<div dir="ltr">Sorry for the delay.  Yeah, that error message is a bit confusing.  What's happening is that your pass sequence is invalid.  Once the IR has been lowered to machine code, its too late to run LLVM IR passes (ModulePass, FunctionPass, CallGraphSCCPass, etc.).  At that point, you need to run a Machine*Pass, e.g. MachineFunctionPass.  If you need to run an IR level pass, you need to use addIRPasses().</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 24, 2013 at 11:20 AM, Antony Yu <span dir="ltr"><<a href="mailto:swpenim@gmail.com" target="_blank">swpenim@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I try to use INITIALIZE_PASS instead of RegisterPass<> to register my pass,<br>
though I don't understand what's their difference and how it works because<br>
its documents doesn't exist. But it still doesn't work.<br>
<br>
Parts of my codes is as follows:<br>
<br>
in  NVPTXTest.h<br>
<br>
namespace llvm {<br>
<br>
void initializeNVPTXTestPass(PassRegistry &r);<br>
<br>
class NVPTXTest : public ModulePass<br>
{<br>
public:<br>
<br>
    NVPTXTest() : ModulePass(ID){<br>
        initializeNVPTXTestPass(*PassRegistry::getPassRegistry());<br>
<div class="im">    }<br>
    void getAnalysisUsage(AnalysisUsage &AU) const {<br>
        AU.setPreservesAll();<br>
</div>        ModulePass::getAnalysisUsage(AU);<br>
    }<br>
<br>
};<br>
<br>
in NVPTXTest.cpp<br>
<br>
#include "NVPTXTest.h"<br>
<br>
namespace llvm<br>
{<br>
    //static RegisterPass<NVPTXTest> X("test", "Test Module Pass");<br>
<div class="im">    char NVPTXTest::ID = 0;<br>
</div><div class="im">    ModulePass *createTest()<br>
    {<br>
        return new NVPTXTest();<br>
    }<br>
}<br>
</div>using namespace llvm;<br>
<br>
INITIALIZE_PASS(NVPTXTest, "test", "TestModule Pass", true, true);<br>
====<br>
When I use the same way to write a CallGraphSCCPass, it still doesn't work,<br>
but this time it tells me that my CallGraphSCCPass is not initialized<br>
instead of 'NVPTX Assembly Printer'.<br>
It's really weird...<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://llvm.1065342.n5.nabble.com/About-writing-a-modulePass-in-addPreEmitPass-for-NVPTX-tp58701p58770.html" target="_blank">http://llvm.1065342.n5.nabble.com/About-writing-a-modulePass-in-addPreEmitPass-for-NVPTX-tp58701p58770.html</a><br>

<div class="HOEnZb"><div class="h5">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">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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div>
</div>