48 function.
name =
"choose";
54 flag.
kind = Compiler_IR_Slot_Kind::Parameter;
60 value.kind = Compiler_IR_Slot_Kind::Local;
66 entry.
label =
"entry";
69 zero.
kind = Compiler_IR_Instruction_Kind::Constant;
94 exit.terminator.kind = Compiler_IR_Terminator_Kind::Exit;
95 exit.predecessors.append(3);
102 one.
kind = Compiler_IR_Instruction_Kind::Constant;
113 then_block.terminator.kind = Compiler_IR_Terminator_Kind::Jump;
127 join_block.terminator.kind = Compiler_IR_Terminator_Kind::Return;
138 two.
kind = Compiler_IR_Instruction_Kind::Constant;
149 else_block.terminator.kind = Compiler_IR_Terminator_Kind::Jump;
153 function.
blocks.append(entry);
160 for (
size_t i = 0; i < function.
blocks.size(); ++i)
182 module.functions.append(&function);
190 std::cout <<
"\nWarnings:\n";
191 for (
size_t i = 0; i <
report.warnings.size(); ++i)
192 std::cout <<
"- " <<
report.warnings.access(i) <<
'\n';
195 return report.valid ? 0 : 1;
Static single assignment form over Compiler_IR.H.
size_t size_t int32_t value
Arena-backed ownership context for SSA functions and modules.
Lowers non-SSA IR to SSA form for all reachable blocks.
T & append()
Allocate a new entry to the end of array.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Compiler_SSA_Block & block(Compiler_SSA_Function &function, const Compiler_SSA_Block_Id id)
Main namespace for Aleph-w library functions.
Compiler_SSA_Validation_Report validate_ssa_module(const Compiler_SSA_Module &module)
Validates all functions in one SSA module.
void exit(const char *file, int line, const char *format,...)
Print a message and exit the program.
std::string compiler_dump_ssa_module(const Compiler_SSA_Module *module, const Compiler_Type_Context *types=nullptr)
Dumps all SSA functions in one module deterministically.
One basic block of IR instructions.
std::string label
Deterministic debug label.
Compiler_IR_Terminator terminator
Explicit block terminator.
DynArray< Compiler_IR_Instruction > instructions
Linear instruction list.
Compiler_IR_Block_Id id
Stable block id.
Lowered IR for one function or top-level body.
Compiler_IR_Value_Id next_value_id
Next value id to allocate while lowering.
DynArray< Compiler_IR_Block > blocks
Basic blocks in deterministic id order.
std::string name
Debug or source-level name.
Compiler_IR_Block_Id exit_block
Canonical exit block.
Compiler_IR_Block_Id entry_block
Canonical entry block.
DynArray< Compiler_IR_Slot > local_slots
Parameter/local slots in stable order.
One instruction producing an optional explicit result value.
std::string text
Constant spelling or debug payload.
Compiler_IR_Instruction_Kind kind
Instruction category.
Compiler_IR_Value_Id result_id
Produced value id, or 0 for void instructions.
Lowered IR module with shared global slots and functions.
One storage slot used by the IR.
std::string name
Debug name of the slot.
size_t id
Stable slot id within its storage space.
Compiler_IR_Slot_Kind kind
Slot storage category.
Compiler_IR_Terminator_Kind kind
Terminator category.
DynArray< Compiler_IR_Block_Id > successors
Successor blocks in deterministic order.
Compiler_IR_Value_Id condition_value
Branch condition value, if any.
DynArray< Compiler_SSA_Instruction > instructions
Linear SSA instruction list.