]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/arm/aof.h
host-hpux.c: Change copyright header to refer to version 3 of the GNU General Public...
[thirdparty/gcc.git] / gcc / config / arm / aof.h
1 /* Definitions of target machine for GNU compiler, for Advanced RISC Machines
2 ARM compilation, AOF Assembler.
3 Copyright (C) 1995, 1996, 1997, 2000, 2003, 2004, 2007
4 Free Software Foundation, Inc.
5 Contributed by Richard Earnshaw (rearnsha@armltd.co.uk)
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 3, or (at your
12 option) any later version.
13
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
22
23 \f
24
25 #define AOF_ASSEMBLER
26
27 #define LINK_LIBGCC_SPECIAL 1
28
29 #define LINK_SPEC "%{aof} %{bin} %{aif} %{ihf} %{shl,*} %{reent*} %{split} \
30 %{ov*} %{reloc*} -nodebug"
31
32 #define STARTFILE_SPEC "crtbegin.o%s"
33
34 #define ENDFILE_SPEC "crtend.o%s"
35
36 #ifndef ASM_SPEC
37 #define ASM_SPEC "%{g -g} -arch 4 -apcs 3/32bit"
38 #endif
39
40 #ifndef LIB_SPEC
41 #define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}"
42 #endif
43
44 #define LIBGCC_SPEC "libgcc.a%s"
45
46 #define CTOR_LIST_BEGIN \
47 asm (CTORS_SECTION_ASM_OP); \
48 extern func_ptr __CTOR_END__[1]; \
49 func_ptr __CTOR_LIST__[1] = {__CTOR_END__};
50
51 #define CTOR_LIST_END \
52 asm (CTORS_SECTION_ASM_OP); \
53 func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
54
55 #define DO_GLOBAL_CTORS_BODY \
56 do \
57 { \
58 func_ptr *ptr = __CTOR_LIST__ + 1; \
59 \
60 while (*ptr) \
61 (*ptr++) (); \
62 } \
63 while (0)
64
65 #define DTOR_LIST_BEGIN \
66 asm (DTORS_SECTION_ASM_OP); \
67 extern func_ptr __DTOR_END__[1]; \
68 func_ptr __DTOR_LIST__[1] = {__DTOR_END__};
69
70 #define DTOR_LIST_END \
71 asm (DTORS_SECTION_ASM_OP); \
72 func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
73
74 #define DO_GLOBAL_DTORS_BODY \
75 do \
76 { \
77 func_ptr *ptr = __DTOR_LIST__ + 1; \
78 \
79 while (*ptr) \
80 (*ptr++) (); \
81 } \
82 while (0)
83
84 /* We really want to put Thumb tables in a read-only data section, but
85 switching to another section during function output is not
86 possible. We could however do what the SPARC does and defer the
87 whole table generation until the end of the function. */
88 #define JUMP_TABLES_IN_TEXT_SECTION 1
89
90 #define TARGET_ASM_INIT_SECTIONS aof_asm_init_sections
91
92 /* Some systems use __main in a way incompatible with its use in gcc, in these
93 cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
94 give the same symbol without quotes for an alternative entry point. You
95 must define both, or neither. */
96 #define NAME__MAIN "__gccmain"
97 #define SYMBOL__MAIN __gccmain
98
99 #define ASM_COMMENT_START ";"
100 #define ASM_APP_ON ""
101 #define ASM_APP_OFF ""
102
103 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
104 { \
105 int i; \
106 const char *ptr = (PTR); \
107 fprintf ((STREAM), "\tDCB"); \
108 for (i = 0; i < (long)(LEN); i++) \
109 fprintf ((STREAM), " &%02x%s", \
110 (unsigned ) *(ptr++), \
111 (i + 1 < (long)(LEN) \
112 ? ((i & 3) == 3 ? "\n\tDCB" : ",") \
113 : "\n")); \
114 }
115
116 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n')
117
118 /* Output of Uninitialized Variables. */
119
120 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
121 (in_section = NULL, \
122 fprintf ((STREAM), "\tAREA "), \
123 assemble_name ((STREAM), (NAME)), \
124 fprintf ((STREAM), ", DATA, COMMON\n\t%% %d\t%s size=%d\n", \
125 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE)))
126
127 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
128 (zero_init_section (), \
129 assemble_name ((STREAM), (NAME)), \
130 fprintf ((STREAM), "\n"), \
131 fprintf ((STREAM), "\t%% %d\t%s size=%d\n", \
132 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE)))
133
134 /* Output and Generation of Labels */
135 extern int arm_main_function;
136
137 /* Globalizing directive for a label. */
138 #define GLOBAL_ASM_OP "\tEXPORT\t"
139
140 #define ASM_OUTPUT_LABEL(STREAM,NAME) \
141 do { \
142 assemble_name (STREAM,NAME); \
143 fputs ("\n", STREAM); \
144 } while (0)
145
146 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
147 { \
148 if (TARGET_POKE_FUNCTION_NAME) \
149 arm_poke_function_name ((STREAM), (NAME)); \
150 ASM_OUTPUT_LABEL (STREAM, NAME); \
151 if (! TREE_PUBLIC (DECL)) \
152 { \
153 fputs ("\tKEEP ", STREAM); \
154 ASM_OUTPUT_LABEL (STREAM, NAME); \
155 } \
156 aof_delete_import ((NAME)); \
157 }
158
159 #define ASM_DECLARE_OBJECT_NAME(STREAM,NAME,DECL) \
160 { \
161 ASM_OUTPUT_LABEL (STREAM, NAME); \
162 if (! TREE_PUBLIC (DECL)) \
163 { \
164 fputs ("\tKEEP ", STREAM); \
165 ASM_OUTPUT_LABEL (STREAM, NAME); \
166 } \
167 aof_delete_import ((NAME)); \
168 }
169
170 #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
171 aof_add_import ((NAME))
172
173 #define ASM_OUTPUT_EXTERNAL_LIBCALL(STREAM,SYMREF) \
174 (fprintf ((STREAM), "\tIMPORT\t"), \
175 assemble_name ((STREAM), XSTR ((SYMREF), 0)), \
176 fputc ('\n', (STREAM)))
177
178 #define ASM_OUTPUT_LABELREF(STREAM,NAME) \
179 fprintf ((STREAM), "|%s|", NAME)
180
181 #define ASM_GENERATE_INTERNAL_LABEL(STRING,PREFIX,NUM) \
182 sprintf ((STRING), "*|%s..%ld|", (PREFIX), (long)(NUM))
183
184 /* How initialization functions are handled. */
185
186 #define CTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_ctorsvec|, DATA, READONLY"
187 #define DTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_dtorsvec|, DATA, READONLY"
188
189 /* Output of Assembler Instructions. Note that the ?xx registers are
190 there so that VFPv3/NEON registers D16-D31 have the same spacing as D0-D15
191 (each of which is overlaid on two S registers), although there are no
192 actual single-precision registers which correspond to D16-D31. */
193
194 #define REGISTER_NAMES \
195 { \
196 "a1", "a2", "a3", "a4", \
197 "v1", "v2", "v3", "v4", \
198 "v5", "v6", "sl", "fp", \
199 "ip", "sp", "lr", "pc", \
200 "f0", "f1", "f2", "f3", \
201 "f4", "f5", "f6", "f7", \
202 "cc", "sfp", "afp", \
203 "mv0", "mv1", "mv2", "mv3", \
204 "mv4", "mv5", "mv6", "mv7", \
205 "mv8", "mv9", "mv10", "mv11", \
206 "mv12", "mv13", "mv14", "mv15", \
207 "wcgr0", "wcgr1", "wcgr2", "wcgr3", \
208 "wr0", "wr1", "wr2", "wr3", \
209 "wr4", "wr5", "wr6", "wr7", \
210 "wr8", "wr9", "wr10", "wr11", \
211 "wr12", "wr13", "wr14", "wr15", \
212 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
213 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", \
214 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", \
215 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", \
216 "d16", "?16", "d17", "?17", "d18", "?18", "d19", "?19", \
217 "d20", "?20", "d21", "?21", "d22", "?22", "d23", "?23", \
218 "d24", "?24", "d25", "?25", "d26", "?26", "d27", "?27", \
219 "d28", "?28", "d29", "?29", "d30", "?30", "d31", "?31", \
220 "vfpcc" \
221 }
222
223 #define ADDITIONAL_REGISTER_NAMES \
224 { \
225 {"r0", 0}, {"a1", 0}, \
226 {"r1", 1}, {"a2", 1}, \
227 {"r2", 2}, {"a3", 2}, \
228 {"r3", 3}, {"a4", 3}, \
229 {"r4", 4}, {"v1", 4}, \
230 {"r5", 5}, {"v2", 5}, \
231 {"r6", 6}, {"v3", 6}, \
232 {"r7", 7}, {"wr", 7}, \
233 {"r8", 8}, {"v5", 8}, \
234 {"r9", 9}, {"v6", 9}, \
235 {"r10", 10}, {"sl", 10}, {"v7", 10}, \
236 {"r11", 11}, {"fp", 11}, \
237 {"r12", 12}, {"ip", 12}, \
238 {"r13", 13}, {"sp", 13}, \
239 {"r14", 14}, {"lr", 14}, \
240 {"r15", 15}, {"pc", 15}, \
241 {"d0", 63}, {"q0", 63}, \
242 {"d1", 65}, \
243 {"d2", 67}, {"q1", 67}, \
244 {"d3", 69}, \
245 {"d4", 71}, {"q2", 71}, \
246 {"d5", 73}, \
247 {"d6", 75}, {"q3", 75}, \
248 {"d7", 77}, \
249 {"d8", 79}, {"q4", 79}, \
250 {"d9", 81}, \
251 {"d10", 83}, {"q5", 83}, \
252 {"d11", 85}, \
253 {"d12", 87}, {"q6", 87}, \
254 {"d13", 89}, \
255 {"d14", 91}, {"q7", 91}, \
256 {"d15", 93}, \
257 {"q8", 95}, \
258 {"q9", 99}, \
259 {"q10", 103}, \
260 {"q11", 107}, \
261 {"q12", 111}, \
262 {"q13", 115}, \
263 {"q14", 119}, \
264 {"q15", 123} \
265 }
266
267 #define REGISTER_PREFIX "__"
268 #define USER_LABEL_PREFIX ""
269 #define LOCAL_LABEL_PREFIX ""
270
271 /* AOF does not prefix user function names with an underscore. */
272 #define ARM_MCOUNT_NAME "_mcount"
273
274 /* Output of Dispatch Tables. */
275 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
276 do \
277 { \
278 if (TARGET_ARM) \
279 fprintf ((STREAM), "\tb\t|L..%d|\n", (VALUE)); \
280 else if (TARGET_THUMB1) \
281 fprintf ((STREAM), "\tDCD\t|L..%d| - |L..%d|\n", (VALUE), (REL)); \
282 else /* Thumb-2 */ \
283 { \
284 switch (GET_MODE(body)) \
285 { \
286 case QImode: /* TBB */ \
287 asm_fprintf (STREAM, "\tDCB\t(|L..%d| - |L..%d|)/2\n", \
288 VALUE, REL); \
289 break; \
290 case HImode: /* TBH */ \
291 asm_fprintf (STREAM, "\tDCW\t|L..%d| - |L..%d|)/2\n", \
292 VALUE, REL); \
293 break; \
294 case SImode: \
295 if (flag_pic) \
296 asm_fprintf (STREAM, "\tDCD\t|L..%d| + 1 - |L..%d|\n", \
297 VALUE, REL); \
298 else \
299 asm_fprintf (STREAM, "\tDCD\t|L..%d| + 1\n", VALUE); \
300 break; \
301 default: \
302 gcc_unreachable(); \
303 } \
304 } \
305 } \
306 while (0)
307
308 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
309 do \
310 { \
311 gcc_assert (!TARGET_THUMB2) \
312 fprintf ((STREAM), "\tDCD\t|L..%d|\n", (VALUE)) \
313 } \
314 while (0)
315
316
317 /* A label marking the start of a jump table is a data label. */
318 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
319 fprintf ((STREAM), "\tALIGN\n|%s..%d|\n", (PREFIX), (NUM))
320
321 /* Assembler Commands for Alignment. */
322 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
323 fprintf ((STREAM), "\t%%\t%d\n", (int) (NBYTES))
324
325 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
326 do \
327 { \
328 int amount = 1 << (POWER); \
329 \
330 if (amount == 2) \
331 fprintf ((STREAM), "\tALIGN 2\n"); \
332 else if (amount == 4) \
333 fprintf ((STREAM), "\tALIGN\n"); \
334 else \
335 fprintf ((STREAM), "\tALIGN %d\n", amount); \
336 } \
337 while (0)
338
339 #undef DBX_DEBUGGING_INFO