]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stupid.c: Die die die.
authorRichard Henderson <rth@cygnus.com>
Wed, 19 Jan 2000 09:42:11 +0000 (01:42 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 19 Jan 2000 09:42:11 +0000 (01:42 -0800)
* stupid.c: Die die die.
* Makefile.in (OBJS): Remove stupid.o.
(stupid.o): Likewise.

* except.c (emit_eh_context): Don't emit USEs for stupid.
* explow.c (probe_stack_range): Likewise.
* flags.h (obey_regdecls): Remove.
* flow.c (find_basic_blocks): Don't run try_merge_blocks
when not optimizing.
(life_analysis): Limit data collection when not optimizing.
(mark_regs_live_at_end): Always mark the return value registers.
(mark_used_regs): Remove dummy RETURN case.
(print_rtl_with_bb): Don't consult obey_regdecls.
* function.c (use_variable, use_variable_after): Remove.
(assign_parms): Consult optimize not obey_regdecls.
(expand_function_start): Don't emit USEs for stupid.
(expand_function_end): Likewise.
* global.c (build_insn_chain): Export.
* integrate.c (expand_inline_function): Kill return-value USE
handling code.
* jump.c (jump_optimize_1): Do simple jump optimizations and
dead code elimination.
(calculate_can_reach_end): Remove check_deleted argument.
(delete_insn): Patch out insns even when not optimizing.
* local-alloc.c (block_alloc): Don't do tying when not optimizing.
* rtl.h (use_variable, use_variable_after): Remove declarations.
(build_insn_chain): Declare.
* stmt.c (expand_value_return): Don't emit USEs for stupid.
(expand_end_bindings): Likewise.
(expand_decl): Likewise.  Consult optimize not obey_regdecls.
* toplev.c (obey_regdecls): Remove.
(rest_of_compilation): Don't set it.  Kill stupid in favour of
flow1, local-alloc, and reload.
(main): Don't set obey_regdecls.

* config/nextstep.c (handle_pragma): Likewise.

* alpha/alpha.md (allocate_stack): Don't emit USEs for stupid.

* arm/arm.h (CONDITIONAL_REGISTER_USAGE): Don't fix reg 0 for stupid.

From-SVN: r31499

18 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/config/alpha/alpha.md
gcc/config/arm/arm.h
gcc/config/nextstep.c
gcc/except.c
gcc/explow.c
gcc/flags.h
gcc/flow.c
gcc/function.c
gcc/global.c
gcc/integrate.c
gcc/jump.c
gcc/local-alloc.c
gcc/rtl.h
gcc/stmt.c
gcc/stupid.c [deleted file]
gcc/toplev.c

index 0ba4bbc3786fb5e1add97054680fe2ced27ab5b5..50211e64333a550d4f4cbac9bfc83f41688524af 100644 (file)
@@ -1,3 +1,46 @@
+2000-01-19  Richard Henderson  <rth@cygnus.com>
+
+       * stupid.c: Die die die.
+       * Makefile.in (OBJS): Remove stupid.o.
+       (stupid.o): Likewise.
+
+       * except.c (emit_eh_context): Don't emit USEs for stupid.
+       * explow.c (probe_stack_range): Likewise.
+       * flags.h (obey_regdecls): Remove.
+       * flow.c (find_basic_blocks): Don't run try_merge_blocks
+       when not optimizing.
+       (life_analysis): Limit data collection when not optimizing.
+       (mark_regs_live_at_end): Always mark the return value registers.
+       (mark_used_regs): Remove dummy RETURN case.
+       (print_rtl_with_bb): Don't consult obey_regdecls.
+       * function.c (use_variable, use_variable_after): Remove.
+       (assign_parms): Consult optimize not obey_regdecls.
+       (expand_function_start): Don't emit USEs for stupid.
+       (expand_function_end): Likewise.
+       * global.c (build_insn_chain): Export.
+       * integrate.c (expand_inline_function): Kill return-value USE
+       handling code.
+       * jump.c (jump_optimize_1): Do simple jump optimizations and
+       dead code elimination.
+       (calculate_can_reach_end): Remove check_deleted argument.
+       (delete_insn): Patch out insns even when not optimizing.
+       * local-alloc.c (block_alloc): Don't do tying when not optimizing.
+       * rtl.h (use_variable, use_variable_after): Remove declarations.
+       (build_insn_chain): Declare.
+       * stmt.c (expand_value_return): Don't emit USEs for stupid.
+       (expand_end_bindings): Likewise.
+       (expand_decl): Likewise.  Consult optimize not obey_regdecls.
+       * toplev.c (obey_regdecls): Remove.
+       (rest_of_compilation): Don't set it.  Kill stupid in favour of
+       flow1, local-alloc, and reload.
+       (main): Don't set obey_regdecls.
+
+       * config/nextstep.c (handle_pragma): Likewise.
+
+       * alpha/alpha.md (allocate_stack): Don't emit USEs for stupid.
+
+       * arm/arm.h (CONDITIONAL_REGISTER_USAGE): Don't fix reg 0 for stupid.
+
 2000-01-18  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * alpha-protos.h: PROTO -> PARAMS.
index 0ab31152db40b51d9fe1e9023429555046dc853b..66e06b79e67589432371047c8ebc0bf4672df176 100644 (file)
@@ -667,7 +667,7 @@ OBJS = diagnostic.o \
  function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o real.o \
  builtins.o intl.o varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o \
  dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o gcse.o \
- integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \
+ integrate.o jump.o cse.o loop.o unroll.o flow.o combine.o varray.o \
  regclass.o regmove.o local-alloc.o global.o reload.o reload1.o caller-save.o \
  insn-peep.o reorg.o haifa-sched.o final.o recog.o reg-stack.o \
  insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \
@@ -1546,8 +1546,6 @@ integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
 jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
    insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \
    toplev.h insn-attr.h
-stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
-   $(BASIC_BLOCK_H) insn-config.h reload.h flags.h function.h toplev.h
 
 simplify-rtx.o : simplify-rtx.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) \
    hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
index 577cbe647e9762e1a229577810274e40a83b5d38..7adee1d313398ae74fe634b18e7a179c88550030 100644 (file)
       emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
       emit_insn (gen_cmpdi (tmp, want));
       emit_jump_insn (gen_bgtu (loop_label));
-      if (obey_regdecls)
-       gen_rtx_USE (VOIDmode, tmp);
 
       memref = gen_rtx_MEM (DImode, want);
       MEM_VOLATILE_P (memref) = 1;
index 577cbe88f7d12caccbf0b60cd0d90e1719ced900..33f5932a8f4ad57e4325f5ca9f088193e9bc5323 100644 (file)
@@ -736,14 +736,8 @@ extern const char * structure_size_string;
 #define SUBTARGET_CONDITIONAL_REGISTER_USAGE
 #endif
 
-/* If doing stupid life analysis, avoid a bug causing a return value r0 to be
-   trampled.  This effectively reduces the number of available registers by 1.
-   XXX It is a hack, I know.
-   XXX Is this still needed?  */
 #define CONDITIONAL_REGISTER_USAGE  \
 {                                                      \
-  if (obey_regdecls)                                   \
-    fixed_regs[0] = 1;                                 \
   if (TARGET_SOFT_FLOAT)                               \
     {                                                  \
       int regno;                                       \
index 1c658fb1171e6c8724ff6e3e0a02e84dfd0a34b1..f7d85bdad2786120c702b3233ba2fa427088af86 100644 (file)
@@ -61,13 +61,13 @@ handle_pragma (p_getc, p_ungetc, pname)
 
   if (strcmp (pname, "CC_OPT_ON") == 0)
     {
-      optimize = 1, obey_regdecls = 0;
+      optimize = 1;
       warning ("optimization turned on");
       retval = 1;
     }
   else if (strcmp (pname, "CC_OPT_OFF") == 0)
     {
-      optimize = 0, obey_regdecls = 1;
+      optimize = 0;
       warning ("optimization turned off");
       retval = 1;
     }
@@ -76,13 +76,7 @@ handle_pragma (p_getc, p_ungetc, pname)
       extern int initial_optimize_flag;
 
       if (optimize != initial_optimize_flag)
-       {
-         if (initial_optimize_flag)
-           obey_regdecls = 0;
-         else
-           obey_regdecls = 1;
-         optimize = initial_optimize_flag;
-       }
+       optimize = initial_optimize_flag;
       warning ("optimization level restored");
       retval = 1;
     }
index 0a09fbdd74559dca4da9228c4ad9fa01e13eb659..8fdc9c9a7649f439c652bebd64dbd7a274c87ac5 100644 (file)
@@ -2364,14 +2364,6 @@ emit_eh_context ()
            end_sequence ();
 
            emit_insns_before (insns, insn);
-
-            /* At -O0, we must make the context register stay alive so
-               that the stupid.c register allocator doesn't get confused. */
-            if (obey_regdecls != 0)
-              {
-                insns = gen_rtx_USE (GET_MODE (XEXP (reg,0)), XEXP (reg,0));
-                emit_insn_before (insns, get_last_insn ());
-              }
          }
       }
 }
index 65e43a717477b52637dd9026a91e05784f7d1f6e..1f76dcf081dd629b28b61dd5d1f886d5a6f0f4e5 100644 (file)
@@ -1556,10 +1556,6 @@ probe_stack_range (first, size)
       emit_note (NULL_PTR, NOTE_INSN_LOOP_END);
       emit_label (end_lab);
 
-      /* If will be doing stupid optimization, show test_addr is still live. */
-      if (obey_regdecls)
-       emit_insn (gen_rtx_USE (VOIDmode, test_addr));
-
       emit_stack_probe (last_addr);
     }
 }
index 92d121cb6ed97182cf4349b0c19684c42e4adf93..8b8e995e5eb7a525ead57ddd4ef32b15931df0be 100644 (file)
@@ -57,11 +57,6 @@ extern int optimize;
 
 extern int optimize_size;
 
-/* Nonzero means do stupid register allocation.  -noreg.
-   Currently, this is 1 if `optimize' is 0.  */
-
-extern int obey_regdecls;
-
 /* Don't print functions as they are compiled and don't print
    times taken by the various passes.  -quiet.  */
 
index 0591b007d9de40a62db397bdff00c6224f91ca0e..ac5d204350dab9e6f522d33ca301b21f6b598fb9 100644 (file)
@@ -436,7 +436,8 @@ find_basic_blocks (f, nregs, file, do_cleanup)
       delete_unreachable_blocks ();
       move_stray_eh_region_notes ();
       record_active_eh_regions (f);
-      try_merge_blocks ();
+      if (optimize)
+       try_merge_blocks ();
     }
 
   /* Mark critical edges.  */
@@ -2447,9 +2448,14 @@ life_analysis (f, nregs, file, remove_dead_code)
   /* We want alias analysis information for local dead store elimination.  */
   init_alias_analysis ();
 
-  flags = PROP_FINAL;
-  if (! remove_dead_code)
-    flags &= ~(PROP_SCAN_DEAD_CODE | PROP_KILL_DEAD_CODE);
+  if (! optimize)
+    flags = PROP_DEATH_NOTES | PROP_REG_INFO;
+  else
+    {
+      flags = PROP_FINAL;
+      if (! remove_dead_code)
+       flags &= ~(PROP_SCAN_DEAD_CODE | PROP_KILL_DEAD_CODE);
+    }
   life_analysis_1 (f, nregs, flags);
 
   if (! reload_completed)
@@ -2835,15 +2841,9 @@ mark_regs_live_at_end (set)
     }
 
   /* Mark function return value.  */
-  /* ??? Only do this after reload.  Consider a non-void function that
-     omits a return statement.  Across that edge we'll have the return
-     register live, and no set for it.  Thus the return register will
-     be live back through the CFG to the entry, and thus we die.  A
-     possible solution is to emit a clobber at exits without returns.  */
 
   type = TREE_TYPE (DECL_RESULT (current_function_decl));
-  if (reload_completed
-      && type != void_type_node)
+  if (type != void_type_node)
     {
       rtx outgoing;
 
@@ -4643,12 +4643,6 @@ mark_used_regs (needed, live, x, flags, insn)
       }
       break;
 
-    case RETURN:
-      /* ??? This info should have been gotten from mark_regs_live_at_end,
-        as applied to the EXIT block, and propagated along the edge that
-        connects this block to the EXIT.  */
-      break;
-
     case ASM_OPERANDS:
     case UNSPEC_VOLATILE:
     case TRAP_IF:
@@ -5112,8 +5106,7 @@ print_rtl_with_bb (outf, rtx_first)
 
          if (in_bb_p[INSN_UID(tmp_rtx)] == NOT_IN_BB
              && GET_CODE (tmp_rtx) != NOTE
-             && GET_CODE (tmp_rtx) != BARRIER
-             && ! obey_regdecls)
+             && GET_CODE (tmp_rtx) != BARRIER)
            fprintf (outf, ";; Insn is not within a basic block\n");
          else if (in_bb_p[INSN_UID(tmp_rtx)] == IN_MULTIPLE_BB)
            fprintf (outf, ";; Insn is in multiple basic blocks\n");
index fffeb73e50f351af049c255160fa14e5b25edfe6..9006d16dd9b9d093be87b90ea3a3e7a8969cfd73 100644 (file)
@@ -3916,45 +3916,6 @@ delete_handlers ()
     }
 }
 \f
-/* Output a USE for any register use in RTL.
-   This is used with -noreg to mark the extent of lifespan
-   of any registers used in a user-visible variable's DECL_RTL.  */
-
-void
-use_variable (rtl)
-     rtx rtl;
-{
-  if (GET_CODE (rtl) == REG)
-    /* This is a register variable.  */
-    emit_insn (gen_rtx_USE (VOIDmode, rtl));
-  else if (GET_CODE (rtl) == MEM
-          && GET_CODE (XEXP (rtl, 0)) == REG
-          && (REGNO (XEXP (rtl, 0)) < FIRST_VIRTUAL_REGISTER
-              || REGNO (XEXP (rtl, 0)) > LAST_VIRTUAL_REGISTER)
-          && XEXP (rtl, 0) != current_function_internal_arg_pointer)
-    /* This is a variable-sized structure.  */
-    emit_insn (gen_rtx_USE (VOIDmode, XEXP (rtl, 0)));
-}
-
-/* Like use_variable except that it outputs the USEs after INSN
-   instead of at the end of the insn-chain.  */
-
-void
-use_variable_after (rtl, insn)
-     rtx rtl, insn;
-{
-  if (GET_CODE (rtl) == REG)
-    /* This is a register variable.  */
-    emit_insn_after (gen_rtx_USE (VOIDmode, rtl), insn);
-  else if (GET_CODE (rtl) == MEM
-          && GET_CODE (XEXP (rtl, 0)) == REG
-          && (REGNO (XEXP (rtl, 0)) < FIRST_VIRTUAL_REGISTER
-              || REGNO (XEXP (rtl, 0)) > LAST_VIRTUAL_REGISTER)
-          && XEXP (rtl, 0) != current_function_internal_arg_pointer)
-    /* This is a variable-sized structure.  */
-    emit_insn_after (gen_rtx_USE (VOIDmode, XEXP (rtl, 0)), insn);
-}
-\f
 int
 max_parm_reg_num ()
 {
@@ -4495,7 +4456,8 @@ assign_parms (fndecl)
            }
          DECL_RTL (parm) = stack_parm;
        }
-      else if (! ((obey_regdecls && ! DECL_REGISTER (parm)
+      else if (! ((! optimize
+                  && ! DECL_REGISTER (parm)
                   && ! DECL_INLINE (fndecl))
                  /* layout_decl may set this.  */
                  || TREE_ADDRESSABLE (parm)
@@ -4579,7 +4541,8 @@ assign_parms (fndecl)
          /* If we were passed a pointer but the actual value
             can safely live in a register, put it in one.  */
          if (passed_pointer && TYPE_MODE (TREE_TYPE (parm)) != BLKmode
-             && ! ((obey_regdecls && ! DECL_REGISTER (parm)
+             && ! ((! optimize
+                    && ! DECL_REGISTER (parm)
                     && ! DECL_INLINE (fndecl))
                    /* layout_decl may set this.  */
                    || TREE_ADDRESSABLE (parm)
@@ -6064,32 +6027,19 @@ expand_function_start (subr, parms_have_cleanups)
      as opposed to parm setup.  */
   emit_note (NULL_PTR, NOTE_INSN_FUNCTION_BEG);
 
-  /* If doing stupid allocation, mark parms as born here.  */
-
   if (GET_CODE (get_last_insn ()) != NOTE)
     emit_note (NULL_PTR, NOTE_INSN_DELETED);
   parm_birth_insn = get_last_insn ();
 
-  if (obey_regdecls)
-    {
-      for (i = LAST_VIRTUAL_REGISTER + 1; i < max_parm_reg; i++)
-       use_variable (regno_reg_rtx[i]);
-
-      if (current_function_internal_arg_pointer != virtual_incoming_args_rtx)
-       use_variable (current_function_internal_arg_pointer);
-    }
-
   context_display = 0;
   if (current_function_needs_context)
     {
       /* Fetch static chain values for containing functions.  */
       tem = decl_function_context (current_function_decl);
-      /* If not doing stupid register allocation copy the static chain
-        pointer into a pseudo.  If we have small register classes, copy
-        the value from memory if static_chain_incoming_rtx is a REG.  If
-        we do stupid register allocation, we use the stack address
-        generated above.  */
-      if (tem && ! obey_regdecls)
+      /* Copy the static chain pointer into a pseudo.  If we have
+        small register classes, copy the value from memory if
+        static_chain_incoming_rtx is a REG.  */
+      if (tem)
        {
          /* If the static chain originally came in a register, put it back
             there, then move it out in the next insn.  The reason for
@@ -6349,27 +6299,6 @@ expand_function_end (filename, line, end_bindings)
      until next function's body starts.  */
   immediate_size_expand--;
 
-  /* If doing stupid register allocation,
-     mark register parms as dying here.  */
-
-  if (obey_regdecls)
-    {
-      rtx tem;
-      for (i = LAST_VIRTUAL_REGISTER + 1; i < max_parm_reg; i++)
-       use_variable (regno_reg_rtx[i]);
-
-      /* Likewise for the regs of all the SAVE_EXPRs in the function.  */
-
-      for (tem = save_expr_regs; tem; tem = XEXP (tem, 1))
-       {
-         use_variable (XEXP (tem, 0));
-         use_variable_after (XEXP (tem, 0), parm_birth_insn);
-       }
-
-      if (current_function_internal_arg_pointer != virtual_incoming_args_rtx)
-       use_variable (current_function_internal_arg_pointer);
-    }
-
   clear_pending_stack_adjust ();
   do_pending_stack_adjust ();
 
@@ -6488,7 +6417,6 @@ expand_function_end (filename, line, end_bindings)
                  GET_MODE (DECL_RTL (DECL_RESULT (current_function_decl))));
       emit_move_insn (real_decl_result,
                      DECL_RTL (DECL_RESULT (current_function_decl)));
-      emit_insn (gen_rtx_USE (VOIDmode, real_decl_result));
 
       /* The delay slot scheduler assumes that current_function_return_rtx
         holds the hard register containing the return value, not a temporary
@@ -6522,7 +6450,6 @@ expand_function_end (filename, line, end_bindings)
       REG_FUNCTION_VALUE_P (outgoing) = 1;
 
       emit_move_insn (outgoing, value_address);
-      use_variable (outgoing);
     }
 
   /* If this is an implementation of __throw, do what's necessary to 
index 949e88d63487bd39db8080b8ac1254ed2cef9c3f..7fdc0bed722d4980bf5503b8494c92d2c70e01d0 100644 (file)
@@ -305,7 +305,6 @@ static void dump_conflicts  PARAMS ((FILE *));
 static void reg_becomes_live   PARAMS ((rtx, rtx, void *));
 static void reg_dies           PARAMS ((int, enum machine_mode,
                                       struct insn_chain *));
-static void build_insn_chain   PARAMS ((rtx));
 \f
 /* Perform allocation of pseudo-registers not allocated by local_alloc.
    FILE is a file to output debugging information on,
@@ -1757,7 +1756,7 @@ reg_dies (regno, mode, chain)
 
 /* Walk the insns of the current function and build reload_insn_chain,
    and record register life information.  */
-static void
+void
 build_insn_chain (first)
      rtx first;
 {
index 0cbff9d05f391c93070aa370cf6363f5514ee73d..8b3fff718a575be8122476dcccfeeb7e3e534368 100644 (file)
@@ -1099,13 +1099,6 @@ expand_inline_function (fndecl, parms, target, ignore, type,
          pattern = PATTERN (insn);
          set = single_set (insn);
          copy = 0;
-         if (GET_CODE (pattern) == USE
-             && GET_CODE (XEXP (pattern, 0)) == REG
-             && REG_FUNCTION_VALUE_P (XEXP (pattern, 0)))
-           /* The (USE (REG n)) at return from the function should
-              be ignored since we are changing (REG n) into
-              inline_target.  */
-           break;
 
          /* If the inline fn needs eh context, make sure that
             the current fn has one. */
index 785aa41faa1a0168cc3aa8d875dd2203e135ad7c..9028be1ae6d6d79b2b628889f3cce3b605a83ee5 100644 (file)
@@ -112,7 +112,7 @@ static void delete_barrier_successors       PARAMS ((rtx));
 static void mark_all_labels            PARAMS ((rtx, int));
 static rtx delete_unreferenced_labels  PARAMS ((rtx));
 static void delete_noop_moves          PARAMS ((rtx));
-static int calculate_can_reach_end     PARAMS ((rtx, int, int));
+static int calculate_can_reach_end     PARAMS ((rtx, int));
 static int duplicate_loop_exit_test    PARAMS ((rtx));
 static void find_cross_jump            PARAMS ((rtx, rtx, int, rtx *, rtx *));
 static void do_cross_jump              PARAMS ((rtx, rtx, rtx));
@@ -232,24 +232,8 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
 
   last_insn = delete_unreferenced_labels (f);
 
-  if (optimize == 0)
-    {
-      /* CAN_REACH_END is persistent for each function.  Once set it should
-        not be cleared.  This is especially true for the case where we
-        delete the NOTE_FUNCTION_END note.  CAN_REACH_END is cleared by
-        the front-end before compiling each function.  */
-      if (calculate_can_reach_end (last_insn, 1, 0))
-       can_reach_end = 1;
-
-      /* Zero the "deleted" flag of all the "deleted" insns.  */
-      for (insn = f; insn; insn = NEXT_INSN (insn))
-       INSN_DELETED_P (insn) = 0;
-      
-      goto end;
-    }
-
 #ifdef HAVE_return
-  if (HAVE_return)
+  if (optimize && HAVE_return)
     {
       /* If we fall through to the epilogue, see if we can insert a RETURN insn
         in front of it.  If the machine allows it at this point (we might be
@@ -275,7 +259,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
      This helps some of the optimizations below by having less insns
      being jumped around.  */
 
-  if (! reload_completed && after_regscan)
+  if (optimize && ! reload_completed && after_regscan)
     for (insn = f; insn; insn = next)
       {
        rtx set = single_set (insn);
@@ -389,6 +373,9 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
                }
            }
 
+         if (! optimize)
+           continue;
+
          /* If a jump references the end of the function, try to turn
             it into a RETURN insn, possibly a conditional one.  */
          if (JUMP_LABEL (insn) != 0
@@ -986,7 +973,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
             CALL_INSN, which some machines, such as the ARC, can do, but
             this is a very minor optimization.  */
          if (this_is_condjump && ! this_is_simplejump
-             && cse_not_expected && optimize > 0 && ! reload_completed
+             && cse_not_expected && ! reload_completed
              && BRANCH_COST > 2
              && can_reverse_comparison_p (XEXP (SET_SRC (PATTERN (insn)), 0),
                                           insn))
@@ -2008,8 +1995,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
 #endif
          else
            {
-             /* Detect a jump to a jump.  */
-
              /* Look for   if (foo) bar; else break;  */
              /* The insns look like this:
                 insn = condjump label1;
@@ -2300,7 +2285,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
      not be cleared.  This is especially true for the case where we
      delete the NOTE_FUNCTION_END note.  CAN_REACH_END is cleared by
      the front-end before compiling each function.  */
-  if (calculate_can_reach_end (last_insn, 0, 1))
+  if (calculate_can_reach_end (last_insn, optimize != 0))
     can_reach_end = 1;
 
 end:
@@ -2711,9 +2696,8 @@ delete_noop_moves (f)
    if we find it.  */
 
 static int
-calculate_can_reach_end (last, check_deleted, delete_final_note)
+calculate_can_reach_end (last, delete_final_note)
      rtx last;
-     int check_deleted;
      int delete_final_note;
 {
   rtx insn = last;
@@ -2751,9 +2735,7 @@ calculate_can_reach_end (last, check_deleted, delete_final_note)
   /* See if we backed up to the appropriate type of note.  */
   if (insn != NULL_RTX
       && GET_CODE (insn) == NOTE
-      && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_END
-      && (check_deleted == 0
-         || ! INSN_DELETED_P (insn)))
+      && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_END)
     {
       if (delete_final_note)
        delete_insn (insn);
@@ -4320,8 +4302,7 @@ delete_insn (insn)
 
   /* Don't delete user-declared labels.  Convert them to special NOTEs
      instead.  */
-  if (was_code_label && LABEL_NAME (insn) != 0
-      && optimize && ! dont_really_delete)
+  if (was_code_label && LABEL_NAME (insn) != 0 && ! dont_really_delete)
     {
       PUT_CODE (insn, NOTE);
       NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED_LABEL;
@@ -4347,7 +4328,7 @@ delete_insn (insn)
 
   /* Patch out INSN (and the barrier if any) */
 
-  if (optimize && ! dont_really_delete)
+  if (! dont_really_delete)
     {
       if (prev)
        {
index 20857a908abd863956d2f06c56f336d4bf10f02b..a8bb1e110960605bda2f7bb809db919351bcb4b9 100644 (file)
@@ -1110,7 +1110,8 @@ block_alloc (b)
 
             If tying is done, WIN is set nonzero.  */
 
-         if (recog_data.n_operands > 1
+         if (optimize
+             && recog_data.n_operands > 1
              && recog_data.constraints[0][0] == '='
              && recog_data.constraints[0][1] != '&')
            {
@@ -1194,7 +1195,8 @@ block_alloc (b)
             destination register won't have had a quantity number
             assigned, since that would prevent combining.  */
 
-         if (GET_CODE (PATTERN (insn)) == CLOBBER
+         if (optimize
+             && GET_CODE (PATTERN (insn)) == CLOBBER
              && (r0 = XEXP (PATTERN (insn), 0),
                  GET_CODE (r0) == REG)
              && (link = find_reg_note (insn, REG_LIBCALL, NULL_RTX)) != 0
index 362d293eefb5bc795471d6d5770ac3e24566f87f..22ad556423c1ec788e55b184ff82f0a8e2547ecd 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1503,12 +1503,10 @@ extern void record_excess_regs          PARAMS ((rtx, rtx, rtx *));
 extern void reposition_prologue_and_epilogue_notes     PARAMS ((rtx));
 extern void thread_prologue_and_epilogue_insns         PARAMS ((rtx));
 extern int prologue_epilogue_contains                  PARAMS ((rtx));
-extern void use_variable                               PARAMS ((rtx));
 extern HOST_WIDE_INT get_frame_size                    PARAMS ((void));
 extern void preserve_rtl_expr_result                   PARAMS ((rtx));
 extern void mark_temp_addr_taken                       PARAMS ((rtx));
 extern void update_temp_slot_address                   PARAMS ((rtx, rtx));
-extern void use_variable_after                         PARAMS ((rtx, rtx));
 extern void purge_addressof                            PARAMS ((rtx));
 
 /* In reload.c */
@@ -1562,6 +1560,7 @@ extern void dump_global_regs              PARAMS ((FILE *));
 #ifdef HARD_CONST
 extern void retry_global_alloc         PARAMS ((int, HARD_REG_SET));
 #endif
+extern void build_insn_chain           PARAMS ((rtx));
 
 /* In regclass.c */
 extern int reg_classes_intersect_p     PARAMS ((enum reg_class, enum reg_class));
index 3cb79b19cbdab9a50a6ca4cef2fc2b36f9fb210f..865095361198734b7d7eae6f713c0b03e432584c 100644 (file)
@@ -2722,8 +2722,6 @@ expand_value_return (val)
        emit_move_insn (return_reg, val);
     }
 
-  diddle_return_value (USE);
-
   /* Does any pending block have cleanups?  */
 
   while (block && block->data.block.cleanups == 0)
@@ -3689,14 +3687,6 @@ expand_end_bindings (vars, mark_ends, dont_jump_in)
     /* Get rid of the beginning-mark if we don't make an end-mark.  */
     NOTE_LINE_NUMBER (thisblock->data.block.first_insn) = NOTE_INSN_DELETED;
 
-  /* If doing stupid register allocation, make sure lives of all
-     register variables declared here extend thru end of scope.  */
-
-  if (obey_regdecls)
-    for (decl = vars; decl; decl = TREE_CHAIN (decl))
-      if (TREE_CODE (decl) == VAR_DECL && DECL_RTL (decl))
-       use_variable (DECL_RTL (decl));
-
   /* Restore the temporary level of TARGET_EXPRs.  */
   target_temp_slot_level = thisblock->data.block.block_target_temp_slot_level;
 
@@ -3757,7 +3747,7 @@ expand_decl (decl)
                && TREE_CODE (type) == REAL_TYPE)
           && ! TREE_THIS_VOLATILE (decl)
           && ! TREE_ADDRESSABLE (decl)
-          && (DECL_REGISTER (decl) || ! obey_regdecls)
+          && (DECL_REGISTER (decl) || optimize)
           /* if -fcheck-memory-usage, check all variables.  */
           && ! current_function_check_memory_usage)
     {
@@ -3889,15 +3879,7 @@ expand_decl (decl)
   if (TREE_READONLY (decl))
     RTX_UNCHANGING_P (DECL_RTL (decl)) = 1;
 #endif
-
-  /* If doing stupid register allocation, make sure life of any
-     register variable starts here, at the start of its scope.  */
-
-  if (obey_regdecls)
-    use_variable (DECL_RTL (decl));
 }
-
-
 \f
 /* Emit code to perform the initialization of a declaration DECL.  */
 
diff --git a/gcc/stupid.c b/gcc/stupid.c
deleted file mode 100644 (file)
index 6e36b49..0000000
+++ /dev/null
@@ -1,761 +0,0 @@
-/* Dummy data flow analysis for GNU compiler in nonoptimizing mode.
-   Copyright (C) 1987, 91, 94-96, 98, 99, 2000 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-
-/* This file performs stupid register allocation, which is used
-   when cc1 gets the -noreg switch (which is when cc does not get -O).
-
-   Stupid register allocation goes in place of the flow_analysis,
-   local_alloc and global_alloc passes.  combine_instructions cannot
-   be done with stupid allocation because the data flow info that it needs
-   is not computed here.
-
-   In stupid allocation, the only user-defined variables that can
-   go in registers are those declared "register".  They are assumed
-   to have a life span equal to their scope.  Other user variables
-   are given stack slots in the rtl-generation pass and are not
-   represented as pseudo regs.  A compiler-generated temporary
-   is assumed to live from its first mention to its last mention.
-
-   Since each pseudo-reg's life span is just an interval, it can be
-   represented as a pair of numbers, each of which identifies an insn by
-   its position in the function (number of insns before it).  The first
-   thing done for stupid allocation is to compute such a number for each
-   insn.  It is called the suid.  Then the life-interval of each
-   pseudo reg is computed.  Then the pseudo regs are ordered by priority
-   and assigned hard regs in priority order.  */
-
-#include "config.h"
-#include "system.h"
-
-#include "rtl.h"
-#include "hard-reg-set.h"
-#include "basic-block.h"
-#include "regs.h"
-#include "function.h"
-#include "insn-config.h"
-#include "reload.h"
-#include "flags.h"
-#include "toplev.h"
-#include "tm_p.h"
-\f
-/* Vector mapping INSN_UIDs to suids.
-   The suids are like uids but increase monotonically always.
-   We use them to see whether a subroutine call came
-   between a variable's birth and its death.  */
-
-static int *uid_suid;
-
-/* Get the suid of an insn.  */
-
-#define INSN_SUID(INSN) (uid_suid[INSN_UID (INSN)])
-
-/* Record the suid of the last CALL_INSN
-   so we can tell whether a pseudo reg crosses any calls.  */
-
-static int last_call_suid;
-
-/* Record the suid of the last NOTE_INSN_SETJMP
-   so we can tell whether a pseudo reg crosses any setjmp.  */
-
-static int last_setjmp_suid;
-
-/* Element N is suid of insn where life span of pseudo reg N ends.
-   Element is  0 if register N has not been seen yet on backward scan.  */
-
-static int *reg_where_dead;
-
-/* Likewise, but point to the insn_chain structure of the insn at which
-   the reg dies.  */
-static struct insn_chain **reg_where_dead_chain;
-
-/* Element N is suid of insn where life span of pseudo reg N begins.  */
-static int *reg_where_born_exact;
-
-/* Element N is 1 if the birth of pseudo reg N is due to a CLOBBER, 
-   0 otherwise.  */
-static int *reg_where_born_clobber;
-
-/* Return the suid of the insn where the register is born, or the suid
-   of the insn before if the birth is due to a CLOBBER.  */
-#define REG_WHERE_BORN(N) \
-  (reg_where_born_exact[(N)] - reg_where_born_clobber[(N)])
-
-/* Numbers of pseudo-regs to be allocated, highest priority first.  */
-
-static int *reg_order;
-
-/* Indexed by reg number (hard or pseudo), nonzero if register is live
-   at the current point in the instruction stream.  */
-
-static char *regs_live;
-
-/* Indexed by reg number, nonzero if reg was used in a SUBREG that changes
-   its size.  */
-
-static char *regs_change_size;
-
-/* Indexed by reg number, nonzero if reg crosses a setjmp.  */
-
-static char *regs_crosses_setjmp;
-
-/* Indexed by insn's suid, the set of hard regs live after that insn.  */
-
-static HARD_REG_SET *after_insn_hard_regs;
-
-/* Record that hard reg REGNO is live after insn INSN.  */
-
-#define MARK_LIVE_AFTER(INSN,REGNO)  \
-  SET_HARD_REG_BIT (after_insn_hard_regs[INSN_SUID (INSN)], (REGNO))
-
-static int stupid_reg_compare  PARAMS ((const PTR,const PTR));
-static int stupid_find_reg     PARAMS ((int, enum reg_class, enum machine_mode,
-                                      int, int, int));
-static void stupid_mark_refs   PARAMS ((rtx, struct insn_chain *));
-static void find_clobbered_regs        PARAMS ((rtx, rtx, void *));
-static void mark_hard_ref      PARAMS ((rtx, int, struct insn_chain *));
-\f
-/* For communication between stupid_life_analysis and find_clobbered_regs.  */
-static struct insn_chain *current_chain;
-
-/* This function, called via note_stores, marks any hard registers that are
-   clobbered in an insn as being live in the live_throughout field
-   of the appropriate insn_chain structure.  */
-
-static void
-find_clobbered_regs (reg, setter, data)
-     rtx reg, setter;
-     void *data ATTRIBUTE_UNUSED;
-{
-  int regno, nregs;
-  if (setter == 0 || GET_CODE (setter) != CLOBBER)
-    return;
-
-  if (GET_CODE (reg) == SUBREG)
-    reg = SUBREG_REG (reg);
-
-  if (GET_CODE (reg) != REG)
-    return;
-  regno = REGNO (reg);
-  if (regno >= FIRST_PSEUDO_REGISTER)
-    return;
-
-  if (GET_MODE (reg) == VOIDmode)
-    abort ();
-  else
-    nregs = HARD_REGNO_NREGS (regno, GET_MODE (reg));
-  while (nregs-- > 0)
-    {
-      SET_REGNO_REG_SET (&current_chain->live_throughout, regno++);
-    }
-}
-\f
-/* Stupid life analysis is for the case where only variables declared
-   `register' go in registers.  For this case, we mark all
-   pseudo-registers that belong to register variables as
-   dying in the last instruction of the function, and all other
-   pseudo registers as dying in the last place they are referenced.
-   Hard registers are marked as dying in the last reference before
-   the end or before each store into them.  */
-
-void
-stupid_life_analysis (f, nregs, file)
-     rtx f;
-     int nregs;
-     FILE *file;
-{
-  register int i;
-  register rtx last, insn;
-  int max_uid, max_suid;
-
-  current_function_has_computed_jump = 0;
-
-  bzero (regs_ever_live, sizeof regs_ever_live);
-
-  regs_live = (char *) xmalloc (nregs);
-
-  /* First find the last real insn, and count the number of insns,
-     and assign insns their suids.  */
-
-  for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
-    if (INSN_UID (insn) > i)
-      i = INSN_UID (insn);
-
-  max_uid = i + 1;
-  uid_suid = (int *) xmalloc ((i + 1) * sizeof (int));
-
-  /* Compute the mapping from uids to suids.
-     Suids are numbers assigned to insns, like uids,
-     except that suids increase monotonically through the code.  */
-
-  last = 0;                    /* In case of empty function body */
-  for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
-    {
-      if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
-       last = insn;
-
-      INSN_SUID (insn) = ++i;
-    }
-
-  last_call_suid = i + 1;
-  last_setjmp_suid = i + 1;
-  max_suid = i + 1;
-
-  max_regno = nregs;
-
-  /* Allocate tables to record info about regs.  */
-
-  reg_where_dead = (int *) xcalloc (nregs, sizeof (int));
-  reg_where_born_exact = (int *) xcalloc (nregs, sizeof (int));
-  reg_where_born_clobber = (int *) xcalloc (nregs, sizeof (int));
-  reg_where_dead_chain = (struct insn_chain **)
-    xcalloc (nregs, sizeof (struct insn_chain *));
-  reg_order = (int *) xcalloc (nregs, sizeof (int));
-  regs_change_size = (char *) xcalloc (nregs, sizeof (char));
-  regs_crosses_setjmp = (char *) xcalloc (nregs, sizeof (char));
-
-  /* Allocate the reg_renumber array */
-  allocate_reg_info (max_regno, FALSE, TRUE);
-  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-    reg_renumber[i] = i;
-
-  after_insn_hard_regs =
-    (HARD_REG_SET *) xcalloc (max_suid, sizeof (HARD_REG_SET));
-
-  /* Allocate and zero out many data structures
-     that will record the data from lifetime analysis.  */
-
-  allocate_reg_life_data ();
-  allocate_bb_life_data ();
-
-  for (i = 0; i < max_regno; i++)
-    REG_N_DEATHS (i) = 1;
-
-  bzero (regs_live, nregs);
-
-  /* Find where each pseudo register is born and dies,
-     by scanning all insns from the end to the start
-     and noting all mentions of the registers.
-
-     Also find where each hard register is live
-     and record that info in after_insn_hard_regs.
-     regs_live[I] is 1 if hard reg I is live
-     at the current point in the scan.  
-   
-     Build reload_insn_chain while we're walking the insns.  */
-
-  reload_insn_chain = 0;
-  for (insn = last; insn; insn = PREV_INSN (insn))
-    {
-      register HARD_REG_SET *p = after_insn_hard_regs + INSN_SUID (insn);
-      struct insn_chain *chain = 0;
-
-      /* Copy the info in regs_live into the element of after_insn_hard_regs
-        for the current position in the rtl code.  */
-
-      for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-       if (regs_live[i])
-         SET_HARD_REG_BIT (*p, i);
-
-      if (GET_CODE (insn) != NOTE && GET_CODE (insn) != BARRIER)
-       {
-         chain = new_insn_chain ();
-         if (reload_insn_chain)
-           reload_insn_chain->prev = chain;
-         chain->next = reload_insn_chain;
-         chain->prev = 0;
-         reload_insn_chain = chain;
-         chain->block = 0;
-         chain->insn = insn;
-         for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-           if (regs_live[i])
-             SET_REGNO_REG_SET (&chain->live_throughout, i);
-       }
-
-      /* Update which hard regs are currently live
-        and also the birth and death suids of pseudo regs
-        based on the pattern of this insn.  */
-
-      if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
-       stupid_mark_refs (PATTERN (insn), chain);
-
-      if (GET_CODE (insn) == NOTE
-         && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
-       last_setjmp_suid = INSN_SUID (insn);
-
-      /* Mark all call-clobbered regs as dead after each call insn so that
-        a pseudo whose life span includes this insn will not go in one of
-        them.  If the function contains a non-local goto, mark all hard
-        registers dead (except for stack related bits).
-
-        Then mark those regs as all dead for the continuing scan
-        of the insns before the call.  */
-
-      if (GET_CODE (insn) == CALL_INSN)
-       {
-         last_call_suid = INSN_SUID (insn);
-
-         if (current_function_has_nonlocal_label)
-           {
-             IOR_COMPL_HARD_REG_SET (after_insn_hard_regs[last_call_suid],
-                                     fixed_reg_set);
-             for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-               if (! fixed_regs[i])
-                 regs_live[i] = 0;
-           }
-         else
-           {
-             IOR_HARD_REG_SET (after_insn_hard_regs[last_call_suid],
-                               call_used_reg_set);
-             for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-               if (call_used_regs[i])
-                 regs_live[i] = 0;
-           }
-
-         /* It is important that this be done after processing the insn's
-            pattern because we want the function result register to still
-            be live if it's also used to pass arguments.  */
-         stupid_mark_refs (CALL_INSN_FUNCTION_USAGE (insn), chain);
-       }
-
-      if (GET_CODE (insn) != NOTE && GET_CODE (insn) != BARRIER)
-       {         
-         /* The regs_live array doesn't say anything about hard registers
-            clobbered by this insn.  So we need an extra pass over the
-            pattern.  */
-         current_chain = chain;
-         if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
-           note_stores (PATTERN (insn), find_clobbered_regs, NULL);
-       }
-
-      if (GET_CODE (insn) == JUMP_INSN && computed_jump_p (insn))
-       current_function_has_computed_jump = 1;
-    }
-
-  /* Now decide the order in which to allocate the pseudo registers.  */
-
-  for (i = LAST_VIRTUAL_REGISTER + 1; i < max_regno; i++)
-    reg_order[i] = i;
-
-  qsort (&reg_order[LAST_VIRTUAL_REGISTER + 1],
-        max_regno - LAST_VIRTUAL_REGISTER - 1, sizeof (int),
-        stupid_reg_compare);
-
-  /* Now, in that order, try to find hard registers for those pseudo regs.  */
-
-  for (i = LAST_VIRTUAL_REGISTER + 1; i < max_regno; i++)
-    {
-      register int r = reg_order[i];
-
-      /* Some regnos disappear from the rtl.  Ignore them to avoid crash. 
-        Also don't allocate registers that cross a setjmp, or live across
-        a call if this function receives a nonlocal goto.
-        Also ignore registers we didn't see during the scan.  */
-      if (regno_reg_rtx[r] == 0 || regs_crosses_setjmp[r]
-         || (reg_where_born_exact[r] == 0 && reg_where_dead[r] == 0)
-         || (REG_N_CALLS_CROSSED (r) > 0 
-             && current_function_has_nonlocal_label))
-       continue;
-
-      /* Now find the best hard-register class for this pseudo register */
-      if (N_REG_CLASSES > 1)
-       reg_renumber[r] = stupid_find_reg (REG_N_CALLS_CROSSED (r), 
-                                          reg_preferred_class (r),
-                                          PSEUDO_REGNO_MODE (r),
-                                          REG_WHERE_BORN (r),
-                                          reg_where_dead[r],
-                                          regs_change_size[r]);
-
-      /* If no reg available in that class, try alternate class.  */
-      if (reg_renumber[r] == -1 && reg_alternate_class (r) != NO_REGS)
-       reg_renumber[r] = stupid_find_reg (REG_N_CALLS_CROSSED (r),
-                                          reg_alternate_class (r),
-                                          PSEUDO_REGNO_MODE (r),
-                                          REG_WHERE_BORN (r),
-                                          reg_where_dead[r],
-                                          regs_change_size[r]);
-    }
-
-  /* Fill in the pseudo reg life information into the insn chain.  */
-  for (i = LAST_VIRTUAL_REGISTER + 1; i < max_regno; i++)
-    {
-      struct insn_chain *chain;
-      int regno;
-
-      regno = reg_renumber[i];
-      if (regno < 0)
-       continue;
-
-      chain = reg_where_dead_chain[i];
-      SET_REGNO_REG_SET (&chain->dead_or_set, i);
-
-      while ((chain = chain->prev)
-            && INSN_SUID (chain->insn) > reg_where_born_exact[i])
-       SET_REGNO_REG_SET (&chain->live_throughout, i);
-
-      if (chain)
-       SET_REGNO_REG_SET (&chain->dead_or_set, i);
-    }
-
-  if (file)
-    dump_flow_info (file);
-
-  free (regs_live);
-  free (uid_suid);
-  free (reg_where_dead);
-  free (reg_where_born_exact);
-  free (reg_where_born_clobber);
-  free (reg_where_dead_chain);
-  free (reg_order);
-  free (regs_change_size);
-  free (regs_crosses_setjmp);
-  free (after_insn_hard_regs);
-}
-
-/* Comparison function for qsort.
-   Returns -1 (1) if register *R1P is higher priority than *R2P.  */
-
-static int
-stupid_reg_compare (r1p, r2p)
-     const PTR r1p;
-     const PTR r2p;
-{
-  register int r1 = *(const int *)r1p, r2 = *(const int *)r2p;
-  register int len1 = reg_where_dead[r1] - REG_WHERE_BORN (r1);
-  register int len2 = reg_where_dead[r2] - REG_WHERE_BORN (r2);
-  int tem;
-
-  tem = len2 - len1;
-  if (tem != 0)
-    return tem;
-
-  tem = REG_N_REFS (r1) - REG_N_REFS (r2);
-  if (tem != 0)
-    return tem;
-
-  /* If regs are equally good, sort by regno,
-     so that the results of qsort leave nothing to chance.  */
-  return r1 - r2;
-}
-\f
-/* Find a block of SIZE words of hard registers in reg_class CLASS
-   that can hold a value of machine-mode MODE
-     (but actually we test only the first of the block for holding MODE)
-   currently free from after insn whose suid is BORN_INSN
-   through the insn whose suid is DEAD_INSN,
-   and return the number of the first of them.
-   Return -1 if such a block cannot be found.
-
-   If CALL_PRESERVED is nonzero, insist on registers preserved
-   over subroutine calls, and return -1 if cannot find such.
-
-   If CHANGES_SIZE is nonzero, it means this register was used as the
-   operand of a SUBREG that changes its size.  */
-
-static int
-stupid_find_reg (call_preserved, class, mode,
-                born_insn, dead_insn, changes_size)
-     int call_preserved;
-     enum reg_class class;
-     enum machine_mode mode;
-     int born_insn, dead_insn;
-     int changes_size ATTRIBUTE_UNUSED;
-{
-  register int i, ins;
-#ifdef HARD_REG_SET
-  register             /* Declare them register if they are scalars.  */
-#endif
-    HARD_REG_SET used, this_reg;
-#ifdef ELIMINABLE_REGS
-  static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
-#endif
-
-  /* If this register's life is more than 5,000 insns, we probably
-     can't allocate it, so don't waste the time trying.  This avoids
-     quadratic behavior on programs that have regularly-occurring
-     SAVE_EXPRs.  */
-  if (dead_insn > born_insn + 5000)
-    return -1;
-
-  COPY_HARD_REG_SET (used,
-                    call_preserved ? call_used_reg_set : fixed_reg_set);
-
-#ifdef ELIMINABLE_REGS
-  for (i = 0; i < (int)(sizeof eliminables / sizeof eliminables[0]); i++)
-    SET_HARD_REG_BIT (used, eliminables[i].from);
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
-  SET_HARD_REG_BIT (used, HARD_FRAME_POINTER_REGNUM);
-#endif
-#else
-  SET_HARD_REG_BIT (used, FRAME_POINTER_REGNUM);
-#endif
-
-  for (ins = born_insn; ins < dead_insn; ins++)
-    IOR_HARD_REG_SET (used, after_insn_hard_regs[ins]);
-
-#ifdef STACK_REGS
-  if (current_function_has_computed_jump)
-    for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
-      SET_HARD_REG_BIT (used, i);
-#endif
-  
-  IOR_COMPL_HARD_REG_SET (used, reg_class_contents[(int) class]);
-
-#ifdef CLASS_CANNOT_CHANGE_SIZE
-  if (changes_size)
-    IOR_HARD_REG_SET (used,
-                     reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE]);
-#endif
-
-  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-    {
-#ifdef REG_ALLOC_ORDER
-      int regno = reg_alloc_order[i];
-#else
-      int regno = i;
-#endif
-
-      if (! TEST_HARD_REG_BIT (used, regno)
-         && HARD_REGNO_MODE_OK (regno, mode))
-       {
-         register int j;
-         register int size1 = HARD_REGNO_NREGS (regno, mode);
-         for (j = 1; j < size1 && ! TEST_HARD_REG_BIT (used, regno + j); j++);
-         if (j == size1)
-           {
-             CLEAR_HARD_REG_SET (this_reg);
-             while (--j >= 0)
-               SET_HARD_REG_BIT (this_reg, regno + j);
-             for (ins = born_insn; ins < dead_insn; ins++)
-               {
-                 IOR_HARD_REG_SET (after_insn_hard_regs[ins], this_reg);
-               }
-             return regno;
-           }
-#ifndef REG_ALLOC_ORDER
-         i += j;               /* Skip starting points we know will lose */
-#endif
-       }
-    }
-
-  return -1;
-}
-\f
-/* Note that REG is being set or referenced, and add the appropriate
-   REG_DEAD / REG_UNUSED note(s).  For sets, LIVE_BEFORE_P will be 0,
-   while for references, LIVE_BEFORE_P will be 1.
-   INSN is the instruction that the reg notes have to be added to.  */
-static void
-mark_hard_ref (reg, live_before_p, chain)
-     rtx reg;
-     int live_before_p;
-     struct insn_chain *chain;
-{
-  /* Hard reg: mark it live for continuing scan of previous insns.  */
-  int regno = REGNO (reg);
-  char *live = regs_live;
-  register int j;
-  int nregs = HARD_REGNO_NREGS (regno, GET_MODE (reg));
-
-  for (j = nregs - 1; j >= 0; j--)
-    {
-      if (! fixed_regs[regno+j]
-         && (! live_before_p || ! live[regno+j]))
-       SET_REGNO_REG_SET (&chain->dead_or_set, regno+j);
-      regs_ever_live[regno+j] = 1;
-      live[regno+j] = live_before_p;
-    }
-}
-
-/* Walk X, noting all assignments and references to registers
-   and recording what they imply about life spans.
-   INSN is the current insn, supplied so we can find its suid.  */
-
-static void
-stupid_mark_refs (x, chain)
-     rtx x;
-     struct insn_chain *chain;
-{
-  register RTX_CODE code;
-  register const char *fmt;
-  register int regno, i;
-  rtx insn = chain->insn;
-
-  if (x == 0)
-    return;
-
-  code = GET_CODE (x);
-
-  if (code == SET || code == CLOBBER)
-    {
-      if (SET_DEST (x) != 0
-         && (GET_CODE (SET_DEST (x)) == REG
-             || (GET_CODE (SET_DEST (x)) == SUBREG
-                 && GET_CODE (SUBREG_REG (SET_DEST (x))) == REG
-                 && (REGNO (SUBREG_REG (SET_DEST (x)))
-                     >= FIRST_PSEUDO_REGISTER))))
-       {
-         /* Register is being assigned.  */
-         rtx reg = SET_DEST (x);
-
-         /* If setting a SUBREG, we treat the entire reg as being set.  */
-         if (GET_CODE (SET_DEST (x)) == SUBREG)
-           reg = SUBREG_REG (reg);
-
-         regno = REGNO (reg);
-
-         /* For hard regs, update the where-live info.  */
-         if (regno < FIRST_PSEUDO_REGISTER)
-           {
-             register int j
-               = HARD_REGNO_NREGS (regno, GET_MODE (SET_DEST (x)));
-
-             mark_hard_ref (reg, 0, chain);
-
-             while (--j >= 0)
-               {
-                 /* The following line is for unused outputs;
-                    they do get stored even though never used again.  */
-                 MARK_LIVE_AFTER (insn, regno+j);
-
-                 CLEAR_REGNO_REG_SET (&chain->live_throughout, regno + j);
-
-                 /* When a hard reg is clobbered, mark it in use
-                    just before this insn, so it is live all through.  */
-                 if (code == CLOBBER && INSN_SUID (insn) > 0)
-                   SET_HARD_REG_BIT (after_insn_hard_regs[INSN_SUID (insn) - 1],
-                                     regno+j);
-               }
-           }
-         /* For pseudo regs, record where born, where dead, number of
-            times used, and whether live across a call.  */
-         else
-           {
-             /* Update the life-interval bounds of this pseudo reg.  */
-
-             /* When a pseudo-reg is CLOBBERed, it is born just before
-                the clobbering insn.  When setting, just after.  */
-             int where_born = INSN_SUID (insn) - (code == CLOBBER);
-
-             reg_where_born_exact[regno] = INSN_SUID (insn);
-             reg_where_born_clobber[regno] = (code == CLOBBER);
-
-             if (reg_where_dead_chain[regno] == 0)
-               reg_where_dead_chain[regno] = chain;
-
-             /* The reg must live at least one insn even
-                in it is never again used--because it has to go
-                in SOME hard reg.  Mark it as dying after the current
-                insn so that it will conflict with any other outputs of
-                this insn.  */
-             if (reg_where_dead[regno] < where_born + 2)
-               {
-                 reg_where_dead[regno] = where_born + 2;
-                 regs_live[regno] = 1;
-               }
-
-             /* Count the refs of this reg.  */
-             REG_N_REFS (regno)++;
-
-             if (last_call_suid < reg_where_dead[regno])
-               REG_N_CALLS_CROSSED (regno) += 1;
-
-             if (last_setjmp_suid < reg_where_dead[regno])
-               regs_crosses_setjmp[regno] = 1;
-
-             /* If this register is clobbered or it is only used in
-                this insn and is only set, mark it unused.  We have
-                to do this even when not optimizing so that MD patterns
-                which count on this behavior (e.g., it not causing an
-                output reload on an insn setting CC) will operate
-                correctly.  */
-             if (GET_CODE (SET_DEST (x)) == REG
-                 && (code == CLOBBER
-                     || (REGNO_FIRST_UID (regno) == INSN_UID (insn)
-                         && REGNO_LAST_UID (regno) == INSN_UID (insn)
-                         && ! reg_mentioned_p (SET_DEST (x),
-                                               SET_SRC (x)))))
-               REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_UNUSED,
-                                                     SET_DEST (x),
-                                                     REG_NOTES (insn));
-           }
-       }
-
-      /* Record references from the value being set,
-        or from addresses in the place being set if that's not a reg.
-        If setting a SUBREG, we treat the entire reg as *used*.  */
-      if (code == SET)
-       {
-         stupid_mark_refs (SET_SRC (x), chain);
-         if (GET_CODE (SET_DEST (x)) != REG)
-           stupid_mark_refs (SET_DEST (x), chain);
-       }
-      return;
-    }
-
-  else if (code == SUBREG
-          && GET_CODE (SUBREG_REG (x)) == REG
-          && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER
-          && (GET_MODE_SIZE (GET_MODE (x))
-              != GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
-          && (INTEGRAL_MODE_P (GET_MODE (x))
-              || INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (x)))))
-    regs_change_size[REGNO (SUBREG_REG (x))] = 1;
-
-  /* Register value being used, not set.  */
-
-  else if (code == REG)
-    {
-      regno = REGNO (x);
-      if (regno < FIRST_PSEUDO_REGISTER)
-       /* Hard reg: mark it live for continuing scan of previous insns.  */
-       mark_hard_ref (x, 1, chain);
-      else
-       {
-         /* Pseudo reg: record first use, last use and number of uses.  */
-
-         reg_where_born_exact[regno] = INSN_SUID (insn);
-         reg_where_born_clobber[regno] = 0;
-         REG_N_REFS (regno)++;
-         if (regs_live[regno] == 0)
-           {
-             regs_live[regno] = 1;
-             reg_where_dead[regno] = INSN_SUID (insn);
-             reg_where_dead_chain[regno] = chain;
-           }
-       }
-      return;
-    }
-
-  /* Recursive scan of all other rtx's.  */
-
-  fmt = GET_RTX_FORMAT (code);
-  for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
-    {
-      if (fmt[i] == 'e')
-       stupid_mark_refs (XEXP (x, i), chain);
-      else if (fmt[i] == 'E')
-       {
-         register int j;
-         for (j = XVECLEN (x, i) - 1; j >= 0; j--)
-           stupid_mark_refs (XVECEXP (x, i, j), chain);
-       }
-    }
-}
index 7fac2af36011a485564b24d7e23fac126a597582..c77ea7a53131803ac30bae3146e4ff44136fafd3 100644 (file)
@@ -362,11 +362,6 @@ int pedantic = 0;
 
 int in_system_header = 0;
 
-/* Nonzero means do stupid register allocation.
-   Currently, this is 1 if `optimize' is 0.  */
-
-int obey_regdecls = 0;
-
 /* Don't print functions as they are compiled and don't print
    times taken by the various passes.  -quiet.  */
 
@@ -3207,13 +3202,6 @@ rest_of_compilation (decl)
        ggc_collect ();
     }
 
-  /* Now we choose between stupid (pcc-like) register allocation
-     (if we got the -noreg switch and not -opt)
-     and smart register allocation.  */
-
-  if (optimize > 0)            /* Stupid allocation probably won't work */
-    obey_regdecls = 0;         /* if optimizations being done.  */
-
   regclass_init ();
 
   /* Print function header into flow dump now
@@ -3222,34 +3210,23 @@ rest_of_compilation (decl)
   if (flow_dump)
     open_dump_file (".08.flow", decl_printable_name (decl, 2));
   
-  if (obey_regdecls)
-    {
-      TIMEVAR (flow_time,
-              {
-                regclass (insns, max_reg_num (), NULL);
-                stupid_life_analysis (insns, max_reg_num (),
-                                      rtl_dump_file);
-              });
-    }
-  else
-    {
-      /* Do control and data flow analysis,
-        and write some of the results to dump file.  */
+  /* Do control and data flow analysis; wrote some of the results to
+     the dump file.  */
 
-      TIMEVAR
-       (flow_time,
-        {
-          find_basic_blocks (insns, max_reg_num (), rtl_dump_file, 1);
-          calculate_loop_depth (rtl_dump_file);
-          life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
-        });
+  TIMEVAR
+    (flow_time,
+     {
+       find_basic_blocks (insns, max_reg_num (), rtl_dump_file, 1);
+       if (optimize)
+        calculate_loop_depth (rtl_dump_file);
+       life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
+     });
 
-      if (warn_uninitialized || extra_warnings)
-       {
-         uninitialized_vars_warning (DECL_INITIAL (decl));
-          if (extra_warnings)
-           setjmp_args_warning ();
-       }
+  if (warn_uninitialized || extra_warnings)
+    {
+      uninitialized_vars_warning (DECL_INITIAL (decl));
+      if (extra_warnings)
+       setjmp_args_warning ();
     }
 
   /* Dump rtl after flow analysis.  */
@@ -3344,24 +3321,20 @@ rest_of_compilation (decl)
   if (local_reg_dump)
     open_dump_file (".12.lreg", decl_printable_name (decl, 2));
 
-  /* Unless we did stupid register allocation,
-     allocate pseudo-regs that are used only within 1 basic block. 
+  /* Allocate pseudo-regs that are used only within 1 basic block. 
 
      RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
      jump optimizer after register allocation and reloading are finished.  */
 
-  if (!obey_regdecls)
-    TIMEVAR (local_alloc_time,
-            {
-              /* We recomputed reg usage as part of updating the rest
-                 of life info during sched.  */
-              if (! flag_schedule_insns)
-                recompute_reg_usage (insns, ! optimize_size);
-              regclass (insns, max_reg_num (), rtl_dump_file);
-              rebuild_label_notes_after_reload = local_alloc ();
-            });
-  else
-    rebuild_label_notes_after_reload = 0;
+  TIMEVAR (local_alloc_time,
+          {
+            /* We recomputed reg usage as part of updating the rest
+               of life info during sched.  */
+            if (! flag_schedule_insns)
+              recompute_reg_usage (insns, ! optimize_size);
+            regclass (insns, max_reg_num (), rtl_dump_file);
+            rebuild_label_notes_after_reload = local_alloc ();
+          });
 
   /* Dump rtl code after allocating regs within basic blocks.  */
 
@@ -3381,19 +3354,20 @@ rest_of_compilation (decl)
   if (global_reg_dump)
     open_dump_file (".13.greg", decl_printable_name (decl, 2));
 
-  /* Unless we did stupid register allocation,
-     allocate remaining pseudo-regs, then do the reload pass
-     fixing up any insns that are invalid.  */
+  /* If optimizing, allocate remaining pseudo-regs.  Do the reload
+     pass fixing up any insns that are invalid.  */
 
   TIMEVAR (global_alloc_time,
           {
-            if (!obey_regdecls)
+            if (optimize)
               failure = global_alloc (rtl_dump_file);
             else
-              failure = reload (insns, 0, rtl_dump_file);
+              {
+                build_insn_chain (insns);
+                failure = reload (insns, 0, rtl_dump_file);
+              }
           });
 
-
   if (failure)
     goto exit_rest_of_compilation;
 
@@ -3507,10 +3481,8 @@ rest_of_compilation (decl)
     = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
 #endif
 
-  /* One more attempt to remove jumps to .+1
-     left by dead-store-elimination.
-     Also do cross-jumping this time
-     and delete no-op move insns.  */
+  /* One more attempt to remove jumps to .+1 left by dead-store elimination. 
+     Also do cross-jumping this time and delete no-op move insns.  */
 
   if (optimize > 0)
     {
@@ -4573,8 +4545,6 @@ main (argc, argv)
        }
     }
 
-  obey_regdecls = (optimize == 0);
-
   if (optimize >= 1)
     {
       flag_defer_pop = 1;