This is the mail archive of the gcc-patches@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: [PATCH] RTL docs update


On 7/4/07, Seongbae Park (박성배, 朴成培) <seongbae.park@gmail.com> wrote:
On 7/4/07, Richard Sandiford <richard@codesourcery.com> wrote:
> ""Seongbae Park (박성배, 朴成培)"" <seongbae.park@gmail.com> writes:
> > +   FIXME: Replace all uses of UNSPEC that appears by itself or as a component
> > +   of a PARALLEL with USE.
>
> I'm still not convinced by this.  How should SPU's:
>
> (define_insn "iprefetch"
>   [(unspec [(const_int 0)] UNSPEC_IPREFETCH)]
>   ""
>   "hbrp"
>   [(set_attr "type" "iprefetch")])
>
> be written in that case?  What should it use or clobber?
> I suppose ports have been known to use top-level CONST_INTs
> to implement a "nop" pattern, e.g. MIPS's:
>
> (define_insn "nop"
>   [(const_int 0)]
>   ""
>   "%(nop%)"
>   [(set_attr "type"     "nop")
>    (set_attr "mode"     "none")])
>
> but I think it would be cleaner to move _towards_ rather than
> away from UNSPECs in this case.
> > @@ -273,12 +280,20 @@ DEF_RTL_EXPR(SET, "set", "ee", RTX_EXTRA
> >
> >  /* Indicate something is used in a way that we don't want to explain.
> >     For example, subroutine calls will use the register
> > -   in which the static chain is passed.  */
> > +   in which the static chain is passed.
> > +
> > +   USE can not appear as an operand of other rtx except for PARALLEL.
> > +   USE is not deletable, as it indicates that the operand
> > +   is used in some unknown way.  */
> >  DEF_RTL_EXPR(USE, "use", "e", RTX_EXTRA)
> >
> >  /* Indicate something is clobbered in a way that we don't want to explain.
> >     For example, subroutine calls will clobber some physical registers
> > -   (the ones that are by convention not saved).  */
> > +   (the ones that are by convention not saved).
> > +
> > +   CLOBBER can not appear as an operand of other rtx except for PARALLEL.
> > +   CLOBBER of a hard register appearing by itself (not within PARALLEL)
> > +   is considered undeletable before reload.  */
>
> I think the USE comment needs to be clarified to say that a "USE appearing
> by itself (not within PARALLEL)" is not deletable.  It sounds to me like
> the comments above are saying that USEs inside PARALLELs aren't deletable,
> but CLOBBERs are.  The truth is that both are deletable in PARALLELs.
>
> Richard

So, in summary (apology if the table formatting doesn't survive):

                   as insn                 within parallel
within non-parallel rtx
UNSPEC     not deletable       not deletable        deletable
USE            not deletable       deletable              deletable
CLOBBER    not deletable       deletable              deletable

My main gripe is that USE and UNSPEC are similar enough
that the distinction is confusing, and especially USE/CLOBBER
being deletable or not depending on whether it appears as insn or in parallel.
Hence my proposal was to distinguish between those two
by whether there's unknown effect to the runtime state (USE) or not (UNSPEC).
However, it looks like this will be a lot of work with small benefit,
so I'll drop the FIXME part, and update the comment on USE.

Attached is the patch with the update. Presumably this just reflects the current status and nothing more. ChangeLog:

2007-07-03 Seongbae Park <seongbae.park@gmail.com>

       * rtl.def (UNSPEC): Drop FIXME.
       (USE): More comments.
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com";
Index: rtl.def
===================================================================
--- rtl.def	(revision 126330)
+++ rtl.def	(working copy)
@@ -216,11 +216,7 @@
    UNSPEC can occur all by itself in a PATTERN, as a component of a PARALLEL,
    or inside an expression.  
    UNSPEC by itself or as a component of a PARALLEL
-   is currently considered not deletable.
-
-   FIXME: Replace all uses of UNSPEC that appears by itself or as a component
-   of a PARALLEL with USE.
-   */
+   is currently considered not deletable.  */
 DEF_RTL_EXPR(UNSPEC, "unspec", "Ei", RTX_EXTRA)
 
 /* Similar, but a volatile operation and one which may trap.  */
@@ -283,8 +279,12 @@
    in which the static chain is passed.  
 
    USE can not appear as an operand of other rtx except for PARALLEL.
-   USE is not deletable, as it indicates that the operand
-   is used in some unknown way.  */
+   USE appearing as INSN is not deletable,
+   as it indicates that the operand is used in some unknown way.
+   However, USE as an operand of PARALLEL doesn't prevent
+   the PARALLEL insn from being deleted.
+   Use UNSPEC instead if you want to prevent the entire PARALLEL
+   from being deleted.  */
 DEF_RTL_EXPR(USE, "use", "e", RTX_EXTRA)
 
 /* Indicate something is clobbered in a way that we don't want to explain.

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