OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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

Line No. Rev Author Line
1 38 julius
/* Definitions of target machine for GNU compiler.  OpenRISC 1000 version.
2
   Copyright (C) 1987, 1988, 1992, 1995, 1996, 1999, 2000, 2001, 2002,
3
   2003, 2004, 2005 Free Software Foundation, Inc.
4
   Contributed by Damjan Lampret <damjanl@bsemi.com> in 1999.
5
   Major optimizations by Matjaz Breskvar <matjazb@bsemi.com> in 2005.
6
 
7
This file is part of GNU CC.
8
 
9
GNU CC is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 1, or (at your option)
12
any later version.
13
 
14
GNU CC is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
GNU General Public License for more details.
18
 
19
You should have received a copy of the GNU General Public License
20
along with GNU CC; see the file COPYING.  If not, write to
21
the Free Software Foundation, 59 Temple Place - Suite 330,
22
Boston, MA 02111-1307, USA.  */
23
 
24
#ifndef _OR32_H_
25
#define _OR32_H_
26
 
27
/* Target CPU builtins */
28
#define TARGET_CPU_CPP_BUILTINS()               \
29
  do                                            \
30
    {                                           \
31
      builtin_define_std ("OR32");              \
32
      builtin_define_std ("or32");              \
33
      builtin_assert ("cpu=or32");              \
34
      builtin_assert ("machine=or32");          \
35
    }                                           \
36
  while (0)
37
 
38 152 jeremybenn
 
39 199 jeremybenn
/* A string corresponding to the installation directory for target libraries
40
   and includes. Make it available to SPEC definitions via EXTRA_SPECS */
41
#define CONC_DIR(dir1, dir2) dir1 "/../../" dir2
42
#define TARGET_PREFIX CONC_DIR (STANDARD_EXEC_PREFIX, DEFAULT_TARGET_MACHINE)
43
 
44
#define EXTRA_SPECS                                   \
45
  { "target_prefix", TARGET_PREFIX }
46
 
47
#undef CPP_SPEC
48
#define CPP_SPEC "%{mor32-newlib*:-I%(target_prefix)/newlib-include}"
49
 
50 177 jeremybenn
/* Make sure we pick up the crtinit.o and crtfini.o files. */
51 199 jeremybenn
#undef STARTFILE_SPEC
52
#define STARTFILE_SPEC "%{!shared:%{mor32-newlib*:%(target_prefix)/newlib/crt0.o} \
53
                        %{!mor32-newlib*:crt0%s}} crtinit.o%s"
54 152 jeremybenn
 
55 199 jeremybenn
#undef ENDFILE_SPEC
56 177 jeremybenn
#define ENDFILE_SPEC "crtfini.o%s"
57 38 julius
 
58 199 jeremybenn
/* Specify the newlib library path if necessary */
59
#undef LINK_SPEC
60
#define LINK_SPEC "%{mor32-newlib*:-L%(target_prefix)/newlib}"
61
 
62 177 jeremybenn
/* Override previous definitions (linux.h). We don't use libg.a */
63
#undef LIB_SPEC
64
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}         \
65
                  %{mor32-newlib:-lor32                         \
66
                      %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}    \
67
                  %{mor32-newlib-uart:-lor32uart                \
68
                      %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
69
 
70
/* Old definition of LIB_SPEC, not longer used. */
71 38 julius
/* Which library to get.  The only difference from the default is to get
72
   libsc.a if -sim is given to the driver.  Repeat -lc -lsysX
73
   {X=sim,linux}, because libsysX needs (at least) errno from libc, and
74
   then we want to resolve new unknowns in libc against libsysX, not
75
   libnosys.  */
76 177 jeremybenn
/* #define LIB_SPEC \ */
77
/*  "%{sim*:-lc -lsyssim -lc -lsyssim}\ */
78
/*   %{!sim*:%{g*:-lg}\ */
79
/*     %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\ */
80
/*   -lnosys" */
81 38 julius
 
82
#define TARGET_VERSION fprintf (stderr, " (OpenRISC 1000)");
83
 
84
/* Run-time compilation parameters selecting different hardware subsets.  */
85
 
86
extern int target_flags;
87
 
88
/* Default target_flags if no switches specified.  */
89
#ifndef TARGET_DEFAULT
90
#define TARGET_DEFAULT (MASK_HARD_MUL)
91
#endif
92
 
93
#undef TARGET_ASM_NAMED_SECTION
94
#define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
95
 
96
/* Target machine storage layout */
97
 
98
/* Define this if most significant bit is lowest numbered
99
   in instructions that operate on numbered bit-fields.
100
   This is not true on the or32.  */
101
#define BITS_BIG_ENDIAN 0
102
 
103
/* Define this if most significant byte of a word is the lowest numbered.  */
104
#define BYTES_BIG_ENDIAN 1
105
 
106
/* Define this if most significant word of a multiword number is numbered.  */
107
#define WORDS_BIG_ENDIAN 1
108
 
109
/* Number of bits in an addressable storage unit */
110
#define BITS_PER_UNIT 8
111
 
112
#define BITS_PER_WORD 32
113
#define SHORT_TYPE_SIZE 16
114
#define INT_TYPE_SIZE 32
115
#define LONG_TYPE_SIZE 32
116
#define LONG_LONG_TYPE_SIZE 64
117
#define FLOAT_TYPE_SIZE 32
118
#define DOUBLE_TYPE_SIZE 64
119
#define LONG_DOUBLE_TYPE_SIZE 64
120
 
121
/* Width of a word, in units (bytes).  */
122
#define UNITS_PER_WORD 4
123
 
124
/* Width in bits of a pointer.
125
   See also the macro `Pmode' defined below.  */
126
#define POINTER_SIZE 32
127
 
128
/* Allocation boundary (in *bits*) for storing pointers in memory.  */
129
#define POINTER_BOUNDARY 32
130
 
131
/* Allocation boundary (in *bits*) for storing arguments in argument list.  */
132
#define PARM_BOUNDARY 32
133
 
134
/* Boundary (in *bits*) on which stack pointer should be aligned.  */
135
#define STACK_BOUNDARY 32
136
 
137
/* Allocation boundary (in *bits*) for the code of a function.  */
138
#define FUNCTION_BOUNDARY 32
139
 
140
/* Alignment of field after `int : 0' in a structure.  */
141
#define EMPTY_FIELD_BOUNDARY 8
142
 
143
/* Every structure's size must be a multiple of this.  */
144
#define STRUCTURE_SIZE_BOUNDARY 32
145
 
146
/* A bitfield declared as `int' forces `int' alignment for the struct.  */
147
#define PCC_BITFIELD_TYPE_MATTERS 1
148
 
149
/* No data type wants to be aligned rounder than this.  */
150
#define BIGGEST_ALIGNMENT 32
151
 
152
/* The best alignment to use in cases where we have a choice.  */
153
#define FASTEST_ALIGNMENT 32
154
 
155
/* Make strings word-aligned so strcpy from constants will be faster.  */
156
/*
157
#define CONSTANT_ALIGNMENT(EXP, ALIGN)                                  \
158
  ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR)    \
159
    && (ALIGN) < FASTEST_ALIGNMENT                                      \
160
   ? FASTEST_ALIGNMENT : (ALIGN))
161
*/
162
 
163
/* One use of this macro is to increase alignment of medium-size
164
   data to make it all fit in fewer cache lines.  Another is to
165
   cause character arrays to be word-aligned so that `strcpy' calls
166
   that copy constants to character arrays can be done inline.  */
167
/*
168
#define DATA_ALIGNMENT(TYPE, ALIGN)                                     \
169
  ((((ALIGN) < FASTEST_ALIGNMENT)                                       \
170
    && (TREE_CODE (TYPE) == ARRAY_TYPE                                  \
171
        || TREE_CODE (TYPE) == UNION_TYPE                               \
172
        || TREE_CODE (TYPE) == RECORD_TYPE)) ? FASTEST_ALIGNMENT : (ALIGN))
173
*/ /* CHECK - btw code gets bigger with this one */
174
 
175
/* Define this if move instructions will actually fail to work
176
   when given unaligned data.  */
177
#define STRICT_ALIGNMENT 1 /* CHECK */
178
 
179
/* Align an address */
180
#define OR32_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
181
 
182
/* Define if operations between registers always perform the operation
183
   on the full register even if a narrower mode is specified.  */
184
#define WORD_REGISTER_OPERATIONS  /* CHECK */
185
 
186
 
187
/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
188
   will either zero-extend or sign-extend.  The value of this macro should
189
   be the code that says which one of the two operations is implicitly
190
   done, NIL if none.  */
191
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
192
 
193
/* Define this macro if it is advisable to hold scalars in registers
194
   in a wider mode than that declared by the program.  In such cases,
195
   the value is constrained to be within the bounds of the declared
196
   type, but kept valid in the wider mode.  The signedness of the
197
   extension may differ from that of the type. */
198
#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE)     \
199
  if (GET_MODE_CLASS (MODE) == MODE_INT         \
200
      && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
201
    (MODE) = SImode;
202
  /* CHECK */
203
 
204
/*
205
 * brings 0.4% improvment in static size for linux
206
 *
207
#define PROMOTE_FOR_CALL_ONLY
208
*/
209
 
210
/* Define this macro if it is as good or better to call a constant
211
   function address than to call an address kept in a register.  */
212
#define NO_FUNCTION_CSE 1 /* check */
213
 
214
/* Standard register usage.  */
215
 
216
/* Number of actual hardware registers.
217
   The hardware registers are assigned numbers for the compiler
218
   from 0 to just below FIRST_PSEUDO_REGISTER.
219
   All registers that the compiler knows about must be given numbers,
220
   even those that are not normally considered general registers.  */
221
#define FIRST_PSEUDO_REGISTER 33
222
#define LAST_INT_REG (FIRST_PSEUDO_REGISTER - 1)
223
 
224
/* 1 for registers that have pervasive standard uses
225
   and are not available for the register allocator.
226
   On the or32, these are r1 as stack pointer and
227
   r2 as frame/arg pointer.  r9 is link register, r0
228
   is zero, r10 is linux thread */
229
#define FIXED_REGISTERS { \
230
  1, 1, 1, 0, 0, 0, 0, 0, \
231
  0, 1, 1, 0, 0, 0, 0, 0, \
232
  0, 0, 0, 0, 0, 0, 0, 0, \
233
  0, 0, 0, 0, 0, 0, 0, 0, 1}
234
/* 1 for registers not available across function calls.
235
   These must include the FIXED_REGISTERS and also any
236
   registers that can be used without being saved.
237
   The latter must include the registers where values are returned
238
   and the register where structure-value addresses are passed.
239
   Aside from that, you can include as many other registers as you like.  */
240
#define CALL_USED_REGISTERS { \
241
  1, 1, 1, 1, 1, 1, 1, 1, \
242
  1, 1, 1, 1, 0, 1, 0, 1, \
243
  0, 1, 0, 1, 0, 1, 0, 1, \
244
  0, 1, 0, 1, 0, 1, 0, 1, 1}
245
 
246
/* stack pointer: must be FIXED and CALL_USED */
247
/* frame pointer: must be FIXED and CALL_USED */
248
 
249
/* Return number of consecutive hard regs needed starting at reg REGNO
250
   to hold something of mode MODE.
251
   This is ordinarily the length in words of a value of mode MODE
252
   but can be less for certain modes in special long registers.
253
   On the or32, all registers are one word long.  */
254
#define HARD_REGNO_NREGS(REGNO, MODE)   \
255
 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
256
 
257
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
258
#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
259
 
260
/* Value is 1 if it is a good idea to tie two pseudo registers
261
   when one has mode MODE1 and one has mode MODE2.
262
   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
263
   for any hard reg, then this must be 0 for correct output.  */
264
#define MODES_TIEABLE_P(MODE1, MODE2)  1
265
 
266
/* A C expression returning the cost of moving data from a register of class
267
   CLASS1 to one of CLASS2.  */
268
#define REGISTER_MOVE_COST or32_register_move_cost
269
 
270
/* A C expressions returning the cost of moving data of MODE from a register to
271
   or from memory.  */
272
#define MEMORY_MOVE_COST or32_memory_move_cost
273
 
274
/* Specify the cost of a branch insn; roughly the number of extra insns that
275
   should be added to avoid a branch. */
276
#define BRANCH_COST or32_branch_cost()
277
 
278
/* Specify the registers used for certain standard purposes.
279
   The values of these macros are register numbers.  */
280
 
281
/* Register to use for pushing function arguments.  */
282
#define STACK_POINTER_REGNUM 1
283
 
284
/* Base register for access to local variables of the function.  */
285
#define FRAME_POINTER_REGNUM 2
286
 
287
/* Link register. */
288
#define LINK_REGNUM 9
289
 
290
/* Value should be nonzero if functions must have frame pointers.
291
   Zero means the frame pointer need not be set up (and parms
292
   may be accessed via the stack pointer) in functions that seem suitable.
293
   This is computed in `reload', in reload1.c.  */
294
#define FRAME_POINTER_REQUIRED 0
295
 
296
/* De ne this macro if debugging can be performed even without a frame pointer.
297
   If this macro is de ned, GCC will turn on the `-fomit-frame-pointer' option
298
   whenever `-O' is specifed.
299
 */
300
/*
301
#define CAN_DEBUG_WITHOUT_FP
302
 */
303
 
304
#define INITIAL_FRAME_POINTER_OFFSET(DEPTH)                                             \
305
{ int regno;                                                                            \
306
  int offset = 0;                                                                        \
307
  for( regno=0; regno < FIRST_PSEUDO_REGISTER;  regno++ )                                \
308
    if( regs_ever_live[regno] && !call_used_regs[regno] )                               \
309
      offset += 4;                                                                      \
310
  (DEPTH) = (!current_function_is_leaf || regs_ever_live[LINK_REGNUM] ? 4 : 0)   +       \
311
                (frame_pointer_needed ? 4 : 0)                                   +       \
312
                offset                                                          +       \
313
                OR32_ALIGN(current_function_outgoing_args_size,4)               +       \
314
                OR32_ALIGN(get_frame_size(),4);                                         \
315
}
316
 
317
/* Base register for access to arguments of the function.  */
318
#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
319
 
320
/* Register in which static-chain is passed to a function.  */
321
#define STATIC_CHAIN_REGNUM 0
322
 
323
/* Register in which address to store a structure value
324
   is passed to a function.  */
325
/*#define STRUCT_VALUE_REGNUM 0*/
326
 
327
/* Pass address of result struct to callee as "invisible" first argument */
328
#define STRUCT_VALUE 0
329
 
330
/* -----------------------[ PHX start ]-------------------------------- */
331
 
332
/* Define the classes of registers for register constraints in the
333
   machine description.  Also define ranges of constants.
334
 
335
   One of the classes must always be named ALL_REGS and include all hard regs.
336
   If there is more than one class, another class must be named NO_REGS
337
   and contain no registers.
338
 
339
   The name GENERAL_REGS must be the name of a class (or an alias for
340
   another name such as ALL_REGS).  This is the class of registers
341
   that is allowed by "g" or "r" in a register constraint.
342
   Also, registers outside this class are allocated only when
343
   instructions express preferences for them.
344
 
345
   GENERAL_REGS and BASE_REGS classess are the same on or32.
346
 
347
   The classes must be numbered in nondecreasing order; that is,
348
   a larger-numbered class must never be contained completely
349
   in a smaller-numbered class.
350
 
351
   For any two classes, it is very desirable that there be another
352
   class that represents their union.  */
353
 
354
/* The or32 has only one kind of registers, so NO_REGS, GENERAL_REGS
355
   and ALL_REGS are the only classes.  */
356
 
357
enum reg_class
358
{
359
  NO_REGS,
360
  GENERAL_REGS,
361
  CR_REGS,
362
  ALL_REGS,
363
  LIM_REG_CLASSES
364
};
365
 
366
#define N_REG_CLASSES (int) LIM_REG_CLASSES
367
 
368
/* Give names of register classes as strings for dump file.   */
369
 
370
#define REG_CLASS_NAMES                                                 \
371
{                                                                       \
372
  "NO_REGS",                                                            \
373
  "GENERAL_REGS",                                                       \
374
  "ALL_REGS"                                                            \
375
}
376
 
377
 
378
/* Define which registers fit in which classes.
379
   This is an initializer for a vector of HARD_REG_SET
380
   of length N_REG_CLASSES.  */
381
 
382
/* An initializer containing the contents of the register classes,
383
   as integers which are bit masks.  The Nth integer specifies the
384
   contents of class N.  The way the integer MASK is interpreted is
385
   that register R is in the class if `MASK & (1 << R)' is 1.
386
 
387
   When the machine has more than 32 registers, an integer does not
388
   suffice.  Then the integers are replaced by sub-initializers,
389
   braced groupings containing several integers.  Each
390
   sub-initializer must be suitable as an initializer for the type
391
   `HARD_REG_SET' which is defined in `hard-reg-set.h'.  */
392
 
393
#define REG_CLASS_CONTENTS                           \
394
{                                                    \
395
  { 0x00000000, 0x00000000 }, /* NO_REGS */          \
396
  { 0xffffffff, 0x00000001 }, /* GENERAL_REGS */     \
397
  { 0xffffffff, 0x00000000 }  /* ALL_REGS */         \
398
}
399
 
400
/* The same information, inverted:
401
   Return the class number of the smallest class containing
402
   reg number REGNO.  This could be a conditional expression
403
   or could index an array.  */
404
 
405
#define REGNO_REG_CLASS(REGNO)                  \
406
 ((REGNO) < 32 ? GENERAL_REGS                   \
407
  : NO_REGS)
408
 
409
/* The class value for index registers, and the one for base regs.  */
410
#define INDEX_REG_CLASS GENERAL_REGS
411
#define BASE_REG_CLASS GENERAL_REGS
412
 
413
/* Get reg_class from a letter such as appears in the machine description.  */
414
 
415
#define REG_CLASS_FROM_LETTER(C) NO_REGS
416
 
417
#if 1
418
/* The letters I, J, K, L and M in a register constraint string
419
   can be used to stand for particular ranges of immediate operands.
420
   This macro defines what the ranges are.
421
   C is the letter, and VALUE is a constant value.
422
   Return 1 if VALUE is in the range specified by C.  */
423
 
424
#define CONST_OK_FOR_LETTER_P(VALUE, C)  \
425
    (  (C) == 'I' ? ((VALUE) >=-32768 && (VALUE) <=32767) \
426
     : (C) == 'J' ? ((VALUE) >=0 && (VALUE) <=0) \
427
     : (C) == 'K' ? ((VALUE) >=0 && (VALUE) <=65535) \
428
     : (C) == 'L' ? ((VALUE) >=0 && (VALUE) <=31) \
429
     : (C) == 'M' ? (((VALUE) & 0xffff) == 0 )           \
430
     : (C) == 'N' ? ((VALUE) >=-33554432 && (VALUE) <=33554431) \
431
     : (C) == 'O' ? ((VALUE) >=0 && (VALUE) <=0) \
432
     : 0 )
433
#else
434
 
435
/* The letters I, J, K, L, M, N, and P in a register constraint string
436
   can be used to stand for particular ranges of immediate operands.
437
   This macro defines what the ranges are.
438
   C is the letter, and VALUE is a constant value.
439
   Return 1 if VALUE is in the range specified by C.
440
 
441
   `I' is a signed 16-bit constant
442
   `J' is a constant with only the high-order 16 bits nonzero
443
   `K' is a constant with only the low-order 16 bits nonzero
444
   `L' is a signed 16-bit constant shifted left 16 bits
445
   `M' is a constant that is greater than 31
446
   `N' is a positive constant that is an exact power of two
447
   `O' is the constant zero
448
   `P' is a constant whose negation is a signed 16-bit constant */
449
 
450
#define CONST_OK_FOR_LETTER_P(VALUE, C)                                 \
451
   ( (C) == 'I' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \
452
   : (C) == 'J' ? ((VALUE) & (~ (unsigned HOST_WIDE_INT) 0xffff0000)) == 0 \
453
   : (C) == 'K' ? ((VALUE) & (~ (HOST_WIDE_INT) 0xffff)) == 0            \
454
   : (C) == 'L' ? (((VALUE) & 0xffff) == 0                               \
455
                   && ((VALUE) >> 31 == -1 || (VALUE) >> 31 == 0))       \
456
   : (C) == 'M' ? (VALUE) > 31                                          \
457
   : (C) == 'N' ? (VALUE) > 0 && exact_log2 (VALUE) >= 0          \
458
   : (C) == 'O' ? (VALUE) == 0                                           \
459
   : (C) == 'P' ? (unsigned HOST_WIDE_INT) ((- (VALUE)) + 0x8000) < 0x10000 \
460
   : 0)
461
#endif
462
 
463
/* -----------------------[ PHX stop ]-------------------------------- */
464
 
465
/* Similar, but for floating constants, and defining letters G and H.
466
   Here VALUE is the CONST_DOUBLE rtx itself.  */
467
 
468
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
469
 
470
/* Given an rtx X being reloaded into a reg required to be
471
   in class CLASS, return the class of reg to actually use.
472
   In general this is just CLASS; but on some machines
473
   in some cases it is preferable to use a more restrictive class.  */
474
 
475
#define PREFERRED_RELOAD_CLASS(X,CLASS)  (CLASS)
476
 
477
/* Return the maximum number of consecutive registers
478
   needed to represent mode MODE in a register of class CLASS.  */
479
/* On the or32, this is always the size of MODE in words,
480
   since all registers are the same size.  */
481
#define CLASS_MAX_NREGS(CLASS, MODE)    \
482
 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
483
 
484
/* Stack layout; function entry, exit and calling.  */
485
 
486
/* Define this if pushing a word on the stack
487
   makes the stack pointer a smaller address.  */
488
#define STACK_GROWS_DOWNWARD 1
489
 
490
/* Define this if the nominal address of the stack frame
491
   is at the high-address end of the local variables;
492
   that is, each additional local variable allocated
493
   goes at a more negative offset in the frame.  */
494
#define FRAME_GROWS_DOWNWARD 1
495
 
496
/* Offset within stack frame to start allocating local variables at.
497
   If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
498
   first local allocated.  Otherwise, it is the offset to the BEGINNING
499
   of the first local allocated.  */
500
#define STARTING_FRAME_OFFSET 0
501
 
502
/* Offset of first parameter from the argument pointer register value.  */
503
#define FIRST_PARM_OFFSET(FNDECL) 0
504
 
505
/* Define this if stack space is still allocated for a parameter passed
506
   in a register.  The value is the number of bytes allocated to this
507
   area.  */
508
/*
509
#define REG_PARM_STACK_SPACE(FNDECL) (UNITS_PER_WORD * GP_ARG_NUM_REG)
510
*/
511
/* Define this if the above stack space is to be considered part of the
512
   space allocated by the caller.  */
513
/*
514
#define OUTGOING_REG_PARM_STACK_SPACE
515
*/
516
/* Define this macro if `REG_PARM_STACK_SPACE' is defined, but the
517
   stack parameters don't skip the area specified by it. */
518
/*
519
#define STACK_PARMS_IN_REG_PARM_AREA
520
*/
521
/* Define this if the maximum size of all the outgoing args is to be
522
   accumulated and pushed during the prologue.  The amount can be
523
   found in the variable current_function_outgoing_args_size.  */
524
#define ACCUMULATE_OUTGOING_ARGS 1
525
 
526
/* Value is 1 if returning from a function call automatically
527
   pops the arguments described by the number-of-args field in the call.
528
   FUNDECL is the declaration node of the function (as a tree),
529
   FUNTYPE is the data type of the function (as a tree),
530
   or for a library call it is an identifier node for the subroutine name.
531
 
532
   On the Vax, the RET insn always pops all the args for any function.  */
533
/* SIMON */
534
/*#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)*/
535
#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
536
 
537
/* Minimum and maximum general purpose registers used to hold arguments.  */
538
#define GP_ARG_MIN_REG 3
539
#define GP_ARG_MAX_REG 8
540
#define GP_ARG_NUM_REG (GP_ARG_MAX_REG - GP_ARG_MIN_REG + 1) 
541
 
542
/* Return registers */
543
#define GP_ARG_RETURN 11 
544
 
545
/* Define how to find the value returned by a function.
546
   VALTYPE is the data type of the value (as a tree).
547
   If the precise function being called is known, FUNC is its FUNCTION_DECL;
548
   otherwise, FUNC is 0.  */
549
 
550
/* Return value is in R11.  */
551
#define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
552
 
553
/* Define how to find the value returned by a library function
554
   assuming the value has mode MODE.  */
555
 
556
/* Return value is in R11.  */
557
 
558
#define LIBCALL_VALUE(MODE)                                             \
559
  gen_rtx_REG(                                                          \
560
           ((GET_MODE_CLASS (MODE) != MODE_INT                          \
561
             || GET_MODE_SIZE (MODE) >= 4)                              \
562
            ? (MODE)                                                    \
563
            : SImode),                                                  \
564
            GP_ARG_RETURN)
565
 
566
/* Define this if PCC uses the nonreentrant convention for returning
567
   structure and union values.  */
568
 
569
/*#define PCC_STATIC_STRUCT_RETURN */
570
 
571
/* 1 if N is a possible register number for a function value.
572
   R3 to R8 are possible (set to 1 in CALL_USED_REGISTERS)  */
573
 
574
#define FUNCTION_VALUE_REGNO_P(N)  ((N) == GP_ARG_RETURN)
575
 
576
/* 1 if N is a possible register number for function argument passing. */
577
 
578
#define FUNCTION_ARG_REGNO_P(N) \
579
   ((N) >= GP_ARG_MIN_REG && (N) <= GP_ARG_MAX_REG)
580
 
581
/* A code distinguishing the floating point format of the target
582
   machine.  There are three defined values: IEEE_FLOAT_FORMAT,
583
   VAX_FLOAT_FORMAT, and UNKNOWN_FLOAT_FORMAT.  */
584
 
585
#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
586
#define FLOAT_WORDS_BIG_ENDIAN 1
587
 
588
/* Define a data type for recording info about an argument list
589
   during the scan of that argument list.  This data type should
590
   hold all necessary information about the function itself
591
   and about the args processed so far, enough to enable macros
592
   such as FUNCTION_ARG to determine where the next arg should go.
593
 
594
   On the vax, this is a single integer, which is a number of bytes
595
   of arguments scanned so far.  */
596
 
597
#define CUMULATIVE_ARGS int
598
 
599
/* Initialize a variable CUM of type CUMULATIVE_ARGS
600
   for a call to a function whose data type is FNTYPE.
601
   For a library call, FNTYPE is 0.
602
 
603
   On the vax, the offset starts at 0.  */
604
 
605
/* The regs member is an integer, the number of arguments got into
606
   registers so far.  */
607
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
608
 (CUM = 0)
609
 
610
/* Define intermediate macro to compute the size (in registers) of an argument
611
   for the or32.  */
612
 
613
/* The ROUND_ADVANCE* macros are local to this file.  */
614
/* Round SIZE up to a word boundary.  */
615
#define ROUND_ADVANCE(SIZE) \
616
(((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
617
 
618
/* Round arg MODE/TYPE up to the next word boundary.  */
619
#define ROUND_ADVANCE_ARG(MODE, TYPE) \
620
((MODE) == BLKmode                              \
621
 ? ROUND_ADVANCE (int_size_in_bytes (TYPE))     \
622
 : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
623
 
624
/* Round CUM up to the necessary point for argument MODE/TYPE.  */
625
/* This is either rounded to nearest reg or nearest double-reg boundary */
626
#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
627
((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \
628
  > BITS_PER_WORD)      \
629
 ? (((CUM) + 1) & ~1)   \
630
 : (CUM))
631
 
632
/* Update the data in CUM to advance over an argument
633
   of mode MODE and data type TYPE.
634
   (TYPE is null for libcalls where that information may not be available.)  */
635
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
636
((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
637
          + ROUND_ADVANCE_ARG ((MODE), (TYPE))))
638
 
639
/* Return boolean indicating arg of type TYPE and mode MODE will be passed in
640
   a reg.  This includes arguments that have to be passed by reference as the
641
   pointer to them is passed in a reg if one is available (and that is what
642
   we're given).
643
   When passing arguments NAMED is always 1.  When receiving arguments NAMED
644
   is 1 for each argument except the last in a stdarg/varargs function.  In
645
   a stdarg function we want to treat the last named arg as named.  In a
646
   varargs function we want to treat the last named arg (which is
647
   `__builtin_va_alist') as unnamed.
648
   This macro is only used in this file.  */
649
#define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
650
((NAMED)                                                                \
651
 && ((ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))                         \
652
      + ROUND_ADVANCE_ARG ((MODE), (TYPE))                              \
653
      <= GP_ARG_NUM_REG)))
654
 
655
/* Determine where to put an argument to a function.
656
   Value is zero to push the argument on the stack,
657
   or a hard register in which to store the argument.
658
 
659
   MODE is the argument's machine mode.
660
   TYPE is the data type of the argument (as a tree).
661
    This is null for libcalls where that information may
662
    not be available.
663
   CUM is a variable of type CUMULATIVE_ARGS which gives info about
664
    the preceding args and about the function being called.
665
   NAMED is nonzero if this argument is a named parameter
666
    (otherwise it is an extra parameter matching an ellipsis).  */
667
/* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers
668
   and the rest are pushed.  */
669
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
670
(PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))                         \
671
 ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) + GP_ARG_MIN_REG)     \
672
 : 0)
673
 
674
/* Output assembler code to FILE to increment profiler label # LABELNO
675
   for profiling a function entry.  */
676
 
677 152 jeremybenn
#define FUNCTION_PROFILER(FILE, LABELNO)                  \
678
  fprintf (FILE, "\tl.movhi\tr3,hi(.LP%d)\n", (LABELNO)); \
679
  fprintf (FILE, "\tl.ori\tr3,r3,lo(.LP%d)\n", (LABELNO)); \
680
  fprintf (FILE, "\tl.j\tmcount\n");                      \
681
  fprintf (FILE, "\tl.nop\n");
682 38 julius
 
683
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
684
   the stack pointer does not matter.  The value is tested only in
685
   functions that have frame pointers.
686
   No definition is equivalent to always zero.  */
687
 
688
#define EXIT_IGNORE_STACK 0
689
 
690
/* If the memory address ADDR is relative to the frame pointer,
691
   correct it to be relative to the stack pointer instead.
692
   This is for when we don't use a frame pointer.
693
   ADDR should be a variable name.  */
694
 
695
#define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
696
{ int offset = -1;                                                      \
697
  rtx regs = stack_pointer_rtx;                                         \
698
  if (ADDR == frame_pointer_rtx)                                        \
699
    offset = 0;                                                          \
700
  else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx \
701
           && GET_CODE (XEXP (ADDR, 0)) == CONST_INT)                    \
702
    offset = INTVAL (XEXP (ADDR, 0));                                    \
703
  else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx \
704
           && GET_CODE (XEXP (ADDR, 1)) == CONST_INT)                   \
705
    offset = INTVAL (XEXP (ADDR, 1));                                   \
706
  else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx) \
707
    { rtx other_reg = XEXP (ADDR, 1);                                   \
708
      offset = 0;                                                        \
709
      regs = gen_rtx_PLUS( Pmode, stack_pointer_rtx, other_reg); }      \
710
  else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx) \
711
    { rtx other_reg = XEXP (ADDR, 0);                                    \
712
      offset = 0;                                                        \
713
      regs = gen_rtx_PLUS( Pmode, stack_pointer_rtx, other_reg); }      \
714
  if (offset >= 0)                                                       \
715
    { int regno;                                                        \
716
      extern char call_used_regs[];                                     \
717
      offset += 4; /* I don't know why??? */                            \
718
      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)            \
719
        if (regs_ever_live[regno] && ! call_used_regs[regno])           \
720
          offset += 4;                                                  \
721
      ADDR = plus_constant (regs, offset + (DEPTH)); } }
722
 
723
 
724
/* Addressing modes, and classification of registers for them.  */
725
 
726
/* #define HAVE_POST_INCREMENT */
727
/* #define HAVE_POST_DECREMENT */
728
 
729
/* #define HAVE_PRE_DECREMENT */
730
/* #define HAVE_PRE_INCREMENT */
731
 
732
/* Macros to check register numbers against specific register classes.  */
733
 
734
#define MAX_REGS_PER_ADDRESS 1
735
 
736
/* True if X is an rtx for a constant that is a valid address.  */
737
#define CONSTANT_ADDRESS_P(X)                                           \
738
  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
739
   || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST                \
740
   || GET_CODE (X) == HIGH)
741
 
742
#define REGNO_OK_FOR_BASE_P(REGNO)                                          \
743
((REGNO) < FIRST_PSEUDO_REGISTER ? ((REGNO) > 0 && (REGNO) <= LAST_INT_REG) \
744
 : (reg_renumber[REGNO] > 0 && (reg_renumber[REGNO] <= LAST_INT_REG )))
745
 
746
#ifdef REG_OK_STRICT
747
/* Strict version, used in reload pass. This should not
748
 * accept pseudo registers.
749
 */
750
#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P(REGNO(X))
751
#else
752
/* Accept an int register or a pseudo reg. */
753
#define REG_OK_FOR_BASE_P(X) (REGNO(X) <= LAST_INT_REG || \
754
                              REGNO(X) >= FIRST_PSEUDO_REGISTER)
755
#endif
756
 
757
/*
758
 * OR32 doesn't have any indexed addressing.
759
 */
760
#define REG_OK_FOR_INDEX_P(X) 0
761
#define REGNO_OK_FOR_INDEX_P(X) 0
762
 
763
#define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET)          \
764
 (GET_CODE (X) == CONST_INT && SMALL_INT(X))
765
 
766
#define LEGITIMATE_OFFSET_ADDRESS_P(MODE,X)             \
767
 (GET_CODE (X) == PLUS                                  \
768
  && GET_CODE (XEXP (X, 0)) == REG                      \
769
  && REG_OK_FOR_BASE_P (XEXP (X, 0))                    \
770
  && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0)      \
771
  && (((MODE) != DFmode && (MODE) != DImode)            \
772
      || LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4)))
773
 
774
#define LEGITIMATE_NONOFFSET_ADDRESS_P(MODE,X)          \
775
             (GET_CODE(X) == REG && REG_OK_FOR_BASE_P(X))
776
/*
777
 * OR32 only has one addressing mode:
778
 * register + 16 bit signed offset.
779
 */
780
#define GO_IF_LEGITIMATE_ADDRESS(MODE,X,ADDR)           \
781
  if(LEGITIMATE_OFFSET_ADDRESS_P(MODE,X)) goto ADDR;    \
782
  if(LEGITIMATE_NONOFFSET_ADDRESS_P(MODE,X)) goto ADDR;
783
 
784
/*
785
  if(GET_CODE(X) == SYMBOL_REF) goto ADDR;  */ /* If used, smaller code */
786
 
787
/* Alternative */
788
#if 0
789
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)  \
790
{                                                                       \
791
  if (GET_CODE (X) == REG) goto ADDR;                                   \
792
  if (GET_CODE (X) == SYMBOL_REF) goto ADDR;                            \
793
  if (CONSTANT_ADDRESS_P (X)) goto ADDR;                                \
794
  if (GET_CODE (X) == PLUS)                                             \
795
    {                                                                   \
796
      /* Handle [index]<address> represented with index-sum outermost */\
797
      if (GET_CODE (XEXP (X, 0)) == REG                                 \
798
          && REG_OK_FOR_BASE_P (XEXP (X, 0))                            \
799
          && GET_CODE (XEXP (X, 1)) == CONST_INT)                       \
800
        goto ADDR;                                                      \
801
      if (GET_CODE (XEXP (X, 1)) == REG                                 \
802
          && REG_OK_FOR_BASE_P (XEXP (X, 0))                            \
803
          && GET_CODE (XEXP (X, 0)) == CONST_INT)                       \
804
        goto ADDR;                                                      \
805
    }                                                                   \
806
 }
807
#endif
808
/*
809
 * We have to force symbol_ref's into registers here
810
 * because nobody else seems to want to do that!
811
 */
812
#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
813
/*
814
{ if (GET_CODE (x) == SYMBOL_REF)                               \
815
    (X) = copy_to_reg (X);                                      \
816
  if (memory_address_p (MODE, X))                               \
817
    goto WIN;                                                   \
818
}
819
*/
820
 
821
/*
822
 * OR32 addresses do not depend on the machine mode they are
823
 * being used in.
824
 */
825
#define GO_IF_MODE_DEPENDENT_ADDRESS(addr,label)
826
 
827
/* OR32 has 16 bit immediates.
828
 */
829
#define SMALL_INT(X) (INTVAL(X) >= -32768 && INTVAL(X) <= 32767)
830
 
831
#define LEGITIMATE_CONSTANT_P(x) (GET_CODE(x) != CONST_DOUBLE)
832
 
833
/* Specify the machine mode that this machine uses
834
   for the index in the tablejump instruction.  */
835
#define CASE_VECTOR_MODE SImode
836
 
837
/* Define as C expression which evaluates to nonzero if the tablejump
838
   instruction expects the table to contain offsets from the address of the
839
   table.
840
   Do not define this if the table should contain absolute addresses. */
841
/* #define CASE_VECTOR_PC_RELATIVE 1 */
842
 
843
/* Define this as 1 if `char' should by default be signed; else as 0.  */
844
#define DEFAULT_SIGNED_CHAR 1
845
 
846
/* This flag, if defined, says the same insns that convert to a signed fixnum
847
   also convert validly to an unsigned one.  */
848
#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
849
 
850
/* Max number of bytes we can move from memory to memory
851
   in one reasonably fast instruction.  */
852
#define MOVE_MAX 4
853
 
854
/* Define this if zero-extension is slow (more than one real instruction).  */
855
/* #define SLOW_ZERO_EXTEND */
856
 
857
/* Nonzero if access to memory by bytes is slow and undesirable.
858
   For RISC chips, it means that access to memory by bytes is no
859
   better than access by words when possible, so grab a whole word
860
   and maybe make use of that.  */
861
#define SLOW_BYTE_ACCESS 1
862
 
863
/* Define if shifts truncate the shift count
864
   which implies one can omit a sign-extension or zero-extension
865
   of a shift count.  */
866
/* #define SHIFT_COUNT_TRUNCATED */
867
 
868
/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
869
   is done just by pretending it is already truncated.  */
870
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
871
 
872
/* Specify the machine mode that pointers have.
873
   After generation of rtl, the compiler makes no further distinction
874
   between pointers and any other objects of this machine mode.  */
875
#define Pmode SImode
876
 
877
/* A function address in a call instruction
878
   is a byte address (for indexing purposes)
879
   so give the MEM rtx a byte's mode.  */
880
#define FUNCTION_MODE SImode
881
 
882
/* Compute the cost of computing a constant rtl expression RTX
883
   whose rtx-code is CODE.  The body of this macro is a portion
884
   of a switch statement.  If the code is computed here,
885
   return it with a return statement.  Otherwise, break from the switch.  */
886
#if 0
887
__PHX__ cleanup
888
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
889
  case CONST_INT:                                               \
890
    /* Constant zero is super cheap due to clr instruction.  */ \
891
    if (RTX == const0_rtx) return 0;                             \
892
    if ((unsigned) INTVAL (RTX) < 077) return 1;                \
893
  case CONST:                                                   \
894
  case LABEL_REF:                                               \
895
  case SYMBOL_REF:                                              \
896
    return 3;                                                   \
897
  case CONST_DOUBLE:                                            \
898
    return 5;
899
#endif
900
 
901
 
902
/* Given a comparison code (EQ, NE, etc.) and the first operand of a
903
   COMPARE, return the mode to be used for the comparison.
904
*/
905
 
906
#define SELECT_CC_MODE(OP, X, Y) or32_cc_mode ((OP), (X), (Y))
907
 
908
/* Can the condition code MODE be safely reversed?  This is safe in
909
   all cases on this port, because at present it doesn't use the
910
   trapping FP comparisons (fcmpo).  */
911
#define REVERSIBLE_CC_MODE(MODE) 1
912
 
913
/* Given a condition code and a mode, return the inverse condition.  */
914
#define REVERSE_CONDITION(CODE, MODE) or32_reverse_condition (MODE, CODE)
915
 
916
 
917
/* Control the assembler format that we output.  */
918
 
919
/* A C string constant describing how to begin a comment in the target
920
   assembler language.  The compiler assumes that the comment will end at
921
   the end of the line.  */
922
#define ASM_COMMENT_START "#"
923
 
924
/* Output at beginning of assembler file.  */
925
/*
926
__PHX__ clenup
927
#ifndef ASM_FILE_START
928
#define ASM_FILE_START(FILE) do {\
929
fprintf (FILE, "%s file %s\n", ASM_COMMENT_START, main_input_filename);\
930
fprintf (FILE, ".file\t");   \
931
  output_quoted_string (FILE, main_input_filename);\
932
  fputc ('\n', FILE);} while (0)
933
#endif
934
*/
935
/* Output to assembler file text saying following lines
936
   may contain character constants, extra white space, comments, etc.  */
937
 
938
#define ASM_APP_ON ""
939
 
940
/* Output to assembler file text saying following lines
941
   no longer contain unusual constructs.  */
942
 
943
#define ASM_APP_OFF ""
944
 
945
/* Switch to the text or data segment.  */
946
 
947
/* Output before read-only data.  */
948
#define TEXT_SECTION_ASM_OP ".section .text"
949
 
950
/* Output before writable data.  */
951
#define DATA_SECTION_ASM_OP ".section .data"
952
 
953
/* Output before uninitialized data. */
954
#define BSS_SECTION_ASM_OP  ".section .bss"
955
 
956
/* How to refer to registers in assembler output.
957
   This sequence is indexed by compiler's hard-register-number (see above).  */
958
 
959
#define REGISTER_NAMES \
960
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" \
961
, "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", "cc-flag"}
962
 
963
 
964
/* Define this to be the delimiter between SDB sub-sections.  The default
965
   is ";".  */
966
#define SDB_DELIM       "\n"
967
 
968
/* Do not break .stabs pseudos into continuations.  */
969
#define DBX_CONTIN_LENGTH 0
970
 
971
/* Don't try to use the  type-cross-reference character in DBX data.
972
   Also has the consequence of putting each struct, union or enum
973
   into a separate .stabs, containing only cross-refs to the others.  */
974
#define DBX_NO_XREFS
975
 
976
/* How to renumber registers for dbx and gdb.
977
   Vax needs no change in the numeration.  */
978
 
979
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
980
 
981
/* This is the char to use for continuation (in case we need to turn
982
   continuation back on).  */
983
 
984
#define DBX_CONTIN_CHAR '?'
985
 
986
 
987
 
988
 
989
 
990
/* Node: Label Output */
991
 
992
/* Globalizing directive for a label.  */
993
#define GLOBAL_ASM_OP "\t.global "
994
 
995
#define SUPPORTS_WEAK 1
996
 
997
/* This is how to output the definition of a user-level label named NAME,
998
   such as the label on a static function or variable NAME.  */
999
 
1000
#define ASM_OUTPUT_LABEL(FILE,NAME)     \
1001
 { assemble_name (FILE, NAME); fputs (":\n", FILE); }
1002
#if 0
1003
/* This is how to output a command to make the user-level label named NAME
1004
   defined for reference from other files.  */
1005
/*
1006
 __PHX__ CLEANUP
1007
#define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
1008
 { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE); }
1009
*/
1010
 
1011
/* SIMON */
1012
/*#define ASM_OUTPUT_LABELREF(stream,name)                \
1013
 { fputc('_',stream); fputs(name,stream); }
1014
*/
1015
#define ASM_OUTPUT_LABELREF(stream,name)                \
1016
{if(name[0] == '*')                                      \
1017
   fputs(name,stream);                                  \
1018
else {                                                  \
1019
   fputc('_',stream); fputs(name,stream);               \
1020
}}
1021
#endif
1022
 
1023
/* The prefix to add to user-visible assembler symbols. */
1024
 
1025
/* Remove any previous definition (elfos.h).  */
1026
/* We use -fno-leading-underscore to remove it, when necessary.  */
1027
#undef  USER_LABEL_PREFIX
1028
#define USER_LABEL_PREFIX "_"
1029
 
1030
/* Remove any previous definition (elfos.h).  */
1031
#ifndef ASM_GENERATE_INTERNAL_LABEL
1032
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
1033
  sprintf (LABEL, "*%s%d", PREFIX, NUM)
1034
#endif
1035
 
1036
/* This is how to output an assembler line defining an `int' constant.  */
1037
 
1038
#define ASM_OUTPUT_INT(FILE,VALUE)      \
1039
(                                       \
1040
        fprintf (FILE, "\t.word "),     \
1041
  output_addr_const (FILE, (VALUE)),    \
1042
  fprintf (FILE, "\n"))
1043
 
1044
#define ASM_OUTPUT_FLOAT(stream,value) \
1045
   { long l;                                 \
1046
      REAL_VALUE_TO_TARGET_SINGLE(value,l); \
1047
      fprintf(stream,"\t.word 0x%08x\t\n# float %26.7e\n",l,value); }
1048
 
1049
#define ASM_OUTPUT_DOUBLE(stream,value)                         \
1050
   { long l[2];                                                 \
1051
      REAL_VALUE_TO_TARGET_DOUBLE(value,&l[0]);                 \
1052
      fprintf(stream,"\t.word 0x%08x,0x%08x\t\n# float %26.16le\n",  \
1053
              l[0],l[1],value); }
1054
 
1055
#define ASM_OUTPUT_LONG_DOUBLE(stream,value) \
1056
   { long l[4];                                 \
1057
      REAL_VALUE_TO_TARGET_DOUBLE(value,&l[0]); \
1058
      fprintf(stream,"\t.word 0x%08x,0x%08x,0x%08x,0x%08x\t\n# float %26.18lle\n", \
1059
              l[0],l[1],l[2],l[3],value); }
1060
 
1061
/* Likewise for `char' and `short' constants.  */
1062
 
1063
#define ASM_OUTPUT_SHORT(FILE,VALUE)  \
1064
( fprintf (FILE, "\t.half "),                   \
1065
  output_addr_const (FILE, (VALUE)),            \
1066
  fprintf (FILE, "\n"))
1067
 
1068
#define ASM_OUTPUT_CHAR(FILE,VALUE)  \
1069
( fprintf (FILE, "\t.byte "),                   \
1070
  output_addr_const (FILE, (VALUE)),            \
1071
  fprintf (FILE, "\n"))
1072
 
1073
/* This is how to output an assembler line for a numeric constant byte.  */
1074
 
1075
#define ASM_OUTPUT_BYTE(FILE,VALUE)  \
1076
  fprintf (FILE, "\t.byte 0x%02x\n", (VALUE))
1077
 
1078
/* This is how to output an insn to push a register on the stack.
1079
   It need not be very fast code.  */
1080
 
1081
#define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
1082
  fprintf (FILE, "\tl.sub   \tr1,4\n\tl.sw    \t0(r1),%s\n", reg_names[REGNO])
1083
 
1084
/* This is how to output an insn to pop a register from the stack.
1085
   It need not be very fast code.  */
1086
 
1087
#define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
1088
  fprintf (FILE, "\tl.lwz   \t%s,0(r1)\n\tl.addi   \tr1,4\n", reg_names[REGNO])
1089
 
1090
/* This is how to output an element of a case-vector that is absolute.
1091
   (The Vax does not use such vectors,
1092
   but we must define this macro anyway.)  */
1093
 
1094
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
1095
  fprintf (FILE, "\t.word .L%d\n", VALUE)
1096
 
1097
/* This is how to output an element of a case-vector that is relative.  */
1098
 
1099
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)  \
1100
  fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
1101
 
1102
/* This is how to output an assembler line
1103
   that says to advance the location counter
1104
   to a multiple of 2**LOG bytes.  */
1105
 
1106
#define ASM_OUTPUT_ALIGN(FILE,LOG)  \
1107
  if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG))
1108
 
1109
/* This is how to output an assembler line
1110
   that says to advance the location counter by SIZE bytes.  */
1111
 
1112
#ifndef ASM_OUTPUT_SKIP
1113
#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
1114
  fprintf (FILE, "\t.space %d\n", (SIZE))
1115
#endif
1116
 
1117
/* Need to split up .ascii directives to avoid breaking
1118
   the linker. */
1119
 
1120
/* This is how to output a string.  */
1121
#undef  ASM_OUTPUT_ASCII
1122
#define ASM_OUTPUT_ASCII(STREAM, PTR, LEN)  \
1123
  output_ascii_pseudo_op (STREAM, (const unsigned char *) (PTR), LEN)
1124
 
1125
/* Invoked just before function output. */
1126
#define ASM_OUTPUT_FUNCTION_PREFIX(stream, fnname)              \
1127
  fputs(".proc ",stream); assemble_name(stream,fnname);         \
1128
  fputs("\n",stream);
1129
 
1130
/* This says how to output an assembler line
1131
   to define a global common symbol.  */
1132
#define ASM_OUTPUT_COMMON(stream,name,size,rounded)             \
1133
{ data_section();                                               \
1134
  fputs(".global\t",stream); assemble_name(stream,name);        \
1135
  fputs("\n",stream); assemble_name(stream,name);               \
1136
  fprintf(stream,":\n\t.space %d\n",rounded); }
1137
 
1138
/* This says how to output an assembler line
1139
   to define a local common symbol.  */
1140
 
1141
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
1142
( fputs (".bss ", (FILE)),                      \
1143
  assemble_name ((FILE), (NAME)),               \
1144
  fprintf ((FILE), ",%d,%d\n", (SIZE),(ROUNDED)))
1145
 
1146
/* This says how to output an assembler line to define a global common symbol
1147
   with size SIZE (in bytes) and alignment ALIGN (in bits).  */
1148
#ifndef ASM_OUTPUT_ALIGNED_COMMON
1149
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)      \
1150
{ data_section();                                               \
1151
  if ((ALIGN) > 8)                                              \
1152
        fprintf(FILE, "\t.align %d\n", ((ALIGN) / BITS_PER_UNIT)); \
1153
  fputs(".global\t", FILE); assemble_name(FILE, NAME);          \
1154
  fputs("\n", FILE);                                            \
1155
  assemble_name(FILE, NAME);                                    \
1156
  fprintf(FILE, ":\n\t.space %d\n", SIZE);                      \
1157
}
1158
#endif /* ASM_OUTPUT_ALIGNED_COMMON */
1159
 
1160
/* This says how to output an assembler line to define a local common symbol
1161
   with size SIZE (in bytes) and alignment ALIGN (in bits).  */
1162
 
1163
#ifndef ASM_OUTPUT_ALIGNED_LOCAL
1164
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
1165
{ data_section();                                               \
1166
  if ((ALIGN) > 8)                                              \
1167
        fprintf(FILE, "\t.align %d\n", ((ALIGN) / BITS_PER_UNIT)); \
1168
  assemble_name(FILE, NAME);                                    \
1169
  fprintf(FILE, ":\n\t.space %d\n", SIZE);                      \
1170
}
1171
#endif /* ASM_OUTPUT_ALIGNED_LOCAL */
1172
 
1173
/* Store in OUTPUT a string (made with alloca) containing
1174
   an assembler-name for a local static variable named NAME.
1175
   LABELNO is an integer which is different for each call.  */
1176
 
1177
#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
1178
( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
1179
  sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1180
 
1181
/* Macro for %code validation. Returns nonzero if valid. */
1182
#define PRINT_OPERAND_PUNCT_VALID_P(code) or32_print_operand_punct_valid_p(code)
1183
 
1184
/* Print an instruction operand X on file FILE.
1185
   CODE is the code from the %-spec that requested printing this operand;
1186
   if `%z3' was used to print operand 3, then CODE is 'z'.  */
1187
 
1188
#define PRINT_OPERAND(FILE, X, CODE) or32_print_operand(FILE, X, CODE)
1189
 
1190
/* Print a memory operand whose address is X, on file FILE.
1191
   This uses a function in output-vax.c.  */
1192
 
1193
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) or32_print_operand_address (FILE, ADDR)
1194
 
1195
/* These are stubs, and have yet to bee written. */
1196
 
1197
#define TRAMPOLINE_SIZE 26
1198
#define TRAMPOLINE_TEMPLATE(FILE)
1199
#define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT)
1200
 
1201
extern GTY(()) rtx or32_compare_op0;
1202
extern GTY(()) rtx or32_compare_op1;
1203
 
1204
#endif /* _OR32_H_ */

powered by: WebSVN 2.1.0

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