View Single Post
Old 21 May 2015, 22:14   #100
nogginthenog
Amigan

 
Join Date: Feb 2012
Location: London
Posts: 492
Quote:
Originally Posted by Samurai_Crow View Post
There's no backend for 68k on LLVM yet. I want to write one but got no farther than starting a project on SourceForge.net. The backend for GCC isn't good either.
Have you seen this:
https://github.com/kwaters/llvm-m68k

I compiled it and it does work (Debian Linux). But any C function call fails...

test.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;
}
clang -emit-llvm test.c -c -O2 -o test.ll
./llvm-m68k/build/bin/llc -march=m68k test.ll

test.s
Code:
        SEG     'main'
; GLOBAL foo
foo     PROC                            ; @foo
; BB#0:
        move.l  #131072, d1
        or.l    (a6), d1
        move.b  4(a6), d0
        ext.w   d0
        ext.l   d0
        add.l   d1, d0
        rts

        END
nogginthenog is offline  
 
Page generated in 0.08029 seconds with 9 queries