[llvm] r333000 - Reverting 332999 to get it a proper commit message
Roman Tereshin via llvm-commits
llvm-commits at lists.llvm.org
Tue May 22 09:53:42 PDT 2018
Author: rtereshin
Date: Tue May 22 09:53:42 2018
New Revision: 333000
URL: http://llvm.org/viewvc/llvm-project?rev=333000&view=rev
Log:
Reverting 332999 to get it a proper commit message
Modified:
llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=333000&r1=332999&r2=333000&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Tue May 22 09:53:42 2018
@@ -851,6 +851,7 @@ public:
std::unique_ptr<PredicateMatcher> popFirstCondition() override;
const PredicateMatcher &getFirstCondition() const override;
+ LLTCodeGen getFirstConditionAsRootType();
bool hasFirstCondition() const override;
unsigned getNumOperands() const;
StringRef getOpcode() const;
@@ -1921,6 +1922,16 @@ unsigned RuleMatcher::getNumOperands() c
return Matchers.front()->getNumOperands();
}
+LLTCodeGen RuleMatcher::getFirstConditionAsRootType() {
+ InstructionMatcher &InsnMatcher = *Matchers.front();
+ if (!InsnMatcher.predicates_empty())
+ if (const auto *TM =
+ dyn_cast<LLTOperandMatcher>(&**InsnMatcher.predicates_begin()))
+ if (TM->getInsnVarID() == 0 && TM->getOpIdx() == 0)
+ return TM->getTy();
+ return {};
+}
+
/// Generates code to check that the operand is a register defined by an
/// instruction that matches the given instruction matcher.
///
@@ -4016,25 +4027,6 @@ GlobalISelEmitter::buildMatchTable(Mutab
if (!Optimize)
return MatchTable::buildTable(InputRules, WithCoverage);
- unsigned CurrentOrdering = 0;
- StringMap<unsigned> OpcodeOrder;
- for (RuleMatcher &Rule : Rules) {
- const StringRef Opcode = Rule.getOpcode();
- assert(!Opcode.empty() && "Didn't expect an undefined opcode");
- if (OpcodeOrder.count(Opcode) == 0)
- OpcodeOrder[Opcode] = CurrentOrdering++;
- }
-
- std::stable_sort(InputRules.begin(), InputRules.end(),
- [&OpcodeOrder](const Matcher *A, const Matcher *B) {
- auto *L = static_cast<const RuleMatcher *>(A);
- auto *R = static_cast<const RuleMatcher *>(B);
- return std::make_tuple(OpcodeOrder[L->getOpcode()],
- L->getNumOperands()) <
- std::make_tuple(OpcodeOrder[R->getOpcode()],
- R->getNumOperands());
- });
-
for (Matcher *Rule : InputRules)
Rule->optimize();
More information about the llvm-commits
mailing list