[llvm-commits] [llvm] r62338 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/ret-addr.ll

Evan Cheng evan.cheng at apple.com
Fri Jan 16 11:49:51 PST 2009


Where are the extra push and pop coming from?

Evan
On Jan 16, 2009, at 11:43 AM, Bill Wendling wrote:

> For Depth > 1 (2 in this case), I get this from LLVM:
>
> 	.align	1,0x90
> 	.globl	_h
> _h:
> 	pushl	%ebp
> 	movl	%esp, %ebp
> 	pushl	%ebp
> 	movl	(%ebp), %eax
> 	movl	(%eax), %eax
> 	movl	4(%eax), %eax
> 	popl	%ebp
> 	popl	%ebp
> 	ret
>
> And this from GCC:
>
> .globl _h
> _h:
> 	pushl	%ebp
> 	movl	%esp, %ebp
> 	movl	0(%ebp), %eax
> 	movl	(%eax), %eax
> 	movl	4(%eax), %eax
> 	leave
> 	ret
>
> Except for the extraneous push/pop, these are the same, right? Or am I
> missing something?
>
> -bw
>
> On Fri, Jan 16, 2009 at 11:37 AM, Dale Johannesen <dalej at apple.com>  
> wrote:
>> This doesn't do the right thing for Depth > 1.  I don't think we need
>> to short term, but the test should be ==1 and a comment should
>> indicate this.
>>
>> On Jan 16, 2009, at 11:25 AMPST, Bill Wendling wrote:
>>>
>>> +  if (Depth > 0) {
>>> +    SDValue FrameAddr = LowerFRAMEADDR(Op, DAG);
>>> +    SDValue Offset =
>>> +      DAG.getConstant(TD->getPointerSize(),
>>> +                      Subtarget->is64Bit() ? MVT::i64 : MVT::i32);
>>> +    return DAG.getLoad(getPointerTy(), DAG.getEntryNode(),
>>> +                       DAG.getNode(ISD::ADD, getPointerTy(),
>>> FrameAddr, Offset),
>>> +                       NULL, 0);
>>> +  }
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list