]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/ppc-asm.h
configure.in: Prepend ${srcdir}/config/${cpu_type}/ instead of ${srcdir}/ginclude...
[thirdparty/gcc.git] / gcc / config / rs6000 / ppc-asm.h
1 /* PowerPC asm definitions for GNU C. */
2 /* Under winnt, 1) gas supports the following as names and 2) in particular
3 defining "toc" breaks the FUNC_START macro as ".toc" becomes ".2" */
4
5 #if !defined(__WINNT__)
6 #define r0 0
7 #define sp 1
8 #define toc 2
9 #define r3 3
10 #define r4 4
11 #define r5 5
12 #define r6 6
13 #define r7 7
14 #define r8 8
15 #define r9 9
16 #define r10 10
17 #define r11 11
18 #define r12 12
19 #define r13 13
20 #define r14 14
21 #define r15 15
22 #define r16 16
23 #define r17 17
24 #define r18 18
25 #define r19 19
26 #define r20 20
27 #define r21 21
28 #define r22 22
29 #define r23 23
30 #define r24 24
31 #define r25 25
32 #define r26 26
33 #define r27 27
34 #define r28 28
35 #define r29 29
36 #define r30 30
37 #define r31 31
38
39 #define cr0 0
40 #define cr1 1
41 #define cr2 2
42 #define cr3 3
43 #define cr4 4
44 #define cr5 5
45 #define cr6 6
46 #define cr7 7
47
48 #define f0 0
49 #define f1 1
50 #define f2 2
51 #define f3 3
52 #define f4 4
53 #define f5 5
54 #define f6 6
55 #define f7 7
56 #define f8 8
57 #define f9 9
58 #define f10 10
59 #define f11 11
60 #define f12 12
61 #define f13 13
62 #define f14 14
63 #define f15 15
64 #define f16 16
65 #define f17 17
66 #define f18 18
67 #define f19 19
68 #define f20 20
69 #define f21 21
70 #define f22 22
71 #define f23 23
72 #define f24 24
73 #define f25 25
74 #define f26 26
75 #define f27 27
76 #define f28 28
77 #define f29 29
78 #define f30 30
79 #define f31 31
80 #endif
81
82 /*
83 * Macros to glue together two tokens.
84 */
85
86 #ifdef __STDC__
87 #define XGLUE(a,b) a##b
88 #else
89 #define XGLUE(a,b) a/**/b
90 #endif
91
92 #define GLUE(a,b) XGLUE(a,b)
93
94 /*
95 * Macros to begin and end a function written in assembler. If -mcall-aixdesc
96 * or -mcall-nt, create a function descriptor with the given name, and create
97 * the real function with one or two leading periods respectively.
98 */
99
100 #ifdef _RELOCATABLE
101 #define DESC_SECTION ".got2"
102 #else
103 #define DESC_SECTION ".got1"
104 #endif
105
106 #if defined(_CALL_AIXDESC)
107 #define FUNC_NAME(name) GLUE(.,name)
108 #define JUMP_TARGET(name) FUNC_NAME(name)
109 #define FUNC_START(name) \
110 .section DESC_SECTION,"aw"; \
111 name: \
112 .long GLUE(.,name); \
113 .long _GLOBAL_OFFSET_TABLE_; \
114 .long 0; \
115 .previous; \
116 .type GLUE(.,name),@function; \
117 .globl name; \
118 .globl GLUE(.,name); \
119 GLUE(.,name):
120
121 #define FUNC_END(name) \
122 GLUE(.L,name): \
123 .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name)
124
125 #elif defined(__WINNT__)
126 #define FUNC_NAME(name) GLUE(..,name)
127 #define JUMP_TARGET(name) FUNC_NAME(name)
128 #define FUNC_START(name) \
129 .pdata; \
130 .align 2; \
131 .ualong GLUE(..,name),GLUE(name,.e),0,0,GLUE(..,name); \
132 .reldata; \
133 name: \
134 .ualong GLUE(..,name),.toc; \
135 .section .text; \
136 .globl name; \
137 .globl GLUE(..,name); \
138 GLUE(..,name):
139
140 #define FUNC_END(name) \
141 GLUE(name,.e): ; \
142 GLUE(FE_MOT_RESVD..,name):
143
144 #elif defined(_CALL_NT)
145 #define FUNC_NAME(name) GLUE(..,name)
146 #define JUMP_TARGET(name) FUNC_NAME(name)
147 #define FUNC_START(name) \
148 .section DESC_SECTION,"aw"; \
149 name: \
150 .long GLUE(..,name); \
151 .long _GLOBAL_OFFSET_TABLE_; \
152 .previous; \
153 .type GLUE(..,name),@function; \
154 .globl name; \
155 .globl GLUE(..,name); \
156 GLUE(..,name):
157
158 #define FUNC_END(name) \
159 GLUE(.L,name): \
160 .size GLUE(..,name),GLUE(.L,name)-GLUE(..,name)
161
162 #elif defined (__powerpc64__)
163 #define FUNC_NAME(name) GLUE(.,name)
164 #define FUNC_START(name) \
165 .section ".opd","aw"; \
166 name: \
167 .quad GLUE(.,name); \
168 .quad .TOC.@tocbase; \
169 .quad 0; \
170 .previous; \
171 .type GLUE(.,name),@function; \
172 .globl name; \
173 .globl GLUE(.,name); \
174 GLUE(.,name):
175
176 #define FUNC_END(name) \
177 GLUE(.L,name): \
178 .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name)
179
180 #else
181 #define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name)
182 #if defined __PIC__ || defined __pic__
183 #define JUMP_TARGET(name) FUNC_NAME(name@plt)
184 #else
185 #define JUMP_TARGET(name) FUNC_NAME(name)
186 #endif
187 #define FUNC_START(name) \
188 .type FUNC_NAME(name),@function; \
189 .globl FUNC_NAME(name); \
190 FUNC_NAME(name):
191
192 #define FUNC_END(name) \
193 GLUE(.L,name): \
194 .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
195 #endif
196