Add Dominator tree builder and interprocedural analysis

This commit is contained in:
2025-04-15 12:23:32 +03:00
parent 4afedfceac
commit acb4099fc4
5 changed files with 289 additions and 55 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include "libSage++.h"
#include <map>
#include <string>
#include <set>
@@ -7,18 +8,25 @@
using ResultSet = std::set<std::tuple<std::string, int, std::string>>;
template<typename Iterator>
void extract_vars_from_reg(std::set<SAPFOR::Argument*>& worklist, SAPFOR::Argument* reg, Iterator instr, Iterator first_instr);
static void extract_vars_from_reg(std::set<SAPFOR::Argument*>& worklist,
SAPFOR::Argument* reg,
Iterator instr,
Iterator first_instr);
template<typename Iterator>
static void processArgument(std::set<SAPFOR::Argument*>& worklist, SAPFOR::Argument* arg, Iterator instr, Iterator first_instr);
static void processArgument(std::set<SAPFOR::Argument*>& worklist,
SAPFOR::Argument* arg,
Iterator instr,
Iterator first_instr);
static void lookup_for_vars(ResultSet& result_set,
static void lookup_for_vars(std::map<SgStatement*, std::string>& where_to_add,
std::set<SAPFOR::Argument*>& worklist,
SAPFOR::Instruction* instr,
SAPFOR::BasicBlock* bblock,
const std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*>>& fullIR);
ResultSet
findParameters(const std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*>>& fullIR,
void
findParameters(ResultSet& foundParameters,
std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*>>& fullIR,
const std::map<std::tuple<int, std::string, std::string>, std::pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays);