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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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