Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
SSA.H File Reference

Static single assignment form over Compiler_IR.H. More...

#include <limits>
#include <sstream>
#include <string>
#include <utility>
#include <Compiler_Dataflow.H>
#include <ah-arena.H>
#include <ah-errors.H>
#include <tpl_dynArray.H>
Include dependency graph for SSA.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::Compiler_SSA_Parameter
 SSA parameter definition that seeds renaming for one IR parameter slot. More...
 
struct  Aleph::Compiler_SSA_Phi
 Phi node merging values for one original IR local slot. More...
 
struct  Aleph::Compiler_SSA_Instruction
 One SSA instruction producing an optional explicit result value. More...
 
struct  Aleph::Compiler_SSA_Terminator
 Explicit terminator for one SSA basic block. More...
 
struct  Aleph::Compiler_SSA_Block
 One SSA basic block containing phis, instructions, and a terminator. More...
 
struct  Aleph::Compiler_SSA_Dominance_Info
 Dominance metadata computed for one SSA function. More...
 
struct  Aleph::Compiler_SSA_Function
 SSA form for one function or top-level body lowered from IR. More...
 
struct  Aleph::Compiler_SSA_Module
 SSA module sharing global slots with the source IR module. More...
 
class  Aleph::Compiler_SSA_Context
 Arena-backed ownership context for SSA functions and modules. More...
 
struct  Aleph::Compiler_SSA_Context::Owned_Object
 
struct  Aleph::Compiler_SSA_Validation_Report
 Validation report for one SSA function or module. More...
 
struct  Aleph::Compiler_SSA_Detail::Normalized_IR_Function
 
struct  Aleph::Compiler_SSA_Detail::Phi_Spec
 
struct  Aleph::Compiler_SSA_Detail::Definition_Location
 
class  Aleph::Compiler_SSA_Lowering
 Lowers non-SSA IR to SSA form for all reachable blocks. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::Compiler_SSA_Detail
 

Typedefs

using Aleph::Compiler_SSA_Value_Id = size_t
 
using Aleph::Compiler_SSA_Block_Id = size_t
 

Enumerations

enum class  Aleph::Compiler_SSA_Instruction_Kind {
  Aleph::Constant , Aleph::Load_Global , Aleph::Store_Global , Aleph::Unary ,
  Aleph::Binary , Aleph::Call , Aleph::Function_Ref
}
 Instruction kinds supported by the SSA form. More...
 

Functions

constexpr size_t Aleph::compiler_ssa_invalid_id () noexcept
 Returns the sentinel invalid SSA id.
 
const char * Aleph::compiler_ssa_instruction_kind_name (const Compiler_SSA_Instruction_Kind kind) noexcept
 Returns a stable debug name for an SSA instruction kind.
 
std::string Aleph::Compiler_SSA_Detail::block_name (const Compiler_SSA_Block_Id id)
 
std::string Aleph::Compiler_SSA_Detail::value_name (const Compiler_SSA_Value_Id id)
 
std::string Aleph::Compiler_SSA_Detail::local_slot_name (const Compiler_IR_Local_Slot_Id id)
 
std::string Aleph::Compiler_SSA_Detail::global_slot_name (const Compiler_IR_Global_Slot_Id id)
 
std::string Aleph::Compiler_SSA_Detail::function_name (const Compiler_IR_Function_Id id)
 
const char * Aleph::Compiler_SSA_Detail::token_name (const Compiler_Operator_Kind kind) noexcept
 
void Aleph::Compiler_SSA_Detail::append_indented_text (std::ostream &out, const std::string &text, const size_t indent)
 
bool Aleph::Compiler_SSA_Detail::contains_block_id (const DynArray< Compiler_SSA_Block_Id > &ids, const Compiler_SSA_Block_Id id) noexcept
 
DynArray< bool > Aleph::Compiler_SSA_Detail::compute_reachable_blocks (const Compiler_IR_Function &function)
 
Normalized_IR_Function Aleph::Compiler_SSA_Detail::normalize_ir_function (const Compiler_IR_Function &source)
 
Compiler_SSA_Dominance_Info Aleph::Compiler_SSA_Detail::compute_dominance_info (const Compiler_IR_Function &function)
 
size_t Aleph::Compiler_SSA_Detail::next_value (Compiler_SSA_Function &function) noexcept
 
Compiler_SSA_Block & Aleph::Compiler_SSA_Detail::block (Compiler_SSA_Function &function, const Compiler_SSA_Block_Id id)
 
const Compiler_SSA_Block & Aleph::Compiler_SSA_Detail::block (const Compiler_SSA_Function &function, const Compiler_SSA_Block_Id id)
 
Compiler_SSA_Value_Id Aleph::Compiler_SSA_Detail::current_slot_value (const DynArray< DynArray< Compiler_SSA_Value_Id > > &stacks, const Compiler_IR_Local_Slot_Id slot_id) noexcept
 
size_t Aleph::Compiler_SSA_Detail::predecessor_index (const Compiler_SSA_Block &block, const Compiler_SSA_Block_Id predecessor)
 
void Aleph::Compiler_SSA_Detail::rename_recursive (Compiler_SSA_Function &output, const Compiler_IR_Function &normalized, const Compiler_SSA_Dominance_Info &dominance, const DynArray< DynArray< Phi_Spec > > &phi_specs, Compiler_SSA_Block_Id block_id, DynArray< DynArray< Compiler_SSA_Value_Id > > &slot_stacks, DynArray< Compiler_SSA_Value_Id > &renamed_values)
 
Compiler_SSA_Validation_Report Aleph::validate_ssa_function (const Compiler_SSA_Function &function, const Compiler_SSA_Module *module=nullptr)
 Validates one SSA function structurally and semantically.
 
Compiler_SSA_Validation_Report Aleph::validate_ssa_module (const Compiler_SSA_Module &module)
 Validates all functions in one SSA module.
 
std::string Aleph::compiler_dump_ssa_function (const Compiler_SSA_Function *function, const Compiler_SSA_Module *module=nullptr, const Compiler_Type_Context *types=nullptr)
 Dumps one SSA function deterministically.
 
std::string Aleph::compiler_dump_ssa_module (const Compiler_SSA_Module *module, const Compiler_Type_Context *types=nullptr)
 Dumps all SSA functions in one module deterministically.
 

Detailed Description

Static single assignment form over Compiler_IR.H.

This header introduces the first reusable SSA layer over Aleph-w's explicit non-SSA IR. The current scope is intentionally conservative and targets the existing IR model:

  • dominators and immediate dominators
  • dominance frontiers
  • phi placement for parameters and local slots
  • rename pass that rewrites local-slot traffic into SSA values
  • structural SSA verifier
  • deterministic textual dumps

The transformation converts local and parameter slots into SSA values while keeping global memory traffic explicit as loads and stores. This makes the result suitable for later bytecode or backend stages without prematurely committing to a target ISA.

Definition in file SSA.H.