ROSE  0.9.9.109
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue Class Reference

Description

Type of values manipulated by the IntervalSemantics domain.

Definition at line 37 of file IntervalSemantics2.h.

#include <IntervalSemantics2.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue:
Collaboration graph
[legend]

Public Member Functions

virtual BaseSemantics::SValuePtr bottom_ (size_t nbits) const ROSE_OVERRIDE
 Data-flow bottom value. More...
 
virtual BaseSemantics::SValuePtr undefined_ (size_t nbits) const ROSE_OVERRIDE
 Create a new undefined semantic value. More...
 
virtual BaseSemantics::SValuePtr unspecified_ (size_t nbits) const ROSE_OVERRIDE
 Create a new unspecified semantic value. More...
 
virtual BaseSemantics::SValuePtr number_ (size_t nbits, uint64_t number) const ROSE_OVERRIDE
 Create a new concrete semantic value. More...
 
virtual BaseSemantics::SValuePtr copy (size_t new_width=0) const ROSE_OVERRIDE
 Create a new value from an existing value, changing the width if new_width is non-zero. More...
 
virtual Sawyer::Optional< BaseSemantics::SValuePtrcreateOptionalMerge (const BaseSemantics::SValuePtr &other, const BaseSemantics::MergerPtr &, SMTSolver *) const ROSE_OVERRIDE
 Possibly create a new value by merging two existing values. More...
 
virtual SValuePtr create (size_t nbits, uint64_t v1, uint64_t v2)
 Construct a ValueType that's constrained to be between two unsigned values, inclusive. More...
 
virtual SValuePtr create (size_t nbits, const Intervals &intervals)
 Construct a ValueType from a rangemap. More...
 
virtual SValuePtr create_from_bits (size_t nbits, uint64_t possible_bits)
 Generate ranges from bits. More...
 
virtual bool may_equal (const BaseSemantics::SValuePtr &other, SMTSolver *solver=NULL) const ROSE_OVERRIDE
 Returns true if two values could be equal. More...
 
virtual bool must_equal (const BaseSemantics::SValuePtr &other, SMTSolver *solver=NULL) const ROSE_OVERRIDE
 Returns true if two values must be equal. More...
 
virtual bool isBottom () const ROSE_OVERRIDE
 Determines whether a value is a data-flow bottom. More...
 
virtual bool is_number () const ROSE_OVERRIDE
 Determines if the value is a concrete number. More...
 
virtual uint64_t get_number () const ROSE_OVERRIDE
 Return the concrete number for this value. More...
 
virtual void print (std::ostream &output, BaseSemantics::Formatter &) const ROSE_OVERRIDE
 Print a value to a stream using default format. More...
 
const Intervalsget_intervals () const
 Returns the rangemap stored in this value. More...
 
void set_intervals (const Intervals &intervals)
 Changes the rangemap stored in the value. More...
 
uint64_t possible_bits () const
 Returns all possible bits that could be set. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue
virtual SValuePtr boolean_ (bool value) const
 Create a new, Boolean value. More...
 
SValuePtr createMerged (const SValuePtr &other, const MergerPtr &merger, SMTSolver *solver) const
 Create a new value by merging two existing values. More...
 
bool isTrue () const
 Returns true if concrete non-zero. More...
 
bool isFalse () const
 Returns true if concrete zero. More...
 
virtual size_t get_width () const
 Accessor for value width.
 
virtual void set_width (size_t nbits)
 Accessor for value width.
 
void print (std::ostream &stream) const
 Print a value to a stream using default format. More...
 
WithFormatter with_format (Formatter &fmt)
 Used for printing values with formatting. More...
 
WithFormatter operator+ (Formatter &fmt)
 Used for printing values with formatting. More...
 
virtual std::string get_comment () const
 Some subclasses support the ability to add comments to values. More...
 
virtual void set_comment (const std::string &) const
 Some subclasses support the ability to add comments to values. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 
- Public Member Functions inherited from Sawyer::SharedFromThis< SValue >
SharedPointer< SValue > sharedFromThis ()
 Create a shared pointer from this. More...
 
SharedPointer< const SValue > sharedFromThis () const
 Create a shared pointer from this. More...
 

Static Public Member Functions

static SValuePtr instance ()
 Instantiate a new prototypical value. More...
 
static SValuePtr instance_bottom (size_t nbits)
 Instantiate a new data-flow-bottom value of specified width. More...
 
static SValuePtr instance_undefined (size_t nbits)
 Instantiate a new undefined value of particular width. More...
 
static SValuePtr instance_unspecified (size_t nbits)
 Instantiate a new unspecified value of specific width. More...
 
static SValuePtr instance_integer (size_t nbits, uint64_t number)
 Instantiate a new concrete value of particular width. More...
 
static SValuePtr instance_intervals (size_t nbits, const Intervals &intervals)
 Instantiate a new value from a set of intervals. More...
 
static SValuePtr instance_hull (size_t nbits, uint64_t v1, uint64_t v2)
 Instantiate a new value that's constrained to be between two unsigned values, inclusive. More...
 
static SValuePtr instance_copy (const SValuePtr &other)
 Instantiate a new copy of an existing value. More...
 
static SValuePtr instance_from_bits (size_t nbits, uint64_t possible_bits)
 Create a value from a set of possible bits. More...
 
static SValuePtr promote (const BaseSemantics::SValuePtr &v)
 Promote a base value to an IntevalSemantics value. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue
static SValuePtr promote (const SValuePtr &x)
 
- Static Public Member Functions inherited from Sawyer::SmallObject
static SynchronizedPoolAllocatorpoolAllocator ()
 Return the pool allocator for this class. More...
 
static void * operator new (size_t size)
 
static void operator delete (void *ptr, size_t size)
 

Protected Member Functions

 SValue (size_t nbits)
 
 SValue (size_t nbits, uint64_t number)
 
 SValue (size_t nbits, uint64_t v1, uint64_t v2)
 
 SValue (size_t nbits, const Intervals &intervals)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue
 SValue ()
 Width of the value in bits. More...
 
 SValue (size_t nbits)
 
 SValue (const SValue &other)
 

Protected Attributes

Intervals intervals_
 
bool isBottom_
 
- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue
size_t width
 

Additional Inherited Members

- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue
typedef SValuePtr Ptr
 Shared-ownership pointer for an SValue object. More...
 

Member Function Documentation

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance ( )
inlinestatic

Instantiate a new prototypical value.

Prototypical values are only used for their virtual constructors.

Definition at line 71 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

Referenced by Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::RiscOperators::instance().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_bottom ( size_t  nbits)
inlinestatic

Instantiate a new data-flow-bottom value of specified width.

Definition at line 76 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

Referenced by bottom_().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_undefined ( size_t  nbits)
inlinestatic

Instantiate a new undefined value of particular width.

Currently, there is no distinction between an unspecified value, an undefined value, and an interval that can represent any value of the specified size.

Definition at line 84 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

Referenced by undefined_().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_unspecified ( size_t  nbits)
inlinestatic

Instantiate a new unspecified value of specific width.

Currently, there is no distinction between an unspecified value, an undefined value, and an interval that can represent any value of the specified size.

Definition at line 92 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

Referenced by unspecified_().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_integer ( size_t  nbits,
uint64_t  number 
)
inlinestatic

Instantiate a new concrete value of particular width.

Definition at line 97 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

Referenced by number_().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_intervals ( size_t  nbits,
const Intervals intervals 
)
inlinestatic

Instantiate a new value from a set of intervals.

Definition at line 102 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

Referenced by create().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_hull ( size_t  nbits,
uint64_t  v1,
uint64_t  v2 
)
inlinestatic

Instantiate a new value that's constrained to be between two unsigned values, inclusive.

Definition at line 107 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

Referenced by create().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_copy ( const SValuePtr other)
inlinestatic

Instantiate a new copy of an existing value.

Definition at line 112 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::instance_from_bits ( size_t  nbits,
uint64_t  possible_bits 
)
static

Create a value from a set of possible bits.

Referenced by create_from_bits().

static SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::promote ( const BaseSemantics::SValuePtr v)
inlinestatic
virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::bottom_ ( size_t  nBits) const
inlinevirtual

Data-flow bottom value.

Returns a new value that represents bottom in a data-flow analysis. If a semantic domain can represent a bottom value then the isBottom predicate is true when invoked on this method's return value. If a semantic domain cannot support a bottom value, then it may return some other value.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 129 of file IntervalSemantics2.h.

References instance_bottom().

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::undefined_ ( size_t  nbits) const
inlinevirtual

Create a new undefined semantic value.

The new semantic value will have the same dynamic type as the value on which this virtual method is called. This is the most common way that a new value is created. The unspecified_ method is closely related.

See also
unspecified_

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 132 of file IntervalSemantics2.h.

References instance_undefined().

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::unspecified_ ( size_t  nbits) const
inlinevirtual

Create a new unspecified semantic value.

The new semantic value will have the same dynamic type as the value on which this virtual method is called. Undefined (undefined_) and unspecified are closely related. Unspecified values are the same as undefined values except they're instantiated as the result of some machine instruction where the ISA documentation indicates that the value is unspecified (e.g., status flags for x86 shift and rotate instructions).

Most semantic domains make no distinction between undefined and unspecified.

See also
undefined_

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 135 of file IntervalSemantics2.h.

References instance_unspecified().

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::number_ ( size_t  nbits,
uint64_t  number 
) const
inlinevirtual

Create a new concrete semantic value.

The new value will represent the specified concrete value and have the same dynamic type as the value on which this virtual method is called. This is the most common way that a new constant is created. The number is truncated to contain nbits bits (higher order bits are cleared).

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 139 of file IntervalSemantics2.h.

References instance_integer().

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::copy ( size_t  new_width = 0) const
inlinevirtual

Create a new value from an existing value, changing the width if new_width is non-zero.

Increasing the width logically adds zero bits to the most significant side of the value; decreasing the width logically removes bits from the most significant side of the value.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 142 of file IntervalSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue::SValue().

virtual Sawyer::Optional<BaseSemantics::SValuePtr> Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::createOptionalMerge ( const BaseSemantics::SValuePtr other,
const BaseSemantics::MergerPtr merger,
SMTSolver solver 
) const
virtual

Possibly create a new value by merging two existing values.

This method optionally returns a new semantic value as the data-flow merge of this and other. If the two inputs are "equal" in some sense of the dataflow implementation then nothing is returned, otherwise a new value is returned. Typical usage is like this:

if (SValuePtr merged = v1->createOptionalMerge(v2).orDefault()) {
std::cout <<"v1 and v2 were merged to " <<*merged <<"\n";
} else {
std::cout <<"no merge is necessary\n";
}
or
@code
SValuePtr merge;
if (v1->createOptionalMerge(v2).assignTo(merged)) {
std::cout <<"v1 and v2 were merged to " <<*merged <<"\n";
} else {
std::cout <<"v1 and v2 are equal in some sense (no merge necessary)\n";
}

If you always want a copy regardless of whether the merge is necessary, then use the createMerged convenience function instead.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::create ( size_t  nbits,
uint64_t  v1,
uint64_t  v2 
)
inlinevirtual

Construct a ValueType that's constrained to be between two unsigned values, inclusive.

Definition at line 156 of file IntervalSemantics2.h.

References instance_hull().

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::create ( size_t  nbits,
const Intervals intervals 
)
inlinevirtual

Construct a ValueType from a rangemap.

Note that this does not truncate the rangemap to contain only values that would be possible for the ValueType size–see unsignedExtend() for that.

Definition at line 162 of file IntervalSemantics2.h.

References instance_intervals().

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::create_from_bits ( size_t  nbits,
uint64_t  possible_bits 
)
inlinevirtual

Generate ranges from bits.

Given the set of bits that could be set, generate a range. We have to be careful here because we could end up generating very large rangemaps: a rangemap where the high 31 bits could be set but the zero bit must be cleared would create a rangemap with 2^31 singleton entries.

Definition at line 169 of file IntervalSemantics2.h.

References instance_from_bits().

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::may_equal ( const BaseSemantics::SValuePtr other,
SMTSolver solver = NULL 
) const
virtual

Returns true if two values could be equal.

The SMT solver is optional for many subclasses.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::must_equal ( const BaseSemantics::SValuePtr other,
SMTSolver solver = NULL 
) const
virtual

Returns true if two values must be equal.

The SMT solver is optional for many subclasses.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::isBottom ( ) const
inlinevirtual

Determines whether a value is a data-flow bottom.

Returns true if this value represents a bottom value for data-flow analysis. Any RiscOperation performed on an operand whose isBottom predicate returns true will itself return a bottom value. This includes operations like "xor x x" which would normally return zero.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 180 of file IntervalSemantics2.h.

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::is_number ( ) const
inlinevirtual

Determines if the value is a concrete number.

Concrete numbers can be created with the number_(), boolean_() virtual constructors, or by other means.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 184 of file IntervalSemantics2.h.

References Sawyer::Container::IntervalSet< I >::size().

virtual uint64_t Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::get_number ( ) const
inlinevirtual

Return the concrete number for this value.

Only values for which is_number() returns true are able to return a concrete value by this method.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

Definition at line 188 of file IntervalSemantics2.h.

References Sawyer::Container::IntervalSet< I >::least(), and Sawyer::Container::IntervalSet< I >::size().

virtual void Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::print ( std::ostream &  ,
BaseSemantics::Formatter  
) const
virtual

Print a value to a stream using default format.

The value will normally occupy a single line and not contain leading space or line termination. See also, with_format().

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SValue.

const Intervals& Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::get_intervals ( ) const
inline

Returns the rangemap stored in this value.

Definition at line 199 of file IntervalSemantics2.h.

void Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::set_intervals ( const Intervals intervals)
inline

Changes the rangemap stored in the value.

Definition at line 204 of file IntervalSemantics2.h.

uint64_t Rose::BinaryAnalysis::InstructionSemantics2::IntervalSemantics::SValue::possible_bits ( ) const

Returns all possible bits that could be set.


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