diff options
| author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-02-23 22:08:50 +0000 |
|---|---|---|
| committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-02-23 22:08:50 +0000 |
| commit | 998e49e5c882b5d87f44a2645cde17575b05bb75 (patch) | |
| tree | 71dc2a178021fefa61e0695c1bdcc7e44a0707f0 /llvm/lib | |
| parent | d0a9e807f39fdce9e2dc6e24265e7c8188a52aff (diff) | |
| download | bcm5719-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')
| -rw-r--r-- | llvm/lib/Target/Hexagon/BitTracker.cpp | 16 | ||||
| -rw-r--r-- | llvm/lib/Target/Hexagon/BitTracker.h | 3 |
2 files changed, 13 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. diff --git a/llvm/lib/Target/Hexagon/BitTracker.h b/llvm/lib/Target/Hexagon/BitTracker.h index 48c5f2266ac..a547b34e852 100644 --- a/llvm/lib/Target/Hexagon/BitTracker.h +++ b/llvm/lib/Target/Hexagon/BitTracker.h @@ -283,6 +283,9 @@ struct BitTracker::RegisterCell { return !operator==(RC); } + // Replace the ref-to-reg-0 bit values with the given register. + RegisterCell ®ify(unsigned R); + // Generate a "ref" cell for the corresponding register. In the resulting // cell each bit will be described as being the same as the corresponding // bit in register Reg (i.e. the cell is "defined" by register Reg). |

