]>
Commit | Line | Data |
---|---|---|
c4963a0a | 1 | /* Inline functions to test validity of reg classes for addressing modes. |
818ab71a | 2 | Copyright (C) 2006-2016 Free Software Foundation, Inc. |
c4963a0a BS |
3 | |
4 | This file is part of GCC. | |
5 | ||
6 | GCC is free software; you can redistribute it and/or modify it under | |
7 | the terms of the GNU General Public License as published by the Free | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
c4963a0a BS |
9 | version. |
10 | ||
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
c4963a0a BS |
19 | |
20 | /* Wrapper function to unify target macros MODE_CODE_BASE_REG_CLASS, | |
21 | MODE_BASE_REG_REG_CLASS, MODE_BASE_REG_CLASS and BASE_REG_CLASS. | |
22 | Arguments as for the MODE_CODE_BASE_REG_CLASS macro. */ | |
23 | ||
f1717f8d KC |
24 | #ifndef GCC_ADDRESSES_H |
25 | #define GCC_ADDRESSES_H | |
26 | ||
c4963a0a | 27 | static inline enum reg_class |
ef4bddc2 | 28 | base_reg_class (machine_mode mode ATTRIBUTE_UNUSED, |
86fc3d06 | 29 | addr_space_t as ATTRIBUTE_UNUSED, |
c4963a0a BS |
30 | enum rtx_code outer_code ATTRIBUTE_UNUSED, |
31 | enum rtx_code index_code ATTRIBUTE_UNUSED) | |
32 | { | |
33 | #ifdef MODE_CODE_BASE_REG_CLASS | |
86fc3d06 | 34 | return MODE_CODE_BASE_REG_CLASS (mode, as, outer_code, index_code); |
c4963a0a BS |
35 | #else |
36 | #ifdef MODE_BASE_REG_REG_CLASS | |
37 | if (index_code == REG) | |
38 | return MODE_BASE_REG_REG_CLASS (mode); | |
39 | #endif | |
40 | #ifdef MODE_BASE_REG_CLASS | |
41 | return MODE_BASE_REG_CLASS (mode); | |
42 | #else | |
43 | return BASE_REG_CLASS; | |
44 | #endif | |
45 | #endif | |
46 | } | |
47 | ||
48 | /* Wrapper function to unify target macros REGNO_MODE_CODE_OK_FOR_BASE_P, | |
49 | REGNO_MODE_OK_FOR_REG_BASE_P, REGNO_MODE_OK_FOR_BASE_P and | |
50 | REGNO_OK_FOR_BASE_P. | |
51 | Arguments as for the REGNO_MODE_CODE_OK_FOR_BASE_P macro. */ | |
52 | ||
53 | static inline bool | |
c6dfaad5 | 54 | ok_for_base_p_1 (unsigned regno ATTRIBUTE_UNUSED, |
ef4bddc2 | 55 | machine_mode mode ATTRIBUTE_UNUSED, |
86fc3d06 | 56 | addr_space_t as ATTRIBUTE_UNUSED, |
c4963a0a BS |
57 | enum rtx_code outer_code ATTRIBUTE_UNUSED, |
58 | enum rtx_code index_code ATTRIBUTE_UNUSED) | |
59 | { | |
60 | #ifdef REGNO_MODE_CODE_OK_FOR_BASE_P | |
86fc3d06 UW |
61 | return REGNO_MODE_CODE_OK_FOR_BASE_P (regno, mode, as, |
62 | outer_code, index_code); | |
c4963a0a BS |
63 | #else |
64 | #ifdef REGNO_MODE_OK_FOR_REG_BASE_P | |
65 | if (index_code == REG) | |
66 | return REGNO_MODE_OK_FOR_REG_BASE_P (regno, mode); | |
67 | #endif | |
68 | #ifdef REGNO_MODE_OK_FOR_BASE_P | |
69 | return REGNO_MODE_OK_FOR_BASE_P (regno, mode); | |
70 | #else | |
71 | return REGNO_OK_FOR_BASE_P (regno); | |
72 | #endif | |
73 | #endif | |
74 | } | |
75 | ||
76 | /* Wrapper around ok_for_base_p_1, for use after register allocation is | |
77 | complete. Arguments as for the called function. */ | |
78 | ||
79 | static inline bool | |
ef4bddc2 | 80 | regno_ok_for_base_p (unsigned regno, machine_mode mode, addr_space_t as, |
c4963a0a BS |
81 | enum rtx_code outer_code, enum rtx_code index_code) |
82 | { | |
83 | if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0) | |
84 | regno = reg_renumber[regno]; | |
85 | ||
86fc3d06 | 86 | return ok_for_base_p_1 (regno, mode, as, outer_code, index_code); |
c4963a0a | 87 | } |
f1717f8d KC |
88 | |
89 | #endif /* GCC_ADDRESSES_H */ |