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

View File

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

View File

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