X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=fold.c;h=d51b7652dcc9b48efdd2bf42c0befe73d6c13503;hp=4def3c09e90c8837dc74549195179a52ec98a769;hb=c8a1b6563ef73f82e39202bc9802fee355a4699b;hpb=f25fff1e3db4de036eebf106ff5408ed0b0ee277 diff --git a/fold.c b/fold.c index 4def3c0..d51b765 100644 --- a/fold.c +++ b/fold.c @@ -797,7 +797,7 @@ ast_expression *fold_intrin(fold_t *fold, const char *intrin, ast_expression **a /*#define fold_can_2(X,Y) (fold_can_1(X) && fold_can_1(Y))*/ -int fold_cond(ir_value *condval, ast_function *func, ast_ifthen *branch) { +static GMQCC_INLINE int fold_cond(ir_value *condval, ast_function *func, ast_ifthen *branch) { if (isfloat(condval) && fold_can_1(condval) && OPTS_OPTIMIZATION(OPTIM_CONST_FOLD_DCE)) { ast_expression_codegen *cgen; ir_block *elide; @@ -831,3 +831,11 @@ int fold_cond(ir_value *condval, ast_function *func, ast_ifthen *branch) { } return -1; /* nothing done */ } + +int fold_cond_ternary(ir_value *condval, ast_function *func, ast_ternary *branch) { + return fold_cond(condval, func, (ast_ifthen*)branch); +} + +int fold_cond_ifthen(ir_value *condval, ast_function *func, ast_ifthen *branch) { + return fold_cond(condval, func, branch); +}