diff options
Diffstat (limited to 'llvm/tools/llvm-mca/Scheduler.h')
-rw-r--r-- | llvm/tools/llvm-mca/Scheduler.h | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/llvm/tools/llvm-mca/Scheduler.h b/llvm/tools/llvm-mca/Scheduler.h index 912658fa450..c74d3f1e196 100644 --- a/llvm/tools/llvm-mca/Scheduler.h +++ b/llvm/tools/llvm-mca/Scheduler.h @@ -60,22 +60,8 @@ enum ResourceStateEvent { 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. - // Excluding the most significant bit, the remaining bits in the resource mask - // identify resources that are part of the group. - // - // Example, lets assume that this ResourceState describes a - // group containing ResourceA and ResourceB: - // - // ResourceA -- Mask: 0b001 - // ResourceB -- Mask: 0b010 - // ResourceAB -- Mask: 0b100 U (ResourceA::Mask | ResourceB::Mask) == 0b111 - // - // There is only one bit set for non-group resources. - // A ResourceMask can be used to solve set membership problems with simple bit - // manipulation operations. + // A resource mask. This is generated by the tool with the help of + // function `mca::createProcResourceMasks' (see Support.h). uint64_t ResourceMask; // A ProcResource can specify a number of units. For the purpose of dynamic @@ -309,16 +295,8 @@ class ResourceManager { void addResource(const llvm::MCProcResourceDesc &Desc, unsigned Index, uint64_t Mask); - // Compute processor resource masks for each processor resource declared by - // the scheduling model. - void computeProcResourceMasks(const llvm::MCSchedModel &SM); - // Populate resource descriptors. - void initialize(const llvm::MCSchedModel &SM) { - computeProcResourceMasks(SM); - for (unsigned I = 0, E = SM.getNumProcResourceKinds(); I < E; ++I) - addResource(*SM.getProcResource(I), I, ProcResID2Mask[I]); - } + void initialize(const llvm::MCSchedModel &SM); // Returns the actual resource unit that will be used. ResourceRef selectPipe(uint64_t ResourceID); @@ -354,7 +332,10 @@ class ResourceManager { } public: - ResourceManager(const llvm::MCSchedModel &SM) { initialize(SM); } + ResourceManager(const llvm::MCSchedModel &SM) + : ProcResID2Mask(SM.getNumProcResourceKinds()) { + initialize(SM); + } // Returns RS_BUFFER_AVAILABLE if buffered resources are not reserved, and if // there are enough available slots in the buffers. @@ -400,10 +381,6 @@ public: } } - const llvm::ArrayRef<uint64_t> getProcResMasks() const { - return ProcResID2Mask; - } - #ifndef NDEBUG void dump() const { for (const std::pair<uint64_t, UniqueResourceState> &Resource : Resources) @@ -525,10 +502,6 @@ public: Resources->getBuffersUsage(Usage); } - const llvm::ArrayRef<uint64_t> getProcResourceMasks() const { - return Resources->getProcResMasks(); - } - #ifndef NDEBUG void dump() const; #endif |