except.c (can_throw_internal_1, [...]): Add "is_resx" argument.
authorJan Hubicka <jh@suse.cz>
Fri, 27 May 2005 22:50:41 +0000 (00:50 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 27 May 2005 22:50:41 +0000 (22:50 +0000)
* except.c (can_throw_internal_1, can_throw_external_1): Add
"is_resx" argument.
(can_throw_external, can_throw_internal): Bring into sync wrt
dealing resx.
* except.h (can_throw_internal_1, can_throw_external_1): Update
prototype.
* tree-eh.c (tree_can_throw_internal, tree_can_throw_external):
Deal properly with resx.

From-SVN: r100282

gcc/ChangeLog
gcc/except.c
gcc/except.h
gcc/tree-eh.c

index b46c46d65064cb6da9fcb783427a3388034a069f..49537c978339925a1ef57688c12af5d49ea33247 100644 (file)
@@ -1,3 +1,14 @@
+2005-05-28  Jan Hubicka  <jh@suse.cz>
+
+       * except.c (can_throw_internal_1, can_throw_external_1): Add 
+       "is_resx" argument.
+       (can_throw_external, can_throw_internal): Bring into sync wrt
+       dealing resx.
+       * except.h (can_throw_internal_1, can_throw_external_1): Update
+       prototype.
+       * tree-eh.c (tree_can_throw_internal, tree_can_throw_external):
+       Deal properly with resx.
+
 2005-05-27  Kazu Hirata  <kazu@cs.umass.edu>
 
        * basic-block.h (basic_block_def): Add phi_nodes and
index 9f1bfe926af5972937687c3d897aa7a53042c8e0..78594122e5d0b4cc7f799ab3e79d011feb4dfbd1 100644 (file)
@@ -2539,7 +2539,7 @@ reachable_handlers (rtx insn)
    within the function.  */
 
 bool
-can_throw_internal_1 (int region_number)
+can_throw_internal_1 (int region_number, bool is_resx)
 {
   struct eh_region *region;
   tree type_thrown;
@@ -2547,7 +2547,9 @@ can_throw_internal_1 (int region_number)
   region = cfun->eh->region_array[region_number];
 
   type_thrown = NULL_TREE;
-  if (region->type == ERT_THROW)
+  if (is_resx)
+    region = region->outer;
+  else if (region->type == ERT_THROW)
     {
       type_thrown = region->u.throw.type;
       region = region->outer;
@@ -2579,7 +2581,7 @@ can_throw_internal (rtx insn)
   if (JUMP_P (insn)
       && GET_CODE (PATTERN (insn)) == RESX
       && XINT (PATTERN (insn), 0) > 0)
-    return can_throw_internal_1 (XINT (PATTERN (insn), 0));
+    return can_throw_internal_1 (XINT (PATTERN (insn), 0), true);
 
   if (NONJUMP_INSN_P (insn)
       && GET_CODE (PATTERN (insn)) == SEQUENCE)
@@ -2590,14 +2592,14 @@ can_throw_internal (rtx insn)
   if (!note || INTVAL (XEXP (note, 0)) <= 0)
     return false;
 
-  return can_throw_internal_1 (INTVAL (XEXP (note, 0)));
+  return can_throw_internal_1 (INTVAL (XEXP (note, 0)), false);
 }
 
 /* Determine if the given INSN can throw an exception that is
    visible outside the function.  */
 
 bool
-can_throw_external_1 (int region_number)
+can_throw_external_1 (int region_number, bool is_resx)
 {
   struct eh_region *region;
   tree type_thrown;
@@ -2605,7 +2607,9 @@ can_throw_external_1 (int region_number)
   region = cfun->eh->region_array[region_number];
 
   type_thrown = NULL_TREE;
-  if (region->type == ERT_THROW)
+  if (is_resx)
+    region = region->outer;
+  else if (region->type == ERT_THROW)
     {
       type_thrown = region->u.throw.type;
       region = region->outer;
@@ -2628,6 +2632,11 @@ can_throw_external (rtx insn)
   if (! INSN_P (insn))
     return false;
 
+  if (JUMP_P (insn)
+      && GET_CODE (PATTERN (insn)) == RESX
+      && XINT (PATTERN (insn), 0) > 0)
+    return can_throw_external_1 (XINT (PATTERN (insn), 0), true);
+
   if (NONJUMP_INSN_P (insn)
       && GET_CODE (PATTERN (insn)) == SEQUENCE)
     insn = XVECEXP (PATTERN (insn), 0, 0);
@@ -2647,7 +2656,7 @@ can_throw_external (rtx insn)
   if (INTVAL (XEXP (note, 0)) <= 0)
     return false;
 
-  return can_throw_external_1 (INTVAL (XEXP (note, 0)));
+  return can_throw_external_1 (INTVAL (XEXP (note, 0)), false);
 }
 
 /* Set TREE_NOTHROW and cfun->all_throwers_are_sibcalls.  */
index 9526b865909dd0e6a232e35b2eae91c783fa3135..9188c3bb60fa75644df4226f36be01c3e2d57568 100644 (file)
@@ -46,9 +46,9 @@ extern void for_each_eh_label (void (*) (rtx));
 extern void for_each_eh_region (void (*) (struct eh_region *));
 
 /* Determine if the given INSN can throw an exception.  */
-extern bool can_throw_internal_1 (int);
+extern bool can_throw_internal_1 (int, bool);
 extern bool can_throw_internal (rtx);
-extern bool can_throw_external_1 (int);
+extern bool can_throw_external_1 (int, bool);
 extern bool can_throw_external (rtx);
 
 /* Set TREE_NOTHROW and cfun->all_throwers_are_sibcalls.  */
index 9f641e186d20fa517cfa147cdeb92ea8532ecb72..294e309458b17ea9f52e610a916e2b158aaf8184 100644 (file)
@@ -2009,29 +2009,31 @@ bool
 tree_can_throw_internal (tree stmt)
 {
   int region_nr;
+  bool is_resx = false;
 
   if (TREE_CODE (stmt) == RESX_EXPR)
-    region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0));
+    region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0)), is_resx = true;
   else
     region_nr = lookup_stmt_eh_region (stmt);
   if (region_nr < 0)
     return false;
-  return can_throw_internal_1 (region_nr);
+  return can_throw_internal_1 (region_nr, is_resx);
 }
 
 bool
 tree_can_throw_external (tree stmt)
 {
   int region_nr;
+  bool is_resx = false;
 
   if (TREE_CODE (stmt) == RESX_EXPR)
-    region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0));
+    region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0)), is_resx = true;
   else
     region_nr = lookup_stmt_eh_region (stmt);
   if (region_nr < 0)
     return tree_could_throw_p (stmt);
   else
-    return can_throw_external_1 (region_nr);
+    return can_throw_external_1 (region_nr, is_resx);
 }
 
 /* Given a statement OLD_STMT and a new statement NEW_STMT that has replaced