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
This commit is contained in:
Chris Lattner 2005-10-23 22:33:08 +00:00
parent aa38be17c8
commit d4d0797851

View File

@ -57,7 +57,7 @@ void SubtargetEmitter::run(std::ostream &OS) {
RecordList Processors = Records.getAllDerivedDefinitions("Processor"); RecordList Processors = Records.getAllDerivedDefinitions("Processor");
sort(Processors.begin(), Processors.end(), LessRecordFieldName()); sort(Processors.begin(), Processors.end(), LessRecordFieldName());
OS << "namespace llvm {\n\n"; OS << "#include \"llvm/Target/SubtargetFeature.h\"\n\n";
{ // Feature enumeration { // Feature enumeration
int i = 0; int i = 0;
@ -78,9 +78,9 @@ void SubtargetEmitter::run(std::ostream &OS) {
} }
{ // Feature key values { // Feature key values
OS << "\n\n" OS << "\n"
<< "/// Sorted (by key) array of values for CPU features.\n" << "// Sorted (by key) array of values for CPU features.\n"
<< "static SubtargetFeatureKV FeatureKV[] = {\n"; << "static llvm::SubtargetFeatureKV FeatureKV[] = {\n";
for (RecordListIter RI = Features.begin(), E = Features.end(); RI != E;) { for (RecordListIter RI = Features.begin(), E = Features.end(); RI != E;) {
Record *R = *RI++; Record *R = *RI++;
std::string Instance = R->getName(); std::string Instance = R->getName();
@ -96,9 +96,9 @@ void SubtargetEmitter::run(std::ostream &OS) {
} }
{ // CPU key values { // CPU key values
OS << "\n\n" OS << "\n"
<< "/// Sorted (by key) array of values for CPU subtype.\n" << "// Sorted (by key) array of values for CPU subtype.\n"
<< "static const SubtargetFeatureKV SubTypeKV[] = {\n"; << "static const llvm::SubtargetFeatureKV SubTypeKV[] = {\n";
for (RecordListIter RI = Processors.begin(), E = Processors.end(); for (RecordListIter RI = Processors.begin(), E = Processors.end();
RI != E;) { RI != E;) {
Record *R = *RI++; Record *R = *RI++;
@ -132,5 +132,8 @@ void SubtargetEmitter::run(std::ostream &OS) {
OS << "};\n"; 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";
} }