microinstruction: Make use_count private (#53)

Makes the operation a part of the direct interface.
This commit is contained in:
Mat M 2016-11-30 16:51:06 -05:00 committed by Merry
parent 3621a925b2
commit de1f831d79
6 changed files with 31 additions and 32 deletions

View file

@ -217,7 +217,11 @@ bool Inst::MayHaveSideEffects() const {
WritesToFPSCR() ||
AltersExclusiveState() ||
IsMemoryWrite();
}
void Inst::DecrementRemainingUses() {
ASSERT_MSG(HasUses(), "Microinstruction doesn't have any remaining uses");
use_count--;
}
Inst* Inst::GetAssociatedPseudoOperation(Opcode opcode) {

View file

@ -73,7 +73,10 @@ public:
/// Determines whether or not this instruction may have side-effects.
bool MayHaveSideEffects() const;
size_t UseCount() const { return use_count; }
bool HasUses() const { return use_count > 0; }
void DecrementRemainingUses();
/// Gets a pseudo-operation associated with this instruction.
Inst* GetAssociatedPseudoOperation(Opcode opcode);
@ -91,13 +94,12 @@ public:
void ReplaceUsesWith(Value& replacement);
size_t use_count = 0;
private:
void Use(Value& value);
void UndoUse(Value& value);
Opcode op;
size_t use_count = 0;
std::array<Value, 3> args;
Inst* carry_inst = nullptr;