[llvm-commits] [llvm] r96715 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Chris Lattner
sabre at nondot.org
Sat Feb 20 19:17:59 PST 2010
Author: lattner
Date: Sat Feb 20 21:17:59 2010
New Revision: 96715
URL: http://llvm.org/viewvc/llvm-project?rev=96715&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=96715&r1=96714&r2=96715&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Sat Feb 20 21:17:59 2010
@@ -209,12 +209,26 @@
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 @@
/// 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 @@
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;
More information about the llvm-commits
mailing list