[LLVMdev] New backend help request. (original) (raw)
James Boulton eiconic at googlemail.com
Wed Jul 8 09:40:20 PDT 2015
- Previous message: [LLVMdev] Why change "sub x, 5" to "add x, -5" ?
- Next message: [LLVMdev] New backend help request.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all,
I'm trying to continue an existing m68k backend for LLVM. I'm completely new to LLVM development so I've been muddling my way through mostly by trial and error and using existing back ends for reference. I'm trying to implement code to allow calling. I am compiling this C code --
typedef unsigned int uint32_t; typedef char int8_t;
uint32_t foo(uint32_t x, int8_t y) { return (x | (1 << 17)) + y; }
int main() { uint32_t b = foo(10,12); }
And getting the following error from LLVM --
Machine code for function main: Post SSA
Frame Objects: fi#0: size=4, align=4, at location [SP] Function Live Outs: %D0L
BB#0: derived from LLVM BB %entry ADJCALLSTACKDOWN 6, %A7, %A7 %vreg2 = COPY %A7; DR32:%vreg2 %vreg1 = COPY %vreg2; AR:%vreg1 DR32:%vreg2 MOVElim %vreg1, 0, 10; mem:ST4 AR:%vreg1 %vreg2<def,tied1> = ADDlqd %vreg2, 4, %CCR<imp-def,dead>; DR32:%vreg2 %vreg3 = COPY %vreg2; AR:%vreg3 DR32:%vreg2 MOVEbim %vreg3, 0, 12; mem:ST1[] AR:%vreg3 CALL ga:@foo, %A7, ... ADJCALLSTACKUP 6, 0, %A7, %A7 %vreg4 = COPY %D0L; DR32:%vreg4 MOVEldm <fi#0>, 0, %vreg4; mem:ST4[%b] DR32:%vreg4 %vreg5 = MOVEQ 0; DR32:%vreg5 %D0L = COPY %vreg5; DR32:%vreg5 RTS %D0L<imp-use,kill>
End machine code for function main.
*** Bad machine code: Using an undefined physical register ***
- function: main
- basic block: BB#0 entry (0xa19eac)
- instruction: %vreg4 = COPY %D0L; DR32:%vreg4
- operand 1: %D0L LLVM ERROR: Found 1 machine code errors. Stack dump:
Program arguments:
D:\RetroMods\Jaguar\Compiler\llvm-build\bin\Debug\llc .exe -mtriple m68k-apple-mac test.ll
Running pass 'Function Pass Manager' on module 'test.ll'.
Running pass 'Greedy Register Allocator' on function '@main'
To me this looks like the result from the call (D0) is not being set somewhere to let LLVM know the register is available when it tries to copy it into the virtual register. I'm using the MSP430 target as reference, and I'm doing everything this target is, so I'm not sure what I'm missing.
Any tips would be most appreciated.
- Previous message: [LLVMdev] Why change "sub x, 5" to "add x, -5" ?
- Next message: [LLVMdev] New backend help request.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]