/* * Copyright (c) 2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace JS::Bytecode { class Generator { public: static OwnPtr generate(ASTNode const&); Register allocate_register(); template void emit(Args&&... args) { auto instruction = make(forward(args)...); append(move(instruction)); } private: Generator(); ~Generator(); void append(NonnullOwnPtr); OwnPtr m_block; u32 m_next_register { 1 }; }; }