I'm not sure whether there are any other cases where using LLVM requires knowledge of the target architecture, but needing it for trampolines is worrying me. I'm putting together things where the program that's generating the LLVM intermediate code doesn't have any way to know what the target architecture will be. 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?) Thanks! Eric
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
Possibly Parallel Threads
- [LLVMdev] making trampolines more portable
- [LLVMdev] making trampolines more portable
- [LLVMdev] making trampolines more portable
- [LLVMdev] [PATCH] Split init.trampoline into init.trampoline & adjust.trampoline
- [LLVMdev] [PATCH] Split init.trampoline into init.trampoline & adjust.trampoline