| 1 |
282 |
jeremybenn |
/* Definitions of target machine for GNU compiler, Lattice Mico32 architecture.
|
| 2 |
|
|
Contributed by Jon Beniston <jon@beniston.com>
|
| 3 |
|
|
|
| 4 |
|
|
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of GCC.
|
| 7 |
|
|
|
| 8 |
|
|
GCC is free software; you can redistribute it and/or modify it
|
| 9 |
|
|
under the terms of the GNU General Public License as published
|
| 10 |
|
|
by the Free Software Foundation; either version 3, or (at your
|
| 11 |
|
|
option) any later version.
|
| 12 |
|
|
|
| 13 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
| 14 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
| 15 |
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
| 16 |
|
|
License for more details.
|
| 17 |
|
|
|
| 18 |
|
|
You should have received a copy of the GNU General Public License
|
| 19 |
|
|
along with GCC; see the file COPYING3. If not see
|
| 20 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 21 |
|
|
|
| 22 |
|
|
/*-------------------------------*/
|
| 23 |
|
|
/* Run-time Target Specification */
|
| 24 |
|
|
/*-------------------------------*/
|
| 25 |
|
|
|
| 26 |
|
|
/* Print subsidiary information on the compiler version in use. */
|
| 27 |
|
|
#ifndef TARGET_VERSION
|
| 28 |
|
|
#define TARGET_VERSION fprintf (stderr, " (LatticeMico32)")
|
| 29 |
|
|
#endif
|
| 30 |
|
|
|
| 31 |
|
|
/* Target CPU builtins. */
|
| 32 |
|
|
#define TARGET_CPU_CPP_BUILTINS() \
|
| 33 |
|
|
do \
|
| 34 |
|
|
{ \
|
| 35 |
|
|
builtin_define ("__lm32__"); \
|
| 36 |
|
|
builtin_assert ("cpu=lm32"); \
|
| 37 |
|
|
builtin_assert ("machine=lm32"); \
|
| 38 |
|
|
if (TARGET_MULTIPLY_ENABLED) \
|
| 39 |
|
|
builtin_define ("__multiply_enabled__"); \
|
| 40 |
|
|
if (TARGET_DIVIDE_ENABLED) \
|
| 41 |
|
|
builtin_define ("__divide_enabled__"); \
|
| 42 |
|
|
if (TARGET_BARREL_SHIFT_ENABLED) \
|
| 43 |
|
|
builtin_define ("__barrel_shift_enabled__"); \
|
| 44 |
|
|
if (TARGET_SIGN_EXTEND_ENABLED) \
|
| 45 |
|
|
builtin_define ("__sign_extend_enabled__"); \
|
| 46 |
|
|
if (TARGET_USER_ENABLED) \
|
| 47 |
|
|
builtin_define ("__user_enabled__"); \
|
| 48 |
|
|
} \
|
| 49 |
|
|
while (0)
|
| 50 |
|
|
|
| 51 |
|
|
#undef ASM_SPEC
|
| 52 |
|
|
#define ASM_SPEC "\
|
| 53 |
|
|
%{mmultiply-enabled} \
|
| 54 |
|
|
%{mdivide-enabled} \
|
| 55 |
|
|
%{mbarrel-shift-enabled} \
|
| 56 |
|
|
%{msign-extend-enabled} \
|
| 57 |
|
|
%{muser-extend-enabled} \
|
| 58 |
|
|
%{v} \
|
| 59 |
|
|
"
|
| 60 |
|
|
|
| 61 |
|
|
/* Let link script define all link options.
|
| 62 |
|
|
Default to using simulator link script. */
|
| 63 |
|
|
|
| 64 |
|
|
#undef STARTFILE_SPEC
|
| 65 |
|
|
#define STARTFILE_SPEC ""
|
| 66 |
|
|
#undef ENDFILE_SPEC
|
| 67 |
|
|
#define ENDFILE_SPEC ""
|
| 68 |
|
|
#undef LIB_SPEC
|
| 69 |
|
|
#define LIB_SPEC "%{!T*:-T sim.ld}"
|
| 70 |
|
|
|
| 71 |
|
|
#define OVERRIDE_OPTIONS lm32_override_options()
|
| 72 |
|
|
|
| 73 |
|
|
extern int target_flags;
|
| 74 |
|
|
|
| 75 |
|
|
/* Add -G xx support. */
|
| 76 |
|
|
|
| 77 |
|
|
#undef SWITCH_TAKES_ARG
|
| 78 |
|
|
#define SWITCH_TAKES_ARG(CHAR) \
|
| 79 |
|
|
(DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
|
| 80 |
|
|
|
| 81 |
|
|
#undef CC1_SPEC
|
| 82 |
|
|
#define CC1_SPEC "%{G*}"
|
| 83 |
|
|
|
| 84 |
|
|
/*---------------------------------*/
|
| 85 |
|
|
/* Target machine storage layout. */
|
| 86 |
|
|
/*---------------------------------*/
|
| 87 |
|
|
|
| 88 |
|
|
#define BITS_BIG_ENDIAN 0
|
| 89 |
|
|
#define BYTES_BIG_ENDIAN 1
|
| 90 |
|
|
#define WORDS_BIG_ENDIAN 1
|
| 91 |
|
|
#define LIBGCC2_WORDS_BIG_ENDIAN 1
|
| 92 |
|
|
|
| 93 |
|
|
#define BITS_PER_UNIT 8
|
| 94 |
|
|
#define BITS_PER_WORD 32
|
| 95 |
|
|
#define UNITS_PER_WORD 4
|
| 96 |
|
|
|
| 97 |
|
|
#define POINTER_SIZE 32
|
| 98 |
|
|
|
| 99 |
|
|
#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
|
| 100 |
|
|
do { \
|
| 101 |
|
|
if (GET_MODE_CLASS (MODE) == MODE_INT \
|
| 102 |
|
|
&& GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
|
| 103 |
|
|
(MODE) = word_mode; \
|
| 104 |
|
|
} while (0)
|
| 105 |
|
|
|
| 106 |
|
|
#define PARM_BOUNDARY 32
|
| 107 |
|
|
|
| 108 |
|
|
#define STACK_BOUNDARY 32
|
| 109 |
|
|
|
| 110 |
|
|
#define BIGGEST_ALIGNMENT 64
|
| 111 |
|
|
|
| 112 |
|
|
#define FUNCTION_BOUNDARY 32
|
| 113 |
|
|
|
| 114 |
|
|
#define EMPTY_FIELD_BOUNDARY 32
|
| 115 |
|
|
|
| 116 |
|
|
#define STRICT_ALIGNMENT 1
|
| 117 |
|
|
|
| 118 |
|
|
#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
|
| 119 |
|
|
|
| 120 |
|
|
/* Make strings word-aligned so strcpy from constants will be faster. */
|
| 121 |
|
|
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
|
| 122 |
|
|
(TREE_CODE (EXP) == STRING_CST \
|
| 123 |
|
|
&& (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
|
| 124 |
|
|
|
| 125 |
|
|
/* Make arrays and structures word-aligned to allow faster copying etc. */
|
| 126 |
|
|
#define DATA_ALIGNMENT(TYPE, ALIGN) \
|
| 127 |
|
|
((((ALIGN) < BITS_PER_WORD) \
|
| 128 |
|
|
&& (TREE_CODE (TYPE) == ARRAY_TYPE \
|
| 129 |
|
|
|| TREE_CODE (TYPE) == UNION_TYPE \
|
| 130 |
|
|
|| TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))
|
| 131 |
|
|
|
| 132 |
|
|
/* We need this for the same reason as DATA_ALIGNMENT, namely to cause
|
| 133 |
|
|
character arrays to be word-aligned so that `strcpy' calls that copy
|
| 134 |
|
|
constants to character arrays can be done inline, and 'strcmp' can be
|
| 135 |
|
|
optimised to use word loads. */
|
| 136 |
|
|
#define LOCAL_ALIGNMENT(TYPE, ALIGN) \
|
| 137 |
|
|
DATA_ALIGNMENT (TYPE, ALIGN)
|
| 138 |
|
|
|
| 139 |
|
|
/*----------------------------------------*/
|
| 140 |
|
|
/* Layout of source language data types. */
|
| 141 |
|
|
/*----------------------------------------*/
|
| 142 |
|
|
|
| 143 |
|
|
#define INT_TYPE_SIZE 32
|
| 144 |
|
|
#define SHORT_TYPE_SIZE 16
|
| 145 |
|
|
#define LONG_TYPE_SIZE 32
|
| 146 |
|
|
#define LONG_LONG_TYPE_SIZE 64
|
| 147 |
|
|
|
| 148 |
|
|
#define FLOAT_TYPE_SIZE 32
|
| 149 |
|
|
#define DOUBLE_TYPE_SIZE 64
|
| 150 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 64
|
| 151 |
|
|
|
| 152 |
|
|
#define DEFAULT_SIGNED_CHAR 0
|
| 153 |
|
|
|
| 154 |
|
|
#define SIZE_TYPE "unsigned int"
|
| 155 |
|
|
|
| 156 |
|
|
#define PTRDIFF_TYPE "int"
|
| 157 |
|
|
|
| 158 |
|
|
/*---------------------------*/
|
| 159 |
|
|
/* Standard register usage. */
|
| 160 |
|
|
/*---------------------------*/
|
| 161 |
|
|
|
| 162 |
|
|
#define FIRST_PSEUDO_REGISTER 32
|
| 163 |
|
|
|
| 164 |
|
|
#define RV_REGNUM 1
|
| 165 |
|
|
#define GP_REGNUM 26
|
| 166 |
|
|
#define FP_REGNUM 27
|
| 167 |
|
|
#define SP_REGNUM 28
|
| 168 |
|
|
#define RA_REGNUM 29
|
| 169 |
|
|
|
| 170 |
|
|
#define G_REG_P(X) ((X)<32)
|
| 171 |
|
|
|
| 172 |
|
|
#define FIXED_REGISTERS \
|
| 173 |
|
|
{ 1, 0, 0, 0, 0, 0, 0, 0, \
|
| 174 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, \
|
| 175 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, \
|
| 176 |
|
|
0, 0, 1, 0, 1, 0, 1, 1}
|
| 177 |
|
|
|
| 178 |
|
|
#define CALL_USED_REGISTERS \
|
| 179 |
|
|
{ 1, 1, 1, 1, 1, 1, 1, 1, \
|
| 180 |
|
|
1, 1, 1, 0, 0, 0, 0, 0, \
|
| 181 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, \
|
| 182 |
|
|
0, 0, 1, 0, 1, 0, 1, 1}
|
| 183 |
|
|
|
| 184 |
|
|
#define HARD_REGNO_NREGS(REGNO, MODE) \
|
| 185 |
|
|
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
| 186 |
|
|
|
| 187 |
|
|
#define HARD_REGNO_MODE_OK(REGNO, MODE) G_REG_P(REGNO)
|
| 188 |
|
|
|
| 189 |
|
|
#define MODES_TIEABLE_P(MODE1, MODE2) \
|
| 190 |
|
|
( GET_MODE_CLASS (MODE1) == MODE_INT \
|
| 191 |
|
|
&& GET_MODE_CLASS (MODE2) == MODE_INT \
|
| 192 |
|
|
&& GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
|
| 193 |
|
|
&& GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
|
| 194 |
|
|
|
| 195 |
|
|
#define AVOID_CCMODE_COPIES
|
| 196 |
|
|
|
| 197 |
|
|
/*----------------------------------*/
|
| 198 |
|
|
/* Register classes and constants. */
|
| 199 |
|
|
/*----------------------------------*/
|
| 200 |
|
|
|
| 201 |
|
|
enum reg_class
|
| 202 |
|
|
{
|
| 203 |
|
|
NO_REGS,
|
| 204 |
|
|
GENERAL_REGS,
|
| 205 |
|
|
ALL_REGS,
|
| 206 |
|
|
LIM_REG_CLASSES
|
| 207 |
|
|
};
|
| 208 |
|
|
|
| 209 |
|
|
#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
| 210 |
|
|
|
| 211 |
|
|
#define REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
|
| 212 |
|
|
|
| 213 |
|
|
#define REG_CLASS_CONTENTS \
|
| 214 |
|
|
{ {0x00000000}, \
|
| 215 |
|
|
{0xffffffff}, \
|
| 216 |
|
|
{0xffffffff} \
|
| 217 |
|
|
}
|
| 218 |
|
|
|
| 219 |
|
|
#define REGNO_REG_CLASS(REGNO) \
|
| 220 |
|
|
(G_REG_P(REGNO) ? GENERAL_REGS : NO_REGS)
|
| 221 |
|
|
|
| 222 |
|
|
#define CLASS_MAX_NREGS(CLASS, MODE) \
|
| 223 |
|
|
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
| 224 |
|
|
|
| 225 |
|
|
#define INDEX_REG_CLASS NO_REGS
|
| 226 |
|
|
|
| 227 |
|
|
#define BASE_REG_CLASS GENERAL_REGS
|
| 228 |
|
|
|
| 229 |
|
|
#define REGNO_OK_FOR_BASE_P(REGNO) \
|
| 230 |
|
|
(G_REG_P (REGNO) || G_REG_P ((unsigned) reg_renumber[REGNO]))
|
| 231 |
|
|
|
| 232 |
|
|
#define REGNO_OK_FOR_INDEX_P(REGNO) 0
|
| 233 |
|
|
|
| 234 |
|
|
#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
|
| 235 |
|
|
|
| 236 |
|
|
/*----------------------------------------*/
|
| 237 |
|
|
/* Stack Layout and Calling Conventions. */
|
| 238 |
|
|
/*----------------------------------------*/
|
| 239 |
|
|
|
| 240 |
|
|
#define STACK_GROWS_DOWNWARD 1
|
| 241 |
|
|
|
| 242 |
|
|
#define FRAME_GROWS_DOWNWARD 1
|
| 243 |
|
|
|
| 244 |
|
|
#define STACK_POINTER_OFFSET (UNITS_PER_WORD)
|
| 245 |
|
|
|
| 246 |
|
|
#define STARTING_FRAME_OFFSET (UNITS_PER_WORD)
|
| 247 |
|
|
|
| 248 |
|
|
#define FIRST_PARM_OFFSET(FNDECL) (UNITS_PER_WORD)
|
| 249 |
|
|
|
| 250 |
|
|
#define STACK_POINTER_REGNUM SP_REGNUM
|
| 251 |
|
|
|
| 252 |
|
|
#define FRAME_POINTER_REGNUM FP_REGNUM
|
| 253 |
|
|
|
| 254 |
|
|
#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
|
| 255 |
|
|
|
| 256 |
|
|
#define RETURN_ADDR_RTX(count, frame) \
|
| 257 |
|
|
lm32_return_addr_rtx (count, frame)
|
| 258 |
|
|
|
| 259 |
|
|
/* FIXME - This is not yet supported. */
|
| 260 |
|
|
#define STATIC_CHAIN_REGNUM 9
|
| 261 |
|
|
|
| 262 |
|
|
#define ELIMINABLE_REGS \
|
| 263 |
|
|
{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
|
| 264 |
|
|
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
|
| 265 |
|
|
}
|
| 266 |
|
|
|
| 267 |
|
|
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
| 268 |
|
|
(OFFSET) = lm32_compute_initial_elimination_offset (FROM, TO)
|
| 269 |
|
|
|
| 270 |
|
|
/*-----------------------------*/
|
| 271 |
|
|
/* Function argument passing. */
|
| 272 |
|
|
/*-----------------------------*/
|
| 273 |
|
|
|
| 274 |
|
|
#define ACCUMULATE_OUTGOING_ARGS 1
|
| 275 |
|
|
|
| 276 |
|
|
#define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
|
| 277 |
|
|
|
| 278 |
|
|
/*--------------------------------*/
|
| 279 |
|
|
/* Passing Arguments in Registers */
|
| 280 |
|
|
/*--------------------------------*/
|
| 281 |
|
|
|
| 282 |
|
|
/* The first argument register. */
|
| 283 |
|
|
#define LM32_FIRST_ARG_REG 1
|
| 284 |
|
|
|
| 285 |
|
|
/* The number of (integer) argument register available. */
|
| 286 |
|
|
#define LM32_NUM_ARG_REGS 8
|
| 287 |
|
|
|
| 288 |
|
|
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
|
| 289 |
|
|
lm32_function_arg ((CUM), (MODE), (TYPE), (NAMED))
|
| 290 |
|
|
|
| 291 |
|
|
#define CUMULATIVE_ARGS int
|
| 292 |
|
|
|
| 293 |
|
|
#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT,N_NAMED_ARGS) \
|
| 294 |
|
|
(CUM) = 0
|
| 295 |
|
|
|
| 296 |
|
|
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
|
| 297 |
|
|
(CUM) += LM32_NUM_REGS2 (MODE, TYPE)
|
| 298 |
|
|
|
| 299 |
|
|
#define FUNCTION_ARG_REGNO_P(r) \
|
| 300 |
|
|
(((r) >= LM32_FIRST_ARG_REG) && ((r) <= LM32_NUM_ARG_REGS))
|
| 301 |
|
|
|
| 302 |
|
|
/*--------------------*/
|
| 303 |
|
|
/* Function results. */
|
| 304 |
|
|
/*--------------------*/
|
| 305 |
|
|
|
| 306 |
|
|
#define FUNCTION_VALUE(VALTYPE, FUNC) \
|
| 307 |
|
|
gen_rtx_REG ((INTEGRAL_TYPE_P (VALTYPE) \
|
| 308 |
|
|
&& TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
|
| 309 |
|
|
? word_mode \
|
| 310 |
|
|
: TYPE_MODE (VALTYPE), \
|
| 311 |
|
|
RV_REGNUM)
|
| 312 |
|
|
|
| 313 |
|
|
#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, RV_REGNUM)
|
| 314 |
|
|
|
| 315 |
|
|
#define FUNCTION_VALUE_REGNO_P(N) ((N) == RV_REGNUM)
|
| 316 |
|
|
|
| 317 |
|
|
#define RETURN_IN_MEMORY(TYPE) lm32_return_in_memory (TYPE)
|
| 318 |
|
|
|
| 319 |
|
|
#define DEFAULT_PCC_STRUCT_RETURN 0
|
| 320 |
|
|
|
| 321 |
|
|
/* Convert from bytes to ints. */
|
| 322 |
|
|
#define LM32_NUM_INTS(X) (((X) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
| 323 |
|
|
|
| 324 |
|
|
/* The number of (integer) registers required to hold a quantity of
|
| 325 |
|
|
type MODE. */
|
| 326 |
|
|
#define LM32_NUM_REGS(MODE) LM32_NUM_INTS (GET_MODE_SIZE (MODE))
|
| 327 |
|
|
|
| 328 |
|
|
/* The number of (integer) registers required to hold a quantity of
|
| 329 |
|
|
TYPE MODE. */
|
| 330 |
|
|
#define LM32_NUM_REGS2(MODE, TYPE) \
|
| 331 |
|
|
LM32_NUM_INTS ((MODE) == BLKmode ? \
|
| 332 |
|
|
int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE))
|
| 333 |
|
|
|
| 334 |
|
|
#define STRUCT_VALUE 0
|
| 335 |
|
|
|
| 336 |
|
|
/*---------------------------*/
|
| 337 |
|
|
/* Function entry and exit. */
|
| 338 |
|
|
/*---------------------------*/
|
| 339 |
|
|
|
| 340 |
|
|
/*-------------*/
|
| 341 |
|
|
/* Profiling. */
|
| 342 |
|
|
/*-------------*/
|
| 343 |
|
|
|
| 344 |
|
|
#define FUNCTION_PROFILER(FILE, LABELNO)
|
| 345 |
|
|
|
| 346 |
|
|
/*---------------*/
|
| 347 |
|
|
/* Trampolines. */
|
| 348 |
|
|
/*---------------*/
|
| 349 |
|
|
|
| 350 |
|
|
#define TRAMPOLINE_SIZE 0
|
| 351 |
|
|
|
| 352 |
|
|
/*---------------------*/
|
| 353 |
|
|
/* Addressing Modes. */
|
| 354 |
|
|
/*---------------------*/
|
| 355 |
|
|
|
| 356 |
|
|
#define CONSTANT_ADDRESS_P(X) \
|
| 357 |
|
|
((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
|
| 358 |
|
|
|| GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \
|
| 359 |
|
|
|| (GET_CODE (X) == CONST)))
|
| 360 |
|
|
|
| 361 |
|
|
#define MAX_REGS_PER_ADDRESS 1
|
| 362 |
|
|
|
| 363 |
|
|
#define STRICT_REG_OK_FOR_BASE_P(X) \
|
| 364 |
|
|
(REGNO_OK_FOR_BASE_P (REGNO (X)))
|
| 365 |
|
|
#define NONSTRICT_REG_OK_FOR_BASE_P(X) \
|
| 366 |
|
|
(G_REG_P (REGNO (X)) || !HARD_REGISTER_NUM_P (REGNO (X)))
|
| 367 |
|
|
|
| 368 |
|
|
#ifdef REG_OK_STRICT
|
| 369 |
|
|
#define REG_OK_FOR_BASE_P(X) STRICT_REG_OK_FOR_BASE_P(X)
|
| 370 |
|
|
#else
|
| 371 |
|
|
#define REG_OK_FOR_BASE_P(X) NONSTRICT_REG_OK_FOR_BASE_P(X)
|
| 372 |
|
|
#endif
|
| 373 |
|
|
|
| 374 |
|
|
#define LEGITIMATE_CONSTANT_P(X) lm32_legitimate_constant_p
|
| 375 |
|
|
|
| 376 |
|
|
/*-------------------------*/
|
| 377 |
|
|
/* Condition Code Status. */
|
| 378 |
|
|
/*-------------------------*/
|
| 379 |
|
|
|
| 380 |
|
|
#define REVERSIBLE_CC_MODE(MODE) 1
|
| 381 |
|
|
|
| 382 |
|
|
/*---------*/
|
| 383 |
|
|
/* Costs. */
|
| 384 |
|
|
/*---------*/
|
| 385 |
|
|
|
| 386 |
|
|
#define SLOW_BYTE_ACCESS 1
|
| 387 |
|
|
|
| 388 |
|
|
#define NO_FUNCTION_CSE
|
| 389 |
|
|
|
| 390 |
|
|
#define BRANCH_COST(speed_p, predictable_p) 4
|
| 391 |
|
|
|
| 392 |
|
|
#define MOVE_RATIO(speed) (speed ? 24 : 3)
|
| 393 |
|
|
|
| 394 |
|
|
/*------------*/
|
| 395 |
|
|
/* Sections. */
|
| 396 |
|
|
/*------------*/
|
| 397 |
|
|
|
| 398 |
|
|
#define TEXT_SECTION_ASM_OP "\t.section\t.text"
|
| 399 |
|
|
#define DATA_SECTION_ASM_OP "\t.section\t.data"
|
| 400 |
|
|
#define SDATA_SECTION_ASM_OP "\t.section\t.sdata,\"aw\""
|
| 401 |
|
|
#define BSS_SECTION_ASM_OP "\t.section\t.bss"
|
| 402 |
|
|
#define SBSS_SECTION_ASM_OP "\t.section\t.sbss,\"aw\""
|
| 403 |
|
|
|
| 404 |
|
|
/*-------*/
|
| 405 |
|
|
/* PIC. */
|
| 406 |
|
|
/*-------*/
|
| 407 |
|
|
|
| 408 |
|
|
#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? GP_REGNUM : INVALID_REGNUM)
|
| 409 |
|
|
|
| 410 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
|
| 411 |
|
|
|
| 412 |
|
|
#define LEGITIMATE_PIC_OPERAND_P(X) \
|
| 413 |
|
|
(!(nonpic_symbol_mentioned_p (X)))
|
| 414 |
|
|
|
| 415 |
|
|
/*-------------*/
|
| 416 |
|
|
/* Assembler. */
|
| 417 |
|
|
/*-------------*/
|
| 418 |
|
|
|
| 419 |
|
|
#define ASM_COMMENT_START "#"
|
| 420 |
|
|
|
| 421 |
|
|
#define ASM_APP_ON "#APP\n"
|
| 422 |
|
|
|
| 423 |
|
|
#define ASM_APP_OFF "#NO_APP\n"
|
| 424 |
|
|
|
| 425 |
|
|
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
| 426 |
|
|
do { \
|
| 427 |
|
|
fputc ( '\t', FILE); \
|
| 428 |
|
|
assemble_name (FILE, LABEL1); \
|
| 429 |
|
|
fputs ( " = ", FILE); \
|
| 430 |
|
|
assemble_name (FILE, LABEL2); \
|
| 431 |
|
|
fputc ( '\n', FILE); \
|
| 432 |
|
|
} while (0)
|
| 433 |
|
|
|
| 434 |
|
|
/* Override default implementation in elfos.h to support -G. */
|
| 435 |
|
|
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
| 436 |
|
|
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
| 437 |
|
|
do { \
|
| 438 |
|
|
if ((SIZE) <= g_switch_value) \
|
| 439 |
|
|
switch_to_section (sbss_section); \
|
| 440 |
|
|
else \
|
| 441 |
|
|
switch_to_section (bss_section); \
|
| 442 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
| 443 |
|
|
if (!flag_inhibit_size_directive) \
|
| 444 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
|
| 445 |
|
|
ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \
|
| 446 |
|
|
ASM_OUTPUT_LABEL(FILE, NAME); \
|
| 447 |
|
|
ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \
|
| 448 |
|
|
} while (0)
|
| 449 |
|
|
|
| 450 |
|
|
/* Override default implementation in elfos.h to support -G. */
|
| 451 |
|
|
#undef ASM_OUTPUT_ALIGNED_COMMON
|
| 452 |
|
|
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
| 453 |
|
|
do \
|
| 454 |
|
|
{ \
|
| 455 |
|
|
if ((SIZE) <= g_switch_value) \
|
| 456 |
|
|
{ \
|
| 457 |
|
|
switch_to_section (sbss_section); \
|
| 458 |
|
|
(*targetm.asm_out.globalize_label) (FILE, NAME); \
|
| 459 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
| 460 |
|
|
if (!flag_inhibit_size_directive) \
|
| 461 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
|
| 462 |
|
|
ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \
|
| 463 |
|
|
ASM_OUTPUT_LABEL(FILE, NAME); \
|
| 464 |
|
|
ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \
|
| 465 |
|
|
} \
|
| 466 |
|
|
else \
|
| 467 |
|
|
{ \
|
| 468 |
|
|
switch_to_section (bss_section); \
|
| 469 |
|
|
fprintf ((FILE), "%s", COMMON_ASM_OP); \
|
| 470 |
|
|
assemble_name ((FILE), (NAME)); \
|
| 471 |
|
|
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
|
| 472 |
|
|
(SIZE), (ALIGN) / BITS_PER_UNIT); \
|
| 473 |
|
|
} \
|
| 474 |
|
|
} \
|
| 475 |
|
|
while (0)
|
| 476 |
|
|
|
| 477 |
|
|
#define ASM_OUTPUT_LABEL(FILE, NAME) \
|
| 478 |
|
|
do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
|
| 479 |
|
|
|
| 480 |
|
|
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
|
| 481 |
|
|
do { \
|
| 482 |
|
|
const char *xname = (NAME); \
|
| 483 |
|
|
if (xname[0] == '@') \
|
| 484 |
|
|
xname += 1; \
|
| 485 |
|
|
if (xname[0] == '*') \
|
| 486 |
|
|
xname += 1; \
|
| 487 |
|
|
fputs (xname, FILE); \
|
| 488 |
|
|
} while (0)
|
| 489 |
|
|
|
| 490 |
|
|
#define ASM_OUTPUT_SYMBOL_REF(STREAM, SYMBOL) \
|
| 491 |
|
|
do { \
|
| 492 |
|
|
assemble_name (STREAM, XSTR (SYMBOL, 0)); \
|
| 493 |
|
|
} while (0)
|
| 494 |
|
|
|
| 495 |
|
|
#define GLOBAL_ASM_OP "\t.global\t"
|
| 496 |
|
|
|
| 497 |
|
|
#define REGISTER_NAMES \
|
| 498 |
|
|
{ \
|
| 499 |
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
|
| 500 |
|
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
|
| 501 |
|
|
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
|
| 502 |
|
|
"r24", "r25", "gp", "fp", "sp", "ra", "ea", "ba"}
|
| 503 |
|
|
|
| 504 |
|
|
#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
|
| 505 |
|
|
(((CHAR) == '&') || ((CHAR) == '@') || ((CHAR) == '*'))
|
| 506 |
|
|
|
| 507 |
|
|
#define PRINT_OPERAND(FILE, X, CODE) \
|
| 508 |
|
|
lm32_print_operand (FILE, X, CODE)
|
| 509 |
|
|
|
| 510 |
|
|
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
|
| 511 |
|
|
lm32_print_operand_address (FILE, ADDR)
|
| 512 |
|
|
|
| 513 |
|
|
#ifndef LOCAL_LABEL_PREFIX
|
| 514 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
| 515 |
|
|
#endif
|
| 516 |
|
|
|
| 517 |
|
|
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
| 518 |
|
|
do { if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", (1 << (LOG))); } while (0)
|
| 519 |
|
|
|
| 520 |
|
|
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
|
| 521 |
|
|
do { \
|
| 522 |
|
|
char label[64]; \
|
| 523 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
|
| 524 |
|
|
fprintf (FILE, "\n\t.word\t"); \
|
| 525 |
|
|
assemble_name (FILE, label); \
|
| 526 |
|
|
fprintf (FILE, "\n"); \
|
| 527 |
|
|
} while (0)
|
| 528 |
|
|
|
| 529 |
|
|
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
|
| 530 |
|
|
do { \
|
| 531 |
|
|
char label[64]; \
|
| 532 |
|
|
fprintf (FILE, "\t.word\t("); \
|
| 533 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
|
| 534 |
|
|
assemble_name (FILE, label); \
|
| 535 |
|
|
fprintf (FILE, "-"); \
|
| 536 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
|
| 537 |
|
|
assemble_name (FILE, label); \
|
| 538 |
|
|
fprintf (FILE, ")\n"); \
|
| 539 |
|
|
} while (0)
|
| 540 |
|
|
|
| 541 |
|
|
/*-------------*/
|
| 542 |
|
|
/* Debugging. */
|
| 543 |
|
|
/*-------------*/
|
| 544 |
|
|
|
| 545 |
|
|
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
|
| 546 |
|
|
|
| 547 |
|
|
#define CAN_DEBUG_WITHOUT_FP
|
| 548 |
|
|
|
| 549 |
|
|
#define DEFAULT_GDB_EXTENSIONS 1
|
| 550 |
|
|
|
| 551 |
|
|
/*--------*/
|
| 552 |
|
|
/* Misc. */
|
| 553 |
|
|
/*--------*/
|
| 554 |
|
|
|
| 555 |
|
|
#define CASE_VECTOR_MODE Pmode
|
| 556 |
|
|
|
| 557 |
|
|
#define WORD_REGISTER_OPERATIONS
|
| 558 |
|
|
|
| 559 |
|
|
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
|
| 560 |
|
|
|
| 561 |
|
|
#define SHORT_IMMEDIATES_SIGN_EXTEND
|
| 562 |
|
|
|
| 563 |
|
|
#define MOVE_MAX UNITS_PER_WORD
|
| 564 |
|
|
#define MAX_MOVE_MAX 4
|
| 565 |
|
|
|
| 566 |
|
|
#define SHIFT_COUNT_TRUNCATED 1
|
| 567 |
|
|
|
| 568 |
|
|
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
|
| 569 |
|
|
|
| 570 |
|
|
#define Pmode SImode
|
| 571 |
|
|
|
| 572 |
|
|
#define FUNCTION_MODE SImode
|
| 573 |
|
|
|
| 574 |
|
|
#ifndef NO_IMPLICIT_EXTERN_C
|
| 575 |
|
|
#define NO_IMPLICIT_EXTERN_C
|
| 576 |
|
|
#endif
|
| 577 |
|
|
|
| 578 |
|
|
#define STORE_FLAG_VALUE 1
|