[llvm-commits] [llvm] r37940 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h include/llvm/ParameterAttributes.h lib/AsmParser/Lexer.l lib/AsmParser/llvmAsmParser.y lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/TargetCallingC
Rafael Espindola
espindola at google.com
Tue Jul 17 09:45:08 PDT 2007
> The problem is that not all "byval" structs get passed in registers.
> On x86-32 for example, they all get passed on the stack, just a very
> "specific" part of the stack.
I think that this can be represented. For example, we would compile the function
int f(int a) { return a; }
on x86-32 into
---------------------------------------------------
%struct.f_frame = type { i32 }
define i32 @f(%struct.f_frame* stack_pointer %p) {
entry:
%tmp2 = getelementptr %struct.f_frame* %p, i32 0, i32 0
; <i32*> [#uses=1]
%tmp3 = load i32* %tmp2 ; <i32> [#uses=1]
ret i32 %tmp3
}
---------------------------------------------------
Where "stack_pointer" in an attribute that instructs the codegen that
this is just the esp register. I know that the stack frame is not just
{ i32 }, but I think that the llvm structures are general enough to
describe it.
On x86_64 the same C code would compile into a llvm function with a
normal argument.
> I like the current byval proposal :)
me too :-)
> -Chris
Cheers,
--
Rafael Avila de Espindola
Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland
Registered in Dublin, Ireland
Registration Number: 368047
More information about the llvm-commits
mailing list