Commit Graph

37 Commits

Author SHA1 Message Date
Pietro Fezzardi 7948d8ce56 MakeModelGEPPass: ignore callees of indirect calls 2022-07-29 09:24:21 +02:00
Alvise de Faveri c9930528ee ModelGEP: Fix pointee type in makeBestGEPArgs 2022-07-15 17:17:04 +02:00
Alvise de Faveri ad524a4d4d ModelGEP: Return the size of the gepped field
ModelGEP calls in LLVM IR now return an integer that has the same
size of the field being addressed by the ModelGEP.

AddressOf calls, instead, can accept any integer size as argument but
always return a pointer-sized integer.
2022-06-28 10:14:10 +02:00
Alvise de Faveri f010aea785 ModelGEP: Don't generate index-less GEPs 2022-06-28 10:13:37 +02:00
Pietro Fezzardi ad81bc7020 Enable addtional compilation warnings
These warnings are not enabled by default with -Wall nor with -Wextra.
2022-06-14 12:48:54 +02:00
Pietro Fezzardi 71b99464fe MakeModelGEPPass: consider type size in scoring 2022-06-14 10:56:56 +02:00
Pietro Fezzardi 43fb18219b MakeModelGEPPass: fix comparison of QualifiedTypes
This comparison was used to sort the best results among candidates for
creating ModelGEPs.

However the comparison itself was broken, i.e. you could have 2
different QualifiedTypes T1 and T2 such that T1 < T2 AND T2 < T1.
This caused broken sorting and non-deterministic selection of the best
ModelGEP substitution.

This commit fixes the comparison and as a result the selection of the
best candidate for the emission of ModelGEPs is not completely
deterministic.
2022-06-13 16:52:17 +02:00
Alvise de Faveri 7f37a22b5d Support: Improve peelConstAndTypedefs constness 2022-06-01 11:21:02 +02:00
Pietro Fezzardi 67c6c81e53 MakeModelGEP: ignore undef and null addresses 2022-05-31 12:40:52 +02:00
Pietro Fezzardi c88504afbf Drop old flag -single-decompilation
This flag was used with the old C backend to decompile only a single
function from a binary.

The logic of selecting functions in a binary for decompilation is now
part of revng-pipeline, so the -single-decompilation option and the
associated TargetFunctionOption library can be dropped.
2022-05-11 12:42:38 +02:00
Alvise de Faveri 96074c7938 ModelHelpers: Make dropPointer recursive 2022-04-20 17:35:05 +02:00
Alvise de Faveri 3fe9f687cc Move TypeMap initialization to InitModelTypes
Move the code that initializes the TypeMap in a separate library,
that will be shared between ModelGEP and the backend.
2022-04-20 17:35:05 +02:00
Giacomo Vercesi ab125b35b0 Fix License headers
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
2022-04-19 12:17:59 +02:00
Pietro Fezzardi 36541ae5cd QualifiedType RawFunctionType.StackArgumentsType 2022-04-08 17:58:06 +02:00
Giacomo Vercesi da06acf29e Update to reflect removal of tags from model YAML 2022-04-08 17:57:23 +02:00
Antonio Frighetto 765219d58c Support for control-flow graph out of the model
The control-flow graph has been taken out of the model. Related changes
to `getCallSitePrototype` have been here addressed.
2022-04-06 16:25:05 +02:00
Pietro Fezzardi 58cdd814de MakeModelGEP: fix scoring for array accesses
This commit relaxes some assertions related to DLA, that were too strict
for general type systems not generated by DLA, and fixes the scoring of
the best access to select ModelGEPs.
2022-03-31 16:21:12 +02:00
Pietro Fezzardi ddf6c23be6 Migrate AddressOf to OpaqueFunctionsPool 2022-03-31 10:36:57 +02:00
Pietro Fezzardi b0ce5466d6 MakeModelGEP: fix off-by-minus error in assertion 2022-03-28 17:58:42 +02:00
Pietro Fezzardi d9906b572f MakeModelGEP: use perfect type match in scoring
Before this commit we did not take into account a perfect type match
when deciding the best ModelGEP to emit.

This commit changes the score to take it into account and score higher a
ModelGEP with perfect type match.
2022-03-28 09:51:52 +02:00
Pietro Fezzardi cd826fc52f MakeModelGEPPass: use CallToLifted tag 2022-03-28 09:51:50 +02:00
Alvise de Faveri 096ab1f5a1 Segregate: copy metadata on the new Call
Before this commit, SegregateStackAccessPass did not update properly the
metadata. Missing metadata did not allow the rest of the pipeline to
detect the special call.

This commit properly copies the metadata and updates the rest of the
pipeline to take care of the special call.
2022-03-22 11:48:27 +01:00
Alvise de Faveri 4d7e41e62a Add model type helpers to ModelHelpers 2022-03-22 10:55:11 +01:00
Pietro Fezzardi bced6beacb MakeModelGEP: relax assertions on array size 2022-03-21 15:27:51 +01:00
Alvise de Faveri 97e3512bd7 ModelGEP: Use revng helpers for logging 2022-03-17 20:52:31 +01:00
Pietro Fezzardi c41ca3a451 New revng helpers for Qualifier and QualifiedType 2022-03-17 17:15:50 +01:00
Alessandro Di Federico 77335d036a Rename Lifted tag to Isolated 2022-03-17 14:08:05 +01:00
Alessandro Di Federico 5d197bff15 Adopt API changes in the model 2022-03-10 17:59:05 +01:00
Pietro Fezzardi a65407f089 MakeModelGEP: handle array traversal with 0 offset 2022-03-07 17:25:05 +01:00
Pietro Fezzardi 65e6193edf MakeModelGEPPass.cpp: improve const-correctness 2022-02-25 10:32:22 +01:00
Pietro Fezzardi a767a0556c MakeModelGEP: RestOff might be wider
This is a temporary fix for an heisenbug, very much like commit
99ceac865b790d08de46d21a8ba89f3649d3a097
2022-02-25 10:32:22 +01:00
Pietro Fezzardi 06dc78382b MakeModelGEPPass: fix AddressOf parameters
Before this commit, the type parameter of AddressOf calls was
erroneously set to the same type of the associated ModelGEP.
This commit fixes the problem, setting the type parameter of AddressOf
calls to the pointee type.
2022-02-15 11:44:04 +01:00
Alessandro Di Federico c9f2b24b0b MakeModelGEP: Index might be larger than BaseOff
This is a temporary fix for an heisenbug.
2022-01-27 13:21:14 +01:00
Alessandro Di Federico 020a7fc945 MakeModelGEP: ignore CABIFunctionTypes 2022-01-17 18:18:52 +01:00
Pietro Fezzardi 9e498f8b02 MakeModelGEP: switch to reference semantics 2022-01-14 14:29:57 +01:00
Pietro Fezzardi d237bc439e IRCanonicalization: switch to FunctionTags 2022-01-14 14:29:05 +01:00
Pietro Fezzardi 2fbb8df965 Add MakeModeGEPPass 2022-01-14 14:28:33 +01:00