File src/plugins/built_in/abstract_objects/stub/ao_insn.luadoc

Declares methods that can be invoked on an instruction (instance of the 'insn' class)

Functions

insn:get_SIMD_width () Returns the SIMD width for an SIMD instruction, that is the number of elements processed at input
insn:get_address () Returns the address of an instruction
insn:get_asm_code () Returns the assembly code of an instruction For example, "ADDSS 0(%rax),%xmm2"
insn:get_asmfile () Returns the asmfile containing an instruction
insn:get_bitsize () Returns the size of an instruction, in bits
insn:get_block () Returns the block containing an instruction
insn:get_branch_target () Returns the instruction targetted by a branch instruction
insn:get_class () Returns the class of an instruction.
insn:get_coding () Returns the binary code of an instruction
insn:get_dispatch () Returns the performance data provided by Agner Fog Performance data are:
  • min-max number of fused uops
  • list of uops groups, a uops group being a couple of:
    • a number of uops
    • a list of ports/units accepting these uops
  • min-max number of latency cycles
  • reciprocal throughput (cycles / instruction ratio)
insn:get_element_bits () Returns the size of elements handled by an instruction (converted into bits).
insn:get_element_size () Returns the size of elements handled by an instruction.
insn:get_element_type () Returns the type of elements handled by an instruction.
insn:get_family () Returns the family of an instruction.
insn:get_first_group () Returns a group the instruction belong to
insn:get_first_mem_oprnd () Returns the first memory operand.
insn:get_function () Returns the function containing an instruction
insn:get_groups () Returns all groups the instruction belong to into a table
insn:get_iset () Returns the instruction set of an instruction
insn:get_loop () Returns the loop containing an instruction
insn:get_name () Returns the opcode name of an instruction
insn:get_next () Gets the next instruction
insn:get_noprnds () Returns the number of operands of an instruction
insn:get_operand_dest_index () Returns position of the first memory operand, if written NOTE : this function only considers mov sources (GAS syntax)
insn:get_operand_src_index () Returns position of the first memory operand, if read NOTE : this function only considers mov sources (GAS syntax)
insn:get_operands () Returns operands of an instruction as a table
Each operand is described in a table, with fields:
  • For all operands (independently of its type):
    • type : integer in Consts.{OT_REGISTER, OT_IMMEDIATE, OT_POINTER, OT_MEMORY, OT_MEMORY_RELATIVE, OT_IMMEDIATE_ADDRESS, OT_REGISTER_INDEXED}
    • size : size in bits.
insn:get_oprnd_str (n) Returns the assembly code the nth operand of an instruction
insn:get_oprnd_type (n) Returns the type of the nth operand of an instruction
insn:get_prev () Gets the previous instruction
insn:get_project () Returns the project containing an instruction
insn:get_read_bits () Returns the effective number of bits read by an instruction (converted into bits).
insn:get_read_size () Returns the effective number of bits read by an instruction.
insn:get_registers_name () Returns the name of an instruction's registers as a flat table
insn:get_registers_rw () Returns the read/write flags of an instruction's registers as a flat table.
insn:get_src_column () Returns the source column of an instruction
insn:get_src_file_path () Returns the path to the source file containing an instruction
insn:get_src_line () Returns the source line of an instruction
insn:groups () Iterates over groups of an instruction
insn:has_dst_mem_oprnd () Test whether an instruction has at least one destination memory operand
insn:has_src_mem_oprnd () Test whether an instruction has at least one source memory operand
insn:is_FP () Checks whether an instruction processes at input FP elements
insn:is_INT () Checks whether an instruction processes at input integer elements
insn:is_SIMD () Checks is SIMD (uses SIMD registers and/or units) For example, INC is not SIMD but ADDSS, yes
insn:is_SIMD_FP () Checks whether an instruction is SIMD and processes FP (floating-point) elements
insn:is_SIMD_INT () Checks whether an instruction is SIMD and processes integer elements
insn:is_SIMD_NOT_FP () Checks whether an instruction is SIMD and processes non FP (floating-point) elements
insn:is_add_sub () Checks whether an instruction is a add or a sub
insn:is_arith () Checks whether an instruction is arithmetical (add, sub, mul, fma, div, rcp, sqrt or rsqrt)
insn:is_branch () Tests whether an instruction is a branch (conditional or not)
insn:is_branch_cond () Tests whether an instruction is a conditional branch
insn:is_branch_uncond () Tests whether an instruction is an unconditional branch
insn:is_call () Tests whether an instruction is a call
insn:is_div () Checks whether an instruction is a div
insn:is_double_prec () Checks whether an instruction processes at input double precision (64 bits) FP elements
insn:is_exit () Checks if the instruction is an exit
insn:is_exit_early () Checks if the instruction is an early exit (JUMP in another function)
insn:is_exit_handler () Checks if the instruction is an exit handler (call to a runtime exit function)
insn:is_exit_natural () Checks if the instruction is a natural exit (RET)
insn:is_exit_potential () Checks if the instruction is a potential exit (indirect call / jump)
insn:is_fma () Checks whether an instruction is an FMA (fused multiply-add/sub)
insn:is_load () Checks whether an instruction is a load, that is reads data from memory into a register Warning: it is assumed that there are no implicit (out of operands) loads ! A warning is emitted for instructions with no operands
insn:is_mul () Checks whether an instruction is a mul
insn:is_packed () Checks whether an instruction is packed (a vector instruction)
insn:is_prefetch () Checks whether an instruction is a prefetch
insn:is_rcp () Checks whether an instruction is a reciprocal approximate
insn:is_return () Tests whether an instruction is a return
insn:is_rsqrt () Checks whether an instruction is a reciprocal sqrt (square root) approximate
insn:is_single_prec () Checks whether an instruction processes at input single-precision (32 bits) FP elements
insn:is_sqrt () Checks whether an instruction is a sqrt (square root)
insn:is_store () Checks whether an instruction is a store, that is writes data from a register to memory Warning: it is assumed that there are no implicit (out of operands) loads ! A warning is emitted for instructions with no operands
insn:is_struct_or_str () Checks whether an instruction processes at input a structure or a string
insn:set_function (new_fct) Changes the function associated to an instruction
insn:tostring () Print "Insn: " (meta-method) For example, "Insn: ADDSS 0(%rax),%xmm2"


Functions

insn:get_SIMD_width ()
Returns the SIMD width for an SIMD instruction, that is the number of elements processed at input

Return value:

number of elements (integer)
insn:get_address ()
Returns the address of an instruction

Return value:

address (integer)
insn:get_asm_code ()
Returns the assembly code of an instruction For example, "ADDSS 0(%rax),%xmm2"

Return value:

assembly code (string)
insn:get_asmfile ()
Returns the asmfile containing an instruction

Return value:

asmfile
insn:get_bitsize ()
Returns the size of an instruction, in bits

Return value:

size
insn:get_block ()
Returns the block containing an instruction

Return value:

block
insn:get_branch_target ()
Returns the instruction targetted by a branch instruction

Return value:

target instruction
insn:get_class ()
Returns the class of an instruction. For example, ADDSS belongs to the class "arithmetic"

Return value:

class (integer, compare with constants)
insn:get_coding ()
Returns the binary code of an instruction

Return value:

binary code (string)
insn:get_dispatch ()
Returns the performance data provided by Agner Fog Performance data are:
  • min-max number of fused uops
  • list of uops groups, a uops group being a couple of:
    • a number of uops
    • a list of ports/units accepting these uops
  • min-max number of latency cycles
  • reciprocal throughput (cycles / instruction ratio)

Return value:

table containing performance data

See also:

insn:get_element_bits ()
Returns the size of elements handled by an instruction (converted into bits). For example, 32 for ADDSS. For conversion instructions, input elements are considered

Return value:

element size in bits (integer)
insn:get_element_size ()
Returns the size of elements handled by an instruction. For example, Consts.DATASZ_32b for ADDSS. For conversion instructions, input elements are considered

Return value:

element size (integer, compare with constants)
insn:get_element_type ()
Returns the type of elements handled by an instruction. For example, "FP" for ADDSS. For conversion instructions, input elements are considered

Return value:

element type (integer, compare with constants)
insn:get_family ()
Returns the family of an instruction. For example, ADDSS and INC belongs to the family "ADD"

Return value:

family (integer, compare with constants)
insn:get_first_group ()
Returns a group the instruction belong to

Return value:

group
insn:get_first_mem_oprnd ()
Returns the first memory operand. The rank of an operand (starting from 0 and usable for MADRAS API) can be obtained by using the "rank" field

Return value:

memory operand table

See also:

insn:get_function ()
Returns the function containing an instruction

Return value:

a function
insn:get_groups ()
Returns all groups the instruction belong to into a table

Return value:

groups table
insn:get_iset ()
Returns the instruction set of an instruction

Return value:

instruction set (integer, to compare with constants)
insn:get_loop ()
Returns the loop containing an instruction

Return value:

a loop
insn:get_name ()
Returns the opcode name of an instruction

Return value:

opcode (string)
insn:get_next ()
Gets the next instruction

Return value:

an instruction
insn:get_noprnds ()
Returns the number of operands of an instruction

Return value:

number of instructions
insn:get_operand_dest_index ()
Returns position of the first memory operand, if written NOTE : this function only considers mov sources (GAS syntax)

Return value:

destination operand index (index value starts at 0)
insn:get_operand_src_index ()
Returns position of the first memory operand, if read NOTE : this function only considers mov sources (GAS syntax)

Return value:

source operand index (index value starts at 0)
insn:get_operands ()
Returns operands of an instruction as a table
Each operand is described in a table, with fields:
  • For all operands (independently of its type):
    • type : integer in Consts.{OT_REGISTER, OT_IMMEDIATE, OT_POINTER, OT_MEMORY, OT_MEMORY_RELATIVE, OT_IMMEDIATE_ADDRESS, OT_REGISTER_INDEXED}
    • size : size in bits. For a memory operand, size of the data moved from/to memory
    • value: integer for immediate and pointer operands, string for a register and table for a memory operand
  • For a register or memory operand:
    • read : boolean true if read and false otherwise
    • write: boolean true if written and false otherwise
  • For a register sub-operand of a memory operand:
    • typex: "segment", "base" or "index"
The rank of an operand (starting from 0 and usable for MADRAS API) can be obtained by subtracting 1 from the operand key

Return value:

operands table
insn:get_oprnd_str (n)
Returns the assembly code the nth operand of an instruction

Parameters

  • n: rank of the operand

Return value:

assembly code (string)
insn:get_oprnd_type (n)
Returns the type of the nth operand of an instruction

Parameters

  • n: rank of the operand

Return value:

type (integer, to compare with constants)
insn:get_prev ()
Gets the previous instruction

Return value:

an instruction
insn:get_project ()
Returns the project containing an instruction

Return value:

project
insn:get_read_bits ()
Returns the effective number of bits read by an instruction (converted into bits). For example, 32 for ADDSS.

Return value:

read size in bits (integer)
insn:get_read_size ()
Returns the effective number of bits read by an instruction. For example, Consts.DATASZ_32b for ADDSS.

Return value:

read size (integer, compare with constants)
insn:get_registers_name ()
Returns the name of an instruction's registers as a flat table

Return value:

string table
insn:get_registers_rw ()
Returns the read/write flags of an instruction's registers as a flat table. Extended version of get_registers_name

Return value:

table of tables with 3 fields: value, read and write
insn:get_src_column ()
Returns the source column of an instruction

Return value:

number of the column in the source code
insn:get_src_file_path ()
Returns the path to the source file containing an instruction

Return value:

path to the source file (string)
insn:get_src_line ()
Returns the source line of an instruction

Return value:

number of the line in the source code
insn:groups ()
Iterates over groups of an instruction

Return value:

next group
insn:has_dst_mem_oprnd ()
Test whether an instruction has at least one destination memory operand

Return value:

boolean
insn:has_src_mem_oprnd ()
Test whether an instruction has at least one source memory operand

Return value:

boolean
insn:is_FP ()
Checks whether an instruction processes at input FP elements

Return value:

boolean
insn:is_INT ()
Checks whether an instruction processes at input integer elements

Return value:

boolean
insn:is_SIMD ()
Checks is SIMD (uses SIMD registers and/or units) For example, INC is not SIMD but ADDSS, yes

Return value:

boolean
insn:is_SIMD_FP ()
Checks whether an instruction is SIMD and processes FP (floating-point) elements

Return value:

boolean
insn:is_SIMD_INT ()
Checks whether an instruction is SIMD and processes integer elements

Return value:

boolean
insn:is_SIMD_NOT_FP ()
Checks whether an instruction is SIMD and processes non FP (floating-point) elements

Return value:

boolean
insn:is_add_sub ()
Checks whether an instruction is a add or a sub

Return value:

boolean
insn:is_arith ()
Checks whether an instruction is arithmetical (add, sub, mul, fma, div, rcp, sqrt or rsqrt)

See also:

insn:is_branch ()
Tests whether an instruction is a branch (conditional or not)

Return value:

boolean
insn:is_branch_cond ()
Tests whether an instruction is a conditional branch

Return value:

boolean
insn:is_branch_uncond ()
Tests whether an instruction is an unconditional branch

Return value:

boolean
insn:is_call ()
Tests whether an instruction is a call

Return value:

boolean
insn:is_div ()
Checks whether an instruction is a div

See also:

insn:is_double_prec ()
Checks whether an instruction processes at input double precision (64 bits) FP elements

Return value:

boolean
insn:is_exit ()
Checks if the instruction is an exit

Return value:

true if the instruction is an exit, else false
insn:is_exit_early ()
Checks if the instruction is an early exit (JUMP in another function)

Return value:

true if the instruction is an early exit, else false
insn:is_exit_handler ()
Checks if the instruction is an exit handler (call to a runtime exit function)

Return value:

true if the instruction is an exit exit, else false
insn:is_exit_natural ()
Checks if the instruction is a natural exit (RET)

Return value:

true if the instruction is a natural exit, else false
insn:is_exit_potential ()
Checks if the instruction is a potential exit (indirect call / jump)

Return value:

true if the instruction is a potential exit, else false
insn:is_fma ()
Checks whether an instruction is an FMA (fused multiply-add/sub)

Return value:

boolean
insn:is_load ()
Checks whether an instruction is a load, that is reads data from memory into a register Warning: it is assumed that there are no implicit (out of operands) loads ! A warning is emitted for instructions with no operands

Return value:

boolean
insn:is_mul ()
Checks whether an instruction is a mul

See also:

insn:is_packed ()
Checks whether an instruction is packed (a vector instruction)

Return value:

boolean
insn:is_prefetch ()
Checks whether an instruction is a prefetch

Return value:

boolean
insn:is_rcp ()
Checks whether an instruction is a reciprocal approximate

See also:

insn:is_return ()
Tests whether an instruction is a return

Return value:

boolean
insn:is_rsqrt ()
Checks whether an instruction is a reciprocal sqrt (square root) approximate

See also:

insn:is_single_prec ()
Checks whether an instruction processes at input single-precision (32 bits) FP elements

Return value:

boolean
insn:is_sqrt ()
Checks whether an instruction is a sqrt (square root)

See also:

insn:is_store ()
Checks whether an instruction is a store, that is writes data from a register to memory Warning: it is assumed that there are no implicit (out of operands) loads ! A warning is emitted for instructions with no operands

Return value:

boolean
insn:is_struct_or_str ()
Checks whether an instruction processes at input a structure or a string

Return value:

boolean
insn:set_function (new_fct)
Changes the function associated to an instruction

Parameters

  • new_fct: the new function to associate to the instruction
insn:tostring ()
Print "Insn: " (meta-method) For example, "Insn: ADDSS 0(%rax),%xmm2"

Valid XHTML 1.0!