Dan Klishch
7f47340c82
JSSpecCompiler: Create FunctionDeclaration
s for all external functions
2024-01-14 16:05:51 -07:00
Dan Klishch
0aeb7a26e9
JSSpecCompiler: Prepare for building SSA
...
This commit introduces NamedVariableDeclaration and
SSAVariableDeclaration and allows storing both of them in Variable node.
Also, it adds additional structures in FunctionDefinition and
BasicBlock, which will be used to store SSA form related information.
2024-01-04 12:06:56 -07:00
Dan Klishch
12072dbac5
JSSpecCompiler: Add control flow graph simplification pass
...
It removes empty `BasicBlock`s with an unconditional jump continuation
and then removes unreferenced blocks from the graph.
2024-01-04 12:06:56 -07:00
Dan Klishch
567b1f6e7c
JSSpecCompiler: Adopt more C++ terminology
...
Let's not use strange names like `ExecutionContext`, which nobody will
understand in the future.
2023-10-02 21:15:08 +02:00
Dan Klishch
14a86c8fd6
JSSpecCompiler: Elide nested TreeList
nodes
2023-10-02 21:15:08 +02:00
Dan Klishch
67e07fa4e2
JSSpecCompiler: Introduce ControlFlowOperator nodes
2023-09-17 16:04:42 -06:00
Dan Klishch
81519975c5
JSSpecCompiler: Add reference resolving pass
...
It replaces UnresolvedReference with Variable, FunctionPointer, or
SlotName nodes. Also, it gathers all variable names from their
declarations.
2023-09-17 16:04:42 -06:00
Dan Klishch
326bac19d9
JSSpecCompiler: Make nodes inherit from Statement or Expression
...
The distinction between them will become important during CFG building.
2023-09-17 16:04:42 -06:00
Dan Klishch
ed5ef4da6d
JSSpecCompiler: Make clang-tidy happier, no functional changes
2023-09-17 16:04:42 -06:00
Dan Klishch
4c4e1e1aed
JSSpecCompiler: Add if branch merging pass
...
It merges standalone IfBranch/ElseIfBranch nodes into IfElseIfChain
nodes. This will ease CFG generation later.
2023-09-09 11:20:43 -06:00
Dan Klishch
092ed1cc8a
JSSpecCompiler: Allow storing NullableTree
s in nodes
...
And use this in ElseIfBranch node.
2023-09-09 11:20:43 -06:00
Dan Klishch
4eede5282c
JSSpecCompiler: Allow storing error text in ErrorNode
...
This will be the main way to communicate errors from compilation passes.
2023-09-09 11:20:43 -06:00
Dan Klishch
1c4cd34320
JSSpecCompiler: Restrict usage of NodeSubtreePointer
...
This class stores a non-owning raw pointer to a member of `Node`, so
extra care is needed to ensure that referenced `Node`s will be alive
by the time `NodeSubtreePointer` is used. Since we only need to use this
class while traversing AST in `RecursiveASTVisitor`, access to class
methods can be restricted using `Badge<RecursiveASTVisitor>`.
2023-09-09 11:20:43 -06:00
Dan Klishch
198591cc20
JSSpecCompiler: Add infrastructure to run compiler passes on AST
2023-09-02 19:57:06 +02:00
Dan Klishch
cd8f4aaa7d
JSSpecCompiler: Introduce Function and ExecutionContext classes
...
Currently, they are not extremely useful, but the plan is to store
all function-local state in JSSpecCompiler::Function and all
"translation unit" state in ExecutionContext.
2023-09-02 19:57:06 +02:00
Dan Klishch
5846470a5f
JSSpecCompiler: Add stubs for AST types
2023-08-31 11:00:31 +02:00