OSDN Git Service

* cp/cp-tree.h (struct cp_language_function): Remove x_result_rtx.
[pf3gnuchains/gcc-fork.git] / gcc / cp / expr.c
index c47d390..918e54d 100644 (file)
@@ -32,10 +32,6 @@ Boston, MA 02111-1307, USA.  */
 #include "except.h"
 #include "tm_p.h"
 
-#if 0
-static tree extract_aggr_init PARAMS ((tree, tree));
-static tree extract_scalar_init PARAMS ((tree, tree));
-#endif
 static rtx cplus_expand_expr PARAMS ((tree, rtx, enum machine_mode,
                                    enum expand_modifier));
 
@@ -128,10 +124,6 @@ cplus_expand_expr (exp, target, tmode, modifier)
                            target, tmode, EXPAND_NORMAL);
       }
 
-    case THUNK_DECL:
-      my_friendly_assert (DECL_RTL (exp) != NULL_RTX, 20000115);
-      return DECL_RTL (exp);
-
     case THROW_EXPR:
       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
       expand_internal_throw ();
@@ -141,28 +133,8 @@ cplus_expand_expr (exp, target, tmode, modifier)
       /* We don't need to generate any code for an empty class.  */
       return const0_rtx;
 
-    case STMT_EXPR:
-      {
-       tree rtl_expr;
-       rtx result;
-
-       /* Since expand_expr_stmt calls free_temp_slots after every
-          expression statement, we must call push_temp_slots here.
-          Otherwise, any temporaries in use now would be considered
-          out-of-scope after the first EXPR_STMT from within the
-          STMT_EXPR.  */
-       push_temp_slots ();
-       rtl_expr = expand_start_stmt_expr ();
-       expand_stmt (STMT_EXPR_STMT (exp));
-       expand_end_stmt_expr (rtl_expr);
-       result = expand_expr (rtl_expr, target, tmode, modifier);
-       pop_temp_slots ();
-       return result;
-      }
-      break;
-
     default:
-      break;
+      return c_expand_expr (exp, target, tmode, modifier);
     }
   my_friendly_abort (40);
   /* NOTREACHED */
@@ -176,194 +148,10 @@ init_cplus_expand ()
   lang_expand_constant = cplus_expand_constant;
 }
 
-/* If DECL had its rtl moved from where callers expect it
-   to be, fix it up.  RESULT is the nominal rtl for the RESULT_DECL,
-   which may be a pseudo instead of a hard register.  */
-
-void
-fixup_result_decl (decl, result)
-     tree decl;
-     rtx result;
-{
-  if (REG_P (result))
-    {
-      if (REGNO (result) >= FIRST_PSEUDO_REGISTER)
-       {
-         rtx real_decl_result;
-
-#ifdef FUNCTION_OUTGOING_VALUE
-         real_decl_result
-           = FUNCTION_OUTGOING_VALUE (TREE_TYPE (decl), current_function_decl);
-#else
-         real_decl_result
-           = FUNCTION_VALUE (TREE_TYPE (decl), current_function_decl);
-#endif
-         REG_FUNCTION_VALUE_P (real_decl_result) = 1;
-         result = real_decl_result;
-       }
-      store_expr (decl, result, 0);
-      emit_insn (gen_rtx (USE, VOIDmode, result));
-    }
-}
-
-#if 0
-/* Expand this initialization inline and see if it's simple enough that
-   it can be done at compile-time.  */
-
-static tree
-extract_aggr_init (decl, init)
-     tree decl, init;
-{
-  return 0;
-}
-
-static tree
-extract_scalar_init (decl, init)
-     tree decl, init;
-{
-  rtx value, insns, insn;
-  extern struct obstack temporary_obstack;
-  tree t = NULL_TREE;
-
-  start_sequence ();
-  value = expand_expr (init, NULL_RTX, VOIDmode, 0);
-  insns = get_insns ();
-  end_sequence ();
-  reg_scan (insns, max_reg_num (), 0);
-  jump_optimize (insns, 0, 0, 1);
-
-  for (insn = insns; insn; insn = NEXT_INSN (insn))
-    {
-      rtx r, to;
-
-      if (GET_CODE (insn) == NOTE)
-       continue;
-      else if (GET_CODE (insn) != INSN)
-       return 0;
-
-      r = PATTERN (insn);
-      if (GET_CODE (r) != SET)
-       return 0;
-
-      to = XEXP (r, 0);
-
-      if (! (to == value
-            || (GET_CODE (to) == SUBREG && XEXP (to, 0) == value)))
-       return 0;
-
-      r = XEXP (r, 1);
-
-      switch (GET_CODE (r))
-       {
-       case CONST_INT:
-         t = build_int_2 (XEXP (r, 0), 0);
-         break;
-       default:
-         return 0;
-       }
-    }
-
-  return t; 
-}
-#endif
-
 int
 extract_init (decl, init)
      tree decl ATTRIBUTE_UNUSED, init ATTRIBUTE_UNUSED;
 {
   return 0;
-
-#if 0
-  if (IS_AGGR_TYPE (TREE_TYPE (decl))
-      || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
-    init = extract_aggr_init (decl, init);
-  else
-    init = extract_scalar_init (decl, init);
-
-  if (init == NULL_TREE)
-    return 0;
-
-  DECL_INITIAL (decl) = init;
-  return 1;
-#endif
 }
 
-void
-do_case (start, end)
-     tree start, end;
-{
-  tree value1 = NULL_TREE, value2 = NULL_TREE, label;
-
-  if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE 
-      && POINTER_TYPE_P (TREE_TYPE (start)))
-    error ("pointers are not permitted as case values");
-
-  if (end && pedantic)
-    pedwarn ("ISO C++ forbids range expressions in switch statement");
-
-  if (start)
-    value1 = check_cp_case_value (start);
-  if (end)
-    value2 = check_cp_case_value (end);
-  
-  label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
-  if (value1 != error_mark_node
-      && value2 != error_mark_node)
-    {
-      tree duplicate;
-      int success;
-
-      if (end)
-       success = pushcase_range (value1, value2, convert_and_check,
-                                 label, &duplicate);
-      else if (start)
-       success = pushcase (value1, convert_and_check, label, &duplicate);
-      else
-       success = pushcase (NULL_TREE, 0, label, &duplicate);
-
-      if (success == 1)
-       {
-         if (end)
-           error ("case label not within a switch statement");
-         else if (start)
-           cp_error ("case label `%E' not within a switch statement", start);
-         else
-           error ("default label not within a switch statement");
-       }
-      else if (success == 2)
-       {
-         if (end)
-           {
-             error ("duplicate (or overlapping) case value");
-             cp_error_at ("this is the first entry overlapping that value",
-                          duplicate);
-           }
-         else if (start)
-           {
-             cp_error ("duplicate case value `%E'", start);
-             cp_error_at ("previously used here", duplicate);
-           }
-         else
-           {
-             error ("multiple default labels in one switch");
-             cp_error_at ("this is the first default label", duplicate);
-           }
-       }
-      else if (success == 3)
-       warning ("case value out of range");
-      else if (success == 4)
-       warning ("empty range specified");
-      else if (success == 5)
-       {
-         if (end)
-           error ("case label within scope of cleanup or variable array");
-         else if (! start)
-           error ("`default' label within scope of cleanup or variable array");
-         else
-           cp_error ("case label `%E' within scope of cleanup or variable array", start);
-       }
-    }
-
-  current_function_return_value = NULL_TREE;
-}