Add Dominator tree builder and interprocedural analysis

This commit is contained in:
2025-04-15 12:23:32 +03:00
committed by Alexander
parent 4eb057731f
commit 537d60222f
5 changed files with 289 additions and 55 deletions

View File

@@ -24,7 +24,7 @@ namespace SAPFOR
std::vector<BasicBlock*> next;
std::vector<BasicBlock*> prev;
BasicBlock* idom{};
//reaching definition
std::map<SAPFOR::Argument*, std::set<int>> RD_in, RD_out;
@@ -42,6 +42,7 @@ namespace SAPFOR
void addInstruction(IR_Block* item);
void addPrev(BasicBlock* prev_) { prev.push_back(prev_); }
void addNext(BasicBlock* next_) { next.push_back(next_); }
void setIdom(BasicBlock* idom_) { idom = idom_; }
int removePrev(BasicBlock* removed);
int removeNext(BasicBlock* removed);
@@ -69,7 +70,8 @@ namespace SAPFOR
const std::vector<IR_Block*>& getInstructions() const { return instructions; }
const std::vector<BasicBlock*>& getNext() const { return next; }
const std::vector<BasicBlock*>& getPrev() const { return prev; }
BasicBlock* getIdom() const { return idom; }
/*
* FOR LIVE ANALYSIS
*/
@@ -146,4 +148,4 @@ static inline void deleteCFG(std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*
byFunc.second.clear();
}
cfg.clear();
}
}