Compare commits
3 Commits
ad99446b12
...
ae9cc2bf3b
| Author | SHA1 | Date | |
|---|---|---|---|
| ae9cc2bf3b | |||
| c6a0c73287 | |||
| b454858647 |
@@ -74,12 +74,6 @@ namespace SAPFOR
|
||||
const std::vector<BasicBlock*>& getPrev() const { return prev; }
|
||||
BasicBlock* getDom() const
|
||||
{
|
||||
if (!directDominator)
|
||||
{
|
||||
__spf_print(1, "%s\n", "the dominator tree was built with an error or was not built at all");
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
|
||||
return directDominator;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace SAPFOR {
|
||||
int w = vertex[i];
|
||||
|
||||
for (BasicBlock* v : vertices[w]->getPrev()) {
|
||||
if (dfs_num[v] == -1)
|
||||
continue;
|
||||
int u = Eval(dfs_num[v]);
|
||||
|
||||
if (semi[u] < semi[w])
|
||||
|
||||
@@ -131,9 +131,9 @@ static void lookup_for_vars(set<tuple<SgStatement*, string, MODE>>& where_to_add
|
||||
|
||||
if (worklist.count(result_arg))
|
||||
{
|
||||
worklist.erase(result_arg);
|
||||
processArgument(worklist, arg1, cur_instr, first_instr);
|
||||
processArgument(worklist, arg2, cur_instr, first_instr);
|
||||
worklist.erase(result_arg);
|
||||
}
|
||||
|
||||
if (instr->getOperation() == SAPFOR::CFG_OP::PARAM && worklist.count(arg1))
|
||||
@@ -159,6 +159,8 @@ static void lookup_for_vars(set<tuple<SgStatement*, string, MODE>>& where_to_add
|
||||
|
||||
const auto& RD = bblock->getRD_In();
|
||||
map<SAPFOR::BasicBlock*, SAPFOR::Instruction*> group_by_block;
|
||||
|
||||
set<SAPFOR::Argument*> to_erase;
|
||||
for (auto& arg : worklist)
|
||||
{
|
||||
if (RD.count(arg))
|
||||
@@ -175,7 +177,7 @@ static void lookup_for_vars(set<tuple<SgStatement*, string, MODE>>& where_to_add
|
||||
__spf_print(1, "Please specify value of variable %s on line %d of file %s\n", arg->getValue().c_str(), line, filename);
|
||||
auto toAdd = make_tuple(stmt_after, var_name, MODE::BEFORE);
|
||||
where_to_add.insert(toAdd);
|
||||
worklist.erase(arg);
|
||||
to_erase.insert(arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,6 +188,8 @@ static void lookup_for_vars(set<tuple<SgStatement*, string, MODE>>& where_to_add
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto& arg : to_erase)
|
||||
worklist.erase(arg);
|
||||
|
||||
while (bblock && group_by_block.find(bblock) == group_by_block.end())
|
||||
bblock = bblock->getDom();
|
||||
@@ -408,9 +412,8 @@ void findParameters(ResultSet& foundParameters,
|
||||
|
||||
SgVariableSymb* var_symb = new SgVariableSymb(var_name.c_str());
|
||||
SgVarRefExp* var = new SgVarRefExp(var_symb);
|
||||
SgValueExp* zero = new SgValueExp(1337);
|
||||
SgExprListExp* ex = new SgExprListExp();
|
||||
auto assgn_op = new SgExpression(ASSGN_OP, var, zero);
|
||||
auto assgn_op = new SgExpression(ASSGN_OP, var, NULL);
|
||||
ex->setLhs(assgn_op);
|
||||
|
||||
SgExpression* parameter_op = new SgExpression(SPF_PARAMETER_OP, ex);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "..\GraphCall\graph_calls.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
|
||||
using ResultSet = std::set<std::tuple<std::string, int, std::string>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user