Z / libzlang 0.29.0
C99 runtime library and the Zlang 0.29 source-to-source compiler
Loading...
Searching...
No Matches
optimizer.h
Go to the documentation of this file.
1
4
5#ifndef ZLANG_COMPILER_OPTIMIZER_H
6#define ZLANG_COMPILER_OPTIMIZER_H
7
9
10#include <stdbool.h>
11#include <stddef.h>
12#include <stdint.h>
13
14#define ZLANG_TTO_WORKLIST_CAPACITY 256U
15#define ZLANG_TTO_MAX_ROUNDS 64U
16
25
27
28/* Rewrites the mutable program in place until a fixed point is reached or the
29 caller-owned worklist budget is exhausted. Returns false only on invalid AST
30 indices; budget exhaustion leaves a valid partially optimized program. */
32
33#endif /* ZLANG_COMPILER_OPTIMIZER_H */
Flat abstract syntax tree used by the compiler.
bool zlang_optimize_program(zlang_program_t *program, zlang_optimizer_context_t *context)
Definition optimizer.c:663
#define ZLANG_TTO_WORKLIST_CAPACITY
Definition optimizer.h:14
void zlang_optimizer_context_init(zlang_optimizer_context_t *context)
Definition optimizer.c:18
Definition optimizer.h:17
size_t worklist_[ZLANG_TTO_WORKLIST_CAPACITY]
Definition optimizer.h:18
bool queued_[ZLANG_TTO_WORKLIST_CAPACITY]
Definition optimizer.h:23
uint32_t round_count_
Definition optimizer.h:22
size_t worklist_count_
Definition optimizer.h:19
size_t worklist_front_
Definition optimizer.h:20
size_t generation_
Definition optimizer.h:21
Definition ast.h:189