Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / gcc / config / alpha / alpha32.h
1 /* Definitions of target machine for GNU compiler, for DEC Alpha
2    running Windows/NT.
3    Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
4
5    Derived from code
6       Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7
8    Donn Terry, Softway Systems, Inc.
9
10    This file contains the code-generation stuff common to the 32-bit
11    versions of the DEC/Compaq Alpha architecture.  It is shared by
12    Interix and NT/Win32 ports.   It should not contain compile-time
13    or run-time dependent environment values (such as compiler options
14    or anything containing a file or pathname.)
15
16 This file is part of GNU CC.
17
18 GNU CC is free software; you can redistribute it and/or modify
19 it under the terms of the GNU General Public License as published by
20 the Free Software Foundation; either version 2, or (at your option)
21 any later version.
22
23 GNU CC is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 GNU General Public License for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with GNU CC; see the file COPYING.  If not, write to
30 the Free Software Foundation, 59 Temple Place - Suite 330,
31 Boston, MA 02111-1307, USA.  */
32
33 #undef TARGET_WINDOWS_NT
34 #define TARGET_WINDOWS_NT 1
35
36 /* WinNT (and thus Interix) use unsigned int */
37 #define SIZE_TYPE "unsigned int"
38
39 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
40 #undef POINTER_SIZE
41 #define POINTER_SIZE 32
42 #define POINTERS_EXTEND_UNSIGNED 0
43
44 /* We don't change Pmode to the "obvious" SI mode... the above appears
45    to affect the in-memory size; we want the registers to stay DImode
46    to match the md file */
47
48 /* "long" is 32 bits.  */
49 #undef LONG_TYPE_SIZE
50 #define LONG_TYPE_SIZE 32
51
52
53 /* Output assembler code for a block containing the constant parts
54    of a trampoline, leaving space for the variable parts.
55
56    The trampoline should set the static chain pointer to value placed
57    into the trampoline and should branch to the specified routine.  */
58
59 #undef TRAMPOLINE_TEMPLATE
60 #define TRAMPOLINE_TEMPLATE(FILE)                       \
61 {                                                       \
62   fprintf (FILE, "\tbr $27,$LTRAMPP\n");                \
63   fprintf (FILE, "$LTRAMPP:\n\tldl $1,12($27)\n");      \
64   fprintf (FILE, "\tldl $27,16($27)\n");                \
65   fprintf (FILE, "\tjmp $31,($27),0\n");                \
66   fprintf (FILE, "\t.long 0,0\n");                      \
67 }
68
69 /* Length in units of the trampoline for entering a nested function.  */
70
71 #undef TRAMPOLINE_SIZE
72 #define TRAMPOLINE_SIZE    24
73
74 /* Emit RTL insns to initialize the variable parts of a trampoline.
75    FNADDR is an RTX for the address of the function's pure code.
76    CXT is an RTX for the static chain value for the function.   */
77
78 #undef INITIALIZE_TRAMPOLINE
79 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
80   alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 20, 16, 12)
81
82 /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
83    Used for C++ multiple inheritance.  */
84
85 #undef ASM_OUTPUT_MI_THUNK
86 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION)        \
87 do {                                                                    \
88   char *op, *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0);         \
89   int reg;                                                              \
90                                                                         \
91   /* Mark end of prologue.  */                                          \
92   output_end_prologue (FILE);                                           \
93                                                                         \
94   /* Rely on the assembler to macro expand a large delta.  */           \
95   reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16; \
96   fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg);      \
97                                                                         \
98   op = "jsr";                                                           \
99   if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0)))    \
100     op = "br";                                                          \
101   fprintf (FILE, "\t%s $31,", op);                                      \
102   assemble_name (FILE, fn_name);                                        \
103   fputc ('\n', FILE);                                                   \
104 } while (0)