mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
[qfcc] Allow more control of intrinsic functions
If `@intrinsic()` is followed by `[expr_list]` then those expresses will be used to create the intrinsic rather than the function's parameters, allowing for reordering, adding extra parameters or even complex expressions. However, only the parsing is implemented.
This commit is contained in:
parent
92b476bf04
commit
2c29dcd7d9
3 changed files with 12 additions and 0 deletions
|
@ -388,6 +388,7 @@ typedef struct {
|
|||
const expr_t *opcode;
|
||||
const type_t *res_type;
|
||||
ex_list_t operands;
|
||||
const expr_t *extra;
|
||||
} ex_intrinsic_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -473,6 +473,11 @@ print_intrinsic (dstring_t *dstr, const expr_t *e, int level, int id,
|
|||
{
|
||||
int indent = level * 2 + 2;
|
||||
|
||||
if (e->intrinsic.extra) {
|
||||
_print_expr (dstr, e->intrinsic.extra, level, id, next);
|
||||
dasprintf (dstr, "%*se_%p -> \"e_%p\" [label=\"extra\"];\n",
|
||||
indent, "", e, e->intrinsic.extra);
|
||||
}
|
||||
_print_expr (dstr, e->intrinsic.opcode, level, id, next);
|
||||
for (auto l = e->intrinsic.operands.head; l; l = l->next) {
|
||||
_print_expr (dstr, l->expr, level, id, next);
|
||||
|
|
|
@ -1253,6 +1253,12 @@ function_body
|
|||
|
||||
intrinsic
|
||||
: INTRINSIC '(' expr_list ')' { $$ = new_intrinsic_expr ($3); }
|
||||
| INTRINSIC '(' expr_list ')' vector_expr
|
||||
{
|
||||
auto e = new_intrinsic_expr ($3);
|
||||
e->intrinsic.extra = $5;
|
||||
$$ = e;
|
||||
}
|
||||
;
|
||||
|
||||
storage_class
|
||||
|
|
Loading…
Reference in a new issue