Skip to content

Commit

Permalink
FT32 target added. Approved by Jeff Law [law@redhat.com]
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223261 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jamesbowman committed May 16, 2015
1 parent 5be0de3 commit b6616c9
Show file tree
Hide file tree
Showing 26 changed files with 4,257 additions and 1 deletion.
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2015-05-16 James Bowman <james.bowman@ftdichip.com>

* configure.ac: FT32 target added.
* libgcc/config.host: FT32 target added.
* gcc/config/ft32/: FT32 target added.
* libgcc/config/ft32/: FT32 target added.
* gcc/doc/install.texi, invoke.texi, md.texi: FT32 details added.
* gcc/doc/contrib.texi: self added.
* contrib/config-list.mk: FT32 target added.
* configure: Regenerated.

2015-05-16 Iain Buclaw <ibuclaw@gdcproject.org>

* MAINTAINERS (Write After Approval): Add myself.
Expand Down
3 changes: 3 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3363,6 +3363,9 @@ if test "${ENABLE_LIBSTDCXX}" = "default" ; then
avr-*-*)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
;;
ft32-*-*)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
;;
esac
fi

Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,9 @@ if test "${ENABLE_LIBSTDCXX}" = "default" ; then
avr-*-*)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
;;
ft32-*-*)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
;;
esac
fi

Expand Down
2 changes: 1 addition & 1 deletion contrib/config-list.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LIST = aarch64-elf aarch64-linux-gnu \
bfin-elf bfin-uclinux bfin-linux-uclibc bfin-rtems bfin-openbsd \
c6x-elf c6x-uclinux cr16-elf cris-elf cris-linux crisv32-elf crisv32-linux \
epiphany-elf epiphany-elfOPT-with-stack-offset=16 fido-elf \
fr30-elf frv-elf frv-linux h8300-elf h8300-rtems hppa-linux-gnu \
fr30-elf frv-elf frv-linux ft32-elf h8300-elf h8300-rtems hppa-linux-gnu \
hppa-linux-gnuOPT-enable-sjlj-exceptions=yes hppa64-linux-gnu \
hppa2.0-hpux10.1 hppa64-hpux11.3 \
hppa64-hpux11.0OPT-enable-sjlj-exceptions=yes hppa2.0-hpux11.9 \
Expand Down
9 changes: 9 additions & 0 deletions gcc/config.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ crisv32-*)
frv*) cpu_type=frv
extra_options="${extra_options} g.opt"
;;
ft32*) cpu_type=ft32
target_has_targetm_common=no
;;
moxie*) cpu_type=moxie
target_has_targetm_common=no
;;
Expand Down Expand Up @@ -1194,6 +1197,12 @@ frv-*-*linux*)
gnu-user.h linux.h glibc-stdint.h frv/linux.h"
tmake_file="${tmake_file} frv/t-frv frv/t-linux"
;;
ft32-*-elf)
gas=yes
gnu_ld=yes
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
tmake_file="${tmake_file} ft32/t-ft32"
;;
moxie-*-elf)
gas=yes
gnu_ld=yes
Expand Down
113 changes: 113 additions & 0 deletions gcc/config/ft32/constraints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
;; Constraint definitions for FT32
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Contributed by FTDI <support@ftdi.com>

;; 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/>.

;; -------------------------------------------------------------------------
;; Constraints
;; -------------------------------------------------------------------------

(define_memory_constraint "A"
"An absolute address."
(and (match_code "mem")
(match_test "(!ft32_is_mem_pm(op))")
(ior (match_test "GET_CODE (XEXP (op, 0)) == SYMBOL_REF")
(match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")
(match_test "GET_CODE (XEXP (op, 0)) == CONST_INT")
(and (match_test "(GET_CODE (XEXP (op, 0)) == PLUS)")
(ior (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF")
(match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF")
(match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == CONST_INT"))
(ior (match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == SYMBOL_REF")
(match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == LABEL_REF")
(match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT"))))))

(define_memory_constraint "B"
"An offset address."
(and (match_code "mem")
(match_test "(!ft32_is_mem_pm(op))")
(match_test "(GET_CODE (XEXP (op, 0)) == PLUS)")))

(define_memory_constraint "W"
"A register indirect memory operand."
(and (match_code "mem")
(match_test "!ft32_is_mem_pm(op)
&& REG_P (XEXP (op, 0))
&& REGNO_OK_FOR_BASE_P (REGNO (XEXP (op, 0)))")))

(define_memory_constraint "e"
"An offset address."
(and (match_code "mem")
(match_test "ft32_is_mem_pm(op) && (
(GET_CODE (XEXP (op, 0)) == SYMBOL_REF) ||
(GET_CODE (XEXP (op, 0)) == LABEL_REF) ||
(GET_CODE (XEXP (op, 0)) == CONST_INT) ||
(GET_CODE (XEXP (op, 0)) == CONST))"
)))

(define_memory_constraint "f"
"An offset address."
(and (match_code "mem")
(match_test "ft32_is_mem_pm(op) && (
((GET_CODE (XEXP (op, 0)) == PLUS)) ||
(GET_CODE (XEXP (op, 0)) == REG))"
)))

(define_constraint "O"
"The constant zero or one"
(and (match_code "const_int")
(match_test "((ival == 0) || (ival == 1))")))

(define_constraint "I"
"A 16-bit signed constant (-32768..32767)"
(and (match_code "const_int")
(match_test "ival >= -32768 && ival <= 32767")))

(define_constraint "w"
"A bitfield mask suitable for bext or bins"
(and (match_code "const_int")
(match_test "ft32_as_bitfield(ival) != -1")))

(define_constraint "x"
"An inverted bitfield mask suitable for bext or bins"
(and (match_code "const_int")
(match_test "ft32_as_bitfield(0xffffffff ^ ival) != -1")))

(define_constraint "L"
"A 16-bit unsigned constant, multiple of 4 (-65532..0)"
(and (match_code "const_int")
(match_test "-65532 <= ival && ival <= 0 && (ival & 3) == 0")))

(define_constraint "S"
"A 20-bit signed constant (-524288..524287)"
(ior
(and (match_code "const_int")
(match_test "ival >= -524288 && ival <= 524287"))
(match_test "GET_CODE (op) == LABEL_REF")
(match_test "GET_CODE (op) == SYMBOL_REF")
(match_test "GET_CODE (op) == CONST")))

(define_constraint "b"
"A constant for a bitfield width (1..16)"
(and (match_code "const_int")
(match_test "1 <= ival && ival <= 16")))

(define_constraint "KA"
"A 10-bit signed constant (-512..511)"
(and (match_code "const_int")
(match_test "-512 <= ival && ival <= 511")))
26 changes: 26 additions & 0 deletions gcc/config/ft32/ft32-protos.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Prototypes for ft32.c functions used in the md file & elsewhere.
Copyright (C) 2015 Free Software Foundation, Inc.
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/>. */

extern void ft32_expand_prologue (void);
extern void ft32_expand_epilogue (void);
extern int ft32_initial_elimination_offset (int, int);
extern void ft32_print_operand (FILE *, rtx, int);
extern void ft32_print_operand_address (FILE *, rtx);
extern const char* ft32_load_immediate(rtx, int32_t i);
extern int ft32_as_bitfield(unsigned int x);
Loading

0 comments on commit b6616c9

Please sign in to comment.