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]

Re: RFA: non-const libcalls


On May  8, 2001, Mark Mitchell <mark@codesourcery.com> wrote:

>>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:
>>> The TeXinfo documentation says that CALL_INSN_FUNCTION_USAGE
>>> should only have CLOBBERs for hard registers, but we go ahead
>>> and put MEMs there too.  What's up with all that?

Alexandre> It seems that I forgot to update the docs, though.  Ok
Alexandre> to install?  Branch and mainline?

> Yes, with a couple of minor changes:

> I think there's an important idea in here, but it's not coming out
> with these words.  Can you expand on that a little and/or provide an
> example that shows what assumptions you can make it the two different
> cases?

How's this?  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* rtl.texi (CALL_INSN_FUNCTION_USAGE): Note that (and when) it may
	contain MEMs.

Index: gcc/rtl.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.texi,v
retrieving revision 1.38
diff -u -p -r1.38 rtl.texi
--- gcc/rtl.texi 2001/04/19 19:44:12 1.38
+++ gcc/rtl.texi 2001/05/12 12:13:40
@@ -2523,13 +2523,32 @@ unpredictably.
 accessed in the same way and in addition contain a field
 @code{CALL_INSN_FUNCTION_USAGE}, which contains a list (chain of
 @code{expr_list} expressions) containing @code{use} and @code{clobber}
-expressions that denote hard registers used or clobbered by the called
-function.  A register specified in a @code{clobber} in this list is
-modified @emph{after} the execution of the @code{call_insn}, while a
-register in a @code{clobber} in the body of the @code{call_insn} is
-clobbered before the insn completes execution.  @code{clobber}
-expressions in this list augment registers specified in
-@code{CALL_USED_REGISTERS} (@pxref{Register Basics}).
+expressions that denote hard registers and @code{MEM}s used or
+clobbered by the called function.
+
+A @code{MEM} generally points to a stack slots in which arguments passed
+to the libcall by reference (@pxref{Register Arguments,
+FUNCTION_ARG_PASS_BY_REFERENCE}) are stored.  If the argument is
+caller-copied (@pxref{Register Arguments, FUNCTION_ARG_CALLEE_COPIES}),
+the stack slot will be mentioned in @code{CLOBBER} and @code{USE}
+entries; if it's callee-copied, only a @code{USE} will appear, and the
+@code{MEM} may point to addresses that are not stack slots.  These
+@code{MEM}s are used only in @code{LIBCALL}s, because they don't
+introduce basic blocks.  Without them, flow would consider the stores
+dead and remove them.  Note that, since a @code{LIBCALL} must never
+return values in memory (@pxref{Aggregate Return, RETURN_IN_MEMORY}),
+there will never be a @code{CLOBBER} for a memory address holding a
+return value.
+
+A register or memory region specified in a @code{clobber} in this list
+is modified @emph{after} the execution of the @code{call_insn} (i.e.,
+it's preserved during the execution of the @code{call_insn} itself, but
+the called function is assumed to clobber it), while a register
+specified in a @code{clobber} in the body of the @code{call_insn} is
+clobbered before the insn completes execution (i.e., it's modified
+before the callee starts executing).  @code{clobber} expressions in this
+list augment registers specified in @code{CALL_USED_REGISTERS}
+(@pxref{Register Basics}).
 
 @findex code_label
 @findex CODE_LABEL_NUMBER

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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