From fabf04b6e0fdc55916fbf105b785ba555b8bacd5 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Tue, 18 Jan 2000 23:06:06 +0000 Subject: [PATCH] ns32k-protos.h: New file. * ns32k-protos.h: New file. * ns32k.c: Fix compile time warnings. * ns32k.h: Move prototypes to ns32k-protos.h. Fix compile time warnings. * ns32k.md: Likewise. From-SVN: r31494 --- gcc/ChangeLog | 11 +++++++ gcc/config/ns32k/ns32k-protos.h | 49 ++++++++++++++++++++++++++++ gcc/config/ns32k/ns32k.c | 58 ++++++++++++++++----------------- gcc/config/ns32k/ns32k.h | 53 +++++++----------------------- gcc/config/ns32k/ns32k.md | 4 +++ 5 files changed, 104 insertions(+), 71 deletions(-) create mode 100644 gcc/config/ns32k/ns32k-protos.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f541f0a0fd1..d41d3bbb505 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2000-01-18 Kaveh R. Ghazi + + * ns32k-protos.h: New file. + + * ns32k.c: Fix compile time warnings. + + * ns32k.h: Move prototypes to ns32k-protos.h. Fix compile time + warnings. + + * ns32k.md: Likewise. + 2000-01-18 Kaveh R. Ghazi * vax-protos.h: New file. diff --git a/gcc/config/ns32k/ns32k-protos.h b/gcc/config/ns32k/ns32k-protos.h new file mode 100644 index 00000000000..496d0862e09 --- /dev/null +++ b/gcc/config/ns32k/ns32k-protos.h @@ -0,0 +1,49 @@ +/* Definitions of target machine for GNU compiler. NS32000 version. + Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Michael Tiemann (tiemann@cygnus.com) + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Prototypes for functions in ns32k.c */ + +#ifdef RTX_CODE +extern int calc_address_cost PARAMS ((rtx)); +extern enum reg_class secondary_reload_class PARAMS ((enum reg_class, + enum machine_mode, rtx)); +extern int reg_or_mem_operand PARAMS ((rtx, enum machine_mode)); + +extern void split_di PARAMS ((rtx[], int, rtx[], rtx[])); +extern void expand_block_move PARAMS ((rtx[])); +extern int global_symbolic_reference_mentioned_p PARAMS ((rtx, int)); +extern void print_operand PARAMS ((FILE *, rtx, int)); +extern void print_operand_address PARAMS ((FILE *, rtx)); +extern const char *output_move_double PARAMS ((rtx *)); +extern const char *output_shift_insn PARAMS ((rtx *)); +extern int symbolic_reference_mentioned_p PARAMS ((rtx)); +#endif /* RTX_CODE */ + +#ifdef TREE_CODE +extern int ns32k_comp_type_attributes PARAMS ((tree, tree)); +extern int ns32k_return_pops_args PARAMS ((tree, tree, int)); +extern int ns32k_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree)); +extern int ns32k_valid_type_attribute_p PARAMS ((tree, tree, tree, tree)); +#endif /* TREE_CODE */ + +extern int hard_regno_mode_ok PARAMS ((int, enum machine_mode)); +extern int register_move_cost PARAMS ((enum reg_class, enum reg_class)); +extern const char *output_move_dconst PARAMS ((int, const char *)); diff --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c index ab7535c1dec..bf63a882759 100644 --- a/gcc/config/ns32k/ns32k.c +++ b/gcc/config/ns32k/ns32k.c @@ -1,5 +1,5 @@ /* Subroutines for assembler code output on the NS32000. - Copyright (C) 1988, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. + Copyright (C) 1988, 94-99, 2000 Free Software Foundation, Inc. This file is part of GNU CC. @@ -33,16 +33,18 @@ Boston, MA 02111-1307, USA. */ #include "function.h" #include "expr.h" #include "flags.h" +#include "recog.h" +#include "tm_p.h" #ifdef OSF_OS int ns32k_num_files = 0; #endif -/* This duplicates reg_class_contens in reg_class.c, but maybe that isn't +/* This duplicates reg_class_contents in reg_class.c, but maybe that isn't initialized in time. Also this is more convenient as an array of ints. We know that HARD_REG_SET fits in an unsigned int */ -unsigned int ns32k_reg_class_contents[N_REG_CLASSES] = REG_CLASS_CONTENTS; +unsigned int ns32k_reg_class_contents[N_REG_CLASSES][1] = REG_CLASS_CONTENTS; enum reg_class regclass_map[FIRST_PSEUDO_REGISTER] = { @@ -55,15 +57,11 @@ enum reg_class regclass_map[FIRST_PSEUDO_REGISTER] = FRAME_POINTER_REG, STACK_POINTER_REG }; -char *ns32k_out_reg_names[] = OUTPUT_REGISTER_NAMES; - -void -trace (s, s1, s2) - char *s, *s1, *s2; -{ - fprintf (stderr, s, s1, s2); -} +const char *const ns32k_out_reg_names[] = OUTPUT_REGISTER_NAMES; +static rtx gen_indexed_expr PARAMS ((rtx, rtx, rtx)); +static const char *singlemove_string PARAMS ((rtx *)); +static void move_tail PARAMS ((rtx[], int, int)); /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ int @@ -179,7 +177,7 @@ calc_address_cost (operand) enum reg_class secondary_reload_class (class, mode, in) enum reg_class class; - enum machine_mode mode; + enum machine_mode mode ATTRIBUTE_UNUSED; rtx in; { int regno = true_regnum (in); @@ -265,7 +263,7 @@ split_di (operands, num, lo_half, hi_half) /* Return the best assembler insn template for moving operands[1] into operands[0] as a fullword. */ -static char * +static const char * singlemove_string (operands) rtx *operands; { @@ -276,7 +274,7 @@ singlemove_string (operands) return "movd %1,%0"; } -char * +const char * output_move_double (operands) rtx *operands; { @@ -454,7 +452,6 @@ expand_block_move (operands) rtx src_reg = gen_rtx(REG, Pmode, 1); rtx dest_reg = gen_rtx(REG, Pmode, 2); rtx count_reg = gen_rtx(REG, SImode, 0); - rtx insn; if (constp && bytes <= 0) return; @@ -463,6 +460,7 @@ expand_block_move (operands) { int words = bytes >> 2; if (words) + { if (words < 3 || flag_unroll_loops) { int offset = 0; @@ -488,6 +486,7 @@ expand_block_move (operands) emit_insn(gen_movstrsi2(dest, src, GEN_INT(words))); } + } move_tail(operands, bytes & 3, bytes & ~3); return; } @@ -504,8 +503,6 @@ expand_block_move (operands) if (constp && (align == UNITS_PER_WORD || bytes < MAX_UNALIGNED_COPY)) { - rtx bytes_reg; - /* constant no of bytes and aligned or small enough copy to not bother * aligning. Emit insns to copy by words. */ @@ -640,10 +637,10 @@ symbolic_reference_mentioned_p (op) int ns32k_valid_decl_attribute_p (decl, attributes, identifier, args) - tree decl; - tree attributes; - tree identifier; - tree args; + tree decl ATTRIBUTE_UNUSED; + tree attributes ATTRIBUTE_UNUSED; + tree identifier ATTRIBUTE_UNUSED; + tree args ATTRIBUTE_UNUSED; { return 0; } @@ -655,7 +652,7 @@ ns32k_valid_decl_attribute_p (decl, attributes, identifier, args) int ns32k_valid_type_attribute_p (type, attributes, identifier, args) tree type; - tree attributes; + tree attributes ATTRIBUTE_UNUSED; tree identifier; tree args; { @@ -682,8 +679,8 @@ ns32k_valid_type_attribute_p (type, attributes, identifier, args) int ns32k_comp_type_attributes (type1, type2) - tree type1; - tree type2; + tree type1 ATTRIBUTE_UNUSED; + tree type2 ATTRIBUTE_UNUSED; { return 1; } @@ -708,7 +705,7 @@ ns32k_comp_type_attributes (type1, type2) int ns32k_return_pops_args (fundecl, funtype, size) - tree fundecl; + tree fundecl ATTRIBUTE_UNUSED; tree funtype; int size; { @@ -744,7 +741,7 @@ void print_operand (file, x, code) FILE *file; rtx x; - char code; + int code; { if (code == '$') PUT_IMMEDIATE_PREFIX (file); @@ -754,7 +751,6 @@ print_operand (file, x, code) fprintf (file, "%s", ns32k_out_reg_names[REGNO (x)]); else if (GET_CODE (x) == MEM) { - rtx tmp = XEXP (x, 0); output_address (XEXP (x, 0)); } else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != VOIDmode) @@ -1124,13 +1120,14 @@ print_operand_address (file, addr) /* National 32032 shifting is so bad that we can get better performance in many common cases by using other techniques. */ -char * +const char * output_shift_insn (operands) rtx *operands; { if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 3) + { if (GET_CODE (operands[0]) == REG) { if (GET_CODE (operands[1]) == REG) @@ -1169,13 +1166,14 @@ output_shift_insn (operands) return "addd %0,%0"; } else return "ashd %2,%0"; + } return "ashd %2,%0"; } -char * +const char * output_move_dconst (n, s) int n; - char *s; + const char *s; { static char r[32]; diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h index 71df54afda4..f8ec28e73e1 100644 --- a/gcc/config/ns32k/ns32k.h +++ b/gcc/config/ns32k/ns32k.h @@ -1,5 +1,5 @@ /* Definitions of target machine for GNU compiler. NS32000 version. - Copyright (C) 1988, 93, 94-98, 1999 Free Software Foundation, Inc. + Copyright (C) 1988, 93, 94-99, 2000 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. @@ -408,12 +408,12 @@ enum reg_class This is an initializer for a vector of HARD_REG_SET of length N_REG_CLASSES. */ -#define REG_CLASS_CONTENTS {0, 0x00ff, 0x100, 0x300, 0xff00, \ - 0xffff00, 0xffffff, 0x1000000, 0x2000000, \ - 0x30000ff, 0x3ffffff } +#define REG_CLASS_CONTENTS {{0}, {0x00ff}, {0x100}, {0x300}, {0xff00}, \ + {0xffff00}, {0xffffff}, {0x1000000}, {0x2000000}, \ + {0x30000ff}, {0x3ffffff} } #define SUBSET_P(CLASS1, CLASS2) \ - ((ns32k_reg_class_contents[CLASS1] & ~ns32k_reg_class_contents[CLASS2]) \ + ((ns32k_reg_class_contents[CLASS1][0] & ~ns32k_reg_class_contents[CLASS2][0]) \ == 0) /* The same information, inverted: @@ -1145,8 +1145,7 @@ __transfer_from_trampoline () \ /* Go to ADDR if X is a valid address not using indexing. (This much is the easy part.) */ #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \ -{ register rtx xfoob = (X); \ - if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \ +{ if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \ if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \ if (GET_CODE (X) == PLUS) \ if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \ @@ -1211,7 +1210,9 @@ __transfer_from_trampoline () \ else if (INDEX_TERM_P (xfooy, MODE)) \ goto ADDR; \ else if (GET_CODE (xfooy) == PRE_DEC) \ - if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR; \ + { \ + if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR; \ + } \ else abort (); \ } @@ -1594,7 +1595,7 @@ do { \ This is suitable for output with `assemble_name'. */ #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf (LABEL, "*%s%d", PREFIX, NUM) + sprintf (LABEL, "*%s%ld", PREFIX, (long) NUM) /* This is how to align the code that follows an unconditional branch. */ @@ -1676,38 +1677,8 @@ do { \ #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR) -/* Prototypes for functions in ns32k.c */ - -/* Prototypes would be nice, but for now it causes too many problems. - This file gets included in places where the types (such as "rtx" - and enum machine_mode) are not defined. */ -#define NS32K_PROTO(ARGS) () - -int hard_regno_mode_ok NS32K_PROTO((int regno, enum machine_mode mode)); -int register_move_cost NS32K_PROTO((enum reg_class CLASS1, enum reg_class CLASS2)); -int calc_address_cost NS32K_PROTO((rtx operand)); -enum reg_class secondary_reload_class NS32K_PROTO((enum reg_class class, - enum machine_mode mode, rtx in)); -int reg_or_mem_operand NS32K_PROTO((register rtx op, enum machine_mode mode)); - -void split_di NS32K_PROTO((rtx operands[], int num, rtx lo_half[], hi_half[])); - -void expand_block_move NS32K_PROTO((rtx operands[])); -int global_symbolic_reference_mentioned_p NS32K_PROTO((rtx op, int f)); -int ns32k_comp_type_attributes NS32K_PROTO((tree type1, tree type2)); -int ns32k_return_pops_args NS32K_PROTO((tree fundecl, tree funtype, int size)); -int ns32k_valid_decl_attribute_p NS32K_PROTO((tree decl, tree attributes, - tree identifier, tree args)); -int ns32k_valid_type_attribute_p NS32K_PROTO((tree decl, tree attributes, - tree identifier, tree args)); -void print_operand NS32K_PROTO((FILE *file, rtx x, char code)); -void print_operand_address NS32K_PROTO((register FILE *file, register rtx addr)); -char *output_move_dconst NS32K_PROTO((int n, char *s)); -char *output_move_double NS32K_PROTO((rtx *operands)); -char *output_shift_insn NS32K_PROTO((rtx *operands)); - -extern unsigned int ns32k_reg_class_contents[N_REG_CLASSES]; -extern char *ns32k_out_reg_names[]; +extern unsigned int ns32k_reg_class_contents[N_REG_CLASSES][1]; +extern const char *const ns32k_out_reg_names[]; extern enum reg_class regclass_map[]; /* smalled class containing REGNO */ /* diff --git a/gcc/config/ns32k/ns32k.md b/gcc/config/ns32k/ns32k.md index 7f411d35f53..10ba1d413a1 100644 --- a/gcc/config/ns32k/ns32k.md +++ b/gcc/config/ns32k/ns32k.md @@ -2245,12 +2245,14 @@ "TARGET_BITFIELD" "* { if (GET_CODE (operands[2]) == CONST_INT) + { if (INTVAL (operands[1]) <= 8) return \"inssb %3,%0,%2,%1\"; else if (INTVAL (operands[1]) <= 16) return \"inssw %3,%0,%2,%1\"; else return \"inssd %3,%0,%2,%1\"; + } return \"insd %2,%3,%0,%1\"; }") @@ -2262,12 +2264,14 @@ "TARGET_BITFIELD" "* { if (GET_CODE (operands[2]) == CONST_INT) + { if (INTVAL (operands[1]) <= 8) return \"inssb %3,%0,%2,%1\"; else if (INTVAL (operands[1]) <= 16) return \"inssw %3,%0,%2,%1\"; else return \"inssd %3,%0,%2,%1\"; + } return \"insd %2,%3,%0,%1\"; }") -- 2.30.2