Resynchronize EDInfo.h and EDEmitter.cpp.

The enum names as well as order (i.e. value)
had skewed, which means that consumers of the
tablegen-ed table would see different values than
intended. Make both files have a superset of enums,
and add classification as needed for numMCOperands.

Reviewed by Owen Anderson


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134905 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Shantonu Sen 2011-07-11 17:57:30 +00:00
parent 3f00e31706
commit 7ae0df4142
3 changed files with 42 additions and 25 deletions

View File

@ -25,8 +25,11 @@ enum OperandTypes {
kOperandTypeARMBranchTarget,
kOperandTypeARMSoReg,
kOperandTypeARMSoImm,
kOperandTypeARMRotImm,
kOperandTypeARMSoImm2Part,
kOperandTypeARMPredicate,
kOperandTypeAddrModeImm12,
kOperandTypeLdStSOReg,
kOperandTypeARMAddrMode2,
kOperandTypeARMAddrMode2Offset,
kOperandTypeARMAddrMode3,
@ -38,13 +41,20 @@ enum OperandTypes {
kOperandTypeARMAddrMode7,
kOperandTypeARMAddrModePC,
kOperandTypeARMRegisterList,
kOperandTypeARMDPRRegisterList,
kOperandTypeARMSPRRegisterList,
kOperandTypeARMTBAddrMode,
kOperandTypeThumbITMask,
kOperandTypeThumbAddrModeS1,
kOperandTypeThumbAddrModeS2,
kOperandTypeThumbAddrModeS4,
kOperandTypeThumbAddrModeRegS1,
kOperandTypeThumbAddrModeRegS2,
kOperandTypeThumbAddrModeRegS4,
kOperandTypeThumbAddrModeImmS1,
kOperandTypeThumbAddrModeImmS2,
kOperandTypeThumbAddrModeImmS4,
kOperandTypeThumbAddrModeRR,
kOperandTypeThumbAddrModeSP,
kOperandTypeThumbAddrModePC,
kOperandTypeThumb2AddrModeReg,
kOperandTypeThumb2SoReg,
kOperandTypeThumb2SoImm,
kOperandTypeThumb2AddrModeImm8,
@ -52,8 +62,7 @@ enum OperandTypes {
kOperandTypeThumb2AddrModeImm12,
kOperandTypeThumb2AddrModeSoReg,
kOperandTypeThumb2AddrModeImm8s4,
kOperandTypeThumb2AddrModeImm8s4Offset,
kOperandTypeThumb2AddrModeReg
kOperandTypeThumb2AddrModeImm8s4Offset
};
enum OperandFlags {

View File

@ -61,11 +61,14 @@ EDOperand::EDOperand(const EDDisassembler &disassembler,
switch (operandType) {
default:
case kOperandTypeARMRegisterList:
case kOperandTypeARMDPRRegisterList:
case kOperandTypeARMSPRRegisterList:
break;
case kOperandTypeImmediate:
case kOperandTypeRegister:
case kOperandTypeARMBranchTarget:
case kOperandTypeARMSoImm:
case kOperandTypeARMRotImm:
case kOperandTypeThumb2SoImm:
case kOperandTypeARMSoImm2Part:
case kOperandTypeARMPredicate:
@ -78,6 +81,7 @@ EDOperand::EDOperand(const EDDisassembler &disassembler,
numMCOperands = 1;
break;
case kOperandTypeThumb2SoReg:
case kOperandTypeAddrModeImm12:
case kOperandTypeARMAddrMode2Offset:
case kOperandTypeARMAddrMode3Offset:
case kOperandTypeARMAddrMode4:
@ -86,17 +90,22 @@ EDOperand::EDOperand(const EDDisassembler &disassembler,
case kOperandTypeThumb2AddrModeImm8:
case kOperandTypeThumb2AddrModeImm12:
case kOperandTypeThumb2AddrModeImm8s4:
case kOperandTypeThumbAddrModeImmS1:
case kOperandTypeThumbAddrModeImmS2:
case kOperandTypeThumbAddrModeImmS4:
case kOperandTypeThumbAddrModeRR:
case kOperandTypeThumbAddrModeSP:
case kOperandTypeThumbAddrModePC:
numMCOperands = 2;
break;
case kOperandTypeARMSoReg:
case kOperandTypeLdStSOReg:
case kOperandTypeARMAddrMode2:
case kOperandTypeARMAddrMode3:
case kOperandTypeThumb2AddrModeSoReg:
case kOperandTypeThumbAddrModeS1:
case kOperandTypeThumbAddrModeS2:
case kOperandTypeThumbAddrModeS4:
case kOperandTypeThumbAddrModeRegS1:
case kOperandTypeThumbAddrModeRegS2:
case kOperandTypeThumbAddrModeRegS4:
case kOperandTypeARMAddrMode6Offset:
numMCOperands = 3;
break;
@ -270,9 +279,9 @@ int EDOperand::isMemory() {
case kOperandTypeARMAddrMode7:
case kOperandTypeARMAddrModePC:
case kOperandTypeARMBranchTarget:
case kOperandTypeThumbAddrModeS1:
case kOperandTypeThumbAddrModeS2:
case kOperandTypeThumbAddrModeS4:
case kOperandTypeThumbAddrModeRegS1:
case kOperandTypeThumbAddrModeRegS2:
case kOperandTypeThumbAddrModeRegS4:
case kOperandTypeThumbAddrModeRR:
case kOperandTypeThumbAddrModeSP:
case kOperandTypeThumb2SoImm:

View File

@ -653,12 +653,12 @@ static int ARMFlagFromOpName(LiteralConstantEmitter *type,
MISC("t2am_imm8s4_offset", "kOperandTypeThumb2AddrModeImm8s4Offset");
// R, I
MISC("tb_addrmode", "kOperandTypeARMTBAddrMode"); // I
MISC("t_addrmode_rrs1", "kOperandTypeThumbAddrModeRegS"); // R, R
MISC("t_addrmode_rrs2", "kOperandTypeThumbAddrModeRegS"); // R, R
MISC("t_addrmode_rrs4", "kOperandTypeThumbAddrModeRegS"); // R, R
MISC("t_addrmode_is1", "kOperandTypeThumbAddrModeImmS"); // R, I
MISC("t_addrmode_is2", "kOperandTypeThumbAddrModeImmS"); // R, I
MISC("t_addrmode_is4", "kOperandTypeThumbAddrModeImmS"); // R, I
MISC("t_addrmode_rrs1", "kOperandTypeThumbAddrModeRegS1"); // R, R
MISC("t_addrmode_rrs2", "kOperandTypeThumbAddrModeRegS2"); // R, R
MISC("t_addrmode_rrs4", "kOperandTypeThumbAddrModeRegS4"); // R, R
MISC("t_addrmode_is1", "kOperandTypeThumbAddrModeImmS1"); // R, I
MISC("t_addrmode_is2", "kOperandTypeThumbAddrModeImmS2"); // R, I
MISC("t_addrmode_is4", "kOperandTypeThumbAddrModeImmS4"); // R, I
MISC("t_addrmode_rr", "kOperandTypeThumbAddrModeRR"); // R, R
MISC("t_addrmode_sp", "kOperandTypeThumbAddrModeSP"); // R, I
MISC("t_addrmode_pc", "kOperandTypeThumbAddrModePC"); // R, I
@ -666,14 +666,9 @@ static int ARMFlagFromOpName(LiteralConstantEmitter *type,
return 1;
}
#undef SOREG
#undef SOIMM
#undef PRED
#undef REG
#undef MEM
#undef LEA
#undef IMM
#undef PCR
#undef MISC
#undef SET
@ -874,8 +869,12 @@ static void emitCommonEnums(raw_ostream &o, unsigned int &i) {
operandTypes.addEntry("kOperandTypeARMSPRRegisterList");
operandTypes.addEntry("kOperandTypeARMTBAddrMode");
operandTypes.addEntry("kOperandTypeThumbITMask");
operandTypes.addEntry("kOperandTypeThumbAddrModeRegS");
operandTypes.addEntry("kOperandTypeThumbAddrModeImmS");
operandTypes.addEntry("kOperandTypeThumbAddrModeImmS1");
operandTypes.addEntry("kOperandTypeThumbAddrModeImmS2");
operandTypes.addEntry("kOperandTypeThumbAddrModeImmS4");
operandTypes.addEntry("kOperandTypeThumbAddrModeRegS1");
operandTypes.addEntry("kOperandTypeThumbAddrModeRegS2");
operandTypes.addEntry("kOperandTypeThumbAddrModeRegS4");
operandTypes.addEntry("kOperandTypeThumbAddrModeRR");
operandTypes.addEntry("kOperandTypeThumbAddrModeSP");
operandTypes.addEntry("kOperandTypeThumbAddrModePC");