Hi Ben, That did help. I continue to notice the virtual register in the program. I use LLVM 3.4. The program i am looking at is a very simple one. Listed below int global_var; int *global_ptr; int32_t main(int32_t argc, char ** argv){ int p = 10; int k = 20; int *pp; char *c_pp; pp = &k; global_ptr = pp; pp = &p; global_ptr = &global_var; return 0; } BR/Nizam From: "Benjamin Kramer" <benny.kra at gmail.com> To: nizam at cse.iitm.ac.in Cc: "llvmdev" <llvmdev at cs.uiuc.edu> Sent: Saturday, February 1, 2014 9:57:00 PM Subject: Re: [LLVMdev] Eliminate SSA Virtual registers On 01.02.2014, at 16:47, nizam at cse.iitm.ac.in wrote:> Hi, > > is there a opt pass that replaces the SSA virtual registers to stack-variables? I want to eliminate the SSA virtual register from my IR. Kindly suggestTry the register to memory demotion pass. opt -reg2mem - Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140201/6292de2f/attachment.html>
I mean to say didnt help. :) From: nizam at cse.iitm.ac.in To: "Benjamin Kramer" <benny.kra at gmail.com> Cc: "llvmdev" <llvmdev at cs.uiuc.edu> Sent: Saturday, February 1, 2014 9:53:55 PM Subject: Re: [LLVMdev] Eliminate SSA Virtual registers Hi Ben, That did help. I continue to notice the virtual register in the program. I use LLVM 3.4. The program i am looking at is a very simple one. Listed below int global_var; int *global_ptr; int32_t main(int32_t argc, char ** argv){ int p = 10; int k = 20; int *pp; char *c_pp; pp = &k; global_ptr = pp; pp = &p; global_ptr = &global_var; return 0; } BR/Nizam From: "Benjamin Kramer" <benny.kra at gmail.com> To: nizam at cse.iitm.ac.in Cc: "llvmdev" <llvmdev at cs.uiuc.edu> Sent: Saturday, February 1, 2014 9:57:00 PM Subject: Re: [LLVMdev] Eliminate SSA Virtual registers On 01.02.2014, at 16:47, nizam at cse.iitm.ac.in wrote:> Hi, > > is there a opt pass that replaces the SSA virtual registers to stack-variables? I want to eliminate the SSA virtual register from my IR. Kindly suggestTry the register to memory demotion pass. opt -reg2mem - Ben _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140201/9af7865f/attachment.html>
The reg2mem pass only eliminates phi nodes, using the stack to pass values between basic blocks. LLVM models a register based CPU, not a stack based one. All calculations are assumed to be performed in registers with the arguments and results loaded and stored from the stack. What other constraints are you hoping to enforce on your flavour of IR? On Sun, Feb 2, 2014 at 3:27 AM, <nizam at cse.iitm.ac.in> wrote:> I mean to say didnt help. :) > > ------------------------------ > *From: *nizam at cse.iitm.ac.in > *To: *"Benjamin Kramer" <benny.kra at gmail.com> > *Cc: *"llvmdev" <llvmdev at cs.uiuc.edu> > *Sent: *Saturday, February 1, 2014 9:53:55 PM > > *Subject: *Re: [LLVMdev] Eliminate SSA Virtual registers > > > Hi Ben, > > > That did help. I continue to notice the virtual register in the program. I > use LLVM 3.4. The program i am looking at is a very simple one. Listed > below > > int global_var; > int *global_ptr; > > int32_t main(int32_t argc, char ** argv){ > int p = 10; > int k = 20; > int *pp; > char *c_pp; > > pp = &k; > global_ptr = pp; > pp = &p; > global_ptr = &global_var; > return 0; > } > BR/Nizam > > > > ------------------------------ > *From: *"Benjamin Kramer" <benny.kra at gmail.com> > *To: *nizam at cse.iitm.ac.in > *Cc: *"llvmdev" <llvmdev at cs.uiuc.edu> > *Sent: *Saturday, February 1, 2014 9:57:00 PM > *Subject: *Re: [LLVMdev] Eliminate SSA Virtual registers > > > On 01.02.2014, at 16:47, nizam at cse.iitm.ac.in wrote: > > > Hi, > > > > is there a opt pass that replaces the SSA virtual registers to > stack-variables? I want to eliminate the SSA virtual register from my IR. > Kindly suggest > > Try the register to memory demotion pass. opt -reg2mem > > - Ben > > > _______________________________________________ > 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 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140202/a403f05e/attachment.html>