-
Returns the LLVM type of a machine word.
Declaration
Swift
mutating func word() -> SwiftyLLVM.IntegerType -
Creates the LLVM transpilation of the Hylo IR module
minir.Declaration
Swift
init(transpiling m: ModuleDecl.ID, in context: inout CodeGenerationContext) -
Transpiles and incorporates
f, which is a function or subscript ofminir.Declaration
Swift
mutating func incorporate(_ f: IR.Function.ID, in context: inout CodeGenerationContext) -
Transpiles and incorates
s, which is a static allocation ofminir.The storage is allocated along with a flag keeping track of its initialization state. Access is provided by an addressor that initializes the storage the first time it is called using
s.initializer.Declaration
Swift
private mutating func incorporate(_ s: StaticStorage, in context: inout CodeGenerationContext) -
Defines a “main” function calling the function
f, which represents the entry point of the entry modulemof the programir.This method creates a LLVM entry point calling
f, which is the lowered form of a public function named “main”, taking no parameter and returning eitherVoidorInt32.fwill be linked privately inm.Declaration
Swift
private mutating func defineMain( calling f: IR.Function.ID, in context: inout CodeGenerationContext ) -
Returns the LLVM type of a metatype instance.
Declaration
Swift
private mutating func metatypeType() -> SwiftyLLVM.StructType -
Returns the LLVM type of an existential container.
Declaration
Swift
private mutating func containerType() -> SwiftyLLVM.StructType -
Returns the prototype of subscript slides.
Declaration
Swift
private mutating func slidePrototype() -> SwiftyLLVM.Function -
Returns the declaration of
malloc.Declaration
Swift
private mutating func mallocPrototype() -> SwiftyLLVM.Function -
Returns the declaration of
free.Declaration
Swift
private mutating func freePrototype() -> SwiftyLLVM.Function -
Returns the type of a transpiled function whose type in Hylo is
t.Note
the type of a function in Hylo IR typically doesn’t match the type of its transpiled form 1-to-1, as return values are often passed by references.Declaration
Swift
private mutating func transpiledType(_ t: ArrowType) -> SwiftyLLVM.FunctionType -
Returns the LLVM IR value corresponding to the Hylo IR constant
cwhen used inminir.Declaration
Swift
private mutating func transpiledConstant( _ c: any IR.Constant, in context: inout CodeGenerationContext ) -> SwiftyLLVM.IRValue -
Returns the LLVM IR value corresponding to the Hylo IR constant
cwhen used inminir.Declaration
Swift
private mutating func transpiledConstant( _ c: IR.WordConstant, in context: inout CodeGenerationContext ) -> SwiftyLLVM.IRValue -
Returns the LLVM IR value corresponding to the Hylo IR constant
cwhen used inminir.Declaration
Swift
private mutating func transpiledConstant( _ c: IR.IntegerConstant, in context: inout CodeGenerationContext ) -> SwiftyLLVM.IRValue -
Returns the LLVM IR value corresponding to the Hylo IR constant
cwhen used inminir.Declaration
Swift
private mutating func transpiledConstant( _ c: IR.FloatingPointConstant, in context: inout CodeGenerationContext ) -> SwiftyLLVM.IRValue -
Returns the LLVM IR value of the witness table
tused inminir.Declaration
Swift
private mutating func transpiledWitnessTable( _ t: WitnessTable, in context: inout CodeGenerationContext ) -> SwiftyLLVM.IRValue -
Returns the LLVM IR value of the requirement implementation
i, which is inir.Declaration
Swift
private mutating func transpiledRequirementImplementation( _ i: IR.Conformance.Implementation, from ir: IR.Program ) -> SwiftyLLVM.Function -
Returns the LLVM IR value of the metatype
tused inminir.Declaration
Swift
private mutating func demandMetatype( of t: AnyType, in context: inout CodeGenerationContext ) -> SwiftyLLVM.GlobalVariable -
Initializes
instancewith the value of the metatype oftused inminir.Declaration
Swift
private mutating func initializeTranspiledMetatype<T: TypeProtocol>( _ instance: SwiftyLLVM.GlobalVariable, of t: T, in context: inout CodeGenerationContext ) -
Initializes
instancewith the value of the metatype oftused inminir.Declaration
Swift
private mutating func initializeTranspiledProductTypeMetatype( _ instance: SwiftyLLVM.GlobalVariable, of t: ProductType, in context: inout CodeGenerationContext ) -
Returns the LLVM IR value of
tused inminir, callinginitializeInstanceto initialize it.Declaration
Swift
private mutating func demandMetatype<T: TypeProtocol>( of t: T, in context: inout CodeGenerationContext, initializedWith initializeInstance: ( inout Self, inout CodeGenerationContext, SwiftyLLVM.GlobalVariable ) -> Void ) -> SwiftyLLVM.GlobalVariable -
Returns the LLVM IR value of
tused inminir.Declaration
Swift
private mutating func demandTrait( _ t: TraitType, in context: inout CodeGenerationContext ) -> SwiftyLLVM.GlobalVariable -
Inserts and returns the transpiled declaration of
ref, which is inir.Declaration
Swift
private mutating func declare( _ ref: IR.FunctionReference, from ir: IR.Program ) -> SwiftyLLVM.Function -
Inserts and returns the transpiled declaration of
f, which is a function ofminir.Declaration
Swift
private mutating func declareFunction( transpiledFrom f: IR.Function.ID, in context: inout CodeGenerationContext ) -> (inserted: Bool, function: SwiftyLLVM.Function) -
Inserts and returns the transpiled declaration of
f, which is a subscript ofminir.Declaration
Swift
private mutating func declareSubscript( transpiledFrom f: IR.Function.ID, in context: inout CodeGenerationContext ) -> (inserted: Bool, function: SwiftyLLVM.Function) -
Adds to
llvmFunctionthe attributes implied by its IR formf, which is inm.Declaration
Swift
private mutating func configureAttributes( _ llvmFunction: SwiftyLLVM.Function, transpiledFrom f: IR.Function.ID, of m: IR.Module ) -
Adds to each parameter in
llvmParametersthe attributes implied by its corresponding IR form inm[f].inputs.Declaration
Swift
private mutating func configureInputAttributes( _ llvmParameters: SwiftyLLVM.Function.Parameters.SubSequence, transpiledFrom f: IR.Function.ID, in m: IR.Module ) -
Adds to
llvmParameterthe attributes implied by its IR form inm[f].inputs[p].Declaration
Swift
private mutating func configureInputAttributes( _ llvmParameter: SwiftyLLVM.Parameter, transpiledFrom p: Int, in f: IR.Function.ID, in m: IR.Module ) -
Inserts into
transpilationthe transpiled contents off, which is a function or subscript ofminir.See moreRequires
transpilationcontains no instruction.Declaration
Swift
private mutating func transpile( contentsOf f: IR.Function.ID, into transpilation: SwiftyLLVM.Function, inContext context: inout CodeGenerationContext ) -
Inserts the prologue of the subscript
transpilationat the end of its entry and returns a pointer to its stack frame.Declaration
Swift
fileprivate mutating func insertSubscriptPrologue( into transpilation: SwiftyLLVM.Function ) -> IRValue
View on GitHub