1;; Machine Description for Renesas RL78 processors 2;; Copyright (C) 2011-2018 Free Software Foundation, Inc. 3;; Contributed by Red Hat. 4 5;; This file is part of GCC. 6 7;; GCC is free software; you can redistribute it and/or modify 8;; it under the terms of the GNU General Public License as published by 9;; the Free Software Foundation; either version 3, or (at your option) 10;; any later version. 11 12;; GCC is distributed in the hope that it will be useful, 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15;; GNU General Public License for more details. 16 17;; You should have received a copy of the GNU General Public License 18;; along with GCC; see the file COPYING3. If not see 19;; <http://www.gnu.org/licenses/>. 20 21 22(define_predicate "rl78_volatile_memory_operand" 23 (and (match_code "mem") 24 (match_test ("memory_address_addr_space_p (GET_MODE (op), XEXP (op, 0), MEM_ADDR_SPACE (op))"))) 25) 26 27; TRUE for any valid general operand. We do this because 28; general_operand refuses to match volatile memory refs. 29 30(define_predicate "rl78_general_operand" 31 (ior (match_operand 0 "general_operand") 32 (match_operand 0 "rl78_volatile_memory_operand")) 33) 34 35; Likewise for nonimmediate_operand. 36 37(define_predicate "rl78_nonimmediate_operand" 38 (ior (match_operand 0 "nonimmediate_operand") 39 (match_operand 0 "rl78_volatile_memory_operand")) 40) 41 42(define_predicate "rl78_nonfar_operand" 43 (and (match_operand 0 "rl78_general_operand") 44 (not (match_test "rl78_far_p (op)"))) 45) 46 47(define_predicate "rl78_nonfar_nonimm_operand" 48 (and (match_operand 0 "rl78_nonimmediate_operand") 49 (not (match_test "rl78_far_p (op)"))) 50) 51 52(define_predicate "rl78_near_mem_operand" 53 (and (match_code "mem") 54 (match_test "!rl78_far_p (op) && rl78_as_legitimate_address (VOIDmode, XEXP (op, 0), true, ADDR_SPACE_GENERIC)")) 55) 56 57(define_predicate "ubyte_operand" 58 (and (match_code "const_int") 59 (match_test "IN_RANGE (INTVAL (op), 0, 255)"))) 60 61(define_predicate "rl78_incdec_memory_operand" 62 (and (match_code "mem") 63 (match_test "rl78_far_p (op) 64|| satisfies_constraint_Wsa (op) 65|| satisfies_constraint_Whl (op) 66|| satisfies_constraint_Wh1 (op) 67|| satisfies_constraint_Wab (op)") 68 ) 69) 70 71(define_predicate "rl78_1_2_operand" 72 (and (match_code "const_int") 73 (match_test "IN_RANGE (INTVAL (op), 1, 2) 74 || IN_RANGE (INTVAL (op), -2, -1)"))) 75 76(define_predicate "rl78_24_operand" 77 (and (match_code "const_int") 78 (match_test "INTVAL (op) == 2 || INTVAL (op) == 4"))) 79 80(define_predicate "uword_operand" 81 (ior (ior (ior (match_code "const") 82 (and (match_code "const_int") 83 (match_test "IN_RANGE (INTVAL (op), 0, 65536)"))) 84 (and (match_code "subreg") 85 (ior (match_code "symbol_ref" "0") 86 (match_code "const" "0")))) 87 (match_code "symbol_ref") 88 )) 89 90(define_predicate "rl78_cmp_operator_signed" 91 (match_code "gt,ge,lt,le")) 92(define_predicate "rl78_cmp_operator_real" 93 (match_code "eq,ne,gtu,ltu,geu,leu")) 94(define_predicate "rl78_cmp_operator" 95 (match_code "eq,ne,gtu,ltu,geu,leu,gt,lt,ge,le")) 96 97(define_predicate "rl78_ax_operand" 98 (and (match_code "reg") 99 (match_test "REGNO (op) == AX_REG || REGNO (op) >= FIRST_PSEUDO_REGISTER"))) 100 101(define_predicate "rl78_addw_operand" 102 (and (match_code "reg") 103 (match_test "REGNO (op) == AX_REG || REGNO (op) == SP_REG || REGNO (op) >= FIRST_PSEUDO_REGISTER"))) 104 105(define_predicate "rl78_stack_based_mem" 106 (and (match_code "mem") 107 (ior (and (match_code "reg" "0") 108 (match_test "REGNO (XEXP (op, 0)) == SP_REG")) 109 (and (match_code "plus" "0") 110 (and (match_code "reg" "00") 111 (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == SP_REG") 112 (and (match_code "const_int" "01") 113 (match_test "IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), 0, 256 - GET_MODE_SIZE (GET_MODE (op)))")) 114 ))))) 115