[LLVMdev] ToT ARM Code generator causing - Error: invalid constant (xxx) after fixup in assembly output
root at 32bitmicro.com
Tue Aug 17 19:53:39 PDT 2010
This problem happens in ToT under specific conditions - namely there is
a big BB#671 basic block of code
the just copies data from memory location to another. At the beginning
of BBB#671 r0 is loaded
from the jumptable in the constant pool immediately after it.
Displacement from the pc
in this case is #1476 which is way above magic #1020 hence the error
Both ARMCodeEmitter::emitLEApcrelJTInstruction() and emitJumpTableAddress()
are responsible for the offending instruction adr r0, #.LJTI8485_1_1
But besides the fact that they do not complain about the invalid offset
from the pc I do not see
anything wrong here.
The problem seems to be in the ARMConstantIslands which is not splitting
smaller pieces and thus producing over the limit 'add' opcode.
This code fragment below is produced from a rather large bitcode file
that resists being reduced to something
more manageable. As a result keystrokes in gdb are very "expensive " and
taxing my machine rather heavily.
Any thoughts and hints on debugging this issue would be much appreciated!
I have used llc with these options to produce the output:
llc -O0 -regalloc=fast -relocation-model=pic l.bc -o ll-2.8.s
@ BB#671: @ %bb154
@ in Loop: Header=BB8485_1112
adr r0, #.LJTI8485_1_1
ldr r1, [sp, #3300]
ldr r2, [r0, r1, lsl #2]
lots of boring code omitted
add pc, r2, r0
When assembler runs on the output we get:
ll-2.8.s:1916640: Error: invalid constant (5c4) after fixup
All of the tools used were proper ARM cross compiler,assembler, etc
running on x86_64
and no bitcode was ever harmed during debugging.
More information about the llvm-dev