I am working towards a more complete solution for large constants in mips 16 (ala Arm constant islands and such). That is part of why I'm busy expanding all macros being emitted in the mips 16 compiler (almost done). I'm wondering if there is a poor mans approach for large constants that can be done very simply that I can add just for now. Gcc mips 16 places them after the function in the text section. Mips 16 , unlike mips32, has a pc relative load. 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. Tia. Reed
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.
Why did you take out the constant island code for Arm 64? Just did not need it? On 02/21/2013 12:01 PM, Tim Northover wrote:> 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. >