ROSE 0.11.145.192
AbstractLocation.h
1#ifndef ROSE_BinaryAnalysis_AbstractLocation_H
2#define ROSE_BinaryAnalysis_AbstractLocation_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/Location.h>
7#include <Rose/BinaryAnalysis/BasicTypes.h>
8#include <Rose/BinaryAnalysis/SmtSolver.h>
9
10#include <ostream>
11#include <string>
12
13namespace Rose {
14namespace BinaryAnalysis {
15
33public:
36private:
38 Address addr_;
39 size_t nBytes_ = 0; // size of memory location, or zero if unknown
40 RegisterDictionaryPtr regdict_;
41
42public:
48 virtual ~AbstractLocation();
49
52
55
68 explicit AbstractLocation(const Address&, size_t nBytes = 0);
69
71 static AbstractLocation parse(const std::string&);
72
73 virtual bool isValid() const override;
74 virtual std::string toString() const override;
75 virtual void print(std::ostream&) const override;
76 virtual std::string printableName() const override;
77 virtual bool isEqual(const Location&) const override;
78 virtual bool operator<(const Location&) const override;
79 virtual bool operator<=(const Location&) const override;
80 virtual bool operator>(const Location&) const override;
81 virtual bool operator>=(const Location&) const override;
82
87 int compare(const AbstractLocation &other) const;
88
93 bool isRegister() const;
94
99 bool isAddress() const;
100
107
112 const Address getAddress() const;
113
118 size_t nBytes() const;
119
129 bool mayAlias(const AbstractLocation &other, const SmtSolverPtr &solver = SmtSolverPtr()) const;
130
140 bool mustAlias(const AbstractLocation &other, const SmtSolverPtr &solver = SmtSolverPtr()) const;
141
148 void print(std::ostream &out, const RegisterDictionaryPtr &regdict) const;
149 void print(std::ostream &out, InstructionSemantics::BaseSemantics::Formatter &fmt) const;
150 void print(std::ostream &out, const RegisterDictionaryPtr &regdict, InstructionSemantics::BaseSemantics::Formatter &fmt) const;
152};
153
154} // namespace
155} // namespace
156
157#endif
158#endif
void print(std::ostream &out, InstructionSemantics::BaseSemantics::Formatter &fmt) const
Print an abstract location.
AbstractLocation(const AbstractLocation &)
Copy constructor.
bool isRegister() const
Checks register reference.
void print(std::ostream &out, const RegisterDictionaryPtr &regdict, InstructionSemantics::BaseSemantics::Formatter &fmt) const
Print an abstract location.
AbstractLocation(const Address &, size_t nBytes=0)
Memory referent.
AbstractLocation()
Default constructor.
virtual std::string printableName() const override
Convert location to escaped, parsable string.
static AbstractLocation parse(const std::string &)
Parse an abstract location from a string.
int compare(const AbstractLocation &other) const
Compare two abstract locations.
bool mayAlias(const AbstractLocation &other, const SmtSolverPtr &solver=SmtSolverPtr()) const
True if two abstract locations could be aliases.
bool mustAlias(const AbstractLocation &other, const SmtSolverPtr &solver=SmtSolverPtr()) const
True if two abstract locations are certainly aliases.
AbstractLocation & operator=(const AbstractLocation &)
Assignment operator.
virtual void print(std::ostream &) const override
Output location to a stream.
void print(std::ostream &out, const RegisterDictionaryPtr &regdict) const
Print an abstract location.
bool isAddress() const
Checks memory reference.
const Address getAddress() const
Returns memory address.
size_t nBytes() const
Returns size of memory location in bytes.
virtual std::string toString() const override
Convert location to string.
RegisterDescriptor getRegister() const
Returns register.
AbstractLocation(RegisterDescriptor, const RegisterDictionaryPtr &regdict)
Register referent.
virtual bool isValid() const override
Test whether this object is valid.
virtual bool isEqual(const Location &) const override
Equality and inequality.
AbstractLocation(RegisterDescriptor)
Register referent.
Describes (part of) a physical CPU register.
Base class for location types.
Definition Location.h:23
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
std::shared_ptr< SmtSolver > SmtSolverPtr
Reference counting pointer.
The ROSE library.