mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[llvm-mca] Removed a couple of redundant method declarations, and simplified code in ResourcePressureView. NFC
llvm-svn: 345259
This commit is contained in:
parent
1740b2ec6f
commit
21595f4d2b
@ -20,7 +20,10 @@ namespace mca {
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
void ResourcePressureView::initialize() {
|
||||
ResourcePressureView::ResourcePressureView(const llvm::MCSubtargetInfo &sti,
|
||||
llvm::MCInstPrinter &Printer,
|
||||
const SourceMgr &Sequence)
|
||||
: STI(sti), MCIP(Printer), Source(Sequence) {
|
||||
// Populate the map of resource descriptors.
|
||||
unsigned R2VIndex = 0;
|
||||
const MCSchedModel &SM = STI.getSchedModel();
|
||||
@ -92,8 +95,7 @@ static void printResourcePressure(formatted_raw_ostream &OS, double Pressure,
|
||||
OS.PadToColumn(Col);
|
||||
}
|
||||
|
||||
void ResourcePressureView::printResourcePressurePerIteration(
|
||||
raw_ostream &OS, unsigned Executions) const {
|
||||
void ResourcePressureView::printResourcePressurePerIter(raw_ostream &OS) const {
|
||||
std::string Buffer;
|
||||
raw_string_ostream TempStream(Buffer);
|
||||
formatted_raw_ostream FOS(TempStream);
|
||||
@ -126,6 +128,7 @@ void ResourcePressureView::printResourcePressurePerIteration(
|
||||
FOS << '\n';
|
||||
FOS.flush();
|
||||
|
||||
const unsigned Executions = Source.getNumIterations();
|
||||
for (unsigned I = 0, E = NumResourceUnits; I < E; ++I) {
|
||||
double Usage = ResourceUsage[I + Source.size() * E];
|
||||
printResourcePressure(FOS, Usage / Executions, (I + 1) * 7);
|
||||
@ -135,8 +138,7 @@ void ResourcePressureView::printResourcePressurePerIteration(
|
||||
OS << Buffer;
|
||||
}
|
||||
|
||||
void ResourcePressureView::printResourcePressurePerInstruction(
|
||||
raw_ostream &OS, unsigned Executions) const {
|
||||
void ResourcePressureView::printResourcePressurePerInst(raw_ostream &OS) const {
|
||||
std::string Buffer;
|
||||
raw_string_ostream TempStream(Buffer);
|
||||
formatted_raw_ostream FOS(TempStream);
|
||||
@ -149,6 +151,7 @@ void ResourcePressureView::printResourcePressurePerInstruction(
|
||||
raw_string_ostream InstrStream(Instruction);
|
||||
|
||||
unsigned InstrIndex = 0;
|
||||
const unsigned Executions = Source.getNumIterations();
|
||||
for (const MCInst &MCI : Source) {
|
||||
unsigned BaseEltIdx = InstrIndex * NumResourceUnits;
|
||||
for (unsigned J = 0; J < NumResourceUnits; ++J) {
|
||||
|
@ -82,26 +82,17 @@ class ResourcePressureView : public View {
|
||||
std::vector<ResourceCycles> ResourceUsage;
|
||||
unsigned NumResourceUnits;
|
||||
|
||||
const llvm::MCInst &GetMCInstFromIndex(unsigned Index) const;
|
||||
void printResourcePressurePerIteration(llvm::raw_ostream &OS,
|
||||
unsigned Executions) const;
|
||||
void printResourcePressurePerInstruction(llvm::raw_ostream &OS,
|
||||
unsigned Executions) const;
|
||||
void initialize();
|
||||
void printResourcePressurePerIter(llvm::raw_ostream &OS) const;
|
||||
void printResourcePressurePerInst(llvm::raw_ostream &OS) const;
|
||||
|
||||
public:
|
||||
ResourcePressureView(const llvm::MCSubtargetInfo &sti,
|
||||
llvm::MCInstPrinter &Printer, const SourceMgr &SM)
|
||||
: STI(sti), MCIP(Printer), Source(SM) {
|
||||
initialize();
|
||||
}
|
||||
llvm::MCInstPrinter &Printer, const SourceMgr &SM);
|
||||
|
||||
void onEvent(const HWInstructionEvent &Event) override;
|
||||
|
||||
void printView(llvm::raw_ostream &OS) const override {
|
||||
unsigned Executions = Source.getNumIterations();
|
||||
printResourcePressurePerIteration(OS, Executions);
|
||||
printResourcePressurePerInstruction(OS, Executions);
|
||||
printResourcePressurePerIter(OS);
|
||||
printResourcePressurePerInst(OS);
|
||||
}
|
||||
};
|
||||
} // namespace mca
|
||||
|
@ -48,9 +48,7 @@ public:
|
||||
RetireControlUnitStatistics() : NumRetired(0), NumCycles(0) {}
|
||||
|
||||
void onEvent(const HWInstructionEvent &Event) override;
|
||||
|
||||
void onCycleBegin() override { NumCycles++; }
|
||||
|
||||
void onCycleEnd() override { updateHistograms(); }
|
||||
|
||||
void printView(llvm::raw_ostream &OS) const override;
|
||||
|
@ -70,9 +70,7 @@ public:
|
||||
Usage(STI.getSchedModel().NumProcResourceKinds, {0, 0, 0}) {}
|
||||
|
||||
void onEvent(const HWInstructionEvent &Event) override;
|
||||
|
||||
void onCycleBegin() override { NumCycles++; }
|
||||
|
||||
void onCycleEnd() override { updateHistograms(); }
|
||||
|
||||
// Increases the number of used scheduler queue slots of every buffered
|
||||
|
@ -66,7 +66,6 @@ public:
|
||||
unsigned Width);
|
||||
|
||||
void onCycleEnd() override { ++TotalCycles; }
|
||||
|
||||
void onEvent(const HWInstructionEvent &Event) override;
|
||||
|
||||
void printView(llvm::raw_ostream &OS) const override;
|
||||
|
@ -62,20 +62,8 @@ class InstrBuilder {
|
||||
const llvm::MCInst &MCI) const;
|
||||
|
||||
public:
|
||||
InstrBuilder(const llvm::MCSubtargetInfo &sti, const llvm::MCInstrInfo &mcii,
|
||||
const llvm::MCRegisterInfo &mri,
|
||||
const llvm::MCInstrAnalysis &mcia)
|
||||
: STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) {
|
||||
computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
|
||||
}
|
||||
|
||||
// Returns an array of processor resource masks.
|
||||
// Masks are computed by function mca::computeProcResourceMasks. see
|
||||
// Support.h for a description of how masks are computed and how masks can be
|
||||
// used to solve set membership problems.
|
||||
llvm::ArrayRef<uint64_t> getProcResourceMasks() const {
|
||||
return ProcResourceMasks;
|
||||
}
|
||||
InstrBuilder(const llvm::MCSubtargetInfo &STI, const llvm::MCInstrInfo &MCII,
|
||||
const llvm::MCRegisterInfo &RI, const llvm::MCInstrAnalysis &IA);
|
||||
|
||||
void clear() { VariantDescriptors.shrink_and_clear(); }
|
||||
|
||||
|
@ -26,6 +26,14 @@ namespace mca {
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti,
|
||||
const llvm::MCInstrInfo &mcii,
|
||||
const llvm::MCRegisterInfo &mri,
|
||||
const llvm::MCInstrAnalysis &mcia)
|
||||
: STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) {
|
||||
computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
|
||||
}
|
||||
|
||||
static void initializeUsedResources(InstrDesc &ID,
|
||||
const MCSchedClassDesc &SCDesc,
|
||||
const MCSubtargetInfo &STI,
|
||||
|
Loading…
Reference in New Issue
Block a user