[backend]引入新的活跃性分析
This commit is contained in:
@@ -13,8 +13,16 @@
|
||||
extern int DEBUG;
|
||||
extern int DEEPDEBUG;
|
||||
|
||||
|
||||
|
||||
namespace sysy {
|
||||
|
||||
// 为活跃性分析的结果定义一个结构体,以同时持有 live_in 和 live_out 集合
|
||||
struct LivenessResult {
|
||||
std::map<Instruction*, std::set<std::string>> live_in;
|
||||
std::map<Instruction*, std::set<std::string>> live_out;
|
||||
};
|
||||
|
||||
class RISCv64CodeGen {
|
||||
public:
|
||||
enum class PhysicalReg {
|
||||
@@ -71,9 +79,8 @@ public:
|
||||
void emit_instructions(DAGNode* node, std::stringstream& ss, const RegAllocResult& alloc, std::set<DAGNode*>& emitted_nodes);
|
||||
|
||||
// Register Allocation related
|
||||
std::map<Instruction*, std::set<std::string>> liveness_analysis(Function* func);
|
||||
std::map<std::string, std::set<std::string>> build_interference_graph(
|
||||
const std::map<Instruction*, std::set<std::string>>& live_sets);
|
||||
LivenessResult liveness_analysis(Function* func);
|
||||
std::map<std::string, std::set<std::string>> build_interference_graph(const LivenessResult& liveness);
|
||||
void color_graph(std::map<std::string, PhysicalReg>& vreg_to_preg,
|
||||
const std::map<std::string, std::set<std::string>>& interference_graph);
|
||||
RegAllocResult register_allocation(Function* func);
|
||||
|
||||
Reference in New Issue
Block a user