/* try constant folding away the if */
if ((fold = fold_cond(condval, func, self)) != -1)
return fold;
-
+
if (self->on_true) {
/* create on-true block */
ontrue = ir_function_create_block(ast_ctx(self), func->ir_func, ast_function_label(func, "ontrue"));
* stage constant folding, where, witht he help of the AST, operator
* usages can be constant folded. Then there is the constant folding
* in the IR for things like eliding if statements, can occur.
- *
+ *
* This file is thus, split into two parts.
*/
/*
* Implementation of basic vector math for vec3_t, for trivial constant
* folding.
- *
+ *
* TODO: gcc/clang hinting for autovectorization
*/
static GMQCC_INLINE vec3_t vec3_add(vec3_t a, vec3_t b) {
return !!v->constval.vfloat;
case TYPE_INTEGER:
return !!v->constval.vint;
- case TYPE_VECTOR:
+ case TYPE_VECTOR:
if (OPTS_FLAG(CORRECT_LOGIC))
return vec3_pbool(v->constval.vvec);
return !!(v->constval.vvec.x);
/*
* vector-component constant folding works by matching the component sets
* to eliminate expensive operations on whole-vectors (3 components at runtime).
- * to achive this effect in a clean manner this function generalizes the
+ * to achive this effect in a clean manner this function generalizes the
* values through the use of a set paramater, which is used as an indexing method
* for creating the elided ast binary expression.
*
* vec.z is the same as set[2]-'x' for when set[2] is 'z', 'z'-'x' results in a
* literal value of 2, using this 2, we know that taking the address of vec->x (float)
* and indxing it with this literal will yeild the immediate address of that component
- *
+ *
* Of course more work needs to be done to generate the correct index for the ast_member_new
* call, which is no problem: set[0]-'x' suffices that job.
*/
return (ast_expression*)b;
} else {
return fold_constgen_float (
- fold,
+ fold,
((expr) ? (fold_immediate_true(fold, a) || fold_immediate_true(fold, b))
: (fold_immediate_true(fold, a) && fold_immediate_true(fold, b)))
? 1
#undef INTRIN_REG
#undef INTRIN_VAL
-/*
+/*
* TODO: make static (and handle ast_type_string) here for the builtin
* instead of in SYA parse close.
*/
{&intrin_mod, "__builtin_mod", "mod"},
{&intrin_pow, "__builtin_pow", "pow"},
{&intrin_isnan, "__builtin_isnan", "isnan"},
- {&intrin_debug_typestring, "__builtin_debug_typestring", ""}
+ {&intrin_debug_typestring, "__builtin_debug_typestring", ""}
};
static void intrin_error(intrin_t *intrin, const char *fmt, ...) {
mem_d(dat);
return true;
-
+
err:
if (dat) mem_d(dat);
if (out) fs_file_close(out);
ty1, ty2);
return false;
}
-
+
if (!(out = fold_op(parser->fold, op, exprs))) {
ast_call *gencall = ast_call_new(parser_ctx(parser), intrin_func(parser->intrin, "pow"));
vec_push(gencall->params, exprs[0]);
ty1, ty2);
return false;
- }
+ }
if (!(out = fold_op(parser->fold, op, exprs))) {
ast_binary *eq = ast_binary_new(ctx, INSTR_EQ_F, exprs[0], exprs[1]);
return false;
}
- /*
+ /*
* TODO handle this at the intrinsic level with an ast_intrinsic
* node and codegen.
*/
if (!var && !strcmp(parser_tokval(parser), "__FUNC__"))
var = (ast_expression*)fold_constgen_string(parser->fold, parser->function->name, false);
if (!var) {
- /*
+ /*
* now we try for the real intrinsic hashtable. If the string
* begins with __builtin, we simply skip past it, otherwise we
* use the identifier as is.
if (parser->reserved_version)
ast_value_delete(parser->reserved_version);
- util_htdel(parser->aliases);
+ util_htdel(parser->aliases);
fold_cleanup(parser->fold);
intrin_cleanup(parser->intrin);
}
info = ((stat_mem_block_t*)ptr - 1);
- /*
+ /*
* we need access to the redzone that represents the info block
* so lets do that.
*/
/* don't need access anymore */
VALGRIND_MAKE_MEM_NOACCESS(oldinfo->prev, sizeof(stat_mem_block_t));
}
-
+
if (oldinfo->next) {
/* just need access for a short period */
VALGRIND_MAKE_MEM_DEFINED(oldinfo->next, sizeof(stat_mem_block_t));
newinfo->prev = NULL;
newinfo->next = stat_mem_block_root;
- /*
+ /*
* likely since the only time there is no root is when it's
* being initialized first.
*/
stat_mem_allocated += newinfo->size;
stat_mem_high += newinfo->size;
- /*
+ /*
* we're finished with the redzones, lets kill the access
* to them.
*/
stat_dump_mem_contents(info, OPTS_OPTION_U16(OPTION_MEMDUMPCOLS));
- /*
+ /*
* we're finished with the access, the redzone should be marked
* inaccesible so that invalid read/writes that could 'step-into'
* those redzones will show up as invalid read/writes in valgrind.
char **directories = NULL;
char *claim = util_strdup(curdir);
size_t i;
-
+
vec_push(directories, claim);
dir = fs_dir_open(claim);
*/
for (i = 0; i < vec_size(directories); i++) {
dir = fs_dir_open(directories[i]);
-
+
while ((files = fs_dir_read(dir))) {
util_snprintf(buffer, sizeof(buffer), "%s/%s", directories[i], files->d_name);
if (stat(buffer, &directory) == -1) {
vec_push(task_tasks, task);
}
}
-
+
fs_dir_close(dir);
mem_d(directories[i]); /* free claimed memory */
}
FILE *execute;
char buffer[4096];
task_template_t *tmpl = task_tasks[i].tmpl;
-
+
memset (buffer,0,sizeof(buffer));
if (!strcmp(tmpl->proceduretype, "-execute")) {
*/
if (!(execute = fs_file_open(task_tasks[i].stderrlogfile, "r")))
return false;
-
+
process = false;
}
char *data = NULL;
size_t size = 0;
size_t compare = 0;
-
+
while (fs_file_getline(&data, &size, execute) != EOF) {
if (!strcmp(data, "No main function found\n")) {
con_err("test failure: `%s` (No main function found) [%s]\n",
*/
if (strrchr(data, '\n'))
*strrchr(data, '\n') = '\0';
-
+
/*
* We remove the file/directory and stuff from the error
* match messages when testing diagnostics.
* Generate a task from thin air if it requires execution in
* the QCVM.
*/
-
+
/* diagnostic is not executed, but compare tested instead, like preproessor */
execute = !! (!strcmp(task_tasks[i].tmpl->proceduretype, "-execute")) ||
(!strcmp(task_tasks[i].tmpl->proceduretype, "-pp")) ||
failed++;
continue;
}
-
+
for (j = 0; j < vec_size(match); j++)
mem_d(match[j]);
vec_free(match);
#include "gmqcc.h"
/*
- * Initially this was handled with a table in the gmqcc.h header, but
+ * Initially this was handled with a table in the gmqcc.h header, but
* much to my surprise the contents of the table was duplicated for
* each translation unit, causing all these strings to be duplicated
* for every .c file it was included into. This method culls back on
}
#endif
-/*
+/*
* modifier is the match to make and the transpsition from it, while add is the upper-value that determines the
* transposion from uppercase to lower case.
*/