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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 709 jeremybenn
/*{{{  Comment.  */
2
 
3
/* Definitions of FR30 target.
4
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007, 2008, 2009, 2010,
5
   2011 Free Software Foundation, Inc.
6
   Contributed by Cygnus Solutions.
7
 
8
This file is part of GCC.
9
 
10
GCC is free software; you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation; either version 3, or (at your option)
13
any later version.
14
 
15
GCC is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
GNU General Public License for more details.
19
 
20
You should have received a copy of the GNU General Public License
21
along with GCC; see the file COPYING3.  If not see
22
<http://www.gnu.org/licenses/>.  */
23
 
24
/*}}}*/ 
25
/*{{{  Run-time target specifications.  */
26
 
27
#undef  ASM_SPEC
28
#define ASM_SPEC ""
29
 
30
/* Define this to be a string constant containing `-D' options to define the
31
   predefined macros that identify this machine and system.  These macros will
32
   be predefined unless the `-ansi' option is specified.  */
33
 
34
#define TARGET_CPU_CPP_BUILTINS()               \
35
  do                                            \
36
    {                                           \
37
      builtin_define_std ("fr30");              \
38
      builtin_assert ("machine=fr30");          \
39
    }                                           \
40
   while (0)
41
 
42
#undef  STARTFILE_SPEC
43
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
44
 
45
/* Include the OS stub library, so that the code can be simulated.
46
   This is not the right way to do this.  Ideally this kind of thing
47
   should be done in the linker script - but I have not worked out how
48
   to specify the location of a linker script in a gcc command line yet... */
49
#undef  ENDFILE_SPEC
50
#define ENDFILE_SPEC  "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
51
 
52
#undef  LIB_SPEC
53
#define LIB_SPEC "-lc"
54
 
55
#undef  LINK_SPEC
56
#define LINK_SPEC "%{h*} %{v:-V} \
57
                   %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic}"
58
 
59
/*}}}*/ 
60
/*{{{  Storage Layout.  */
61
 
62
#define BITS_BIG_ENDIAN 1
63
 
64
#define BYTES_BIG_ENDIAN 1
65
 
66
#define WORDS_BIG_ENDIAN 1
67
 
68
#define UNITS_PER_WORD  4
69
 
70
#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)       \
71
  do                                            \
72
    {                                           \
73
      if (GET_MODE_CLASS (MODE) == MODE_INT     \
74
          && GET_MODE_SIZE (MODE) < 4)          \
75
        (MODE) = SImode;                        \
76
    }                                           \
77
  while (0)
78
 
79
#define PARM_BOUNDARY 32
80
 
81
#define STACK_BOUNDARY 32
82
 
83
#define FUNCTION_BOUNDARY 32
84
 
85
#define BIGGEST_ALIGNMENT 32
86
 
87
#define DATA_ALIGNMENT(TYPE, ALIGN)             \
88
  (TREE_CODE (TYPE) == ARRAY_TYPE               \
89
   && TYPE_MODE (TREE_TYPE (TYPE)) == QImode    \
90
   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
91
 
92
#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
93
  (TREE_CODE (EXP) == STRING_CST        \
94
   && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
95
 
96
#define STRICT_ALIGNMENT 1
97
 
98
#define PCC_BITFIELD_TYPE_MATTERS 1
99
 
100
/*}}}*/ 
101
/*{{{  Layout of Source Language Data Types.  */
102
 
103
#define SHORT_TYPE_SIZE         16
104
#define INT_TYPE_SIZE           32
105
#define LONG_TYPE_SIZE          32
106
#define LONG_LONG_TYPE_SIZE     64
107
#define FLOAT_TYPE_SIZE         32
108
#define DOUBLE_TYPE_SIZE        64
109
#define LONG_DOUBLE_TYPE_SIZE   64
110
 
111
#define DEFAULT_SIGNED_CHAR 1
112
 
113
#undef  SIZE_TYPE
114
#define SIZE_TYPE "unsigned int"
115
 
116
#undef  PTRDIFF_TYPE
117
#define PTRDIFF_TYPE "int"
118
 
119
#undef  WCHAR_TYPE
120
#define WCHAR_TYPE "long int"
121
 
122
#undef  WCHAR_TYPE_SIZE
123
#define WCHAR_TYPE_SIZE BITS_PER_WORD
124
 
125
/*}}}*/ 
126
/*{{{  REGISTER BASICS.  */
127
 
128
/* Number of hardware registers known to the compiler.  They receive numbers 0
129
   through `FIRST_PSEUDO_REGISTER-1'; thus, the first pseudo register's number
130
   really is assigned the number `FIRST_PSEUDO_REGISTER'.  */
131
#define FIRST_PSEUDO_REGISTER   21
132
 
133
/* Fixed register assignments: */
134
 
135
/* Here we do a BAD THING - reserve a register for use by the machine
136
   description file.  There are too many places in compiler where it
137
   assumes that it can issue a branch or jump instruction without
138
   providing a scratch register for it, and reload just cannot cope, so
139
   we keep a register back for these situations.  */
140
#define COMPILER_SCRATCH_REGISTER 0
141
 
142
/* The register that contains the result of a function call.  */
143
#define RETURN_VALUE_REGNUM      4
144
 
145
/* The first register that can contain the arguments to a function.  */
146
#define FIRST_ARG_REGNUM         4
147
 
148
/* A call-used register that can be used during the function prologue.  */
149
#define PROLOGUE_TMP_REGNUM      COMPILER_SCRATCH_REGISTER
150
 
151
/* Register numbers used for passing a function's static chain pointer.  If
152
   register windows are used, the register number as seen by the called
153
   function is `STATIC_CHAIN_INCOMING_REGNUM', while the register number as
154
   seen by the calling function is `STATIC_CHAIN_REGNUM'.  If these registers
155
   are the same, `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
156
 
157
   The static chain register need not be a fixed register.
158
 
159
   If the static chain is passed in memory, these macros should not be defined;
160
   instead, the next two macros should be defined.  */
161
#define STATIC_CHAIN_REGNUM     12
162
/* #define STATIC_CHAIN_INCOMING_REGNUM */
163
 
164
/* An FR30 specific hardware register.  */
165
#define ACCUMULATOR_REGNUM      13
166
 
167
/* The register number of the frame pointer register, which is used to access
168
   automatic variables in the stack frame.  On some machines, the hardware
169
   determines which register this is.  On other machines, you can choose any
170
   register you wish for this purpose.  */
171
#define FRAME_POINTER_REGNUM    14
172
 
173
/* The register number of the stack pointer register, which must also be a
174
   fixed register according to `FIXED_REGISTERS'.  On most machines, the
175
   hardware determines which register this is.  */
176
#define STACK_POINTER_REGNUM    15
177
 
178
/* The following a fake hard registers that describe some of the dedicated
179
   registers on the FR30.  */
180
#define CONDITION_CODE_REGNUM   16
181
#define RETURN_POINTER_REGNUM   17
182
#define MD_HIGH_REGNUM          18
183
#define MD_LOW_REGNUM           19
184
 
185
/* An initializer that says which registers are used for fixed purposes all
186
   throughout the compiled code and are therefore not available for general
187
   allocation.  These would include the stack pointer, the frame pointer
188
   (except on machines where that can be used as a general register when no
189
   frame pointer is needed), the program counter on machines where that is
190
   considered one of the addressable registers, and any other numbered register
191
   with a standard use.
192
 
193
   This information is expressed as a sequence of numbers, separated by commas
194
   and surrounded by braces.  The Nth number is 1 if register N is fixed, 0
195
   otherwise.
196
 
197
   The table initialized from this macro, and the table initialized by the
198
   following one, may be overridden at run time either automatically, by the
199
   actions of the macro `TARGET_CONDITIONAL_REGISTER_USAGE', or by the user
200
   with the command options `-ffixed-REG', `-fcall-used-REG' and
201
   `-fcall-saved-REG'.  */
202
#define FIXED_REGISTERS                         \
203
  { 1, 0, 0, 0, 0, 0, 0, 0,     /*  0 -  7 */   \
204
    0, 0, 0, 0, 0, 0, 0, 1,     /*  8 - 15 */   \
205
    1, 1, 1, 1, 1 }             /* 16 - 20 */
206
 
207
/* XXX - MDL and MDH set as fixed for now - this is until I can get the
208
   mul patterns working.  */
209
 
210
/* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
211
   general) by function calls as well as for fixed registers.  This macro
212
   therefore identifies the registers that are not available for general
213
   allocation of values that must live across function calls.
214
 
215
   If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically
216
   saves it on function entry and restores it on function exit, if the register
217
   is used within the function.  */
218
#define CALL_USED_REGISTERS                     \
219
  { 1, 1, 1, 1, 1, 1, 1, 1,     /*  0 -  7 */   \
220
    0, 0, 0, 0, 1, 1, 0, 1,     /*  8 - 15 */   \
221
    1, 1, 1, 1, 1 }             /* 16 - 20 */
222
 
223
/* A C initializer containing the assembler's names for the machine registers,
224
   each one as a C string constant.  This is what translates register numbers
225
   in the compiler into assembler language.  */
226
#define REGISTER_NAMES                                          \
227
{   "r0", "r1", "r2",  "r3",  "r4",  "r5", "r6", "r7",  \
228
    "r8", "r9", "r10", "r11", "r12", "ac", "fp", "sp",  \
229
    "cc", "rp", "mdh", "mdl", "ap"                      \
230
}
231
 
232
/* If defined, a C initializer for an array of structures containing a name and
233
   a register number.  This macro defines additional names for hard registers,
234
   thus allowing the `asm' option in declarations to refer to registers using
235
   alternate names.  */
236
#define ADDITIONAL_REGISTER_NAMES                               \
237
{                                                               \
238
  {"r13", 13}, {"r14", 14}, {"r15", 15}, {"usp", 15}, {"ps", 16}\
239
}
240
 
241
/*}}}*/ 
242
/*{{{  How Values Fit in Registers.  */
243
 
244
/* A C expression for the number of consecutive hard registers, starting at
245
   register number REGNO, required to hold a value of mode MODE.  */
246
 
247
#define HARD_REGNO_NREGS(REGNO, MODE)                   \
248
  ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
249
 
250
/* A C expression that is nonzero if it is permissible to store a value of mode
251
   MODE in hard register number REGNO (or in several registers starting with
252
   that one).  */
253
 
254
#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
255
 
256
/* A C expression that is nonzero if it is desirable to choose register
257
   allocation so as to avoid move instructions between a value of mode MODE1
258
   and a value of mode MODE2.
259
 
260
   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
261
   ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
262
   zero.  */
263
#define MODES_TIEABLE_P(MODE1, MODE2) 1
264
 
265
/*}}}*/ 
266
/*{{{  Register Classes.  */
267
 
268
/* An enumeral type that must be defined with all the register class names as
269
   enumeral values.  `NO_REGS' must be first.  `ALL_REGS' must be the last
270
   register class, followed by one more enumeral value, `LIM_REG_CLASSES',
271
   which is not a register class but rather tells how many classes there are.
272
 
273
   Each register class has a number, which is the value of casting the class
274
   name to type `int'.  The number serves as an index in many of the tables
275
   described below.  */
276
enum reg_class
277
{
278
  NO_REGS,
279
  MULTIPLY_32_REG,      /* the MDL register as used by the MULH, MULUH insns */
280
  MULTIPLY_64_REG,      /* the MDH,MDL register pair as used by MUL and MULU */
281
  LOW_REGS,             /* registers 0 through 7 */
282
  HIGH_REGS,            /* registers 8 through 15 */
283
  REAL_REGS,            /* i.e. all the general hardware registers on the FR30 */
284
  ALL_REGS,
285
  LIM_REG_CLASSES
286
};
287
 
288
#define GENERAL_REGS    REAL_REGS
289
#define N_REG_CLASSES   ((int) LIM_REG_CLASSES)
290
 
291
/* An initializer containing the names of the register classes as C string
292
   constants.  These names are used in writing some of the debugging dumps.  */
293
#define REG_CLASS_NAMES \
294
{                       \
295
  "NO_REGS",            \
296
  "MULTIPLY_32_REG",    \
297
  "MULTIPLY_64_REG",    \
298
  "LOW_REGS",           \
299
  "HIGH_REGS",          \
300
  "REAL_REGS",          \
301
  "ALL_REGS"            \
302
 }
303
 
304
/* An initializer containing the contents of the register classes, as integers
305
   which are bit masks.  The Nth integer specifies the contents of class N.
306
   The way the integer MASK is interpreted is that register R is in the class
307
   if `MASK & (1 << R)' is 1.
308
 
309
   When the machine has more than 32 registers, an integer does not suffice.
310
   Then the integers are replaced by sub-initializers, braced groupings
311
   containing several integers.  Each sub-initializer must be suitable as an
312
   initializer for the type `HARD_REG_SET' which is defined in
313
   `hard-reg-set.h'.  */
314
#define REG_CLASS_CONTENTS                              \
315
{                                                       \
316
  { 0 },                                                \
317
  { 1 << MD_LOW_REGNUM },                               \
318
  { (1 << MD_LOW_REGNUM) | (1 << MD_HIGH_REGNUM) },     \
319
  { (1 << 8) - 1 },                                     \
320
  { ((1 << 8) - 1) << 8 },                              \
321
  { (1 << CONDITION_CODE_REGNUM) - 1 },                 \
322
  { (1 << FIRST_PSEUDO_REGISTER) - 1 }                  \
323
}
324
 
325
/* A C expression whose value is a register class containing hard register
326
   REGNO.  In general there is more than one such class; choose a class which
327
   is "minimal", meaning that no smaller class also contains the register.  */
328
#define REGNO_REG_CLASS(REGNO)                  \
329
  ( (REGNO) < 8 ? LOW_REGS                      \
330
  : (REGNO) < CONDITION_CODE_REGNUM ? HIGH_REGS \
331
  : (REGNO) == MD_LOW_REGNUM ? MULTIPLY_32_REG  \
332
  : (REGNO) == MD_HIGH_REGNUM ? MULTIPLY_64_REG \
333
  : ALL_REGS)
334
 
335
/* A macro whose definition is the name of the class to which a valid base
336
   register must belong.  A base register is one used in an address which is
337
   the register value plus a displacement.  */
338
#define BASE_REG_CLASS  REAL_REGS
339
 
340
/* A macro whose definition is the name of the class to which a valid index
341
   register must belong.  An index register is one used in an address where its
342
   value is either multiplied by a scale factor or added to another register
343
   (as well as added to a displacement).  */
344
#define INDEX_REG_CLASS REAL_REGS
345
 
346
/* A C expression which is nonzero if register number NUM is suitable for use
347
   as a base register in operand addresses.  It may be either a suitable hard
348
   register or a pseudo register that has been allocated such a hard register.  */
349
#define REGNO_OK_FOR_BASE_P(NUM) 1
350
 
351
/* A C expression which is nonzero if register number NUM is suitable for use
352
   as an index register in operand addresses.  It may be either a suitable hard
353
   register or a pseudo register that has been allocated such a hard register.
354
 
355
   The difference between an index register and a base register is that the
356
   index register may be scaled.  If an address involves the sum of two
357
   registers, neither one of them scaled, then either one may be labeled the
358
   "base" and the other the "index"; but whichever labeling is used must fit
359
   the machine's constraints of which registers may serve in each capacity.
360
   The compiler will try both labelings, looking for one that is valid, and
361
   will reload one or both registers only if neither labeling works.  */
362
#define REGNO_OK_FOR_INDEX_P(NUM) 1
363
 
364
/* A C expression for the maximum number of consecutive registers of
365
   class CLASS needed to hold a value of mode MODE.
366
 
367
   This is closely related to the macro `HARD_REGNO_NREGS'.  In fact, the value
368
   of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be the maximum value of
369
   `HARD_REGNO_NREGS (REGNO, MODE)' for all REGNO values in the class CLASS.
370
 
371
   This macro helps control the handling of multiple-word values in
372
   the reload pass.  */
373
#define CLASS_MAX_NREGS(CLASS, MODE) HARD_REGNO_NREGS (0, MODE)
374
 
375
/*}}}*/ 
376
/*{{{  Basic Stack Layout.  */
377
 
378
/* Define this macro if pushing a word onto the stack moves the stack pointer
379
   to a smaller address.  */
380
#define STACK_GROWS_DOWNWARD 1
381
 
382
/* Define this to macro nonzero if the addresses of local variable slots
383
   are at negative offsets from the frame pointer.  */
384
#define FRAME_GROWS_DOWNWARD 1
385
 
386
/* Offset from the frame pointer to the first local variable slot to be
387
   allocated.
388
 
389
   If `FRAME_GROWS_DOWNWARD', find the next slot's offset by subtracting the
390
   first slot's length from `STARTING_FRAME_OFFSET'.  Otherwise, it is found by
391
   adding the length of the first slot to the value `STARTING_FRAME_OFFSET'.  */
392
/* #define STARTING_FRAME_OFFSET -4 */
393
#define STARTING_FRAME_OFFSET 0
394
 
395
/* Offset from the stack pointer register to the first location at which
396
   outgoing arguments are placed.  If not specified, the default value of zero
397
   is used.  This is the proper value for most machines.
398
 
399
   If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
400
   location at which outgoing arguments are placed.  */
401
#define STACK_POINTER_OFFSET 0
402
 
403
/* Offset from the argument pointer register to the first argument's address.
404
   On some machines it may depend on the data type of the function.
405
 
406
   If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
407
   argument's address.  */
408
#define FIRST_PARM_OFFSET(FUNDECL) 0
409
 
410
/* A C expression whose value is RTL representing the location of the incoming
411
   return address at the beginning of any function, before the prologue.  This
412
   RTL is either a `REG', indicating that the return value is saved in `REG',
413
   or a `MEM' representing a location in the stack.
414
 
415
   You only need to define this macro if you want to support call frame
416
   debugging information like that provided by DWARF 2.  */
417
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, RETURN_POINTER_REGNUM)
418
 
419
/*}}}*/ 
420
/*{{{  Register That Address the Stack Frame.  */
421
 
422
/* The register number of the arg pointer register, which is used to access the
423
   function's argument list.  On some machines, this is the same as the frame
424
   pointer register.  On some machines, the hardware determines which register
425
   this is.  On other machines, you can choose any register you wish for this
426
   purpose.  If this is not the same register as the frame pointer register,
427
   then you must mark it as a fixed register according to `FIXED_REGISTERS', or
428
   arrange to be able to eliminate it.  */
429
#define ARG_POINTER_REGNUM 20
430
 
431
/*}}}*/ 
432
/*{{{  Eliminating the Frame Pointer and the Arg Pointer.  */
433
 
434
/* If defined, this macro specifies a table of register pairs used to eliminate
435
   unneeded registers that point into the stack frame.  If it is not defined,
436
   the only elimination attempted by the compiler is to replace references to
437
   the frame pointer with references to the stack pointer.
438
 
439
   The definition of this macro is a list of structure initializations, each of
440
   which specifies an original and replacement register.
441
 
442
   On some machines, the position of the argument pointer is not known until
443
   the compilation is completed.  In such a case, a separate hard register must
444
   be used for the argument pointer.  This register can be eliminated by
445
   replacing it with either the frame pointer or the argument pointer,
446
   depending on whether or not the frame pointer has been eliminated.
447
 
448
   In this case, you might specify:
449
        #define ELIMINABLE_REGS  \
450
        {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
451
         {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
452
         {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
453
 
454
   Note that the elimination of the argument pointer with the stack pointer is
455
   specified first since that is the preferred elimination.  */
456
 
457
#define ELIMINABLE_REGS                         \
458
{                                               \
459
  {ARG_POINTER_REGNUM,   STACK_POINTER_REGNUM}, \
460
  {ARG_POINTER_REGNUM,   FRAME_POINTER_REGNUM}, \
461
  {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}  \
462
}
463
 
464
/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It specifies the
465
   initial difference between the specified pair of registers.  This macro must
466
   be defined if `ELIMINABLE_REGS' is defined.  */
467
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
468
     (OFFSET) = fr30_compute_frame_size (FROM, TO)
469
 
470
/*}}}*/ 
471
/*{{{  Passing Function Arguments on the Stack.  */
472
 
473
/* If defined, the maximum amount of space required for outgoing arguments will
474
   be computed and placed into the variable
475
   `crtl->outgoing_args_size'.  No space will be pushed onto the
476
   stack for each call; instead, the function prologue should increase the
477
   stack frame size by this amount.
478
 
479
   Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is not
480
   proper.  */
481
#define ACCUMULATE_OUTGOING_ARGS 1
482
 
483
/*}}}*/ 
484
/*{{{  Function Arguments in Registers.  */
485
 
486
/* The number of register assigned to holding function arguments.  */
487
 
488
#define FR30_NUM_ARG_REGS        4
489
 
490
/* A C type for declaring a variable that is used as the first argument of
491
   `FUNCTION_ARG' and other related values.  For some target machines, the type
492
   `int' suffices and can hold the number of bytes of argument so far.
493
 
494
   There is no need to record in `CUMULATIVE_ARGS' anything about the arguments
495
   that have been passed on the stack.  The compiler has other variables to
496
   keep track of that.  For target machines on which all arguments are passed
497
   on the stack, there is no need to store anything in `CUMULATIVE_ARGS';
498
   however, the data structure must exist and should not be empty, so use
499
   `int'.  */
500
/* On the FR30 this value is an accumulating count of the number of argument
501
   registers that have been filled with argument values, as opposed to say,
502
   the number of bytes of argument accumulated so far.  */
503
#define CUMULATIVE_ARGS int
504
 
505
/* A C statement (sans semicolon) for initializing the variable CUM for the
506
   state at the beginning of the argument list.  The variable has type
507
   `CUMULATIVE_ARGS'.  The value of FNTYPE is the tree node for the data type
508
   of the function which will receive the args, or 0 if the args are to a
509
   compiler support library function.  The value of INDIRECT is nonzero when
510
   processing an indirect call, for example a call through a function pointer.
511
   The value of INDIRECT is zero for a call to an explicitly named function, a
512
   library function call, or when `INIT_CUMULATIVE_ARGS' is used to find
513
   arguments for the function being compiled.
514
 
515
   When processing a call to a compiler support library function, LIBNAME
516
   identifies which one.  It is a `symbol_ref' rtx which contains the name of
517
   the function, as a string.  LIBNAME is 0 when an ordinary C function call is
518
   being processed.  Thus, each time this macro is called, either LIBNAME or
519
   FNTYPE is nonzero, but never both of them at once.  */
520
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
521
  (CUM) = 0
522
 
523
/* A C expression that is nonzero if REGNO is the number of a hard register in
524
   which function arguments are sometimes passed.  This does *not* include
525
   implicit arguments such as the static chain and the structure-value address.
526
   On many machines, no registers can be used for this purpose since all
527
   function arguments are pushed on the stack.  */
528
#define FUNCTION_ARG_REGNO_P(REGNO) \
529
  ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) < FIRST_ARG_REGNUM + FR30_NUM_ARG_REGS))
530
 
531
/*}}}*/ 
532
/*{{{  How Large Values are Returned.  */
533
 
534
/* Define this macro to be 1 if all structure and union return values must be
535
   in memory.  Since this results in slower code, this should be defined only
536
   if needed for compatibility with other compilers or with an ABI.  If you
537
   define this macro to be 0, then the conventions used for structure and union
538
   return values are decided by the `TARGET_RETURN_IN_MEMORY' macro.
539
 
540
   If not defined, this defaults to the value 1.  */
541
#define DEFAULT_PCC_STRUCT_RETURN 1
542
 
543
/*}}}*/ 
544
/*{{{  Generating Code for Profiling.  */
545
 
546
/* A C statement or compound statement to output to FILE some assembler code to
547
   call the profiling subroutine `mcount'.  Before calling, the assembler code
548
   must load the address of a counter variable into a register where `mcount'
549
   expects to find the address.  The name of this variable is `LP' followed by
550
   the number LABELNO, so you would generate the name using `LP%d' in a
551
   `fprintf'.
552
 
553
   The details of how the address should be passed to `mcount' are determined
554
   by your operating system environment, not by GCC.  To figure them out,
555
   compile a small program for profiling using the system's installed C
556
   compiler and look at the assembler code that results.  */
557
#define FUNCTION_PROFILER(FILE, LABELNO)        \
558
{                                               \
559
  fprintf (FILE, "\t mov rp, r1\n" );           \
560
  fprintf (FILE, "\t ldi:32 mcount, r0\n" );    \
561
  fprintf (FILE, "\t call @r0\n" );             \
562
  fprintf (FILE, ".word\tLP%d\n", LABELNO);     \
563
}
564
 
565
/*}}}*/ 
566
/*{{{  Trampolines for Nested Functions.  */
567
 
568
/* A C expression for the size in bytes of the trampoline, as an integer.  */
569
#define TRAMPOLINE_SIZE 18
570
 
571
/* We want the trampoline to be aligned on a 32bit boundary so that we can
572
   make sure the location of the static chain & target function within
573
   the trampoline is also aligned on a 32bit boundary.  */
574
#define TRAMPOLINE_ALIGNMENT 32
575
 
576
/*}}}*/ 
577
/*{{{  Addressing Modes.  */
578
 
579
/* A number, the maximum number of registers that can appear in a valid memory
580
   address.  Note that it is up to you to specify a value equal to the maximum
581
   number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept.  */
582
#define MAX_REGS_PER_ADDRESS 1
583
 
584
/* A C compound statement with a conditional `goto LABEL;' executed if X (an
585
   RTX) is a legitimate memory address on the target machine for a memory
586
   operand of mode MODE.  */
587
 
588
/* On the FR30 we only have one real addressing mode - an address in a
589
   register.  There are three special cases however:
590
 
591
   * indexed addressing using small positive offsets from the stack pointer
592
 
593
   * indexed addressing using small signed offsets from the frame pointer
594
 
595
   * register plus register addressing using R13 as the base register.
596
 
597
   At the moment we only support the first two of these special cases.  */
598
 
599
#ifdef REG_OK_STRICT
600
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                        \
601
  do                                                                    \
602
    {                                                                   \
603
      if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                 \
604
        goto LABEL;                                                     \
605
      if (GET_CODE (X) == PLUS                                          \
606
          && ((MODE) == SImode || (MODE) == SFmode)                     \
607
          && GET_CODE (XEXP (X, 0)) == REG                              \
608
          && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM                \
609
          && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
610
          && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))         \
611
        goto LABEL;                                                     \
612
      if (GET_CODE (X) == PLUS                                          \
613
          && ((MODE) == SImode || (MODE) == SFmode)                     \
614
          && GET_CODE (XEXP (X, 0)) == REG                              \
615
          && REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM                \
616
          && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
617
          && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4)) \
618
        goto LABEL;                                                     \
619
    }                                                                   \
620
  while (0)
621
#else
622
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                        \
623
  do                                                                    \
624
    {                                                                   \
625
      if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                 \
626
        goto LABEL;                                                     \
627
      if (GET_CODE (X) == PLUS                                          \
628
          && ((MODE) == SImode || (MODE) == SFmode)                     \
629
          && GET_CODE (XEXP (X, 0)) == REG                              \
630
          && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM                \
631
          && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
632
          && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))         \
633
        goto LABEL;                                                     \
634
      if (GET_CODE (X) == PLUS                                          \
635
          && ((MODE) == SImode || (MODE) == SFmode)                     \
636
          && GET_CODE (XEXP (X, 0)) == REG                              \
637
          && (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM               \
638
              || REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM)             \
639
          && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
640
          && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4)) \
641
        goto LABEL;                                                     \
642
    }                                                                   \
643
  while (0)
644
#endif
645
 
646
/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
647
   use as a base register.  For hard registers, it should always accept those
648
   which the hardware permits and reject the others.  Whether the macro accepts
649
   or rejects pseudo registers must be controlled by `REG_OK_STRICT' as
650
   described above.  This usually requires two variant definitions, of which
651
   `REG_OK_STRICT' controls the one actually used.  */
652
#ifdef REG_OK_STRICT
653
#define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) <= STACK_POINTER_REGNUM)
654
#else
655
#define REG_OK_FOR_BASE_P(X) 1
656
#endif
657
 
658
/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
659
   use as an index register.
660
 
661
   The difference between an index register and a base register is that the
662
   index register may be scaled.  If an address involves the sum of two
663
   registers, neither one of them scaled, then either one may be labeled the
664
   "base" and the other the "index"; but whichever labeling is used must fit
665
   the machine's constraints of which registers may serve in each capacity.
666
   The compiler will try both labelings, looking for one that is valid, and
667
   will reload one or both registers only if neither labeling works.  */
668
#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
669
 
670
/*}}}*/ 
671
/*{{{  Describing Relative Costs of Operations */
672
 
673
/* Define this macro as a C expression which is nonzero if accessing less than
674
   a word of memory (i.e. a `char' or a `short') is no faster than accessing a
675
   word of memory, i.e., if such access require more than one instruction or if
676
   there is no difference in cost between byte and (aligned) word loads.
677
 
678
   When this macro is not defined, the compiler will access a field by finding
679
   the smallest containing object; when it is defined, a fullword load will be
680
   used if alignment permits.  Unless bytes accesses are faster than word
681
   accesses, using word accesses is preferable since it may eliminate
682
   subsequent memory access if subsequent accesses occur to other fields in the
683
   same word of the structure, but to different bytes.  */
684
#define SLOW_BYTE_ACCESS 1
685
 
686
/*}}}*/ 
687
/*{{{  Dividing the output into sections.  */
688
 
689
/* A C expression whose value is a string containing the assembler operation
690
   that should precede instructions and read-only data.  Normally `".text"' is
691
   right.  */
692
#define TEXT_SECTION_ASM_OP "\t.text"
693
 
694
/* A C expression whose value is a string containing the assembler operation to
695
   identify the following data as writable initialized data.  Normally
696
   `".data"' is right.  */
697
#define DATA_SECTION_ASM_OP "\t.data"
698
 
699
#define BSS_SECTION_ASM_OP "\t.section .bss"
700
 
701
/*}}}*/ 
702
/*{{{  The Overall Framework of an Assembler File.  */
703
 
704
/* A C string constant describing how to begin a comment in the target
705
   assembler language.  The compiler assumes that the comment will end at the
706
   end of the line.  */
707
#define ASM_COMMENT_START ";"
708
 
709
/* A C string constant for text to be output before each `asm' statement or
710
   group of consecutive ones.  Normally this is `"#APP"', which is a comment
711
   that has no effect on most assemblers but tells the GNU assembler that it
712
   must check the lines that follow for all valid assembler constructs.  */
713
#define ASM_APP_ON "#APP\n"
714
 
715
/* A C string constant for text to be output after each `asm' statement or
716
   group of consecutive ones.  Normally this is `"#NO_APP"', which tells the
717
   GNU assembler to resume making the time-saving assumptions that are valid
718
   for ordinary compiler output.  */
719
#define ASM_APP_OFF "#NO_APP\n"
720
 
721
/*}}}*/ 
722
/*{{{  Output and Generation of Labels.  */
723
 
724
/* Globalizing directive for a label.  */
725
#define GLOBAL_ASM_OP "\t.globl "
726
 
727
/*}}}*/ 
728
/*{{{  Output of Assembler Instructions.  */
729
 
730
/* A C compound statement to output to stdio stream STREAM the assembler syntax
731
   for an instruction operand X.  X is an RTL expression.
732
 
733
   CODE is a value that can be used to specify one of several ways of printing
734
   the operand.  It is used when identical operands must be printed differently
735
   depending on the context.  CODE comes from the `%' specification that was
736
   used to request printing of the operand.  If the specification was just
737
   `%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is
738
   the ASCII code for LTR.
739
 
740
   If X is a register, this macro should print the register's name.  The names
741
   can be found in an array `reg_names' whose type is `char *[]'.  `reg_names'
742
   is initialized from `REGISTER_NAMES'.
743
 
744
   When the machine description has a specification `%PUNCT' (a `%' followed by
745
   a punctuation character), this macro is called with a null pointer for X and
746
   the punctuation character for CODE.  */
747
#define PRINT_OPERAND(STREAM, X, CODE)  fr30_print_operand (STREAM, X, CODE)
748
 
749
/* A C expression which evaluates to true if CODE is a valid punctuation
750
   character for use in the `PRINT_OPERAND' macro.  If
751
   `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation
752
   characters (except for the standard one, `%') are used in this way.  */
753
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#')
754
 
755
/* A C compound statement to output to stdio stream STREAM the assembler syntax
756
   for an instruction operand that is a memory reference whose address is X.  X
757
   is an RTL expression.  */
758
 
759
#define PRINT_OPERAND_ADDRESS(STREAM, X) fr30_print_operand_address (STREAM, X)
760
 
761
#define REGISTER_PREFIX "%"
762
#define LOCAL_LABEL_PREFIX "."
763
#define USER_LABEL_PREFIX ""
764
#define IMMEDIATE_PREFIX ""
765
 
766
/*}}}*/ 
767
/*{{{  Output of Dispatch Tables.  */
768
 
769
/* This macro should be provided on machines where the addresses in a dispatch
770
   table are relative to the table's own address.
771
 
772
   The definition should be a C statement to output to the stdio stream STREAM
773
   an assembler pseudo-instruction to generate a difference between two labels.
774
   VALUE and REL are the numbers of two internal labels.  The definitions of
775
   these labels are output using `(*targetm.asm_out.internal_label)', and they must be
776
   printed in the same way here.  For example,
777
 
778
        fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL)  */
779
#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
780
fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
781
 
782
/* This macro should be provided on machines where the addresses in a dispatch
783
   table are absolute.
784
 
785
   The definition should be a C statement to output to the stdio stream STREAM
786
   an assembler pseudo-instruction to generate a reference to a label.  VALUE
787
   is the number of an internal label whose definition is output using
788
   `(*targetm.asm_out.internal_label)'.  For example,
789
 
790
        fprintf (STREAM, "\t.word L%d\n", VALUE)  */
791
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
792
fprintf (STREAM, "\t.word .L%d\n", VALUE)
793
 
794
/*}}}*/ 
795
/*{{{  Assembler Commands for Alignment.  */
796
 
797
/* A C statement to output to the stdio stream STREAM an assembler command to
798
   advance the location counter to a multiple of 2 to the POWER bytes.  POWER
799
   will be a C expression of type `int'.  */
800
#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
801
  fprintf ((STREAM), "\t.p2align %d\n", (POWER))
802
 
803
/*}}}*/ 
804
/*{{{  Miscellaneous Parameters.  */
805
 
806
/* An alias for a machine mode name.  This is the machine mode that elements of
807
   a jump-table should have.  */
808
#define CASE_VECTOR_MODE SImode
809
 
810
/* The maximum number of bytes that a single instruction can move quickly from
811
   memory to memory.  */
812
#define MOVE_MAX 8
813
 
814
/* A C expression which is nonzero if on this machine it is safe to "convert"
815
   an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
816
   than INPREC) by merely operating on it as if it had only OUTPREC bits.
817
 
818
   On many machines, this expression can be 1.
819
 
820
   When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for
821
   which `MODES_TIEABLE_P' is 0, suboptimal code can result.  If this is the
822
   case, making `TRULY_NOOP_TRUNCATION' return 0 in such cases may improve
823
   things.  */
824
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
825
 
826
/* An alias for the machine mode for pointers.  On most machines, define this
827
   to be the integer mode corresponding to the width of a hardware pointer;
828
   `SImode' on 32-bit machine or `DImode' on 64-bit machines.  On some machines
829
   you must define this to be one of the partial integer modes, such as
830
   `PSImode'.
831
 
832
   The width of `Pmode' must be at least as large as the value of
833
   `POINTER_SIZE'.  If it is not equal, you must define the macro
834
   `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to `Pmode'.  */
835
#define Pmode SImode
836
 
837
/* An alias for the machine mode used for memory references to functions being
838
   called, in `call' RTL expressions.  On most machines this should be
839
   `QImode'.  */
840
#define FUNCTION_MODE QImode
841
 
842
/*}}}*/ 
843
 
844
/* Local Variables: */
845
/* folded-file: t   */
846
/* End:             */

powered by: WebSVN 2.1.0

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