diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h --- a/llvm/utils/TableGen/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h @@ -1145,7 +1145,6 @@ RecordKeeper &Records; CodeGenTarget Target; CodeGenIntrinsicTable Intrinsics; - CodeGenIntrinsicTable TgtIntrinsics; std::map SDNodes; std::map, LessRecordByID> @@ -1211,24 +1210,18 @@ const CodeGenIntrinsic &getIntrinsic(Record *R) const { for (unsigned i = 0, e = Intrinsics.size(); i != e; ++i) if (Intrinsics[i].TheDef == R) return Intrinsics[i]; - for (unsigned i = 0, e = TgtIntrinsics.size(); i != e; ++i) - if (TgtIntrinsics[i].TheDef == R) return TgtIntrinsics[i]; llvm_unreachable("Unknown intrinsic!"); } const CodeGenIntrinsic &getIntrinsicInfo(unsigned IID) const { if (IID-1 < Intrinsics.size()) return Intrinsics[IID-1]; - if (IID-Intrinsics.size()-1 < TgtIntrinsics.size()) - return TgtIntrinsics[IID-Intrinsics.size()-1]; llvm_unreachable("Bad intrinsic ID!"); } unsigned getIntrinsicID(Record *R) const { for (unsigned i = 0, e = Intrinsics.size(); i != e; ++i) if (Intrinsics[i].TheDef == R) return i; - for (unsigned i = 0, e = TgtIntrinsics.size(); i != e; ++i) - if (TgtIntrinsics[i].TheDef == R) return i + Intrinsics.size(); llvm_unreachable("Unknown intrinsic!"); } @@ -1285,8 +1278,6 @@ return intrinsic_wo_chain_sdnode; } - bool hasTargetIntrinsics() { return !TgtIntrinsics.empty(); } - unsigned allocateScope() { return ++NumScopes; } bool operandHasDefault(Record *Op) const { diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -3028,8 +3028,7 @@ : Records(R), Target(R), LegalVTS(Target.getLegalValueTypes()), PatternRewriter(PatternRewriter) { - Intrinsics = CodeGenIntrinsicTable(Records, false); - TgtIntrinsics = CodeGenIntrinsicTable(Records, true); + Intrinsics = CodeGenIntrinsicTable(Records); ParseNodeInfo(); ParseNodeTransforms(); ParseComplexPatterns(); diff --git a/llvm/utils/TableGen/CodeGenIntrinsics.h b/llvm/utils/TableGen/CodeGenIntrinsics.h --- a/llvm/utils/TableGen/CodeGenIntrinsics.h +++ b/llvm/utils/TableGen/CodeGenIntrinsics.h @@ -176,7 +176,7 @@ }; std::vector Targets; - explicit CodeGenIntrinsicTable(const RecordKeeper &RC, bool TargetOnly); + explicit CodeGenIntrinsicTable(const RecordKeeper &RC); CodeGenIntrinsicTable() = default; bool empty() const { return Intrinsics.empty(); } diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -574,17 +574,14 @@ // CodeGenIntrinsic Implementation //===----------------------------------------------------------------------===// -CodeGenIntrinsicTable::CodeGenIntrinsicTable(const RecordKeeper &RC, - bool TargetOnly) { +CodeGenIntrinsicTable::CodeGenIntrinsicTable(const RecordKeeper &RC) { std::vector Defs = RC.getAllDerivedDefinitions("Intrinsic"); Intrinsics.reserve(Defs.size()); - for (unsigned I = 0, e = Defs.size(); I != e; ++I) { - bool isTarget = Defs[I]->getValueAsBit("isTarget"); - if (isTarget == TargetOnly) - Intrinsics.push_back(CodeGenIntrinsic(Defs[I])); - } + for (unsigned I = 0, e = Defs.size(); I != e; ++I) + Intrinsics.push_back(CodeGenIntrinsic(Defs[I])); + llvm::sort(Intrinsics, [](const CodeGenIntrinsic &LHS, const CodeGenIntrinsic &RHS) { return std::tie(LHS.TargetPrefix, LHS.Name) < diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -26,12 +26,9 @@ namespace { class IntrinsicEmitter { RecordKeeper &Records; - bool TargetOnly; - std::string TargetPrefix; public: - IntrinsicEmitter(RecordKeeper &R, bool T) - : Records(R), TargetOnly(T) {} + IntrinsicEmitter(RecordKeeper &R) : Records(R) {} void run(raw_ostream &OS, bool Enums); @@ -58,10 +55,7 @@ void IntrinsicEmitter::run(raw_ostream &OS, bool Enums) { emitSourceFileHeader("Intrinsic Function Source Fragment", OS); - CodeGenIntrinsicTable Ints(Records, TargetOnly); - - if (TargetOnly && !Ints.empty()) - TargetPrefix = Ints[0].TargetPrefix; + CodeGenIntrinsicTable Ints(Records); EmitPrefix(OS); @@ -588,11 +582,7 @@ raw_ostream &OS) { OS << "// Add parameter attributes that are not common to all intrinsics.\n"; OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n"; - if (TargetOnly) - OS << "static AttributeList getAttributes(LLVMContext &C, " << TargetPrefix - << "Intrinsic::ID id) {\n"; - else - OS << "AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; + OS << "AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; // Compute the maximum number of attribute arguments and the map typedef std::map