summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Hexagon
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-10-18 19:47:20 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-10-18 19:47:20 +0000
commit5bb417bed2131e38d0e057101d88ba84e9bb2a82 (patch)
tree82a57e45544d8991eb606480828005437b1fe0ce /llvm/lib/Target/Hexagon
parent4c2582ad78abe764b2786a34d7432980449d09f5 (diff)
downloadbcm5719-llvm-5bb417bed2131e38d0e057101d88ba84e9bb2a82.tar.gz
bcm5719-llvm-5bb417bed2131e38d0e057101d88ba84e9bb2a82.zip
[Hexagon] Handle block live-ins with lane masks in HexagonBlockRanges
llvm-svn: 284522
Diffstat (limited to 'llvm/lib/Target/Hexagon')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonBlockRanges.cpp36
-rw-r--r--llvm/lib/Target/Hexagon/HexagonBlockRanges.h3
2 files changed, 28 insertions, 11 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonBlockRanges.cpp b/llvm/lib/Target/Hexagon/HexagonBlockRanges.cpp
index c6a5e7a55ea..48d1c082a66 100644
--- a/llvm/lib/Target/Hexagon/HexagonBlockRanges.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonBlockRanges.cpp
@@ -241,11 +241,29 @@ HexagonBlockRanges::HexagonBlockRanges(MachineFunction &mf)
HexagonBlockRanges::RegisterSet HexagonBlockRanges::getLiveIns(
- const MachineBasicBlock &B) {
+ const MachineBasicBlock &B, const MachineRegisterInfo &MRI,
+ const TargetRegisterInfo &TRI) {
RegisterSet LiveIns;
- for (auto I : B.liveins())
- if (!Reserved[I.PhysReg])
- LiveIns.insert({I.PhysReg, 0});
+ RegisterSet Tmp;
+ for (auto I : B.liveins()) {
+ if (I.LaneMask == ~LaneBitmask(0)) {
+ Tmp.insert({I.PhysReg,0});
+ continue;
+ }
+ for (MCSubRegIndexIterator S(I.PhysReg, &TRI); S.isValid(); ++S) {
+ LaneBitmask M = TRI.getSubRegIndexLaneMask(S.getSubRegIndex());
+ if (M & I.LaneMask)
+ Tmp.insert({S.getSubReg(), 0});
+ }
+ }
+
+ for (auto R : Tmp) {
+ if (!Reserved[R.Reg])
+ LiveIns.insert(R);
+ for (auto S : expandToSubRegs(R, MRI, TRI))
+ if (!Reserved[S.Reg])
+ LiveIns.insert(S);
+ }
return LiveIns;
}
@@ -287,9 +305,8 @@ void HexagonBlockRanges::computeInitialLiveRanges(InstrIndexMap &IndexMap,
MachineBasicBlock &B = IndexMap.getBlock();
MachineRegisterInfo &MRI = B.getParent()->getRegInfo();
- for (auto R : getLiveIns(B))
- for (auto S : expandToSubRegs(R, MRI, TRI))
- LiveOnEntry.insert(S);
+ for (auto R : getLiveIns(B, MRI, TRI))
+ LiveOnEntry.insert(R);
for (auto R : LiveOnEntry)
LastDef[R] = IndexType::Entry;
@@ -340,9 +357,8 @@ void HexagonBlockRanges::computeInitialLiveRanges(InstrIndexMap &IndexMap,
// Collect live-on-exit.
RegisterSet LiveOnExit;
for (auto *SB : B.successors())
- for (auto R : getLiveIns(*SB))
- for (auto S : expandToSubRegs(R, MRI, TRI))
- LiveOnExit.insert(S);
+ for (auto R : getLiveIns(*SB, MRI, TRI))
+ LiveOnExit.insert(R);
for (auto R : LiveOnExit)
LastUse[R] = IndexType::Exit;
diff --git a/llvm/lib/Target/Hexagon/HexagonBlockRanges.h b/llvm/lib/Target/Hexagon/HexagonBlockRanges.h
index 9c3f938f99e..4d18cf5abe8 100644
--- a/llvm/lib/Target/Hexagon/HexagonBlockRanges.h
+++ b/llvm/lib/Target/Hexagon/HexagonBlockRanges.h
@@ -150,7 +150,8 @@ struct HexagonBlockRanges {
};
private:
- RegisterSet getLiveIns(const MachineBasicBlock &B);
+ RegisterSet getLiveIns(const MachineBasicBlock &B,
+ const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI);
void computeInitialLiveRanges(InstrIndexMap &IndexMap,
RegToRangeMap &LiveMap);
OpenPOWER on IntegriCloud