OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [crx/] [crx.h] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Definitions of target machine for GNU compiler, for CRX.
2
   Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3
   2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
4
 
5
   This file is part of GCC.
6
 
7
   GCC is free software; you can redistribute it and/or modify it
8
   under the terms of the GNU General Public License as published
9
   by the Free Software Foundation; either version 3, or (at your
10
   option) any later version.
11
 
12
   GCC is distributed in the hope that it will be useful, but WITHOUT
13
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15
   License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with GCC; see the file COPYING3.  If not see
19
   <http://www.gnu.org/licenses/>.  */
20
 
21
#ifndef GCC_CRX_H
22
#define GCC_CRX_H
23
 
24
/*****************************************************************************/
25
/* CONTROLLING THE DRIVER                                                    */
26
/*****************************************************************************/
27
 
28
#define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
29
    %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
30
    %{!fexceptions:-fno-exceptions} \
31
    %{!fthreadsafe-statics:-fno-threadsafe-statics}"
32
 
33
#undef  STARTFILE_SPEC
34
#define STARTFILE_SPEC "crti.o%s crtbegin.o%s"
35
 
36
#undef  ENDFILE_SPEC
37
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
38
 
39
#undef MATH_LIBRARY
40
#define MATH_LIBRARY ""
41
 
42
/*****************************************************************************/
43
/* RUN-TIME TARGET SPECIFICATION                                             */
44
/*****************************************************************************/
45
 
46
#ifndef TARGET_CPU_CPP_BUILTINS
47
#define TARGET_CPU_CPP_BUILTINS()                               \
48
do {                                                            \
49
     builtin_define("__CRX__");                                 \
50
     builtin_define("__CR__");                                  \
51
} while (0)
52
#endif
53
 
54
#define TARGET_VERSION fputs (" (CRX/ELF)", stderr);
55
 
56
/* Put each function in its own section so that PAGE-instruction
57
 * relaxation can do its best.  */
58
#define OPTIMIZATION_OPTIONS(LEVEL, SIZEFLAG)   \
59
    do {                                        \
60
        if ((LEVEL) || (SIZEFLAG))              \
61
            flag_function_sections = 1; \
62
    } while (0)
63
 
64
/* Show we can debug even without a frame pointer.  */
65
#define CAN_DEBUG_WITHOUT_FP
66
 
67
/*****************************************************************************/
68
/* STORAGE LAYOUT                                                            */
69
/*****************************************************************************/
70
 
71
#define BITS_BIG_ENDIAN  0
72
 
73
#define BYTES_BIG_ENDIAN 0
74
 
75
#define WORDS_BIG_ENDIAN 0
76
 
77
#define UNITS_PER_WORD 4
78
 
79
#define POINTER_SIZE 32
80
 
81
#define PARM_BOUNDARY 32
82
 
83
#define STACK_BOUNDARY 32
84
 
85
#define FUNCTION_BOUNDARY 32
86
 
87
#define STRUCTURE_SIZE_BOUNDARY 32
88
 
89
#define BIGGEST_ALIGNMENT 32
90
 
91
/* In CRX arrays of chars are word-aligned, so strcpy() will be faster.  */
92
#define DATA_ALIGNMENT(TYPE, ALIGN) \
93
  (TREE_CODE (TYPE) == ARRAY_TYPE && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
94
   && (ALIGN) < BITS_PER_WORD \
95
   ? (BITS_PER_WORD) : (ALIGN))
96
 
97
/* In CRX strings are word-aligned so strcpy from constants will be faster. */
98
#define CONSTANT_ALIGNMENT(CONSTANT, ALIGN) \
99
  (TREE_CODE (CONSTANT) == STRING_CST && (ALIGN) < BITS_PER_WORD \
100
   ? (BITS_PER_WORD) : (ALIGN))
101
 
102
#define STRICT_ALIGNMENT 0
103
 
104
#define PCC_BITFIELD_TYPE_MATTERS 1
105
 
106
/*****************************************************************************/
107
/* LAYOUT OF SOURCE LANGUAGE DATA TYPES                                      */
108
/*****************************************************************************/
109
 
110
#define INT_TYPE_SIZE           32
111
 
112
#define SHORT_TYPE_SIZE         16
113
 
114
#define LONG_TYPE_SIZE          32
115
 
116
#define LONG_LONG_TYPE_SIZE     64
117
 
118
#define FLOAT_TYPE_SIZE         32
119
 
120
#define DOUBLE_TYPE_SIZE        64
121
 
122
#define LONG_DOUBLE_TYPE_SIZE   64
123
 
124
#define DEFAULT_SIGNED_CHAR     1
125
 
126
#define SIZE_TYPE               "unsigned int"
127
 
128
#define PTRDIFF_TYPE            "int"
129
 
130
/*****************************************************************************/
131
/* REGISTER USAGE.                                                           */
132
/*****************************************************************************/
133
 
134
#define FIRST_PSEUDO_REGISTER   19
135
 
136
/* On the CRX, only the stack pointer (r15) is such. */
137
#define FIXED_REGISTERS \
138
  { \
139
 /* r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r10 */  \
140
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,      \
141
 /* r11 r12 r13 ra  sp  r16 r17 cc */               \
142
    0,  0,  0,  0,  1,  0,  0,  1                   \
143
  }
144
 
145
/* On the CRX, calls clobbers r0-r6 (scratch registers), ra (the return address)
146
 * and sp - (the stack pointer which is fixed). */
147
#define CALL_USED_REGISTERS \
148
  { \
149
 /* r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r10 */  \
150
    1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,      \
151
 /* r11 r12 r13 ra  sp  r16 r17 cc */               \
152
    0,  0,  0,  1,  1,  1,  1,  1                   \
153
  }
154
 
155
#define HARD_REGNO_NREGS(REGNO, MODE) \
156
    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
157
 
158
/* On the CRX architecture, HILO regs can only hold SI mode. */
159
#define HARD_REGNO_MODE_OK(REGNO, MODE) crx_hard_regno_mode_ok(REGNO, MODE)
160
 
161
/* So far no patterns for moving CCMODE data are available */
162
#define AVOID_CCMODE_COPIES
163
 
164
/* Interrupt functions can only use registers that have already been saved by
165
 * the prologue, even if they would normally be call-clobbered. */
166
#define HARD_REGNO_RENAME_OK(SRC, DEST) \
167
        (!crx_interrupt_function_p () || regs_ever_live[DEST])
168
 
169
#define MODES_TIEABLE_P(MODE1, MODE2)  1
170
 
171
enum reg_class
172
{
173
  NO_REGS,
174
  LO_REGS,
175
  HI_REGS,
176
  HILO_REGS,
177
  NOSP_REGS,
178
  GENERAL_REGS,
179
  ALL_REGS,
180
  LIM_REG_CLASSES
181
};
182
 
183
#define N_REG_CLASSES (int) LIM_REG_CLASSES
184
 
185
#define REG_CLASS_NAMES \
186
  {                     \
187
    "NO_REGS",          \
188
    "LO_REGS",          \
189
    "HI_REGS",          \
190
    "HILO_REGS",        \
191
    "NOSP_REGS",        \
192
    "GENERAL_REGS",     \
193
    "ALL_REGS"          \
194
  }
195
 
196
#define REG_CLASS_CONTENTS                              \
197
  {                                                     \
198
    {0x00000000}, /* NO_REGS                    */      \
199
    {0x00010000}, /* LO_REGS :          16      */      \
200
    {0x00020000}, /* HI_REGS :          17      */      \
201
    {0x00030000}, /* HILO_REGS :        16, 17  */      \
202
    {0x00007fff}, /* NOSP_REGS :        0 - 14  */      \
203
    {0x0000ffff}, /* GENERAL_REGS :     0 - 15  */      \
204
    {0x0007ffff}  /* ALL_REGS :         0 - 18  */      \
205
  }
206
 
207
#define REGNO_REG_CLASS(REGNO)  crx_regno_reg_class(REGNO)
208
 
209
#define BASE_REG_CLASS          GENERAL_REGS
210
 
211
#define INDEX_REG_CLASS         GENERAL_REGS
212
 
213
#define REG_CLASS_FROM_LETTER(C)        \
214
  ((C) == 'b' ? NOSP_REGS :             \
215
   (C) == 'l' ? LO_REGS :               \
216
   (C) == 'h' ? HI_REGS :               \
217
   (C) == 'k' ? HILO_REGS :             \
218
  NO_REGS)
219
 
220
#define REGNO_OK_FOR_BASE_P(REGNO) \
221
  ((REGNO) < 16 \
222
   || (reg_renumber && (unsigned)reg_renumber[REGNO] < 16))
223
 
224
#define REGNO_OK_FOR_INDEX_P(REGNO)        REGNO_OK_FOR_BASE_P(REGNO)
225
 
226
#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
227
 
228
#define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \
229
  crx_secondary_reload_class (CLASS, MODE, X)
230
 
231
#define CLASS_MAX_NREGS(CLASS, MODE) \
232
    (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD
233
 
234
#define SIGNED_INT_FITS_N_BITS(imm, N) \
235
  ((((imm) < ((long long)1<<((N)-1))) && ((imm) >= -((long long)1<<((N)-1)))) ? 1 : 0)
236
 
237
#define UNSIGNED_INT_FITS_N_BITS(imm, N) \
238
  (((imm) < ((long long)1<<(N)) && (imm) >= (long long)0) ? 1 : 0)
239
 
240
#define HILO_REGNO_P(regno) \
241
  (reg_classes_intersect_p(REGNO_REG_CLASS(regno), HILO_REGS))
242
 
243
#define INT_CST4(VALUE) \
244
  (((VALUE) >= -1 && (VALUE) <= 4) || (VALUE) == -4 \
245
  || (VALUE) == 7 || (VALUE) == 8 || (VALUE) == 16 || (VALUE) == 32 \
246
  || (VALUE) == 20 || (VALUE) == 12 || (VALUE) == 48)
247
 
248
#define CONST_OK_FOR_LETTER_P(VALUE, C)                         \
249
  /* Legal const for store immediate instructions */            \
250
  ((C) == 'I' ? UNSIGNED_INT_FITS_N_BITS(VALUE, 3) :            \
251
   (C) == 'J' ? UNSIGNED_INT_FITS_N_BITS(VALUE, 4) :            \
252
   (C) == 'K' ? UNSIGNED_INT_FITS_N_BITS(VALUE, 5) :            \
253
   (C) == 'L' ? INT_CST4(VALUE) :                               \
254
  0)
255
 
256
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
257
  ((C) == 'G' ? crx_const_double_ok (VALUE) :   \
258
  0)
259
 
260
/*****************************************************************************/
261
/* STACK LAYOUT AND CALLING CONVENTIONS.                                     */
262
/*****************************************************************************/
263
 
264
#define STACK_GROWS_DOWNWARD
265
 
266
#define STARTING_FRAME_OFFSET  0
267
 
268
#define STACK_POINTER_REGNUM    15
269
 
270
#define FRAME_POINTER_REGNUM    13
271
 
272
#define ARG_POINTER_REGNUM      12
273
 
274
#define STATIC_CHAIN_REGNUM     1
275
 
276
#define RETURN_ADDRESS_REGNUM   14
277
 
278
#define FIRST_PARM_OFFSET(FNDECL)  0
279
 
280
#define FRAME_POINTER_REQUIRED (current_function_calls_alloca)
281
 
282
#define ELIMINABLE_REGS \
283
  { \
284
    { ARG_POINTER_REGNUM,   STACK_POINTER_REGNUM}, \
285
    { ARG_POINTER_REGNUM,   FRAME_POINTER_REGNUM}, \
286
    { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}  \
287
  }
288
 
289
#define CAN_ELIMINATE(FROM, TO) \
290
 ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
291
 
292
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
293
  do {                                                                  \
294
    (OFFSET) = crx_initial_elimination_offset ((FROM), (TO));           \
295
  } while (0)
296
 
297
/*****************************************************************************/
298
/* PASSING FUNCTION ARGUMENTS                                                */
299
/*****************************************************************************/
300
 
301
#define ACCUMULATE_OUTGOING_ARGS (TARGET_NO_PUSH_ARGS)
302
 
303
#define PUSH_ARGS (!TARGET_NO_PUSH_ARGS)
304
 
305
#define PUSH_ROUNDING(BYTES) (((BYTES) + 3) & ~3)
306
 
307
#define RETURN_POPS_ARGS(FNDECL, FUNTYPE, SIZE)   0
308
 
309
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
310
  ((rtx) crx_function_arg(&(CUM), (MODE), (TYPE), (NAMED)))
311
 
312
#ifndef CUMULATIVE_ARGS
313
struct cumulative_args
314
{
315
  int ints;
316
};
317
 
318
#define CUMULATIVE_ARGS struct cumulative_args
319
#endif
320
 
321
/* On the CRX architecture, Varargs routines should receive their parameters on
322
 * the stack.  */
323
 
324
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
325
  crx_init_cumulative_args(&(CUM), (FNTYPE), (LIBNAME))
326
 
327
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
328
  crx_function_arg_advance(&(CUM), (MODE), (TYPE), (NAMED))
329
 
330
#define FUNCTION_ARG_REGNO_P(REGNO)  crx_function_arg_regno_p(REGNO)
331
 
332
/*****************************************************************************/
333
/* RETURNING FUNCTION VALUE                                                  */
334
/*****************************************************************************/
335
 
336
/* On the CRX, the return value is in R0 */
337
 
338
#define FUNCTION_VALUE(VALTYPE, FUNC) \
339
        gen_rtx_REG(TYPE_MODE (VALTYPE), 0)
340
 
341
#define LIBCALL_VALUE(MODE)     gen_rtx_REG (MODE, 0)
342
 
343
#define FUNCTION_VALUE_REGNO_P(N)       ((N) == 0)
344
 
345
#define CRX_STRUCT_VALUE_REGNUM  0
346
 
347
/*****************************************************************************/
348
/* GENERATING CODE FOR PROFILING - NOT IMPLEMENTED                           */
349
/*****************************************************************************/
350
 
351
#undef  FUNCTION_PROFILER
352
#define FUNCTION_PROFILER(STREAM, LABELNO)      \
353
{                                               \
354
    sorry ("Profiler support for CRX");         \
355
}
356
 
357
/*****************************************************************************/
358
/* TRAMPOLINES FOR NESTED FUNCTIONS - NOT SUPPORTED                          */
359
/*****************************************************************************/
360
 
361
#define TRAMPOLINE_SIZE 32
362
 
363
#define INITIALIZE_TRAMPOLINE(addr, fnaddr, static_chain)       \
364
{                                                               \
365
    sorry ("Trampoline support for CRX");                       \
366
}
367
 
368
/*****************************************************************************/
369
/* ADDRESSING MODES                                                          */
370
/*****************************************************************************/
371
 
372
#define CONSTANT_ADDRESS_P(X)                                           \
373
  (GET_CODE (X) == LABEL_REF                                            \
374
   || GET_CODE (X) == SYMBOL_REF                                        \
375
   || GET_CODE (X) == CONST                                             \
376
   || GET_CODE (X) == CONST_INT)
377
 
378
#define MAX_REGS_PER_ADDRESS 2
379
 
380
#define HAVE_POST_INCREMENT  1
381
#define HAVE_POST_DECREMENT  1
382
#define HAVE_POST_MODIFY_DISP 1
383
#define HAVE_POST_MODIFY_REG 0
384
 
385
#ifdef REG_OK_STRICT
386
#define REG_OK_FOR_BASE_P(X)    REGNO_OK_FOR_BASE_P (REGNO (X))
387
#define REG_OK_FOR_INDEX_P(X)   REGNO_OK_FOR_INDEX_P (REGNO (X))
388
#else
389
#define REG_OK_FOR_BASE_P(X)    1
390
#define REG_OK_FOR_INDEX_P(X)   1
391
#endif /* REG_OK_STRICT */
392
 
393
#ifdef REG_OK_STRICT
394
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                        \
395
{                                                                       \
396
  if (crx_legitimate_address_p (MODE, X, 1))                            \
397
      goto LABEL;                                                       \
398
}
399
#else
400
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                        \
401
{                                                                       \
402
  if (crx_legitimate_address_p (MODE, X, 0))                            \
403
      goto LABEL;                                                       \
404
}
405
#endif /* REG_OK_STRICT */
406
 
407
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)                       \
408
{                                                                       \
409
  if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC)       \
410
    goto LABEL;                                                         \
411
}
412
 
413
#define LEGITIMATE_CONSTANT_P(X)  1
414
 
415
/*****************************************************************************/
416
/* CONDITION CODE STATUS                                                     */
417
/*****************************************************************************/
418
 
419
/*****************************************************************************/
420
/* RELATIVE COSTS OF OPERATIONS                                              */
421
/*****************************************************************************/
422
 
423
#define MEMORY_MOVE_COST(MODE, CLASS, IN) crx_memory_move_cost(MODE, CLASS, IN)
424
/* Moving to processor register flushes pipeline - thus asymmetric */
425
#define REGISTER_MOVE_COST(MODE, FROM, TO) ((TO != GENERAL_REGS) ? 8 : 2)
426
/* Assume best case (branch predicted) */
427
#define BRANCH_COST 2
428
 
429
#define SLOW_BYTE_ACCESS  1
430
 
431
/*****************************************************************************/
432
/* DIVIDING THE OUTPUT INTO SECTIONS                                         */
433
/*****************************************************************************/
434
 
435
#define TEXT_SECTION_ASM_OP     "\t.section\t.text"
436
 
437
#define DATA_SECTION_ASM_OP     "\t.section\t.data"
438
 
439
#define BSS_SECTION_ASM_OP      "\t.section\t.bss"
440
 
441
/*****************************************************************************/
442
/* POSITION INDEPENDENT CODE                                                 */
443
/*****************************************************************************/
444
 
445
#define PIC_OFFSET_TABLE_REGNUM  12
446
 
447
#define LEGITIMATE_PIC_OPERAND_P(X)  1
448
 
449
/*****************************************************************************/
450
/* ASSEMBLER FORMAT                                                          */
451
/*****************************************************************************/
452
 
453
#define GLOBAL_ASM_OP "\t.globl\t"
454
 
455
#undef  USER_LABEL_PREFIX
456
#define USER_LABEL_PREFIX "_"
457
 
458
#undef  ASM_OUTPUT_LABELREF
459
#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
460
  asm_fprintf (STREAM, "%U%s", (*targetm.strip_name_encoding) (NAME));
461
 
462
#undef  ASM_APP_ON
463
#define ASM_APP_ON   "#APP\n"
464
 
465
#undef  ASM_APP_OFF
466
#define ASM_APP_OFF  "#NO_APP\n"
467
 
468
/*****************************************************************************/
469
/* INSTRUCTION OUTPUT                                                        */
470
/*****************************************************************************/
471
 
472
#define REGISTER_NAMES \
473
  { \
474
    "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7", \
475
    "r8",  "r9",  "r10", "r11", "r12", "r13", "ra",  "sp", \
476
    "lo",  "hi",  "cc" \
477
  }
478
 
479
#define PRINT_OPERAND(STREAM, X, CODE) \
480
  crx_print_operand(STREAM, X, CODE)
481
 
482
#define PRINT_OPERAND_ADDRESS(STREAM, ADDR) \
483
  crx_print_operand_address(STREAM, ADDR)
484
 
485
/*****************************************************************************/
486
/* OUTPUT OF DISPATCH TABLES                                                 */
487
/*****************************************************************************/
488
 
489
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
490
  asm_fprintf ((STREAM), "\t.long\t.L%d\n", (VALUE))
491
 
492
/*****************************************************************************/
493
/* ALIGNMENT IN ASSEMBLER FILE                                               */
494
/*****************************************************************************/
495
 
496
#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
497
  asm_fprintf ((STREAM), "\t.align\t%d\n", 1 << (POWER))
498
 
499
/*****************************************************************************/
500
/* MISCELLANEOUS PARAMETERS                                                  */
501
/*****************************************************************************/
502
 
503
#define CASE_VECTOR_MODE  Pmode
504
 
505
#define MOVE_MAX 4
506
 
507
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)  1
508
 
509
#define STORE_FLAG_VALUE  1
510
 
511
#define Pmode           SImode
512
 
513
#define FUNCTION_MODE   QImode
514
 
515
/*****************************************************************************/
516
/* EXTERNAL DECLARATIONS FOR VARIABLES DEFINED IN CRX.C                      */
517
/*****************************************************************************/
518
 
519
extern rtx crx_compare_op0;    /* operand 0 for comparisons */
520
extern rtx crx_compare_op1;    /* operand 1 for comparisons */
521
 
522
#endif /* ! GCC_CRX_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.