Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
string ExtManager::getExtInstMnemo(Inst inst) const
{
    assert(inst);

    if (const Extension* e = getByProp(PROP_OPCODE, inst.opcode())) return e->getMnemo(inst);
    return "";
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
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;
}
Ejemplo n.º 6
0
    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 "";
        }
    }
Ejemplo n.º 7
0
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");
}