mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-05 23:41:10 +00:00
add the vector-calls "optimisation" from fteqcc. makes it possible to
compile the version of frogbot with waypoints for almost 300 maps.
This commit is contained in:
parent
116860bb66
commit
66cabb587f
6 changed files with 50 additions and 16 deletions
|
@ -165,6 +165,12 @@ mode.
|
||||||
Use float values directly in \*(lqif\*(rq statements. Defaults to on. This
|
Use float values directly in \*(lqif\*(rq statements. Defaults to on. This
|
||||||
option is always enabled when using version 6 progs.
|
option is always enabled when using version 6 progs.
|
||||||
.TP
|
.TP
|
||||||
|
.B vector\-calls
|
||||||
|
Where a function is called with just a vector, this causes the function call to
|
||||||
|
store three floats instead of one vector. This can save a good number of
|
||||||
|
pr_globals where those vectors contain many duplicate coordinates but do not
|
||||||
|
match entirly. However, this will generate slower code for such calls.
|
||||||
|
.TP
|
||||||
.B v6only
|
.B v6only
|
||||||
Restrict the compiler to only version 6 progs (original Quake/QuakeWorld)
|
Restrict the compiler to only version 6 progs (original Quake/QuakeWorld)
|
||||||
features. This means that the compiled data file should be able to run on
|
features. This means that the compiled data file should be able to run on
|
||||||
|
@ -229,7 +235,7 @@ report the details (operating system, detection methods, correct execution
|
||||||
specification). The base default execution spec (on most Linux systems) is
|
specification). The base default execution spec (on most Linux systems) is
|
||||||
\fBcpp %d -o %o %i\fP. This spec is similar in concept to a \fBprintf\fP
|
\fBcpp %d -o %o %i\fP. This spec is similar in concept to a \fBprintf\fP
|
||||||
string. The name of the program may be either absolute (eg \fB/lib/cpp\fP) or
|
string. The name of the program may be either absolute (eg \fB/lib/cpp\fP) or
|
||||||
relative as the \fBPATH\fB will be searched. Available substitutions:
|
relative as the \fBPATH\fP will be searched. Available substitutions:
|
||||||
.TP
|
.TP
|
||||||
.B %d
|
.B %d
|
||||||
Mainly for defines (\-D, \-U and \-I) but \fB%d\fP will be replaced by all
|
Mainly for defines (\-D, \-U and \-I) but \fB%d\fP will be replaced by all
|
||||||
|
@ -249,6 +255,13 @@ Sky-father, and Papatuanuku, the Earth-mother. Ruamoko is the god of
|
||||||
volcanoes and earthquakes \fB(Quake, get it?)\fP. For more information, see
|
volcanoes and earthquakes \fB(Quake, get it?)\fP. For more information, see
|
||||||
the Web site at <\fBhttp://maori.com/kmst1.htm\fP>.
|
the Web site at <\fBhttp://maori.com/kmst1.htm\fP>.
|
||||||
.TP
|
.TP
|
||||||
|
.B qfcc hangs
|
||||||
|
This is almost always caused by qfcc incorrectly invoking \fBcpp\fP. Using the
|
||||||
|
\fB--cpp\fP option (refer to the \fBCPP NAME\fP section above), the correct
|
||||||
|
method for invoking cpp can be specified. Once you have found this, please
|
||||||
|
send the correct \fBcpp\fP command line, preferably along with the output of
|
||||||
|
\fBconfig.guess\fP, to the team.
|
||||||
|
.TP
|
||||||
.B qfcc is singing a bad 80s rap song to me. What's going on?
|
.B qfcc is singing a bad 80s rap song to me. What's going on?
|
||||||
\*(lqice ice baby\*(rq is QuakeForge-speak for \*(lqInternal Compiler
|
\*(lqice ice baby\*(rq is QuakeForge-speak for \*(lqInternal Compiler
|
||||||
Error\*(rq. It usually means there's a bug in \fBqfcc\fP, so please report it
|
Error\*(rq. It usually means there's a bug in \fBqfcc\fP, so please report it
|
||||||
|
|
|
@ -39,6 +39,7 @@ typedef struct {
|
||||||
qboolean debug; // Generate debug info for the engine
|
qboolean debug; // Generate debug info for the engine
|
||||||
qboolean short_circuit; // short circuit logic for && and ||
|
qboolean short_circuit; // short circuit logic for && and ||
|
||||||
qboolean fast_float; // use floats directly in ifs
|
qboolean fast_float; // use floats directly in ifs
|
||||||
|
qboolean vector_calls; // use floats instead of vectors for constant function args
|
||||||
unsigned int progsversion; // Progs version to generate code for
|
unsigned int progsversion; // Progs version to generate code for
|
||||||
} code_options_t;
|
} code_options_t;
|
||||||
|
|
||||||
|
|
|
@ -202,10 +202,11 @@ static def_t *
|
||||||
emit_function_call (expr_t *e, def_t *dest)
|
emit_function_call (expr_t *e, def_t *dest)
|
||||||
{
|
{
|
||||||
def_t *func = emit_sub_expr (e->e.expr.e1, 0);
|
def_t *func = emit_sub_expr (e->e.expr.e1, 0);
|
||||||
def_t *parm;
|
|
||||||
def_t *ret;
|
def_t *ret;
|
||||||
def_t *arg;
|
def_t *arg;
|
||||||
|
def_t *p;
|
||||||
expr_t *earg;
|
expr_t *earg;
|
||||||
|
expr_t *parm;
|
||||||
opcode_t *op;
|
opcode_t *op;
|
||||||
int count = 0, ind;
|
int count = 0, ind;
|
||||||
|
|
||||||
|
@ -214,17 +215,34 @@ emit_function_call (expr_t *e, def_t *dest)
|
||||||
ind = count;
|
ind = count;
|
||||||
for (earg = e->e.expr.e2; earg; earg = earg->next) {
|
for (earg = e->e.expr.e2; earg; earg = earg->next) {
|
||||||
ind--;
|
ind--;
|
||||||
parm = emit_sub_expr (new_param_expr (get_type (earg), ind), 0);
|
parm = new_param_expr (get_type (earg), ind);
|
||||||
if (parm->type->type == ev_struct) {
|
if (extract_type (parm) == ev_struct) {
|
||||||
expr_t *a = assign_expr (new_def_expr (parm), earg);
|
expr_t *a = assign_expr (parm, earg);
|
||||||
a->line = e->line;
|
a->line = e->line;
|
||||||
a->file = e->file;
|
a->file = e->file;
|
||||||
emit_expr (a);
|
emit_expr (a);
|
||||||
} else {
|
} else {
|
||||||
arg = emit_sub_expr (earg, parm);
|
if (options.code.vector_calls && earg->type == ex_vector) {
|
||||||
if (arg != parm) {
|
expr_t *a, *v, *n;
|
||||||
op = opcode_find ("=", arg->type, arg->type, &type_void);
|
int i;
|
||||||
emit_statement (e, op, arg, parm, 0);
|
static const char *names[] = {"x", "y", "z"};
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
n = new_name_expr (names[i]);
|
||||||
|
v = new_float_expr (earg->e.vector_val[i]);
|
||||||
|
a = assign_expr (binary_expr ('.', parm, n), v);
|
||||||
|
parm = new_param_expr (get_type (earg), ind);
|
||||||
|
a->line = e->line;
|
||||||
|
a->file = e->file;
|
||||||
|
emit_expr (a);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p = emit_sub_expr (parm, 0);
|
||||||
|
arg = emit_sub_expr (earg, p);
|
||||||
|
if (arg != p) {
|
||||||
|
op = opcode_find ("=", arg->type, arg->type, &type_void);
|
||||||
|
emit_statement (e, op, arg, p, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -953,7 +953,7 @@ field_expr (expr_t *e1, expr_t *e2)
|
||||||
break;
|
break;
|
||||||
case ev_vector:
|
case ev_vector:
|
||||||
case ev_quat:
|
case ev_quat:
|
||||||
if (!options.traditional && e2->type == ex_name) {
|
if (e2->type == ex_name) {
|
||||||
if (t1->type == ev_quat) {
|
if (t1->type == ev_quat) {
|
||||||
field = struct_find_field (quaternion_struct,
|
field = struct_find_field (quaternion_struct,
|
||||||
e2->e.string_val);
|
e2->e.string_val);
|
||||||
|
|
|
@ -281,6 +281,8 @@ DecodeArgs (int argc, char **argv)
|
||||||
options.code.short_circuit = flag;
|
options.code.short_circuit = flag;
|
||||||
} else if (!(strcasecmp (temp, "fast-float"))) {
|
} else if (!(strcasecmp (temp, "fast-float"))) {
|
||||||
options.code.fast_float = flag;
|
options.code.fast_float = flag;
|
||||||
|
} else if (!(strcasecmp (temp, "vector-calls"))) {
|
||||||
|
options.code.vector_calls = flag;
|
||||||
} else if (!(strcasecmp (temp, "v6only"))) {
|
} else if (!(strcasecmp (temp, "v6only"))) {
|
||||||
if (flag)
|
if (flag)
|
||||||
options.code.progsversion = PROG_ID_VERSION;
|
options.code.progsversion = PROG_ID_VERSION;
|
||||||
|
|
|
@ -656,6 +656,12 @@ init_types (void)
|
||||||
new_struct_field (strct, &type_integer, "integer_val", vis_public);
|
new_struct_field (strct, &type_integer, "integer_val", vis_public);
|
||||||
new_struct_field (strct, &type_uinteger, "uinteger_val", vis_public);
|
new_struct_field (strct, &type_uinteger, "uinteger_val", vis_public);
|
||||||
|
|
||||||
|
strct = vector_struct = get_struct (0, 1);
|
||||||
|
init_struct (strct, new_type (), str_struct, 0);
|
||||||
|
new_struct_field (strct, &type_float, "x", vis_public);
|
||||||
|
new_struct_field (strct, &type_float, "y", vis_public);
|
||||||
|
new_struct_field (strct, &type_float, "z", vis_public);
|
||||||
|
|
||||||
if (options.traditional)
|
if (options.traditional)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -666,12 +672,6 @@ init_types (void)
|
||||||
strct = type_param.s.strct;
|
strct = type_param.s.strct;
|
||||||
new_struct_field (strct, &type_quaternion, "quaternion_val", vis_public);
|
new_struct_field (strct, &type_quaternion, "quaternion_val", vis_public);
|
||||||
|
|
||||||
strct = vector_struct = get_struct (0, 1);
|
|
||||||
init_struct (strct, new_type (), str_struct, 0);
|
|
||||||
new_struct_field (strct, &type_float, "x", vis_public);
|
|
||||||
new_struct_field (strct, &type_float, "y", vis_public);
|
|
||||||
new_struct_field (strct, &type_float, "z", vis_public);
|
|
||||||
|
|
||||||
strct = quaternion_struct = get_struct (0, 1);
|
strct = quaternion_struct = get_struct (0, 1);
|
||||||
init_struct (strct, new_type (), str_struct, 0);
|
init_struct (strct, new_type (), str_struct, 0);
|
||||||
new_struct_field (strct, &type_float, "s", vis_public);
|
new_struct_field (strct, &type_float, "s", vis_public);
|
||||||
|
|
Loading…
Reference in a new issue