diff --git a/include/revng-c/Decompiler/DLALayouts.h b/include/revng-c/DataLayoutAnalysis/DLALayouts.h similarity index 100% rename from include/revng-c/Decompiler/DLALayouts.h rename to include/revng-c/DataLayoutAnalysis/DLALayouts.h diff --git a/include/revng-c/Decompiler/DLAPass.h b/include/revng-c/DataLayoutAnalysis/DLAPass.h similarity index 92% rename from include/revng-c/Decompiler/DLAPass.h rename to include/revng-c/DataLayoutAnalysis/DLAPass.h index ee046037f..cdf23581d 100644 --- a/include/revng-c/Decompiler/DLAPass.h +++ b/include/revng-c/DataLayoutAnalysis/DLAPass.h @@ -10,7 +10,7 @@ #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Pass.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" struct DLAPass : public llvm::ModulePass { static char ID; diff --git a/lib/Decompiler/DLATypeSystem.h b/include/revng-c/DataLayoutAnalysis/DLATypeSystem.h similarity index 99% rename from lib/Decompiler/DLATypeSystem.h rename to include/revng-c/DataLayoutAnalysis/DLATypeSystem.h index c77cb91a7..450439fde 100644 --- a/lib/Decompiler/DLATypeSystem.h +++ b/include/revng-c/DataLayoutAnalysis/DLATypeSystem.h @@ -24,7 +24,7 @@ #include "revng/ADT/FilteredGraphTraits.h" #include "revng/Support/Assert.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" namespace dla { diff --git a/lib/Decompiler/SCEVBaseAddressExplorer.h b/include/revng-c/Decompiler/SCEVBaseAddressExplorer.h similarity index 100% rename from lib/Decompiler/SCEVBaseAddressExplorer.h rename to include/revng-c/Decompiler/SCEVBaseAddressExplorer.h diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index a386fe200..5369611e3 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -18,3 +18,4 @@ add_subdirectory(RemoveNewPCCalls) add_subdirectory(TargetFunctionOption) add_subdirectory(ThreadSafeClangTooling) add_subdirectory(ValueManipulationAnalysis) +add_subdirectory(DataLayoutAnalysis) diff --git a/lib/Decompiler/DLAMakeLayouts.cpp b/lib/DataLayoutAnalysis/Backend/DLAMakeLayouts.cpp similarity index 98% rename from lib/Decompiler/DLAMakeLayouts.cpp rename to lib/DataLayoutAnalysis/Backend/DLAMakeLayouts.cpp index 5884e9f6e..9712878f7 100644 --- a/lib/Decompiler/DLAMakeLayouts.cpp +++ b/lib/DataLayoutAnalysis/Backend/DLAMakeLayouts.cpp @@ -22,11 +22,11 @@ #include "revng/Support/Assert.h" #include "revng/Support/Debug.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" -#include "DLAHelpers.h" -#include "DLAStep.h" -#include "DLATypeSystem.h" +#include "../DLAHelpers.h" +#include "DLAMakeLayouts.h" using namespace llvm; diff --git a/lib/DataLayoutAnalysis/Backend/DLAMakeLayouts.h b/lib/DataLayoutAnalysis/Backend/DLAMakeLayouts.h new file mode 100644 index 000000000..5882919b9 --- /dev/null +++ b/lib/DataLayoutAnalysis/Backend/DLAMakeLayouts.h @@ -0,0 +1,36 @@ +#pragma once + +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + +// +// Copyright (c) rev.ng Srls. See LICENSE.md for details. +// + +namespace dla { + +/// Final step, which flattens out the types into memory layouts +using LayoutPtrVector = std::vector; + +///\brief Generate Layout objects from a DLATypeSystem +/// +/// Some nodes of a DLATypeSystem graph can generate a Layout, that is added to +/// \a Layouts. +/// The returned vector stores pointers to the generated layouts in a specific +/// order: the index of a Layout in the vector is equal to the Node's ID +/// equivalence class. +/// Note that pointers in the returned vector may be duplicated. +/// +///\param[in] TS The graph that represents layouts and their relations +///\param[out] Layouts Where to put the constructed layouts +///\return a vector of Layouts ordered using TS equivalence classes +LayoutPtrVector makeLayouts(const LayoutTypeSystem &TS, LayoutVector &Layouts); + +///\brief Create a map between LayoutTypePtrs and Layouts +///\param Values the list of LayoutTypePtrs +///\param OrderedLayouts the list of Layouts +///\param EqClasses equivalence classes between indexes of \a Values and +/// indexes of \a OrderedLayouts +ValueLayoutMap makeLayoutMap(const LayoutTypePtrVect &Values, + const LayoutPtrVector &OrderedLayouts, + const VectEqClasses &EqClasses); +} // namespace dla \ No newline at end of file diff --git a/lib/DataLayoutAnalysis/CMakeLists.txt b/lib/DataLayoutAnalysis/CMakeLists.txt new file mode 100644 index 000000000..af20d4b1b --- /dev/null +++ b/lib/DataLayoutAnalysis/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright rev.ng Srls. See LICENSE.md for details. +# + +revng_add_analyses_library(DataLayoutAnalysis revngc + Frontend/DLACreateInterProceduralTypes.cpp + Frontend/DLACreateIntraProceduralTypes.cpp + Frontend/DLATypeSystemBuilder.cpp + Middleend/DLACollapseIdentityAndInheritanceCC.cpp + Middleend/DLAComputeNonInterferingComponents.cpp + Middleend/DLAComputeUpperMemberAccess.cpp + Middleend/DLAPruneLayoutNodesWithoutLayout.cpp + Middleend/DLARemoveTransitiveInheritanceEdges.cpp + Middleend/DLAMakeInheritanceTree.cpp + Middleend/DLAStep.cpp + Backend/DLAMakeLayouts.cpp + DLAHelpers.cpp + DLALayouts.cpp + DLAPass.cpp + DLATypeSystem.cpp) + +target_link_libraries(DataLayoutAnalysis + revng::revngModel + revng::revngSupport + ${LLVM_LIBRARIES}) \ No newline at end of file diff --git a/lib/Decompiler/DLAHelpers.cpp b/lib/DataLayoutAnalysis/DLAHelpers.cpp similarity index 99% rename from lib/Decompiler/DLAHelpers.cpp rename to lib/DataLayoutAnalysis/DLAHelpers.cpp index 47fbb1bb7..505fc83a0 100644 --- a/lib/Decompiler/DLAHelpers.cpp +++ b/lib/DataLayoutAnalysis/DLAHelpers.cpp @@ -20,8 +20,9 @@ #include "revng/Support/Assert.h" #include "revng/Support/Debug.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + #include "DLAHelpers.h" -#include "DLATypeSystem.h" template concept DerivedValue = std::is_base_of_v; diff --git a/lib/Decompiler/DLAHelpers.h b/lib/DataLayoutAnalysis/DLAHelpers.h similarity index 100% rename from lib/Decompiler/DLAHelpers.h rename to lib/DataLayoutAnalysis/DLAHelpers.h diff --git a/lib/Decompiler/DLALayouts.cpp b/lib/DataLayoutAnalysis/DLALayouts.cpp similarity index 99% rename from lib/Decompiler/DLALayouts.cpp rename to lib/DataLayoutAnalysis/DLALayouts.cpp index 49dd15399..2559333e3 100644 --- a/lib/Decompiler/DLALayouts.cpp +++ b/lib/DataLayoutAnalysis/DLALayouts.cpp @@ -4,7 +4,7 @@ #include -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" namespace dla { diff --git a/lib/Decompiler/DLAPass.cpp b/lib/DataLayoutAnalysis/DLAPass.cpp similarity index 90% rename from lib/Decompiler/DLAPass.cpp rename to lib/DataLayoutAnalysis/DLAPass.cpp index b2d8736f4..f58b80a94 100644 --- a/lib/Decompiler/DLAPass.cpp +++ b/lib/DataLayoutAnalysis/DLAPass.cpp @@ -4,12 +4,12 @@ #include "revng/Model/LoadModelPass.h" -#include "revng-c/Decompiler/DLALayouts.h" -#include "revng-c/Decompiler/DLAPass.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLAPass.h" -#include "DLAStep.h" -#include "DLATypeSystem.h" -#include "DLATypeSystemBuilder.h" +#include "Backend/DLAMakeLayouts.h" +#include "Frontend/DLATypeSystemBuilder.h" +#include "Middleend/DLAStep.h" char DLAPass::ID = 0; diff --git a/lib/Decompiler/DLATypeSystem.cpp b/lib/DataLayoutAnalysis/DLATypeSystem.cpp similarity index 99% rename from lib/Decompiler/DLATypeSystem.cpp rename to lib/DataLayoutAnalysis/DLATypeSystem.cpp index 02a48b3c5..c026fd541 100644 --- a/lib/Decompiler/DLATypeSystem.cpp +++ b/lib/DataLayoutAnalysis/DLATypeSystem.cpp @@ -15,8 +15,9 @@ #include "revng/Support/Debug.h" #include "revng/Support/DebugHelper.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + #include "DLAHelpers.h" -#include "DLATypeSystem.h" using namespace llvm; diff --git a/lib/Decompiler/DLACreateInterProceduralTypes.cpp b/lib/DataLayoutAnalysis/Frontend/DLACreateInterProceduralTypes.cpp similarity index 98% rename from lib/Decompiler/DLACreateInterProceduralTypes.cpp rename to lib/DataLayoutAnalysis/Frontend/DLACreateInterProceduralTypes.cpp index 04172baa6..2afd80167 100644 --- a/lib/Decompiler/DLACreateInterProceduralTypes.cpp +++ b/lib/DataLayoutAnalysis/Frontend/DLACreateInterProceduralTypes.cpp @@ -11,7 +11,8 @@ #include "revng/Support/FunctionTags.h" #include "revng/Support/IRHelpers.h" -#include "DLATypeSystem.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + #include "DLATypeSystemBuilder.h" using namespace dla; diff --git a/lib/Decompiler/DLACreateIntraProceduralTypes.cpp b/lib/DataLayoutAnalysis/Frontend/DLACreateIntraProceduralTypes.cpp similarity index 99% rename from lib/Decompiler/DLACreateIntraProceduralTypes.cpp rename to lib/DataLayoutAnalysis/Frontend/DLACreateIntraProceduralTypes.cpp index e25b7629c..33a12a5a5 100644 --- a/lib/Decompiler/DLACreateIntraProceduralTypes.cpp +++ b/lib/DataLayoutAnalysis/Frontend/DLACreateIntraProceduralTypes.cpp @@ -24,10 +24,11 @@ #include "revng/Support/FunctionTags.h" #include "revng/Support/IRHelpers.h" -#include "DLAHelpers.h" -#include "DLATypeSystem.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" +#include "revng-c/Decompiler/SCEVBaseAddressExplorer.h" + +#include "../DLAHelpers.h" #include "DLATypeSystemBuilder.h" -#include "SCEVBaseAddressExplorer.h" using namespace dla; using namespace llvm; diff --git a/lib/Decompiler/DLATypeSystemBuilder.cpp b/lib/DataLayoutAnalysis/Frontend/DLATypeSystemBuilder.cpp similarity index 99% rename from lib/Decompiler/DLATypeSystemBuilder.cpp rename to lib/DataLayoutAnalysis/Frontend/DLATypeSystemBuilder.cpp index d4be654cf..96d21099a 100644 --- a/lib/Decompiler/DLATypeSystemBuilder.cpp +++ b/lib/DataLayoutAnalysis/Frontend/DLATypeSystemBuilder.cpp @@ -8,7 +8,7 @@ #include "revng/Support/IRHelpers.h" -#include "DLAHelpers.h" +#include "../DLAHelpers.h" #include "DLATypeSystemBuilder.h" using namespace llvm; diff --git a/lib/Decompiler/DLATypeSystemBuilder.h b/lib/DataLayoutAnalysis/Frontend/DLATypeSystemBuilder.h similarity index 97% rename from lib/Decompiler/DLATypeSystemBuilder.h rename to lib/DataLayoutAnalysis/Frontend/DLATypeSystemBuilder.h index 4a64baa59..b82e9ae05 100644 --- a/lib/Decompiler/DLATypeSystemBuilder.h +++ b/lib/DataLayoutAnalysis/Frontend/DLATypeSystemBuilder.h @@ -6,11 +6,8 @@ #include "llvm/Pass.h" -#include "revng/Support/Assert.h" - -#include "revng-c/Decompiler/DLALayouts.h" - -#include "DLATypeSystem.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" namespace dla { diff --git a/lib/Decompiler/DLACollapseIdentityAndInheritanceCC.cpp b/lib/DataLayoutAnalysis/Middleend/DLACollapseIdentityAndInheritanceCC.cpp similarity index 98% rename from lib/Decompiler/DLACollapseIdentityAndInheritanceCC.cpp rename to lib/DataLayoutAnalysis/Middleend/DLACollapseIdentityAndInheritanceCC.cpp index 31b374c68..1fb53a242 100644 --- a/lib/Decompiler/DLACollapseIdentityAndInheritanceCC.cpp +++ b/lib/DataLayoutAnalysis/Middleend/DLACollapseIdentityAndInheritanceCC.cpp @@ -12,9 +12,10 @@ #include "revng/ADT/FilteredGraphTraits.h" #include "revng/Support/Debug.h" -#include "DLAHelpers.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + +#include "../DLAHelpers.h" #include "DLAStep.h" -#include "DLATypeSystem.h" using namespace llvm; diff --git a/lib/Decompiler/DLAComputeNonInterferingComponents.cpp b/lib/DataLayoutAnalysis/Middleend/DLAComputeNonInterferingComponents.cpp similarity index 99% rename from lib/Decompiler/DLAComputeNonInterferingComponents.cpp rename to lib/DataLayoutAnalysis/Middleend/DLAComputeNonInterferingComponents.cpp index 8536d9e0d..7653b8d97 100644 --- a/lib/Decompiler/DLAComputeNonInterferingComponents.cpp +++ b/lib/DataLayoutAnalysis/Middleend/DLAComputeNonInterferingComponents.cpp @@ -14,9 +14,10 @@ #include "revng/Support/Debug.h" -#include "DLAHelpers.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + +#include "../DLAHelpers.h" #include "DLAStep.h" -#include "DLATypeSystem.h" namespace dla { diff --git a/lib/Decompiler/DLAComputeUpperMemberAccess.cpp b/lib/DataLayoutAnalysis/Middleend/DLAComputeUpperMemberAccess.cpp similarity index 98% rename from lib/Decompiler/DLAComputeUpperMemberAccess.cpp rename to lib/DataLayoutAnalysis/Middleend/DLAComputeUpperMemberAccess.cpp index 4e774526a..a15d91b00 100644 --- a/lib/Decompiler/DLAComputeUpperMemberAccess.cpp +++ b/lib/DataLayoutAnalysis/Middleend/DLAComputeUpperMemberAccess.cpp @@ -12,9 +12,10 @@ #include "revng/ADT/FilteredGraphTraits.h" #include "revng/Support/Debug.h" -#include "DLAHelpers.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + +#include "../DLAHelpers.h" #include "DLAStep.h" -#include "DLATypeSystem.h" using namespace llvm; diff --git a/lib/Decompiler/DLAMakeInheritanceTree.cpp b/lib/DataLayoutAnalysis/Middleend/DLAMakeInheritanceTree.cpp similarity index 98% rename from lib/Decompiler/DLAMakeInheritanceTree.cpp rename to lib/DataLayoutAnalysis/Middleend/DLAMakeInheritanceTree.cpp index 40363c0b6..564f4e023 100644 --- a/lib/Decompiler/DLAMakeInheritanceTree.cpp +++ b/lib/DataLayoutAnalysis/Middleend/DLAMakeInheritanceTree.cpp @@ -13,9 +13,10 @@ #include "revng/ADT/FilteredGraphTraits.h" #include "revng/Support/Debug.h" -#include "DLAHelpers.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + +#include "../DLAHelpers.h" #include "DLAStep.h" -#include "DLATypeSystem.h" using LTSN = dla::LayoutTypeSystemNode; using GraphNodeT = LTSN *; diff --git a/lib/Decompiler/DLAPruneLayoutNodesWithoutLayout.cpp b/lib/DataLayoutAnalysis/Middleend/DLAPruneLayoutNodesWithoutLayout.cpp similarity index 97% rename from lib/Decompiler/DLAPruneLayoutNodesWithoutLayout.cpp rename to lib/DataLayoutAnalysis/Middleend/DLAPruneLayoutNodesWithoutLayout.cpp index d70324002..faa3e1766 100644 --- a/lib/Decompiler/DLAPruneLayoutNodesWithoutLayout.cpp +++ b/lib/DataLayoutAnalysis/Middleend/DLAPruneLayoutNodesWithoutLayout.cpp @@ -10,8 +10,9 @@ #include "revng/ADT/FilteredGraphTraits.h" #include "revng/Support/Debug.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + #include "DLAStep.h" -#include "DLATypeSystem.h" using namespace llvm; diff --git a/lib/Decompiler/DLARemoveTransitiveInheritanceEdges.cpp b/lib/DataLayoutAnalysis/Middleend/DLARemoveTransitiveInheritanceEdges.cpp similarity index 99% rename from lib/Decompiler/DLARemoveTransitiveInheritanceEdges.cpp rename to lib/DataLayoutAnalysis/Middleend/DLARemoveTransitiveInheritanceEdges.cpp index 60f41fa37..f99482ddb 100644 --- a/lib/Decompiler/DLARemoveTransitiveInheritanceEdges.cpp +++ b/lib/DataLayoutAnalysis/Middleend/DLARemoveTransitiveInheritanceEdges.cpp @@ -18,8 +18,9 @@ #include "revng/ADT/SmallMap.h" #include "revng/Support/Debug.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" + #include "DLAStep.h" -#include "DLATypeSystem.h" static Logger<> Log("dla-remove-transitive-edges"); diff --git a/lib/Decompiler/DLAStep.cpp b/lib/DataLayoutAnalysis/Middleend/DLAStep.cpp similarity index 100% rename from lib/Decompiler/DLAStep.cpp rename to lib/DataLayoutAnalysis/Middleend/DLAStep.cpp diff --git a/lib/Decompiler/DLAStep.h b/lib/DataLayoutAnalysis/Middleend/DLAStep.h similarity index 85% rename from lib/Decompiler/DLAStep.h rename to lib/DataLayoutAnalysis/Middleend/DLAStep.h index 0afb80e1d..0b02c139d 100644 --- a/lib/Decompiler/DLAStep.h +++ b/lib/DataLayoutAnalysis/Middleend/DLAStep.h @@ -12,9 +12,8 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" -#include "revng-c/Decompiler/DLALayouts.h" - -#include "DLATypeSystem.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" namespace dla { @@ -207,32 +206,6 @@ public: virtual bool runOnTypeSystem(LayoutTypeSystem &TS) override; }; -/// Final step, which flattens out the types into memory layouts -using LayoutPtrVector = std::vector; - -///\brief Generate Layout objects from a DLATypeSystem -/// -/// Some nodes of a DLATypeSystem graph can generate a Layout, that is added to -/// \a Layouts. -/// The returned vector stores pointers to the generated layouts in a specific -/// order: the index of a Layout in the vector is equal to the Node's ID -/// equivalence class. -/// Note that pointers in the returned vector may be duplicated. -/// -///\param[in] TS The graph that represents layouts and their relations -///\param[out] Layouts Where to put the constructed layouts -///\return a vector of Layouts ordered using TS equivalence classes -LayoutPtrVector makeLayouts(const LayoutTypeSystem &TS, LayoutVector &Layouts); - -///\brief Create a map between LayoutTypePtrs and Layouts -///\param Values the list of LayoutTypePtrs -///\param OrderedLayouts the list of Layouts -///\param EqClasses equivalence classes between indexes of \a Values and -/// indexes of \a OrderedLayouts -ValueLayoutMap makeLayoutMap(const LayoutTypePtrVect &Values, - const LayoutPtrVector &OrderedLayouts, - const VectEqClasses &EqClasses); - template bool intersect(IterT I1, IterT E1, IterT I2, IterT E2) { while ((I1 != E1) and (I2 != E2)) { diff --git a/lib/Decompiler/ASTBuildAnalysis.cpp b/lib/Decompiler/ASTBuildAnalysis.cpp index 65d7603a8..4320cfc81 100644 --- a/lib/Decompiler/ASTBuildAnalysis.cpp +++ b/lib/Decompiler/ASTBuildAnalysis.cpp @@ -31,14 +31,14 @@ #include "revng/Support/IRHelpers.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" +#include "revng-c/Decompiler/SCEVBaseAddressExplorer.h" #include "ASTBuildAnalysis.h" #include "AddSCEVBarrierPass.h" #include "DecompilationHelpers.h" #include "IRASTTypeTranslation.h" #include "Mangling.h" -#include "SCEVBaseAddressExplorer.h" static Logger<> ASTBuildLog("ast-builder"); diff --git a/lib/Decompiler/ASTBuildAnalysis.h b/lib/Decompiler/ASTBuildAnalysis.h index 87fa7cdb1..45d76512a 100644 --- a/lib/Decompiler/ASTBuildAnalysis.h +++ b/lib/Decompiler/ASTBuildAnalysis.h @@ -17,7 +17,7 @@ #include "revng/Support/Assert.h" #include "revng/Support/MonotoneFramework.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" #include "revng-c/Decompiler/MarkForSerialization.h" namespace clang { diff --git a/lib/Decompiler/CDecompilerAction.h b/lib/Decompiler/CDecompilerAction.h index 32d8115b3..930843a51 100644 --- a/lib/Decompiler/CDecompilerAction.h +++ b/lib/Decompiler/CDecompilerAction.h @@ -11,7 +11,7 @@ #include "clang/Frontend/ASTConsumers.h" #include "clang/Frontend/FrontendAction.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" #include "revng-c/Decompiler/MarkForSerialization.h" #include "CDecompilerBeautify.h" diff --git a/lib/Decompiler/CDecompilerPass.cpp b/lib/Decompiler/CDecompilerPass.cpp index 98b0ef444..7f97be7f6 100644 --- a/lib/Decompiler/CDecompilerPass.cpp +++ b/lib/Decompiler/CDecompilerPass.cpp @@ -23,9 +23,9 @@ #include "revng/Support/FunctionTags.h" #include "revng/Support/IRHelpers.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLAPass.h" #include "revng-c/Decompiler/CDecompilerPass.h" -#include "revng-c/Decompiler/DLALayouts.h" -#include "revng-c/Decompiler/DLAPass.h" #include "revng-c/Decompiler/MarkForSerialization.h" #include "revng-c/PHIASAPAssignmentInfo/PHIASAPAssignmentInfo.h" #include "revng-c/RestructureCFGPass/ASTTree.h" diff --git a/lib/Decompiler/CMakeLists.txt b/lib/Decompiler/CMakeLists.txt index 5864626b0..ff606dd11 100644 --- a/lib/Decompiler/CMakeLists.txt +++ b/lib/Decompiler/CMakeLists.txt @@ -5,20 +5,6 @@ revng_add_analyses_library(Decompiler revngc AddSCEVBarrierPass.cpp ASTBuildAnalysis.cpp - DLACollapseIdentityAndInheritanceCC.cpp - DLAComputeNonInterferingComponents.cpp - DLAComputeUpperMemberAccess.cpp - DLACreateInterProceduralTypes.cpp - DLACreateIntraProceduralTypes.cpp - DLAHelpers.cpp - DLALayouts.cpp - DLAMakeInheritanceTree.cpp - DLAMakeLayouts.cpp - DLAPass.cpp - DLAPruneLayoutNodesWithoutLayout.cpp - DLARemoveTransitiveInheritanceEdges.cpp - DLAStep.cpp - DLATypeSystem.cpp CDecompiler.cpp CDecompilerAction.cpp CDecompilerBeautify.cpp @@ -29,8 +15,7 @@ revng_add_analyses_library(Decompiler revngc IRASTTypeTranslation.cpp MarkForSerialization.cpp SCEVBaseAddressExplorer.cpp - TypeDeclCreationAction.cpp - DLATypeSystemBuilder.cpp) + TypeDeclCreationAction.cpp) target_link_libraries(Decompiler FilterForDecompilation @@ -52,4 +37,5 @@ target_link_libraries(Decompiler clangBasic clangFrontend clangSerialization + DataLayoutAnalysis ${LLVM_LIBRARIES}) diff --git a/lib/Decompiler/IRASTTypeTranslation.cpp b/lib/Decompiler/IRASTTypeTranslation.cpp index 3cf6edf1f..ae0352172 100644 --- a/lib/Decompiler/IRASTTypeTranslation.cpp +++ b/lib/Decompiler/IRASTTypeTranslation.cpp @@ -23,9 +23,9 @@ #include "revng/Support/Assert.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLATypeSystem.h" -#include "DLATypeSystem.h" #include "IRASTTypeTranslation.h" #include "Mangling.h" diff --git a/lib/Decompiler/IRASTTypeTranslation.h b/lib/Decompiler/IRASTTypeTranslation.h index 7d8fdd7c2..11ea98831 100644 --- a/lib/Decompiler/IRASTTypeTranslation.h +++ b/lib/Decompiler/IRASTTypeTranslation.h @@ -17,7 +17,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/Type.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" namespace llvm { class Type; diff --git a/lib/Decompiler/SCEVBaseAddressExplorer.cpp b/lib/Decompiler/SCEVBaseAddressExplorer.cpp index 05229e66f..8a41d8860 100644 --- a/lib/Decompiler/SCEVBaseAddressExplorer.cpp +++ b/lib/Decompiler/SCEVBaseAddressExplorer.cpp @@ -9,7 +9,7 @@ #include "revng/Support/Debug.h" #include "revng/Support/FunctionTags.h" -#include "SCEVBaseAddressExplorer.h" +#include "revng-c/Decompiler/SCEVBaseAddressExplorer.h" static bool isConstantAddress(const llvm::ConstantInt *C) { // TODO: insert some logic to properly detect when this constant represents diff --git a/lib/Decompiler/TypeDeclCreationAction.cpp b/lib/Decompiler/TypeDeclCreationAction.cpp index e14f6f73b..2b363b370 100644 --- a/lib/Decompiler/TypeDeclCreationAction.cpp +++ b/lib/Decompiler/TypeDeclCreationAction.cpp @@ -13,7 +13,7 @@ #include "revng/Support/Assert.h" -#include "revng-c/Decompiler/DLALayouts.h" +#include "revng-c/DataLayoutAnalysis/DLALayouts.h" #include "DecompilationHelpers.h" #include "IRASTTypeTranslation.h" diff --git a/tests/Unit/DLAStepManager.cpp b/tests/Unit/DLAStepManager.cpp index f912634cf..7fb5f4e47 100644 --- a/tests/Unit/DLAStepManager.cpp +++ b/tests/Unit/DLAStepManager.cpp @@ -14,7 +14,7 @@ bool init_unit_test(); #include "revng/Support/Assert.h" #include "revng/UnitTestHelpers/UnitTestHelpers.h" -#include "lib/Decompiler/DLAStep.h" +#include "lib/DataLayoutAnalysis/Middleend/DLAStep.h" namespace dla {