1 /* score-conv.h for Sunplus S+CORE processor
2    Copyright (C) 2005 Free Software Foundation, Inc.
3 
4    This file is part of GCC.
5 
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 2, or (at your
9    option) any later version.
10 
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.
15 
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
18    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19    Boston, MA 02110-1301, USA.  */
20 
21 #ifndef SCORE_CONV_0601
22 #define SCORE_CONV_0601
23 
24 extern int target_flags;
25 
26 #define GP_REG_FIRST                    0U
27 #define GP_REG_LAST                     31U
28 #define GP_REG_NUM                      (GP_REG_LAST - GP_REG_FIRST + 1U)
29 #define GP_DBX_FIRST                    0U
30 
31 #define CE_REG_FIRST                    48U
32 #define CE_REG_LAST                     49U
33 #define CE_REG_NUM                      (CE_REG_LAST - CE_REG_FIRST + 1U)
34 
35 #define ARG_REG_FIRST                   4U
36 #define ARG_REG_LAST                    7U
37 #define ARG_REG_NUM                     (ARG_REG_LAST - ARG_REG_FIRST + 1U)
38 
39 #define REG_CONTAIN(REGNO, FIRST, NUM) \
40   ((unsigned int)((int) (REGNO) - (FIRST)) < (NUM))
41 
42 #define GP_REG_P(REGNO)        REG_CONTAIN (REGNO, GP_REG_FIRST, GP_REG_NUM)
43 
44 #define G16_REG_P(REGNO)       REG_CONTAIN (REGNO, GP_REG_FIRST, 16)
45 
46 #define CE_REG_P(REGNO)        REG_CONTAIN (REGNO, CE_REG_FIRST, CE_REG_NUM)
47 
48 #define UIMM_IN_RANGE(V, W)  ((V) >= 0 && (V) < ((HOST_WIDE_INT) 1 << (W)))
49 
50 #define SIMM_IN_RANGE(V, W)                            \
51   ((V) >= (-1 * ((HOST_WIDE_INT) 1 << ((W) - 1)))      \
52    && (V) < (1 * ((HOST_WIDE_INT) 1 << ((W) - 1))))
53 
54 #define IMM_IN_RANGE(V, W, S) \
55   ((S) ? SIMM_IN_RANGE (V, W) : UIMM_IN_RANGE (V, W))
56 
57 #define IMM_IS_POW_OF_2(V, E1, E2)                \
58   ((V) >= ((unsigned HOST_WIDE_INT) 1 << (E1))     \
59    && (V) <= ((unsigned HOST_WIDE_INT) 1 << (E2))  \
60    && ((V) & ((V) - 1)) == 0)
61 
62 #define SCORE_STACK_ALIGN(LOC)          (((LOC) + 3) & ~3)
63 
64 #define SCORE_MAX_FIRST_STACK_STEP      (0x3ff0)
65 
66 #define SCORE_SDATA_MAX                 score_sdata_max ()
67 
68 #define DEFAULT_SDATA_MAX               8
69 
70 #define CONST_HIGH_PART(VALUE) \
71   (((VALUE) + 0x8000) & ~(unsigned HOST_WIDE_INT) 0xffff)
72 
73 #define CONST_LOW_PART(VALUE)           ((VALUE) - CONST_HIGH_PART (VALUE))
74 
75 #define PROLOGUE_TEMP_REGNUM            (GP_REG_FIRST + 8)
76 
77 #define EPILOGUE_TEMP_REGNUM            (GP_REG_FIRST + 8)
78 
79 enum score_symbol_type
80 {
81   SYMBOL_GENERAL,
82   SYMBOL_SMALL_DATA     /* The symbol refers to something in a small data section.  */
83 };
84 
85 int score_sdata_max (void);
86 
87 #endif
88