[llvm] r344149 - [llvm-mca] Minor refactoring in preparation for a patch that will fully fix PR36671. NFCI
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 10 09:08:02 PDT 2018
Author: adibiagio
Date: Wed Oct 10 09:08:02 2018
New Revision: 344149
URL: http://llvm.org/viewvc/llvm-project?rev=344149&view=rev
Log:
[llvm-mca] Minor refactoring in preparation for a patch that will fully fix PR36671. NFCI
Modified:
llvm/trunk/tools/llvm-mca/include/HardwareUnits/RegisterFile.h
llvm/trunk/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp
Modified: llvm/trunk/tools/llvm-mca/include/HardwareUnits/RegisterFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/include/HardwareUnits/RegisterFile.h?rev=344149&r1=344148&r2=344149&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/include/HardwareUnits/RegisterFile.h (original)
+++ llvm/trunk/tools/llvm-mca/include/HardwareUnits/RegisterFile.h Wed Oct 10 09:08:02 2018
@@ -68,9 +68,11 @@ class RegisterFile : public HardwareUnit
bool AllowZeroMoveEliminationOnly;
RegisterMappingTracker(unsigned NumPhysRegisters,
- unsigned MaxMoveEliminated = 0U)
+ unsigned MaxMoveEliminated = 0U,
+ bool AllowZeroMoveElimOnly = false)
: NumPhysRegs(NumPhysRegisters), NumUsedPhysRegs(0),
- MaxMoveEliminatedPerCycle(MaxMoveEliminated), NumMoveEliminated(0U) {}
+ MaxMoveEliminatedPerCycle(MaxMoveEliminated), NumMoveEliminated(0U),
+ AllowZeroMoveEliminationOnly(AllowZeroMoveElimOnly) {}
};
// A vector of register file descriptors. This set always contains at least
@@ -151,9 +153,8 @@ class RegisterFile : public HardwareUnit
// Here FPRegisterFile contains all the registers defined by register class
// VR128RegClass and VR256RegClass. FPRegisterFile implements 60
// registers which can be used for register renaming purpose.
- void
- addRegisterFile(llvm::ArrayRef<llvm::MCRegisterCostEntry> RegisterClasses,
- unsigned NumPhysRegs);
+ void addRegisterFile(const llvm::MCRegisterFileDesc &RF,
+ llvm::ArrayRef<llvm::MCRegisterCostEntry> Entries);
// Consumes physical registers in each register file specified by the
// `IndexPlusCostPairTy`. This method is called from `addRegisterMapping()`.
Modified: llvm/trunk/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp?rev=344149&r1=344148&r2=344149&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp (original)
+++ llvm/trunk/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp Wed Oct 10 09:08:02 2018
@@ -37,7 +37,7 @@ void RegisterFile::initialize(const MCSc
// declared by the target. The number of physical registers in the default
// register file is set equal to `NumRegs`. A value of zero for `NumRegs`
// means: this register file has an unbounded number of physical registers.
- addRegisterFile({} /* all registers */, NumRegs);
+ RegisterFiles.emplace_back(NumRegs);
if (!SM.hasExtraProcessorInfo())
return;
@@ -48,15 +48,17 @@ void RegisterFile::initialize(const MCSc
for (unsigned I = 0, E = Info.NumRegisterFiles; I < E; ++I) {
const MCRegisterFileDesc &RF = Info.RegisterFiles[I];
// Skip invalid register files with zero physical registers.
- unsigned Length = RF.NumRegisterCostEntries;
+ // TODO: verify this constraint in SubtargetEmitter, and convert this
+ // statement into an assert.
if (!RF.NumPhysRegs)
continue;
+
// The cost of a register definition is equivalent to the number of
// physical registers that are allocated at register renaming stage.
+ unsigned Length = RF.NumRegisterCostEntries;
const MCRegisterCostEntry *FirstElt =
&Info.RegisterCostTable[RF.RegisterCostEntryIdx];
- addRegisterFile(ArrayRef<MCRegisterCostEntry>(FirstElt, Length),
- RF.NumPhysRegs);
+ addRegisterFile(RF, ArrayRef<MCRegisterCostEntry>(FirstElt, Length));
}
}
@@ -65,15 +67,15 @@ void RegisterFile::cycleStart() {
RMT.NumMoveEliminated = 0;
}
-void RegisterFile::addRegisterFile(ArrayRef<MCRegisterCostEntry> Entries,
- unsigned NumPhysRegs) {
+void RegisterFile::addRegisterFile(const MCRegisterFileDesc &RF,
+ ArrayRef<MCRegisterCostEntry> Entries) {
// A default register file is always allocated at index #0. That register file
// is mainly used to count the total number of mappings created by all
// register files at runtime. Users can limit the number of available physical
// registers in register file #0 through the command line flag
// `-register-file-size`.
unsigned RegisterFileIndex = RegisterFiles.size();
- RegisterFiles.emplace_back(NumPhysRegs);
+ RegisterFiles.emplace_back(RF.NumPhysRegs);
// Special case where there is no register class identifier in the set.
// An empty set of register classes means: this register file contains all
More information about the llvm-commits
mailing list