public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* New flag: TREE_THIS_NOTRAP
@ 2004-06-09 14:03 Andrew Haley
  2004-06-09 21:45 ` Richard Henderson
  2004-06-09 21:46 ` Richard Henderson
  0 siblings, 2 replies; 17+ messages in thread
From: Andrew Haley @ 2004-06-09 14:03 UTC (permalink / raw)
  To: gcc-patches

The idea here is to allow a language front end to tell the back end
what operands might generate traps.  Java already knows which memory
references cannot trap, and marking these MEM_NOTRAP_P reduces the
number of exception edges and improves scheduling.

There aren't any bits left in tree_common, so this patch (ab)uses
nothrow_flag.

I'm not convinced that this is the best solution, but I'm not sure how
else to do it.

Andrew.


2004-06-09  Andrew Haley  <aph@redhat.com>

	* tree.h (TREE_THIS_NOTRAP): New.
	* emit-rtl.c (set_mem_attributes_minus_bitpos): Set
	MEM_NOTRAP_P from TREE_THIS_NOTRAP.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.393
diff -p -2 -c -r1.393 emit-rtl.c
*** emit-rtl.c	28 May 2004 06:27:31 -0000	1.393
--- emit-rtl.c	9 Jun 2004 12:33:14 -0000
*************** set_mem_attributes_minus_bitpos (rtx ref
*** 1544,1547 ****
--- 1544,1548 ----
  	|| (! TYPE_P (t) && TREE_CONSTANT (t)));
    MEM_POINTER (ref) = POINTER_TYPE_P (type);
+   MEM_NOTRAP_P (ref) = TREE_THIS_NOTRAP (t);
  
    /* If we are making an object of this type, or if this is a DECL, we know
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.506
diff -p -2 -c -r1.506 tree.h
*** tree.h	7 Jun 2004 02:10:48 -0000	1.506
--- tree.h	9 Jun 2004 12:33:15 -0000
*************** struct tree_common GTY(())
*** 306,309 ****
--- 306,312 ----
  	   ..._TYPE
  
+        TREE_THIS_NOTRAP in
+            VAR_DECL, arithmetic expressions
+ 
     deprecated_flag:
  
*************** extern void tree_operand_check_failed (i
*** 789,792 ****
--- 792,801 ----
  #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag)
  
+ /* Nonzero means this node will not trap.  In a MEM, means accessing
+    the memory at this node won't generate a trap.  However, this only
+    applies to an object when used appropriately: it doesn't mean that
+    writing a READONLY mem won't trap.  */
+ #define TREE_THIS_NOTRAP(NODE) ((NODE)->common.nothrow_flag)
+ 
  /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
     nonzero means it may not be the lhs of an assignment.  */

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2004-06-16 17:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-09 14:03 New flag: TREE_THIS_NOTRAP Andrew Haley
2004-06-09 21:45 ` Richard Henderson
2004-06-09 21:46 ` Richard Henderson
2004-06-10 12:45   ` Andrew Haley
2004-06-10 18:06     ` Richard Henderson
2004-06-11 18:18       ` Andrew Haley
2004-06-11 20:37         ` Richard Henderson
2004-06-11 20:44           ` Andrew Haley
2004-06-11 20:49             ` Richard Henderson
2004-06-14 22:26               ` Jason Merrill
2004-06-16 17:17               ` Andrew Haley
2004-06-16 17:17                 ` Andrew Haley
2004-06-16 17:35                   ` Frank Ch. Eigler
2004-06-16 17:35                     ` Andrew Haley
2004-06-16 18:30                 ` Richard Henderson
2004-06-15  2:39             ` Tom Tromey
2004-06-15 11:50               ` Andrew Haley

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).