Displaying 5 results from an estimated 5 matches for "_zn3foo6getfooev".
2008 Mar 26
4
[LLVMdev] Wrong calling convention?
...u put me on the right track. The problem is that the class is
returned on the stack.
This is the class:
class Foo {
public:
Foo() : data(113.5) {}
static Foo GetFoo() { return Foo(); }
private:
double data;
};
This is the assembler code for Foo::GetFoo:
Dump of assembler code for function _ZN3Foo6GetFooEv:
0x6e08b5a4 <_ZN3Foo6GetFooEv+0>: push %ebp
0x6e08b5a5 <_ZN3Foo6GetFooEv+1>: mov %esp,%ebp
0x6e08b5a7 <_ZN3Foo6GetFooEv+3>: sub $0x14,%esp
0x6e08b5aa <_ZN3Foo6GetFooEv+6>: lea -0x8(%ebp),%eax
0x6e08b5ad <_ZN3Foo6GetFooEv+9>:...
2008 Mar 26
0
[LLVMdev] Wrong calling convention?
...on the stack.
>
> This is the class:
>
> class Foo {
> public:
> Foo() : data(113.5) {}
> static Foo GetFoo() { return Foo(); }
> private:
> double data;
> };
>
> This is the assembler code for Foo::GetFoo:
>
> Dump of assembler code for function _ZN3Foo6GetFooEv:
> 0x6e08b5a4 <_ZN3Foo6GetFooEv+0>: push %ebp
> 0x6e08b5a5 <_ZN3Foo6GetFooEv+1>: mov %esp,%ebp
> 0x6e08b5a7 <_ZN3Foo6GetFooEv+3>: sub $0x14,%esp
> 0x6e08b5aa <_ZN3Foo6GetFooEv+6>: lea -0x8(%ebp),%eax
> 0x6e08b5ad <_ZN3...
2008 Mar 26
0
[LLVMdev] Wrong calling convention?
Hi,
> define internal i1 @Addr_045442A0() {
> alloca [8 x i8], align 4 ; <[8 x i8]*>:1 [#uses=2]
> alloca i1, align 4 ; <i1*>:2 [#uses=2]
> tail call void @F95478DA5_FFI_FN( [8 x i8]* %1 sret )
this call uses the "struct-return" convention (due to the sret attribute).
On x86 this means that the caller is responsible for adjusting the stack
pointer after
2008 Mar 26
2
[LLVMdev] Wrong calling convention?
When my llvm code calls certain function, either it receives a wrong
result or the application ends on what it seems a corrupt stack.
The function is a C++ static method that returns a class with just a
`double' data member:
class Foo {
double data;
};
My compiler abstracts this as a [8 x i8] array. This is the llvm code:
define internal i1 @Addr_045442A0() {
alloca [8 x i8], align 4 ;
2008 Mar 26
4
[LLVMdev] Wrong calling convention?
Duncan Sands <baldrick at free.fr> writes:
>> But you put me on the right track. The problem is that the class is
>> returned on the stack.
Correction: The class is returned on the FP stack:
>> 0x6e08b5b5 <_ZN3Foo6GetFooEv+17>: fldl -0x8(%ebp)
>> 0x6e08b5b8 <_ZN3Foo6GetFooEv+20>: leave
>> 0x6e08b5b9 <_ZN3Foo6GetFooEv+21>: ret
>> End of assembler dump.
>>
>> I guess that g++ exploits its knowledge of Foo's internals for deciding
>> how to retu...