const MCWriteLatencyEntry &WLE =
*STI.getWriteLatencyEntry(&SCDesc, CurrentDef);
// Conservatively default to MaxLatency.
- Write.Latency = WLE.Cycles == -1 ? ID.MaxLatency : WLE.Cycles;
+ Write.Latency = WLE.Cycles < 0 ? ID.MaxLatency
+ : static_cast<unsigned>(WLE.Cycles);
Write.SClassOrWriteResourceID = WLE.WriteResourceID;
} else {
// Assign a default latency for this write.
const MCWriteLatencyEntry &WLE =
*STI.getWriteLatencyEntry(&SCDesc, Index);
// Conservatively default to MaxLatency.
- Write.Latency = WLE.Cycles == -1 ? ID.MaxLatency : WLE.Cycles;
+ Write.Latency = WLE.Cycles < 0 ? ID.MaxLatency
+ : static_cast<unsigned>(WLE.Cycles);
Write.SClassOrWriteResourceID = WLE.WriteResourceID;
} else {
// Assign a default latency for this write.
void WriteState::onInstructionIssued() {
assert(CyclesLeft == UNKNOWN_CYCLES);
// Update the number of cycles left based on the WriteDescriptor info.
- CyclesLeft = WD.Latency;
+ CyclesLeft = getLatency();
// Now that the time left before write-back is known, notify
// all the users.
#ifndef NDEBUG
void WriteState::dump() const {
- dbgs() << "{ OpIdx=" << WD.OpIndex << ", Lat=" << WD.Latency << ", RegID "
+ dbgs() << "{ OpIdx=" << WD.OpIndex << ", Lat=" << getLatency() << ", RegID "
<< getRegisterID() << ", Cycles Left=" << getCyclesLeft() << " }";
}
namespace mca {
-struct WriteDescriptor;
-struct ReadDescriptor;
-class WriteState;
-class ReadState;
-
constexpr int UNKNOWN_CYCLES = -512;
/// A register write descriptor.
// a bitwise not of the OpIndex.
int OpIndex;
// Write latency. Number of cycles before write-back stage.
- int Latency;
+ unsigned Latency;
// This field is set to a value different than zero only if this
// is an implicit definition.
unsigned RegisterID;
bool isImplicitRead() const { return OpIndex < 0; };
};
+class ReadState;
+
/// Tracks uses of a register definition (e.g. register write).
///
/// Each implicit/explicit register write is associated with an instance of
int getCyclesLeft() const { return CyclesLeft; }
unsigned getWriteResourceID() const { return WD.SClassOrWriteResourceID; }
unsigned getRegisterID() const { return RegisterID; }
+ unsigned getLatency() const { return WD.Latency; }
void addUser(ReadState *Use, int ReadAdvance);
unsigned getNumUsers() const { return Users.size(); }