I think it might have been done to handle the case where i is volatile.
It might also be needed for code dealing with auto decrement coupled with 
pointer dereferencing and the computing of pointer involves an expression 
having side effects.

Murthy

-----Original Message-----
From: Gilmore, Doug [mailto:doug.gilm...@amd.com] 
Sent: Wednesday, September 29, 2010 10:39 AM
To: "C. Bergström"; open64-devel
Subject: Re: [Open64-devel] WHIRL question

I suspect that the translation is done in a way that that ensures correctness.

The temp is not needed in your example, but it is needed for:

j = i-- + i--

Doug
> -----Original Message-----
> From: "C. Bergström" [mailto:cbergst...@pathscale.com]
> Sent: Wednesday, September 29, 2010 7:15 AM
> To: open64-devel
> Subject: [Open64-devel] WHIRL question
> 
> (forwarding this question)
> 
> This code
>         j = --i + i--;
> 
> Is transformed into this (pseudo)WHIRL:
> 
> STID(i) - ADD - LDID(i)                         ; this is the side
>               \ INTCONST(-1)                    ; effect of the --i
> expression
> 
> STID(preg_I4) - LDID(i)                               ; storage of the 
> previous
>                                               ; i value
> 
> STID(i) - ADD - LDID(i)                         ; this is the side
>               \ INTCONST(-1)                    ; effect of the i--
> expression
> 
> STID(j) - ADD - LDID(preg_I4)                   ; the actual
>               \ LDID(i)                         ; j = .... expression
> 
> what is the advantage of this WHIRL instead of
> 
> STID(i) - ADD - LDID(i)                         ; this is the side
>               \ INTCONST(-1)                    ; effect of the --i
> expression
> 
> STID(j) - ADD - LDID(i)                         ; the actual
>               \ LDID(i)                         ; j = .... expression
> 
> STID(i) - ADD - LDID(i)                         ; this is the side
>               \ INTCONST(-1)                    ; effect of the --i
> expression
> 
> 
> the first version just uses one more WHIRL node and one more variable.
> why is it used? is it because it's easier to rewrite C -> WHIRL in that
> way?
> 
> 
> -----------------------------------------------------------------------
> -------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Open64-devel mailing list
> Open64-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open64-devel



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to