[llvm-commits] [llvm] r129124 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
Bill Wendling
isanbard at gmail.com
Thu Apr 7 21:08:57 PDT 2011
Author: void
Date: Thu Apr 7 23:08:57 2011
New Revision: 129124
URL: http://llvm.org/viewvc/llvm-project?rev=129124&view=rev
Log:
Only emit the AvailableFeatures variable if it's used.
Modified:
llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=129124&r1=129123&r2=129124&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Thu Apr 7 23:08:57 2011
@@ -625,10 +625,10 @@
unsigned getOpIndex(StringRef Op) { return OpMap[Op]; }
bool isOpMapped(StringRef Op) { return OpMap.find(Op) != OpMap.end(); }
- void print(raw_ostream &O) {
+ bool print(raw_ostream &O) {
if (Conds.empty() && ReqFeatures.empty()) {
O.indent(6) << "return true;\n";
- return;
+ return false;
}
O << "if (";
@@ -675,6 +675,7 @@
O.indent(6) << "break;\n";
O.indent(4) << '}';
+ return !ReqFeatures.empty();
}
bool operator==(const IAPrinter &RHS) {
@@ -937,6 +938,7 @@
std::string Cases;
raw_string_ostream CasesO(Cases);
+ bool NeedAvailableFeatures = false;
for (std::map<std::string, std::vector<IAPrinter*> >::iterator
I = IAPrinterMap.begin(), E = IAPrinterMap.end(); I != E; ++I) {
@@ -967,7 +969,7 @@
II = UniqueIAPs.begin(), IE = UniqueIAPs.end(); II != IE; ++II) {
IAPrinter *IAP = *II;
CasesO.indent(4);
- IAP->print(CasesO);
+ NeedAvailableFeatures |= IAP->print(CasesO);
CasesO << '\n';
}
@@ -983,7 +985,8 @@
O.indent(2) << "StringRef AsmString;\n";
O.indent(2) << "std::map<StringRef, unsigned> OpMap;\n";
- O.indent(2) << "unsigned AvailableFeatures = getAvailableFeatures();\n\n";
+ if (NeedAvailableFeatures)
+ O.indent(2) << "unsigned AvailableFeatures = getAvailableFeatures();\n\n";
O.indent(2) << "switch (MI->getOpcode()) {\n";
O.indent(2) << "default: return true;\n";
O << CasesO.str();
More information about the llvm-commits
mailing list