Files
revng-revng/functionboundariesdetection.h
T
Alessandro Di Federico 9fa311bd1b Introduce metadata func.entry and rename func
Attach a `func.entry` metadata node to the entry basic block of a
function and rename `func` to `func.member.of`.
2017-01-11 15:29:33 +01:00

47 lines
1.0 KiB
C++

#ifndef _FUNCTIONBOUNDARIESDETECTION_H
#define _FUNCTIONBOUNDARIESDETECTION_H
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
// 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