mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-21 18:42:53 +00:00
JSSpecCompiler: Add control flow building pass
This commit is contained in:
parent
c74e2d04d1
commit
ff44aea917
Notes:
sideshowbarker
2024-07-16 18:26:46 +09:00
Author: https://github.com/DanShaders
Commit: ff44aea917
Pull-request: https://github.com/SerenityOS/serenity/pull/22222
10 changed files with 222 additions and 2 deletions
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Dan Klishch <danilklishch@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
#include "Forward.h"
|
||||
|
||||
namespace JSSpecCompiler {
|
||||
|
||||
class BasicBlock : public RefCounted<BasicBlock> {
|
||||
public:
|
||||
BasicBlock(size_t index, NonnullRefPtr<ControlFlowOperator> continuation)
|
||||
: m_index(index)
|
||||
, m_continuation(move(continuation))
|
||||
{
|
||||
}
|
||||
|
||||
size_t m_index;
|
||||
Vector<Tree> m_expressions;
|
||||
NonnullRefPtr<ControlFlowOperator> m_continuation;
|
||||
};
|
||||
|
||||
class ControlFlowGraph : public RefCounted<ControlFlowGraph> {
|
||||
public:
|
||||
ControlFlowGraph() { }
|
||||
|
||||
size_t blocks_count() const { return blocks.size(); }
|
||||
|
||||
Vector<NonnullRefPtr<BasicBlock>> blocks;
|
||||
BasicBlockRef start_block;
|
||||
BasicBlockRef end_block;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue