2 * Tiny Code Generator for QEMU
4 * Copyright (c) 2008 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 #define TCG_CT_CONST_U32 0x100
27 static uint8_t *tb_ret_addr
;
31 #if TARGET_PHYS_ADDR_BITS == 32
37 #if TARGET_LONG_BITS == 32
46 static const char * const tcg_target_reg_names
[TCG_TARGET_NB_REGS
] = {
82 static const int tcg_target_reg_alloc_order
[] = {
117 static const int tcg_target_call_iarg_regs
[] = {
128 static const int tcg_target_call_oarg_regs
[2] = {
132 static const int tcg_target_callee_save_regs
[] = {
149 static uint32_t reloc_pc24_val (void *pc
, tcg_target_long target
)
151 tcg_target_long disp
;
153 disp
= target
- (tcg_target_long
) pc
;
154 if ((disp
<< 38) >> 38 != disp
)
157 return disp
& 0x3fffffc;
160 static void reloc_pc24 (void *pc
, tcg_target_long target
)
162 *(uint32_t *) pc
= (*(uint32_t *) pc
& ~0x3fffffc)
163 | reloc_pc24_val (pc
, target
);
166 static uint16_t reloc_pc14_val (void *pc
, tcg_target_long target
)
168 tcg_target_long disp
;
170 disp
= target
- (tcg_target_long
) pc
;
171 if (disp
!= (int16_t) disp
)
174 return disp
& 0xfffc;
177 static void reloc_pc14 (void *pc
, tcg_target_long target
)
179 *(uint32_t *) pc
= (*(uint32_t *) pc
& ~0xfffc)
180 | reloc_pc14_val (pc
, target
);
183 static void patch_reloc (uint8_t *code_ptr
, int type
,
184 tcg_target_long value
, tcg_target_long addend
)
189 reloc_pc14 (code_ptr
, value
);
192 reloc_pc24 (code_ptr
, value
);
199 /* maximum number of register used for input function arguments */
200 static int tcg_target_get_call_iarg_regs_count (int flags
)
202 return sizeof (tcg_target_call_iarg_regs
) / sizeof (tcg_target_call_iarg_regs
[0]);
205 /* parse target specific constraints */
206 static int target_parse_constraint (TCGArgConstraint
*ct
, const char **pct_str
)
212 case 'A': case 'B': case 'C': case 'D':
213 ct
->ct
|= TCG_CT_REG
;
214 tcg_regset_set_reg (ct
->u
.regs
, 3 + ct_str
[0] - 'A');
217 ct
->ct
|= TCG_CT_REG
;
218 tcg_regset_set32 (ct
->u
.regs
, 0, 0xffffffff);
220 case 'L': /* qemu_ld constraint */
221 ct
->ct
|= TCG_CT_REG
;
222 tcg_regset_set32 (ct
->u
.regs
, 0, 0xffffffff);
223 tcg_regset_reset_reg (ct
->u
.regs
, TCG_REG_R3
);
224 #ifdef CONFIG_SOFTMMU
225 tcg_regset_reset_reg (ct
->u
.regs
, TCG_REG_R4
);
228 case 'S': /* qemu_st constraint */
229 ct
->ct
|= TCG_CT_REG
;
230 tcg_regset_set32 (ct
->u
.regs
, 0, 0xffffffff);
231 tcg_regset_reset_reg (ct
->u
.regs
, TCG_REG_R3
);
232 #ifdef CONFIG_SOFTMMU
233 tcg_regset_reset_reg (ct
->u
.regs
, TCG_REG_R4
);
234 tcg_regset_reset_reg (ct
->u
.regs
, TCG_REG_R5
);
238 ct
->ct
|= TCG_CT_CONST_U32
;
248 /* test if a constant matches the constraint */
249 static int tcg_target_const_match (tcg_target_long val
,
250 const TCGArgConstraint
*arg_ct
)
255 if (ct
& TCG_CT_CONST
)
257 else if ((ct
& TCG_CT_CONST_U32
) && (val
== (uint32_t) val
))
262 #define OPCD(opc) ((opc)<<26)
263 #define XO19(opc) (OPCD(19)|((opc)<<1))
264 #define XO30(opc) (OPCD(30)|((opc)<<2))
265 #define XO31(opc) (OPCD(31)|((opc)<<1))
266 #define XO58(opc) (OPCD(58)|(opc))
267 #define XO62(opc) (OPCD(62)|(opc))
271 #define LBZ OPCD( 34)
272 #define LHZ OPCD( 40)
273 #define LHA OPCD( 42)
274 #define LWZ OPCD( 32)
275 #define STB OPCD( 38)
276 #define STH OPCD( 44)
277 #define STW OPCD( 36)
280 #define STDU XO62( 1)
281 #define STDX XO31(149)
284 #define LDX XO31( 21)
287 #define LWAX XO31(341)
289 #define ADDI OPCD( 14)
290 #define ADDIS OPCD( 15)
291 #define ORI OPCD( 24)
292 #define ORIS OPCD( 25)
293 #define XORI OPCD( 26)
294 #define XORIS OPCD( 27)
295 #define ANDI OPCD( 28)
296 #define ANDIS OPCD( 29)
297 #define MULLI OPCD( 7)
298 #define CMPLI OPCD( 10)
299 #define CMPI OPCD( 11)
301 #define LWZU OPCD( 33)
302 #define STWU OPCD( 37)
304 #define RLWINM OPCD( 21)
306 #define RLDICL XO30( 0)
307 #define RLDICR XO30( 1)
308 #define RLDIMI XO30( 3)
310 #define BCLR XO19( 16)
311 #define BCCTR XO19(528)
312 #define CRAND XO19(257)
313 #define CRANDC XO19(129)
314 #define CRNAND XO19(225)
315 #define CROR XO19(449)
317 #define EXTSB XO31(954)
318 #define EXTSH XO31(922)
319 #define EXTSW XO31(986)
320 #define ADD XO31(266)
321 #define ADDE XO31(138)
322 #define ADDC XO31( 10)
323 #define AND XO31( 28)
324 #define SUBF XO31( 40)
325 #define SUBFC XO31( 8)
326 #define SUBFE XO31(136)
328 #define XOR XO31(316)
329 #define MULLW XO31(235)
330 #define MULHWU XO31( 11)
331 #define DIVW XO31(491)
332 #define DIVWU XO31(459)
334 #define CMPL XO31( 32)
335 #define LHBRX XO31(790)
336 #define LWBRX XO31(534)
337 #define STHBRX XO31(918)
338 #define STWBRX XO31(662)
339 #define MFSPR XO31(339)
340 #define MTSPR XO31(467)
341 #define SRAWI XO31(824)
342 #define NEG XO31(104)
344 #define MULLD XO31(233)
345 #define MULHD XO31( 73)
346 #define MULHDU XO31( 9)
347 #define DIVD XO31(489)
348 #define DIVDU XO31(457)
350 #define LBZX XO31( 87)
351 #define LHZX XO31(276)
352 #define LHAX XO31(343)
353 #define LWZX XO31( 23)
354 #define STBX XO31(215)
355 #define STHX XO31(407)
356 #define STWX XO31(151)
358 #define SPR(a,b) ((((a)<<5)|(b))<<11)
360 #define CTR SPR(9, 0)
362 #define SLW XO31( 24)
363 #define SRW XO31(536)
364 #define SRAW XO31(792)
366 #define SLD XO31( 27)
367 #define SRD XO31(539)
368 #define SRAD XO31(794)
369 #define SRADI XO31(413<<1)
371 #define LMW OPCD( 46)
372 #define STMW OPCD( 47)
375 #define TRAP (TW | TO (31))
377 #define RT(r) ((r)<<21)
378 #define RS(r) ((r)<<21)
379 #define RA(r) ((r)<<16)
380 #define RB(r) ((r)<<11)
381 #define TO(t) ((t)<<21)
382 #define SH(s) ((s)<<11)
383 #define MB(b) ((b)<<6)
384 #define ME(e) ((e)<<1)
385 #define BO(o) ((o)<<21)
386 #define MB64(b) ((b)<<5)
390 #define TAB(t,a,b) (RT(t) | RA(a) | RB(b))
391 #define SAB(s,a,b) (RS(s) | RA(a) | RB(b))
393 #define BF(n) ((n)<<23)
394 #define BI(n, c) (((c)+((n)*4))<<16)
395 #define BT(n, c) (((c)+((n)*4))<<21)
396 #define BA(n, c) (((c)+((n)*4))<<16)
397 #define BB(n, c) (((c)+((n)*4))<<11)
399 #define BO_COND_TRUE BO (12)
400 #define BO_COND_FALSE BO ( 4)
401 #define BO_ALWAYS BO (20)
410 static const uint32_t tcg_to_bc
[10] = {
411 [TCG_COND_EQ
] = BC
| BI (7, CR_EQ
) | BO_COND_TRUE
,
412 [TCG_COND_NE
] = BC
| BI (7, CR_EQ
) | BO_COND_FALSE
,
413 [TCG_COND_LT
] = BC
| BI (7, CR_LT
) | BO_COND_TRUE
,
414 [TCG_COND_GE
] = BC
| BI (7, CR_LT
) | BO_COND_FALSE
,
415 [TCG_COND_LE
] = BC
| BI (7, CR_GT
) | BO_COND_FALSE
,
416 [TCG_COND_GT
] = BC
| BI (7, CR_GT
) | BO_COND_TRUE
,
417 [TCG_COND_LTU
] = BC
| BI (7, CR_LT
) | BO_COND_TRUE
,
418 [TCG_COND_GEU
] = BC
| BI (7, CR_LT
) | BO_COND_FALSE
,
419 [TCG_COND_LEU
] = BC
| BI (7, CR_GT
) | BO_COND_FALSE
,
420 [TCG_COND_GTU
] = BC
| BI (7, CR_GT
) | BO_COND_TRUE
,
423 static void tcg_out_mov (TCGContext
*s
, int ret
, int arg
)
425 tcg_out32 (s
, OR
| SAB (arg
, ret
, arg
));
428 static void tcg_out_rld (TCGContext
*s
, int op
, int ra
, int rs
, int sh
, int mb
)
430 sh
= SH (sh
& 0x1f) | (((sh
>> 5) & 1) << 1);
431 mb
= MB64 ((mb
>> 5) | ((mb
<< 1) & 0x3f));
432 tcg_out32 (s
, op
| RA (ra
) | RS (rs
) | sh
| mb
);
435 static void tcg_out_movi32 (TCGContext
*s
, int ret
, int32_t arg
)
437 if (arg
== (int16_t) arg
)
438 tcg_out32 (s
, ADDI
| RT (ret
) | RA (0) | (arg
& 0xffff));
440 tcg_out32 (s
, ADDIS
| RT (ret
) | RA (0) | ((arg
>> 16) & 0xffff));
442 tcg_out32 (s
, ORI
| RS (ret
) | RA (ret
) | (arg
& 0xffff));
446 static void tcg_out_movi (TCGContext
*s
, TCGType type
,
447 int ret
, tcg_target_long arg
)
451 if (type
== TCG_TYPE_I32
|| arg
== arg32
) {
452 tcg_out_movi32 (s
, ret
, arg32
);
455 if ((uint64_t) arg
>> 32) {
456 uint16_t h16
= arg
>> 16;
459 tcg_out_movi32 (s
, ret
, arg
>> 32);
460 tcg_out_rld (s
, RLDICR
, ret
, ret
, 32, 31);
461 if (h16
) tcg_out32 (s
, ORIS
| RS (ret
) | RA (ret
) | h16
);
462 if (l16
) tcg_out32 (s
, ORI
| RS (ret
) | RA (ret
) | l16
);
465 tcg_out_movi32 (s
, ret
, arg32
);
467 tcg_out_rld (s
, RLDICL
, ret
, ret
, 0, 32);
472 static void tcg_out_call (TCGContext
*s
, tcg_target_long arg
, int const_arg
)
478 tcg_out_movi (s
, TCG_TYPE_I64
, reg
, arg
);
482 tcg_out32 (s
, LD
| RT (0) | RA (reg
));
483 tcg_out32 (s
, MTSPR
| RA (0) | CTR
);
484 tcg_out32 (s
, LD
| RT (11) | RA (reg
) | 16);
485 tcg_out32 (s
, LD
| RT (2) | RA (reg
) | 8);
486 tcg_out32 (s
, BCCTR
| BO_ALWAYS
| LK
);
489 static void tcg_out_ldst (TCGContext
*s
, int ret
, int addr
,
490 int offset
, int op1
, int op2
)
492 if (offset
== (int16_t) offset
)
493 tcg_out32 (s
, op1
| RT (ret
) | RA (addr
) | (offset
& 0xffff));
495 tcg_out_movi (s
, TCG_TYPE_I64
, 0, offset
);
496 tcg_out32 (s
, op2
| RT (ret
) | RA (addr
) | RB (0));
500 static void tcg_out_b (TCGContext
*s
, int mask
, tcg_target_long target
)
502 tcg_target_long disp
;
504 disp
= target
- (tcg_target_long
) s
->code_ptr
;
505 if ((disp
<< 38) >> 38 == disp
)
506 tcg_out32 (s
, B
| (disp
& 0x3fffffc) | mask
);
508 tcg_out_movi (s
, TCG_TYPE_I64
, 0, (tcg_target_long
) target
);
509 tcg_out32 (s
, MTSPR
| RS (0) | CTR
);
510 tcg_out32 (s
, BCCTR
| BO_ALWAYS
| mask
);
514 #if defined (CONFIG_SOFTMMU)
516 #include "../../softmmu_defs.h"
518 static void *qemu_ld_helpers
[4] = {
525 static void *qemu_st_helpers
[4] = {
532 static void tcg_out_tlb_read (TCGContext
*s
, int r0
, int r1
, int r2
,
533 int addr_reg
, int s_bits
, int offset
)
535 #if TARGET_LONG_BITS == 32
536 tcg_out_rld (s
, RLDICL
, addr_reg
, addr_reg
, 0, 32);
538 tcg_out32 (s
, (RLWINM
541 | SH (32 - (TARGET_PAGE_BITS
- CPU_TLB_ENTRY_BITS
))
542 | MB (32 - (CPU_TLB_BITS
+ CPU_TLB_ENTRY_BITS
))
543 | ME (31 - CPU_TLB_ENTRY_BITS
)
546 tcg_out32 (s
, ADD
| RT (r0
) | RA (r0
) | RB (TCG_AREG0
));
547 tcg_out32 (s
, (LWZU
| RT (r1
) | RA (r0
) | offset
));
548 tcg_out32 (s
, (RLWINM
552 | MB ((32 - s_bits
) & 31)
553 | ME (31 - TARGET_PAGE_BITS
)
557 tcg_out_rld (s
, RLDICL
, r0
, addr_reg
,
558 64 - TARGET_PAGE_BITS
,
560 tcg_out_rld (s
, RLDICR
, r0
, r0
,
562 63 - CPU_TLB_ENTRY_BITS
);
564 tcg_out32 (s
, ADD
| TAB (r0
, r0
, TCG_AREG0
));
565 tcg_out32 (s
, LD_ADDR
| RT (r1
) | RA (r0
) | offset
);
568 tcg_out_rld (s
, RLDICR
, r2
, addr_reg
, 0, 63 - TARGET_PAGE_BITS
);
571 tcg_out_rld (s
, RLDICL
, r2
, addr_reg
,
572 64 - TARGET_PAGE_BITS
,
573 TARGET_PAGE_BITS
- s_bits
);
574 tcg_out_rld (s
, RLDICL
, r2
, r2
, TARGET_PAGE_BITS
, 0);
580 static void tcg_out_qemu_ld (TCGContext
*s
, const TCGArg
*args
, int opc
)
582 int addr_reg
, data_reg
, r0
, r1
, mem_index
, s_bits
, bswap
;
583 #ifdef CONFIG_SOFTMMU
585 void *label1_ptr
, *label2_ptr
;
593 #ifdef CONFIG_SOFTMMU
598 tcg_out_tlb_read (s
, r0
, r1
, r2
, addr_reg
, s_bits
,
599 offsetof (CPUState
, tlb_table
[mem_index
][0].addr_read
));
601 tcg_out32 (s
, CMP
| BF (7) | RA (r2
) | RB (r1
) | CMP_L
);
603 label1_ptr
= s
->code_ptr
;
605 tcg_out32 (s
, BC
| BI (7, CR_EQ
) | BO_COND_TRUE
);
609 tcg_out_mov (s
, 3, addr_reg
);
610 tcg_out_movi (s
, TCG_TYPE_I64
, 4, mem_index
);
612 tcg_out_call (s
, (tcg_target_long
) qemu_ld_helpers
[s_bits
], 1);
616 tcg_out32 (s
, EXTSB
| RA (data_reg
) | RS (3));
619 tcg_out32 (s
, EXTSH
| RA (data_reg
) | RS (3));
622 tcg_out32 (s
, EXTSW
| RA (data_reg
) | RS (3));
629 tcg_out_mov (s
, data_reg
, 3);
632 label2_ptr
= s
->code_ptr
;
635 /* label1: fast path */
637 reloc_pc14 (label1_ptr
, (tcg_target_long
) s
->code_ptr
);
640 /* r0 now contains &env->tlb_table[mem_index][index].addr_read */
641 tcg_out32 (s
, (LD_ADDEND
644 | (offsetof (CPUTLBEntry
, addend
)
645 - offsetof (CPUTLBEntry
, addr_read
))
647 /* r0 = env->tlb_table[mem_index][index].addend */
648 tcg_out32 (s
, ADD
| RT (r0
) | RA (r0
) | RB (addr_reg
));
649 /* r0 = env->tlb_table[mem_index][index].addend + addr */
651 #else /* !CONFIG_SOFTMMU */
652 #if TARGET_LONG_BITS == 32
653 tcg_out_rld (s
, RLDICL
, addr_reg
, addr_reg
, 0, 32);
659 #ifdef TARGET_WORDS_BIGENDIAN
667 tcg_out32 (s
, LBZ
| RT (data_reg
) | RA (r0
));
670 tcg_out32 (s
, LBZ
| RT (data_reg
) | RA (r0
));
671 tcg_out32 (s
, EXTSB
| RA (data_reg
) | RS (data_reg
));
674 if (bswap
) tcg_out32 (s
, LHBRX
| RT (data_reg
) | RB (r0
));
675 else tcg_out32 (s
, LHZ
| RT (data_reg
) | RA (r0
));
679 tcg_out32 (s
, LHBRX
| RT (data_reg
) | RB (r0
));
680 tcg_out32 (s
, EXTSH
| RA (data_reg
) | RS (data_reg
));
682 else tcg_out32 (s
, LHA
| RT (data_reg
) | RA (r0
));
685 if (bswap
) tcg_out32 (s
, LWBRX
| RT (data_reg
) | RB (r0
));
686 else tcg_out32 (s
, LWZ
| RT (data_reg
)| RA (r0
));
690 tcg_out32 (s
, LWBRX
| RT (data_reg
) | RB (r0
));
691 tcg_out32 (s
, EXTSW
| RA (data_reg
) | RS (data_reg
));
693 else tcg_out32 (s
, LWA
| RT (data_reg
)| RA (r0
));
697 tcg_out_movi32 (s
, 0, 4);
698 tcg_out32 (s
, LWBRX
| RT (data_reg
) | RB (r0
));
699 tcg_out32 (s
, LWBRX
| RT ( r1
) | RA (r0
));
700 tcg_out_rld (s
, RLDIMI
, data_reg
, r1
, 32, 0);
702 else tcg_out32 (s
, LD
| RT (data_reg
) | RA (r0
));
706 #ifdef CONFIG_SOFTMMU
707 reloc_pc24 (label2_ptr
, (tcg_target_long
) s
->code_ptr
);
711 static void tcg_out_qemu_st (TCGContext
*s
, const TCGArg
*args
, int opc
)
713 int addr_reg
, r0
, r1
, data_reg
, mem_index
, bswap
;
714 #ifdef CONFIG_SOFTMMU
716 void *label1_ptr
, *label2_ptr
;
723 #ifdef CONFIG_SOFTMMU
728 tcg_out_tlb_read (s
, r0
, r1
, r2
, addr_reg
, opc
,
729 offsetof (CPUState
, tlb_table
[mem_index
][0].addr_write
));
731 tcg_out32 (s
, CMP
| BF (7) | RA (r2
) | RB (r1
) | CMP_L
);
733 label1_ptr
= s
->code_ptr
;
735 tcg_out32 (s
, BC
| BI (7, CR_EQ
) | BO_COND_TRUE
);
739 tcg_out_mov (s
, 3, addr_reg
);
740 tcg_out_rld (s
, RLDICL
, 4, data_reg
, 0, 64 - (1 << (3 + opc
)));
741 tcg_out_movi (s
, TCG_TYPE_I64
, 5, mem_index
);
743 tcg_out_call (s
, (tcg_target_long
) qemu_st_helpers
[opc
], 1);
745 label2_ptr
= s
->code_ptr
;
748 /* label1: fast path */
750 reloc_pc14 (label1_ptr
, (tcg_target_long
) s
->code_ptr
);
753 tcg_out32 (s
, (LD_ADDEND
756 | (offsetof (CPUTLBEntry
, addend
)
757 - offsetof (CPUTLBEntry
, addr_write
))
759 /* r0 = env->tlb_table[mem_index][index].addend */
760 tcg_out32 (s
, ADD
| RT (r0
) | RA (r0
) | RB (addr_reg
));
761 /* r0 = env->tlb_table[mem_index][index].addend + addr */
763 #else /* !CONFIG_SOFTMMU */
764 #if TARGET_LONG_BITS == 32
765 tcg_out_rld (s
, RLDICL
, addr_reg
, addr_reg
, 0, 32);
771 #ifdef TARGET_WORDS_BIGENDIAN
778 tcg_out32 (s
, STB
| RS (data_reg
) | RA (r0
));
781 if (bswap
) tcg_out32 (s
, STHBRX
| RS (data_reg
) | RA (0) | RB (r0
));
782 else tcg_out32 (s
, STH
| RS (data_reg
) | RA (r0
));
785 if (bswap
) tcg_out32 (s
, STWBRX
| RS (data_reg
) | RA (0) | RB (r0
));
786 else tcg_out32 (s
, STW
| RS (data_reg
) | RA (r0
));
790 tcg_out32 (s
, STWBRX
| RS (data_reg
) | RA (0) | RB (r0
));
791 tcg_out32 (s
, ADDI
| RT (r1
) | RA (r0
) | 4);
792 tcg_out_rld (s
, RLDICL
, 0, data_reg
, 32, 0);
793 tcg_out32 (s
, STWBRX
| RS (0) | RA (0) | RB (r1
));
795 else tcg_out32 (s
, STD
| RS (data_reg
) | RA (r0
));
799 #ifdef CONFIG_SOFTMMU
800 reloc_pc24 (label2_ptr
, (tcg_target_long
) s
->code_ptr
);
804 void tcg_target_qemu_prologue (TCGContext
*s
)
813 + 8 /* compiler doubleword */
814 + 8 /* link editor doubleword */
815 + 8 /* TOC save area */
816 + TCG_STATIC_CALL_ARGS_SIZE
817 + ARRAY_SIZE (tcg_target_callee_save_regs
) * 8
819 frame_size
= (frame_size
+ 15) & ~15;
821 /* First emit adhoc function descriptor */
822 addr
= (uint64_t) s
->code_ptr
+ 24;
823 tcg_out32 (s
, addr
>> 32); tcg_out32 (s
, addr
); /* entry point */
824 s
->code_ptr
+= 16; /* skip TOC and environment pointer */
827 tcg_out32 (s
, MFSPR
| RT (0) | LR
);
828 tcg_out32 (s
, STDU
| RS (1) | RA (1) | (-frame_size
& 0xffff));
829 for (i
= 0; i
< ARRAY_SIZE (tcg_target_callee_save_regs
); ++i
)
831 | RS (tcg_target_callee_save_regs
[i
])
833 | (i
* 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE
)
836 tcg_out32 (s
, STD
| RS (0) | RA (1) | (frame_size
+ 16));
838 tcg_out32 (s
, MTSPR
| RS (3) | CTR
);
839 tcg_out32 (s
, BCCTR
| BO_ALWAYS
);
842 tb_ret_addr
= s
->code_ptr
;
844 for (i
= 0; i
< ARRAY_SIZE (tcg_target_callee_save_regs
); ++i
)
846 | RT (tcg_target_callee_save_regs
[i
])
848 | (i
* 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE
)
851 tcg_out32 (s
, LD
| RT (0) | RA (1) | (frame_size
+ 16));
852 tcg_out32 (s
, MTSPR
| RS (0) | LR
);
853 tcg_out32 (s
, ADDI
| RT (1) | RA (1) | frame_size
);
854 tcg_out32 (s
, BCLR
| BO_ALWAYS
);
857 static void tcg_out_ld (TCGContext
*s
, TCGType type
, int ret
, int arg1
,
858 tcg_target_long arg2
)
860 if (type
== TCG_TYPE_I32
)
861 tcg_out_ldst (s
, ret
, arg1
, arg2
, LWZ
, LWZX
);
863 tcg_out_ldst (s
, ret
, arg1
, arg2
, LD
, LDX
);
866 static void tcg_out_st (TCGContext
*s
, TCGType type
, int arg
, int arg1
,
867 tcg_target_long arg2
)
869 if (type
== TCG_TYPE_I32
)
870 tcg_out_ldst (s
, arg
, arg1
, arg2
, STW
, STWX
);
872 tcg_out_ldst (s
, arg
, arg1
, arg2
, STD
, STDX
);
875 static void ppc_addi32 (TCGContext
*s
, int rt
, int ra
, tcg_target_long si
)
880 if (si
== (int16_t) si
)
881 tcg_out32 (s
, ADDI
| RT (rt
) | RA (ra
) | (si
& 0xffff));
883 uint16_t h
= ((si
>> 16) & 0xffff) + ((uint16_t) si
>> 15);
884 tcg_out32 (s
, ADDIS
| RT (rt
) | RA (ra
) | h
);
885 tcg_out32 (s
, ADDI
| RT (rt
) | RA (rt
) | (si
& 0xffff));
889 static void ppc_addi64 (TCGContext
*s
, int rt
, int ra
, tcg_target_long si
)
891 /* XXX: suboptimal */
892 if (si
== (int16_t) si
893 || (((uint64_t) si
>> 31) == 0) && (si
& 0x8000) == 0)
894 ppc_addi32 (s
, rt
, ra
, si
);
896 tcg_out_movi (s
, TCG_TYPE_I64
, 0, si
);
897 tcg_out32 (s
, ADD
| RT (rt
) | RA (ra
));
901 static void tcg_out_addi (TCGContext
*s
, int reg
, tcg_target_long val
)
903 ppc_addi64 (s
, reg
, reg
, val
);
906 static void tcg_out_cmp (TCGContext
*s
, int cond
, TCGArg arg1
, TCGArg arg2
,
907 int const_arg2
, int cr
, int arch64
)
916 if ((int16_t) arg2
== arg2
) {
921 else if ((uint16_t) arg2
== arg2
) {
936 if ((int16_t) arg2
== arg2
) {
951 if ((uint16_t) arg2
== arg2
) {
964 op
|= BF (cr
) | (arch64
<< 21);
967 tcg_out32 (s
, op
| RA (arg1
) | (arg2
& 0xffff));
970 tcg_out_movi (s
, TCG_TYPE_I64
, 0, arg2
);
971 tcg_out32 (s
, op
| RA (arg1
) | RB (0));
974 tcg_out32 (s
, op
| RA (arg1
) | RB (arg2
));
979 static void tcg_out_bc (TCGContext
*s
, int bc
, int label_index
)
981 TCGLabel
*l
= &s
->labels
[label_index
];
984 tcg_out32 (s
, bc
| reloc_pc14_val (s
->code_ptr
, l
->u
.value
));
986 uint16_t val
= *(uint16_t *) &s
->code_ptr
[2];
988 /* Thanks to Andrzej Zaborowski */
989 tcg_out32 (s
, bc
| (val
& 0xfffc));
990 tcg_out_reloc (s
, s
->code_ptr
- 4, R_PPC_REL14
, label_index
, 0);
994 static void tcg_out_brcond (TCGContext
*s
, int cond
,
995 TCGArg arg1
, TCGArg arg2
, int const_arg2
,
996 int label_index
, int arch64
)
998 tcg_out_cmp (s
, cond
, arg1
, arg2
, const_arg2
, 7, arch64
);
999 tcg_out_bc (s
, tcg_to_bc
[cond
], label_index
);
1002 void ppc_tb_set_jmp_target (unsigned long jmp_addr
, unsigned long addr
)
1005 unsigned long patch_size
;
1007 s
.code_ptr
= (uint8_t *) jmp_addr
;
1008 tcg_out_b (&s
, 0, addr
);
1009 patch_size
= s
.code_ptr
- (uint8_t *) jmp_addr
;
1010 flush_icache_range (jmp_addr
, jmp_addr
+ patch_size
);
1013 static void tcg_out_op (TCGContext
*s
, int opc
, const TCGArg
*args
,
1014 const int *const_args
)
1019 case INDEX_op_exit_tb
:
1020 tcg_out_movi (s
, TCG_TYPE_I64
, TCG_REG_R3
, args
[0]);
1021 tcg_out_b (s
, 0, (tcg_target_long
) tb_ret_addr
);
1023 case INDEX_op_goto_tb
:
1024 if (s
->tb_jmp_offset
) {
1025 /* direct jump method */
1027 s
->tb_jmp_offset
[args
[0]] = s
->code_ptr
- s
->code_buf
;
1033 s
->tb_next_offset
[args
[0]] = s
->code_ptr
- s
->code_buf
;
1037 TCGLabel
*l
= &s
->labels
[args
[0]];
1040 tcg_out_b (s
, 0, l
->u
.value
);
1043 uint32_t val
= *(uint32_t *) s
->code_ptr
;
1045 /* Thanks to Andrzej Zaborowski */
1046 tcg_out32 (s
, B
| (val
& 0x3fffffc));
1047 tcg_out_reloc (s
, s
->code_ptr
- 4, R_PPC_REL24
, args
[0], 0);
1052 tcg_out_call (s
, args
[0], const_args
[0]);
1055 if (const_args
[0]) {
1056 tcg_out_b (s
, 0, args
[0]);
1059 tcg_out32 (s
, MTSPR
| RS (args
[0]) | CTR
);
1060 tcg_out32 (s
, BCCTR
| BO_ALWAYS
);
1063 case INDEX_op_movi_i32
:
1064 tcg_out_movi (s
, TCG_TYPE_I32
, args
[0], args
[1]);
1066 case INDEX_op_movi_i64
:
1067 tcg_out_movi (s
, TCG_TYPE_I64
, args
[0], args
[1]);
1069 case INDEX_op_ld8u_i32
:
1070 case INDEX_op_ld8u_i64
:
1071 tcg_out_ldst (s
, args
[0], args
[1], args
[2], LBZ
, LBZX
);
1073 case INDEX_op_ld8s_i32
:
1074 case INDEX_op_ld8s_i64
:
1075 tcg_out_ldst (s
, args
[0], args
[1], args
[2], LBZ
, LBZX
);
1076 tcg_out32 (s
, EXTSB
| RS (args
[0]) | RA (args
[0]));
1078 case INDEX_op_ld16u_i32
:
1079 case INDEX_op_ld16u_i64
:
1080 tcg_out_ldst (s
, args
[0], args
[1], args
[2], LHZ
, LHZX
);
1082 case INDEX_op_ld16s_i32
:
1083 case INDEX_op_ld16s_i64
:
1084 tcg_out_ldst (s
, args
[0], args
[1], args
[2], LHA
, LHAX
);
1086 case INDEX_op_ld_i32
:
1087 case INDEX_op_ld32u_i64
:
1088 tcg_out_ldst (s
, args
[0], args
[1], args
[2], LWZ
, LWZX
);
1090 case INDEX_op_ld32s_i64
:
1091 tcg_out_ldst (s
, args
[0], args
[1], args
[2], LWA
, LWAX
);
1093 case INDEX_op_ld_i64
:
1094 tcg_out_ldst (s
, args
[0], args
[1], args
[2], LD
, LDX
);
1096 case INDEX_op_st8_i32
:
1097 case INDEX_op_st8_i64
:
1098 tcg_out_ldst (s
, args
[0], args
[1], args
[2], STB
, STBX
);
1100 case INDEX_op_st16_i32
:
1101 case INDEX_op_st16_i64
:
1102 tcg_out_ldst (s
, args
[0], args
[1], args
[2], STH
, STHX
);
1104 case INDEX_op_st_i32
:
1105 case INDEX_op_st32_i64
:
1106 tcg_out_ldst (s
, args
[0], args
[1], args
[2], STW
, STWX
);
1108 case INDEX_op_st_i64
:
1109 tcg_out_ldst (s
, args
[0], args
[1], args
[2], STD
, STDX
);
1112 case INDEX_op_add_i32
:
1114 ppc_addi32 (s
, args
[0], args
[1], args
[2]);
1116 tcg_out32 (s
, ADD
| TAB (args
[0], args
[1], args
[2]));
1118 case INDEX_op_sub_i32
:
1120 ppc_addi32 (s
, args
[0], args
[1], -args
[2]);
1122 tcg_out32 (s
, SUBF
| TAB (args
[0], args
[2], args
[1]));
1125 case INDEX_op_and_i64
:
1126 case INDEX_op_and_i32
:
1127 if (const_args
[2]) {
1128 if ((args
[2] & 0xffff) == args
[2])
1129 tcg_out32 (s
, ANDI
| RS (args
[1]) | RA (args
[0]) | args
[2]);
1130 else if ((args
[2] & 0xffff0000) == args
[2])
1131 tcg_out32 (s
, ANDIS
| RS (args
[1]) | RA (args
[0])
1132 | ((args
[2] >> 16) & 0xffff));
1134 tcg_out_movi (s
, (opc
== INDEX_op_and_i32
1138 tcg_out32 (s
, AND
| SAB (args
[1], args
[0], 0));
1142 tcg_out32 (s
, AND
| SAB (args
[1], args
[0], args
[2]));
1144 case INDEX_op_or_i64
:
1145 case INDEX_op_or_i32
:
1146 if (const_args
[2]) {
1147 if (args
[2] & 0xffff) {
1148 tcg_out32 (s
, ORI
| RS (args
[1]) | RA (args
[0])
1149 | (args
[2] & 0xffff));
1151 tcg_out32 (s
, ORIS
| RS (args
[0]) | RA (args
[0])
1152 | ((args
[2] >> 16) & 0xffff));
1155 tcg_out32 (s
, ORIS
| RS (args
[1]) | RA (args
[0])
1156 | ((args
[2] >> 16) & 0xffff));
1160 tcg_out32 (s
, OR
| SAB (args
[1], args
[0], args
[2]));
1162 case INDEX_op_xor_i64
:
1163 case INDEX_op_xor_i32
:
1164 if (const_args
[2]) {
1165 if ((args
[2] & 0xffff) == args
[2])
1166 tcg_out32 (s
, XORI
| RS (args
[1]) | RA (args
[0])
1167 | (args
[2] & 0xffff));
1168 else if ((args
[2] & 0xffff0000) == args
[2])
1169 tcg_out32 (s
, XORIS
| RS (args
[1]) | RA (args
[0])
1170 | ((args
[2] >> 16) & 0xffff));
1172 tcg_out_movi (s
, (opc
== INDEX_op_and_i32
1176 tcg_out32 (s
, XOR
| SAB (args
[1], args
[0], 0));
1180 tcg_out32 (s
, XOR
| SAB (args
[1], args
[0], args
[2]));
1183 case INDEX_op_mul_i32
:
1184 if (const_args
[2]) {
1185 if (args
[2] == (int16_t) args
[2])
1186 tcg_out32 (s
, MULLI
| RT (args
[0]) | RA (args
[1])
1187 | (args
[2] & 0xffff));
1189 tcg_out_movi (s
, TCG_TYPE_I32
, 0, args
[2]);
1190 tcg_out32 (s
, MULLW
| TAB (args
[0], args
[1], 0));
1194 tcg_out32 (s
, MULLW
| TAB (args
[0], args
[1], args
[2]));
1197 case INDEX_op_div_i32
:
1198 tcg_out32 (s
, DIVW
| TAB (args
[0], args
[1], args
[2]));
1201 case INDEX_op_divu_i32
:
1202 tcg_out32 (s
, DIVWU
| TAB (args
[0], args
[1], args
[2]));
1205 case INDEX_op_rem_i32
:
1206 tcg_out32 (s
, DIVW
| TAB (0, args
[1], args
[2]));
1207 tcg_out32 (s
, MULLW
| TAB (0, 0, args
[2]));
1208 tcg_out32 (s
, SUBF
| TAB (args
[0], 0, args
[1]));
1211 case INDEX_op_remu_i32
:
1212 tcg_out32 (s
, DIVWU
| TAB (0, args
[1], args
[2]));
1213 tcg_out32 (s
, MULLW
| TAB (0, 0, args
[2]));
1214 tcg_out32 (s
, SUBF
| TAB (args
[0], 0, args
[1]));
1217 case INDEX_op_shl_i32
:
1218 if (const_args
[2]) {
1219 tcg_out32 (s
, (RLWINM
1229 tcg_out32 (s
, SLW
| SAB (args
[1], args
[0], args
[2]));
1231 case INDEX_op_shr_i32
:
1232 if (const_args
[2]) {
1233 tcg_out32 (s
, (RLWINM
1243 tcg_out32 (s
, SRW
| SAB (args
[1], args
[0], args
[2]));
1245 case INDEX_op_sar_i32
:
1247 tcg_out32 (s
, SRAWI
| RS (args
[1]) | RA (args
[0]) | SH (args
[2]));
1249 tcg_out32 (s
, SRAW
| SAB (args
[1], args
[0], args
[2]));
1252 case INDEX_op_brcond_i32
:
1253 tcg_out_brcond (s
, args
[2], args
[0], args
[1], const_args
[1], args
[3], 0);
1256 case INDEX_op_brcond_i64
:
1257 tcg_out_brcond (s
, args
[2], args
[0], args
[1], const_args
[1], args
[3], 1);
1260 case INDEX_op_neg_i32
:
1261 case INDEX_op_neg_i64
:
1262 tcg_out32 (s
, NEG
| RT (args
[0]) | RA (args
[1]));
1265 case INDEX_op_add_i64
:
1267 ppc_addi64 (s
, args
[0], args
[1], args
[2]);
1269 tcg_out32 (s
, ADD
| TAB (args
[0], args
[1], args
[2]));
1271 case INDEX_op_sub_i64
:
1273 ppc_addi64 (s
, args
[0], args
[1], -args
[2]);
1275 tcg_out32 (s
, SUBF
| TAB (args
[0], args
[2], args
[1]));
1278 case INDEX_op_shl_i64
:
1280 tcg_out_rld (s
, RLDICR
, args
[0], args
[1], args
[2], 63 - args
[2]);
1282 tcg_out32 (s
, SLD
| SAB (args
[1], args
[0], args
[2]));
1284 case INDEX_op_shr_i64
:
1286 tcg_out_rld (s
, RLDICL
, args
[0], args
[1], 64 - args
[2], args
[2]);
1288 tcg_out32 (s
, SRD
| SAB (args
[1], args
[0], args
[2]));
1290 case INDEX_op_sar_i64
:
1291 if (const_args
[2]) {
1292 int sh
= SH (args
[2] & 0x1f) | (((args
[2] >> 5) & 1) << 1);
1293 tcg_out32 (s
, SRADI
| RA (args
[0]) | RS (args
[1]) | sh
);
1296 tcg_out32 (s
, SRAD
| SAB (args
[1], args
[0], args
[2]));
1299 case INDEX_op_mul_i64
:
1300 tcg_out32 (s
, MULLD
| TAB (args
[0], args
[1], args
[2]));
1302 case INDEX_op_div_i64
:
1303 tcg_out32 (s
, DIVD
| TAB (args
[0], args
[1], args
[2]));
1305 case INDEX_op_divu_i64
:
1306 tcg_out32 (s
, DIVDU
| TAB (args
[0], args
[1], args
[2]));
1308 case INDEX_op_rem_i64
:
1309 tcg_out32 (s
, DIVD
| TAB (0, args
[1], args
[2]));
1310 tcg_out32 (s
, MULLD
| TAB (0, 0, args
[2]));
1311 tcg_out32 (s
, SUBF
| TAB (args
[0], 0, args
[1]));
1313 case INDEX_op_remu_i64
:
1314 tcg_out32 (s
, DIVDU
| TAB (0, args
[1], args
[2]));
1315 tcg_out32 (s
, MULLD
| TAB (0, 0, args
[2]));
1316 tcg_out32 (s
, SUBF
| TAB (args
[0], 0, args
[1]));
1319 case INDEX_op_qemu_ld8u
:
1320 tcg_out_qemu_ld (s
, args
, 0);
1322 case INDEX_op_qemu_ld8s
:
1323 tcg_out_qemu_ld (s
, args
, 0 | 4);
1325 case INDEX_op_qemu_ld16u
:
1326 tcg_out_qemu_ld (s
, args
, 1);
1328 case INDEX_op_qemu_ld16s
:
1329 tcg_out_qemu_ld (s
, args
, 1 | 4);
1331 case INDEX_op_qemu_ld32u
:
1332 tcg_out_qemu_ld (s
, args
, 2);
1334 case INDEX_op_qemu_ld32s
:
1335 tcg_out_qemu_ld (s
, args
, 2 | 4);
1337 case INDEX_op_qemu_ld64
:
1338 tcg_out_qemu_ld (s
, args
, 3);
1340 case INDEX_op_qemu_st8
:
1341 tcg_out_qemu_st (s
, args
, 0);
1343 case INDEX_op_qemu_st16
:
1344 tcg_out_qemu_st (s
, args
, 1);
1346 case INDEX_op_qemu_st32
:
1347 tcg_out_qemu_st (s
, args
, 2);
1349 case INDEX_op_qemu_st64
:
1350 tcg_out_qemu_st (s
, args
, 3);
1353 case INDEX_op_ext8s_i32
:
1354 case INDEX_op_ext8s_i64
:
1357 case INDEX_op_ext16s_i32
:
1358 case INDEX_op_ext16s_i64
:
1361 case INDEX_op_ext32s_i64
:
1365 tcg_out32 (s
, c
| RS (args
[1]) | RA (args
[0]));
1369 tcg_dump_ops (s
, stderr
);
1374 static const TCGTargetOpDef ppc_op_defs
[] = {
1375 { INDEX_op_exit_tb
, { } },
1376 { INDEX_op_goto_tb
, { } },
1377 { INDEX_op_call
, { "ri" } },
1378 { INDEX_op_jmp
, { "ri" } },
1379 { INDEX_op_br
, { } },
1381 { INDEX_op_mov_i32
, { "r", "r" } },
1382 { INDEX_op_mov_i64
, { "r", "r" } },
1383 { INDEX_op_movi_i32
, { "r" } },
1384 { INDEX_op_movi_i64
, { "r" } },
1386 { INDEX_op_ld8u_i32
, { "r", "r" } },
1387 { INDEX_op_ld8s_i32
, { "r", "r" } },
1388 { INDEX_op_ld16u_i32
, { "r", "r" } },
1389 { INDEX_op_ld16s_i32
, { "r", "r" } },
1390 { INDEX_op_ld_i32
, { "r", "r" } },
1391 { INDEX_op_ld_i64
, { "r", "r" } },
1392 { INDEX_op_st8_i32
, { "r", "r" } },
1393 { INDEX_op_st8_i64
, { "r", "r" } },
1394 { INDEX_op_st16_i32
, { "r", "r" } },
1395 { INDEX_op_st16_i64
, { "r", "r" } },
1396 { INDEX_op_st_i32
, { "r", "r" } },
1397 { INDEX_op_st_i64
, { "r", "r" } },
1398 { INDEX_op_st32_i64
, { "r", "r" } },
1400 { INDEX_op_ld8u_i64
, { "r", "r" } },
1401 { INDEX_op_ld8s_i64
, { "r", "r" } },
1402 { INDEX_op_ld16u_i64
, { "r", "r" } },
1403 { INDEX_op_ld16s_i64
, { "r", "r" } },
1404 { INDEX_op_ld32u_i64
, { "r", "r" } },
1405 { INDEX_op_ld32s_i64
, { "r", "r" } },
1406 { INDEX_op_ld_i64
, { "r", "r" } },
1408 { INDEX_op_add_i32
, { "r", "r", "ri" } },
1409 { INDEX_op_mul_i32
, { "r", "r", "ri" } },
1410 { INDEX_op_div_i32
, { "r", "r", "r" } },
1411 { INDEX_op_divu_i32
, { "r", "r", "r" } },
1412 { INDEX_op_rem_i32
, { "r", "r", "r" } },
1413 { INDEX_op_remu_i32
, { "r", "r", "r" } },
1414 { INDEX_op_sub_i32
, { "r", "r", "ri" } },
1415 { INDEX_op_and_i32
, { "r", "r", "ri" } },
1416 { INDEX_op_or_i32
, { "r", "r", "ri" } },
1417 { INDEX_op_xor_i32
, { "r", "r", "ri" } },
1419 { INDEX_op_shl_i32
, { "r", "r", "ri" } },
1420 { INDEX_op_shr_i32
, { "r", "r", "ri" } },
1421 { INDEX_op_sar_i32
, { "r", "r", "ri" } },
1423 { INDEX_op_brcond_i32
, { "r", "ri" } },
1424 { INDEX_op_brcond_i64
, { "r", "ri" } },
1426 { INDEX_op_neg_i32
, { "r", "r" } },
1428 { INDEX_op_add_i64
, { "r", "r", "ri" } },
1429 { INDEX_op_sub_i64
, { "r", "r", "ri" } },
1430 { INDEX_op_and_i64
, { "r", "r", "rZ" } },
1431 { INDEX_op_or_i64
, { "r", "r", "rZ" } },
1432 { INDEX_op_xor_i64
, { "r", "r", "rZ" } },
1434 { INDEX_op_shl_i64
, { "r", "r", "ri" } },
1435 { INDEX_op_shr_i64
, { "r", "r", "ri" } },
1436 { INDEX_op_sar_i64
, { "r", "r", "ri" } },
1438 { INDEX_op_mul_i64
, { "r", "r", "r" } },
1439 { INDEX_op_div_i64
, { "r", "r", "r" } },
1440 { INDEX_op_divu_i64
, { "r", "r", "r" } },
1441 { INDEX_op_rem_i64
, { "r", "r", "r" } },
1442 { INDEX_op_remu_i64
, { "r", "r", "r" } },
1444 { INDEX_op_neg_i64
, { "r", "r" } },
1446 { INDEX_op_qemu_ld8u
, { "r", "L" } },
1447 { INDEX_op_qemu_ld8s
, { "r", "L" } },
1448 { INDEX_op_qemu_ld16u
, { "r", "L" } },
1449 { INDEX_op_qemu_ld16s
, { "r", "L" } },
1450 { INDEX_op_qemu_ld32u
, { "r", "L" } },
1451 { INDEX_op_qemu_ld32s
, { "r", "L" } },
1452 { INDEX_op_qemu_ld64
, { "r", "L" } },
1454 { INDEX_op_qemu_st8
, { "S", "S" } },
1455 { INDEX_op_qemu_st16
, { "S", "S" } },
1456 { INDEX_op_qemu_st32
, { "S", "S" } },
1457 { INDEX_op_qemu_st64
, { "S", "S", "S" } },
1459 { INDEX_op_ext8s_i32
, { "r", "r" } },
1460 { INDEX_op_ext16s_i32
, { "r", "r" } },
1461 { INDEX_op_ext8s_i64
, { "r", "r" } },
1462 { INDEX_op_ext16s_i64
, { "r", "r" } },
1463 { INDEX_op_ext32s_i64
, { "r", "r" } },
1468 void tcg_target_init (TCGContext
*s
)
1470 tcg_regset_set32 (tcg_target_available_regs
[TCG_TYPE_I32
], 0, 0xffffffff);
1471 tcg_regset_set32 (tcg_target_available_regs
[TCG_TYPE_I64
], 0, 0xffffffff);
1472 tcg_regset_set32 (tcg_target_call_clobber_regs
, 0,
1481 (1 << TCG_REG_R10
) |
1482 (1 << TCG_REG_R11
) |
1486 tcg_regset_clear (s
->reserved_regs
);
1487 tcg_regset_set_reg (s
->reserved_regs
, TCG_REG_R0
);
1488 tcg_regset_set_reg (s
->reserved_regs
, TCG_REG_R1
);
1489 tcg_regset_set_reg (s
->reserved_regs
, TCG_REG_R2
);
1490 tcg_regset_set_reg (s
->reserved_regs
, TCG_REG_R13
);
1492 tcg_add_target_add_op_defs (ppc_op_defs
);