diff --git a/include/revng/HeadersGeneration/Options.h b/include/revng/HeadersGeneration/Options.h deleted file mode 100644 index b3d31f468..000000000 --- a/include/revng/HeadersGeneration/Options.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -// -// This file is distributed under the MIT License. See LICENSE.md for details. -// - -#include "llvm/Support/CommandLine.h" - -namespace revng::options { - -// Enabled by default. -extern llvm::cl::opt EnableStackFrameInlining; - -} // namespace revng::options diff --git a/include/revng/TypeNames/ModelCBuilder.h b/include/revng/TypeNames/ModelCBuilder.h index aa86f7037..2c391f850 100644 --- a/include/revng/TypeNames/ModelCBuilder.h +++ b/include/revng/TypeNames/ModelCBuilder.h @@ -28,16 +28,6 @@ protected: public: struct ConfigurationOptions { - /// When set to true, function stack frame types are printed also inside the - /// function body, and not just in the header. - /// This may break the property that we emit syntactically valid C code, - /// because including the header will cause the definition of the stack - /// frame type to be duplicated in the header and inside the function body. - /// For this reason it's disabled by default. And it should only be turned - /// on when printing artifacts that only show the body of the function, for - /// which emitting recompilable C code is not a strict requirement. - bool EnableStackFrameInlining = false; - /// Because we are emitting C11, we cannot specify underlying enum type /// (the feature was only backported from C++ in C23), which means that /// when we need to preserve enum size across the compilation boundary diff --git a/lib/Backend/DecompileFunction.cpp b/lib/Backend/DecompileFunction.cpp index 3cc329a19..a9f3eb183 100644 --- a/lib/Backend/DecompileFunction.cpp +++ b/lib/Backend/DecompileFunction.cpp @@ -35,7 +35,6 @@ #include "revng/ABI/ModelHelpers.h" #include "revng/Backend/DecompileFunction.h" #include "revng/EarlyFunctionAnalysis/ControlFlowGraphCache.h" -#include "revng/HeadersGeneration/Options.h" #include "revng/InitModelTypes/InitModelTypes.h" #include "revng/Model/Binary.h" #include "revng/Model/FunctionTags.h" @@ -1945,19 +1944,9 @@ void CCodeGenerator::emitFunction(bool NeedsLocalStateVar) { revng_assert(not IsStackDefined, "Multiple stack variables?"); const model::StructDefinition &Struct = *ModelFunction.stackFrameType(); - // In the artifacts generated by this LLVM-based backend we've given up - // the requirement of emitting syntactically valid C code. Hence, we can - // always emit the stack frame type definition inside the body of the - // function itself, because we don't care anymore if it clashes with a - // global definition that we have emitted in a header outside the - // function's body. - if (B.Configuration.EnableStackFrameInlining) { - B.printDefinition(Struct, " " + std::move(VarName)); - } else { - auto Named = B.getNamedCInstance(*ModelFunction.StackFrame().Type(), - std::move(VarName)); - B.append(Named + ";\n"); - } + auto Named = B.getNamedCInstance(*ModelFunction.StackFrame().Type(), + std::move(VarName)); + B.append(Named + ";\n"); IsStackDefined = true; } else { diff --git a/lib/Backend/DecompilePipe.cpp b/lib/Backend/DecompilePipe.cpp index 6279c70a9..f2f1c279c 100644 --- a/lib/Backend/DecompilePipe.cpp +++ b/lib/Backend/DecompilePipe.cpp @@ -4,7 +4,6 @@ #include "revng/Backend/DecompileFunction.h" #include "revng/Backend/DecompilePipe.h" -#include "revng/HeadersGeneration/Options.h" #include "revng/Model/Binary.h" #include "revng/Pipeline/AllRegistries.h" #include "revng/Pipes/Kinds.h" @@ -145,12 +144,9 @@ void Decompile::run(pipeline::ExecutionContext &EC, const model::Binary &Model = *getModelFromContext(EC); ControlFlowGraphCache Cache(CFGMap); - namespace options = revng::options; - ptml::ModelCBuilder - B(llvm::nulls(), - Model, - /* EnableTaglessMode = */ false, - { .EnableStackFrameInlining = options::EnableStackFrameInlining }); + ptml::ModelCBuilder B(llvm::nulls(), + Model, + /* EnableTaglessMode = */ false); for (const model::Function &Function : getFunctionsAndCommit(EC, DecompiledFunctions.name())) { diff --git a/lib/HeadersGeneration/CMakeLists.txt b/lib/HeadersGeneration/CMakeLists.txt index 15f9e0e1d..766b1a32e 100644 --- a/lib/HeadersGeneration/CMakeLists.txt +++ b/lib/HeadersGeneration/CMakeLists.txt @@ -6,7 +6,7 @@ revng_add_analyses_library_internal( revngModelToHeader ModelToHeader.cpp ModelToHeaderPipe.cpp - ModelTypeDefinitionPipe.cpp Options.cpp) + ModelTypeDefinitionPipe.cpp) target_link_libraries( revngModelToHeader diff --git a/lib/HeadersGeneration/ModelToHeaderPipe.cpp b/lib/HeadersGeneration/ModelToHeaderPipe.cpp index d3e731969..806cdaa08 100644 --- a/lib/HeadersGeneration/ModelToHeaderPipe.cpp +++ b/lib/HeadersGeneration/ModelToHeaderPipe.cpp @@ -4,7 +4,6 @@ #include "revng/HeadersGeneration/ConfigurationHelpers.h" #include "revng/HeadersGeneration/ModelToHeaderPipe.h" -#include "revng/HeadersGeneration/Options.h" #include "revng/HeadersGeneration/PTMLHeaderBuilder.h" #include "revng/Pipeline/AllRegistries.h" #include "revng/Pipeline/RegisterContainerFactory.h" @@ -26,8 +25,7 @@ void ModelToHeader::run() { B(*Out, Binary, /* EnableTaglessMode = */ false, - { .EnableStackFrameInlining = revng::options::EnableStackFrameInlining, - .EnablePrintingOfTheMaximumEnumValue = true, + { .EnablePrintingOfTheMaximumEnumValue = true, .ExplicitTargetPointerSize = getExplicitPointerSize(Binary) }); ptml::HeaderBuilder(B).printModelHeader(/*DefineOpaqueTypes*/ true); Out->flush(); diff --git a/lib/HeadersGeneration/Options.cpp b/lib/HeadersGeneration/Options.cpp deleted file mode 100644 index 6d0bc7ca1..000000000 --- a/lib/HeadersGeneration/Options.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// -// This file is distributed under the MIT License. See LICENSE.md for details. -// - -#include "revng/HeadersGeneration/Options.h" - -using namespace llvm::cl; - -namespace revng::options { - -opt EnableStackFrameInlining("enable-stack-frame-inlining", - desc("Enable printing the definition " - "of a function's stack type inside " - "the function's body."), - init(false)); - -} // namespace revng::options