[LLVMdev] It is possible to somehow turn off coercion of struct parameters into ints?

Reid Kleckner rnk at google.com
Fri May 16 10:22:19 PDT 2014


There isn't a flag to do this, but depending on what you need, you can hack
clang to get it.

Someone else wanted Clang to pass structs directly as LLVM aggregates, but
that would definitely be an ABI break:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-April/036615.html

This might be a reasonable lowering, if it works for you:

struct A { int a; int b; };
void foo(A x) { }

%struct.A = type { i32, i32 }
define void @foo(%struct.A* byval %x) {
  ret void
}

Something like this would be easy to implement and might even be ABI
compatible with the integral coercion lowering, but I make no guarantees.
 You'd change TargetInfo.cpp to return ABIArgInfo::getIndirect(0,
/*ByVal=*/true) for every record that is currently expanded or passed
directly.


On Fri, May 16, 2014 at 8:55 AM, Zvonimir Rakamaric <zvonimir at cs.utah.edu>wrote:

> In particular, I would for example like to prevent that two fields of
> type i32 are packed into an i64 parameter. And so on...
>
> Thanks!
> -- Zvonimir
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140516/2716364b/attachment.html>


More information about the llvm-dev mailing list