#include "llvm/MCA/HardwareUnits/ResourceManager.h"
#include "llvm/MCA/Support.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
namespace mca {
#define DEBUG_TYPE …
ResourceStrategy::~ResourceStrategy() = default;
static uint64_t selectImpl(uint64_t CandidateMask,
uint64_t &NextInSequenceMask) { … }
uint64_t DefaultResourceStrategy::select(uint64_t ReadyMask) { … }
void DefaultResourceStrategy::used(uint64_t Mask) { … }
ResourceState::ResourceState(const MCProcResourceDesc &Desc, unsigned Index,
uint64_t Mask)
: … { … }
bool ResourceState::isReady(unsigned NumUnits) const { … }
ResourceStateEvent ResourceState::isBufferAvailable() const { … }
#ifndef NDEBUG
void ResourceState::dump() const {
dbgs() << "MASK=" << format_hex(ResourceMask, 16)
<< ", SZMASK=" << format_hex(ResourceSizeMask, 16)
<< ", RDYMASK=" << format_hex(ReadyMask, 16)
<< ", BufferSize=" << BufferSize
<< ", AvailableSlots=" << AvailableSlots
<< ", Reserved=" << Unavailable << '\n';
}
#endif
static std::unique_ptr<ResourceStrategy>
getStrategyFor(const ResourceState &RS) { … }
ResourceManager::ResourceManager(const MCSchedModel &SM)
: … { … }
void ResourceManager::setCustomStrategyImpl(std::unique_ptr<ResourceStrategy> S,
uint64_t ResourceMask) { … }
unsigned ResourceManager::resolveResourceMask(uint64_t Mask) const { … }
unsigned ResourceManager::getNumUnits(uint64_t ResourceID) const { … }
ResourceRef ResourceManager::selectPipe(uint64_t ResourceID) { … }
void ResourceManager::use(const ResourceRef &RR) { … }
void ResourceManager::release(const ResourceRef &RR) { … }
ResourceStateEvent
ResourceManager::canBeDispatched(uint64_t ConsumedBuffers) const { … }
void ResourceManager::reserveBuffers(uint64_t ConsumedBuffers) { … }
void ResourceManager::releaseBuffers(uint64_t ConsumedBuffers) { … }
uint64_t ResourceManager::checkAvailability(const InstrDesc &Desc) const { … }
void ResourceManager::issueInstructionImpl(
const InstrDesc &Desc, SmallVectorImpl<ResourceWithCycles> &Pipes) { … }
void ResourceManager::fastIssueInstruction(
const InstrDesc &Desc, SmallVectorImpl<ResourceWithCycles> &Pipes) { … }
void ResourceManager::cycleEvent(SmallVectorImpl<ResourceRef> &ResourcesFreed) { … }
void ResourceManager::reserveResource(uint64_t ResourceID) { … }
void ResourceManager::releaseResource(uint64_t ResourceID) { … }
}
}