decompiler  1.0.0
Enumerations | Functions
opcodes.hh File Reference

All the individual p-code operations. More...

#include <string>

Enumerations

enum  ghidra::OpCode {
  ghidra::CPUI_COPY = 1, ghidra::CPUI_LOAD = 2, ghidra::CPUI_STORE = 3, ghidra::CPUI_BRANCH = 4,
  ghidra::CPUI_CBRANCH = 5, ghidra::CPUI_BRANCHIND = 6, ghidra::CPUI_CALL = 7, ghidra::CPUI_CALLIND = 8,
  ghidra::CPUI_CALLOTHER = 9, ghidra::CPUI_RETURN = 10, ghidra::CPUI_INT_EQUAL = 11, ghidra::CPUI_INT_NOTEQUAL = 12,
  ghidra::CPUI_INT_SLESS = 13, ghidra::CPUI_INT_SLESSEQUAL = 14, ghidra::CPUI_INT_LESS = 15, ghidra::CPUI_INT_LESSEQUAL = 16,
  ghidra::CPUI_INT_ZEXT = 17, ghidra::CPUI_INT_SEXT = 18, ghidra::CPUI_INT_ADD = 19, ghidra::CPUI_INT_SUB = 20,
  ghidra::CPUI_INT_CARRY = 21, ghidra::CPUI_INT_SCARRY = 22, ghidra::CPUI_INT_SBORROW = 23, ghidra::CPUI_INT_2COMP = 24,
  ghidra::CPUI_INT_NEGATE = 25, ghidra::CPUI_INT_XOR = 26, ghidra::CPUI_INT_AND = 27, ghidra::CPUI_INT_OR = 28,
  ghidra::CPUI_INT_LEFT = 29, ghidra::CPUI_INT_RIGHT = 30, ghidra::CPUI_INT_SRIGHT = 31, ghidra::CPUI_INT_MULT = 32,
  ghidra::CPUI_INT_DIV = 33, ghidra::CPUI_INT_SDIV = 34, ghidra::CPUI_INT_REM = 35, ghidra::CPUI_INT_SREM = 36,
  ghidra::CPUI_BOOL_NEGATE = 37, ghidra::CPUI_BOOL_XOR = 38, ghidra::CPUI_BOOL_AND = 39, ghidra::CPUI_BOOL_OR = 40,
  ghidra::CPUI_FLOAT_EQUAL = 41, ghidra::CPUI_FLOAT_NOTEQUAL = 42, ghidra::CPUI_FLOAT_LESS = 43, ghidra::CPUI_FLOAT_LESSEQUAL = 44,
  ghidra::CPUI_FLOAT_NAN = 46, ghidra::CPUI_FLOAT_ADD = 47, ghidra::CPUI_FLOAT_DIV = 48, ghidra::CPUI_FLOAT_MULT = 49,
  ghidra::CPUI_FLOAT_SUB = 50, ghidra::CPUI_FLOAT_NEG = 51, ghidra::CPUI_FLOAT_ABS = 52, ghidra::CPUI_FLOAT_SQRT = 53,
  ghidra::CPUI_FLOAT_INT2FLOAT = 54, ghidra::CPUI_FLOAT_FLOAT2FLOAT = 55, ghidra::CPUI_FLOAT_TRUNC = 56, ghidra::CPUI_FLOAT_CEIL = 57,
  ghidra::CPUI_FLOAT_FLOOR = 58, ghidra::CPUI_FLOAT_ROUND = 59, ghidra::CPUI_MULTIEQUAL = 60, ghidra::CPUI_INDIRECT = 61,
  ghidra::CPUI_PIECE = 62, ghidra::CPUI_SUBPIECE = 63, ghidra::CPUI_CAST = 64, ghidra::CPUI_PTRADD = 65,
  ghidra::CPUI_PTRSUB = 66, ghidra::CPUI_SEGMENTOP = 67, ghidra::CPUI_CPOOLREF = 68, ghidra::CPUI_NEW = 69,
  ghidra::CPUI_INSERT = 70, ghidra::CPUI_EXTRACT = 71, ghidra::CPUI_POPCOUNT = 72, ghidra::CPUI_LZCOUNT = 73,
  ghidra::CPUI_MAX = 74
}
 The op-code defining a specific p-code operation (PcodeOp) More...
 

Functions

const char * ghidra::get_opname (OpCode opc)
 Convert an OpCode to the name as a string. More...
 
OpCode ghidra::get_opcode (const string &nm)
 Convert a name string to the matching OpCode. More...
 
OpCode ghidra::get_booleanflip (OpCode opc, bool &reorder)
 Get the complementary OpCode. More...
 

Detailed Description

All the individual p-code operations.

Enumeration Type Documentation

◆ OpCode

The op-code defining a specific p-code operation (PcodeOp)

These break up into categories:

  • Branching operations
  • Load and Store
  • Comparison operations
  • Arithmetic operations
  • Logical operations
  • Extension and truncation operations
Enumerator
CPUI_COPY 

Copy one operand to another.

CPUI_LOAD 

Load from a pointer into a specified address space.

CPUI_STORE 

Store at a pointer into a specified address space.

CPUI_BRANCH 

Always branch.

CPUI_CBRANCH 

Conditional branch.

CPUI_BRANCHIND 

Indirect branch (jumptable)

CPUI_CALL 

Call to an absolute address.

CPUI_CALLIND 

Call through an indirect address.

CPUI_CALLOTHER 

User-defined operation.

CPUI_RETURN 

Return from subroutine.

CPUI_INT_EQUAL 

Integer comparison, equality (==)

CPUI_INT_NOTEQUAL 

Integer comparison, in-equality (!=)

CPUI_INT_SLESS 

Integer comparison, signed less-than (<)

CPUI_INT_SLESSEQUAL 

Integer comparison, signed less-than-or-equal (<=)

CPUI_INT_LESS 

Integer comparison, unsigned less-than (<)

CPUI_INT_LESSEQUAL 

Integer comparison, unsigned less-than-or-equal (<=)

CPUI_INT_ZEXT 

Zero extension.

CPUI_INT_SEXT 

Sign extension.

CPUI_INT_ADD 

Addition, signed or unsigned (+)

CPUI_INT_SUB 

Subtraction, signed or unsigned (-)

CPUI_INT_CARRY 

Test for unsigned carry.

CPUI_INT_SCARRY 

Test for signed carry.

CPUI_INT_SBORROW 

Test for signed borrow.

CPUI_INT_2COMP 

Twos complement.

CPUI_INT_NEGATE 

Logical/bitwise negation (~)

CPUI_INT_XOR 

Logical/bitwise exclusive-or (^)

CPUI_INT_AND 

Logical/bitwise and (&)

CPUI_INT_OR 

Logical/bitwise or (|)

CPUI_INT_LEFT 

Left shift (<<)

CPUI_INT_RIGHT 

Right shift, logical (>>)

CPUI_INT_SRIGHT 

Right shift, arithmetic (>>)

CPUI_INT_MULT 

Integer multiplication, signed and unsigned (*)

CPUI_INT_DIV 

Integer division, unsigned (/)

CPUI_INT_SDIV 

Integer division, signed (/)

CPUI_INT_REM 

Remainder/modulo, unsigned (%)

CPUI_INT_SREM 

Remainder/modulo, signed (%)

CPUI_BOOL_NEGATE 

Boolean negate (!)

CPUI_BOOL_XOR 

Boolean exclusive-or (^^)

CPUI_BOOL_AND 

Boolean and (&&)

CPUI_BOOL_OR 

Boolean or (||)

CPUI_FLOAT_EQUAL 

Floating-point comparison, equality (==)

CPUI_FLOAT_NOTEQUAL 

Floating-point comparison, in-equality (!=)

CPUI_FLOAT_LESS 

Floating-point comparison, less-than (<)

CPUI_FLOAT_LESSEQUAL 

Floating-point comparison, less-than-or-equal (<=)

CPUI_FLOAT_NAN 

Not-a-number test (NaN)

CPUI_FLOAT_ADD 

Floating-point addition (+)

CPUI_FLOAT_DIV 

Floating-point division (/)

CPUI_FLOAT_MULT 

Floating-point multiplication (*)

CPUI_FLOAT_SUB 

Floating-point subtraction (-)

CPUI_FLOAT_NEG 

Floating-point negation (-)

CPUI_FLOAT_ABS 

Floating-point absolute value (abs)

CPUI_FLOAT_SQRT 

Floating-point square root (sqrt)

CPUI_FLOAT_INT2FLOAT 

Convert an integer to a floating-point.

CPUI_FLOAT_FLOAT2FLOAT 

Convert between different floating-point sizes.

CPUI_FLOAT_TRUNC 

Round towards zero.

CPUI_FLOAT_CEIL 

Round towards +infinity.

CPUI_FLOAT_FLOOR 

Round towards -infinity.

CPUI_FLOAT_ROUND 

Round towards nearest.

CPUI_MULTIEQUAL 

Phi-node operator.

CPUI_INDIRECT 

Copy with an indirect effect.

CPUI_PIECE 

Concatenate.

CPUI_SUBPIECE 

Truncate.

CPUI_CAST 

Cast from one data-type to another.

CPUI_PTRADD 

Index into an array ([])

CPUI_PTRSUB 

Drill down to a sub-field (->)

CPUI_SEGMENTOP 

Look-up a segmented address.

CPUI_CPOOLREF 

Recover a value from the constant pool.

CPUI_NEW 

Allocate a new object (new)

CPUI_INSERT 

Insert a bit-range.

CPUI_EXTRACT 

Extract a bit-range.

CPUI_POPCOUNT 

Count the 1-bits.

CPUI_LZCOUNT 

Count the leading 0-bits.

CPUI_MAX 

Value indicating the end of the op-code values.

Function Documentation

◆ get_booleanflip()

OpCode ghidra::get_booleanflip ( OpCode  opc,
bool &  reorder 
)

Get the complementary OpCode.

Every comparison operation has a complementary form that produces the opposite output on the same inputs. Set reorder to true if the complimentary operation involves reordering the input parameters.

Parameters
opcis the OpCode to complement
reorderis set to true if the inputs need to be reordered
Returns
the complementary OpCode or CPUI_MAX if not given a comparison operation

◆ get_opcode()

OpCode ghidra::get_opcode ( const string &  nm)

Convert a name string to the matching OpCode.

Parameters
nmis the name of an operation
Returns
the corresponding OpCode value

◆ get_opname()

const char * ghidra::get_opname ( OpCode  opc)

Convert an OpCode to the name as a string.

Parameters
opcis an OpCode value
Returns
the name of the operation as a string