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.
26 lines
750 B
C++
26 lines
750 B
C++
/// \file LoadFunctionMetadataPass.cpp
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "revng/EarlyFunctionAnalysis/IRHelpers.h"
|
|
#include "revng/EarlyFunctionAnalysis/LoadFunctionMetadataPass.h"
|
|
#include "revng/Model/IRHelpers.h"
|
|
|
|
const efa::FunctionMetadata &LoadFunctionMetadataPass::get(llvm::Function *F) {
|
|
auto Address = getMetaAddressOfIsolatedFunction(*F);
|
|
auto It = EntryToMetadata.find(Address);
|
|
if (It == EntryToMetadata.end()) {
|
|
efa::FunctionMetadata FM = *extractFunctionMetadata(F).get();
|
|
It = EntryToMetadata.insert(It, { Address, std::move(FM) });
|
|
}
|
|
|
|
return It->second;
|
|
}
|
|
|
|
bool LoadFunctionMetadataPass::runOnModule(llvm::Module &M) {
|
|
// Do nothing
|
|
return false;
|
|
}
|