virtual Inst parseInstMnemo(const string& prefix, Scanner& scanner, Brigantine& bw, int* vx) const { Inst res = GenericExtension::parseInstMnemo(prefix, scanner, bw, vx); const ExtInstDesc* desc = getInstDesc(res.opcode()); if (desc->parser == parseMnemoBasicNoType) res.type() = BRIG_TYPE_B32; return res; }
string ExtManager::getExtInstMnemo(Inst inst) const { assert(inst); if (const Extension* e = getByProp(PROP_OPCODE, inst.opcode())) return e->getMnemo(inst); return ""; }
unsigned ExtManager::getDefRounding(Inst inst, unsigned machineModel, unsigned profile) const { assert(inst); assert(machineModel == BRIG_MACHINE_SMALL || machineModel == BRIG_MACHINE_LARGE); assert(profile == BRIG_PROFILE_BASE || profile == BRIG_PROFILE_FULL); if (isCoreInst(inst)) { return getCoreDefRounding(inst, machineModel, profile); } else if (const Extension* e = getByProp(PROP_OPCODE, inst.opcode())) { return e->getDefRounding(inst, machineModel, profile); } return BRIG_ROUND_NONE; }
bool ExtManager::validateInst(Inst inst, unsigned model, unsigned profile) const { assert(inst); assert(model == BRIG_MACHINE_SMALL || model == BRIG_MACHINE_LARGE); assert(profile == BRIG_PROFILE_BASE || profile == BRIG_PROFILE_FULL); if (isCoreInst(inst)) { InstValidator(model, profile).validateInst(inst); return true; } else if (const Extension* e = getByProp(PROP_OPCODE, inst.opcode())) { return e->validateInst(inst, model, profile); } return false; }
unsigned ExtManager::getOperandType(Inst inst, unsigned operandIdx, unsigned machineModel, unsigned profile) const { assert(inst); assert(operandIdx < MAX_OPERANDS_NUM); assert(machineModel == BRIG_MACHINE_SMALL || machineModel == BRIG_MACHINE_LARGE); assert(profile == BRIG_PROFILE_BASE || profile == BRIG_PROFILE_FULL); if (isCoreInst(inst)) { return getCoreOperandType(inst, operandIdx, machineModel, profile); } else if (const Extension* e = getByProp(PROP_OPCODE, inst.opcode())) { return e->getOperandType(inst, operandIdx, machineModel, profile); } return BRIG_TYPE_INVALID; }
virtual string getMnemo(Inst inst) const { assert(inst); unsigned opcode = inst.opcode(); const ExtInstDesc* desc = getInstDesc(opcode); if (opcode == BRIG_OPCODE_AMD_GCN_APPEND || opcode == BRIG_OPCODE_AMD_GCN_CONSUME) { return string(desc->name) + "_" + type2str(inst.type()); } else if (desc->parser == parseMnemoBasicNoType) { return string(desc->name); } else { return ""; } }
template <typename Visitor> void enumerateFields_gen(Inst obj, Visitor & vis) { enumerateFields_gen(Code(obj), vis); vis(obj.opcode(),"opcode"); vis(obj.type(),"type"); vis(obj.operands(),"operands"); }