public abstract class DalvInsn
extends java.lang.Object
| Constructor and Description |
|---|
DalvInsn(Dop opcode,
SourcePosition position,
RegisterSpecList registers)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.lang.String |
argString()
Gets the string form for any arguments to this instance.
|
abstract int |
codeSize()
Gets the size of this instruction, in 16-bit code units.
|
java.lang.String |
cstComment()
Helper which returns the comment form of the associated constants
for inclusion in a human oriented listing dump.
|
java.lang.String |
cstString()
Helper which returns the string form of the associated constants
for inclusion in a human oriented listing dump.
|
DalvInsn |
expandedPrefix(java.util.BitSet compatRegs)
Gets the instruction prefix required, if any, to use in an expanded
version of this instance.
|
DalvInsn |
expandedSuffix(java.util.BitSet compatRegs)
Gets the instruction suffix required, if any, to use in an expanded
version of this instance.
|
DalvInsn |
expandedVersion(java.util.BitSet compatRegs)
Gets the instruction that is equivalent to this one, except that
it replaces incompatible registers with sequential registers
starting at
0 (storing the result, if any, in register
0 as well). |
int |
getAddress()
Gets the output address of this instruction, if it is known.
|
DalvInsn |
getLowRegVersion()
Gets the instruction that is equivalent to this one, except that
it uses sequential registers starting at
0 (storing
the result, if any, in register 0 as well). |
int |
getMinimumRegisterRequirement(java.util.BitSet compatRegs)
Gets the minimum distinct registers required for this instruction.
|
int |
getNextAddress()
Gets the address immediately after this instance.
|
Dop |
getOpcode()
Gets the opcode.
|
SourcePosition |
getPosition()
Gets the source position.
|
RegisterSpecList |
getRegisters()
Gets the register list for this instruction.
|
boolean |
hasAddress()
Gets whether the address of this instruction is known.
|
boolean |
hasResult()
Returns whether this instance's opcode uses a result register.
|
java.lang.String |
identifierString()
Gets the short identifier for this instruction.
|
java.lang.String |
listingString(java.lang.String prefix,
int width,
boolean noteIndices)
Returns the string form of this instance suitable for inclusion in
a human-oriented listing dump.
|
protected abstract java.lang.String |
listingString0(boolean noteIndices)
Helper for
listingString(java.lang.String, int, boolean), which returns the string
form of this instance suitable for inclusion in a
human-oriented listing dump, not including the instruction
address and without respect for any output formatting. |
static SimpleInsn |
makeMove(SourcePosition position,
RegisterSpec dest,
RegisterSpec src)
Makes a move instruction, appropriate and ideal for the given arguments.
|
void |
setAddress(int address)
Sets the output address.
|
java.lang.String |
toString() |
DalvInsn |
withMapper(RegisterMapper mapper)
Returns an instance that is just like this one, except that the
register list is mapped by using
mapper. |
abstract DalvInsn |
withOpcode(Dop opcode)
Returns an instance that is just like this one, except that its
opcode is replaced by the one given, and its address is reset.
|
abstract DalvInsn |
withRegisterOffset(int delta)
Returns an instance that is just like this one, except that all
register references have been offset by the given delta, and its
address is reset.
|
abstract DalvInsn |
withRegisters(RegisterSpecList registers)
Returns an instance that is just like this one, except that the
register list is replaced by the given one, and its address is
reset.
|
abstract void |
writeTo(AnnotatedOutput out)
Writes this instance to the given output.
|
public DalvInsn(Dop opcode, SourcePosition position, RegisterSpecList registers)
-1).
Note: In the unlikely event that an instruction takes
absolutely no registers (e.g., a nop or a
no-argument no-result static method call), then the given
register list may be passed as RegisterSpecList.EMPTY.
opcode - the opcode; one of the constants from Dopsposition - non-null; source positionregisters - non-null; register list, including a
result register if appropriate (that is, registers may be either
ins and outs)public static SimpleInsn makeMove(SourcePosition position, RegisterSpec dest, RegisterSpec src)
position - non-null; source position informationdest - non-null; destination registersrc - non-null; source registernon-null; an appropriately-constructed instancepublic final java.lang.String toString()
toString in class java.lang.Objectpublic final boolean hasAddress()
getAddress(),
setAddress(int)public final int getAddress()
RuntimeException if it has not yet been set.>= 0; the output addresssetAddress(int)public final Dop getOpcode()
non-null; the opcodepublic final SourcePosition getPosition()
non-null; the source positionpublic final RegisterSpecList getRegisters()
non-null; the registerspublic final boolean hasResult()
getOpcode().hasResult().true iff this opcode uses a result registerpublic final int getMinimumRegisterRequirement(java.util.BitSet compatRegs)
compatRegs - non-null; set of compatible registers>= 0; the minimum distinct register requirementpublic DalvInsn getLowRegVersion()
0 (storing
the result, if any, in register 0 as well).non-null; the replacementpublic DalvInsn expandedPrefix(java.util.BitSet compatRegs)
compatRegs - non-null; set of compatible registersnull-ok; the prefix, if anyexpandedVersion(java.util.BitSet)public DalvInsn expandedSuffix(java.util.BitSet compatRegs)
compatRegs - non-null; set of compatible registersnull-ok; the suffix, if anyexpandedVersion(java.util.BitSet)public DalvInsn expandedVersion(java.util.BitSet compatRegs)
0 (storing the result, if any, in register
0 as well). The sequence of instructions from
expandedPrefix(java.util.BitSet) and expandedSuffix(java.util.BitSet) (if non-null)
surrounding the result of a call to this method are the expanded
transformation of this instance, and it is guaranteed that the
number of low registers used will be the number returned by
getMinimumRegisterRequirement(java.util.BitSet).compatRegs - non-null; set of compatible registersnon-null; the replacementpublic final java.lang.String identifierString()
non-null; the identifierpublic final java.lang.String listingString(java.lang.String prefix,
int width,
boolean noteIndices)
null
if this instance should not appear in a listing.prefix - non-null; prefix before the address; each follow-on
line will be indented to match as wellwidth - width >= 0; the width of the output or 0 for
unlimited widthnoteIndices - whether to include an explicit notation of
constant pool indicesnull-ok; the string form or null if this
instance should not appear in a listingpublic final void setAddress(int address)
address - address >= 0; the output addresspublic final int getNextAddress()
>= 0; the next addresspublic DalvInsn withMapper(RegisterMapper mapper)
mapper.mapper - non-null; used to map registersnon-null; an appropriately-constructed instancepublic abstract int codeSize()
>= 0; the code size of this instructionpublic abstract void writeTo(AnnotatedOutput out)
out - non-null; where to write topublic abstract DalvInsn withOpcode(Dop opcode)
opcode - non-null; the new opcodenon-null; an appropriately-constructed instancepublic abstract DalvInsn withRegisterOffset(int delta)
delta - the amount to offset register references bynon-null; an appropriately-constructed instancepublic abstract DalvInsn withRegisters(RegisterSpecList registers)
registers - non-null; new register listnon-null; an appropriately-constructed instanceprotected abstract java.lang.String argString()
null-ok; the string version of any arguments or
null if there are noneprotected abstract java.lang.String listingString0(boolean noteIndices)
listingString(java.lang.String, int, boolean), which returns the string
form of this instance suitable for inclusion in a
human-oriented listing dump, not including the instruction
address and without respect for any output formatting. This
method should return null if this instance should
not appear in a listing.noteIndices - whether to include an explicit notation of
constant pool indicesnull-ok; the listing stringpublic java.lang.String cstString()
public java.lang.String cstComment()
Copyright © 2020. All Rights Reserved.