View Single Post
Old 08 July 2015, 18:33   #1
Registered User

Join Date: Jul 2015
Location: UK
Posts: 10
LLVM / Clang Progress

Thought I'd start a new thread on progress with getting LLVM working with a m68k backend. I've got a fair bit of the plumbing in now for calls (I think), working from one of the other backends as a source (as the whole m68k backend was by the looks of it).

I've got as far as getting this --

# 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<imp-def>, %A7<imp-use>
        %vreg2<def> = COPY %A7; DR32:%vreg2
        %vreg1<def> = COPY %vreg2; AR:%vreg1 DR32:%vreg2
        MOVElim %vreg1<kill>, 0, 10; mem:ST4[<unknown>](align=2) AR:%vreg1
        %vreg2<def,tied1> = ADDlqd %vreg2<tied0>, 4, %CCR<imp-def,dead>; DR32:%vreg2
        %vreg3<def> = COPY %vreg2; AR:%vreg3 DR32:%vreg2
        MOVEbim %vreg3<kill>, 0, 12; mem:ST1[<unknown>] AR:%vreg3
        CALL <ga:@foo>, %A7<imp-use>, ...
        ADJCALLSTACKUP 6, 0, %A7<imp-def>, %A7<imp-use>
        %vreg4<def> = COPY %D0L; DR32:%vreg4
        MOVEldm <fi#0>, 0, %vreg4<kill>; mem:ST4[%b] DR32:%vreg4
        %vreg5<def> = MOVEQ 0; DR32:%vreg5
        %D0L<def> = COPY %vreg5<kill>; 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<def> = COPY %D0L; DR32:%vreg4
- operand 1:   %D0L
LLVM ERROR: Found 1 machine code errors.
Stack dump:
0.      Program arguments: D:\RetroMods\Jaguar\Compiler\llvm-build\bin\Debug\llc
.exe -mtriple m68k-apple-mac test.ll
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'Greedy Register Allocator' on function '@main'
Press any key to continue . . .
from this:

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);
Which looks to me like the D0 output from the call isn't being registered as existing at that point or something. I'm completely new to LLVM development, so if anyone knows anything about this stuff please chime in. I'm trying the LLVM dev lists for info too...
SainT is offline  
AdSense AdSense  
Page generated in 0.05227 seconds with 9 queries