1169689Skan/* Inline functions to test validity of reg classes for addressing modes. 2169689Skan Copyright (C) 2006 Free Software Foundation, Inc. 3169689Skan 4169689SkanThis file is part of GCC. 5169689Skan 6169689SkanGCC is free software; you can redistribute it and/or modify it under 7169689Skanthe terms of the GNU General Public License as published by the Free 8169689SkanSoftware Foundation; either version 2, or (at your option) any later 9169689Skanversion. 10169689Skan 11169689SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY 12169689SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or 13169689SkanFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14169689Skanfor more details. 15169689Skan 16169689SkanYou should have received a copy of the GNU General Public License 17169689Skanalong with GCC; see the file COPYING. If not, write to the Free 18169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 19169689Skan02110-1301, USA. */ 20169689Skan 21169689Skan/* Wrapper function to unify target macros MODE_CODE_BASE_REG_CLASS, 22169689Skan MODE_BASE_REG_REG_CLASS, MODE_BASE_REG_CLASS and BASE_REG_CLASS. 23169689Skan Arguments as for the MODE_CODE_BASE_REG_CLASS macro. */ 24169689Skan 25169689Skanstatic inline enum reg_class 26169689Skanbase_reg_class (enum machine_mode mode ATTRIBUTE_UNUSED, 27169689Skan enum rtx_code outer_code ATTRIBUTE_UNUSED, 28169689Skan enum rtx_code index_code ATTRIBUTE_UNUSED) 29169689Skan{ 30169689Skan#ifdef MODE_CODE_BASE_REG_CLASS 31169689Skan return MODE_CODE_BASE_REG_CLASS (mode, outer_code, index_code); 32169689Skan#else 33169689Skan#ifdef MODE_BASE_REG_REG_CLASS 34169689Skan if (index_code == REG) 35169689Skan return MODE_BASE_REG_REG_CLASS (mode); 36169689Skan#endif 37169689Skan#ifdef MODE_BASE_REG_CLASS 38169689Skan return MODE_BASE_REG_CLASS (mode); 39169689Skan#else 40169689Skan return BASE_REG_CLASS; 41169689Skan#endif 42169689Skan#endif 43169689Skan} 44169689Skan 45169689Skan/* Wrapper function to unify target macros REGNO_MODE_CODE_OK_FOR_BASE_P, 46169689Skan REGNO_MODE_OK_FOR_REG_BASE_P, REGNO_MODE_OK_FOR_BASE_P and 47169689Skan REGNO_OK_FOR_BASE_P. 48169689Skan Arguments as for the REGNO_MODE_CODE_OK_FOR_BASE_P macro. */ 49169689Skan 50169689Skanstatic inline bool 51169689Skanok_for_base_p_1 (unsigned regno, enum machine_mode mode ATTRIBUTE_UNUSED, 52169689Skan enum rtx_code outer_code ATTRIBUTE_UNUSED, 53169689Skan enum rtx_code index_code ATTRIBUTE_UNUSED) 54169689Skan{ 55169689Skan#ifdef REGNO_MODE_CODE_OK_FOR_BASE_P 56169689Skan return REGNO_MODE_CODE_OK_FOR_BASE_P (regno, mode, outer_code, index_code); 57169689Skan#else 58169689Skan#ifdef REGNO_MODE_OK_FOR_REG_BASE_P 59169689Skan if (index_code == REG) 60169689Skan return REGNO_MODE_OK_FOR_REG_BASE_P (regno, mode); 61169689Skan#endif 62169689Skan#ifdef REGNO_MODE_OK_FOR_BASE_P 63169689Skan return REGNO_MODE_OK_FOR_BASE_P (regno, mode); 64169689Skan#else 65169689Skan return REGNO_OK_FOR_BASE_P (regno); 66169689Skan#endif 67169689Skan#endif 68169689Skan} 69169689Skan 70169689Skan/* Wrapper around ok_for_base_p_1, for use after register allocation is 71169689Skan complete. Arguments as for the called function. */ 72169689Skan 73169689Skanstatic inline bool 74169689Skanregno_ok_for_base_p (unsigned regno, enum machine_mode mode, 75169689Skan enum rtx_code outer_code, enum rtx_code index_code) 76169689Skan{ 77169689Skan if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0) 78169689Skan regno = reg_renumber[regno]; 79169689Skan 80169689Skan return ok_for_base_p_1 (regno, mode, outer_code, index_code); 81169689Skan} 82