1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[MCA] Make the bool conversion operator in class InstRef explicit. NFCI

This patch makes the bool conversion operator in InstRef explicit.
It also adds a operator< to hel comparing InstRef objects in sets.

llvm-svn: 361482
This commit is contained in:
Andrea Di Biagio 2019-05-23 10:50:01 +00:00
parent af457897d6
commit c10551d172
2 changed files with 8 additions and 2 deletions

View File

@ -526,13 +526,17 @@ public:
InstRef(unsigned Index, Instruction *I) : Data(std::make_pair(Index, I)) {}
bool operator==(const InstRef &Other) const { return Data == Other.Data; }
bool operator!=(const InstRef &Other) const { return Data != Other.Data; }
bool operator<(const InstRef &Other) const {
return Data.first < Other.Data.first;
}
unsigned getSourceIndex() const { return Data.first; }
Instruction *getInstruction() { return Data.second; }
const Instruction *getInstruction() const { return Data.second; }
/// Returns true if this references a valid instruction.
operator bool() const { return Data.second != nullptr; }
explicit operator bool() const { return Data.second != nullptr; }
/// Invalidate this reference.
void invalidate() { Data.second = nullptr; }

View File

@ -18,7 +18,9 @@
namespace llvm {
namespace mca {
bool EntryStage::hasWorkToComplete() const { return CurrentInstruction; }
bool EntryStage::hasWorkToComplete() const {
return static_cast<bool>(CurrentInstruction);
}
bool EntryStage::isAvailable(const InstRef & /* unused */) const {
if (CurrentInstruction)