summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/MCA/Instruction.h6
-rw-r--r--llvm/lib/MCA/HardwareUnits/ResourceManager.cpp1
-rw-r--r--llvm/lib/MCA/InstrBuilder.cpp3
3 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h
index 01d08c1916a..38c7ff4e6b3 100644
--- a/llvm/include/llvm/MCA/Instruction.h
+++ b/llvm/include/llvm/MCA/Instruction.h
@@ -28,6 +28,7 @@
#include <memory>
namespace llvm {
+
namespace mca {
constexpr int UNKNOWN_CYCLES = -512;
@@ -347,6 +348,11 @@ struct InstrDesc {
InstrDesc() = default;
InstrDesc(const InstrDesc &Other) = delete;
InstrDesc &operator=(const InstrDesc &Other) = delete;
+
+#ifndef NDEBUG
+ // Original instruction name for debugging purposes.
+ StringRef Name;
+#endif
};
/// Base class for instructions consumed by the simulation pipeline.
diff --git a/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp b/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp
index b68e996ff9e..e3a0da2dafe 100644
--- a/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp
+++ b/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp
@@ -169,6 +169,7 @@ unsigned ResourceManager::getNumUnits(uint64_t ResourceID) const {
// Second, is the specific sub-resource ID.
ResourceRef ResourceManager::selectPipe(uint64_t ResourceID) {
unsigned Index = getResourceStateIndex(ResourceID);
+ assert(Index < Resources.size() && "Invalid resource use!");
ResourceState &RS = *Resources[Index];
assert(RS.isReady() && "No available units to select!");
diff --git a/llvm/lib/MCA/InstrBuilder.cpp b/llvm/lib/MCA/InstrBuilder.cpp
index d8309b6868e..76881b0982f 100644
--- a/llvm/lib/MCA/InstrBuilder.cpp
+++ b/llvm/lib/MCA/InstrBuilder.cpp
@@ -558,6 +558,9 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) {
populateWrites(*ID, MCI, SchedClassID);
populateReads(*ID, MCI, SchedClassID);
+#ifndef NDEBUG
+ ID->Name = MCII.getName(Opcode);
+#endif
LLVM_DEBUG(dbgs() << "\t\tMaxLatency=" << ID->MaxLatency << '\n');
LLVM_DEBUG(dbgs() << "\t\tNumMicroOps=" << ID->NumMicroOps << '\n');
OpenPOWER on IntegriCloud