Using output from dragonegg

Howdy!
I am trying to understand how to properly use dragonegg. I’ve gotten it on my machine and it runs everything and seems to compile fortran well.

If I run this command:
gcc-4.6 tests/hello_world.f -o hello_world.o -fplugin=./dragonegg.so -S -flto
I get a bunch of LLVM code in the hello_world.o file. What do I do with it next if I want to execute it?
I’ve tried llvm-as and llvm-nm but both of them just throw errors up about file formats or errors that seem to indicate they aren’t being used for their intended purpose.
Thank you,
Zack

Hi Zack,

DragonEgg should give you LLVM IR as an output. Btw, why do you need -fopt?
What to do with LLVM IR - depends on your purpose. You can translate
it to something else using one of available backends, for example, to
x86 assembly:

$ llc -march=x86 hello_world.bc

(It's better to use different extension, because llc would also produce *.o)

Or you can pass this file through any available code transformations,
for example:

$ opt -basicaa -mem2reg -simplifycfg -instcombine -S hello_word.bc -o
hello_world_opt.bc

HTH,
- Dima.

Hi Zack,

I am trying to understand how to properly use dragonegg. I've gotten it on my
machine and it runs everything and seems to compile fortran well.

If I run this command:
gcc-4.6 tests/hello_world.f -o hello_world.o -fplugin=./dragonegg.so -S -flto
I get a bunch of LLVM code in the hello_world.o file. What do I do with it next
if I want to execute it?
I've tried llvm-as and llvm-nm but both of them just throw errors up about file
formats or errors that seem to indicate they aren't being used for
their intended purpose.

llvm-as should work. Maybe your llvm-as is from an older version of LLVM than
dragonegg? What errors do you get exactly?

Ciao, Duncan.