|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdspl.backend.x86.X86AsmFormatter
public class X86AsmFormatter
Utility class for various common formatting operations required by the various x86***InstructionProcessors
| Constructor Summary | |
|---|---|
X86AsmFormatter()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
getAddInstruction(Variable v)
Returns the appriopriate add instruction based on the variable's size |
static java.lang.String |
getArrayElement(Variable v,
java.lang.String index)
Returns the string representation of an element within an array. |
static java.lang.String |
getConstantRepresentation(int x)
Returns representation that should be used in an x86 assmebly file for an integer constant Created originally for getting representation for array sizes which is used in loops. |
static java.lang.String |
getDivideInstruction(Variable v)
Returns the appriopriate divide instruction based on the variable's type |
static java.lang.String |
getInstr(java.lang.String inst,
Variable v)
Returns a string representing the instruction for inst + (b/w/l), depending on size of v |
static java.lang.String |
getMoveInstruction(int size)
|
static java.lang.String |
getMoveInstruction(Variable v)
Returns the apprioprate move instruction based on the variable's size |
static java.lang.String |
getMultiplyInstruction(Variable v)
Returns the appriopriate multiply instruction based on the variable's type |
static java.lang.String |
getSizePostfix(Variable v)
Returns the appriopriate size postfix (b,w, or l) for (1,2, or 4) byte sized data type |
static java.lang.String |
getSubtractInstruction(Variable v)
Returns the appriopriate subtract instruction based on the variable's type |
static java.lang.String |
getVariableRepresentation(Variable v)
Returns the representation that should be used for the variable in assmebly |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public X86AsmFormatter()
| Method Detail |
|---|
public static java.lang.String getVariableRepresentation(Variable v)
The intent on adding this it allow for the future possibility of supporting the different
ASM representations for assembly
Also to allow for changes in exactly how a variable's location, as it should be referenced within
the asm file to change.
For example, if variables stored on the stack are supported, an additional field might be added to variable to store it's stack offset (i.e. "-4(%ebp)")
v -
public static java.lang.String getConstantRepresentation(int x)
x -
public static java.lang.String getArrayElement(Variable v,
java.lang.String index)
v - index -
public static java.lang.String getMoveInstruction(Variable v)
1 byte = movb 2 bytes = movw 4 bytes = movl
v -
public static java.lang.String getMoveInstruction(int size)
public static java.lang.String getAddInstruction(Variable v)
1 byte = addb 2 bytes = addw 4 bytes = addl
v -
public static java.lang.String getInstr(java.lang.String inst,
Variable v)
inst - v -
public static java.lang.String getSizePostfix(Variable v)
v -
public static java.lang.String getMultiplyInstruction(Variable v)
This instruction is only valid for int/byte (signed) or uint/ubyte (unsigned).
v -
public static java.lang.String getSubtractInstruction(Variable v)
This instruction is only valid for int/byte (signed) or uint/ubyte (unsigned).
v -
public static java.lang.String getDivideInstruction(Variable v)
This instruction is only valid for int/byte (signed) or uint/ubyte (unsigned).
v -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||