MCPcopy Create free account
hub / github.com/boostorg/build / compile_condition

Function compile_condition

src/engine/function.cpp:2430–2540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2428static struct arg_list * arg_list_compile( PARSE * parse, int32_t * num_arguments );
2429
2430static void compile_condition( PARSE * parse, compiler * c, int32_t branch_true, int32_t label )
2431{
2432 assert( parse->type == PARSE_EVAL );
2433 switch ( parse->num )
2434 {
2435 case EXPR_EXISTS:
2436 compile_parse( parse->left, c, RESULT_STACK );
2437 if ( branch_true )
2438 compile_emit_branch( c, INSTR_JUMP_NOT_EMPTY, label );
2439 else
2440 compile_emit_branch( c, INSTR_JUMP_EMPTY, label );
2441 break;
2442
2443 case EXPR_EQUALS:
2444 compile_parse( parse->left, c, RESULT_STACK );
2445 compile_parse( parse->right, c, RESULT_STACK );
2446 if ( branch_true )
2447 compile_emit_branch( c, INSTR_JUMP_EQ, label );
2448 else
2449 compile_emit_branch( c, INSTR_JUMP_NE, label );
2450 break;
2451
2452 case EXPR_NOTEQ:
2453 compile_parse( parse->left, c, RESULT_STACK );
2454 compile_parse( parse->right, c, RESULT_STACK );
2455 if ( branch_true )
2456 compile_emit_branch( c, INSTR_JUMP_NE, label );
2457 else
2458 compile_emit_branch( c, INSTR_JUMP_EQ, label );
2459 break;
2460
2461 case EXPR_LESS:
2462 compile_parse( parse->left, c, RESULT_STACK );
2463 compile_parse( parse->right, c, RESULT_STACK );
2464 if ( branch_true )
2465 compile_emit_branch( c, INSTR_JUMP_LT, label );
2466 else
2467 compile_emit_branch( c, INSTR_JUMP_GE, label );
2468 break;
2469
2470 case EXPR_LESSEQ:
2471 compile_parse( parse->left, c, RESULT_STACK );
2472 compile_parse( parse->right, c, RESULT_STACK );
2473 if ( branch_true )
2474 compile_emit_branch( c, INSTR_JUMP_LE, label );
2475 else
2476 compile_emit_branch( c, INSTR_JUMP_GT, label );
2477 break;
2478
2479 case EXPR_MORE:
2480 compile_parse( parse->left, c, RESULT_STACK );
2481 compile_parse( parse->right, c, RESULT_STACK );
2482 if ( branch_true )
2483 compile_emit_branch( c, INSTR_JUMP_GT, label );
2484 else
2485 compile_emit_branch( c, INSTR_JUMP_LE, label );
2486 break;
2487

Callers 1

compile_parseFunction · 0.85

Calls 4

compile_parseFunction · 0.85
compile_emit_branchFunction · 0.85
compile_new_labelFunction · 0.85
compile_set_labelFunction · 0.85

Tested by

no test coverage detected