OSDN Git Service

87606fc283c8d9dd39648b38022dfa0cb15fd9ac
[pf3gnuchains/gcc-fork.git] / gcc / config / pj / pj.h
1 /* Definitions of target machine for GNU compiler for picoJava
2    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Contributed by Steve Chamberlain of Transmeta (sac@pobox.com).  */
22
23
24 #define TARGET_VERSION  fputs ("(picoJava)", stderr);
25
26 /* We support two different default configurations.  */
27 #undef ASM_SPEC
28 #ifdef TARGET_LITTLE_ENDIAN_DEFAULT
29 #define CPP_SPEC        "%{mb:-D__BIG_ENDIAN__ }%{!mb:-D__LITTLE_ENDIAN__ }" 
30 #define ASM_SPEC        "%{mb:-EB }%{!mb:-EL }"
31 #else
32 #define CPP_SPEC        "%{ml:-D__LITTLE_ENDIAN__ }%{!ml:-D__BIG_ENDIAN__}"
33 #define ASM_SPEC        "%{ml:-EL } %{!ml:-EB }"
34 #endif
35
36 #ifndef CPP_PREDEFINES
37 #define CPP_PREDEFINES "-D__ELF__ -D__pj__ -Asystem=posix"
38 #endif
39 \f
40 /* Run-time compilation parameters selecting different hardware subsets.  */
41
42 extern int target_flags;
43
44 #define LITTLE_ENDIAN_BIT (1<<0)
45 #define EXTENSIONS_BIT    (1<<1)
46 #define PJ_TEST_BIT       (1<<2)
47 #define REORG_BIT         (1<<3)
48
49 /* Nonzero if generating code for a little endian pico java.  */
50
51 #define TARGET_LITTLE_ENDIAN     (target_flags & LITTLE_ENDIAN_BIT)
52
53 /* Nonzero to turn on internal tests.  */
54
55 #define TARGET_TEST              (target_flags & PJ_TEST_BIT)
56
57 /* Nonzero to turn on picoJava extensions.  */
58
59 #define TARGET_TM_EXTENSIONS     (target_flags & EXTENSIONS_BIT)
60
61 /* Nonzero to turn on the reorganization pass.  */
62
63 #define TARGET_REORG             (target_flags & REORG_BIT)
64
65 #ifdef TARGET_LITTLE_ENDIAN_DEFAULT
66 #define TARGET_DEFAULT  (LITTLE_ENDIAN_BIT|EXTENSIONS_BIT|REORG_BIT)
67 #else
68 #define TARGET_DEFAULT  REORG_BIT
69 #endif
70
71 #define TARGET_SWITCHES  \
72 { {"l",         LITTLE_ENDIAN_BIT,                      \
73    N_("Generate little endian data")           },       \
74   {"b",        -LITTLE_ENDIAN_BIT,                      \
75    N_("Generate big endian data")              },       \
76   {"t",         PJ_TEST_BIT,                            \
77    N_("Turn on maintainer testing code")       },       \
78   {"ext",       EXTENSIONS_BIT,                         \
79    N_("Enable Transmeta picoJava extensions")  },       \
80   {"no-ext",   -EXTENSIONS_BIT,                         \
81    N_("Disable Transmeta picoJava extensions") },       \
82   {"no-reorg", -REORG_BIT,                              \
83    N_("Disable reorganization pass")           },       \
84   {"",          TARGET_DEFAULT,    0 }}
85
86 /* Sometimes certain combinations of command options do not make
87    sense on a particular target machine.  You can define a macro
88    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
89    defined, is executed once just after all the command options have
90    been parsed.
91
92    Don't use this macro to turn on various extra optimizations for
93    `-O'.  That is what `OPTIMIZATION_OPTIONS' is for.  
94
95    We take this chance to register the global variables with the garbage
96    collector. */
97
98 #define OVERRIDE_OPTIONS                                                \
99  do {                                                                   \
100    ggc_add_rtx_root (&pj_cmp_op0, 1);                                   \
101    ggc_add_rtx_root (&pj_cmp_op1, 1);                                   \
102  } while (0)
103
104 /* Define this to change the optimizations performed by default.  */
105 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                                \
106  do {                                                                   \
107    if (optimize)                                                        \
108        flag_force_addr = 1;                                             \
109  } while (0)
110 \f
111 /* Target machine storage layout.  */
112
113 /* Define to use software floating point emulator for REAL_ARITHMETIC and
114    decimal <-> binary conversion.  */
115 #define REAL_ARITHMETIC
116
117 /* Define this if most significant bit is lowest numbered
118    in instructions that operate on numbered bit-fields.  */
119 #define BITS_BIG_ENDIAN  0
120
121 /* Define this if most significant byte of a word is the lowest numbered.  */
122 #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
123
124 /* Define this if most significant word of a multiword number is the lowest
125    numbered.  */
126 #define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
127
128 /* Define this to set the endianness to use in libgcc2.c, which can
129    not depend on target_flags.  */
130 #if defined(TARGET_LITTLE_ENDIAN_DEFAULT)
131 #define LIBGCC2_WORDS_BIG_ENDIAN 0
132 #else
133 #define LIBGCC2_WORDS_BIG_ENDIAN 1
134 #endif
135
136 /* Number of bits in an addressable storage unit.  */
137 #define BITS_PER_UNIT  8
138
139 /* Width in bits of a "word", which is the contents of a machine register.
140    Note that this is not necessarily the width of data type `int';
141    if using 16-bit ints on a 68000, this would still be 32.
142    But on a machine with 16-bit registers, this would be 16.  */
143 #define BITS_PER_WORD  32
144 #define MAX_BITS_PER_WORD 32
145
146 /* Width of a word, in units (bytes).  */
147 #define UNITS_PER_WORD  4
148
149 /* Width in bits of a pointer.
150    See also the macro `Pmode' defined below.  */
151 #define POINTER_SIZE  32
152
153 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
154 #define PARM_BOUNDARY   32
155
156 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
157 #define STACK_BOUNDARY  32
158
159 /* Allocation boundary (in *bits*) for the code of a function.  */
160 #define FUNCTION_BOUNDARY  8
161
162 /* Alignment of field after `int : 0' in a structure.  */
163 #define EMPTY_FIELD_BOUNDARY  32
164
165 /* No data type wants to be aligned rounder than this.  */
166 #define BIGGEST_ALIGNMENT  32
167
168 /* The best alignment to use in cases where we have a choice.  */
169 #define FASTEST_ALIGNMENT 32
170
171 /* Make strings word-aligned so strcpy from constants will be faster.  */
172 #define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
173   ((TREE_CODE (EXP) == STRING_CST       \
174     && (ALIGN) < FASTEST_ALIGNMENT)     \
175     ? FASTEST_ALIGNMENT : (ALIGN))
176
177 /* Make arrays of chars word-aligned for the same reasons.  */
178 #define DATA_ALIGNMENT(TYPE, ALIGN)             \
179   (TREE_CODE (TYPE) == ARRAY_TYPE               \
180    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode    \
181    && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
182
183 /* Set this non-zero if move instructions will actually fail to work
184    when given unaligned data.  */
185 #define STRICT_ALIGNMENT 1
186 \f
187
188 /* Standard register usage.  */
189
190 /* Enumerate the hardware registers.  */
191
192 enum
193 {
194   R0_REG,       R1_REG,         R2_REG,         R3_REG, 
195   R4_REG,       R5_REG,         R6_REG,         R7_REG, 
196   R8_REG,       R9_REG,         R10_REG,        R11_REG,
197   R12_REG,      R13_REG,        R14_REG,        R15_REG,
198
199   R16_REG,      R17_REG,        R18_REG,        R19_REG,
200   R20_REG,      R21_REG,        R22_REG,        R23_REG,
201   R24_REG,      R25_REG,        R26_REG,        R27_REG,
202   R28_REG,      R29_REG,        R30_REG,        R31_REG,
203
204   I0_REG,       I1_REG,         I2_REG,         I3_REG,  
205   I4_REG,       I5_REG,         I6_REG,         I7_REG,  
206   I8_REG,       I9_REG,         I10_REG,        I11_REG, 
207   I12_REG,      I13_REG,        I14_REG,        I15_REG, 
208
209   I16_REG,      I17_REG,        I18_REG,        I19_REG, 
210   I20_REG,      I21_REG,        I22_REG,        I23_REG, 
211   I24_REG,      I25_REG,        I26_REG,        I27_REG, 
212   I28_REG,      I29_REG,        I30_REG,        ISC_REG, 
213
214   G0_REG,       G1_REG,         G2_REG,         G3_REG,  
215   G4_REG,       G5_REG,         G6_REG,         G7_REG,  
216   VARS_REG,     OPTOP_REG,      SC_REG,         PC_REG,  
217   TICKS_REG,    SLOW_REG,       VA_REG,         D3_REG, 
218
219   D4_REG,       D5_REG,         D6_REG,         D7_REG,
220   Q0_REG,       Q1_REG,         Q2_REG,         Q3_REG,
221   P0_REG,       P1_REG,         P2_REG,         P3_REG,
222   P4_REG,       P5_REG,         P6_REG,         P7_REG,
223
224   O0_REG,       O1_REG,         O2_REG,         O3_REG, 
225   O4_REG,       O5_REG,         O6_REG,         O7_REG, 
226   O8_REG,       O9_REG,         O10_REG,        O11_REG,
227   O12_REG,      O13_REG,        O14_REG,        O15_REG,
228
229   O16_REG,      O17_REG,        O18_REG,        O19_REG,
230   O20_REG,      O21_REG,        O22_REG,        O23_REG,
231   O24_REG,      O25_REG,        O26_REG,        O27_REG,
232   O28_REG,      O29_REG,        O30_REG,        OSC_REG,
233   
234   LAST_O_REG=OSC_REG,
235   LAST_R_REG=R31_REG,
236   LAST_I_REG=ISC_REG,
237   LAST_S_REG=P7_REG
238
239 };
240
241 /* Useful predicates.  */
242
243 #define STACK_REGNO_P(REGNO)            \
244         (((unsigned) (REGNO)) <= LAST_I_REG)
245
246 #define OUTGOING_REGNO_P(REGNO)         \
247         (((REGNO) >= O0_REG) && ((REGNO) <= LAST_O_REG))
248
249 #define INCOMING_REGNO_P(REGNO)         \
250         (((REGNO) >= I0_REG) && ((REGNO) <= LAST_I_REG))
251
252 #define STACK_REG_RTX_P(RTX)            \
253         (GET_CODE (RTX) == REG && STACK_REGNO_P (REGNO (RTX)))
254
255 #define OUTGOING_REG_RTX_P(RTX)         \
256         (GET_CODE (RTX) == REG && OUTGOING_REGNO_P (REGNO (RTX)))
257
258 #define OPTOP_REG_RTX_P(RTX)            \
259         (GET_CODE (RTX) == REG && REGNO (RTX) == OPTOP_REG)
260
261 #define FIRST_PSEUDO_REGISTER 128
262
263 /* 1 for registers that have pervasive standard uses
264    and are not available for the register allocator.  */
265
266 #define FIXED_REGISTERS                                                 \
267  {                                                                      \
268    0,0,0,0, 0,0,0,0,  /* r0 .. r7  */                                   \
269    0,0,0,0, 0,0,0,0,  /* r8 .. r15 */                                   \
270    0,0,0,0, 0,0,0,0,  /* r16.. r23 */                                   \
271    0,0,0,0, 0,0,0,0,  /* r24.. r31 */                                   \
272                                                                         \
273    0,0,0,0, 0,0,0,0,  /* i0 .. i7  */                                   \
274    0,0,0,0, 0,0,0,0,  /* i8 .. i15 */                                   \
275    0,0,0,0, 0,0,0,0,  /* i16.. i23 */                                   \
276    0,0,0,0, 0,0,0,0,  /* i24.. i31 */                                   \
277                                                                         \
278    1,0,0,1, 1,1,1,1,  /* g0 .. g7  */                                   \
279    1,1,1,1, 1,1,1,1,  /* vars, optop, sc, pc, ticks, slow, va, sgo */   \
280    1,1,1,1, 1,1,1,1,  /* d4 d5 d6 ap p0 p1 p2 p3 */                     \
281    1,1,1,1, 1,1,1,1,  /* q1 .. q7 */                                    \
282                                                                         \
283    0,0,0,0, 0,0,0,0,  /* o0 .. o7  */                                   \
284    0,0,0,0, 0,0,0,0,  /* o8 .. o15 */                                   \
285    0,0,0,0, 0,0,0,0,  /* o16.. o23 */                                   \
286    0,0,0,0, 0,0,0,0 } /* o24.. o31 */                                   
287                                                                           
288
289 /* 1 for registers not available across function calls.
290    These must include the FIXED_REGISTERS and also any
291    registers that can be used without being saved.
292    The latter must include the registers where values are returned
293    and the register where structure-value addresses are passed.
294    Aside from that, you can include as many other registers as you like.  
295
296    We pretend that some standard registers are call clobbered so the
297    exception handler code has somewhere to play.  */
298
299 #define CALL_USED_REGISTERS                                             \
300  {                                                                      \
301    0,0,0,0, 0,0,0,0,  /* r0 ..r7  */                                    \
302    0,0,0,0, 0,0,0,0,  /* r8 ..r15 */                                    \
303    0,0,0,0, 1,1,1,1,  /* r16..r23 */                                    \
304    1,1,1,1, 1,1,1,1,  /* r24..r31 */                                    \
305                                                                         \
306    0,0,0,0, 0,0,0,0,  /* i0 ..i7  */                                    \
307    0,0,0,0, 0,0,0,0,  /* i8 ..i15 */                                    \
308    0,0,0,0, 0,0,0,0,  /* i16..i23 */                                    \
309    0,0,0,0, 0,0,0,0,  /* i24..i31 */                                    \
310                                                                         \
311    1,1,1,1, 0,0,0,0,  /* g0 ..g7  */                                    \
312    1,1,1,1, 1,1,1,1,  /* vars, optop, sc, pc, ticls, slow, va, sgo */   \
313    1,1,1,1, 1,1,1,1,  /* d4 d5 d6 ap p0..p3*/                           \
314    1,1,1,1, 1,1,1,1,  /* q0..q7  */                                     \
315                                                                         \
316    1,1,1,1, 1,1,1,1,  /* o0 ..o7  */                                    \
317    1,1,1,1, 1,1,1,1,  /* o8 ..o15 */                                    \
318    1,1,1,1, 1,1,1,1,  /* o16..o23 */                                    \
319    1,1,1,1, 1,1,1,1 } /* o24..o31 */                                    
320   
321 /* Return number of consecutive hard regs needed starting at reg REGNO
322    to hold something of mode MODE.
323    This is ordinarily the length in words of a value of mode MODE
324    but can be less for certain modes in special long registers.  */
325
326 #define HARD_REGNO_NREGS(REGNO, MODE) \
327    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
328
329 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
330
331    We can allow any mode in the general register or the result
332    register.  It's only safe to put up to 4 bytes values elsewhere.  */
333
334 #define HARD_REGNO_MODE_OK(REGNO, MODE)                               \
335    (((REGNO) <= LAST_R_REG || (REGNO) == G1_REG || GET_MODE_SIZE(MODE) <= 4 ) && !OUTGOING_REGNO_P(REGNO))
336
337 /* Value is 1 if it is a good idea to tie two pseudo registers
338    when one has mode MODE1 and one has mode MODE2.
339    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
340    for any hard reg, then this must be 0 for correct output.  */
341 #define MODES_TIEABLE_P(MODE1, MODE2) 1
342
343 /* Specify the registers used for certain standard purposes.
344    The values of these macros are register numbers.  */
345
346 /* Define this if the program counter is overloaded on a register.  */
347 #define PC_REGNUM               PC_REG
348
349 /* Register to use for pushing function arguments.  */
350 #define STACK_POINTER_REGNUM    G0_REG
351
352 /* Base register for access to local variables of the function.  */
353 #define FRAME_POINTER_REGNUM    R31_REG
354
355 /* Base register for access to arguments of the function.  */
356 #define ARG_POINTER_REGNUM      R30_REG
357
358 /* Register in which the static-chain is passed to a function.  */
359 #define STATIC_CHAIN_REGNUM     G1_REG
360
361 /* Value should be nonzero if functions must have frame pointers.
362    Zero means the frame pointer need not be set up (and parms may be
363    accessed via the stack pointer) in functions that seem suitable.  */
364 #define FRAME_POINTER_REQUIRED  0
365
366 /* This is an array of structures.  Each structure initializes one pair
367    of eliminable registers.  The "from" register number is given first,
368    followed by "to".  Eliminations of the same "from" register are listed
369    in order of preference.  */
370
371 #define ELIMINABLE_REGS                                                 \
372    { { VA_REG,                          STACK_POINTER_REGNUM    },      \
373      { FRAME_POINTER_REGNUM,            STACK_POINTER_REGNUM    },      \
374      { ARG_POINTER_REGNUM,              STACK_POINTER_REGNUM    } }    
375      
376 /* Given FROM and TO register numbers, say whether this elimination
377    is allowed.  */
378 #define CAN_ELIMINATE(FROM, TO) 1
379
380 /* Define the offset between two registers, one to be eliminated, and the other
381    its replacement, at the start of a routine.  */
382 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
383   OFFSET =  (((FROM) == FRAME_POINTER_REGNUM) ? get_frame_size() : 0)
384
385 /* For picoJava we have to save 12 bytes of information for a non local 
386    jump.  */
387
388 #define STACK_SAVEAREA_MODE(x) ((x)==SAVE_NONLOCAL ? XFmode : Pmode)
389
390 /* If the structure value address is not passed in a register, define
391    `STRUCT_VALUE' as an expression returning an RTX for the place
392    where the address is passed.  If it returns 0, the address is
393    passed as an "invisible" first argument.  */
394 #define STRUCT_VALUE 0
395
396 /* A C expression which can inhibit the returning of certain function
397    values in registers, based on the type of value.  A nonzero value
398    says to return the function value in memory, just as large
399    structures are always returned.  Here TYPE will be a C expression
400    of type `tree', representing the data type of the value.
401
402    Note that values of mode `BLKmode' must be explicitly handled by
403    this macro.  Also, the option `-fpcc-struct-return' takes effect
404    regardless of this macro.  On most systems, it is possible to
405    leave the macro undefined; this causes a default definition to be
406    used, whose value is the constant 1 for `BLKmode' values, and 0
407    otherwise.
408
409    Do not use this macro to indicate that structures and unions
410    should always be returned in memory.  You should instead use
411    `DEFAULT_PCC_STRUCT_RETURN' to indicate this.  */
412 #define RETURN_IN_MEMORY(TYPE) \
413   ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 8)
414
415 /* Don't default to pcc-struct-return, because we have already specified
416    exactly how to return structures in the RETURN_IN_MEMORY macro.  */
417 #define DEFAULT_PCC_STRUCT_RETURN 0
418 \f
419 /* Define the classes of registers for register constraints in the
420    machine description.  Also define ranges of constants.
421
422    One of the classes must always be named ALL_REGS and include all hard regs.
423    If there is more than one class, another class must be named NO_REGS
424    and contain no registers.
425
426    The name GENERAL_REGS must be the name of a class (or an alias for
427    another name such as ALL_REGS).  This is the class of registers
428    that is allowed by "g" or "r" in a register constraint.
429    Also, registers outside this class are allocated only when
430    instructions express preferences for them.
431
432    The classes must be numbered in nondecreasing order; that is,
433    a larger-numbered class must never be contained completely
434    in a smaller-numbered class.
435
436    For any two classes, it is very desirable that there be another
437    class that represents their union.  */
438
439 enum reg_class
440 {
441   NO_REGS,
442   OUT_REGS,         /* Registers for passing outgoing parameters.  */
443   STD_REGS,         /* Standard registers, on opstack.  */
444   ARG_REGS,         /* Incoming argument registers.  */
445   SRC_REGS,         /* All registers valid as a source.  */
446   DST_REGS,         /* All registers valid as a destination.  */
447   ALL_REGS,
448   LIM_REG_CLASSES
449 };
450
451 #define GENERAL_REGS SRC_REGS
452 #define N_REG_CLASSES  (int) LIM_REG_CLASSES
453
454 /* Give names of register classes as strings for dump files.  */
455 #define REG_CLASS_NAMES   \
456 {                         \
457   "NO_REGS",              \
458   "OUT_REGS",             \
459   "STD_REGS",             \
460   "ARG_REGS",             \
461   "SRC_REGS",             \
462   "DST_REGS",             \
463   "ALL_REGS"              \
464 }
465
466 /* Define which registers fit in which classes.
467    This is an initializer for a vector of HARD_REG_SET
468    of length N_REG_CLASSES.  */
469
470 #define REG_CLASS_CONTENTS                                              \
471 {                                                                       \
472   { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS  */    \
473   { 0x00000000, 0x00000000, 0x00000000, 0xffffffff }, /* OUT_REGS */    \
474   { 0xffffffff, 0x00000000, 0x00000000, 0x00000000 }, /* STD_REGS */    \
475   { 0x00000000, 0xffffffff, 0x00000000, 0x00000000 }, /* ARG_REGS */    \
476   { 0xffffffff, 0xffffffff, 0x000fff0f, 0x00000000 }, /* SRC_REGS */    \
477   { 0xffffffff, 0xffffffff, 0x000fff0f, 0xffffffff }, /* DST_REGS */    \
478   { 0xffffffff, 0xffffffff, 0x000fff0f, 0xffffffff }, /* ALL_REGS */    \
479 }
480
481 /* The same information, inverted:
482    Return the class number of the smallest class containing
483    reg number REGNO.  This could be a conditional expression
484    or could index an array.  */
485
486 #define REGNO_REG_CLASS(REGNO)                  \
487      ( ((REGNO) <= LAST_R_REG) ? STD_REGS       \
488      : ((REGNO) <= LAST_I_REG) ? ARG_REGS       \
489      : ((REGNO) <= LAST_S_REG) ? SRC_REGS       \
490      : OUT_REGS)
491         
492 /* The class value for index registers, and the one for base regs.  */
493 #define INDEX_REG_CLASS  GENERAL_REGS
494 #define BASE_REG_CLASS   GENERAL_REGS
495
496 /* Get reg_class from a letter such as appears in the machine
497    description.  */
498
499 #define REG_CLASS_FROM_LETTER(C) \
500    ( (C) == 'S' ? SRC_REGS \
501    : (C) == 'D' ? DST_REGS \
502    : NO_REGS)
503 \f
504 /* The letters I, J, K, L and M in a register constraint string
505    can be used to stand for particular ranges of immediate operands.
506    This macro defines what the ranges are.
507    C is the letter, and VALUE is a constant value.
508    Return 1 if VALUE is in the range specified by C.
509
510    I: arithmetic operand -127..128, as used in inc.
511    K: 0.
512    */
513
514 #define CONST_OK_FOR_I(VALUE) \
515  (((HOST_WIDE_INT)(VALUE))>= -128 && ((HOST_WIDE_INT)(VALUE)) <= 127)
516
517 #define CONST_OK_FOR_K(VALUE) ((VALUE)==0)
518
519 #define CONST_OK_FOR_LETTER_P(VALUE, C)         \
520      ((C) == 'I' ? CONST_OK_FOR_I (VALUE)       \
521     : (C) == 'K' ? CONST_OK_FOR_K (VALUE)       \
522     : 0)
523
524 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
525
526 /* Given an rtx X being reloaded into a reg required to be
527    in class CLASS, return the class of reg to actually use.
528    In general this is just CLASS; but on some machines
529    in some cases it is preferable to use a more restrictive class.  */
530
531 #define PREFERRED_RELOAD_CLASS(X, CLASS) (CLASS)
532
533 /* Return the maximum number of consecutive registers
534    needed to represent mode MODE in a register of class CLASS.
535
536    With picoJava this is the size of MODE in words.  */
537
538 #define CLASS_MAX_NREGS(CLASS, MODE) \
539      ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
540
541
542 /* A C expression whose value is nonzero if pseudos that have been
543    assigned to registers of class CLASS would likely be spilled
544    because registers of CLASS are needed for spill registers.
545
546    For picoJava, something that isn't an incoming argument or a normal
547    register is going to be very hard to get at. */
548
549 #define CLASS_LIKELY_SPILLED_P(X) ((X) != STD_REGS && (X) != ARG_REGS)
550 \f
551 /* Stack layout; function entry, exit and calling.  */
552
553 /* Define this if pushing a word on the stack
554    makes the stack pointer a smaller address.  */
555
556 #define STACK_GROWS_DOWNWARD 1
557
558 /* Define this macro if successive arguments to a function occupy
559    decreasing addresses on the stack.  */
560
561 #define ARGS_GROW_DOWNWARD 1
562
563 /*  Define this macro if the addresses of local variable slots are at
564     negative offsets from the frame pointer.  */
565
566 #define FRAME_GROWS_DOWNWARD 1
567
568 /* Offset from the frame pointer to the first local variable slot to
569    be allocated.  */
570
571 #define STARTING_FRAME_OFFSET  0
572
573 /* If we generate an insn to push BYTES bytes,
574    this says how many the stack pointer really advances by.  */
575
576 /* Don't define PUSH_ROUNDING, since the hardware doesn't do this.
577    When PUSH_ROUNDING is not defined, PARM_BOUNDARY will cause gcc to
578    do correct alignment.  */
579
580 #define PUSH_ROUNDING(NPUSHED)  (((NPUSHED) + 3) & ~3)
581
582 /* Offset of first parameter from the argument pointer register value.  */
583
584 #define FIRST_PARM_OFFSET(FNDECL)  0
585
586 /* Value is the number of byte of arguments automatically
587    popped when returning from a subroutine call.
588    FUNDECL is the declaration node of the function (as a tree),
589    FUNTYPE is the data type of the function (as a tree),
590    or for a library call it is an identifier node for the subroutine name.
591    SIZE is the number of bytes of arguments passed on the stack.  */
592
593 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 
594
595 /* Define how to find the value returned by a function.
596    VALTYPE is the data type of the value (as a tree).
597    If the precise function being called is known, FUNC is its FUNCTION_DECL;
598    otherwise, FUNC is 0.  */
599
600 #define FUNCTION_VALUE(VALTYPE, FUNC) \
601    gen_rtx_REG (TYPE_MODE (VALTYPE), G1_REG)
602
603 /* 1 if N is a possible register number for a function value
604    as seen by the caller.  */
605
606 #define FUNCTION_VALUE_REGNO_P(N)  \
607   ((N) == G1_REG)
608
609 /* 1 if N is a possible register number for function argument passing.  */
610 #define FUNCTION_ARG_REGNO_P(N) 0
611
612 /* Define how to find the value returned by a library function
613    assuming the value has mode MODE.  */
614
615 #define LIBCALL_VALUE(MODE) \
616   gen_rtx_REG (MODE, G1_REG)
617
618 /* Define this macro to be a nonzero value if the location where a
619    function argument is passed depends on whether or not it is a
620    named argument.  */
621
622 #define STRICT_ARGUMENT_NAMING 1
623
624 /* Define a data type for recording info about an argument list
625    during the scan of that argument list.  This data type should
626    hold all necessary information about the function itself
627    and about the args processed so far, enough to enable macros
628    such as FUNCTION_ARG to determine where the next arg should go.
629
630    For picoJava this is a struct which remembers the number of
631    arguments named, the total number of words passed and an adjustment
632    factor to use if accessing a double word argument with a single
633    word memop.  See the comments at the head pj.c for more information */
634
635 #define ARGS_IN_REGS 32
636
637 struct pj_args
638 {
639   int named_words;
640   int total_words;
641   int arg_count;
642   int arg_adjust[ARGS_IN_REGS];
643 };
644
645 #define CUMULATIVE_ARGS  struct pj_args
646
647 #define FUNCTION_INCOMING_ARG(asf,pmode,passtyped,named) \
648     pj_function_incoming_arg(&asf,pmode,passtyped,named)
649
650 /* Initialize a variable CUM of type CUMULATIVE_ARGS
651    for a call to a function whose data type is FNTYPE.
652    For a library call, FNTYPE is 0.
653  */
654
655 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
656   (CUM).named_words = 0;                                     \
657   (CUM).total_words = 0;                                     \
658   (CUM).arg_count = 0;
659
660 /* Update the data in CUM to advance over an argument
661    of mode MODE and data type TYPE.
662
663    picoJava only ever sends scalars as arguments.  Aggregates are sent
664    by reference.  */
665
666 #define PJ_ARG_WORDS(MODE)  \
667    ((GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
668
669 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)                    \
670 {                                                                       \
671   (CUM).total_words += PJ_ARG_WORDS (MODE);                             \
672   if (NAMED)                                                            \
673     (CUM).named_words += PJ_ARG_WORDS (MODE);                           \
674   (CUM).arg_count++;                                                    \
675 }
676
677 /* Define where to put the arguments to a function.
678    Value is zero to push the argument on the stack,
679    or a hard register in which to store the argument.
680
681    MODE is the argument's machine mode.
682    TYPE is the data type of the argument (as a tree).
683     This is null for libcalls where that information may
684     not be available.
685    CUM is a variable of type CUMULATIVE_ARGS which gives info about
686     the preceding args and about the function being called.
687    NAMED is nonzero if this argument is a named parameter
688     (otherwise it is an extra parameter matching an ellipsis).
689
690    For picoJava scalar arguments are normally in registers.  */
691
692
693 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)                            \
694     ( ((CUM).total_words + PJ_ARG_WORDS (MODE) < ARGS_IN_REGS)          \
695        ? gen_rtx (REG, MODE, O0_REG + (CUM).total_words)                \
696        : NULL_RTX)
697
698
699 /* A C expression that indicates when an argument must be passed by
700    reference.  If nonzero for an argument, a copy of that argument is
701    made in memory and a pointer to the argument is passed instead of
702    the argument itself.  The pointer is passed in whatever way is
703    appropriate for passing a pointer to that type.  */
704
705 /* All aggregates and arguments larger than 8 bytes are passed this way.  */
706
707 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
708  (TYPE && (AGGREGATE_TYPE_P (TYPE) || int_size_in_bytes (TYPE) > 8))
709
710 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
711    the stack pointer does not matter.  The value is tested only in
712    functions that have frame pointers.
713    No definition is equivalent to always zero.  */
714
715 #define EXIT_IGNORE_STACK 0
716 \f
717 /* Trampoline support.  */
718
719 /* A picoJava trampoline looks like:
720
721  0000 11DEAD            sipush %lo16(static)
722  0003 EDDEAD            sethi  %hi16(static)
723  0006 FF7D              write_global1
724  0008 11DEAD            sipush %lo16(fn)
725  000b EDDEAD            sethi  %hi16(fn)
726  000e FF60              write_pc
727 */ 
728
729 /* Length in units of the trampoline for entering a nested function.  */
730 #define TRAMPOLINE_SIZE  16
731
732 /* Alignment required for a trampoline in bits .  */
733 #define TRAMPOLINE_ALIGNMENT  32
734
735 #define TRAMPOLINE_TEMPLATE(FILE) \
736   fprintf (FILE, "\tsipush 0xdead\n"); \
737   fprintf (FILE, "\tsethi  0xdead\n"); \
738   fprintf (FILE, "\twrite_global1\n"); \
739   fprintf (FILE, "\tsipush 0xdead\n"); \
740   fprintf (FILE, "\tsethi  0xdead\n"); \
741   fprintf (FILE, "\twrite_pc\n"); 
742
743 /* Emit RTL insns to initialize the variable parts of a trampoline.
744    FNADDR is an RTX for the address of the function's pure code.
745    CXT is an RTX for the static chain value for the function.  */
746
747 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                             \
748 {                                                                             \
749   static int off[4] = { 1, 0, 4, 3 };                                         \
750   int i;                                                                      \
751                                                                               \
752   /* Move the FNADDR and CXT into the instruction stream. Do this byte        \
753      by byte to make sure it works for either endianness.  */                 \
754                                                                               \
755   for (i = 0; i < 4; i++)                                                     \
756     emit_move_insn                                                            \
757       (gen_rtx_MEM (QImode,                                                   \
758                     plus_constant (tramp, off[i] + 1)),                       \
759        gen_rtx_TRUNCATE (QImode,                                              \
760                          expand_shift (RSHIFT_EXPR, SImode,                   \
761                                        CXT, size_int (i * 8), 0, 1)));        \
762                                                                               \
763   for (i = 0; i < 4; i++)                                                     \
764     emit_move_insn                                                            \
765       (gen_rtx_MEM (QImode,                                                   \
766                     plus_constant (tramp, off[i] + 9)),                       \
767        gen_rtx_TRUNCATE (QImode,                                              \
768                          expand_shift (RSHIFT_EXPR, SImode,                   \
769                                        FNADDR, size_int (i * 8), 0, 1)));     \
770 }
771
772 /* Output assembler code to FILE to increment profiler label # LABELNO
773    for profiling a function entry.  */
774
775 #define FUNCTION_PROFILER(FILE, LABELNO)                        \
776  fprintf (FILE, "\tsipush %%lo16(.LP%d)\n", (LABELNO));         \
777  fprintf (FILE, "\tsethi  %%hi16(.LP%d)\n", (LABELNO));         \
778  fprintf (FILE, "\tsipush %%lo16(_mcount)\n");                  \
779  fprintf (FILE, "\tsethi  %%hi16(_mcount)\n");                  \
780  fprintf (FILE, "\ticonst_3\n");                                \
781  fprintf (FILE, "\tcall\n");                                    
782
783 \f
784 /* Addressing modes, and classification of registers for them.  */
785
786 #define HAVE_POST_INCREMENT  1
787 #define HAVE_PRE_INCREMENT   1
788 #define HAVE_POST_DECREMENT  1
789 #define HAVE_PRE_DECREMENT   1
790
791 /* These assume that REGNO is a hard or pseudo reg number.
792    They give nonzero only if REGNO is a hard reg of the suitable class
793    or a pseudo reg currently allocated to a suitable hard reg.
794    Since they use reg_renumber, they are safe only once reg_renumber
795    has been allocated, which happens in local-alloc.c.  */
796
797 /* Any register is OK for a base or an index.  As is something that has
798    been spilled to memory.  */
799
800 #define REGNO_OK_FOR_BASE_P(REGNO) 1
801 #define REGNO_OK_FOR_INDEX_P(REGNO) 1
802
803 /* Maximum number of registers that can appear in a valid memory
804    address.  
805
806    Arbitarily limited to 20.  */
807
808 #define MAX_REGS_PER_ADDRESS 20
809
810 /* Recognize any constant value that is a valid address.  */
811
812 #define CONSTANT_ADDRESS_P(X)                                   \
813   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF      \
814    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
815
816 /* Nonzero if the constant value X is a legitimate general operand.  */
817
818 #define LEGITIMATE_CONSTANT_P(X) \
819   (GET_CODE (X) == CONST_DOUBLE ? (pj_standard_float_constant (X)!=0) : 1)
820
821 /* Letters in the range `Q' through `U' in a register constraint string
822    may be defined in a machine-dependent fashion to stand for arbitrary
823    operand types.
824
825    For picoJava, `S' handles a source operand. */
826
827 #define EXTRA_CONSTRAINT(OP, C)                         \
828    ((C) == 'S' ? pj_source_operand (OP, GET_MODE (OP)) : 0)
829
830 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and
831    check its validity for a certain class.  */
832
833 #define REG_OK_FOR_BASE_P(X) 1
834 #define REG_OK_FOR_INDEX_P(x) 0
835
836 \f
837 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
838    that is a valid memory address for an instruction.
839    The MODE argument is the machine mode for the MEM expression
840    that wants to use this address.  
841
842    We may have arbitrarily complex addressing modes, but we get better
843    cse of address expressions if we generate code with simple
844    addressing modes and clean up redundant register operations later
845    in the machine dependent reorg pass.  */
846
847 #define SRC_REG_P(X) \
848  (REG_P(X) && !OUTGOING_REG_RTX_P (X))
849
850 #define SIMPLE_ADDRESS(X) \
851  (SRC_REG_P(X) || CONSTANT_ADDRESS_P(X))
852
853 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                          \
854    if (SIMPLE_ADDRESS(X)) goto LABEL;                                     \
855    if ((GET_CODE (X) == POST_INC                                          \
856        || GET_CODE (X) == PRE_INC                                         \
857        || GET_CODE (X) == POST_DEC                                        \
858        || GET_CODE (X) == PRE_DEC) && SRC_REG_P(XEXP (X, 0))) goto LABEL; \
859
860 /* Try machine-dependent ways of modifying an illegitimate address
861    to be legitimate.  If we find one, return the new, valid address.
862    This macro is used in only one place: `memory_address' in explow.c.
863
864    OLDX is the address as it was before break_out_memory_refs was called.
865    In some cases it is useful to look at this to decide what needs to be done.
866
867    MODE and WIN are passed so that this macro can use
868    GO_IF_LEGITIMATE_ADDRESS.
869
870    It is always safe for this macro to do nothing.  It exists to recognize
871    opportunities to optimize the output.  */
872
873 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)
874
875 /* Go to LABEL if ADDR (a legitimate address expression)
876    has an effect that depends on the machine mode it is used for.  */
877
878 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)                        \
879 {                                                                       \
880   if (GET_CODE(ADDR) == PRE_DEC || GET_CODE(ADDR) == POST_INC           \
881       || GET_CODE(ADDR) == PRE_INC || GET_CODE(ADDR) == POST_DEC)       \
882     goto LABEL;                                                         \
883 }
884 \f
885 /* Specify the machine mode that this machine uses
886    for the index in the tablejump instruction.  */
887 #define CASE_VECTOR_MODE SImode
888
889 /* Define as C expression which evaluates to nonzero if the tablejump
890    instruction expects the table to contain offsets from the address of the
891    table.  */
892
893 #define CASE_VECTOR_PC_RELATIVE 1
894
895 /* Specify the tree operation to be used to convert reals to integers.  */
896 #define IMPLICIT_FIX_EXPR  FIX_ROUND_EXPR
897
898 /* This is the kind of divide that is easiest to do in the general case.  */
899 #define EASY_DIV_EXPR  TRUNC_DIV_EXPR
900
901 /* 'char' is signed by default.  */
902 #define DEFAULT_SIGNED_CHAR  1
903
904 /* The type of size_t unsigned int.  */
905 #define SIZE_TYPE "unsigned int"
906
907 /* Don't cse the address of the function being compiled.  */
908
909 #define NO_RECURSIVE_FUNCTION_CSE (!optimize_size)
910
911 /* Max number of bytes we can move from memory to memory
912    in one reasonably fast instruction.  */
913
914 #define MOVE_MAX 4
915
916 /* Max number of bytes we want move_by_pieces to be able to copy
917    efficiently.  */
918
919 #define MOVE_MAX_PIECES 4
920
921 /* Define if operations between registers always perform the operation
922    on the full register even if a narrower mode is specified.  */
923 /*#define WORD_REGISTER_OPERATIONS*/
924
925 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
926    will either zero-extend or sign-extend.  The value of this macro should
927    be the code that says which one of the two operations is implicitly
928    done, NIL if none.  */
929
930 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
931
932 /* We assume that the store-condition-codes instructions store 0 for false
933    and some other value for true.  This is the value stored for true.  */
934
935 #define STORE_FLAG_VALUE 1
936
937 /* Define if loading short immediate values into registers sign extends.  */
938
939 #define SHORT_IMMEDIATES_SIGN_EXTEND
940
941 /* Define this if zero-extension is slow (more than one real
942    instruction).  */
943
944 /* #define SLOW_ZERO_EXTEND  */
945
946 /* Nonzero if access to memory by bytes is no faster than for words.  */
947 #define SLOW_BYTE_ACCESS 1
948
949 #define INT_TYPE_SIZE           32
950
951 /* A C expression that is nonzero if on this machine the number of
952    bits actually used for the count of a shift operation is equal to the
953    number of bits needed to represent the size of the object being
954    shifted.  */
955
956 #define SHIFT_COUNT_TRUNCATED 1
957
958 /* All integers have the same format so truncation is easy.  */
959
960 #define TRULY_NOOP_TRUNCATION(OUTPREC,INPREC)  1
961
962 /* Define this if addresses of constant functions
963    shouldn't be put through pseudo regs where they can be cse'd.
964    Desirable on machines where ordinary constants are expensive
965    but a CALL with constant address is cheap.  */
966
967 #define NO_FUNCTION_CSE (!optimize_size)
968
969 /* Chars and shorts should be passed as ints.  */
970
971 #define PROMOTE_PROTOTYPES 1
972
973 /* The machine modes of pointers and functions.  */
974
975 #define Pmode  SImode
976 #define FUNCTION_MODE  Pmode
977
978 \f
979 /* A part of a C `switch' statement that describes the relative costs
980    of constant RTL expressions.  It must contain `case' labels for
981    expression codes `const_int', `const', `symbol_ref', `label_ref'
982    and `const_double'.  Each case must ultimately reach a `return'
983    statement to return the relative cost of the use of that kind of
984    constant value in an expression.  The cost may depend on the
985    precise value of the constant, which is available for examination
986    in X, and the rtx code of the expression in which it is contained,
987    found in OUTER_CODE.
988   
989    CODE is the expression code--redundant, since it can be obtained
990    with `GET_CODE (X)'.  */
991
992 #define CONST_COSTS(RTX,CODE,OUTER_CODE)                        \
993   case CONST_INT:                                               \
994     return INTVAL (RTX) >= -1 && INTVAL (RTX) <= 5 ?  1         \
995          : INTVAL (RTX) >= -32768 && INTVAL (RTX) <= 32767 ? 2  \
996          : 3;                                                   \
997   case CONST:                                                   \
998   case LABEL_REF:                                               \
999   case SYMBOL_REF:                                              \
1000     return 3;                                                   \
1001   case CONST_DOUBLE:                                            \
1002    return pj_standard_float_constant (RTX) ? 1 : 4;             \
1003
1004 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
1005    This can be used, for example, to indicate how costly a multiply
1006    instruction is.  In writing this macro, you can use the construct
1007    `COSTS_N_INSNS (N)' to specify a cost equal to N fast
1008    instructions.  OUTER_CODE is the code of the expression in which X
1009    is contained. */
1010
1011 #define RTX_COSTS(X,CODE,OUTER_CODE)                                    \
1012   case MULT:                                                            \
1013     if (GET_CODE (XEXP (X, 1)) == CONST_INT)                            \
1014       {                                                                 \
1015         unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1));            \
1016         int nbits = 0;                                                  \
1017                                                                         \
1018         while (value != 0)                                              \
1019           {                                                             \
1020             nbits++;                                                    \
1021             value >>= 1;                                                \
1022           }                                                             \
1023                                                                         \
1024           total = COSTS_N_INSNS (nbits);                                \
1025       }                                                                 \
1026     else                                                                \
1027       total = COSTS_N_INSNS (10);                                       \
1028     break;
1029
1030 /* Compute extra cost of moving data between one register class and
1031    another.  */
1032
1033 #define REGISTER_MOVE_COST(MODE, SRC_CLASS, DST_CLASS)                \
1034       ((SRC_CLASS == STD_REGS || SRC_CLASS == ARG_REGS)?  2 : 10)
1035
1036 \f
1037 /* Assembler output control.  */
1038
1039 /* A C string constant describing how to begin a comment in the target
1040    assembler language.  The compiler assumes that the comment will end at
1041    the end of the line.  */
1042 #define ASM_COMMENT_START "!"
1043
1044 /* The text to go at the start of the assembler file.  */
1045
1046 #undef ASM_FILE_START
1047 #define ASM_FILE_START(FILE)                                                 \
1048   fprintf (FILE,"\t.file\t\"%s\"\n", main_input_filename);                   \
1049   fprintf (FILE,"\t! %s\n", TARGET_LITTLE_ENDIAN ? ".little" : ".big");      \
1050   fprintf (FILE,"\t.align 4\n");
1051
1052 #define ASM_APP_ON              ""
1053 #define ASM_APP_OFF             ""
1054 #define FILE_ASM_OP             "\t.file\n"
1055
1056 #define SET_ASM_OP              "\t.set\t"
1057
1058 /* How to change between sections.  */
1059
1060 #define TEXT_SECTION_ASM_OP             "\t.text"
1061 #define DATA_SECTION_ASM_OP             "\t.data"
1062
1063 /* This special macro is used to output the asm pseduo op which allows
1064    the linker to fixup broken calling conentions.  */
1065
1066 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME)                        \
1067 do { fputs (current_function_varargs || current_function_stdarg         \
1068             ? "\t.varargs_words_needed\t" : "\t.words_needed\t",        \
1069             FILE);                                                      \
1070      assemble_name (FILE, FNNAME);                                      \
1071      fprintf (FILE, ", %d\n", current_function_args_info.named_words);  \
1072    } while (0)
1073
1074 /* If defined, a C expression whose value is a string containing the
1075    assembler operation to identify the following data as
1076    uninitialized G data.  If not defined, and neither
1077    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
1078    uninitialized global data will be output in the data section if
1079    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
1080    used.  */
1081
1082 #define BSS_SECTION_ASM_OP      "\t.section\t.bss"
1083
1084 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
1085    separate, explicit argument.  If you define this macro, it is used
1086    in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
1087    handling the required alignment of the variable.  The alignment is
1088    specified as the number of bits.
1089
1090    Try to use function `asm_output_aligned_bss' defined in file
1091    `varasm.c' when defining this macro.  */
1092
1093 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1094   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
1095
1096
1097 /* Define this so that jump tables go in same section as the current function,
1098    which could be text or it could be a user defined section.  */
1099 #define JUMP_TABLES_IN_TEXT_SECTION 1
1100
1101 /* The assembler's names for the registers.  */
1102
1103 #define REGISTER_NAMES                                          \
1104 {                                                               \
1105    "r0", "r1",  "r2",  "r3",  "r4",  "r5",  "r6", "r7",         \
1106    "r8", "r9",  "r10", "r11", "r12", "r13", "r14","r15",        \
1107    "r16","r17", "r18", "r19", "r20", "r21", "r22","r23",        \
1108    "r24","r25", "r26", "r27", "r28", "r29", "r30","r31",        \
1109                                                                 \
1110    "i0", "i1",  "i2",  "i3",  "i4",  "i5",  "i6", "i7",         \
1111    "i8", "i9",  "i10", "i11", "i12", "i13", "i14","i15",        \
1112    "i16","i17", "i18", "i19", "i20", "i21", "i22","i23",        \
1113    "i24","i25", "i26", "i27", "i28", "i29", "i30","i31",        \
1114                                                                 \
1115    "global0",   "global1",    "global2",    "global3",          \
1116    "global4",   "global5",    "global6",    "global7",          \
1117    "vars",      "optop",      "sc",         "pc",               \
1118    "ticks",     "slow",       "va",         "d3",               \
1119    "d4",        "d5",         "d6",         "ap",               \
1120    "p0",        "p1",         "p2",         "p3",               \
1121    "q0", "q1",  "q2",  "q3",  "q4",  "q5",  "q6", "q7",         \
1122                                                                 \
1123    "o0", "o1",  "o2",  "o3",  "o4",  "o5",  "o6", "o7",         \
1124    "o8", "o9",  "o10", "o11", "o12", "o13", "o14","o15",        \
1125    "o16","o17", "o18", "o19", "o20", "o21", "o22","o23",        \
1126    "o24","o25", "o26", "o27", "o28", "o29", "o30","o31"}        \
1127
1128
1129 /* Output a label definition.  */
1130
1131 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1132   do { assemble_name ((FILE), (NAME)); fputs (":\n", (FILE)); } while (0)
1133
1134 /* This is how to output an assembler line
1135    that says to advance the location counter
1136    to a multiple of 2**LOG bytes.  */
1137
1138 #define ASM_OUTPUT_ALIGN(FILE,LOG)              \
1139   if ((LOG) != 0)                               \
1140     fprintf ((FILE), "\t.align %d\n", (LOG))
1141
1142 /* Output a globalising directive for a label.  */
1143
1144 #define ASM_GLOBALIZE_LABEL(STREAM,NAME)        \
1145   (fprintf ((STREAM), "\t.global\t"),           \
1146    assemble_name ((STREAM), (NAME)),            \
1147    fputc ('\n', (STREAM)))
1148
1149 /* After an opcode has been printed, there's nothing on the line any
1150    more.  */
1151
1152 #define ASM_OUTPUT_OPCODE(STREAM, P)            \
1153    pj_stuff_on_line = 0;
1154
1155 /* The prefix to add to user-visible assembler symbols.  */
1156
1157 #define USER_LABEL_PREFIX ""
1158
1159 /* The prefix to add to an internally generated label.  */
1160
1161 #define LOCAL_LABEL_PREFIX "."
1162
1163 /* Make an internal label into a string.  */
1164 #undef  ASM_GENERATE_INTERNAL_LABEL
1165 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
1166   sprintf ((STRING), "*%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
1167
1168 /* Output an internal label definition.  */
1169 #undef  ASM_OUTPUT_INTERNAL_LABEL
1170 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1171   asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM))
1172
1173 /* Construct a private name.  */
1174 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER)     \
1175   ((OUTVAR) = (char *) alloca (strlen (NAME) + 10),     \
1176    sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)))
1177
1178 /* Output a relative address table.  */
1179
1180 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,BODY,VALUE,REL)                 \
1181       asm_fprintf ((STREAM), "\t.long\t.L%d-.L%di\n", (VALUE),(REL));
1182
1183 #define ADDR_VEC_ALIGN(VEC) 0
1184
1185 /* Output various types of constants.  */
1186
1187 /* This is how to output an assembler line
1188    that says to advance the location counter by SIZE bytes.  */
1189
1190 #undef  ASM_OUTPUT_SKIP
1191 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1192   fprintf ((FILE), "\t.space %d\n", (SIZE))
1193
1194 /* This says how to output an assembler line
1195    to define a global common symbol.  */
1196
1197 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)    \
1198 ( fputs ("\t.comm ", (FILE)),                           \
1199   assemble_name ((FILE), (NAME)),                       \
1200   fprintf ((FILE), ",%d\n", (SIZE)))
1201
1202 /* This says how to output an assembler line
1203    to define a local common symbol.  */
1204
1205 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)     \
1206 ( fputs ("\t.lcomm ", (FILE)),                          \
1207   assemble_name ((FILE), (NAME)),                       \
1208   fprintf ((FILE), ",%d\n", (SIZE)))
1209
1210 /* We don't want the default switch handling.  */
1211 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
1212 #undef ASM_OUTPUT_CASE_LABEL
1213 \f
1214 /* Print operand X (an rtx) in assembler syntax to file FILE.
1215    CODE is a letter or star or 0 if no letter was specified.
1216    For `%' followed by punctuation, CODE is the punctuation and X is null.  */
1217
1218 #define PRINT_OPERAND(STREAM, X, CODE)  pj_print_operand ((STREAM), (X), (CODE))
1219
1220 /* Print a memory address as an operand to reference that memory location.  */
1221
1222 #define PRINT_OPERAND_ADDRESS(STREAM,X)  output_addr_const (STREAM, X)
1223
1224 /* Punctuation valid for print_operand.  */
1225
1226 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '*')
1227 \f
1228
1229 /* Define this macro if it is advisable to hold scalars in registers
1230    in a wider mode than that declared by the program.  In such cases, 
1231    the value is constrained to be within the bounds of the declared
1232    type, but kept valid in the wider mode.  The signedness of the
1233    extension may differ from that of the type.
1234
1235    Since picoJava doesn't have unsigned compares, prefer signed
1236    arithmetic.  */
1237
1238 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE)             \
1239  if (GET_MODE_CLASS (MODE) == MODE_INT                  \
1240      && GET_MODE_SIZE (MODE) < UNITS_PER_WORD)          \
1241      {                                                  \
1242        (MODE) = SImode;                                 \
1243        (UNSIGNEDP) = 0;                                 \
1244       }
1245
1246 /* Defining PROMOTE_FUNCTION_ARGS eliminates some unnecessary zero/sign
1247    extensions applied to char/short functions arguments.  Defining
1248    PROMOTE_FUNCTION_RETURN does the same for function returns.  */
1249 #define PROMOTE_FUNCTION_ARGS
1250
1251 \f
1252 /* We can debug without a frame pointer.  */
1253 #define CAN_DEBUG_WITHOUT_FP 
1254
1255 /* How to renumber registers for dbx and gdb.  */
1256 extern short pj_debugreg_renumber_vec[];
1257
1258 #define DBX_REGISTER_NUMBER(REG) (pj_debugreg_renumber_vec[REG])
1259
1260 #define DONT_USE_BUILTIN_SETJMP
1261
1262 /* We prefer to use dwarf2. */
1263 #undef  PREFERRED_DEBUGGING_TYPE 
1264 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
1265 #define DWARF2_UNWIND_INFO 1
1266 #define DWARF_LINE_MIN_INSTR_LENGTH 1
1267
1268 \f
1269 /* varargs and stdarg builtins.  */
1270
1271 #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg)                      \
1272 do {                                                                          \
1273    tree t = build (MODIFY_EXPR, TREE_TYPE (valist), valist,                   \
1274                    make_tree (ptr_type_node, gen_rtx_REG (Pmode, VA_REG)));   \
1275    TREE_SIDE_EFFECTS (t) = 1;                                                 \
1276    expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);                      \
1277     } while (0)
1278
1279
1280 #define EXPAND_BUILTIN_VA_ARG(valist, type)                             \
1281    pj_expand_builtin_va_arg(valist, type)
1282
1283 #define EXPAND_BUILTIN_NEXT_ARG(OFFSET)                                 \
1284    gen_rtx_MEM (Pmode,                                                  \
1285                 plus_constant (gen_rtx_REG (SImode, VARS_REG),          \
1286                                (INTVAL (offset) + 1) * -4));     
1287
1288 /* Before the prologue, the return address is just above optop.  */
1289 #define INCOMING_RETURN_ADDR_RTX  \
1290   plus_constant (gen_rtx_REG (Pmode, OPTOP_REG), 4)
1291
1292 /* Rewrite the rtl to use take advantage of the opstack.  */
1293 #define MACHINE_DEPENDENT_REORG(INSNS) pj_machine_dependent_reorg(INSNS)
1294
1295
1296 /* Define the codes that are matched by predicates in pj.c.  */
1297 #define PREDICATE_CODES                                                  \
1298   {"pj_dest_operand",                 {SUBREG, REG, MEM}},               \
1299   {"pj_signed_comparison_operator",   {EQ, NE, LE, LT, GE,GT}},          \
1300   {"pj_unsigned_comparison_operator", {LEU, LTU, GEU, GTU}},             \
1301   {"pj_source_operand",               {CONST_INT, CONST_DOUBLE, CONST,   \
1302                                        SYMBOL_REF, LABEL_REF, SUBREG,    \
1303                                        REG, MEM}},
1304
1305 /* Generate calls to memcpy, memcmp and memset.  */
1306 #define TARGET_MEM_FUNCTIONS