build failed for h8300-hms with 980315

Aki M Laukkanen amlaukka@cc.helsinki.fi
Sun Mar 22 02:28:00 GMT 1998


I was building a cross compiler for h8300-hms target with 980315
snapshot. That failed due to apparent changes in gcc/cse.c which hadn't
been reflected to the h8300 port. Specifically there was a duplicate
default: in cse.c/rtx_cost(). With a five minutes of hacking I came up
with this but I'm not exactly sure whether it really fixes it as should.

*** h8300.c.orig        Fri Mar 20 23:58:53 1998
--- gcc/config/h8300/h8300.c    Sat Mar 21 00:03:13 1998
***************
*** 976,1022 ****
    return result;
  }
  ^L
- /* Return the cost of the rtx R with code CODE.  */
-
- int
- const_costs (r, c)
-      rtx r;
-      enum rtx_code c;
- {
-   switch (c)
-     {
-     case CONST_INT:
-       switch (INTVAL (r))
-       {
-       case 0:
-       case 1:
-       case 2:
-       case -1:
-       case -2:
-         return 0;
-       case 4:
-       case -4:
-         if (TARGET_H8300H || TARGET_H8300S)
-           return 0;
-         else
-           return 1;
-       default:
-         return 1;
-       }
-
-     case CONST:
-     case LABEL_REF:
-     case SYMBOL_REF:
-       return 3;
-
-     case CONST_DOUBLE:
-       return 20;
-
-     default:
-       return 4;
-     }
- }
- ^L
  /* Documentation for the machine specific operand escapes:

     'A' print rn in h8/300 mode, erN in H8/300H mode
--- 976,981 ----
*** h8300.h.orig        Fri Mar 20 23:58:49 1998
--- gcc/config/h8300/h8300.h    Sat Mar 21 00:00:04 1998
***************
*** 958,965 ****
     return it with a return statement.  Otherwise, break from the
switch.  */

  #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
!   default: { int _zxy= const_costs(RTX, CODE);        \
!            if(_zxy) return _zxy; break;}

  #define BRANCH_COST 0

--- 958,992 ----
     return it with a return statement.  Otherwise, break from the
switch.  */

  #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
!   case CONST_INT:                        \
!     switch (INTVAL(RTX))                 \
!       {                                  \
!       case 0:                            \
!       case 1:                            \
!       case 2:                            \
!       case -1:                           \
!       case -2:                           \
!       return 0;                        \
!       case 4:                            \
!       case -4:                           \
!       if (TARGET_H8300H || TARGET_H8300S) \
!         return 0;                      \
!       else                             \
!         return 1;                      \
!       default:                           \
!       return 1;                        \
!       }                                  \
!                                          \
!   case CONST:                            \
!   case LABEL_REF:                        \
!   case SYMBOL_REF:                       \
!   return 3;                              \
!                                          \
!   case CONST_DOUBLE:                     \
!   return 20;
!
! #define DEFAULT_RTX_COSTS(RTX,CODE,OUTER_CODE) \
!   return 4;

  #define BRANCH_COST 0


-- 
D.



More information about the Gcc-bugs mailing list