2023-09-14 19:43:13 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
2025-04-15 12:23:32 +03:00
|
|
|
#include "libSage++.h"
|
2025-03-05 16:34:32 +03:00
|
|
|
#include <map>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <set>
|
2025-05-01 11:43:35 +03:00
|
|
|
#include <vector>
|
2025-03-05 16:34:32 +03:00
|
|
|
|
|
|
|
|
using ResultSet = std::set<std::tuple<std::string, int, std::string>>;
|
|
|
|
|
|
2025-05-01 11:43:35 +03:00
|
|
|
enum class MODE
|
|
|
|
|
{
|
|
|
|
|
BEFORE,
|
|
|
|
|
AFTER
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static std::map<FuncInfo*, std::vector<SAPFOR::Instruction*>> call_sites;
|
|
|
|
|
|
2025-03-05 16:34:32 +03:00
|
|
|
template<typename Iterator>
|
2025-05-01 11:43:35 +03:00
|
|
|
void extract_vars_from_reg(std::set<SAPFOR::Argument*>& worklist,
|
|
|
|
|
SAPFOR::Argument* reg,
|
|
|
|
|
Iterator instr,
|
|
|
|
|
Iterator first_instr);
|
2025-03-05 16:34:32 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename Iterator>
|
2025-05-01 11:43:35 +03:00
|
|
|
void processArgument(std::set<SAPFOR::Argument*>& worklist,
|
|
|
|
|
SAPFOR::Argument* arg,
|
|
|
|
|
Iterator instr,
|
|
|
|
|
Iterator first_instr);
|
|
|
|
|
|
|
|
|
|
void lookup_for_vars(std::set<std::tuple<SgStatement*, std::string, MODE>>& where_to_add,
|
|
|
|
|
std::set<SAPFOR::Argument*>& worklist,
|
|
|
|
|
SAPFOR::Instruction* instr,
|
|
|
|
|
SAPFOR::BasicBlock* bblock,
|
|
|
|
|
FuncInfo* cur_func,
|
|
|
|
|
const std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*>>& fullIR);
|
2025-03-05 16:34:32 +03:00
|
|
|
|
2025-04-15 12:23:32 +03:00
|
|
|
void
|
|
|
|
|
findParameters(ResultSet& foundParameters,
|
|
|
|
|
std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*>>& fullIR,
|
2025-03-05 16:34:32 +03:00
|
|
|
const std::map<std::tuple<int, std::string, std::string>, std::pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays);
|