summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-12-10 01:11:56 +0000
committerMatthias Braun <matze@braunis.de>2014-12-10 01:11:56 +0000
commitd01627b2495b6730fb09ce2c15b5917d20e1987d (patch)
tree6e530dc8f0ee8ce8d93823f628f570ba184970fa /llvm
parentf0aceb2f69cae1b84e1b96f1ae9932480e801b32 (diff)
downloadbcm5719-llvm-d01627b2495b6730fb09ce2c15b5917d20e1987d.tar.gz
bcm5719-llvm-d01627b2495b6730fb09ce2c15b5917d20e1987d.zip
Let tablegen compute maximum lanemask for regs/regclasses.
Let tablegen compute the combination of subregister lanemasks for all subregisters in a register/register class. This is preparation for further work subregister allocation llvm-svn: 223873
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Target/TargetRegisterInfo.h8
-rw-r--r--llvm/utils/TableGen/CodeGenRegisters.cpp18
-rw-r--r--llvm/utils/TableGen/CodeGenRegisters.h4
-rw-r--r--llvm/utils/TableGen/RegisterInfoEmitter.cpp3
4 files changed, 28 insertions, 5 deletions
diff --git a/llvm/include/llvm/Target/TargetRegisterInfo.h b/llvm/include/llvm/Target/TargetRegisterInfo.h
index 16b72a98db0..ad4fdbe3958 100644
--- a/llvm/include/llvm/Target/TargetRegisterInfo.h
+++ b/llvm/include/llvm/Target/TargetRegisterInfo.h
@@ -45,6 +45,7 @@ public:
const vt_iterator VTs;
const uint32_t *SubClassMask;
const uint16_t *SuperRegIndices;
+ const unsigned LaneMask;
const sc_iterator SuperClasses;
ArrayRef<MCPhysReg> (*OrderFunc)(const MachineFunction&);
@@ -190,6 +191,13 @@ public:
ArrayRef<MCPhysReg> getRawAllocationOrder(const MachineFunction &MF) const {
return OrderFunc ? OrderFunc(MF) : makeArrayRef(begin(), getNumRegs());
}
+
+ /// Returns the combination of all lane masks of register in this class.
+ /// The lane masks of the registers are the combination of all lane masks
+ /// of their subregisters.
+ unsigned getLaneMask() const {
+ return LaneMask;
+ }
};
/// TargetRegisterInfoDesc - Extra information, not in MCRegisterDesc, about
diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp
index c50ed9b85f0..fdfdba4f202 100644
--- a/llvm/utils/TableGen/CodeGenRegisters.cpp
+++ b/llvm/utils/TableGen/CodeGenRegisters.cpp
@@ -661,7 +661,8 @@ CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R)
: TheDef(R),
Name(R->getName()),
TopoSigs(RegBank.getNumTopoSigs()),
- EnumValue(-1) {
+ EnumValue(-1),
+ LaneMask(0) {
// Rename anonymous register classes.
if (R->getName().size() > 9 && R->getName()[9] == '.') {
static unsigned AnonCounter = 0;
@@ -1165,7 +1166,7 @@ void CodeGenRegBank::computeComposites() {
//
// Conservatively share a lane mask bit if two sub-register indices overlap in
// some registers, but not in others. That shouldn't happen a lot.
-void CodeGenRegBank::computeSubRegIndexLaneMasks() {
+void CodeGenRegBank::computeSubRegLaneMasks() {
// First assign individual bits to all the leaf indices.
unsigned Bit = 0;
// Determine mask of lanes that cover their registers.
@@ -1202,6 +1203,17 @@ void CodeGenRegBank::computeSubRegIndexLaneMasks() {
if (!Idx.AllSuperRegsCovered)
CoveringLanes &= ~Mask;
}
+
+ // Compute lane mask combinations for register classes.
+ for (auto &RegClass : RegClasses) {
+ unsigned LaneMask = 0;
+ for (const auto &SubRegIndex : SubRegIndices) {
+ if (RegClass.getSubClassWithSubReg(&SubRegIndex) != &RegClass)
+ continue;
+ LaneMask |= SubRegIndex.LaneMask;
+ }
+ RegClass.LaneMask = LaneMask;
+ }
}
namespace {
@@ -1689,7 +1701,7 @@ void CodeGenRegBank::computeRegUnitSets() {
void CodeGenRegBank::computeDerivedInfo() {
computeComposites();
- computeSubRegIndexLaneMasks();
+ computeSubRegLaneMasks();
// Compute a weight for each register unit created during getSubRegs.
// This may create adopted register units (with unit # >= NumNativeRegUnits).
diff --git a/llvm/utils/TableGen/CodeGenRegisters.h b/llvm/utils/TableGen/CodeGenRegisters.h
index c1606e35703..6baaa28d95d 100644
--- a/llvm/utils/TableGen/CodeGenRegisters.h
+++ b/llvm/utils/TableGen/CodeGenRegisters.h
@@ -283,6 +283,8 @@ namespace llvm {
int CopyCost;
bool Allocatable;
std::string AltOrderSelect;
+ /// Contains the combination of the lane masks of all subregisters.
+ unsigned LaneMask;
// Return the Record that defined this class, or NULL if the class was
// created by TableGen.
@@ -525,7 +527,7 @@ namespace llvm {
void computeComposites();
// Compute a lane mask for each sub-register index.
- void computeSubRegIndexLaneMasks();
+ void computeSubRegLaneMasks();
public:
CodeGenRegBank(RecordKeeper&);
diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index fa10dbbb872..b7bd37b30a2 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -1171,7 +1171,8 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
<< "MCRegisterClasses[" << RC.getName() << "RegClassID],\n "
<< "VTLists + " << VTSeqs.get(RC.VTs) << ",\n " << RC.getName()
<< "SubClassMask,\n SuperRegIdxSeqs + "
- << SuperRegIdxSeqs.get(SuperRegIdxLists[RC.EnumValue]) << ",\n ";
+ << SuperRegIdxSeqs.get(SuperRegIdxLists[RC.EnumValue]) << ",\n "
+ << format("0x%08x,\n ", RC.LaneMask);
if (RC.getSuperClasses().empty())
OS << "NullRegClasses,\n ";
else
OpenPOWER on IntegriCloud