diff options
| author | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-03-24 12:56:59 +0000 |
|---|---|---|
| committer | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-03-24 12:56:59 +0000 |
| commit | 29704e7fb425a9cdf0e134996be3c0302a71feed (patch) | |
| tree | d198e67a086ed876f28bdbfd6f6156f8da2032f3 /llvm/utils | |
| parent | d5cc45f192cbc1d6ad2566cbf999e1edfb3a525a (diff) | |
| download | bcm5719-llvm-29704e7fb425a9cdf0e134996be3c0302a71feed.tar.gz bcm5719-llvm-29704e7fb425a9cdf0e134996be3c0302a71feed.zip | |
Revert "Use std::bitset for SubtargetFeatures"
This reverts commit r233055.
It still causes buildbot failures (gcc running out of memory on several platforms, and a self-host failure on arm), although less than the previous time.
llvm-svn: 233068
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/TableGen/AsmMatcherEmitter.cpp | 12 | ||||
| -rw-r--r-- | llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | 10 | ||||
| -rw-r--r-- | llvm/utils/TableGen/InstrInfoEmitter.cpp | 8 | ||||
| -rw-r--r-- | llvm/utils/TableGen/SubtargetEmitter.cpp | 57 |
4 files changed, 46 insertions, 41 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 65d930ad858..159bc23fbff 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -2248,7 +2248,7 @@ static void emitComputeAvailableFeatures(AsmMatcherInfo &Info, Info.AsmParser->getValueAsString("AsmParserClassName"); OS << "uint64_t " << Info.Target.getName() << ClassName << "::\n" - << "ComputeAvailableFeatures(const FeatureBitset& FB) const {\n"; + << "ComputeAvailableFeatures(uint64_t FB) const {\n"; OS << " uint64_t Features = 0;\n"; for (const auto &SF : Info.SubtargetFeatures) { const SubtargetFeatureInfo &SFI = SF.second; @@ -2270,10 +2270,12 @@ static void emitComputeAvailableFeatures(AsmMatcherInfo &Info, Cond = Cond.substr(1); } - OS << "("; + OS << "((FB & " << Info.Target.getName() << "::" << Cond << ")"; if (Neg) - OS << "!"; - OS << "FB[" << Info.Target.getName() << "::" << Cond << "])"; + OS << " == 0"; + else + OS << " != 0"; + OS << ")"; if (Comma.second.empty()) break; @@ -2643,7 +2645,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << "#undef GET_ASSEMBLER_HEADER\n"; OS << " // This should be included into the middle of the declaration of\n"; OS << " // your subclasses implementation of MCTargetAsmParser.\n"; - OS << " uint64_t ComputeAvailableFeatures(const FeatureBitset& FB) const;\n"; + OS << " uint64_t ComputeAvailableFeatures(uint64_t FeatureBits) const;\n"; OS << " void convertToMCInst(unsigned Kind, MCInst &Inst, " << "unsigned Opcode,\n" << " const OperandVector " diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index 30812fb9548..c69b89b9bc0 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -848,7 +848,7 @@ emitPredicateFunction(formatted_raw_ostream &OS, PredicateSet &Predicates, // The predicate function is just a big switch statement based on the // input predicate index. OS.indent(Indentation) << "static bool checkDecoderPredicate(unsigned Idx, " - << "const FeatureBitset& Bits) {\n"; + << "uint64_t Bits) {\n"; Indentation += 2; if (!Predicates.empty()) { OS.indent(Indentation) << "switch (Idx) {\n"; @@ -1102,10 +1102,10 @@ unsigned FilterChooser::getDecoderIndex(DecoderSet &Decoders, static void emitSinglePredicateMatch(raw_ostream &o, StringRef str, const std::string &PredicateNamespace) { if (str[0] == '!') - o << "!Bits[" << PredicateNamespace << "::" - << str.slice(1,str.size()) << "]"; + o << "!(Bits & " << PredicateNamespace << "::" + << str.slice(1,str.size()) << ")"; else - o << "Bits[" << PredicateNamespace << "::" << str << "]"; + o << "(Bits & " << PredicateNamespace << "::" << str << ")"; } bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation, @@ -2010,7 +2010,7 @@ static void emitDecodeInstruction(formatted_raw_ostream &OS) { << " InsnType insn, uint64_t Address,\n" << " const void *DisAsm,\n" << " const MCSubtargetInfo &STI) {\n" - << " const FeatureBitset& Bits = STI.getFeatureBits();\n" + << " uint64_t Bits = STI.getFeatureBits();\n" << "\n" << " const uint8_t *Ptr = DecodeTable;\n" << " uint32_t CurFieldValue = 0;\n" diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index 798c407e900..f999326bc97 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -549,15 +549,15 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num, CodeGenTarget &Target = CDP.getTargetInfo(); if (Inst.HasComplexDeprecationPredicate) // Emit a function pointer to the complex predicate method. - OS << ", { } " + OS << ",0" << ",&get" << Inst.DeprecatedReason << "DeprecationInfo"; else if (!Inst.DeprecatedReason.empty()) // Emit the Subtarget feature. - OS << ", { " << Target.getInstNamespace() << "::" << Inst.DeprecatedReason - << "} ,nullptr"; + OS << "," << Target.getInstNamespace() << "::" << Inst.DeprecatedReason + << ",nullptr"; else // Instruction isn't deprecated. - OS << ", { } ,nullptr"; + OS << ",0,nullptr"; OS << " }, // Inst #" << Num << " = " << Inst.TheDef->getName() << "\n"; } diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp index 831a7732ee4..e5c62fa1375 100644 --- a/llvm/utils/TableGen/SubtargetEmitter.cpp +++ b/llvm/utils/TableGen/SubtargetEmitter.cpp @@ -16,7 +16,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/MC/MCInstrItineraries.h" -#include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Format.h" #include "llvm/TableGen/Error.h" @@ -63,7 +62,7 @@ class SubtargetEmitter { CodeGenSchedModels &SchedModels; std::string Target; - void Enumeration(raw_ostream &OS, const char *ClassName); + void Enumeration(raw_ostream &OS, const char *ClassName, bool isBits); unsigned FeatureKeyValues(raw_ostream &OS); unsigned CPUKeyValues(raw_ostream &OS); void FormItineraryStageString(const std::string &Names, @@ -113,7 +112,8 @@ public: // Enumeration - Emit the specified class as an enumeration. // void SubtargetEmitter::Enumeration(raw_ostream &OS, - const char *ClassName) { + const char *ClassName, + bool isBits) { // Get all records of class and sort std::vector<Record*> DefList = Records.getAllDerivedDefinitions(ClassName); std::sort(DefList.begin(), DefList.end(), LessRecord()); @@ -121,8 +121,8 @@ void SubtargetEmitter::Enumeration(raw_ostream &OS, unsigned N = DefList.size(); if (N == 0) return; - if (N > MAX_SUBTARGET_FEATURES) { - errs() << "Too many subtarget features! Bump MAX_SUBTARGET_FEATURES."; + if (N > 64) { + errs() << "Too many (> 64) subtarget features!\n"; exit(1); } @@ -137,14 +137,21 @@ void SubtargetEmitter::Enumeration(raw_ostream &OS, Record *Def = DefList[i]; // Get and emit name - OS << " " << Def->getName() << " = " << i; + OS << " " << Def->getName(); + + // If bit flags then emit expression (1 << i) + if (isBits) OS << " = " << " 1ULL << " << i; + + // Depending on 'if more in the list' emit comma if (++i < N) OS << ","; OS << "\n"; } - // Close enumeration and namespace - OS << "};\n}\n"; + // Close enumeration + OS << "};\n"; + + OS << "}\n"; } // @@ -178,24 +185,22 @@ unsigned SubtargetEmitter::FeatureKeyValues(raw_ostream &OS) { if (CommandLineName.empty()) continue; - // Emit as { "feature", "description", { featureEnum }, { i1 , i2 , ... , in } } + // Emit as { "feature", "description", featureEnum, i1 | i2 | ... | in } OS << " { " << "\"" << CommandLineName << "\", " << "\"" << Desc << "\", " - << "{ " << Target << "::" << Name << " }, "; + << Target << "::" << Name << ", "; const std::vector<Record*> &ImpliesList = Feature->getValueAsListOfDefs("Implies"); if (ImpliesList.empty()) { - OS << "{ }"; + OS << "0ULL"; } else { - OS << "{ "; for (unsigned j = 0, M = ImpliesList.size(); j < M;) { OS << Target << "::" << ImpliesList[j]->getName(); - if (++j < M) OS << ", "; + if (++j < M) OS << " | "; } - OS << " }"; } OS << " }"; @@ -237,24 +242,22 @@ unsigned SubtargetEmitter::CPUKeyValues(raw_ostream &OS) { const std::vector<Record*> &FeatureList = Processor->getValueAsListOfDefs("Features"); - // Emit as { "cpu", "description", { f1 , f2 , ... fn } }, + // Emit as { "cpu", "description", f1 | f2 | ... fn }, OS << " { " << "\"" << Name << "\", " << "\"Select the " << Name << " processor\", "; if (FeatureList.empty()) { - OS << "{ }"; + OS << "0ULL"; } else { - OS << "{ "; for (unsigned j = 0, M = FeatureList.size(); j < M;) { OS << Target << "::" << FeatureList[j]->getName(); - if (++j < M) OS << ", "; + if (++j < M) OS << " | "; } - OS << " }"; } - // The { } is for the "implies" section of this data structure. - OS << ", { } }"; + // The "0" is for the "implies" section of this data structure. + OS << ", 0ULL }"; // Depending on 'if more in the list' emit comma if (++i < N) OS << ","; @@ -1382,7 +1385,7 @@ void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS, } OS << " InitMCProcessorInfo(CPU, FS);\n" - << " const FeatureBitset& Bits = getFeatureBits();\n"; + << " uint64_t Bits = getFeatureBits();\n"; for (unsigned i = 0; i < Features.size(); i++) { // Next record @@ -1392,12 +1395,12 @@ void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS, const std::string &Attribute = R->getValueAsString("Attribute"); if (Value=="true" || Value=="false") - OS << " if (Bits[" << Target << "::" - << Instance << "]) " + OS << " if ((Bits & " << Target << "::" + << Instance << ") != 0) " << Attribute << " = " << Value << ";\n"; else - OS << " if (Bits[" << Target << "::" - << Instance << "] && " + OS << " if ((Bits & " << Target << "::" + << Instance << ") != 0 && " << Attribute << " < " << Value << ") " << Attribute << " = " << Value << ";\n"; } @@ -1415,7 +1418,7 @@ void SubtargetEmitter::run(raw_ostream &OS) { OS << "#undef GET_SUBTARGETINFO_ENUM\n"; OS << "namespace llvm {\n"; - Enumeration(OS, "SubtargetFeature"); + Enumeration(OS, "SubtargetFeature", true); OS << "} // End llvm namespace \n"; OS << "#endif // GET_SUBTARGETINFO_ENUM\n\n"; |

