[LLVMdev] constants in text section for mips 16

Tim Northover t.p.northover at gmail.com
Thu Feb 21 12:01:06 PST 2013


Hi Reed,

> I'm wondering if there is already some mechanism where I can assign literals
> to the text section and get a label for where it has been stored.

I think putting them in the text section is reasonably simple, though
doesn't have a generic "pleasePutConstantsAfterFunctions()" call in
LLVM.

A good place to start would be the reverse of my recent patch to
AArch64 which removed the entire ConstantIslands thing. It looks like
the key points are creating a "CONSTPOOL_ENTRY" "instruction" which is
emitted in the AsmPrinter. A relatively simple pass should be able to
convert constpool entries as LLVM sees them into such instructions
(see "doInitialPlacement").

Most of the complexity is in moving the constants around so that
they're accessible from the instructions that use them, but for a
first approximation that's not needed (beware, PlumHall's ch7_22 is a
prime candidate for exercising this ability even with a 1MB range).

Regards.

Tim.



More information about the llvm-dev mailing list