Hi Elena,
> I’d like to generate constants inside .text in order to use ip-relative
> loads, when the code model is “large”.
I don't think this is a sequence the x86 backend supports at the
moment, but it is how ARM handles its constant-pools. The outline is
that you have a pass which looks through a functions constpool uses
and emits a pseudo-instruction for each, which is then handled in the
AsmPrinter.
ARM has the added complication that the instructions accessing these
constants are of limited range, which means lots of extra complexity
making sure they can be reached when needed. This is probably
unnecessary with x86's +/- 2GB limit. Any single function over 2GB in
size has bigger problems than where its constants are.
Actually, originally the AArch64 backend did the same thing but I
switched to the x86 model back in February. Which means thar r175258
is a nice potted (but reversed) description of all the steps needed.
Ignore the more baroque parts of AArch64ConstantIslandsPass.cpp, yours
will probably only have to add a bunch of CONSTPOOL_ENTRYs at the end
of the function (the doInitialPlacement method, though even that does
more than you need).
I'll watch with interest to see how you handle it, AArch64 will
probably have the same issues in the large code model.
Cheers.
Tim.