Structures

The following structures are available globally.

  • The abstract layout of a type, describing the relative offsets of its stored properties.

    See more

    Declaration

    Swift

    public struct AbstractTypeLayout : Sendable
    extension AbstractTypeLayout: Hashable
  • The evaluation context of an abstract interpreter.

    See more

    Declaration

    Swift

    struct AbstractContext<Domain> : Equatable, Sendable where Domain : AbstractDomain
    extension AbstractContext: CustomStringConvertible
  • Undocumented

    See more

    Declaration

    Swift

    struct AbstractInterpreter<Domain> : Sendable where Domain : AbstractDomain
  • An object in an abstract interpreter.

    See more

    Declaration

    Swift

    struct AbstractObject<Domain> : Equatable, Sendable where Domain : AbstractDomain
    extension AbstractObject: CustomStringConvertible
  • A control-flow graph.

    This data structure describes relation between the basic blocks of a function. The direction of the graph’s edges denotes the direction of the control flow from one block to another: there an edge from A to B if the former’s terminator points to the latter.

    See more

    Declaration

    Swift

    struct ControlFlowGraph : Sendable
    extension ControlFlowGraph: CustomStringConvertible
  • A tree whose nodes are basic blocks and where a node immediately dominates its children.

    Definitions:

    • A block b1 in a control-flow graph dominates a block b2 if every path from the entry to b2 must go through b1. By definition, every node dominates itself.
    • A block b1 strictly dominates a block b2 if b1 dominates b2 and b1 != b2.
    • A block b1 immediately dominates a block b2 if b1 strictly dominates b2 and there is no block b3 that strictly dominates b2.

    A dominator tree encodes the dominance relation of a control graph as a tree where a node is a basic blocks and its children are those it immediately dominates.

    See more

    Declaration

    Swift

    struct DominatorTree : Sendable
    extension DominatorTree: CustomStringConvertible
  • A spanning tree of a control flow graph.

    See more

    Declaration

    Swift

    private struct SpanningTree : Sendable
  • A region of the program rooted at a definition.

    A lifetime rooted at a definition d is a region starting immediately after d and covering a set of uses dominated by d. The “upper boundaries” of a lifetime are the program points immediately after the uses sequenced last in that region.

    Note

    The definition of an operand o isn’t part of o‘s lifetime.
    See more

    Declaration

    Swift

    struct Lifetime : Sendable
  • A module lowered to Hylo IR.

    A lowered module is a collection of IR functions and a collection of constant IR values, which represent nominal types, traits, and global bindings. These entities may not necessarily have a definition. When they don’t, they denote a declaration known to be defined in another module.

    See more

    Declaration

    Swift

    public struct Module : Sendable
    extension Module: CustomStringConvertible
    extension Module: TextOutputStreamable
  • Creates an access on an object.

    IR generation sometimes cannot determine the capability used to access an object, as this information is kept implicit in Hylo sources. For example, a let-binding declaration will actually request a sink capability on its right hand side if the binding escapes. In these cases, IR generation will emit access instructions with the set capabilities that may be inferred from the syntax. These instructions are expected to be “reifed” during IR analysis so that only a single capability is requested.

    See more

    Declaration

    Swift

    public struct Access : RegionEntry
    extension Access: ReifiableAccess
    extension Access: LifetimeExtender
    extension Access: CustomStringConvertible
  • Projects a value from a subscript bundle.

    See more

    Declaration

    Swift

    public struct ProjectBundle : Instruction
    extension ProjectBundle: ReifiableAccess
    extension ProjectBundle: LifetimeExtender
    extension ProjectBundle: CustomStringConvertible
  • Computes a source address value advanced by offset bytes.

    See more

    Declaration

    Swift

    public struct AdvancedByBytes : Instruction
    extension AdvancedByBytes: LifetimeExtender
    extension AdvancedByBytes: CustomStringConvertible
  • Computes a source address advanced by count strides of its referred type.

    The stride of a type is the number of bytes from the start of an instance to the start of the next when stored in contiguous memory.

    See more

    Declaration

    Swift

    public struct AdvancedByStrides : Instruction
    extension AdvancedByStrides: LifetimeExtender
    extension AdvancedByStrides: CustomStringConvertible
  • Exposes a captured access.

    See more

    Declaration

    Swift

    public struct OpenCapture : RegionEntry
    extension OpenCapture: LifetimeExtender
  • Projects the address of a union payload, viewed as an instance of a given type.

    See more

    Declaration

    Swift

    public struct OpenUnion : RegionEntry
    extension OpenUnion: LifetimeExtender
    extension OpenUnion: CustomStringConvertible
  • Projects a value.

    See more

    Declaration

    Swift

    public struct Project : RegionEntry
    extension Project: LifetimeExtender
    extension Project: CustomStringConvertible
  • Computes the address of storage for a field or sub-field of a record, given the record’s address.

    Does not access memory.

    See more

    Declaration

    Swift

    public struct SubfieldView : Instruction
    extension SubfieldView: LifetimeExtender
    extension SubfieldView: CustomStringConvertible
  • Creates existential container wrapping the address of a witness.

    See more

    Declaration

    Swift

    public struct WrapExistentialAddr : Instruction
    extension WrapExistentialAddr: LifetimeExtender
    extension WrapExistentialAddr: CustomStringConvertible
  • An instruction marking an exit from a region.

    See more

    Declaration

    Swift

    public struct RegionExit<Entry> where Entry : RegionEntry
    extension RegionExit: LifetimeCloser
    extension RegionExit: CustomStringConvertible
    extension RegionExit: Sendable where Entry: Sendable
  • The monomorphization of a function.

    See more

    Declaration

    Swift

    private struct Monomorphizer : InstructionTransformer
  • How to translate the contents of a function being inlined.

    See more

    Declaration

    Swift

    private struct InliningTranslation : InstructionTransformer
  • Classification of a record type’s subfields into uninitialized, initialized, and consumed sets.

    See more

    Declaration

    Swift

    private struct SubfieldsByInitializationState : Sendable
  • A basic block in a Hylo IR function.

    A basic blocks is sequence of instructions free of conditional control flow. It may also accept arguments representing values that are notionally defined before its first instruction.

    See more

    Declaration

    Swift

    public struct Block : Sendable
  • A reference to a method or subscript bundle.

    See more

    Declaration

    Swift

    public struct BundleReference<T> : Hashable, Sendable where T : BundleDecl
    extension BundleReference: CustomStringConvertible
  • The witness of a type’s conformance to the Collection trait from the standard library.

    See more

    Declaration

    Swift

    struct CollectionWitness : Sendable
  • Where, how, and under what conditions a type satisfies the requirements of a trait.

    See more

    Declaration

    Swift

    public struct Conformance : Sendable
  • Hylo’s IR emitter.

    The emitter transforms well-formed, typed ASTs to a representation suitable for flow-sensitive analysis. IR generated from the emitter may be incomplete and must go through mandatory passes before it can be fed to code generation.

    You create an instance by calling Emitter.withInstance, providing the module in which IR should be incorporated and a diagnostic log. Then, the two main entry points are:

    • incorporateTopLevelDeclarations: incorporates the top-level declarations of a module’s AST into its corresponding IR form.
    • incorporateSyntheticDeclarations: generates the implementations of the synthesized declarations that are notionally part of a module. This method is called after definite deinitialization.

    Other entry points may be used during IR passes (e.g., emitDeinit).

    Note

    Unless documented otherwise, the methods of Emitter type insert IR in self.module at self.insertionPoint, anchoring new instructions at the given source range, named site in their parameter lists.
    See more

    Declaration

    Swift

    struct Emitter : Sendable
  • A collection of basic blocks representing a lowered function.

    See more

    Declaration

    Swift

    public struct Function : Sendable
  • The stable identity of an instruction in its module.

    See also

    InstructionIndex
    See more

    Declaration

    Swift

    public struct InstructionID : Hashable, Sendable
    extension InstructionID: CustomStringConvertible
  • Unlike an identity, an index is not stable: inserting or removing instructions from the containing block may invalidate existing indices.

    See also

    InstructionID
    See more

    Declaration

    Swift

    public struct InstructionIndex : Hashable, Sendable
  • The witness of a type’s conformance to the Iterator trait from the standard library.

    See more

    Declaration

    Swift

    struct IteratorWitness : Sendable
  • A digit in base 64.

    The textual description of a Base64Digit is a single printable ASCII character, determined with the following table:

    ┌────────────────────────────────────────────────────────┐
    | 00 ... 09 | \u{0030} ... \u{0039} | decimal digits     |
    | 10 ... 35 | \u{0061} ... \u{007a} | lower case letters |
    | 36 ... 61 | \u{0041} ... \u{005a} | upper case letters |
    | 62        | \u{002e}              | period             |
    | 63        | \u{005f}              | underscore         |
    └────────────────────────────────────────────────────────┘
    

    This character set is suitable for use in LLVM assembly identifiers.

    See more

    Declaration

    Swift

    public struct Base64Digit : Hashable
    extension Base64Digit: RawRepresentable
    extension Base64Digit: Comparable
    extension Base64Digit: LosslessStringConvertible
  • An unsigned integer whose textual representation uses a variable-length code in base 64.

    The textual representation of a Base64VarUInt is satisfies the following properties:

    • Small values use fewer characters than larger values.
    • The length of the representation can be determined by looking at just the first character.

    The textual representation of v is composed of 1 to n ASCII characters (0 < n < 12), written an. v is decoded as follows:

    • If a0 < 51, then n = 1 and v = a0.
    • If a0 == 51, then n = 2 and v = 50 + a1.
    • If a0 == 52, then n = 3 and v = 114 + 64 * a1 + a2.
    • Otherwise, n = a0 and v is the sum of ai * 64^(a0 - i) for 1 <= i < a0.
    See more

    Declaration

    Swift

    public struct Base64VarUInt : Hashable
    extension Base64VarUInt: RawRepresentable
    extension Base64VarUInt: Comparable
    extension Base64VarUInt: TextOutputStreamable
    extension Base64VarUInt: LosslessStringConvertible
  • The payload of a DemangledSymbol.entity.

    See more

    Declaration

    Swift

    public struct DemangledEntity : Hashable, Sendable
    extension DemangledEntity: CustomStringConvertible
  • The demangled description of a synthesized function.

    See more

    Declaration

    Swift

    public struct DemangledSynthesizedFunction : Hashable, Sendable
    extension DemangledSynthesizedFunction: CustomStringConvertible
  • Hylo’s demangling algorithm.

    See more

    Declaration

    Swift

    struct Demangler : Sendable
  • Hylo’s mangling algorithm.

    See more

    Declaration

    Swift

    struct Mangler : Sendable
  • A floating-point number Hylo IR constant.

    See more

    Declaration

    Swift

    public struct FloatingPointConstant : Constant, Hashable
    extension FloatingPointConstant: CustomStringConvertible
  • A Hylo IR reference to a user function.

    See more

    Declaration

    Swift

    public struct FunctionReference : Constant, Hashable, Sendable
    extension FunctionReference: CustomStringConvertible
  • An unsigned integer Hylo IR constant.

    See more

    Declaration

    Swift

    public struct IntegerConstant : Constant, Hashable
    extension IntegerConstant: CustomStringConvertible
  • A void constant.

    See more

    Declaration

    Swift

    public struct VoidConstant : Constant, Hashable
    extension VoidConstant: CustomStringConvertible
  • The type and conformances of a value acting as the witness of an existential container.

    See more

    Declaration

    Swift

    public struct WitnessTable : Constant, Hashable
    extension WitnessTable: CustomStringConvertible
  • The type of a witness table.

    See more

    Declaration

    Swift

    public struct WitnessTableType : TypeProtocol, CustomStringConvertible
  • Undocumented

    See more

    Declaration

    Swift

    public struct WordConstant : Constant, Hashable
    extension WordConstant: CustomStringConvertible
  • Converts an address to a built-in pointer value.

    This instruction doesn’t extend the lifetime of its operand. The value of the converted pointer is only valid within the scope of the source address.

    See more

    Declaration

    Swift

    public struct AddressToPointer : Instruction
  • Allocates memory on the stack.

    See more

    Declaration

    Swift

    public struct AllocStack : Instruction
    extension AllocStack: CustomStringConvertible
  • Branches unconditionally to the start of a basic block.

    See more

    Declaration

    Swift

    public struct Branch : Terminator
    extension Branch: CustomStringConvertible
  • Invokes callee with arguments and writes its result to output.

    callee must have a lambda type; the type of the instruction must be the same as output type of the callee. operands must contain as many operands as the callee’s type.

    See more

    Declaration

    Swift

    public struct Call : Instruction
    extension Call: CustomStringConvertible
  • Invokes the built-in function callee, passing operands as the argument list.

    See more

    Declaration

    Swift

    public struct CallBuiltinFunction : Instruction
    extension CallBuiltinFunction: CustomStringConvertible
  • Invokes one variant of bundle with arguments and writes its result to output.

    See more

    Declaration

    Swift

    public struct CallBundle : Instruction
    extension CallBundle: CustomStringConvertible
  • Invokes callee, which is a foreign function interface, with operands.

    See more

    Declaration

    Swift

    public struct CallFFI : Instruction
    extension CallFFI: CustomStringConvertible
  • Captures and stores a remote part.

    Well-formed IR guarantees the following invariants:

    • The provenances of target contain a single alloc_stack.
    • A capture ... in is post-dominated by at least one release_captures on the storage in which it has stored an access.
    See more

    Declaration

    Swift

    public struct CaptureIn : Instruction
    extension CaptureIn: CustomStringConvertible
  • Branches conditionally to the start of a basic block.

    See more

    Declaration

    Swift

    public struct CondBranch : Terminator
    extension CondBranch: CustomStringConvertible
  • Creates the internal representation of constant string allocated statically.

    The result is a 64-bit integer corresponding to the byte representation of a string in Hylo.

    See more

    Declaration

    Swift

    public struct ConstantString : Instruction
    extension ConstantString: CustomStringConvertible
  • Deallocates memory previously allocated by alloc_stack.

    See more

    Declaration

    Swift

    public struct DeallocStack : Instruction
  • Accesses the value passed to a generic parameter.

    See more

    Declaration

    Swift

    public struct GenericParameter : Instruction
    extension GenericParameter: CustomStringConvertible
  • Returns the address of a global binding.

    See more

    Declaration

    Swift

    public struct GlobalAddr : Instruction
    extension GlobalAddr: CustomStringConvertible
  • A load instruction.

    See more

    Declaration

    Swift

    public struct Load : Instruction
  • Unsafely sets the initialization state of storage.

    See more

    Declaration

    Swift

    public struct MarkState : Instruction
    extension MarkState: CustomStringConvertible
  • Copies the memory representation of the value stored source to target.

    See more

    Declaration

    Swift

    public struct MemoryCopy : Instruction
  • Initializes or assigns storage with a value.

    See more

    Declaration

    Swift

    public struct Move : Instruction
  • Converts a built-in pointer value to an address.

    This instruction doesn’t extend the lifetime of its operand. The address unsafely refers to the memory referenced by the pointer.

    See more

    Declaration

    Swift

    public struct PointerToAddress : Instruction
    extension PointerToAddress: CustomStringConvertible
  • Releases accesses captures in an allocation.

    See more

    Declaration

    Swift

    public struct ReleaseCaptures : Instruction
  • A return instruction.

    See more

    Declaration

    Swift

    public struct Return : Terminator
  • Stores object at the specified location.

    See more

    Declaration

    Swift

    public struct Store : Instruction
  • Branches to one of several basic blocks.

    See more

    Declaration

    Swift

    public struct Switch : Terminator
    extension Switch: CustomStringConvertible
  • Copy the discriminator of a union container.

    See more

    Declaration

    Swift

    public struct UnionDiscriminator : Instruction
  • Branches to one of several basic blocks based on the discriminator of a union.

    See more

    Declaration

    Swift

    public struct UnionSwitch : Terminator
    extension UnionSwitch: CustomStringConvertible
  • Marks this execution path as unreachable, causing a fatal error otherwise.

    See more

    Declaration

    Swift

    public struct Unreachable : Terminator
  • Projects the address of an object.

    See more

    Declaration

    Swift

    public struct Yield : Instruction
  • The possibly synthetic declaration of a parameter to a Hylo IR function.

    See more

    Declaration

    Swift

    public struct Parameter : Sendable
    extension Parameter: CustomStringConvertible
  • A program lowered to Hylo IR.

    See more

    Declaration

    Swift

    public struct Program : FrontEnd.Program
  • The address of some statically allocated storage.

    See more

    Declaration

    Swift

    public struct StaticStorage : Sendable
    extension StaticStorage: Equatable
    extension StaticStorage: Hashable
  • The lowered (static) type of an entity.

    Note: when qualified, this must be spelled IR.Type (https://github.com/apple/swift/issues/67378)

    See more

    Declaration

    Swift

    public struct Type : Hashable, Sendable
  • Use

    A pair representing the use of a value in an instruction.

    See more

    Declaration

    Swift

    public struct Use : Hashable, Sendable