diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2e833b76406..6dfc7a0a75d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +Thu Mar 15 11:24:29 EST 2001 John Wehle (john@feith.com) + + * i960.h (i960_maxbitalignment, + i960_last_maxbitalignment): Declare. + * i960.c (i960_maxbitalignment, + i960_last_maxbitalignment): Make global. + (process_pragma): Delete. + (i960_pr_align, i960_pr_noalign): Move from here ... + * i960-c.c: ... to this new file. + * t-960bare (i960-c.o): New rule. + * t-vxworks960 (i960-c.o): Likewise. + * config.gcc (i960-*-*): Define c_target_objs and + cxx_target_objs. + 2001-03-15 Bernd Schmidt * cselib.c (hash_rtx): For REG and MEM, just use value of expression diff --git a/gcc/config.gcc b/gcc/config.gcc index 830fa114c4e..f3fe3bb88e8 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1519,23 +1519,31 @@ i960-wrs-vxworks5 | i960-wrs-vxworks5.0*) tmake_file=i960/t-vxworks960 use_collect2=yes thread_file='vxworks' + c_target_objs="i960-c.o" + cxx_target_objs="i960-c.o" ;; i960-wrs-vxworks5* | i960-wrs-vxworks) tm_file="${tm_file} dbxcoff.h i960/i960-coff.h i960/vx960-coff.h" tmake_file=i960/t-vxworks960 use_collect2=yes thread_file='vxworks' + c_target_objs="i960-c.o" + cxx_target_objs="i960-c.o" ;; i960-wrs-vxworks*) tm_file="${tm_file} i960/vx960.h" tmake_file=i960/t-vxworks960 use_collect2=yes thread_file='vxworks' + c_target_objs="i960-c.o" + cxx_target_objs="i960-c.o" ;; i960-*-coff*) tm_file="${tm_file} dbxcoff.h i960/i960-coff.h libgloss.h" tmake_file=i960/t-960bare use_collect2=yes + c_target_objs="i960-c.o" + cxx_target_objs="i960-c.o" ;; i960-*-rtems) tmake_file="i960/t-960bare t-rtems" @@ -1544,9 +1552,13 @@ i960-*-rtems) if test x$enable_threads = xyes; then thread_file='rtems' fi + c_target_objs="i960-c.o" + cxx_target_objs="i960-c.o" ;; i960-*-*) # Default i960 environment. use_collect2=yes + c_target_objs="i960-c.o" + cxx_target_objs="i960-c.o" ;; ia64*-*-elf*) tm_file=ia64/elf.h diff --git a/gcc/config/i960/i960-c.c b/gcc/config/i960/i960-c.c new file mode 100644 index 00000000000..66ff29cfcaf --- /dev/null +++ b/gcc/config/i960/i960-c.c @@ -0,0 +1,116 @@ +/* Intel 80960 specific, C compiler specific functions. + Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000 + Free Software Foundation, Inc. + Contributed by Steven McGeady, Intel Corp. + Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson + Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support. + +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. */ + +#include "config.h" +#include "system.h" +#include "cpplib.h" +#include "tree.h" +#include "c-pragma.h" +#include "c-lex.h" +#include "toplev.h" +#include "ggc.h" +#include "tm_p.h" + +/* Handle pragmas for compatibility with Intel's compilers. */ + +/* NOTE: ic960 R3.0 pragma align definition: + + #pragma align [(size)] | (identifier=size[,...]) + #pragma noalign [(identifier)[,...]] + + (all parens are optional) + + - size is [1,2,4,8,16] + - noalign means size==1 + - applies only to component elements of a struct (and union?) + - identifier applies to structure tag (only) + - missing identifier means next struct + + - alignment rules for bitfields need more investigation. + + This implementation only handles the case of no identifiers. */ + +void +i960_pr_align (pfile) + cpp_reader *pfile ATTRIBUTE_UNUSED; +{ + tree number; + enum cpp_ttype type; + int align; + + type = c_lex (&number); + if (type == CPP_OPEN_PAREN) + type = c_lex (&number); + if (type == CPP_NAME) + { + warning ("sorry, not implemented: #pragma align NAME=SIZE"); + return; + } + if (type != CPP_NUMBER) + { + warning ("malformed #pragma align - ignored"); + return; + } + + align = TREE_INT_CST_LOW (number); + switch (align) + { + case 0: + /* Return to last alignment. */ + align = i960_last_maxbitalignment / 8; + /* Fall through. */ + case 16: + case 8: + case 4: + case 2: + case 1: + i960_last_maxbitalignment = i960_maxbitalignment; + i960_maxbitalignment = align * 8; + break; + + default: + /* Silently ignore bad values. */ + break; + } +} + +void +i960_pr_noalign (pfile) + cpp_reader *pfile ATTRIBUTE_UNUSED; +{ + enum cpp_ttype type; + tree number; + + type = c_lex (&number); + if (type == CPP_OPEN_PAREN) + type = c_lex (&number); + if (type == CPP_NAME) + { + warning ("sorry, not implemented: #pragma noalign NAME"); + return; + } + + i960_last_maxbitalignment = i960_maxbitalignment; + i960_maxbitalignment = 8; +} diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index 1f885fe68b1..c56f2f7bb54 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -55,8 +55,8 @@ rtx i960_compare_op0, i960_compare_op1; /* Used to implement #pragma align/noalign. Initialized by OVERRIDE_OPTIONS macro in i960.h. */ -static int i960_maxbitalignment; -static int i960_last_maxbitalignment; +int i960_maxbitalignment; +int i960_last_maxbitalignment; /* Used to implement switching between MEM and ALU insn types, for better C series performance. */ @@ -89,135 +89,6 @@ static int ret_label = 0; && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL)))) != void_type_node)) \ || current_function_varargs) -/* Handle pragmas for compatibility with Intel's compilers. */ - -/* NOTE: ic960 R3.0 pragma align definition: - - #pragma align [(size)] | (identifier=size[,...]) - #pragma noalign [(identifier)[,...]] - - (all parens are optional) - - - size is [1,2,4,8,16] - - noalign means size==1 - - applies only to component elements of a struct (and union?) - - identifier applies to structure tag (only) - - missing identifier means next struct - - - alignment rules for bitfields need more investigation. - - This implementation only handles the case of no identifiers. */ - -void -i960_pr_align (pfile) - cpp_reader *pfile ATTRIBUTE_UNUSED; -{ - tree number; - enum cpp_ttype type; - int align; - - type = c_lex (&number); - if (type == CPP_OPEN_PAREN) - type = c_lex (&number); - if (type == CPP_NAME) - { - warning ("sorry, not implemented: #pragma align NAME=SIZE"); - return; - } - if (type != CPP_NUMBER) - { - warning ("malformed #pragma align - ignored"); - return; - } - - align = TREE_INT_CST_LOW (number); - switch (align) - { - case 0: - /* Return to last alignment. */ - align = i960_last_maxbitalignment / 8; - /* Fall through. */ - case 16: - case 8: - case 4: - case 2: - case 1: - i960_last_maxbitalignment = i960_maxbitalignment; - i960_maxbitalignment = align * 8; - break; - - default: - /* Silently ignore bad values. */ - break; - } -} - -void -i960_pr_noalign (pfile) - cpp_reader *pfile ATTRIBUTE_UNUSED; -{ - enum cpp_ttype type; - tree number; - - type = c_lex (&number); - if (type == CPP_OPEN_PAREN) - type = c_lex (&number); - if (type == CPP_NAME) - { - warning ("sorry, not implemented: #pragma noalign NAME"); - return; - } - - i960_last_maxbitalignment = i960_maxbitalignment; - i960_maxbitalignment = 8; -} - -int -process_pragma (p_getc, p_ungetc, pname) - int (* p_getc) PARAMS ((void)); - void (* p_ungetc) PARAMS ((int)); - const char *pname; -{ - register int c; - char buf[20]; - char *s = buf; - int align; - - /* Should be pragma 'far' or equivalent for callx/balx here. */ - if (strcmp (pname, "align") != 0) - return 0; - - do - { - c = p_getc (); - } - while (c == ' ' || c == '\t'); - - if (c == '(') - c = p_getc (); - - while (c >= '0' && c <= '9') - { - if (s < buf + sizeof buf - 1) - *s++ = c; - c = p_getc (); - } - - *s = '\0'; - - /* We had to read a non-numerical character to get out of the - while loop---often a newline. So, we have to put it back to - make sure we continue to parse everything properly. */ - - p_ungetc (c); - - align = atoi (buf); - - - - return 1; -} - /* Initialize variables before compiling any files. */ void diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h index 4c85e95d8e8..40480bf178c 100644 --- a/gcc/config/i960/i960.h +++ b/gcc/config/i960/i960.h @@ -131,6 +131,10 @@ Boston, MA 02111-1307, USA. */ fprintf (asm_out_file, "\t.type\t0x%x;", A) /* Handle pragmas for compatibility with Intel's compilers. */ + +extern int i960_maxbitalignment; +extern int i960_last_maxbitalignment; + #define REGISTER_TARGET_PRAGMAS(PFILE) do { \ cpp_register_pragma (PFILE, 0, "align", i960_pr_align); \ cpp_register_pragma (PFILE, 0, "noalign", i960_pr_noalign); \ diff --git a/gcc/config/i960/t-960bare b/gcc/config/i960/t-960bare index 5c6b8274bb6..17c99a1cef2 100644 --- a/gcc/config/i960/t-960bare +++ b/gcc/config/i960/t-960bare @@ -21,6 +21,9 @@ xp-bit.c: $(srcdir)/config/fp-bit.c echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c cat $(srcdir)/config/fp-bit.c >> xp-bit.c +i960-c.o: $(srcdir)/config/i960/i960-c.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + MULTILIB_OPTIONS=mnumerics/msoft-float mlong-double-64 MULTILIB_DIRNAMES=float soft-float ld64 MULTILIB_MATCHES=mnumerics=msb mnumerics=msc mnumerics=mkb mnumerics=mkc mnumerics=mmc mnumerics=mcb mnumerics=mcc mnumerics=mjf msoft-float=msa msoft-float=mka msoft-float=mca msoft-float=mcf diff --git a/gcc/config/i960/t-vxworks960 b/gcc/config/i960/t-vxworks960 index 43949fa4f84..7878591764b 100644 --- a/gcc/config/i960/t-vxworks960 +++ b/gcc/config/i960/t-vxworks960 @@ -24,6 +24,9 @@ xp-bit.c: $(srcdir)/config/fp-bit.c echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c cat $(srcdir)/config/fp-bit.c >> xp-bit.c +i960-c.o: $(srcdir)/config/i960/i960-c.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + MULTILIB_OPTIONS=mnumerics/msoft-float mlong-double-64 MULTILIB_DIRNAMES=float soft-float ld64 MULTILIB_MATCHES=mnumerics=msb mnumerics=msc mnumerics=mkb mnumerics=mkc mnumerics=mmc mnumerics=mcb mnumerics=mcc msoft-float=msa msoft-float=mka msoft-float=mca msoft-float=mcf