Introduce ABIAnalyses2

Architecture-agnostic and ABI-independent data-flow analyses that
traverse the recovered functions in order to detect arguments and
return values registers.
This commit is contained in:
Qian Matteo Chen
2021-02-18 04:20:19 -08:00
committed by Antonio Frighetto
parent 835089705e
commit 12c3ce2dba
23 changed files with 1679 additions and 108 deletions
+9
View File
@@ -58,6 +58,7 @@
#include "revng/Support/IRHelpers.h"
#include "revng/Support/MetaAddress.h"
#include "ABIAnalyses/ABIAnalysis.h"
#include "Cache.h"
#include "InterproceduralAnalysis.h"
#include "Intraprocedural.h"
@@ -1235,6 +1236,7 @@ llvm::Function *CFEPAnalyzer<FO>::createFakeFunction(llvm::BasicBlock *Entry) {
template<class FO>
FunctionSummary CFEPAnalyzer<FO>::analyze(BasicBlock *Entry) {
using namespace llvm;
using namespace ABIAnalyses;
IRBuilder<> Builder(M.getContext());
@@ -1244,6 +1246,13 @@ FunctionSummary CFEPAnalyzer<FO>::analyze(BasicBlock *Entry) {
// Recover the control-flow graph of the function
auto CFG = collectDirectCFG(&OutlinedFunction);
// Run ABI-independent data-flow analyses
ABIAnalysesResults
ABIResults = ABIAnalyses::analyzeOutlinedFunction(OutFunc,
*GCBI,
PreHookMarker,
PostHookMarker);
// The analysis aims at identifying the callee-saved registers of a function
// and establishing if a function returns properly, i.e., it jumps to the
// return address (regular function). In order to achieve this, the IR is