sun::codegen::loops::LoopGenerator
class · Source (opens in a new tab)
class sun::codegen::loops::LoopGeneratorEmits the three loop forms and the two ways out of them.
Functions
codegen
codegen(const sun::ast::ContinueAST &expr)
public · function · Source (opens in a new tab)
Value * sun::codegen::loops::LoopGenerator::codegen(const sun::ast::ContinueAST &expr)Emits LLVM instructions for this syntax node and returns its generated value.
Related: sun::ast::ContinueAST
codegen(const T &)=delete
private · function · Source (opens in a new tab)
template <typename T>
llvm::Value * sun::codegen::loops::LoopGenerator::codegen(const T &)=deleteA node kind with its own overload must not silently bind to the ExprAST forwarder above: that path attaches an expression debug location, so a block routed through it changes DWARF output.
Make it a compile error instead. Add an overload here when a new kind is needed.
Related: ExprAST, sun::ast::BlockExprAST, ExprAST
codegen(const sun::ast::WhileExprAST &expr)
public · function · Source (opens in a new tab)
Value * sun::codegen::loops::LoopGenerator::codegen(const sun::ast::WhileExprAST &expr)Emits LLVM instructions for this syntax node and returns its generated value.
Related: sun::ast::WhileExprAST
codegen(const ExprAST &expr)
private · function · Source (opens in a new tab)
llvm::Value * sun::codegen::loops::LoopGenerator::codegen(const ExprAST &expr)What a loop borrows from the rest of codegen: emitting its parts, finding the iterator protocol's methods, and declaring the loop variable.
Related: ExprAST
codegen(const sun::ast::BreakAST &expr)
public · function · Source (opens in a new tab)
Value * sun::codegen::loops::LoopGenerator::codegen(const sun::ast::BreakAST &expr)Emits LLVM instructions for this syntax node and returns its generated value.
Related: sun::ast::BreakAST
codegen(const sun::ast::ForExprAST &expr)
public · function · Source (opens in a new tab)
Value * sun::codegen::loops::LoopGenerator::codegen(const sun::ast::ForExprAST &expr)Emits LLVM instructions for this syntax node and returns its generated value.
Related: sun::ast::ForExprAST
codegen(const sun::ast::BlockExprAST &block)
private · function · Source (opens in a new tab)
llvm::Value * sun::codegen::loops::LoopGenerator::codegen(const sun::ast::BlockExprAST &block)Emits LLVM instructions for this syntax node and returns its generated value.
Related: sun::ast::BlockExprAST
codegen(const sun::ast::ForInExprAST &expr)
public · function · Source (opens in a new tab)
Value * sun::codegen::loops::LoopGenerator::codegen(const sun::ast::ForInExprAST &expr)Emits LLVM instructions for this syntax node and returns its generated value.
Related: sun::ast::ForInExprAST
Public Functions
LoopGenerator
LoopGenerator(sun::codegen::CodegenState &state, sun::codegen::CodegenVisitor &gen)
public · function · Source (opens in a new tab)
sun::codegen::loops::LoopGenerator::LoopGenerator(sun::codegen::CodegenState &state, sun::codegen::CodegenVisitor &gen)Binds loop generation to the shared expression visitor and state.
Related: sun::codegen::CodegenState, sun::codegen::CodegenVisitor
LoopGenerator(const LoopGenerator &)=delete
public · function · Source (opens in a new tab)
sun::codegen::loops::LoopGenerator::LoopGenerator(const LoopGenerator &)=deleteBinds loop generation to the shared expression visitor and state.
operator=
public · function · Source (opens in a new tab)
LoopGenerator & sun::codegen::loops::LoopGenerator::operator=(const LoopGenerator &)=deleteDisallows assignment so ownership and object identity cannot be duplicated.
Related: LoopGenerator
Private Functions
createEntryBlockAlloca
private · function · Source (opens in a new tab)
llvm::AllocaInst * sun::codegen::loops::LoopGenerator::createEntryBlockAlloca(llvm::Function *func, llvm::StringRef varName, llvm::Type *type)Allocates local storage in the function entry block.
debugDeclareLocal
private · function · Source (opens in a new tab)
void sun::codegen::loops::LoopGenerator::debugDeclareLocal(llvm::AllocaInst *alloca, const std::string &name, const sun::types::TypePtr &type, const sun::support::Position &loc)Associates local storage with its source variable for debugging.
Related: sun::types::TypePtr, sun::support::Position
functions
private · function · Source (opens in a new tab)
sun::codegen::functions::FunctionRegistry & sun::codegen::loops::LoopGenerator::functions()Provides the registry of generated functions and their metadata.
Related: sun::codegen::functions::FunctionRegistry
materializeMethodClosure
private · function · Source (opens in a new tab)
llvm::Value * sun::codegen::loops::LoopGenerator::materializeMethodClosure(llvm::Value *fnPtr, llvm::Value *receiverPtr, llvm::StringRef name)Builds a callable value that retains the method receiver.
scopes
private · function · Source (opens in a new tab)
sun::codegen::scopes::ScopeManager & sun::codegen::loops::LoopGenerator::scopes()Provides the scope manager responsible for variable storage and cleanup.
Related: sun::codegen::scopes::ScopeManager
Private Fields
ctx
private · variable · Source (opens in a new tab)
sun::codegen::CodegenContext& sun::codegen::loops::LoopGenerator::ctxNo documentation comment.
Related: sun::codegen::CodegenContext
gen_
private · variable · Source (opens in a new tab)
sun::codegen::CodegenVisitor& sun::codegen::loops::LoopGenerator::gen_No documentation comment.
Related: sun::codegen::CodegenVisitor
loopStack
private · variable · Source (opens in a new tab)
std::vector<LoopContext> sun::codegen::loops::LoopGenerator::loopStackNo documentation comment.
Related: LoopContext
state_
private · variable · Source (opens in a new tab)
sun::codegen::CodegenState& sun::codegen::loops::LoopGenerator::state_No documentation comment.
Related: sun::codegen::CodegenState
typeResolver
private · variable · Source (opens in a new tab)
sun::codegen::LLVMTypeResolver& sun::codegen::loops::LoopGenerator::typeResolverNo documentation comment.
Related: sun::codegen::LLVMTypeResolver