[llvm-mca] Remove redundant namespace prefixes. NFC

We are already "using" namespace llvm in all the files modified by this change.

llvm-svn: 343312
This commit is contained in:
Andrea Di Biagio 2018-09-28 10:47:24 +00:00
parent 17e5981ebf
commit a7699127a9
8 changed files with 36 additions and 37 deletions

View File

@ -24,8 +24,8 @@ using namespace llvm;
namespace mca { namespace mca {
RegisterFile::RegisterFile(const llvm::MCSchedModel &SM, RegisterFile::RegisterFile(const MCSchedModel &SM, const MCRegisterInfo &mri,
const llvm::MCRegisterInfo &mri, unsigned NumRegs) unsigned NumRegs)
: MRI(mri), : MRI(mri),
RegisterMappings(mri.getNumRegs(), {WriteRef(), RegisterRenamingInfo()}), RegisterMappings(mri.getNumRegs(), {WriteRef(), RegisterRenamingInfo()}),
ZeroRegisters(mri.getNumRegs(), false) { ZeroRegisters(mri.getNumRegs(), false) {
@ -281,7 +281,7 @@ void RegisterFile::collectWrites(SmallVectorImpl<WriteRef> &Writes,
} }
// Remove duplicate entries and resize the input vector. // Remove duplicate entries and resize the input vector.
llvm::sort(Writes, [](const WriteRef &Lhs, const WriteRef &Rhs) { sort(Writes, [](const WriteRef &Lhs, const WriteRef &Rhs) {
return Lhs.getWriteState() < Rhs.getWriteState(); return Lhs.getWriteState() < Rhs.getWriteState();
}); });
auto It = std::unique(Writes.begin(), Writes.end()); auto It = std::unique(Writes.begin(), Writes.end());

View File

@ -35,10 +35,10 @@ void DefaultResourceStrategy::skipMask(uint64_t Mask) {
uint64_t DefaultResourceStrategy::select(uint64_t ReadyMask) { uint64_t DefaultResourceStrategy::select(uint64_t ReadyMask) {
// This method assumes that ReadyMask cannot be zero. // This method assumes that ReadyMask cannot be zero.
uint64_t CandidateMask = llvm::PowerOf2Floor(NextInSequenceMask); uint64_t CandidateMask = PowerOf2Floor(NextInSequenceMask);
while (!(ReadyMask & CandidateMask)) { while (!(ReadyMask & CandidateMask)) {
skipMask(CandidateMask); skipMask(CandidateMask);
CandidateMask = llvm::PowerOf2Floor(NextInSequenceMask); CandidateMask = PowerOf2Floor(NextInSequenceMask);
} }
return CandidateMask; return CandidateMask;
} }
@ -55,8 +55,8 @@ ResourceState::ResourceState(const MCProcResourceDesc &Desc, unsigned Index,
uint64_t Mask) uint64_t Mask)
: ProcResourceDescIndex(Index), ResourceMask(Mask), : ProcResourceDescIndex(Index), ResourceMask(Mask),
BufferSize(Desc.BufferSize) { BufferSize(Desc.BufferSize) {
if (llvm::countPopulation(ResourceMask) > 1) if (countPopulation(ResourceMask) > 1)
ResourceSizeMask = ResourceMask ^ llvm::PowerOf2Floor(ResourceMask); ResourceSizeMask = ResourceMask ^ PowerOf2Floor(ResourceMask);
else else
ResourceSizeMask = (1ULL << Desc.NumUnits) - 1; ResourceSizeMask = (1ULL << Desc.NumUnits) - 1;
ReadyMask = ResourceSizeMask; ReadyMask = ResourceSizeMask;
@ -66,7 +66,7 @@ ResourceState::ResourceState(const MCProcResourceDesc &Desc, unsigned Index,
bool ResourceState::isReady(unsigned NumUnits) const { bool ResourceState::isReady(unsigned NumUnits) const {
return (!isReserved() || isADispatchHazard()) && return (!isReserved() || isADispatchHazard()) &&
llvm::countPopulation(ReadyMask) >= NumUnits; countPopulation(ReadyMask) >= NumUnits;
} }
ResourceStateEvent ResourceState::isBufferAvailable() const { ResourceStateEvent ResourceState::isBufferAvailable() const {
@ -87,7 +87,7 @@ void ResourceState::dump() const {
#endif #endif
static unsigned getResourceStateIndex(uint64_t Mask) { static unsigned getResourceStateIndex(uint64_t Mask) {
return std::numeric_limits<uint64_t>::digits - llvm::countLeadingZeros(Mask); return std::numeric_limits<uint64_t>::digits - countLeadingZeros(Mask);
} }
static std::unique_ptr<ResourceStrategy> static std::unique_ptr<ResourceStrategy>

View File

@ -21,7 +21,7 @@ using namespace llvm;
namespace mca { namespace mca {
RetireControlUnit::RetireControlUnit(const llvm::MCSchedModel &SM) RetireControlUnit::RetireControlUnit(const MCSchedModel &SM)
: NextAvailableSlotIdx(0), CurrentInstructionSlotIdx(0), : NextAvailableSlotIdx(0), CurrentInstructionSlotIdx(0),
AvailableSlots(SM.MicroOpBufferSize), MaxRetirePerCycle(0) { AvailableSlots(SM.MicroOpBufferSize), MaxRetirePerCycle(0) {
// Check if the scheduling model provides extra information about the machine // Check if the scheduling model provides extra information about the machine

View File

@ -64,8 +64,7 @@ static void initializeUsedResources(InstrDesc &ID,
// Sort elements by mask popcount, so that we prioritize resource units over // Sort elements by mask popcount, so that we prioritize resource units over
// resource groups, and smaller groups over larger groups. // resource groups, and smaller groups over larger groups.
llvm::sort(Worklist, sort(Worklist, [](const ResourcePlusCycles &A, const ResourcePlusCycles &B) {
[](const ResourcePlusCycles &A, const ResourcePlusCycles &B) {
unsigned popcntA = countPopulation(A.first); unsigned popcntA = countPopulation(A.first);
unsigned popcntB = countPopulation(B.first); unsigned popcntB = countPopulation(B.first);
if (popcntA < popcntB) if (popcntA < popcntB)
@ -351,7 +350,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) {
const MCSchedClassDesc &SCDesc = *SM.getSchedClassDesc(SchedClassID); const MCSchedClassDesc &SCDesc = *SM.getSchedClassDesc(SchedClassID);
if (SCDesc.NumMicroOps == MCSchedClassDesc::InvalidNumMicroOps) { if (SCDesc.NumMicroOps == MCSchedClassDesc::InvalidNumMicroOps) {
std::string ToString; std::string ToString;
llvm::raw_string_ostream OS(ToString); raw_string_ostream OS(ToString);
WithColor::error() << "found an unsupported instruction in the input" WithColor::error() << "found an unsupported instruction in the input"
<< " assembly sequence.\n"; << " assembly sequence.\n";
MCIP.printInst(&MCI, OS, "", STI); MCIP.printInst(&MCI, OS, "", STI);

View File

@ -133,7 +133,7 @@ void Instruction::execute() {
void Instruction::update() { void Instruction::update() {
assert(isDispatched() && "Unexpected instruction stage found!"); assert(isDispatched() && "Unexpected instruction stage found!");
if (!llvm::all_of(Uses, [](const UniqueUse &Use) { return Use->isReady(); })) if (!all_of(Uses, [](const UniqueUse &Use) { return Use->isReady(); }))
return; return;
// A partial register write cannot complete before a dependent write. // A partial register write cannot complete before a dependent write.
@ -147,7 +147,7 @@ void Instruction::update() {
return true; return true;
}; };
if (llvm::all_of(Defs, IsDefReady)) if (all_of(Defs, IsDefReady))
Stage = IS_READY; Stage = IS_READY;
} }

View File

@ -31,26 +31,26 @@ void Pipeline::addEventListener(HWEventListener *Listener) {
} }
bool Pipeline::hasWorkToProcess() { bool Pipeline::hasWorkToProcess() {
return llvm::any_of(Stages, [](const std::unique_ptr<Stage> &S) { return any_of(Stages, [](const std::unique_ptr<Stage> &S) {
return S->hasWorkToComplete(); return S->hasWorkToComplete();
}); });
} }
llvm::Error Pipeline::run() { Error Pipeline::run() {
assert(!Stages.empty() && "Unexpected empty pipeline found!"); assert(!Stages.empty() && "Unexpected empty pipeline found!");
while (hasWorkToProcess()) { while (hasWorkToProcess()) {
notifyCycleBegin(); notifyCycleBegin();
if (llvm::Error Err = runCycle()) if (Error Err = runCycle())
return Err; return Err;
notifyCycleEnd(); notifyCycleEnd();
++Cycles; ++Cycles;
} }
return llvm::ErrorSuccess(); return ErrorSuccess();
} }
llvm::Error Pipeline::runCycle() { Error Pipeline::runCycle() {
llvm::Error Err = llvm::ErrorSuccess(); Error Err = ErrorSuccess();
// Update stages before we start processing new instructions. // Update stages before we start processing new instructions.
for (auto I = Stages.rbegin(), E = Stages.rend(); I != E && !Err; ++I) { for (auto I = Stages.rbegin(), E = Stages.rend(); I != E && !Err; ++I) {
const std::unique_ptr<Stage> &S = *I; const std::unique_ptr<Stage> &S = *I;

View File

@ -85,7 +85,7 @@ void DispatchStage::updateRAWDependencies(ReadState &RS,
} }
} }
llvm::Error DispatchStage::dispatch(InstRef IR) { Error DispatchStage::dispatch(InstRef IR) {
assert(!CarryOver && "Cannot dispatch another instruction!"); assert(!CarryOver && "Cannot dispatch another instruction!");
Instruction &IS = *IR.getInstruction(); Instruction &IS = *IR.getInstruction();
const InstrDesc &Desc = IS.getDesc(); const InstrDesc &Desc = IS.getDesc();
@ -128,10 +128,10 @@ llvm::Error DispatchStage::dispatch(InstRef IR) {
return moveToTheNextStage(IR); return moveToTheNextStage(IR);
} }
llvm::Error DispatchStage::cycleStart() { Error DispatchStage::cycleStart() {
if (!CarryOver) { if (!CarryOver) {
AvailableEntries = DispatchWidth; AvailableEntries = DispatchWidth;
return llvm::ErrorSuccess(); return ErrorSuccess();
} }
AvailableEntries = CarryOver >= DispatchWidth ? 0 : DispatchWidth - CarryOver; AvailableEntries = CarryOver >= DispatchWidth ? 0 : DispatchWidth - CarryOver;
@ -143,7 +143,7 @@ llvm::Error DispatchStage::cycleStart() {
notifyInstructionDispatched(CarriedOver, RegisterFiles, DispatchedOpcodes); notifyInstructionDispatched(CarriedOver, RegisterFiles, DispatchedOpcodes);
if (!CarryOver) if (!CarryOver)
CarriedOver = InstRef(); CarriedOver = InstRef();
return llvm::ErrorSuccess(); return ErrorSuccess();
} }
bool DispatchStage::isAvailable(const InstRef &IR) const { bool DispatchStage::isAvailable(const InstRef &IR) const {
@ -157,7 +157,7 @@ bool DispatchStage::isAvailable(const InstRef &IR) const {
return canDispatch(IR); return canDispatch(IR);
} }
llvm::Error DispatchStage::execute(InstRef &IR) { Error DispatchStage::execute(InstRef &IR) {
assert(canDispatch(IR) && "Cannot dispatch another instruction!"); assert(canDispatch(IR) && "Cannot dispatch another instruction!");
return dispatch(IR); return dispatch(IR);
} }

View File

@ -85,9 +85,9 @@ Error ExecuteStage::issueReadyInstructions() {
} }
Error ExecuteStage::cycleStart() { Error ExecuteStage::cycleStart() {
llvm::SmallVector<ResourceRef, 8> Freed; SmallVector<ResourceRef, 8> Freed;
llvm::SmallVector<InstRef, 4> Executed; SmallVector<InstRef, 4> Executed;
llvm::SmallVector<InstRef, 4> Ready; SmallVector<InstRef, 4> Ready;
HWS.cycleEvent(Freed, Executed, Ready); HWS.cycleEvent(Freed, Executed, Ready);