Files
revng-revng/functionboundariesdetection.h
T
Alessandro Di Federico 37de0a0002 Introduce FunctionBoundariesDetectionPass
`FunctionBoundariesDetectionPass` implements our function detection
system.
2016-09-17 15:33:57 +02:00

43 lines
980 B
C++

#ifndef _FUNCTIONBOUNDARIESDETECTION_H
#define _FUNCTIONBOUNDARIESDETECTION_H
// Standard includes
#include <map>
#include <string>
// LLVM includes
#include "llvm/Pass.h"
namespace llvm {
class BasicBlock;
}
class JumpTargetManager;
class FunctionBoundariesDetectionPass : public llvm::FunctionPass {
public:
static char ID;
public:
FunctionBoundariesDetectionPass() : llvm::FunctionPass(ID), JTM(nullptr) { }
FunctionBoundariesDetectionPass(JumpTargetManager *JTM,
std::string SerializePath) :
llvm::FunctionPass(ID), JTM(JTM), SerializePath(SerializePath) { }
void getAnalysisUsage(llvm::AnalysisUsage &AU) const override {
AU.setPreservesAll();
}
bool runOnFunction(llvm::Function &F) override;
private:
void serialize() const;
private:
JumpTargetManager *JTM;
std::string SerializePath;
std::map<llvm::BasicBlock *, std::vector<llvm::BasicBlock *>> Functions;
};
#endif // _FUNCTIONBOUNDARIESDETECTION_H