#include "X86.h"
#include "X86InstrInfo.h"
#include "X86Subtarget.h"
+#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/STLExtras.h"
const X86InstrInfo *TII = nullptr;
/// All edges that are included in some closure
- DenseSet<unsigned> EnclosedEdges;
+ BitVector EnclosedEdges{8, false};
/// All instructions that are included in some closure.
DenseMap<MachineInstr *, unsigned> EnclosedInstrs;
void X86DomainReassignment::visitRegister(Closure &C, Register Reg,
RegDomain &Domain,
SmallVectorImpl<unsigned> &Worklist) {
- if (EnclosedEdges.count(Reg))
+ if (!Reg.isVirtual())
return;
- if (!Reg.isVirtual())
+ if (EnclosedEdges.test(Register::virtReg2Index(Reg)))
return;
if (!MRI->hasOneDef(Reg))
// Register already in this closure.
if (!C.insertEdge(CurReg))
continue;
- EnclosedEdges.insert(Reg);
+ EnclosedEdges.set(Register::virtReg2Index(Reg));
MachineInstr *DefMI = MRI->getVRegDef(CurReg);
encloseInstr(C, DefMI);
bool Changed = false;
EnclosedEdges.clear();
+ EnclosedEdges.resize(MRI->getNumVirtRegs());
EnclosedInstrs.clear();
std::vector<Closure> Closures;
continue;
// Register already in closure.
- if (EnclosedEdges.count(Reg))
+ if (EnclosedEdges.test(Idx))
continue;
// Calculate closure starting with Reg.