[llvm-commits] [llvm] r46066 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Chris Lattner sabre at nondot.org
Tue Jan 15 23:51:34 PST 2008


Author: lattner
Date: Wed Jan 16 01:51:34 2008
New Revision: 46066

URL: http://llvm.org/viewvc/llvm-project?rev=46066&view=rev
Log:
merge a few pieces of code that do the store/load to stack 
pattern to use EmitStackConvert now.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=46066&r1=46065&r2=46066&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 16 01:51:34 2008
@@ -3573,20 +3573,12 @@
     break;
 
   case ISD::FP_EXTEND: {
-      MVT::ValueType newVT = Op.getValueType();
-      MVT::ValueType oldVT = Op.getOperand(0).getValueType();
-      if (TLI.getConvertAction(oldVT, newVT) == TargetLowering::Expand) {
+      MVT::ValueType DstVT = Op.getValueType();
+      MVT::ValueType SrcVT = Op.getOperand(0).getValueType();
+      if (TLI.getConvertAction(SrcVT, DstVT) == TargetLowering::Expand) {
         // The only other way we can lower this is to turn it into a STORE,
         // LOAD pair, targetting a temporary location (a stack slot).
-
-        // NOTE: there is a choice here between constantly creating new stack
-        // slots and always reusing the same one.  We currently always create
-        // new ones, as reuse may inhibit scheduling.
-        SDOperand StackSlot = DAG.CreateStackTemporary(oldVT);
-        Result = DAG.getStore(DAG.getEntryNode(), Node->getOperand(0),
-                                   StackSlot, NULL, 0);
-        Result = DAG.getExtLoad(ISD::EXTLOAD, newVT,
-                                Result, StackSlot, NULL, 0, oldVT);
+        Result = EmitStackConvert(Node->getOperand(0), SrcVT, DstVT);
         break;
       }
     }
@@ -3603,25 +3595,18 @@
     }
     break;
   case ISD::FP_ROUND: {
-      MVT::ValueType newVT = Op.getValueType();
-      MVT::ValueType oldVT = Op.getOperand(0).getValueType();
-      if (TLI.getConvertAction(oldVT, newVT) == TargetLowering::Expand) {
-        if (oldVT == MVT::ppcf128) {
+      MVT::ValueType DstVT = Op.getValueType();
+      MVT::ValueType SrcVT = Op.getOperand(0).getValueType();
+      if (TLI.getConvertAction(SrcVT, DstVT) == TargetLowering::Expand) {
+        if (SrcVT == MVT::ppcf128) {
           SDOperand Lo, Hi;
           ExpandOp(Node->getOperand(0), Lo, Hi);
-          Result = DAG.getNode(ISD::FP_ROUND, newVT, Hi);
+          Result = DAG.getNode(ISD::FP_ROUND, DstVT, Hi);
           break;
         } else {
           // The only other way we can lower this is to turn it into a STORE,
           // LOAD pair, targetting a temporary location (a stack slot).
-
-          // NOTE: there is a choice here between constantly creating new stack
-          // slots and always reusing the same one.  We currently always create
-          // new ones, as reuse may inhibit scheduling.
-          SDOperand StackSlot = DAG.CreateStackTemporary(newVT);
-          Result = DAG.getTruncStore(DAG.getEntryNode(), Node->getOperand(0),
-                                     StackSlot, NULL, 0, newVT);
-          Result = DAG.getLoad(newVT, Result, StackSlot, NULL, 0);
+          Result = EmitStackConvert(Node->getOperand(0), DstVT, DstVT);
           break;
         }
       }
@@ -3700,11 +3685,8 @@
         // NOTE: there is a choice here between constantly creating new stack
         // slots and always reusing the same one.  We currently always create
         // new ones, as reuse may inhibit scheduling.
-        SDOperand StackSlot = DAG.CreateStackTemporary(ExtraVT);
-        Result = DAG.getTruncStore(DAG.getEntryNode(), Node->getOperand(0),
-                                   StackSlot, NULL, 0, ExtraVT);
-        Result = DAG.getExtLoad(ISD::EXTLOAD, Node->getValueType(0),
-                                Result, StackSlot, NULL, 0, ExtraVT);
+        Result = EmitStackConvert(Node->getOperand(0), ExtraVT, 
+                                  Node->getValueType(0));
       } else {
         assert(0 && "Unknown op");
       }





More information about the llvm-commits mailing list