mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
276d168e32
LoadFunctionMetadataPass lazily loads a `std::map` from isolated function MetaAddress to `efa::FunctionMetadata`, and caches it.
28 lines
558 B
C++
28 lines
558 B
C++
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "llvm/Pass.h"
|
|
|
|
class LoadFunctionMetadataPass : public llvm::ModulePass {
|
|
public:
|
|
const efa::FunctionMetadata &get(llvm::Function *F);
|
|
|
|
private:
|
|
std::map<MetaAddress, efa::FunctionMetadata> EntryToMetadata;
|
|
|
|
public:
|
|
static char ID;
|
|
|
|
public:
|
|
LoadFunctionMetadataPass() : llvm::ModulePass(ID) {}
|
|
|
|
void getAnalysisUsage(llvm::AnalysisUsage &AU) const override {
|
|
AU.setPreservesAll();
|
|
}
|
|
|
|
bool runOnModule(llvm::Module &M) override;
|
|
};
|