Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit d510dbf

Browse files
committed
[llvm-mca] Remove namespace prefixes made redundant by r345612. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345730 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 5406c80 commit d510dbf

18 files changed

+129
-149
lines changed

tools/llvm-mca/include/Context.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ struct PipelineOptions {
4343
};
4444

4545
class Context {
46-
llvm::SmallVector<std::unique_ptr<HardwareUnit>, 4> Hardware;
47-
const llvm::MCRegisterInfo &MRI;
48-
const llvm::MCSubtargetInfo &STI;
46+
SmallVector<std::unique_ptr<HardwareUnit>, 4> Hardware;
47+
const MCRegisterInfo &MRI;
48+
const MCSubtargetInfo &STI;
4949

5050
public:
51-
Context(const llvm::MCRegisterInfo &R, const llvm::MCSubtargetInfo &S)
52-
: MRI(R), STI(S) {}
51+
Context(const MCRegisterInfo &R, const MCSubtargetInfo &S) : MRI(R), STI(S) {}
5352
Context(const Context &C) = delete;
5453
Context &operator=(const Context &C) = delete;
5554

tools/llvm-mca/include/HWEventListener.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,22 @@ class HWInstructionEvent {
6262
class HWInstructionIssuedEvent : public HWInstructionEvent {
6363
public:
6464
using ResourceRef = std::pair<uint64_t, uint64_t>;
65-
HWInstructionIssuedEvent(
66-
const InstRef &IR,
67-
llvm::ArrayRef<std::pair<ResourceRef, ResourceCycles>> UR)
65+
HWInstructionIssuedEvent(const InstRef &IR,
66+
ArrayRef<std::pair<ResourceRef, ResourceCycles>> UR)
6867
: HWInstructionEvent(HWInstructionEvent::Issued, IR), UsedResources(UR) {}
6968

70-
llvm::ArrayRef<std::pair<ResourceRef, ResourceCycles>> UsedResources;
69+
ArrayRef<std::pair<ResourceRef, ResourceCycles>> UsedResources;
7170
};
7271

7372
class HWInstructionDispatchedEvent : public HWInstructionEvent {
7473
public:
75-
HWInstructionDispatchedEvent(const InstRef &IR, llvm::ArrayRef<unsigned> Regs,
74+
HWInstructionDispatchedEvent(const InstRef &IR, ArrayRef<unsigned> Regs,
7675
unsigned UOps)
7776
: HWInstructionEvent(HWInstructionEvent::Dispatched, IR),
7877
UsedPhysRegs(Regs), MicroOpcodes(UOps) {}
7978
// Number of physical register allocated for this instruction. There is one
8079
// entry per register file.
81-
llvm::ArrayRef<unsigned> UsedPhysRegs;
80+
ArrayRef<unsigned> UsedPhysRegs;
8281
// Number of micro opcodes dispatched.
8382
// This field is often set to the total number of micro-opcodes specified by
8483
// the instruction descriptor of IR.
@@ -93,12 +92,12 @@ class HWInstructionDispatchedEvent : public HWInstructionEvent {
9392

9493
class HWInstructionRetiredEvent : public HWInstructionEvent {
9594
public:
96-
HWInstructionRetiredEvent(const InstRef &IR, llvm::ArrayRef<unsigned> Regs)
95+
HWInstructionRetiredEvent(const InstRef &IR, ArrayRef<unsigned> Regs)
9796
: HWInstructionEvent(HWInstructionEvent::Retired, IR),
9897
FreedPhysRegs(Regs) {}
9998
// Number of register writes that have been architecturally committed. There
10099
// is one entry per register file.
101-
llvm::ArrayRef<unsigned> FreedPhysRegs;
100+
ArrayRef<unsigned> FreedPhysRegs;
102101
};
103102

104103
// A HWStallEvent represents a pipeline stall caused by the lack of hardware
@@ -142,9 +141,9 @@ class HWEventListener {
142141
// Events generated by the Scheduler when buffered resources are
143142
// consumed/freed for an instruction.
144143
virtual void onReservedBuffers(const InstRef &Inst,
145-
llvm::ArrayRef<unsigned> Buffers) {}
144+
ArrayRef<unsigned> Buffers) {}
146145
virtual void onReleasedBuffers(const InstRef &Inst,
147-
llvm::ArrayRef<unsigned> Buffers) {}
146+
ArrayRef<unsigned> Buffers) {}
148147

149148
virtual ~HWEventListener() {}
150149

tools/llvm-mca/include/HardwareUnits/LSUnit.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ class LSUnit : public HardwareUnit {
129129
void dump() const;
130130
#endif
131131

132-
enum Status {
133-
LSU_AVAILABLE = 0,
134-
LSU_LQUEUE_FULL,
135-
LSU_SQUEUE_FULL
136-
};
132+
enum Status { LSU_AVAILABLE = 0, LSU_LQUEUE_FULL, LSU_SQUEUE_FULL };
137133

138134
// Returns LSU_AVAILABLE if there are enough load/store queue entries to serve
139135
// IR. It also returns LSU_AVAILABLE if IR is not a memory operation.

tools/llvm-mca/include/HardwareUnits/RegisterFile.h

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class WriteRef;
3434
/// Manages hardware register files, and tracks register definitions for
3535
/// register renaming purposes.
3636
class RegisterFile : public HardwareUnit {
37-
const llvm::MCRegisterInfo &MRI;
37+
const MCRegisterInfo &MRI;
3838

3939
// class RegisterMappingTracker is a physical register file (PRF) descriptor.
4040
// There is one RegisterMappingTracker for every PRF definition in the
@@ -85,7 +85,7 @@ class RegisterFile : public HardwareUnit {
8585
//
8686
// Users can limit the number of physical registers that are available in
8787
// regsiter file #0 specifying command line flag `-register-file-size=<uint>`.
88-
llvm::SmallVector<RegisterMappingTracker, 4> RegisterFiles;
88+
SmallVector<RegisterMappingTracker, 4> RegisterFiles;
8989

9090
// This type is used to propagate information about the owner of a register,
9191
// and the cost of allocating it in the PRF. Register cost is defined as the
@@ -101,7 +101,7 @@ class RegisterFile : public HardwareUnit {
101101
//
102102
// There is a RegisterRenamingInfo object for every logical register defined
103103
// by the target. RegisteRenamingInfo objects are stored into vector
104-
// `RegisterMappings`, and llvm::MCPhysReg IDs can be used to reference
104+
// `RegisterMappings`, and MCPhysReg IDs can be used to reference
105105
// elements in that vector.
106106
//
107107
// Each RegisterRenamingInfo is owned by a PRF, and field `IndexPlusCost`
@@ -117,8 +117,8 @@ class RegisterFile : public HardwareUnit {
117117
// register definition.
118118
struct RegisterRenamingInfo {
119119
IndexPlusCostPairTy IndexPlusCost;
120-
llvm::MCPhysReg RenameAs;
121-
llvm::MCPhysReg AliasRegID;
120+
MCPhysReg RenameAs;
121+
MCPhysReg AliasRegID;
122122
bool AllowMoveElimination;
123123
RegisterRenamingInfo()
124124
: IndexPlusCost(std::make_pair(0U, 1U)), RenameAs(0U), AliasRegID(0U),
@@ -144,7 +144,7 @@ class RegisterFile : public HardwareUnit {
144144

145145
// Used to track zero registers. There is one bit for each register defined by
146146
// the target. Bits are set for registers that are known to be zero.
147-
llvm::APInt ZeroRegisters;
147+
APInt ZeroRegisters;
148148

149149
// This method creates a new register file descriptor.
150150
// The new register file owns all of the registers declared by register
@@ -160,41 +160,40 @@ class RegisterFile : public HardwareUnit {
160160
// Here FPRegisterFile contains all the registers defined by register class
161161
// VR128RegClass and VR256RegClass. FPRegisterFile implements 60
162162
// registers which can be used for register renaming purpose.
163-
void addRegisterFile(const llvm::MCRegisterFileDesc &RF,
164-
llvm::ArrayRef<llvm::MCRegisterCostEntry> Entries);
163+
void addRegisterFile(const MCRegisterFileDesc &RF,
164+
ArrayRef<MCRegisterCostEntry> Entries);
165165

166166
// Consumes physical registers in each register file specified by the
167167
// `IndexPlusCostPairTy`. This method is called from `addRegisterMapping()`.
168168
void allocatePhysRegs(const RegisterRenamingInfo &Entry,
169-
llvm::MutableArrayRef<unsigned> UsedPhysRegs);
169+
MutableArrayRef<unsigned> UsedPhysRegs);
170170

171171
// Releases previously allocated physical registers from the register file(s).
172172
// This method is called from `invalidateRegisterMapping()`.
173173
void freePhysRegs(const RegisterRenamingInfo &Entry,
174-
llvm::MutableArrayRef<unsigned> FreedPhysRegs);
174+
MutableArrayRef<unsigned> FreedPhysRegs);
175175

176176
// Create an instance of RegisterMappingTracker for every register file
177177
// specified by the processor model.
178178
// If no register file is specified, then this method creates a default
179179
// register file with an unbounded number of physical registers.
180-
void initialize(const llvm::MCSchedModel &SM, unsigned NumRegs);
180+
void initialize(const MCSchedModel &SM, unsigned NumRegs);
181181

182182
public:
183-
RegisterFile(const llvm::MCSchedModel &SM, const llvm::MCRegisterInfo &mri,
183+
RegisterFile(const MCSchedModel &SM, const MCRegisterInfo &mri,
184184
unsigned NumRegs = 0);
185185

186186
// This method updates the register mappings inserting a new register
187187
// definition. This method is also responsible for updating the number of
188188
// allocated physical registers in each register file modified by the write.
189189
// No physical regiser is allocated if this write is from a zero-idiom.
190-
void addRegisterWrite(WriteRef Write,
191-
llvm::MutableArrayRef<unsigned> UsedPhysRegs);
190+
void addRegisterWrite(WriteRef Write, MutableArrayRef<unsigned> UsedPhysRegs);
192191

193192
// Removes write \param WS from the register mappings.
194193
// Physical registers may be released to reflect this update.
195194
// No registers are released if this write is from a zero-idiom.
196195
void removeRegisterWrite(const WriteState &WS,
197-
llvm::MutableArrayRef<unsigned> FreedPhysRegs);
196+
MutableArrayRef<unsigned> FreedPhysRegs);
198197

199198
// Returns true if a move from RS to WS can be eliminated.
200199
// On success, it updates WriteState by setting flag `WS.isEliminated`.
@@ -212,9 +211,8 @@ class RegisterFile : public HardwareUnit {
212211
//
213212
// Current implementation can simulate up to 32 register files (including the
214213
// special register file at index #0).
215-
unsigned isAvailable(llvm::ArrayRef<unsigned> Regs) const;
216-
void collectWrites(llvm::SmallVectorImpl<WriteRef> &Writes,
217-
unsigned RegID) const;
214+
unsigned isAvailable(ArrayRef<unsigned> Regs) const;
215+
void collectWrites(SmallVectorImpl<WriteRef> &Writes, unsigned RegID) const;
218216
unsigned getNumRegisterFiles() const { return RegisterFiles.size(); }
219217

220218
// Notify each PRF that a new cycle just started.

tools/llvm-mca/include/HardwareUnits/ResourceManager.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ class ResourceState {
189189
}
190190

191191
public:
192-
ResourceState(const llvm::MCProcResourceDesc &Desc, unsigned Index,
193-
uint64_t Mask);
192+
ResourceState(const MCProcResourceDesc &Desc, unsigned Index, uint64_t Mask);
194193

195194
unsigned getProcResourceID() const { return ProcResourceDescIndex; }
196195
uint64_t getResourceMask() const { return ResourceMask; }
@@ -211,9 +210,7 @@ class ResourceState {
211210
/// `NumUnits` available units.
212211
bool isReady(unsigned NumUnits = 1) const;
213212

214-
bool isAResourceGroup() const {
215-
return llvm::countPopulation(ResourceMask) > 1;
216-
}
213+
bool isAResourceGroup() const { return countPopulation(ResourceMask) > 1; }
217214

218215
bool containsResource(uint64_t ID) const { return ResourceMask & ID; }
219216

@@ -228,7 +225,7 @@ class ResourceState {
228225
}
229226

230227
unsigned getNumUnits() const {
231-
return isAResourceGroup() ? 1U : llvm::countPopulation(ResourceSizeMask);
228+
return isAResourceGroup() ? 1U : countPopulation(ResourceSizeMask);
232229
}
233230

234231
/// Checks if there is an available slot in the resource buffer.
@@ -286,10 +283,10 @@ class ResourceManager {
286283

287284
// Keeps track of which resources are busy, and how many cycles are left
288285
// before those become usable again.
289-
llvm::SmallDenseMap<ResourceRef, unsigned> BusyResources;
286+
SmallDenseMap<ResourceRef, unsigned> BusyResources;
290287

291288
// A table to map processor resource IDs to processor resource masks.
292-
llvm::SmallVector<uint64_t, 8> ProcResID2Mask;
289+
SmallVector<uint64_t, 8> ProcResID2Mask;
293290

294291
// Returns the actual resource unit that will be used.
295292
ResourceRef selectPipe(uint64_t ResourceID);
@@ -305,7 +302,7 @@ class ResourceManager {
305302
uint64_t ResourceMask);
306303

307304
public:
308-
ResourceManager(const llvm::MCSchedModel &SM);
305+
ResourceManager(const MCSchedModel &SM);
309306
virtual ~ResourceManager() = default;
310307

311308
// Overrides the selection strategy for the resource at index ResourceID in
@@ -319,17 +316,17 @@ class ResourceManager {
319316

320317
// Returns RS_BUFFER_AVAILABLE if buffered resources are not reserved, and if
321318
// there are enough available slots in the buffers.
322-
ResourceStateEvent canBeDispatched(llvm::ArrayRef<uint64_t> Buffers) const;
319+
ResourceStateEvent canBeDispatched(ArrayRef<uint64_t> Buffers) const;
323320

324321
// Return the processor resource identifier associated to this Mask.
325322
unsigned resolveResourceMask(uint64_t Mask) const;
326323

327324
// Consume a slot in every buffered resource from array 'Buffers'. Resource
328325
// units that are dispatch hazards (i.e. BufferSize=0) are marked as reserved.
329-
void reserveBuffers(llvm::ArrayRef<uint64_t> Buffers);
326+
void reserveBuffers(ArrayRef<uint64_t> Buffers);
330327

331328
// Release buffer entries previously allocated by method reserveBuffers.
332-
void releaseBuffers(llvm::ArrayRef<uint64_t> Buffers);
329+
void releaseBuffers(ArrayRef<uint64_t> Buffers);
333330

334331
// Reserve a processor resource. A reserved resource is not available for
335332
// instruction issue until it is released.
@@ -346,9 +343,9 @@ class ResourceManager {
346343

347344
void issueInstruction(
348345
const InstrDesc &Desc,
349-
llvm::SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Pipes);
346+
SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Pipes);
350347

351-
void cycleEvent(llvm::SmallVectorImpl<ResourceRef> &ResourcesFreed);
348+
void cycleEvent(SmallVectorImpl<ResourceRef> &ResourcesFreed);
352349

353350
#ifndef NDEBUG
354351
void dump() const {

tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct RetireControlUnit : public HardwareUnit {
6363
std::vector<RUToken> Queue;
6464

6565
public:
66-
RetireControlUnit(const llvm::MCSchedModel &SM);
66+
RetireControlUnit(const MCSchedModel &SM);
6767

6868
bool isEmpty() const { return AvailableSlots == Queue.size(); }
6969
bool isAvailable(unsigned Quantity = 1) const {

tools/llvm-mca/include/HardwareUnits/Scheduler.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ class Scheduler : public HardwareUnit {
105105
/// Issue an instruction without updating the ready queue.
106106
void issueInstructionImpl(
107107
InstRef &IR,
108-
llvm::SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Pipes);
108+
SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Pipes);
109109

110110
// Identify instructions that have finished executing, and remove them from
111111
// the IssuedSet. References to executed instructions are added to input
112112
// vector 'Executed'.
113-
void updateIssuedSet(llvm::SmallVectorImpl<InstRef> &Executed);
113+
void updateIssuedSet(SmallVectorImpl<InstRef> &Executed);
114114

115115
// Try to promote instructions from WaitSet to ReadySet.
116116
// Add promoted instructions to the 'Ready' vector in input.
117-
void promoteToReadySet(llvm::SmallVectorImpl<InstRef> &Ready);
117+
void promoteToReadySet(SmallVectorImpl<InstRef> &Ready);
118118

119119
public:
120-
Scheduler(const llvm::MCSchedModel &Model, LSUnit *Lsu)
121-
: LSU(Lsu), Resources(llvm::make_unique<ResourceManager>(Model)) {
120+
Scheduler(const MCSchedModel &Model, LSUnit *Lsu)
121+
: LSU(Lsu), Resources(make_unique<ResourceManager>(Model)) {
122122
initializeStrategy(nullptr);
123123
}
124-
Scheduler(const llvm::MCSchedModel &Model, LSUnit *Lsu,
124+
Scheduler(const MCSchedModel &Model, LSUnit *Lsu,
125125
std::unique_ptr<SchedulerStrategy> SelectStrategy)
126-
: LSU(Lsu), Resources(llvm::make_unique<ResourceManager>(Model)) {
126+
: LSU(Lsu), Resources(make_unique<ResourceManager>(Model)) {
127127
initializeStrategy(std::move(SelectStrategy));
128128
}
129129
Scheduler(std::unique_ptr<ResourceManager> RM, LSUnit *Lsu,
@@ -168,8 +168,8 @@ class Scheduler : public HardwareUnit {
168168
/// result of this event.
169169
void issueInstruction(
170170
InstRef &IR,
171-
llvm::SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Used,
172-
llvm::SmallVectorImpl<InstRef> &Ready);
171+
SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Used,
172+
SmallVectorImpl<InstRef> &Ready);
173173

174174
/// Returns true if IR has to be issued immediately, or if IR is a zero
175175
/// latency instruction.
@@ -182,9 +182,9 @@ class Scheduler : public HardwareUnit {
182182
/// have changed in state, and that are now available to new instructions.
183183
/// Instructions executed are added to vector Executed, while vector Ready is
184184
/// populated with instructions that have become ready in this new cycle.
185-
void cycleEvent(llvm::SmallVectorImpl<ResourceRef> &Freed,
186-
llvm::SmallVectorImpl<InstRef> &Ready,
187-
llvm::SmallVectorImpl<InstRef> &Executed);
185+
void cycleEvent(SmallVectorImpl<ResourceRef> &Freed,
186+
SmallVectorImpl<InstRef> &Ready,
187+
SmallVectorImpl<InstRef> &Executed);
188188

189189
/// Convert a resource mask into a valid llvm processor resource identifier.
190190
unsigned getResourceID(uint64_t Mask) const {
@@ -203,9 +203,9 @@ class Scheduler : public HardwareUnit {
203203
// This routine performs a sanity check. This routine should only be called
204204
// when we know that 'IR' is not in the scheduler's instruction queues.
205205
void sanityCheck(const InstRef &IR) const {
206-
assert(llvm::find(WaitSet, IR) == WaitSet.end());
207-
assert(llvm::find(ReadySet, IR) == ReadySet.end());
208-
assert(llvm::find(IssuedSet, IR) == IssuedSet.end());
206+
assert(find(WaitSet, IR) == WaitSet.end() && "Already in the wait set!");
207+
assert(find(ReadySet, IR) == ReadySet.end() && "Already in the ready set!");
208+
assert(find(IssuedSet, IR) == IssuedSet.end() && "Already executing!");
209209
}
210210
#endif // !NDEBUG
211211
};

0 commit comments

Comments
 (0)