aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/X86DisassemblerTables.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-04-09 04:08:42 +0000
committerCraig Topper <craig.topper@gmail.com>2015-04-09 04:08:42 +0000
commitd434e395576a064160c85a91bb5f05853a48aaa1 (patch)
tree13cfcf0fc0d9c482ed0d0c89b5466c2ac8d23977 /llvm/utils/TableGen/X86DisassemblerTables.cpp
parent903338511bfd613bc6f41fb7c9d156e3fbb5fd57 (diff)
downloadllvm-d434e395576a064160c85a91bb5f05853a48aaa1.zip
llvm-d434e395576a064160c85a91bb5f05853a48aaa1.tar.gz
llvm-d434e395576a064160c85a91bb5f05853a48aaa1.tar.bz2
Don't convert enum to strings just to put them in the uniquing map. Use the enum directly. Only convert to a string for printing.
llvm-svn: 234463
Diffstat (limited to 'llvm/utils/TableGen/X86DisassemblerTables.cpp')
-rw-r--r--llvm/utils/TableGen/X86DisassemblerTables.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/llvm/utils/TableGen/X86DisassemblerTables.cpp b/llvm/utils/TableGen/X86DisassemblerTables.cpp
index e7e292d..9d55d14 100644
--- a/llvm/utils/TableGen/X86DisassemblerTables.cpp
+++ b/llvm/utils/TableGen/X86DisassemblerTables.cpp
@@ -597,7 +597,7 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o,
o << "static const struct OperandSpecifier x86OperandSets[]["
<< X86_MAX_OPERANDS << "] = {\n";
- typedef std::vector<std::pair<const char *, const char *> > OperandListTy;
+ typedef std::vector<std::pair<OperandEncoding, OperandType> > OperandListTy;
std::map<OperandListTy, unsigned> OperandSets;
unsigned OperandSetNum = 0;
@@ -606,12 +606,10 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o,
for (unsigned OperandIndex = 0; OperandIndex < X86_MAX_OPERANDS;
++OperandIndex) {
- const char *Encoding =
- stringForOperandEncoding((OperandEncoding)InstructionSpecifiers[Index]
- .operands[OperandIndex].encoding);
- const char *Type =
- stringForOperandType((OperandType)InstructionSpecifiers[Index]
- .operands[OperandIndex].type);
+ OperandEncoding Encoding = (OperandEncoding)InstructionSpecifiers[Index]
+ .operands[OperandIndex].encoding;
+ OperandType Type = (OperandType)InstructionSpecifiers[Index]
+ .operands[OperandIndex].type;
OperandList.push_back(std::make_pair(Encoding, Type));
}
unsigned &N = OperandSets[OperandList];
@@ -621,8 +619,9 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o,
o << " { /* " << (OperandSetNum - 1) << " */\n";
for (unsigned i = 0, e = OperandList.size(); i != e; ++i) {
- o << " { " << OperandList[i].first << ", "
- << OperandList[i].second << " },\n";
+ const char *Encoding = stringForOperandEncoding(OperandList[i].first);
+ const char *Type = stringForOperandType(OperandList[i].second);
+ o << " { " << Encoding << ", " << Type << " },\n";
}
o << " },\n";
}
@@ -640,12 +639,10 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o,
OperandListTy OperandList;
for (unsigned OperandIndex = 0; OperandIndex < X86_MAX_OPERANDS;
++OperandIndex) {
- const char *Encoding =
- stringForOperandEncoding((OperandEncoding)InstructionSpecifiers[index]
- .operands[OperandIndex].encoding);
- const char *Type =
- stringForOperandType((OperandType)InstructionSpecifiers[index]
- .operands[OperandIndex].type);
+ OperandEncoding Encoding = (OperandEncoding)InstructionSpecifiers[index]
+ .operands[OperandIndex].encoding;
+ OperandType Type = (OperandType)InstructionSpecifiers[index]
+ .operands[OperandIndex].type;
OperandList.push_back(std::make_pair(Encoding, Type));
}
o.indent(i * 2) << (OperandSets[OperandList] - 1) << ",\n";