org.ow2.asmdex.instruction
Class InstructionFormat11N

java.lang.Object
  extended by org.ow2.asmdex.instruction.Instruction
      extended by org.ow2.asmdex.instruction.InstructionFormat11N
All Implemented Interfaces:
ILiteralInstruction, IOneRegisterInstruction

public class InstructionFormat11N
extends Instruction
implements IOneRegisterInstruction, ILiteralInstruction

Encodes and decodes an instruction built with the Dalvik format 11N.

Author:
Julien Névo

Field Summary
 
Fields inherited from class org.ow2.asmdex.instruction.Instruction
lineNumber, opcodeByte, opcodeHighOrderByte
 
Constructor Summary
InstructionFormat11N(int opcode, int destinationRegister, int var)
          Constructor of the Instruction by providing all the elements it's composed of.
 
Method Summary
 int getLiteral()
          The value of the litteral.
static int getLiteralB(int opcode)
          Returns the LiteralB encoded in the given 16-bit opcode.
 int getRegisterA()
          The index of the register (called A value in Dalvik documentation)
static int getRegisterA(int opcode)
          Returns the RegisterA encoded in the given 16-bit opcode.
 int getSize()
          Returns the size of the instruction in bytes.
 void write(ByteVector out, ConstantPool constantPool)
          Encodes the instruction, in the Dalvik format, to an output buffer.
 
Methods inherited from class org.ow2.asmdex.instruction.Instruction
getInstructionSizeInByte, getLineNumber, getOpcodeByte, getOpcodeHighOrderByte, setLineNumber, test4BitsLimit, test4BitsLimit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstructionFormat11N

public InstructionFormat11N(int opcode,
                            int destinationRegister,
                            int var)
Constructor of the Instruction by providing all the elements it's composed of.

Parameters:
opcode - 8 or 16 bits opcode.
destinationRegister - the destination register.
var - the literal to store.
Method Detail

getRegisterA

public int getRegisterA()
Description copied from interface: IOneRegisterInstruction
The index of the register (called A value in Dalvik documentation)

Specified by:
getRegisterA in interface IOneRegisterInstruction
Returns:
regoster A index

getLiteral

public int getLiteral()
Description copied from interface: ILiteralInstruction
The value of the litteral.

Specified by:
getLiteral in interface ILiteralInstruction
Returns:
as an integer (one word).

getRegisterA

public static int getRegisterA(int opcode)
Returns the RegisterA encoded in the given 16-bit opcode.

Returns:
the RegisterA .

getLiteralB

public static int getLiteralB(int opcode)
Returns the LiteralB encoded in the given 16-bit opcode.

Returns:
the LiteralB.

getSize

public int getSize()
Description copied from class: Instruction
Returns the size of the instruction in bytes.

Specified by:
getSize in class Instruction
Returns:
the size of the instruction in bytes.

write

public void write(ByteVector out,
                  ConstantPool constantPool)
Description copied from class: Instruction
Encodes the instruction, in the Dalvik format, to an output buffer.

Specified by:
write in class Instruction
Parameters:
out - output buffer.
constantPool - the constantPool.