1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/gcc/4.4.0/300-pr40105.patch Sun Feb 05 23:26:55 2012 +0100
1.3 @@ -0,0 +1,180 @@
1.4 +diff -durN gcc-4.4.0.orig/gcc/Makefile.in gcc-4.4.0/gcc/Makefile.in
1.5 +--- gcc-4.4.0.orig/gcc/Makefile.in 2009-03-25 13:00:32.000000000 +0100
1.6 ++++ gcc-4.4.0/gcc/Makefile.in 2009-05-27 21:38:50.000000000 +0200
1.7 +@@ -2785,7 +2785,8 @@
1.8 + value-prof.h $(TREE_INLINE_H) $(TARGET_H)
1.9 + cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
1.10 + $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
1.11 +- output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(TM_P_H) insn-config.h $(EXPR_H) \
1.12 ++ output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(TM_P_H) $(INSN_ATTR_H) \
1.13 ++ insn-config.h $(EXPR_H) \
1.14 + $(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \
1.15 + tree-pass.h $(DF_H) $(GGC_H)
1.16 + cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
1.17 +diff -durN gcc-4.4.0.orig/gcc/cfgrtl.c gcc-4.4.0/gcc/cfgrtl.c
1.18 +--- gcc-4.4.0.orig/gcc/cfgrtl.c 2008-12-12 22:16:09.000000000 +0100
1.19 ++++ gcc-4.4.0/gcc/cfgrtl.c 2009-05-27 21:38:50.000000000 +0200
1.20 +@@ -53,6 +53,7 @@
1.21 + #include "toplev.h"
1.22 + #include "tm_p.h"
1.23 + #include "obstack.h"
1.24 ++#include "insn-attr.h"
1.25 + #include "insn-config.h"
1.26 + #include "cfglayout.h"
1.27 + #include "expr.h"
1.28 +@@ -427,13 +428,27 @@
1.29 + return 0;
1.30 + }
1.31 +
1.32 ++static unsigned int
1.33 ++rest_of_pass_free_cfg (void)
1.34 ++{
1.35 ++#ifdef DELAY_SLOTS
1.36 ++ /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
1.37 ++ valid at that point so it would be too late to call df_analyze. */
1.38 ++ if (optimize > 0 && flag_delayed_branch)
1.39 ++ df_analyze ();
1.40 ++#endif
1.41 ++
1.42 ++ free_bb_for_insn ();
1.43 ++ return 0;
1.44 ++}
1.45 ++
1.46 + struct rtl_opt_pass pass_free_cfg =
1.47 + {
1.48 + {
1.49 + RTL_PASS,
1.50 + NULL, /* name */
1.51 + NULL, /* gate */
1.52 +- free_bb_for_insn, /* execute */
1.53 ++ rest_of_pass_free_cfg, /* execute */
1.54 + NULL, /* sub */
1.55 + NULL, /* next */
1.56 + 0, /* static_pass_number */
1.57 +diff -durN gcc-4.4.0.orig/gcc/resource.c gcc-4.4.0/gcc/resource.c
1.58 +--- gcc-4.4.0.orig/gcc/resource.c 2009-02-20 16:20:38.000000000 +0100
1.59 ++++ gcc-4.4.0/gcc/resource.c 2009-05-27 21:38:50.000000000 +0200
1.60 +@@ -135,8 +135,6 @@
1.61 + static int
1.62 + find_basic_block (rtx insn, int search_limit)
1.63 + {
1.64 +- basic_block bb;
1.65 +-
1.66 + /* Scan backwards to the previous BARRIER. Then see if we can find a
1.67 + label that starts a basic block. Return the basic block number. */
1.68 + for (insn = prev_nonnote_insn (insn);
1.69 +@@ -157,11 +155,8 @@
1.70 + for (insn = next_nonnote_insn (insn);
1.71 + insn && LABEL_P (insn);
1.72 + insn = next_nonnote_insn (insn))
1.73 +- {
1.74 +- FOR_EACH_BB (bb)
1.75 +- if (insn == BB_HEAD (bb))
1.76 +- return bb->index;
1.77 +- }
1.78 ++ if (BLOCK_FOR_INSN (insn))
1.79 ++ return BLOCK_FOR_INSN (insn)->index;
1.80 +
1.81 + return -1;
1.82 + }
1.83 +@@ -848,13 +843,12 @@
1.84 + (with no intervening active insns) to see if any of them start a basic
1.85 + block. If we hit the start of the function first, we use block 0.
1.86 +
1.87 +- Once we have found a basic block and a corresponding first insns, we can
1.88 +- accurately compute the live status from basic_block_live_regs and
1.89 +- reg_renumber. (By starting at a label following a BARRIER, we are immune
1.90 +- to actions taken by reload and jump.) Then we scan all insns between
1.91 +- that point and our target. For each CLOBBER (or for call-clobbered regs
1.92 +- when we pass a CALL_INSN), mark the appropriate registers are dead. For
1.93 +- a SET, mark them as live.
1.94 ++ Once we have found a basic block and a corresponding first insn, we can
1.95 ++ accurately compute the live status (by starting at a label following a
1.96 ++ BARRIER, we are immune to actions taken by reload and jump.) Then we
1.97 ++ scan all insns between that point and our target. For each CLOBBER (or
1.98 ++ for call-clobbered regs when we pass a CALL_INSN), mark the appropriate
1.99 ++ registers are dead. For a SET, mark them as live.
1.100 +
1.101 + We have to be careful when using REG_DEAD notes because they are not
1.102 + updated by such things as find_equiv_reg. So keep track of registers
1.103 +@@ -954,13 +948,10 @@
1.104 + TARGET. Otherwise, we must assume everything is live. */
1.105 + if (b != -1)
1.106 + {
1.107 +- regset regs_live = DF_LR_IN (BASIC_BLOCK (b));
1.108 ++ regset regs_live = df_get_live_in (BASIC_BLOCK (b));
1.109 + rtx start_insn, stop_insn;
1.110 +
1.111 +- /* Compute hard regs live at start of block -- this is the real hard regs
1.112 +- marked live, plus live pseudo regs that have been renumbered to
1.113 +- hard regs. */
1.114 +-
1.115 ++ /* Compute hard regs live at start of block. */
1.116 + REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
1.117 +
1.118 + /* Get starting and ending insn, handling the case where each might
1.119 +@@ -1046,10 +1037,24 @@
1.120 +
1.121 + else if (LABEL_P (real_insn))
1.122 + {
1.123 ++ basic_block bb;
1.124 ++
1.125 + /* A label clobbers the pending dead registers since neither
1.126 + reload nor jump will propagate a value across a label. */
1.127 + AND_COMPL_HARD_REG_SET (current_live_regs, pending_dead_regs);
1.128 + CLEAR_HARD_REG_SET (pending_dead_regs);
1.129 ++
1.130 ++ /* We must conservatively assume that all registers that used
1.131 ++ to be live here still are. The fallthrough edge may have
1.132 ++ left a live register uninitialized. */
1.133 ++ bb = BLOCK_FOR_INSN (real_insn);
1.134 ++ if (bb)
1.135 ++ {
1.136 ++ HARD_REG_SET extra_live;
1.137 ++
1.138 ++ REG_SET_TO_HARD_REG_SET (extra_live, df_get_live_in (bb));
1.139 ++ IOR_HARD_REG_SET (current_live_regs, extra_live);
1.140 ++ }
1.141 + }
1.142 +
1.143 + /* The beginning of the epilogue corresponds to the end of the
1.144 +@@ -1121,6 +1126,7 @@
1.145 + init_resource_info (rtx epilogue_insn)
1.146 + {
1.147 + int i;
1.148 ++ basic_block bb;
1.149 +
1.150 + /* Indicate what resources are required to be valid at the end of the current
1.151 + function. The condition code never is and memory always is. If the
1.152 +@@ -1189,6 +1195,11 @@
1.153 + /* Allocate and initialize the tables used by mark_target_live_regs. */
1.154 + target_hash_table = XCNEWVEC (struct target_info *, TARGET_HASH_PRIME);
1.155 + bb_ticks = XCNEWVEC (int, last_basic_block);
1.156 ++
1.157 ++ /* Set the BLOCK_FOR_INSN of each label that starts a basic block. */
1.158 ++ FOR_EACH_BB (bb)
1.159 ++ if (LABEL_P (BB_HEAD (bb)))
1.160 ++ BLOCK_FOR_INSN (BB_HEAD (bb)) = bb;
1.161 + }
1.162 +
1.163 + /* Free up the resources allocated to mark_target_live_regs (). This
1.164 +@@ -1197,6 +1208,8 @@
1.165 + void
1.166 + free_resource_info (void)
1.167 + {
1.168 ++ basic_block bb;
1.169 ++
1.170 + if (target_hash_table != NULL)
1.171 + {
1.172 + int i;
1.173 +@@ -1222,6 +1235,10 @@
1.174 + free (bb_ticks);
1.175 + bb_ticks = NULL;
1.176 + }
1.177 ++
1.178 ++ FOR_EACH_BB (bb)
1.179 ++ if (LABEL_P (BB_HEAD (bb)))
1.180 ++ BLOCK_FOR_INSN (BB_HEAD (bb)) = NULL;
1.181 + }
1.182 +
1.183 + /* Clear any hashed information that we have stored for INSN. */