[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Dec 22 22:24:15 PST 2005



Changes in directory llvm/lib/Target/SparcV8:

SparcV8ISelDAGToDAG.cpp updated: 1.34 -> 1.35
---
Log message:

implement vastart.  The dag isel compiles this:

void test3(va_list Y);
void test2(int F, ...) { 
  va_list X;
  va_start(X, F);
  test3(X);
}

into this:

test2:
        save -104, %o6, %o6
        st %i5, [%i6+88]
        st %i4, [%i6+84]
        st %i3, [%i6+80]
        st %i2, [%i6+76]
        st %i1, [%i6+72]
        add %i6, 72, %o0
        st %o0, [%i6+-4]
        call test3
        nop
        restore %g0, %g0, %g0
        retl
        nop

The simple isel emits:

test2:
        save -96, %o6, %o6
        st %i0, [%i6+68]
        st %i1, [%i6+72]
        st %i2, [%i6+76]
        st %i3, [%i6+80]
        st %i4, [%i6+84]
        st %i5, [%i6+88]
        or %g0, 1, %l0
        or %g0, 4, %l1
        umul %l0, %l1, %l0
        add %l0, 7, %l0
        and %l0, -8, %l0
        sub %o6, %l0, %o6
        add %o6, 96, %l0
        add %i6, 72, %l1
        st %l1, [%l0]
        ld [%l0], %o0
        call test3
        nop
        restore %g0, %g0, %g0
        retl
        nop



---
Diffs of the changes:  (+5 -2)

 SparcV8ISelDAGToDAG.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
diff -u llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.34 llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.35
--- llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.34	Thu Dec 22 23:12:47 2005
+++ llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp	Fri Dec 23 00:24:04 2005
@@ -568,8 +568,11 @@
 LowerVAStart(SDOperand Chain, SDOperand VAListP, Value *VAListV, 
              SelectionDAG &DAG) {
              
-  assert(0 && "Unimp");
-  abort();
+  SDOperand Offset = DAG.getNode(ISD::ADD, MVT::i32,
+                                 DAG.getRegister(V8::I6, MVT::i32),
+                                 DAG.getConstant(VarArgsFrameOffset, MVT::i32));
+  return DAG.getNode(ISD::STORE, MVT::Other, Chain, Offset, 
+                     VAListP, DAG.getSrcValue(VAListV));
 }
 
 std::pair<SDOperand,SDOperand> SparcV8TargetLowering::






More information about the llvm-commits mailing list