Which can be replaced with calls to a shared subroutine. To
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:
The following are language features that we'd like to see implemented in the
future.
- Enumerations:
- Like C
-
AST Macros:
Macros with sanity. Not textual substiution.
Assembler:
Possibly support for a future assembler for QCASM. But we're not
entirely sure if it makes sense.
-
-
self->op = op;
self->operand = expr;
+
if (ast_istype(expr, ast_unary) && OPTS_OPTIMIZATION(OPTIM_PEEPHOLE)) {
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)) {
ast_expression_delete((ast_expression*)self);
mem_d(self);