# bcc [EMAIL PROTECTED]
tag 123685 + patch
thanks

For the record, this updated NaT patch will allow ia64 to build... but we 
are waiting for confirmation from upstream.

randolph
-- 
Debian Developer <[EMAIL PROTECTED]>
http://www.TauSq.org/


#! /bin/sh -e

# DP: ia64 NaT bug fix
# DP: 
https://external-lists.valinux.com/archives/linux-ia64/2001-November/002495.html

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        #cd ${dir}gcc && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        #rm ${dir}gcc/configure
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

diff -c -p -r1.214 stmt.c
*** gcc/stmt.c  2001/08/27 17:36:20     1.214
--- gcc/stmt.c  2001/10/12 14:14:37
*************** expand_return (retval)
*** 3066,3073 ****
              dst = gen_reg_rtx (word_mode);
              result_pseudos[xbitpos / BITS_PER_WORD] = dst;
  
!             /* Clobber the destination before we move anything into it.  */
!             emit_insn (gen_rtx_CLOBBER (VOIDmode, dst));
            }
  
          /* We need a new source operand each time bitpos is on a word
--- 3066,3073 ----
              dst = gen_reg_rtx (word_mode);
              result_pseudos[xbitpos / BITS_PER_WORD] = dst;
  
!             /* Clear the destination before we move anything into it.  */
!             emit_move_insn (dst, CONST0_RTX (GET_MODE (dst)));
            }
  
          /* We need a new source operand each time bitpos is on a word


Index: gcc/rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.309
diff -c -p -r1.309 rtl.h
*** gcc/rtl.h   2001/10/25 12:55:16     1.309
--- gcc/rtl.h   2001/11/16 15:00:58
*************** extern void move_by_pieces              PARAMS ((rtx
*** 1892,1901 ****
                                                 unsigned int));
  
  /* In flow.c */
! extern void recompute_reg_usage               PARAMS ((rtx, int));
  #ifdef BUFSIZ
! extern void print_rtl_with_bb         PARAMS ((FILE *, rtx));
! extern void dump_flow_info            PARAMS ((FILE *));
  #endif
  
  /* In expmed.c */
--- 1892,1902 ----
                                                 unsigned int));
  
  /* In flow.c */
! extern void recompute_reg_usage                       PARAMS ((rtx, int));
! extern int initialize_uninitialized_subregs   PARAMS ((void));
  #ifdef BUFSIZ
! extern void print_rtl_with_bb                 PARAMS ((FILE *, rtx));
! extern void dump_flow_info                    PARAMS ((FILE *));
  #endif
  
  /* In expmed.c */
Index: gcc/toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.525
diff -c -p -r1.525 toplev.c
*** gcc/toplev.c        2001/10/23 13:34:23     1.525
--- gcc/toplev.c        2001/11/16 15:01:03
*************** rest_of_compilation (decl)
*** 3280,3285 ****
--- 3280,3299 ----
        setjmp_args_warning ();
      }
  
+   if (optimize)
+     {
+       if (initialize_uninitialized_subregs ())
+       {
+         /* Insns were inserted, so things might look a bit different.  */
+         insns = get_insns();
+         find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
+         cleanup_cfg ();
+         clear_log_links (insns);
+         life_analysis (insns, rtl_dump_file, 
+                        (PROP_LOG_LINKS | PROP_REG_INFO));
+       }
+     }
+ 
    close_dump_file (DFI_life, print_rtl_with_bb, insns);
  
    ggc_collect ();
Index: gcc/flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.486
diff -c -p -r1.486 flow.c
*** gcc/flow.c  2001/10/22 07:09:53     1.486
--- gcc/flow.c  2001/11/16 15:01:07
*************** static void mark_set_regs               PARAMS ((stru
*** 306,311 ****
--- 306,313 ----
  static void mark_set_1                        PARAMS ((struct 
propagate_block_info *,
                                                 enum rtx_code, rtx, rtx,
                                                 rtx, int));
+ static int find_regno_partial         PARAMS ((rtx *, void *));
+ 
  #ifdef HAVE_conditional_execution
  static int mark_regno_cond_dead               PARAMS ((struct 
propagate_block_info *,
                                                 int, rtx));
*************** calculate_global_regs_live (blocks_in, b
*** 1291,1296 ****
--- 1293,1407 ----
  
    free (queue);
  }
+ 
+ 
+ /* This structure is used to pass parameters to an from the
+    the function find_regno_partial(). It is used to pass in the 
+    register number we are looking, as well as to return any rtx 
+    we find.  */
+ 
+ typedef struct {
+   unsigned regno_to_find;
+   rtx retval;
+ } find_regno_partial_param;
+ 
+ 
+ /* Find the rtx for the reg numbers specified in 'data' if it is
+    part of an expression which only uses part of the register.  Return
+    it in the structure passed in.  */
+ static int 
+ find_regno_partial (ptr, data)
+      rtx *ptr;
+      void *data;
+ {
+   find_regno_partial_param *param = (find_regno_partial_param *)data;
+   unsigned reg = param->regno_to_find;
+   param->retval = NULL_RTX;
+ 
+   if (*ptr == NULL_RTX)
+     return 0;
+ 
+   switch (GET_CODE (*ptr)) 
+     {
+       case ZERO_EXTRACT:
+       case SIGN_EXTRACT:
+       case STRICT_LOW_PART:
+         if (GET_CODE (XEXP (*ptr, 0)) == REG && REGNO (XEXP (*ptr, 0)) == reg)
+         {
+           param->retval = XEXP(*ptr, 0);
+           return 1;
+         }
+       break;
+ 
+       case SUBREG:
+         if (GET_CODE (SUBREG_REG (*ptr)) == REG 
+           && REGNO (SUBREG_REG (*ptr)) == reg)
+         {
+           param->retval = SUBREG_REG(*ptr);
+           return 1;
+         }
+       break;
+
+       default:
+         break;
+     }
+ 
+   return 0;
+ }
+ 
+ /* Process all immediate successors of the entry block looking for pseudo
+    registers which are live on entry. Find all of those whose first 
+    instance is a partial register reference of some kind, and initialize 
+    them to 0 after the entry block.  This will prevent bit sets within
+    registers whose value is unknown, and may contain some kind of sticky 
+    bits we don't want.  */
+ 
+ int
+ initialize_uninitialized_subregs () 
+ {
+   rtx insn;
+   edge e;
+   int reg, did_something = 0;
+   find_regno_partial_param param;
+ 
+   for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
+     {
+       basic_block bb = e->dest;
+       regset map = bb->global_live_at_start;
+       EXECUTE_IF_SET_IN_REG_SET (map,
+                                FIRST_PSEUDO_REGISTER, reg,
+       {
+         int uid = REGNO_FIRST_UID (reg);
+         rtx i;
+ 
+         /* Find an insn which mentions the register we are looking for.
+            Its preferable to have an instance of the register's rtl since
+            there may be various flags set which we need to duplicate.  
+            If we can't find it, its probably an automatic whose initial
+            value doesnt matter, or hopefully something we dont care about. */
+         for (i = get_insns (); i && INSN_UID (i) != uid; i = NEXT_INSN (i))
+           ;
+         if (i != NULL_RTX)
+           {
+             /* Found the insn, now get the REG rtx, if we can.  */
+             param.regno_to_find = reg;
+             for_each_rtx (&i, find_regno_partial, &param);
+             if (param.retval != NULL_RTX)
+               {
+                 insn = gen_move_insn (param.retval, 
+                                       CONST0_RTX (GET_MODE (param.retval)));
+                 insert_insn_on_edge (insn, e);
+                 did_something = 1;
+               }
+           }
+       });
+     }
+ 
+   if (did_something)
+     commit_edge_insertions ();
+   return did_something;
+ }
+ 
  
  /* Subroutines of life analysis.  */
  



Reply via email to