[LLVMdev] Hwo to guess PC-relative offset
HEITZMANN Frédéric 218168
frederic.heitzmann at cea.fr
Mon Jun 29 06:00:14 PDT 2015
Dear LLVM crew,
I have been writing a new LLVM backend with a very simple instruction set.
moving a constant value to a register is selected as a load of the constant, with a PC-relative positive offset.
Thus, the constant should be stored in .text section, after the load instruction, and offset should be computed at compile time (not link time).
I struggle to find out :
- how llvm handle constant pool
- where I should compute the offset (MCCodeEmitter ? MCInstLowering ? ... ?)
ARM has a specific pass for this (ARMConstantIslandPass.cpp), but I wonder if such a processing is really needed, at least for simple case (i.e. small enough offset).
Handling this with relocations and linker-hacking seems odd, I'd prefer to avoid it.
Thanks for you help, either with some advice on the implementation strategy, or with and example in an existing backend.
--
Frederic Heitzmann
More information about the llvm-dev
mailing list