[cfe-commits] r143596 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp

Eli Friedman eli.friedman at gmail.com
Mon Nov 7 20:04:33 PST 2011


On Mon, Nov 7, 2011 at 7:27 PM, Hatanaka, Akira <ahatanaka at mips.com> wrote:
> Just to add to my previous email,
>
> tail call void @callee(i32 3, double %0, i64 %1, i64 %2, i64 %3) nounwind
>
> Without alignment information attached to "double %0", this is how the backend will pass arguments in registers, when the function above is lowered:
> i32 3 => 1st integer register
> double %0 => 2nd FP register
> i64 %1 => 3rd integer register
> i64 %2, i64 %3 => 4th and 5th integer register
>
> The correct way to pass arguments is the following:
> i32 3 => 1st integer register
> double %0 => 3rd FP register
> i64 %1 => 4th integer register
> i64 %2, i64 %3 => 5th and 6th integer register

As you've figured out, you can't attach alignment to scalars.  IIRC,
x86 doesn't run into this issue.  Something like "tail call void
@callee(i32 3, i32 undef, double %0, i64 %1, i64 %2, i64 %3) nounwind"
probably does what you want. I'm not entirely sure how you would
convince clang to emit that, though; it might require extending the
ABI interface a bit.

-Eli



More information about the cfe-commits mailing list