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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gcc/] [gcc-3.4.4/] [gcc/] [config/] [or32/] [or32.h] - Blame information for rev 1612

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

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

powered by: WebSVN 2.1.0

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