;; Machine Description for Renesas RL78 processors
|
;; Machine Description for Renesas RL78 processors
|
;; Copyright (C) 2011 Free Software Foundation, Inc.
|
;; Copyright (C) 2011 Free Software Foundation, Inc.
|
;; Contributed by Red Hat.
|
;; Contributed by Red Hat.
|
|
|
;; This file is part of GCC.
|
;; This file is part of GCC.
|
|
|
;; GCC is free software; you can redistribute it and/or modify
|
;; GCC is free software; you can redistribute it and/or modify
|
;; it under the terms of the GNU General Public License as published by
|
;; it under the terms of the GNU General Public License as published by
|
;; the Free Software Foundation; either version 3, or (at your option)
|
;; the Free Software Foundation; either version 3, or (at your option)
|
;; any later version.
|
;; any later version.
|
|
|
;; GCC is distributed in the hope that it will be useful,
|
;; GCC is distributed in the hope that it will be useful,
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;; GNU General Public License for more details.
|
;; GNU General Public License for more details.
|
|
|
;; You should have received a copy of the GNU General Public License
|
;; You should have received a copy of the GNU General Public License
|
;; along with GCC; see the file COPYING3. If not see
|
;; along with GCC; see the file COPYING3. If not see
|
;; .
|
;; .
|
|
|
; Constraints in use:
|
; Constraints in use:
|
|
|
; core:
|
; core:
|
; V X g i m n o p r s < >
|
; V X g i m n o p r s < >
|
; 0..9
|
; 0..9
|
; I..Q - integers
|
; I..Q - integers
|
; Int8 = 0..255
|
; Int8 = 0..255
|
; Int3 = 1..7
|
; Int3 = 1..7
|
; J = -255..0
|
; J = -255..0
|
; K = 1
|
; K = 1
|
; L = -1
|
; L = -1
|
; M = 0
|
; M = 0
|
; N = 2
|
; N = 2
|
; O = -2
|
; O = -2
|
; P = 1..15
|
; P = 1..15
|
|
|
; E..H - float constants
|
; E..H - float constants
|
|
|
; RL78-specific
|
; RL78-specific
|
; a x b c d e h l w - 8-bit regs
|
; a x b c d e h l w - 8-bit regs
|
; A B D T S - 16-bit regs
|
; A B D T S - 16-bit regs
|
; R = all regular registers (A-L)
|
; R = all regular registers (A-L)
|
; Y - any valid memory
|
; Y - any valid memory
|
; Wxx - various memory addressing modes
|
; Wxx - various memory addressing modes
|
; Qxx - conditionals
|
; Qxx - conditionals
|
; v = virtual registers
|
; v = virtual registers
|
; Zxx = specific virtual registers
|
; Zxx = specific virtual registers
|
|
|
(define_constraint "Int8"
|
(define_constraint "Int8"
|
"Integer constant in the range 0 @dots{} 255."
|
"Integer constant in the range 0 @dots{} 255."
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, 0, 255)")))
|
(match_test "IN_RANGE (ival, 0, 255)")))
|
|
|
(define_constraint "Int3"
|
(define_constraint "Int3"
|
"Integer constant in the range 1 @dots{} 7."
|
"Integer constant in the range 1 @dots{} 7."
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, 1, 7)")))
|
(match_test "IN_RANGE (ival, 1, 7)")))
|
|
|
(define_constraint "J"
|
(define_constraint "J"
|
"Integer constant in the range -255 @dots{} 0"
|
"Integer constant in the range -255 @dots{} 0"
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, -255, 0)")))
|
(match_test "IN_RANGE (ival, -255, 0)")))
|
|
|
(define_constraint "K"
|
(define_constraint "K"
|
"Integer constant 1."
|
"Integer constant 1."
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, 1, 1)")))
|
(match_test "IN_RANGE (ival, 1, 1)")))
|
|
|
(define_constraint "L"
|
(define_constraint "L"
|
"Integer constant -1."
|
"Integer constant -1."
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, -1, -1)")))
|
(match_test "IN_RANGE (ival, -1, -1)")))
|
|
|
(define_constraint "M"
|
(define_constraint "M"
|
"Integer constant 0."
|
"Integer constant 0."
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, 0, 0)")))
|
(match_test "IN_RANGE (ival, 0, 0)")))
|
|
|
(define_constraint "N"
|
(define_constraint "N"
|
"Integer constant 2."
|
"Integer constant 2."
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, 2, 2)")))
|
(match_test "IN_RANGE (ival, 2, 2)")))
|
|
|
(define_constraint "O"
|
(define_constraint "O"
|
"Integer constant -2."
|
"Integer constant -2."
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, -2, -2)")))
|
(match_test "IN_RANGE (ival, -2, -2)")))
|
|
|
(define_constraint "P"
|
(define_constraint "P"
|
"Integer constant 1..15"
|
"Integer constant 1..15"
|
(and (match_code "const_int")
|
(and (match_code "const_int")
|
(match_test "IN_RANGE (ival, 1, 15)")))
|
(match_test "IN_RANGE (ival, 1, 15)")))
|
|
|
(define_register_constraint "R" "QI_REGS"
|
(define_register_constraint "R" "QI_REGS"
|
"@code{A} through @code{L} registers.")
|
"@code{A} through @code{L} registers.")
|
|
|
(define_register_constraint "a" "AREG"
|
(define_register_constraint "a" "AREG"
|
"The @code{A} register.")
|
"The @code{A} register.")
|
|
|
(define_register_constraint "x" "XREG"
|
(define_register_constraint "x" "XREG"
|
"The @code{X} register.")
|
"The @code{X} register.")
|
|
|
(define_register_constraint "b" "BREG"
|
(define_register_constraint "b" "BREG"
|
"The @code{B} register.")
|
"The @code{B} register.")
|
|
|
(define_register_constraint "c" "CREG"
|
(define_register_constraint "c" "CREG"
|
"The @code{C} register.")
|
"The @code{C} register.")
|
|
|
(define_register_constraint "d" "DREG"
|
(define_register_constraint "d" "DREG"
|
"The @code{D} register.")
|
"The @code{D} register.")
|
|
|
(define_register_constraint "e" "EREG"
|
(define_register_constraint "e" "EREG"
|
"The @code{E} register.")
|
"The @code{E} register.")
|
|
|
(define_register_constraint "h" "HREG"
|
(define_register_constraint "h" "HREG"
|
"The @code{H} register.")
|
"The @code{H} register.")
|
|
|
(define_register_constraint "l" "LREG"
|
(define_register_constraint "l" "LREG"
|
"The @code{L} register.")
|
"The @code{L} register.")
|
|
|
(define_register_constraint "w" "PSWREG"
|
(define_register_constraint "w" "PSWREG"
|
"The @code{PSW} register.")
|
"The @code{PSW} register.")
|
|
|
(define_register_constraint "A" "AXREG"
|
(define_register_constraint "A" "AXREG"
|
"The @code{AX} register.")
|
"The @code{AX} register.")
|
|
|
(define_register_constraint "B" "BCREG"
|
(define_register_constraint "B" "BCREG"
|
"The @code{BC} register.")
|
"The @code{BC} register.")
|
|
|
(define_register_constraint "D" "DEREG"
|
(define_register_constraint "D" "DEREG"
|
"The @code{DE} register.")
|
"The @code{DE} register.")
|
|
|
; because H + L = T, assuming A=1.
|
; because H + L = T, assuming A=1.
|
(define_register_constraint "T" "HLREG"
|
(define_register_constraint "T" "HLREG"
|
"The @code{HL} register.")
|
"The @code{HL} register.")
|
|
|
(define_register_constraint "S" "SPREG"
|
(define_register_constraint "S" "SPREG"
|
"The @code{SP} register.")
|
"The @code{SP} register.")
|
|
|
(define_register_constraint "v" "V_REGS"
|
(define_register_constraint "v" "V_REGS"
|
"The virtual registers.")
|
"The virtual registers.")
|
|
|
(define_register_constraint "Z08W" "R8W_REGS"
|
(define_register_constraint "Z08W" "R8W_REGS"
|
"The R8 register, HImode.")
|
"The R8 register, HImode.")
|
|
|
(define_register_constraint "Z10W" "R10W_REGS"
|
(define_register_constraint "Z10W" "R10W_REGS"
|
"The R10 register, HImode.")
|
"The R10 register, HImode.")
|
|
|
(define_register_constraint "Zint" "INT_REGS"
|
(define_register_constraint "Zint" "INT_REGS"
|
"The interrupt registers.")
|
"The interrupt registers.")
|
|
|
; All the memory addressing schemes the RL78 supports
|
; All the memory addressing schemes the RL78 supports
|
; of the form W {register} {bytes of offset}
|
; of the form W {register} {bytes of offset}
|
; or W {register} {register}
|
; or W {register} {register}
|
|
|
; absolute address
|
; absolute address
|
(define_memory_constraint "Wab"
|
(define_memory_constraint "Wab"
|
"[addr]"
|
"[addr]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(ior (match_test "CONSTANT_P (XEXP (op, 0))")
|
(ior (match_test "CONSTANT_P (XEXP (op, 0))")
|
(match_test "GET_CODE (XEXP (op, 0)) == PLUS && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF"))
|
(match_test "GET_CODE (XEXP (op, 0)) == PLUS && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF"))
|
)
|
)
|
)
|
)
|
|
|
(define_memory_constraint "Wbc"
|
(define_memory_constraint "Wbc"
|
"word16[BC]"
|
"word16[BC]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(ior
|
(ior
|
(and (match_code "reg" "0")
|
(and (match_code "reg" "0")
|
(match_test "REGNO (XEXP (op, 0)) == BC_REG"))
|
(match_test "REGNO (XEXP (op, 0)) == BC_REG"))
|
(and (match_code "plus" "0")
|
(and (match_code "plus" "0")
|
(and (and (match_code "reg" "00")
|
(and (and (match_code "reg" "00")
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == BC_REG"))
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == BC_REG"))
|
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
)
|
)
|
)
|
)
|
|
|
(define_memory_constraint "Wde"
|
(define_memory_constraint "Wde"
|
"[DE]"
|
"[DE]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(and (match_code "reg" "0")
|
(and (match_code "reg" "0")
|
(match_test "REGNO (XEXP (op, 0)) == DE_REG")))
|
(match_test "REGNO (XEXP (op, 0)) == DE_REG")))
|
)
|
)
|
|
|
(define_memory_constraint "Wca"
|
(define_memory_constraint "Wca"
|
"[AX..HL] for calls"
|
"[AX..HL] for calls"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(and (match_code "reg" "0")
|
(and (match_code "reg" "0")
|
(match_test "REGNO (XEXP (op, 0)) <= HL_REG")))
|
(match_test "REGNO (XEXP (op, 0)) <= HL_REG")))
|
)
|
)
|
|
|
(define_memory_constraint "Wcv"
|
(define_memory_constraint "Wcv"
|
"[AX..HL,r8-r23] for calls"
|
"[AX..HL,r8-r23] for calls"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(and (match_code "reg" "0")
|
(and (match_code "reg" "0")
|
(match_test "REGNO (XEXP (op, 0)) < 24")))
|
(match_test "REGNO (XEXP (op, 0)) < 24")))
|
)
|
)
|
|
|
(define_memory_constraint "Wd2"
|
(define_memory_constraint "Wd2"
|
"word16[DE]"
|
"word16[DE]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(ior
|
(ior
|
(and (match_code "reg" "0")
|
(and (match_code "reg" "0")
|
(match_test "REGNO (XEXP (op, 0)) == DE_REG"))
|
(match_test "REGNO (XEXP (op, 0)) == DE_REG"))
|
(and (match_code "plus" "0")
|
(and (match_code "plus" "0")
|
(and (and (match_code "reg" "00")
|
(and (and (match_code "reg" "00")
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == DE_REG"))
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == DE_REG"))
|
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
)
|
)
|
)
|
)
|
|
|
(define_memory_constraint "Whl"
|
(define_memory_constraint "Whl"
|
"[HL]"
|
"[HL]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(and (match_code "reg" "0")
|
(and (match_code "reg" "0")
|
(match_test "REGNO (XEXP (op, 0)) == HL_REG")))
|
(match_test "REGNO (XEXP (op, 0)) == HL_REG")))
|
)
|
)
|
|
|
(define_memory_constraint "Wh1"
|
(define_memory_constraint "Wh1"
|
"byte8[HL]"
|
"byte8[HL]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(and (match_code "plus" "0")
|
(and (match_code "plus" "0")
|
(and (and (match_code "reg" "00")
|
(and (and (match_code "reg" "00")
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == HL_REG"))
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == HL_REG"))
|
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
)
|
)
|
|
|
(define_memory_constraint "Whb"
|
(define_memory_constraint "Whb"
|
"[HL+B]"
|
"[HL+B]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(match_test "rl78_hl_b_c_addr_p (XEXP (op, 0))"))
|
(match_test "rl78_hl_b_c_addr_p (XEXP (op, 0))"))
|
)
|
)
|
|
|
(define_memory_constraint "Ws1"
|
(define_memory_constraint "Ws1"
|
"word8[SP]"
|
"word8[SP]"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(ior
|
(ior
|
(and (match_code "reg" "0")
|
(and (match_code "reg" "0")
|
(match_test "REGNO (XEXP (op, 0)) == SP_REG"))
|
(match_test "REGNO (XEXP (op, 0)) == SP_REG"))
|
(and (match_code "plus" "0")
|
(and (match_code "plus" "0")
|
(and (and (match_code "reg" "00")
|
(and (and (match_code "reg" "00")
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == SP_REG"))
|
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == SP_REG"))
|
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
|
)
|
)
|
)
|
)
|
|
|
(define_memory_constraint "Wfr"
|
(define_memory_constraint "Wfr"
|
"ES/CS far pointer"
|
"ES/CS far pointer"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(match_test "rl78_far_p (op)"))
|
(match_test "rl78_far_p (op)"))
|
)
|
)
|
|
|
(define_memory_constraint "Y"
|
(define_memory_constraint "Y"
|
"any near legitimate memory access"
|
"any near legitimate memory access"
|
(and (match_code "mem")
|
(and (match_code "mem")
|
(match_test "!rl78_far_p (op) && rl78_as_legitimate_address (VOIDmode, XEXP (op, 0), true, ADDR_SPACE_GENERIC)"))
|
(match_test "!rl78_far_p (op) && rl78_as_legitimate_address (VOIDmode, XEXP (op, 0), true, ADDR_SPACE_GENERIC)"))
|
)
|
)
|
|
|
|
|
(define_memory_constraint "Qbi"
|
(define_memory_constraint "Qbi"
|
"built-in compare types"
|
"built-in compare types"
|
(match_code "eq,ne,gtu,ltu,geu,leu"))
|
(match_code "eq,ne,gtu,ltu,geu,leu"))
|
|
|
(define_memory_constraint "Qsc"
|
(define_memory_constraint "Qsc"
|
"synthetic compares"
|
"synthetic compares"
|
(match_code "gt,lt,ge,le"))
|
(match_code "gt,lt,ge,le"))
|
|
|