[llvm-dev] Emitting asm variable directive into MachineBasicBlock

Julius Hiller via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 4 09:06:45 PDT 2018


Hello everyone,

I am writing a MachineFunctionPass and need to insert int32 data values 
into my asm file.
I achieved that by adding a GlobalVariable to the MachineFunction's 
Module which gets me something like:

    test:
               .long   0                       @ 0x0
               .size   test, 4

at the Module's end.
I need to access the data with PC relative instructions like LDR Rd, 
<label> (Rd := [label]), where the label range is limited (label range 
PC to PC+1020).
This leads to the problem that the data might be too far away.
The question I face is how to get the data into the corresponding 
BasicBlock.
Can it be done with a MachineInstr?

I am using the ARM backend, ARMv6m Architecture.

Best regards,
Julius Hiller

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180404/baf81c07/attachment.html>


More information about the llvm-dev mailing list