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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [h8300/] [h8300.h] - Blame information for rev 801

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

Line No. Rev Author Line
1 709 jeremybenn
/* Definitions of target machine for GNU compiler.
2
   Renesas H8/300 (generic)
3
   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1996, 1997, 1998, 1999,
4
   2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
5
   Free Software Foundation, Inc.
6
   Contributed by Steve Chamberlain (sac@cygnus.com),
7
   Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
8
 
9
This file is part of GCC.
10
 
11
GCC is free software; you can redistribute it and/or modify
12
it under the terms of the GNU General Public License as published by
13
the Free Software Foundation; either version 3, or (at your option)
14
any later version.
15
 
16
GCC is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
GNU General Public License for more details.
20
 
21
You should have received a copy of the GNU General Public License
22
along with GCC; see the file COPYING3.  If not see
23
<http://www.gnu.org/licenses/>.  */
24
 
25
#ifndef GCC_H8300_H
26
#define GCC_H8300_H
27
 
28
/* Which CPU to compile for.
29
   We use int for CPU_TYPE to avoid lots of casts.  */
30
#if 0 /* defined in insn-attr.h, here for documentation */
31
enum attr_cpu { CPU_H8300, CPU_H8300H };
32
#endif
33
extern int cpu_type;
34
 
35
/* Various globals defined in h8300.c.  */
36
 
37
extern const char *h8_push_op, *h8_pop_op, *h8_mov_op;
38
extern const char * const *h8_reg_names;
39
 
40
/* Target CPU builtins.  */
41
#define TARGET_CPU_CPP_BUILTINS()                       \
42
  do                                                    \
43
    {                                                   \
44
      if (TARGET_H8300H)                                \
45
        {                                               \
46
          builtin_define ("__H8300H__");                \
47
          builtin_assert ("cpu=h8300h");                \
48
          builtin_assert ("machine=h8300h");            \
49
          if (TARGET_NORMAL_MODE)                       \
50
            {                                           \
51
              builtin_define ("__NORMAL_MODE__");       \
52
            }                                           \
53
        }                                               \
54
      else if (TARGET_H8300SX)                          \
55
        {                                               \
56
          builtin_define ("__H8300SX__");               \
57
          if (TARGET_NORMAL_MODE)                       \
58
            {                                           \
59
              builtin_define ("__NORMAL_MODE__");       \
60
            }                                           \
61
        }                                               \
62
      else if (TARGET_H8300S)                           \
63
        {                                               \
64
          builtin_define ("__H8300S__");                \
65
          builtin_assert ("cpu=h8300s");                \
66
          builtin_assert ("machine=h8300s");            \
67
          if (TARGET_NORMAL_MODE)                       \
68
            {                                           \
69
              builtin_define ("__NORMAL_MODE__");       \
70
            }                                           \
71
        }                                               \
72
      else                                              \
73
        {                                               \
74
          builtin_define ("__H8300__");                 \
75
          builtin_assert ("cpu=h8300");                 \
76
          builtin_assert ("machine=h8300");             \
77
        }                                               \
78
    }                                                   \
79
  while (0)
80
 
81
#define LINK_SPEC "%{mh:%{mn:-m h8300hn}} %{mh:%{!mn:-m h8300h}} %{ms:%{mn:-m h8300sn}} %{ms:%{!mn:-m h8300s}}"
82
 
83
#define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
84
 
85
/* Macros used in the machine description to test the flags.  */
86
 
87
/* Select between the H8/300 and H8/300H CPUs.  */
88
#define TARGET_H8300    (! TARGET_H8300H && ! TARGET_H8300S)
89
#define TARGET_H8300S   (TARGET_H8300S_1 || TARGET_H8300SX)
90
/* Some multiply instructions are not available in all H8SX variants.
91
   Use this macro instead of TARGET_H8300SX to indicate this, even
92
   though we don't actually generate different code for now.  */
93
#define TARGET_H8300SXMUL TARGET_H8300SX
94
 
95
#ifdef IN_LIBGCC2
96
#undef TARGET_H8300H
97
#undef TARGET_H8300S
98
#undef TARGET_NORMAL_MODE
99
/* If compiling libgcc2, make these compile time constants based on what
100
   flags are we actually compiling with.  */
101
#ifdef __H8300H__
102
#define TARGET_H8300H   1
103
#else
104
#define TARGET_H8300H   0
105
#endif
106
#ifdef __H8300S__
107
#define TARGET_H8300S   1
108
#else
109
#define TARGET_H8300S   0
110
#endif
111
#ifdef __NORMAL_MODE__
112
#define TARGET_NORMAL_MODE 1
113
#else
114
#define TARGET_NORMAL_MODE 0
115
#endif
116
#endif /* !IN_LIBGCC2 */
117
 
118
/* Default target_flags if no switches specified.  */
119
 
120
#ifndef TARGET_DEFAULT
121
#define TARGET_DEFAULT (MASK_QUICKCALL)
122
#endif
123
 
124
/* We want dwarf2 info available to gdb.  */
125
#define DWARF2_DEBUGGING_INFO        1
126
 
127
/* The return address is pushed on the stack.  */
128
#define INCOMING_RETURN_ADDR_RTX   gen_rtx_MEM (Pmode, gen_rtx_REG (Pmode, STACK_POINTER_REGNUM))
129
#define INCOMING_FRAME_SP_OFFSET   (POINTER_SIZE / 8)
130
 
131
#define DWARF_CIE_DATA_ALIGNMENT        2
132
 
133
/* Define this if addresses of constant functions
134
   shouldn't be put through pseudo regs where they can be cse'd.
135
   Desirable on machines where ordinary constants are expensive
136
   but a CALL with constant address is cheap.
137
 
138
   Calls through a register are cheaper than calls to named
139
   functions; however, the register pressure this causes makes
140
   CSEing of function addresses generally a lose.  */
141
#define NO_FUNCTION_CSE
142
 
143
/* Target machine storage layout */
144
 
145
/* Define this if most significant bit is lowest numbered
146
   in instructions that operate on numbered bit-fields.
147
   This is not true on the H8/300.  */
148
#define BITS_BIG_ENDIAN 0
149
 
150
/* Define this if most significant byte of a word is the lowest numbered.  */
151
/* That is true on the H8/300.  */
152
#define BYTES_BIG_ENDIAN 1
153
 
154
/* Define this if most significant word of a multiword number is lowest
155
   numbered.  */
156
#define WORDS_BIG_ENDIAN 1
157
 
158
#define MAX_BITS_PER_WORD       32
159
 
160
/* Width of a word, in units (bytes).  */
161
#define UNITS_PER_WORD          (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
162
#define MIN_UNITS_PER_WORD      2
163
 
164
#define SHORT_TYPE_SIZE 16
165
#define INT_TYPE_SIZE           (TARGET_INT32 ? 32 : 16)
166
#define LONG_TYPE_SIZE          32
167
#define LONG_LONG_TYPE_SIZE     64
168
#define FLOAT_TYPE_SIZE 32
169
#define DOUBLE_TYPE_SIZE        32
170
#define LONG_DOUBLE_TYPE_SIZE   DOUBLE_TYPE_SIZE
171
 
172
#define MAX_FIXED_MODE_SIZE     32
173
 
174
/* Allocation boundary (in *bits*) for storing arguments in argument list.  */
175
#define PARM_BOUNDARY (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
176
 
177
/* Allocation boundary (in *bits*) for the code of a function.  */
178
#define FUNCTION_BOUNDARY 16
179
 
180
/* Alignment of field after `int : 0' in a structure.  */
181
/* One can argue this should be 32 for -mint32, but since 32-bit ints only
182
   need 16-bit alignment, this is left as is so that -mint32 doesn't change
183
   structure layouts.  */
184
#define EMPTY_FIELD_BOUNDARY 16
185
 
186
/* No data type wants to be aligned rounder than this.
187
   32-bit values are aligned as such on the H8/300H and H8S for speed.  */
188
#define BIGGEST_ALIGNMENT \
189
(((TARGET_H8300H || TARGET_H8300S) && ! TARGET_ALIGN_300) ? 32 : 16)
190
 
191
/* The stack goes in 16/32 bit lumps.  */
192
#define STACK_BOUNDARY (TARGET_H8300 ? 16 : 32)
193
 
194
/* Define this if move instructions will actually fail to work
195
   when given unaligned data.  */
196
/* On the H8/300, longs can be aligned on halfword boundaries, but not
197
   byte boundaries.  */
198
#define STRICT_ALIGNMENT 1
199
 
200
/* Standard register usage.  */
201
 
202
/* Number of actual hardware registers.
203
   The hardware registers are assigned numbers for the compiler
204
   from 0 to just below FIRST_PSEUDO_REGISTER.
205
 
206
   All registers that the compiler knows about must be given numbers,
207
   even those that are not normally considered general registers.
208
 
209
   Reg 9 does not correspond to any hardware register, but instead
210
   appears in the RTL as an argument pointer prior to reload, and is
211
   eliminated during reloading in favor of either the stack or frame
212
   pointer.  */
213
 
214
#define FIRST_PSEUDO_REGISTER 12
215
 
216
/* 1 for registers that have pervasive standard uses
217
   and are not available for the register allocator.  */
218
 
219
#define FIXED_REGISTERS                         \
220
/* r0 r1 r2 r3 r4 r5 r6 r7 mac ap rap fp */     \
221
  { 0, 0, 0, 0, 0, 0, 0, 1,  0, 1,  1, 1 }
222
 
223
/* 1 for registers not available across function calls.
224
   These must include the FIXED_REGISTERS and also any
225
   registers that can be used without being saved.
226
   The latter must include the registers where values are returned
227
   and the register where structure-value addresses are passed.
228
   Aside from that, you can include as many other registers as you
229
   like.
230
 
231
   H8 destroys r0,r1,r2,r3.  */
232
 
233
#define CALL_USED_REGISTERS                     \
234
/* r0 r1 r2 r3 r4 r5 r6 r7 mac ap rap fp */     \
235
  { 1, 1, 1, 1, 0, 0, 0, 1,  1, 1,  1, 1 }
236
 
237
#define REG_ALLOC_ORDER                         \
238
/* r0 r1 r2 r3 r4 r5 r6 r7 mac ap rap  fp */    \
239
  { 2, 3, 0, 1, 4, 5, 6, 8,  7, 9, 10, 11 }
240
 
241
#define HARD_REGNO_NREGS(REGNO, MODE)           \
242
  h8300_hard_regno_nregs ((REGNO), (MODE))
243
 
244
#define HARD_REGNO_MODE_OK(REGNO, MODE)         \
245
  h8300_hard_regno_mode_ok ((REGNO), (MODE))
246
 
247
/* Value is 1 if it is a good idea to tie two pseudo registers
248
   when one has mode MODE1 and one has mode MODE2.
249
   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
250
   for any hard reg, then this must be 0 for correct output.  */
251
#define MODES_TIEABLE_P(MODE1, MODE2)                                     \
252
  ((MODE1) == (MODE2)                                                     \
253
   || (((MODE1) == QImode || (MODE1) == HImode                            \
254
        || ((TARGET_H8300H || TARGET_H8300S) && (MODE1) == SImode))       \
255
       &&  ((MODE2) == QImode || (MODE2) == HImode                        \
256
            || ((TARGET_H8300H || TARGET_H8300S) && (MODE2) == SImode))))
257
 
258
/* A C expression that is nonzero if hard register NEW_REG can be
259
   considered for use as a rename register for OLD_REG register */
260
 
261
#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG)          \
262
   h8300_hard_regno_rename_ok (OLD_REG, NEW_REG)
263
 
264
/* Specify the registers used for certain standard purposes.
265
   The values of these macros are register numbers.  */
266
 
267
/* H8/300 pc is not overloaded on a register.  */
268
 
269
/*#define PC_REGNUM 15*/
270
 
271
/* Register to use for pushing function arguments.  */
272
#define STACK_POINTER_REGNUM SP_REG
273
 
274
/* Base register for access to local variables of the function.  */
275
#define HARD_FRAME_POINTER_REGNUM HFP_REG
276
 
277
/* Base register for access to local variables of the function.  */
278
#define FRAME_POINTER_REGNUM FP_REG
279
 
280
/* Base register for access to arguments of the function.  */
281
#define ARG_POINTER_REGNUM AP_REG
282
 
283
/* Register in which static-chain is passed to a function.  */
284
#define STATIC_CHAIN_REGNUM SC_REG
285
 
286
/* Fake register that holds the address on the stack of the
287
   current function's return address.  */
288
#define RETURN_ADDRESS_POINTER_REGNUM RAP_REG
289
 
290
/* A C expression whose value is RTL representing the value of the return
291
   address for the frame COUNT steps up from the current frame.
292
   FRAMEADDR is already the frame pointer of the COUNT frame, assuming
293
   a stack layout with the frame pointer as the first saved register.  */
294
#define RETURN_ADDR_RTX(COUNT, FRAME) h8300_return_addr_rtx ((COUNT), (FRAME))
295
 
296
/* Define the classes of registers for register constraints in the
297
   machine description.  Also define ranges of constants.
298
 
299
   One of the classes must always be named ALL_REGS and include all hard regs.
300
   If there is more than one class, another class must be named NO_REGS
301
   and contain no registers.
302
 
303
   The name GENERAL_REGS must be the name of a class (or an alias for
304
   another name such as ALL_REGS).  This is the class of registers
305
   that is allowed by "g" or "r" in a register constraint.
306
   Also, registers outside this class are allocated only when
307
   instructions express preferences for them.
308
 
309
   The classes must be numbered in nondecreasing order; that is,
310
   a larger-numbered class must never be contained completely
311
   in a smaller-numbered class.
312
 
313
   For any two classes, it is very desirable that there be another
314
   class that represents their union.  */
315
 
316
enum reg_class {
317
  NO_REGS, COUNTER_REGS, SOURCE_REGS, DESTINATION_REGS,
318
  GENERAL_REGS, MAC_REGS, ALL_REGS, LIM_REG_CLASSES
319
};
320
 
321
#define N_REG_CLASSES ((int) LIM_REG_CLASSES)
322
 
323
/* Give names of register classes as strings for dump file.  */
324
 
325
#define REG_CLASS_NAMES \
326
{ "NO_REGS", "COUNTER_REGS", "SOURCE_REGS", "DESTINATION_REGS", \
327
  "GENERAL_REGS", "MAC_REGS", "ALL_REGS", "LIM_REGS" }
328
 
329
/* Define which registers fit in which classes.
330
   This is an initializer for a vector of HARD_REG_SET
331
   of length N_REG_CLASSES.  */
332
 
333
#define REG_CLASS_CONTENTS                      \
334
{      {0},              /* No regs      */      \
335
   {0x010},             /* COUNTER_REGS */      \
336
   {0x020},             /* SOURCE_REGS */       \
337
   {0x040},             /* DESTINATION_REGS */  \
338
   {0xeff},             /* GENERAL_REGS */      \
339
   {0x100},             /* MAC_REGS */          \
340
   {0xfff},             /* ALL_REGS     */      \
341
}
342
 
343
/* The same information, inverted:
344
   Return the class number of the smallest class containing
345
   reg number REGNO.  This could be a conditional expression
346
   or could index an array.  */
347
 
348
#define REGNO_REG_CLASS(REGNO)                          \
349
  ((REGNO) == MAC_REG ? MAC_REGS                        \
350
   : (REGNO) == COUNTER_REG ? COUNTER_REGS              \
351
   : (REGNO) == SOURCE_REG ? SOURCE_REGS                \
352
   : (REGNO) == DESTINATION_REG ? DESTINATION_REGS      \
353
   : GENERAL_REGS)
354
 
355
/* The class value for index registers, and the one for base regs.  */
356
 
357
#define INDEX_REG_CLASS (TARGET_H8300SX ? GENERAL_REGS : NO_REGS)
358
#define BASE_REG_CLASS  GENERAL_REGS
359
 
360
/* Stack layout; function entry, exit and calling.  */
361
 
362
/* Define this if pushing a word on the stack
363
   makes the stack pointer a smaller address.  */
364
 
365
#define STACK_GROWS_DOWNWARD
366
 
367
/* Define this to nonzero if the nominal address of the stack frame
368
   is at the high-address end of the local variables;
369
   that is, each additional local variable allocated
370
   goes at a more negative offset in the frame.  */
371
 
372
#define FRAME_GROWS_DOWNWARD 1
373
 
374
/* Offset within stack frame to start allocating local variables at.
375
   If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
376
   first local allocated.  Otherwise, it is the offset to the BEGINNING
377
   of the first local allocated.  */
378
 
379
#define STARTING_FRAME_OFFSET 0
380
 
381
/* If we generate an insn to push BYTES bytes,
382
   this says how many the stack pointer really advances by.
383
 
384
   On the H8/300, @-sp really pushes a byte if you ask it to - but that's
385
   dangerous, so we claim that it always pushes a word, then we catch
386
   the mov.b rx,@-sp and turn it into a mov.w rx,@-sp on output.
387
 
388
   On the H8/300H, we simplify TARGET_QUICKCALL by setting this to 4
389
   and doing a similar thing.  */
390
 
391
#define PUSH_ROUNDING(BYTES) \
392
  (((BYTES) + PARM_BOUNDARY / 8 - 1) & -PARM_BOUNDARY / 8)
393
 
394
/* Offset of first parameter from the argument pointer register value.  */
395
/* Is equal to the size of the saved fp + pc, even if an fp isn't
396
   saved since the value is used before we know.  */
397
 
398
#define FIRST_PARM_OFFSET(FNDECL) 0
399
 
400
/* Definitions for register eliminations.
401
 
402
   This is an array of structures.  Each structure initializes one pair
403
   of eliminable registers.  The "from" register number is given first,
404
   followed by "to".  Eliminations of the same "from" register are listed
405
   in order of preference.
406
 
407
   We have three registers that can be eliminated on the h8300.
408
   First, the frame pointer register can often be eliminated in favor
409
   of the stack pointer register.  Secondly, the argument pointer
410
   register and the return address pointer register are always
411
   eliminated; they are replaced with either the stack or frame
412
   pointer.  */
413
 
414
#define ELIMINABLE_REGS                                         \
415
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},                   \
416
 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},              \
417
 { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
418
 { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},   \
419
 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},                 \
420
 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
421
 
422
/* Define the offset between two registers, one to be eliminated, and the other
423
   its replacement, at the start of a routine.  */
424
 
425
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
426
  ((OFFSET) = h8300_initial_elimination_offset ((FROM), (TO)))
427
 
428
/* Define this if PCC uses the nonreentrant convention for returning
429
   structure and union values.  */
430
 
431
/*#define PCC_STATIC_STRUCT_RETURN*/
432
 
433
/* 1 if N is a possible register number for function argument passing.
434
   On the H8, no registers are used in this way.  */
435
 
436
#define FUNCTION_ARG_REGNO_P(N) (TARGET_QUICKCALL ? N < 3 : 0)
437
 
438
/* When this hook returns true for MODE, the compiler allows
439
   registers explicitly used in the rtl to be used as spill registers
440
   but prevents the compiler from extending the lifetime of these
441
   registers.  */
442
#define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_true
443
 
444
/* Define a data type for recording info about an argument list
445
   during the scan of that argument list.  This data type should
446
   hold all necessary information about the function itself
447
   and about the args processed so far, enough to enable macros
448
   such as FUNCTION_ARG to determine where the next arg should go.
449
 
450
   On the H8/300, this is a two item struct, the first is the number
451
   of bytes scanned so far and the second is the rtx of the called
452
   library function if any.  */
453
 
454
#define CUMULATIVE_ARGS struct cum_arg
455
struct cum_arg
456
{
457
  int nbytes;
458
  rtx libcall;
459
};
460
 
461
/* Initialize a variable CUM of type CUMULATIVE_ARGS
462
   for a call to a function whose data type is FNTYPE.
463
   For a library call, FNTYPE is 0.
464
 
465
   On the H8/300, the offset starts at 0.  */
466
 
467
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
468
 ((CUM).nbytes = 0, (CUM).libcall = LIBNAME)
469
 
470
/* Output assembler code to FILE to increment profiler label # LABELNO
471
   for profiling a function entry.  */
472
 
473
#define FUNCTION_PROFILER(FILE, LABELNO)  \
474
  fprintf (FILE, "\t%s\t#LP%d,%s\n\tjsr @mcount\n", \
475
           h8_mov_op, (LABELNO), h8_reg_names[0]);
476
 
477
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
478
   the stack pointer does not matter.  The value is tested only in
479
   functions that have frame pointers.
480
   No definition is equivalent to always zero.  */
481
 
482
#define EXIT_IGNORE_STACK 0
483
 
484
/* Length in units of the trampoline for entering a nested function.  */
485
 
486
#define TRAMPOLINE_SIZE ((Pmode == HImode) ? 8 : 12)
487
 
488
/* Addressing modes, and classification of registers for them.  */
489
 
490
#define HAVE_POST_INCREMENT 1
491
#define HAVE_PRE_DECREMENT 1
492
#define HAVE_POST_DECREMENT TARGET_H8300SX
493
#define HAVE_PRE_INCREMENT TARGET_H8300SX
494
 
495
/* Macros to check register numbers against specific register classes.  */
496
 
497
/* These assume that REGNO is a hard or pseudo reg number.
498
   They give nonzero only if REGNO is a hard reg of the suitable class
499
   or a pseudo reg currently allocated to a suitable hard reg.
500
   Since they use reg_renumber, they are safe only once reg_renumber
501
   has been allocated, which happens in local-alloc.c.  */
502
 
503
#define REGNO_OK_FOR_INDEX_P(regno) 0
504
 
505
#define REGNO_OK_FOR_BASE_P(regno)                              \
506
  (((regno) < FIRST_PSEUDO_REGISTER && regno != MAC_REG)        \
507
   || reg_renumber[regno] >= 0)
508
 
509
/* Maximum number of registers that can appear in a valid memory address.  */
510
 
511
#define MAX_REGS_PER_ADDRESS 1
512
 
513
/* 1 if X is an rtx for a constant that is a valid address.  */
514
 
515
#define CONSTANT_ADDRESS_P(X)                                   \
516
  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF      \
517
   || (GET_CODE (X) == CONST_INT                                \
518
       /* We handle signed and unsigned offsets here.  */       \
519
       && INTVAL (X) > (TARGET_H8300 ? -0x10000 : -0x1000000)   \
520
       && INTVAL (X) < (TARGET_H8300 ? 0x10000 : 0x1000000))    \
521
   || (GET_CODE (X) == HIGH || GET_CODE (X) == CONST))
522
 
523
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
524
   and check its validity for a certain class.
525
   We have two alternate definitions for each of them.
526
   The usual definition accepts all pseudo regs; the other rejects
527
   them unless they have been allocated suitable hard regs.
528
   The symbol REG_OK_STRICT causes the latter definition to be used.
529
 
530
   Most source files want to accept pseudo regs in the hope that
531
   they will get allocated to the class that the insn wants them to be in.
532
   Source files for reload pass need to be strict.
533
   After reload, it makes no difference, since pseudo regs have
534
   been eliminated by then.  */
535
 
536
/* Non-strict versions.  */
537
#define REG_OK_FOR_INDEX_NONSTRICT_P(X) 0
538
/* Don't use REGNO_OK_FOR_BASE_P here because it uses reg_renumber.  */
539
#define REG_OK_FOR_BASE_NONSTRICT_P(X)                          \
540
  (REGNO (X) >= FIRST_PSEUDO_REGISTER || REGNO (X) != MAC_REG)
541
 
542
/* Strict versions.  */
543
#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
544
#define REG_OK_FOR_BASE_STRICT_P(X)  REGNO_OK_FOR_BASE_P (REGNO (X))
545
 
546
#ifndef REG_OK_STRICT
547
 
548
#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P (X)
549
#define REG_OK_FOR_BASE_P(X)  REG_OK_FOR_BASE_NONSTRICT_P (X)
550
 
551
#else
552
 
553
#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X)
554
#define REG_OK_FOR_BASE_P(X)  REG_OK_FOR_BASE_STRICT_P (X)
555
 
556
#endif
557
 
558
 
559
/* Specify the machine mode that this machine uses
560
   for the index in the tablejump instruction.  */
561
#define CASE_VECTOR_MODE Pmode
562
 
563
/* Define this as 1 if `char' should by default be signed; else as 0.
564
 
565
   On the H8/300, sign extension is expensive, so we'll say that chars
566
   are unsigned.  */
567
#define DEFAULT_SIGNED_CHAR 0
568
 
569
/* This flag, if defined, says the same insns that convert to a signed fixnum
570
   also convert validly to an unsigned one.  */
571
#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
572
 
573
/* Max number of bytes we can move from memory to memory
574
   in one reasonably fast instruction.  */
575
#define MOVE_MAX        (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
576
#define MAX_MOVE_MAX    4
577
 
578
/* Nonzero if access to memory by bytes is slow and undesirable.  */
579
#define SLOW_BYTE_ACCESS TARGET_SLOWBYTE
580
 
581
/* Define if shifts truncate the shift count
582
   which implies one can omit a sign-extension or zero-extension
583
   of a shift count.  */
584
/* #define SHIFT_COUNT_TRUNCATED */
585
 
586
/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
587
   is done just by pretending it is already truncated.  */
588
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
589
 
590
/* Specify the machine mode that pointers have.
591
   After generation of rtl, the compiler makes no further distinction
592
   between pointers and any other objects of this machine mode.  */
593
#define Pmode                                                                 \
594
  ((TARGET_H8300H || TARGET_H8300S) && !TARGET_NORMAL_MODE ? SImode : HImode)
595
 
596
/* ANSI C types.
597
   We use longs for the H8/300H and the H8S because ints can be 16 or 32.
598
   GCC requires SIZE_TYPE to be the same size as pointers.  */
599
#define SIZE_TYPE                                                               \
600
  (TARGET_H8300 || TARGET_NORMAL_MODE ? TARGET_INT32 ? "short unsigned int" : "unsigned int" : "long unsigned int")
601
#define PTRDIFF_TYPE                                            \
602
  (TARGET_H8300 || TARGET_NORMAL_MODE ? TARGET_INT32 ? "short int" : "int" : "long int")
603
 
604
#define POINTER_SIZE                                                    \
605
  ((TARGET_H8300H || TARGET_H8300S) && !TARGET_NORMAL_MODE ? 32 : 16)
606
 
607
#define WCHAR_TYPE "short unsigned int"
608
#define WCHAR_TYPE_SIZE 16
609
 
610
/* A function address in a call instruction
611
   is a byte address (for indexing purposes)
612
   so give the MEM rtx a byte's mode.  */
613
#define FUNCTION_MODE QImode
614
 
615
/* Return the length of JUMP's delay slot insn (0 if it has none).
616
   If JUMP is a delayed branch, NEXT_INSN (PREV_INSN (JUMP)) will
617
   be the containing SEQUENCE, not JUMP itself.  */
618
#define DELAY_SLOT_LENGTH(JUMP) \
619
  (NEXT_INSN (PREV_INSN (JUMP)) == JUMP ? 0 : 2)
620
 
621
#define BRANCH_COST(speed_p, predictable_p) 0
622
 
623
/* Tell final.c how to eliminate redundant test instructions.  */
624
 
625
/* Here we define machine-dependent flags and fields in cc_status
626
   (see `conditions.h').  No extra ones are needed for the h8300.  */
627
 
628
/* Store in cc_status the expressions
629
   that the condition codes will describe
630
   after execution of an instruction whose pattern is EXP.
631
   Do not alter them if the instruction would not alter the cc's.  */
632
 
633
#define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc (EXP, INSN)
634
 
635
/* The add insns don't set overflow in a usable way.  */
636
#define CC_OVERFLOW_UNUSABLE 01000
637
/* The mov,and,or,xor insns don't set carry.  That's OK though as the
638
   Z bit is all we need when doing unsigned comparisons on the result of
639
   these insns (since they're always with 0).  However, conditions.h has
640
   CC_NO_OVERFLOW defined for this purpose.  Rename it to something more
641
   understandable.  */
642
#define CC_NO_CARRY CC_NO_OVERFLOW
643
 
644
/* Control the assembler format that we output.  */
645
 
646
/* Output to assembler file text saying following lines
647
   may contain character constants, extra white space, comments, etc.  */
648
 
649
#define ASM_APP_ON "; #APP\n"
650
 
651
/* Output to assembler file text saying following lines
652
   no longer contain unusual constructs.  */
653
 
654
#define ASM_APP_OFF "; #NO_APP\n"
655
 
656
#define FILE_ASM_OP "\t.file\n"
657
 
658
/* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H.  */
659
#define ASM_WORD_OP                                                     \
660
  (TARGET_H8300 || TARGET_NORMAL_MODE ? "\t.word\t" : "\t.long\t")
661
 
662
#define TEXT_SECTION_ASM_OP "\t.section .text"
663
#define DATA_SECTION_ASM_OP "\t.section .data"
664
#define BSS_SECTION_ASM_OP "\t.section .bss"
665
 
666
#undef DO_GLOBAL_CTORS_BODY
667
#define DO_GLOBAL_CTORS_BODY                    \
668
{                                               \
669
  extern func_ptr __ctors[];                    \
670
  extern func_ptr __ctors_end[];                \
671
  func_ptr *p;                                  \
672
  for (p = __ctors_end; p > __ctors; )          \
673
    {                                           \
674
      (*--p)();                                 \
675
    }                                           \
676
}
677
 
678
#undef DO_GLOBAL_DTORS_BODY
679
#define DO_GLOBAL_DTORS_BODY                    \
680
{                                               \
681
  extern func_ptr __dtors[];                    \
682
  extern func_ptr __dtors_end[];                \
683
  func_ptr *p;                                  \
684
  for (p = __dtors; p < __dtors_end; p++)       \
685
    {                                           \
686
      (*p)();                                   \
687
    }                                           \
688
}
689
 
690
/* How to refer to registers in assembler output.
691
   This sequence is indexed by compiler's hard-register-number (see above).  */
692
 
693
#define REGISTER_NAMES \
694
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "mac", "ap", "rap", "fp" }
695
 
696
#define ADDITIONAL_REGISTER_NAMES \
697
{ {"er0", 0}, {"er1", 1}, {"er2", 2}, {"er3", 3}, {"er4", 4}, \
698
  {"er5", 5}, {"er6", 6}, {"er7", 7}, {"r7", 7} }
699
 
700
/* Globalizing directive for a label.  */
701
#define GLOBAL_ASM_OP "\t.global "
702
 
703
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
704
   ASM_OUTPUT_LABEL (FILE, NAME)
705
 
706
/* The prefix to add to user-visible assembler symbols.  */
707
 
708
#define USER_LABEL_PREFIX "_"
709
 
710
/* This is how to store into the string LABEL
711
   the symbol_ref name of an internal numbered label where
712
   PREFIX is the class of label and NUM is the number within the class.
713
   This is suitable for output with `assemble_name'.
714
 
715
   N.B.: The h8300.md branch_true and branch_false patterns also know
716
   how to generate internal labels.  */
717
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
718
  sprintf (LABEL, "*.%s%lu", PREFIX, (unsigned long)(NUM))
719
 
720
/* This is how to output an insn to push a register on the stack.
721
   It need not be very fast code.  */
722
 
723
#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
724
  fprintf (FILE, "\t%s\t%s\n", h8_push_op, h8_reg_names[REGNO])
725
 
726
/* This is how to output an insn to pop a register from the stack.
727
   It need not be very fast code.  */
728
 
729
#define ASM_OUTPUT_REG_POP(FILE, REGNO) \
730
  fprintf (FILE, "\t%s\t%s\n", h8_pop_op, h8_reg_names[REGNO])
731
 
732
/* This is how to output an element of a case-vector that is absolute.  */
733
 
734
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
735
  fprintf (FILE, "%s.L%d\n", ASM_WORD_OP, VALUE)
736
 
737
/* This is how to output an element of a case-vector that is relative.  */
738
 
739
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
740
  fprintf (FILE, "%s.L%d-.L%d\n", ASM_WORD_OP, VALUE, REL)
741
 
742
/* This is how to output an assembler line
743
   that says to advance the location counter
744
   to a multiple of 2**LOG bytes.  */
745
 
746
#define ASM_OUTPUT_ALIGN(FILE, LOG)             \
747
  if ((LOG) != 0)                                \
748
    fprintf (FILE, "\t.align %d\n", (LOG))
749
 
750
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
751
  fprintf (FILE, "\t.space %d\n", (int)(SIZE))
752
 
753
/* This says how to output an assembler line
754
   to define a global common symbol.  */
755
 
756
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)    \
757
( fputs ("\t.comm ", (FILE)),                           \
758
  assemble_name ((FILE), (NAME)),                       \
759
  fprintf ((FILE), ",%lu\n", (unsigned long)(SIZE)))
760
 
761
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
762
  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
763
 
764
/* This says how to output an assembler line
765
   to define a local common symbol.  */
766
 
767
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)     \
768
( fputs ("\t.lcomm ", (FILE)),                          \
769
  assemble_name ((FILE), (NAME)),                       \
770
  fprintf ((FILE), ",%d\n", (int)(SIZE)))
771
 
772
#define ASM_PN_FORMAT "%s___%lu"
773
 
774
/* H8300 specific pragmas.  */
775
#define REGISTER_TARGET_PRAGMAS()                               \
776
  do                                                            \
777
    {                                                           \
778
      c_register_pragma (0, "saveall", h8300_pr_saveall);        \
779
      c_register_pragma (0, "interrupt", h8300_pr_interrupt);    \
780
    }                                                           \
781
  while (0)
782
 
783
#define FINAL_PRESCAN_INSN(insn, operand, nop)  \
784
  final_prescan_insn (insn, operand, nop)
785
 
786
extern int h8300_move_ratio;
787
#define MOVE_RATIO(speed) h8300_move_ratio
788
 
789
/* Machine-specific symbol_ref flags.  */
790
#define SYMBOL_FLAG_FUNCVEC_FUNCTION    (SYMBOL_FLAG_MACH_DEP << 0)
791
#define SYMBOL_FLAG_EIGHTBIT_DATA       (SYMBOL_FLAG_MACH_DEP << 1)
792
#define SYMBOL_FLAG_TINY_DATA           (SYMBOL_FLAG_MACH_DEP << 2)
793
 
794
#endif /* ! GCC_H8300_H */

powered by: WebSVN 2.1.0

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