19 #ifndef OTAWA_PROP_CONTEXTUALPROPERTY_H_
20 #define OTAWA_PROP_CONTEXTUALPROPERTY_H_
22 #include <elm/inhstruct/Tree.h>
23 #include <elm/genstruct/Vector.h>
52 { _kind = step.
_kind; addr = step.
addr;
return *
this; }
58 {
return _kind == step.
kind() && addr == step.
address(); }
113 inline Ref(
const Ref<T>& r): cp(r.cp), p(r.p), i(r.i) { }
121 inline const T &
get (void)
const {
return cp.get(i, p); }
122 inline operator const T &(void)
const {
return get(); }
132 inline Ref<T> &operator+= (
const T &v)
const { ref() +=
value;
return *
this; }
133 inline Ref<T> &operator-= (
const T &v)
const { ref() -=
value;
return *
this; }
134 inline Ref<T> &operator *= (
const T &v)
const { ref() *=
value;
return *
this; }
135 inline Ref<T> &operator/= (
const T &v)
const { ref() /=
value;
return *
this; }
136 inline Ref<T> &operator%= (
const T &v)
const { ref() %=
value;
return *
this; }
137 inline Ref<T> &operator &= (
const T &v)
const { ref() &=
value;
return *
this; }
138 inline Ref<T> &operator|= (
const T &v)
const { ref() |=
value;
return *
this; }
139 inline Ref<T> &operator^= (
const T &v)
const { ref() ^=
value;
return *
this; }
140 inline Ref<T> &operator<<= (
const T &v)
const { ref() <<=
value;
return *
this; }
141 inline Ref<T> &operator>>= (
const T &v)
const { ref() >>=
value;
return *
this; }
142 inline Ref<T> &operator++ (
void)
const { ref()++;
return *
this; }
143 inline Ref<T> &operator-- (
void)
const { ref()--;
return *
this; }
144 inline Ref<T> &operator++ (
int)
const { ref()++;
return *
this; }
145 inline Ref<T> &operator-- (
int)
const { ref()--;
return *
this; }
158 inline void clear(
void) { stack.clear(); }
162 inline void pop(
void) {stack.pop(); }
164 inline bool isEmpty(
void)
const {
return stack.isEmpty(); }
165 inline int count(
void)
const {
return stack.count(); }
168 inline operator bool(
void)
const {
return !isEmpty(); }
171 Address getEnclosingFunction(
void);
175 return id.value(fprops);
179 {
return Ref<T>(*
this, props, id); }
181 {
return get(id, *props); }
183 {
return ref(
id, *props); }
186 {
return get(id, *props); }
188 {
return get(id, props); }
190 {
return ref(
id, *props); }
192 {
return ref(
id, props); }
202 inline io::Output& operator<<(io::Output& out, const ContextualPath::Ref<T>& r)
203 { r.print(
out);
return out; }
PropList & p
Definition: ContextualProperty.h:149
Definition: ContextualProperty.h:43
bool operator==(const ContextualStep &step) const
Definition: ContextualProperty.h:59
Definition: ContextualProperty.h:38
void pop(void)
Definition: ContextualProperty.h:162
ContextualStep(kind_t kind, const Address &address)
Definition: ContextualProperty.h:49
static const PropList & find(const PropList &props, const ContextualPath &path, const AbstractIdentifier &id)
Get a contextual property from a property list.
Definition: prop_ContextualProperty.cpp:237
static PropList & ref(PropList &props, const ContextualPath &path, const AbstractIdentifier &id)
Obtain a reference on a property value in the given contextual path.
Definition: prop_ContextualProperty.cpp:299
Definition: ContextualProperty.h:105
Definition: ClpValue.h:54
Driver * find(kind_t kind)
Find a driver by its output kind.
Definition: display_Graph.cpp:245
void push(ContextualStep::kind_t kind, const Address &addr)
Definition: ContextualProperty.h:160
void print(io::Output &out) const
Print the contextual path.
Definition: prop_ContextualProperty.cpp:107
Definition: ContextualProperty.h:110
static bool exists(const PropList &props, const ContextualPath &path, const AbstractIdentifier &id)
Test if a contextual property exists, that is, the property value is defined at any step of the given...
Definition: prop_ContextualProperty.cpp:276
Ref(const ContextualPath &_cp, PropList &_p, const Identifier< T > &_i)
Definition: ContextualProperty.h:112
ContextualStep & operator=(const ContextualStep &step)
Definition: ContextualProperty.h:51
Address addr
Definition: ContextualProperty.h:66
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
Node(const ContextualStep &_step)
Definition: ContextualProperty.h:79
static AbstractIdentifier ID
Private identifier for contextual properties.
Definition: ContextualProperty.h:100
Definition: ContextualProperty.h:76
void push(const ContextualStep &step)
Definition: ContextualProperty.h:159
elm::io::IntFormat address(Address addr)
Build a format to display addresses.
Definition: base.cpp:213
Ref< T > operator()(const Identifier< T > &id, PropList &props) const
Definition: ContextualProperty.h:191
T & operator&(void) const
Definition: ContextualProperty.h:130
Represents a unique identifier used by the annotation system.
Definition: AbstractIdentifier.h:32
Inst::kind_t kind
Definition: odisasm.cpp:106
Ref< T > & operator=(const Ref< T > &r)
Definition: ContextualProperty.h:114
Ref< T > operator()(const Identifier< T > &id, PropList *props) const
Definition: ContextualProperty.h:189
value_t value(CString name, int value)
const Address & address(void) const
Definition: ContextualProperty.h:55
Ref(const Ref< T > &r)
Definition: ContextualProperty.h:113
bool isEmpty(void) const
Definition: ContextualProperty.h:164
kind_t
Allowed types for values: NONE represents nothing; REG is only used for addresses, and represents a register; VAL represents some values (either a constant or an interval); ALL is the Top element.
Definition: ClpValue.h:53
kind_t _kind
Definition: ContextualProperty.h:65
const Ref< T > & operator=(const T &value) const
Definition: ContextualProperty.h:131
bool exists(void) const
Definition: ContextualProperty.h:120
Definition: ContextualProperty.h:42
ContextualStep(void)
Definition: ContextualProperty.h:48
The representation of an address in OTAWA.
Definition: base.h:54
const Ref & add(const T &value) const
Definition: ContextualProperty.h:127
Definition: ContextualProperty.h:44
Property * make(const Identifier< T > &id, const T &v)
Definition: info.h:31
genstruct::Vector< ContextualStep > stack
Definition: ContextualProperty.h:195
void print(io::Output &out)
Definition: ContextualProperty.h:124
sys::SystemOutStream & out
kind_t kind(void) const
Definition: ContextualProperty.h:54
Ref< T > ref(const Identifier< T > &id, PropList &props) const
Definition: ContextualProperty.h:178
ContextualStep step
Definition: ContextualProperty.h:80
kind_t
Definition: ContextualProperty.h:40
const ContextualStep & operator[](int i) const
Definition: ContextualProperty.h:167
ContextualStep(const ContextualStep &step)
Definition: ContextualProperty.h:50
const T & operator()(const Identifier< T > &id, const PropList *props) const
Definition: ContextualProperty.h:185
void removeProp(const AbstractIdentifier *id)
Remove a property matching the given identifier.
Definition: prop_PropList.cpp:409
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
T & ref(void) const
Definition: ContextualProperty.h:129
const ContextualPath & path(void) const
Definition: ContextualProperty.h:117
ContextualPath(void)
Definition: ContextualProperty.h:154
Node(void)
Definition: ContextualProperty.h:78
This a list of properties.
Definition: PropList.h:63
int count(void) const
Definition: ContextualProperty.h:165
static PropList & make(PropList &props, const ContextualPath &path)
Set a contextual property.
Definition: prop_ContextualProperty.cpp:256
bool operator!=(const ContextualStep &step) const
Definition: ContextualProperty.h:60
void clear(void)
Definition: ContextualProperty.h:158
bool equals(const ContextualStep &step) const
Definition: ContextualProperty.h:57
const Identifier< T > & identifier(void) const
Definition: ContextualProperty.h:119
const ContextualStep & step(int i) const
Definition: ContextualProperty.h:166
Node root
Definition: ContextualProperty.h:99
A property associates a data with an identifier.
Definition: PropList.h:42
const Identifier< T > & i
Definition: ContextualProperty.h:150
void print(io::Output &out) const
Definition: prop_ContextualProperty.cpp:84
Ref< T > ref(const Identifier< T > &id, PropList *props) const
Definition: ContextualProperty.h:182
const T & operator()(const Identifier< T > &id, const PropList &props) const
Definition: ContextualProperty.h:187
T operator->(void) const
Definition: ContextualProperty.h:123
const ContextualPath & cp
Definition: ContextualProperty.h:148
const PropList & proplist(void) const
Definition: ContextualProperty.h:118
A contextual property is a special property that allows to retrieve a property value by its contextua...
Definition: ContextualProperty.h:73