1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package mips
31
32 import (
33 "cmd/internal/obj"
34 )
35
36
37
38
41 const (
42 NSNAME = 8
43 NSYM = 50
44 NREG = 32
45 NFREG = 32
46 NWREG = 32
47 )
48
49 const (
50 REG_R0 = obj.RBaseMIPS + iota
51 REG_R1
52 REG_R2
53 REG_R3
54 REG_R4
55 REG_R5
56 REG_R6
57 REG_R7
58 REG_R8
59 REG_R9
60 REG_R10
61 REG_R11
62 REG_R12
63 REG_R13
64 REG_R14
65 REG_R15
66 REG_R16
67 REG_R17
68 REG_R18
69 REG_R19
70 REG_R20
71 REG_R21
72 REG_R22
73 REG_R23
74 REG_R24
75 REG_R25
76 REG_R26
77 REG_R27
78 REG_R28
79 REG_R29
80 REG_R30
81 REG_R31
82
83 REG_F0
84 REG_F1
85 REG_F2
86 REG_F3
87 REG_F4
88 REG_F5
89 REG_F6
90 REG_F7
91 REG_F8
92 REG_F9
93 REG_F10
94 REG_F11
95 REG_F12
96 REG_F13
97 REG_F14
98 REG_F15
99 REG_F16
100 REG_F17
101 REG_F18
102 REG_F19
103 REG_F20
104 REG_F21
105 REG_F22
106 REG_F23
107 REG_F24
108 REG_F25
109 REG_F26
110 REG_F27
111 REG_F28
112 REG_F29
113 REG_F30
114 REG_F31
115
116
117 REG_M0
118 REG_M1
119 REG_M2
120 REG_M3
121 REG_M4
122 REG_M5
123 REG_M6
124 REG_M7
125 REG_M8
126 REG_M9
127 REG_M10
128 REG_M11
129 REG_M12
130 REG_M13
131 REG_M14
132 REG_M15
133 REG_M16
134 REG_M17
135 REG_M18
136 REG_M19
137 REG_M20
138 REG_M21
139 REG_M22
140 REG_M23
141 REG_M24
142 REG_M25
143 REG_M26
144 REG_M27
145 REG_M28
146 REG_M29
147 REG_M30
148 REG_M31
149
150
151 REG_FCR0
152 REG_FCR1
153 REG_FCR2
154 REG_FCR3
155 REG_FCR4
156 REG_FCR5
157 REG_FCR6
158 REG_FCR7
159 REG_FCR8
160 REG_FCR9
161 REG_FCR10
162 REG_FCR11
163 REG_FCR12
164 REG_FCR13
165 REG_FCR14
166 REG_FCR15
167 REG_FCR16
168 REG_FCR17
169 REG_FCR18
170 REG_FCR19
171 REG_FCR20
172 REG_FCR21
173 REG_FCR22
174 REG_FCR23
175 REG_FCR24
176 REG_FCR25
177 REG_FCR26
178 REG_FCR27
179 REG_FCR28
180 REG_FCR29
181 REG_FCR30
182 REG_FCR31
183
184
185
186 REG_W0
187 REG_W1
188 REG_W2
189 REG_W3
190 REG_W4
191 REG_W5
192 REG_W6
193 REG_W7
194 REG_W8
195 REG_W9
196 REG_W10
197 REG_W11
198 REG_W12
199 REG_W13
200 REG_W14
201 REG_W15
202 REG_W16
203 REG_W17
204 REG_W18
205 REG_W19
206 REG_W20
207 REG_W21
208 REG_W22
209 REG_W23
210 REG_W24
211 REG_W25
212 REG_W26
213 REG_W27
214 REG_W28
215 REG_W29
216 REG_W30
217 REG_W31
218
219 REG_HI
220 REG_LO
221
222 REG_LAST = REG_LO
223
224 REG_SPECIAL = REG_M0
225
226 REGZERO = REG_R0
227 REGSP = REG_R29
228 REGSB = REG_R28
229 REGLINK = REG_R31
230 REGRET = REG_R1
231 REGARG = -1
232 REGRT1 = REG_R1
233 REGRT2 = REG_R2
234 REGCTXT = REG_R22
235 REGG = REG_R30
236 REGTMP = REG_R23
237 FREGRET = REG_F0
238 )
239
240
241
242
243 var MIPSDWARFRegisters = map[int16]int16{}
244
245 func init() {
246
247 f := func(from, to, base int16) {
248 for r := int16(from); r <= to; r++ {
249 MIPSDWARFRegisters[r] = (r - from) + base
250 }
251 }
252 f(REG_R0, REG_R31, 0)
253 f(REG_F0, REG_F31, 32)
254 MIPSDWARFRegisters[REG_HI] = 64
255 MIPSDWARFRegisters[REG_LO] = 65
256
257 f(REG_W0, REG_W31, 32)
258 }
259
260 const (
261 BIG = 32766
262 )
263
264 const (
265
266 FOLL = 1 << 0
267 LABEL = 1 << 1
268 LEAF = 1 << 2
269 SYNC = 1 << 3
270 BRANCH = 1 << 4
271 LOAD = 1 << 5
272 FCMP = 1 << 6
273 NOSCHED = 1 << 7
274
275 NSCHED = 20
276 )
277
278
279 const (
280 C_NONE = iota
281 C_REG
282 C_FREG
283 C_FCREG
284 C_MREG
285 C_WREG
286 C_HI
287 C_LO
288 C_ZCON
289 C_SCON
290 C_UCON
291 C_ADD0CON
292 C_AND0CON
293 C_ADDCON
294 C_ANDCON
295 C_LCON
296 C_DCON
297 C_SACON
298 C_SECON
299 C_LACON
300 C_LECON
301 C_DACON
302 C_STCON
303 C_SBRA
304 C_LBRA
305 C_SAUTO
306 C_LAUTO
307 C_SEXT
308 C_LEXT
309 C_ZOREG
310 C_SOREG
311 C_LOREG
312 C_GOK
313 C_ADDR
314 C_TLS
315 C_TEXTSIZE
316
317 C_NCLASS
318 )
319
320 const (
321 AABSD = obj.ABaseMIPS + obj.A_ARCHSPECIFIC + iota
322 AABSF
323 AABSW
324 AADD
325 AADDD
326 AADDF
327 AADDU
328 AADDW
329 AAND
330 ABEQ
331 ABFPF
332 ABFPT
333 ABGEZ
334 ABGEZAL
335 ABGTZ
336 ABLEZ
337 ABLTZ
338 ABLTZAL
339 ABNE
340 ABREAK
341 ACLO
342 ACLZ
343 ACMOVF
344 ACMOVN
345 ACMOVT
346 ACMOVZ
347 ACMPEQD
348 ACMPEQF
349 ACMPGED
350 ACMPGEF
351 ACMPGTD
352 ACMPGTF
353 ADIV
354 ADIVD
355 ADIVF
356 ADIVU
357 ADIVW
358 AGOK
359 ALL
360 ALLV
361 ALUI
362 AMADD
363 AMOVB
364 AMOVBU
365 AMOVD
366 AMOVDF
367 AMOVDW
368 AMOVF
369 AMOVFD
370 AMOVFW
371 AMOVH
372 AMOVHU
373 AMOVW
374 AMOVWD
375 AMOVWF
376 AMOVWL
377 AMOVWR
378 AMSUB
379 AMUL
380 AMULD
381 AMULF
382 AMULU
383 AMULW
384 ANEGD
385 ANEGF
386 ANEGW
387 ANEGV
388 ANOOP
389 ANOR
390 AOR
391 AREM
392 AREMU
393 ARFE
394 AROTR
395 AROTRV
396 ASC
397 ASCV
398 ASEB
399 ASEH
400 ASGT
401 ASGTU
402 ASLL
403 ASQRTD
404 ASQRTF
405 ASRA
406 ASRL
407 ASUB
408 ASUBD
409 ASUBF
410 ASUBU
411 ASUBW
412 ASYNC
413 ASYSCALL
414 ATEQ
415 ATLBP
416 ATLBR
417 ATLBWI
418 ATLBWR
419 ATNE
420 AWORD
421 AWSBH
422 AXOR
423
424
425 AMOVV
426 AMOVVL
427 AMOVVR
428 ASLLV
429 ASRAV
430 ASRLV
431 ADIVV
432 ADIVVU
433 AREMV
434 AREMVU
435 AMULV
436 AMULVU
437 AADDV
438 AADDVU
439 ASUBV
440 ASUBVU
441 ADSBH
442 ADSHD
443
444
445 ATRUNCFV
446 ATRUNCDV
447 ATRUNCFW
448 ATRUNCDW
449 AMOVWU
450 AMOVFV
451 AMOVDV
452 AMOVVF
453 AMOVVD
454
455
456 AVMOVB
457 AVMOVH
458 AVMOVW
459 AVMOVD
460
461 ALAST
462
463
464 AJMP = obj.AJMP
465 AJAL = obj.ACALL
466 ARET = obj.ARET
467 )
468
469 func init() {
470
471
472
473
474 if REG_R0%32 != 0 {
475 panic("REG_R0 is not a multiple of 32")
476 }
477 if REG_F0%32 != 0 {
478 panic("REG_F0 is not a multiple of 32")
479 }
480 if REG_M0%32 != 0 {
481 panic("REG_M0 is not a multiple of 32")
482 }
483 if REG_FCR0%32 != 0 {
484 panic("REG_FCR0 is not a multiple of 32")
485 }
486 if REG_W0%32 != 0 {
487 panic("REG_W0 is not a multiple of 32")
488 }
489 }
490
View as plain text