Commit Graph

32 Commits

Author SHA1 Message Date
Pietro Fezzardi 3d6020139f Add type argument to 'revng_call_stack_arguments'
The additional argument is a pointer to a constant string that represent
the serialized model::QualifiedType of the argument.
2022-11-30 18:16:13 +01:00
Pietro Fezzardi 05c96a1a3a Adopt abi::FunctionType::ArgumentKind 2022-11-30 18:16:13 +01:00
Pietro Fezzardi daec840e37 Fix getStrongModelInfo for stack arguments
Before this commit, the code was assuming that we only passed stack
arguments to fuctions with RawFunction type. This is not true anymore.

This commit adds support to getStrongModelInfo for when we are passing
stack arguments to CABIFunctionType.
2022-11-30 18:16:13 +01:00
Pietro Fezzardi 7c643f3d1b ModelHelpers: support generic80_t and generic96_t 2022-11-30 18:16:13 +01:00
Pietro Fezzardi e92f6a3ddd ModelHelpers.cpp: refactor handling of ModelGEP 2022-11-30 18:16:13 +01:00
Ivan Krysak 033ccbe51a Adopt FunctionType::Layout to improve CABI support 2022-11-30 18:16:13 +01:00
Ivan Krysak 654afbef0c Move pointer creation away from model::Binary 2022-11-30 18:16:13 +01:00
Massimo Fioravanti 335d402245 Change signatures to forward metadata cache. 2022-11-22 12:27:02 +01:00
Pietro Fezzardi 0097af6dd0 Fix peelConstAndTypedefs for model::TypedefType
Before this commit typedefs were not unwrapped correctly, leading to
infinite loops.
2022-11-09 11:59:51 +01:00
Pietro Fezzardi 73210ab4ae Adopt TupleTreeReference caching 2022-10-31 09:08:17 +01:00
Pietro Fezzardi 25119c4377 Drop bugged addPointerQualifier for getPointerTo
This commit removes the bugged addPointerQualifier helper function,
that was wrongly pushing the pointer qualifier at the end.

Instead, we now use the correct model::Binary::getPointerTo method.
2022-10-21 09:45:28 +02:00
Pietro Fezzardi 887701e6f0 InitModelTypes: better support CABIFunctionType 2022-10-20 10:22:20 +02:00
Antonio Frighetto 19d7f8b2c9 Late decompilation: support model::Segment
Backend and InitModelTypes now handle the opaque `segmentRef` marker.
2022-07-19 13:53:21 +02:00
Antonio Frighetto 0ca87e8840 ModelHelpers: drop createEmptyStruct
`createEmptyStruct` has been upstreamed into revng.
2022-07-19 13:47:44 +02:00
Alvise de Faveri a788a5ba62 Add helpers for inferring model types from the IR
1. Add a common helper to traverse ModelGEPs (`traverseModelGEP`)
2. Add a centralized way to deduce the model type of values that
   have strong model information attached to them (e.g. isolated
   functions and ModelGEPs)
3. Add a similar helper for deducing formal types of operands in known
   cases
2022-07-18 15:37:31 +02:00
Alvise de Faveri c2481aeb7b Support: Add deserializeFromLLVMString
Instead of having `paseQualifiedType` and `parseAndDeserialize`,
we now have a single function that is symmetric to
`serializeToLLVMString`.
2022-07-15 17:17:04 +02:00
Antonio Frighetto 4a045cce53 Introduce MakeModelCastPass
A pass that strips the casts off from some instructions, including
`ModelGEP`s, general function calls, return and store ones, and
embeds the cast into new dedicated `ModelCast` function calls.
2022-06-15 10:28:50 +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
Alvise de Faveri 66e077fdcb Support: Fix dropPointer() 2022-06-13 15:21:49 +02:00
Alvise de Faveri 7f37a22b5d Support: Improve peelConstAndTypedefs constness 2022-06-01 11:21:02 +02:00
Alvise de Faveri e9fcdc3f2a Support: Convert LLVM types as generic types 2022-06-01 11:09:15 +02:00
Alvise de Faveri c7264badae Support: Add serializeToLLVMString(QualifiedT) 2022-06-01 11:08:29 +02:00
Pietro Fezzardi 4ed636cbba Support emission in C of null pointers 2022-05-31 12:40:52 +02:00
Alvise de Faveri 96074c7938 ModelHelpers: Make dropPointer recursive 2022-04-20 17:35:05 +02:00
Alvise de Faveri 827d5605f4 llvmIntToModelType: Handle nested pointer types 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
Alvise de Faveri 4d7e41e62a Add model type helpers to ModelHelpers 2022-03-22 10:55:11 +01:00
Pietro Fezzardi c41ca3a451 New revng helpers for Qualifier and QualifiedType 2022-03-17 17:15:50 +01:00
Pietro Fezzardi 5cdc63cda6 Apply new revng coding conventions 2022-02-28 18:02:25 +01:00
Alvise de Faveri 73c743597b Pull out DepGraph and naming from ModelToHeader
Separate `ModelToHeader.cpp` into 3 different files:

1. DependencyGraph, used to calculate the precedence between
   type declarations
2. ModelTypeNames, that holds all the naming logic, whose
   primitives are accessible from other modules through a
   public header
3. ModelToHeader, that now contains only the logic to print
   out declarations and definitions

Also add a compilation test for the headers generated by this pass.
2022-02-10 17:12:56 +01:00
Filippo Cremonese b940af4692 Import recent changes to the model 2022-01-14 14:06:59 +01:00
Pietro Fezzardi 818156e06a DLA upgrades stack's and stack arguments' types 2022-01-04 16:21:07 +01:00