File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
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
21
+ class Value ;
22
+
20
23
class ConstraintSystem {
21
24
// / Current linear constraints in the system.
22
25
// / An entry of the form c0, c1, ... cn represents the following constraint:
23
26
// / c0 >= v0 * c1 + .... + v{n-1} * cn
24
27
SmallVector<SmallVector<int64_t , 8 >, 4 > Constraints;
25
28
29
+ // / A map of variables (IR values) to their corresponding index in the
30
+ // / constraint system.
31
+ DenseMap<Value *, unsigned > Value2Index;
32
+
26
33
// / Current greatest common divisor for all coefficients in the system.
27
34
uint32_t GCD = 1 ;
28
35
@@ -52,6 +59,11 @@ class ConstraintSystem {
52
59
return true ;
53
60
}
54
61
62
+ DenseMap<Value *, unsigned > &getValue2Index () { return Value2Index; }
63
+ const DenseMap<Value *, unsigned > &getValue2Index () const {
64
+ return Value2Index;
65
+ }
66
+
55
67
bool addVariableRowFill (ArrayRef<int64_t > R) {
56
68
// If all variable coefficients are 0, the constraint does not provide any
57
69
// 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