mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
88 lines
2.8 KiB
C++
88 lines
2.8 KiB
C++
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include <array>
|
|
#include <string>
|
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include "revng/PTML/Tag.h"
|
|
#include "revng/PipeboxCommon/RawContainer.h"
|
|
#include "revng/Pipeline/Contract.h"
|
|
#include "revng/Pipes/StringMap.h"
|
|
#include "revng/Yield/Pipes/ProcessCallGraph.h"
|
|
|
|
namespace revng::pipes {
|
|
|
|
class YieldCallGraphSlice {
|
|
public:
|
|
static constexpr const auto Name = "yield-call-graph-slice";
|
|
|
|
public:
|
|
inline std::array<pipeline::ContractGroup, 1> getContract() const {
|
|
using namespace pipeline;
|
|
return { ContractGroup{ Contract(kinds::BinaryCrossRelations,
|
|
1,
|
|
kinds::CallGraphSliceSVG,
|
|
2,
|
|
InputPreservation::Preserve),
|
|
Contract(kinds::CFG,
|
|
0,
|
|
kinds::CallGraphSliceSVG,
|
|
2,
|
|
InputPreservation::Preserve) } };
|
|
}
|
|
|
|
public:
|
|
llvm::Error run(pipeline::ExecutionContext &Context,
|
|
const CFGMap &CFGMap,
|
|
const CrossRelationsFileContainer &InputFile,
|
|
CallGraphSliceSVGStringMap &Output);
|
|
};
|
|
|
|
} // namespace revng::pipes
|
|
|
|
namespace revng::pypeline {
|
|
|
|
using CallGraphSliceContainer = FunctionToBytesContainer<"CallGraphSliceContain"
|
|
"er",
|
|
"image/svg">;
|
|
|
|
namespace piperuns {
|
|
|
|
class YieldCallGraphSlice {
|
|
private:
|
|
ptml::MarkupBuilder B;
|
|
const model::Binary &Binary;
|
|
const CrossRelationsContainer &Input;
|
|
CallGraphSliceContainer &Output;
|
|
|
|
public:
|
|
static constexpr llvm::StringRef Name = "yield-call-graph-slice";
|
|
using Arguments = TypeList<PipeRunArgument<const CrossRelationsContainer,
|
|
"Input",
|
|
"Binary cross relations">,
|
|
PipeRunArgument<CallGraphSliceContainer,
|
|
"Output",
|
|
"per-function SVG of the "
|
|
"callgraph",
|
|
Access::Write>>;
|
|
|
|
YieldCallGraphSlice(const Model &Model,
|
|
llvm::StringRef StaticConfiguration,
|
|
llvm::StringRef Configuration,
|
|
const CrossRelationsContainer &Input,
|
|
CallGraphSliceContainer &Output) :
|
|
Binary(*Model.get().get()), Input(Input), Output(Output) {}
|
|
|
|
void runOnFunction(const model::Function &Function);
|
|
};
|
|
|
|
} // namespace piperuns
|
|
|
|
} // namespace revng::pypeline
|