This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Creating temporary variables


Ian Lance Taylor wrote:
> VIbhav Garg <vibhtech@yahoo.com> writes:
> 
> 
>>I am working on some optimizations on the CFG. Can someone please give
>>me some info on the following -
>>
>>1. For an gimple expression node, how do we determine the return type?
> 
> 
> You can get the type of any gimple expression using TREE_TYPE.
> 
> 
>>2. How do we create a temporary variable, and add it to the list of
>>variables defined in the current function declaration?
> 
> 
> create_tmp_var.

I have seen calls to add_referenced_tmp_var after a call to
create_tmp_var. Is this necessary?
> 
> 
>>3. Any particular code I can look at to see how it works.
> 
> 
> grep for create_tmp_var.
> 
> 
>>4. Any issues I should be aware of?
> 
> 
> It kinds of depends on when during the compilation you are doing this.
> When in SSA form you probably need to do other stuff as well.

I am doing this before SSA form is applied but after CFG is built.
> 
> Ian
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]