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

Function compile_condition

src/engine/function.c:2260–2370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2258static struct arg_list * arg_list_compile( PARSE * parse, int * num_arguments );
2259
2260static void compile_condition( PARSE * parse, compiler * c, int branch_true, int label )
2261{
2262 assert( parse->type == PARSE_EVAL );
2263 switch ( parse->num )
2264 {
2265 case EXPR_EXISTS:
2266 compile_parse( parse->left, c, RESULT_STACK );
2267 if ( branch_true )
2268 compile_emit_branch( c, INSTR_JUMP_NOT_EMPTY, label );
2269 else
2270 compile_emit_branch( c, INSTR_JUMP_EMPTY, label );
2271 break;
2272
2273 case EXPR_EQUALS:
2274 compile_parse( parse->left, c, RESULT_STACK );
2275 compile_parse( parse->right, c, RESULT_STACK );
2276 if ( branch_true )
2277 compile_emit_branch( c, INSTR_JUMP_EQ, label );
2278 else
2279 compile_emit_branch( c, INSTR_JUMP_NE, label );
2280 break;
2281
2282 case EXPR_NOTEQ:
2283 compile_parse( parse->left, c, RESULT_STACK );
2284 compile_parse( parse->right, c, RESULT_STACK );
2285 if ( branch_true )
2286 compile_emit_branch( c, INSTR_JUMP_NE, label );
2287 else
2288 compile_emit_branch( c, INSTR_JUMP_EQ, label );
2289 break;
2290
2291 case EXPR_LESS:
2292 compile_parse( parse->left, c, RESULT_STACK );
2293 compile_parse( parse->right, c, RESULT_STACK );
2294 if ( branch_true )
2295 compile_emit_branch( c, INSTR_JUMP_LT, label );
2296 else
2297 compile_emit_branch( c, INSTR_JUMP_GE, label );
2298 break;
2299
2300 case EXPR_LESSEQ:
2301 compile_parse( parse->left, c, RESULT_STACK );
2302 compile_parse( parse->right, c, RESULT_STACK );
2303 if ( branch_true )
2304 compile_emit_branch( c, INSTR_JUMP_LE, label );
2305 else
2306 compile_emit_branch( c, INSTR_JUMP_GT, label );
2307 break;
2308
2309 case EXPR_MORE:
2310 compile_parse( parse->left, c, RESULT_STACK );
2311 compile_parse( parse->right, c, RESULT_STACK );
2312 if ( branch_true )
2313 compile_emit_branch( c, INSTR_JUMP_GT, label );
2314 else
2315 compile_emit_branch( c, INSTR_JUMP_LE, label );
2316 break;
2317

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