decompiler  1.0.0
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CoverBlock Class Reference

The topological scope of a variable within a basic block. More...

#include <cover.hh>

Public Member Functions

 CoverBlock (void)
 Construct empty/uncovered block.
 
const PcodeOpgetStart (void) const
 Get the start of the range.
 
const PcodeOpgetStop (void) const
 Get the end of the range.
 
void clear (void)
 Clear this block to empty/uncovered.
 
void setAll (void)
 Mark whole block as covered.
 
void setBegin (const PcodeOp *begin)
 Reset start of range.
 
void setEnd (const PcodeOp *end)
 Reset end of range.
 
int4 intersect (const CoverBlock &op2) const
 Compute intersection with another CoverBlock. More...
 
bool empty (void) const
 Return true if this is empty/uncovered.
 
bool contain (const PcodeOp *point) const
 Check containment of given point. More...
 
int4 boundary (const PcodeOp *point) const
 Characterize given point as boundary. More...
 
void merge (const CoverBlock &op2)
 Merge another CoverBlock into this. More...
 
void print (ostream &s) const
 Dump a description to stream. More...
 

Static Public Member Functions

static uintm getUIndex (const PcodeOp *op)
 Get the comparison index for a PcodeOp. More...
 

Private Attributes

const PcodeOpstart
 Beginning of the range.
 
const PcodeOpstop
 End of the range.
 

Detailed Description

The topological scope of a variable within a basic block.

Within a basic block, the topological scope of a variable can be considered a contiguous range of p-code operations. This range can be described with a start and stop PcodeOp object, indicating all p-code operations between the two inclusive. The start and stop may hold special encodings meaning:

Member Function Documentation

int4 CoverBlock::boundary ( const PcodeOp point) const

Characterize given point as boundary.

Return:

  • 0 if point not on boundary
  • 1 if on tail
  • 2 if on the defining point
Parameters
pointis the given PcodeOp point
Returns
the characterization

References empty(), getUIndex(), start, and stop.

Referenced by Merge::collectCorrectable(), and empty().

bool CoverBlock::contain ( const PcodeOp point) const

Check containment of given point.

If the given PcodeOp or boundary point is contained in this range, return true.

Parameters
pointis the given PcodeOp
Returns
true if the point is contained

References empty(), getUIndex(), start, and stop.

Referenced by Cover::clear(), Merge::collectCovering(), empty(), and merge().

uintm CoverBlock::getUIndex ( const PcodeOp op)
static

Get the comparison index for a PcodeOp.

PcodeOp objects and a CoverBlock start/stop boundaries have a natural ordering that can be used to tell if a PcodeOp falls between boundary points and if CoverBlock objects intersect. Ordering is determined by comparing the values returned by this method.

Parameters
opis the PcodeOp and/or boundary point
Returns
a value for comparison

References PcodeOp::code(), CPUI_INDIRECT, CPUI_MULTIEQUAL, Varnode::getAddr(), PcodeOp::getIn(), PcodeOp::getOpFromConst(), SeqNum::getOrder(), PcodeOp::getSeqNum(), and PcodeOp::isMarker().

Referenced by Cover::addRefPoint(), Cover::addRefRecurse(), boundary(), Merge::collectCorrectable(), contain(), CoverBlock(), intersect(), merge(), and print().

int4 CoverBlock::intersect ( const CoverBlock op2) const

Compute intersection with another CoverBlock.

Characterize the intersection of this range with another CoverBlock. Return:

  • 0 if there is no intersection
  • 1 if only the intersection is at boundary points
  • 2 if a whole interval intersects
Parameters
op2is the other CoverBlock to compare
Returns
the intersection characterization

References empty(), getUIndex(), start, and stop.

Referenced by Cover::clear(), and setEnd().

void CoverBlock::merge ( const CoverBlock op2)

Merge another CoverBlock into this.

Compute the union of this with the other given CoverBlock, replacing this in place.

Parameters
op2is the other given CoverBlock

References contain(), empty(), getUIndex(), setAll(), start, and stop.

Referenced by Cover::clear(), and empty().

void CoverBlock::print ( ostream &  s) const

Dump a description to stream.

Print a description of the covered range of ops in this block

Parameters
sis the output stream

References empty(), PcodeOp::getSeqNum(), getUIndex(), start, and stop.

Referenced by Cover::clear(), and empty().


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