Displaying 4 results from an estimated 4 matches for "mrv5".
Did you mean:
mrs5
2010 Jan 27
0
[LLVMdev] Returning a structure
...class aggregates". Check out this example:
struct R {
long a;
long b;
};
struct R f(long a, long b) {
struct R A;
A.a = a;
A.b = b;
return A;
}
->
%"struct R" = type { i64, i64 }
define %"struct R" @f(i64 %a, i64 %b) nounwind readnone {
entry:
%mrv5 = insertvalue %"struct R" undef, i64 %a, 0 ; <%"struct R"> [#uses=1]
%mrv6 = insertvalue %"struct R" %mrv5, i64 %b, 1 ; <%"struct R"> [#uses=1]
ret %"struct R" %mrv6
}
2010 Jan 27
2
[LLVMdev] Returning a structure
Hi Duncan,
Thanks for the response!
> that's because clang is doing something more complicated than you are: it is
> producing a function that conforms to the platform ABI for passing parameters.
> The platform ABI specifies in this case that the valued should be returned via
> a special in-memory mechanism (thus the "sret" extra function parameter) rather
> than in
2008 Jul 23
0
[LLVMdev] Structs as first class values.
...d assign to xmm/gpr. It works in this case, but not in the general
case.
For example, in this case:
struct x {
double x;
float f;
int i;
};
struct x foo(float *F, int *I) {
struct x y;
y.x = *F;
y.f = *F;
y.i = *I;
return y;
}
llvm-gcc produces:
ret { double, i64 } %mrv5
to get the right ABI. There is not enough information in the llvm ir
to do this without the front-end's help. Again, there is a many to
one mapping from C type to LLVM type and not all C types that map onto
the same llvm type are supposed to be handled the same way.
-Chris
2008 Jul 23
2
[LLVMdev] Structs as first class values.
On Wednesday 23 July 2008 12:22, Chris Lattner wrote:
> and both produce this machine code:
>
> _test:
> movq (%rsi), %rax
> movsd (%rdi), %xmm0
> ret
Ok, that's good.
> >> right thing. However, returning a {i64, i64, i64, i64} by value and
> >> having it automatically be returned "by pointer" is less interesting,
> >
> > What do