Files
revng-revng/lib/Lift/RootAnalyzer.h
Alessandro Di Federico a65ccc3413 Introduce ValueMaterializer
`ValueMaterializer` is a rewrite of what was called `AdvancedValueInfo`
which follows the same principles.

The main benefits over the old version is:

* We materialize the data-flow graph and the CFG of the relevant part of
  root. This makes debugging significantly easier.
* We drop the old MonotoneFramework infrastructure in favor of
  getMaximalFixedPoint.
* We significantly reduce the amount of queries we make to
  AdvancedValueInfo.
2023-06-30 13:39:22 +02:00

60 lines
1.6 KiB
C++

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include <unordered_set>
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include "revng/Model/Binary.h"
#include "revng/Support/MetaAddress.h"
#include "DropHelperCallsPass.h"
class AnalysisRegistry;
class JumpTargetManager;
class RootAnalyzer {
private:
using MetaAddressSet = std::unordered_set<MetaAddress>;
using Features = MetaAddress::Features;
using GlobalToAllocaTy = llvm::DenseMap<llvm::GlobalVariable *,
llvm::AllocaInst *>;
private:
JumpTargetManager &JTM;
llvm::Module &TheModule;
const TupleTree<model::Binary> &Model;
public:
RootAnalyzer(JumpTargetManager &JTM);
void cloneOptimizeAndHarvest(llvm::Function *TheFunction);
private:
void updateCSAA();
llvm::Function *createTemporaryRoot(llvm::Function *TheFunction,
llvm::ValueToValueMapTy &OldToNew);
MetaAddressSet inflateValueMaterializerWhitelist();
void promoteHelpersToIntrinsics(llvm::Function *OptimizedFunction,
llvm::IRBuilder<> &Builder);
SummaryCallsBuilder
optimize(llvm::Function *OptimizedFunction, const Features &CommonFeatures);
GlobalToAllocaTy promoteCSVsToAlloca(llvm::Function *OptimizedFunction);
void collectMaterializedValues(AnalysisRegistry &AR);
void collectValuesStoredIntoMemory(llvm::Function *F,
const Features &CommonFeatures);
};