@@ -96,8 +96,8 @@ static inline cj_operand cj_builder_call_unary(cj_ctx *ctx, cj_builder_scratch *
9696static inline size_t align_stack_size (size_t size )
9797{
9898 const size_t alignment = 16 ;
99- if (size == 0 )
100- return 0 ;
99+ if (size == 0 ) return 0 ;
100+
101101 size_t mask = alignment - 1 ;
102102 return (size + mask ) & ~mask ;
103103}
@@ -116,8 +116,7 @@ static inline void cj_builder_fn_prologue_with_link_save(cj_ctx *ctx, size_t req
116116
117117static inline void cj_builder_fn_epilogue (cj_ctx * ctx , const cj_builder_frame * frame )
118118{
119- if (!ctx )
120- return ;
119+ if (!ctx ) return ;
121120 size_t aligned = frame ? frame -> stack_size : 0 ;
122121 int save_lr = (frame && frame -> save_lr );
123122
@@ -157,8 +156,7 @@ static inline void cj_builder_fn_epilogue(cj_ctx *ctx, const cj_builder_frame *f
157156
158157static inline void cj_builder_return (cj_ctx * ctx , const cj_builder_frame * frame )
159158{
160- if (!ctx )
161- return ;
159+ if (!ctx ) return ;
162160 cj_builder_fn_epilogue (ctx , frame );
163161 cj_ret (ctx );
164162}
@@ -333,30 +331,26 @@ static inline cj_builder_block cj_builder_loop_begin(cj_ctx *ctx)
333331static inline void cj_builder_loop_condition (cj_ctx * ctx , cj_builder_block block , cj_operand lhs ,
334332 cj_operand rhs , cj_condition exit_cond )
335333{
336- if (!ctx )
337- return ;
334+ if (!ctx ) return ;
338335 cj_cmp (ctx , lhs , rhs );
339336 branch_on_condition (ctx , exit_cond , block .exit );
340337}
341338
342339static inline void cj_builder_loop_continue (cj_ctx * ctx , cj_builder_block block )
343340{
344- if (!ctx )
345- return ;
341+ if (!ctx ) return ;
346342 branch_unconditional (ctx , block .entry );
347343}
348344
349345static inline void cj_builder_loop_break (cj_ctx * ctx , cj_builder_block block )
350346{
351- if (!ctx )
352- return ;
347+ if (!ctx ) return ;
353348 branch_unconditional (ctx , block .exit );
354349}
355350
356351static inline void cj_builder_loop_end (cj_ctx * ctx , cj_builder_block block )
357352{
358- if (!ctx )
359- return ;
353+ if (!ctx ) return ;
360354 branch_unconditional (ctx , block .entry );
361355 cj_mark_label (ctx , block .exit );
362356}
@@ -375,17 +369,15 @@ cj_builder_if_block cj_builder_if(cj_ctx *ctx, cj_operand lhs, cj_operand rhs, c
375369
376370void cj_builder_else (cj_ctx * ctx , cj_builder_if_block * block )
377371{
378- if (!ctx || !block )
379- return ;
372+ if (!ctx || !block ) return ;
380373 branch_unconditional (ctx , block -> end_label );
381374 cj_mark_label (ctx , block -> else_label );
382375 block -> has_else = 1 ;
383376}
384377
385378void cj_builder_endif (cj_ctx * ctx , cj_builder_if_block * block )
386379{
387- if (!ctx || !block )
388- return ;
380+ if (!ctx || !block ) return ;
389381 if (!block -> has_else )
390382 {
391383 cj_mark_label (ctx , block -> else_label );
@@ -404,10 +396,7 @@ static inline cj_builder_for_loop cj_builder_for_begin(cj_ctx *ctx, cj_operand c
404396 .exit_cond = exit_cond ,
405397 };
406398
407- if (counter .type == CJ_REGISTER )
408- {
409- cj_mov (ctx , counter , start );
410- }
399+ if (counter .type == CJ_REGISTER ) cj_mov (ctx , counter , start );
411400
412401 loop .block = cj_builder_loop_begin (ctx );
413402 cj_builder_loop_condition (ctx , loop .block , counter , limit , exit_cond );
@@ -416,23 +405,20 @@ static inline cj_builder_for_loop cj_builder_for_begin(cj_ctx *ctx, cj_operand c
416405
417406static inline void cj_builder_for_continue (cj_ctx * ctx , cj_builder_for_loop * loop )
418407{
419- if (!ctx || !loop )
420- return ;
408+ if (!ctx || !loop ) return ;
421409 cj_add (ctx , loop -> counter , loop -> step );
422410 cj_builder_loop_continue (ctx , loop -> block );
423411}
424412
425413static inline void cj_builder_for_break (cj_ctx * ctx , cj_builder_for_loop * loop )
426414{
427- if (!ctx || !loop )
428- return ;
415+ if (!ctx || !loop ) return ;
429416 cj_builder_loop_break (ctx , loop -> block );
430417}
431418
432419static inline void cj_builder_for_end (cj_ctx * ctx , cj_builder_for_loop * loop )
433420{
434- if (!ctx || !loop )
435- return ;
421+ if (!ctx || !loop ) return ;
436422 cj_add (ctx , loop -> counter , loop -> step );
437423 cj_builder_loop_end (ctx , loop -> block );
438424}
@@ -456,8 +442,8 @@ static inline cj_operand cj_builder_assign(cj_ctx *ctx, cj_operand dst, cj_opera
456442 for (int shift = 16 ; shift < (is64 ? 64 : 32 ); shift += 16 )
457443 {
458444 uint16_t part = (uint16_t )((value >> shift ) & 0xFFFFu );
459- if (!part )
460- continue ;
445+ if (!part ) continue ;
446+
461447 uint64_t encoded = (uint64_t )part | ((uint64_t )(shift / 16 ) << 16 );
462448 cj_operand next = cj_make_constant (encoded );
463449 cj_movk (ctx , dst , next );
@@ -525,21 +511,15 @@ static inline cj_operand cj_builder_arg_int(cj_ctx *ctx, unsigned index)
525511static inline void cj_builder_return_value (cj_ctx * ctx , const cj_builder_frame * frame ,
526512 cj_operand value )
527513{
528- if (!ctx )
529- return ;
514+ if (!ctx ) return ;
530515 cj_operand ret = get_return_operand ();
531516 int needs_move = 1 ;
532517 if (value .type == CJ_REGISTER && value .reg && ret .reg )
533518 {
534- if (strcmp (value .reg , ret .reg ) == 0 )
535- {
536- needs_move = 0 ;
537- }
538- }
539- if (needs_move )
540- {
541- cj_mov (ctx , ret , value );
519+ if (strcmp (value .reg , ret .reg ) == 0 ) needs_move = 0 ;
542520 }
521+ if (needs_move ) cj_mov (ctx , ret , value );
522+
543523 cj_builder_return (ctx , frame );
544524}
545525
@@ -554,8 +534,7 @@ static inline cj_operand cj_builder_zero_operand(void)
554534
555535static inline void cj_builder_clear (cj_ctx * ctx , cj_operand dst )
556536{
557- if (!ctx )
558- return ;
537+ if (!ctx ) return ;
559538#if defined(__x86_64__ ) || defined(_M_X64 )
560539 if (dst .type == CJ_REGISTER )
561540 {
@@ -603,8 +582,7 @@ static inline unsigned cj_builder_arg_int_capacity(void)
603582
604583static inline void cj_builder_scratch_init (cj_builder_scratch * scratch )
605584{
606- if (!scratch )
607- return ;
585+ if (!scratch ) return ;
608586 scratch -> depth = 0 ;
609587}
610588
@@ -642,8 +620,7 @@ static inline cj_operand cj_builder_call_unary(cj_ctx *ctx, cj_builder_scratch *
642620static inline cj_operand cj_builder_call (cj_ctx * ctx , cj_builder_scratch * scratch , cj_label target ,
643621 const cj_operand * args , size_t arg_count )
644622{
645- if (!ctx )
646- return cj_builder_return_reg ();
623+ if (!ctx ) return cj_builder_return_reg ();
647624
648625 unsigned capacity = cj_builder_arg_int_capacity ();
649626 assert (arg_count <= capacity );
@@ -654,8 +631,7 @@ static inline cj_operand cj_builder_call(cj_ctx *ctx, cj_builder_scratch *scratc
654631 cj_builder_assign (ctx , reg , args [i ]);
655632 }
656633
657- if (scratch )
658- cj_builder_scratch_release (scratch );
634+ if (scratch ) cj_builder_scratch_release (scratch );
659635
660636 cj_builder_call_label (ctx , target );
661637
@@ -672,8 +648,7 @@ static inline cj_operand cj_builder_call(cj_ctx *ctx, cj_builder_scratch *scratc
672648static inline void cj_builder_fn_prologue_ex (cj_ctx * ctx , size_t requested_stack_bytes ,
673649 cj_builder_frame * frame , int save_lr )
674650{
675- if (!ctx )
676- return ;
651+ if (!ctx ) return ;
677652 assert (!save_lr || frame );
678653
679654 size_t aligned = align_stack_size (requested_stack_bytes );
0 commit comments