c, c++: attribute format on a ctor with a vbase [PR101833, PR47634]
[official-gcc.git] / gcc / addresses.h
blob925a579b47a20db00f3f7619dae6622c6581afbc
1 /* Inline functions to test validity of reg classes for addressing modes.
2 Copyright (C) 2006-2022 Free Software Foundation, Inc.
4 This file is part of GCC.
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
8 Software Foundation; either version 3, or (at your option) any later
9 version.
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.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
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. */
24 #ifndef GCC_ADDRESSES_H
25 #define GCC_ADDRESSES_H
27 static inline enum reg_class
28 base_reg_class (machine_mode mode ATTRIBUTE_UNUSED,
29 addr_space_t as ATTRIBUTE_UNUSED,
30 enum rtx_code outer_code ATTRIBUTE_UNUSED,
31 enum rtx_code index_code ATTRIBUTE_UNUSED)
33 #ifdef MODE_CODE_BASE_REG_CLASS
34 return MODE_CODE_BASE_REG_CLASS (MACRO_MODE (mode), as, outer_code,
35 index_code);
36 #else
37 #ifdef MODE_BASE_REG_REG_CLASS
38 if (index_code == REG)
39 return MODE_BASE_REG_REG_CLASS (MACRO_MODE (mode));
40 #endif
41 #ifdef MODE_BASE_REG_CLASS
42 return MODE_BASE_REG_CLASS (MACRO_MODE (mode));
43 #else
44 return BASE_REG_CLASS;
45 #endif
46 #endif
49 /* Wrapper function to unify target macros REGNO_MODE_CODE_OK_FOR_BASE_P,
50 REGNO_MODE_OK_FOR_REG_BASE_P, REGNO_MODE_OK_FOR_BASE_P and
51 REGNO_OK_FOR_BASE_P.
52 Arguments as for the REGNO_MODE_CODE_OK_FOR_BASE_P macro. */
54 static inline bool
55 ok_for_base_p_1 (unsigned regno ATTRIBUTE_UNUSED,
56 machine_mode mode ATTRIBUTE_UNUSED,
57 addr_space_t as ATTRIBUTE_UNUSED,
58 enum rtx_code outer_code ATTRIBUTE_UNUSED,
59 enum rtx_code index_code ATTRIBUTE_UNUSED)
61 #ifdef REGNO_MODE_CODE_OK_FOR_BASE_P
62 return REGNO_MODE_CODE_OK_FOR_BASE_P (regno, MACRO_MODE (mode), as,
63 outer_code, index_code);
64 #else
65 #ifdef REGNO_MODE_OK_FOR_REG_BASE_P
66 if (index_code == REG)
67 return REGNO_MODE_OK_FOR_REG_BASE_P (regno, MACRO_MODE (mode));
68 #endif
69 #ifdef REGNO_MODE_OK_FOR_BASE_P
70 return REGNO_MODE_OK_FOR_BASE_P (regno, MACRO_MODE (mode));
71 #else
72 return REGNO_OK_FOR_BASE_P (regno);
73 #endif
74 #endif
77 /* Wrapper around ok_for_base_p_1, for use after register allocation is
78 complete. Arguments as for the called function. */
80 static inline bool
81 regno_ok_for_base_p (unsigned regno, machine_mode mode, addr_space_t as,
82 enum rtx_code outer_code, enum rtx_code index_code)
84 if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0)
85 regno = reg_renumber[regno];
87 return ok_for_base_p_1 (regno, mode, as, outer_code, index_code);
90 #endif /* GCC_ADDRESSES_H */