Static Value-Flow Analysis
Loading...
Searching...
No Matches
AbstractValue.h
Go to the documentation of this file.
1//===- AbstractValue.h ----AbstractValue-------------------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-2022> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23// The implementation is based on
24// Xiao Cheng, Jiawei Wang and Yulei Sui. Precise Sparse Abstract Execution via Cross-Domain Interaction.
25// 46th International Conference on Software Engineering. (ICSE24)
26
29#include "Util/SVFUtil.h"
30
31namespace SVF
32{
33
35{
36
37public:
40
46
48 {
49 interval = other.interval;
50 addrs = other.addrs;
51 }
52
53 inline bool isInterval() const
54 {
55 return !interval.isBottom();
56 }
57 inline bool isAddr() const
58 {
59 return !addrs.isBottom();
60 }
61
67
68 // operator overload, supporting both interval and address
70 {
71 interval = other.interval;
72 addrs = other.addrs;
73 return *this;
74 }
75
77 {
78 interval = SVFUtil::move(other.interval);
79 addrs = SVFUtil::move(other.addrs);
80 return *this;
81 }
82
84 {
87 return *this;
88 }
89
91 {
92 addrs = other;
94 return *this;
95 }
96
98
100
102 {
103 return interval;
104 }
105
107 {
108 return interval;
109 }
110
112 {
113 return addrs;
114 }
115
116 const AddressValue getAddrs() const
117 {
118 return addrs;
119 }
120
122
123 bool equals(const AbstractValue &rhs) const
124 {
125 return interval.equals(rhs.interval) && addrs.equals(rhs.addrs);
126 }
127
129 {
130 interval.join_with(other.interval);
131 addrs.join_with(other.addrs);
132 }
133
135 {
136 interval.meet_with(other.interval);
137 addrs.meet_with(other.addrs);
138 }
139
141 {
142 interval.widen_with(other.interval);
143 // TODO: widen Addrs
144 }
145
147 {
148 interval.narrow_with(other.interval);
149 // TODO: narrow Addrs
150 }
151
152 std::string toString() const
153 {
154 return "<" + interval.toString() + ", " + addrs.toString() + ">";
155 }
156};
157}
void meet_with(const AbstractValue &other)
AbstractValue(const AbstractValue &other)
AbstractValue & operator=(const AbstractValue &other)
AbstractValue & operator=(const AbstractValue &&other)
AbstractValue(const IntervalValue &ival)
void join_with(const AbstractValue &other)
bool isInterval() const
AbstractValue & operator=(const AddressValue &other)
IntervalValue interval
void widen_with(const AbstractValue &other)
IntervalValue & getInterval()
const IntervalValue getInterval() const
void narrow_with(const AbstractValue &other)
AbstractValue & operator=(const IntervalValue &other)
const AddressValue getAddrs() const
AbstractValue(AbstractValue &&other)
AddressValue & getAddrs()
std::string toString() const
bool isAddr() const
AbstractValue(const AddressValue &addr)
AddressValue addrs
bool equals(const AbstractValue &rhs) const
bool meet_with(const AddressValue &other)
Return a intersected AddressValue.
bool equals(const AddressValue &rhs) const
const std::string toString() const
bool isBottom() const
bool join_with(const AddressValue &other)
Current AddressValue joins with another AddressValue.
void meet_with(const IntervalValue &other)
Return a intersected IntervalValue.
void join_with(const IntervalValue &other)
Current IntervalValue joins with another IntervalValue.
const std::string toString() const
bool isBottom() const
void narrow_with(const IntervalValue &other)
Current IntervalValue narrow with another IntervalValue.
static IntervalValue bottom()
Create the bottom IntervalValue [+inf, -inf].
void widen_with(const IntervalValue &other)
Current IntervalValue widen with another IntervalValue.
bool equals(const IntervalValue &other) const
Equality comparison.
constexpr std::remove_reference< T >::type && move(T &&t) noexcept
Definition SVFUtil.h:447
for isBitcode
Definition BasicTypes.h:68
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74