forked from OSchip/llvm-project
rename SelectScalarSSELoad -> SelectScalarSSELoadXXX and rewrite
it to follow the mode needed by the new isel. Instead of returning the input and output chains, it just returns the (currently only one, which is a silly limitation) node that has input and output chains. Since we want the old thing to still work, add a new SelectScalarSSELoad to emulate the old interface. The XXX suffix and the wrapper will eventually go away. llvm-svn: 96715
This commit is contained in:
parent
98b99aa401
commit
18a32ce0f3
|
@ -209,12 +209,26 @@ namespace {
|
||||||
SDValue &Scale, SDValue &Index, SDValue &Disp);
|
SDValue &Scale, SDValue &Index, SDValue &Disp);
|
||||||
bool SelectTLSADDRAddr(SDNode *Op, SDValue N, SDValue &Base,
|
bool SelectTLSADDRAddr(SDNode *Op, SDValue N, SDValue &Base,
|
||||||
SDValue &Scale, SDValue &Index, SDValue &Disp);
|
SDValue &Scale, SDValue &Index, SDValue &Disp);
|
||||||
bool SelectScalarSSELoad(SDNode *Root, SDValue N,
|
bool SelectScalarSSELoadXXX(SDNode *Root, SDValue N,
|
||||||
SDValue &Base, SDValue &Scale,
|
SDValue &Base, SDValue &Scale,
|
||||||
SDValue &Index, SDValue &Disp,
|
SDValue &Index, SDValue &Disp,
|
||||||
SDValue &Segment,
|
SDValue &Segment,
|
||||||
|
SDValue &NodeWithChain);
|
||||||
|
|
||||||
|
// FIXME: Remove this hacky wrapper.
|
||||||
|
bool SelectScalarSSELoad(SDNode *Root, SDValue N, SDValue &Base,
|
||||||
|
SDValue &Scale, SDValue &Index,
|
||||||
|
SDValue &Disp, SDValue &Segment,
|
||||||
SDValue &PatternChainResult,
|
SDValue &PatternChainResult,
|
||||||
SDValue &PatternInputChain);
|
SDValue &PatternInputChain) {
|
||||||
|
SDValue Tmp;
|
||||||
|
if (!SelectScalarSSELoadXXX(Root, N, Base, Scale, Index, Disp, Segment,
|
||||||
|
Tmp))
|
||||||
|
return false;
|
||||||
|
PatternInputChain = Tmp.getOperand(0);
|
||||||
|
PatternChainResult = Tmp.getValue(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
bool TryFoldLoad(SDNode *P, SDValue N,
|
bool TryFoldLoad(SDNode *P, SDValue N,
|
||||||
SDValue &Base, SDValue &Scale,
|
SDValue &Base, SDValue &Scale,
|
||||||
SDValue &Index, SDValue &Disp,
|
SDValue &Index, SDValue &Disp,
|
||||||
|
@ -1320,26 +1334,23 @@ bool X86DAGToDAGISel::SelectAddr(SDNode *Op, SDValue N, SDValue &Base,
|
||||||
/// is derived from the type of N, which is either v4f32 or v2f64.
|
/// is derived from the type of N, which is either v4f32 or v2f64.
|
||||||
///
|
///
|
||||||
/// We also return:
|
/// We also return:
|
||||||
/// PatternInputChain: this is the chain node input to the pattern that the
|
/// PatternChainNode: this is the matched node that has a chain input and
|
||||||
/// newly selected instruction should use.
|
/// output.
|
||||||
/// PatternChainResult: this is chain result matched by the pattern which
|
bool X86DAGToDAGISel::SelectScalarSSELoadXXX(SDNode *Root,
|
||||||
/// should be replaced with the chain result of the matched node.
|
|
||||||
bool X86DAGToDAGISel::SelectScalarSSELoad(SDNode *Root,
|
|
||||||
SDValue N, SDValue &Base,
|
SDValue N, SDValue &Base,
|
||||||
SDValue &Scale, SDValue &Index,
|
SDValue &Scale, SDValue &Index,
|
||||||
SDValue &Disp, SDValue &Segment,
|
SDValue &Disp, SDValue &Segment,
|
||||||
SDValue &PatternChainResult,
|
SDValue &PatternNodeWithChain) {
|
||||||
SDValue &PatternInputChain) {
|
|
||||||
if (N.getOpcode() == ISD::SCALAR_TO_VECTOR) {
|
if (N.getOpcode() == ISD::SCALAR_TO_VECTOR) {
|
||||||
PatternChainResult = N.getOperand(0).getValue(1);
|
PatternNodeWithChain = N.getOperand(0);
|
||||||
if (ISD::isNON_EXTLoad(PatternChainResult.getNode()) &&
|
if (ISD::isNON_EXTLoad(PatternNodeWithChain.getNode()) &&
|
||||||
PatternChainResult.getValue(0).hasOneUse() &&
|
PatternNodeWithChain.hasOneUse() &&
|
||||||
IsProfitableToFold(N.getOperand(0),PatternChainResult.getNode(),Root) &&
|
IsProfitableToFold(N.getOperand(0), PatternNodeWithChain.getNode(),
|
||||||
IsLegalToFold(N.getOperand(0), N.getNode(), Root)) {
|
Root) &&
|
||||||
LoadSDNode *LD = cast<LoadSDNode>(PatternChainResult);
|
IsLegalToFold(N.getOperand(0), PatternNodeWithChain.getNode(), Root)) {
|
||||||
|
LoadSDNode *LD = cast<LoadSDNode>(PatternNodeWithChain);
|
||||||
if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp,Segment))
|
if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp,Segment))
|
||||||
return false;
|
return false;
|
||||||
PatternInputChain = LD->getChain();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1358,8 +1369,7 @@ bool X86DAGToDAGISel::SelectScalarSSELoad(SDNode *Root,
|
||||||
LoadSDNode *LD = cast<LoadSDNode>(N.getOperand(0).getOperand(0));
|
LoadSDNode *LD = cast<LoadSDNode>(N.getOperand(0).getOperand(0));
|
||||||
if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp, Segment))
|
if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp, Segment))
|
||||||
return false;
|
return false;
|
||||||
PatternInputChain = LD->getChain();
|
PatternNodeWithChain = SDValue(LD, 0);
|
||||||
PatternChainResult = SDValue(LD, 1);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue