Files
revng-revng/include/revng/FunctionIsolation/InlineHelpers.h
T
Giacomo Vercesi 798af62b87 Introduce helpers declarations
Re-organize the variants of `libtcg-helpers-*.bc` as such:
* `libtcg-helpers-full-$ARCH.bc`: unchanged, contains all helper
  function with their bodies and all CSVs.
* `libtcg-helpers-declarations-only-$ARCH.bc`: all helper
  functions have been turned to declarations. All CSVs (except a couple
  of special ones) have been dropped.
* `libtcg-helpers-to-inline-$ARCH.bc`: only functions with the
  `revng_inline` section retain their body. Only CSVs that are used by
  these functions are present.

Lift now loads only the `declarations-only` variant of helpers, as
their body is not required until `inline-helpers`. In `inline-helpers`
the `to-inline` variant is loaded and linked, which then allows the
helpers to be inlined.
2026-02-05 10:20:45 +01:00

28 lines
675 B
C++

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "llvm/Pass.h"
#include "revng/BasicAnalyses/GeneratedCodeBasicInfo.h"
class InlineHelpersPass : public llvm::ModulePass {
public:
static char ID;
// This map stores the loaded helper module(s) to be inlined. Generally state
// in a pass is frowned upon, but since this is only ever read it's simpler to
// store it at the pass level.
llvm::StringMap<std::unique_ptr<llvm::Module>> HelpersModules;
public:
InlineHelpersPass() : ModulePass(ID) {}
bool runOnModule(llvm::Module &M) override;
private:
void linkRequiredHelpers(llvm::Module &M);
};