<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">I found that this error is caused by the visit(M) ,once I delete this. It runs without errors.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">
And, I found that some of my previous pass also can not run(didn't happen before) normally with the same error. If I delete the code which will reference the Module &M, the error disappear.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">
That is very strange. What's wrong with that?<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/9 Jin Huang <span dir="ltr"><<a href="mailto:54jin.huang@gmail.com" target="_blank">54jin.huang@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Sorry, I copied it from the shell, so the format may be not right! I used the opt command just like you wrote!</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">
<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">
-JinHuang</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/9 Arnaud Allard de Grandmaison <span dir="ltr"><<a href="mailto:arnaud.adegm@gmail.com" target="_blank">arnaud.adegm@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>The opt invocation looks weird to me. I would expect something like:<br><br>opt -load /home/king/llvm/Release+Asserts/lib/instVisit.so -visitInst load.bc<br>
<br></div>Cheers,<br>--<br></div>Arnaud<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 9, 2014 at 1:49 PM, JinHuang <span dir="ltr"><<a href="mailto:54jin.huang@gmail.com" target="_blank">54jin.huang@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.All<br>
I had a problem in using llvm::InstVisitor class, my pass is like that:<br>
<br>
using namespace llvm;<br>
<br>
namespace<br>
{<br>
class InstVisit : public ModulePass,<br>
public InstVisitor<InstVisit><br>
{<br>
public :<br>
static char ID;<br>
InstVisit():ModulePass(ID){}<br>
<br>
virtual bool runOnModule(Module &M)<br>
{<br>
visit(M);<br>
return false;<br>
}<br>
<br>
void visitStoreInst(StoreInst &SI)<br>
{<br>
errs()<<"a store inst:"<<&SI<<"\n";<br>
}<br>
};<br>
<br>
char InstVisit::ID = 0;<br>
static RegisterPass<InstVisit><br>
X("visitInst","visit inst test");<br>
}<br>
<br>
then I use<br>
opt -load /home/king/llvm/Release+Asserts/lib/instVisit.so<br>
-visitInst<load.bc> /dev/null<br>
to run the pass. but it appears such errors:<br>
<br>
0 opt 0x00000000012700d2 llvm::sys::PrintStackTrace(_IO_FILE*)<br>
+ 34<br>
1 opt 0x000000000126fd29<br>
2 libpthread.so.0 0x00007f9ba0336bd0<br>
3 instVisit.so 0x00007f9b9f33a200<br>
4 opt 0x00000000012081ef<br>
llvm::MPPassManager::runOnModule(llvm::Module&) + 655<br>
5 opt 0x0000000001209f7f<br>
llvm::PassManagerImpl::run(llvm::Module&) + 223<br>
6 opt 0x000000000057e1ac main + 3772<br>
7 libc.so.6 0x00007f9b9f55eea5 __libc_start_main + 245<br>
8 opt 0x000000000058fe65<br>
Stack dump:<br>
0. Program arguments: opt -load<br>
/home/king/llvm/Release+Asserts/lib/instVisit.so -visitInst<br>
1. Running pass 'visit inst test' on module '<stdin>'.<br>
Segmentation fault (core dumped)<br>
<br>
the load.c is :<br>
<br>
int main() {<br>
int x, y, z;<br>
<br>
x = 12;<br>
y = x + 22; /* load value of x that was just stored */<br>
z = y + 33; /* load value of y that was just stored */<br>
return z;<br>
}<br>
<br>
there is no stdin in the program .but why it says "Running pass 'visit inst<br>
test' on module '<stdin>'."<br>
<br>
Thank You!<br>
<br>
-JinHuang<br>
<br>
<br>
<br>
<br>
-----<br>
Kind Regards!<br>
<span><font color="#888888">-JinHuang<span><font color="#888888"><br>
--<br>
View this message in context: <a href="http://llvm.1065342.n5.nabble.com/InstVisitor-usage-problem-tp64909.html" target="_blank">http://llvm.1065342.n5.nabble.com/InstVisitor-usage-problem-tp64909.html</a><br>
Sent from the LLVM - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</font></span></font></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Kind Regards!<div>-Jin Huang</div></div>
</div>