set up structure for reg alloc
This commit is contained in:
@ -18,10 +18,15 @@ class CFGNodeType {
|
||||
std::vector<CFGNodeType *> successors_in_dom_tree;
|
||||
CFGNodeCollection dom_frontier;
|
||||
|
||||
std::vector<size_t> in_active_vars;
|
||||
std::vector<size_t> out_active_vars;
|
||||
std::vector<size_t> use_vars;
|
||||
std::vector<size_t> def_vars;
|
||||
std::vector<size_t> block_in_active_vars;
|
||||
std::vector<size_t> block_out_active_vars;
|
||||
std::vector<size_t> block_use_vars;
|
||||
std::vector<size_t> block_def_vars;
|
||||
|
||||
std::unordered_map<ActionItem *, std::vector<size_t>> action_use_vars;
|
||||
std::unordered_map<ActionItem *, std::vector<size_t>> action_def_vars;
|
||||
std::unordered_map<ActionItem *, std::vector<size_t>> action_in_active_vars;
|
||||
std::unordered_map<ActionItem *, std::vector<size_t>> action_out_active_vars;
|
||||
};
|
||||
|
||||
class CFGType {
|
||||
@ -30,6 +35,9 @@ class CFGType {
|
||||
CFGNodeType *entry;
|
||||
std::unordered_map<BlockItem *, CFGNodeType *> block_to_node;
|
||||
std::unordered_map<std::string, BlockItem *> label_to_block;
|
||||
std::vector<std::string> id_to_var;
|
||||
std::unordered_map<std::string, size_t> var_to_id;
|
||||
FunctionDefItem *corresponding_func;
|
||||
};
|
||||
|
||||
template <typename Container, typename Compare = std::less<typename Container::value_type>>
|
||||
|
@ -1,4 +1,36 @@
|
||||
#pragma once
|
||||
#include "IR/IR_basic.h"
|
||||
#include "cfg.h"
|
||||
#include "tools.h"
|
||||
|
||||
void LiveAnalysis(CFGType &cfg);
|
||||
void LiveAnalysis(CFGType &cfg);
|
||||
|
||||
namespace opt {
|
||||
class ForceDef : public ActionItem {
|
||||
public:
|
||||
std::string var_full;
|
||||
LLVMType ty;
|
||||
ForceDef() = default;
|
||||
void RecursivePrint(std::ostream &os) const {
|
||||
throw std::runtime_error("ForceDef instruction is not an actual LLVM IR instruction");
|
||||
}
|
||||
};
|
||||
class ForceUse : public ActionItem {
|
||||
public:
|
||||
std::string var_full;
|
||||
ForceUse() = default;
|
||||
void RecursivePrint(std::ostream &os) const {
|
||||
throw std::runtime_error("ForceUse instruction is not an actual LLVM IR instruction");
|
||||
}
|
||||
};
|
||||
class LoadSpilledArgs : public ActionItem {
|
||||
public:
|
||||
size_t arg_id; // [8,+inf)
|
||||
std::string var_full;
|
||||
LLVMType ty;
|
||||
LoadSpilledArgs() = default;
|
||||
void RecursivePrint(std::ostream &os) const {
|
||||
throw std::runtime_error("LoadSpilledArgs instruction is not an actual LLVM IR instruction");
|
||||
}
|
||||
};
|
||||
} // namespace opt
|
@ -7,6 +7,7 @@ class MoveInstruct : public ActionItem {
|
||||
public:
|
||||
std::string src_full;
|
||||
std::string dest_full;
|
||||
LLVMType ty;
|
||||
MoveInstruct() = default;
|
||||
void RecursivePrint([[maybe_unused]] std::ostream &os) const {
|
||||
throw std::runtime_error("Move instruction is not an actual LLVM IR instruction");
|
||||
|
Reference in New Issue
Block a user