Module
public struct Module : Sendable
extension Module: CustomStringConvertible
extension Module: TextOutputStreamable
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.
-
Unique identifier of a module within a program.
Declaration
Swift
public typealias ID = ModuleDecl.ID -
The program defining the functions in
self.Declaration
Swift
public let program: TypedProgram -
The module’s identifier.
Declaration
Swift
public let id: ID -
The def-use chains of the values in this module.
-
The nominal product types defined in the module.
Declaration
Swift
public private(set) var productTypes: [ProductType] { get } -
The traits defined in the module.
Declaration
Swift
public private(set) var traits: [TraitType] { get } -
The static allocations defined in the module.
Declaration
Swift
public private(set) var allocations: [StaticStorage] { get } -
The functions in the module.
-
The module’s entry function, if any.
An entry function is the lowered form of a program’s entry point, that is the
mainfunction of a Hylo program. A module with an entry function is called an entry module. There can be only one entry module in a program. -
Creates an instance lowering
minp, reporting errors and warnings tolog.Requires
mis a valid ID inp.Throws
Diagnosticsif lowering fails.Declaration
Swift
public init( lowering m: ModuleDecl.ID, in p: TypedProgram, reportingDiagnosticsTo log: inout DiagnosticSet ) throws -
The module’s name.
Declaration
Swift
public var name: String { get } -
Accesses the given function.
-
Accesses the given block.
-
Accesses the given instruction.
Declaration
Swift
public subscript(i: InstructionID) -> Instruction { get set } -
Accesses the instruction denoted by
oif it is.register; returnsnilotherwise.Declaration
Swift
public subscript(o: Operand) -> Instruction? { get } -
Returns the type of
operand.Declaration
Swift
public func type(of operand: Operand) -> IR.Type -
Returns
trueiff cannot be used to modify or update a value.Declaration
Swift
public func isBoundImmutably(_ p: Operand) -> Bool -
Returns
trueiff the result oficannot be used to modify or update a value.Declaration
Swift
public func isBoundImmutably(register i: InstructionID) -> Bool -
If
pis a function parameter, returns its passing convention. Otherwise, returnsnil.Declaration
Swift
public func passingConvention(of p: Operand) -> AccessEffect? -
Returns the passing convention of the
i-th parameter off.Declaration
-
Returns the scope in which
iis used.Declaration
Swift
public func scope(containing i: InstructionID) -> AnyScopeID -
Returns the IDs of the instructions in
b, in order.Declaration
Swift
public func instructions( in b: Block.ID ) -> LazyMapSequence<Block.Instructions.Indices, InstructionID> -
Returns the ID the instruction before
i.Declaration
Swift
func instruction(before i: InstructionID) -> InstructionID? -
Returns the ID the instruction after
i.Declaration
Swift
func instruction(after i: InstructionID) -> InstructionID? -
Returns the global identity of
block‘s terminator, if it exists.Declaration
Swift
func terminator(of block: Block.ID) -> InstructionID? -
Returns the register asssigned by
i, if any.Declaration
Swift
func result(of i: InstructionID) -> Operand? -
Returns
trueifflhsis sequenced beforerhs.Declaration
Swift
func dominates(_ lhs: InstructionID, _ rhs: InstructionID) -> Bool -
Returns
trueifiis a deinitializer. -
Returns whether the IR in
selfis well-formed.Use this method as a sanity check to verify the module’s invariants.
Declaration
Swift
public func isWellFormed() -> Bool -
Returns whether
fis well-formed.Use this method as a sanity check to verify the function’s invariants.
-
Applies all mandatory passes in this module, accumulating diagnostics in
See morelogand throwing if a pass reports an error.Declaration
Swift
public mutating func applyMandatoryPasses( reportingDiagnosticsTo log: inout DiagnosticSet ) throws -
Inserts the IR for the synthesized declarations defined in this module, reporting diagnostics to
logand throwing if a an error occurred.Declaration
Swift
private mutating func generateSyntheticImplementations( reportingDiagnosticsTo log: inout DiagnosticSet ) throws -
Adds
tto the set of nominal product types defined inself.Declaration
Swift
mutating func addProductType(_ t: ProductType) -
Adds
tto the set of traits defined inself.Declaration
Swift
mutating func addTrait(_ t: TraitType) -
Adds
dto the set of static allocations inself.Declaration
Swift
mutating func addStaticStorage(_ s: StaticStorage) -
Assigns
identitytovalueinself.Requires
identityis not already assigned. -
Returns the identity of the IR function corresponding to
i.Declaration
Swift
mutating func demandDeclaration(lowering i: FrontEnd.Conformance.Implementation) -> Function.ID -
Returns the identity of the IR function corresponding to
d, ornilifdcan’t be lowered to an IR function. -
Returns the identity of the IR function corresponding to
d. -
Returns the identity of the IR function corresponding to
d. -
Returns the identity of the IR function corresponding to
d. -
Returns the identifier of the IR initializer corresponding to
d. -
Returns the identity of the IR function corresponding to
d.Declaration
-
Returns the implementation of the requirement named
rinwitness.Requires
ridentifies a function or subscript requirement in the trait for whichwitnesshas been established.Declaration
Swift
mutating func demandImplementation<T: Decl>( of r: T.ID, for witness: FrontEnd.Conformance ) -> Function.ID -
Returns the IR function implementing the deinitializer defined in
c.Declaration
Swift
mutating func demandDeinitDeclaration( from c: FrontEnd.Conformance ) -> Function.ID -
Returns the IR function implementing the
kvariant move-operation defined byconformanceToMovable.Declaration
Swift
mutating func demandTakeValueDeclaration( _ k: AccessEffect, definedBy conformanceToMovable: FrontEnd.Conformance ) -> Function.IDParameters
kThe semantics of a move operation. It must be either
.setor.inout.conformanceToMovableA conformance to
Movable. -
Returns the IR function implementing the copy operation defined in
conformanceToCopyable.Declaration
Swift
mutating func demandCopyDeclaration( definedBy conformanceToCopyable: FrontEnd.Conformance ) -> Function.IDParameters
conformanceToCopyableA conformance to
Copyable. -
Returns the IR function implementing the operator defined in
conformanceToEquatable.Declaration
Swift
mutating func demandEqualDeclaration( definedBy conformanceToEquatable: FrontEnd.Conformance ) -> Function.IDParameters
conformanceToEquatableA conformance to
Equatable. -
Returns a function reference to the implementation of the requirement
rinwitness.Requires
ridentifies a function or subscript requirement in the trait for whichwitnesshas been established.Declaration
Swift
mutating func reference<T: Decl>( toImplementationOf r: T.ID, for witness: FrontEnd.Conformance ) -> FunctionReference -
Returns a function reference to
d, which is an implementation that’s part ofwitness.Declaration
Swift
func reference( to d: Function.ID, implementedFor witness: FrontEnd.Conformance ) -> FunctionReference -
Returns a member reference to
d, which is member ofreceiveraccessed with capabilitiesk, specializingd‘s type forainscopeOfUse.Declaration
Swift
mutating func memberCallee( referringTo d: AnyDeclID, memberOf receiver: AnyType, accessedWith k: AccessEffectSet, specializedBy a: GenericArguments, usedIn scopeOfUse: AnyScopeID ) -> Callee -
Returns the lowered declarations of
d‘s parameters. -
Returns the lowered declarations of
d‘s parameters. -
Returns the lowered declarations of
d‘s parameters.d’s receiver comes first and is followed byd’s formal parameters, from left to right. -
Returns the lowered declarations of
d‘s parameters. -
Returns
d, which declares a parameter, paired with its lowered type. -
Appends to
inputsthe parameters corresponding to the givencapturespassedeffect, canonicalizing theirs type inscopeOfUse.Declaration
Swift
private func appendCaptures( _ captures: [TupleType.Element], passed effect: AccessEffect, to inputs: inout [Parameter], canonicalizedIn scopeOfUse: AnyScopeID ) -
Appends
parameterstoinputs, canonicalizing their types inscopeOfUse.Declaration
Swift
private func appendParameters( _ parameters: [CallableTypeParameter], to inputs: inout [Parameter], canonicalizedIn scopeOfUse: AnyScopeID ) -
Returns a pointer to the witness table of
tused inscopeOfUse.Declaration
Swift
mutating func demandWitnessTable(_ t: AnyType, in scopeOfUse: AnyScopeID) -> WitnessTable -
Returns the lowered conformances of
modelthat are exposed touseScope.Declaration
Swift
private mutating func loweredConformances( of model: AnyType, exposedTo useScope: AnyScopeID ) -> Set<IR.Conformance> -
Returns the lowered form of
c.Declaration
Swift
private mutating func loweredConformance(_ c: FrontEnd.Conformance) -> IR.Conformance -
Returns a map from
f‘s generic arguments to their skolemized form.Requires
fis declared inself. -
Returns the entry of
f.Requires
fis declared inself. -
Returns the operand representing the return value of
f.Requires
fis declared inself. -
Appends to
fan entry block that is inscope, returning its identifier.Requires
fis declared inselfand doesn’t have an entry block.Declaration
-
Appends to
fa basic block that is inscopeand acceptsparameterstof, returning its identifier.Requires
fis declared inself.Declaration
-
Removes
blockand updates def-use chains.Requires
No instruction inblockis used by an instruction outside ofblock. -
Swaps
oldbynew.oldis removed and the def-use chains are updated so that the uses made byoldare replaced by the uses made bynewand all uses ofoldrefer tonew. After the call,self[old] == new.Requires
newproduces results with the same types asold.Declaration
Swift
mutating func replace<I>(_ old: InstructionID, with new: I) where I : Instruction -
Swaps all uses of
oldinfbynewand updates the def-use chains.Requires
newas the same type asold.fis inself. -
Inserts
newInstructionatboundaryand returns its identity.Declaration
Swift
@discardableResult mutating func insert( _ newInstruction: Instruction, at boundary: InsertionPoint ) -> InstructionID -
Adds
newInstructionat the start ofblockand returns its identity.Declaration
Swift
@discardableResult mutating func prepend(_ newInstruction: Instruction, to block: Block.ID) -> InstructionID -
Adds
newInstructionat the end ofblockand returns its identity.Declaration
Swift
@discardableResult mutating func append(_ newInstruction: Instruction, to block: Block.ID) -> InstructionID -
Inserts
newInstructionatpositionand returns its identity.The instruction is inserted before the instruction currently at
position. You can pass a “past the end” position to append at the end of a block.Declaration
Swift
@discardableResult mutating func insert( _ newInstruction: Instruction, at position: InstructionIndex ) -> InstructionID -
Inserts
newInstructionbeforesuccessorand returns its identity.Declaration
Swift
@discardableResult mutating func insert( _ newInstruction: Instruction, before successor: InstructionID ) -> InstructionID -
Inserts
newInstructionafterpredecessorand returns its identity.Declaration
Swift
@discardableResult mutating func insert( _ newInstruction: Instruction, after predecessor: InstructionID ) -> InstructionID -
Inserts
newInstructionwithimpland returns its identity.Declaration
Swift
private mutating func insert( _ newInstruction: Instruction, with impl: (inout Self, Instruction) -> InstructionID ) -> InstructionID -
Removes instruction
iand updates def-use chains.Requires
The result ofihave no users.Declaration
Swift
mutating func removeInstruction(_ i: InstructionID) -
Removes all instructions after
iin its containing block and updates def-use chains.Requires
LetSbe the set of removed instructions, all users of a result ofjinSare also inS.Declaration
Swift
mutating func removeAllInstructions(after i: InstructionID) -
Returns the uses of all the registers assigned by
i.Declaration
Swift
func allUses(of i: InstructionID) -> [Use] -
Removes
ifrom the def-use chains of its operands.Declaration
Swift
private mutating func removeUsesMadeBy(_ i: InstructionID) -
Returns the operands from which the address denoted by
aderives.The (static) provenances of an address denote the original operands from which it derives. They form a set because an address computed by a projection depends on that projection’s arguments and because an address defined as a parameter of a basic block with multiple predecessors depends on that bock’s arguments.
-
Returns
trueifocan be sunken.Declaration
Swift
func isSink(_ o: Operand) -> Bool -
Returns
trueiffois anaccess [set]instruction.Declaration
Swift
func isBorrowSet(_ o: Operand) -> Bool -
Given
operandis an instruction or block parameter, returns its live-range.The live-range
Lof an operandxin a functionfis the minimal lifetime such that for for all instructionsiinf, ifiusesxtheniis inL. -
Returns
lin whichihas been inserted.Requires
The definition ofldominatesu. -
Returns
leftextended to cover the instructions inright.Requires
leftandrightare defined in the same function, which is inself. The operand for whichrightis defined must be inleft. -
Returns the last use of
operandinblock. -
Returns the use that executes last.
-
Replace uses of instructions requesting multiple capabilities by one requesting the weakest actually required, reporting errors and warnings to
diagnostics.Requires
fis inself.Declaration
-
Undocumented
Declaration
Swift
private func requests(_ u: Use) -> AccessEffectSet -
Undocumented
Declaration
Swift
private func requests(projectBundle u: Use) -> AccessEffectSet -
Calls
actionon the uses of a capability of the access at the origin ofi.Declaration
Swift
private func forEachClient(of i: InstructionID, _ action: (Use) -> Void) -
Replaces the uses of
iwith uses of an instruction providing the same access but only with capabilityk.Declaration
Swift
private mutating func reify(_ i: InstructionID, as k: AccessEffect) -
Narrows the capabilities requested by
i, which is anaccessinstruction, to justk.Declaration
Swift
private mutating func reify(access i: InstructionID, as k: AccessEffect) -
Undocumented
Declaration
Swift
private mutating func reify(projectBundle i: InstructionID, as k: AccessEffect) -
Replace occurrences of
call_bundlebycalldepending on the uses of their first operands, reporting errors and warnings todiagnostics.Requires
fis inself.Declaration
-
Undocumented
Declaration
Swift
private mutating func reify(callBundle i: InstructionID) -
Inserts
end_borrowinstructions after the last use of eachaccessinstruction inf, reporting errors and warnings todiagnostics.Requires
selfis has gone through access reification.fis inself.Declaration
-
If
iisaccessorproject, make sure it is post-dominated by respectivelyend_borroworend_project, inserting new instructions as necessary; does nothing otherwise.Declaration
Swift
private mutating func close( _ i: InstructionID, in f: Function.ID, reportingDiagnosticsTo log: inout DiagnosticSet ) -
Closes the access formed by
iat the boundaries ofregion, callingmaketo create the appropriate lifetiem closer instruction.No instruction is inserted at after already existing lifetime closers for
i.Declaration
Swift
private mutating func insertClose<T: LifetimeCloser>( _ i: InstructionID, atBoundariesOf region: Lifetime, makingInstructionWith make: (inout Self, SourceRange) -> T ) -
Returns the extended live-range of
definition.A definition is live over an instruction if it is is used by that instruction or may be used by another instruction in the future. The live-range of a definition
dis the region of a function containing all instructions over whichdis live. The extended live-range ofdis its live-range merged with the extended live-ranges of the definitions extendingd.Note
The definition of an operandoisn’t part ofo‘s lifetime. -
Removes unreachable code from
f, reporting errors and warnings todiagnostics.Requires
fis inself.Declaration
-
Removes the instructions if
fthat have no user. -
Removes the instructions in
definitionsthat have no user, accumulating the IDs of removed elements inremoved.Declaration
Swift
private mutating func removeUnused<S: Sequence<InstructionID>>( _ definitions: S, keepingTrackIn removed: inout Set<InstructionID> ) -
Removes the basic blocks that have no predecessor from
f, except its entry. -
Removes the code after calls returning
Neverfromf. -
Returns
trueiffinever returns control flow.Declaration
Swift
private func returnsNever(_ i: InstructionID) -> Bool -
Returns
trueiffican be removed if it has no use.Declaration
Swift
private func isRemovableWhenUnused(_ i: InstructionID) -> Bool -
Allocates and initializes storage for each generic value argument in
specializationin the entry ofmonomorphized, returning a map from a generic value parameter to its corresponding allocation that preserves the order ofspecialization.Declaration
Swift
fileprivate mutating func defineGenericValueArguments( _ specialization: GenericArguments, in monomorphized: Function.ID ) -> OrderedDictionary<GenericParameterDecl.ID, InstructionID> -
A “program counter” in the abstract machine.
Declaration
Swift
private typealias PC = Block.Instructions.Address -
Ensures that objects in
fare initialized before use and deinitialized after last use, reporting errors and warnings todiagnostics.See moreRequires
Borrows inselfhave been closed.fis inself.Declaration
-
Returns the initial context in which
fshould be interpreted. -
Configure in
contextthe initial state of the parameter atpositioninentry, which has typet.Declaration
-
Configure in
contextthe initial state of the parameter atpositioninentry, which has typetpassed with capabilityk.Declaration
-
Assigns a fully initialized object to the virtual register defined by
iincontext.Declaration
Swift
private func initializeRegister(createdBy i: InstructionID, in context: inout Context) -
Assigns the virtual register defined by
ito the location of the storage projected byi, usingtto set the initial state of that storage.Declaration
Swift
private func initializeRegister( createdBy i: InstructionID, projecting t: RemoteType, in context: inout Context ) -
Inserts IR for the deinitialization of
rootat giveninitializedSubfieldsbefore instructioni, anchoring instructions tosite.Declaration
Swift
private mutating func insertDeinit( _ root: Operand, at initializedSubfields: [RecordPath], before i: InstructionID, anchoringInstructionsTo site: SourceRange, reportingDiagnosticsTo log: inout DiagnosticSet ) -
Inserts ID for the deinitialization of
whole‘s parts before instructioni, anchoring new instructions tosite.Declaration
Swift
private mutating func insertDeinitParts( of whole: Operand, before i: InstructionID, anchoringInstructionsTo site: SourceRange, reportingDiagnosticsTo log: inout DiagnosticSet ) -
Returns the site at which diagnostics related to the parameter
pshould be reported inf. -
Ensures the Law of Exclusivity is satisfied in
f, reporting errors and warnings todiagnostics.See moreRequires
fis inself.Declaration
-
Returns the initial context in which
fshould be interpreted. -
Configure in
contextthe initial state of the parameter atpositioninentry, which has typet.Declaration
-
Configure in
contextthe initial state of the parameter atpositioninentry, which has typetpassed with capabilityk.Declaration
-
Assigns the virtual register defined by
ito the location of the storage projected byi, usingtto set the initial state of that storage.Declaration
Swift
private func initializeRegister( createdBy i: InstructionID, projecting t: RemoteType, in context: inout Context ) -
Returns the borrowed instruction from which
breborrows, if any.Declaration
Swift
private func reborrowedSource(_ b: Access) -> InstructionID? -
Returns the source of the access denoted by
o.Requires
odenotes a location. -
Eliminates redundant instructions and fold address computations in
f. -
Replaces uses of
iby its source ifiis redundant.An access is redundant if its source is another access requesting the same capability. When that occurs, instructions closing the redundant access can be removed and uses be replaced by uses of its source.
Declaration
Swift
private mutating func eliminateRedundantAccess(_ i: InstructionID) -> InstructionID? -
Declaration
Swift
public var description: String { get } -
Writes a textual representation of this instance into
output.Declaration
Swift
public func write<Target>(to output: inout Target) where Target : TextOutputStream -
Returns a textual representation of the specified function.
-
Writes a textual representation of the specified function into
output.Declaration
-
Returns a textual description of
fsuitable for debugging. -
Returns a textual description of
dsuitable for debugging.Declaration
Swift
func debugDescription(_ f: SynthesizedFunctionDecl) -> String -
Creates an
accessanchored atsitethat may take any ofcapabilitiesfromsource, optionally associated with a variable declaration in the AST.Declaration
-
Creates an
address_to_pointeranchored atsitethat convertssourceto a built-in pointer value.Declaration
Swift
func makeAddressToPointer(_ source: Operand, at site: SourceRange) -> AddressToPointer -
Creates an
advanced by bytesinstruction anchored atsitecomputing thesourceaddress value advanced byoffsetbytes.Declaration
Swift
func makeAdvancedByBytes( source: Operand, offset: Operand, at site: SourceRange ) -> AdvancedByBytes -
Creates an
advanced by stridesinstruction anchored atsitecomputing thesourceaddress advanced bynstrides of its referred type.Declaration
Swift
func makeAdvanced( _ source: Operand, byStrides n: Int, at site: SourceRange ) -> AdvancedByStrides -
Returns the AST type of
sourceiff it is the address of a buffer.Declaration
Swift
private func sourceType(_ source: Operand) -> BufferType? -
Creates an
alloc_stackanchored atsitethat allocates storage of typet.Requires
tis canonical.Declaration
Swift
func makeAllocStack(_ t: AnyType, at site: SourceRange) -> AllocStack -
Creates a
branchanchored atsitethat unconditionally jumps at the start of a block.Parameters
targetThe block in which control flow jumps.
-
Creates a
callanchored atsitethat appliescalleeonargumentsand writes its result tooutput.Declaration
Parameters
calleeThe function to call.
outputThe location at which the result of
calleeis stored.argumentsThe arguments of the call; one for each input of
callee‘s type. -
Creates an instruction anchored at
sitethat appliesftooperands.Declaration
Swift
func makeCallBuiltin( applying s: BuiltinFunction, to operands: [Operand], at site: SourceRange ) -> CallBuiltinFunctionParameters
fA built-in function.
operandsA collection of built-in objects.
-
Creates a
call_bundleanchored atsitethat applies one of the variants defined inmto argumentsa, canonicalizing types inscopeOfUse.Declaration
Swift
mutating func makeCallBundle( applying m: BundleReference<MethodDecl>, to a: [Operand], writingResultTo o: Operand, at site: SourceRange, canonicalizingTypesIn scopeOfUse: AnyScopeID ) -> CallBundle -
Creates a
call_ffianchored atsitethat appliescalleeonargumentsusing to return and returns a value ofreturnType.Declaration
Parameters
returnTypeThe return type of the callee.
calleeThe name of the foreign function to call
argumentsThe arguments of the call.
-
Creates a
capture ... inanchored atsitethat capturessource, which is an access, and stores it intarget.Declaration
-
Creates a
close_captureanchored atsitethat ends the exposition of a captured access.Declaration
Swift
func makeCloseCapture(_ start: Operand, at site: SourceRange) -> CloseCapture -
Creates an
close_unionanchored atsitethat ends an access to the payload of a union opened previously bystart.Declaration
Swift
func makeCloseUnion(_ start: Operand, at site: SourceRange) -> CloseUnion -
Creates a
cond_branchanchored atsitethat jumps totargetIfTrueifconditionis true ortargetIfFalseotherwise.Declaration
Parameters
conditionThe condition tested to select the jump destination. Must a built-in
i1object.targetIfTrueThe block in which control flow jumps if
conditionis true.targetIfFalseThe block in which control flow jumps if
conditionis false. -
Creates a
constant_stringanchored atsitethat returns a string with givenvalue, encoded in UTF8.Declaration
Swift
func makeConstantString(utf8 value: Data, at site: SourceRange) -> ConstantString -
Creates a
dealloc_stackanchored atsitethat deallocates memory allocated byalloc.Declaration
Swift
func makeDeallocStack(for alloc: Operand, at site: SourceRange) -> DeallocStackParameters
allocThe address of the memory to deallocate. Must be the result of
alloc. -
Creates an
end_accessanchored atsitethat ends the projection created bystart. -
Creates an
end_projectanchored atsitethat ends the projection created bystart.Declaration
Swift
func makeEndProject(_ start: Operand, at site: SourceRange) -> EndProject -
Creates an
generic_parameteranchored atsitethat returns the address of the generic argument passed top.Declaration
Swift
func makeGenericParameter( passedTo p: GenericParameterDecl.ID, at site: SourceRange ) -> GenericParameter -
Creates an
global_addranchored atsitethat returns the address ofbinding.Declaration
Swift
func makeGlobalAddr(of binding: BindingDecl.ID, at anchor: SourceRange) -> GlobalAddr -
Creates a
loadanchored atsitethat loads the object atsource.Parameters
sourceThe location from which the object is loaded. Must be the result of an
accessinstruction requesting asinkcapability. -
Creates a
mark_stateinstruction anchored atsitethat marksstoragehas being fully initialized ifinitializedistrueor fully uninitialized otherwise.Declaration
-
Creates an
memory_copyanchored atsitethat copies the memory representation of the value stored atsourcetotarget.Requires
sourceis alet-capable access andtargetis aset-capable access.sourceandtargethave the same type.Declaration
Swift
func makeMemoryCopy(_ source: Operand, _ target: Operand, at site: SourceRange) -> MemoryCopy -
Creates a
moveanchored atsitethat movesvalueintostorageusing the move operations defined bymovable.This instruction is replaced during IR transformation by either the initialization or assignment of
storage, depending on its initialization state.Declaration
Swift
func makeMove( _ value: Operand, to storage: Operand, usingConformance movable: FrontEnd.Conformance, at site: SourceRange ) -> MoveParameters
valueThe object to move. Must have an address type.
storageThe location to initialize or assign. Must have an address type.
-
Creates an
open_captureanchored atsitethat loads the address stored atsource.Declaration
Swift
func makeOpenCapture(_ source: Operand, at site: SourceRange) -> OpenCapture -
Creates an
open_unionanchored atsitethat projects the address ofcontainer‘s payload viewed as an instance ofpayload.If the bits of the union’s discriminator are hidden in its storage, this function removes them before projecting the address unless
isUsedForInitializationistrue.Declaration
-
Creates a
pointer_to_addressanchored atsitethat convertssource, which is a built-in pointer value, to an address of typetarget.Declaration
Swift
func makePointerToAddress( _ source: Operand, to target: RemoteType, at site: SourceRange ) -> PointerToAddress -
Creates a
projectanchored atsitethat projects a value of typetby applyings, which is a reference to a lowered subscript, onarguments.Declaration
Swift
func makeProject( _ t: RemoteType, applying s: FunctionReference, to arguments: [Operand], at site: SourceRange ) -> Project -
Creates a
projectanchored atsitethat projects a value of typetby applyings, which is a lowered subscript, specialized byz, onarguments.Declaration
-
Creates a
project_bundleanchored atsitethat applies one of the variants defined inmto argumentsa, canonicalizing types inscopeOfUse.Declaration
Swift
mutating func makeProjectBundle( applying m: BundleReference<SubscriptDecl>, to a: [Operand], at site: SourceRange, canonicalizingTypesIn scopeOfUse: AnyScopeID ) -> ProjectBundle -
Creates a region exit anchored at
sitemarking an exit of the regions started bystart.Declaration
Swift
func makeRegionExit<Entry: RegionEntry>( _ start: Operand, at anchor: SourceRange ) -> RegionExit<Entry> -
Creates a
release_captureanchored atsitethat releases the accesses previously captured incontainer.Declaration
Swift
func makeReleaseCapture(_ container: Operand, at site: SourceRange) -> ReleaseCaptures -
Creates a
returnanchored atsite.Declaration
Swift
func makeReturn(at site: SourceRange) -> Return -
Creates a
recordanchored atsitethat storesobjectat `target.Declaration
Parameters
objectThe object to store. Must have an object type.
targetThe location at which
objectis stored. Must have an address type. -
Creates a
subfield_viewanchored atsitecomputing the address of the givensubfieldof some record atrecordAddress.Note
baseis returned unchanged ifelementPathis empty.Declaration
Swift
func makeSubfieldView( of recordAddress: Operand, subfield elementPath: RecordPath, at site: SourceRange ) -> SubfieldView -
Creates a
switchanchored atsitethat jumps tosuccessors[i].Requires
iis a valid index insuccessors, expressed as a built-in integer, andsuccessorsis not empty.Declaration
-
Creates a
union_discriminatoranchored atsitethat returns the discriminator of the element stored incontainer.Declaration
Swift
func makeUnionDiscriminator( _ container: Operand, at site: SourceRange ) -> UnionDiscriminator -
Creates a
union_switchanchored atsitethat switches overdiscriminator, which is the discriminator of a container of typeunion, jumping to corresponding block intarget.If
unionis generic,discriminatorshould be the result ofunion_discriminatorrather than a constant.Requires
targetshas a key defined for each ofunion.Declaration
Swift
func makeUnionSwitch( over discriminator: Operand, of union: UnionType, toOneOf targets: UnionSwitch.Targets, at site: SourceRange ) -> UnionSwitch -
Creates an
unreachableanchored atsitethat marks the execution path unreachable.Declaration
Swift
func makeUnreachable(at site: SourceRange) -> Unreachable -
Creates a
wrap_existential_addranchored atsitethat creates an existential container of typeinterfacewrappingwitnessandtable.Declaration
Swift
func makeWrapExistentialAddr( _ witness: Operand, _ table: Operand, as interface: ExistentialType, at site: SourceRange ) -> WrapExistentialAddrParameters
witnessThe address of the object wrapped in the container.
interfaceThe type of the container.
tableThe witness table of the wrapped value. Must be a pointer to a witness table.
-
Creates a
yieldanchored atsitethat projectsawith capabilityc.
View on GitHub