Initial revision
[official-gcc.git] / gcc / ginclude / ppc-asm.h
blob9e830dcc6ebfad4d078acc5da828c285dc811f69
1 /* PowerPC asm definitions for GNU C. */
2 /* Under winnt, 1) gas suppports the following as names and 2) in particular
3 defining "toc" breaks the FUNC_START macro as ".toc" becomes ".2" */
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
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
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
83 * Macros to glue together two tokens.
86 #ifdef __STDC__
87 #define XGLUE(a,b) a##b
88 #else
89 #define XGLUE(a,b) a/**/b
90 #endif
92 #define GLUE(a,b) XGLUE(a,b)
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.
100 #ifdef _RELOCATABLE
101 #define DESC_SECTION ".got2"
102 #else
103 #define DESC_SECTION ".got1"
104 #endif
106 #if defined(_CALL_AIXDESC)
107 #define FUNC_NAME(name) GLUE(.,name)
108 #define FUNC_START(name) \
109 .section DESC_SECTION,"aw"; \
110 name: \
111 .long GLUE(.,name); \
112 .long _GLOBAL_OFFSET_TABLE_; \
113 .long 0; \
114 .previous; \
115 .type GLUE(.,name),@function; \
116 .globl name; \
117 .globl GLUE(.,name); \
118 GLUE(.,name):
120 #define FUNC_END(name) \
121 GLUE(.L,name): \
122 .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name)
124 #elif defined(__WINNT__)
125 #define FUNC_NAME(name) GLUE(..,name)
126 #define FUNC_START(name) \
127 .pdata; \
128 .align 2; \
129 .ualong GLUE(..,name),GLUE(name,.e),0,0,GLUE(..,name); \
130 .reldata; \
131 name: \
132 .ualong GLUE(..,name),.toc; \
133 .section .text; \
134 .globl name; \
135 .globl GLUE(..,name); \
136 GLUE(..,name):
138 #define FUNC_END(name) \
139 GLUE(name,.e): ; \
140 GLUE(FE_MOT_RESVD..,name):
142 #elif defined(_CALL_NT)
143 #define FUNC_NAME(name) GLUE(..,name)
144 #define FUNC_START(name) \
145 .section DESC_SECTION,"aw"; \
146 name: \
147 .long GLUE(..,name); \
148 .long _GLOBAL_OFFSET_TABLE_; \
149 .previous; \
150 .type GLUE(..,name),@function; \
151 .globl name; \
152 .globl GLUE(..,name); \
153 GLUE(..,name):
155 #define FUNC_END(name) \
156 GLUE(.L,name): \
157 .size GLUE(..,name),GLUE(.L,name)-GLUE(..,name)
159 #else
160 #define FUNC_NAME(name) name
161 #define FUNC_START(name) \
162 .type name,@function; \
163 .globl name; \
164 name:
166 #define FUNC_END(name) \
167 GLUE(.L,name): \
168 .size name,GLUE(.L,name)-name
169 #endif