1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

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.
This commit is contained in:
Dan Klishch 2023-10-01 22:32:10 -04:00 committed by Andrew Kaster
parent 23164bc570
commit 0aeb7a26e9
11 changed files with 173 additions and 13 deletions

View file

@ -37,9 +37,14 @@ class FunctionDefinition : public FunctionDeclaration {
public:
FunctionDefinition(StringView name, Tree ast);
void reindex_ssa_variables();
Tree m_ast;
VariableDeclarationRef m_return_value;
HashMap<StringView, VariableDeclarationRef> m_local_variables;
NamedVariableDeclarationRef m_return_value;
// NOTE: The hash map here is ordered since we do not want random hash changes to break our test
// expectations (looking at you, SipHash).
OrderedHashMap<StringView, NamedVariableDeclarationRef> m_local_variables;
Vector<SSAVariableDeclarationRef> m_local_ssa_variables;
RefPtr<ControlFlowGraph> m_cfg;
};