Files
revng-revng/lib/Yield/CMakeLists.txt
Alessandro Di Federico f68b7866b3 Introduce BasicBlockID
This commit introduces `BasicBlockID` as the unique identifier for a
`efa::BasicBlock` into the CFG. A `BasicBlockID` is defined by a
`MetaAddress` plus an incremental integer. This enables us to have
multiple instances of the same block in a single function, which is
particularly useful when inlining multiple times the same function.

Apart from this, the commit also does the following:

* It drops representing `MetaAddress`es a `structs` in the IR. This created
  several issues related to ABI. We now represent them as strings.

* It defines more functions in `support.h`, instead of defining prototypes
  by hand in `CodeGenerator.cpp` and the like. Specifically, `unknownPC`
  and `raise_exception_helper`. We also introduce a C "constructor" for
  `PlainMetaAddress`.

* It significantly reduces the API of `GeneratedCodeBasicInfo`, which
  was supposed to be put on a diet since a long time.  Specifically,
  many jump target related methods have been moved to free functions in
  `IRHelpers.h`.  Also `GCBI::getSuccessors` has been pushed into its
  only user, `PruneRetSuccessors`, to prevent further usage of a
  deprecated API. In the future, it would be nice to drop it entirely.

* It introduces `efa::BasicBlock::InlinedFrom`.

* Introduce an enum to represent named argument indices for `newpc`.
  This enables us to more effectively manipulate its argument list.

* It improves the verification and error reporting for
  `efa::FunctionMetadata`.

* Update tests.

This commit is preliminary to another piece of work to improve the
generality of inlining beyond the simple "fake function" scenario, for
which the feature was originally conceived.
2023-02-23 14:51:10 +01:00

120 lines
3.3 KiB
CMake

#
# This file is distributed under the MIT License. See LICENSE.md for details.
#
revng_add_library_internal(
revngYield
SHARED
Assembly/DisassemblyHelper.cpp
Assembly/LLVMDisassemblerInterface.cpp
CallGraphs/CallGraphSlices.cpp
ControlFlow/ConvertFromEFA.cpp
ControlFlow/Extraction.cpp
ControlFlow/FallthroughDetection.cpp
ControlFlow/NodeSizeCalculation.cpp
ControlFlow/SVG.cpp
Support/SugiyamaStyleGraphLayout/EdgeRouting.cpp
Support/SugiyamaStyleGraphLayout/GraphPreparation.cpp
Support/SugiyamaStyleGraphLayout/HorizontalPositions.cpp
Support/SugiyamaStyleGraphLayout/LaneDistribution.cpp
Support/SugiyamaStyleGraphLayout/LayoutConversion.cpp
Support/SugiyamaStyleGraphLayout/LinearSegmentSelection.cpp
Support/SugiyamaStyleGraphLayout/NodeRanking.cpp
Support/SugiyamaStyleGraphLayout/PermutationSelection.cpp
Support/SugiyamaStyleGraphLayout/TopologicalOrdering.cpp
Support/SugiyamaStyleGraphLayout/VerticalPositions.cpp
Support/SugiyamaStyleGraphLayout.cpp
CrossRelations.cpp
Dump.cpp
Plain.cpp
PTML.cpp
Verify.cpp)
set(DISASSEMBLER_ARCHITECTURE_SUPPORT "")
foreach(CURRENT_ARCHITECTURE AArch64 ARM Mips SystemZ X86)
set(DISASSEMBLER_ARCHITECTURE_SUPPORT
${DISASSEMBLER_ARCHITECTURE_SUPPORT}
"${CURRENT_ARCHITECTURE}Disassembler" "${CURRENT_ARCHITECTURE}Info"
"${CURRENT_ARCHITECTURE}Desc")
endforeach(CURRENT_ARCHITECTURE)
llvm_map_components_to_libnames(
LLVM_LIBRARIES
Core
MC
MCDisassembler
Support
Target
${DISASSEMBLER_ARCHITECTURE_SUPPORT})
target_link_libraries(
revngYield
revngEarlyFunctionAnalysis
revngModelPasses
revngPTML
revngSupport
revngLift
${LLVM_LIBRARIES})
set(INTERNAL_ASSEMBLY_HEADERS "${CMAKE_SOURCE_DIR}/include/revng/Yield")
target_tuple_tree_generator(
revngYield
INSTALL
HEADER_DIRECTORY
"Yield"
NAMESPACE
"yield"
ROOT_TYPE
Function
SCHEMA_PATH
"${CMAKE_BINARY_DIR}/yield-internal-schema.yml"
SEPARATE_STRING_TYPES
"MetaAddress"
SCALAR_TYPES
"BasicBlockID"
"MetaAddress"
"yield::ByteContainer"
"model::FunctionAttribute::Values"
HEADERS
"${INTERNAL_ASSEMBLY_HEADERS}/CallEdge.h"
"${INTERNAL_ASSEMBLY_HEADERS}/FunctionEdge.h"
"${INTERNAL_ASSEMBLY_HEADERS}/FunctionEdgeBase.h"
"${INTERNAL_ASSEMBLY_HEADERS}/FunctionEdgeType.h"
"${INTERNAL_ASSEMBLY_HEADERS}/BasicBlock.h"
"${INTERNAL_ASSEMBLY_HEADERS}/Function.h"
"${INTERNAL_ASSEMBLY_HEADERS}/Instruction.h"
"${INTERNAL_ASSEMBLY_HEADERS}/Tag.h"
"${INTERNAL_ASSEMBLY_HEADERS}/TagType.h")
set(INTERNAL_ASSEMBLY_HEADERS
"${CMAKE_SOURCE_DIR}/include/revng/Yield/CrossRelations")
target_tuple_tree_generator(
revngYield
INSTALL
HEADER_DIRECTORY
"Yield/CrossRelations"
NAMESPACE
"yield::crossrelations"
ROOT_TYPE
CrossRelations
SCHEMA_PATH
"${CMAKE_BINARY_DIR}/yield-cross-relations.yml"
SEPARATE_STRING_TYPES
"MetaAddress"
SCALAR_TYPES
"BasicBlockID"
"MetaAddress"
"yield::ByteContainer"
HEADERS
"${INTERNAL_ASSEMBLY_HEADERS}/CrossRelations.h"
"${INTERNAL_ASSEMBLY_HEADERS}/RelationDescription.h"
"${INTERNAL_ASSEMBLY_HEADERS}/RelationTarget.h"
"${INTERNAL_ASSEMBLY_HEADERS}/RelationType.h")
revng_add_analyses_library_internal(
revngYieldPipes SHARED Pipes/AssemblyPipes.cpp Pipes/CallGraphPipes.cpp
Pipes/CFGPipes.cpp)
target_link_libraries(revngYieldPipes revngYield revngFunctionIsolation
revngPipes revngSupport)