1 #ifndef Rose_NullSemantics2_H
2 #define Rose_NullSemantics2_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include "BaseSemantics2.h"
10 namespace InstructionSemantics2 {
17 namespace NullSemantics {
48 static SValuePtr
instance(
size_t nbits, uint64_t number) {
53 static SValuePtr
instance(
const SValuePtr &other) {
73 SValuePtr retval(
new SValue(*
this));
74 if (new_width!=0 && new_width!=retval->nBits())
75 retval->set_width(new_width);
90 ASSERT_not_null(retval);
102 stream <<
"VOID[" <<
nBits() <<
"]";
121 ASSERT_not_reachable(
"not a number");
135 return this == getRawPointer(other);
154 : BaseSemantics::RegisterState(other) {}
157 : BaseSemantics::RegisterState(protoval, regdict) {}
166 return instance(protoval, regdict);
174 RegisterStatePtr retval = boost::dynamic_pointer_cast<
RegisterState>(from);
175 ASSERT_not_null(retval);
183 virtual void clear() ROSE_OVERRIDE {}
184 virtual void zero() ROSE_OVERRIDE {}
189 return protoval()->undefined_(reg.
nBits());
195 return protoval()->undefined_(reg.
nBits());
220 : BaseSemantics::MemoryState(addrProtoval, valProtoval) {}
223 : BaseSemantics::MemoryState(other) {}
233 return instance(addrProtoval, valProtoval);
242 MemoryStatePtr retval = boost::dynamic_pointer_cast<
MemoryState>(x);
248 virtual void clear() ROSE_OVERRIDE {}
281 typedef BaseSemantics::State State;
352 size_t begin_bit,
size_t end_bit) ROSE_OVERRIDE;
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.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
virtual uint64_t get_number() const ROSE_OVERRIDE
Virtual API.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Read memory without side effects.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
Constructor.
size_t nBits() const
Property: Size in bits.
virtual void hash(Combinatorics::Hasher &hasher) const override
Hash this semantic value.
virtual BaseSemantics::SValuePtr undefined_(size_t nBits) const ROSE_OVERRIDE
Create a new undefined semantic value.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual bool is_number() const ROSE_OVERRIDE
Virtual API.
virtual Sawyer::Optional< BaseSemantics::SValuePtr > createOptionalMerge(const BaseSemantics::SValuePtr &other, const BaseSemantics::MergerPtr &, const SmtSolverPtr &) const ROSE_OVERRIDE
Possibly create a new value by merging two existing values.
void insert(const std::string &x)
Insert data into the digest.
static SValuePtr instance()
Instantiate a new prototypical values.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Calculates modulo with signed values.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to null RISC operations.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
Holds a value or nothing.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to null register state.
Main namespace for the ROSE library.
static RiscOperatorsPtr instance(const RegisterDictionary *regdict)
Instantiate a new RiscOperators object and configures it to use semantic values and states that are d...
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Two's complement.
Reference-counting intrusive smart pointer.
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_, const BaseSemantics::SValuePtr &c_, BaseSemantics::SValuePtr &carry_out) ROSE_OVERRIDE
Used for printing RISC operators with formatting.
boost::shared_ptr< class RegisterState > RegisterStatePtr
Shared-ownership pointer to null register state.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Writes a value to memory.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Multiply two unsigned values.
virtual BaseSemantics::SValuePtr unspecified_(size_t nBits) const ROSE_OVERRIDE
Create a new unspecified semantic value.
Describes (part of) a physical CPU register.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual API.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Static allocating constructor.
NullSemantics operators always return a new undefined value.
static SValuePtr instance(size_t nbits)
Instantiate a new undefined value.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Multiplies two signed values.
virtual bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual API.
virtual void print(std::ostream &stream, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print a value to a stream using default format.
Base class for semantic values.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Divides two unsigned values.
virtual BaseSemantics::SValuePtr number_(size_t nBits, uint64_t number) const ROSE_OVERRIDE
Create a new concrete semantic value.
Values in the NullSemantics domain.
SharedPointer< U > dynamicCast() const
Dynamic cast.
Base class for most instruction semantics RISC operators.
static SValuePtr instance(size_t nbits, uint64_t number)
Instantiate a new concrete value.
static SValuePtr instance(const SValuePtr &other)
Instantiate a new copy of an existing value.
size_t nBits() const
Property: value width.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Calculates modulo with unsigned values.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Divides two signed values.
virtual bool isBottom() const ROSE_OVERRIDE
Determines whether a value is a data-flow bottom.
Sawyer::SharedPointer< class SValue > SValuePtr
Shared-ownership pointer to a null semantic value.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to a NullSemantics value.
Defines registers available for a particular architecture.
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual const std::string & name() const
Property: Name used for debugging.
virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Reads a value from memory.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
std::shared_ptr< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
virtual BaseSemantics::SValuePtr bottom_(size_t nBits) const ROSE_OVERRIDE
Data-flow bottom value.