mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Put instruction names into the first non TargetInstrInfo namespace found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28043 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1c174c62b8
commit
eff5c36238
@ -28,23 +28,31 @@ void InstrInfoEmitter::runEnums(std::ostream &OS) {
|
||||
// We must emit the PHI opcode first...
|
||||
Record *InstrInfo = Target.getInstructionSet();
|
||||
|
||||
std::string Namespace = Target.inst_begin()->second.Namespace;
|
||||
|
||||
if (!Namespace.empty())
|
||||
OS << "namespace " << Namespace << " {\n";
|
||||
OS << " enum {\n";
|
||||
std::string Namespace;
|
||||
for (CodeGenTarget::inst_iterator II = Target.inst_begin(),
|
||||
E = Target.inst_end(); II != E; ++II) {
|
||||
if (II->second.Namespace != "TargetInstrInfo") {
|
||||
Namespace = II->second.Namespace;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Namespace.empty()) {
|
||||
std::cerr << "No instructions defined!\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::vector<const CodeGenInstruction*> NumberedInstructions;
|
||||
Target.getInstructionsByEnumValue(NumberedInstructions);
|
||||
|
||||
OS << "namespace " << Namespace << " {\n";
|
||||
OS << " enum {\n";
|
||||
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
|
||||
OS << " " << NumberedInstructions[i]->TheDef->getName()
|
||||
<< ", \t// " << i << "\n";
|
||||
<< "\t= " << i << ",\n";
|
||||
}
|
||||
OS << " INSTRUCTION_LIST_END\n";
|
||||
OS << " };\n";
|
||||
if (!Namespace.empty())
|
||||
OS << "}\n";
|
||||
OS << " INSTRUCTION_LIST_END = " << NumberedInstructions.size() << "\n";
|
||||
OS << " };\n}\n";
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user