Hi all,
I´ve been working on a transformation pass which performs the remotion of some redundant instructions.
So now it´s finished I´d like to run the optimized programs generated by my pass.
But I´ve got some problems to do this, because I didn´t find a way to generate assembly from the code and then call the gcc compiler to produce machine-dependent code.
Please, does anybody know how to run programs optmized by passes?
Thanks you all!
Best regards,
Alysson
How are you getting LLVM to run your pass? There's plenty of
information here if you haven't found this document:
http://llvm.org/docs/WritingAnLLVMPass.html
I'm going to assume you're using `opt -load MyPass.so -my-pass
input.bc -o output.bc` in which case you can just run llc on output.bc
to get a .s file.
Reid
Thank you for the answer Reid.
I’ve been already using the format opt -load MyPass.so -my-pass input.bc -o output.bc
.
But my problem is to execute the .s generated file.
As long as I know, gcc compiler is capable to generate target machine code from assembly.
So I tried to compile it with gcc to generate machine code, but there was many problems.
Is there any way to compile and run .s files?
Best regards,
Alysson
I don’t know if there is something to do with my problem, but I’m using VMKit front-end to generate the .bc files.
So, after generating the example.bc, I remove some redundant instructions with my pass with opt.
You should post the errors you get when creating the final executable with gcc.
I'm guessing you need to do some linking with the VMKit runtime, but
you should look at the VMKit documentation.
Reid