patches/gcc/4.4.0/300-pr40105.patch
author Remy Bohmer <linux@bohmer.net>
Sun Jul 11 22:23:34 2010 +0200 (2010-07-11)
changeset 2021 3e52a1510f87
permissions -rw-r--r--
debug/gdb: Fix compilation for Mingw hosts

GDB requires PDcurses instead of ncurses while running on Windows.
So, do not always compile ncurses in case GDB needs to build.

PDcurses is provided by an earlier build step and is not described in
this file.

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