X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=ast.cpp;h=4768e6e5bb9db83be59b9415cb73733d66d829b9;hp=366d2a9ecd750069a9aaa0ff9824cbdb69df3af9;hb=db9c37d18bcced1c3b0f1421044155b1d88f0b25;hpb=76278e8b97578f210b34784a55925b043098def9 diff --git a/ast.cpp b/ast.cpp index 366d2a9..4768e6e 100644 --- a/ast.cpp +++ b/ast.cpp @@ -5,7 +5,8 @@ #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)); \ @@ -2560,7 +2561,7 @@ bool ast_ifthen_codegen(ast_ifthen *self, ast_function *func, bool lvalue, ir_va 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; @@ -2580,8 +2581,8 @@ bool ast_ifthen_codegen(ast_ifthen *self, ast_function *func, bool lvalue, ir_va 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 */ @@ -2663,7 +2664,7 @@ bool ast_ternary_codegen(ast_ternary *self, ast_function *func, bool lvalue, ir_ 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) @@ -2689,8 +2690,8 @@ bool ast_ternary_codegen(ast_ternary *self, ast_function *func, bool lvalue, ir_ 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"));