[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 13 09:48:57 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.261 -> 1.262
---
Log message:
If a target specified a stack pointer with setStackPointerRegisterToSaveRestore,
lower STACKSAVE/STACKRESTORE into a copy from/to that register.
---
Diffs of the changes: (+21 -5)
LegalizeDAG.cpp | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.261 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.262
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.261 Thu Jan 12 20:50:02 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 13 11:48:44 2006
@@ -1453,10 +1453,20 @@
AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1));
return Result.getValue(Op.ResNo);
case TargetLowering::Expand:
- Tmp1 = DAG.getNode(ISD::UNDEF, Node->getValueType(0));
- AddLegalizedOperand(SDOperand(Node, 0), Tmp1);
- AddLegalizedOperand(SDOperand(Node, 1), Node->getOperand(0));
- return Op.ResNo ? Node->getOperand(0) : Tmp1;
+ // Expand to CopyFromReg if the target set
+ // StackPointerRegisterToSaveRestore.
+ if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) {
+ Tmp1 = DAG.getCopyFromReg(Node->getOperand(0), SP,
+ Node->getValueType(0));
+ AddLegalizedOperand(SDOperand(Node, 0), Tmp1);
+ AddLegalizedOperand(SDOperand(Node, 1), Tmp1.getValue(1));
+ return Tmp1.getValue(Op.ResNo);
+ } else {
+ Tmp1 = DAG.getNode(ISD::UNDEF, Node->getValueType(0));
+ AddLegalizedOperand(SDOperand(Node, 0), Tmp1);
+ AddLegalizedOperand(SDOperand(Node, 1), Node->getOperand(0));
+ return Op.ResNo ? Node->getOperand(0) : Tmp1;
+ }
}
case ISD::STACKRESTORE:
@@ -1478,7 +1488,13 @@
case TargetLowering::Legal:
break;
case TargetLowering::Expand:
- Result = Tmp1;
+ // Expand to CopyToReg if the target set
+ // StackPointerRegisterToSaveRestore.
+ if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) {
+ Result = DAG.getCopyToReg(Tmp1, SP, Tmp2);
+ } else {
+ Result = Tmp1;
+ }
break;
}
break;
More information about the llvm-commits
mailing list