summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenRegisters.h
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-08-28 19:48:42 +0000
committerMatthias Braun <matze@braunis.de>2017-08-28 19:48:42 +0000
commitafcff2d0d914b4c1f07aca3a35de0d72a35c2b00 (patch)
treec019da361ada501dfee2fe1b4dd6fa0bd60f2096 /llvm/utils/TableGen/CodeGenRegisters.h
parent3fdc099a6d7a8fb18f6a739df78f10975e9eadef (diff)
downloadbcm5719-llvm-afcff2d0d914b4c1f07aca3a35de0d72a35c2b00.tar.gz
bcm5719-llvm-afcff2d0d914b4c1f07aca3a35de0d72a35c2b00.zip
TableGen: Fix subreg composition/concatenation
This fixes 2 problems in subregister hierarchies with multiple levels and tuples: 1) For bigger tuples computing secondary subregs would miss 2nd order effects. In the test case a register like `S10_S11_S12_S13_S14` with D5 = S10_S11, D6 = S12_S13 we would correctly compute sub0 = D5, sub1 = D6 but would miss the fact that we could now form ssub0_ssub1_ssub2_ssub3 (aka sub0_sub1) = D5_D6. This is fixed by changing computeSecondarySubRegs() to compute a fixpoint. 2) Fixing 1) exposed a problem where TableGen would create multiple names for effectively the same subregister index. In the test case the subregister index sub0 is composed from ssub0 and ssub1, and sub1 is composed from ssub2 and ssub3. TableGen should not create both sub0_sub1 and ssub0_ssub1_ssub2_ssub3 as infered subregister indexes. This changes the code to build a transitive closure of the subregister components before forming new concatenated subregister indexes. This fix was developed for an out of tree target. For the in-tree targets the only change is in the register information computed for ARM. There is a slight chance this fixed/improved some register coalescing around the QQQQ/QQ register classes there but I couldn't see/provoke any code generation differences. Differential Revision: https://reviews.llvm.org/D36913 llvm-svn: 311914
Diffstat (limited to 'llvm/utils/TableGen/CodeGenRegisters.h')
-rw-r--r--llvm/utils/TableGen/CodeGenRegisters.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/utils/TableGen/CodeGenRegisters.h b/llvm/utils/TableGen/CodeGenRegisters.h
index d0f96a035ea..1ce041c2ef8 100644
--- a/llvm/utils/TableGen/CodeGenRegisters.h
+++ b/llvm/utils/TableGen/CodeGenRegisters.h
@@ -72,6 +72,10 @@ namespace llvm {
mutable LaneBitmask LaneMask;
mutable SmallVector<MaskRolPair,1> CompositionLaneMaskTransform;
+ /// A list of subregister indexes concatenated resulting in this
+ /// subregister index. This is the reverse of CodeGenRegBank::ConcatIdx.
+ SmallVector<CodeGenSubRegIndex*,4> ConcatenationOf;
+
// Are all super-registers containing this SubRegIndex covered by their
// sub-registers?
bool AllSuperRegsCovered;
@@ -123,6 +127,12 @@ namespace llvm {
// Compute LaneMask from Composed. Return LaneMask.
LaneBitmask computeLaneMask() const;
+ void setConcatenationOf(ArrayRef<CodeGenSubRegIndex*> Parts);
+
+ /// Replaces subregister indexes in the `ConcatenationOf` list with
+ /// list of subregisters they are composed of (if any). Do this recursively.
+ void computeConcatTransitiveClosure();
+
private:
CompMap Composed;
};
@@ -609,12 +619,6 @@ namespace llvm {
CodeGenSubRegIndex *
getConcatSubRegIndex(const SmallVector<CodeGenSubRegIndex *, 8>&);
- void
- addConcatSubRegIndex(const SmallVector<CodeGenSubRegIndex *, 8> &Parts,
- CodeGenSubRegIndex *Idx) {
- ConcatIdx.insert(std::make_pair(Parts, Idx));
- }
-
const std::deque<CodeGenRegister> &getRegisters() { return Registers; }
const StringMap<CodeGenRegister*> &getRegistersByName() {
OpenPOWER on IntegriCloud