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

Subversion Repositories openrisc_me

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

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

powered by: WebSVN 2.1.0

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