Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / contrib / gcc-3.4 / gcc / xcoffout.h
1 /* XCOFF definitions.  These are needed in dbxout.c, final.c,
2    and xcoffout.h.
3    Copyright (C) 1998, 2000, 2002, 2003
4    Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA.  */
22
23
24 #define ASM_STABS_OP "\t.stabx\t"
25
26 /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM.  */
27
28 #define DBX_TYPE_DECL_STABS_CODE N_DECL
29
30 /* Use the XCOFF predefined type numbers.  */
31
32 /* ??? According to metin, typedef stabx must go in text control section,
33    but he did not make this changes everywhere where such typedef stabx
34    can be emitted, so it is really needed or not?  */
35
36 #define DBX_OUTPUT_STANDARD_TYPES(SYMS)         \
37 {                                               \
38   text_section ();                              \
39   xcoff_output_standard_types (SYMS);           \
40 }
41
42 /* Any type with a negative type index has already been output.  */
43
44 #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0)
45
46 /* Must use N_STSYM for static const variables (those in the text section)
47    instead of N_FUN.  */
48
49 #define DBX_STATIC_CONST_VAR_CODE N_STSYM
50
51 /* For static variables, output code to define the start of a static block.  */
52
53 #define DBX_STATIC_BLOCK_START(ASMFILE,CODE)                            \
54 {                                                                       \
55   if ((CODE) == N_STSYM)                                                \
56     fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
57   else if ((CODE) == N_LCSYM)                                           \
58     fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \
59 }
60
61 /* For static variables, output code to define the end of a static block.  */
62
63 #define DBX_STATIC_BLOCK_END(ASMFILE,CODE)                              \
64 {                                                                       \
65   if ((CODE) == N_STSYM || (CODE) == N_LCSYM)                           \
66     fputs ("\t.es\n", (ASMFILE));                                       \
67 }
68
69 /* We must use N_RPYSM instead of N_RSYM for register parameters.  */
70
71 #define DBX_REGPARM_STABS_CODE N_RPSYM
72
73 /* We must use 'R' instead of 'P' for register parameters.  */
74
75 #define DBX_REGPARM_STABS_LETTER 'R'
76
77 /* Define our own finish symbol function, since xcoff stabs have their
78    own different format.  */
79
80 #define DBX_FINISH_SYMBOL(SYM)                                  \
81 {                                                               \
82   if (current_sym_addr && current_sym_code == N_FUN)            \
83     fprintf (asmfile, "\",.");                                  \
84   else                                                          \
85     fprintf (asmfile, "\",");                                   \
86   /* If we are writing a function name, we must ensure that     \
87      there is no storage-class suffix on the name.  */          \
88   if (current_sym_addr && current_sym_code == N_FUN             \
89       && GET_CODE (current_sym_addr) == SYMBOL_REF)             \
90     {                                                           \
91       const char *_p = XSTR (current_sym_addr, 0);              \
92       if (*_p == '*')                                           \
93         fprintf (asmfile, "%s", _p+1);                          \
94       else                                                      \
95         for (; *_p != '[' && *_p; _p++)                         \
96           fprintf (asmfile, "%c", *_p);                         \
97     }                                                           \
98   else if (current_sym_addr)                                    \
99     output_addr_const (asmfile, current_sym_addr);              \
100   else if (current_sym_code == N_GSYM)                          \
101     assemble_name (asmfile, XSTR (XEXP (DECL_RTL (sym), 0), 0)); \
102   else                                                          \
103     fprintf (asmfile, "%d", current_sym_value);                 \
104   fprintf (asmfile, ",%d,0\n", stab_to_sclass (current_sym_code)); \
105 }
106
107 /* These are IBM XCOFF extensions we need to reference in dbxout.c
108    and xcoffout.c.  */
109
110 /* AIX XCOFF uses this for typedefs.  This can have any value, since it is
111    only used for translation into a C_DECL storage class.  */
112 #ifndef N_DECL
113 #define N_DECL 0x8c
114 #endif
115 /* AIX XCOFF uses this for parameters passed in registers.  This can have
116    any value, since it is only used for translation into a C_RPSYM storage
117    class.  */
118 #ifndef N_RPSYM
119 #define N_RPSYM 0x8e
120 #endif
121
122 /* Name of the current include file.  */
123
124 extern const char *xcoff_current_include_file;
125
126 /* Names of bss and data sections.  These should be unique names for each
127    compilation unit.  */
128
129 extern char *xcoff_bss_section_name;
130 extern char *xcoff_private_data_section_name;
131 extern char *xcoff_read_only_section_name;
132
133 /* Last source file name mentioned in a NOTE insn.  */
134
135 extern const char *xcoff_lastfile;
136
137 /* Don't write out path name for main source file.  */
138 #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE,FILENAME)
139
140 /* Write out main source file name using ".file" rather than ".stabs".
141    We don't actually do this here, because the assembler gets confused if there
142    is more than one .file directive.  rs6000_xcoff_file_start is already
143    emitting a .file directory, so we don't output one here also.
144    Initialize xcoff_lastfile.  */
145 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \
146   xcoff_lastfile = (FILENAME)
147
148 /* If we are still in an include file, its end must be marked.  */
149 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
150 {                                                       \
151   if (xcoff_current_include_file)                       \
152     {                                                   \
153       fputs ("\t.ei\t", (FILE));                        \
154       output_quoted_string ((FILE), xcoff_current_include_file);        \
155       putc ('\n', (FILE));                              \
156       xcoff_current_include_file = NULL;                \
157     }                                                   \
158 }
159
160 /* .stabx has the type in a different place.  */
161 #if 0  /* Do not emit any marker for XCOFF until assembler allows XFT_CV.  */
162 #define DBX_OUTPUT_GCC_MARKER(FILE) \
163   fprintf ((FILE), "%s\"%s\",0,%d,0\n", ASM_STABS_OP, STABS_GCC_MARKER, \
164            stab_to_sclass (N_GSYM))
165 #else
166 #define DBX_OUTPUT_GCC_MARKER(FILE)
167 #endif
168
169 /* Do not break .stabs pseudos into continuations.  */
170 #define DBX_CONTIN_LENGTH 0
171
172 /* Don't try to use the `x' type-cross-reference character in DBX data.
173    Also has the consequence of putting each struct, union or enum
174    into a separate .stabs, containing only cross-refs to the others.  */
175 #define DBX_NO_XREFS
176
177 /* We must put stabs in the text section.  If we don't the assembler
178    won't handle them correctly; it will sometimes put stabs where gdb
179    can't find them.  */
180
181 #define DEBUG_SYMS_TEXT
182
183 /* Prototype functions in xcoffout.c.  */
184
185 extern int stab_to_sclass (int);
186 #ifdef BUFSIZ
187 extern void xcoffout_begin_prologue (unsigned int, const char *);
188 extern void xcoffout_begin_block (unsigned, unsigned);
189 extern void xcoffout_end_epilogue (unsigned int, const char *);
190 extern void xcoffout_end_function (unsigned int);
191 extern void xcoffout_end_block (unsigned, unsigned);
192 #endif /* BUFSIZ */
193
194 #ifdef TREE_CODE
195 extern void xcoff_output_standard_types (tree);
196 #ifdef BUFSIZ
197 extern void xcoffout_declare_function (FILE *, tree, const char *);
198 #endif /* BUFSIZ */
199 #endif /* TREE_CODE */
200
201 #ifdef RTX_CODE
202 #ifdef BUFSIZ
203 extern void xcoffout_source_line (unsigned int, const char *);
204 #endif /* BUFSIZ */
205 #endif /* RTX_CODE */