#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"
/// position is in a hole, this method returns an iterator pointing to the
/// LiveRange immediately after the hole.
iterator advanceTo(iterator I, SlotIndex Pos) {
+ assert(I != end());
if (Pos >= endIndex())
return end();
while (I->end <= Pos) ++I;
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);
/// Return the number of connected components.
unsigned Classify(const LiveInterval *LI);
- // Distribute values in LIV[0] into a separate LiveInterval for each connected
- // component. LIV must have a LiveInterval for each connected component.
- // The LiveIntervals in Liv[1..] must be empty.
+ /// getEqClass - Classify creates equivalence classes numbered 0..N. Return
+ /// the equivalence class assigned the VNI.
+ unsigned getEqClass(const VNInfo *VNI) { return eqClass_[VNI->id]; }
+
+ /// Distribute - Distribute values in LIV[0] into a separate LiveInterval
+ /// for each connected component. LIV must have a LiveInterval for each
+ /// connected component. The LiveIntervals in Liv[1..] must be empty.
void Distribute(LiveInterval *LIV[]);
+
};
}