1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics2_BaseSemantics_SValue_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics2_BaseSemantics_SValue_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <BaseSemanticsTypes.h>
7 #include <BinarySmtSolver.h>
9 #include <boost/serialization/access.hpp>
10 #include <boost/serialization/nvp.hpp>
11 #include <Sawyer/SharedPointer.h>
15 namespace InstructionSemantics2 {
26 template<
class To,
class From>
28 return from.template dynamicCast<To>();
51 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
53 friend class boost::serialization::access;
56 void serialize(S &s,
const unsigned ) {
57 s & BOOST_SERIALIZATION_NVP(width);
65 explicit SValue(
size_t nbits): width(nbits) {}
219 void print(std::ostream&)
const;
229 void print(std::ostream &stream)
const { obj->print(stream, fmt); }
241 WithFormatter
operator+(
const std::string &linePrefix);
254 std::ostream& operator<<(std::ostream&,
const SValue&);
255 std::ostream& operator<<(std::ostream&,
const SValue::WithFormatter&);
SharedObject()
Default constructor.
virtual std::string get_comment() const
Some subclasses support the ability to add comments to values.
virtual void set_width(size_t nbits)
Accessor for value width.
WithFormatter with_format(Formatter &fmt)
Used for printing values with formatting.
virtual bool must_equal(const SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const =0
Returns true if two values must be equal.
void print(std::ostream &) const
Print a value to a stream using default format.
bool isFalse() const
Returns true if concrete zero.
virtual SValuePtr boolean_(bool value) const
Create a new, Boolean value.
SValuePtr createMerged(const SValuePtr &other, const MergerPtr &merger, const SmtSolverPtr &solver) const
Create a new value by merging two existing values.
SValuePtr Ptr
Shared-ownership pointer for an SValue object.
WithFormatter operator+(Formatter &fmt)
Used for printing values with formatting.
Holds a value or nothing.
Main namespace for the ROSE library.
virtual SValuePtr unspecified_(size_t nbits) const =0
Create a new unspecified semantic value.
Reference-counting intrusive smart pointer.
Name space for the entire library.
Sawyer::SharedPointer< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
virtual uint64_t get_number() const =0
Return the concrete number for this value.
Base classes for instruction semantics.
Creates SharedPointer from this.
virtual bool may_equal(const SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const =0
Returns true if two values could be equal.
Base class for semantic values.
bool isTrue() const
Returns true if concrete non-zero.
virtual void set_comment(const std::string &) const
Some subclasses support the ability to add comments to values.
virtual SValuePtr bottom_(size_t nBits) const =0
Data-flow bottom value.
virtual bool isBottom() const =0
Determines whether a value is a data-flow bottom.
virtual SValuePtr number_(size_t nbits, uint64_t number) const =0
Create a new concrete semantic value.
Base class for reference counted objects.
virtual size_t get_width() const
Accessor for value width.
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
virtual bool is_number() const =0
Determines if the value is a concrete number.
virtual SValuePtr undefined_(size_t nbits) const =0
Create a new undefined semantic value.
virtual Sawyer::Optional< SValuePtr > createOptionalMerge(const SValuePtr &other, const MergerPtr &merger, const SmtSolverPtr &solver) const =0
Possibly create a new value by merging two existing values.
virtual SValuePtr copy(size_t new_width=0) const =0
Create a new value from an existing value, changing the width if new_width is non-zero.