OSDN Git Service

(struct function): Make frame_offset be HOST_WIDE_INT.
[pf3gnuchains/gcc-fork.git] / gcc / cp / except.c
index 1d207e5..fefcd02 100644 (file)
@@ -312,58 +312,41 @@ init_exception_processing ()
 
   declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
   d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_pc"));
-  d = start_decl (d, declspecs, 0, NULL_TREE);
+  d = start_decl (d, declspecs, 0);
   DECL_COMMON (d) = 1;
   cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
   saved_pc = lookup_name (get_identifier ("__eh_pc"), 0);
 
   declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
   d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_type"));
-  d = start_decl (d, declspecs, 0, NULL_TREE);
+  d = start_decl (d, declspecs, 0);
   DECL_COMMON (d) = 1;
   cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
   saved_throw_type = lookup_name (get_identifier ("__eh_type"), 0);
 
   declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
   d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_value"));
-  d = start_decl (d, declspecs, 0, NULL_TREE);
+  d = start_decl (d, declspecs, 0);
   DECL_COMMON (d) = 1;
   cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
   saved_throw_value = lookup_name (get_identifier ("__eh_value"), 0);
 
   declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
   d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_cleanup"));
-  d = build_parse_node (CALL_EXPR, d, void_list_node, NULL_TREE);
-  d = start_decl (d, declspecs, 0, NULL_TREE);
+  d = make_call_declarator (d, void_list_node, NULL_TREE, NULL_TREE);
+  d = start_decl (d, declspecs, 0);
   DECL_COMMON (d) = 1;
   cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
   saved_cleanup = lookup_name (get_identifier ("__eh_cleanup"), 0);
 
   declspecs = tree_cons (NULL_TREE, get_identifier ("bool"), NULL_TREE);
   d = get_identifier ("__eh_in_catch");
-  d = start_decl (d, declspecs, 0, NULL_TREE);
+  d = start_decl (d, declspecs, 0);
   DECL_COMMON (d) = 1;
   cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
   saved_in_catch = lookup_name (get_identifier ("__eh_in_catch"), 0);
 }
 
-/* Call this on start of a try block.  */
-
-void
-expand_start_try_stmts ()
-{
-  if (! doing_eh (1))
-    return;
-
-  expand_eh_region_start ();
-}
-
-void
-expand_end_try_stmts ()
-{
-  expand_eh_region_end (integer_zero_node);
-}
-
 /* Build a type value for use at runtime for a type that is matched
    against by the exception handling system.  */
 
@@ -446,6 +429,7 @@ expand_start_catch_block (declspecs, declarator)
     return;
 
   /* Create a binding level for the parm.  */
+  pushlevel (0);
   expand_start_bindings (0);
 
   false_label_rtx = gen_label_rtx ();
@@ -457,8 +441,7 @@ expand_start_catch_block (declspecs, declarator)
       rtx call_rtx, return_value_rtx;
       tree init_type;
 
-      decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1,
-                            NULL_TREE, NULL_TREE);
+      decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
 
       if (decl == NULL_TREE)
        {
@@ -562,8 +545,8 @@ void expand_end_catch_block ()
   expand_leftover_cleanups ();
 
   /* Cleanup the EH parameter.  */
-  decls = getdecls ();
-  expand_end_bindings (decls, decls != NULL_TREE, 0);
+  expand_end_bindings (getdecls (), kept_level_p (), 0);
+  poplevel (kept_level_p (), 1, 0);
       
   /* label we emit to jump to if this catch block didn't match.  */
   /* This the closing } in the `if (eq) {' of the documentation.  */
@@ -592,6 +575,7 @@ do_unwind (inner_throw_label)
   temp = gen_reg_rtx (Pmode);
   emit_move_insn (temp, inner_throw_label);
   emit_move_insn (return_val_rtx, plus_constant (temp, -8));
+  emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, 31)));
   easy_expand_asm ("ret");
   easy_expand_asm ("restore");
   emit_barrier ();
@@ -687,10 +671,11 @@ expand_builtin_throw ()
     return;
 
   params = void_list_node;
-  t = build_parse_node (CALL_EXPR, get_identifier ("__throw"), params, NULL_TREE);
+  t = make_call_declarator (get_identifier ("__throw"), params, NULL_TREE,
+                           NULL_TREE);
   start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"),
                                  void_list_node),
-                 t, NULL_TREE, NULL_TREE, 0);
+                 t, NULL_TREE, 0);
   store_parm_decls ();
   pushlevel (0);
   clear_last_expr ();
@@ -884,7 +869,7 @@ void
 expand_exception_blocks ()
 {
   rtx funcend;
-  rtx insns;
+  rtx insn, insns;
   rtx eh_spec_insns = NULL_RTX;
 
   start_sequence ();
@@ -973,7 +958,14 @@ expand_exception_blocks ()
     store_after_parms (eh_spec_insns);
 #endif
 
-  emit_insns (insns);
+  insn = get_last_insn ();
+  while (GET_CODE (insn) == NOTE
+        || (GET_CODE (insn) == INSN
+            && (GET_CODE (PATTERN (insn)) == USE
+                || GET_CODE (PATTERN (insn)) == CLOBBER)))
+    insn = PREV_INSN (insn);
+    
+  emit_insns_after (insns, insn);
 }
 
 tree
@@ -996,10 +988,11 @@ start_anon_func ()
   params = void_list_node;
   /* tcf stands for throw clean funciton.  */
   sprintf (name, "__tcf_%d", counter++);
-  t = build_parse_node (CALL_EXPR, get_identifier (name), params, NULL_TREE);
+  t = make_call_declarator (get_identifier (name), params, NULL_TREE,
+                           NULL_TREE);
   start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"),
                                  void_list_node),
-                 t, NULL_TREE, NULL_TREE, 0);
+                 t, NULL_TREE, 0);
   store_parm_decls ();
   pushlevel (0);
   clear_last_expr ();
@@ -1079,7 +1072,7 @@ expand_throw (exp)
          start_sequence ();
          object = build_reinterpret_cast (TREE_TYPE (exp), saved_throw_value);
          object = build_indirect_ref (object, NULL_PTR);
-         cleanup = maybe_build_cleanup (object);
+         cleanup = maybe_build_cleanup_and_delete (object);
          if (cleanup)
            expand_expr (cleanup, const0_rtx, VOIDmode, 0);
          cleanup_insns = get_insns ();
@@ -1089,7 +1082,8 @@ expand_throw (exp)
            {
              cleanup = start_anon_func ();
 
-             expand_expr (maybe_build_cleanup (object), const0_rtx, VOIDmode, 0);
+             expand_expr (maybe_build_cleanup_and_delete (object),
+                          const0_rtx, VOIDmode, 0);
 
              end_anon_func ();
 
@@ -1138,7 +1132,7 @@ build_throw (e)
 {
   if (e != error_mark_node)
     {
-      if (current_template_parms)
+      if (processing_template_decl)
        return build_min (THROW_EXPR, void_type_node, e);
       e = build1 (THROW_EXPR, void_type_node, e);
       TREE_SIDE_EFFECTS (e) = 1;