decompiler  1.0.0
Public Member Functions | Private Attributes | List of all members
ghidra::ToOpEdge Class Reference

An edge between a Varnode and a PcodeOp. More...

#include <dynamic.hh>

Public Member Functions

 ToOpEdge (const PcodeOp *o, int4 s)
 Constructor.
 
const PcodeOpgetOp (void) const
 Get the PcodeOp defining the edge.
 
int4 getSlot (void) const
 Get the slot of the starting Varnode.
 
bool operator< (const ToOpEdge &op2) const
 Compare two edges based on PcodeOp. More...
 
uint4 hash (uint4 reg) const
 Hash this edge into an accumulator. More...
 

Private Attributes

const PcodeOpop
 The PcodeOp defining the edge.
 
int4 slot
 Slot containing the input Varnode or -1 for the p-code op output.
 

Detailed Description

An edge between a Varnode and a PcodeOp.

A DynamicHash is defined on a sub-graph of the data-flow, and this defines an edge in the sub-graph. The edge can either be from an input Varnode to the PcodeOp that reads it, or from a PcodeOp to the Varnode it defines.

Member Function Documentation

◆ hash()

uint4 ghidra::ToOpEdge::hash ( uint4  reg) const

Hash this edge into an accumulator.

The hash accumulates:

The op-codes are translated so that the hash is invariant under common variants.

Parameters
regis the incoming hash accumulator value
Returns
the accumulator value with this edge folded in

References ghidra::PcodeOp::code(), ghidra::crc_update(), ghidra::SeqNum::getAddr(), ghidra::Address::getAddrSize(), ghidra::Address::getOffset(), ghidra::PcodeOp::getSeqNum(), op, and slot.

Referenced by ghidra::DynamicHash::calcHash(), ghidra::DynamicHash::findOp(), ghidra::DynamicHash::findVarnode(), ghidra::DynamicHash::getHash(), getSlot(), ghidra::DynamicHash::pieceTogetherHash(), and ghidra::DynamicHash::uniqueHash().

◆ operator<()

bool ghidra::ToOpEdge::operator< ( const ToOpEdge op2) const

Compare two edges based on PcodeOp.

These edges are sorted to provide consistency to the hash The sort is based on the PcodeOp sequence number first, then the Varnode slot

Parameters
op2is the edge to compare this to
Returns
true if this should be ordered before the other edge

References ghidra::SeqNum::getAddr(), ghidra::SeqNum::getOrder(), ghidra::PcodeOp::getSeqNum(), op, and slot.

Referenced by getSlot().


The documentation for this class was generated from the following files: