Target-neutral semantic machine IR
pub suberror MachVVerifyError {
EmptyFunction
InvalidFunction(message~ : String)
ForeignValue(value_id~ : Int)
ForeignBlock(block_id~ : Int)
ForeignInstruction(instruction_id~ : Int)
ForeignStackObject(object_id~ : Int)
InvalidStackObject(object_id~ : Int, message~ : String)
TerminatorAlreadySet(block_id~ : Int)
MissingTerminator(block_id~ : Int)
EntryHasBlockParameters
EntryHasPredecessor(block_id~ : Int)
UnreachableBlock(block_id~ : Int)
InvalidValueDefinition(value_id~ : Int)
DuplicateValueDefinition(value_id~ : Int)
DuplicateInstructionMembership(instruction_id~ : Int)
OrphanInstruction(instruction_id~ : Int)
RemovedValueUse(value_id~ : Int)
UseBeforeDefinition(value_id~ : Int, block_id~ : Int, instruction_id~ : Int)
NonDominatingUse(value_id~ : Int, defining_block_id~ : Int, use_block_id~ : Int)
InvalidOperation(block_id~ : Int, message~ : String)
InvalidInstruction(block_id~ : Int, instruction_id~ : Int, message~ : String)
InvalidEdge(block_id~ : Int, target_id~ : Int, message~ : String)
InvalidTerminator(block_id~ : Int, message~ : String)
InvalidSafepoint(block_id~ : Int, message~ : String)
MissingGcRoot(block_id~ : Int, instruction_id~ : Int, value_id~ : Int)
InvalidMetadata(block_id~ : Int, message~ : String)
} derive(Eq, Debug)impl Show for MachVVerifyErrorpub struct AtomicSpec {
width : AccessWidth
value_type : ValueType
offset : UInt64
endianness : Endianness
trap : TrapReason?
} derive(Eq, Hash, Debug)fn AtomicSpec::new(width : AccessWidth, value_type : ValueType, offset : UInt64, endianness : Endianness, trap : TrapReason?) -> AtomicSpecpub struct Block {
// private fields
}pub struct CallBehavior {
memory : MemoryEffect
may_trap : Bool
may_unwind : Bool
gc_safepoint : Bool
cancellation_safepoint : Bool
returns_twice : Bool
} derive(Eq, Hash, Debug)fn CallBehavior::new(memory : MemoryEffect, may_trap : Bool, may_unwind : Bool, gc_safepoint : Bool, cancellation_safepoint : Bool, returns_twice? : Bool) -> CallBehaviorpub(all) enum Callee {
Internal(CodeSymbol)
External(ExternalSymbol)
Indirect
} derive(Eq, Hash, Debug)pub(all) enum ConversionOp {
I32WrapI64
I64ExtendI32(Signedness)
F32DemoteF64
F64PromoteF32
FloatToInt(FloatType, IntegerType, Signedness, ConversionMode)
IntToFloat(IntegerType, FloatType, Signedness)
SignExtend(IntegerType, AccessWidth)
Bitcast(ValueType, ValueType)
} derive(Eq, Hash, Debug)pub struct EnvironmentFieldUseGroup {
field : EnvironmentField
stability : EnvironmentFieldStability
context : Value
occurrences : Array[Instruction]
call_free_regions : Array[EnvironmentFieldUseRegion]
context_use_count : Int
can_replace_context_carrier : Bool
} derive(Eq, Debug)pub struct EnvironmentFieldUseRegion {
block : Block
segment_index : Int
occurrences : Array[Instruction]
} derive(Eq, Debug)pub struct Function {
// private fields
}fn Function::instruction_metadata(self : Function, instruction : Instruction) -> InstructionMetadata?pub struct FunctionBuilder {
// private fields
}fn FunctionBuilder::branch(self : FunctionBuilder, condition : Value, true_target : Block, true_arguments : Array[Value], false_target : Block, false_arguments : Array[Value]) -> Unitfn FunctionBuilder::create_block(self : FunctionBuilder, parameter_types : Array[ValueType]) -> Blockfn FunctionBuilder::create_stack_object(self : FunctionBuilder, size : Int, alignment : Int) -> StackObjectfn FunctionBuilder::emit(self : FunctionBuilder, operation : Operation, operands : Array[Value], result_types : Array[ValueType]) -> Array[Value]fn FunctionBuilder::emit_with_metadata(self : FunctionBuilder, operation : Operation, operands : Array[Value], result_types : Array[ValueType], metadata : InstructionMetadata) -> Array[Value]fn FunctionBuilder::new(name : String, protocol : CallProtocol, params : Array[ValueType], results : Array[ValueType]) -> FunctionBuilderfn FunctionBuilder::noreturn_call(self : FunctionBuilder, call : SemanticCall, operands : Array[Value]) -> Unitfn FunctionBuilder::noreturn_call_with_metadata(self : FunctionBuilder, call : SemanticCall, operands : Array[Value], metadata : TerminatorMetadata) -> Unitfn FunctionBuilder::switch(self : FunctionBuilder, index : Value, cases : Array[(UInt64, Block, Array[Value])], default_target : Block, default_arguments : Array[Value]) -> Unitfn FunctionBuilder::tail_call(self : FunctionBuilder, call : SemanticCall, operands : Array[Value]) -> Unitfn FunctionBuilder::tail_call_with_metadata(self : FunctionBuilder, call : SemanticCall, operands : Array[Value], metadata : TerminatorMetadata) -> Unitpub struct Instruction {
// private fields
}impl Eq for Instructionimpl Hash for Instructionimpl Debug for Instructionpub struct InstructionMetadata {
source : SourceLocation?
live_gc_roots : Array[Value]
stack_map : StackMapMetadata?
} derive(Eq, Debug)fn InstructionMetadata::new(source : SourceLocation?, live_gc_roots : Array[Value], stack_map? : StackMapMetadata) -> InstructionMetadatapub(all) enum IntOverflowOp {
Add(Signedness)
Sub(Signedness)
Mul(Signedness)
} derive(Eq, Hash, Debug)pub struct LoadSpec {
width : AccessWidth
extension : LoadExtension
result_type : ValueType
offset : UInt64
endianness : Endianness
trap : TrapReason?
} derive(Eq, Hash, Debug)fn LoadSpec::new(width : AccessWidth, extension : LoadExtension, result_type : ValueType, offset : UInt64, endianness : Endianness, trap : TrapReason?) -> LoadSpecpub(all) enum Operation {
I32Const(UInt)
I64Const(UInt64)
F32Const(UInt)
F64Const(UInt64)
V128Const(UInt64, UInt64)
NullPtr
NullGcRef
CodeAddress(CodeSymbol)
ExternalAddress(ExternalSymbol)
DataAddress(DataSymbol)
EnvironmentField(EnvironmentField, EnvironmentFieldStability)
StackAddress(StackObject)
Copy
Select
GcRefAddress
GcRefFromBits
PointerOffset
ReferenceCompare(ReferenceComparison)
IntUnary(IntUnaryOp)
IntBinary(IntBinaryOp)
IntHighMultiply(Signedness)
IntWithOverflow(IntOverflowOp)
IntCompare(IntComparison)
FloatUnary(FloatUnaryOp)
FloatBinary(FloatBinaryOp)
FloatTernary(FloatTernaryOp)
FloatCompare(FloatComparison)
Convert(ConversionOp)
Load(LoadSpec)
Store(StoreSpec)
AtomicLoad(AtomicSpec)
AtomicStore(AtomicSpec)
AtomicRmw(AtomicSpec, AtomicRmwOp)
AtomicCompareExchange(AtomicSpec)
AtomicFence
Vector(VectorOp)
VectorLoad(VectorLoadSpec)
VectorStoreLane(VectorStoreLaneSpec)
Call(SemanticCall)
Safepoint(SafepointKind)
} derive(Eq, Debug)pub struct OperationSemantics {
memory : MemoryEffect
may_trap : Bool
may_unwind : Bool
gc_safepoint : Bool
cancellation_safepoint : Bool
returns_twice : Bool
} derive(Eq, Hash, Debug)pub struct SemanticCall {
callee : Callee
signature : Signature
protocol : CallProtocol
behavior : CallBehavior
} derive(Eq, Hash, Debug)fn SemanticCall::new(callee : Callee, signature : Signature, protocol : CallProtocol, behavior : CallBehavior) -> SemanticCallpub struct StackObject {
// private fields
}impl Eq for StackObjectimpl Hash for StackObjectimpl Debug for StackObjectpub struct StoreSpec {
width : AccessWidth
value_type : ValueType
offset : UInt64
endianness : Endianness
trap : TrapReason?
} derive(Eq, Hash, Debug)fn StoreSpec::new(width : AccessWidth, value_type : ValueType, offset : UInt64, endianness : Endianness, trap : TrapReason?) -> StoreSpecpub(all) enum Terminator {
Jump(Edge)
Branch(Value, Edge, Edge)
Switch(Value, Array[SwitchCase], Edge)
Return(Array[Value])
TailCall(SemanticCall, Array[Value])
NoReturnCall(SemanticCall, Array[Value])
Trap(TrapReason)
} derive(Eq, Debug)pub struct TerminatorMetadata {
source : SourceLocation?
live_gc_roots : Array[Value]
} derive(Eq, Debug)fn TerminatorMetadata::new(source : SourceLocation?, live_gc_roots : Array[Value]) -> TerminatorMetadatapub struct Value {
// private fields
}pub(all) enum VectorConversionOp {
ExtendLow(VectorLane, Signedness)
ExtendHigh(VectorLane, Signedness)
Narrow(VectorLane, Signedness)
FloatToInt(VectorLane, VectorLane, Signedness, ConversionMode)
IntToFloat(VectorLane, VectorLane, Signedness)
PromoteLowF32x4
DemoteZeroF64x2
} derive(Eq, Hash, Debug)pub(all) enum VectorIntBinaryOp {
Add
Sub
Mul
Min(Signedness)
Max(Signedness)
AverageUnsigned
SaturatingAdd(Signedness)
SaturatingSub(Signedness)
ExtendMultiply(VectorHalf, Signedness)
Dot16To32Signed
Q15MultiplyRoundedSaturating
} derive(Eq, Hash, Debug)pub(all) enum VectorIntComparison {
Equal
NotEqual
LessThan(Signedness)
LessOrEqual(Signedness)
GreaterThan(Signedness)
GreaterOrEqual(Signedness)
} derive(Eq, Hash, Debug)pub(all) enum VectorIntUnaryOp {
Absolute
Negate
PopulationCount
ExtendAddPairwise(Signedness)
} derive(Eq, Hash, Debug)pub(all) enum VectorLoadKind {
Splat(VectorLane)
Extend(VectorLane, Signedness)
Zero(AccessWidth)
Lane(VectorLane, Int)
} derive(Eq, Hash, Debug)pub struct VectorLoadSpec {
kind : VectorLoadKind
offset : UInt64
endianness : Endianness
trap : TrapReason?
} derive(Eq, Hash, Debug)fn VectorLoadSpec::new(kind : VectorLoadKind, offset : UInt64, endianness : Endianness, trap : TrapReason?) -> VectorLoadSpecpub(all) enum VectorOp {
Splat(VectorLane)
ExtractLane(VectorLane, Int, Signedness?)
ReplaceLane(VectorLane, Int)
Shuffle(FixedArray[Int])
Swizzle
Bitwise(VectorBitwiseOp)
IntUnary(VectorLane, VectorIntUnaryOp)
IntBinary(VectorLane, VectorIntBinaryOp)
IntShift(VectorLane, VectorIntShiftOp)
IntCompare(VectorLane, VectorIntComparison)
FloatUnary(VectorLane, VectorFloatUnaryOp)
FloatBinary(VectorLane, VectorFloatBinaryOp)
FloatTernary(VectorLane, FloatTernaryOp)
FloatCompare(VectorLane, VectorFloatComparison)
Predicate(VectorPredicateOp)
Convert(VectorConversionOp)
Relaxed(VectorRelaxedOp)
} derive(Eq, Debug)pub(all) enum VectorPredicateOp {
AnyTrue
AllTrue(VectorLane)
BitMask(VectorLane)
} derive(Eq, Hash, Debug)pub(all) enum VectorRelaxedOp {
Swizzle
FloatToInt(VectorLane, VectorLane, Signedness)
FusedMultiplyAdd(VectorLane, FloatTernaryOp)
LaneSelect(VectorLane)
Min(VectorLane)
Max(VectorLane)
Q15MultiplyRoundedSigned
Dot8To16Signed
Dot8To32AddSigned
} derive(Eq, Hash, Debug)pub struct VectorStoreLaneSpec {
lane : VectorLane
lane_index : Int
offset : UInt64
endianness : Endianness
trap : TrapReason?
} derive(Eq, Hash, Debug)fn VectorStoreLaneSpec::new(lane : VectorLane, lane_index : Int, offset : UInt64, endianness : Endianness, trap : TrapReason?) -> VectorStoreLaneSpecTarget-neutral semantic machine IR