This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Remove unscaled index insn hack from pa.c


Here is another cleanup that can be done as a result of improving the
basereg_operand detection.  It depends on these two patches being installed:

<http://gcc.gnu.org/ml/gcc-patches/2000-11/msg01358.html>
<http://gcc.gnu.org/ml/gcc-patches/2000-11/msg01508.html>

Tested with a complete bootstrap and check under hpux 10.20.  Please review
and install if OK.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-11-24  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* pa.c (restore_unscaled_index_insn_codes): Delete procedure.
	(record_unscaled_index_insn_codes): Likewise.
	(unscaled_index_insn_codes): Delete.
	(max_unscaled_index_insn_codes_uid): Delete.
	(output_function_prologue, output_function_epilogue, pa_reorg):
	Don't use the unscaled index insn hack.

--- pa.c.orig	Wed Nov 22 18:32:13 2000
+++ pa.c	Thu Nov 23 14:46:39 2000
@@ -43,8 +43,6 @@
 #include "recog.h"
 #include "tm_p.h"
 
-static void restore_unscaled_index_insn_codes		PARAMS ((rtx));
-static void record_unscaled_index_insn_codes		PARAMS ((rtx));
 static void pa_combine_instructions			PARAMS ((rtx));
 static int pa_can_combine_p	PARAMS ((rtx, rtx, rtx, int, rtx, rtx, rtx));
 static int forward_branch_p				PARAMS ((rtx));
@@ -100,13 +98,6 @@
 } *deferred_plabels = 0;
 int n_deferred_plabels = 0;
 
-/* Array indexed by INSN_UIDs holding the INSN_CODE of an insn which
-   uses an unscaled indexed address before delay slot scheduling.  */
-static int *unscaled_index_insn_codes;
-
-/* Upper bound for the array.  */
-static int max_unscaled_index_insn_codes_uid;
-
 void
 override_options ()
 {
@@ -2925,9 +2916,6 @@
     total_code_bytes = -1;
 
   remove_useless_addtr_insns (get_insns (), 0);
-
-  /* Restore INSN_CODEs for insn which use unscaled indexed addresses.  */
-  restore_unscaled_index_insn_codes (get_insns ());
 }
 
 void
@@ -3212,11 +3200,6 @@
     fputs ("\tnop\n", file);
 
   fputs ("\t.EXIT\n\t.PROCEND\n", file);
-
-  /* Free up stuff we don't need anymore.  */
-  if (unscaled_index_insn_codes)
-    free (unscaled_index_insn_codes);
-  max_unscaled_index_insn_codes_uid = 0;
 }
 
 void
@@ -6365,101 +6348,6 @@
   return 0;
 }
 
-/* Restore any INSN_CODEs for insns with unscaled indexed addresses since
-   the INSN_CODE might be clobberd by rerecognition triggered by reorg.  */
-
-static void
-restore_unscaled_index_insn_codes (insns)
-     rtx insns;
-{
-  rtx insn;
-
-  for (insn = insns; insn; insn = NEXT_INSN (insn))
-    {
-      if (INSN_UID (insn) < max_unscaled_index_insn_codes_uid
-	  && unscaled_index_insn_codes[INSN_UID (insn)] != -1)
-	INSN_CODE (insn) = unscaled_index_insn_codes[INSN_UID (insn)];
-    }
-}
-
-/* Severe braindamage:
-
-   On the PA, address computations within MEM expressions are not
-   commutative because of the implicit space register selection
-   from the base register (instead of the entire effective address).
-
-   Because of this mis-feature we have to know which register in a reg+reg
-   address is the base and which is the index.
-
-   Before reload, the base can be identified by REG_POINTER.  We use
-   this to force base + index addresses to match a different insn than
-   index + base addresses.
-
-   We assume that no pass during or after reload creates new unscaled indexed
-   addresses, so any unscaled indexed address we find after reload must have
-   at one time been recognized a base + index or index + base and we accept
-   any register as a base register.
-
-   This scheme assumes that no pass during/after reload will rerecognize an
-   insn with an unscaled indexed address.  This failed due to a reorg call
-   to rerecognize certain insns.
-
-   So, we record if an insn uses an unscaled indexed address and which
-   register is the base (via recording of the INSN_CODE for such insns).
-
-   Just before we output code for the function, we make sure all the insns
-   using unscaled indexed addresses have the same INSN_CODE as they did
-   immediately before delay slot scheduling.
-
-   This is extremely gross.  Long term, I'd like to use REG_POINTER to
-   handle these kinds of problems.
-
-   FIXME: Is this still necessary now that the pointer flag is stored
-   in REG rtx's and basereg_operand properly checks for the flag after
-   reload?  */
- 
-static void
-record_unscaled_index_insn_codes (insns)
-     rtx insns;
-{
-  rtx insn;
-
-  max_unscaled_index_insn_codes_uid = get_max_uid ();
-  unscaled_index_insn_codes
-    = (int *)xmalloc (max_unscaled_index_insn_codes_uid * sizeof (int));
-  memset (unscaled_index_insn_codes, -1,
-	  max_unscaled_index_insn_codes_uid * sizeof (int));
-
-  for (insn = insns; insn; insn = NEXT_INSN (insn))
-    {
-      rtx set = single_set (insn);
-      rtx mem = NULL_RTX;
-
-      /* Ignore anything that isn't a normal SET.  */
-      if (set == NULL_RTX)
-	continue;
-
-      /* No insns can have more than one MEM.  */
-      if (GET_CODE (SET_SRC (set)) == MEM)
-	mem = SET_SRC (set);
-
-      if (GET_CODE (SET_DEST (set)) == MEM)
-	mem = SET_DEST (set);
-	
-      /* If neither operand is a mem, then there's nothing to do.  */
-      if (mem == NULL_RTX)
-	continue;
-
-      if (GET_CODE (XEXP (mem, 0)) != PLUS)
-	continue;
-
-      /* If both are REGs (or SUBREGs), then record the insn code for
-	 this insn.  */
-      if (REG_P (XEXP (XEXP (mem, 0), 0)) && REG_P (XEXP (XEXP (mem, 0), 1)))
-        unscaled_index_insn_codes[INSN_UID (insn)] = INSN_CODE (insn);
-    }
-}
-
 /* We use this hook to perform a PA specific optimization which is difficult
    to do in earlier passes.
 
@@ -6499,10 +6387,6 @@
 {
   rtx insn;
 
-  /* Keep track of which insns have unscaled indexed addresses, and which
-     register is the base address in such insns.  */
-  record_unscaled_index_insn_codes (insns);
-
   remove_useless_addtr_insns (insns, 1);
 
   if (pa_cpu < PROCESSOR_8000)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]