[LLVMdev] making trampolines more portable

Eli Friedman eli.friedman at gmail.com
Sat Jun 13 20:12:57 PDT 2009


On Sat, Jun 13, 2009 at 6:59 PM, Eric Smith<eric at brouhaha.com> wrote:
> Right now I'm using alloca to get a block that is expected to be more
> than large enough, and assuming that align 4 will work.  Any chance of
> LLVM gaining a new intrinsic that returns the appropriate size and
> alignment for the target?  (Might need the alloca() instruction extended
> or a new version to support non-constant alignment?)

The alignment is easy: just allocate as an array of pointers, and I'm
pretty sure you'll get appropriate alignment for every architecture.
Also, for lack of an intrinsic, there's a relatively easy workaround:
you can declare a global containing the correct size, then link in a
small target-specific .bc with the definition right before code
generation.

-Eli




More information about the llvm-dev mailing list