llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.42k stars 11.74k forks source link

PowerPC stack frames must be a minimum of 64 bytes #1008

Closed llvmbot closed 14 years ago

llvmbot commented 19 years ago
Bugzilla Link 636
Resolution WORKSFORME
Resolved on Mar 06, 2010 13:59
Version trunk
OS MacOS X
Reporter LLVM Bugzilla Contributor

Extended Description

The PowerPC ABI requires that a stack frame must be at least 64 bytes and a multiple of 16.

   align(sizeof(Linkage) + 8 * sizeof(long), 16);

The minimum of 8 long is to allow the spilling of args by the callee (in particular var arg case), or any intermediary thunk.

Compiling the following example will show il-sized frames.

include

void printing(int x, int y) { printf("%d %d\n", x, y); }

int main(int argc, char *argv[]) { printing(10, 20); return 0; }

lattner commented 18 years ago

It seems that this got fixed somehow, works now.

-Chris

lattner commented 18 years ago

Ok, I agree that this is a bug. Please come up with a testcase though.

Thanks,

-Chris

llvmbot commented 19 years ago

That's not what I got;

llvm-g++ -Wa,-disable-inlining -Wl,-disable-inlining main.cpp llc a.out.bc -o -

    .text
    .align  4
    .globl  l1__Z8printingii

l1Z8printingii: stwu r1, -64(r1) mflr r11 stw r11, 72(r1) lis r2, ha16(l22E_str_1) li r5, 20 li r4, 10 la r3, lo16(l2__2E_str_1)(r2) bl L_printf$stub lwz r11, 72(r1) mtlr r11 lwz r1, 0(r1) blr

    .text
    .align  4
    .globl  _main

_main: stwu r1, -32(r1) <<<<< mflr r11 stw r11, 40(r1) bl l1_main bl l1Z8printingii li r3, 0 lwz r11, 40(r1) mtlr r11 lwz r1, 0(r1) blr

....

Also seeing small frames in the mpeg2dec tests.

lattner commented 19 years ago

Uh, stupid safari, I didn't mean to close this.

lattner commented 19 years ago

What is the bug here? "printing" reserves 80 bytes and main reserves 64. What am I missing?

I used:

llvm-gcc txxxx.c -c -o - | llc

llvmbot commented 19 years ago

http://developer.apple.com/documentation/DeveloperTools/Conceptual/PowerPCRuntime/Stack/ chapter_3_section_3.html