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 /utils/TableGen/SubtargetEmitter.cpp | |
parent | aa38be17c89fbc059c51f083a9161e4e440a6dd5 (diff) | |
download | external_llvm-d4d079785187ce923edc245aee527e4768b1d180.zip external_llvm-d4d079785187ce923edc245aee527e4768b1d180.tar.gz external_llvm-d4d079785187ce923edc245aee527e4768b1d180.tar.bz2 |
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
Diffstat (limited to 'utils/TableGen/SubtargetEmitter.cpp')
-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 5318173..6d3542e 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"; } |