Chuck Zhao
2011-Jun-20 03:03 UTC
[LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
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>
Xi Wang
2011-Jun-20 03:19 UTC
[LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
I guess AU.addRequiredID(DemoteRegisterToMemoryID) would do the trick. - xi On Jun 19, 2011, at 11:03 PM, Chuck Zhao wrote:> 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 > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Chuck Zhao
2011-Jun-20 15:38 UTC
[LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
Xi, Thank you for the comments. I also found a recent comment (from John Criswell) on Transformation Pass as a pre requisite: http://comments.gmane.org/gmane.comp.compilers.llvm.devel/35640 My problem is now solved :-) Chuck On 6/19/2011 11:19 PM, Xi Wang wrote:> I guess AU.addRequiredID(DemoteRegisterToMemoryID) would do the trick. > > - xi > > On Jun 19, 2011, at 11:03 PM, Chuck Zhao wrote: > >> 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 >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Apparently Analagous Threads
- [LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
- [LLVMdev] Pass Incompatibility
- [LLVMdev] Pass Incompatibility
- [LLVMdev] Specify dominator for BasicBlock to avoid "Instruction does not dominate all uses!"
- [LLVMdev] eliminate phi nodes, reduce unnecessary loads / stores , reg2mem, mem2reg