diff options
author | Chris Lattner <sabre@nondot.org> | 2005-01-22 18:58:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-01-22 18:58:51 +0000 |
commit | d6488671736d0a5aaee1218748b94d8c68f33716 (patch) | |
tree | b218490b3ed80a627edef94927a70f1eea52b855 /utils/TableGen/InstrInfoEmitter.cpp | |
parent | 615ed993e115f8bc97ff0678aa861629fec93880 (diff) | |
download | external_llvm-d6488671736d0a5aaee1218748b94d8c68f33716.zip external_llvm-d6488671736d0a5aaee1218748b94d8c68f33716.tar.gz external_llvm-d6488671736d0a5aaee1218748b94d8c68f33716.tar.bz2 |
Refactor code for numbering instructions into CodeGenTarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19758 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/InstrInfoEmitter.cpp')
-rw-r--r-- | utils/TableGen/InstrInfoEmitter.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp index 113bc98..bde5fdc 100644 --- a/utils/TableGen/InstrInfoEmitter.cpp +++ b/utils/TableGen/InstrInfoEmitter.cpp @@ -26,7 +26,6 @@ void InstrInfoEmitter::runEnums(std::ostream &OS) { // We must emit the PHI opcode first... Record *InstrInfo = Target.getInstructionSet(); - Record *PHI = InstrInfo->getValueAsDef("PHIInst"); std::string Namespace = Target.inst_begin()->second.Namespace; @@ -34,15 +33,13 @@ void InstrInfoEmitter::runEnums(std::ostream &OS) { OS << "namespace " << Namespace << " {\n"; OS << " enum {\n"; - OS << " " << PHI->getName() << ", \t// 0 (fixed for all targets)\n"; - - // Print out the rest of the instructions now. - unsigned i = 0; - for (CodeGenTarget::inst_iterator II = Target.inst_begin(), - E = Target.inst_end(); II != E; ++II) - if (II->second.TheDef != PHI) - OS << " " << II->first << ", \t// " << ++i << "\n"; - + std::vector<const CodeGenInstruction*> NumberedInstructions; + Target.getInstructionsByEnumValue(NumberedInstructions); + + for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) { + OS << " " << NumberedInstructions[i]->TheDef->getName() + << ", \t// " << i << "\n"; + } OS << " };\n"; if (!Namespace.empty()) OS << "}\n"; |