summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Hexagon/BitTracker.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-02-23 22:08:50 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-02-23 22:08:50 +0000
commit998e49e5c882b5d87f44a2645cde17575b05bb75 (patch)
tree71dc2a178021fefa61e0695c1bdcc7e44a0707f0 /llvm/lib/Target/Hexagon/BitTracker.cpp
parentd0a9e807f39fdce9e2dc6e24265e7c8188a52aff (diff)
downloadbcm5719-llvm-998e49e5c882b5d87f44a2645cde17575b05bb75.tar.gz
bcm5719-llvm-998e49e5c882b5d87f44a2645cde17575b05bb75.zip
[Hexagon] Allow setting register in BitVal without storing into map
In the bit tracker, references to other bit values in which the register is 0 are prohibited. This means that generating self-referential register cells like { w:32 [0-15]:s[0-15] [16-31]:s[15] } is impossible. In order to get a self-referential cell, it had to be stored into a map and then reloaded from it. To avoid this step, add a function that will set the register to a given value without going through the map. llvm-svn: 296025
Diffstat (limited to 'llvm/lib/Target/Hexagon/BitTracker.cpp')
-rw-r--r--llvm/lib/Target/Hexagon/BitTracker.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Target/Hexagon/BitTracker.cpp b/llvm/lib/Target/Hexagon/BitTracker.cpp
index 963fb99ce09..61d3630ac09 100644
--- a/llvm/lib/Target/Hexagon/BitTracker.cpp
+++ b/llvm/lib/Target/Hexagon/BitTracker.cpp
@@ -317,6 +317,15 @@ bool BT::RegisterCell::operator== (const RegisterCell &RC) const {
return true;
}
+BT::RegisterCell &BT::RegisterCell::regify(unsigned R) {
+ for (unsigned i = 0, n = width(); i < n; ++i) {
+ const BitValue &V = Bits[i];
+ if (V.Type == BitValue::Ref && V.RefI.Reg == 0)
+ Bits[i].RefI = BitRef(R, i);
+ }
+ return *this;
+}
+
uint16_t BT::MachineEvaluator::getRegBitWidth(const RegisterRef &RR) const {
// The general problem is with finding a register class that corresponds
// to a given reference reg:sub. There can be several such classes, and
@@ -378,12 +387,7 @@ void BT::MachineEvaluator::putCell(const RegisterRef &RR, RegisterCell RC,
return;
assert(RR.Sub == 0 && "Unexpected sub-register in definition");
// Eliminate all ref-to-reg-0 bit values: replace them with "self".
- for (unsigned i = 0, n = RC.width(); i < n; ++i) {
- const BitValue &V = RC[i];
- if (V.Type == BitValue::Ref && V.RefI.Reg == 0)
- RC[i].RefI = BitRef(RR.Reg, i);
- }
- M[RR.Reg] = RC;
+ M[RR.Reg] = RC.regify(RR.Reg);
}
// Check if the cell represents a compile-time integer value.
OpenPOWER on IntegriCloud