* tree-ssa-loop-prefetch.c (determine_unroll_factor): Bound the unroll
[official-gcc.git] / gcc / config / arm / aof.h
blobe6694dc1bc74571715a8ced40a3b655381a5523b
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)
7 This file is part of GCC.
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 2, or (at your
12 option) any later version.
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.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING. If not, write to
21 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */
26 #define AOF_ASSEMBLER
28 #define LINK_LIBGCC_SPECIAL 1
30 #define LINK_SPEC "%{aof} %{bin} %{aif} %{ihf} %{shl,*} %{reent*} %{split} \
31 %{ov*} %{reloc*} -nodebug"
33 #define STARTFILE_SPEC "crtbegin.o%s"
35 #define ENDFILE_SPEC "crtend.o%s"
37 #ifndef ASM_SPEC
38 #define ASM_SPEC "%{g -g} -arch 4 -apcs 3/32bit"
39 #endif
41 #ifndef LIB_SPEC
42 #define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}"
43 #endif
45 #define LIBGCC_SPEC "libgcc.a%s"
47 #define CTOR_LIST_BEGIN \
48 asm (CTORS_SECTION_ASM_OP); \
49 extern func_ptr __CTOR_END__[1]; \
50 func_ptr __CTOR_LIST__[1] = {__CTOR_END__};
52 #define CTOR_LIST_END \
53 asm (CTORS_SECTION_ASM_OP); \
54 func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
56 #define DO_GLOBAL_CTORS_BODY \
57 do \
58 { \
59 func_ptr *ptr = __CTOR_LIST__ + 1; \
61 while (*ptr) \
62 (*ptr++) (); \
63 } \
64 while (0)
66 #define DTOR_LIST_BEGIN \
67 asm (DTORS_SECTION_ASM_OP); \
68 extern func_ptr __DTOR_END__[1]; \
69 func_ptr __DTOR_LIST__[1] = {__DTOR_END__};
71 #define DTOR_LIST_END \
72 asm (DTORS_SECTION_ASM_OP); \
73 func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
75 #define DO_GLOBAL_DTORS_BODY \
76 do \
77 { \
78 func_ptr *ptr = __DTOR_LIST__ + 1; \
80 while (*ptr) \
81 (*ptr++) (); \
82 } \
83 while (0)
85 /* We really want to put Thumb tables in a read-only data section, but
86 switching to another section during function output is not
87 possible. We could however do what the SPARC does and defer the
88 whole table generation until the end of the function. */
89 #define JUMP_TABLES_IN_TEXT_SECTION 1
91 #define TARGET_ASM_INIT_SECTIONS aof_asm_init_sections
93 /* Some systems use __main in a way incompatible with its use in gcc, in these
94 cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
95 give the same symbol without quotes for an alternative entry point. You
96 must define both, or neither. */
97 #define NAME__MAIN "__gccmain"
98 #define SYMBOL__MAIN __gccmain
100 #define ASM_COMMENT_START ";"
101 #define ASM_APP_ON ""
102 #define ASM_APP_OFF ""
104 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
106 int i; \
107 const char *ptr = (PTR); \
108 fprintf ((STREAM), "\tDCB"); \
109 for (i = 0; i < (long)(LEN); i++) \
110 fprintf ((STREAM), " &%02x%s", \
111 (unsigned ) *(ptr++), \
112 (i + 1 < (long)(LEN) \
113 ? ((i & 3) == 3 ? "\n\tDCB" : ",") \
114 : "\n")); \
117 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n')
119 /* Output of Uninitialized Variables. */
121 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
122 (in_section = NULL, \
123 fprintf ((STREAM), "\tAREA "), \
124 assemble_name ((STREAM), (NAME)), \
125 fprintf ((STREAM), ", DATA, COMMON\n\t%% %d\t%s size=%d\n", \
126 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE)))
128 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
129 (zero_init_section (), \
130 assemble_name ((STREAM), (NAME)), \
131 fprintf ((STREAM), "\n"), \
132 fprintf ((STREAM), "\t%% %d\t%s size=%d\n", \
133 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE)))
135 /* Output and Generation of Labels */
136 extern int arm_main_function;
138 /* Globalizing directive for a label. */
139 #define GLOBAL_ASM_OP "\tEXPORT\t"
141 #define ASM_OUTPUT_LABEL(STREAM,NAME) \
142 do { \
143 assemble_name (STREAM,NAME); \
144 fputs ("\n", STREAM); \
145 } while (0)
147 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
149 if (TARGET_POKE_FUNCTION_NAME) \
150 arm_poke_function_name ((STREAM), (NAME)); \
151 ASM_OUTPUT_LABEL (STREAM, NAME); \
152 if (! TREE_PUBLIC (DECL)) \
154 fputs ("\tKEEP ", STREAM); \
155 ASM_OUTPUT_LABEL (STREAM, NAME); \
157 aof_delete_import ((NAME)); \
160 #define ASM_DECLARE_OBJECT_NAME(STREAM,NAME,DECL) \
162 ASM_OUTPUT_LABEL (STREAM, NAME); \
163 if (! TREE_PUBLIC (DECL)) \
165 fputs ("\tKEEP ", STREAM); \
166 ASM_OUTPUT_LABEL (STREAM, NAME); \
168 aof_delete_import ((NAME)); \
171 #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
172 aof_add_import ((NAME))
174 #define ASM_OUTPUT_EXTERNAL_LIBCALL(STREAM,SYMREF) \
175 (fprintf ((STREAM), "\tIMPORT\t"), \
176 assemble_name ((STREAM), XSTR ((SYMREF), 0)), \
177 fputc ('\n', (STREAM)))
179 #define ASM_OUTPUT_LABELREF(STREAM,NAME) \
180 fprintf ((STREAM), "|%s|", NAME)
182 #define ASM_GENERATE_INTERNAL_LABEL(STRING,PREFIX,NUM) \
183 sprintf ((STRING), "*|%s..%ld|", (PREFIX), (long)(NUM))
185 /* How initialization functions are handled. */
187 #define CTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_ctorsvec|, DATA, READONLY"
188 #define DTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_dtorsvec|, DATA, READONLY"
190 /* Output of Assembler Instructions. */
192 #define REGISTER_NAMES \
194 "a1", "a2", "a3", "a4", \
195 "v1", "v2", "v3", "v4", \
196 "v5", "v6", "sl", "fp", \
197 "ip", "sp", "lr", "pc", \
198 "f0", "f1", "f2", "f3", \
199 "f4", "f5", "f6", "f7", \
200 "cc", "sfp", "afp", \
201 "mv0", "mv1", "mv2", "mv3", \
202 "mv4", "mv5", "mv6", "mv7", \
203 "mv8", "mv9", "mv10", "mv11", \
204 "mv12", "mv13", "mv14", "mv15", \
205 "wcgr0", "wcgr1", "wcgr2", "wcgr3", \
206 "wr0", "wr1", "wr2", "wr3", \
207 "wr4", "wr5", "wr6", "wr7", \
208 "wr8", "wr9", "wr10", "wr11", \
209 "wr12", "wr13", "wr14", "wr15", \
210 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
211 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", \
212 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", \
213 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", \
214 "vfpcc" \
217 #define ADDITIONAL_REGISTER_NAMES \
219 {"r0", 0}, {"a1", 0}, \
220 {"r1", 1}, {"a2", 1}, \
221 {"r2", 2}, {"a3", 2}, \
222 {"r3", 3}, {"a4", 3}, \
223 {"r4", 4}, {"v1", 4}, \
224 {"r5", 5}, {"v2", 5}, \
225 {"r6", 6}, {"v3", 6}, \
226 {"r7", 7}, {"wr", 7}, \
227 {"r8", 8}, {"v5", 8}, \
228 {"r9", 9}, {"v6", 9}, \
229 {"r10", 10}, {"sl", 10}, {"v7", 10}, \
230 {"r11", 11}, {"fp", 11}, \
231 {"r12", 12}, {"ip", 12}, \
232 {"r13", 13}, {"sp", 13}, \
233 {"r14", 14}, {"lr", 14}, \
234 {"r15", 15}, {"pc", 15}, \
235 {"d0", 63}, \
236 {"d1", 65}, \
237 {"d2", 67}, \
238 {"d3", 69}, \
239 {"d4", 71}, \
240 {"d5", 73}, \
241 {"d6", 75}, \
242 {"d7", 77}, \
243 {"d8", 79}, \
244 {"d9", 81}, \
245 {"d10", 83}, \
246 {"d11", 85}, \
247 {"d12", 87}, \
248 {"d13", 89}, \
249 {"d14", 91}, \
250 {"d15", 93} \
253 #define REGISTER_PREFIX "__"
254 #define USER_LABEL_PREFIX ""
255 #define LOCAL_LABEL_PREFIX ""
257 /* AOF does not prefix user function names with an underscore. */
258 #define ARM_MCOUNT_NAME "_mcount"
260 /* Output of Dispatch Tables. */
261 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
262 do \
264 if (TARGET_ARM) \
265 fprintf ((STREAM), "\tb\t|L..%d|\n", (VALUE)); \
266 else if (TARGET_THUMB1) \
267 fprintf ((STREAM), "\tDCD\t|L..%d| - |L..%d|\n", (VALUE), (REL)); \
268 else /* Thumb-2 */ \
270 switch (GET_MODE(body)) \
272 case QImode: /* TBB */ \
273 asm_fprintf (STREAM, "\tDCB\t(|L..%d| - |L..%d|)/2\n", \
274 VALUE, REL); \
275 break; \
276 case HImode: /* TBH */ \
277 asm_fprintf (STREAM, "\tDCW\t|L..%d| - |L..%d|)/2\n", \
278 VALUE, REL); \
279 break; \
280 case SImode: \
281 if (flag_pic) \
282 asm_fprintf (STREAM, "\tDCD\t|L..%d| + 1 - |L..%d|\n", \
283 VALUE, REL); \
284 else \
285 asm_fprintf (STREAM, "\tDCD\t|L..%d| + 1\n", VALUE); \
286 break; \
287 default: \
288 gcc_unreachable(); \
292 while (0)
294 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
295 do \
297 gcc_assert (!TARGET_THUMB2) \
298 fprintf ((STREAM), "\tDCD\t|L..%d|\n", (VALUE)) \
300 while (0)
303 /* A label marking the start of a jump table is a data label. */
304 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
305 fprintf ((STREAM), "\tALIGN\n|%s..%d|\n", (PREFIX), (NUM))
307 /* Assembler Commands for Alignment. */
308 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
309 fprintf ((STREAM), "\t%%\t%d\n", (int) (NBYTES))
311 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
312 do \
314 int amount = 1 << (POWER); \
316 if (amount == 2) \
317 fprintf ((STREAM), "\tALIGN 2\n"); \
318 else if (amount == 4) \
319 fprintf ((STREAM), "\tALIGN\n"); \
320 else \
321 fprintf ((STREAM), "\tALIGN %d\n", amount); \
323 while (0)
325 #undef DBX_DEBUGGING_INFO