mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-07 00:11:13 +00:00
Possibly get vector calls working.
This commit is contained in:
parent
52b561f7cb
commit
bcb2667b73
1 changed files with 41 additions and 13 deletions
|
@ -272,6 +272,28 @@ statement_assign (sblock_t *sblock, expr_t *e)
|
||||||
return sblock;
|
return sblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static sblock_t *
|
||||||
|
vector_call (sblock_t *sblock, expr_t *earg, expr_t *param, int ind,
|
||||||
|
operand_t **op)
|
||||||
|
{
|
||||||
|
expr_t *a, *v, *n;
|
||||||
|
int i;
|
||||||
|
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.value.v.vector_val[i]);
|
||||||
|
a = assign_expr (binary_expr ('.', param, n), v);
|
||||||
|
param = new_param_expr (get_type (earg), ind);
|
||||||
|
a->line = earg->line;
|
||||||
|
a->file = earg->file;
|
||||||
|
sblock = statement_slist (sblock, a);
|
||||||
|
}
|
||||||
|
sblock = statement_subexpr (sblock, param, op);
|
||||||
|
return sblock;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static sblock_t *
|
static sblock_t *
|
||||||
expr_call (sblock_t *sblock, expr_t *call, operand_t **op)
|
expr_call (sblock_t *sblock, expr_t *call, operand_t **op)
|
||||||
{
|
{
|
||||||
|
@ -295,9 +317,10 @@ expr_call (sblock_t *sblock, expr_t *call, operand_t **op)
|
||||||
if (count && options.code.progsversion != PROG_ID_VERSION && ind < 2) {
|
if (count && options.code.progsversion != PROG_ID_VERSION && ind < 2) {
|
||||||
pref = "R";
|
pref = "R";
|
||||||
sblock = statement_subexpr (sblock, param, &arguments[ind]);
|
sblock = statement_subexpr (sblock, param, &arguments[ind]);
|
||||||
//if (options.code.vector_calls && is_vector_val (a)) FIXME
|
if (options.code.vector_calls && a->type == ex_value
|
||||||
// sblock = vector_call (sblock, a, param, ind, &arguments[ind]);
|
&& a->e.value.type == ev_vector)
|
||||||
//else
|
sblock = vector_call (sblock, a, param, ind, &arguments[ind]);
|
||||||
|
else
|
||||||
sblock = statement_subexpr (sblock, a, &arguments[ind]);
|
sblock = statement_subexpr (sblock, a, &arguments[ind]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -307,16 +330,21 @@ expr_call (sblock_t *sblock, expr_t *call, operand_t **op)
|
||||||
mov->file = a->file;
|
mov->file = a->file;
|
||||||
sblock = statement_slist (sblock, mov);
|
sblock = statement_slist (sblock, mov);
|
||||||
} else {
|
} else {
|
||||||
operand_t *p;
|
if (options.code.vector_calls && a->type == ex_value
|
||||||
operand_t *arg;
|
&& a->e.value.type == ev_vector) {
|
||||||
sblock = statement_subexpr (sblock, param, &p);
|
sblock = vector_call (sblock, a, param, ind, 0);
|
||||||
arg = p;
|
} else {
|
||||||
sblock = statement_subexpr (sblock, a, &arg);
|
operand_t *p;
|
||||||
if (arg != p) {
|
operand_t *arg;
|
||||||
s = new_statement ("=");
|
sblock = statement_subexpr (sblock, param, &p);
|
||||||
s->opa = arg;
|
arg = p;
|
||||||
s->opb = p;
|
sblock = statement_subexpr (sblock, a, &arg);
|
||||||
sblock_add_statement (sblock, s);
|
if (arg != p) {
|
||||||
|
s = new_statement ("=");
|
||||||
|
s->opa = arg;
|
||||||
|
s->opb = p;
|
||||||
|
sblock_add_statement (sblock, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue