2021-01-13 00:20:08 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <unordered_set>
|
2021-09-12 00:52:35 +00:00
|
|
|
#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 {
|
2021-03-22 20:46:02 +00:00
|
|
|
RegSet live, dead, consumes, written_and_unused, live_in;
|
2021-01-13 00:20:08 +00:00
|
|
|
};
|
|
|
|
|
2021-01-16 15:54:09 +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
|