]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/addresses.h
* doc/install.texi (Specific, alpha): Remove note to use
[thirdparty/gcc.git] / gcc / addresses.h
CommitLineData
00cb30dc 1/* Inline functions to test validity of reg classes for addressing modes.
fbd26352 2 Copyright (C) 2006-2019 Free Software Foundation, Inc.
00cb30dc 3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8c4c00c1 8Software Foundation; either version 3, or (at your option) any later
00cb30dc 9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
8c4c00c1 17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
00cb30dc 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
ce6bb0f3 24#ifndef GCC_ADDRESSES_H
25#define GCC_ADDRESSES_H
26
00cb30dc 27static inline enum reg_class
3754d046 28base_reg_class (machine_mode mode ATTRIBUTE_UNUSED,
f8a8fc7b 29 addr_space_t as ATTRIBUTE_UNUSED,
00cb30dc 30 enum rtx_code outer_code ATTRIBUTE_UNUSED,
31 enum rtx_code index_code ATTRIBUTE_UNUSED)
32{
33#ifdef MODE_CODE_BASE_REG_CLASS
42d5183d 34 return MODE_CODE_BASE_REG_CLASS (MACRO_MODE (mode), as, outer_code,
35 index_code);
00cb30dc 36#else
37#ifdef MODE_BASE_REG_REG_CLASS
38 if (index_code == REG)
42d5183d 39 return MODE_BASE_REG_REG_CLASS (MACRO_MODE (mode));
00cb30dc 40#endif
41#ifdef MODE_BASE_REG_CLASS
42d5183d 42 return MODE_BASE_REG_CLASS (MACRO_MODE (mode));
00cb30dc 43#else
44 return BASE_REG_CLASS;
45#endif
46#endif
47}
48
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. */
53
54static inline bool
c0da4b3a 55ok_for_base_p_1 (unsigned regno ATTRIBUTE_UNUSED,
3754d046 56 machine_mode mode ATTRIBUTE_UNUSED,
f8a8fc7b 57 addr_space_t as ATTRIBUTE_UNUSED,
00cb30dc 58 enum rtx_code outer_code ATTRIBUTE_UNUSED,
59 enum rtx_code index_code ATTRIBUTE_UNUSED)
60{
61#ifdef REGNO_MODE_CODE_OK_FOR_BASE_P
42d5183d 62 return REGNO_MODE_CODE_OK_FOR_BASE_P (regno, MACRO_MODE (mode), as,
f8a8fc7b 63 outer_code, index_code);
00cb30dc 64#else
65#ifdef REGNO_MODE_OK_FOR_REG_BASE_P
66 if (index_code == REG)
42d5183d 67 return REGNO_MODE_OK_FOR_REG_BASE_P (regno, MACRO_MODE (mode));
00cb30dc 68#endif
69#ifdef REGNO_MODE_OK_FOR_BASE_P
42d5183d 70 return REGNO_MODE_OK_FOR_BASE_P (regno, MACRO_MODE (mode));
00cb30dc 71#else
72 return REGNO_OK_FOR_BASE_P (regno);
73#endif
74#endif
75}
76
77/* Wrapper around ok_for_base_p_1, for use after register allocation is
78 complete. Arguments as for the called function. */
79
80static inline bool
3754d046 81regno_ok_for_base_p (unsigned regno, machine_mode mode, addr_space_t as,
00cb30dc 82 enum rtx_code outer_code, enum rtx_code index_code)
83{
84 if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0)
85 regno = reg_renumber[regno];
86
f8a8fc7b 87 return ok_for_base_p_1 (regno, mode, as, outer_code, index_code);
00cb30dc 88}
ce6bb0f3 89
90#endif /* GCC_ADDRESSES_H */