microinstruction: Implement Inst::AreAllArgsImmediates
This commit is contained in:
parent
22804dc6a5
commit
5f7ffe0d0b
2 changed files with 9 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
||||||
* General Public License version 2 or any later version.
|
* General Public License version 2 or any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "frontend/ir/microinstruction.h"
|
#include "frontend/ir/microinstruction.h"
|
||||||
|
|
||||||
|
@ -240,6 +242,10 @@ bool Inst::MayHaveSideEffects() const {
|
||||||
IsCoprocessorInstruction();
|
IsCoprocessorInstruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Inst::AreAllArgsImmediates() const {
|
||||||
|
return std::all_of(args.begin(), args.begin() + NumArgs(), [](const auto& value){ return value.IsImmediate(); });
|
||||||
|
}
|
||||||
|
|
||||||
void Inst::DecrementRemainingUses() {
|
void Inst::DecrementRemainingUses() {
|
||||||
ASSERT_MSG(HasUses(), "Microinstruction doesn't have any remaining uses");
|
ASSERT_MSG(HasUses(), "Microinstruction doesn't have any remaining uses");
|
||||||
use_count--;
|
use_count--;
|
||||||
|
|
|
@ -76,6 +76,9 @@ public:
|
||||||
/// Determines whether or not this instruction may have side-effects.
|
/// Determines whether or not this instruction may have side-effects.
|
||||||
bool MayHaveSideEffects() const;
|
bool MayHaveSideEffects() const;
|
||||||
|
|
||||||
|
/// Determines if all arguments of this instruction are immediates.
|
||||||
|
bool AreAllArgsImmediates() const;
|
||||||
|
|
||||||
size_t UseCount() const { return use_count; }
|
size_t UseCount() const { return use_count; }
|
||||||
bool HasUses() const { return use_count > 0; }
|
bool HasUses() const { return use_count > 0; }
|
||||||
void DecrementRemainingUses();
|
void DecrementRemainingUses();
|
||||||
|
|
Loading…
Reference in a new issue