patches/gcc/4.4.0/300-pr40105.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 12 19:24:03 2010 +0100 (2010-01-12)
changeset 1761 88020b2c3246
permissions -rw-r--r--
scripts/functions: change handling of nochdir

- 'nochdir' must be the first option
- have systematic pushd/popd, even if nochdir
yann@1393
     1
diff -durN gcc-4.4.0.orig/gcc/Makefile.in gcc-4.4.0/gcc/Makefile.in
yann@1393
     2
--- gcc-4.4.0.orig/gcc/Makefile.in	2009-03-25 13:00:32.000000000 +0100
yann@1393
     3
+++ gcc-4.4.0/gcc/Makefile.in	2009-05-27 21:38:50.000000000 +0200
yann@1393
     4
@@ -2785,7 +2785,8 @@
yann@1393
     5
    value-prof.h $(TREE_INLINE_H) $(TARGET_H)
yann@1393
     6
 cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
yann@1393
     7
    $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
yann@1393
     8
-   output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(TM_P_H) insn-config.h $(EXPR_H) \
yann@1393
     9
+   output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(TM_P_H) $(INSN_ATTR_H) \
yann@1393
    10
+   insn-config.h $(EXPR_H) \
yann@1393
    11
    $(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \
yann@1393
    12
    tree-pass.h $(DF_H) $(GGC_H)
yann@1393
    13
 cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
yann@1393
    14
diff -durN gcc-4.4.0.orig/gcc/cfgrtl.c gcc-4.4.0/gcc/cfgrtl.c
yann@1393
    15
--- gcc-4.4.0.orig/gcc/cfgrtl.c	2008-12-12 22:16:09.000000000 +0100
yann@1393
    16
+++ gcc-4.4.0/gcc/cfgrtl.c	2009-05-27 21:38:50.000000000 +0200
yann@1393
    17
@@ -53,6 +53,7 @@
yann@1393
    18
 #include "toplev.h"
yann@1393
    19
 #include "tm_p.h"
yann@1393
    20
 #include "obstack.h"
yann@1393
    21
+#include "insn-attr.h"
yann@1393
    22
 #include "insn-config.h"
yann@1393
    23
 #include "cfglayout.h"
yann@1393
    24
 #include "expr.h"
yann@1393
    25
@@ -427,13 +428,27 @@
yann@1393
    26
   return 0;
yann@1393
    27
 }
yann@1393
    28
 
yann@1393
    29
+static unsigned int
yann@1393
    30
+rest_of_pass_free_cfg (void)
yann@1393
    31
+{
yann@1393
    32
+#ifdef DELAY_SLOTS
yann@1393
    33
+  /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
yann@1393
    34
+     valid at that point so it would be too late to call df_analyze.  */
yann@1393
    35
+  if (optimize > 0 && flag_delayed_branch)
yann@1393
    36
+    df_analyze ();
yann@1393
    37
+#endif
yann@1393
    38
+
yann@1393
    39
+  free_bb_for_insn ();
yann@1393
    40
+  return 0;
yann@1393
    41
+}
yann@1393
    42
+
yann@1393
    43
 struct rtl_opt_pass pass_free_cfg =
yann@1393
    44
 {
yann@1393
    45
  {
yann@1393
    46
   RTL_PASS,
yann@1393
    47
   NULL,                                 /* name */
yann@1393
    48
   NULL,                                 /* gate */
yann@1393
    49
-  free_bb_for_insn,                     /* execute */
yann@1393
    50
+  rest_of_pass_free_cfg,                /* execute */
yann@1393
    51
   NULL,                                 /* sub */
yann@1393
    52
   NULL,                                 /* next */
yann@1393
    53
   0,                                    /* static_pass_number */
yann@1393
    54
diff -durN gcc-4.4.0.orig/gcc/resource.c gcc-4.4.0/gcc/resource.c
yann@1393
    55
--- gcc-4.4.0.orig/gcc/resource.c	2009-02-20 16:20:38.000000000 +0100
yann@1393
    56
+++ gcc-4.4.0/gcc/resource.c	2009-05-27 21:38:50.000000000 +0200
yann@1393
    57
@@ -135,8 +135,6 @@
yann@1393
    58
 static int
yann@1393
    59
 find_basic_block (rtx insn, int search_limit)
yann@1393
    60
 {
yann@1393
    61
-  basic_block bb;
yann@1393
    62
-
yann@1393
    63
   /* Scan backwards to the previous BARRIER.  Then see if we can find a
yann@1393
    64
      label that starts a basic block.  Return the basic block number.  */
yann@1393
    65
   for (insn = prev_nonnote_insn (insn);
yann@1393
    66
@@ -157,11 +155,8 @@
yann@1393
    67
   for (insn = next_nonnote_insn (insn);
yann@1393
    68
        insn && LABEL_P (insn);
yann@1393
    69
        insn = next_nonnote_insn (insn))
yann@1393
    70
-    {
yann@1393
    71
-      FOR_EACH_BB (bb)
yann@1393
    72
-	if (insn == BB_HEAD (bb))
yann@1393
    73
-	  return bb->index;
yann@1393
    74
-    }
yann@1393
    75
+    if (BLOCK_FOR_INSN (insn))
yann@1393
    76
+      return BLOCK_FOR_INSN (insn)->index;
yann@1393
    77
 
yann@1393
    78
   return -1;
yann@1393
    79
 }
yann@1393
    80
@@ -848,13 +843,12 @@
yann@1393
    81
    (with no intervening active insns) to see if any of them start a basic
yann@1393
    82
    block.  If we hit the start of the function first, we use block 0.
yann@1393
    83
 
yann@1393
    84
-   Once we have found a basic block and a corresponding first insns, we can
yann@1393
    85
-   accurately compute the live status from basic_block_live_regs and
yann@1393
    86
-   reg_renumber.  (By starting at a label following a BARRIER, we are immune
yann@1393
    87
-   to actions taken by reload and jump.)  Then we scan all insns between
yann@1393
    88
-   that point and our target.  For each CLOBBER (or for call-clobbered regs
yann@1393
    89
-   when we pass a CALL_INSN), mark the appropriate registers are dead.  For
yann@1393
    90
-   a SET, mark them as live.
yann@1393
    91
+   Once we have found a basic block and a corresponding first insn, we can
yann@1393
    92
+   accurately compute the live status (by starting at a label following a
yann@1393
    93
+   BARRIER, we are immune to actions taken by reload and jump.)  Then we
yann@1393
    94
+   scan all insns between that point and our target.  For each CLOBBER (or
yann@1393
    95
+   for call-clobbered regs when we pass a CALL_INSN), mark the appropriate
yann@1393
    96
+   registers are dead.  For a SET, mark them as live.
yann@1393
    97
 
yann@1393
    98
    We have to be careful when using REG_DEAD notes because they are not
yann@1393
    99
    updated by such things as find_equiv_reg.  So keep track of registers
yann@1393
   100
@@ -954,13 +948,10 @@
yann@1393
   101
      TARGET.  Otherwise, we must assume everything is live.  */
yann@1393
   102
   if (b != -1)
yann@1393
   103
     {
yann@1393
   104
-      regset regs_live = DF_LR_IN (BASIC_BLOCK (b));
yann@1393
   105
+      regset regs_live = df_get_live_in (BASIC_BLOCK (b));
yann@1393
   106
       rtx start_insn, stop_insn;
yann@1393
   107
 
yann@1393
   108
-      /* Compute hard regs live at start of block -- this is the real hard regs
yann@1393
   109
-	 marked live, plus live pseudo regs that have been renumbered to
yann@1393
   110
-	 hard regs.  */
yann@1393
   111
-
yann@1393
   112
+      /* Compute hard regs live at start of block.  */
yann@1393
   113
       REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
yann@1393
   114
 
yann@1393
   115
       /* Get starting and ending insn, handling the case where each might
yann@1393
   116
@@ -1046,10 +1037,24 @@
yann@1393
   117
 
yann@1393
   118
 	  else if (LABEL_P (real_insn))
yann@1393
   119
 	    {
yann@1393
   120
+	      basic_block bb;
yann@1393
   121
+
yann@1393
   122
 	      /* A label clobbers the pending dead registers since neither
yann@1393
   123
 		 reload nor jump will propagate a value across a label.  */
yann@1393
   124
 	      AND_COMPL_HARD_REG_SET (current_live_regs, pending_dead_regs);
yann@1393
   125
 	      CLEAR_HARD_REG_SET (pending_dead_regs);
yann@1393
   126
+
yann@1393
   127
+	      /* We must conservatively assume that all registers that used
yann@1393
   128
+		 to be live here still are.  The fallthrough edge may have
yann@1393
   129
+		 left a live register uninitialized.  */
yann@1393
   130
+	      bb = BLOCK_FOR_INSN (real_insn);
yann@1393
   131
+	      if (bb)
yann@1393
   132
+		{
yann@1393
   133
+		  HARD_REG_SET extra_live;
yann@1393
   134
+
yann@1393
   135
+		  REG_SET_TO_HARD_REG_SET (extra_live, df_get_live_in (bb));
yann@1393
   136
+		  IOR_HARD_REG_SET (current_live_regs, extra_live);
yann@1393
   137
+		}
yann@1393
   138
 	    }
yann@1393
   139
 
yann@1393
   140
 	  /* The beginning of the epilogue corresponds to the end of the
yann@1393
   141
@@ -1121,6 +1126,7 @@
yann@1393
   142
 init_resource_info (rtx epilogue_insn)
yann@1393
   143
 {
yann@1393
   144
   int i;
yann@1393
   145
+  basic_block bb;
yann@1393
   146
 
yann@1393
   147
   /* Indicate what resources are required to be valid at the end of the current
yann@1393
   148
      function.  The condition code never is and memory always is.  If the
yann@1393
   149
@@ -1189,6 +1195,11 @@
yann@1393
   150
   /* Allocate and initialize the tables used by mark_target_live_regs.  */
yann@1393
   151
   target_hash_table = XCNEWVEC (struct target_info *, TARGET_HASH_PRIME);
yann@1393
   152
   bb_ticks = XCNEWVEC (int, last_basic_block);
yann@1393
   153
+
yann@1393
   154
+  /* Set the BLOCK_FOR_INSN of each label that starts a basic block.  */
yann@1393
   155
+  FOR_EACH_BB (bb)
yann@1393
   156
+    if (LABEL_P (BB_HEAD (bb)))
yann@1393
   157
+      BLOCK_FOR_INSN (BB_HEAD (bb)) = bb;
yann@1393
   158
 }
yann@1393
   159
 
yann@1393
   160
 /* Free up the resources allocated to mark_target_live_regs ().  This
yann@1393
   161
@@ -1197,6 +1208,8 @@
yann@1393
   162
 void
yann@1393
   163
 free_resource_info (void)
yann@1393
   164
 {
yann@1393
   165
+  basic_block bb;
yann@1393
   166
+
yann@1393
   167
   if (target_hash_table != NULL)
yann@1393
   168
     {
yann@1393
   169
       int i;
yann@1393
   170
@@ -1222,6 +1235,10 @@
yann@1393
   171
       free (bb_ticks);
yann@1393
   172
       bb_ticks = NULL;
yann@1393
   173
     }
yann@1393
   174
+
yann@1393
   175
+  FOR_EACH_BB (bb)
yann@1393
   176
+    if (LABEL_P (BB_HEAD (bb)))
yann@1393
   177
+      BLOCK_FOR_INSN (BB_HEAD (bb)) = NULL;
yann@1393
   178
 }
yann@1393
   179
 
yann@1393
   180
 /* Clear any hashed information that we have stored for INSN.  */