1
2
3
4
5 package loong64
6
7 import (
8 "cmd/internal/obj"
9 )
10
11
12
13 const (
14 NSNAME = 8
15 NSYM = 50
16 NREG = 32
17 NFREG = 32
18 NVREG = 32
19 NXREG = 32
20 )
21
22 const (
23 REG_R0 = obj.RBaseLOONG64 + iota
24 REG_R1
25 REG_R2
26 REG_R3
27 REG_R4
28 REG_R5
29 REG_R6
30 REG_R7
31 REG_R8
32 REG_R9
33 REG_R10
34 REG_R11
35 REG_R12
36 REG_R13
37 REG_R14
38 REG_R15
39 REG_R16
40 REG_R17
41 REG_R18
42 REG_R19
43 REG_R20
44 REG_R21
45 REG_R22
46 REG_R23
47 REG_R24
48 REG_R25
49 REG_R26
50 REG_R27
51 REG_R28
52 REG_R29
53 REG_R30
54 REG_R31
55
56 REG_F0
57 REG_F1
58 REG_F2
59 REG_F3
60 REG_F4
61 REG_F5
62 REG_F6
63 REG_F7
64 REG_F8
65 REG_F9
66 REG_F10
67 REG_F11
68 REG_F12
69 REG_F13
70 REG_F14
71 REG_F15
72 REG_F16
73 REG_F17
74 REG_F18
75 REG_F19
76 REG_F20
77 REG_F21
78 REG_F22
79 REG_F23
80 REG_F24
81 REG_F25
82 REG_F26
83 REG_F27
84 REG_F28
85 REG_F29
86 REG_F30
87 REG_F31
88
89 REG_FCSR0
90 REG_FCSR1
91 REG_FCSR2
92 REG_FCSR3
93 REG_FCSR4
94 REG_FCSR5
95 REG_FCSR6
96 REG_FCSR7
97 REG_FCSR8
98 REG_FCSR9
99 REG_FCSR10
100 REG_FCSR11
101 REG_FCSR12
102 REG_FCSR13
103 REG_FCSR14
104 REG_FCSR15
105 REG_FCSR16
106 REG_FCSR17
107 REG_FCSR18
108 REG_FCSR19
109 REG_FCSR20
110 REG_FCSR21
111 REG_FCSR22
112 REG_FCSR23
113 REG_FCSR24
114 REG_FCSR25
115 REG_FCSR26
116 REG_FCSR27
117 REG_FCSR28
118 REG_FCSR29
119 REG_FCSR30
120 REG_FCSR31
121
122 REG_FCC0
123 REG_FCC1
124 REG_FCC2
125 REG_FCC3
126 REG_FCC4
127 REG_FCC5
128 REG_FCC6
129 REG_FCC7
130 REG_FCC8
131 REG_FCC9
132 REG_FCC10
133 REG_FCC11
134 REG_FCC12
135 REG_FCC13
136 REG_FCC14
137 REG_FCC15
138 REG_FCC16
139 REG_FCC17
140 REG_FCC18
141 REG_FCC19
142 REG_FCC20
143 REG_FCC21
144 REG_FCC22
145 REG_FCC23
146 REG_FCC24
147 REG_FCC25
148 REG_FCC26
149 REG_FCC27
150 REG_FCC28
151 REG_FCC29
152 REG_FCC30
153 REG_FCC31
154
155
156 REG_V0
157 REG_V1
158 REG_V2
159 REG_V3
160 REG_V4
161 REG_V5
162 REG_V6
163 REG_V7
164 REG_V8
165 REG_V9
166 REG_V10
167 REG_V11
168 REG_V12
169 REG_V13
170 REG_V14
171 REG_V15
172 REG_V16
173 REG_V17
174 REG_V18
175 REG_V19
176 REG_V20
177 REG_V21
178 REG_V22
179 REG_V23
180 REG_V24
181 REG_V25
182 REG_V26
183 REG_V27
184 REG_V28
185 REG_V29
186 REG_V30
187 REG_V31
188
189
190 REG_X0
191 REG_X1
192 REG_X2
193 REG_X3
194 REG_X4
195 REG_X5
196 REG_X6
197 REG_X7
198 REG_X8
199 REG_X9
200 REG_X10
201 REG_X11
202 REG_X12
203 REG_X13
204 REG_X14
205 REG_X15
206 REG_X16
207 REG_X17
208 REG_X18
209 REG_X19
210 REG_X20
211 REG_X21
212 REG_X22
213 REG_X23
214 REG_X24
215 REG_X25
216 REG_X26
217 REG_X27
218 REG_X28
219 REG_X29
220 REG_X30
221 REG_X31
222
223 REG_SPECIAL = REG_FCSR0
224
225 REGZERO = REG_R0
226 REGLINK = REG_R1
227 REGSP = REG_R3
228 REGRET = REG_R20
229 REGARG = -1
230 REGRT1 = REG_R20
231 REGRT2 = REG_R21
232 REGCTXT = REG_R29
233 REGG = REG_R22
234 REGTMP = REG_R30
235 FREGRET = REG_F0
236 )
237
238 var LOONG64DWARFRegisters = map[int16]int16{}
239
240 func init() {
241
242 f := func(from, to, base int16) {
243 for r := int16(from); r <= to; r++ {
244 LOONG64DWARFRegisters[r] = (r - from) + base
245 }
246 }
247 f(REG_R0, REG_R31, 0)
248 f(REG_F0, REG_F31, 32)
249
250
251 f(REG_V0, REG_V31, 32)
252 f(REG_X0, REG_X31, 32)
253 }
254
255 const (
256 BIG = 2046
257 )
258
259 const (
260
261 LABEL = 1 << 0
262 LEAF = 1 << 1
263 SYNC = 1 << 2
264 BRANCH = 1 << 3
265 )
266
267
268 const (
269
270 ARNG_32B int16 = iota
271 ARNG_16H
272 ARNG_8W
273 ARNG_4V
274 ARNG_2Q
275 ARNG_16B
276 ARNG_8H
277 ARNG_4W
278 ARNG_2V
279 ARNG_B
280 ARNG_H
281 ARNG_W
282 ARNG_V
283 ARNG_BU
284 ARNG_HU
285 ARNG_WU
286 ARNG_VU
287 )
288
289
290 const (
291 LSX int16 = iota
292 LASX
293 )
294
295
296
297
298 const (
299 REG_ARNG = obj.RBaseLOONG64 + (1 << 10) + (iota << 11)
300 REG_ELEM
301 REG_ELEM_END
302 )
303
304 const (
305 EXT_REG_SHIFT = 0
306 EXT_REG_MASK = 0x1f
307
308 EXT_TYPE_SHIFT = 5
309 EXT_TYPE_MASK = 0x1f
310
311 EXT_SIMDTYPE_SHIFT = 10
312 EXT_SIMDTYPE_MASK = 0x1
313 )
314
315 const (
316 REG_LAST = REG_ELEM_END
317 )
318
319
320 const (
321 C_NONE = iota
322 C_REG
323 C_FREG
324 C_FCSRREG
325 C_FCCREG
326 C_VREG
327 C_XREG
328 C_ARNG
329 C_ELEM
330 C_ZCON
331 C_SCON
332 C_UCON
333 C_ADD0CON
334 C_AND0CON
335 C_ADDCON
336 C_ANDCON
337 C_LCON
338 C_DCON
339 C_SACON
340 C_LACON
341 C_DACON
342 C_EXTADDR
343 C_BRAN
344 C_SAUTO
345 C_LAUTO
346 C_ZOREG
347 C_SOREG
348 C_LOREG
349 C_ROFF
350 C_ADDR
351 C_TLS_LE
352 C_TLS_IE
353 C_GOTADDR
354 C_TEXTSIZE
355
356 C_GOK
357 C_NCLASS
358 )
359
360 const (
361 AABSD = obj.ABaseLoong64 + obj.A_ARCHSPECIFIC + iota
362 AABSF
363 AADD
364 AADDD
365 AADDF
366 AADDU
367
368 AADDW
369 AAND
370 ABEQ
371 ABGEZ
372 ABLEZ
373 ABGTZ
374 ABLTZ
375 ABFPF
376 ABFPT
377
378 ABNE
379 ABREAK
380
381 ACMPEQD
382 ACMPEQF
383
384 ACMPGED
385 ACMPGEF
386 ACMPGTD
387 ACMPGTF
388
389 ALU12IW
390 ALU32ID
391 ALU52ID
392 APCALAU12I
393 APCADDU12I
394 AJIRL
395 ABGE
396 ABLT
397 ABLTU
398 ABGEU
399
400 ADIV
401 ADIVD
402 ADIVF
403 ADIVU
404 ADIVW
405
406 ALL
407 ALLV
408
409 ALUI
410
411 AMOVB
412 AMOVBU
413
414 AMOVD
415 AMOVDF
416 AMOVDW
417 AMOVF
418 AMOVFD
419 AMOVFW
420
421 AMOVH
422 AMOVHU
423 AMOVW
424
425 AMOVWD
426 AMOVWF
427
428 AMUL
429 AMULD
430 AMULF
431 AMULU
432 AMULH
433 AMULHU
434 AMULW
435 ANEGD
436 ANEGF
437
438 ANEGW
439 ANEGV
440
441 ANOOP
442 ANOR
443 AOR
444 AREM
445 AREMU
446
447 ARFE
448
449 ASC
450 ASCV
451
452 ASGT
453 ASGTU
454
455 ASLL
456 ASQRTD
457 ASQRTF
458 ASRA
459 ASRL
460 AROTR
461 ASUB
462 ASUBD
463 ASUBF
464
465 ASUBU
466 ASUBW
467 ADBAR
468 ASYSCALL
469
470 ATEQ
471 ATNE
472
473 AWORD
474
475 AXOR
476
477 AMASKEQZ
478 AMASKNEZ
479
480
481 AMOVV
482
483 ASLLV
484 ASRAV
485 ASRLV
486 AROTRV
487 ADIVV
488 ADIVVU
489
490 AREMV
491 AREMVU
492
493 AMULV
494 AMULVU
495 AMULHV
496 AMULHVU
497 AADDV
498 AADDVU
499 ASUBV
500 ASUBVU
501
502
503 ATRUNCFV
504 ATRUNCDV
505 ATRUNCFW
506 ATRUNCDW
507
508 AMOVWU
509 AMOVFV
510 AMOVDV
511 AMOVVF
512 AMOVVD
513
514
515 AORN
516 AANDN
517
518
519 AAMSWAPB
520 AAMSWAPH
521 AAMSWAPW
522 AAMSWAPV
523 AAMCASB
524 AAMCASH
525 AAMCASW
526 AAMCASV
527 AAMADDW
528 AAMADDV
529 AAMANDW
530 AAMANDV
531 AAMORW
532 AAMORV
533 AAMXORW
534 AAMXORV
535 AAMMAXW
536 AAMMAXV
537 AAMMINW
538 AAMMINV
539 AAMMAXWU
540 AAMMAXVU
541 AAMMINWU
542 AAMMINVU
543 AAMSWAPDBB
544 AAMSWAPDBH
545 AAMSWAPDBW
546 AAMSWAPDBV
547 AAMCASDBB
548 AAMCASDBH
549 AAMCASDBW
550 AAMCASDBV
551 AAMADDDBW
552 AAMADDDBV
553 AAMANDDBW
554 AAMANDDBV
555 AAMORDBW
556 AAMORDBV
557 AAMXORDBW
558 AAMXORDBV
559 AAMMAXDBW
560 AAMMAXDBV
561 AAMMINDBW
562 AAMMINDBV
563 AAMMAXDBWU
564 AAMMAXDBVU
565 AAMMINDBWU
566 AAMMINDBVU
567
568
569 AEXTWB
570 AEXTWH
571
572
573 ACLOW
574 ACLOV
575 ACLZW
576 ACLZV
577 ACTOW
578 ACTOV
579 ACTZW
580 ACTZV
581
582
583 AREVBV
584 AREVB2W
585 AREVB4H
586 AREVB2H
587
588
589 AREVH2W
590 AREVHV
591
592
593 ABITREV4B
594 ABITREV8B
595
596
597 ABITREVW
598 ABITREVV
599
600
601 ABSTRINSW
602 ABSTRINSV
603
604
605 ABSTRPICKW
606 ABSTRPICKV
607
608
609 ACRCWBW
610 ACRCWHW
611 ACRCWWW
612 ACRCWVW
613 ACRCCWBW
614 ACRCCWHW
615 ACRCCWWW
616 ACRCCWVW
617
618
619 ARDTIMELW
620 ARDTIMEHW
621 ARDTIMED
622 ACPUCFG
623
624
625 AFMADDF
626 AFMADDD
627 AFMSUBF
628 AFMSUBD
629 AFNMADDF
630 AFNMADDD
631 AFNMSUBF
632 AFNMSUBD
633
634
635 AFMINF
636 AFMIND
637 AFMAXF
638 AFMAXD
639
640
641 AFCOPYSGF
642 AFCOPYSGD
643 AFSCALEBF
644 AFSCALEBD
645 AFLOGBF
646 AFLOGBD
647
648
649 AFCLASSF
650 AFCLASSD
651
652
653 AFFINTFW
654 AFFINTFV
655 AFFINTDW
656 AFFINTDV
657 AFTINTWF
658 AFTINTWD
659 AFTINTVF
660 AFTINTVD
661
662
663 AFTINTRPWF
664 AFTINTRPWD
665 AFTINTRPVF
666 AFTINTRPVD
667 AFTINTRMWF
668 AFTINTRMWD
669 AFTINTRMVF
670 AFTINTRMVD
671 AFTINTRZWF
672 AFTINTRZWD
673 AFTINTRZVF
674 AFTINTRZVD
675 AFTINTRNEWF
676 AFTINTRNEWD
677 AFTINTRNEVF
678 AFTINTRNEVD
679
680
681 AVMOVQ
682 AXVMOVQ
683
684
685 AVPCNTB
686 AVPCNTH
687 AVPCNTW
688 AVPCNTV
689 AXVPCNTB
690 AXVPCNTH
691 AXVPCNTW
692 AXVPCNTV
693
694
695 AVSEQB
696 AXVSEQB
697 AVSEQH
698 AXVSEQH
699 AVSEQW
700 AXVSEQW
701 AVSEQV
702 AXVSEQV
703
704 ALAST
705
706
707 AJMP = obj.AJMP
708 AJAL = obj.ACALL
709 ARET = obj.ARET
710 )
711
712 func init() {
713
714
715
716
717 if REG_R0%32 != 0 {
718 panic("REG_R0 is not a multiple of 32")
719 }
720 if REG_F0%32 != 0 {
721 panic("REG_F0 is not a multiple of 32")
722 }
723 if REG_FCSR0%32 != 0 {
724 panic("REG_FCSR0 is not a multiple of 32")
725 }
726 if REG_FCC0%32 != 0 {
727 panic("REG_FCC0 is not a multiple of 32")
728 }
729 if REG_V0%32 != 0 {
730 panic("REG_V0 is not a multiple of 32")
731 }
732 if REG_X0%32 != 0 {
733 panic("REG_X0 is not a multiple of 32")
734 }
735 }
736
View as plain text