mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Drop Logger's StaticEnabled feature
This commit is contained in:
@@ -152,7 +152,7 @@ public:
|
||||
std::strong_ordering operator<=>(const TypeLinkTag &Other) const = default;
|
||||
|
||||
friend void
|
||||
writeToLog(Logger<true> &L, const dla::TypeLinkTag &T, int /* Ignore */);
|
||||
writeToLog(Logger &L, const dla::TypeLinkTag &T, int /* Ignore */);
|
||||
|
||||
}; // end class TypeLinkTag
|
||||
|
||||
|
||||
@@ -68,8 +68,7 @@ public:
|
||||
void dump(T &Output, const char *Prefix = "") const;
|
||||
};
|
||||
|
||||
extern template void RUAResults::dump<Logger<true>>(Logger<true> &,
|
||||
const char *) const;
|
||||
extern template void RUAResults::dump<Logger>(Logger &, const char *) const;
|
||||
|
||||
RUAResults analyzeRegisterUsage(llvm::Function *F,
|
||||
const GeneratedCodeBasicInfo &,
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "revng/Support/Assert.h"
|
||||
|
||||
template<bool StaticallyEnabled>
|
||||
class Logger;
|
||||
|
||||
/// Different types of accesses to the CPU State Variables (CSVs), with a set of
|
||||
@@ -72,7 +71,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
friend void writeToLog(Logger<true> &L, const CSVOffsets &O, int /*Ignore*/);
|
||||
friend void writeToLog(Logger &L, const CSVOffsets &O, int /*Ignore*/);
|
||||
|
||||
private:
|
||||
explicit operator Kind() const { return OffsetKind; }
|
||||
|
||||
+13
-13
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace MFP {
|
||||
|
||||
inline Logger<> NullLogger("");
|
||||
inline Logger NullLogger("");
|
||||
|
||||
template<typename T>
|
||||
void dump(llvm::raw_ostream &Stream, unsigned Indent, const T &Element) {
|
||||
@@ -87,7 +87,7 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
typename MFIType::LatticeElement ExtremalValue,
|
||||
const std::vector<typename MFIType::Label> &ExtremalLabels,
|
||||
const std::vector<typename MFIType::Label> &InitialNodes,
|
||||
Logger<> &Logger = NullLogger) {
|
||||
Logger &Logger = NullLogger) {
|
||||
using Label = typename MFIType::Label;
|
||||
using LatticeElement = typename MFIType::LatticeElement;
|
||||
|
||||
@@ -111,13 +111,13 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
|
||||
if (Logger.isEnabled()) {
|
||||
revng_log(Logger, "Initializing extremal labels");
|
||||
LoggerIndent<> Indent(Logger);
|
||||
LoggerIndent Indent(Logger);
|
||||
Logger << "Extremal value:\n";
|
||||
MFP::dump(*Logger.getAsLLVMStream(), 1, ExtremalValue);
|
||||
Logger << DoLog;
|
||||
|
||||
Logger << "Extremal labels:" << DoLog;
|
||||
LoggerIndent<> Indent2(Logger);
|
||||
LoggerIndent Indent2(Logger);
|
||||
for (Label ExtremalLabel : ExtremalLabels) {
|
||||
MFP::dumpLabel(*Logger.getAsLLVMStream(), ExtremalLabel);
|
||||
Logger << DoLog;
|
||||
@@ -129,13 +129,13 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
|
||||
if (Logger.isEnabled()) {
|
||||
revng_log(Logger, "Initializing initial nodes");
|
||||
LoggerIndent<> Indent(Logger);
|
||||
LoggerIndent Indent(Logger);
|
||||
Logger << "Initial value:\n";
|
||||
MFP::dump(*Logger.getAsLLVMStream(), 1, InitialValue);
|
||||
Logger << DoLog;
|
||||
|
||||
Logger << "Initial labels:" << DoLog;
|
||||
LoggerIndent<> Indent2(Logger);
|
||||
LoggerIndent Indent2(Logger);
|
||||
for (Label InitialNode : InitialNodes) {
|
||||
MFP::dumpLabel(*Logger.getAsLLVMStream(), InitialNode);
|
||||
Logger << DoLog;
|
||||
@@ -163,7 +163,7 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
|
||||
// Step 2 iterations
|
||||
revng_log(Logger, "Starting the iterations");
|
||||
LoggerIndent<> Indent(Logger);
|
||||
LoggerIndent Indent(Logger);
|
||||
|
||||
unsigned IterationIndex = 0;
|
||||
while (not Worklist.empty()) {
|
||||
@@ -180,7 +180,7 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
Logger << DoLog;
|
||||
}
|
||||
|
||||
LoggerIndent<> Indent(Logger);
|
||||
LoggerIndent Indent(Logger);
|
||||
|
||||
if (Logger.isEnabled()) {
|
||||
Logger << "Initial value:\n";
|
||||
@@ -199,7 +199,7 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
Logger.unindent();
|
||||
|
||||
if (Logger.isEnabled()) {
|
||||
LoggerIndent<> Indent(Logger);
|
||||
LoggerIndent Indent(Logger);
|
||||
Logger << "New final value:\n";
|
||||
MFP::dump(*Logger.getAsLLVMStream(), 1, New);
|
||||
Logger << DoLog;
|
||||
@@ -212,7 +212,7 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
|
||||
// Enqueue successors that need to be recomputed
|
||||
revng_log(Logger, "Processing successors:");
|
||||
LoggerIndent<> Indent2(Logger);
|
||||
LoggerIndent Indent2(Logger);
|
||||
for (Label Successor : successors<GT>(Start)) {
|
||||
auto &SuccessorResults = AnalysisResult.at(Successor);
|
||||
|
||||
@@ -222,12 +222,12 @@ getMaximalFixedPoint(const MFIType &MFI,
|
||||
Logger << DoLog;
|
||||
|
||||
Logger << "Initial value:\n";
|
||||
LoggerIndent<> Indent(Logger);
|
||||
LoggerIndent Indent(Logger);
|
||||
Logger << DoLog;
|
||||
MFP::dump(*Logger.getAsLLVMStream(), 1, SuccessorResults.InValue);
|
||||
Logger << DoLog;
|
||||
}
|
||||
LoggerIndent<> Indent(Logger);
|
||||
LoggerIndent Indent(Logger);
|
||||
|
||||
if (not MFI.isLessOrEqual(LabelAnalysis.OutValue,
|
||||
SuccessorResults.InValue)) {
|
||||
@@ -265,7 +265,7 @@ getMaximalFixedPoint(const MFI &Instance,
|
||||
typename MFI::LatticeElement InitialValue,
|
||||
typename MFI::LatticeElement ExtremalValue,
|
||||
const std::vector<typename MFI::Label> &ExtremalLabels,
|
||||
Logger<> &Logger = NullLogger) {
|
||||
Logger &Logger = NullLogger) {
|
||||
using Label = typename MFI::Label;
|
||||
std::vector<Label> InitialNodes(ExtremalLabels);
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ class BinaryImporterHelper {
|
||||
protected:
|
||||
model::Binary &Binary;
|
||||
uint64_t BaseAddress = 0;
|
||||
Logger<> &Logger;
|
||||
Logger &Logger;
|
||||
llvm::SmallVector<const model::Segment *> ExecutableSegments;
|
||||
bool SegmentsInitialized = false;
|
||||
|
||||
public:
|
||||
BinaryImporterHelper(model::Binary &Binary,
|
||||
uint64_t BaseAddress,
|
||||
::Logger<> &Logger) :
|
||||
::Logger &Logger) :
|
||||
Binary(Binary), BaseAddress(BaseAddress), Logger(Logger) {}
|
||||
|
||||
public:
|
||||
|
||||
@@ -77,5 +77,4 @@ public:
|
||||
private:
|
||||
std::pair<const model::Segment *, uint64_t>
|
||||
findOffsetInSegment(MetaAddress Address, uint64_t Size) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "revng/Support/Debug.h"
|
||||
#include "revng/TupleTree/TupleTree.h"
|
||||
|
||||
inline Logger<> ModelVerifyLogger("model-verify");
|
||||
inline Logger ModelVerifyLogger("model-verify");
|
||||
|
||||
namespace model {
|
||||
class TypeDefinition;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
namespace pipeline {
|
||||
|
||||
extern Logger<> ExplanationLogger;
|
||||
extern Logger<> CommandLogger;
|
||||
extern Logger ExplanationLogger;
|
||||
extern Logger CommandLogger;
|
||||
|
||||
/// A class that contains every object that has a lifetime longer than a
|
||||
/// pipeline.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "revng/Pipeline/ContainerEnumerator.h"
|
||||
#include "revng/Pipeline/Pipe.h"
|
||||
|
||||
inline Logger<> ModuleStatisticsLogger("module-statistics");
|
||||
inline Logger ModuleStatisticsLogger("module-statistics");
|
||||
|
||||
namespace pipeline {
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "revng/Pipeline/Target.h"
|
||||
#include "revng/Support/Debug.h"
|
||||
|
||||
inline Logger<> InvalidationLog("invalidation");
|
||||
inline Logger InvalidationLog("invalidation");
|
||||
|
||||
namespace pipeline {
|
||||
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
const ContainerToTargetsMap &Target) const override {
|
||||
revng_log(InvalidationLog,
|
||||
"Computing requirements for " << this->Invokable.getName());
|
||||
LoggerIndent<> Imdent(InvalidationLog);
|
||||
LoggerIndent Imdent(InvalidationLog);
|
||||
|
||||
const auto &Contracts = Invokable.getPipe().getContract();
|
||||
ContainerToTargetsMap Input = Target;
|
||||
@@ -327,7 +327,7 @@ public:
|
||||
llvm::StringRef GlobalName,
|
||||
const TupleTreePath &Path,
|
||||
ContainerToTargetsMap &Out,
|
||||
Logger<> &Log) const;
|
||||
Logger &Log) const;
|
||||
|
||||
void remove(const ContainerToTargetsMap &Map);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
void registerTargetsDependingOn(llvm::StringRef GlobalName,
|
||||
const TupleTreePath &Path,
|
||||
TargetInStepSet &Out,
|
||||
Logger<> &Log) const;
|
||||
Logger &Log) const;
|
||||
|
||||
private:
|
||||
llvm::Error loadInvalidationMetadataImpl(const revng::DirectoryPath &Path,
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
|
||||
class GHASTDumper {
|
||||
size_t GraphLogCounter;
|
||||
Logger<> &Logger;
|
||||
Logger &Logger;
|
||||
std::string FunctionName;
|
||||
const ASTTree &AST;
|
||||
std::string FolderName;
|
||||
|
||||
public:
|
||||
GHASTDumper(::Logger<> &Logger,
|
||||
GHASTDumper(::Logger &Logger,
|
||||
const llvm::Function &F,
|
||||
const ASTTree &TheAST,
|
||||
const std::string &FolderName) :
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// TODO: move the definition of this object in an unique place, to avoid using
|
||||
// an extern declaration
|
||||
extern Logger<> CombLogger;
|
||||
extern Logger CombLogger;
|
||||
|
||||
template<class NodeT>
|
||||
using RegionCFGEdge = typename BasicBlockNode<NodeT>::EdgeDescriptor;
|
||||
|
||||
@@ -38,7 +38,6 @@ struct LogTerminator {
|
||||
///
|
||||
/// The typical usage of this class is to be a static global variable in a
|
||||
/// translation unit.
|
||||
template<bool StaticEnabled = true>
|
||||
class Logger {
|
||||
private:
|
||||
static unsigned IndentLevel;
|
||||
@@ -50,7 +49,7 @@ public:
|
||||
void unindent(unsigned Level = 1);
|
||||
void setIndentation(unsigned Level);
|
||||
|
||||
bool isEnabled() const { return StaticEnabled && Enabled; }
|
||||
bool isEnabled() const { return Enabled; }
|
||||
llvm::StringRef name() const { return Name; }
|
||||
// TODO: allow optional description
|
||||
llvm::StringRef description() const { return ""; }
|
||||
@@ -74,11 +73,10 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<bool X>
|
||||
friend void writeToLog(Logger<X> &This, const LogTerminator &T, int Ignore);
|
||||
friend void writeToLog(Logger &This, const LogTerminator &T, int Ignore);
|
||||
|
||||
template<bool X, typename T, typename LowPrio>
|
||||
friend void writeToLog(Logger<X> &This, const T Other, LowPrio Ignore);
|
||||
template<typename T, typename LowPrio>
|
||||
friend void writeToLog(Logger &This, const T Other, LowPrio Ignore);
|
||||
|
||||
std::unique_ptr<llvm::raw_ostream> getAsLLVMStream() {
|
||||
if (Enabled)
|
||||
@@ -96,14 +94,13 @@ private:
|
||||
};
|
||||
|
||||
/// Indent all loggers within the scope of this object
|
||||
template<bool StaticEnabled = true>
|
||||
class LoggerIndent {
|
||||
public:
|
||||
LoggerIndent(Logger<StaticEnabled> &L) : L(L) { L.indent(); }
|
||||
LoggerIndent(Logger &L) : L(L) { L.indent(); }
|
||||
~LoggerIndent() { L.unindent(); }
|
||||
|
||||
private:
|
||||
Logger<StaticEnabled> &L;
|
||||
Logger &L;
|
||||
};
|
||||
|
||||
/// Emit a message for the specified logger upon return
|
||||
@@ -111,14 +108,13 @@ private:
|
||||
/// You can create an instance of this object associated to a Logger, so that
|
||||
/// when the object goes out of scope (typically, on return), the emit method
|
||||
/// will be invoked.
|
||||
template<bool StaticEnabled = true>
|
||||
class LogOnReturn {
|
||||
public:
|
||||
LogOnReturn(Logger<StaticEnabled> &L) : L(L) {}
|
||||
LogOnReturn(Logger &L) : L(L) {}
|
||||
~LogOnReturn() { L.flush(); }
|
||||
|
||||
private:
|
||||
Logger<StaticEnabled> &L;
|
||||
Logger &L;
|
||||
};
|
||||
|
||||
/// The catch-all function for logging, it can log any type not already handled
|
||||
@@ -135,27 +131,24 @@ private:
|
||||
/// overloads should never have overlapping types for \p Other.
|
||||
///
|
||||
/// For an example see the next specialization.
|
||||
template<bool X, typename T, typename LowPrio>
|
||||
inline void writeToLog(Logger<X> &This, const T Other, LowPrio) {
|
||||
template<typename T, typename LowPrio>
|
||||
inline void writeToLog(Logger &This, const T Other, LowPrio) {
|
||||
if (This.isEnabled())
|
||||
This.Buffer << Other;
|
||||
}
|
||||
|
||||
/// Specialization of writeToLog to emit a message
|
||||
template<bool X>
|
||||
inline void writeToLog(Logger<X> &This, const LogTerminator &LineInfo, int) {
|
||||
inline void writeToLog(Logger &This, const LogTerminator &LineInfo, int) {
|
||||
This.flush(LineInfo);
|
||||
}
|
||||
|
||||
/// Specialization for llvm::StringRef
|
||||
template<bool X>
|
||||
inline void writeToLog(Logger<X> &This, const llvm::StringRef &S, int Ign) {
|
||||
inline void writeToLog(Logger &This, const llvm::StringRef &S, int Ign) {
|
||||
writeToLog(This, S.str(), Ign);
|
||||
}
|
||||
|
||||
/// Specialization for llvm::Error
|
||||
template<bool X>
|
||||
inline void writeToLog(Logger<X> &This, const llvm::Error &Error, int Ign) {
|
||||
inline void writeToLog(Logger &This, const llvm::Error &Error, int Ign) {
|
||||
std::string Message;
|
||||
{
|
||||
llvm::raw_string_ostream Stream(Message);
|
||||
@@ -203,9 +196,9 @@ private:
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
extern Logger<> NRALog;
|
||||
extern Logger<> PassesLog;
|
||||
extern Logger<> ReleaseLog;
|
||||
extern Logger<> VerifyLog;
|
||||
extern Logger NRALog;
|
||||
extern Logger PassesLog;
|
||||
extern Logger ReleaseLog;
|
||||
extern Logger VerifyLog;
|
||||
|
||||
void writeToFile(llvm::StringRef What, llvm::StringRef Path) debug_function;
|
||||
|
||||
@@ -503,7 +503,7 @@ inline llvm::BasicBlock *blockByName(llvm::Function *F, const char *Name) {
|
||||
/// Specialization of writeToLog for llvm::Value-derived types
|
||||
template<typename T>
|
||||
requires std::derived_from<llvm::Value, std::remove_const_t<T>>
|
||||
inline void writeToLog(Logger<true> &This, T *I, int) {
|
||||
inline void writeToLog(Logger &This, T *I, int) {
|
||||
if (I != nullptr)
|
||||
This << getName(I);
|
||||
else
|
||||
@@ -1049,8 +1049,8 @@ concept LLVMRawOStreamDumpable = not ValueLikePrintable<T>
|
||||
llvm::raw_ostream &>());
|
||||
};
|
||||
|
||||
template<bool B, LLVMRawOStreamDumpable Dumpable>
|
||||
inline void writeToLog(Logger<B> &L, const Dumpable &P, int /* Ignore */) {
|
||||
template<LLVMRawOStreamDumpable Dumpable>
|
||||
inline void writeToLog(Logger &L, const Dumpable &P, int /* Ignore */) {
|
||||
if (L.isEnabled()) {
|
||||
llvm::SmallString<32> Buffer;
|
||||
{
|
||||
|
||||
@@ -224,10 +224,9 @@ struct llvm::yaml::ScalarTraits<T> {
|
||||
};
|
||||
|
||||
/// Specialization for the std::variant we have in TupleTreeReference
|
||||
template<bool X, typename T>
|
||||
inline void writeToLog(Logger<X> &This,
|
||||
const std::variant<T *, const T *> &Var,
|
||||
int Ignored) {
|
||||
template<typename T>
|
||||
inline void
|
||||
writeToLog(Logger &This, const std::variant<T *, const T *> &Var, int Ignored) {
|
||||
if (Var.index() == std::variant_npos)
|
||||
writeToLog(This, llvm::StringRef("std::variant_npos"), Ignored);
|
||||
else if (std::holds_alternative<T *>(Var))
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace llvm {
|
||||
class APInt;
|
||||
}
|
||||
|
||||
inline Logger<> ValueMaterializerLogger("value-materializer");
|
||||
inline Logger ValueMaterializerLogger("value-materializer");
|
||||
|
||||
std::string aviFormatter(const llvm::APInt &Value);
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ using TokenMapT = std::map<const llvm::Value *, std::string>;
|
||||
using ModelTypesMap = std::map<const llvm::Value *,
|
||||
const model::UpcastableType>;
|
||||
|
||||
static Logger<> Log{ "c-backend" };
|
||||
static Logger<> VisitLog{ "c-backend-visit-order" };
|
||||
static Logger Log{ "c-backend" };
|
||||
static Logger VisitLog{ "c-backend-visit-order" };
|
||||
|
||||
static bool isStackFrameDecl(const llvm::Value *I) {
|
||||
auto *Call = dyn_cast_or_null<llvm::CallInst>(I);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "revng/Support/Error.h"
|
||||
#include "revng/Support/IRHelpers.h"
|
||||
|
||||
static Logger<> Log("discarded-debug-information");
|
||||
static Logger Log("discarded-debug-information");
|
||||
|
||||
struct DiscardBrokenDebugInformation : public llvm::FunctionPass {
|
||||
public:
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log{ "exit-ssa" };
|
||||
static Logger Log{ "exit-ssa" };
|
||||
|
||||
struct ExitSSAPass : public FunctionPass {
|
||||
public:
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "revng/Support/DecompilationHelpers.h"
|
||||
#include "revng/Support/YAMLTraits.h"
|
||||
|
||||
static Logger<> Log{ "fold-model-gep" };
|
||||
static Logger Log{ "fold-model-gep" };
|
||||
|
||||
struct FoldModelGEP : public llvm::FunctionPass {
|
||||
public:
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "revng/TypeNames/LLVMTypeNames.h"
|
||||
#include "revng/TypeNames/ModelCBuilder.h"
|
||||
|
||||
static Logger<> Log{ "implicit-model-cast" };
|
||||
static Logger Log{ "implicit-model-cast" };
|
||||
|
||||
using ValueTypeMap = std::map<const llvm::Value *, const model::UpcastableType>;
|
||||
using ModelPromotedTypesMap = std::map<const llvm::Instruction *, ValueTypeMap>;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log{ "loop-rewrite-with-canonical-induction-variable" };
|
||||
static Logger Log{ "loop-rewrite-with-canonical-induction-variable" };
|
||||
|
||||
class LoopRewriteIV {
|
||||
public:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "revng/Support/YAMLTraits.h"
|
||||
#include "revng/TypeNames/LLVMTypeNames.h"
|
||||
|
||||
static Logger<> Log{ "make-model-cast" };
|
||||
static Logger Log{ "make-model-cast" };
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ using llvm::Value;
|
||||
using model::CABIFunctionDefinition;
|
||||
using model::RawFunctionDefinition;
|
||||
|
||||
static Logger<> ModelGEPLog{ "make-model-gep" };
|
||||
static Logger ModelGEPLog{ "make-model-gep" };
|
||||
|
||||
// This struct represents an llvm::Value for which it has been determined that
|
||||
// it has pointer semantic on the model, along with the type of the pointee.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("peephole-opt-for-decompilation");
|
||||
static Logger Log("peephole-opt-for-decompilation");
|
||||
|
||||
struct PeepholeOptimizationPass : public FunctionPass {
|
||||
public:
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
using namespace llvm;
|
||||
using namespace ::revng::kinds;
|
||||
|
||||
static Logger<> Log("switch-opt");
|
||||
static Logger Log("switch-opt");
|
||||
|
||||
class RawBinaryMemoryOracle final : public MemoryOracle {
|
||||
private:
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "revng/Support/Debug.h"
|
||||
#include "revng/Support/DecompilationHelpers.h"
|
||||
|
||||
static Logger<> Log{ "switch-to-statements" };
|
||||
static Logger Log{ "switch-to-statements" };
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ using namespace clift;
|
||||
|
||||
namespace {
|
||||
|
||||
static Logger<> BasicBlockLog{ "llvm-to-clift-basic-blocks" };
|
||||
static Logger<> ExpressionLog{ "llvm-to-clift-expressions" };
|
||||
static Logger BasicBlockLog{ "llvm-to-clift-basic-blocks" };
|
||||
static Logger ExpressionLog{ "llvm-to-clift-expressions" };
|
||||
|
||||
// These helper functions are used to save insertion points *after* an
|
||||
// operation, while the usual operating mode of `OpBuilder::InsertPoint` is
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
using namespace model;
|
||||
using namespace dla;
|
||||
|
||||
static Logger<> Log("dla-make-model");
|
||||
static Logger<> ModelLog("dla-dump-model");
|
||||
static Logger<> TypeMapLog("dla-type-map");
|
||||
static Logger Log("dla-make-model");
|
||||
static Logger ModelLog("dla-dump-model");
|
||||
static Logger TypeMapLog("dla-type-map");
|
||||
|
||||
using model::UpcastableType;
|
||||
using LTSN = LayoutTypeSystemNode;
|
||||
|
||||
@@ -40,8 +40,8 @@ using namespace dla;
|
||||
|
||||
using llvm::dyn_cast;
|
||||
|
||||
static Logger<> Log("dla-update-model-funcs");
|
||||
static Logger<> ModelLog("dla-dump-model-with-funcs");
|
||||
static Logger Log("dla-update-model-funcs");
|
||||
static Logger ModelLog("dla-dump-model-with-funcs");
|
||||
|
||||
using model::PrimitiveKind::Generic;
|
||||
using model::PrimitiveKind::PointerOrNumber;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
char DLAPass::ID = 0;
|
||||
|
||||
static Logger<> BuilderLog("dla-builder-log");
|
||||
static Logger BuilderLog("dla-builder-log");
|
||||
|
||||
using Register = llvm::RegisterPass<DLAPass>;
|
||||
static ::Register X("dla", "Data Layout Analysis Pass", false, false);
|
||||
|
||||
@@ -25,7 +25,7 @@ using namespace llvm;
|
||||
|
||||
using NodeAllocatorT = SpecificBumpPtrAllocator<dla::LayoutTypeSystemNode>;
|
||||
|
||||
static Logger<> CollapsedNodePrinter("dla-print-collapsed-in-dot");
|
||||
static Logger CollapsedNodePrinter("dla-print-collapsed-in-dot");
|
||||
|
||||
void *operator new(size_t, NodeAllocatorT &NodeAllocator);
|
||||
void *operator new(size_t, NodeAllocatorT &NodeAllocator) {
|
||||
@@ -289,7 +289,7 @@ static void fixPredSucc(LayoutTypeSystemNode *From,
|
||||
}
|
||||
}
|
||||
|
||||
static Logger<> MergeLog("dla-merge-nodes");
|
||||
static Logger MergeLog("dla-merge-nodes");
|
||||
|
||||
void LayoutTypeSystem::mergeNodes(llvm::ArrayRef<LayoutTypeSystemNode *>
|
||||
ToMerge) {
|
||||
@@ -489,7 +489,7 @@ void LayoutTypeSystem::dropOutgoingEdges(LayoutTypeSystemNode *N) {
|
||||
It = eraseEdge(N, It);
|
||||
}
|
||||
|
||||
static Logger<> VerifyDLALog("dla-verify-strict");
|
||||
static Logger VerifyDLALog("dla-verify-strict");
|
||||
|
||||
bool LayoutTypeSystem::verifyConsistency() const {
|
||||
for (LayoutTypeSystemNode *NodePtr : Layouts) {
|
||||
@@ -805,7 +805,7 @@ void TSDebugPrinter::printNodeContent(const LayoutTypeSystem &TS,
|
||||
File << "]" << DoRet;
|
||||
}
|
||||
|
||||
void writeToLog(Logger<true> &Log, const TypeLinkTag &Tag, int /* Ignore */) {
|
||||
void writeToLog(Logger &Log, const TypeLinkTag &Tag, int /* Ignore */) {
|
||||
|
||||
switch (Tag.getKind()) {
|
||||
case TypeLinkTag::LK_Equality: {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "DLAStep.h"
|
||||
#include "FieldSizeComputation.h"
|
||||
|
||||
static Logger<> Log{ "sort-accesses-hierarchically" };
|
||||
static Logger Log{ "sort-accesses-hierarchically" };
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> LogVerbose("dla-collapse-verbose");
|
||||
static Logger LogVerbose("dla-collapse-verbose");
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ using PointerFilterT = EdgeFilteredGraph<LTSN *, dla::isPointerEdge>;
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("dla-collapse-single-child");
|
||||
static Logger Log("dla-collapse-single-child");
|
||||
|
||||
namespace dla {
|
||||
bool CollapseSingleChild::collapseSingle(LayoutTypeSystem &TS,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("dla-compute-upper-member-access");
|
||||
static Logger Log("dla-compute-upper-member-access");
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("dla-prune");
|
||||
static Logger Log("dla-prune");
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ static std::string getStepNameFromID(const void *ID) {
|
||||
revng_abort("Unexpected ID for DLAStep");
|
||||
}
|
||||
|
||||
static Logger<> DLAStepManagerLog("dla-step-manager");
|
||||
static Logger<> DLADumpDot("dla-step-dump-dot");
|
||||
static Logger DLAStepManagerLog("dla-step-manager");
|
||||
static Logger DLADumpDot("dla-step-dump-dot");
|
||||
|
||||
[[nodiscard]] bool StepManager::addStep(std::unique_ptr<Step> S) {
|
||||
const void *StepID = S->getStepID();
|
||||
|
||||
@@ -32,8 +32,8 @@ using NonPointerFilterT = EdgeFilteredGraph<LTSN *, dla::isNotPointerEdge>;
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("dla-deduplicate-union-fields");
|
||||
static Logger<> CmpLog("dla-duf-comparisons");
|
||||
static Logger Log("dla-deduplicate-union-fields");
|
||||
static Logger CmpLog("dla-duf-comparisons");
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("dla-merge-pointees-of-ptr-union");
|
||||
static Logger Log("dla-merge-pointees-of-ptr-union");
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("dla-merge-pointer-nodes");
|
||||
static Logger Log("dla-merge-pointer-nodes");
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "RemoveBackedges.h"
|
||||
|
||||
static Logger<> Log("dla-remove-backedges");
|
||||
static Logger Log("dla-remove-backedges");
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "DLAStep.h"
|
||||
#include "FieldSizeComputation.h"
|
||||
|
||||
static Logger<> Log{ "dla-remove-stride-edges" };
|
||||
static Logger Log{ "dla-remove-stride-edges" };
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ using InverseInstanceT = llvm::Inverse<InstanceT>;
|
||||
using CPointerT = EdgeFilteredGraph<const dla::LayoutTypeSystemNode *,
|
||||
dla::isPointerEdge>;
|
||||
|
||||
static Logger<> Log{ "dla-simplify-instance-off0" };
|
||||
static Logger Log{ "dla-simplify-instance-off0" };
|
||||
|
||||
namespace dla {
|
||||
|
||||
|
||||
@@ -28,12 +28,11 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("rua-analyses");
|
||||
static Logger Log("rua-analyses");
|
||||
|
||||
namespace efa {
|
||||
|
||||
template void RUAResults::dump<Logger<true>>(Logger<true> &,
|
||||
const char *) const;
|
||||
template void RUAResults::dump<Logger>(Logger &, const char *) const;
|
||||
|
||||
struct CallSite {
|
||||
using Node = rua::Function::Node;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("attach-debug-info");
|
||||
static Logger Log("attach-debug-info");
|
||||
|
||||
class AttachDebugInfo : public pipeline::FunctionPassImpl {
|
||||
private:
|
||||
|
||||
@@ -59,7 +59,7 @@ static opt<std::string> IndirectBranchInfoSummaryPath("indirect-branch-info-"
|
||||
"of SA2 on disk."),
|
||||
value_desc("filename"));
|
||||
|
||||
static Logger<> Log("cfg-analyzer");
|
||||
static Logger Log("cfg-analyzer");
|
||||
|
||||
static MetaAddress getFinalAddressOfBasicBlock(llvm::BasicBlock *BB) {
|
||||
auto &&[End, Size] = getPC(BB->getTerminator());
|
||||
@@ -264,7 +264,7 @@ CFGAnalyzer::collectDirectCFG(OutlinedFunction *OF) {
|
||||
using namespace llvm;
|
||||
using llvm::BasicBlock;
|
||||
revng_log(Log, "collectDirectCFG(" << OF->Function->getName().str() << ")");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
SortedVector<efa::BasicBlock> CFG;
|
||||
|
||||
@@ -285,7 +285,7 @@ CFGAnalyzer::collectDirectCFG(OutlinedFunction *OF) {
|
||||
"Creating block starting at " << ID.toString()
|
||||
<< " (preliminary ending is "
|
||||
<< Block.End().toString() << ")");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
OnceQueue<BasicBlock *> Queue;
|
||||
Queue.insert(&BB);
|
||||
@@ -312,7 +312,7 @@ CFGAnalyzer::collectDirectCFG(OutlinedFunction *OF) {
|
||||
}
|
||||
|
||||
revng_log(Log, "Considering successors");
|
||||
LoggerIndent<> Indent2(Log);
|
||||
LoggerIndent Indent2(Log);
|
||||
|
||||
for (BasicBlock *Succ : successors(Current)) {
|
||||
revng_log(Log, "Considering successor " << getName(Succ));
|
||||
@@ -739,11 +739,11 @@ FunctionSummary CFGAnalyzer::milkInfo(OutlinedFunction *OutlinedFunction,
|
||||
int64_t CallPushSize = getCallPushSize(Binary->Architecture());
|
||||
|
||||
revng_log(Log, "Milking info for " << OutlinedFunction->Address.toString());
|
||||
LoggerIndent<> Ident(Log);
|
||||
LoggerIndent Ident(Log);
|
||||
|
||||
revng_log(Log, "Initial CFG:\n");
|
||||
if (Log.isEnabled()) {
|
||||
LoggerIndent<> Ident(Log);
|
||||
LoggerIndent Ident(Log);
|
||||
for (const efa::BasicBlock &Block : CFG) {
|
||||
serialize(Log, Block);
|
||||
Log << DoLog;
|
||||
@@ -1018,7 +1018,7 @@ FunctionSummary CFGAnalyzer::milkInfo(OutlinedFunction *OutlinedFunction,
|
||||
|
||||
revng_log(Log, "Final CFG:\n");
|
||||
if (Log.isEnabled()) {
|
||||
LoggerIndent<> Ident(Log);
|
||||
LoggerIndent Ident(Log);
|
||||
for (const efa::BasicBlock &Block : CFG) {
|
||||
serialize(Log, Block);
|
||||
Log << DoLog;
|
||||
|
||||
@@ -19,7 +19,7 @@ static Register Y("collect-functions-from-callees",
|
||||
true,
|
||||
true);
|
||||
|
||||
static Logger<> Log("functions-from-callees-collection");
|
||||
static Logger Log("functions-from-callees-collection");
|
||||
|
||||
using CFFCWP = CollectFunctionsFromCalleesWrapperPass;
|
||||
void CFFCWP::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
|
||||
@@ -25,7 +25,7 @@ static Register Y("collect-functions-from-unused-addresses",
|
||||
true,
|
||||
true);
|
||||
|
||||
static Logger<> Log("functions-from-unused-addresses-collection");
|
||||
static Logger Log("functions-from-unused-addresses-collection");
|
||||
|
||||
class CFFUAImpl {
|
||||
public:
|
||||
|
||||
@@ -83,7 +83,7 @@ static opt<ABIOpt> ABIEnforcement("abi-enforcement-level",
|
||||
"found.")),
|
||||
init(ABIOpt::FullABIEnforcement));
|
||||
|
||||
static Logger<> Log("detect-abi");
|
||||
static Logger Log("detect-abi");
|
||||
|
||||
struct Changes {
|
||||
bool Function = false;
|
||||
@@ -323,7 +323,7 @@ void DetectABI::computeApproximateCallGraph() {
|
||||
|
||||
void DetectABI::preliminaryFunctionAnalysis() {
|
||||
revng_log(Log, "Running the preliminary function analysis");
|
||||
LoggerIndent<> LodIndent(Log);
|
||||
LoggerIndent LodIndent(Log);
|
||||
|
||||
BasicBlockQueue EntrypointsQueue;
|
||||
|
||||
@@ -354,7 +354,7 @@ void DetectABI::preliminaryFunctionAnalysis() {
|
||||
const BasicBlockNode *EntryNode = EntrypointsQueue.pop();
|
||||
MetaAddress EntryPointAddress = EntryNode->Address;
|
||||
revng_log(Log, "Analyzing " << EntryPointAddress.toString());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
FunctionSummary AnalysisResult = Analyzer.analyze(EntryNode->Address);
|
||||
|
||||
@@ -392,7 +392,7 @@ void DetectABI::preliminaryFunctionAnalysis() {
|
||||
if (Changed) {
|
||||
revng_log(Log,
|
||||
"Entry " << EntryPointAddress.toString() << " has changed");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
OnceQueue<const BasicBlockNode *> InlineFunctionWorklist;
|
||||
InlineFunctionWorklist.insert(EntryNode);
|
||||
|
||||
@@ -401,7 +401,7 @@ void DetectABI::preliminaryFunctionAnalysis() {
|
||||
MetaAddress NodeAddress = Node->Address;
|
||||
revng_log(Log,
|
||||
"Re-enqueuing callers of " << NodeAddress.toString() << ":");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
for (auto *Caller : Node->predecessors()) {
|
||||
// Root node?
|
||||
if (Caller->Address.isInvalid())
|
||||
@@ -450,7 +450,7 @@ void DetectABI::preliminaryFunctionAnalysis() {
|
||||
|
||||
void DetectABI::analyzeABI() {
|
||||
revng_log(Log, "Running ABI analyses");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
llvm::Task Task(2, "analyzeABI");
|
||||
std::map<MetaAddress, std::unique_ptr<OutlinedFunction>> Functions;
|
||||
@@ -494,7 +494,7 @@ void DetectABI::analyzeABI() {
|
||||
|
||||
if (Changes.Function) {
|
||||
revng_log(Log, "The function has changed, re-enqueing all callers:");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
// The prototype of the function we analyzed has changed, reanalyze
|
||||
// callers
|
||||
auto &FunctionNode = BasicBlockNodeMap[GCBI.getBlockAt(Function.Entry())];
|
||||
@@ -758,7 +758,7 @@ void DetectABI::propagatePrototypesInFunction(model::Function &Function) {
|
||||
const MetaAddress &Entry = Function.Entry();
|
||||
|
||||
revng_log(Log, "Trying to propagate prototypes for " << Entry.toString());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
FunctionSummary &Summary = Oracle.getLocalFunction(Entry);
|
||||
RUAResults &ABI = Summary.ABIResults;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "revng/ADT/STLExtras.h"
|
||||
#include "revng/EarlyFunctionAnalysis/FunctionSummaryOracle.h"
|
||||
|
||||
static Logger<> Log("efa-import-model");
|
||||
static Logger Log("efa-import-model");
|
||||
|
||||
namespace efa {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ static RegisterPass<FunctionCallIdentification> X("fci",
|
||||
true,
|
||||
true);
|
||||
|
||||
static Logger<> FilteredCFGLog("filtered-cfg");
|
||||
static Logger FilteredCFGLog("filtered-cfg");
|
||||
|
||||
bool FunctionCallIdentification::runOnModule(llvm::Module &M) {
|
||||
revng_log(PassesLog, "Starting FunctionCallIdentification");
|
||||
|
||||
@@ -110,7 +110,7 @@ using Register = RegisterPass<pipeline::FunctionPass<EnforceABI>>;
|
||||
|
||||
static Register X("enforce-abi", "Enforce ABI Pass", true, true);
|
||||
|
||||
static Logger<> EnforceABILog("enforce-abi");
|
||||
static Logger EnforceABILog("enforce-abi");
|
||||
|
||||
bool EnforceABI::prologue() {
|
||||
FunctionDispatcher = getIRHelper("function_dispatcher", M);
|
||||
|
||||
@@ -61,7 +61,7 @@ using namespace llvm;
|
||||
|
||||
class IsolateFunctionsImpl;
|
||||
|
||||
static Logger<> TheLogger("isolation");
|
||||
static Logger TheLogger("isolation");
|
||||
|
||||
// Define an alias for the data structure that will contain the LLVM functions
|
||||
using FunctionsMap = std::map<MDString *, Function *>;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
using llvm::dyn_cast;
|
||||
|
||||
static Logger<> Log{ "helpers-to-header" };
|
||||
static Logger Log{ "helpers-to-header" };
|
||||
|
||||
/// Print the declaration a C struct corresponding to an LLVM struct
|
||||
/// type.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "revng/Support/Debug.h"
|
||||
#include "revng/Support/YAMLTraits.h"
|
||||
|
||||
static Logger<> Log{ "model-to-header" };
|
||||
static Logger Log{ "model-to-header" };
|
||||
|
||||
bool ptml::HeaderBuilder::printModelHeader() {
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static aua::StructPointers collectOffsetTypes(Module &Module,
|
||||
revng_log(Log,
|
||||
"Considering argument " << Argument->getArgNo() << " of "
|
||||
<< F.getName().str());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
auto *DIArgumentType = dyn_cast_or_null<DIDerivedType>(Type);
|
||||
if (DIArgumentType == nullptr
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace aua {
|
||||
|
||||
void ArgumentUsageAnalysis::run() {
|
||||
revng_log(Log, "Running ArgumentUsageAnalysis");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Analyze functions in post order
|
||||
llvm::CallGraph CG(M);
|
||||
@@ -39,7 +39,7 @@ void ArgumentUsageAnalysis::run() {
|
||||
|
||||
void ArgumentUsageAnalysis::analyzeFunction(llvm::Function &F) {
|
||||
revng_log(Log, "Analyzing " << F.getName());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
auto [It, New] = Results.insert({ &F, Function(TheContext) });
|
||||
revng_assert(New);
|
||||
@@ -59,7 +59,7 @@ void ArgumentUsageAnalysis::analyzeFunction(llvm::Function &F) {
|
||||
// expressions
|
||||
{
|
||||
revng_log(Log, "Running analyzeInstruction");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// We do one sweep in reverse-post order. This means that, before we visit
|
||||
// an instruction all of its operands will have been visited already. The
|
||||
@@ -77,7 +77,7 @@ void ArgumentUsageAnalysis::analyzeFunction(llvm::Function &F) {
|
||||
// Do a final pass to register memory accesses (load, store, memcpy),
|
||||
// function calls and escaped arguments
|
||||
revng_log(Log, "Running registerFunctionResults");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
for (llvm::BasicBlock &BB : F)
|
||||
for (llvm::Instruction &I : BB)
|
||||
if (not I.isDebugOrPseudoInst())
|
||||
@@ -92,7 +92,7 @@ void ArgumentUsageAnalysis::analyzeFunction(llvm::Function &F) {
|
||||
void ArgumentUsageAnalysis::taintAnalysis(Function &FunctionResults,
|
||||
const llvm::Function &F) {
|
||||
revng_log(Log, "Running taint analysis");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
revng_assert(not isVarArg(F));
|
||||
revng_assert(F.arg_size() <= 64);
|
||||
@@ -334,7 +334,7 @@ void ArgumentUsageAnalysis::registerCall(Function &FunctionResults,
|
||||
Log << DoLog;
|
||||
}
|
||||
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
if (Log.isEnabled()) {
|
||||
CallSite.dump(Log);
|
||||
Log << DoLog;
|
||||
|
||||
@@ -111,7 +111,7 @@ CPUStateUsageAnalysis::computeAccessesInRoot(const Value &Offset) const {
|
||||
|
||||
for (const PointerSet &Pointer : Pointers) {
|
||||
revng_log(Log, "Considering " << Pointer.toString());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Collect the number of elements in arrays whose elements match the
|
||||
// strides in Pointer
|
||||
@@ -248,7 +248,7 @@ void CPUStateUsageAnalysis::analyze(llvm::Function &Function) {
|
||||
llvm::Task T(2, "Analyze CPU state usage of " + Function.getName());
|
||||
FastValuePrinter Printer(*Function.getParent());
|
||||
revng_log(Log, "Collecting interprocedural data in " << Function.getName());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
revng_log(Log, "Collecting global results");
|
||||
T.advance("Collecting global results");
|
||||
@@ -257,7 +257,7 @@ void CPUStateUsageAnalysis::analyze(llvm::Function &Function) {
|
||||
|
||||
T.advance("Processing arguments");
|
||||
revng_log(Log, "Processing arguments of " << Function.getName());
|
||||
LoggerIndent<> Indent2(Log);
|
||||
LoggerIndent Indent2(Log);
|
||||
|
||||
for (auto &&[ArgumentIndex, Argument] : llvm::enumerate(Function.args())) {
|
||||
auto &Offsets = Initializer.getOffsetsFor(Argument);
|
||||
@@ -277,7 +277,7 @@ void CPUStateUsageAnalysis::analyze(llvm::Function &Function) {
|
||||
Log << DoLog;
|
||||
}
|
||||
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// If the argument is escaping, bail out
|
||||
bool Escapes = false;
|
||||
@@ -452,7 +452,7 @@ CPUStateUsageAnalysis::collectGlobalAUAResults(const llvm::Function &Function) {
|
||||
Callee.dump(Log, " ");
|
||||
Log << DoLog;
|
||||
}
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Register escaped arguments replacing arguments
|
||||
for (const EscapedArgument &EscapedArgument :
|
||||
@@ -548,7 +548,7 @@ void StructPointers::visitType(llvm::Type &Type, uint64_t StartingOffset) {
|
||||
revng_log(Log,
|
||||
"Registering an instance of " << Struct->getName()
|
||||
<< " at offset " << StartingOffset);
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
if (Struct->getName().size() != 0)
|
||||
OffsetsOfStructs[Struct].push_back(StartingOffset);
|
||||
|
||||
@@ -560,7 +560,7 @@ void StructPointers::visitType(llvm::Type &Type, uint64_t StartingOffset) {
|
||||
} else if (auto *Array = dyn_cast<llvm::ArrayType>(&Type)) {
|
||||
auto ElementsCount = Array->getNumElements();
|
||||
revng_log(Log, "Handling an array of " << ElementsCount << " elements");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
auto &ElementType = *Array->getElementType();
|
||||
auto ElementSize = DL.getTypeAllocSize(&ElementType);
|
||||
for (unsigned I = 0; I < ElementsCount; ++I)
|
||||
|
||||
@@ -40,7 +40,7 @@ using namespace llvm;
|
||||
|
||||
using std::string;
|
||||
|
||||
static Logger<> Log("fix-helpers");
|
||||
static Logger Log("fix-helpers");
|
||||
|
||||
static cl::opt<string> ArchitectureName("fix-helpers-architecture",
|
||||
cl::desc("architecture of the helper "
|
||||
@@ -53,7 +53,7 @@ static void setMetadata(VariableManager &Variables,
|
||||
StringRef MetadataName,
|
||||
const aua::Annotation::OffsetAndSizeSet &Offsets) {
|
||||
revng_log(Log, "Parsing " << MetadataName << ":");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
QuickMetadata QMD(getContext(&F));
|
||||
SmallVector<Metadata *, 2> CSVList;
|
||||
@@ -97,7 +97,7 @@ static void convertToCSVAnnotation(VariableManager &Variables,
|
||||
Function &F,
|
||||
const aua::Annotation &Annotation) {
|
||||
revng_log(Log, "Converting CSV to annotations");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
setMetadata(Variables, F, "revng.csvaccess.offsets.load", Annotation.Reads);
|
||||
setMetadata(Variables, F, "revng.csvaccess.offsets.store", Annotation.Writes);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ void AccessFixer::handle(Instruction &I,
|
||||
revng_log(Log,
|
||||
"Handling " << getName(&I) << ", which has " << Targets.size()
|
||||
<< " targets");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Handle the single-offset situation
|
||||
if (Targets.size() == 1) {
|
||||
@@ -344,7 +344,7 @@ AccessFixer::decomposeMemcpy(llvm::Instruction &I) {
|
||||
void AccessFixer::fixMemoryAccess(Instruction &I,
|
||||
const aua::Annotation &Annotation) {
|
||||
revng_log(Log, "Handling memory access " << getName(&I));
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
revng_assert(not I.isTerminator());
|
||||
auto *Load = dyn_cast<LoadInst>(&I);
|
||||
@@ -392,7 +392,7 @@ static void fixHelpers(VariableManager &Variables, Module &Module) {
|
||||
|
||||
for (Function &F : Module) {
|
||||
revng_log(Log, "Handling " << F.getName());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
auto Annotation = aua::Annotation::deserialize(F)
|
||||
.value_or(aua::Annotation());
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "Context.h"
|
||||
#include "Value.h"
|
||||
|
||||
inline Logger<> Log("argument-usage-analysis");
|
||||
inline Logger Log("argument-usage-analysis");
|
||||
|
||||
template<typename O>
|
||||
void dumpCall(O &Output, const llvm::CallInst *Call) {
|
||||
|
||||
@@ -72,7 +72,7 @@ static std::optional<std::string> findHeaderFile(const std::string &File) {
|
||||
return (*MaybeHeaderPath).substr(0, Index);
|
||||
}
|
||||
|
||||
static Logger<> Log("header-to-model-errors");
|
||||
static Logger Log("header-to-model-errors");
|
||||
|
||||
struct ImportFromCAnalysis {
|
||||
static constexpr auto Name = "import-from-c";
|
||||
|
||||
@@ -57,7 +57,7 @@ using TypeVector = llvm::SmallVector<model::UpcastableType, 8>;
|
||||
using ModelTypesMap = std::map<const llvm::Value *,
|
||||
const model::UpcastableType>;
|
||||
|
||||
static Logger<> Log{ "init-model-types" };
|
||||
static Logger Log{ "init-model-types" };
|
||||
|
||||
/// Map each llvm::Argument of the given llvm::Function to its type in the model
|
||||
static void addArgumentsTypes(const llvm::Function &LLVMFunc,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "revng/Lift/CSVOffsets.h"
|
||||
#include "revng/Support/Debug.h"
|
||||
|
||||
void writeToLog(Logger<true> &L, const CSVOffsets &O, int /*Ignore*/) {
|
||||
void writeToLog(Logger &L, const CSVOffsets &O, int /*Ignore*/) {
|
||||
L << "Kind: " << CSVOffsets::toString(O.OffsetKind);
|
||||
L << " Offsets = { ";
|
||||
for (const auto &Offset : O)
|
||||
|
||||
@@ -73,8 +73,8 @@ static cl::opt<bool> RecordTCG("record-tcg",
|
||||
cl::desc("create metadata for TCG"),
|
||||
cl::cat(MainCategory));
|
||||
|
||||
static Logger<> LibTcgLog("libtcg");
|
||||
static Logger<> Log("lift");
|
||||
static Logger LibTcgLog("libtcg");
|
||||
static Logger Log("lift");
|
||||
|
||||
template<typename T, typename... ArgTypes>
|
||||
constexpr std::array<T, sizeof...(ArgTypes)> make_array(ArgTypes &&...Args) {
|
||||
@@ -411,7 +411,7 @@ void CodeGenerator::translate(LibTcg &LibTcg,
|
||||
static std::array<char, 128> DumpBuf{ 0 };
|
||||
LibTcgLog << "Translation starting from " << VirtualAddress.toGeneric()
|
||||
<< " (size: " << ConsumedSize << " bytes)" << DoLog;
|
||||
LoggerIndent<> Indent(LibTcgLog);
|
||||
LoggerIndent Indent(LibTcgLog);
|
||||
LibTcgLog.indent();
|
||||
for (size_t I = 0; I < TranslationBlock->instruction_count; ++I) {
|
||||
auto Opcode = TranslationBlock->list[I].opcode;
|
||||
|
||||
@@ -38,7 +38,7 @@ RegisterIRHelper NewPCHelper("newpc");
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("instruction-translator");
|
||||
static Logger Log("instruction-translator");
|
||||
|
||||
using IT = InstructionTranslator;
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
Logger<> JTCountLog("jtcount");
|
||||
Logger<> RegisterJTLog("registerjt");
|
||||
Logger JTCountLog("jtcount");
|
||||
Logger RegisterJTLog("registerjt");
|
||||
|
||||
CounterMap<std::string> HarvestingStats("harvesting");
|
||||
|
||||
@@ -918,7 +918,7 @@ BasicBlock *JumpTargetManager::registerJT(MetaAddress PC,
|
||||
revng_log(RegisterJTLog,
|
||||
"Registering bb." << nameForAddress(PC) << " for "
|
||||
<< JTReason::getName(Reason));
|
||||
LoggerIndent<> Indent(RegisterJTLog);
|
||||
LoggerIndent Indent(RegisterJTLog);
|
||||
|
||||
// Do we already have a BasicBlock for this PC?
|
||||
BlockMap::iterator TargetIt = JumpTargets.find(PC);
|
||||
|
||||
@@ -49,8 +49,8 @@ RunningStatistics DetectedEdgesStatistics("detected-edges");
|
||||
RunningStatistics StoredInMemoryStatistics("stored-in-memory");
|
||||
RunningStatistics LoadAddressStatistics("load-address");
|
||||
|
||||
Logger<> NewEdgesLog("new-edges");
|
||||
static Logger<> Log("root-analyzer");
|
||||
Logger NewEdgesLog("new-edges");
|
||||
static Logger Log("root-analyzer");
|
||||
|
||||
// NOTE: Setting this to 1 gives us performance improvement. We have tested and
|
||||
// realized that there is an impact on performance if setting it to 2.
|
||||
@@ -720,7 +720,7 @@ void RootAnalyzer::collectMaterializedValues(AnalysisRegistry &AR) {
|
||||
|
||||
for (auto &[ValueMaterializerID, Operands] : MaterializedValuesById) {
|
||||
revng_log(Log, "Parsing ID " << ValueMaterializerID);
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Remove duplicates
|
||||
llvm::sort(Operands);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
// This name corresponds to a function in `early-linked`.
|
||||
RegisterIRHelper SetRegisterMarker("set_register");
|
||||
|
||||
static Logger<> Log("csv-at-offset");
|
||||
static Logger Log("csv-at-offset");
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -488,7 +488,7 @@ VariableManager::getByCPUStateOffsetWithRemainder(intptr_t Offset) {
|
||||
return MaybeResult.value();
|
||||
|
||||
revng_log(Log, "Considering offset " << Offset);
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Get the type of the field at that offset (if any) and obtain the offset
|
||||
// within the field
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
namespace {
|
||||
|
||||
// TODO: all this logic should be moved to lib/TupleTree
|
||||
Logger<> FieldAccessedLogger("field-accessed");
|
||||
Logger FieldAccessedLogger("field-accessed");
|
||||
|
||||
constexpr const char *StructNameHelpText = "regex that will make the program "
|
||||
"assert when a model struct which "
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
|
||||
Logger<> ELFImporterLog("elf-importer");
|
||||
Logger ELFImporterLog("elf-importer");
|
||||
|
||||
template<typename A, typename B>
|
||||
static bool hasFlag(A Flag, B Value) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "DwarfReader.h"
|
||||
#include "SegmentImportHelpers.h"
|
||||
|
||||
extern Logger<> ELFImporterLog;
|
||||
extern Logger ELFImporterLog;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace llvm::object;
|
||||
using namespace llvm;
|
||||
using namespace model;
|
||||
|
||||
static Logger<> Log("macho-importer");
|
||||
static Logger Log("macho-importer");
|
||||
|
||||
template<typename R>
|
||||
void swapBytes(R &Value) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
|
||||
static Logger<> Log("pecoff-importer");
|
||||
static Logger Log("pecoff-importer");
|
||||
|
||||
using PELDDTree = std::map<std::string, std::vector<std::string>>;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
static Logger<> DILogger("dwarf-importer");
|
||||
static Logger DILogger("dwarf-importer");
|
||||
static const std::string GlobalDebugDirectory = "/usr/lib/debug/";
|
||||
|
||||
template<typename M>
|
||||
@@ -1064,7 +1064,7 @@ findDebugInfoFileByName(StringRef FileName,
|
||||
llvm::object::ObjectFile *ELF) {
|
||||
revng_log(DILogger,
|
||||
"Looking for \"" << DebugFileName << "\" for " << FileName << "\"");
|
||||
LoggerIndent<> Indent(DILogger);
|
||||
LoggerIndent Indent(DILogger);
|
||||
|
||||
// Let's find it in canonical places, where debug info was fetched.
|
||||
// 1) Look for a .gnu_debuglink/.gnu_debugaltlink/.debug_sup section.
|
||||
@@ -1170,7 +1170,7 @@ void DwarfImporter::import(StringRef FileName, const ImporterOptions &Options) {
|
||||
revng_log(DILogger,
|
||||
"Importing DWARF information for "
|
||||
<< llvm::sys::path::filename(FileName));
|
||||
LoggerIndent<> Indent(DILogger);
|
||||
LoggerIndent Indent(DILogger);
|
||||
|
||||
Task T(3,
|
||||
"Importing DWARF information for "
|
||||
|
||||
@@ -51,7 +51,7 @@ using namespace llvm::codeview;
|
||||
using namespace llvm::object;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
static Logger<> Log("pdb-importer");
|
||||
static Logger Log("pdb-importer");
|
||||
|
||||
// Force using a specific PDB.
|
||||
static llvm::cl::opt<std::string> UsePDB("use-pdb",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
using namespace llvm;
|
||||
using namespace model;
|
||||
|
||||
static Logger<> Log("model-types-deduplication");
|
||||
static Logger Log("model-types-deduplication");
|
||||
|
||||
static RegisterModelPass R("deduplicate-equivalent-types",
|
||||
"Best-effort deduplication of types that are "
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("purge-model-types");
|
||||
static Logger Log("purge-model-types");
|
||||
|
||||
static RegisterModelPass R0("purge-invalid-types",
|
||||
"Remove all the types that do not verify",
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
using namespace pipeline;
|
||||
|
||||
Logger<> pipeline::ExplanationLogger("pipeline");
|
||||
Logger<> pipeline::CommandLogger("commands");
|
||||
Logger pipeline::ExplanationLogger("pipeline");
|
||||
Logger pipeline::CommandLogger("commands");
|
||||
|
||||
Context::Context() : TheKindRegistry(Registry::registerAllKinds()) {
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ void InvalidationMetadata::registerTargetsDependingOn(const Context &Context,
|
||||
const TupleTreePath &Path,
|
||||
ContainerToTargetsMap
|
||||
&Out,
|
||||
Logger<> &Log) const {
|
||||
Logger &Log) const {
|
||||
if (auto Iter = PathCache.find(GlobalName); Iter != PathCache.end()) {
|
||||
|
||||
auto &Bimap = Iter->second;
|
||||
|
||||
@@ -454,7 +454,7 @@ void Runner::getDiffInvalidations(const GlobalTupleTreeDiff &Diff,
|
||||
T.advance(Step.getName(), true);
|
||||
revng_log(InvalidationLog,
|
||||
"Computing invalidations in step " << Step.getName());
|
||||
LoggerIndent<> I(InvalidationLog);
|
||||
LoggerIndent I(InvalidationLog);
|
||||
|
||||
ContainerToTargetsMap &StepInvalidations = Map[Step.getName()];
|
||||
|
||||
@@ -472,7 +472,7 @@ void Runner::getDiffInvalidations(const GlobalTupleTreeDiff &Diff,
|
||||
revng_log(InvalidationLog, ChangedPaths.size() << " paths have changed");
|
||||
for (const TupleTreePath *Path : ChangedPaths) {
|
||||
revng_log(InvalidationLog, "Processing " << *Diff.pathAsString(*Path));
|
||||
LoggerIndent<> Indent(InvalidationLog);
|
||||
LoggerIndent Indent(InvalidationLog);
|
||||
Step.registerTargetsDependingOn(Diff.getGlobalName(),
|
||||
*Path,
|
||||
Map,
|
||||
|
||||
@@ -411,7 +411,7 @@ Error Step::load(const revng::DirectoryPath &DirPath) {
|
||||
void Step::registerTargetsDependingOn(llvm::StringRef GlobalName,
|
||||
const TupleTreePath &Path,
|
||||
TargetInStepSet &Out,
|
||||
Logger<> &Log) const {
|
||||
Logger &Log) const {
|
||||
ContainerToTargetsMap ToInvalidateMap;
|
||||
|
||||
Task T(3, "Computing invalidation for step " + getName());
|
||||
@@ -422,7 +422,7 @@ void Step::registerTargetsDependingOn(llvm::StringRef GlobalName,
|
||||
for (const PipeWrapper &Pipe : Pipes) {
|
||||
T2.advance(Pipe.Pipe->getName(), true);
|
||||
revng_log(Log, "Handling the " << Pipe.Pipe->getName() << " pipe");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
Pipe.InvalidationMetadata.registerTargetsDependingOn(*TheContext,
|
||||
GlobalName,
|
||||
Path,
|
||||
|
||||
@@ -27,7 +27,7 @@ using ArgumentRef = const revng::tracing::Argument &;
|
||||
using ArgumentsRef = const llvm::ArrayRef<revng::tracing::Argument>;
|
||||
using ReturnRef = const llvm::StringRef;
|
||||
|
||||
static Logger<> TraceRunnerLogger("trace-runner");
|
||||
static Logger TraceRunnerLogger("trace-runner");
|
||||
|
||||
namespace utils {
|
||||
// Utility functions for decoding arguments
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("compute-stack-accesses-bounds");
|
||||
static Logger Log("compute-stack-accesses-bounds");
|
||||
|
||||
template<typename T, std::ranges::range R>
|
||||
bool areAll(const R &Range) {
|
||||
@@ -38,7 +38,7 @@ getSCEVBoundaries(ScalarEvolution &SE, PostDominatorTree &PDT, Instruction *I) {
|
||||
auto FullSet = ConstantRange::getFull(SCEV->getType()->getIntegerBitWidth());
|
||||
|
||||
revng_log(Log, "getSCEVBoundaries on " << dumpToString(*SCEV));
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
auto *AddRec = dyn_cast<SCEVAddRecExpr>(SCEV);
|
||||
if (AddRec == nullptr)
|
||||
@@ -106,7 +106,7 @@ getSCEVBoundaries(ScalarEvolution &SE, PostDominatorTree &PDT, Instruction *I) {
|
||||
|
||||
bool ComputeStackAccessesBoundsPass::runOnFunction(Function &F) {
|
||||
revng_log(Log, "Running on " << F.getName().str());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
ScalarEvolution &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
|
||||
PostDominatorTree &PDT = getAnalysis<PostDominatorTreeWrapperPass>()
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using namespace llvm;
|
||||
using model::RawFunctionDefinition;
|
||||
|
||||
static Logger<> Log("detect-stack-size");
|
||||
static Logger Log("detect-stack-size");
|
||||
|
||||
static bool isValidStackSize(uint64_t Size) {
|
||||
return 0 < Size and Size < 10 * 1024 * 1024;
|
||||
@@ -147,7 +147,7 @@ void DetectStackSize::collectStackBounds(Function &F) {
|
||||
"Collecting stack bounds for "
|
||||
<< model::CNameBuilder(*Binary).name(ModelFunction));
|
||||
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Check if this function already has information about stack
|
||||
// frame/arguments
|
||||
@@ -265,7 +265,7 @@ void DetectStackSize::electFunctionStackFrameSize(FunctionStackInfo &FSI) {
|
||||
"electFunctionStackFrameSize: "
|
||||
<< model::CNameBuilder(*Binary).name(ModelFunction));
|
||||
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
if (FSI.MaxStackSize)
|
||||
revng_log(Log, "MaxStackSize: " << *FSI.MaxStackSize);
|
||||
@@ -302,7 +302,7 @@ void DetectStackSize::electFunctionStackFrameSize(FunctionStackInfo &FSI) {
|
||||
std::optional<uint64_t>
|
||||
DetectStackSize::handleCallSite(const CallSite &CallSite) {
|
||||
revng_log(Log, "CallSite");
|
||||
LoggerIndent<> Indent2(Log);
|
||||
LoggerIndent Indent2(Log);
|
||||
revng_log(Log, "CallSite.StackSize: " << CallSite.StackSize.value_or(0));
|
||||
revng_log(Log, "StackArgumentsSize: " << std::get<0>(CallSite.CallType));
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("instrument-stack-accesses");
|
||||
static Logger Log("instrument-stack-accesses");
|
||||
|
||||
class InstrumentStackAccesses {
|
||||
private:
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
public:
|
||||
void run(Function &F) {
|
||||
revng_log(Log, "Instrumenting " << F.getName());
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
reset();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ RegisterIRHelper IBIMarker("revng_undefined_local_sp");
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("promote-stack-pointer");
|
||||
static Logger Log("promote-stack-pointer");
|
||||
|
||||
struct PromoteStackPointerPassImpl : public pipeline::FunctionPassImpl {
|
||||
private:
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> Log("segregate-stack-accesses");
|
||||
static Logger Log("segregate-stack-accesses");
|
||||
|
||||
inline Value *createAdd(revng::IRBuilder &B, Value *V, uint64_t Addend) {
|
||||
return B.CreateAdd(V, ConstantInt::get(V->getType(), Addend));
|
||||
@@ -204,7 +204,7 @@ struct SegregateStackAccessesMFI : public SetUnionLattice<Lattice> {
|
||||
const LatticeElement &Value) {
|
||||
using namespace llvm;
|
||||
revng_log(Log, "Analyzing block " << getName(BB));
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
LatticeElement StackBytes = Value;
|
||||
|
||||
@@ -219,7 +219,7 @@ struct SegregateStackAccessesMFI : public SetUnionLattice<Lattice> {
|
||||
continue;
|
||||
|
||||
revng_log(Log, "Analyzing instruction " << getName(&I));
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Get stack offset, if available
|
||||
auto MaybeStartStackOffset = getStackOffset(&I);
|
||||
@@ -795,7 +795,7 @@ private:
|
||||
"Segregating "
|
||||
<< model::CNameBuilder(Binary).name(ModelFunction));
|
||||
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
// Lookup the redirector, if any
|
||||
auto It = StackArgumentsRedirectors.find(&F);
|
||||
@@ -822,7 +822,7 @@ private:
|
||||
MFIResult AnalysisResult;
|
||||
{
|
||||
revng_log(Log, "Running SegregateStackAccessesMFI");
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
using SSAMFI = SegregateStackAccessesMFI;
|
||||
BasicBlock *Entry = &F.getEntryBlock();
|
||||
AnalysisResult = MFP::getMaximalFixedPoint<SSAMFI>({},
|
||||
@@ -873,7 +873,7 @@ private:
|
||||
}
|
||||
|
||||
void handleCallSite(MFIResult &AnalysisResult, CallInst *SSACSCall) {
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
//
|
||||
// Find call to revng_undefined_local_sp
|
||||
@@ -1114,7 +1114,7 @@ private:
|
||||
|
||||
if (Log.isEnabled()) {
|
||||
Log << "Redirector data:\n";
|
||||
LoggerIndent<> X(Log);
|
||||
LoggerIndent X(Log);
|
||||
Redirector.dump(Log);
|
||||
Log << DoLog;
|
||||
}
|
||||
@@ -1301,7 +1301,7 @@ private:
|
||||
- CallInstructionPushSize);
|
||||
|
||||
revng_log(Log, "Considering " << getName(Store));
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
revng_log(Log, "Size: " << Size);
|
||||
revng_log(Log, "Info.Count: " << Info.Count);
|
||||
revng_log(Log, "Info.Offset: " << Info.Count);
|
||||
@@ -1339,7 +1339,7 @@ private:
|
||||
void handleMemoryAccess(const StackAccessRedirector &Redirector,
|
||||
Instruction *I) {
|
||||
revng_log(Log, "Handling memory access " << getName(I));
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
auto MaybeStackOffset = getStackOffset(I);
|
||||
if (not MaybeStackOffset)
|
||||
|
||||
@@ -37,7 +37,7 @@ using std::unique_ptr;
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static Logger<> BeautifyLogger("beautify");
|
||||
static Logger BeautifyLogger("beautify");
|
||||
|
||||
// Prefix for the short circuit metrics dir.
|
||||
static cl::opt<std::string> OutputPath("short-circuit-metrics-output-dir",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
using namespace llvm;
|
||||
|
||||
// Debug logger
|
||||
static Logger<> Log("dagify");
|
||||
static Logger Log("dagify");
|
||||
|
||||
class DAGifyPassImpl {
|
||||
Function &F;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
using namespace llvm;
|
||||
|
||||
// Debug logger
|
||||
Logger<> GenericRegionInfoLogger("generic-region-info");
|
||||
Logger GenericRegionInfoLogger("generic-region-info");
|
||||
|
||||
/// Helper function which mimics the `at` behavior for a `llvm::SmallDenseMap`
|
||||
template<class KeyT, class ValueT>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
using namespace llvm;
|
||||
|
||||
// Debug logger
|
||||
Logger<> MaterializeTrivialGotoLogger("materialize-trivial-goto");
|
||||
Logger MaterializeTrivialGotoLogger("materialize-trivial-goto");
|
||||
|
||||
static void eraseGoto(ScopeGraphBuilder &SGBuilder, BasicBlock &BB) {
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ using std::string;
|
||||
|
||||
// TODO: Move the initialization of the logger here from "Utils.h"
|
||||
// Debug logger.
|
||||
Logger<> CombLogger("restructure");
|
||||
Logger<> LogShortestPath("restructure-shortest-path");
|
||||
Logger CombLogger("restructure");
|
||||
Logger LogShortestPath("restructure-shortest-path");
|
||||
|
||||
// EdgeDescriptor is a handy way to create and manipulate edges on the
|
||||
// RegionCFG.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
using namespace llvm;
|
||||
|
||||
// Debug logger
|
||||
static Logger<> Log("select-scope");
|
||||
static Logger Log("select-scope");
|
||||
|
||||
static std::map<BasicBlock *, size_t>
|
||||
initializeScopeMap(SmallSetVector<BasicBlock *, 2> &ConditionalSuccessors) {
|
||||
|
||||
+14
-29
@@ -39,13 +39,12 @@ class LoggersRegistry {
|
||||
public:
|
||||
LoggersRegistry() {}
|
||||
|
||||
void add(Logger<true> *L) { Loggers.push_back(L); }
|
||||
void add(Logger<false> *) {}
|
||||
void add(Logger *L) { Loggers.push_back(L); }
|
||||
|
||||
size_t size() const { return Loggers.size(); }
|
||||
|
||||
void enable(llvm::StringRef Name) {
|
||||
for (Logger<true> *L : Loggers) {
|
||||
for (Logger *L : Loggers) {
|
||||
if (L->name() == Name) {
|
||||
L->enable();
|
||||
return;
|
||||
@@ -56,7 +55,7 @@ public:
|
||||
}
|
||||
|
||||
void disable(llvm::StringRef Name) {
|
||||
for (Logger<true> *L : Loggers) {
|
||||
for (Logger *L : Loggers) {
|
||||
if (L->name() == Name) {
|
||||
L->disable();
|
||||
return;
|
||||
@@ -69,7 +68,7 @@ public:
|
||||
void registerArguments() const;
|
||||
|
||||
private:
|
||||
std::vector<Logger<true> *> Loggers;
|
||||
std::vector<Logger *> Loggers;
|
||||
};
|
||||
|
||||
static llvm::ManagedStatic<LoggersRegistry> Loggers;
|
||||
@@ -87,13 +86,12 @@ ScopedDebugFeature::~ScopedDebugFeature() {
|
||||
|
||||
std::ostream &dbg(std::cerr);
|
||||
|
||||
Logger<> PassesLog("passes");
|
||||
Logger<> ReleaseLog("release");
|
||||
Logger<> VerifyLog("verify");
|
||||
Logger PassesLog("passes");
|
||||
Logger ReleaseLog("release");
|
||||
Logger VerifyLog("verify");
|
||||
|
||||
template<bool X>
|
||||
void Logger<X>::flush(const LogTerminator &LineInfo) {
|
||||
if (X && Enabled) {
|
||||
void Logger::flush(const LogTerminator &LineInfo) {
|
||||
if (Enabled) {
|
||||
std::string Pad;
|
||||
|
||||
if (MaxLocationLength != 0) {
|
||||
@@ -167,8 +165,7 @@ static std::unique_ptr<cl::alias> DebugLoggingAlias;
|
||||
|
||||
llvm::ManagedStatic<DebugLogOptionWrapper> DebugLogOption;
|
||||
|
||||
template<>
|
||||
void Logger<true>::init() {
|
||||
void Logger::init() {
|
||||
Loggers->add(this);
|
||||
if (Name.size() > 0) {
|
||||
auto &Parser = DebugLogOption->TheOption.getParser();
|
||||
@@ -176,37 +173,25 @@ void Logger<true>::init() {
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
void Logger<false>::init() {
|
||||
}
|
||||
unsigned Logger::IndentLevel;
|
||||
|
||||
template<bool X>
|
||||
unsigned Logger<X>::IndentLevel;
|
||||
|
||||
template<bool X>
|
||||
void Logger<X>::indent(unsigned Level) {
|
||||
void Logger::indent(unsigned Level) {
|
||||
if (isEnabled())
|
||||
IndentLevel += Level;
|
||||
}
|
||||
|
||||
template<bool X>
|
||||
void Logger<X>::unindent(unsigned Level) {
|
||||
void Logger::unindent(unsigned Level) {
|
||||
if (isEnabled()) {
|
||||
revng_assert(IndentLevel - Level >= 0);
|
||||
IndentLevel -= Level;
|
||||
}
|
||||
}
|
||||
|
||||
template<bool X>
|
||||
void Logger<X>::setIndentation(unsigned Level) {
|
||||
void Logger::setIndentation(unsigned Level) {
|
||||
if (isEnabled())
|
||||
IndentLevel = Level;
|
||||
}
|
||||
|
||||
// Force instantiation
|
||||
template class Logger<true>;
|
||||
template class Logger<false>;
|
||||
|
||||
void writeToFile(llvm::StringRef What, llvm::StringRef Path) {
|
||||
std::error_code EC;
|
||||
llvm::raw_fd_ostream File(Path, EC);
|
||||
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
#include "revng/Support/LDDTree.h"
|
||||
#include "revng/Support/OverflowSafeInt.h"
|
||||
|
||||
static Logger<> Log("lddtree");
|
||||
static Logger Log("lddtree");
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -165,7 +165,7 @@ findLibrary(StringRef ToImport,
|
||||
std::optional<StringRef> RPath,
|
||||
std::optional<StringRef> RunPath) {
|
||||
revng_log(Log, "Looking for " << ToImport);
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
SmallVector<std::string, 16> SearchPaths;
|
||||
|
||||
@@ -414,7 +414,7 @@ static RecursiveCoroutine<void> lddtreeHelper(LDDTree &Dependencies,
|
||||
unsigned CurrentLevel,
|
||||
unsigned DepthLevel) {
|
||||
revng_log(Log, "lddtree for " << Path << "\n");
|
||||
LoggerIndent<> Ident(Log);
|
||||
LoggerIndent Ident(Log);
|
||||
|
||||
using namespace object;
|
||||
auto MaybeBinary = createBinary(Path);
|
||||
|
||||
@@ -22,7 +22,7 @@ extern "C" {
|
||||
#include "revng/Support/Debug.h"
|
||||
#include "revng/Support/PathList.h"
|
||||
|
||||
static Logger<> Log("find-resources");
|
||||
static Logger Log("find-resources");
|
||||
|
||||
struct Resources {
|
||||
bool FirstCall = true;
|
||||
@@ -103,7 +103,7 @@ findFileInPaths(llvm::StringRef FileName,
|
||||
llvm::SmallString<64> FullFileName;
|
||||
llvm::sys::path::append(FullFileName, Path, FileName);
|
||||
|
||||
LoggerIndent<> Indent(Log);
|
||||
LoggerIndent Indent(Log);
|
||||
|
||||
if (not llvm::sys::fs::exists(FullFileName)) {
|
||||
revng_log(Log, "File not found: " << FullFileName.str().str());
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "revng/Support/ProgramRunner.h"
|
||||
#include "revng/Support/TemporaryFile.h"
|
||||
|
||||
static Logger<> Log("program-runner");
|
||||
static Logger Log("program-runner");
|
||||
|
||||
ProgramRunner Runner;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "revng/TypeNames/DependencyGraph.h"
|
||||
#include "revng/TypeNames/ModelCBuilder.h"
|
||||
|
||||
static Logger<> Log{ "type-dependency-graph" };
|
||||
static Logger Log{ "type-dependency-graph" };
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user