diff mbox

[3/4] Add Visium support to gcc

Message ID 4304211.XWGjf9jolC@polaris
State New
Headers show

Commit Message

Eric Botcazou Dec. 12, 2014, 12:11 a.m. UTC
gcc/ChangeLog

2014-12-11  Eric Botcazou  <ebotcazou@adacore.com>

	* config.gcc: Add Visium support.
	* configure.ac: Likewise.
	* configure: Regenerate.
	* doc/invoke.texi: Document Visium options.
	* doc/md.texi: Document Visium constraints.
	* common/config/visium: New directory.
	* config/visium: Likewise.

Comments

Joseph Myers Dec. 12, 2014, 12:26 a.m. UTC | #1
Use of `%s' in diagnostics is long obsoleted by %qs (in this case, using 
%qE with the identifier directly, rather than using IDENTIFIER_POINTER, is 
preferred).

INTVAL / UINTVAL return HOST_WIDE_INT / unsigned HOST_WIDE_INT, not long / 
unsigned long.  You have lots of uses of fprintf that presume they return 
long / unsigned long.

As you have the interrupt attribute, you need to add this port to the list 
in extend.texi of ports with this attribute.  (Generally, check the 
checklist of pieces in sourcebuild.texi to update for a new port.)

At least one target for this port should be added to 
contrib/config-list.mk (and you should verify that the port builds cleanly 
with --enable-werror-always, for both 32-bit and 64-bit hosts, when 
building using current trunk GCC).
Hans-Peter Nilsson Dec. 12, 2014, 2:35 a.m. UTC | #2
On Fri, 12 Dec 2014, Joseph Myers wrote:
> At least one target for this port should be added to
> contrib/config-list.mk (and you should verify that the port builds cleanly
> with --enable-werror-always, for both 32-bit and 64-bit hosts, when
> building using current trunk GCC).

While doing that, beware that gcc has bugs causing some ports (I
forgot which ones) to get at least one spurious warning
apparently not attributable to the quality of the port.

PR(s) duly entered, but I can't quote the numbers (finding PRs
is not practical for me after the https change, but IIRC Joern
was the author).

brgds, H-P
PS. of course no excuse to not get the low-hanging fruit.
Eric Botcazou Dec. 15, 2014, 11:15 a.m. UTC | #3
> Use of `%s' in diagnostics is long obsoleted by %qs (in this case, using
> %qE with the identifier directly, rather than using IDENTIFIER_POINTER, is
> preferred).

Only occurrence fixed by mimicing the i386 port.

> INTVAL / UINTVAL return HOST_WIDE_INT / unsigned HOST_WIDE_INT, not long /
> unsigned long.  You have lots of uses of fprintf that presume they return
> long / unsigned long.

Changed into HOST_WIDE_INT_PRINT_DEC/HOST_WIDE_INT_PRINT_UNSIGNED.

> As you have the interrupt attribute, you need to add this port to the list
> in extend.texi of ports with this attribute.  (Generally, check the
> checklist of pieces in sourcebuild.texi to update for a new port.)

Done.  But there is a bit of a contradiction in sourcebuild.texi:

   * Entries in `gcc/doc/install.texi' for all target triplets
     supported with this target architecture, giving details of any
     special notes about installation for this target, or saying that
     there are no special notes if there are none.

But gcc/doc/install.texi has:

Note that this list of install notes is @emph{not} a list of supported
hosts or targets.  Not all supported hosts and targets are listed
here, only the ones that require host-specific or target-specific
information have to. 

I have nevertheless added visium-*-elf to gcc/doc/install.texi.

I'll note that libbacktrace, libcc1, libcilkrts, liboffloadmic, libsanitizer 
and libvtv are not documented in there.

> At least one target for this port should be added to contrib/config-list.mk

This is documented in sourcebuild.texi, I'll take the 5 steps covered by "If 
the back end is added to the official GCC source repository, the following are 
also necessary:" when the premise is fulfilled.

> (and you should verify that the port builds cleanly with --enable-werror
> -always, for both 32-bit and 64-bit hosts, when building using current trunk 
> GCC).

Do you mean a bootstrap of the cross-compiler with --enable-werror-always on a 
32-bit and a 64-bit host?  OK, I'll do that.

Thanks for the review.
Joseph Myers Dec. 16, 2014, 11:58 p.m. UTC | #4
On Mon, 15 Dec 2014, Eric Botcazou wrote:

> > (and you should verify that the port builds cleanly with --enable-werror
> > -always, for both 32-bit and 64-bit hosts, when building using current trunk 
> > GCC).
> 
> Do you mean a bootstrap of the cross-compiler with --enable-werror-always on a 
> 32-bit and a 64-bit host?  OK, I'll do that.

First, bootstrap a native compiler from current trunk.  Then, use that 
native compiler to build the cross compiler configured with 
--enable-werror-always.  (--enable-werror-always is only expected to work 
when GCC is being built with the same version of GCC, as the compiler may 
not be -Werror-clean when built with other versions.)  Do this for both 
32-bit and 64-bit hosts.

For a cross-compiler, doing this provides equivalent -Werror coverage to 
what simple bootstrap does for a native compiler.
Eric Botcazou Dec. 20, 2014, 9:51 p.m. UTC | #5
> First, bootstrap a native compiler from current trunk.  Then, use that
> native compiler to build the cross compiler configured with
> --enable-werror-always.  (--enable-werror-always is only expected to work
> when GCC is being built with the same version of GCC, as the compiler may
> not be -Werror-clean when built with other versions.)  Do this for both
> 32-bit and 64-bit hosts.

Done, no changes required.
diff mbox

Patch

Index: config.gcc
===================================================================
--- config.gcc	(revision 218617)
+++ config.gcc	(working copy)
@@ -2853,6 +2853,10 @@  vax-*-openbsd*)
 	extra_options="${extra_options} openbsd.opt"
 	use_collect2=yes
 	;;
+visium-*-elf*)
+	tm_file="dbxelf.h elfos.h ${tm_file} visium/elf.h newlib-stdint.h"
+	tmake_file="visium/t-visium visium/t-crtstuff"
+	;;
 xstormy16-*-elf)
 	# For historical reasons, the target files omit the 'x'.
 	tm_file="dbxelf.h elfos.h newlib-stdint.h stormy16/stormy16.h"
Index: configure.ac
===================================================================
--- configure.ac	(revision 218617)
+++ configure.ac	(working copy)
@@ -4442,7 +4442,7 @@  esac
 case "$cpu_type" in
   aarch64 | alpha | arm | avr | bfin | cris | i386 | m32c | m68k | microblaze \
   | mips | nios2 | pa | rs6000 | score | sparc | spu | tilegx | tilepro \
-  | xstormy16 | xtensa)
+  | visium | xstormy16 | xtensa)
     insn="nop"
     ;;
   ia64 | s390)
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 218617)
+++ doc/invoke.texi	(working copy)
@@ -1062,6 +1062,10 @@  See RS/6000 and PowerPC Options.
 @emph{VAX Options}
 @gccoptlist{-mg  -mgnu  -munix}
 
+@emph{Visium Options}
+@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
+-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
+
 @emph{VMS Options}
 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
 -mpointer-size=@var{size}}
@@ -11845,6 +11849,7 @@  platform.
 * TILEPro Options::
 * V850 Options::
 * VAX Options::
+* Visium Options::
 * VMS Options::
 * VxWorks Options::
 * x86-64 Options::
@@ -22456,6 +22461,77 @@  GNU assembler is being used.
 Output code for G-format floating-point numbers instead of D-format.
 @end table
 
+@node Visium Options
+@subsection Visium Options
+@cindex Visium options
+
+@table @gcctabopt
+
+@item -mdebug
+@opindex mdebug
+A program which performs file I/O and is destined to run on an MCM target
+should be linked with this option.  It causes the libraries libc.a and
+libdebug.a to be linked.  The program should be run on the target under
+the control of the GDB remote debugging stub.
+
+@item -msim
+@opindex msim
+A program which performs file I/O and is destined to run on the simulator
+should be linked with option.  This causes libraries libc.a and libsim.a to
+be linked.
+
+@item -mfpu
+@itemx -mhard-float
+@opindex mfpu
+@opindex mhard-float
+Generate code containing floating-point instructions.  This is the
+default.
+
+@item -mno-fpu
+@itemx -msoft-float
+@opindex mno-fpu
+@opindex msoft-float
+Generate code containing library calls for floating-point.
+
+@option{-msoft-float} changes the calling convention in the output file;
+therefore, it is only useful if you compile @emph{all} of a program with
+this option.  In particular, you need to compile @file{libgcc.a}, the
+library that comes with GCC, with @option{-msoft-float} in order for
+this to work.
+
+@item -mcpu=@var{cpu_type}
+@opindex mcpu
+Set the instruction set, register set, and instruction scheduling parameters
+for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
+@samp{mcm}, @samp{gr5} and @samp{gr6}.
+
+@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
+
+By default (unless configured otherwise), GCC generates code for the GR5
+variant of the Visium architecture.  
+
+With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
+architecture.  The only difference from GR5 code is that the compiler will
+generate block move instructions.
+
+@item -mtune=@var{cpu_type}
+@opindex mtune
+Set the instruction scheduling parameters for machine type @var{cpu_type},
+but do not set the instruction set or register set that the option
+@option{-mcpu=@var{cpu_type}} would.
+
+@item -msv-mode
+@opindex msv-mode
+Generate code for the supervisor mode, where there are no restrictions on
+the access to general registers.  This is the default.
+
+@item -muser-mode
+@opindex muser-mode
+Generate code for the user mode, where the access to some general registers
+is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
+mode; on the GR6, only registers r29 to r31 are affected.
+@end table
+
 @node VMS Options
 @subsection VMS Options
 
Index: doc/md.texi
===================================================================
--- doc/md.texi	(revision 218642)
+++ doc/md.texi	(working copy)
@@ -3974,6 +3974,56 @@  A 2-element vector constant with identic
 
 @end table
 
+@item Visium---@file{config/visium/constraints.md}
+@table @code
+@item b
+EAM register @code{mdb}
+
+@item c
+EAM register @code{mdc}
+
+@item f
+Floating point register
+
+@ifset INTERNALS
+@item k
+Register for sibcall optimization
+@end ifset
+
+@item l
+General register, but not @code{r29}, @code{r30} and @code{r31}
+
+@item t
+Register @code{r1}
+
+@item u
+Register @code{r2}
+
+@item v
+Register @code{r3}
+
+@item G
+Floating-point constant 0.0
+
+@item J
+Integer constant in the range 0 .. 65535 (16-bit immediate)
+
+@item K
+Integer constant in the range 1 .. 31 (5-bit immediate)
+
+@item L
+Integer constant in the range @minus{}65535 .. @minus{}1 (16-bit negative immediate)
+
+@item M
+Integer constant @minus{}1
+
+@item O
+Integer constant 0
+
+@item P
+Integer constant 32
+@end table
+
 @item Xtensa---@file{config/xtensa/constraints.md}
 @table @code
 @item a
Index: common/config/visium/visium-common.c
===================================================================
--- common/config/visium/visium-common.c	(revision 0)
+++ common/config/visium/visium-common.c	(revision 0)
@@ -0,0 +1,38 @@ 
+/* Common hooks for Visium.
+   Copyright (C) 2002-2014 Free Software Foundation, Inc.
+   Contributed by C.Nettleton,J.P.Parkes and P.Garbett.
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "common/common-target.h"
+#include "common/common-target-def.h"
+
+/* Set default optimization options.  */
+static const struct default_options visium_option_optimization_table[] =
+  {
+    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
+    { OPT_LEVELS_NONE, 0, NULL, 0 }
+  };
+
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
+#define TARGET_OPTION_OPTIMIZATION_TABLE visium_option_optimization_table
+
+struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;