1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[SelectionDAG] Add a isel matcher op to check the type of node results other than result 0.

I plan to use this to check the type of the mask result of masked gathers in the X86 backend.

llvm-svn: 318820
This commit is contained in:
Craig Topper 2017-11-22 07:11:01 +00:00
parent 40279b1003
commit f724cae1ff
3 changed files with 23 additions and 5 deletions

View File

@ -130,6 +130,7 @@ public:
OPC_CheckOpcode,
OPC_SwitchOpcode,
OPC_CheckType,
OPC_CheckTypeRes,
OPC_SwitchType,
OPC_CheckChild0Type, OPC_CheckChild1Type, OPC_CheckChild2Type,
OPC_CheckChild3Type, OPC_CheckChild4Type, OPC_CheckChild5Type,

View File

@ -2775,6 +2775,12 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
Result = !::CheckType(Table, Index, N, SDISel.TLI,
SDISel.CurDAG->getDataLayout());
return Index;
case SelectionDAGISel::OPC_CheckTypeRes: {
unsigned Res = Table[Index++];
Result = !::CheckType(Table, Index, N.getValue(Res), SDISel.TLI,
SDISel.CurDAG->getDataLayout());
return Index;
}
case SelectionDAGISel::OPC_CheckChild0Type:
case SelectionDAGISel::OPC_CheckChild1Type:
case SelectionDAGISel::OPC_CheckChild2Type:
@ -3177,6 +3183,14 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
break;
continue;
case OPC_CheckTypeRes: {
unsigned Res = MatcherTable[MatcherIndex++];
if (!::CheckType(MatcherTable, MatcherIndex, N.getValue(Res), TLI,
CurDAG->getDataLayout()))
break;
continue;
}
case OPC_SwitchOpcode: {
unsigned CurNodeOpcode = N.getOpcode();
unsigned SwitchStart = MatcherIndex-1; (void)SwitchStart;

View File

@ -497,11 +497,14 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
}
case Matcher::CheckType:
assert(cast<CheckTypeMatcher>(N)->getResNo() == 0 &&
"FIXME: Add support for CheckType of resno != 0");
OS << "OPC_CheckType, "
<< getEnumName(cast<CheckTypeMatcher>(N)->getType()) << ",\n";
return 2;
if (cast<CheckTypeMatcher>(N)->getResNo() == 0) {
OS << "OPC_CheckType, "
<< getEnumName(cast<CheckTypeMatcher>(N)->getType()) << ",\n";
return 2;
}
OS << "OPC_CheckTypeRes, " << cast<CheckTypeMatcher>(N)->getResNo()
<< ", " << getEnumName(cast<CheckTypeMatcher>(N)->getType()) << ",\n";
return 3;
case Matcher::CheckChildType:
OS << "OPC_CheckChild"