1 /* score-conv.h for Sunplus S+CORE processor
2 Copyright (C) 2005, 2007 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 SCORE_CONV_0601
21 #define SCORE_CONV_0601
23 extern int target_flags;
25 #define GP_REG_FIRST 0U
26 #define GP_REG_LAST 31U
27 #define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1U)
28 #define GP_DBX_FIRST 0U
30 #define CE_REG_FIRST 48U
31 #define CE_REG_LAST 49U
32 #define CE_REG_NUM (CE_REG_LAST - CE_REG_FIRST + 1U)
34 #define ARG_REG_FIRST 4U
35 #define ARG_REG_LAST 7U
36 #define ARG_REG_NUM (ARG_REG_LAST - ARG_REG_FIRST + 1U)
38 #define REG_CONTAIN(REGNO, FIRST, NUM) \
39 ((unsigned int)((int) (REGNO) - (FIRST)) < (NUM))
41 #define GP_REG_P(REGNO) REG_CONTAIN (REGNO, GP_REG_FIRST, GP_REG_NUM)
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 UIMM_IN_RANGE(V, W) ((V) >= 0 && (V) < ((HOST_WIDE_INT) 1 << (W)))
49 #define SIMM_IN_RANGE(V, W) \
50 ((V) >= (-1 * ((HOST_WIDE_INT) 1 << ((W) - 1))) \
51 && (V) < (1 * ((HOST_WIDE_INT) 1 << ((W) - 1))))
53 #define IMM_IN_RANGE(V, W, S) \
54 ((S) ? SIMM_IN_RANGE (V, W) : UIMM_IN_RANGE (V, W))
56 #define IMM_IS_POW_OF_2(V, E1, E2) \
57 ((V) >= ((unsigned HOST_WIDE_INT) 1 << (E1)) \
58 && (V) <= ((unsigned HOST_WIDE_INT) 1 << (E2)) \
59 && ((V) & ((V) - 1)) == 0)
61 #define SCORE_STACK_ALIGN(LOC) (((LOC) + 3) & ~3)
63 #define SCORE_MAX_FIRST_STACK_STEP (0x3ff0)
65 #define SCORE_SDATA_MAX score_sdata_max ()
67 #define DEFAULT_SDATA_MAX 8
69 #define CONST_HIGH_PART(VALUE) \
70 (((VALUE) + 0x8000) & ~(unsigned HOST_WIDE_INT) 0xffff)
72 #define CONST_LOW_PART(VALUE) ((VALUE) - CONST_HIGH_PART (VALUE))
74 #define PROLOGUE_TEMP_REGNUM (GP_REG_FIRST + 8)
76 #define EPILOGUE_TEMP_REGNUM (GP_REG_FIRST + 8)
78 enum score_symbol_type
81 SYMBOL_SMALL_DATA /* The symbol refers to something in a small data section. */
84 int score_sdata_max (void);