Skip to content

Commit

Permalink
Resynchronize EDInfo.h and EDEmitter.cpp.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shantonusen committed Jul 11, 2011
1 parent 3f00e31 commit 7ae0df4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 25 deletions.
19 changes: 14 additions & 5 deletions lib/MC/MCDisassembler/EDInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ enum OperandTypes {
kOperandTypeARMBranchTarget,
kOperandTypeARMSoReg,
kOperandTypeARMSoImm,
kOperandTypeARMRotImm,
kOperandTypeARMSoImm2Part,
kOperandTypeARMPredicate,
kOperandTypeAddrModeImm12,
kOperandTypeLdStSOReg,
kOperandTypeARMAddrMode2,
kOperandTypeARMAddrMode2Offset,
kOperandTypeARMAddrMode3,
Expand All @@ -38,22 +41,28 @@ 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,
kOperandTypeThumb2AddrModeImm8Offset,
kOperandTypeThumb2AddrModeImm12,
kOperandTypeThumb2AddrModeSoReg,
kOperandTypeThumb2AddrModeImm8s4,
kOperandTypeThumb2AddrModeImm8s4Offset,
kOperandTypeThumb2AddrModeReg
kOperandTypeThumb2AddrModeImm8s4Offset
};

enum OperandFlags {
Expand Down
21 changes: 15 additions & 6 deletions lib/MC/MCDisassembler/EDOperand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -78,6 +81,7 @@ EDOperand::EDOperand(const EDDisassembler &disassembler,
numMCOperands = 1;
break;
case kOperandTypeThumb2SoReg:
case kOperandTypeAddrModeImm12:
case kOperandTypeARMAddrMode2Offset:
case kOperandTypeARMAddrMode3Offset:
case kOperandTypeARMAddrMode4:
Expand All @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
27 changes: 13 additions & 14 deletions utils/TableGen/EDEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,27 +653,22 @@ 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

return 1;
}

#undef SOREG
#undef SOIMM
#undef PRED
#undef REG
#undef MEM
#undef LEA
#undef IMM
#undef PCR
#undef MISC

#undef SET

Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 7ae0df4

Please sign in to comment.