Commit Graph

6113 Commits

Author SHA1 Message Date
Ivan Krysak b4061793f3 TTG: fix accessor comment and constness
Also improve whitespace adjacent formatting
2023-07-21 17:25:24 +02:00
Alessandro Di Federico e544f40c72 Merge branch 'feature/tuple-tree-fix' 2023-07-21 14:50:29 +02:00
Giacomo Vercesi 27c065a54b model.ts: implement makeDiff speedups
Make `makeDiff` run faster by:
* Utilizing the information exposed by TYPE_HINTS which avoids having
  expensive runtime checks
* Optimize some of the hot parts of the codebase to lower run times
2023-07-21 13:19:04 +02:00
Giacomo Vercesi 3a006422d3 typescript/python model wrappers: fix structure
Change the way the python and typescript model wrappers handle
attributes in struct fields. Now all fields are populated and none of
the use `None`.
2023-07-21 09:34:00 +02:00
Giacomo Vercesi 0ec2fdd175 revng.daemon: prevent shutdown crash
Change the behavior of `revng daemon` to avoid a crash at shutdown
caused by `rp_shutdown` not being called due to the pointer of
`rp_manager` not being freed.
2023-07-21 09:34:00 +02:00
Giacomo Vercesi 406a21360a model.ts: add offset support to MetaAddress
Allow the `MetaAddress` class in typescript to independently compute the
offset to another MetaAddress.
2023-07-21 09:34:00 +02:00
Ivan Krysak 4a32781868 Backend: emit function comment 2023-07-21 04:58:51 +00:00
Ivan Krysak 11f07c6708 TypeNames: emit comments when outputting types 2023-07-21 04:58:50 +00:00
Ivan Krysak e0b956b1c2 Model: rework edit path helpers from the ground up 2023-07-21 04:58:50 +00:00
Ivan Krysak 2987b5621b Model: update constuctors with an extra field 2023-07-21 04:58:50 +00:00
Alessandro Di Federico c88d5693e7 Merge branch 'feature/make-dynamic-functions-nomerge' 2023-07-20 21:05:10 +02:00
Alessandro Di Federico cbddc85762 Merge branch 'feature/make-dynamic-functions-nomerge' 2023-07-20 21:05:07 +02:00
Pietro Fezzardi f04dea7636 InitModelTypes: detect type for isolated callees
Before this commit initModelTypes wasn't able to detect the type of the
callee operand for calls to isolated functions.
This commit properly supports this case.
2023-07-20 20:30:49 +02:00
Pietro Fezzardi 8683e889db EnforceABI: copy attributes on function calls
Before this commit, we were blinding adding the `nomerge` attribute to
function calls. Now we copy attributes over, so we preserve all the
attributes.

In this way the only place where we add the `nomerge` attribute becomes
Isolate.
2023-07-20 20:30:46 +02:00
Pietro Fezzardi 53bc3ebc17 Isolate: add nomerge attribute to DynamicFunctions 2023-07-20 20:30:45 +02:00
Alessandro Di Federico ab36b69678 Merge branch 'feature/propagate-prototypes' 2023-07-20 18:10:01 +02:00
Kacper Kołodziej 4b76bbbac8 Add test case for propagating prototypes
This test case relies on simple program that calls function from
dynamically linked library (puts function). Function from Procedure
Linkage Table is a wrapper for this call and puts prototype (recognized
from debug symbols) should be propagated to `puts@plt` function.

Verification relies on `revng model compare`.

Fetching prototypes requires internet connection. Adding puts prototype
to test case's model makes it independent of the Internet connection.
2023-07-20 18:09:48 +02:00
Kacper Kołodziej 2c470ec036 Add propagating prototypes in DetectABI pass
The goal of this update is to propagate prototypes of functions called
in wrappers to this wrappers.

When some function hasn't it's own prototype, but the only thing it does
is calling another function, DetectABI pass sets callee prototype as
caller prototype also.

This behaviour is limited to callers that:
 1. have only one basic block
 2. end with call
 3. don't write arguments of callee
 4. don't modify stack pointer
 5. don't write to memory.
2023-07-20 18:09:48 +02:00
Kacper Kołodziej b05a56e2da Move isMemory to IRHelpers.h 2023-07-20 18:09:48 +02:00
Kacper Kołodziej 75ed8f7788 Add WrittenRegisters set to FunctionSummary
WrittenRegisters will be used in propagating prototypes to wrappers
functionality to check if function writes to arguments or stack pointer.
2023-07-20 18:09:48 +02:00
Pietro Fezzardi e423676da3 Segregate: copy attributes on function calls
Before this commit, we were only copying the metadata attached to the
CallInst, but we need to copy also the attributes, otherwise we might
lose important information, such as `nomerge`.
2023-07-20 17:24:54 +02:00
Massimo Fioravanti 6707a20eea revng-pipeline CLI: drop list- from analysis lists 2023-07-20 17:08:28 +02:00
Andrea Gussoni 42f74ad998 RestructureCFG: use nodesBetween helper
Use the `nodesBetween` helper provided by the `GraphAlgorithms` header
instead of the custom `findReachableNodes` implementation.
2023-07-19 16:31:48 +02:00
Andrea Gussoni a715b89cf9 RestructureCFG: use getBackedges helper
Use the `getBackedges` helper provided by the `GraphAlgorithms` header
instead of the custom own implementation.
2023-07-19 16:30:14 +02:00
Alessandro Di Federico 448ebfc285 support.c: no-op g_assertion_message_expr
This lead to linking failures during translation of certain ARM
programs.
2023-07-18 17:39:37 +02:00
Pietro Fezzardi 10efe0f19d DLA: switch to revng's isCallToIsolatedFunction 2023-07-10 12:30:35 +02:00
Pietro Fezzardi a35ff569dc Merge branch 'feature/mlir-init' 2023-07-07 18:10:33 +02:00
Alessandro Di Federico aa74e194bc Merge branch 'feature/mlir-init' 2023-07-07 18:07:10 +02:00
Andrea Gussoni ac6139bc0f clift: import mlir::clift dialect 2023-07-07 17:48:13 +02:00
Andrea Gussoni 4ae0916934 clift: clift-opt binary 2023-07-07 17:48:09 +02:00
Andrea Gussoni c8871fc508 GraphAlgorithms: drop old nodesBetween
We now switch to the `llvm::df_iterator` based `nodesBetween`
implementation.

This new implementation makes use of the idiomatic way of extending the
DFS implementation provided by LLVM, instead of rolling our custom
implementation for the `nodesBetween` algorithm.
2023-07-07 15:02:08 +02:00
Andrea Gussoni f7db37e990 SetOperations: new header with useful set helpers 2023-07-07 15:02:08 +02:00
Andrea Gussoni 1a0c429ef9 GraphAlgorithms: introduce extended DFS algorithms
We improve the `getBackedges` and `nodesBetween` helper functions that
can be used for backedge discovery and computation of all the nodes
reachable on all the paths defined between two nodes in a graph.

We build upon the `llvm::df_iterator` function, by customizing the visit
stack to perform the desired visits.
2023-07-07 15:02:08 +02:00
Andrea Gussoni a613b873e8 GraphAlgorithms: introduce isDAG verifier helper 2023-07-07 13:33:30 +02:00
Alessandro Di Federico c711d5f5f2 Merge branch 'feature/libcpp-16' 2023-07-05 17:38:37 +02:00
Alessandro Di Federico 79ad7ff5ea Merge branch 'feature/libcpp-16' 2023-07-05 17:38:34 +02:00
Ivan Krysak b0dcc3d9ee Formatting: forbid clang format off 2023-07-05 14:33:06 +02:00
Ivan Krysak ce6d9a6dbf Formatting: forbid \brief 2023-07-05 14:33:03 +02:00
Ivan Krysak cd3865ee90 Switch to c++20 from c++2a 2023-07-05 06:07:11 +00:00
Ivan Krysak fe0531868c Use Container::contains() where appropriate 2023-07-05 06:07:09 +00:00
Ivan Krysak 888e5371eb Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-05 06:06:07 +00:00
Ivan Krysak 3c584cfabc Formatting: set AllowShortEnumsOnASingleLine
The new value is `false`.
2023-07-05 06:05:04 +00:00
Pietro Fezzardi 90a675038c ExitSSAPass: drop Liveness
The old implementation based on Liveness was broken.
2023-07-04 11:53:07 +02:00
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00
Ivan Krysak 5f6003346c Increase licence header search range 2023-07-03 15:23:10 +00:00
Ivan Krysak 260508dea7 Formatting: add mlir include category 2023-07-03 15:23:10 +00:00
Ivan Krysak ef7e576886 Formatting: drop unused include categories 2023-07-03 15:23:10 +00:00
Ivan Krysak ee0dc1866d Forbid clang format off 2023-07-03 15:23:10 +00:00
Ivan Krysak 5deede9992 Switch to c++20 from c++2a 2023-07-03 15:23:10 +00:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00