File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 11
11
12
12
#include " llvm/ADT/APInt.h"
13
13
#include " llvm/ADT/ArrayRef.h"
14
+ #include " llvm/ADT/DenseMap.h"
14
15
#include " llvm/ADT/SmallVector.h"
15
16
16
17
#include < string>
17
18
18
19
namespace llvm {
19
-
20
+ class Value ;
20
21
class ConstraintSystem {
21
22
// / Current linear constraints in the system.
22
23
// / An entry of the form c0, c1, ... cn represents the following constraint:
23
24
// / c0 >= v0 * c1 + .... + v{n-1} * cn
24
25
SmallVector<SmallVector<int64_t , 8 >, 4 > Constraints;
25
26
27
+ // / a Map between variabled collected in ConstraintElimination and their
28
+ // / corresponding index in the constraint system solver.
29
+ DenseMap<Value *, unsigned > Value2Index;
30
+
26
31
// / Current greatest common divisor for all coefficients in the system.
27
32
uint32_t GCD = 1 ;
28
33
@@ -52,6 +57,11 @@ class ConstraintSystem {
52
57
return true ;
53
58
}
54
59
60
+ DenseMap<Value *, unsigned > &getValue2Index () { return Value2Index; }
61
+ const DenseMap<Value *, unsigned > &getValue2Index () const {
62
+ return Value2Index;
63
+ }
64
+
55
65
bool addVariableRowFill (ArrayRef<int64_t > R) {
56
66
// If all variable coefficients are 0, the constraint does not provide any
57
67
// usable information.
Original file line number Diff line number Diff line change @@ -123,8 +123,6 @@ struct ConstraintTy {
123
123
// / based on signed-ness, certain conditions can be transferred between the two
124
124
// / systems.
125
125
class ConstraintInfo {
126
- DenseMap<Value *, unsigned > UnsignedValue2Index;
127
- DenseMap<Value *, unsigned > SignedValue2Index;
128
126
129
127
ConstraintSystem UnsignedCS;
130
128
ConstraintSystem SignedCS;
@@ -135,10 +133,10 @@ class ConstraintInfo {
135
133
ConstraintInfo (const DataLayout &DL) : DL(DL) {}
136
134
137
135
DenseMap<Value *, unsigned > &getValue2Index (bool Signed) {
138
- return Signed ? SignedValue2Index : UnsignedValue2Index ;
136
+ return Signed ? SignedCS. getValue2Index () : UnsignedCS. getValue2Index () ;
139
137
}
140
138
const DenseMap<Value *, unsigned > &getValue2Index (bool Signed) const {
141
- return Signed ? SignedValue2Index : UnsignedValue2Index ;
139
+ return Signed ? SignedCS. getValue2Index () : UnsignedCS. getValue2Index () ;
142
140
}
143
141
144
142
ConstraintSystem &getCS (bool Signed) {
You can’t perform that action at this time.
0 commit comments