[LLVMdev] constant pool in large functions
Evan Cheng
evan.cheng at apple.com
Fri Jan 5 11:17:20 PST 2007
Hi Lauro,
This is a very tricky problem to resolve. Basically you need a pass
just before code emission to find the proper locations for each
constant pool. That means you need:
1. Exact size of each instruction. This can be added with a custom
instrinfo that specify instruction length for each target instruction.
2. Probably some kind of constantpool pseudo instruction.
The pass can then insert new constantpool instructions at the right
locations to solve this problem.
Evan
On Jan 5, 2007, at 9:15 AM, Lauro Ramos Venancio wrote:
> I'm facing a problem with constant pool in large functions.
>
> The LLVM prints constant pool at the beginning of functions.
>
> In large functions loads can be far from constant pool. GCC
> resolves this situations by spreading constants throughtout
> functions. A C test and the code generated by LLVM and GCC are
> attached.
>
> As you can see in the following error the ldr is too far from
> constant:
>
> $ arm-linux-gnueabi-as teste-llvm.s
> teste-llvm.s: Assembler messages: teste-llvm.s:1039:
> Error: bad immediate value for offset (4120)
>
> Any ideas?
>
>
> Lauro
> <teste.c>
> <teste-llvm.s>
> <teste-gcc.s>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list