mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-01 01:14:12 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96715 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
beff6a3fd0
commit
a170b5e818
@ -209,12 +209,26 @@ namespace {
|
||||
SDValue &Scale, SDValue &Index, SDValue &Disp);
|
||||
bool SelectTLSADDRAddr(SDNode *Op, SDValue N, SDValue &Base,
|
||||
SDValue &Scale, SDValue &Index, SDValue &Disp);
|
||||
bool SelectScalarSSELoad(SDNode *Root, SDValue N,
|
||||
bool SelectScalarSSELoadXXX(SDNode *Root, SDValue N,
|
||||
SDValue &Base, SDValue &Scale,
|
||||
SDValue &Index, SDValue &Disp,
|
||||
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 &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,
|
||||
SDValue &Base, SDValue &Scale,
|
||||
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.
|
||||
///
|
||||
/// We also return:
|
||||
/// PatternInputChain: this is the chain node input to the pattern that the
|
||||
/// newly selected instruction should use.
|
||||
/// PatternChainResult: this is chain result matched by the pattern which
|
||||
/// should be replaced with the chain result of the matched node.
|
||||
bool X86DAGToDAGISel::SelectScalarSSELoad(SDNode *Root,
|
||||
/// PatternChainNode: this is the matched node that has a chain input and
|
||||
/// output.
|
||||
bool X86DAGToDAGISel::SelectScalarSSELoadXXX(SDNode *Root,
|
||||
SDValue N, SDValue &Base,
|
||||
SDValue &Scale, SDValue &Index,
|
||||
SDValue &Disp, SDValue &Segment,
|
||||
SDValue &PatternChainResult,
|
||||
SDValue &PatternInputChain) {
|
||||
SDValue &PatternNodeWithChain) {
|
||||
if (N.getOpcode() == ISD::SCALAR_TO_VECTOR) {
|
||||
PatternChainResult = N.getOperand(0).getValue(1);
|
||||
if (ISD::isNON_EXTLoad(PatternChainResult.getNode()) &&
|
||||
PatternChainResult.getValue(0).hasOneUse() &&
|
||||
IsProfitableToFold(N.getOperand(0),PatternChainResult.getNode(),Root) &&
|
||||
IsLegalToFold(N.getOperand(0), N.getNode(), Root)) {
|
||||
LoadSDNode *LD = cast<LoadSDNode>(PatternChainResult);
|
||||
PatternNodeWithChain = N.getOperand(0);
|
||||
if (ISD::isNON_EXTLoad(PatternNodeWithChain.getNode()) &&
|
||||
PatternNodeWithChain.hasOneUse() &&
|
||||
IsProfitableToFold(N.getOperand(0), PatternNodeWithChain.getNode(),
|
||||
Root) &&
|
||||
IsLegalToFold(N.getOperand(0), PatternNodeWithChain.getNode(), Root)) {
|
||||
LoadSDNode *LD = cast<LoadSDNode>(PatternNodeWithChain);
|
||||
if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp,Segment))
|
||||
return false;
|
||||
PatternInputChain = LD->getChain();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1358,8 +1369,7 @@ bool X86DAGToDAGISel::SelectScalarSSELoad(SDNode *Root,
|
||||
LoadSDNode *LD = cast<LoadSDNode>(N.getOperand(0).getOperand(0));
|
||||
if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp, Segment))
|
||||
return false;
|
||||
PatternInputChain = LD->getChain();
|
||||
PatternChainResult = SDValue(LD, 1);
|
||||
PatternNodeWithChain = SDValue(LD, 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user