Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Compiler_IR_Lowering::Module_Builder Struct Reference
module nullptr
Collaboration diagram for Aleph::Compiler_IR_Lowering::Module_Builder:
[legend]

Public Member Functions

Compiler_IR_Function & function (Compiler_IR_Function_Id id) const
 
Compiler_IR_Function_Id find_function_id (const std::string &name) const noexcept
 
Compiler_IR_Global_Slot_Id find_global_slot_id (const std::string &name) const noexcept
 
Compiler_IR_Global_Slot_Id add_global_slot (const std::string &name, const Compiler_Type_Id type_id, const Source_Span &span) const
 
Compiler_IR_Function_Id predeclare_function (const Compiler_HIR_Function *hir_function)
 
Compiler_IR_Block_Id ensure_block (Compiler_IR_Function &function, Compiler_IR_Block_Id current)
 
Compiler_IR_Value_Id emit_unit_constant (Compiler_IR_Function &function, const Compiler_IR_Block_Id block_id, const Source_Span &span) const
 
Compiler_IR_Value_Id lower_expr (Compiler_IR_Function &function, const Compiler_HIR_Expr *expr, const Compiler_IR_Block_Id block_id, const DynArray< Compiler_IR_Detail::Scope_Frame > &scopes)
 
Compiler_IR_Block_Id lower_stmt (Compiler_IR_Function &function, const Compiler_HIR_Stmt *stmt, Compiler_IR_Block_Id current, DynArray< Compiler_IR_Detail::Scope_Frame > &scopes, DynArray< std::pair< Compiler_IR_Block_Id, Compiler_IR_Block_Id > > &loops)
 
void preload_global_bindings (DynArray< Compiler_IR_Detail::Scope_Frame > &scopes) const
 
void lower_function_body (Compiler_IR_Function &function, const DynArray< Compiler_HIR_Stmt * > &statements)
 

Static Public Member Functions

static Compiler_IR_Block & block (Compiler_IR_Function &function, const Compiler_IR_Block_Id id)
 
static void merge_span (Source_Span &dst, const Source_Span &src)
 
static Compiler_IR_Block_Id create_block (Compiler_IR_Function &function, std::string label)
 
static void add_edge (Compiler_IR_Function &function, const Compiler_IR_Block_Id from, const Compiler_IR_Block_Id to)
 
static Compiler_IR_Value_Id next_value (Compiler_IR_Function &function) noexcept
 
static Compiler_IR_Local_Slot_Id add_local_slot (Compiler_IR_Function &function, const Compiler_IR_Slot_Kind kind, const std::string &name, const Compiler_Type_Id type_id, const Source_Span &span)
 
static void emit_instruction (Compiler_IR_Function &function, const Compiler_IR_Block_Id block_id, Compiler_IR_Instruction instruction)
 
static void set_jump (Compiler_IR_Function &function, const Compiler_IR_Block_Id from, const Compiler_IR_Block_Id to, const Source_Span &span={})
 
static void set_branch (Compiler_IR_Function &function, const Compiler_IR_Block_Id from, const Compiler_IR_Value_Id condition, const Source_Span &span, const Compiler_IR_Block_Id then_block, const Compiler_IR_Block_Id else_block)
 
static void set_return (Compiler_IR_Function &function, const Compiler_IR_Block_Id from, const Compiler_IR_Value_Id value, const Source_Span &span={})
 
static void set_exit (Compiler_IR_Function &function, const Compiler_IR_Block_Id id)
 
static void set_unreachable (Compiler_IR_Function &function, const Compiler_IR_Block_Id id, const Source_Span &span={})
 
static void enter_scope (DynArray< Compiler_IR_Detail::Scope_Frame > &scopes)
 
static void leave_scope (DynArray< Compiler_IR_Detail::Scope_Frame > &scopes)
 
static void bind (DynArray< Compiler_IR_Detail::Scope_Frame > &scopes, const std::string &name, const Compiler_IR_Detail::Binding &binding)
 
static Compiler_IR_Detail::Binding lookup (const DynArray< Compiler_IR_Detail::Scope_Frame > &scopes, const std::string &name)
 

Public Attributes

const Compiler_HIR_Module * hir = nullptr
 
Compiler_IR_Context * ctx = nullptr
 
const Compiler_Type_Context * types = nullptr
 
size_t if_counter = 0
 
size_t while_counter = 0
 
size_t dead_counter = 0
 
DynArray< std::pair< std::string, Compiler_IR_Function_Id > > function_ids
 

Detailed Description

Definition at line 74 of file Compiler_IR_Lowering_MVP.H.

Member Function Documentation

◆ add_edge()

static void Aleph::Compiler_IR_Lowering::Module_Builder::add_edge ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  from,
const Compiler_IR_Block_Id  to 
)
inlinestatic

◆ add_global_slot()

Compiler_IR_Global_Slot_Id Aleph::Compiler_IR_Lowering::Module_Builder::add_global_slot ( const std::string &  name,
const Compiler_Type_Id  type_id,
const Source_Span &  span 
) const
inline

◆ add_local_slot()

static Compiler_IR_Local_Slot_Id Aleph::Compiler_IR_Lowering::Module_Builder::add_local_slot ( Compiler_IR_Function &  function,
const Compiler_IR_Slot_Kind  kind,
const std::string &  name,
const Compiler_Type_Id  type_id,
const Source_Span &  span 
)
inlinestatic

◆ bind()

◆ block()

static Compiler_IR_Block & Aleph::Compiler_IR_Lowering::Module_Builder::block ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  id 
)
inlinestatic

◆ create_block()

static Compiler_IR_Block_Id Aleph::Compiler_IR_Lowering::Module_Builder::create_block ( Compiler_IR_Function &  function,
std::string  label 
)
inlinestatic

◆ emit_instruction()

static void Aleph::Compiler_IR_Lowering::Module_Builder::emit_instruction ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  block_id,
Compiler_IR_Instruction  instruction 
)
inlinestatic

◆ emit_unit_constant()

◆ ensure_block()

Compiler_IR_Block_Id Aleph::Compiler_IR_Lowering::Module_Builder::ensure_block ( Compiler_IR_Function &  function,
Compiler_IR_Block_Id  current 
)
inline

◆ enter_scope()

static void Aleph::Compiler_IR_Lowering::Module_Builder::enter_scope ( DynArray< Compiler_IR_Detail::Scope_Frame > &  scopes)
inlinestatic

◆ find_function_id()

Compiler_IR_Function_Id Aleph::Compiler_IR_Lowering::Module_Builder::find_function_id ( const std::string &  name) const
inlinenoexcept

◆ find_global_slot_id()

Compiler_IR_Global_Slot_Id Aleph::Compiler_IR_Lowering::Module_Builder::find_global_slot_id ( const std::string &  name) const
inlinenoexcept

Definition at line 98 of file Compiler_IR_Lowering_MVP.H.

References Aleph::compiler_ir_invalid_id().

Referenced by lower_stmt().

◆ function()

◆ leave_scope()

static void Aleph::Compiler_IR_Lowering::Module_Builder::leave_scope ( DynArray< Compiler_IR_Detail::Scope_Frame > &  scopes)
inlinestatic

◆ lookup()

static Compiler_IR_Detail::Binding Aleph::Compiler_IR_Lowering::Module_Builder::lookup ( const DynArray< Compiler_IR_Detail::Scope_Frame > &  scopes,
const std::string &  name 
)
inlinestatic

Definition at line 299 of file Compiler_IR_Lowering_MVP.H.

References Aleph::DynArray< T >::access(), and Aleph::DynArray< T >::size().

Referenced by lower_expr().

◆ lower_expr()

Compiler_IR_Value_Id Aleph::Compiler_IR_Lowering::Module_Builder::lower_expr ( Compiler_IR_Function &  function,
const Compiler_HIR_Expr *  expr,
const Compiler_IR_Block_Id  block_id,
const DynArray< Compiler_IR_Detail::Scope_Frame > &  scopes 
)
inline

◆ lower_function_body()

◆ lower_stmt()

Compiler_IR_Block_Id Aleph::Compiler_IR_Lowering::Module_Builder::lower_stmt ( Compiler_IR_Function &  function,
const Compiler_HIR_Stmt *  stmt,
Compiler_IR_Block_Id  current,
DynArray< Compiler_IR_Detail::Scope_Frame > &  scopes,
DynArray< std::pair< Compiler_IR_Block_Id, Compiler_IR_Block_Id > > &  loops 
)
inline

◆ merge_span()

static void Aleph::Compiler_IR_Lowering::Module_Builder::merge_span ( Source_Span &  dst,
const Source_Span &  src 
)
inlinestatic

◆ next_value()

static Compiler_IR_Value_Id Aleph::Compiler_IR_Lowering::Module_Builder::next_value ( Compiler_IR_Function &  function)
inlinestaticnoexcept

◆ predeclare_function()

◆ preload_global_bindings()

void Aleph::Compiler_IR_Lowering::Module_Builder::preload_global_bindings ( DynArray< Compiler_IR_Detail::Scope_Frame > &  scopes) const
inline

◆ set_branch()

static void Aleph::Compiler_IR_Lowering::Module_Builder::set_branch ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  from,
const Compiler_IR_Value_Id  condition,
const Source_Span &  span,
const Compiler_IR_Block_Id  then_block,
const Compiler_IR_Block_Id  else_block 
)
inlinestatic

◆ set_exit()

static void Aleph::Compiler_IR_Lowering::Module_Builder::set_exit ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  id 
)
inlinestatic

◆ set_jump()

static void Aleph::Compiler_IR_Lowering::Module_Builder::set_jump ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  from,
const Compiler_IR_Block_Id  to,
const Source_Span &  span = {} 
)
inlinestatic

Definition at line 206 of file Compiler_IR_Lowering_MVP.H.

Referenced by lower_function_body(), and lower_stmt().

◆ set_return()

static void Aleph::Compiler_IR_Lowering::Module_Builder::set_return ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  from,
const Compiler_IR_Value_Id  value,
const Source_Span &  span = {} 
)
inlinestatic

Definition at line 238 of file Compiler_IR_Lowering_MVP.H.

Referenced by lower_stmt().

◆ set_unreachable()

static void Aleph::Compiler_IR_Lowering::Module_Builder::set_unreachable ( Compiler_IR_Function &  function,
const Compiler_IR_Block_Id  id,
const Source_Span &  span = {} 
)
inlinestatic

Definition at line 259 of file Compiler_IR_Lowering_MVP.H.

Referenced by lower_stmt().

Member Data Documentation

◆ ctx

Compiler_IR_Context* Aleph::Compiler_IR_Lowering::Module_Builder::ctx = nullptr

Definition at line 78 of file Compiler_IR_Lowering_MVP.H.

Referenced by predeclare_function().

◆ dead_counter

size_t Aleph::Compiler_IR_Lowering::Module_Builder::dead_counter = 0

Definition at line 82 of file Compiler_IR_Lowering_MVP.H.

Referenced by ensure_block().

◆ function_ids

DynArray<std::pair<std::string, Compiler_IR_Function_Id> > Aleph::Compiler_IR_Lowering::Module_Builder::function_ids

◆ hir

const Compiler_HIR_Module* Aleph::Compiler_IR_Lowering::Module_Builder::hir = nullptr

Definition at line 77 of file Compiler_IR_Lowering_MVP.H.

◆ if_counter

size_t Aleph::Compiler_IR_Lowering::Module_Builder::if_counter = 0

Definition at line 80 of file Compiler_IR_Lowering_MVP.H.

Referenced by lower_stmt().

◆ types

const Compiler_Type_Context* Aleph::Compiler_IR_Lowering::Module_Builder::types = nullptr

Definition at line 79 of file Compiler_IR_Lowering_MVP.H.

Referenced by emit_unit_constant().

◆ while_counter

size_t Aleph::Compiler_IR_Lowering::Module_Builder::while_counter = 0

Definition at line 81 of file Compiler_IR_Lowering_MVP.H.

Referenced by lower_stmt().


The documentation for this struct was generated from the following file: