Commit Graph

6113 Commits

Author SHA1 Message Date
Alessandro Di Federico fe1dffcffd Add some missing includes
This is in preparation of reducing headers in Debug.h.
2024-05-03 21:52:40 +02:00
Alessandro Di Federico 25c7834b21 Introduce test_adt
This should reduce build times.
2024-05-03 21:52:40 +02:00
Alessandro Di Federico 7b4183509e Merge branch 'feature/efa-4' 2024-05-03 19:28:59 +02:00
Alessandro Di Federico b392105f48 Merge branch 'feature/efa-4' 2024-05-03 19:28:56 +02:00
Andrea Gussoni 736e2509c0 Improve switch to if promotion test 2024-05-03 18:09:12 +02:00
Alessandro Di Federico ddc4e7146f Run DropOpaqueReturnAddress after early-optimize 2024-05-03 18:09:12 +02:00
Alessandro Di Federico 8eca2e13fe Do not use SmallPtrSet with std::includes 2024-05-03 17:59:34 +02:00
Andrea Gussoni 1590d96381 SimplifyDualSwitch: Fix two case switch
Fix the promotion logic to not promote standard `switch`es with two
`case`s and no `default` (or the semantics will be corrupted).
2024-05-03 07:40:38 +02:00
Alessandro Di Federico 452036edf1 Purge instructions to save return address 2024-04-30 15:25:53 +02:00
Alessandro Di Federico f777eaf00f Introduce tests for RegisterUsageAnalyses 2024-04-19 18:33:00 +02:00
Alessandro Di Federico 0459b9d084 Introduce RegisterUsageAnalyses 2024-04-19 18:33:00 +02:00
Alessandro Di Federico 9d12cd35e3 DwarfImporter: improve logging 2024-04-19 18:33:00 +02:00
Alessandro Di Federico 58d965f977 DwarfImporter::getName: consider abstract_origin 2024-04-19 18:33:00 +02:00
Alessandro Di Federico fcd04c163b DwarfImporter: hack to handle transparent unions 2024-04-19 18:33:00 +02:00
Alessandro Di Federico 2267b51090 Mark findPrototype as inline 2024-04-19 18:33:00 +02:00
Alessandro Di Federico ba65443293 DetectABI call graph: no multiple identical edges 2024-04-18 17:55:22 +02:00
Alessandro Di Federico 0b4476d824 Introduce FunctionSummary::clone 2024-04-18 17:55:15 +02:00
Alessandro Di Federico ab3d546b0a Introduce GenericGraph::dumpGraph() 2024-04-18 17:50:33 +02:00
Alessandro Di Federico dcfb4621a7 Improve GenericGraph::verify 2024-04-18 17:50:33 +02:00
Alessandro Di Federico a1f3624b21 TraceProgressListener: flush upon signal 2024-04-18 17:50:33 +02:00
Alessandro Di Federico 3b135a2a2f MFP: use the provided GraphTraits for RPOT 2024-04-18 17:50:32 +02:00
Alessandro Di Federico d36d0184d3 SerializableGraph: fix template usage 2024-04-18 17:50:32 +02:00
Alessandro Di Federico a1b0ba752c GenericGraph: implement Edge::operator==
This fixes a subtle bug in GenericGraph. Basically, if the label of an
Edge was the Empty data structure, whose `operator==` always returns
`true`, the comparison between edges was broken.
2024-04-18 17:50:32 +02:00
Alessandro Di Federico d8e58f7a36 for-detect-abi.yml: re-enable tests
Tests were accidentally disabled due to a typo.
2024-04-18 17:50:31 +02:00
Alessandro Di Federico c2da2ba08a revng-check-conventions: ignore empty files 2024-04-18 17:50:31 +02:00
Alessandro Di Federico dae9f33544 Minor changes 2024-04-18 17:50:31 +02:00
Alessandro Di Federico 9bbf1cc144 DwarfImporter: renumber UnionFields after cleanup 2024-04-11 15:29:39 +02:00
Alessandro Di Federico 53f0c71d3b FunctionMetadata::dumpCFG: dump to file 2024-04-05 13:29:15 +02:00
Alessandro Di Federico dda484d642 FunctionMetadata::simplify: use .nextBlock()
Before we were using `.End()` which lead to lose the inlining index.
2024-04-05 13:28:31 +02:00
Pietro Fezzardi 9624f2bbd1 Merge branch 'feature/dual-switch-test' 2024-04-05 10:00:49 +02:00
Andrea Gussoni c7b0fb7c06 Introduce switch to if promotion test 2024-04-05 09:10:18 +02:00
Andrea Gussoni f05723707f BeautifyGHAST: delay loop promotion passes
Delay as much as possible the loop promotion passes, in order to catch
more opportunities.

Specifically, we now perform the loop promotion after the dual case
`switch` promotion pass.
2024-03-26 17:08:20 +01:00
Giacomo Vercesi f7b1130dc2 mkdocs: add additional.js
Add an empty `additional.js` file which can be used by downstream users
for additional javascript code.
2024-03-26 11:30:14 +01:00
Pietro Fezzardi 964ff2227d Merge branch 'feature/more-fixes-for-13-binaries' 2024-03-25 18:09:04 +01:00
Pietro Fezzardi 8b0f4e035c RestructureCFG: update deduplicated dummy nodes
Before this commit, it could happen that some duplicated dummy node
(used to mark backedges) could be left lingering in wrong regions when
collapsing a regions, if they were first iteration outlined.

This commit fixes the problem, by collecting them and letting
`updateNodes` take care of them, removing them from the containing
region and all its parents.
2024-03-25 18:08:35 +01:00
Pietro Fezzardi 454e38e4ff RestructureCFG: handle retreating from SetNodes 2024-03-25 18:08:35 +01:00
Pietro Fezzardi 4baff26fca SwitchToStatements: handle self-assignments 2024-03-25 18:08:35 +01:00
Pietro Fezzardi abb9344242 Relax tests to cope with DetectABI nondeterminism
Currently, some non-determinism upstream in the ABI detection pipeline
causes the return type of the `compute` function to be misdetected, even
if only very rarely.
Exclud this return type from tests for now.
Consider to re-add it in the future if we enforce stricter determinism,
or when EFA 4 is ready.
2024-03-25 18:08:35 +01:00
Pietro Fezzardi b50aca6a15 MergePointeesOfPointerUnion: improve Model types
Before this commit, the DLAStep MergePointeesOfPointerUnion wasn't
really equipped for dealing with LayoutTypeSystemNodes representing
types imported from Model.
There was some code that tried to deal with them but it was mostly an
afterthought and it wasn't robust.

This commit fixes that, and is able to handle a strict superset of the
scenarios envisioned before, while preserving the property that nodes
representing types imported from Model should be preserved (in
particular their size).
2024-03-21 11:51:10 +01:00
Alessandro Di Federico d7212401c9 Merge branch 'feature/last-fixes-tier-2' 2024-03-19 19:30:13 +01:00
Pietro Fezzardi e66fb48f16 README.md: fix revng repository link preview 2024-03-19 18:12:53 +01:00
Pietro Fezzardi d84f099af7 RestructureCFG: fix iterator invalidation 2024-03-19 17:46:32 +01:00
Pietro Fezzardi e58531b88d RestructureCFG: flush logger 2024-03-19 17:46:32 +01:00
Pietro Fezzardi f0619b08eb MakeModelGEP: simplify ModelGEPs LLVM Types
Now ModelGEPs emitted by MakeModelGEP always forward the LLVM Type of
the operand representing the base address.

Before this commit they were occasionally using an integer type with the
size of the underlying `model::QualifiedType`, but that is not necessary
and may end up requiring `llvm::IntegerType`s that are very large, to
the point of not being supported by LLVM, for no additional advantage.
2024-03-19 17:46:32 +01:00
Pietro Fezzardi d9b0a118ef SegregateStackAccessesPass: drop unused AssignPool 2024-03-19 17:46:32 +01:00
Alessandro Di Federico 06342b9023 Merge branch 'feature/revng-c-fixes-tier-2' 2024-03-19 17:33:03 +01:00
Alessandro Di Federico cdfd91c334 Merge branch 'feature/revng-c-fixes-tier-2' 2024-03-19 17:33:00 +01:00
Pietro Fezzardi c48908c6a6 Revamp decompilation tests
Many old unit tests were too rigid, using the model and the LLVM IR.
This commit drops them, and replaces them with decompilation tests based
on revng-qa, relying on `revng model compare` to test model properties,
and on `FileCheck` to test that we emit specific constructs in C.

The new tests cover various features of the decompiler.
* DLA capability to recover complex data structure like linked-lists and
  arrays.
* DLA capability to update segment and section types, so that we emit
  nice looking accesses to segments in C.
* Capability to emit nice looking integer literals in C
* Capability to emit inline string literals in C and update the model
  types of the segments containg such string literals.
2024-03-19 09:44:00 +01:00
Pietro Fezzardi 4531b9ff5d InitModelTypes: fix IntToPtr
Before this commit, initModelTypes could return integers of the wrong
size for IntToPtrInst, whenever the integer being casted to pointer did
not have the exact same size of the pointer on the model.

This commit fixes the problem. Now initModelTypes, even if it might be
forced to return an integer type for IntToPtr, it makes sure that the
size of that integer matches the size of the pointer on the model.
2024-03-19 09:44:00 +01:00
Pietro Fezzardi 71f61d9eb5 Pipeline: execute ExitSSA after ternary reduction 2024-03-19 09:44:00 +01:00