aboutsummaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-21 00:48:17 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-21 00:48:17 +0000
commitb907e8a2d40dc546f21ff7e122a80b121653851a (patch)
treeaae2803590bfa885b3e4aa4b99b3b6ca31c73bc9 /include/llvm
parent2a6899c5391a9aada02686dee29f9b56218ed1d3 (diff)
Use IntEqClasses to compute connected components of live intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/IntEqClasses.h9
-rw-r--r--include/llvm/CodeGen/LiveInterval.h8
2 files changed, 10 insertions, 7 deletions
diff --git a/include/llvm/ADT/IntEqClasses.h b/include/llvm/ADT/IntEqClasses.h
index 00d042695a..8e75c48e37 100644
--- a/include/llvm/ADT/IntEqClasses.h
+++ b/include/llvm/ADT/IntEqClasses.h
@@ -39,13 +39,20 @@ class IntEqClasses {
public:
/// IntEqClasses - Create an equivalence class mapping for 0 .. N-1.
- IntEqClasses(unsigned N) : NumClasses(0) { grow(N); }
+ IntEqClasses(unsigned N = 0) : NumClasses(0) { grow(N); }
/// grow - Increase capacity to hold 0 .. N-1, putting new integers in unique
/// equivalence classes.
/// This requires an uncompressed map.
void grow(unsigned N);
+ /// clear - Clear all classes so that grow() will assign a unique class to
+ /// every integer.
+ void clear() {
+ EC.clear();
+ NumClasses = 0;
+ }
+
/// join - Join the equivalence classes of a and b. After joining classes,
/// findLeader(a) == findLeader(b).
/// This requires an uncompressed map.
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index 72f1624d06..192f07ec56 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -21,7 +21,7 @@
#ifndef LLVM_CODEGEN_LIVEINTERVAL_H
#define LLVM_CODEGEN_LIVEINTERVAL_H
-#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/IntEqClasses.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/CodeGen/SlotIndexes.h"
@@ -561,11 +561,7 @@ namespace llvm {
class ConnectedVNInfoEqClasses {
LiveIntervals &lis_;
-
- // Map each value number to its equivalence class.
- // The invariant is that EqClass[x] <= x.
- // Two values are connected iff EqClass[x] == EqClass[b].
- SmallVector<unsigned, 8> eqClass_;
+ IntEqClasses eqClass_;
// Note that values a and b are connected.
void Connect(unsigned a, unsigned b);