annotate gcc/config/rl78/predicates.md @ 131:84e7813d76e9

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