S/390: Kill warnings

Ulrich Weigand Ulrich.Weigand@de.ibm.com
Mon Oct 21 12:45:00 GMT 2002


Hello,

this patch kills a number of warnings in the s390 backend (and in some
middle-end files where they were introduced due to s390 target macros).

With this and the separately posted common code patches, the number of
warnings in stage3 is reduced from 36 to 14; the remaining ones appear
to be common code problems and/or hard to fix.

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux.


ChangeLog:

      * config/s390/fixdfdi.h (__fixunsdfdi, __fixdfdi): Add prototypes.
      (__fixunssfdi, __fixsfdi): Likewise.
      * config/s390/s390.c (s390_single_hi): Initialize 'value'.
      (s390_single_qi): Likewise.
      (s390_emit_epilogue): Initialize 'offset'.  Remove signed vs.
      unsigned comparison warning.
      (s390_return_addr_rtx): New function.
      * config/s390/s390-protos.h (s390_return_addr_rtx): Declare it.
      * config/s390/s390.h (RETURN_ADDR_RTX): Use it.
      (HARD_REGNO_MODE_OK): Rewrite condition to silence warnings.

Index: gcc/config/s390/fixdfdi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/fixdfdi.h,v
retrieving revision 1.2
diff -c -p -r1.2 fixdfdi.h
*** gcc/config/s390/fixdfdi.h 11 Aug 2001 20:56:12 -0000    1.2
--- gcc/config/s390/fixdfdi.h 21 Oct 2002 18:02:29 -0000
*************** union double_long {
*** 43,48 ****
--- 43,49 ----
      UDItype_x ll;
  };

+ UDItype_x __fixunsdfdi (double a1);

  /* convert double to unsigned int */
  UDItype_x
*************** union double_long {
*** 114,119 ****
--- 115,122 ----
      UDItype_x ll;
  };

+ DItype_x __fixdfdi (double a1);
+
  /* convert double to int */
  DItype_x
  __fixdfdi (double a1)
*************** union float_long
*** 184,189 ****
--- 187,194 ----
      USItype_x l;
    };

+ UDItype_x __fixunssfdi (float a1);
+
  /* convert float to unsigned int */
  UDItype_x
  __fixunssfdi (float a1)
*************** union float_long
*** 249,254 ****
--- 254,261 ----
      float f;
      USItype_x l;
    };
+
+ DItype_x __fixsfdi (float a1);

  /* convert double to int */
  DItype_x
Index: gcc/config/s390/s390-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390-protos.h,v
retrieving revision 1.18
diff -c -p -r1.18 s390-protos.h
*** gcc/config/s390/s390-protos.h   20 Oct 2002 22:37:12 -0000    1.18
--- gcc/config/s390/s390-protos.h   21 Oct 2002 18:02:29 -0000
*************** extern void s390_load_address PARAMS ((r
*** 66,71 ****
--- 66,72 ----
  extern void s390_expand_movstr PARAMS ((rtx, rtx, rtx));
  extern void s390_expand_clrstr PARAMS ((rtx, rtx));
  extern void s390_expand_cmpstr PARAMS ((rtx, rtx, rtx, rtx));
+ extern rtx s390_return_addr_rtx PARAMS ((int, rtx));

  extern void s390_output_symbolic_const PARAMS ((FILE *, rtx));
  extern void print_operand_address PARAMS ((FILE *, rtx));
Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.62
diff -c -p -r1.62 s390.c
*** gcc/config/s390/s390.c    21 Oct 2002 15:27:27 -0000    1.62
--- gcc/config/s390/s390.c    21 Oct 2002 18:02:32 -0000
*************** s390_single_hi (op, mode, def)
*** 605,611 ****
  {
    if (GET_CODE (op) == CONST_INT)
      {
!       unsigned HOST_WIDE_INT value;
        int n_parts = GET_MODE_SIZE (mode) / 2;
        int i, part = -1;

--- 605,611 ----
  {
    if (GET_CODE (op) == CONST_INT)
      {
!       unsigned HOST_WIDE_INT value = 0;
        int n_parts = GET_MODE_SIZE (mode) / 2;
        int i, part = -1;

*************** s390_single_hi (op, mode, def)
*** 631,637 ****
    else if (GET_CODE (op) == CONST_DOUBLE
             && GET_MODE (op) == VOIDmode)
      {
!       unsigned HOST_WIDE_INT value;
        int n_parts = GET_MODE_SIZE (mode) / 2;
        int i, part = -1;

--- 631,637 ----
    else if (GET_CODE (op) == CONST_DOUBLE
             && GET_MODE (op) == VOIDmode)
      {
!       unsigned HOST_WIDE_INT value = 0;
        int n_parts = GET_MODE_SIZE (mode) / 2;
        int i, part = -1;

*************** s390_single_qi (op, mode, def)
*** 708,714 ****
  {
    if (GET_CODE (op) == CONST_INT)
      {
!       unsigned HOST_WIDE_INT value;
        int n_parts = GET_MODE_SIZE (mode);
        int i, part = -1;

--- 708,714 ----
  {
    if (GET_CODE (op) == CONST_INT)
      {
!       unsigned HOST_WIDE_INT value = 0;
        int n_parts = GET_MODE_SIZE (mode);
        int i, part = -1;

*************** s390_single_qi (op, mode, def)
*** 734,740 ****
    else if (GET_CODE (op) == CONST_DOUBLE
             && GET_MODE (op) == VOIDmode)
      {
!       unsigned HOST_WIDE_INT value;
        int n_parts = GET_MODE_SIZE (mode);
        int i, part = -1;

--- 734,740 ----
    else if (GET_CODE (op) == CONST_DOUBLE
             && GET_MODE (op) == VOIDmode)
      {
!       unsigned HOST_WIDE_INT value = 0;
        int n_parts = GET_MODE_SIZE (mode);
        int i, part = -1;

*************** s390_machine_dependent_reorg (first)
*** 4370,4375 ****
--- 4370,4400 ----
  }


+ /* Return an RTL expression representing the value of the return address
+    for the frame COUNT steps up from the current frame.  FRAME is the
+    frame pointer of that frame.  */
+
+ rtx
+ s390_return_addr_rtx (count, frame)
+      int count;
+      rtx frame;
+ {
+   rtx addr;
+
+   /* For the current frame, we use the initial value of RETURN_REGNUM.
+      This works both in leaf and non-leaf functions.  */
+
+   if (count == 0)
+     return get_hard_reg_initial_val (Pmode, RETURN_REGNUM);
+
+   /* For frames farther back, we read the stack slot where the
+      corresponding RETURN_REGNUM value was saved.  */
+
+   addr = plus_constant (frame, RETURN_REGNUM * UNITS_PER_WORD);
+   addr = memory_address (Pmode, addr);
+   return gen_rtx_MEM (Pmode, addr);
+ }
+
  /* Find first call clobbered register unsused in a function.
     This could be used as base register in a leaf function
     or for holding the return address before epilogue.  */
*************** s390_emit_epilogue ()
*** 4794,4800 ****
  {
    struct s390_frame frame;
    rtx frame_pointer, return_reg;
!   int area_bottom, area_top, offset;
    rtvec p;

    /* Compute frame_info.  */
--- 4819,4825 ----
  {
    struct s390_frame frame;
    rtx frame_pointer, return_reg;
!   int area_bottom, area_top, offset = 0;
    rtvec p;

    /* Compute frame_info.  */
*************** s390_emit_epilogue ()
*** 4916,4922 ****
        if (i == STACK_POINTER_REGNUM
                || i == RETURN_REGNUM
                || i == BASE_REGISTER
!               || (flag_pic && i == PIC_OFFSET_TABLE_REGNUM))
          continue;

        if (global_regs[i])
--- 4941,4947 ----
        if (i == STACK_POINTER_REGNUM
                || i == RETURN_REGNUM
                || i == BASE_REGISTER
!               || (flag_pic && i == (int)PIC_OFFSET_TABLE_REGNUM))
          continue;

        if (global_regs[i])
Index: gcc/config/s390/s390.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.47
diff -c -p -r1.47 s390.h
*** gcc/config/s390/s390.h    20 Oct 2002 22:37:13 -0000    1.47
--- gcc/config/s390/s390.h    21 Oct 2002 18:02:33 -0000
*************** do                                                \
*** 370,378 ****

  #define HARD_REGNO_MODE_OK(REGNO, MODE)                             \
    (FLOAT_REGNO_P(REGNO)?                                            \
!    (GET_MODE_CLASS(MODE) == MODE_FLOAT ||                           \
!     GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT ||                   \
!     (MODE) == SImode || (MODE) == DImode) :                         \
     INT_REGNO_P(REGNO)?                                              \
      (HARD_REGNO_NREGS(REGNO, MODE) == 1 || !((REGNO) & 1)) :        \
     CC_REGNO_P(REGNO)?                                               \
--- 370,378 ----

  #define HARD_REGNO_MODE_OK(REGNO, MODE)                             \
    (FLOAT_REGNO_P(REGNO)?                                            \
!    ((MODE) == SImode || (MODE) == DImode ||                         \
!     GET_MODE_CLASS(MODE) == MODE_FLOAT ||                           \
!     GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT) :                   \
     INT_REGNO_P(REGNO)?                                              \
      (HARD_REGNO_NREGS(REGNO, MODE) == 1 || !((REGNO) & 1)) :        \
     CC_REGNO_P(REGNO)?                                               \
*************** extern const enum reg_class regclass_map
*** 599,609 ****
     plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET))

  #define RETURN_ADDR_RTX(COUNT, FRAME)                                 \
!   ((COUNT) == 0 ? get_hard_reg_initial_val (Pmode, RETURN_REGNUM) :         \
!    gen_rtx_MEM (Pmode,                                                \
!                 memory_address (Pmode,                                \
!                                 plus_constant (DYNAMIC_CHAIN_ADDRESS ((FRAME)),   \
!                                                RETURN_REGNUM * UNITS_PER_WORD))))

  /* The following macros will turn on dwarf2 exception hndling
     Other code location for this exception handling are
--- 599,605 ----
     plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET))

  #define RETURN_ADDR_RTX(COUNT, FRAME)                                 \
!   s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))

  /* The following macros will turn on dwarf2 exception hndling
     Other code location for this exception handling are


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com



More information about the Gcc-patches mailing list