live analysis: remove redunant ';'
This commit is contained in:
@@ -95,7 +95,7 @@ namespace SAPFOR
|
|||||||
}
|
}
|
||||||
|
|
||||||
return inserted;
|
return inserted;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool BasicBlock::removeLive(SAPFOR::Argument* to_remove, bool in)
|
bool BasicBlock::removeLive(SAPFOR::Argument* to_remove, bool in)
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,7 @@ namespace SAPFOR
|
|||||||
}
|
}
|
||||||
|
|
||||||
return removed;
|
return removed;
|
||||||
};
|
}
|
||||||
|
|
||||||
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> BasicBlock::getLive(bool in) const {
|
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> BasicBlock::getLive(bool in) const {
|
||||||
auto& current_set = in ? live_in : live_out;
|
auto& current_set = in ? live_in : live_out;
|
||||||
@@ -231,22 +231,22 @@ public:
|
|||||||
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getIn()
|
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getIn()
|
||||||
{
|
{
|
||||||
return getBlock()->getLiveOut();
|
return getBlock()->getLiveOut();
|
||||||
};
|
}
|
||||||
|
|
||||||
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getOut()
|
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getOut()
|
||||||
{
|
{
|
||||||
return getBlock()->getLiveIn();
|
return getBlock()->getLiveIn();
|
||||||
};
|
}
|
||||||
|
|
||||||
bool addIn(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data)
|
bool addIn(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data)
|
||||||
{
|
{
|
||||||
return getBlock()->addLiveOut(data);
|
return getBlock()->addLiveOut(data);
|
||||||
};
|
}
|
||||||
|
|
||||||
bool addOut(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data)
|
bool addOut(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data)
|
||||||
{
|
{
|
||||||
return getBlock()->addLiveIn(data);
|
return getBlock()->addLiveIn(data);
|
||||||
};
|
}
|
||||||
|
|
||||||
bool forwardData(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data)
|
bool forwardData(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data)
|
||||||
{
|
{
|
||||||
@@ -257,7 +257,7 @@ public:
|
|||||||
inserted |= getBlock()->addLiveIn({ byArg });
|
inserted |= getBlock()->addLiveIn({ byArg });
|
||||||
|
|
||||||
return inserted;
|
return inserted;
|
||||||
};
|
}
|
||||||
|
|
||||||
LiveVarAnalysisNode(SAPFOR::BasicBlock* block, vector<SAPFOR::Argument*>& formal_parameters,
|
LiveVarAnalysisNode(SAPFOR::BasicBlock* block, vector<SAPFOR::Argument*>& formal_parameters,
|
||||||
vector<LiveDeadVarsForCall>& fcalls, const map<string, FuncInfo*>& funcByName)
|
vector<LiveDeadVarsForCall>& fcalls, const map<string, FuncInfo*>& funcByName)
|
||||||
@@ -279,11 +279,11 @@ protected:
|
|||||||
|
|
||||||
LiveVarAnalysisNode* createNode(SAPFOR::BasicBlock* block) override {
|
LiveVarAnalysisNode* createNode(SAPFOR::BasicBlock* block) override {
|
||||||
return new LiveVarAnalysisNode(block, formal_parameters, fcalls, funcByName);
|
return new LiveVarAnalysisNode(block, formal_parameters, fcalls, funcByName);
|
||||||
};
|
}
|
||||||
public:
|
public:
|
||||||
LiveVarAnalysis(vector<SAPFOR::Argument*>& formal_parameters, vector<LiveDeadVarsForCall>& fcalls,
|
LiveVarAnalysis(vector<SAPFOR::Argument*>& formal_parameters, vector<LiveDeadVarsForCall>& fcalls,
|
||||||
const map<string, FuncInfo*>& funcByName) : formal_parameters(formal_parameters), fcalls(fcalls), funcByName(funcByName)
|
const map<string, FuncInfo*>& funcByName) : formal_parameters(formal_parameters), fcalls(fcalls), funcByName(funcByName)
|
||||||
{ };
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
void getUseDefForInstruction(SAPFOR::BasicBlock* block, SAPFOR::Instruction* instr,
|
void getUseDefForInstruction(SAPFOR::BasicBlock* block, SAPFOR::Instruction* instr,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void insertIfVar(IT begin, IT end, DEST& to) {
|
|||||||
for (auto it = begin; it != end; it++)
|
for (auto it = begin; it != end; it++)
|
||||||
if (*it && (*it)->getType() == SAPFOR::CFG_ARG_TYPE::VAR)
|
if (*it && (*it)->getType() == SAPFOR::CFG_ARG_TYPE::VAR)
|
||||||
to.insert(*it);
|
to.insert(*it);
|
||||||
};
|
}
|
||||||
|
|
||||||
void getUseDefForInstruction(SAPFOR::BasicBlock* block, SAPFOR::Instruction* instr,
|
void getUseDefForInstruction(SAPFOR::BasicBlock* block, SAPFOR::Instruction* instr,
|
||||||
std::set<SAPFOR::Argument*>& use, std::set<SAPFOR::Argument*>& def,
|
std::set<SAPFOR::Argument*>& use, std::set<SAPFOR::Argument*>& def,
|
||||||
|
|||||||
@@ -190,11 +190,11 @@ public:
|
|||||||
|
|
||||||
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getIn() {
|
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getIn() {
|
||||||
return getBlock()->getLiveOut();
|
return getBlock()->getLiveOut();
|
||||||
};
|
}
|
||||||
|
|
||||||
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getOut() {
|
map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>> getOut() {
|
||||||
return getBlock()->getLiveIn();
|
return getBlock()->getLiveIn();
|
||||||
};
|
}
|
||||||
|
|
||||||
bool addIn(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data) {
|
bool addIn(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data) {
|
||||||
bool inserted = getBlock()->addLiveOut(data);
|
bool inserted = getBlock()->addLiveOut(data);
|
||||||
@@ -205,11 +205,11 @@ public:
|
|||||||
inserted |= updateJumpStatus();
|
inserted |= updateJumpStatus();
|
||||||
|
|
||||||
return inserted;
|
return inserted;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool addOut(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data) {
|
bool addOut(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data) {
|
||||||
return getBlock()->addLiveIn(data);
|
return getBlock()->addLiveIn(data);
|
||||||
};
|
}
|
||||||
|
|
||||||
bool forwardData(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data) {
|
bool forwardData(const map<SAPFOR::Argument*, vector<SAPFOR::BasicBlock*>>& data) {
|
||||||
bool inserted = false;
|
bool inserted = false;
|
||||||
@@ -279,7 +279,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return inserted;
|
return inserted;
|
||||||
};
|
}
|
||||||
|
|
||||||
DeadCodeAnalysisNode(SAPFOR::BasicBlock* block, vector<SAPFOR::Argument*>& formal_parameters) :
|
DeadCodeAnalysisNode(SAPFOR::BasicBlock* block, vector<SAPFOR::Argument*>& formal_parameters) :
|
||||||
formal_parameters(formal_parameters)
|
formal_parameters(formal_parameters)
|
||||||
@@ -295,7 +295,7 @@ public:
|
|||||||
getBlock()->addLiveIn({ { arg, { getBlock() } } });
|
getBlock()->addLiveIn({ { arg, { getBlock() } } });
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<bool>& getResult() { return useful; };
|
const vector<bool>& getResult() { return useful; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeadCodeAnalysis : public BackwardDataFlowAnalysis<DeadCodeAnalysisNode> {
|
class DeadCodeAnalysis : public BackwardDataFlowAnalysis<DeadCodeAnalysisNode> {
|
||||||
@@ -304,11 +304,11 @@ protected:
|
|||||||
|
|
||||||
DeadCodeAnalysisNode* createNode(SAPFOR::BasicBlock* block) override {
|
DeadCodeAnalysisNode* createNode(SAPFOR::BasicBlock* block) override {
|
||||||
return new DeadCodeAnalysisNode(block, formal_parameters);
|
return new DeadCodeAnalysisNode(block, formal_parameters);
|
||||||
};
|
}
|
||||||
public:
|
public:
|
||||||
DeadCodeAnalysis(vector<SAPFOR::Argument*>& formal_parameters) :
|
DeadCodeAnalysis(vector<SAPFOR::Argument*>& formal_parameters) :
|
||||||
formal_parameters(formal_parameters)
|
formal_parameters(formal_parameters)
|
||||||
{ };
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user