llvm.org GIT mirror llvm / 336c6c0
Switch to densemap rather than std::set git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42462 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Berlin 13 years ago
1 changed file(s) with 26 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
133133 assert(Offset == 0 || Ty != AddressOf &&
134134 "Offset is illegal on addressof constraints");
135135 }
136
136137 bool operator==(const Constraint &RHS) const {
137138 return RHS.Type == Type
138139 && RHS.Dest == Dest
139140 && RHS.Src == Src
140141 && RHS.Offset == Offset;
141142 }
143
144 bool operator!=(const Constraint &RHS) const {
145 return !(*this == RHS);
146 }
147
142148 bool operator<(const Constraint &RHS) const {
143149 if (RHS.Type != Type)
144150 return RHS.Type < Type;
147153 else if (RHS.Src != Src)
148154 return RHS.Src < Src;
149155 return RHS.Offset < Offset;
156 }
157 };
158
159 struct ConstraintKeyInfo {
160 static inline Constraint getEmptyKey() {
161 return Constraint(Constraint::Copy, ~0UL, ~0UL, ~0UL);
162 }
163 static inline Constraint getTombstoneKey() {
164 return Constraint(Constraint::Copy, ~0UL - 1, ~0UL - 1, ~0UL - 1);
165 }
166 static unsigned getHashValue(const Constraint &C) {
167 return C.Src ^ C.Dest ^ C.Type ^ C.Offset;
168 }
169 static bool isEqual(const Constraint &LHS,
170 const Constraint &RHS) {
171 return LHS.Type == RHS.Type && LHS.Dest == RHS.Dest
172 && LHS.Src == RHS.Src && LHS.Offset == RHS.Offset;
150173 }
151174 };
152175
17491772 /// replaced by their the pointer equivalence class representative.
17501773 void Andersens::RewriteConstraints() {
17511774 std::vector NewConstraints;
1752 std::set> Seen;
1775 DenseMap> Seen;
17531776
17541777 PEClass2Node.clear();
17551778 PENLEClass2Node.clear();
17871810 C.Src = FindEquivalentNode(RHSNode, RHSLabel);
17881811 C.Dest = FindEquivalentNode(FindNode(LHSNode), LHSLabel);
17891812 if (C.Src == C.Dest && C.Type == Constraint::Copy
1790 || Seen.count(C) != 0)
1813 || Seen[C] == true)
17911814 continue;
17921815
1793 Seen.insert(C);
1816 Seen[C] = true;
17941817 NewConstraints.push_back(C);
17951818 }
17961819 Constraints.swap(NewConstraints);