diff options
author | Matthias Braun <matze@braunis.de> | 2015-09-22 03:44:41 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2015-09-22 03:44:41 +0000 |
commit | d3dd1354a49c321324878269189cdff7e0e151bb (patch) | |
tree | 8e2679c0255c036a28de407235dcfc7a271bbc77 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | 927a11e380d5c5fb1e618a6ce6bdf6c1f423e53f (diff) | |
download | bcm5719-llvm-d3dd1354a49c321324878269189cdff7e0e151bb.tar.gz bcm5719-llvm-d3dd1354a49c321324878269189cdff7e0e151bb.zip |
LiveIntervalAnalysis: Factor common code into splitSeparateComponents; NFC
llvm-svn: 248241
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index 53a241203fd..1160dcf4121 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -1413,3 +1413,20 @@ void LiveIntervals::removeVRegDefAt(LiveInterval &LI, SlotIndex Pos) { } LI.removeEmptySubRanges(); } + +void LiveIntervals::splitSeparateComponents(LiveInterval &LI, + SmallVectorImpl<LiveInterval*> &SplitLIs) { + ConnectedVNInfoEqClasses ConEQ(*this); + unsigned NumComp = ConEQ.Classify(&LI); + if (NumComp <= 1) + return; + DEBUG(dbgs() << " Split " << NumComp << " components: " << LI << '\n'); + unsigned Reg = LI.reg; + const TargetRegisterClass *RegClass = MRI->getRegClass(Reg); + for (unsigned I = 1; I < NumComp; ++I) { + unsigned NewVReg = MRI->createVirtualRegister(RegClass); + LiveInterval &NewLI = createEmptyInterval(NewVReg); + SplitLIs.push_back(&NewLI); + } + ConEQ.Distribute(LI, SplitLIs.data(), *MRI); +} |