summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/InstrBuilder.h
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-20 12:25:54 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-20 12:25:54 +0000
commit4704f0386bb8a29edb5d014ef7c00ef1b82fe78d (patch)
tree0259e9d0987c641812784514b3e69858e3ab902f /llvm/tools/llvm-mca/InstrBuilder.h
parenta713ebea2456be61281e7570106a842357ce43a1 (diff)
downloadbcm5719-llvm-4704f0386bb8a29edb5d014ef7c00ef1b82fe78d.tar.gz
bcm5719-llvm-4704f0386bb8a29edb5d014ef7c00ef1b82fe78d.zip
[llvm-mca] Move the routine that computes processor resource masks to its own file.
Function computeProcResourceMasks is used by the ResourceManager (owned by the Scheduler) to compute resource masks for processor resources. Before this refactoring, there was an implicit dependency between the Scheduler and the InstrBuilder. That is because InstrBuilder has to know about resource masks when computing the set of processor resources consumed by a new instruction. With this patch, the functionality that computes resource masks has been extracted from the ResourceManager, and moved to a separate file (Support.h). This helps removing the dependency between the Scheduler and the InstrBuilder. No functional change intended. llvm-svn: 327973
Diffstat (limited to 'llvm/tools/llvm-mca/InstrBuilder.h')
-rw-r--r--llvm/tools/llvm-mca/InstrBuilder.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/tools/llvm-mca/InstrBuilder.h b/llvm/tools/llvm-mca/InstrBuilder.h
index 252b68ca5b0..a26b84607b6 100644
--- a/llvm/tools/llvm-mca/InstrBuilder.h
+++ b/llvm/tools/llvm-mca/InstrBuilder.h
@@ -16,6 +16,7 @@
#define LLVM_TOOLS_LLVM_MCA_INSTRBUILDER_H
#include "Instruction.h"
+#include "Support.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
@@ -34,28 +35,26 @@ class DispatchUnit;
/// Information from the machine scheduling model is used to identify processor
/// resources that are consumed by an instruction.
class InstrBuilder {
+ const llvm::MCSubtargetInfo &STI;
const llvm::MCInstrInfo &MCII;
- const llvm::ArrayRef<uint64_t> ProcResourceMasks;
+ llvm::SmallVector<uint64_t, 8> ProcResourceMasks;
llvm::DenseMap<unsigned short, std::unique_ptr<const InstrDesc>> Descriptors;
llvm::DenseMap<unsigned, std::unique_ptr<Instruction>> Instructions;
- void createInstrDescImpl(const llvm::MCSubtargetInfo &STI,
- const llvm::MCInst &MCI);
+ void createInstrDescImpl(const llvm::MCInst &MCI);
public:
- InstrBuilder(const llvm::MCInstrInfo &mcii,
- const llvm::ArrayRef<uint64_t> Masks)
- : MCII(mcii), ProcResourceMasks(Masks) {}
+ InstrBuilder(const llvm::MCSubtargetInfo &sti, const llvm::MCInstrInfo &mcii)
+ : STI(sti), MCII(mcii),
+ ProcResourceMasks(STI.getSchedModel().getNumProcResourceKinds()) {
+ computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
+ }
- const InstrDesc &getOrCreateInstrDesc(const llvm::MCSubtargetInfo &STI,
- const llvm::MCInst &MCI);
+ const InstrDesc &getOrCreateInstrDesc(const llvm::MCInst &MCI);
- Instruction *createInstruction(const llvm::MCSubtargetInfo &STI,
- unsigned Idx,
- const llvm::MCInst &MCI);
+ Instruction *createInstruction(unsigned Idx, const llvm::MCInst &MCI);
};
-
} // namespace mca
#endif
OpenPOWER on IntegriCloud