Package io.github.eutro.wasm2j.core.ssa
Class Insn
java.lang.Object
io.github.eutro.wasm2j.core.ext.ExtHolder
io.github.eutro.wasm2j.core.ext.DelegatingExtHolder
io.github.eutro.wasm2j.core.ssa.Insn
- All Implemented Interfaces:
ExtContainer
,Iterable<Var>
An instruction, encapsulating an
operation
and its arguments.-
Field Summary
Modifier and TypeFieldDescriptionWhere this variable was created, for debugging purposes.The underlying operation.static boolean
Whether instruction creations should be tracked. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionargs()
Get the arguments to the instruction.Create an effect that assigns the result of this instruction.Create an effect that assigns the result of this instruction.<T> void
Associateext
withvalue
in this container.Create a new effect that assigns to the same variables as the given one.protected ExtContainer
Get theExtHolder
to delegate to.<T> T
getNullable
(Ext<T> ext) Get the value associated withext
in this container, or null if not present.iterator()
jumpsTo
(BasicBlock... targets) Create a control instruction that jumps to the given targets.jumpsTo
(List<BasicBlock> targets) Create a control instruction that jumps to the given targets.<T> void
Disassociate the value ofext
(if any) in this container.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.eutro.wasm2j.core.ext.ExtContainer
getExt, getExtOrRun, getExtOrThrow
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
TRACK_INSN_CREATIONS
public static boolean TRACK_INSN_CREATIONSWhether instruction creations should be tracked. -
created
Where this variable was created, for debugging purposes. Only ifTRACK_INSN_CREATIONS
was true at the time. -
op
The underlying operation.
-
-
Constructor Details
-
Insn
Construct an instruction with the given operator and arguments.- Parameters:
op
- The operator.args
- The arguments.
-
Insn
Construct an instruction with the given operator and arguments.- Parameters:
op
- The operator.args
- The arguments.
-
-
Method Details
-
getDelegate
Description copied from class:DelegatingExtHolder
Get theExtHolder
to delegate to.- Specified by:
getDelegate
in classDelegatingExtHolder
- Returns:
- The delegate.
-
toString
-
assignTo
Create an effect that assigns the result of this instruction.- Parameters:
vars
- The variables to assign to.- Returns:
- The effect.
-
assignTo
Create an effect that assigns the result of this instruction.- Parameters:
vars
- The variables to assign to.- Returns:
- The effect.
-
jumpsTo
Create a control instruction that jumps to the given targets.- Parameters:
targets
- The jump targets.- Returns:
- The control instruction.
-
jumpsTo
Create a control instruction that jumps to the given targets.- Parameters:
targets
- The jump targets.- Returns:
- The control instruction.
-
copyFrom
Create a new effect that assigns to the same variables as the given one.- Parameters:
fx
- The effect to copy from.- Returns:
- The new effect.
-
getNullable
Description copied from interface:ExtContainer
Get the value associated withext
in this container, or null if not present.If an ext was attached with
ExtContainer.attachExt(Ext, Object)
, it should be returned, unless it was later removed with a call toExtContainer.removeExt(Ext)
.- Specified by:
getNullable
in interfaceExtContainer
- Overrides:
getNullable
in classDelegatingExtHolder
- Type Parameters:
T
- The type of the ext.- Parameters:
ext
- The ext.- Returns:
- The value associated with ext in this container.
-
attachExt
Description copied from interface:ExtContainer
Associateext
withvalue
in this container.- Specified by:
attachExt
in interfaceExtContainer
- Overrides:
attachExt
in classExtHolder
- Type Parameters:
T
- The type of the ext.- Parameters:
ext
- The ext.value
- The value the ext has in this container.
-
removeExt
Description copied from interface:ExtContainer
Disassociate the value ofext
(if any) in this container.- Specified by:
removeExt
in interfaceExtContainer
- Overrides:
removeExt
in classExtHolder
- Type Parameters:
T
- The type of the ext.- Parameters:
ext
- The ext.
-
args
Get the arguments to the instruction.- Returns:
- The arguments.
-
iterator
-