mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
5009074e9e
* Introduce `ShrinkInstructionOperandsPass`: a transformation shrinking operands and the results of instructions if they are zero/sign-extended immediately before and after the instruction. * Introduce `ConstantRangeSet`: similar to `ConstantRange` but allows disjoint ranges. * Introduce `MaterializedValue`: a class that can represent a constant value or a symbol plus offset pair. * Introduce `DropHelperCallsPass`: a transformation removing calls to helpers and replacing them with a function call reading the CSVs that the helper reads and writing the CSVs that the helper writes (according to CSAA). * Introduce `DropRangeMetadataPass`: a transformation dropping the `range` metadata, which, in certain situations, lowers the quality of the results provided by `LazyValueInfo`. * Introduce `AdvancedValueInfo`: an analysis exploiting results of `LazyValueInfo` but collecting them as `ConstantRangeSet` with a monotone framework. It produces `MaterializedValue`. * Anticipate linking of helpers: `AVI` requires `CSAA`, which requires helper functions to be linked in. * Drop `--no-link`. * Force x86-64 `DataLayout`. * Reorganize harvesting to either collect simple literals or go with (incremental) `AVI`. * Drop `SET`, `OSRA`, the reaching definition analysis, the `SimplifyComparisonsPass` and all the sumjump-related code: e now clone `root`, optimize it and analyze it with `AVI`. * Temporarily drop the `NoReturnAnalysis`. * Link `libLLVMInstCombine`, `libLLVMCodeGen` and `libLLVMPasses`. * Introduce tests for `AdvancedValueInfo`, `ShrinkInstructionOperandsPass` and `ConstantRangeSet`. * Fix test results. * Add `llvm.bswap.i64` and `@pc` to the LLVM template module for unit tests.
894 B
894 B
Approach
-
Identify all the return candidates [DONE]
- Indirect jumps to the return address
- Indirect tail calls, i.e., indirect jumps to unknown addresses with SP >= 0
-
Go through all the candidates and elect a return stack pointer
- Mark all non-complaint ones as broken returns/indirect tail calls. They are not returns. [DONE]
- Combine the result associated to each propore return/indirect tail call, that's the grand result. Mark the ABIIRBasicBlock as return. [DONE]
a. If no proper stack pointer can be elected, but all the return points agree on a single SP <0, mark the function as outlined. b. If no proper stack pointer can be elected, mark the function as noreturn c. If a proper stack pointer has been elected, mark the function as regular.
TODOs
- Indirect tail calls must become longjmps, or longjmps should be treated as indirect tail calls