I appreciate your suggestions, some follow-up questions though....>1) LLVM has the capabilities to do everything that you are trying to >re-implement. >2) Have you looked at the C backend? It recreates loops. It may not >create "for" loops but you can hack on it to do that.I wonder if you mean "goto elimination technique" by Ana Maria Erosa ( http://citeseer.ist.psu.edu/317208.html ) for this?>3) The way you are converting out of SSA is wrong. You will suffer >from lost copies. You should look at using demotePHI(). see include/ >llvm/Transforms/Utils/Local.hI use LLVM 1.9 where I can't find demotePHI(). Is it a function available at later versions?>4) LLVM will compute your trip counts for you, use LoopInfo. You >need to be in SSA form to do this. > >-Tanya >Do you mean -loops pass, right? Thank you in advance. Best regards, Seung
>> 1) LLVM has the capabilities to do everything that you are trying to >> re-implement. >> 2) Have you looked at the C backend? It recreates loops. It may not >> create "for" loops but you can hack on it to do that. > > I wonder if you mean "goto elimination technique" by Ana Maria Erosa ( > http://citeseer.ist.psu.edu/317208.html ) for this?I mean exactly this: look at the C backend in LLVM. It goes from LLVM IR in SSA form to C code. LLVM has everything you are trying to reimplement. You should spend some time looking through doxygen or the source code for examples.>> 3) The way you are converting out of SSA is wrong. You will suffer >> from lost copies. You should look at using demotePHI(). see include/ >> llvm/Transforms/Utils/Local.h > > I use LLVM 1.9 where I can't find demotePHI(). Is it a function available at later versions?It is not in 1.9. You should really consider upgrading to 2.1 or 2.2 (its out in a week). 1.9 is almost 1.5 years old! demotePHI is in 2.1.> >> 4) LLVM will compute your trip counts for you, use LoopInfo. You >> need to be in SSA form to do this.> Do you mean -loops pass, right? >I mean this: http://llvm.org/doxygen/LoopInfo_8h-source.html Require the analysis in your pass and use it. -Tanya