c-common.h (flag_dump_translation_unit): Remove.
[gcc.git] / gcc / cp / semantics.c
index 8b7e99bef2cb0d8be02df673033c66ab2fb8ae32..b30c80e8c3d687a92b60ab16b7b42213f6c0c73a 100644 (file)
@@ -54,7 +54,6 @@ static void emit_associated_thunks PARAMS ((tree));
 static void genrtl_try_block PARAMS ((tree));
 static void genrtl_eh_spec_block PARAMS ((tree));
 static void genrtl_handler PARAMS ((tree));
-static void genrtl_catch_block PARAMS ((tree));
 static void genrtl_ctor_stmt PARAMS ((tree));
 static void genrtl_subobject PARAMS ((tree));
 static void genrtl_named_return_value PARAMS ((void));
@@ -721,6 +720,8 @@ genrtl_handler (t)
      tree t;
 {
   genrtl_do_pushlevel ();
+  if (!processing_template_decl)
+    expand_start_catch (HANDLER_TYPE (t));
   expand_stmt (HANDLER_BODY (t));
   if (!processing_template_decl)
     expand_end_catch ();
@@ -734,7 +735,10 @@ begin_handler ()
   tree r;
   r = build_stmt (HANDLER, NULL_TREE, NULL_TREE);
   add_stmt (r);
+  /* Create a binding level for the eh_info and the exception object
+     cleanup.  */
   do_pushlevel ();
+  note_level_for_catch ();
   return r;
 }
 
@@ -742,13 +746,12 @@ begin_handler ()
    HANDLER.  DECL is the declaration for the catch parameter, or NULL
    if this is a `catch (...)' clause.  */
 
-tree
+void
 finish_handler_parms (decl, handler)
      tree decl;
      tree handler;
 {
-  tree blocks = NULL_TREE;
-
+  tree type = NULL_TREE;
   if (processing_template_decl)
     {
       if (decl)
@@ -757,47 +760,24 @@ finish_handler_parms (decl, handler)
          decl = push_template_decl (decl);
          add_decl_stmt (decl);
          RECHAIN_STMTS (handler, HANDLER_PARMS (handler));
+         type = TREE_TYPE (decl);
        }
     }
   else
-    blocks = expand_start_catch_block (decl);
-
-  if (decl)
-    TREE_TYPE (handler) = TREE_TYPE (decl);
-
-  return blocks;
-}
-
-/* Generate the RTL for a START_CATCH_STMT. */
+    type = expand_start_catch_block (decl);
 
-static void
-genrtl_catch_block (type)
-     tree type;
-{
-  expand_start_catch (type);
-}
-
-/* Note the beginning of a handler for TYPE.  This function is called
-   at the point to which control should be transferred when an
-   appropriately-typed exception is thrown.  */
-
-void
-begin_catch_block (type)
-     tree type;
-{
-  add_stmt (build (START_CATCH_STMT, type));
+  HANDLER_TYPE (handler) = type;
 }
 
 /* Finish a handler, which may be given by HANDLER.  The BLOCKs are
    the return value from the matching call to finish_handler_parms.  */
 
 void
-finish_handler (blocks, handler)
-     tree blocks;
+finish_handler (handler)
      tree handler;
 {
   if (!processing_template_decl)
-      expand_end_catch_block (blocks);
+    expand_end_catch_block ();
   do_poplevel ();
   RECHAIN_STMTS (handler, HANDLER_BODY (handler));
 }
@@ -1491,31 +1471,6 @@ finish_qualified_call_expr (fn, args)
                              args);
 }
 
-/* Finish an expression taking the address of LABEL.  Returns an
-   expression for the address.  */
-
-tree 
-finish_label_address_expr (label)
-     tree label;
-{
-  tree result;
-
-  label = lookup_label (label);
-  if (label == NULL_TREE)
-    result = null_pointer_node;
-  else
-    {
-      TREE_USED (label) = 1;
-      result = build1 (ADDR_EXPR, ptr_type_node, label);
-      TREE_CONSTANT (result) = 1;
-      /* This function cannot be inlined.  All jumps to the addressed
-        label should wind up at the same point.  */
-      DECL_UNINLINABLE (current_function_decl) = 1;
-    }
-
-  return result;
-}
-
 /* Finish an expression of the form CODE EXPR.  */
 
 tree
@@ -2192,10 +2147,6 @@ cp_expand_stmt (t)
       genrtl_decl_cleanup (CLEANUP_DECL (t), CLEANUP_EXPR (t));
       break;
 
-    case START_CATCH_STMT:
-      genrtl_catch_block (TREE_TYPE (t));
-      break;
-
     case CTOR_STMT:
       genrtl_ctor_stmt (t);
       break;
@@ -2446,8 +2397,13 @@ expand_body (fn)
 
   timevar_push (TV_INTEGRATION);
 
-  /* Optimize the body of the function before expanding it.  */
-  optimize_function (fn);
+  /* Optimize the body of the function before expanding it.  We do not
+     optimize thunks, as (1) the backend tries to optimize the call to
+     the thunkee, (b) the tree based inliner breaks that optimization,
+     (c) virtual functions are rarely inlineable, and (d)
+     ASM_OUTPUT_MI_THUNK is there to DTRT anyway.  */
+  if (!DECL_THUNK_P (fn))
+    optimize_function (fn);
 
   timevar_pop (TV_INTEGRATION);
   timevar_push (TV_EXPAND);
@@ -2479,7 +2435,7 @@ expand_body (fn)
 
   /* If possible, obliterate the body of the function so that it can
      be garbage collected.  */
-  if (flag_dump_translation_unit)
+  if (dump_enabled_p (TDI_all))
     /* Keep the body; we're going to dump it.  */
     ;
   else if (DECL_INLINE (fn) && flag_inline_trees)