[LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass

Chuck Zhao czhao at eecg.toronto.edu
Sun Jun 19 20:03:05 PDT 2011


I am currently building a BasicBlock pass which requires to run -reg2mem 
before it, and need to run -mem2reg after it to clean up.

So, I want to specify -reg2mem as one of the pre-requisite passes to it, as:


class MyPass: public BasicBlockPass{

   virtual void getAnalysisUsage(AnalysisUsage &AU){
     ...
AU.addRequired<RegToMem>();
     ...
   }

};


I searched all passes under the lib/Transform directory, but didn't find 
a single case of my expected usage.
Though I know opt takes both -reg2mem and -mem2reg as valid arguments 
and does the proper transformation, I didn't figure out how it is being 
done.


What is the right way of doing this?
(Or, is there a different way doing it?)


Thank you very  much


Chuck

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110619/3ba77f48/attachment.html>


More information about the llvm-dev mailing list