LLVM 22.0.0git
Public Member Functions | List of all members
llvm::mca::ResourceState Class Reference

A processor resource descriptor. More...

#include "llvm/MCA/HardwareUnits/ResourceManager.h"

Public Member Functions

LLVM_ABI ResourceState (const MCProcResourceDesc &Desc, unsigned Index, uint64_t Mask)
 
unsigned getProcResourceID () const
 
uint64_t getResourceMask () const
 
uint64_t getReadyMask () const
 
int getBufferSize () const
 
bool isBuffered () const
 
bool isInOrder () const
 
bool isADispatchHazard () const
 Returns true if this is an in-order dispatch/issue resource.
 
bool isReserved () const
 
void setReserved ()
 
void clearReserved ()
 
LLVM_ABI bool isReady (unsigned NumUnits=1) const
 Returs true if this resource is not reserved, and if there are at least NumUnits available units.
 
uint64_t getNumReadyUnits () const
 
bool isAResourceGroup () const
 
bool containsResource (uint64_t ID) const
 
void markSubResourceAsUsed (uint64_t ID)
 
void releaseSubResource (uint64_t ID)
 
unsigned getNumUnits () const
 
LLVM_ABI ResourceStateEvent isBufferAvailable () const
 Checks if there is an available slot in the resource buffer.
 
bool reserveBuffer ()
 Reserve a buffer slot.
 
void releaseBuffer ()
 Releases a slot in the buffer.
 
void dump () const
 

Detailed Description

A processor resource descriptor.

There is an instance of this class for every processor resource defined by the machine scheduling model. Objects of class ResourceState dynamically track the usage of processor resource units.

Definition at line 136 of file ResourceManager.h.

Constructor & Destructor Documentation

◆ ResourceState()

llvm::mca::ResourceState::ResourceState ( const MCProcResourceDesc Desc,
unsigned  Index,
uint64_t  Mask 
)

Definition at line 65 of file ResourceManager.cpp.

References llvm::mca::getResourceStateIndex().

Member Function Documentation

◆ clearReserved()

void llvm::mca::ResourceState::clearReserved ( )
inline

Definition at line 231 of file ResourceManager.h.

References Unavailable.

Referenced by llvm::mca::ResourceManager::releaseResource().

◆ containsResource()

bool llvm::mca::ResourceState::containsResource ( uint64_t  ID) const
inline

Definition at line 241 of file ResourceManager.h.

◆ dump()

void llvm::mca::ResourceState::dump ( ) const

Definition at line 94 of file ResourceManager.cpp.

References llvm::dbgs(), and llvm::format_hex().

◆ getBufferSize()

int llvm::mca::ResourceState::getBufferSize ( ) const
inline

Definition at line 221 of file ResourceManager.h.

◆ getNumReadyUnits()

uint64_t llvm::mca::ResourceState::getNumReadyUnits ( ) const
inline

Definition at line 237 of file ResourceManager.h.

References llvm::popcount().

Referenced by llvm::mca::ResourceManager::issueInstructionImpl().

◆ getNumUnits()

unsigned llvm::mca::ResourceState::getNumUnits ( ) const
inline

Definition at line 253 of file ResourceManager.h.

References isAResourceGroup(), and llvm::popcount().

Referenced by llvm::mca::getStrategyFor().

◆ getProcResourceID()

unsigned llvm::mca::ResourceState::getProcResourceID ( ) const
inline

Definition at line 218 of file ResourceManager.h.

◆ getReadyMask()

uint64_t llvm::mca::ResourceState::getReadyMask ( ) const
inline

◆ getResourceMask()

uint64_t llvm::mca::ResourceState::getResourceMask ( ) const
inline

Definition at line 219 of file ResourceManager.h.

◆ isADispatchHazard()

bool llvm::mca::ResourceState::isADispatchHazard ( ) const
inline

Returns true if this is an in-order dispatch/issue resource.

Definition at line 227 of file ResourceManager.h.

Referenced by isBufferAvailable(), isReady(), and llvm::mca::ResourceManager::releaseResource().

◆ isAResourceGroup()

bool llvm::mca::ResourceState::isAResourceGroup ( ) const
inline

◆ isBufferAvailable()

ResourceStateEvent llvm::mca::ResourceState::isBufferAvailable ( ) const

Checks if there is an available slot in the resource buffer.

Returns RS_BUFFER_AVAILABLE if this is not a buffered resource, or if there is a slot available.

Returns RS_RESERVED if this buffered resource is a dispatch hazard, and it is reserved.

Returns RS_BUFFER_UNAVAILABLE if there are no available slots.

Definition at line 85 of file ResourceManager.cpp.

References isADispatchHazard(), isBuffered(), isReserved(), llvm::mca::RS_BUFFER_AVAILABLE, llvm::mca::RS_BUFFER_UNAVAILABLE, and llvm::mca::RS_RESERVED.

◆ isBuffered()

bool llvm::mca::ResourceState::isBuffered ( ) const
inline

Definition at line 223 of file ResourceManager.h.

Referenced by isBufferAvailable().

◆ isInOrder()

bool llvm::mca::ResourceState::isInOrder ( ) const
inline

Definition at line 224 of file ResourceManager.h.

◆ isReady()

bool llvm::mca::ResourceState::isReady ( unsigned  NumUnits = 1) const

Returs true if this resource is not reserved, and if there are at least NumUnits available units.

Definition at line 80 of file ResourceManager.cpp.

References isADispatchHazard(), isReserved(), and llvm::popcount().

Referenced by llvm::mca::ResourceManager::checkAvailability().

◆ isReserved()

bool llvm::mca::ResourceState::isReserved ( ) const
inline

◆ markSubResourceAsUsed()

void llvm::mca::ResourceState::markSubResourceAsUsed ( uint64_t  ID)
inline

Definition at line 243 of file ResourceManager.h.

References assert().

◆ releaseBuffer()

void llvm::mca::ResourceState::releaseBuffer ( )
inline

Releases a slot in the buffer.

Definition at line 282 of file ResourceManager.h.

References assert().

◆ releaseSubResource()

void llvm::mca::ResourceState::releaseSubResource ( uint64_t  ID)
inline

Definition at line 248 of file ResourceManager.h.

References assert().

◆ reserveBuffer()

bool llvm::mca::ResourceState::reserveBuffer ( )
inline

Reserve a buffer slot.

Returns true if the buffer is not full. It always returns true if BufferSize is set to zero.

Definition at line 272 of file ResourceManager.h.

References assert().

◆ setReserved()

void llvm::mca::ResourceState::setReserved ( )
inline

Definition at line 230 of file ResourceManager.h.

References Unavailable.

Referenced by llvm::mca::ResourceManager::reserveResource().


The documentation for this class was generated from the following files: