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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 38 julius
/* Definitions of target machine for GNU compiler, for the pdp-11
2
   Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
3
   2007 Free Software Foundation, Inc.
4
   Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3, or (at your option)
11
any later version.
12
 
13
GCC is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING3.  If not see
20
<http://www.gnu.org/licenses/>.  */
21
 
22
#define CONSTANT_POOL_BEFORE_FUNCTION   0
23
 
24
/* check whether load_fpu_reg or not */
25
#define LOAD_FPU_REG_P(x) ((x)>=8 && (x)<=11)
26
#define NO_LOAD_FPU_REG_P(x) ((x)==12 || (x)==13)
27
#define FPU_REG_P(x)    (LOAD_FPU_REG_P(x) || NO_LOAD_FPU_REG_P(x))
28
#define CPU_REG_P(x)    ((x)<8)
29
 
30
/* Names to predefine in the preprocessor for this target machine.  */
31
 
32
#define TARGET_CPU_CPP_BUILTINS()               \
33
  do                                            \
34
    {                                           \
35
      builtin_define_std ("pdp11");             \
36
    }                                           \
37
  while (0)
38
 
39
/* Print subsidiary information on the compiler version in use.  */
40
#define TARGET_VERSION fprintf (stderr, " (pdp11)");
41
 
42
 
43
/* Generate DBX debugging information.  */
44
 
45
/* #define DBX_DEBUGGING_INFO */
46
 
47
#define TARGET_40_PLUS          (TARGET_40 || TARGET_45)
48
#define TARGET_10               (! TARGET_40_PLUS)
49
 
50
#define TARGET_UNIX_ASM_DEFAULT 0
51
 
52
#define ASSEMBLER_DIALECT       (TARGET_UNIX_ASM ? 1 : 0)
53
 
54
 
55
 
56
/* TYPE SIZES */
57
#define SHORT_TYPE_SIZE         16
58
#define INT_TYPE_SIZE           (TARGET_INT16 ? 16 : 32)
59
#define LONG_TYPE_SIZE          32
60
#define LONG_LONG_TYPE_SIZE     64     
61
 
62
/* if we set FLOAT_TYPE_SIZE to 32, we could have the benefit
63
   of saving core for huge arrays - the definitions are
64
   already in md - but floats can never reside in
65
   an FPU register - we keep the FPU in double float mode
66
   all the time !! */
67
#define FLOAT_TYPE_SIZE         (TARGET_FLOAT32 ? 32 : 64)
68
#define DOUBLE_TYPE_SIZE        64
69
#define LONG_DOUBLE_TYPE_SIZE   64
70
 
71
/* machine types from ansi */
72
#define SIZE_TYPE "unsigned int"        /* definition of size_t */
73
#define WCHAR_TYPE "int"                /* or long int???? */
74
#define WCHAR_TYPE_SIZE 16
75
 
76
#define PTRDIFF_TYPE "int"
77
 
78
/* target machine storage layout */
79
 
80
/* Define this if most significant bit is lowest numbered
81
   in instructions that operate on numbered bit-fields.  */
82
#define BITS_BIG_ENDIAN 0
83
 
84
/* Define this if most significant byte of a word is the lowest numbered.  */
85
#define BYTES_BIG_ENDIAN 0
86
 
87
/* Define this if most significant word of a multiword number is first.  */
88
#define WORDS_BIG_ENDIAN 1
89
 
90
/* Define that floats are in VAX order, not high word first as for ints.  */
91
#define FLOAT_WORDS_BIG_ENDIAN 0
92
 
93
/* Width of a word, in units (bytes).
94
 
95
   UNITS OR BYTES - seems like units */
96
#define UNITS_PER_WORD 2
97
 
98
/* This machine doesn't use IEEE floats.  */
99
/* Because the pdp11 (at least Unix) convention for 32 bit ints is
100
   big endian, opposite for what you need for float, the vax float
101
   conversion routines aren't actually used directly.  But the underlying
102
   format is indeed the vax/pdp11 float format.  */
103
#define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
104
 
105
extern const struct real_format pdp11_f_format;
106
extern const struct real_format pdp11_d_format;
107
 
108
/* Maximum sized of reasonable data type
109
   DImode or Dfmode ...*/
110
#define MAX_FIXED_MODE_SIZE 64  
111
 
112
/* Allocation boundary (in *bits*) for storing pointers in memory.  */
113
#define POINTER_BOUNDARY 16
114
 
115
/* Allocation boundary (in *bits*) for storing arguments in argument list.  */
116
#define PARM_BOUNDARY 16
117
 
118
/* Boundary (in *bits*) on which stack pointer should be aligned.  */
119
#define STACK_BOUNDARY 16
120
 
121
/* Allocation boundary (in *bits*) for the code of a function.  */
122
#define FUNCTION_BOUNDARY 16
123
 
124
/* Alignment of field after `int : 0' in a structure.  */
125
#define EMPTY_FIELD_BOUNDARY 16
126
 
127
/* No data type wants to be aligned rounder than this.  */
128
#define BIGGEST_ALIGNMENT 16
129
 
130
/* Define this if move instructions will actually fail to work
131
   when given unaligned data.  */
132
#define STRICT_ALIGNMENT 1
133
 
134
/* Standard register usage.  */
135
 
136
/* Number of actual hardware registers.
137
   The hardware registers are assigned numbers for the compiler
138
   from 0 to just below FIRST_PSEUDO_REGISTER.
139
   All registers that the compiler knows about must be given numbers,
140
   even those that are not normally considered general registers.
141
 
142
   we have 8 integer registers, plus 6 float
143
   (don't use scratch float !) */
144
 
145
#define FIRST_PSEUDO_REGISTER 14
146
 
147
/* 1 for registers that have pervasive standard uses
148
   and are not available for the register allocator.
149
 
150
   On the pdp, these are:
151
   Reg 7        = pc;
152
   reg 6        = sp;
153
   reg 5        = fp;  not necessarily!
154
*/
155
 
156
/* don't let them touch fp regs for the time being !*/
157
 
158
#define FIXED_REGISTERS  \
159
{0, 0, 0, 0, 0, 0, 1, 1, \
160
 0, 0, 0, 0, 0, 0     }
161
 
162
 
163
 
164
/* 1 for registers not available across function calls.
165
   These must include the FIXED_REGISTERS and also any
166
   registers that can be used without being saved.
167
   The latter must include the registers where values are returned
168
   and the register where structure-value addresses are passed.
169
   Aside from that, you can include as many other registers as you like.  */
170
 
171
/* don't know about fp */
172
#define CALL_USED_REGISTERS  \
173
{1, 1, 0, 0, 0, 0, 1, 1, \
174
 0, 0, 0, 0, 0, 0 }
175
 
176
 
177
/* Make sure everything's fine if we *don't* have an FPU.
178
   This assumes that putting a register in fixed_regs will keep the
179
   compiler's mitts completely off it.  We don't bother to zero it out
180
   of register classes.  Also fix incompatible register naming with
181
   the UNIX assembler.
182
*/
183
#define CONDITIONAL_REGISTER_USAGE \
184
{                                               \
185
  int i;                                        \
186
  HARD_REG_SET x;                               \
187
  if (!TARGET_FPU)                              \
188
    {                                           \
189
      COPY_HARD_REG_SET (x, reg_class_contents[(int)FPU_REGS]); \
190
      for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
191
       if (TEST_HARD_REG_BIT (x, i))            \
192
        fixed_regs[i] = call_used_regs[i] = 1;  \
193
    }                                           \
194
                                                \
195
  if (TARGET_AC0)                               \
196
      call_used_regs[8] = 1;                    \
197
  if (TARGET_UNIX_ASM)                          \
198
    {                                           \
199
      /* Change names of FPU registers for the UNIX assembler.  */ \
200
      reg_names[8] = "fr0";                     \
201
      reg_names[9] = "fr1";                     \
202
      reg_names[10] = "fr2";                    \
203
      reg_names[11] = "fr3";                    \
204
      reg_names[12] = "fr4";                    \
205
      reg_names[13] = "fr5";                    \
206
    }                                           \
207
}
208
 
209
/* Return number of consecutive hard regs needed starting at reg REGNO
210
   to hold something of mode MODE.
211
   This is ordinarily the length in words of a value of mode MODE
212
   but can be less for certain modes in special long registers.
213
*/
214
 
215
#define HARD_REGNO_NREGS(REGNO, MODE)   \
216
((REGNO < 8)?                                                           \
217
    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)      \
218
    :1)
219
 
220
 
221
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
222
   On the pdp, the cpu registers can hold any mode - check alignment
223
 
224
   FPU can only hold DF - simplifies life!
225
*/
226
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
227
(((REGNO) < 8)?                                         \
228
  ((GET_MODE_BITSIZE(MODE) <= 16)                       \
229
   || (GET_MODE_BITSIZE(MODE) == 32 && !((REGNO) & 1))) \
230
  :(MODE) == DFmode)
231
 
232
 
233
/* Value is 1 if it is a good idea to tie two pseudo registers
234
   when one has mode MODE1 and one has mode MODE2.
235
   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
236
   for any hard reg, then this must be 0 for correct output.  */
237
#define MODES_TIEABLE_P(MODE1, MODE2) 0
238
 
239
/* Specify the registers used for certain standard purposes.
240
   The values of these macros are register numbers.  */
241
 
242
/* the pdp11 pc overloaded on a register that the compiler knows about.  */
243
#define PC_REGNUM  7
244
 
245
/* Register to use for pushing function arguments.  */
246
#define STACK_POINTER_REGNUM 6
247
 
248
/* Base register for access to local variables of the function.  */
249
#define FRAME_POINTER_REGNUM 5
250
 
251
/* Value should be nonzero if functions must have frame pointers.
252
   Zero means the frame pointer need not be set up (and parms
253
   may be accessed via the stack pointer) in functions that seem suitable.
254
   This is computed in `reload', in reload1.c.
255
  */
256
 
257
#define FRAME_POINTER_REQUIRED 0
258
 
259
/* Base register for access to arguments of the function.  */
260
#define ARG_POINTER_REGNUM 5
261
 
262
/* Register in which static-chain is passed to a function.  */
263
/* ??? - i don't want to give up a reg for this! */
264
#define STATIC_CHAIN_REGNUM 4
265
 
266
/* Define the classes of registers for register constraints in the
267
   machine description.  Also define ranges of constants.
268
 
269
   One of the classes must always be named ALL_REGS and include all hard regs.
270
   If there is more than one class, another class must be named NO_REGS
271
   and contain no registers.
272
 
273
   The name GENERAL_REGS must be the name of a class (or an alias for
274
   another name such as ALL_REGS).  This is the class of registers
275
   that is allowed by "g" or "r" in a register constraint.
276
   Also, registers outside this class are allocated only when
277
   instructions express preferences for them.
278
 
279
   The classes must be numbered in nondecreasing order; that is,
280
   a larger-numbered class must never be contained completely
281
   in a smaller-numbered class.
282
 
283
   For any two classes, it is very desirable that there be another
284
   class that represents their union.  */
285
 
286
/* The pdp has a couple of classes:
287
 
288
MUL_REGS are used for odd numbered regs, to use in 16 bit multiplication
289
         (even numbered do 32 bit multiply)
290
LMUL_REGS long multiply registers (even numbered regs )
291
          (don't need them, all 32 bit regs are even numbered!)
292
GENERAL_REGS is all cpu
293
LOAD_FPU_REGS is the first four cpu regs, they are easier to load
294
NO_LOAD_FPU_REGS is ac4 and ac5, currently - difficult to load them
295
FPU_REGS is all fpu regs
296
*/
297
 
298
enum reg_class { NO_REGS, MUL_REGS, GENERAL_REGS, LOAD_FPU_REGS, NO_LOAD_FPU_REGS, FPU_REGS, ALL_REGS, LIM_REG_CLASSES };
299
 
300
#define N_REG_CLASSES (int) LIM_REG_CLASSES
301
 
302
/* have to allow this till cmpsi/tstsi are fixed in a better way !! */
303
#define SMALL_REGISTER_CLASSES 1
304
 
305
/* Since GENERAL_REGS is the same class as ALL_REGS,
306
   don't give it a different class number; just make it an alias.  */
307
 
308
/* #define GENERAL_REGS ALL_REGS */
309
 
310
/* Give names of register classes as strings for dump file.  */
311
 
312
#define REG_CLASS_NAMES {"NO_REGS", "MUL_REGS", "GENERAL_REGS", "LOAD_FPU_REGS", "NO_LOAD_FPU_REGS", "FPU_REGS", "ALL_REGS" }
313
 
314
/* Define which registers fit in which classes.
315
   This is an initializer for a vector of HARD_REG_SET
316
   of length N_REG_CLASSES.  */
317
 
318
#define REG_CLASS_CONTENTS {{0}, {0x00aa}, {0x00ff}, {0x0f00}, {0x3000}, {0x3f00}, {0x3fff}}
319
 
320
/* The same information, inverted:
321
   Return the class number of the smallest class containing
322
   reg number REGNO.  This could be a conditional expression
323
   or could index an array.  */
324
 
325
#define REGNO_REG_CLASS(REGNO)          \
326
((REGNO)>=8?((REGNO)<=11?LOAD_FPU_REGS:NO_LOAD_FPU_REGS):(((REGNO)&1)?MUL_REGS:GENERAL_REGS))
327
 
328
 
329
/* The class value for index registers, and the one for base regs.  */
330
#define INDEX_REG_CLASS GENERAL_REGS
331
#define BASE_REG_CLASS GENERAL_REGS
332
 
333
/* Get reg_class from a letter such as appears in the machine description.  */
334
 
335
#define REG_CLASS_FROM_LETTER(C)        \
336
((C) == 'f' ? FPU_REGS :                        \
337
  ((C) == 'd' ? MUL_REGS :                      \
338
   ((C) == 'a' ? LOAD_FPU_REGS : NO_REGS)))
339
 
340
 
341
/* The letters I, J, K, L and M in a register constraint string
342
   can be used to stand for particular ranges of immediate operands.
343
   This macro defines what the ranges are.
344
   C is the letter, and VALUE is a constant value.
345
   Return 1 if VALUE is in the range specified by C.
346
 
347
   I            bits 31-16 0000
348
   J            bits 15-00 0000
349
   K            completely random 32 bit
350
   L,M,N        -1,1,0 respectively
351
   O            where doing shifts in sequence is faster than
352
                one big shift
353
*/
354
 
355
#define CONST_OK_FOR_LETTER_P(VALUE, C)  \
356
  ((C) == 'I' ? ((VALUE) & 0xffff0000) == 0              \
357
   : (C) == 'J' ? ((VALUE) & 0x0000ffff) == 0            \
358
   : (C) == 'K' ? (((VALUE) & 0xffff0000) != 0           \
359
                   && ((VALUE) & 0x0000ffff) != 0)       \
360
   : (C) == 'L' ? ((VALUE) == 1)                        \
361
   : (C) == 'M' ? ((VALUE) == -1)                       \
362
   : (C) == 'N' ? ((VALUE) == 0)                 \
363
   : (C) == 'O' ? (abs(VALUE) >1 && abs(VALUE) <= 4)            \
364
   : 0)
365
 
366
/* Similar, but for floating constants, and defining letters G and H.
367
   Here VALUE is the CONST_DOUBLE rtx itself.  */
368
 
369
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
370
  ((C) == 'G' && XINT (VALUE, 0) == 0 && XINT (VALUE, 1) == 0)
371
 
372
 
373
/* Letters in the range `Q' through `U' may be defined in a
374
   machine-dependent fashion to stand for arbitrary operand types.
375
   The machine description macro `EXTRA_CONSTRAINT' is passed the
376
   operand as its first argument and the constraint letter as its
377
   second operand.
378
 
379
   `Q'  is for memory references that require an extra word after the opcode.
380
   `R'  is for memory references which are encoded within the opcode.  */
381
 
382
#define EXTRA_CONSTRAINT(OP,CODE)                                       \
383
  ((GET_CODE (OP) != MEM) ? 0                                            \
384
   : !legitimate_address_p (GET_MODE (OP), XEXP (OP, 0)) ? 0              \
385
   : ((CODE) == 'Q')      ? !simple_memory_operand (OP, GET_MODE (OP))  \
386
   : ((CODE) == 'R')      ? simple_memory_operand (OP, GET_MODE (OP))   \
387
   : 0)
388
 
389
/* Given an rtx X being reloaded into a reg required to be
390
   in class CLASS, return the class of reg to actually use.
391
   In general this is just CLASS; but on some machines
392
   in some cases it is preferable to use a more restrictive class.
393
 
394
loading is easier into LOAD_FPU_REGS than FPU_REGS! */
395
 
396
#define PREFERRED_RELOAD_CLASS(X,CLASS)         \
397
(((CLASS) != FPU_REGS)?(CLASS):LOAD_FPU_REGS)
398
 
399
#define SECONDARY_RELOAD_CLASS(CLASS,MODE,x)    \
400
(((CLASS) == NO_LOAD_FPU_REGS && !(REG_P(x) && LOAD_FPU_REG_P(REGNO(x))))?LOAD_FPU_REGS:NO_REGS)
401
 
402
/* Return the maximum number of consecutive registers
403
   needed to represent mode MODE in a register of class CLASS.  */
404
#define CLASS_MAX_NREGS(CLASS, MODE)    \
405
((CLASS == GENERAL_REGS || CLASS == MUL_REGS)?                          \
406
  ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD):       \
407
  1                                                                     \
408
)
409
 
410
 
411
/* Stack layout; function entry, exit and calling.  */
412
 
413
/* Define this if pushing a word on the stack
414
   makes the stack pointer a smaller address.  */
415
#define STACK_GROWS_DOWNWARD
416
 
417
/* Define this to nonzero if the nominal address of the stack frame
418
   is at the high-address end of the local variables;
419
   that is, each additional local variable allocated
420
   goes at a more negative offset in the frame.
421
*/
422
#define FRAME_GROWS_DOWNWARD 1
423
 
424
/* Offset within stack frame to start allocating local variables at.
425
   If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
426
   first local allocated.  Otherwise, it is the offset to the BEGINNING
427
   of the first local allocated.  */
428
#define STARTING_FRAME_OFFSET 0
429
 
430
/* If we generate an insn to push BYTES bytes,
431
   this says how many the stack pointer really advances by.
432
   On the pdp11, the stack is on an even boundary */
433
#define PUSH_ROUNDING(BYTES) ((BYTES + 1) & ~1)
434
 
435
/* current_first_parm_offset stores the # of registers pushed on the
436
   stack */
437
extern int current_first_parm_offset;
438
 
439
/* Offset of first parameter from the argument pointer register value.
440
   For the pdp11, this is nonzero to account for the return address.
441
        1 - return address
442
        2 - frame pointer (always saved, even when not used!!!!)
443
                -- chnage some day !!!:q!
444
 
445
*/
446
#define FIRST_PARM_OFFSET(FNDECL) 4
447
 
448
/* Value is 1 if returning from a function call automatically
449
   pops the arguments described by the number-of-args field in the call.
450
   FUNDECL is the declaration node of the function (as a tree),
451
   FUNTYPE is the data type of the function (as a tree),
452
   or for a library call it is an identifier node for the subroutine name.  */
453
 
454
#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
455
 
456
/* Define how to find the value returned by a function.
457
   VALTYPE is the data type of the value (as a tree).
458
   If the precise function being called is known, FUNC is its FUNCTION_DECL;
459
   otherwise, FUNC is 0.  */
460
#define BASE_RETURN_VALUE_REG(MODE) \
461
 ((MODE) == DFmode ? 8 : 0)
462
 
463
/* On the pdp11 the value is found in R0 (or ac0???
464
not without FPU!!!! ) */
465
 
466
#define FUNCTION_VALUE(VALTYPE, FUNC)  \
467
  gen_rtx_REG (TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
468
 
469
/* and the called function leaves it in the first register.
470
   Difference only on machines with register windows.  */
471
 
472
#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC)  \
473
  gen_rtx_REG (TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
474
 
475
/* Define how to find the value returned by a library function
476
   assuming the value has mode MODE.  */
477
 
478
#define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, BASE_RETURN_VALUE_REG(MODE))
479
 
480
/* 1 if N is a possible register number for a function value
481
   as seen by the caller.
482
   On the pdp, the first "output" reg is the only register thus used.
483
 
484
maybe ac0 ? - as option someday! */
485
 
486
#define FUNCTION_VALUE_REGNO_P(N) (((N) == 0) || (TARGET_AC0 && (N) == 8))
487
 
488
/* 1 if N is a possible register number for function argument passing.
489
   - not used on pdp */
490
 
491
#define FUNCTION_ARG_REGNO_P(N) 0
492
 
493
/* Define a data type for recording info about an argument list
494
   during the scan of that argument list.  This data type should
495
   hold all necessary information about the function itself
496
   and about the args processed so far, enough to enable macros
497
   such as FUNCTION_ARG to determine where the next arg should go.
498
 
499
*/
500
 
501
#define CUMULATIVE_ARGS int
502
 
503
/* Initialize a variable CUM of type CUMULATIVE_ARGS
504
   for a call to a function whose data type is FNTYPE.
505
   For a library call, FNTYPE is 0.
506
 
507
   ...., the offset normally starts at 0, but starts at 1 word
508
   when the function gets a structure-value-address as an
509
   invisible first argument.  */
510
 
511
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
512
 ((CUM) = 0)
513
 
514
/* Update the data in CUM to advance over an argument
515
   of mode MODE and data type TYPE.
516
   (TYPE is null for libcalls where that information may not be available.)
517
 
518
*/
519
 
520
 
521
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
522
 ((CUM) += ((MODE) != BLKmode                   \
523
            ? (GET_MODE_SIZE (MODE))            \
524
            : (int_size_in_bytes (TYPE))))
525
 
526
/* Determine where to put an argument to a function.
527
   Value is zero to push the argument on the stack,
528
   or a hard register in which to store the argument.
529
 
530
   MODE is the argument's machine mode.
531
   TYPE is the data type of the argument (as a tree).
532
    This is null for libcalls where that information may
533
    not be available.
534
   CUM is a variable of type CUMULATIVE_ARGS which gives info about
535
    the preceding args and about the function being called.
536
   NAMED is nonzero if this argument is a named parameter
537
    (otherwise it is an extra parameter matching an ellipsis).  */
538
 
539
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)  0
540
 
541
/* Define where a function finds its arguments.
542
   This would be different from FUNCTION_ARG if we had register windows.  */
543
/*
544
#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED)   \
545
  FUNCTION_ARG (CUM, MODE, TYPE, NAMED)
546
*/
547
 
548
/* Output assembler code to FILE to increment profiler label # LABELNO
549
   for profiling a function entry.  */
550
 
551
#define FUNCTION_PROFILER(FILE, LABELNO)  \
552
   gcc_unreachable ();
553
 
554
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
555
   the stack pointer does not matter.  The value is tested only in
556
   functions that have frame pointers.
557
   No definition is equivalent to always zero.  */
558
 
559
extern int may_call_alloca;
560
 
561
#define EXIT_IGNORE_STACK       1
562
 
563
#define INITIAL_FRAME_POINTER_OFFSET(DEPTH_VAR) \
564
{                                                               \
565
  int offset, regno;                                            \
566
  offset = get_frame_size();                                    \
567
  for (regno = 0; regno < 8; regno++)                            \
568
    if (regs_ever_live[regno] && ! call_used_regs[regno])       \
569
      offset += 2;                                              \
570
  for (regno = 8; regno < 14; regno++)                          \
571
    if (regs_ever_live[regno] && ! call_used_regs[regno])       \
572
      offset += 8;                                              \
573
  /* offset -= 2;   no fp on stack frame */                     \
574
  (DEPTH_VAR) = offset;                                         \
575
}
576
 
577
 
578
/* Addressing modes, and classification of registers for them.  */
579
 
580
#define HAVE_POST_INCREMENT 1
581
 
582
#define HAVE_PRE_DECREMENT 1
583
 
584
/* Macros to check register numbers against specific register classes.  */
585
 
586
/* These assume that REGNO is a hard or pseudo reg number.
587
   They give nonzero only if REGNO is a hard reg of the suitable class
588
   or a pseudo reg currently allocated to a suitable hard reg.
589
   Since they use reg_renumber, they are safe only once reg_renumber
590
   has been allocated, which happens in local-alloc.c.  */
591
 
592
#define REGNO_OK_FOR_INDEX_P(REGNO) \
593
  ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
594
#define REGNO_OK_FOR_BASE_P(REGNO)  \
595
  ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
596
 
597
/* Now macros that check whether X is a register and also,
598
   strictly, whether it is in a specified class.
599
*/
600
 
601
 
602
 
603
/* Maximum number of registers that can appear in a valid memory address.  */
604
 
605
#define MAX_REGS_PER_ADDRESS 1
606
 
607
/* Recognize any constant value that is a valid address.  */
608
 
609
#define CONSTANT_ADDRESS_P(X)  CONSTANT_P (X)
610
 
611
/* Nonzero if the constant value X is a legitimate general operand.
612
   It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
613
 
614
#define LEGITIMATE_CONSTANT_P(X)                                        \
615
  (GET_CODE (X) != CONST_DOUBLE || legitimate_const_double_p (X))
616
 
617
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
618
   and check its validity for a certain class.
619
   We have two alternate definitions for each of them.
620
   The usual definition accepts all pseudo regs; the other rejects
621
   them unless they have been allocated suitable hard regs.
622
   The symbol REG_OK_STRICT causes the latter definition to be used.
623
 
624
   Most source files want to accept pseudo regs in the hope that
625
   they will get allocated to the class that the insn wants them to be in.
626
   Source files for reload pass need to be strict.
627
   After reload, it makes no difference, since pseudo regs have
628
   been eliminated by then.  */
629
 
630
#ifndef REG_OK_STRICT
631
 
632
/* Nonzero if X is a hard reg that can be used as an index
633
   or if it is a pseudo reg.  */
634
#define REG_OK_FOR_INDEX_P(X) (1)
635
/* Nonzero if X is a hard reg that can be used as a base reg
636
   or if it is a pseudo reg.  */
637
#define REG_OK_FOR_BASE_P(X) (1)
638
 
639
#else
640
 
641
/* Nonzero if X is a hard reg that can be used as an index.  */
642
#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
643
/* Nonzero if X is a hard reg that can be used as a base reg.  */
644
#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
645
 
646
#endif
647
 
648
/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
649
   that is a valid memory address for an instruction.
650
   The MODE argument is the machine mode for the MEM expression
651
   that wants to use this address.
652
 
653
*/
654
 
655
#define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
656
{                                                     \
657
    rtx xfoob;                                                          \
658
                                                                        \
659
    /* accept (R0) */                                                   \
660
    if (GET_CODE (operand) == REG                                       \
661
        && REG_OK_FOR_BASE_P(operand))                                  \
662
      goto ADDR;                                                        \
663
                                                                        \
664
    /* accept @#address */                                              \
665
    if (CONSTANT_ADDRESS_P (operand))                                   \
666
      goto ADDR;                                                        \
667
                                                                        \
668
    /* accept X(R0) */                                                  \
669
    if (GET_CODE (operand) == PLUS                                      \
670
        && GET_CODE (XEXP (operand, 0)) == REG                           \
671
        && REG_OK_FOR_BASE_P (XEXP (operand, 0))                 \
672
        && CONSTANT_ADDRESS_P (XEXP (operand, 1)))                      \
673
      goto ADDR;                                                        \
674
                                                                        \
675
    /* accept -(R0) */                                                  \
676
    if (GET_CODE (operand) == PRE_DEC                                   \
677
        && GET_CODE (XEXP (operand, 0)) == REG                           \
678
        && REG_OK_FOR_BASE_P (XEXP (operand, 0)))                        \
679
      goto ADDR;                                                        \
680
                                                                        \
681
    /* accept (R0)+ */                                                  \
682
    if (GET_CODE (operand) == POST_INC                                  \
683
        && GET_CODE (XEXP (operand, 0)) == REG                           \
684
        && REG_OK_FOR_BASE_P (XEXP (operand, 0)))                        \
685
      goto ADDR;                                                        \
686
                                                                        \
687
    /* accept -(SP) -- which uses PRE_MODIFY for byte mode */           \
688
    if (GET_CODE (operand) == PRE_MODIFY                                \
689
        && GET_CODE (XEXP (operand, 0)) == REG                           \
690
        && REGNO (XEXP (operand, 0)) == 6                                \
691
        && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS               \
692
        && GET_CODE (XEXP (xfoob, 0)) == REG                             \
693
        && REGNO (XEXP (xfoob, 0)) == 6                                  \
694
        && CONSTANT_P (XEXP (xfoob, 1))                                 \
695
        && INTVAL (XEXP (xfoob,1)) == -2)                               \
696
      goto ADDR;                                                        \
697
                                                                        \
698
    /* accept (SP)+ -- which uses POST_MODIFY for byte mode */          \
699
    if (GET_CODE (operand) == POST_MODIFY                               \
700
        && GET_CODE (XEXP (operand, 0)) == REG                           \
701
        && REGNO (XEXP (operand, 0)) == 6                                \
702
        && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS               \
703
        && GET_CODE (XEXP (xfoob, 0)) == REG                             \
704
        && REGNO (XEXP (xfoob, 0)) == 6                                  \
705
        && CONSTANT_P (XEXP (xfoob, 1))                                 \
706
        && INTVAL (XEXP (xfoob,1)) == 2)                                \
707
      goto ADDR;                                                        \
708
                                                                        \
709
                                                                        \
710
    /* handle another level of indirection ! */                         \
711
    if (GET_CODE(operand) != MEM)                                       \
712
      goto fail;                                                        \
713
                                                                        \
714
    xfoob = XEXP (operand, 0);                                           \
715
                                                                        \
716
    /* (MEM:xx (MEM:xx ())) is not valid for SI, DI and currently */    \
717
    /* also forbidden for float, because we have to handle this */      \
718
    /* in output_move_double and/or output_move_quad() - we could */    \
719
    /* do it, but currently it's not worth it!!! */                     \
720
    /* now that DFmode cannot go into CPU register file, */             \
721
    /* maybe I should allow float ... */                                \
722
    /*  but then I have to handle memory-to-memory moves in movdf ?? */ \
723
                                                                        \
724
    if (GET_MODE_BITSIZE(mode) > 16)                                    \
725
      goto fail;                                                        \
726
                                                                        \
727
    /* accept @(R0) - which is @0(R0) */                                \
728
    if (GET_CODE (xfoob) == REG                                         \
729
        && REG_OK_FOR_BASE_P(xfoob))                                    \
730
      goto ADDR;                                                        \
731
                                                                        \
732
    /* accept @address */                                               \
733
    if (CONSTANT_ADDRESS_P (xfoob))                                     \
734
      goto ADDR;                                                        \
735
                                                                        \
736
    /* accept @X(R0) */                                                 \
737
    if (GET_CODE (xfoob) == PLUS                                        \
738
        && GET_CODE (XEXP (xfoob, 0)) == REG                             \
739
        && REG_OK_FOR_BASE_P (XEXP (xfoob, 0))                           \
740
        && CONSTANT_ADDRESS_P (XEXP (xfoob, 1)))                        \
741
      goto ADDR;                                                        \
742
                                                                        \
743
    /* accept @-(R0) */                                                 \
744
    if (GET_CODE (xfoob) == PRE_DEC                                     \
745
        && GET_CODE (XEXP (xfoob, 0)) == REG                             \
746
        && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)))                          \
747
      goto ADDR;                                                        \
748
                                                                        \
749
    /* accept @(R0)+ */                                                 \
750
    if (GET_CODE (xfoob) == POST_INC                                    \
751
        && GET_CODE (XEXP (xfoob, 0)) == REG                             \
752
        && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)))                          \
753
      goto ADDR;                                                        \
754
                                                                        \
755
  /* anything else is invalid */                                        \
756
  fail: ;                                                               \
757
}
758
 
759
 
760
/* Go to LABEL if ADDR (a legitimate address expression)
761
   has an effect that depends on the machine mode it is used for.
762
   On the pdp this is for predec/postinc */
763
 
764
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)        \
765
 { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC)       \
766
     goto LABEL;                                                        \
767
 }
768
 
769
 
770
/* Specify the machine mode that this machine uses
771
   for the index in the tablejump instruction.  */
772
#define CASE_VECTOR_MODE HImode
773
 
774
/* Define this if a raw index is all that is needed for a
775
   `tablejump' insn.  */
776
#define CASE_TAKES_INDEX_RAW
777
 
778
/* Define this as 1 if `char' should by default be signed; else as 0.  */
779
#define DEFAULT_SIGNED_CHAR 1
780
 
781
/* Max number of bytes we can move from memory to memory
782
   in one reasonably fast instruction.
783
*/
784
 
785
#define MOVE_MAX 2
786
 
787
/* Nonzero if access to memory by byte is slow and undesirable. -
788
*/
789
#define SLOW_BYTE_ACCESS 0
790
 
791
/* Do not break .stabs pseudos into continuations.  */
792
#define DBX_CONTIN_LENGTH 0
793
 
794
/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
795
   is done just by pretending it is already truncated.  */
796
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
797
 
798
/* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE,
799
   return the mode to be used for the comparison.  For floating-point, CCFPmode
800
   should be used.  */
801
 
802
#define SELECT_CC_MODE(OP,X,Y)  \
803
(GET_MODE_CLASS(GET_MODE(X)) == MODE_FLOAT? CCFPmode : CCmode)
804
 
805
/* Specify the machine mode that pointers have.
806
   After generation of rtl, the compiler makes no further distinction
807
   between pointers and any other objects of this machine mode.  */
808
#define Pmode HImode
809
 
810
/* A function address in a call instruction
811
   is a word address (for indexing purposes)
812
   so give the MEM rtx a word's mode.  */
813
#define FUNCTION_MODE HImode
814
 
815
/* Define this if addresses of constant functions
816
   shouldn't be put through pseudo regs where they can be cse'd.
817
   Desirable on machines where ordinary constants are expensive
818
   but a CALL with constant address is cheap.  */
819
/* #define NO_FUNCTION_CSE */
820
 
821
 
822
/* cost of moving one register class to another */
823
#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
824
  register_move_cost (CLASS1, CLASS2)
825
 
826
/* Tell emit-rtl.c how to initialize special values on a per-function base.  */
827
extern int optimize;
828
extern struct rtx_def *cc0_reg_rtx;
829
 
830
#define CC_STATUS_MDEP rtx
831
 
832
#define CC_STATUS_MDEP_INIT (cc_status.mdep = 0)
833
 
834
/* Tell final.c how to eliminate redundant test instructions.  */
835
 
836
/* Here we define machine-dependent flags and fields in cc_status
837
   (see `conditions.h').  */
838
 
839
#define CC_IN_FPU 04000 
840
 
841
/* Do UPDATE_CC if EXP is a set, used in
842
   NOTICE_UPDATE_CC
843
 
844
   floats only do compare correctly, else nullify ...
845
 
846
   get cc0 out soon ...
847
*/
848
 
849
/* Store in cc_status the expressions
850
   that the condition codes will describe
851
   after execution of an instruction whose pattern is EXP.
852
   Do not alter them if the instruction would not alter the cc's.  */
853
 
854
#define NOTICE_UPDATE_CC(EXP, INSN) \
855
{ if (GET_CODE (EXP) == SET)                                    \
856
    {                                                           \
857
      notice_update_cc_on_set(EXP, INSN);                       \
858
    }                                                           \
859
  else if (GET_CODE (EXP) == PARALLEL                           \
860
           && GET_CODE (XVECEXP (EXP, 0, 0)) == SET)              \
861
    {                                                           \
862
      notice_update_cc_on_set(XVECEXP (EXP, 0, 0), INSN); \
863
    }                                                           \
864
  else if (GET_CODE (EXP) == CALL)                              \
865
    { /* all bets are off */ CC_STATUS_INIT; }                  \
866
  if (cc_status.value1 && GET_CODE (cc_status.value1) == REG    \
867
      && cc_status.value2                                       \
868
      && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
869
    {                                                           \
870
      printf ("here!\n");                                       \
871
      cc_status.value2 = 0;                                      \
872
    }                                                           \
873
}
874
 
875
/* Control the assembler format that we output.  */
876
 
877
/* Output to assembler file text saying following lines
878
   may contain character constants, extra white space, comments, etc.  */
879
 
880
#define ASM_APP_ON ""
881
 
882
/* Output to assembler file text saying following lines
883
   no longer contain unusual constructs.  */
884
 
885
#define ASM_APP_OFF ""
886
 
887
/* Output before read-only data.  */
888
 
889
#define TEXT_SECTION_ASM_OP "\t.text\n"
890
 
891
/* Output before writable data.  */
892
 
893
#define DATA_SECTION_ASM_OP "\t.data\n"
894
 
895
/* How to refer to registers in assembler output.
896
   This sequence is indexed by compiler's hard-register-number (see above).  */
897
 
898
#define REGISTER_NAMES \
899
{"r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc",     \
900
 "ac0", "ac1", "ac2", "ac3", "ac4", "ac5" }
901
 
902
/* Globalizing directive for a label.  */
903
#define GLOBAL_ASM_OP "\t.globl "
904
 
905
/* The prefix to add to user-visible assembler symbols.  */
906
 
907
#define USER_LABEL_PREFIX "_"
908
 
909
/* This is how to store into the string LABEL
910
   the symbol_ref name of an internal numbered label where
911
   PREFIX is the class of label and NUM is the number within the class.
912
   This is suitable for output with `assemble_name'.  */
913
 
914
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
915
  sprintf (LABEL, "*%s_%lu", PREFIX, (unsigned long)(NUM))
916
 
917
#define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
918
  output_ascii (FILE, P, SIZE)
919
 
920
/* This is how to output an element of a case-vector that is absolute.  */
921
 
922
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
923
  fprintf (FILE, "\t%sL_%d\n", TARGET_UNIX_ASM ? "" : ".word ", VALUE)
924
 
925
/* This is how to output an element of a case-vector that is relative.
926
   Don't define this if it is not supported.  */
927
 
928
/* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
929
 
930
/* This is how to output an assembler line
931
   that says to advance the location counter
932
   to a multiple of 2**LOG bytes.
933
 
934
   who needs this????
935
*/
936
 
937
#define ASM_OUTPUT_ALIGN(FILE,LOG)      \
938
  switch (LOG)                          \
939
    {                                   \
940
      case 0:                            \
941
        break;                          \
942
      case 1:                           \
943
        fprintf (FILE, "\t.even\n");    \
944
        break;                          \
945
      default:                          \
946
        gcc_unreachable ();             \
947
    }
948
 
949
#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
950
  fprintf (FILE, "\t.=.+ %#ho\n", (unsigned short)(SIZE))
951
 
952
/* This says how to output an assembler line
953
   to define a global common symbol.  */
954
 
955
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
956
( fprintf ((FILE), ".globl "),                  \
957
  assemble_name ((FILE), (NAME)),               \
958
  fprintf ((FILE), "\n"),                       \
959
  assemble_name ((FILE), (NAME)),               \
960
  fprintf ((FILE), ": .=.+ %#ho\n", (unsigned short)(ROUNDED))          \
961
)
962
 
963
/* This says how to output an assembler line
964
   to define a local common symbol.  */
965
 
966
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
967
( assemble_name ((FILE), (NAME)),                               \
968
  fprintf ((FILE), ":\t.=.+ %#ho\n", (unsigned short)(ROUNDED)))
969
 
970
/* Print operand X (an rtx) in assembler syntax to file FILE.
971
   CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
972
   For `%' followed by punctuation, CODE is the punctuation and X is null.
973
 
974
*/
975
 
976
 
977
#define PRINT_OPERAND(FILE, X, CODE)  \
978
{ if (CODE == '#') fprintf (FILE, "#");                                 \
979
  else if (GET_CODE (X) == REG)                                         \
980
    fprintf (FILE, "%s", reg_names[REGNO (X)]);                         \
981
  else if (GET_CODE (X) == MEM)                                         \
982
    output_address (XEXP (X, 0));                                        \
983
  else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != SImode)      \
984
    { REAL_VALUE_TYPE r;                                                \
985
      long sval[2];                                                     \
986
      REAL_VALUE_FROM_CONST_DOUBLE (r, X);                              \
987
      REAL_VALUE_TO_TARGET_DOUBLE (r, sval);                            \
988
      fprintf (FILE, "$%#o", sval[0] >> 16); }                           \
989
  else { putc ('$', FILE); output_addr_const_pdp11 (FILE, X); }}
990
 
991
/* Print a memory address as an operand to reference that memory location.  */
992
 
993
#define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
994
 print_operand_address (FILE, ADDR)
995
 
996
#define ASM_OUTPUT_REG_PUSH(FILE,REGNO)                 \
997
(                                                       \
998
  fprintf (FILE, "\tmov %s, -(sp)\n", reg_names[REGNO]) \
999
)
1000
 
1001
#define ASM_OUTPUT_REG_POP(FILE,REGNO)                          \
1002
(                                                               \
1003
  fprintf (FILE, "\tmov (sp)+, %s\n", reg_names[REGNO])         \
1004
)
1005
 
1006
/* trampoline - how should i do it in separate i+d ?
1007
   have some allocate_trampoline magic???
1008
 
1009
   the following should work for shared I/D: */
1010
 
1011
/* lets see whether this works as trampoline:
1012
MV      #STATIC, $4     0x940Y  0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
1013
JMP     FUNCTION        0x0058  0x0000 <- FUNCTION
1014
*/
1015
 
1016
#define TRAMPOLINE_TEMPLATE(FILE)       \
1017
{                                       \
1018
  gcc_assert (!TARGET_SPLIT);           \
1019
                                        \
1020
  assemble_aligned_integer (2, GEN_INT (0x9400+STATIC_CHAIN_REGNUM));   \
1021
  assemble_aligned_integer (2, const0_rtx);                             \
1022
  assemble_aligned_integer (2, GEN_INT(0x0058));                        \
1023
  assemble_aligned_integer (2, const0_rtx);                             \
1024
}
1025
 
1026
#define TRAMPOLINE_SIZE 8
1027
#define TRAMPOLINE_ALIGNMENT 16
1028
 
1029
/* Emit RTL insns to initialize the variable parts of a trampoline.
1030
   FNADDR is an RTX for the address of the function's pure code.
1031
   CXT is an RTX for the static chain value for the function.  */
1032
 
1033
#define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT) \
1034
{                                       \
1035
  gcc_assert (!TARGET_SPLIT);           \
1036
                                        \
1037
  emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 2)), CXT); \
1038
  emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), FNADDR); \
1039
}
1040
 
1041
 
1042
/* Some machines may desire to change what optimizations are
1043
   performed for various optimization levels.   This macro, if
1044
   defined, is executed once just after the optimization level is
1045
   determined and before the remainder of the command options have
1046
   been parsed.  Values set in this macro are used as the default
1047
   values for the other command line options.
1048
 
1049
   LEVEL is the optimization level specified; 2 if -O2 is
1050
   specified, 1 if -O is specified, and 0 if neither is specified.  */
1051
 
1052
#define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                                \
1053
{                                                                       \
1054
  if (LEVEL >= 3)                                                       \
1055
    {                                                                   \
1056
      flag_omit_frame_pointer           = 1;                            \
1057
      /* flag_unroll_loops                      = 1; */                 \
1058
    }                                                                   \
1059
}
1060
 
1061
/* there is no point in avoiding branches on a pdp,
1062
   since branches are really cheap - I just want to find out
1063
   how much difference the BRANCH_COST macro makes in code */
1064
#define BRANCH_COST (TARGET_BRANCH_CHEAP ? 0 : 1)
1065
 
1066
 
1067
#define COMPARE_FLAG_MODE HImode

powered by: WebSVN 2.1.0

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