[llvm] r315932 - Revert MSVC 2017 build fix and fix it by moving the method that implicitly instantiates addPredicate out of line
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 16 13:31:16 PDT 2017
Author: rnk
Date: Mon Oct 16 13:31:16 2017
New Revision: 315932
URL: http://llvm.org/viewvc/llvm-project?rev=315932&view=rev
Log:
Revert MSVC 2017 build fix and fix it by moving the method that implicitly instantiates addPredicate out of line
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=315932&r1=315931&r2=315932&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Mon Oct 16 13:31:16 2017
@@ -715,18 +715,6 @@ public:
virtual unsigned countRendererFns() const { return 0; }
};
-// Specialize OperandMatcher::addPredicate() to refrain from adding redundant
-// predicates.
-template <>
-template <class Kind, class... Args>
-Optional<Kind *>
-PredicateListMatcher<OperandPredicateMatcher>::addPredicate(Args &&... args) {
- if (static_cast<OperandMatcher *>(this)->isSameAsAnotherOperand())
- return None;
- Predicates.emplace_back(llvm::make_unique<Kind>(std::forward<Args>(args)...));
- return static_cast<Kind *>(Predicates.back().get());
-}
-
template <>
std::string
PredicateListMatcher<OperandPredicateMatcher>::getNoPredicateComment() const {
@@ -990,26 +978,7 @@ public:
InstructionMatcher &getInstructionMatcher() const { return Insn; }
Error addTypeCheckPredicate(const TypeSetByHwMode &VTy,
- bool OperandIsAPointer) {
- if (!VTy.isMachineValueType())
- return failedImport("unsupported typeset");
-
- if (VTy.getMachineValueType() == MVT::iPTR && OperandIsAPointer) {
- addPredicate<PointerToAnyOperandMatcher>(0);
- return Error::success();
- }
-
- auto OpTyOrNone = MVTToLLT(VTy.getMachineValueType().SimpleTy);
- if (!OpTyOrNone)
- return failedImport("unsupported type");
-
- if (OperandIsAPointer)
- addPredicate<PointerToAnyOperandMatcher>(
- OpTyOrNone->get().getSizeInBits());
- else
- addPredicate<LLTOperandMatcher>(*OpTyOrNone);
- return Error::success();
- }
+ bool OperandIsAPointer);
/// Emit MatchTable opcodes to capture instructions into the MIs table.
void emitCaptureOpcodes(MatchTable &Table, RuleMatcher &Rule,
@@ -1078,6 +1047,39 @@ public:
}
};
+// Specialize OperandMatcher::addPredicate() to refrain from adding redundant
+// predicates.
+template <>
+template <class Kind, class... Args>
+Optional<Kind *>
+PredicateListMatcher<OperandPredicateMatcher>::addPredicate(Args &&... args) {
+ if (static_cast<OperandMatcher *>(this)->isSameAsAnotherOperand())
+ return None;
+ Predicates.emplace_back(llvm::make_unique<Kind>(std::forward<Args>(args)...));
+ return static_cast<Kind *>(Predicates.back().get());
+}
+
+Error OperandMatcher::addTypeCheckPredicate(const TypeSetByHwMode &VTy,
+ bool OperandIsAPointer) {
+ if (!VTy.isMachineValueType())
+ return failedImport("unsupported typeset");
+
+ if (VTy.getMachineValueType() == MVT::iPTR && OperandIsAPointer) {
+ addPredicate<PointerToAnyOperandMatcher>(0);
+ return Error::success();
+ }
+
+ auto OpTyOrNone = MVTToLLT(VTy.getMachineValueType().SimpleTy);
+ if (!OpTyOrNone)
+ return failedImport("unsupported type");
+
+ if (OperandIsAPointer)
+ addPredicate<PointerToAnyOperandMatcher>(OpTyOrNone->get().getSizeInBits());
+ else
+ addPredicate<LLTOperandMatcher>(*OpTyOrNone);
+ return Error::success();
+}
+
unsigned ComplexPatternOperandMatcher::getAllocatedTemporariesBaseID() const {
return Operand.getAllocatedTemporariesBaseID();
}
More information about the llvm-commits
mailing list