Skip to content

Commit dfdadc8

Browse files
committed
Make clang-format happy
Macro IIF sometime confuses clang-format, so that we have to insert semicolon manually.
1 parent acb06dc commit dfdadc8

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

src/rv32_template.c

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -292,46 +292,46 @@ RVOP(
292292
(type) x cond (type) y
293293
/* clang-format on */
294294

295-
#define BRANCH_FUNC(type, cond) \
296-
IIF(RV32_HAS(EXT_C))(, const uint32_t pc = PC;); \
297-
if (BRANCH_COND(type, rv->X[ir->rs1], rv->X[ir->rs2], cond)) { \
298-
is_branch_taken = false; \
299-
struct rv_insn *untaken = ir->branch_untaken; \
300-
if (!untaken) \
301-
goto nextop; \
302-
IIF(RV32_HAS(JIT)) \
303-
({ \
304-
cache_get(rv->block_cache, PC + 4, true); \
305-
if (!set_add(&pc_set, PC + 4)) \
306-
has_loops = true; \
307-
if (cache_hot(rv->block_cache, PC + 4)) \
308-
goto nextop; \
309-
}, ); \
310-
PC += 4; \
311-
last_pc = PC; \
312-
MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); \
313-
} \
314-
is_branch_taken = true; \
315-
PC += ir->imm; \
316-
/* check instruction misaligned */ \
317-
IIF(RV32_HAS(EXT_C)) \
318-
(, RV_EXC_MISALIGN_HANDLER(pc, insn, false, 0);) struct rv_insn *taken = \
319-
ir->branch_taken; \
320-
if (taken) { \
321-
IIF(RV32_HAS(JIT)) \
322-
({ \
323-
cache_get(rv->block_cache, PC, true); \
324-
if (!set_add(&pc_set, PC)) \
325-
has_loops = true; \
326-
if (cache_hot(rv->block_cache, PC)) \
327-
goto end_insn; \
328-
}, ); \
329-
last_pc = PC; \
330-
MUST_TAIL return taken->impl(rv, taken, cycle, PC); \
331-
} \
332-
end_insn: \
333-
rv->csr_cycle = cycle; \
334-
rv->PC = PC; \
295+
#define BRANCH_FUNC(type, cond) \
296+
IIF(RV32_HAS(EXT_C))(, const uint32_t pc = PC;); \
297+
if (BRANCH_COND(type, rv->X[ir->rs1], rv->X[ir->rs2], cond)) { \
298+
is_branch_taken = false; \
299+
struct rv_insn *untaken = ir->branch_untaken; \
300+
if (!untaken) \
301+
goto nextop; \
302+
IIF(RV32_HAS(JIT)) \
303+
({ \
304+
cache_get(rv->block_cache, PC + 4, true); \
305+
if (!set_add(&pc_set, PC + 4)) \
306+
has_loops = true; \
307+
if (cache_hot(rv->block_cache, PC + 4)) \
308+
goto nextop; \
309+
}, ); \
310+
PC += 4; \
311+
last_pc = PC; \
312+
MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); \
313+
} \
314+
is_branch_taken = true; \
315+
PC += ir->imm; \
316+
/* check instruction misaligned */ \
317+
IIF(RV32_HAS(EXT_C)) \
318+
(, RV_EXC_MISALIGN_HANDLER(pc, insn, false, 0);); \
319+
struct rv_insn *taken = ir->branch_taken; \
320+
if (taken) { \
321+
IIF(RV32_HAS(JIT)) \
322+
({ \
323+
cache_get(rv->block_cache, PC, true); \
324+
if (!set_add(&pc_set, PC)) \
325+
has_loops = true; \
326+
if (cache_hot(rv->block_cache, PC)) \
327+
goto end_insn; \
328+
}, ); \
329+
last_pc = PC; \
330+
MUST_TAIL return taken->impl(rv, taken, cycle, PC); \
331+
} \
332+
end_insn: \
333+
rv->csr_cycle = cycle; \
334+
rv->PC = PC; \
335335
return true;
336336

337337
/* In RV32I and RV64I, if the branch is taken, set pc = pc + offset, where

0 commit comments

Comments
 (0)