[−][src]Trait cranelift_codegen::ir::InstBuilder
Convenience methods for building instructions.
The InstBuilder
trait has one method per instruction opcode for
conveniently constructing the instruction with minimum arguments.
Polymorphic instructions infer their result types from the input
arguments when possible. In some cases, an explicit ctrl_typevar
argument is required.
The opcode methods return the new instruction's result values, or
the Inst
itself for instructions that don't have any results.
There is also a method per instruction format. These methods all
return an Inst
.
Provided methods
fn jump(self, EBB: Ebb, args: &[Value]) -> Inst
Jump.
Unconditionally jump to an extended basic block, passing the specified EBB arguments. The number and types of arguments must match the destination EBB.
Inputs:
- EBB: Destination extended basic block
- args: EBB arguments
fn fallthrough(self, EBB: Ebb, args: &[Value]) -> Inst
Fall through to the next EBB.
This is the same as jump
, except the destination EBB must be
the next one in the layout.
Jumps are turned into fall-through instructions by the branch relaxation pass. There is no reason to use this instruction outside that pass.
Inputs:
- EBB: Destination extended basic block
- args: EBB arguments
fn brz(self, c: Value, EBB: Ebb, args: &[Value]) -> Inst
Branch when zero.
If c
is a b1
value, take the branch when c
is false. If
c
is an integer value, take the branch when c = 0
.
Inputs:
- c: Controlling value to test
- EBB: Destination extended basic block
- args: EBB arguments
fn brnz(self, c: Value, EBB: Ebb, args: &[Value]) -> Inst
Branch when non-zero.
If c
is a b1
value, take the branch when c
is true. If
c
is an integer value, take the branch when c != 0
.
Inputs:
- c: Controlling value to test
- EBB: Destination extended basic block
- args: EBB arguments
fn br_icmp<T1: Into<IntCC>>(
self,
Cond: T1,
x: Value,
y: Value,
EBB: Ebb,
args: &[Value]
) -> Inst
self,
Cond: T1,
x: Value,
y: Value,
EBB: Ebb,
args: &[Value]
) -> Inst
Compare scalar integers and branch.
Compare x
and y
in the same way as the icmp
instruction
and take the branch if the condition is true:
br_icmp ugt v1, v2, ebb4(v5, v6)
is semantically equivalent to:
v10 = icmp ugt, v1, v2
brnz v10, ebb4(v5, v6)
Some RISC architectures like MIPS and RISC-V provide instructions that implement all or some of the condition codes. The instruction can also be used to represent macro-op fusion on architectures like Intel's.
Inputs:
- Cond: An integer comparison condition code.
- x: A scalar integer type
- y: A scalar integer type
- EBB: Destination extended basic block
- args: EBB arguments
fn brif<T1: Into<IntCC>>(
self,
Cond: T1,
f: Value,
EBB: Ebb,
args: &[Value]
) -> Inst
self,
Cond: T1,
f: Value,
EBB: Ebb,
args: &[Value]
) -> Inst
Branch when condition is true in integer CPU flags.
Inputs:
- Cond: An integer comparison condition code.
- f: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code. - EBB: Destination extended basic block
- args: EBB arguments
fn brff<T1: Into<FloatCC>>(
self,
Cond: T1,
f: Value,
EBB: Ebb,
args: &[Value]
) -> Inst
self,
Cond: T1,
f: Value,
EBB: Ebb,
args: &[Value]
) -> Inst
Branch when condition is true in floating point CPU flags.
Inputs:
- Cond: A floating point comparison condition code
- f: CPU flags representing the result of a floating point comparison. These
flags can be tested with a :type:
floatcc
condition code. - EBB: Destination extended basic block
- args: EBB arguments
fn br_table(self, x: Value, EBB: Ebb, JT: JumpTable) -> Inst
Indirect branch via jump table.
Use x
as an unsigned index into the jump table JT
. If a jump
table entry is found, branch to the corresponding EBB. If no entry was
found or the index is out-of-bounds, branch to the given default EBB.
Note that this branch instruction can't pass arguments to the targeted blocks. Split critical edges as needed to work around this.
Do not confuse this with "tables" in WebAssembly. br_table
is for
jump tables with destinations within the current function only -- think
of a match
in Rust or a switch
in C. If you want to call a
function in a dynamic library, that will typically use
call_indirect
.
Inputs:
- x: index into jump table
- EBB: Destination extended basic block
- JT: A jump table.
fn jump_table_entry<T1: Into<Uimm8>>(
self,
x: Value,
addr: Value,
Size: T1,
JT: JumpTable
) -> Value
self,
x: Value,
addr: Value,
Size: T1,
JT: JumpTable
) -> Value
Get an entry from a jump table.
Load a serialized entry
from a jump table JT
at a given index
addr
with a specific Size
. The retrieved entry may need to be
decoded after loading, depending upon the jump table type used.
Currently, the only type supported is entries which are relative to the base of the jump table.
Inputs:
- x: index into jump table
- addr: An integer address type
- Size: Size in bytes
- JT: A jump table.
Outputs:
- entry: entry of jump table
fn jump_table_base(self, iAddr: Type, JT: JumpTable) -> Value
Get the absolute base address of a jump table.
This is used for jump tables wherein the entries are stored relative to
the base of jump table. In order to use these, generated code should first
load an entry using jump_table_entry
, then use this instruction to add
the relative base back to it.
Inputs:
- iAddr (controlling type variable): An integer address type
- JT: A jump table.
Outputs:
- addr: An integer address type
fn indirect_jump_table_br(self, addr: Value, JT: JumpTable) -> Inst
Branch indirectly via a jump table entry.
Unconditionally jump via a jump table entry that was previously loaded
with the jump_table_entry
instruction.
Inputs:
- addr: An integer address type
- JT: A jump table.
fn debugtrap(self) -> Inst
Encodes an assembly debug trap.
fn trap<T1: Into<TrapCode>>(self, code: T1) -> Inst
Terminate execution unconditionally.
Inputs:
- code: A trap reason code.
fn trapz<T1: Into<TrapCode>>(self, c: Value, code: T1) -> Inst
Trap when zero.
if c
is non-zero, execution continues at the following instruction.
Inputs:
- c: Controlling value to test
- code: A trap reason code.
fn resumable_trap<T1: Into<TrapCode>>(self, code: T1) -> Inst
A resumable trap.
This instruction allows non-conditional traps to be used as non-terminal instructions.
Inputs:
- code: A trap reason code.
fn trapnz<T1: Into<TrapCode>>(self, c: Value, code: T1) -> Inst
Trap when non-zero.
if c
is zero, execution continues at the following instruction.
Inputs:
- c: Controlling value to test
- code: A trap reason code.
fn trapif<T1: Into<IntCC>, T2: Into<TrapCode>>(
self,
Cond: T1,
f: Value,
code: T2
) -> Inst
self,
Cond: T1,
f: Value,
code: T2
) -> Inst
Trap when condition is true in integer CPU flags.
Inputs:
- Cond: An integer comparison condition code.
- f: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code. - code: A trap reason code.
fn trapff<T1: Into<FloatCC>, T2: Into<TrapCode>>(
self,
Cond: T1,
f: Value,
code: T2
) -> Inst
self,
Cond: T1,
f: Value,
code: T2
) -> Inst
Trap when condition is true in floating point CPU flags.
Inputs:
- Cond: A floating point comparison condition code
- f: CPU flags representing the result of a floating point comparison. These
flags can be tested with a :type:
floatcc
condition code. - code: A trap reason code.
fn return_(self, rvals: &[Value]) -> Inst
Return from the function.
Unconditionally transfer control to the calling function, passing the provided return values. The list of return values must match the function signature's return types.
Inputs:
- rvals: return values
fn fallthrough_return(self, rvals: &[Value]) -> Inst
Return from the function by fallthrough.
This is a specialized instruction for use where one wants to append a custom epilogue, which will then perform the real return. This instruction has no encoding.
Inputs:
- rvals: return values
fn call(self, FN: FuncRef, args: &[Value]) -> Inst
Direct function call.
Call a function which has been declared in the preamble. The argument types must match the function's signature.
Inputs:
- FN: function to call, declared by
function
- args: call arguments
Outputs:
- rvals: return values
fn call_indirect(self, SIG: SigRef, callee: Value, args: &[Value]) -> Inst
Indirect function call.
Call the function pointed to by callee
with the given arguments. The
called function must match the specified signature.
Note that this is different from WebAssembly's call_indirect
; the
callee is a native address, rather than a table index. For WebAssembly,
table_addr
and load
are used to obtain a native address
from a table.
Inputs:
- SIG: function signature
- callee: address of function to call
- args: call arguments
Outputs:
- rvals: return values
fn func_addr(self, iAddr: Type, FN: FuncRef) -> Value
Get the address of a function.
Compute the absolute address of a function declared in the preamble.
The returned address can be used as a callee
argument to
call_indirect
. This is also a method for calling functions that
are too far away to be addressable by a direct call
instruction.
Inputs:
- iAddr (controlling type variable): An integer address type
- FN: function to call, declared by
function
Outputs:
- addr: An integer address type
fn load<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
Mem: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
self,
Mem: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
Load from memory at p + Offset
.
This is a polymorphic instruction that can load any value type which has a memory representation.
Inputs:
- Mem (controlling type variable): Any type that can be stored in memory
- MemFlags: Memory operation flags
- p: An integer address type
- Offset: Byte offset from base address
Outputs:
- a: Value loaded
fn load_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
Mem: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
self,
Mem: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
Load from memory at sum(args) + Offset
.
This is a polymorphic instruction that can load any value type which has a memory representation.
Inputs:
- Mem (controlling type variable): Any type that can be stored in memory
- MemFlags: Memory operation flags
- args: Address arguments
- Offset: Byte offset from base address
Outputs:
- a: Value loaded
fn store<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
Store x
to memory at p + Offset
.
This is a polymorphic instruction that can store any value type with a memory representation.
Inputs:
- MemFlags: Memory operation flags
- x: Value to be stored
- p: An integer address type
- Offset: Byte offset from base address
fn store_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
Store x
to memory at sum(args) + Offset
.
This is a polymorphic instruction that can store any value type with a memory representation.
Inputs:
- MemFlags: Memory operation flags
- x: Value to be stored
- args: Address arguments
- Offset: Byte offset from base address
fn uload8<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt8: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
self,
iExt8: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
Load 8 bits from memory at p + Offset
and zero-extend.
This is equivalent to load.i8
followed by uextend
.
Inputs:
- iExt8 (controlling type variable): An integer type with more than 8 bits
- MemFlags: Memory operation flags
- p: An integer address type
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 8 bits
fn uload8_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt8: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
self,
iExt8: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
Load 8 bits from memory at sum(args) + Offset
and zero-extend.
This is equivalent to load.i8
followed by uextend
.
Inputs:
- iExt8 (controlling type variable): An integer type with more than 8 bits
- MemFlags: Memory operation flags
- args: Address arguments
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 8 bits
fn sload8<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt8: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
self,
iExt8: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
Load 8 bits from memory at p + Offset
and sign-extend.
This is equivalent to load.i8
followed by sextend
.
Inputs:
- iExt8 (controlling type variable): An integer type with more than 8 bits
- MemFlags: Memory operation flags
- p: An integer address type
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 8 bits
fn sload8_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt8: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
self,
iExt8: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
Load 8 bits from memory at sum(args) + Offset
and sign-extend.
This is equivalent to load.i8
followed by sextend
.
Inputs:
- iExt8 (controlling type variable): An integer type with more than 8 bits
- MemFlags: Memory operation flags
- args: Address arguments
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 8 bits
fn istore8<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
Store the low 8 bits of x
to memory at p + Offset
.
This is equivalent to ireduce.i8
followed by store.i8
.
Inputs:
- MemFlags: Memory operation flags
- x: An integer type with more than 8 bits
- p: An integer address type
- Offset: Byte offset from base address
fn istore8_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
Store the low 8 bits of x
to memory at sum(args) + Offset
.
This is equivalent to ireduce.i8
followed by store.i8
.
Inputs:
- MemFlags: Memory operation flags
- x: An integer type with more than 8 bits
- args: Address arguments
- Offset: Byte offset from base address
fn uload16<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt16: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
self,
iExt16: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
Load 16 bits from memory at p + Offset
and zero-extend.
This is equivalent to load.i16
followed by uextend
.
Inputs:
- iExt16 (controlling type variable): An integer type with more than 16 bits
- MemFlags: Memory operation flags
- p: An integer address type
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 16 bits
fn uload16_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt16: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
self,
iExt16: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
Load 16 bits from memory at sum(args) + Offset
and zero-extend.
This is equivalent to load.i16
followed by uextend
.
Inputs:
- iExt16 (controlling type variable): An integer type with more than 16 bits
- MemFlags: Memory operation flags
- args: Address arguments
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 16 bits
fn sload16<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt16: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
self,
iExt16: Type,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
Load 16 bits from memory at p + Offset
and sign-extend.
This is equivalent to load.i16
followed by sextend
.
Inputs:
- iExt16 (controlling type variable): An integer type with more than 16 bits
- MemFlags: Memory operation flags
- p: An integer address type
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 16 bits
fn sload16_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
iExt16: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
self,
iExt16: Type,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
Load 16 bits from memory at sum(args) + Offset
and sign-extend.
This is equivalent to load.i16
followed by sextend
.
Inputs:
- iExt16 (controlling type variable): An integer type with more than 16 bits
- MemFlags: Memory operation flags
- args: Address arguments
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 16 bits
fn istore16<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
Store the low 16 bits of x
to memory at p + Offset
.
This is equivalent to ireduce.i16
followed by store.i16
.
Inputs:
- MemFlags: Memory operation flags
- x: An integer type with more than 16 bits
- p: An integer address type
- Offset: Byte offset from base address
fn istore16_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
Store the low 16 bits of x
to memory at sum(args) + Offset
.
This is equivalent to ireduce.i16
followed by store.i16
.
Inputs:
- MemFlags: Memory operation flags
- x: An integer type with more than 16 bits
- args: Address arguments
- Offset: Byte offset from base address
fn uload32<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
self,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
Load 32 bits from memory at p + Offset
and zero-extend.
This is equivalent to load.i32
followed by uextend
.
Inputs:
- MemFlags: Memory operation flags
- p: An integer address type
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 32 bits
fn uload32_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
self,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
Load 32 bits from memory at sum(args) + Offset
and zero-extend.
This is equivalent to load.i32
followed by uextend
.
Inputs:
- MemFlags: Memory operation flags
- args: Address arguments
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 32 bits
fn sload32<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
self,
MemFlags: T1,
p: Value,
Offset: T2
) -> Value
Load 32 bits from memory at p + Offset
and sign-extend.
This is equivalent to load.i32
followed by sextend
.
Inputs:
- MemFlags: Memory operation flags
- p: An integer address type
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 32 bits
fn sload32_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
self,
MemFlags: T1,
args: &[Value],
Offset: T2
) -> Value
Load 32 bits from memory at sum(args) + Offset
and sign-extend.
This is equivalent to load.i32
followed by sextend
.
Inputs:
- MemFlags: Memory operation flags
- args: Address arguments
- Offset: Byte offset from base address
Outputs:
- a: An integer type with more than 32 bits
fn istore32<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
p: Value,
Offset: T2
) -> Inst
Store the low 32 bits of x
to memory at p + Offset
.
This is equivalent to ireduce.i32
followed by store.i32
.
Inputs:
- MemFlags: Memory operation flags
- x: An integer type with more than 32 bits
- p: An integer address type
- Offset: Byte offset from base address
fn istore32_complex<T1: Into<MemFlags>, T2: Into<Offset32>>(
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
self,
MemFlags: T1,
x: Value,
args: &[Value],
Offset: T2
) -> Inst
Store the low 32 bits of x
to memory at sum(args) + Offset
.
This is equivalent to ireduce.i32
followed by store.i32
.
Inputs:
- MemFlags: Memory operation flags
- x: An integer type with more than 32 bits
- args: Address arguments
- Offset: Byte offset from base address
fn stack_load<T1: Into<Offset32>>(
self,
Mem: Type,
SS: StackSlot,
Offset: T1
) -> Value
self,
Mem: Type,
SS: StackSlot,
Offset: T1
) -> Value
Load a value from a stack slot at the constant offset.
This is a polymorphic instruction that can load any value type which has a memory representation.
The offset is an immediate constant, not an SSA value. The memory
access cannot go out of bounds, i.e.
sizeof(a) + Offset <= sizeof(SS)
.
Inputs:
- Mem (controlling type variable): Any type that can be stored in memory
- SS: A stack slot
- Offset: In-bounds offset into stack slot
Outputs:
- a: Value loaded
fn stack_store<T1: Into<Offset32>>(
self,
x: Value,
SS: StackSlot,
Offset: T1
) -> Inst
self,
x: Value,
SS: StackSlot,
Offset: T1
) -> Inst
Store a value to a stack slot at a constant offset.
This is a polymorphic instruction that can store any value type with a memory representation.
The offset is an immediate constant, not an SSA value. The memory
access cannot go out of bounds, i.e.
sizeof(a) + Offset <= sizeof(SS)
.
Inputs:
- x: Value to be stored
- SS: A stack slot
- Offset: In-bounds offset into stack slot
fn stack_addr<T1: Into<Offset32>>(
self,
iAddr: Type,
SS: StackSlot,
Offset: T1
) -> Value
self,
iAddr: Type,
SS: StackSlot,
Offset: T1
) -> Value
Get the address of a stack slot.
Compute the absolute address of a byte in a stack slot. The offset must
refer to a byte inside the stack slot:
0 <= Offset < sizeof(SS)
.
Inputs:
- iAddr (controlling type variable): An integer address type
- SS: A stack slot
- Offset: In-bounds offset into stack slot
Outputs:
- addr: An integer address type
fn global_value(self, Mem: Type, GV: GlobalValue) -> Value
Compute the value of global GV.
Inputs:
- Mem (controlling type variable): Any type that can be stored in memory
- GV: A global value.
Outputs:
- a: Value loaded
fn symbol_value(self, Mem: Type, GV: GlobalValue) -> Value
Compute the value of global GV, which is a symbolic value.
Inputs:
- Mem (controlling type variable): Any type that can be stored in memory
- GV: A global value.
Outputs:
- a: Value loaded
fn heap_addr<T1: Into<Uimm32>>(
self,
iAddr: Type,
H: Heap,
p: Value,
Size: T1
) -> Value
self,
iAddr: Type,
H: Heap,
p: Value,
Size: T1
) -> Value
Bounds check and compute absolute address of heap memory.
Verify that the offset range p .. p + Size - 1
is in bounds for the
heap H, and generate an absolute address that is safe to dereference.
- If
p + Size
is not greater than the heap bound, return an absolute address corresponding to a byte offset ofp
from the heap's base address. - If
p + Size
is greater than the heap bound, generate a trap.
Inputs:
- iAddr (controlling type variable): An integer address type
- H: A heap.
- p: An unsigned heap offset
- Size: Size in bytes
Outputs:
- addr: An integer address type
fn get_pinned_reg(self, iAddr: Type) -> Value
Gets the content of the pinned register, when it's enabled.
Inputs:
- iAddr (controlling type variable): An integer address type
Outputs:
- addr: An integer address type
fn set_pinned_reg(self, addr: Value) -> Inst
Sets the content of the pinned register, when it's enabled.
Inputs:
- addr: An integer address type
fn table_addr<T1: Into<Offset32>>(
self,
iAddr: Type,
T: Table,
p: Value,
Offset: T1
) -> Value
self,
iAddr: Type,
T: Table,
p: Value,
Offset: T1
) -> Value
Bounds check and compute absolute address of a table entry.
Verify that the offset p
is in bounds for the table T, and generate
an absolute address that is safe to dereference.
Offset
must be less than the size of a table element.
- If
p
is not greater than the table bound, return an absolute address corresponding to a byte offset ofp
from the table's base address. - If
p
is greater than the table bound, generate a trap.
Inputs:
- iAddr (controlling type variable): An integer address type
- T: A table.
- p: An unsigned table offset
- Offset: Byte offset from element address
Outputs:
- addr: An integer address type
fn iconst<T1: Into<Imm64>>(self, Int: Type, N: T1) -> Value
Integer constant.
Create a scalar integer SSA value with an immediate constant value, or an integer vector where all the lanes have the same value.
Inputs:
- Int (controlling type variable): A scalar or vector integer type
- N: A 64-bit immediate integer.
Outputs:
- a: A constant integer scalar or vector value
fn f32const<T1: Into<Ieee32>>(self, N: T1) -> Value
Floating point constant.
Create a f32
SSA value with an immediate constant value.
Inputs:
- N: A 32-bit immediate floating point number.
Outputs:
- a: A constant f32 scalar value
fn f64const<T1: Into<Ieee64>>(self, N: T1) -> Value
Floating point constant.
Create a f64
SSA value with an immediate constant value.
Inputs:
- N: A 64-bit immediate floating point number.
Outputs:
- a: A constant f64 scalar value
fn bconst<T1: Into<bool>>(self, Bool: Type, N: T1) -> Value
Boolean constant.
Create a scalar boolean SSA value with an immediate constant value, or a boolean vector where all the lanes have the same value.
Inputs:
- Bool (controlling type variable): A scalar or vector boolean type
- N: An immediate boolean.
Outputs:
- a: A constant boolean scalar or vector value
fn vconst<T1: Into<Constant>>(self, TxN: Type, N: T1) -> Value
SIMD vector constant.
Construct a vector with the given immediate bytes.
Inputs:
- TxN (controlling type variable): A SIMD vector type
- N: The 16 immediate bytes of a 128-bit vector
Outputs:
- a: A constant vector value
fn shuffle<T1: Into<Immediate>>(self, a: Value, b: Value, mask: T1) -> Value
SIMD vector shuffle.
Shuffle two vectors using the given immediate bytes. For each of the 16 bytes of the immediate, a value i of 0-15 selects the i-th element of the first vector and a value i of 16-31 selects the (i-16)th element of the second vector. Immediate values outside of the 0-31 range place a 0 in the resulting vector lane.
Inputs:
- a: A vector value
- b: A vector value
- mask: The 16 immediate bytes used for selecting the elements to shuffle
Outputs:
- a: A vector value
fn null(self, Ref: Type) -> Value
Null constant value for reference types.
Create a scalar reference SSA value with a constant null value.
Inputs:
- Ref (controlling type variable): A scalar reference type
Outputs:
- a: A constant reference null value
fn nop(self) -> Inst
Just a dummy instruction.
Note: this doesn't compile to a machine code nop.
fn select(self, c: Value, x: Value, y: Value) -> Value
Conditional select.
This instruction selects whole values. Use vselect
for
lane-wise selection.
Inputs:
- c: Controlling value to test
- x: Value to use when
c
is true - y: Value to use when
c
is false
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn selectif<T1: Into<IntCC>>(
self,
Any: Type,
cc: T1,
flags: Value,
x: Value,
y: Value
) -> Value
self,
Any: Type,
cc: T1,
flags: Value,
x: Value,
y: Value
) -> Value
Conditional select, dependent on integer condition codes.
Inputs:
- Any (controlling type variable): Any integer, float, boolean, or reference scalar or vector type
- cc: Controlling condition code
- flags: The machine's flag register
- x: Value to use when
c
is true - y: Value to use when
c
is false
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn bitselect(self, c: Value, x: Value, y: Value) -> Value
Conditional select of bits.
For each bit in c
, this instruction selects the corresponding bit from x
if the bit
in c
is 1 and the corresponding bit from y
if the bit in c
is 0. See also:
select
, vselect
.
Inputs:
- c: Controlling value to test
- x: Value to use when
c
is true - y: Value to use when
c
is false
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn copy(self, x: Value) -> Value
Register-register copy.
This instruction copies its input, preserving the value type.
A pure SSA-form program does not need to copy values, but this instruction is useful for representing intermediate stages during instruction transformations, and the register allocator needs a way of representing register copies.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn spill(self, x: Value) -> Value
Spill a register value to a stack slot.
This instruction behaves exactly like copy
, but the result
value is assigned to a spill slot.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn fill(self, x: Value) -> Value
Load a register value from a stack slot.
This instruction behaves exactly like copy
, but creates a new
SSA value for the spilled input value.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn fill_nop(self, x: Value) -> Value
This is identical to fill
, except it has no encoding, since it is a no-op.
This instruction is created only during late-stage redundant-reload removal, after all
registers and stack slots have been assigned. It is used to replace fill
s that have
been identified as redundant.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn regmove<T1: Into<RegUnit>, T2: Into<RegUnit>>(
self,
x: Value,
src: T1,
dst: T2
) -> Inst
self,
x: Value,
src: T1,
dst: T2
) -> Inst
Temporarily divert x
from src
to dst
.
This instruction moves the location of a value from one register to another without creating a new SSA value. It is used by the register allocator to temporarily rearrange register assignments in order to satisfy instruction constraints.
The register diversions created by this instruction must be undone before the value leaves the EBB. At the entry to a new EBB, all live values must be in their originally assigned registers.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
- src: A register unit in the target ISA
- dst: A register unit in the target ISA
fn copy_special<T1: Into<RegUnit>, T2: Into<RegUnit>>(
self,
src: T1,
dst: T2
) -> Inst
self,
src: T1,
dst: T2
) -> Inst
Copies the contents of ''src'' register to ''dst'' register.
This instructions copies the contents of one register to another register without involving any SSA values. This is used for copying special registers, e.g. copying the stack register to the frame register in a function prologue.
Inputs:
- src: A register unit in the target ISA
- dst: A register unit in the target ISA
fn copy_to_ssa<T1: Into<RegUnit>>(self, Any: Type, src: T1) -> Value
Copies the contents of ''src'' register to ''a'' SSA name.
This instruction copies the contents of one register, regardless of its SSA name, to another register, creating a new SSA name. In that sense it is a one-sided version of ''copy_special''. This instruction is internal and should not be created by Cranelift users.
Inputs:
- Any (controlling type variable): Any integer, float, boolean, or reference scalar or vector type
- src: A register unit in the target ISA
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn copy_nop(self, x: Value) -> Value
Stack-slot-to-the-same-stack-slot copy, which is guaranteed to turn into a no-op. This instruction is for use only within Cranelift itself.
This instruction copies its input, preserving the value type.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
Outputs:
- a: Any integer, float, boolean, or reference scalar or vector type
fn adjust_sp_down(self, delta: Value) -> Inst
Subtracts delta
offset value from the stack pointer register.
This instruction is used to adjust the stack pointer by a dynamic amount.
Inputs:
- delta: A scalar or vector integer type
fn adjust_sp_up_imm<T1: Into<Imm64>>(self, Offset: T1) -> Inst
Adds Offset
immediate offset value to the stack pointer register.
This instruction is used to adjust the stack pointer, primarily in function
prologues and epilogues. Offset
is constrained to the size of a signed
32-bit integer.
Inputs:
- Offset: Offset from current stack pointer
fn adjust_sp_down_imm<T1: Into<Imm64>>(self, Offset: T1) -> Inst
Subtracts Offset
immediate offset value from the stack pointer
register.
This instruction is used to adjust the stack pointer, primarily in function
prologues and epilogues. Offset
is constrained to the size of a signed
32-bit integer.
Inputs:
- Offset: Offset from current stack pointer
fn ifcmp_sp(self, addr: Value) -> Value
Compare addr
with the stack pointer and set the CPU flags.
This is like ifcmp
where addr
is the LHS operand and the stack
pointer is the RHS.
Inputs:
- addr: An integer address type
Outputs:
- f: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn regspill<T1: Into<RegUnit>>(self, x: Value, src: T1, SS: StackSlot) -> Inst
Temporarily divert x
from src
to SS
.
This instruction moves the location of a value from a register to a stack slot without creating a new SSA value. It is used by the register allocator to temporarily rearrange register assignments in order to satisfy instruction constraints.
See also regmove
.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
- src: A register unit in the target ISA
- SS: A stack slot
fn regfill<T1: Into<RegUnit>>(self, x: Value, SS: StackSlot, dst: T1) -> Inst
Temporarily divert x
from SS
to dst
.
This instruction moves the location of a value from a stack slot to a register without creating a new SSA value. It is used by the register allocator to temporarily rearrange register assignments in order to satisfy instruction constraints.
See also regmove
.
Inputs:
- x: Any integer, float, boolean, or reference scalar or vector type
- SS: A stack slot
- dst: A register unit in the target ISA
fn safepoint(self, args: &[Value]) -> Inst
This instruction will provide live reference values at a point in the function. It can only be used by the compiler.
Inputs:
- args: Variable number of args for Stackmap
fn vsplit(self, x: Value) -> (Value, Value)
Split a vector into two halves.
Split the vector x
into two separate values, each containing half of
the lanes from x
. The result may be two scalars if x
only had
two lanes.
Inputs:
- x: Vector to split
Outputs:
- lo: Low-numbered lanes of
x
- hi: High-numbered lanes of
x
fn vconcat(self, x: Value, y: Value) -> Value
Vector concatenation.
Return a vector formed by concatenating x
and y
. The resulting
vector type has twice as many lanes as each of the inputs. The lanes of
x
appear as the low-numbered lanes, and the lanes of y
become
the high-numbered lanes of a
.
It is possible to form a vector by concatenating two scalars.
Inputs:
- x: Low-numbered lanes
- y: High-numbered lanes
Outputs:
- a: Concatenation of
x
andy
fn vselect(self, c: Value, x: Value, y: Value) -> Value
Vector lane select.
Select lanes from x
or y
controlled by the lanes of the boolean
vector c
.
Inputs:
- c: Controlling vector
- x: Value to use where
c
is true - y: Value to use where
c
is false
Outputs:
- a: A SIMD vector type
fn vany_true(self, a: Value) -> Value
Reduce a vector to a scalar boolean.
Return a scalar boolean true if any lane in a
is non-zero, false otherwise.
Inputs:
- a: A SIMD vector type
Outputs:
- s: A boolean type with 1 bits.
fn vall_true(self, a: Value) -> Value
Reduce a vector to a scalar boolean.
Return a scalar boolean true if all lanes in i
are non-zero, false otherwise.
Inputs:
- a: A SIMD vector type
Outputs:
- s: A boolean type with 1 bits.
fn splat(self, TxN: Type, x: Value) -> Value
Vector splat.
Return a vector whose lanes are all x
.
Inputs:
- TxN (controlling type variable): A SIMD vector type
- x:
Outputs:
- a: A SIMD vector type
fn insertlane<T1: Into<Uimm8>>(self, x: Value, Idx: T1, y: Value) -> Value
Insert y
as lane Idx
in x.
The lane index, Idx
, is an immediate value, not an SSA value. It
must indicate a valid lane index for the type of x
.
Inputs:
- x: SIMD vector to modify
- Idx: Lane index
- y: New lane value
Outputs:
- a: A SIMD vector type
fn extractlane<T1: Into<Uimm8>>(self, x: Value, Idx: T1) -> Value
Extract lane Idx
from x
.
The lane index, Idx
, is an immediate value, not an SSA value. It
must indicate a valid lane index for the type of x
. Note that the upper bits of a
may or may not be zeroed depending on the ISA but the type system should prevent using
a
as anything other than the extracted value.
Inputs:
- x: A SIMD vector type
- Idx: Lane index
Outputs:
- a:
fn icmp<T1: Into<IntCC>>(self, Cond: T1, x: Value, y: Value) -> Value
Integer comparison.
The condition code determines if the operands are interpreted as signed or unsigned integers.
Signed | Unsigned | Condition |
---|---|---|
eq | eq | Equal |
ne | ne | Not equal |
slt | ult | Less than |
sge | uge | Greater than or equal |
sgt | ugt | Greater than |
sle | ule | Less than or equal |
of | * | Overflow |
nof | * | No Overflow |
* The unsigned version of overflow conditions have ISA-specific semantics and thus have been kept as methods on the TargetIsa trait as [unsigned_add_overflow_condition][isa::TargetIsa::unsigned_add_overflow_condition] and [unsigned_sub_overflow_condition][isa::TargetIsa::unsigned_sub_overflow_condition].
When this instruction compares integer vectors, it returns a boolean vector of lane-wise comparisons.
Inputs:
- Cond: An integer comparison condition code.
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a:
fn icmp_imm<T1: Into<IntCC>, T2: Into<Imm64>>(
self,
Cond: T1,
x: Value,
Y: T2
) -> Value
self,
Cond: T1,
x: Value,
Y: T2
) -> Value
Compare scalar integer to a constant.
This is the same as the icmp
instruction, except one operand is
an immediate constant.
This instruction can only compare scalars. Use icmp
for
lane-wise vector comparisons.
Inputs:
- Cond: An integer comparison condition code.
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A boolean type with 1 bits.
fn ifcmp(self, x: Value, y: Value) -> Value
Compare scalar integers and return flags.
Compare two scalar integer values and return integer CPU flags representing the result.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
Outputs:
- f: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn ifcmp_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Compare scalar integer to a constant and return flags.
Like icmp_imm
, but returns integer CPU flags instead of testing
a specific condition code.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- f: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn iadd(self, x: Value, y: Value) -> Value
Wrapping integer addition: a := x + y \pmod{2^B}
.
This instruction does not depend on the signed/unsigned interpretation of the operands.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn uadd_sat(self, x: Value, y: Value) -> Value
Add with unsigned saturation.
This is similar to iadd
but the operands are interpreted as unsigned integers and their
summed result, instead of wrapping, will be saturated to the highest unsigned integer for
the controlling type (e.g. 0xFF
for i8).
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn sadd_sat(self, x: Value, y: Value) -> Value
Add with signed saturation.
This is similar to iadd
but the operands are interpreted as signed integers and their
summed result, instead of wrapping, will be saturated to the lowest or highest
signed integer for the controlling type (e.g. 0x80
or 0x7F
for i8). For example,
since an iadd_ssat.i8
of 0x70
and 0x70
is greater than 0x7F
, the result will be
clamped to 0x7F
.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn isub(self, x: Value, y: Value) -> Value
Wrapping integer subtraction: a := x - y \pmod{2^B}
.
This instruction does not depend on the signed/unsigned interpretation of the operands.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn usub_sat(self, x: Value, y: Value) -> Value
Subtract with unsigned saturation.
This is similar to isub
but the operands are interpreted as unsigned integers and their
difference, instead of wrapping, will be saturated to the lowest unsigned integer for
the controlling type (e.g. 0x00
for i8).
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn ssub_sat(self, x: Value, y: Value) -> Value
Subtract with signed saturation.
This is similar to isub
but the operands are interpreted as signed integers and their
difference, instead of wrapping, will be saturated to the lowest or highest
signed integer for the controlling type (e.g. 0x80
or 0x7F
for i8).
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn ineg(self, x: Value) -> Value
Integer negation: a := -x \pmod{2^B}
.
Inputs:
- x: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn imul(self, x: Value, y: Value) -> Value
Wrapping integer multiplication: a := x y \pmod{2^B}
.
This instruction does not depend on the signed/unsigned interpretation of the operands.
Polymorphic over all integer types (vector and scalar).
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn umulhi(self, x: Value, y: Value) -> Value
Unsigned integer multiplication, producing the high half of a double-length result.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn smulhi(self, x: Value, y: Value) -> Value
Signed integer multiplication, producing the high half of a double-length result.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn udiv(self, x: Value, y: Value) -> Value
Unsigned integer division: a := \lfloor {x \over y} \rfloor
.
This operation traps if the divisor is zero.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn sdiv(self, x: Value, y: Value) -> Value
Signed integer division rounded toward zero: a := sign(xy) \lfloor {|x| \over |y|}\rfloor
.
This operation traps if the divisor is zero, or if the result is not
representable in B
bits two's complement. This only happens
when x = -2^{B-1}, y = -1
.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn urem(self, x: Value, y: Value) -> Value
Unsigned integer remainder.
This operation traps if the divisor is zero.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn srem(self, x: Value, y: Value) -> Value
Signed integer remainder. The result has the sign of the dividend.
This operation traps if the divisor is zero.
Inputs:
- x: A scalar or vector integer type
- y: A scalar or vector integer type
Outputs:
- a: A scalar or vector integer type
fn iadd_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Add immediate integer.
Same as iadd
, but one operand is an immediate constant.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn imul_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Integer multiplication by immediate constant.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn udiv_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Unsigned integer division by an immediate constant.
This operation traps if the divisor is zero.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn sdiv_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Signed integer division by an immediate constant.
This operation traps if the divisor is zero, or if the result is not
representable in B
bits two's complement. This only happens
when x = -2^{B-1}, Y = -1
.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn urem_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Unsigned integer remainder with immediate divisor.
This operation traps if the divisor is zero.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn srem_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Signed integer remainder with immediate divisor.
This operation traps if the divisor is zero.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn irsub_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Immediate reverse wrapping subtraction: a := Y - x \pmod{2^B}
.
Also works as integer negation when Y = 0
. Use iadd_imm
with a negative immediate operand for the reverse immediate
subtraction.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn iadd_cin(self, x: Value, y: Value, c_in: Value) -> Value
Add integers with carry in.
Same as iadd
with an additional carry input. Computes:
a = x + y + c_{in} \pmod 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- c_in: Input carry flag
Outputs:
- a: A scalar integer type
fn iadd_ifcin(self, x: Value, y: Value, c_in: Value) -> Value
Add integers with carry in.
Same as iadd
with an additional carry flag input. Computes:
a = x + y + c_{in} \pmod 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- c_in: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
Outputs:
- a: A scalar integer type
fn iadd_cout(self, x: Value, y: Value) -> (Value, Value)
Add integers with carry out.
Same as iadd
with an additional carry output.
a &= x + y \pmod 2^B \\
c_{out} &= x+y >= 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
Outputs:
- a: A scalar integer type
- c_out: Output carry flag
fn iadd_ifcout(self, x: Value, y: Value) -> (Value, Value)
Add integers with carry out.
Same as iadd
with an additional carry flag output.
a &= x + y \pmod 2^B \\
c_{out} &= x+y >= 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
Outputs:
- a: A scalar integer type
- c_out: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn iadd_carry(self, x: Value, y: Value, c_in: Value) -> (Value, Value)
Add integers with carry in and out.
Same as iadd
with an additional carry input and output.
a &= x + y + c_{in} \pmod 2^B \\
c_{out} &= x + y + c_{in} >= 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- c_in: Input carry flag
Outputs:
- a: A scalar integer type
- c_out: Output carry flag
fn iadd_ifcarry(self, x: Value, y: Value, c_in: Value) -> (Value, Value)
Add integers with carry in and out.
Same as iadd
with an additional carry flag input and output.
a &= x + y + c_{in} \pmod 2^B \\
c_{out} &= x + y + c_{in} >= 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- c_in: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
Outputs:
- a: A scalar integer type
- c_out: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn isub_bin(self, x: Value, y: Value, b_in: Value) -> Value
Subtract integers with borrow in.
Same as isub
with an additional borrow flag input. Computes:
a = x - (y + b_{in}) \pmod 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- b_in: Input borrow flag
Outputs:
- a: A scalar integer type
fn isub_ifbin(self, x: Value, y: Value, b_in: Value) -> Value
Subtract integers with borrow in.
Same as isub
with an additional borrow flag input. Computes:
a = x - (y + b_{in}) \pmod 2^B
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- b_in: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
Outputs:
- a: A scalar integer type
fn isub_bout(self, x: Value, y: Value) -> (Value, Value)
Subtract integers with borrow out.
Same as isub
with an additional borrow flag output.
a &= x - y \pmod 2^B \\
b_{out} &= x < y
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
Outputs:
- a: A scalar integer type
- b_out: Output borrow flag
fn isub_ifbout(self, x: Value, y: Value) -> (Value, Value)
Subtract integers with borrow out.
Same as isub
with an additional borrow flag output.
a &= x - y \pmod 2^B \\
b_{out} &= x < y
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
Outputs:
- a: A scalar integer type
- b_out: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn isub_borrow(self, x: Value, y: Value, b_in: Value) -> (Value, Value)
Subtract integers with borrow in and out.
Same as isub
with an additional borrow flag input and output.
a &= x - (y + b_{in}) \pmod 2^B \\
b_{out} &= x < y + b_{in}
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- b_in: Input borrow flag
Outputs:
- a: A scalar integer type
- b_out: Output borrow flag
fn isub_ifborrow(self, x: Value, y: Value, b_in: Value) -> (Value, Value)
Subtract integers with borrow in and out.
Same as isub
with an additional borrow flag input and output.
a &= x - (y + b_{in}) \pmod 2^B \\
b_{out} &= x < y + b_{in}
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- y: A scalar integer type
- b_in: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
Outputs:
- a: A scalar integer type
- b_out: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn band(self, x: Value, y: Value) -> Value
Bitwise and.
Inputs:
- x: Any integer, float, or boolean scalar or vector type
- y: Any integer, float, or boolean scalar or vector type
Outputs:
- a: Any integer, float, or boolean scalar or vector type
fn bor(self, x: Value, y: Value) -> Value
Bitwise or.
Inputs:
- x: Any integer, float, or boolean scalar or vector type
- y: Any integer, float, or boolean scalar or vector type
Outputs:
- a: Any integer, float, or boolean scalar or vector type
fn bxor(self, x: Value, y: Value) -> Value
Bitwise xor.
Inputs:
- x: Any integer, float, or boolean scalar or vector type
- y: Any integer, float, or boolean scalar or vector type
Outputs:
- a: Any integer, float, or boolean scalar or vector type
fn bnot(self, x: Value) -> Value
Bitwise not.
Inputs:
- x: Any integer, float, or boolean scalar or vector type
Outputs:
- a: Any integer, float, or boolean scalar or vector type
fn band_not(self, x: Value, y: Value) -> Value
Bitwise and not.
Computes x & ~y
.
Inputs:
- x: Any integer, float, or boolean scalar or vector type
- y: Any integer, float, or boolean scalar or vector type
Outputs:
- a: Any integer, float, or boolean scalar or vector type
fn bor_not(self, x: Value, y: Value) -> Value
Bitwise or not.
Computes x | ~y
.
Inputs:
- x: Any integer, float, or boolean scalar or vector type
- y: Any integer, float, or boolean scalar or vector type
Outputs:
- a: Any integer, float, or boolean scalar or vector type
fn bxor_not(self, x: Value, y: Value) -> Value
Bitwise xor not.
Computes x ^ ~y
.
Inputs:
- x: Any integer, float, or boolean scalar or vector type
- y: Any integer, float, or boolean scalar or vector type
Outputs:
- a: Any integer, float, or boolean scalar or vector type
fn band_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Bitwise and with immediate.
Same as band
, but one operand is an immediate constant.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn bor_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Bitwise or with immediate.
Same as bor
, but one operand is an immediate constant.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn bxor_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Bitwise xor with immediate.
Same as bxor
, but one operand is an immediate constant.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- x: A scalar integer type
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar integer type
fn rotl(self, x: Value, y: Value) -> Value
Rotate left.
Rotate the bits in x
by y
places.
Inputs:
- x: Scalar or vector value to shift
- y: Number of bits to shift
Outputs:
- a: A scalar or vector integer type
fn rotr(self, x: Value, y: Value) -> Value
Rotate right.
Rotate the bits in x
by y
places.
Inputs:
- x: Scalar or vector value to shift
- y: Number of bits to shift
Outputs:
- a: A scalar or vector integer type
fn rotl_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Rotate left by immediate.
Inputs:
- x: Scalar or vector value to shift
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar or vector integer type
fn rotr_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Rotate right by immediate.
Inputs:
- x: Scalar or vector value to shift
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar or vector integer type
fn ishl(self, x: Value, y: Value) -> Value
Integer shift left. Shift the bits in x
towards the MSB by y
places. Shift in zero bits to the LSB.
The shift amount is masked to the size of x
.
When shifting a B-bits integer type, this instruction computes:
s &:= y \pmod B,
a &:= x \cdot 2^s \pmod{2^B}.
Inputs:
- x: Scalar or vector value to shift
- y: Number of bits to shift
Outputs:
- a: A scalar or vector integer type
fn ushr(self, x: Value, y: Value) -> Value
Unsigned shift right. Shift bits in x
towards the LSB by y
places, shifting in zero bits to the MSB. Also called a logical
shift.
The shift amount is masked to the size of the register.
When shifting a B-bits integer type, this instruction computes:
s &:= y \pmod B,
a &:= \lfloor x \cdot 2^{-s} \rfloor.
Inputs:
- x: Scalar or vector value to shift
- y: Number of bits to shift
Outputs:
- a: A scalar or vector integer type
fn sshr(self, x: Value, y: Value) -> Value
Signed shift right. Shift bits in x
towards the LSB by y
places, shifting in sign bits to the MSB. Also called an arithmetic
shift.
The shift amount is masked to the size of the register.
Inputs:
- x: Scalar or vector value to shift
- y: Number of bits to shift
Outputs:
- a: A scalar or vector integer type
fn ishl_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Integer shift left by immediate.
The shift amount is masked to the size of x
.
Inputs:
- x: Scalar or vector value to shift
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar or vector integer type
fn ushr_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Unsigned shift right by immediate.
The shift amount is masked to the size of the register.
Inputs:
- x: Scalar or vector value to shift
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar or vector integer type
fn sshr_imm<T1: Into<Imm64>>(self, x: Value, Y: T1) -> Value
Signed shift right by immediate.
The shift amount is masked to the size of the register.
Inputs:
- x: Scalar or vector value to shift
- Y: A 64-bit immediate integer.
Outputs:
- a: A scalar or vector integer type
fn bitrev(self, x: Value) -> Value
Reverse the bits of a integer.
Reverses the bits in x
.
Inputs:
- x: A scalar integer type
Outputs:
- a: A scalar integer type
fn clz(self, x: Value) -> Value
Count leading zero bits.
Starting from the MSB in x
, count the number of zero bits before
reaching the first one bit. When x
is zero, returns the size of x
in bits.
Inputs:
- x: A scalar integer type
Outputs:
- a: A scalar integer type
fn cls(self, x: Value) -> Value
Count leading sign bits.
Starting from the MSB after the sign bit in x
, count the number of
consecutive bits identical to the sign bit. When x
is 0 or -1,
returns one less than the size of x in bits.
Inputs:
- x: A scalar integer type
Outputs:
- a: A scalar integer type
fn ctz(self, x: Value) -> Value
Count trailing zeros.
Starting from the LSB in x
, count the number of zero bits before
reaching the first one bit. When x
is zero, returns the size of x
in bits.
Inputs:
- x: A scalar integer type
Outputs:
- a: A scalar integer type
fn popcnt(self, x: Value) -> Value
Population count
Count the number of one bits in x
.
Inputs:
- x: A scalar integer type
Outputs:
- a: A scalar integer type
fn fcmp<T1: Into<FloatCC>>(self, Cond: T1, x: Value, y: Value) -> Value
Floating point comparison.
Two IEEE 754-2008 floating point numbers, x
and y
, relate to each
other in exactly one of four ways:
== ==========================================
UN Unordered when one or both numbers is NaN.
EQ When x = y
. (And 0.0 = -0.0
).
LT When x < y
.
GT When x > y
.
== ==========================================
The 14 floatcc
condition codes each correspond to a subset of
the four relations, except for the empty set which would always be
false, and the full set which would always be true.
The condition codes are divided into 7 'ordered' conditions which don't include UN, and 7 unordered conditions which all include UN.
+-------+------------+---------+------------+-------------------------+ |Ordered |Unordered |Condition | +=======+============+=========+============+=========================+ |ord |EQ | LT | GT|uno |UN |NaNs absent / present. | +-------+------------+---------+------------+-------------------------+ |eq |EQ |ueq |UN | EQ |Equal | +-------+------------+---------+------------+-------------------------+ |one |LT | GT |ne |UN | LT | GT|Not equal | +-------+------------+---------+------------+-------------------------+ |lt |LT |ult |UN | LT |Less than | +-------+------------+---------+------------+-------------------------+ |le |LT | EQ |ule |UN | LT | EQ|Less than or equal | +-------+------------+---------+------------+-------------------------+ |gt |GT |ugt |UN | GT |Greater than | +-------+------------+---------+------------+-------------------------+ |ge |GT | EQ |uge |UN | GT | EQ|Greater than or equal | +-------+------------+---------+------------+-------------------------+
The standard C comparison operators, <, <=, >, >=
, are all ordered,
so they are false if either operand is NaN. The C equality operator,
==
, is ordered, and since inequality is defined as the logical
inverse it is unordered. They map to the floatcc
condition
codes as follows:
==== ====== ============
C Cond
Subset
==== ====== ============
==
eq EQ
!=
ne UN | LT | GT
<
lt LT
<=
le LT | EQ
>
gt GT
>=
ge GT | EQ
==== ====== ============
This subset of condition codes also corresponds to the WebAssembly floating point comparisons of the same name.
When this instruction compares floating point vectors, it returns a boolean vector with the results of lane-wise comparisons.
Inputs:
- Cond: A floating point comparison condition code
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a:
fn ffcmp(self, x: Value, y: Value) -> Value
Floating point comparison returning flags.
Compares two numbers like fcmp
, but returns floating point CPU
flags instead of testing a specific condition.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- f: CPU flags representing the result of a floating point comparison. These
flags can be tested with a :type:
floatcc
condition code.
fn fadd(self, x: Value, y: Value) -> Value
Floating point addition.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: Result of applying operator to each lane
fn fsub(self, x: Value, y: Value) -> Value
Floating point subtraction.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: Result of applying operator to each lane
fn fmul(self, x: Value, y: Value) -> Value
Floating point multiplication.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: Result of applying operator to each lane
fn fdiv(self, x: Value, y: Value) -> Value
Floating point division.
Unlike the integer division instructions and
udiv`, this can't trap. Division by zero is infinity or
NaN, depending on the dividend.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: Result of applying operator to each lane
fn sqrt(self, x: Value) -> Value
Floating point square root.
Inputs:
- x: A scalar or vector floating point number
Outputs:
- a: Result of applying operator to each lane
fn fma(self, x: Value, y: Value, z: Value) -> Value
Floating point fused multiply-and-add.
Computes a := xy+z
without any intermediate rounding of the
product.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
- z: A scalar or vector floating point number
Outputs:
- a: Result of applying operator to each lane
fn fneg(self, x: Value) -> Value
Floating point negation.
Note that this is a pure bitwise operation.
Inputs:
- x: A scalar or vector floating point number
Outputs:
- a:
x
with its sign bit inverted
fn fabs(self, x: Value) -> Value
Floating point absolute value.
Note that this is a pure bitwise operation.
Inputs:
- x: A scalar or vector floating point number
Outputs:
- a:
x
with its sign bit cleared
fn fcopysign(self, x: Value, y: Value) -> Value
Floating point copy sign.
Note that this is a pure bitwise operation. The sign bit from y
is
copied to the sign bit of x
.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a:
x
with its sign bit changed to that ofy
fn fmin(self, x: Value, y: Value) -> Value
Floating point minimum, propagating NaNs.
If either operand is NaN, this returns a NaN.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: The smaller of
x
andy
fn fmax(self, x: Value, y: Value) -> Value
Floating point maximum, propagating NaNs.
If either operand is NaN, this returns a NaN.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: The larger of
x
andy
fn ceil(self, x: Value) -> Value
Round floating point round to integral, towards positive infinity.
Inputs:
- x: A scalar or vector floating point number
Outputs:
- a:
x
rounded to integral value
fn floor(self, x: Value) -> Value
Round floating point round to integral, towards negative infinity.
Inputs:
- x: A scalar or vector floating point number
Outputs:
- a:
x
rounded to integral value
fn trunc(self, x: Value) -> Value
Round floating point round to integral, towards zero.
Inputs:
- x: A scalar or vector floating point number
Outputs:
- a:
x
rounded to integral value
fn nearest(self, x: Value) -> Value
Round floating point round to integral, towards nearest with ties to even.
Inputs:
- x: A scalar or vector floating point number
Outputs:
- a:
x
rounded to integral value
fn is_null(self, x: Value) -> Value
Reference verification.
The condition code determines if the reference type in question is null or not.
Inputs:
- x: A scalar reference type
Outputs:
- a: A boolean type with 1 bits.
fn trueif<T1: Into<IntCC>>(self, Cond: T1, f: Value) -> Value
Test integer CPU flags for a specific condition.
Check the CPU flags in f
against the Cond
condition code and
return true when the condition code is satisfied.
Inputs:
- Cond: An integer comparison condition code.
- f: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
Outputs:
- a: A boolean type with 1 bits.
fn trueff<T1: Into<FloatCC>>(self, Cond: T1, f: Value) -> Value
Test floating point CPU flags for a specific condition.
Check the CPU flags in f
against the Cond
condition code and
return true when the condition code is satisfied.
Inputs:
- Cond: A floating point comparison condition code
- f: CPU flags representing the result of a floating point comparison. These
flags can be tested with a :type:
floatcc
condition code.
Outputs:
- a: A boolean type with 1 bits.
fn bitcast(self, MemTo: Type, x: Value) -> Value
Reinterpret the bits in x
as a different type.
The input and output types must be storable to memory and of the same size. A bitcast is equivalent to storing one type and loading the other type from the same address.
Inputs:
- MemTo (controlling type variable):
- x: Any type that can be stored in memory
Outputs:
- a: Bits of
x
reinterpreted
fn raw_bitcast(self, AnyTo: Type, x: Value) -> Value
Cast the bits in x
as a different type of the same bit width.
This instruction does not change the data's representation but allows
data in registers to be used as different types, e.g. an i32x4 as a
b8x16. The only constraint on the result a
is that it can be
raw_bitcast
back to the original type. Also, in a raw_bitcast between
vector types with the same number of lanes, the value of each result
lane is a raw_bitcast of the corresponding operand lane. TODO there is
currently no mechanism for enforcing the bit width constraint.
Inputs:
- AnyTo (controlling type variable):
- x: Any integer, float, boolean, or reference scalar or vector type
Outputs:
- a: Bits of
x
reinterpreted
fn scalar_to_vector(self, TxN: Type, s: Value) -> Value
Scalar To Vector -- move a value out of a scalar register and into a vector register; the scalar will be moved to the lowest-order bits of the vector register. Note that this instruction is intended as a low-level legalization instruction and frontends should prefer insertlane; on certain architectures, scalar_to_vector may zero the highest-order bits for some types (e.g. integers) but not for others (e.g. floats).
Inputs:
- TxN (controlling type variable): A SIMD vector type
- s: A scalar value
Outputs:
- a: A vector value
fn breduce(self, BoolTo: Type, x: Value) -> Value
Convert x
to a smaller boolean type in the platform-defined way.
The result type must have the same number of vector lanes as the input, and each lane must not have more bits that the input lanes. If the input and output types are the same, this is a no-op.
Inputs:
- BoolTo (controlling type variable): A smaller boolean type with the same number of lanes
- x: A scalar or vector boolean type
Outputs:
- a: A smaller boolean type with the same number of lanes
fn bextend(self, BoolTo: Type, x: Value) -> Value
Convert x
to a larger boolean type in the platform-defined way.
The result type must have the same number of vector lanes as the input, and each lane must not have fewer bits that the input lanes. If the input and output types are the same, this is a no-op.
Inputs:
- BoolTo (controlling type variable): A larger boolean type with the same number of lanes
- x: A scalar or vector boolean type
Outputs:
- a: A larger boolean type with the same number of lanes
fn bint(self, IntTo: Type, x: Value) -> Value
Convert x
to an integer.
True maps to 1 and false maps to 0. The result type must have the same number of vector lanes as the input.
Inputs:
- IntTo (controlling type variable): An integer type with the same number of lanes
- x: A scalar or vector boolean type
Outputs:
- a: An integer type with the same number of lanes
fn bmask(self, IntTo: Type, x: Value) -> Value
Convert x
to an integer mask.
True maps to all 1s and false maps to all 0s. The result type must have the same number of vector lanes as the input.
Inputs:
- IntTo (controlling type variable): An integer type with the same number of lanes
- x: A scalar or vector boolean type
Outputs:
- a: An integer type with the same number of lanes
fn ireduce(self, IntTo: Type, x: Value) -> Value
Convert x
to a smaller integer type by dropping high bits.
Each lane in x
is converted to a smaller integer type by discarding
the most significant bits. This is the same as reducing modulo
2^n
.
The result type must have the same number of vector lanes as the input, and each lane must not have more bits that the input lanes. If the input and output types are the same, this is a no-op.
Inputs:
- IntTo (controlling type variable): A smaller integer type with the same number of lanes
- x: A scalar or vector integer type
Outputs:
- a: A smaller integer type with the same number of lanes
fn uextend(self, IntTo: Type, x: Value) -> Value
Convert x
to a larger integer type by zero-extending.
Each lane in x
is converted to a larger integer type by adding
zeroes. The result has the same numerical value as x
when both are
interpreted as unsigned integers.
The result type must have the same number of vector lanes as the input, and each lane must not have fewer bits that the input lanes. If the input and output types are the same, this is a no-op.
Inputs:
- IntTo (controlling type variable): A larger integer type with the same number of lanes
- x: A scalar or vector integer type
Outputs:
- a: A larger integer type with the same number of lanes
fn sextend(self, IntTo: Type, x: Value) -> Value
Convert x
to a larger integer type by sign-extending.
Each lane in x
is converted to a larger integer type by replicating
the sign bit. The result has the same numerical value as x
when both
are interpreted as signed integers.
The result type must have the same number of vector lanes as the input, and each lane must not have fewer bits that the input lanes. If the input and output types are the same, this is a no-op.
Inputs:
- IntTo (controlling type variable): A larger integer type with the same number of lanes
- x: A scalar or vector integer type
Outputs:
- a: A larger integer type with the same number of lanes
fn fpromote(self, FloatTo: Type, x: Value) -> Value
Convert x
to a larger floating point format.
Each lane in x
is converted to the destination floating point format.
This is an exact operation.
Cranelift currently only supports two floating point formats
f32
andf64
. This may change in the future.
The result type must have the same number of vector lanes as the input, and the result lanes must not have fewer bits than the input lanes. If the input and output types are the same, this is a no-op.
Inputs:
- FloatTo (controlling type variable): A scalar or vector floating point number
- x: A scalar or vector floating point number
Outputs:
- a: A scalar or vector floating point number
fn fdemote(self, FloatTo: Type, x: Value) -> Value
Convert x
to a smaller floating point format.
Each lane in x
is converted to the destination floating point format
by rounding to nearest, ties to even.
Cranelift currently only supports two floating point formats
f32
andf64
. This may change in the future.
The result type must have the same number of vector lanes as the input, and the result lanes must not have more bits than the input lanes. If the input and output types are the same, this is a no-op.
Inputs:
- FloatTo (controlling type variable): A scalar or vector floating point number
- x: A scalar or vector floating point number
Outputs:
- a: A scalar or vector floating point number
fn fcvt_to_uint(self, IntTo: Type, x: Value) -> Value
Convert floating point to unsigned integer.
Each lane in x
is converted to an unsigned integer by rounding
towards zero. If x
is NaN or if the unsigned integral value cannot be
represented in the result type, this instruction traps.
The result type must have the same number of vector lanes as the input.
Inputs:
- IntTo (controlling type variable): A larger integer type with the same number of lanes
- x: A scalar or vector floating point number
Outputs:
- a: A larger integer type with the same number of lanes
fn fcvt_to_uint_sat(self, IntTo: Type, x: Value) -> Value
Convert floating point to unsigned integer as fcvt_to_uint does, but saturates the input instead of trapping. NaN and negative values are converted to 0.
Inputs:
- IntTo (controlling type variable): A larger integer type with the same number of lanes
- x: A scalar or vector floating point number
Outputs:
- a: A larger integer type with the same number of lanes
fn fcvt_to_sint(self, IntTo: Type, x: Value) -> Value
Convert floating point to signed integer.
Each lane in x
is converted to a signed integer by rounding towards
zero. If x
is NaN or if the signed integral value cannot be
represented in the result type, this instruction traps.
The result type must have the same number of vector lanes as the input.
Inputs:
- IntTo (controlling type variable): A larger integer type with the same number of lanes
- x: A scalar or vector floating point number
Outputs:
- a: A larger integer type with the same number of lanes
fn fcvt_to_sint_sat(self, IntTo: Type, x: Value) -> Value
Convert floating point to signed integer as fcvt_to_sint does, but saturates the input instead of trapping. NaN values are converted to 0.
Inputs:
- IntTo (controlling type variable): A larger integer type with the same number of lanes
- x: A scalar or vector floating point number
Outputs:
- a: A larger integer type with the same number of lanes
fn fcvt_from_uint(self, FloatTo: Type, x: Value) -> Value
Convert unsigned integer to floating point.
Each lane in x
is interpreted as an unsigned integer and converted to
floating point using round to nearest, ties to even.
The result type must have the same number of vector lanes as the input.
Inputs:
- FloatTo (controlling type variable): A scalar or vector floating point number
- x: A scalar or vector integer type
Outputs:
- a: A scalar or vector floating point number
fn fcvt_from_sint(self, FloatTo: Type, x: Value) -> Value
Convert signed integer to floating point.
Each lane in x
is interpreted as a signed integer and converted to
floating point using round to nearest, ties to even.
The result type must have the same number of vector lanes as the input.
Inputs:
- FloatTo (controlling type variable): A scalar or vector floating point number
- x: A scalar or vector integer type
Outputs:
- a: A scalar or vector floating point number
fn isplit(self, x: Value) -> (Value, Value)
Split an integer into low and high parts.
Vectors of integers are split lane-wise, so the results have the same number of lanes as the input, but the lanes are half the size.
Returns the low half of x
and the high half of x
as two independent
values.
Inputs:
- x: An integer type with lanes from
i16
upwards
Outputs:
- lo: The low bits of
x
- hi: The high bits of
x
fn iconcat(self, lo: Value, hi: Value) -> Value
Concatenate low and high bits to form a larger integer type.
Vectors of integers are concatenated lane-wise such that the result has the same number of lanes as the inputs, but the lanes are twice the size.
Inputs:
- lo: An integer type with lanes type to
i64
- hi: An integer type with lanes type to
i64
Outputs:
- a: The concatenation of
lo
andhi
fn x86_udivmodx(self, nlo: Value, nhi: Value, d: Value) -> (Value, Value)
Extended unsigned division.
Concatenate the bits in nhi
and nlo
to form the numerator.
Interpret the bits as an unsigned number and divide by the unsigned
denominator d
. Trap when d
is zero or if the quotient is larger
than the range of the output.
Return both quotient and remainder.
Inputs:
- nlo: Low part of numerator
- nhi: High part of numerator
- d: Denominator
Outputs:
- q: Quotient
- r: Remainder
fn x86_sdivmodx(self, nlo: Value, nhi: Value, d: Value) -> (Value, Value)
Extended signed division.
Concatenate the bits in nhi
and nlo
to form the numerator.
Interpret the bits as a signed number and divide by the signed
denominator d
. Trap when d
is zero or if the quotient is outside
the range of the output.
Return both quotient and remainder.
Inputs:
- nlo: Low part of numerator
- nhi: High part of numerator
- d: Denominator
Outputs:
- q: Quotient
- r: Remainder
fn x86_umulx(self, argL: Value, argR: Value) -> (Value, Value)
Unsigned integer multiplication, producing a double-length result.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- argL: A scalar integer machine word
- argR: A scalar integer machine word
Outputs:
- resLo: A scalar integer machine word
- resHi: A scalar integer machine word
fn x86_smulx(self, argL: Value, argR: Value) -> (Value, Value)
Signed integer multiplication, producing a double-length result.
Polymorphic over all scalar integer types, but does not support vector types.
Inputs:
- argL: A scalar integer machine word
- argR: A scalar integer machine word
Outputs:
- resLo: A scalar integer machine word
- resHi: A scalar integer machine word
fn x86_cvtt2si(self, IntTo: Type, x: Value) -> Value
Convert with truncation floating point to signed integer.
The source floating point operand is converted to a signed integer by rounding towards zero. If the result can't be represented in the output type, returns the smallest signed value the output type can represent.
This instruction does not trap.
Inputs:
- IntTo (controlling type variable): An integer type with the same number of lanes
- x: A scalar or vector floating point number
Outputs:
- a: An integer type with the same number of lanes
fn x86_fmin(self, x: Value, y: Value) -> Value
Floating point minimum with x86 semantics.
This is equivalent to the C ternary operator x < y ? x : y
which
differs from fmin
when either operand is NaN or when comparing
+0.0 to -0.0.
When the two operands don't compare as LT, y
is returned unchanged,
even if it is a signalling NaN.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: A scalar or vector floating point number
fn x86_fmax(self, x: Value, y: Value) -> Value
Floating point maximum with x86 semantics.
This is equivalent to the C ternary operator x > y ? x : y
which
differs from fmax
when either operand is NaN or when comparing
+0.0 to -0.0.
When the two operands don't compare as GT, y
is returned unchanged,
even if it is a signalling NaN.
Inputs:
- x: A scalar or vector floating point number
- y: A scalar or vector floating point number
Outputs:
- a: A scalar or vector floating point number
fn x86_push(self, x: Value) -> Inst
Pushes a value onto the stack.
Decrements the stack pointer and stores the specified value on to the top.
This is polymorphic in i32 and i64. However, it is only implemented for i64 in 64-bit mode, and only for i32 in 32-bit mode.
Inputs:
- x: A scalar integer machine word
fn x86_pop(self, iWord: Type) -> Value
Pops a value from the stack.
Loads a value from the top of the stack and then increments the stack pointer.
This is polymorphic in i32 and i64. However, it is only implemented for i64 in 64-bit mode, and only for i32 in 32-bit mode.
Inputs:
- iWord (controlling type variable): A scalar integer machine word
Outputs:
- x: A scalar integer machine word
fn x86_bsr(self, x: Value) -> (Value, Value)
Bit Scan Reverse -- returns the bit-index of the most significant 1 in the word. Result is undefined if the argument is zero. However, it sets the Z flag depending on the argument, so it is at least easy to detect and handle that case.
This is polymorphic in i32 and i64. It is implemented for both i64 and i32 in 64-bit mode, and only for i32 in 32-bit mode.
Inputs:
- x: A scalar integer machine word
Outputs:
- y: A scalar integer machine word
- rflags: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn x86_bsf(self, x: Value) -> (Value, Value)
Bit Scan Forwards -- returns the bit-index of the least significant 1 in the word. Is otherwise identical to 'bsr', just above.
Inputs:
- x: A scalar integer machine word
Outputs:
- y: A scalar integer machine word
- rflags: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn x86_pshufd<T1: Into<Uimm8>>(self, a: Value, i: T1) -> Value
Packed Shuffle Doublewords -- copies data from either memory or lanes in an extended register and re-orders the data according to the passed immediate byte.
Inputs:
- a: A vector value (i.e. held in an XMM register)
- i: An ordering operand controlling the copying of data from the source to the destination; see PSHUFD in Intel manual for details
Outputs:
- a: A vector value (i.e. held in an XMM register)
fn x86_pshufb(self, a: Value, b: Value) -> Value
Packed Shuffle Bytes -- re-orders data in an extended register using a shuffle mask from either memory or another extended register
Inputs:
- a: A vector value (i.e. held in an XMM register)
- b: A vector value (i.e. held in an XMM register)
Outputs:
- a: A vector value (i.e. held in an XMM register)
fn x86_pextr<T1: Into<Uimm8>>(self, x: Value, Idx: T1) -> Value
Extract lane Idx
from x
.
The lane index, Idx
, is an immediate value, not an SSA value. It
must indicate a valid lane index for the type of x
.
Inputs:
- x: A SIMD vector type
- Idx: Lane index
Outputs:
- a:
fn x86_pinsr<T1: Into<Uimm8>>(self, x: Value, Idx: T1, y: Value) -> Value
Insert y
into x
at lane Idx
.
The lane index, Idx
, is an immediate value, not an SSA value. It
must indicate a valid lane index for the type of x
.
Inputs:
- x: A SIMD vector type containing only booleans and integers
- Idx: Lane index
- y: New lane value
Outputs:
- a: A SIMD vector type containing only booleans and integers
fn x86_insertps<T1: Into<Uimm8>>(self, x: Value, Idx: T1, y: Value) -> Value
Insert a lane of y
into x
at using Idx
to encode both which lane the value is
extracted from and which it is inserted to. This is similar to x86_pinsr but inserts
floats, which are already stored in an XMM register.
Inputs:
- x: A SIMD vector type containing floats
- Idx: Lane index
- y: New lane value
Outputs:
- a: A SIMD vector type containing floats
fn x86_movsd(self, x: Value, y: Value) -> Value
Move the low 64 bits of the float vector y
to the low 64 bits of float vector x
Inputs:
- x: A SIMD vector type containing floats
- y: A SIMD vector type containing floats
Outputs:
- a: A SIMD vector type containing floats
fn x86_movlhps(self, x: Value, y: Value) -> Value
Move the low 64 bits of the float vector y
to the high 64 bits of float vector x
Inputs:
- x: A SIMD vector type containing floats
- y: A SIMD vector type containing floats
Outputs:
- a: A SIMD vector type containing floats
fn x86_psll(self, x: Value, y: Value) -> Value
Shift Packed Data Left Logical -- This implements the behavior of the shared instruction
ishl
but alters the shift operand to live in an XMM register as expected by the PSLL*
family of instructions.
Inputs:
- x: Vector value to shift
- y: Number of bits to shift
Outputs:
- a: A SIMD vector type containing integers
fn x86_psrl(self, x: Value, y: Value) -> Value
Shift Packed Data Right Logical -- This implements the behavior of the shared instruction
ushr
but alters the shift operand to live in an XMM register as expected by the PSRL*
family of instructions.
Inputs:
- x: Vector value to shift
- y: Number of bits to shift
Outputs:
- a: A SIMD vector type containing integers
fn x86_psra(self, x: Value, y: Value) -> Value
Shift Packed Data Right Arithmetic -- This implements the behavior of the shared
instruction sshr
but alters the shift operand to live in an XMM register as expected by
the PSRA* family of instructions.
Inputs:
- x: Vector value to shift
- y: Number of bits to shift
Outputs:
- a: A SIMD vector type containing integers
fn x86_ptest(self, x: Value, y: Value) -> Value
Logical Compare -- PTEST will set the ZF flag if all bits in the result are 0 of the bitwise AND of the first source operand (first operand) and the second source operand (second operand). PTEST sets the CF flag if all bits in the result are 0 of the bitwise AND of the second source operand (second operand) and the logical NOT of the destination operand (first operand).
Inputs:
- x: A SIMD vector type
- y: A SIMD vector type
Outputs:
- f: CPU flags representing the result of an integer comparison. These flags
can be tested with an :type:
intcc
condition code.
fn x86_pmaxs(self, x: Value, y: Value) -> Value
Maximum of Packed Signed Integers -- Compare signed integers in the first and second operand and return the maximum values.
Inputs:
- x: A SIMD vector type containing integers
- y: A SIMD vector type containing integers
Outputs:
- a: A SIMD vector type containing integers
fn x86_pmaxu(self, x: Value, y: Value) -> Value
Maximum of Packed Unsigned Integers -- Compare unsigned integers in the first and second operand and return the maximum values.
Inputs:
- x: A SIMD vector type containing integers
- y: A SIMD vector type containing integers
Outputs:
- a: A SIMD vector type containing integers
fn x86_pmins(self, x: Value, y: Value) -> Value
Minimum of Packed Signed Integers -- Compare signed integers in the first and second operand and return the minimum values.
Inputs:
- x: A SIMD vector type containing integers
- y: A SIMD vector type containing integers
Outputs:
- a: A SIMD vector type containing integers
fn x86_pminu(self, x: Value, y: Value) -> Value
Minimum of Packed Unsigned Integers -- Compare unsigned integers in the first and second operand and return the minimum values.
Inputs:
- x: A SIMD vector type containing integers
- y: A SIMD vector type containing integers
Outputs:
- a: A SIMD vector type containing integers
fn Binary(
self,
opcode: Opcode,
ctrl_typevar: Type,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
Binary(imms=(), vals=2)
fn BinaryImm(
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Imm64,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Imm64,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
BinaryImm(imms=(imm: ir::immediates::Imm64), vals=1)
fn Branch(
self,
opcode: Opcode,
ctrl_typevar: Type,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
Branch(imms=(destination: ir::Ebb), vals=1)
fn BranchFloat(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
BranchFloat(imms=(cond: ir::condcodes::FloatCC, destination: ir::Ebb), vals=1)
fn BranchIcmp(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
BranchIcmp(imms=(cond: ir::condcodes::IntCC, destination: ir::Ebb), vals=2)
fn BranchInt(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
BranchInt(imms=(cond: ir::condcodes::IntCC, destination: ir::Ebb), vals=1)
fn BranchTable(
self,
opcode: Opcode,
ctrl_typevar: Type,
destination: Ebb,
table: JumpTable,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
destination: Ebb,
table: JumpTable,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
BranchTable(imms=(destination: ir::Ebb, table: ir::JumpTable), vals=1)
fn BranchTableBase(
self,
opcode: Opcode,
ctrl_typevar: Type,
table: JumpTable
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
table: JumpTable
) -> (Inst, &'f mut DataFlowGraph)
BranchTableBase(imms=(table: ir::JumpTable), vals=0)
fn BranchTableEntry(
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Uimm8,
table: JumpTable,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Uimm8,
table: JumpTable,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
BranchTableEntry(imms=(imm: ir::immediates::Uimm8, table: ir::JumpTable), vals=2)
fn Call(
self,
opcode: Opcode,
ctrl_typevar: Type,
func_ref: FuncRef,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
func_ref: FuncRef,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
Call(imms=(func_ref: ir::FuncRef), vals=0)
fn CallIndirect(
self,
opcode: Opcode,
ctrl_typevar: Type,
sig_ref: SigRef,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
sig_ref: SigRef,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
CallIndirect(imms=(sig_ref: ir::SigRef), vals=1)
fn CondTrap(
self,
opcode: Opcode,
ctrl_typevar: Type,
code: TrapCode,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
code: TrapCode,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
CondTrap(imms=(code: ir::TrapCode), vals=1)
fn CopySpecial(
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit,
dst: RegUnit
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit,
dst: RegUnit
) -> (Inst, &'f mut DataFlowGraph)
CopySpecial(imms=(src: isa::RegUnit, dst: isa::RegUnit), vals=0)
fn CopyToSsa(
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit
) -> (Inst, &'f mut DataFlowGraph)
CopyToSsa(imms=(src: isa::RegUnit), vals=0)
fn ExtractLane(
self,
opcode: Opcode,
ctrl_typevar: Type,
lane: Uimm8,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
lane: Uimm8,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
ExtractLane(imms=(lane: ir::immediates::Uimm8), vals=1)
fn FloatCompare(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
FloatCompare(imms=(cond: ir::condcodes::FloatCC), vals=2)
fn FloatCond(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
FloatCond(imms=(cond: ir::condcodes::FloatCC), vals=1)
fn FloatCondTrap(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
code: TrapCode,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: FloatCC,
code: TrapCode,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
FloatCondTrap(imms=(cond: ir::condcodes::FloatCC, code: ir::TrapCode), vals=1)
fn FuncAddr(
self,
opcode: Opcode,
ctrl_typevar: Type,
func_ref: FuncRef
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
func_ref: FuncRef
) -> (Inst, &'f mut DataFlowGraph)
FuncAddr(imms=(func_ref: ir::FuncRef), vals=0)
fn HeapAddr(
self,
opcode: Opcode,
ctrl_typevar: Type,
heap: Heap,
imm: Uimm32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
heap: Heap,
imm: Uimm32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
HeapAddr(imms=(heap: ir::Heap, imm: ir::immediates::Uimm32), vals=1)
fn IndirectJump(
self,
opcode: Opcode,
ctrl_typevar: Type,
table: JumpTable,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
table: JumpTable,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
IndirectJump(imms=(table: ir::JumpTable), vals=1)
fn InsertLane(
self,
opcode: Opcode,
ctrl_typevar: Type,
lane: Uimm8,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
lane: Uimm8,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
InsertLane(imms=(lane: ir::immediates::Uimm8), vals=2)
fn IntCompare(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
IntCompare(imms=(cond: ir::condcodes::IntCC), vals=2)
fn IntCompareImm(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
imm: Imm64,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
imm: Imm64,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
IntCompareImm(imms=(cond: ir::condcodes::IntCC, imm: ir::immediates::Imm64), vals=1)
fn IntCond(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
IntCond(imms=(cond: ir::condcodes::IntCC), vals=1)
fn IntCondTrap(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
code: TrapCode,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
code: TrapCode,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
IntCondTrap(imms=(cond: ir::condcodes::IntCC, code: ir::TrapCode), vals=1)
fn IntSelect(
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
arg0: Value,
arg1: Value,
arg2: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
cond: IntCC,
arg0: Value,
arg1: Value,
arg2: Value
) -> (Inst, &'f mut DataFlowGraph)
IntSelect(imms=(cond: ir::condcodes::IntCC), vals=3)
fn Jump(
self,
opcode: Opcode,
ctrl_typevar: Type,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
destination: Ebb,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
Jump(imms=(destination: ir::Ebb), vals=0)
fn Load(
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
Load(imms=(flags: ir::MemFlags, offset: ir::immediates::Offset32), vals=1)
fn LoadComplex(
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
LoadComplex(imms=(flags: ir::MemFlags, offset: ir::immediates::Offset32), vals=0)
fn MultiAry(
self,
opcode: Opcode,
ctrl_typevar: Type,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
MultiAry(imms=(), vals=0)
fn NullAry(
self,
opcode: Opcode,
ctrl_typevar: Type
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type
) -> (Inst, &'f mut DataFlowGraph)
NullAry(imms=(), vals=0)
fn RegFill(
self,
opcode: Opcode,
ctrl_typevar: Type,
src: StackSlot,
dst: RegUnit,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
src: StackSlot,
dst: RegUnit,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
RegFill(imms=(src: ir::StackSlot, dst: isa::RegUnit), vals=1)
fn RegMove(
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit,
dst: RegUnit,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit,
dst: RegUnit,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
RegMove(imms=(src: isa::RegUnit, dst: isa::RegUnit), vals=1)
fn RegSpill(
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit,
dst: StackSlot,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
src: RegUnit,
dst: StackSlot,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
RegSpill(imms=(src: isa::RegUnit, dst: ir::StackSlot), vals=1)
fn Shuffle(
self,
opcode: Opcode,
ctrl_typevar: Type,
mask: Immediate,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
mask: Immediate,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
Shuffle(imms=(mask: ir::Immediate), vals=2)
fn StackLoad(
self,
opcode: Opcode,
ctrl_typevar: Type,
stack_slot: StackSlot,
offset: Offset32
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
stack_slot: StackSlot,
offset: Offset32
) -> (Inst, &'f mut DataFlowGraph)
StackLoad(imms=(stack_slot: ir::StackSlot, offset: ir::immediates::Offset32), vals=0)
fn StackStore(
self,
opcode: Opcode,
ctrl_typevar: Type,
stack_slot: StackSlot,
offset: Offset32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
stack_slot: StackSlot,
offset: Offset32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
StackStore(imms=(stack_slot: ir::StackSlot, offset: ir::immediates::Offset32), vals=1)
fn Store(
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
arg0: Value,
arg1: Value
) -> (Inst, &'f mut DataFlowGraph)
Store(imms=(flags: ir::MemFlags, offset: ir::immediates::Offset32), vals=2)
fn StoreComplex(
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
flags: MemFlags,
offset: Offset32,
args: ValueList
) -> (Inst, &'f mut DataFlowGraph)
StoreComplex(imms=(flags: ir::MemFlags, offset: ir::immediates::Offset32), vals=1)
fn TableAddr(
self,
opcode: Opcode,
ctrl_typevar: Type,
table: Table,
offset: Offset32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
table: Table,
offset: Offset32,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
TableAddr(imms=(table: ir::Table, offset: ir::immediates::Offset32), vals=1)
fn Ternary(
self,
opcode: Opcode,
ctrl_typevar: Type,
arg0: Value,
arg1: Value,
arg2: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
arg0: Value,
arg1: Value,
arg2: Value
) -> (Inst, &'f mut DataFlowGraph)
Ternary(imms=(), vals=3)
fn Trap(
self,
opcode: Opcode,
ctrl_typevar: Type,
code: TrapCode
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
code: TrapCode
) -> (Inst, &'f mut DataFlowGraph)
Trap(imms=(code: ir::TrapCode), vals=0)
fn Unary(
self,
opcode: Opcode,
ctrl_typevar: Type,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
arg0: Value
) -> (Inst, &'f mut DataFlowGraph)
Unary(imms=(), vals=1)
fn UnaryBool(
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: bool
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: bool
) -> (Inst, &'f mut DataFlowGraph)
UnaryBool(imms=(imm: bool), vals=0)
fn UnaryConst(
self,
opcode: Opcode,
ctrl_typevar: Type,
constant_handle: Constant
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
constant_handle: Constant
) -> (Inst, &'f mut DataFlowGraph)
UnaryConst(imms=(constant_handle: ir::Constant), vals=0)
fn UnaryGlobalValue(
self,
opcode: Opcode,
ctrl_typevar: Type,
global_value: GlobalValue
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
global_value: GlobalValue
) -> (Inst, &'f mut DataFlowGraph)
UnaryGlobalValue(imms=(global_value: ir::GlobalValue), vals=0)
fn UnaryIeee32(
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Ieee32
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Ieee32
) -> (Inst, &'f mut DataFlowGraph)
UnaryIeee32(imms=(imm: ir::immediates::Ieee32), vals=0)
fn UnaryIeee64(
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Ieee64
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Ieee64
) -> (Inst, &'f mut DataFlowGraph)
UnaryIeee64(imms=(imm: ir::immediates::Ieee64), vals=0)
fn UnaryImm(
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Imm64
) -> (Inst, &'f mut DataFlowGraph)
self,
opcode: Opcode,
ctrl_typevar: Type,
imm: Imm64
) -> (Inst, &'f mut DataFlowGraph)
UnaryImm(imms=(imm: ir::immediates::Imm64), vals=0)
Implementors
impl<'f, T: InstBuilderBase<'f>> InstBuilder<'f> for T
[src]
Any type implementing InstBuilderBase
gets all the InstBuilder
methods for free.