|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Small reusable helper that allocates and connects HIR nodes. More...
#include <Compiler_HIR_Builder.H>
Static Public Member Functions | |
| static void | append_function (Compiler_HIR_Module &module, Compiler_HIR_Function *function) |
Appends one function to module and updates the module span. | |
| static void | append_top_level_statement (Compiler_HIR_Module &module, Compiler_HIR_Stmt *stmt) |
Appends one top-level statement to module and updates the span. | |
| static void | append_statement (Compiler_HIR_Block_Stmt &block, Compiler_HIR_Stmt *stmt) |
Appends one nested statement to block and updates the span. | |
| static void | set_body (Compiler_HIR_Function &function, Compiler_HIR_Block_Stmt *body) noexcept |
Attaches body to function and refreshes the aggregate span. | |
| static Compiler_HIR_Param & | add_parameter (Compiler_HIR_Function &function, std::string name, const Compiler_Type_Id type_id, const Source_Span &span={}) |
Adds one parameter metadata entry to function. | |
| static void | append_argument (Compiler_HIR_Call_Expr &call, Compiler_HIR_Expr *argument) |
Appends one argument to call and updates the aggregate span. | |
Static Private Member Functions | |
| static void | merge_span (Source_Span &dst, const Source_Span &src) noexcept |
Private Attributes | |
| Compiler_HIR_Context * | hir = nullptr |
Small reusable helper that allocates and connects HIR nodes.
The builder is intentionally lightweight: it owns no memory itself and only wraps a Compiler_HIR_Context. All nodes remain owned by the associated context.
Definition at line 53 of file Compiler_HIR_Builder.H.
|
inlineexplicitnoexcept |
Builds HIR nodes inside context.
Definition at line 71 of file Compiler_HIR_Builder.H.
|
inlinestatic |
Adds one parameter metadata entry to function.
Definition at line 139 of file Compiler_HIR_Builder.H.
|
inlinestatic |
Appends one argument to call and updates the aggregate span.
Definition at line 244 of file Compiler_HIR_Builder.H.
References ah_runtime_error_unless, Aleph::Compiler_HIR_Call_Expr::arguments, Aleph::blossom_maximum_cardinality_matching(), merge_span(), and Aleph::Compiler_HIR_Node::span.
|
inlinestatic |
Appends one function to module and updates the module span.
Definition at line 86 of file Compiler_HIR_Builder.H.
References ah_runtime_error_unless, merge_span(), and Aleph::Compiler_HIR_Node::span.
|
inlinestatic |
Appends one nested statement to block and updates the span.
Definition at line 111 of file Compiler_HIR_Builder.H.
References ah_runtime_error_unless, merge_span(), Aleph::Compiler_HIR_Node::span, and Aleph::Compiler_SSA_Block::span.
|
inlinestatic |
Appends one top-level statement to module and updates the span.
Definition at line 95 of file Compiler_HIR_Builder.H.
References ah_runtime_error_unless, merge_span(), and Aleph::Compiler_HIR_Node::span.
|
inlinenoexcept |
Returns the underlying ownership context.
Definition at line 74 of file Compiler_HIR_Builder.H.
References hir.
|
inline |
Allocates one binary expression.
Definition at line 225 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one structured block statement.
Definition at line 104 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one boolean constant expression.
Definition at line 174 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one break statement.
Definition at line 300 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one call expression without arguments.
Definition at line 235 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one character constant expression.
Definition at line 200 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one generic constant expression.
Definition at line 157 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one continue statement.
Definition at line 306 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one expression statement.
Definition at line 259 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one function node without inserting it into any module.
Definition at line 120 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one structured conditional statement.
Definition at line 282 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one integer constant expression.
Definition at line 183 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one invalid expression placeholder.
Definition at line 150 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one invalid statement placeholder.
Definition at line 253 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one lexical binding statement.
Definition at line 265 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one empty module.
Definition at line 80 of file Compiler_HIR_Builder.H.
Referenced by main().
|
inline |
Allocates one return statement.
Definition at line 275 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one string constant expression.
Definition at line 192 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one unary expression.
Definition at line 216 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one unit constant expression.
Definition at line 167 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one variable-reference expression.
Definition at line 208 of file Compiler_HIR_Builder.H.
|
inline |
Allocates one structured while-loop statement.
Definition at line 292 of file Compiler_HIR_Builder.H.
|
inlinestaticprivatenoexcept |
Definition at line 57 of file Compiler_HIR_Builder.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::compiler_hir_merge_spans().
Referenced by append_argument(), append_function(), append_statement(), append_top_level_statement(), and set_body().
|
inlinestaticnoexcept |
Attaches body to function and refreshes the aggregate span.
Definition at line 130 of file Compiler_HIR_Builder.H.
References merge_span(), and Aleph::Compiler_HIR_Node::span.
|
private |
Definition at line 55 of file Compiler_HIR_Builder.H.
Referenced by context().