jak-project/decompiler/analysis/reg_usage.h

33 lines
652 B
C
Raw Normal View History

2021-01-13 00:20:08 +00:00
#pragma once
#include <unordered_set>
#include <vector>
2021-01-13 00:20:08 +00:00
#include "decompiler/Disasm/Register.h"
namespace decompiler {
class Function;
using RegSet = std::unordered_set<Register, Register::hash>;
struct RegUsageInfo {
struct PerBlock {
RegSet use, defs, input, output;
};
struct PerOp {
RegSet live, dead, consumes, written_and_unused, live_in;
2021-01-13 00:20:08 +00:00
};
int block_count() const { return int(block.size()); }
2021-01-13 00:20:08 +00:00
std::vector<PerBlock> block;
std::vector<PerOp> op;
RegUsageInfo() = default;
RegUsageInfo(int n_blocks, int n_ops);
};
RegUsageInfo analyze_ir2_register_usage(const Function& function);
} // namespace decompiler