2006-08-06 Paolo Carlini <pcarlini@suse.de>
[official-gcc.git] / gcc / addresses.h
blob6741acac041edeecbaaf81e9b02dedc535caa23c
1 /* Inline functions to test validity of reg classes for addressing modes.
2 Copyright (C) 2006 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 2, 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 COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA. */
21 /* Wrapper function to unify target macros MODE_CODE_BASE_REG_CLASS,
22 MODE_BASE_REG_REG_CLASS, MODE_BASE_REG_CLASS and BASE_REG_CLASS.
23 Arguments as for the MODE_CODE_BASE_REG_CLASS macro. */
25 static inline enum reg_class
26 base_reg_class (enum machine_mode mode ATTRIBUTE_UNUSED,
27 enum rtx_code outer_code ATTRIBUTE_UNUSED,
28 enum rtx_code index_code ATTRIBUTE_UNUSED)
30 #ifdef MODE_CODE_BASE_REG_CLASS
31 return MODE_CODE_BASE_REG_CLASS (mode, outer_code, index_code);
32 #else
33 #ifdef MODE_BASE_REG_REG_CLASS
34 if (index_code == REG)
35 return MODE_BASE_REG_REG_CLASS (mode);
36 #endif
37 #ifdef MODE_BASE_REG_CLASS
38 return MODE_BASE_REG_CLASS (mode);
39 #else
40 return BASE_REG_CLASS;
41 #endif
42 #endif
45 /* Wrapper function to unify target macros REGNO_MODE_CODE_OK_FOR_BASE_P,
46 REGNO_MODE_OK_FOR_REG_BASE_P, REGNO_MODE_OK_FOR_BASE_P and
47 REGNO_OK_FOR_BASE_P.
48 Arguments as for the REGNO_MODE_CODE_OK_FOR_BASE_P macro. */
50 static inline bool
51 ok_for_base_p_1 (unsigned regno, enum machine_mode mode ATTRIBUTE_UNUSED,
52 enum rtx_code outer_code ATTRIBUTE_UNUSED,
53 enum rtx_code index_code ATTRIBUTE_UNUSED)
55 #ifdef REGNO_MODE_CODE_OK_FOR_BASE_P
56 return REGNO_MODE_CODE_OK_FOR_BASE_P (regno, mode, outer_code, index_code);
57 #else
58 #ifdef REGNO_MODE_OK_FOR_REG_BASE_P
59 if (index_code == REG)
60 return REGNO_MODE_OK_FOR_REG_BASE_P (regno, mode);
61 #endif
62 #ifdef REGNO_MODE_OK_FOR_BASE_P
63 return REGNO_MODE_OK_FOR_BASE_P (regno, mode);
64 #else
65 return REGNO_OK_FOR_BASE_P (regno);
66 #endif
67 #endif
70 /* Wrapper around ok_for_base_p_1, for use after register allocation is
71 complete. Arguments as for the called function. */
73 static inline bool
74 regno_ok_for_base_p (unsigned regno, enum machine_mode mode,
75 enum rtx_code outer_code, enum rtx_code index_code)
77 if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0)
78 regno = reg_renumber[regno];
80 return ok_for_base_p_1 (regno, mode, outer_code, index_code);