tcg-ppc64: Reformat tcg-target.c

Whitespace and brace changes only.

Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Richard Henderson 2013-08-31 05:14:53 -07:00
parent 8f50c841b3
commit 541dd4ceaa
1 changed files with 239 additions and 239 deletions

View File

@ -178,8 +178,9 @@ static uint32_t reloc_pc24_val (void *pc, tcg_target_long target)
tcg_target_long disp;
disp = target - (tcg_target_long)pc;
if ((disp << 38) >> 38 != disp)
if ((disp << 38) >> 38 != disp) {
tcg_abort();
}
return disp & 0x3fffffc;
}
@ -195,16 +196,16 @@ static uint16_t reloc_pc14_val (void *pc, tcg_target_long target)
tcg_target_long disp;
disp = target - (tcg_target_long)pc;
if (disp != (int16_t) disp)
if (disp != (int16_t) disp) {
tcg_abort();
}
return disp & 0xfffc;
}
static void reloc_pc14(void *pc, tcg_target_long target)
{
*(uint32_t *) pc = (*(uint32_t *) pc & ~0xfffc)
| reloc_pc14_val (pc, target);
*(uint32_t *)pc = (*(uint32_t *)pc & ~0xfffc) | reloc_pc14_val(pc, target);
}
static void patch_reloc(uint8_t *code_ptr, int type,
@ -691,9 +692,9 @@ static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target)
tcg_target_long disp;
disp = target - (tcg_target_long)s->code_ptr;
if ((disp << 38) >> 38 == disp)
if ((disp << 38) >> 38 == disp) {
tcg_out32(s, B | (disp & 0x3fffffc) | mask);
else {
} else {
tcg_out_movi(s, TCG_TYPE_I64, 0, (tcg_target_long)target);
tcg_out32(s, MTSPR | RS(0) | CTR);
tcg_out32(s, BCCTR | BO_ALWAYS | mask);
@ -705,19 +706,17 @@ static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
#ifdef __APPLE__
if (const_arg) {
tcg_out_b(s, LK, arg);
}
else {
} else {
tcg_out32(s, MTSPR | RS(arg) | LR);
tcg_out32(s, BCLR | BO_ALWAYS | LK);
}
#else
int reg;
int reg = arg;
if (const_arg) {
reg = 2;
tcg_out_movi(s, TCG_TYPE_I64, reg, arg);
}
else reg = arg;
tcg_out32(s, LD | RT(0) | RA(reg));
tcg_out32(s, MTSPR | RA(0) | CTR);
@ -793,8 +792,7 @@ static void tcg_out_tlb_read(TCGContext *s, TCGReg r0, TCGReg r1, TCGReg r2,
if (!s_bits) {
tcg_out_rld(s, RLDICR, r2, addr_reg, 0, 63 - TARGET_PAGE_BITS);
}
else {
} else {
tcg_out_rld(s, RLDICL, r2, addr_reg,
64 - TARGET_PAGE_BITS,
TARGET_PAGE_BITS - s_bits);
@ -1072,20 +1070,22 @@ static void tcg_target_qemu_prologue (TCGContext *s)
static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1,
intptr_t arg2)
{
if (type == TCG_TYPE_I32)
if (type == TCG_TYPE_I32) {
tcg_out_ldst(s, ret, arg1, arg2, LWZ, LWZX);
else
} else {
tcg_out_ldsta(s, ret, arg1, arg2, LD, LDX);
}
}
static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1,
intptr_t arg2)
{
if (type == TCG_TYPE_I32)
if (type == TCG_TYPE_I32) {
tcg_out_ldst(s, arg, arg1, arg2, STW, STWX);
else
} else {
tcg_out_ldsta(s, arg, arg1, arg2, STD, STDX);
}
}
static void tcg_out_cmp(TCGContext *s, int cond, TCGArg arg1, TCGArg arg2,
int const_arg2, int cr, TCGType type)
@ -1106,8 +1106,7 @@ static void tcg_out_cmp(TCGContext *s, int cond, TCGArg arg1, TCGArg arg2,
op = CMPI;
imm = 1;
break;
}
else if ((uint16_t) arg2 == arg2) {
} else if ((uint16_t) arg2 == arg2) {
op = CMPLI;
imm = 1;
break;
@ -1317,9 +1316,9 @@ static void tcg_out_bc (TCGContext *s, int bc, int label_index)
{
TCGLabel *l = &s->labels[label_index];
if (l->has_value)
if (l->has_value) {
tcg_out32(s, bc | reloc_pc14_val(s->code_ptr, l->u.value));
else {
} else {
uint16_t val = *(uint16_t *) &s->code_ptr[2];
/* Thanks to Andrzej Zaborowski */
@ -1408,12 +1407,11 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,
break;
case INDEX_op_goto_tb:
if (s->tb_jmp_offset) {
/* direct jump method */
/* Direct jump method. */
s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf;
s->code_ptr += 28;
}
else {
} else {
/* Indirect jump method. */
tcg_abort();
}
s->tb_next_offset[args[0]] = s->code_ptr - s->code_buf;
@ -1424,8 +1422,7 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,
if (l->has_value) {
tcg_out_b(s, 0, l->u.value);
}
else {
} else {
uint32_t val = *(uint32_t *) s->code_ptr;
/* Thanks to Andrzej Zaborowski */
@ -1629,10 +1626,11 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,
}
break;
case INDEX_op_sar_i32:
if (const_args[2])
if (const_args[2]) {
tcg_out32(s, SRAWI | RS(args[1]) | RA(args[0]) | SH(args[2]));
else
} else {
tcg_out32(s, SRAW | SAB(args[1], args[0], args[2]));
}
break;
case INDEX_op_rotl_i32:
if (const_args[2]) {
@ -1722,24 +1720,26 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,
break;
case INDEX_op_shl_i64:
if (const_args[2])
if (const_args[2]) {
tcg_out_shli64(s, args[0], args[1], args[2]);
else
} else {
tcg_out32(s, SLD | SAB(args[1], args[0], args[2]));
}
break;
case INDEX_op_shr_i64:
if (const_args[2])
if (const_args[2]) {
tcg_out_shri64(s, args[0], args[1], args[2]);
else
} else {
tcg_out32(s, SRD | SAB(args[1], args[0], args[2]));
}
break;
case INDEX_op_sar_i64:
if (const_args[2]) {
int sh = SH(args[2] & 0x1f) | (((args[2] >> 5) & 1) << 1);
tcg_out32(s, SRADI | RA(args[0]) | RS(args[1]) | sh);
}
else
} else {
tcg_out32(s, SRAD | SAB(args[1], args[0], args[2]));
}
break;
case INDEX_op_rotl_i64:
if (const_args[2]) {