[LLVMdev] using GCC LTO files as a frontend to dragonegg?
Marcus Daniels
mdaniels at lanl.gov
Fri Sep 10 11:37:17 PDT 2010
Hello,
With GCC, it is possible to compile GIMPLE from an object file back to
assembly. With Dragonegg, it seems to be a NOP. (See below for a
comparison.)
This appears it could be a nice way to mix the strengths of GCC and
LLVM. If it worked.. Should it?
Thanks,
Marcus
[mdaniels at dn002 dragonegg]$ cat hello.c
#include <stdio.h>
int hello () { printf ("Hello World\n"); }
[mdaniels at dn002 dragonegg]$ gcc-4.5 -flto -c hello.c[mdaniels at dn002
dragonegg]$ gcc-4.5 -S -x lto hello.o
[mdaniels at dn002 dragonegg]$ cat hello.s
.file "hello.o"
.section .rodata
.LC0:
.string "Hello World"
.text
.globl hello
.type hello, @function
hello:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
movl $.LC0, %edi
call puts
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size hello, .-hello
.ident "GCC: (GNU) 4.5.1"
.section .note.GNU-stack,"", at progbits
[mdaniels at dn002 dragonegg]$ cat hello.c
#include <stdio.h>
int hello () { printf ("Hello World\n"); }
[mdaniels at dn002 dragonegg]$ gcc-4.5 -flto -c hello.c
[mdaniels at dn002 dragonegg]$ rm -f hello.s
[mdaniels at dn002 dragonegg]$ gcc-4.5 -O0 -c -x lto -S hello.o
[mdaniels at dn002 dragonegg]$ cat hello.s
.file "hello.o"
.section .rodata
.LC0:
.string "Hello World"
.text
.globl hello
.type hello, @function
hello:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
movl $.LC0, %edi
call puts
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size hello, .-hello
.ident "GCC: (GNU) 4.5.1"
.section .note.GNU-stack,"", at progbits
[mdaniels at dn002 dragonegg]$ rm -f hello.s
[mdaniels at dn002 dragonegg]$ gcc-4.5 -fplugin=./dragonegg.so -c -x lto
-flto -S hello.o
[mdaniels at dn002 dragonegg]$ cat hello.s
.file "hello.o"
.ident "GCC: (GNU) 4.5.1 LLVM: 113541"
.section .note.GNU-stack,"", at progbits
More information about the llvm-dev
mailing list