Commit Graph

500 Commits

Author SHA1 Message Date
Djordje Todorovic c58fec45e3 Add ImplicitModelCastPass
We introduce a new LLVM Pass that should detect implicit
casts, by marking the 3rd argument of ModelCast as `true`.
The backend will omit printing a cast expression if the
ModelCast is implicit one.
2024-05-16 17:57:22 +02:00
Djordje Todorovic e3f191ff67 doc: Adjust tests because of cast reduction 2024-05-16 17:55:19 +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 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 d8e58f7a36 for-detect-abi.yml: re-enable tests
Tests were accidentally disabled due to a typo.
2024-04-18 17:50:31 +02:00
Andrea Gussoni c7b0fb7c06 Introduce switch to if promotion test 2024-04-05 09:10:18 +02: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 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 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 71f61d9eb5 Pipeline: execute ExitSSA after ternary reduction 2024-03-19 09:44:00 +01:00
Pietro Fezzardi 132adeecd5 Add PeepholeOptimization pass
This pass is dedicated to applying a bunch of peephole optimizations
that are useful for decompilation and haven't been implemented in LLVM
for whatever reason.

At the moment it only runs an optimization that tries to reduce the uses
of incoming values of PHINodes, under very specific condidtions, which
enables emitting less LocalVariables.
2024-03-19 09:44:00 +01:00
Pietro Fezzardi 70c8ae48ff Retire MarkAssignment for SwitchToStatements 2024-03-19 09:44:00 +01:00
Ivan Krysak 13cc649226 test-model-diff: fix temporary directory usage 2024-03-18 19:32:35 +01:00
Ivan Krysak 5894201920 Yield: update model-tutorial.md 2024-03-18 17:23:07 +01:00
Ivan Krysak 44e5328477 Yield: add explicit directive support 2024-03-18 11:40:32 +00:00
Ivan Krysak 7403f09b7d docs: add new asm tokens 2024-03-18 07:20:41 +00:00
Ivan Krysak aa44fdbe91 docs: fix some typos 2024-03-18 07:20:41 +00:00
Ivan Krysak 60cbf9a33f Use ABI test binaries for the entire pipeline 2024-03-15 19:05:10 +01:00
Ivan Krysak a58ccd159e ImportPE: fix the filters 2024-03-15 19:05:10 +01:00
Ivan Krysak 1b52530531 ABI-tests: turn temporary directory into "output" 2024-03-15 19:05:10 +01:00
Ivan Krysak d71fd7a1ad ABI-tests: strip model of irrelevant functions 2024-03-15 19:05:10 +01:00
Ivan Krysak 6feb9aa001 ABI-tests: rename replace-abi script 2024-03-15 19:05:10 +01:00
Ivan Krysak 5407c11a8f ABI: do not touch ABIs of unrelated functions 2024-03-15 19:05:10 +01:00
Andrea Gussoni 7d8b0139f3 SegregateStack: fix FileCheck directive
Add `%` in order to match precisely the argument LLVMIR value, and not
other spurious characters around.
2024-03-11 18:36:09 +01:00
Alessandro Di Federico 85abd9b6fc revng artifact: introduce --analyze 2024-02-29 18:04:35 +01:00
Alessandro Di Federico 0c212b66d9 Relicense to MIT 2024-02-29 17:03:36 +01:00
Alessandro Di Federico d21aadfdd0 docs: document binary installation 2024-02-29 17:03:04 +01:00
Alessandro Di Federico 2403f1e10b mkdocs: make links relative 2024-02-26 16:08:54 +01:00
Alessandro Di Federico 9f097e079d revng-c opening: update docs 2024-02-16 10:32:49 +01:00
Ivan Krysak b0b1f10e72 ABI: move ToCABIFunctionType analysis to revng 2024-02-09 16:24:44 +01:00
Ivan Krysak e708a3655b ABI: drop incomplete clrcall support 2024-02-09 15:09:37 +00:00
Ivan Krysak e62d4f79ef ABI: remove an obsolete definition parameter
Since pointer to copy system got straightenned up, the old way of
marking them (`abi::Definition::UsePointerToCopyForStackArguments`)
is no longer needed.
2024-02-09 15:09:37 +00:00
Ivan Krysak 5a36d8fccf ABI-tests: update documentation 2024-02-09 15:09:37 +00:00
Ivan Krysak 94b6be25ae ABI-tests: check equivalence after compatibility
This does not change anything about the "successful" tests, but does
make "failing" ones slightly easier to debug - since "compatibility"
failures are generally easier to work with (they provide more explicit
information about the failure) that "equivalence" ones.
2024-02-09 15:09:37 +00:00
Ivan Krysak 27491410d6 ABI: introduce a way to disable vector registers 2024-02-09 15:09:37 +00:00
Ivan Krysak 4e81a34cd7 ABI: separate 'gcc' editions of microsoft ABIs 2024-02-09 15:09:37 +00:00
Ivan Krysak 3fdd7d8e8a ABI: introduce a way to set stack argument offset 2024-02-09 15:09:37 +00:00
Ivan Krysak 3efd08b07a ABI: fix microsoft x64 abi definitions 2024-02-09 15:09:37 +00:00
Ivan Krysak af6f9367b2 ImportPE: remove i386-specific values 2024-02-09 15:09:37 +00:00
Djordje Todorovic 79460c6933 PDBImport: Handle forward referenced types
A class or a struct type A can be a forward declaration and refer
to another type B in PDB, so we need to follow the references.
We pre-create type for B, when we face type A, and then, when we
visit type B, we populate the fields for the model::type we
pre-created.

In addition, this patch fixes some minor/side bugs:
  - Handle SHORT/Int16Short simple type
  - Do not delete model::Function if Prototype is invalid.
2024-02-09 15:09:37 +00:00
Ivan Krysak e16cf87106 ABI-tests: specify the default PDB location 2024-02-09 15:09:37 +00:00
Ivan Krysak 34039dea68 ABI: move ToCABIFunctionType analysis to revng 2024-02-09 16:07:59 +01:00
Alessandro Di Federico aaa1b26468 AAPCS ABI: drop support for int128_t 2024-02-09 10:04:26 +01:00
Alessandro Di Federico 6cacb56c96 Reorganize test suite 2024-02-09 10:04:25 +01:00
Alessandro Di Federico 346b367c19 Drop revng efa-extractcfg 2024-02-09 10:04:25 +01:00
Alessandro Di Federico 757f7e21d7 Import docs 2024-02-09 10:04:24 +01:00
Alessandro Di Federico d9367954a4 Convert all public strings to kebab-case 2024-02-09 10:04:24 +01:00
Giacomo Vercesi 5978300476 codespell: ignore CSS files 2024-02-09 10:04:24 +01:00