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:
.long 0 @ 0x0
.size test, 4
at the Module’s end.
I need to access the data with PC relative instructions like LDR Rd, (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.