llvm.org GIT mirror llvm / dd099e1
Only emit the AvailableFeatures variable if it's used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129124 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 9 years ago
1 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
624624 unsigned getOpIndex(StringRef Op) { return OpMap[Op]; }
625625 bool isOpMapped(StringRef Op) { return OpMap.find(Op) != OpMap.end(); }
626626
627 void print(raw_ostream &O) {
627 bool print(raw_ostream &O) {
628628 if (Conds.empty() && ReqFeatures.empty()) {
629629 O.indent(6) << "return true;\n";
630 return;
630 return false;
631631 }
632632
633633 O << "if (";
674674
675675 O.indent(6) << "break;\n";
676676 O.indent(4) << '}';
677 return !ReqFeatures.empty();
677678 }
678679
679680 bool operator==(const IAPrinter &RHS) {
936937
937938 std::string Cases;
938939 raw_string_ostream CasesO(Cases);
940 bool NeedAvailableFeatures = false;
939941
940942 for (std::map >::iterator
941943 I = IAPrinterMap.begin(), E = IAPrinterMap.end(); I != E; ++I) {
966968 II = UniqueIAPs.begin(), IE = UniqueIAPs.end(); II != IE; ++II) {
967969 IAPrinter *IAP = *II;
968970 CasesO.indent(4);
969 IAP->print(CasesO);
971 NeedAvailableFeatures |= IAP->print(CasesO);
970972 CasesO << '\n';
971973 }
972974
982984
983985 O.indent(2) << "StringRef AsmString;\n";
984986 O.indent(2) << "std::map OpMap;\n";
985 O.indent(2) << "unsigned AvailableFeatures = getAvailableFeatures();\n\n";
987 if (NeedAvailableFeatures)
988 O.indent(2) << "unsigned AvailableFeatures = getAvailableFeatures();\n\n";
986989 O.indent(2) << "switch (MI->getOpcode()) {\n";
987990 O.indent(2) << "default: return true;\n";
988991 O << CasesO.str();