diff options
author | Chris Lattner <sabre@nondot.org> | 2005-10-23 22:33:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-10-23 22:33:08 +0000 |
commit | d4d079785187ce923edc245aee527e4768b1d180 (patch) | |
tree | a4b476ad0430b868dc7c460ed716c38f6ee7a06d | |
parent | aa38be17c89fbc059c51f083a9161e4e440a6dd5 (diff) |
Add the needed #include, emit enums with the sizes of tables, remove
definitions from the LLVM namespace, since they are all static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23907 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | utils/TableGen/SubtargetEmitter.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/utils/TableGen/SubtargetEmitter.cpp b/utils/TableGen/SubtargetEmitter.cpp index 5318173b0d..6d3542ea3e 100644 --- a/utils/TableGen/SubtargetEmitter.cpp +++ b/utils/TableGen/SubtargetEmitter.cpp @@ -57,7 +57,7 @@ void SubtargetEmitter::run(std::ostream &OS) { RecordList Processors = Records.getAllDerivedDefinitions("Processor"); sort(Processors.begin(), Processors.end(), LessRecordFieldName()); - OS << "namespace llvm {\n\n"; + OS << "#include \"llvm/Target/SubtargetFeature.h\"\n\n"; { // Feature enumeration int i = 0; @@ -78,9 +78,9 @@ void SubtargetEmitter::run(std::ostream &OS) { } { // Feature key values - OS << "\n\n" - << "/// Sorted (by key) array of values for CPU features.\n" - << "static SubtargetFeatureKV FeatureKV[] = {\n"; + OS << "\n" + << "// Sorted (by key) array of values for CPU features.\n" + << "static llvm::SubtargetFeatureKV FeatureKV[] = {\n"; for (RecordListIter RI = Features.begin(), E = Features.end(); RI != E;) { Record *R = *RI++; std::string Instance = R->getName(); @@ -96,9 +96,9 @@ void SubtargetEmitter::run(std::ostream &OS) { } { // CPU key values - OS << "\n\n" - << "/// Sorted (by key) array of values for CPU subtype.\n" - << "static const SubtargetFeatureKV SubTypeKV[] = {\n"; + OS << "\n" + << "// Sorted (by key) array of values for CPU subtype.\n" + << "static const llvm::SubtargetFeatureKV SubTypeKV[] = {\n"; for (RecordListIter RI = Processors.begin(), E = Processors.end(); RI != E;) { Record *R = *RI++; @@ -131,6 +131,9 @@ void SubtargetEmitter::run(std::ostream &OS) { } OS << "};\n"; } - - OS << "\n} // End llvm namespace \n"; + + OS<<"\nenum {\n"; + OS<<" FeatureKVSize = sizeof(FeatureKV)/sizeof(llvm::SubtargetFeatureKV),\n"; + OS<<" SubTypeKVSize = sizeof(SubTypeKV)/sizeof(llvm::SubtargetFeatureKV)\n"; + OS<<"};\n"; } |