public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR 37363 follow-on 2: define a grammar for CONSTs
@ 2008-11-11  6:51 Richard Sandiford
  0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2008-11-11  6:51 UTC (permalink / raw)
  To: gcc-patches

As discussed previously, this patch defines a grammar for RTL
CONST expressions.  After the previous two patches, I think the
only exception to this grammar is the in the m68hc11 port, whose
trampoline set-up routines use (const (symbol_ref ...)) -- rather
than plain symbol_ref -- to refer to the static chain register.
(The static chain register is the "soft" -- i.e. in-memory --
register Z.)

The port uses (const (symbol_ref ...)) rather than symbol_ref
to avoid extra syntax in print_operand.  However, the idea of
using symbol_refs to refer to registers behind gcc's back just
seems Plain Wrong.  I believe it's there because md_reorg tries
to replace references to Z with references to a hard register,
and this code does not appear to handle cases where Z is live
on entry to the function.

I don't really have time to fix that, and m68hc11 is currently
on the deprecation list anyway, so...

Tested by inspecting the pdf, html and info output.  OK to install?

Richard


gcc/
	* doc/rtl.texi: Define a grammar for consts.

Index: gcc/doc/rtl.texi
===================================================================
--- gcc/doc/rtl.texi	2008-11-10 23:00:17.000000000 +0000
+++ gcc/doc/rtl.texi	2008-11-10 23:12:13.000000000 +0000
@@ -1582,13 +1582,22 @@ Usually that is the only mode for which 
 @findex const
 @item (const:@var{m} @var{exp})
 Represents a constant that is the result of an assembly-time
-arithmetic computation.  The operand, @var{exp}, is an expression that
-contains only constants (@code{const_int}, @code{symbol_ref} and
-@code{label_ref} expressions) combined with @code{plus} and
-@code{minus}.  However, not all combinations are valid, since the
-assembler cannot do arbitrary arithmetic on relocatable symbols.
+arithmetic computation.  The valid values of @var{exp} are:
 
-@var{m} should be @code{Pmode}.
+@itemize
+@item @samp{(unspec:@var{m} @var{v} @var{c})}
+@item @samp{(plus:@var{m} (unspec:@var{m} @var{v} @var{c}) (const_int @var{offset}))}
+@item @samp{(plus:@var{m} (symbol_ref:@var{m} @var{base}) (const_int @var{offset}))}
+@item @samp{(plus:@var{m} (label_ref:@var{m} @var{base}) (const_int @var{offset}))}
+@end itemize
+
+There is no defined way for target-independent code to tell whether a
+particular @code{unspec} expression can be wrapped in a @code{const}.
+Target-independent code should therefore only create the first two
+forms if it knows that the same @samp{(unspec:@var{m} @var{v} @var{c})}
+occurs somewhere within another @code{const}'s @var{exp}.
+
+@var{m} is usually @code{Pmode}.
 
 @findex high
 @item (high:@var{m} @var{exp})

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-10 23:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-11  6:51 PR 37363 follow-on 2: define a grammar for CONSTs Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).