sh.md (insv): Use copy_addr_to_reg.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Tue, 27 Apr 1999 12:23:20 +0000 (12:23 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Tue, 27 Apr 1999 12:23:20 +0000 (13:23 +0100)
* sh.md (insv): Use copy_addr_to_reg.
* final.c (insn_lengths_max_uid) New variable.
(init_insn_lengths, shorten_branches): Set it.
(get_attr_lengths): Test insn uid against insn_lengths_max_uid.

From-SVN: r26676

gcc/ChangeLog
gcc/config/sh/sh.md
gcc/final.c

index 90bbe68247d3d0d3b315a5557e9d8cc868e6629f..d7ad46e154bb3a3e7256ad69e2d3e4b819d5a3b6 100644 (file)
@@ -1,3 +1,11 @@
+Tue Apr 27 20:19:47 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * sh.md (insv): Use copy_addr_to_reg.
+
+       * final.c (insn_lengths_max_uid) New variable.
+       (init_insn_lengths, shorten_branches): Set it.
+       (get_attr_lengths): Test insn uid against insn_lengths_max_uid.
+
 1999-04-27 08:32 -0400  Zack Weinberg  <zack@rabi.columbia.edu>
 
        * expr.c (emit_move_insn_1): Abort if MODE argument is invalid. 
index f5bd532f1675b6af764d65ffbeca1ac1e7aed4f0..04992a18773e0f6b86b8a4d9284881fcebfebafc 100644 (file)
 
   size /= 8;
   orig_address = XEXP (operands[0], 0);
-  addr_target = gen_reg_rtx (SImode);
   shift_reg = gen_reg_rtx (SImode);
   emit_insn (gen_movsi (shift_reg, operands[3]));
-  emit_insn (gen_addsi3 (addr_target, orig_address, GEN_INT (size - 1)));
+  addr_target = copy_addr_to_reg (plus_constant (orig_address, size - 1));
 
   operands[0] = change_address (operands[0], QImode, addr_target);
   emit_insn (gen_movqi (operands[0], gen_rtx (SUBREG, QImode, shift_reg, 0)));
index bacc093224900d9535d73b2796dd12b4439d6fa4..4695590dc5e9eb41ac353b8c8fbe9bc44511f2aa 100644 (file)
@@ -627,6 +627,9 @@ dbr_sequence_length ()
 static short *insn_lengths;
 int *insn_addresses;
 
+/* Max uid for which the above arrays are valid.  */
+static int insn_lengths_max_uid;
+
 /* Address of insn being processed.  Used by `insn_current_length'.  */
 int insn_current_address;
 
@@ -673,6 +676,7 @@ init_insn_lengths ()
     {
       free (insn_lengths);
       insn_lengths = 0;
+      insn_lengths_max_uid = 0;
     }
   if (insn_addresses)
     {
@@ -698,7 +702,7 @@ get_attr_length (insn)
   int i;
   int length = 0;
 
-  if (insn_lengths)
+  if (insn_lengths_max_uid > INSN_UID (insn))
     return insn_lengths[INSN_UID (insn)];
   else
     switch (GET_CODE (insn))
@@ -1128,6 +1132,7 @@ shorten_branches (first)
   /* Allocate the rest of the arrays.  */
   insn_lengths = (short *) xmalloc (max_uid * sizeof (short));
   insn_addresses = (int *) xmalloc (max_uid * sizeof (int));
+  insn_lengths_max_uid = max_uid;
   /* Syntax errors can lead to labels being outside of the main insn stream.
      Initialize insn_addresses, so that we get reproducible results.  */
   bzero ((char *)insn_addresses, max_uid * sizeof *insn_addresses);