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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [moxie/] [moxie.h] - Blame information for rev 716

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 709 jeremybenn
/* Target Definitions for moxie.
2
   Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
3
   Contributed by Anthony Green.
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_MOXIE_H
22
#define GCC_MOXIE_H
23
 
24
#undef  STARTFILE_SPEC
25
#define STARTFILE_SPEC "crt0%O%s crti.o%s crtbegin.o%s"
26
 
27
/* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
28
   magical crtend.o file (see crtstuff.c) which provides part of the
29
   support for getting C++ file-scope static object constructed before
30
   entering `main', followed by the normal svr3/svr4 "finalizer" file,
31
   which is either `gcrtn.o' or `crtn.o'.  */
32
 
33
#undef  ENDFILE_SPEC
34
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
35
 
36
/* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
37
   standard C library (unless we are building a shared library) and
38
   the simulator BSP code.  */
39
 
40
#undef LIB_SPEC
41
#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
42
 
43
#undef  LINK_SPEC
44
#define LINK_SPEC "%{h*} %{v:-V} \
45
                   %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic}"
46
 
47
/* Layout of Source Language Data Types */
48
 
49
#define INT_TYPE_SIZE 32
50
#define SHORT_TYPE_SIZE 16
51
#define LONG_TYPE_SIZE 32
52
#define LONG_LONG_TYPE_SIZE 64
53
 
54
#define FLOAT_TYPE_SIZE 32
55
#define DOUBLE_TYPE_SIZE 64
56
#define LONG_DOUBLE_TYPE_SIZE 64
57
 
58
#define DEFAULT_SIGNED_CHAR 1
59
 
60
#undef  SIZE_TYPE
61
#define SIZE_TYPE "unsigned int"
62
 
63
#undef  PTRDIFF_TYPE
64
#define PTRDIFF_TYPE "int"
65
 
66
#undef  WCHAR_TYPE
67
#define WCHAR_TYPE "long int"
68
 
69
#undef  WCHAR_TYPE_SIZE
70
#define WCHAR_TYPE_SIZE BITS_PER_WORD
71
 
72
/* Registers...
73
 
74
   $fp  - frame pointer
75
   $sp  - stack pointer
76
   $r0  - general purpose 32-bit register.
77
   $r1  - general purpose 32-bit register.
78
   $r2  - general purpose 32-bit register.
79
   $r3  - general purpose 32-bit register.
80
   $r4  - general purpose 32-bit register.
81
   $r5  - general purpose 32-bit register.
82
   $r6  - general purpose 32-bit register.
83
   $r7  - general purpose 32-bit register.
84
   $r8  - general purpose 32-bit register.
85
   $r9  - general purpose 32-bit register.
86
   $r10 - general purpose 32-bit register.
87
   $r11 - general purpose 32-bit register.
88
   $r12 - general purpose 32-bit register.
89
   $r13 - reserved for execution environment.
90
 
91
   Special Registers...
92
 
93
   $pc - 32-bit program counter.
94
 
95
*/
96
 
97
#define REGISTER_NAMES {        \
98
  "$fp", "$sp", "$r0", "$r1",   \
99
  "$r2", "$r3", "$r4", "$r5",   \
100
  "$r6", "$r7", "$r8", "$r9",   \
101
  "$r10", "$r11", "$r12", "$r13",   \
102
  "?fp", "?ap", "$pc", "?cc" }
103
 
104
#define MOXIE_FP     0
105
#define MOXIE_SP     1
106
#define MOXIE_R0     2
107
#define MOXIE_R1     3
108
#define MOXIE_R2     4
109
#define MOXIE_R3     5
110
#define MOXIE_R4     6
111
#define MOXIE_R5     7
112
#define MOXIE_R6     8
113
#define MOXIE_R7     9
114
#define MOXIE_R8     10
115
#define MOXIE_R9     11
116
#define MOXIE_R10    12
117
#define MOXIE_R11    13
118
#define MOXIE_R12    14
119
#define MOXIE_R13    15
120
#define MOXIE_QFP    16
121
#define MOXIE_QAP    17
122
#define MOXIE_PC     18
123
#define MOXIE_CC     19
124
 
125
#define FIRST_PSEUDO_REGISTER 20
126
 
127
enum reg_class
128
{
129
  NO_REGS,
130
  GENERAL_REGS,
131
  SPECIAL_REGS,
132
  CC_REGS,
133
  ALL_REGS,
134
  LIM_REG_CLASSES
135
};
136
 
137
 
138
#define REG_CLASS_CONTENTS \
139
{ { 0x00000000 }, /* Empty */                      \
140
  { 0x0003FFFF }, /* $fp, $sp, $r0 to $r13, ?fp */ \
141
  { 0x00040000 }, /* $pc */                        \
142
  { 0x00080000 }, /* ?cc */                        \
143
  { 0x000FFFFF }  /* All registers */              \
144
}
145
 
146
#define N_REG_CLASSES LIM_REG_CLASSES
147
 
148
#define REG_CLASS_NAMES {\
149
    "NO_REGS", \
150
    "GENERAL_REGS", \
151
    "SPECIAL_REGS", \
152
    "CC_REGS", \
153
    "ALL_REGS" }
154
 
155
#define FIXED_REGISTERS     { 1, 1, 0, 0, \
156
                              0, 0, 0, 0, \
157
                              0, 0, 0, 0, \
158
                              0, 0, 0, 1, \
159
                              1, 1, 1, 1 }
160
 
161
#define CALL_USED_REGISTERS { 1, 1, 1, 1, \
162
                              1, 1, 1, 1, \
163
                              0, 0, 0, 0, \
164
                              0, 0, 1, 1, \
165
                              1, 1, 1, 1 }
166
 
167
/* We can't copy to or from our CC register. */
168
#define AVOID_CCMODE_COPIES 1
169
 
170
/* A C expression that is nonzero if it is permissible to store a
171
   value of mode MODE in hard register number REGNO (or in several
172
   registers starting with that one).  All gstore registers are
173
   equivalent, so we can set this to 1.  */
174
#define HARD_REGNO_MODE_OK(R,M) 1
175
 
176
/* A C expression whose value is a register class containing hard
177
   register REGNO.  */
178
#define REGNO_REG_CLASS(R) ((R < MOXIE_PC) ? GENERAL_REGS :             \
179
                            (R == MOXIE_CC ? CC_REGS : SPECIAL_REGS))
180
 
181
/* A C expression for the number of consecutive hard registers,
182
   starting at register number REGNO, required to hold a value of mode
183
   MODE.  */
184
#define HARD_REGNO_NREGS(REGNO, MODE)                      \
185
  ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1)             \
186
   / UNITS_PER_WORD)
187
 
188
/* A C expression that is nonzero if a value of mode MODE1 is
189
   accessible in mode MODE2 without copying.  */
190
#define MODES_TIEABLE_P(MODE1, MODE2) 1
191
 
192
/* The Overall Framework of an Assembler File */
193
 
194
#undef  ASM_SPEC
195
#define ASM_COMMENT_START "#"
196
#define ASM_APP_ON ""
197
#define ASM_APP_OFF ""
198
 
199
#define FILE_ASM_OP     "\t.file\n"
200
 
201
/* Switch to the text or data segment.  */
202
#define TEXT_SECTION_ASM_OP  "\t.text"
203
#define DATA_SECTION_ASM_OP  "\t.data"
204
 
205
/* Assembler Commands for Alignment */
206
 
207
#define ASM_OUTPUT_ALIGN(STREAM,POWER) \
208
        fprintf (STREAM, "\t.p2align\t%d\n", POWER);
209
 
210
/* A C compound statement to output to stdio stream STREAM the
211
   assembler syntax for an instruction operand X.  */
212
#define PRINT_OPERAND(STREAM, X, CODE) moxie_print_operand (STREAM, X, CODE)
213
 
214
#define PRINT_OPERAND_ADDRESS(STREAM ,X) moxie_print_operand_address (STREAM, X)
215
 
216
/* Output and Generation of Labels */
217
 
218
#define GLOBAL_ASM_OP "\t.global\t"
219
 
220
/* Passing Arguments in Registers */
221
 
222
/* A C type for declaring a variable that is used as the first
223
   argument of `FUNCTION_ARG' and other related values.  */
224
#define CUMULATIVE_ARGS unsigned int
225
 
226
/* If defined, the maximum amount of space required for outgoing arguments
227
   will be computed and placed into the variable
228
   `current_function_outgoing_args_size'.  No space will be pushed
229
   onto the stack for each call; instead, the function prologue should
230
   increase the stack frame size by this amount.  */
231
#define ACCUMULATE_OUTGOING_ARGS 1
232
 
233
/* A C statement (sans semicolon) for initializing the variable CUM
234
   for the state at the beginning of the argument list.
235
   For moxie, the first arg is passed in register 2 (aka $r0).  */
236
#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \
237
  (CUM = MOXIE_R0)
238
 
239
/* How Scalar Function Values Are Returned */
240
 
241
/* STACK AND CALLING */
242
 
243
/* Define this macro if pushing a word onto the stack moves the stack
244
   pointer to a smaller address.  */
245
#define STACK_GROWS_DOWNWARD
246
 
247
#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0
248
 
249
/* Offset from the frame pointer to the first local variable slot to
250
   be allocated.  */
251
#define STARTING_FRAME_OFFSET 0
252
 
253
/* Define this if the above stack space is to be considered part of the
254
   space allocated by the caller.  */
255
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
256
#define STACK_PARMS_IN_REG_PARM_AREA
257
 
258
/* Define this if it is the responsibility of the caller to allocate
259
   the area reserved for arguments passed in registers.  */
260
#define REG_PARM_STACK_SPACE(FNDECL) (6 * UNITS_PER_WORD)
261
 
262
/* Offset from the argument pointer register to the first argument's
263
   address.  On some machines it may depend on the data type of the
264
   function.  */
265
#define FIRST_PARM_OFFSET(F) 12
266
 
267
/* Define this macro to nonzero value if the addresses of local variable slots
268
   are at negative offsets from the frame pointer.  */
269
#define FRAME_GROWS_DOWNWARD 1
270
 
271
/* Define this macro as a C expression that is nonzero for registers that are
272
   used by the epilogue or the return pattern.  The stack and frame
273
   pointer registers are already assumed to be used as needed.  */
274
#define EPILOGUE_USES(R) (R == MOXIE_R5)
275
 
276
/* A C expression whose value is RTL representing the location of the
277
   incoming return address at the beginning of any function, before
278
   the prologue.  */
279
#define INCOMING_RETURN_ADDR_RTX                                        \
280
  gen_frame_mem (Pmode,                                                 \
281
                 plus_constant (stack_pointer_rtx, UNITS_PER_WORD))
282
 
283
/* Describe how we implement __builtin_eh_return.  */
284
#define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N+2) : INVALID_REGNUM)
285
 
286
/* Store the return handler into the call frame.  */
287
#define EH_RETURN_HANDLER_RTX                                           \
288
  gen_frame_mem (Pmode,                                                 \
289
                 plus_constant (frame_pointer_rtx, UNITS_PER_WORD))
290
 
291
/* Storage Layout */
292
 
293
#define BITS_BIG_ENDIAN 0
294
#define BYTES_BIG_ENDIAN 1
295
#define WORDS_BIG_ENDIAN 1
296
 
297
/* Alignment required for a function entry point, in bits.  */
298
#define FUNCTION_BOUNDARY 16
299
 
300
/* Define this macro as a C expression which is nonzero if accessing
301
   less than a word of memory (i.e. a `char' or a `short') is no
302
   faster than accessing a word of memory.  */
303
#define SLOW_BYTE_ACCESS 1
304
 
305
/* Number of storage units in a word; normally the size of a
306
   general-purpose register, a power of two from 1 or 8.  */
307
#define UNITS_PER_WORD 4
308
 
309
/* Define this macro to the minimum alignment enforced by hardware
310
   for the stack pointer on this machine.  The definition is a C
311
   expression for the desired alignment (measured in bits).  */
312
#define STACK_BOUNDARY 32
313
 
314
/* Normal alignment required for function parameters on the stack, in
315
   bits.  All stack parameters receive at least this much alignment
316
   regardless of data type.  */
317
#define PARM_BOUNDARY 32
318
 
319
/* Alignment of field after `int : 0' in a structure.  */
320
#define EMPTY_FIELD_BOUNDARY  32
321
 
322
/* No data type wants to be aligned rounder than this.  */
323
#define BIGGEST_ALIGNMENT 32
324
 
325
/* The best alignment to use in cases where we have a choice.  */
326
#define FASTEST_ALIGNMENT 32
327
 
328
/* Every structures size must be a multiple of 8 bits.  */
329
#define STRUCTURE_SIZE_BOUNDARY 8
330
 
331
/* Look at the fundamental type that is used for a bit-field and use
332
   that to impose alignment on the enclosing structure.
333
   struct s {int a:8}; should have same alignment as "int", not "char".  */
334
#define PCC_BITFIELD_TYPE_MATTERS       1
335
 
336
/* Largest integer machine mode for structures.  If undefined, the default
337
   is GET_MODE_SIZE(DImode).  */
338
#define MAX_FIXED_MODE_SIZE 32
339
 
340
/* Make strings word-aligned so strcpy from constants will be faster.  */
341
#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
342
  ((TREE_CODE (EXP) == STRING_CST       \
343
    && (ALIGN) < FASTEST_ALIGNMENT)     \
344
   ? FASTEST_ALIGNMENT : (ALIGN))
345
 
346
/* Make arrays of chars word-aligned for the same reasons.  */
347
#define DATA_ALIGNMENT(TYPE, ALIGN)             \
348
  (TREE_CODE (TYPE) == ARRAY_TYPE               \
349
   && TYPE_MODE (TREE_TYPE (TYPE)) == QImode    \
350
   && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
351
 
352
/* Set this nonzero if move instructions will actually fail to work
353
   when given unaligned data.  */
354
#define STRICT_ALIGNMENT 1
355
 
356
/* Generating Code for Profiling */
357
#define FUNCTION_PROFILER(FILE,LABELNO) (abort (), 0)
358
 
359
/* Trampolines for Nested Functions.  */
360
#define TRAMPOLINE_SIZE (2 + 6 + 6 + 2 + 2 + 6)
361
 
362
/* Alignment required for trampolines, in bits.  */
363
#define TRAMPOLINE_ALIGNMENT 32
364
 
365
/* An alias for the machine mode for pointers.  */
366
#define Pmode         SImode
367
 
368
/* An alias for the machine mode used for memory references to
369
   functions being called, in `call' RTL expressions.  */
370
#define FUNCTION_MODE QImode
371
 
372
/* The register number of the stack pointer register, which must also
373
   be a fixed register according to `FIXED_REGISTERS'.  */
374
#define STACK_POINTER_REGNUM MOXIE_SP
375
 
376
/* The register number of the frame pointer register, which is used to
377
   access automatic variables in the stack frame.  */
378
#define FRAME_POINTER_REGNUM MOXIE_QFP
379
 
380
/* The register number of the arg pointer register, which is used to
381
   access the function's argument list.  */
382
#define ARG_POINTER_REGNUM MOXIE_QAP
383
 
384
#define HARD_FRAME_POINTER_REGNUM MOXIE_FP
385
 
386
#define ELIMINABLE_REGS                                                 \
387
{{ FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM },                   \
388
 { ARG_POINTER_REGNUM,   HARD_FRAME_POINTER_REGNUM }}
389
 
390
/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It
391
   specifies the initial difference between the specified pair of
392
   registers.  This macro must be defined if `ELIMINABLE_REGS' is
393
   defined.  */
394
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
395
  do {                                                                  \
396
    (OFFSET) = moxie_initial_elimination_offset ((FROM), (TO));         \
397
  } while (0)
398
 
399
/* A C expression that is nonzero if REGNO is the number of a hard
400
   register in which function arguments are sometimes passed.  */
401
#define FUNCTION_ARG_REGNO_P(r) (r >= MOXIE_R0 && r <= MOXIE_R5)
402
 
403
/* A macro whose definition is the name of the class to which a valid
404
   base register must belong.  A base register is one used in an
405
   address which is the register value plus a displacement.  */
406
#define BASE_REG_CLASS GENERAL_REGS
407
 
408
#define INDEX_REG_CLASS NO_REGS
409
 
410
#define HARD_REGNO_OK_FOR_BASE_P(NUM) \
411
  ((unsigned) (NUM) < FIRST_PSEUDO_REGISTER \
412
   && (REGNO_REG_CLASS(NUM) == GENERAL_REGS \
413
       || (NUM) == HARD_FRAME_POINTER_REGNUM))
414
 
415
/* A C expression which is nonzero if register number NUM is suitable
416
   for use as a base register in operand addresses.  */
417
#ifdef REG_OK_STRICT
418
#define REGNO_OK_FOR_BASE_P(NUM)                 \
419
  (HARD_REGNO_OK_FOR_BASE_P(NUM)                 \
420
   || HARD_REGNO_OK_FOR_BASE_P(reg_renumber[(NUM)]))
421
#else
422
#define REGNO_OK_FOR_BASE_P(NUM)                 \
423
  ((NUM) >= FIRST_PSEUDO_REGISTER || HARD_REGNO_OK_FOR_BASE_P(NUM))
424
#endif
425
 
426
/* A C expression which is nonzero if register number NUM is suitable
427
   for use as an index register in operand addresses.  */
428
#define REGNO_OK_FOR_INDEX_P(NUM) MOXIE_FP
429
 
430
/* The maximum number of bytes that a single instruction can move
431
   quickly between memory and registers or between two memory
432
   locations.  */
433
#define MOVE_MAX 4
434
#define TRULY_NOOP_TRUNCATION(op,ip) 1
435
 
436
/* All load operations zero extend.  */
437
#define LOAD_EXTEND_OP(MEM) ZERO_EXTEND
438
 
439
/* A number, the maximum number of registers that can appear in a
440
   valid memory address.  */
441
#define MAX_REGS_PER_ADDRESS 1
442
 
443
#define TRULY_NOOP_TRUNCATION(op,ip) 1
444
 
445
/* An alias for a machine mode name.  This is the machine mode that
446
   elements of a jump-table should have.  */
447
#define CASE_VECTOR_MODE SImode
448
 
449
/* A C compound statement with a conditional `goto LABEL;' executed
450
   if X (an RTX) is a legitimate memory address on the target machine
451
   for a memory operand of mode MODE.  */
452
#define GO_IF_LEGITIMATE_ADDRESS(MODE,X,LABEL)          \
453
  do {                                                  \
454
    if (GET_CODE(X) == PLUS)                            \
455
      {                                                 \
456
        rtx op1,op2;                                    \
457
        op1 = XEXP(X,0);                         \
458
        op2 = XEXP(X,1);                                \
459
        if (GET_CODE(op1) == REG                        \
460
            && CONSTANT_ADDRESS_P(op2)                  \
461
            && REGNO_OK_FOR_BASE_P(REGNO(op1)))         \
462
          goto LABEL;                                   \
463
      }                                                 \
464
    if (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))   \
465
      goto LABEL;                                       \
466
    if (GET_CODE (X) == SYMBOL_REF                      \
467
        || GET_CODE (X) == LABEL_REF                    \
468
        || GET_CODE (X) == CONST)                       \
469
      goto LABEL;                                       \
470
  } while (0)
471
 
472
/* Run-time Target Specification */
473
 
474
#define TARGET_CPU_CPP_BUILTINS() \
475
  { \
476
    builtin_define_std ("moxie");               \
477
    builtin_define_std ("MOXIE");               \
478
  }
479
 
480
#define HAS_LONG_UNCOND_BRANCH true
481
 
482
#endif /* GCC_MOXIE_H */

powered by: WebSVN 2.1.0

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