ir_opt: Update VerificationPass to current IR
This commit is contained in:
parent
8fc21f481a
commit
9c82a12f8f
1 changed files with 20 additions and 3 deletions
|
@ -4,6 +4,8 @@
|
|||
* General Public License version 2 or any later version.
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "frontend/ir/ir.h"
|
||||
#include "ir_opt/passes.h"
|
||||
|
@ -12,11 +14,26 @@ namespace Dynarmic {
|
|||
namespace Optimization {
|
||||
|
||||
void VerificationPass(const IR::Block& block) {
|
||||
#if 0
|
||||
for (const auto& inst : block.instructions) {
|
||||
inst->AssertValid();
|
||||
for (size_t i = 0; i < inst.NumArgs(); i++) {
|
||||
IR::Type t1 = inst.GetArg(i).GetType();
|
||||
IR::Type t2 = IR::GetArgTypeOf(inst.GetOpcode(), i);
|
||||
ASSERT(t1 == t2 || t1 == IR::Type::Opaque || t2 == IR::Type::Opaque);
|
||||
}
|
||||
}
|
||||
|
||||
std::map<IR::Inst*, size_t> actual_uses;
|
||||
for (const auto& inst : block.instructions) {
|
||||
for (size_t i = 0; i < inst.NumArgs(); i++) {
|
||||
if (!inst.GetArg(i).IsImmediate()) {
|
||||
actual_uses[inst.GetArg(i).GetInst()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& pair : actual_uses) {
|
||||
ASSERT(pair.first->use_count == pair.second);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Optimization
|
||||
|
|
Loading…
Reference in a new issue