[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Fix build problems on several targets
From:       Jan Hubicka <jh () suse ! cz>
Date:       2008-08-31 20:48:15
Message-ID: 20080831204815.GB24745 () kam ! mff ! cuni ! cz
[Download RAW message or body]

Hi,
as suggested by Hp after noticing RTX_COST updating problem in cris target,
I went through all modified target and tried to build them.  THis patch
fixes all problems I've noticed that are some of rtx_cost updating problems
along with some dataflow issues.  There is one nontrivial hunk I am not comitting:
Index: config/m68hc11/m68hc11.h
===================================================================
*** config/m68hc11/m68hc11.h	(revision 139836)
--- config/m68hc11/m68hc11.h	(working copy)
*************** extern enum reg_class m68hc11_index_reg_
*** 1067,1084 ****
     local-alloc.c.  */
  
  
- /* Internal macro, return 1 if REGNO is a valid base register.  */
- #define REG_VALID_P(REGNO) ((REGNO) >= 0)
- 
  extern unsigned char m68hc11_reg_valid_for_base[FIRST_PSEUDO_REGISTER];
  #define REG_VALID_FOR_BASE_P(REGNO) \
!     (REG_VALID_P (REGNO) && (REGNO) < FIRST_PSEUDO_REGISTER \
       && m68hc11_reg_valid_for_base[REGNO])
  
  /* Internal macro, return 1 if REGNO is a valid index register.  */
  extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER];
  #define REG_VALID_FOR_INDEX_P(REGNO) \
!     (REG_VALID_P (REGNO) >= 0 && (REGNO) < FIRST_PSEUDO_REGISTER \
       && m68hc11_reg_valid_for_index[REGNO])
  
  /* Internal macro, the nonstrict definition for REGNO_OK_FOR_BASE_P.  */
--- 1067,1081 ----
     local-alloc.c.  */
  
  
  extern unsigned char m68hc11_reg_valid_for_base[FIRST_PSEUDO_REGISTER];
  #define REG_VALID_FOR_BASE_P(REGNO) \
!     ((REGNO) < FIRST_PSEUDO_REGISTER \
       && m68hc11_reg_valid_for_base[REGNO])
  
  /* Internal macro, return 1 if REGNO is a valid index register.  */
  extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER];
  #define REG_VALID_FOR_INDEX_P(REGNO) \
!     ((REGNO) < FIRST_PSEUDO_REGISTER \
       && m68hc11_reg_valid_for_index[REGNO])
  
  /* Internal macro, the nonstrict definition for REGNO_OK_FOR_BASE_P.  */

I am not sure at all how negative regno can get here, REG_VALID_FOR_BASE_P
seems to be called on REG_REGNO arguments only, but things like true_regnum
can return -1 to indicate errors, so I am leaving it out.
Without this patch we get warnings on comparsion being always 0.

The other changes are pretty obvious, so I am comitting them now.  I apologize
for breakage on the target.  RTX_COST updates was a lot more involved than what
I hoped for after updating i386 only.  We should have started using profile in
those cases a while ago, but I kept delaying this change for various reason and
because the orignal optimize_insn_for_size_p patch got stuck for few years.

Honza

	* frv.c (frv_rtx_costs): Update forward declaration.
	* spu.c (spu_rtx_costs): Likewise.
	* pdp11.c: Include df.h
	(pdp11_output_function_epilogue): Use df_set_regs_ever_live.
	* m68hc11.c (m68hc11_gen_highpart): Fix call of gen_rtx_SUBREG.
	(m68hc11_rtx_costs_1): Fix call of rtx_cost.
	* iq2000.c (iq2000_address_cost): Add speed argument.
	(iq2000_rtx_costs): Likewise.
	* mn10300.c (mn10300_address_cost_1): Remove speed argument;
	update call of mn10300_address_cost.
	* mcore.c: Include df.h
	(mcore_rtx_costs): Update prototype.
	* score3.c: Include df.h
	(score3_rtx_costs): Remove speed argument.
	* score7.c: Include df.h
	(score7_address_cost): Remove speed argument.
	* score-protos.h (score_address_cost): Update prototype.
	* score.c: Include df.h
	(score_rtx_costs): Update call of costs functions.
	* v850.c (v850_rtx_costs): Add bool argument.

Index: config/frv/frv.c
===================================================================
*** config/frv/frv.c	(revision 139836)
--- config/frv/frv.c	(working copy)
*************** static void frv_setup_incoming_varargs		
*** 366,372 ****
  						 tree, int *, int);
  static rtx frv_expand_builtin_saveregs		(void);
  static void frv_expand_builtin_va_start		(tree, rtx);
! static bool frv_rtx_costs			(rtx, int, int, int*);
  static void frv_asm_out_constructor		(rtx, int);
  static void frv_asm_out_destructor		(rtx, int);
  static bool frv_function_symbol_referenced_p	(rtx);
--- 366,372 ----
  						 tree, int *, int);
  static rtx frv_expand_builtin_saveregs		(void);
  static void frv_expand_builtin_va_start		(tree, rtx);
! static bool frv_rtx_costs			(rtx, int, int, int*, bool);
  static void frv_asm_out_constructor		(rtx, int);
  static void frv_asm_out_destructor		(rtx, int);
  static bool frv_function_symbol_referenced_p	(rtx);
Index: config/spu/spu.c
===================================================================
*** config/spu/spu.c	(revision 139836)
--- config/spu/spu.c	(working copy)
*************** static int mem_is_padded_component_ref (
*** 126,132 ****
  static bool spu_assemble_integer (rtx x, unsigned int size, int aligned_p);
  static void spu_asm_globalize_label (FILE * file, const char *name);
  static unsigned char spu_rtx_costs (rtx x, int code, int outer_code,
! 				    int *total);
  static unsigned char spu_function_ok_for_sibcall (tree decl, tree exp);
  static void spu_init_libfuncs (void);
  static bool spu_return_in_memory (const_tree type, const_tree fntype);
--- 126,132 ----
  static bool spu_assemble_integer (rtx x, unsigned int size, int aligned_p);
  static void spu_asm_globalize_label (FILE * file, const char *name);
  static unsigned char spu_rtx_costs (rtx x, int code, int outer_code,
! 				    int *total, bool speed);
  static unsigned char spu_function_ok_for_sibcall (tree decl, tree exp);
  static void spu_init_libfuncs (void);
  static bool spu_return_in_memory (const_tree type, const_tree fntype);
Index: config/pdp11/pdp11.c
===================================================================
*** config/pdp11/pdp11.c	(revision 139836)
--- config/pdp11/pdp11.c	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 40,45 ****
--- 40,46 ----
  #include "tm_p.h"
  #include "target.h"
  #include "target-def.h"
+ #include "df.h"
  
  /*
  #define FPU_REG_P(X)	((X)>=8 && (X)<14)
*************** pdp11_output_function_epilogue (FILE *st
*** 376,382 ****
      if (frame_pointer_needed)					
      {								
  	/* hope this is safe - m68k does it also .... */		
!       df_regs_ever_live_p (FRAME_POINTER_REGNUM) = 0;			
  								
  	for (i =7, j = 0 ; i >= 0 ; i--)				
  	  if (df_regs_ever_live_p (i) && ! call_used_regs[i])		
--- 377,383 ----
      if (frame_pointer_needed)					
      {								
  	/* hope this is safe - m68k does it also .... */		
!         df_set_regs_ever_live (FRAME_POINTER_REGNUM, false);
  								
  	for (i =7, j = 0 ; i >= 0 ; i--)				
  	  if (df_regs_ever_live_p (i) && ! call_used_regs[i])		
Index: config/m68hc11/m68hc11.c
===================================================================
*** config/m68hc11/m68hc11.c	(revision 139836)
--- config/m68hc11/m68hc11.c	(working copy)
*************** m68hc11_gen_highpart (enum machine_mode 
*** 1960,1966 ****
    switch (GET_CODE (x))
      {
      case SUBREG:
!       return gen_rtx_SUBREG (mode, XEXP (x, 0), XEXP (x, 1));
      case REG:
        if (REGNO (x) < FIRST_PSEUDO_REGISTER)
          return gen_rtx_REG (mode, REGNO (x));
--- 1960,1966 ----
    switch (GET_CODE (x))
      {
      case SUBREG:
!       return gen_rtx_SUBREG (mode, XEXP (x, 0), XINT (x, 1));
      case REG:
        if (REGNO (x) < FIRST_PSEUDO_REGISTER)
          return gen_rtx_REG (mode, REGNO (x));
*************** m68hc11_rtx_costs_1 (rtx x, enum rtx_cod
*** 5335,5341 ****
            + rtx_cost (XEXP (XEXP (x, 0), 0), code, !optimize_size)
            + rtx_cost (XEXP (XEXP (x, 1), 0), code, !optimize_size);
  
!       total = rtx_cost (XEXP (x, 0), code) + rtx_cost (XEXP (x, 1), code);
        switch (mode)
          {
          case QImode:
--- 5335,5342 ----
            + rtx_cost (XEXP (XEXP (x, 0), 0), code, !optimize_size)
            + rtx_cost (XEXP (XEXP (x, 1), 0), code, !optimize_size);
  
!       total = rtx_cost (XEXP (x, 0), code, !optimize_size)
!       	      + rtx_cost (XEXP (x, 1), code, !optimize_size);
        switch (mode)
          {
          case QImode:
Index: config/iq2000/iq2000.c
===================================================================
*** config/iq2000/iq2000.c	(revision 139836)
--- config/iq2000/iq2000.c	(working copy)
*************** iq2000_move_1word (rtx operands[], rtx i
*** 744,750 ****
  /* Provide the costs of an addressing mode that contains ADDR.  */
  
  static int
! iq2000_address_cost (rtx addr, bool speec ATTRIBUTE_UNUSED)
  {
    switch (GET_CODE (addr))
      {
--- 744,750 ----
  /* Provide the costs of an addressing mode that contains ADDR.  */
  
  static int
! iq2000_address_cost (rtx addr, bool speed)
  {
    switch (GET_CODE (addr))
      {
*************** iq2000_address_cost (rtx addr, bool spee
*** 795,801 ****
  	  case LABEL_REF:
  	  case HIGH:
  	  case LO_SUM:
! 	    return iq2000_address_cost (plus1) + 1;
  
  	  default:
  	    break;
--- 795,801 ----
  	  case LABEL_REF:
  	  case HIGH:
  	  case LO_SUM:
! 	    return iq2000_address_cost (plus1, speed) + 1;
  
  	  default:
  	    break;
*************** print_operand (FILE *file, rtx op, int l
*** 3203,3209 ****
  }
  
  static bool
! iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total, bool speed)
  {
    enum machine_mode mode = GET_MODE (x);
  
--- 3203,3210 ----
  }
  
  static bool
! iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total,
! 		  bool speed ATTRIBUTE_UNUSED)
  {
    enum machine_mode mode = GET_MODE (x);
  
Index: config/mn10300/mn10300.c
===================================================================
*** config/mn10300/mn10300.c	(revision 139836)
--- config/mn10300/mn10300.c	(working copy)
*************** legitimate_address_p (enum machine_mode 
*** 1942,1948 ****
  }
  
  static int
! mn10300_address_cost_1 (rtx x, int *unsig, bool speed ATTRIBUTE_UNUSED)
  {
    switch (GET_CODE (x))
      {
--- 1942,1948 ----
  }
  
  static int
! mn10300_address_cost_1 (rtx x, int *unsig)
  {
    switch (GET_CODE (x))
      {
*************** mn10300_address_cost_1 (rtx x, int *unsi
*** 1979,1985 ****
      case EXPR_LIST:
      case SUBREG:
      case MEM:
!       return mn10300_address_cost (XEXP (x, 0));
  
      case ZERO_EXTEND:
        *unsig = 1;
--- 1979,1985 ----
      case EXPR_LIST:
      case SUBREG:
      case MEM:
!       return mn10300_address_cost (XEXP (x, 0), !optimize_size);
  
      case ZERO_EXTEND:
        *unsig = 1;
Index: config/mcore/mcore.c
===================================================================
*** config/mcore/mcore.c	(revision 139836)
--- config/mcore/mcore.c	(working copy)
***************
*** 44,49 ****
--- 44,50 ----
  #include "toplev.h"
  #include "target.h"
  #include "target-def.h"
+ #include "df.h"
  
  /* Maximum size we are allowed to grow the stack in a single operation.
     If we want more, we must do it in increments of at most this size.
*************** static const char *mcore_strip_name_enco
*** 143,149 ****
  static int        mcore_const_costs            	(rtx, RTX_CODE);
  static int        mcore_and_cost               	(rtx);
  static int        mcore_ior_cost               	(rtx);
! static bool       mcore_rtx_costs		(rtx, int, int, int *);
  static void       mcore_external_libcall	(rtx);
  static bool       mcore_return_in_memory	(const_tree, const_tree);
  static int        mcore_arg_partial_bytes       (CUMULATIVE_ARGS *,
--- 144,150 ----
  static int        mcore_const_costs            	(rtx, RTX_CODE);
  static int        mcore_and_cost               	(rtx);
  static int        mcore_ior_cost               	(rtx);
! static bool       mcore_rtx_costs		(rtx, int, int, int *, bool);
  static void       mcore_external_libcall	(rtx);
  static bool       mcore_return_in_memory	(const_tree, const_tree);
  static int        mcore_arg_partial_bytes       (CUMULATIVE_ARGS *,
Index: config/score/score3.c
===================================================================
*** config/score/score3.c	(revision 139836)
--- config/score/score3.c	(working copy)
***************
*** 49,54 ****
--- 49,55 ----
  #include "langhooks.h"
  #include "cfglayout.h"
  #include "score3.h"
+ #include "df.h"
  
  #define BITSET_P(VALUE, BIT)      (((VALUE) & (1L << (BIT))) != 0)
  #define INS_BUF_SZ                128
*************** score3_rtx_costs (rtx x, int code, int o
*** 1155,1161 ****
  
  /* Implement TARGET_ADDRESS_COST macro.  */
  int
! score3_address_cost (rtx addr, bool speed ATTRIBUTE_UNUSED)
  {
    return score3_address_insns (addr, SImode);
  }
--- 1156,1162 ----
  
  /* Implement TARGET_ADDRESS_COST macro.  */
  int
! score3_address_cost (rtx addr)
  {
    return score3_address_insns (addr, SImode);
  }
Index: config/score/score7.c
===================================================================
*** config/score/score7.c	(revision 139836)
--- config/score/score7.c	(working copy)
***************
*** 49,54 ****
--- 49,55 ----
  #include "langhooks.h"
  #include "cfglayout.h"
  #include "score7.h"
+ #include "df.h"
  
  #define BITSET_P(VALUE, BIT)      (((VALUE) & (1L << (BIT))) != 0)
  #define INS_BUF_SZ                128
*************** score7_rtx_costs (rtx x, int code, int o
*** 1146,1153 ****
  
  /* Implement TARGET_ADDRESS_COST macro.  */
  int
! score7_address_cost (rtx addr,
! 		     bool speed ATTRIBUTE_UNUSED)
  {
    return score7_address_insns (addr, SImode);
  }
--- 1147,1153 ----
  
  /* Implement TARGET_ADDRESS_COST macro.  */
  int
! score7_address_cost (rtx addr)
  {
    return score7_address_insns (addr, SImode);
  }
Index: config/score/score-protos.h
===================================================================
*** config/score/score-protos.h	(revision 139836)
--- config/score/score-protos.h	(working copy)
*************** extern const char * score_move (rtx *ops
*** 39,45 ****
  extern bool score_unaligned_load (rtx* ops);
  extern bool score_unaligned_store (rtx* ops);
  extern bool score_block_move (rtx* ops);
! extern int score_address_cost (rtx addr);
  extern rtx score_function_arg (const CUMULATIVE_ARGS *cum,
                                 enum machine_mode mode,
                                 tree type, int named);
--- 39,45 ----
  extern bool score_unaligned_load (rtx* ops);
  extern bool score_unaligned_store (rtx* ops);
  extern bool score_block_move (rtx* ops);
! extern int score_address_cost (rtx addr, bool speed);
  extern rtx score_function_arg (const CUMULATIVE_ARGS *cum,
                                 enum machine_mode mode,
                                 tree type, int named);
Index: config/score/score.c
===================================================================
*** config/score/score.c	(revision 139836)
--- config/score/score.c	(working copy)
***************
*** 49,54 ****
--- 49,55 ----
  #include "langhooks.h"
  #include "score7.h"
  #include "score3.h"
+ #include "df.h"
  
  #undef  TARGET_ASM_FILE_START
  #define TARGET_ASM_FILE_START           score_asm_file_start
*************** score_rtx_costs (rtx x, int code, int ou
*** 573,581 ****
  		 bool speed ATTRIBUTE_UNUSED)
  {
    if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
!     return score7_rtx_costs (x, code, outer_code, total);
    else if (TARGET_SCORE3)
!     return score3_rtx_costs (x, code, outer_code, total);
  
    gcc_unreachable ();
  }
--- 574,582 ----
  		 bool speed ATTRIBUTE_UNUSED)
  {
    if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
!     return score7_rtx_costs (x, code, outer_code, total, speed);
    else if (TARGET_SCORE3)
!     return score3_rtx_costs (x, code, outer_code, total, speed);
  
    gcc_unreachable ();
  }
Index: config/v850/v850.c
===================================================================
*** config/v850/v850.c	(revision 139836)
--- config/v850/v850.c	(working copy)
*************** static bool v850_handle_option       (si
*** 53,59 ****
  static void const_double_split       (rtx, HOST_WIDE_INT *, HOST_WIDE_INT *);
  static int  const_costs_int          (HOST_WIDE_INT, int);
  static int  const_costs		     (rtx, enum rtx_code);
! static bool v850_rtx_costs	     (rtx, int, int, int *);
  static void substitute_ep_register   (rtx, rtx, int, int, rtx *, rtx *);
  static void v850_reorg		     (void);
  static int  ep_memory_offset         (enum machine_mode, int);
--- 53,59 ----
  static void const_double_split       (rtx, HOST_WIDE_INT *, HOST_WIDE_INT *);
  static int  const_costs_int          (HOST_WIDE_INT, int);
  static int  const_costs		     (rtx, enum rtx_code);
! static bool v850_rtx_costs	     (rtx, int, int, int *, bool);
  static void substitute_ep_register   (rtx, rtx, int, int, rtx *, rtx *);
  static void v850_reorg		     (void);
  static int  ep_memory_offset         (enum machine_mode, int);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic