Rebase.
[official-gcc.git] / gcc / config / score / score-conv.h
blobc362d9f2db4d13809aed978ad1047ddc87efb527
1 /* score-conv.h for Sunplus S+CORE processor
2 Copyright (C) 2005-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 3, or (at your
9 option) any later version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License 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 #ifndef GCC_SCORE_CONV_H
21 #define GCC_SCORE_CONV_H
23 #define GP_REG_FIRST 0U
24 #define GP_REG_LAST 31U
25 #define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1U)
26 #define GP_DBX_FIRST 0U
28 #define CE_REG_FIRST 48U
29 #define CE_REG_LAST 49U
30 #define CE_REG_NUM (CE_REG_LAST - CE_REG_FIRST + 1U)
32 #define ARG_REG_FIRST 4U
33 #define ARG_REG_LAST 7U
34 #define ARG_REG_NUM (ARG_REG_LAST - ARG_REG_FIRST + 1U)
36 #define REG_CONTAIN(REGNO, FIRST, NUM) \
37 ((unsigned int)((int) (REGNO) - (FIRST)) < (NUM))
39 #define GP_REG_P(REGNO) REG_CONTAIN (REGNO, GP_REG_FIRST, GP_REG_NUM)
41 #define G8_REG_P(REGNO) REG_CONTAIN (REGNO, GP_REG_FIRST, 8)
43 #define G16_REG_P(REGNO) REG_CONTAIN (REGNO, GP_REG_FIRST, 16)
45 #define CE_REG_P(REGNO) REG_CONTAIN (REGNO, CE_REG_FIRST, CE_REG_NUM)
47 #define GR_REG_CLASS_P(C) ((C) == G16_REGS || (C) == G32_REGS)
48 #define SP_REG_CLASS_P(C) \
49 ((C) == CN_REG || (C) == LC_REG || (C) == SC_REG || (C) == SP_REGS)
50 #define CP_REG_CLASS_P(C) \
51 ((C) == CP1_REGS || (C) == CP2_REGS || (C) == CP3_REGS || (C) == CPA_REGS)
52 #define CE_REG_CLASS_P(C) \
53 ((C) == HI_REG || (C) == LO_REG || (C) == CE_REGS)
55 #define UIMM_IN_RANGE(V, W) \
56 ((V) >= 0 \
57 && ((unsigned HOST_WIDE_INT) (V) \
58 <= (((unsigned HOST_WIDE_INT) 2 << ((W) - 1)) - 1)))
60 #define SIMM_IN_RANGE(V, W) \
61 ((V) >= ((HOST_WIDE_INT) -1 << ((W) - 1)) \
62 && (V) <= (((HOST_WIDE_INT) 1 << ((W) - 1)) - 1))
64 #define IMM_IN_RANGE(V, W, S) \
65 ((S) ? SIMM_IN_RANGE (V, W) : UIMM_IN_RANGE (V, W))
67 #define IMM_IS_POW_OF_2(V, E1, E2) \
68 ((V) >= ((unsigned HOST_WIDE_INT) 1 << (E1)) \
69 && (V) <= ((unsigned HOST_WIDE_INT) 1 << (E2)) \
70 && ((V) & ((V) - 1)) == 0)
72 enum score_symbol_type
74 SYMBOL_GENERAL,
75 SYMBOL_SMALL_DATA /* The symbol refers to something in a small data section */
78 #endif