mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
500d77f43e
The symbol handling has been extended to register whether a symbol represents a function or not. This information is then used to register, during the global data harvesting phase, all the function symbols and explicitly mark them through the "FunctionSymbol" `JTReason`. We use this information during the CFEP harvesting phase to integrate the information produced by the function boundaries detection with potential unidentified CFEPs. This option can be enabled with the `--use-debug-symbols`, which supersedes `--use-sections`.
49 lines
1.1 KiB
C++
49 lines
1.1 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,
|
|
bool UseDebugSymbols) :
|
|
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;
|
|
bool UseDebugSymbols;
|
|
std::map<llvm::BasicBlock *, std::vector<llvm::BasicBlock *>> Functions;
|
|
};
|
|
|
|
#endif // _FUNCTIONBOUNDARIESDETECTION_H
|