Hi, 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 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120407/728cdc3a/attachment.html>
Duncan Sands
2012-Apr-07 07:26 UTC
[LLVMdev] Problems on getting the OPT resultant bitcode
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/nullare 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
Hi, I am currently using llvm to compile memcache to get the bitcode. I simply change all the "gcc -c" command to "clang -emit-llvm -c", and output ".o" to ".bc". And all gcc link command to llvm-ld. By these means, I successfully get the bitcode file, but when I run it using "lli", it fails with the error: UNREACHABLE executed!0 lli 0x087c2cabStack dump:0. Program arguments lli timedrun.bc1. Running Pass 'X86 Machine Code Emitter' on function @mainaborted I encountered the same error when executing other executables in the project. Why does this happen? Is there any suggestions to get rid of such problem? Thank you BestAndy -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120918/3c2fa035/attachment.html>
Hi Andy,> I am currently using llvm to compile memcache to get the bitcode. I simply > change all the "gcc -c" command to "clang -emit-llvm -c", and output ".o" to > ".bc". And all gcc link command to llvm-ld. By these means, I successfully get > the bitcode file, but when I run it using "lli", it fails with the error: > > UNREACHABLE executed! > 0 lli 0x087c2cab > Stack dump: > 0. Program arguments lli timedrun.bc > 1. Running Pass 'X86 Machine Code Emitter' on function @main > aborted > > I encountered the same error when executing other executables in the project. > Why does this happen? Is there any suggestions to get rid of such problem?this probably means that the bitcode contains something that is not supported by lli, such as inline assembler. Try passing the -use-mcjit option to lli. If that doesn't work, feel free to open a bugreport and attach the bitcode. Ciao, Duncan.
Reasonably Related Threads
- [LLVMdev] Problems on getting UNREACHABLE executed
- [LLVMdev] Problems on getting UNREACHABLE executed
- [LLVMdev] Problems on getting the OPT resultant bitcode
- [LLVMdev] Find all backedges of CFG by MachineDominatorTree. please look at my jpg.
- [LLVMdev] 转发: Re: Dear Evan Chang, Re: help: about how to use tblgen to constraint operand.