microinstruction: Implement Inst::AreAllArgsImmediates

This commit is contained in:
MerryMage
2017-01-29 22:54:54 +00:00
parent 22804dc6a5
commit 5f7ffe0d0b
2 changed files with 9 additions and 0 deletions

View File

@@ -4,6 +4,8 @@
* General Public License version 2 or any later version.
*/
#include <algorithm>
#include "common/assert.h"
#include "frontend/ir/microinstruction.h"
@@ -240,6 +242,10 @@ bool Inst::MayHaveSideEffects() const {
IsCoprocessorInstruction();
}
bool Inst::AreAllArgsImmediates() const {
return std::all_of(args.begin(), args.begin() + NumArgs(), [](const auto& value){ return value.IsImmediate(); });
}
void Inst::DecrementRemainingUses() {
ASSERT_MSG(HasUses(), "Microinstruction doesn't have any remaining uses");
use_count--;