Ghidra Decompiler Analysis Engine
Enumerations | Functions
opcodes.hh File Reference

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

#include <string>
Include dependency graph for opcodes.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

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

Functions

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

Detailed Description

All the individual p-code operations.

Enumeration Type Documentation

◆ OpCode

enum 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_MAX 

Value indicating the end of the op-code values.

Function Documentation

◆ get_booleanflip()

OpCode 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 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* 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