[llvm-commits] [llvm] r133979 - /llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
Evan Cheng
evan.cheng at apple.com
Mon Jun 27 18:36:01 PDT 2011
Author: evancheng
Date: Mon Jun 27 20:36:01 2011
New Revision: 133979
URL: http://llvm.org/viewvc/llvm-project?rev=133979&view=rev
Log:
Alternative name enum should go into the enum portion.
Modified:
llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=133979&r1=133978&r2=133979&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Mon Jun 27 20:36:01 2011
@@ -57,7 +57,8 @@
Target.getRegisterClasses();
if (!RegisterClasses.empty()) {
OS << "\n// Register classes\n";
- OS << "namespace " << RegisterClasses[0].Namespace << " {\n";
+ if (!Namespace.empty())
+ OS << "namespace " << Namespace << " {\n";
OS << "enum {\n";
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
if (i) OS << ",\n";
@@ -65,9 +66,27 @@
OS << " = " << i;
}
OS << "\n };\n";
- OS << "}\n";
+ if (!Namespace.empty())
+ OS << "}\n";
+ }
+
+ const std::vector<Record*> RegAltNameIndices = Target.getRegAltNameIndices();
+ // If the only definition is the default NoRegAltName, we don't need to
+ // emit anything.
+ if (RegAltNameIndices.size() > 1) {
+ OS << "\n// Register alternate name indices\n";
+ if (!Namespace.empty())
+ OS << "namespace " << Namespace << " {\n";
+ OS << "enum {\n";
+ for (unsigned i = 0, e = RegAltNameIndices.size(); i != e; ++i)
+ OS << " " << RegAltNameIndices[i]->getName() << ",\t// " << i << "\n";
+ OS << " NUM_TARGET_REG_ALT_NAMES = " << RegAltNameIndices.size() << "\n";
+ OS << "};\n";
+ if (!Namespace.empty())
+ OS << "}\n";
}
+
OS << "} // End llvm namespace \n";
OS << "#endif // GET_REGINFO_ENUM\n\n";
}
@@ -112,18 +131,6 @@
OS << "0 };\n";
}
- const std::vector<Record*> RegAltNameIndices = Target.getRegAltNameIndices();
- // If the only definition is the default NoRegAltName, we don't need to
- // emit anything.
- if (RegAltNameIndices.size() > 1) {
- OS << "\n// Register alternate name indices\n";
- OS << "enum {\n";
- for (unsigned i = 0, e = RegAltNameIndices.size(); i != e; ++i)
- OS << " " << RegAltNameIndices[i]->getName() << ",\t// " << i << "\n";
- OS << " NUM_TARGET_REG_ALT_NAMES = " << RegAltNameIndices.size() << "\n";
- OS << "};\n";
- }
-
// Emit the empty sub-registers list
OS << " const unsigned Empty_SubRegsSet[] = { 0 };\n";
// Loop over all of the registers which have sub-registers, emitting the
More information about the llvm-commits
mailing list