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

Function compile_condition

v2/engine/function.c:2209–2319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2207static struct arg_list * arg_list_compile( PARSE * parse, int * num_arguments );
2208
2209static void compile_condition( PARSE * parse, compiler * c, int branch_true, int label )
2210{
2211 assert( parse->type == PARSE_EVAL );
2212 switch ( parse->num )
2213 {
2214 case EXPR_EXISTS:
2215 compile_parse( parse->left, c, RESULT_STACK );
2216 if ( branch_true )
2217 compile_emit_branch( c, INSTR_JUMP_NOT_EMPTY, label );
2218 else
2219 compile_emit_branch( c, INSTR_JUMP_EMPTY, label );
2220 break;
2221
2222 case EXPR_EQUALS:
2223 compile_parse( parse->left, c, RESULT_STACK );
2224 compile_parse( parse->right, c, RESULT_STACK );
2225 if ( branch_true )
2226 compile_emit_branch( c, INSTR_JUMP_EQ, label );
2227 else
2228 compile_emit_branch( c, INSTR_JUMP_NE, label );
2229 break;
2230
2231 case EXPR_NOTEQ:
2232 compile_parse( parse->left, c, RESULT_STACK );
2233 compile_parse( parse->right, c, RESULT_STACK );
2234 if ( branch_true )
2235 compile_emit_branch( c, INSTR_JUMP_NE, label );
2236 else
2237 compile_emit_branch( c, INSTR_JUMP_EQ, label );
2238 break;
2239
2240 case EXPR_LESS:
2241 compile_parse( parse->left, c, RESULT_STACK );
2242 compile_parse( parse->right, c, RESULT_STACK );
2243 if ( branch_true )
2244 compile_emit_branch( c, INSTR_JUMP_LT, label );
2245 else
2246 compile_emit_branch( c, INSTR_JUMP_GE, label );
2247 break;
2248
2249 case EXPR_LESSEQ:
2250 compile_parse( parse->left, c, RESULT_STACK );
2251 compile_parse( parse->right, c, RESULT_STACK );
2252 if ( branch_true )
2253 compile_emit_branch( c, INSTR_JUMP_LE, label );
2254 else
2255 compile_emit_branch( c, INSTR_JUMP_GT, label );
2256 break;
2257
2258 case EXPR_MORE:
2259 compile_parse( parse->left, c, RESULT_STACK );
2260 compile_parse( parse->right, c, RESULT_STACK );
2261 if ( branch_true )
2262 compile_emit_branch( c, INSTR_JUMP_GT, label );
2263 else
2264 compile_emit_branch( c, INSTR_JUMP_LE, label );
2265 break;
2266

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