MFP: rename namespace MFP into mfp

This commit is contained in:
Alessandro Di Federico
2026-05-27 16:51:45 +02:00
parent 841b5dab71
commit 6a594a9133
16 changed files with 99 additions and 99 deletions
+7 -7
View File
@@ -13,9 +13,9 @@ namespace llvm {
class Instruction;
}
template<MFP::MonotoneFrameworkInstance MFI>
struct llvm::DOTGraphTraits<const MFP::Graph<MFI> *> {
using GraphType = const MFP::Graph<MFI> *;
template<mfp::MonotoneFrameworkInstance MFI>
struct llvm::DOTGraphTraits<const mfp::Graph<MFI> *> {
using GraphType = const mfp::Graph<MFI> *;
using UnderlyingGraphType = MFI::GraphType;
using UnderlyingDOTGraphTraits = llvm::DOTGraphTraits<UnderlyingGraphType>;
using NodeRef = llvm::GraphTraits<GraphType>::NodeRef;
@@ -63,7 +63,7 @@ struct llvm::DOTGraphTraits<const MFP::Graph<MFI> *> {
llvm::raw_string_ostream Stream(Result);
Stream << Name.str() << " value:"
<< "\n";
MFP::dump(Stream, 1, ToDump);
mfp::dump(Stream, 1, ToDump);
}
replaceAll(Result, "\n", Newline);
@@ -141,6 +141,6 @@ struct llvm::DOTGraphTraits<const MFP::Graph<MFI> *> {
}
};
template<MFP::MonotoneFrameworkInstance MFI>
struct llvm::DOTGraphTraits<MFP::Graph<MFI> *>
: llvm::DOTGraphTraits<const MFP::Graph<MFI> *> {};
template<mfp::MonotoneFrameworkInstance MFI>
struct llvm::DOTGraphTraits<mfp::Graph<MFI> *>
: llvm::DOTGraphTraits<const mfp::Graph<MFI> *> {};
+8 -8
View File
@@ -6,7 +6,7 @@
#include "revng/MFP/MFP.h"
namespace MFP {
namespace mfp {
template<MonotoneFrameworkInstance MFI>
class Graph {
@@ -28,12 +28,12 @@ public:
const auto &results() const { return Results; }
};
} // namespace MFP
} // namespace mfp
/// \note This implementation of GraphTraits forwards everything 1-to-1
template<MFP::MonotoneFrameworkInstance MFI>
struct llvm::GraphTraits<MFP::Graph<MFI> *> {
using GraphType = MFP::Graph<MFI> *;
template<mfp::MonotoneFrameworkInstance MFI>
struct llvm::GraphTraits<mfp::Graph<MFI> *> {
using GraphType = mfp::Graph<MFI> *;
using UnderlyingGraphTraits = llvm::GraphTraits<typename MFI::GraphType>;
using NodeRef = typename UnderlyingGraphTraits::NodeRef;
using EdgeRef = typename UnderlyingGraphTraits::EdgeRef;
@@ -76,9 +76,9 @@ struct llvm::GraphTraits<MFP::Graph<MFI> *> {
};
/// \note This implementation of GraphTraits forwards everything 1-to-1
template<MFP::MonotoneFrameworkInstance MFI>
struct llvm::GraphTraits<const MFP::Graph<MFI> *> {
using GraphType = const MFP::Graph<MFI> *;
template<mfp::MonotoneFrameworkInstance MFI>
struct llvm::GraphTraits<const mfp::Graph<MFI> *> {
using GraphType = const mfp::Graph<MFI> *;
using UnderlyingGraphTraits = llvm::GraphTraits<typename MFI::GraphType>;
using NodeRef = const typename UnderlyingGraphTraits::NodeRef;
using EdgeRef = typename UnderlyingGraphTraits::EdgeRef;
+15 -15
View File
@@ -28,7 +28,7 @@
#include "revng/ADT/GenericGraph.h"
#include "revng/ADT/ReversePostOrderTraversal.h"
namespace MFP {
namespace mfp {
inline Logger NullLogger("");
@@ -147,10 +147,10 @@ public:
Stream << Map.size() << " elements:\n";
for (const auto &[Key, Element] : Map) {
Stream << " " << (Key.second == Position::Before ? "Before " : "After ");
MFP::dumpLabel(Stream, Key.first);
mfp::dumpLabel(Stream, Key.first);
Stream << "\n";
MFP::dump<LatticeElement>(Stream, 2, Element);
mfp::dump<LatticeElement>(Stream, 2, Element);
}
}
};
@@ -313,26 +313,26 @@ getMaximalFixedPointImpl(MFPConfiguration<MFIType> &Configuration) {
revng_log(Logger, "Initializing extremal labels");
LoggerIndent Indent(Logger);
Logger << "Extremal value:\n";
MFP::dump(*Logger.getAsLLVMStream(), 1, Configuration.ExtremalValue);
mfp::dump(*Logger.getAsLLVMStream(), 1, Configuration.ExtremalValue);
Logger << DoLog;
Logger << "Extremal labels:" << DoLog;
LoggerIndent Indent2(Logger);
for (Label ExtremalLabel : ExtremalLabels) {
MFP::dumpLabel(*Logger.getAsLLVMStream(), ExtremalLabel);
mfp::dumpLabel(*Logger.getAsLLVMStream(), ExtremalLabel);
Logger << DoLog;
}
revng_log(Logger, "Initializing initial nodes");
LoggerIndent Indent3(Logger);
Logger << "Initial value:\n";
MFP::dump(*Logger.getAsLLVMStream(), 1, Bottom);
mfp::dump(*Logger.getAsLLVMStream(), 1, Bottom);
Logger << DoLog;
Logger << "Initial labels:" << DoLog;
LoggerIndent Indent4(Logger);
for (Label InitialNode : EntryLabels) {
MFP::dumpLabel(*Logger.getAsLLVMStream(), InitialNode);
mfp::dumpLabel(*Logger.getAsLLVMStream(), InitialNode);
Logger << DoLog;
}
}
@@ -395,7 +395,7 @@ getMaximalFixedPointImpl(MFPConfiguration<MFIType> &Configuration) {
if (Logger.isEnabled()) {
Logger << "Iteration #" << IterationIndex << " on ";
MFP::dumpLabel(*Logger.getAsLLVMStream(), Start);
mfp::dumpLabel(*Logger.getAsLLVMStream(), Start);
Logger << DoLog;
}
@@ -403,11 +403,11 @@ getMaximalFixedPointImpl(MFPConfiguration<MFIType> &Configuration) {
if (Logger.isEnabled()) {
Logger << "Initial value:\n";
MFP::dump(*Logger.getAsLLVMStream(), 1, LabelAnalysis.InValue);
mfp::dump(*Logger.getAsLLVMStream(), 1, LabelAnalysis.InValue);
Logger << DoLog;
Logger << "Final value:\n";
MFP::dump(*Logger.getAsLLVMStream(), 1, LabelAnalysis.OutValue);
mfp::dump(*Logger.getAsLLVMStream(), 1, LabelAnalysis.OutValue);
Logger << DoLog;
}
@@ -422,7 +422,7 @@ getMaximalFixedPointImpl(MFPConfiguration<MFIType> &Configuration) {
if (Logger.isEnabled()) {
LoggerIndent Indent(Logger);
Logger << "New final value:\n";
MFP::dump(*Logger.getAsLLVMStream(), 1, New);
mfp::dump(*Logger.getAsLLVMStream(), 1, New);
Logger << DoLog;
}
@@ -439,13 +439,13 @@ getMaximalFixedPointImpl(MFPConfiguration<MFIType> &Configuration) {
if (Logger.isEnabled()) {
Logger << "Considering successor ";
MFP::dumpLabel(*Logger.getAsLLVMStream(), Successor);
mfp::dumpLabel(*Logger.getAsLLVMStream(), Successor);
Logger << DoLog;
Logger << "Initial value:\n";
LoggerIndent Indent(Logger);
Logger << DoLog;
MFP::dump(*Logger.getAsLLVMStream(), 1, SuccessorResults.InValue);
mfp::dump(*Logger.getAsLLVMStream(), 1, SuccessorResults.InValue);
Logger << DoLog;
}
LoggerIndent Indent(Logger);
@@ -461,7 +461,7 @@ getMaximalFixedPointImpl(MFPConfiguration<MFIType> &Configuration) {
if (Logger.isEnabled()) {
Logger << "Enqueuing. New initial value:\n";
MFP::dump(*Logger.getAsLLVMStream(), 1, SuccessorResults.InValue);
mfp::dump(*Logger.getAsLLVMStream(), 1, SuccessorResults.InValue);
Logger << DoLog;
}
@@ -520,4 +520,4 @@ getMaximalFixedPoint(MFPConfiguration<MFIType> Configuration) {
return getMaximalFixedPointImpl<MFIType, GT>(Configuration);
}
} // namespace MFP
} // namespace mfp
@@ -60,7 +60,7 @@ public:
RegisterSet applyTransferFunction(const BlockNode *Block,
const RegisterSet &InitialState,
MFP::NoExtraState &) const {
mfp::NoExtraState &) const {
RegisterSet Result = InitialState;
for (const Operation &Operation :
@@ -86,6 +86,6 @@ public:
}
};
static_assert(MFP::MonotoneFrameworkInstance<Liveness>);
static_assert(mfp::MonotoneFrameworkInstance<Liveness>);
} // namespace rua
@@ -64,7 +64,7 @@ public:
using LatticeElement = WritersSet;
using GraphType = Function *;
using Label = BlockNode *;
using ExtraStateType = MFP::NoExtraState;
using ExtraStateType = mfp::NoExtraState;
private:
llvm::DenseMap<const Operation *, uint8_t> WriteToIndex;
@@ -133,7 +133,7 @@ public:
WritersSet applyTransferFunction(const Block *Block,
const WritersSet &InitialState,
MFP::NoExtraState &) const {
mfp::NoExtraState &) const {
WritersSet Result = InitialState;
for (const Operation &Operation : *Block) {
@@ -160,6 +160,6 @@ public:
}
};
static_assert(MFP::MonotoneFrameworkInstance<ReachingDefinitions>);
static_assert(mfp::MonotoneFrameworkInstance<ReachingDefinitions>);
} // namespace rua
@@ -715,11 +715,11 @@ struct ReachableExitsAnalysis
using LatticeElement = typename SetUnionLattice<
std::set<BasicBlockNode<NodeT> *>>::LatticeElement;
using ExtraStateType = MFP::NoExtraState;
using ExtraStateType = mfp::NoExtraState;
static LatticeElement applyTransferFunction(const Label &L,
const LatticeElement E,
MFP::NoExtraState &) {
mfp::NoExtraState &) {
const auto IsInlined = [](const auto &NodeLabelPair) {
return NodeLabelPair.second.Inlined;
@@ -765,7 +765,7 @@ inline bool RegionCFG<NodeT>::inflate() {
using REA = ReachableExitsAnalysis<NodeT>;
using Inverse = llvm::Inverse<typename REA::GraphType>;
using GraphTraits = llvm::GraphTraits<Inverse>;
auto GetMaximalFixedPoint = MFP::getMaximalFixedPoint<REA, GraphTraits>;
auto GetMaximalFixedPoint = mfp::getMaximalFixedPoint<REA, GraphTraits>;
auto ReachableExits = GetMaximalFixedPoint({ .Flow = &Graph,
.EntryLabels = &Exits });
@@ -25,9 +25,9 @@ public:
using LatticeElement = std::map<llvm::Instruction *, ConstantRangeSet>;
using GraphType = const ControlFlowEdgesGraph *;
using Label = const ControlFlowEdgesGraph::Node *;
using ResultsMap = std::map<Label, MFP::MFPResult<LatticeElement>>;
using ResultsMap = std::map<Label, mfp::MFPResult<LatticeElement>>;
using InstructionsSet = llvm::SmallPtrSetImpl<llvm::Instruction *>;
using ExtraStateType = MFP::NoExtraState;
using ExtraStateType = mfp::NoExtraState;
private:
llvm::LazyValueInfo &LVI;
@@ -60,13 +60,13 @@ public:
LatticeElement applyTransferFunction(Label L,
const LatticeElement &E,
MFP::NoExtraState &) const;
mfp::NoExtraState &) const;
public:
static void dump(GraphType CFEG, const ResultsMap &AllResults);
};
static_assert(MFP::MonotoneFrameworkInstance<AdvancedValueInfoMFI>);
static_assert(mfp::MonotoneFrameworkInstance<AdvancedValueInfoMFI>);
/// \p DFG the data flow graph containing the instructions we're interested in.
/// \p Context the position in the function for the current query.
@@ -74,7 +74,7 @@ std::tuple<
std::map<llvm::Instruction *, ConstantRangeSet>,
ControlFlowEdgesGraph,
std::map<const ForwardNode<ControlFlowEdgesNode> *,
MFP::MFPResult<std::map<llvm::Instruction *, ConstantRangeSet>>>>
mfp::MFPResult<std::map<llvm::Instruction *, ConstantRangeSet>>>>
runAVI(const DataFlowGraph &DFG,
llvm::Instruction *Context,
const llvm::DominatorTree &DT,
@@ -83,10 +83,10 @@ runAVI(const DataFlowGraph &DFG,
bool ZeroExtendConstraints);
template<>
void MFP::dump(llvm::raw_ostream &Stream,
void mfp::dump(llvm::raw_ostream &Stream,
unsigned Indent,
const std::map<llvm::Instruction *, ConstantRangeSet> &Element);
template<>
void MFP::dumpLabel(llvm::raw_ostream &Stream,
void mfp::dumpLabel(llvm::raw_ostream &Stream,
const ControlFlowEdgesGraph::Node *const &Label);
@@ -58,7 +58,7 @@ private:
DataFlowGraph DataFlowGraph;
ConstraintsMap OracleConstraints;
std::map<const ForwardNode<ControlFlowEdgesNode> *,
MFP::MFPResult<std::map<llvm::Instruction *, ConstantRangeSet>>>
mfp::MFPResult<std::map<llvm::Instruction *, ConstantRangeSet>>>
MFIResults;
std::optional<MaterializedValues> Values;
ControlFlowEdgesGraph CFEG;
+5 -5
View File
@@ -495,7 +495,7 @@ public:
LatticeElement applyTransferFunction(ProgramPointNode *L,
const LatticeElement &E,
MFP::NoExtraState &ExtraState) const;
mfp::NoExtraState &ExtraState) const;
private:
void applyTransferFunctionImpl(Instruction *I, LatticeElement &E) const;
@@ -510,7 +510,7 @@ template<bool IsLegacy>
using LatticeElement = AEMFP<IsLegacy>::LatticeElement;
template<bool IsLegacy>
using AvailableExpressionsMap = MFP::MFIResultMap<AEMFP<IsLegacy>>;
using AvailableExpressionsMap = mfp::MFIResultMap<AEMFP<IsLegacy>>;
static bool legacyLocalVariablesNoAlias(const Instruction *I,
const Instruction *J) {
@@ -646,7 +646,7 @@ template<bool IsLegacy>
AEMFP<IsLegacy>::LatticeElement
AEMFP<IsLegacy>::applyTransferFunction(ProgramPointNode *ProgramPoint,
const AEMFP<IsLegacy>::LatticeElement &E,
MFP::NoExtraState &ExtraState) const {
mfp::NoExtraState &ExtraState) const {
Instruction *I = ProgramPoint->TheInstruction;
@@ -962,7 +962,7 @@ static AEResult<IsLegacy> getAvailableExpressions(Function &F,
using AEMFP = AEMFP<IsLegacy>;
AEMFP AvailableExpressionsMF{ AA, MST };
std::vector Entries = { Entry };
MFP::MFPConfiguration<AEMFP> Configuration{
mfp::MFPConfiguration<AEMFP> Configuration{
.Instance = &AvailableExpressionsMF,
.Flow = Graph,
.Bottom = &Bottom,
@@ -972,7 +972,7 @@ static AEResult<IsLegacy> getAvailableExpressions(Function &F,
// std::exchange here is only needed to make revng check-conventions happy.
std::exchange(Result.AvailableExpressions,
MFP::getMaximalFixedPoint<AEMFP>(Configuration));
mfp::getMaximalFixedPoint<AEMFP>(Configuration));
return Result;
}
@@ -268,16 +268,16 @@ RUAResults analyzeRegisterUsage(Function *F,
// the forward entry), and seeding only from the return node would skip
// no-return blocks (e.g., calls to non-returning functions). Use `All` to
// seed RPOT from every node.
MFP::MFPConfiguration<rua::Liveness> Configuration{
mfp::MFPConfiguration<rua::Liveness> Configuration{
.Instance = &Liveness,
.Flow = &Function.Function,
.Bottom = &DefaultValue,
.ExtremalValue = &DefaultValue,
.ExtremalLabels = &ExtremalLabels,
.EntryLabels = MFP::All{}
.EntryLabels = mfp::All{}
};
using namespace MFP;
using namespace mfp;
using InverseGT = llvm::GraphTraits<llvm::Inverse<const rua::Function *>>;
auto GetMaximalFixedPoint = getMaximalFixedPoint<rua::Liveness, InverseGT>;
auto AnalysisResult = GetMaximalFixedPoint(Configuration);
@@ -324,16 +324,16 @@ RUAResults analyzeRegisterUsage(Function *F,
// nodes (e.g. `ReturnNode`) that may not be forward-reachable from the
// entry (functions with no return paths). With `Entry{}` those nodes
// would be absent from the result map.
MFP::MFPConfiguration<rua::ReachingDefinitions> Configuration{
mfp::MFPConfiguration<rua::ReachingDefinitions> Configuration{
.Instance = &ReachingDefinitions,
.Flow = &Function.Function,
.Bottom = &DefaultValue,
.ExtremalValue = &DefaultValue,
.ExtremalLabels = &ExtremalLabels,
.EntryLabels = MFP::All{}
.EntryLabels = mfp::All{}
};
using namespace MFP;
using namespace mfp;
auto GetMaximalFixedPoint = getMaximalFixedPoint<rua::ReachingDefinitions>;
auto AnalysisResult = GetMaximalFixedPoint(Configuration);
+3 -3
View File
@@ -20,7 +20,7 @@
#include "revng/Support/IRHelpers.h"
using namespace llvm;
using namespace MFP;
using namespace mfp;
// TODO: switch from CallInst to CallBase
@@ -450,11 +450,11 @@ static bool needsWrapper(Function *F) {
struct UsedRegistersMFI : public SetUnionLattice<FunctionNodeData::UsedCSVSet> {
using Label = FunctionNode *;
using GraphType = GenericCallGraph *;
using ExtraStateType = MFP::NoExtraState;
using ExtraStateType = mfp::NoExtraState;
static LatticeElement applyTransferFunction(Label L,
const LatticeElement &Value,
MFP::NoExtraState &) {
mfp::NoExtraState &) {
return combineValues(L->UsedCSVs, Value);
}
};
@@ -741,7 +741,7 @@ public:
using Label = llvm::BasicBlock *;
using GraphType = llvm::Function *;
using ExtraStateKey = llvm::Instruction *;
using ExtraStateType = MFP::ExtraState<llvm::Instruction *, MemoryAreaState>;
using ExtraStateType = mfp::ExtraState<llvm::Instruction *, MemoryAreaState>;
private:
InstructionStackUsage &StackUsage;
@@ -797,9 +797,9 @@ public:
}
};
static_assert(MFP::MonotoneFrameworkInstance<SegregateStackAccessesMFI>);
static_assert(mfp::MonotoneFrameworkInstance<SegregateStackAccessesMFI>);
namespace MFP {
namespace mfp {
template<>
void dump<MemoryAreaState>(Logger &Stream,
@@ -818,7 +818,7 @@ void dumpLabel<Instruction *>(Logger &Stream, Instruction *const &Label) {
Stream << getName(Label);
}
} // namespace MFP
} // namespace mfp
struct SortByFunction {
bool operator()(const Instruction *LHS, const Instruction *RHS) const {
@@ -1637,7 +1637,7 @@ void SegregateFunctionStack<Legacy>::runDataFlowAnalysis() {
std::vector ExtremalLabels = { Entry };
using SSAMFI = SegregateStackAccessesMFI;
SSAMFI MFI(StackUsage);
MFP::getMaximalFixedPoint<SSAMFI>({ .Instance = &MFI,
mfp::getMaximalFixedPoint<SSAMFI>({ .Instance = &MFI,
.Flow = NewFunction,
.ExtremalLabels = &ExtremalLabels,
.ExtraState = &MFPExtraState,
+10 -10
View File
@@ -62,8 +62,8 @@ struct BitLivenessAnalysis {
using GraphType = GenericGraph<DataFlowNode> *;
using LatticeElement = uint32_t;
using Label = DataFlowNode *;
using MFPResult = MFP::MFPResult<BitLivenessAnalysis::LatticeElement>;
using ExtraStateType = MFP::NoExtraState;
using MFPResult = mfp::MFPResult<BitLivenessAnalysis::LatticeElement>;
using ExtraStateType = mfp::NoExtraState;
uint32_t combineValues(const uint32_t &LHS, const uint32_t &RHS) const {
return std::max(LHS, RHS);
@@ -75,7 +75,7 @@ struct BitLivenessAnalysis {
uint32_t applyTransferFunction(DataFlowNode *L,
const uint32_t E,
MFP::NoExtraState &) const;
mfp::NoExtraState &) const;
};
using BitVector = llvm::BitVector;
@@ -244,7 +244,7 @@ static uint32_t transferZExt(Instruction *Ins, const uint32_t &Element) {
uint32_t BitLivenessAnalysis::applyTransferFunction(DataFlowNode *L,
const uint32_t E,
MFP::NoExtraState &) const {
mfp::NoExtraState &) const {
auto *Ins = L->Instruction;
switch (Ins->getOpcode()) {
case Instruction::And:
@@ -284,18 +284,18 @@ BitLivenessPass::Result BitLivenessPass::run(llvm::Function &F,
// The data-flow graph has no designated entry node and the analysis is
// backward-shaped (extremals are sinks). Seed RPOT from every node.
MFP::MFPConfiguration<BitLivenessAnalysis> Configuration{
mfp::MFPConfiguration<BitLivenessAnalysis> Configuration{
.Flow = &DataFlowGraph,
.ExtremalValue = &Top,
.ExtremalLabels = &ExtremalLabels,
.EntryLabels = MFP::All{}
.EntryLabels = mfp::All{}
};
auto Results = MFP::getMaximalFixedPoint<BitLivenessAnalysis>(Configuration);
auto Results = mfp::getMaximalFixedPoint<BitLivenessAnalysis>(Configuration);
using GraphType = typename BitLivenessAnalysis::GraphType;
using GraphTraits = llvm::GraphTraits<GraphType>;
static_assert(MFP::HasNodeRange<GraphTraits>);
static_assert(mfp::HasNodeRange<GraphTraits>);
BitLivenessPass::Result Result;
for (auto &[Label, MFPResult] : Results) {
@@ -307,7 +307,7 @@ BitLivenessPass::Result BitLivenessPass::run(llvm::Function &F,
if (llvm::Error Error = DataFlowGraph.verify())
revng_abort(revng::unwrapError(std::move(Error)).c_str());
MFP::Graph<BitLivenessAnalysis> MFPGraph(&DataFlowGraph, Results);
mfp::Graph<BitLivenessAnalysis> MFPGraph(&DataFlowGraph, Results);
return Result;
}
@@ -321,7 +321,7 @@ bool BitLivenessWrapperPass::runOnFunction(llvm::Function &F) {
} // namespace TypeShrinking
template<>
void MFP::dump(llvm::raw_ostream &Stream,
void mfp::dump(llvm::raw_ostream &Stream,
unsigned Indent,
const unsigned &Value) {
Stream << Value;
+10 -10
View File
@@ -79,7 +79,7 @@ bool AdvancedValueInfoMFI::isLessOrEqual(const LatticeElement &LHS,
AdvancedValueInfoMFI::LatticeElement
AdvancedValueInfoMFI::applyTransferFunction(Label L,
const LatticeElement &E,
MFP::NoExtraState &) const {
mfp::NoExtraState &) const {
revng_log(AVILogger, " " << L->toString());
LoggerIndent Indent(AVILogger);
@@ -191,7 +191,7 @@ AdvancedValueInfoMFI::applyTransferFunction(Label L,
}
void AdvancedValueInfoMFI::dump(GraphType CFEG, const ResultsMap &AllResults) {
MFP::Graph<AdvancedValueInfoMFI> MFPGraph(CFEG, AllResults);
mfp::Graph<AdvancedValueInfoMFI> MFPGraph(CFEG, AllResults);
llvm::WriteGraph(&MFPGraph, "cfeg");
}
@@ -200,7 +200,7 @@ void AdvancedValueInfoMFI::dump(GraphType CFEG, const ResultsMap &AllResults) {
std::tuple<std::map<llvm::Instruction *, ConstantRangeSet>,
ControlFlowEdgesGraph,
map<const ForwardNode<ControlFlowEdgesNode> *,
MFP::MFPResult<map<llvm::Instruction *, ConstantRangeSet>>>>
mfp::MFPResult<map<llvm::Instruction *, ConstantRangeSet>>>>
runAVI(const DataFlowGraph &DFG,
llvm::Instruction *Context,
const llvm::DominatorTree &DT,
@@ -238,7 +238,7 @@ runAVI(const DataFlowGraph &DFG,
std::map<llvm::Instruction *, ConstantRangeSet>{},
ControlFlowEdgesGraph(),
map<const ForwardNode<ControlFlowEdgesNode> *,
MFP::MFPResult<map<llvm::Instruction *, ConstantRangeSet>>>{}
mfp::MFPResult<map<llvm::Instruction *, ConstantRangeSet>>>{}
};
}
@@ -316,7 +316,7 @@ runAVI(const DataFlowGraph &DFG,
ExtremalValue[I] = ConstantRangeSet(I->getType()->getIntegerBitWidth(),
true);
MFP::MFPConfiguration<AdvancedValueInfoMFI> Configuration{
mfp::MFPConfiguration<AdvancedValueInfoMFI> Configuration{
.Instance = &AVIMFI,
.Flow = &CFEG,
.ExtremalValue = &ExtremalValue,
@@ -325,7 +325,7 @@ runAVI(const DataFlowGraph &DFG,
.Logger = &AVILogger
};
auto GetMaximalFixedPoint = MFP::getMaximalFixedPoint<AdvancedValueInfoMFI>;
auto GetMaximalFixedPoint = mfp::getMaximalFixedPoint<AdvancedValueInfoMFI>;
auto AllResults = GetMaximalFixedPoint(Configuration);
if (AVILogger.isEnabled()) {
@@ -334,9 +334,9 @@ runAVI(const DataFlowGraph &DFG,
for (const auto &[Node, AnalysisResults] : AllResults) {
AVILogger << Node->toString() << ":\n";
AVILogger << " Initial value:\n";
MFP::dump(*AVILogger.getAsLLVMStream().get(), 2, AnalysisResults.InValue);
mfp::dump(*AVILogger.getAsLLVMStream().get(), 2, AnalysisResults.InValue);
AVILogger << " Final value:\n";
MFP::dump(*AVILogger.getAsLLVMStream().get(),
mfp::dump(*AVILogger.getAsLLVMStream().get(),
2,
AnalysisResults.OutValue);
}
@@ -349,7 +349,7 @@ runAVI(const DataFlowGraph &DFG,
}
template<>
void MFP::dump(llvm::raw_ostream &Stream,
void mfp::dump(llvm::raw_ostream &Stream,
unsigned Indent,
const std::map<llvm::Instruction *, ConstantRangeSet> &Element) {
for (const auto &[I, Range] : Element) {
@@ -362,7 +362,7 @@ void MFP::dump(llvm::raw_ostream &Stream,
}
template<>
void MFP::dumpLabel(llvm::raw_ostream &Stream,
void mfp::dumpLabel(llvm::raw_ostream &Stream,
const ControlFlowEdgesGraph::Node *const &Label) {
Stream << Label->toString();
}
+9 -9
View File
@@ -36,7 +36,7 @@ struct OperationsMFI : public SetUnionLattice<IntSet> {
using GraphType = OperationGraph *;
using LatticeElement = IntSet;
using ExtraStateKey = OperationKey;
using ExtraStateType = MFP::ExtraState<OperationKey, LatticeElement>;
using ExtraStateType = mfp::ExtraState<OperationKey, LatticeElement>;
LatticeElement applyTransferFunction(Label Node,
const LatticeElement &In,
@@ -52,7 +52,7 @@ struct OperationsMFI : public SetUnionLattice<IntSet> {
}
};
static_assert(MFP::MonotoneFrameworkInstance<OperationsMFI>);
static_assert(mfp::MonotoneFrameworkInstance<OperationsMFI>);
namespace {
@@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(DiamondMFP) {
IntSet ExtremalValue;
std::vector<OperationNode *> ExtremalLabels{ G.Entry };
MFP::MFPConfiguration<OperationsMFI> Configuration{
mfp::MFPConfiguration<OperationsMFI> Configuration{
.Instance = &MFI,
.Flow = &G.Graph,
.Bottom = &Bottom,
@@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(DiamondMFP) {
.ExtremalLabels = &ExtremalLabels,
};
auto Result = MFP::getMaximalFixedPoint<OperationsMFI>(Configuration);
auto Result = mfp::getMaximalFixedPoint<OperationsMFI>(Configuration);
BOOST_TEST(Result.at(G.Entry).InValue == IntSet{});
BOOST_TEST(Result.at(G.Entry).OutValue == IntSet({ 1 }));
@@ -143,7 +143,7 @@ BOOST_AUTO_TEST_CASE(LoopMFP) {
IntSet ExtremalValue;
std::vector<OperationNode *> ExtremalLabels{ A };
MFP::MFPConfiguration<OperationsMFI> Configuration{
mfp::MFPConfiguration<OperationsMFI> Configuration{
.Instance = &MFI,
.Flow = &Graph,
.Bottom = &Bottom,
@@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(LoopMFP) {
.ExtremalLabels = &ExtremalLabels,
};
auto Result = MFP::getMaximalFixedPoint<OperationsMFI>(Configuration);
auto Result = mfp::getMaximalFixedPoint<OperationsMFI>(Configuration);
// The loop forces B and C's incoming values to include {1, 2, 3, 4} once
// the analysis converges.
@@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(LoopMFP) {
BOOST_AUTO_TEST_CASE(ExtraStateRecordingOnDiamond) {
DiamondGraph G;
using State = MFP::ExtraState<OperationKey, IntSet>;
using State = mfp::ExtraState<OperationKey, IntSet>;
State S;
// Mark a single point per node.
@@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE(ExtraStateRecordingOnDiamond) {
IntSet ExtremalValue;
std::vector<OperationNode *> ExtremalLabels{ G.Entry };
MFP::MFPConfiguration<OperationsMFI> Configuration{
mfp::MFPConfiguration<OperationsMFI> Configuration{
.Instance = &MFI,
.Flow = &G.Graph,
.Bottom = &Bottom,
@@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(ExtraStateRecordingOnDiamond) {
.ExtraState = &S
};
auto Result = MFP::getMaximalFixedPoint<OperationsMFI>(Configuration);
auto Result = mfp::getMaximalFixedPoint<OperationsMFI>(Configuration);
// Sanity: the fixed-point lattice values must match the diamond test above.
BOOST_TEST(Result.at(G.Tail).OutValue == IntSet({ 1, 2, 3, 4 }));
+5 -5
View File
@@ -134,14 +134,14 @@ BOOST_AUTO_TEST_CASE(LivenessTest) {
// the forward entry), and a single exit doesn't reach no-return blocks.
// Use `All` to seed RPOT from every node.
using InverseGT = llvm::GraphTraits<llvm::Inverse<const rua::Function *>>;
auto GetMaximalFixedPoint = MFP::getMaximalFixedPoint<Liveness, InverseGT>;
return GetMaximalFixedPoint(MFP::MFPConfiguration<Liveness>{
auto GetMaximalFixedPoint = mfp::getMaximalFixedPoint<Liveness, InverseGT>;
return GetMaximalFixedPoint(mfp::MFPConfiguration<Liveness>{
.Instance = &LA,
.Flow = &Function,
.Bottom = &DefaultValue,
.ExtremalValue = &DefaultValue,
.ExtremalLabels = &ExtremalLabels,
.EntryLabels = MFP::All{} });
.EntryLabels = mfp::All{} });
};
auto RunOnSingleNode =
@@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE(ReachingDefinitionsTest) {
auto DefaultValue = RD.defaultValue();
std::vector ExtremalLabels{ F.Entry };
MFP::MFPConfiguration<ReachingDefinitions> Configuration{
mfp::MFPConfiguration<ReachingDefinitions> Configuration{
.Instance = &RD,
.Flow = &F.Function,
.Bottom = &DefaultValue,
@@ -294,7 +294,7 @@ BOOST_AUTO_TEST_CASE(ReachingDefinitionsTest) {
.ExtremalLabels = &ExtremalLabels
};
using namespace MFP;
using namespace mfp;
auto Results = getMaximalFixedPoint<ReachingDefinitions>(Configuration);
return ReachingDefinitions::compute(Results[F.Exit].OutValue,
Results[F.Sink].OutValue);