#include "gmqcc.h"
#include "ast.h"
-#include "parser.h"
+#include "fold.h"
+//#include "parser.h"
#define ast_instantiate(T, ctx, destroyfn) \
T* self = (T*)mem_a(sizeof(T)); \
ir_block *ontrue_endblock = nullptr;
ir_block *onfalse_endblock = nullptr;
ir_block *merge = nullptr;
- int fold = 0;
+ int folded = 0;
/* We don't output any value, thus also don't care about r/lvalue */
(void)out;
cond = func->curblock;
/* try constant folding away the condition */
- if ((fold = fold_cond_ifthen(condval, func, self)) != -1)
- return fold;
+ if ((folded = fold::cond_ifthen(condval, func, self)) != -1)
+ return folded;
if (self->on_true) {
/* create on-true block */
ir_block *ontrue, *ontrue_out = nullptr;
ir_block *onfalse, *onfalse_out = nullptr;
ir_block *merge;
- int fold = 0;
+ int folded = 0;
/* Ternary can never create an lvalue... */
if (lvalue)
cond_out = func->curblock;
/* try constant folding away the condition */
- if ((fold = fold_cond_ternary(condval, func, self)) != -1)
- return fold;
+ if ((folded = fold::cond_ternary(condval, func, self)) != -1)
+ return folded;
/* create on-true block */
ontrue = ir_function_create_block(ast_ctx(self), func->ir_func, ast_function_label(func, "tern_T"));