mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-18 17:41:47 +00:00
Handle double negation case specially. Update TODO
This commit is contained in:
parent
7249c2ec18
commit
03b56bd41f
2 changed files with 7 additions and 13 deletions
13
TODO
13
TODO
|
@ -29,21 +29,10 @@ Optimizations:
|
||||||
Which can be replaced with calls to a shared subroutine. To
|
Which can be replaced with calls to a shared subroutine. To
|
||||||
reduce duplicated code. (Size optimization)
|
reduce duplicated code. (Size optimization)
|
||||||
|
|
||||||
The following are optimizations that can be implemented anywhere, ideally
|
|
||||||
these are functional language optimizations.
|
|
||||||
|
|
||||||
Removing Recursion:
|
|
||||||
Tail recursive algorithms can be converted to iteration, which
|
|
||||||
does not have to have call overhead.
|
|
||||||
|
|
||||||
|
|
||||||
Language Features:
|
Language Features:
|
||||||
The following are language features that we'd like to see implemented in the
|
The following are language features that we'd like to see implemented in the
|
||||||
future.
|
future.
|
||||||
|
|
||||||
Enumerations:
|
|
||||||
Like C
|
|
||||||
|
|
||||||
AST Macros:
|
AST Macros:
|
||||||
Macros with sanity. Not textual substiution.
|
Macros with sanity. Not textual substiution.
|
||||||
|
|
||||||
|
@ -153,5 +142,3 @@ Testsuite:
|
||||||
Assembler:
|
Assembler:
|
||||||
Possibly support for a future assembler for QCASM. But we're not
|
Possibly support for a future assembler for QCASM. But we're not
|
||||||
entirely sure if it makes sense.
|
entirely sure if it makes sense.
|
||||||
|
|
||||||
|
|
||||||
|
|
7
ast.c
7
ast.c
|
@ -518,8 +518,15 @@ ast_unary* ast_unary_new(lex_ctx_t ctx, int op,
|
||||||
self->op = op;
|
self->op = op;
|
||||||
self->operand = expr;
|
self->operand = expr;
|
||||||
|
|
||||||
|
|
||||||
if (ast_istype(expr, ast_unary) && OPTS_OPTIMIZATION(OPTIM_PEEPHOLE)) {
|
if (ast_istype(expr, ast_unary) && OPTS_OPTIMIZATION(OPTIM_PEEPHOLE)) {
|
||||||
ast_unary *prev = (ast_unary*)((ast_unary*)expr)->operand;
|
ast_unary *prev = (ast_unary*)((ast_unary*)expr)->operand;
|
||||||
|
ast_unary *cur = (ast_unary*)expr;
|
||||||
|
|
||||||
|
/* Handle for double negation */
|
||||||
|
if (cur->op == op && (op >= VINSTR_NEG_F && op <= VINSTR_NEG_V))
|
||||||
|
prev = cur;
|
||||||
|
|
||||||
if (ast_istype(prev, ast_unary)) {
|
if (ast_istype(prev, ast_unary)) {
|
||||||
ast_expression_delete((ast_expression*)self);
|
ast_expression_delete((ast_expression*)self);
|
||||||
mem_d(self);
|
mem_d(self);
|
||||||
|
|
Loading…
Reference in a new issue