<div dir="ltr"><div><div><div>Thank you John,<br><br></div>I was able to get my code to work by copying poolalloc. The crucial part I was missing is the third line here<br><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
static RegisterPass<AllButUnreachableFromMemoryHeuristic> B("paheur-AllButUnreachableFromMemory", "Pool allocate all reachable from memory objects");</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
static RegisterAnalysisGroup<Heuristic> HeuristicGroup("Pool Allocation Heuristic");<br>RegisterAnalysisGroup<Heuristic> Heuristic2(B);<br></blockquote><br></div>As I mentioned above, RegisterAnalysisGroup is never used in the llvm source tree, and the tutorial tells you about the usage on the second line, but it tells you to use INITIALIZE_AG_PASS instead of the third line and makes no mention of using RegisterAnalysisGroup this way. I'm not sure how one was expected to find out about this usage, perhaps someone could update the tutorial to include this?<br>
<br></div><div>Jeremy<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 12, 2014 at 6:43 PM, Jeremy Salwen <span dir="ltr"><<a href="mailto:jeremysalwen@gmail.com" target="_blank">jeremysalwen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Eli, I'm referring to building a project in its own directory, without a copy of the llvm source being involved at all. If I grep for RegisterAnalysisGroup it only shows up in the header file it's defined, and in the docs directory. (RegisterPass does show up however, just not in all of the passes).<br>
<br></div>John, thanks, I'm taking a look at poolalloc. It doesn't seem to compile with the latest SVN, but hopefully the code regarding analysis groups is up to date[1]<br><br></div>Jeremy<br><br></div><div>[1] I had to make some changes for headers being moved around, but after doing so, I still got error messages<br>
<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">llvm[2]: Compiling AddressTakenAnalysis.cpp for Release+Asserts build (PIC)<br>AddressTakenAnalysis.cpp: In function ‘bool isAddressTaken(llvm::Value*)’:<br>
AddressTakenAnalysis.cpp:39:16: error: cannot convert ‘llvm::Use’ to ‘llvm::User*’ in initialization<br> User *U = *I;<br> ^<br>AddressTakenAnalysis.cpp:63:25: error: no matching function for call to ‘llvm::CallSite::isCallee(llvm::Value::use_iterator&)’<br>
if (!CS.isCallee(I))<br> ^<br>AddressTakenAnalysis.cpp:63:25: note: candidates are:<br>In file included from AddressTakenAnalysis.cpp:25:0:<br>/home/jeremy/hardware/llvm/llvmsource/llvm-toolchain-snapshot-3.5~svn209039/include/llvm/IR/CallSite.h:106:8: note: bool llvm::CallSiteBase<FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy>::isCallee(llvm::Value::const_user_iterator) const [with FunTy = llvm::Function; ValTy = llvm::Value; UserTy = llvm::User; InstrTy = llvm::Instruction; CallTy = llvm::CallInst; InvokeTy = llvm::InvokeInst; IterTy = llvm::Use*; llvm::Value::const_user_iterator = llvm::Value::user_iterator_impl<const llvm::User>]<br>
bool isCallee(Value::const_user_iterator UI) const {<br> ^<br>/home/jeremy/hardware/llvm/llvmsource/llvm-toolchain-snapshot-3.5~svn209039/include/llvm/IR/CallSite.h:106:8: note: no known conversion for argument 1 from ‘llvm::Value::use_iterator’ to ‘llvm::Value::const_user_iterator {aka llvm::Value::user_iterator_impl<const llvm::User>}’<br>
/home/jeremy/hardware/llvm/llvmsource/llvm-toolchain-snapshot-3.5~svn209039/include/llvm/IR/CallSite.h:111:8: note: bool llvm::CallSiteBase<FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy>::isCallee(const llvm::Use*) const [with FunTy = llvm::Function; ValTy = llvm::Value; UserTy = llvm::User; InstrTy = llvm::Instruction; CallTy = llvm::CallInst; InvokeTy = llvm::InvokeInst; IterTy = llvm::Use*]<br>
bool isCallee(const Use *U) const { return getCallee() == U; }<br> ^<br>/home/jeremy/hardware/llvm/llvmsource/llvm-toolchain-snapshot-3.5~svn209039/include/llvm/IR/CallSite.h:111:8: note: no known conversion for argument 1 from ‘llvm::Value::use_iterator’ to ‘const llvm::Use*’<br>
<br></blockquote></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 12, 2014 at 5:06 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div>
<div>On 6/12/14, 3:46 PM, Jeremy Salwen
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>Hi Eli,<br>
<br>
Thanks for the link! I'm able to compile a standalone pass
outside of the source tree, and I'm obviously ably to
compile analysis groups inside the source tree. However,
the problem comes when I try to do what the tutorial
suggests to create an analysis group outside of the source
tree.<br>
<br>
My understanding is that building out of tree requires
different methods to register the passes. For example, the
class RegisterPass, which the tutorial instructs you to use
(and is used by sample repository you linked), never shows
up in the source tree. Likewise for RegisterAnalysisGroup.
Furthermore I've found that just copying the way it's done
in the source tree and not using RegisterPass causes opt to
not recognize your command-line arguments.<br>
<br>
</div>
<div>Do you know of any other projects that will demonstrate
how to build passes out of tree, only creating an analysis
group as well?<br>
</div>
</div>
</div>
</blockquote>
<br></div>
The poolalloc and SAFECode projects have analysis groups. For
directions on downloading the code, please see
<a href="http://sva.cs.illinois.edu/docs/Install.html" target="_blank">http://sva.cs.illinois.edu/docs/Install.html</a>.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote type="cite"><div>
<div dir="ltr">
<div>
<div><br>
</div>
Thanks<br>
</div>
Jeremy<br>
</div>
<div class="gmail_extra">
<br>
<br>
<div class="gmail_quote">On Thu, Jun 12, 2014 at 4:20 PM, Eli
Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>
<div>On Thu, Jun 12, 2014 at 1:10 PM,
Jeremy Salwen <span dir="ltr"><<a href="mailto:jeremysalwen@gmail.com" target="_blank">jeremysalwen@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>Hello all,<br>
<br>
</div>
I'm trying to follow the guide <a href="http://llvm.org/docs/WritingAnLLVMPass.html" target="_blank">http://llvm.org/docs/WritingAnLLVMPass.html</a>
to build an some passes and analysis
groups out of tree. However, I'm having
some trouble with crashes when I try to
follow the guide. <br>
The first section provides a very useful
example of what the whole .cpp file should
look like for the HelloWorld pass.
Obviously it's a bit more complex to write
the whole setup with an analysis group, an
analysis pass, and a transform pass that
uses the analysis, but example code would
be extremely helpful, and could serve as a
good starting point for anyone who wants
to do something similar. Is there
anywhere i could find such example code,
perhaps as part of a project, that
demonstrates how to define and use an
analysis group out of tree?<br>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
</div>
</div>
<div>It's not entirely clear which part you're having
a problem with. If it's creating an analysis group,
there should be samples within the LLVM source code.
If it's building out-of-tree, take a look at <a href="https://github.com/eliben/llvm-clang-samples" target="_blank">https://github.com/eliben/llvm-clang-samples</a>
-- it's a repository with a bunch of LLVM/Clang
samples, all built out of tree. It keeps pretty
close track to ToT, as well as having branches for
prior releases (3.3 and 3.4, for now).</div>
<span><font color="#888888">
<div><br>
</div>
<div>Eli</div>
<div> </div>
</font></span></div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
</div><pre>_______________________________________________
LLVM Developers mailing list
<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>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</div>
<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>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>