|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Small reusable helper that allocates and connects IR nodes. More...
#include <Compiler_IR_Builder.H>
Public Member Functions | |
| Compiler_IR_Builder (Compiler_IR_Context &context) noexcept | |
Builds IR nodes inside context. | |
| Compiler_IR_Context & | context () const noexcept |
| Returns the underlying ownership context. | |
| Compiler_IR_Module * | make_module () const |
| Allocates one empty IR module. | |
| Compiler_IR_Function * | make_function (std::string name, const Compiler_Type_Id type_id=0, const Source_Span &span={}, const Compiler_HIR_Function *source_function=nullptr) const |
| Allocates one function without inserting it into a module. | |
Static Private Member Functions | |
| static void | merge_span (Source_Span &dst, const Source_Span &src) noexcept |
| static Compiler_IR_Block & | block (Compiler_IR_Function &function, const Compiler_IR_Block_Id id) |
| static void | merge_function_span (Compiler_IR_Function &function, const Source_Span &span) noexcept |
| static void | add_edge (Compiler_IR_Function &function, const Compiler_IR_Block_Id from, const Compiler_IR_Block_Id to) |
| static Compiler_IR_Instruction & | append_instruction (Compiler_IR_Function &function, const Compiler_IR_Block_Id block_id, Compiler_IR_Instruction instruction) |
| static void | set_terminator_span (Compiler_IR_Function &function, Compiler_IR_Block &blk, const Source_Span &span) noexcept |
Private Attributes | |
| Compiler_IR_Context * | ir_ = nullptr |
Small reusable helper that allocates and connects IR nodes.
The builder keeps block successors, predecessor lists, and aggregate spans in sync while reusing an external Compiler_IR_Context for ownership.
Definition at line 52 of file Compiler_IR_Builder.H.
|
inlineexplicitnoexcept |
Builds IR nodes inside context.
Definition at line 117 of file Compiler_IR_Builder.H.
|
inlinestaticprivate |
Definition at line 80 of file Compiler_IR_Builder.H.
References block(), Aleph::blossom_maximum_cardinality_matching(), and Aleph::Compiler_IR_Detail::contains_block_id().
|
inlinestatic |
Appends one global slot to module.
Definition at line 132 of file Compiler_IR_Builder.H.
|
inlinestatic |
Appends one local or parameter slot to function.
Definition at line 185 of file Compiler_IR_Builder.H.
|
inlinestaticnoexcept |
Allocates the next explicit IR value id in function.
Definition at line 227 of file Compiler_IR_Builder.H.
References Aleph::Compiler_IR_Function::next_value_id.
|
inlinestatic |
Appends one non-top-level function to module and assigns its id.
Definition at line 163 of file Compiler_IR_Builder.H.
References ah_runtime_error_unless, and Aleph::Compiler_IR_Function::id.
|
inlinestaticprivate |
Definition at line 92 of file Compiler_IR_Builder.H.
References ah_runtime_error_unless, block(), Aleph::Compiler_IR_Detail::block_name(), Aleph::blossom_maximum_cardinality_matching(), merge_function_span(), merge_span(), and Aleph::Compiler_IR_Function::span.
|
inlinestaticprivate |
Definition at line 68 of file Compiler_IR_Builder.H.
References ah_runtime_error_unless, and Aleph::Compiler_IR_Function::blocks.
Referenced by add_edge(), append_instruction(), set_entry_block(), and set_exit_block().
|
inlinenoexcept |
Returns the underlying ownership context.
Definition at line 120 of file Compiler_IR_Builder.H.
References ir_.
|
inlinestatic |
Creates one empty block and returns its id.
Definition at line 203 of file Compiler_IR_Builder.H.
References Aleph::Compiler_IR_Function::blocks, Aleph::blossom_maximum_cardinality_matching(), and Aleph::Compiler_IR_Block::id.
|
inlinestatic |
Emits one binary instruction.
Definition at line 348 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one call instruction.
Definition at line 388 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one constant instruction.
Definition at line 234 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one function reference instruction.
Definition at line 370 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one load from a global slot.
Definition at line 274 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one load from a local or parameter slot.
Definition at line 254 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one store into a global slot.
Definition at line 311 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one store into a local or parameter slot.
Definition at line 292 of file Compiler_IR_Builder.H.
|
inlinestatic |
Emits one unary instruction.
Definition at line 328 of file Compiler_IR_Builder.H.
|
inline |
|
inline |
Allocates one empty IR module.
Definition at line 126 of file Compiler_IR_Builder.H.
References ir_, and Aleph::Compiler_IR_Context::make().
Referenced by main().
|
inlinestaticprivatenoexcept |
Definition at line 75 of file Compiler_IR_Builder.H.
References merge_span().
Referenced by append_instruction(), and set_terminator_span().
|
inlinestaticprivatenoexcept |
Definition at line 56 of file Compiler_IR_Builder.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::compiler_hir_merge_spans().
Referenced by append_instruction(), merge_function_span(), and set_terminator_span().
|
inlinestatic |
Sets one conditional branch terminator and both outgoing edges.
Definition at line 424 of file Compiler_IR_Builder.H.
|
inlinestatic |
Marks one block as the canonical entry block.
Definition at line 213 of file Compiler_IR_Builder.H.
References block(), Aleph::blossom_maximum_cardinality_matching(), and Aleph::Compiler_IR_Function::entry_block.
|
inlinestatic |
|
inlinestatic |
Marks one block as the canonical exit block.
Definition at line 220 of file Compiler_IR_Builder.H.
References block(), Aleph::blossom_maximum_cardinality_matching(), and Aleph::Compiler_IR_Function::exit_block.
|
inlinestatic |
Sets one jump terminator and predecessor/successor edge.
Definition at line 409 of file Compiler_IR_Builder.H.
|
inlinestatic |
Sets one return terminator and connects it to the exit block.
Definition at line 444 of file Compiler_IR_Builder.H.
|
inlinestaticprivatenoexcept |
Definition at line 106 of file Compiler_IR_Builder.H.
References Aleph::blossom_maximum_cardinality_matching(), merge_function_span(), and merge_span().
|
inlinestatic |
Installs one top-level function body in module.
Definition at line 174 of file Compiler_IR_Builder.H.
References ah_runtime_error_unless, Aleph::compiler_ir_invalid_id(), and Aleph::Compiler_IR_Function::id.
|
inlinestatic |
Marks one block as unreachable.
Definition at line 478 of file Compiler_IR_Builder.H.
|
private |
Definition at line 54 of file Compiler_IR_Builder.H.
Referenced by context(), and make_module().