LLVMProgram

public struct LLVMProgram : Sendable
extension LLVMProgram: CustomStringConvertible

A Hylo program transpiled to LLVM.

  • The machine for which the program is compiled.

    Declaration

    Swift

    public let target: SwiftyLLVM.TargetMachine
  • The LLVM modules in the program.

    Declaration

    Swift

    public private(set) var llvmModules: [ModuleDecl.ID : SwiftyLLVM.Module] { get }
  • Creates a transpiling ir, whose main module is mainModule, for target.

    Declaration

    Swift

    public init(
      _ ir: IR.Program,
      mainModule: ModuleDecl.ID,
      for target: SwiftyLLVM.TargetMachine? = nil
    ) throws

    Parameters

    target

    The machine for which ir is transpiled. Defaults to the current host.

  • Applies the mandatory IR simplification passes on each module in self.

    Declaration

    Swift

    public mutating func applyMandatoryPasses()
  • Applies optimizations on each module in self.

    Optimization applied are similar to clang’s -O3.

    Declaration

    Swift

    public mutating func optimize()
  • Compile the contents of this program to products of given type and writes theses products to directory, returning the URL of each written file.

    Declaration

    Swift

    public func write(
      _ type: SwiftyLLVM.CodeGenerationResultType, to directory: URL
    ) throws -> [URL]

    Return Value

    The URL of each written product, one for each module in self.

  • Declaration

    Swift

    public var description: String { get }