summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/Scheduler.h
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-10 16:55:07 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-10 16:55:07 +0000
commit0c54129907191f44780af22582da18ea4cf2a57e (patch)
treeaa3786495c4ea061c1a0db9c9a1a6efaf9d1c103 /llvm/tools/llvm-mca/Scheduler.h
parent8224241f757c57fcb6696264ca3ae66a9e82de9a (diff)
downloadbcm5719-llvm-0c54129907191f44780af22582da18ea4cf2a57e.tar.gz
bcm5719-llvm-0c54129907191f44780af22582da18ea4cf2a57e.zip
[llvm-mca] Views are now independent from resource masks. NFCI
This change removes method Backend::getProcResourceMasks() and simplifies some logic in the Views. This effectively removes yet another dependency between the views and the Backend. No functional change intended. llvm-svn: 327214
Diffstat (limited to 'llvm/tools/llvm-mca/Scheduler.h')
-rw-r--r--llvm/tools/llvm-mca/Scheduler.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/tools/llvm-mca/Scheduler.h b/llvm/tools/llvm-mca/Scheduler.h
index 2b58437404c..7bc28739746 100644
--- a/llvm/tools/llvm-mca/Scheduler.h
+++ b/llvm/tools/llvm-mca/Scheduler.h
@@ -56,6 +56,8 @@ enum ResourceStateEvent {
/// Internally, ResourceState uses a round-robin selector to identify
/// which unit of the group shall be used next.
class ResourceState {
+ // Index to the MCProcResourceDesc in the processor Model.
+ unsigned ProcResourceDescIndex;
// A resource unique identifier generated by the tool.
// For processor resource groups, the number of number of bits set in this
// mask is equivalent to the cardinality of the group plus one.
@@ -181,8 +183,9 @@ class ResourceState {
}
public:
- ResourceState(const llvm::MCProcResourceDesc &Desc, uint64_t Mask)
- : ResourceMask(Mask) {
+ ResourceState(const llvm::MCProcResourceDesc &Desc, unsigned Index,
+ uint64_t Mask)
+ : ProcResourceDescIndex(Index), ResourceMask(Mask) {
bool IsAGroup = llvm::countPopulation(ResourceMask) > 1;
ResourceSizeMask = IsAGroup ? computeResourceSizeMaskForGroup(ResourceMask)
: ((1ULL << Desc.NumUnits) - 1);
@@ -195,6 +198,7 @@ public:
Unavailable = false;
}
+ unsigned getProcResourceID() const { return ProcResourceDescIndex; }
uint64_t getResourceMask() const { return ResourceMask; }
int getBufferSize() const { return BufferSize; }
unsigned getMaxUsedSlots() const { return MaxUsedSlots; }
@@ -274,9 +278,9 @@ public:
/// 'second' index is an index for a "sub-resource" (i.e. unit).
typedef std::pair<uint64_t, uint64_t> ResourceRef;
-// First: a resource mask identifying a buffered resource.
+// First: a MCProcResourceDesc index identifying a buffered resource.
// Second: max number of buffer entries used in this resource.
-typedef std::pair<uint64_t, unsigned> BufferUsageEntry;
+typedef std::pair<unsigned, unsigned> BufferUsageEntry;
/// A resource manager for processor resource units and groups.
///
@@ -300,7 +304,8 @@ class ResourceManager {
// Adds a new resource state in Resources, as well as a new descriptor in
// ResourceDescriptor.
- void addResource(const llvm::MCProcResourceDesc &Desc, uint64_t Mask);
+ void addResource(const llvm::MCProcResourceDesc &Desc, unsigned Index,
+ uint64_t Mask);
// Compute processor resource masks for each processor resource declared by
// the scheduling model.
@@ -310,7 +315,7 @@ class ResourceManager {
void initialize(const llvm::MCSchedModel &SM) {
computeProcResourceMasks(SM);
for (unsigned I = 0, E = SM.getNumProcResourceKinds(); I < E; ++I)
- addResource(*SM.getProcResource(I), ProcResID2Mask[I]);
+ addResource(*SM.getProcResource(I), I, ProcResID2Mask[I]);
}
// Returns the actual resource unit that will be used.
@@ -400,7 +405,7 @@ public:
for (const std::pair<uint64_t, UniqueResourceState> &Resource : Resources) {
const ResourceState &RS = *Resource.second;
if (RS.isBuffered())
- Usage.emplace_back(std::pair<uint64_t, unsigned>(RS.getResourceMask(),
+ Usage.emplace_back(std::pair<unsigned, unsigned>(RS.getProcResourceID(),
RS.getMaxUsedSlots()));
}
}
OpenPOWER on IntegriCloud