[LLVMdev] Problems on getting the OPT resultant bitcode

Duncan Sands baldrick at free.fr
Sat Apr 7 00:26:53 PDT 2012


Hi Andy,

> I want to write a piece of code to instrument c++ programs. I have finished
> writing the pass, but I do not know how to get the resultant bitcode
>
> I ran OPT with the following arguments:
>
> opt -basiccg -basicaa -load /home/andy/llvm-3.0.src/Release/lib/InstTest.so
> -InstTest </home/andy/llvm-3.0.src/workspace/threadTest/Debug/threadTest.bc>
> -o=</home/andy/output/out.bc> /dev/null

are you really using "<" and ">" here, or were they just for emphasis?  The
shell interprets "<" and ">" as input and output redirectors so you will get
strange behaviour if you use them like this.  Also, there is no need to use
an equals sign "=" after -o, it can just be "-o /home/andy/output/out.bc".
Finally, why did you put /dev/null?

Anyway, try this:

opt -basiccg -basicaa -load /home/andy/llvm-3.0.src/Release/lib/InstTest.so 
-InstTest /home/andy/llvm-3.0.src/workspace/threadTest/Debug/threadTest.bc -o 
/home/andy/output/out.bc

Ciao, Duncan.

>
> where </home/andy/llvm-3.0.src/workspace/threadTest/Debug/threadTest.bc> is the
> input file, and </home/andy/output/out.bc> is the expected output file. InstTest
> is my pass.
>
> However, opt treat </home/andy/output/out.bc> as the input file, and I cannot
> find any output any where. Also, if I donot use the "-o" argument, the input is
> </home/andy/llvm-3.0.src/workspace/threadTest/Debug/threadTest.bc> as expected
> but still I cannot find the output (the resultant bitcode).
>
> What should I do?
>
> I am expecting for your reply. Thank you very much.
>
> Best Regards,
> Andy
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list