forked from OSchip/llvm-project
Emit a redundant check for immediates at root context, e.g. (imm 0).
This allows formation of OpcodeSwitch for top level patterns, in particular on X86. This saves about 1K of data space in the x86 table and makes the dispatch much more efficient. llvm-svn: 97440
This commit is contained in:
parent
053a28a397
commit
a44697c394
|
@ -55,7 +55,6 @@ public:
|
||||||
CheckPredicate, // Fail if node predicate fails.
|
CheckPredicate, // Fail if node predicate fails.
|
||||||
CheckOpcode, // Fail if not opcode.
|
CheckOpcode, // Fail if not opcode.
|
||||||
SwitchOpcode, // Dispatch based on opcode.
|
SwitchOpcode, // Dispatch based on opcode.
|
||||||
CheckMultiOpcode, // Fail if not in opcode list.
|
|
||||||
CheckType, // Fail if not correct type.
|
CheckType, // Fail if not correct type.
|
||||||
CheckChildType, // Fail if child has wrong type.
|
CheckChildType, // Fail if child has wrong type.
|
||||||
CheckInteger, // Fail if wrong val.
|
CheckInteger, // Fail if wrong val.
|
||||||
|
|
|
@ -205,8 +205,17 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
|
||||||
AddMatcher(new CheckPredicateMatcher(N->getPredicateFns()[i]));
|
AddMatcher(new CheckPredicateMatcher(N->getPredicateFns()[i]));
|
||||||
|
|
||||||
// Direct match against an integer constant.
|
// Direct match against an integer constant.
|
||||||
if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue()))
|
if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
|
||||||
|
// If this is the root of the dag we're matching, we emit a redundant opcode
|
||||||
|
// check to ensure that this gets folded into the normal top-level
|
||||||
|
// OpcodeSwitch.
|
||||||
|
if (N == Pattern.getSrcPattern()) {
|
||||||
|
const SDNodeInfo &NI = CGP.getSDNodeInfo(CGP.getSDNodeNamed("imm"));
|
||||||
|
AddMatcher(new CheckOpcodeMatcher(NI));
|
||||||
|
}
|
||||||
|
|
||||||
return AddMatcher(new CheckIntegerMatcher(II->getValue()));
|
return AddMatcher(new CheckIntegerMatcher(II->getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
DefInit *DI = dynamic_cast<DefInit*>(N->getLeafValue());
|
DefInit *DI = dynamic_cast<DefInit*>(N->getLeafValue());
|
||||||
if (DI == 0) {
|
if (DI == 0) {
|
||||||
|
|
Loading…
Reference in New Issue