@@ -22,7 +22,7 @@ public:
|
|||||||
ir_generator(const ir_generator&) = delete;
|
ir_generator(const ir_generator&) = delete;
|
||||||
ir_generator& operator=(const ir_generator&) = delete;
|
ir_generator& operator=(const ir_generator&) = delete;
|
||||||
public:
|
public:
|
||||||
furlang::ir::module&& move_module() { return std::move(m_module); }
|
furlang::ir::mod&& move_module() { return std::move(m_module); }
|
||||||
public:
|
public:
|
||||||
void visit(const ast::function_definition_node& funcDef) override;
|
void visit(const ast::function_definition_node& funcDef) override;
|
||||||
void visit(const ast::return_statement_node& returnStmt) override;
|
void visit(const ast::return_statement_node& returnStmt) override;
|
||||||
@@ -45,7 +45,7 @@ private:
|
|||||||
|
|
||||||
furlang::ir::block_index push_block(bool validate = true);
|
furlang::ir::block_index push_block(bool validate = true);
|
||||||
private:
|
private:
|
||||||
furlang::ir::module m_module;
|
furlang::ir::mod m_module;
|
||||||
std::unique_ptr<furlang::ir::function> m_currentFunction;
|
std::unique_ptr<furlang::ir::function> m_currentFunction;
|
||||||
std::shared_ptr<furlang::ir::block> m_currentBlock;
|
std::shared_ptr<furlang::ir::block> m_currentBlock;
|
||||||
ir_register m_registerCounter = 0;
|
ir_register m_registerCounter = 0;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace front {
|
|||||||
class ssa {
|
class ssa {
|
||||||
using block_map_t = std::unordered_map<furlang::ir::block_index, std::vector<furlang::ir::block_index>>;
|
using block_map_t = std::unordered_map<furlang::ir::block_index, std::vector<furlang::ir::block_index>>;
|
||||||
public:
|
public:
|
||||||
static void optimize(furlang::ir::module& mod);
|
static void optimize(furlang::ir::mod& mod);
|
||||||
private:
|
private:
|
||||||
static void optimize(const std::unique_ptr<furlang::ir::function>& func);
|
static void optimize(const std::unique_ptr<furlang::ir::function>& func);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace furc::front {
|
namespace furc::front {
|
||||||
|
|
||||||
void ssa::optimize(furlang::ir::module& mod) {
|
void ssa::optimize(furlang::ir::mod& mod) {
|
||||||
for (const auto& func : mod.functions()) {
|
for (const auto& func : mod.functions()) {
|
||||||
ssa::optimize(func);
|
ssa::optimize(func);
|
||||||
ssa::constant_propagation(func);
|
ssa::constant_propagation(func);
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ namespace ir {
|
|||||||
/**
|
/**
|
||||||
* @brief IR module
|
* @brief IR module
|
||||||
*/
|
*/
|
||||||
class module {
|
class mod {
|
||||||
public:
|
public:
|
||||||
using value_type = std::unique_ptr<function>; /**< Value type. */
|
using value_type = std::unique_ptr<function>; /**< Value type. */
|
||||||
public:
|
public:
|
||||||
module() = default;
|
mod() = default;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Pushes and returns a new IR function.
|
* @brief Pushes and returns a new IR function.
|
||||||
@@ -49,4 +49,4 @@ private:
|
|||||||
} // namespace ir
|
} // namespace ir
|
||||||
} // namespace furlang
|
} // namespace furlang
|
||||||
|
|
||||||
#endif // FURLANG_IR_MODULE_HPP
|
#endif // FURLANG_IR_MODULE_HPP
|
||||||
|
|||||||
Reference in New Issue
Block a user