Alessandro Di Federico
0c212b66d9
Relicense to MIT
2024-02-29 17:03:36 +01:00
Alessandro Di Federico
2de10213d4
Segregate: improve returning aggregates support
...
This commit heavily reworks how we handle returned values, making things
a bit more elegant.
Apart from this, it fixes how were handling types that on the model are
aggregates but were being returned via registers on the IR.
2023-12-12 12:04:21 +01:00
Alessandro Di Federico
d5ad77d2d9
Adopt model::QualifiedType::stripPointer
2023-12-12 12:04:19 +01:00
Alessandro Di Federico
c561a71089
s/Layout::returnsAggregateType/Layout::hasSPTAR/
2023-12-12 12:04:12 +01:00
Giacomo Vercesi
194bcecc41
Drop getReturnField
...
Drop the `getReturnField` helper, the cases in which it was used are now
covered by the `NamedTypeRegister::name` method.
2023-12-11 10:21:40 +01:00
Giacomo Vercesi
fd24487666
C code: fix location for RawFunction return struct
...
Fix the needed attributes to allow navigation from the use of an
artificial return struct for raw functions to their definition in
`types-and-globals.h`.
2023-12-11 10:21:40 +01:00
Pietro Fezzardi
24cb43ce9c
Make RawFunctionType::StackArgumentsType a TTR
...
This is homogeneous with all other nullable references to types in the
model, such as the StackFrameType in model::Function, and others.
2023-12-05 16:56:52 +01:00
Giacomo Vercesi
68f71c3b39
Adopt new PTML tags
...
Change the emitted decompile code to include the
`data-action-context-location` and `data-name-of` tags.
2023-11-03 16:31:06 +01:00
Giacomo Vercesi
0ca3c03de1
ModelTypeNames: fix printFunctionPrototype
...
The `printFunctionPrototype` function produced a prototype with a
`data-location-references` instead of a `data-location-definition`.
2023-10-23 10:20:54 +02:00
Giacomo Vercesi
df877d4aec
Drop unused statements
...
Drop `using`s that were unused.
2023-10-23 10:20:49 +02:00
Pietro Fezzardi
4bc7a14649
ModelTypeNames: print function attributes
2023-10-18 15:39:17 +02:00
Alessandro Di Federico
2a7e06df1f
printFunctionPrototype: add newline after ABI
...
This commit forces getLocationAttribute's argument to be false.
2023-10-06 17:14:29 +02:00
Alessandro Di Federico
f3d6bbb047
s/ThePTMLCBuilder/B/g
2023-08-23 16:40:54 +02:00
Alessandro Di Federico
489dddd0e7
TupleTreeReference::isValid is for assertions only
2023-08-23 16:37:39 +02:00
Alessandro Di Federico
330d2b6cc7
Model: rework how we name things
...
This commit:
* Introduces `_` as a prefix for all non-user entities we emit in
decompiled code.
Also, some names have been changed to be more concise.
Specifically, the following entities have changed:
`_ENUM_UNDERLYING`, `_ABI`, `_REG`, `_padding_at_`,
`_artificial_struct_`, `_artificial_wrapper_`, `_stack`,
`_break_from_loop_`, `_var_`, `_stack_arguments`,
`_artificial_struct_returned_`, `_enum_max_value_`.
* Introduce _PACKED for `__attribute__((packed))`.
* `EnumEntry` name: drop the `EnumType` name prefix.
2023-08-23 16:37:39 +02:00
Pietro Fezzardi
936fbacd2d
ModelTypeNames: drop leading whitespace
2023-07-26 10:01:27 +02:00
Pietro Fezzardi
abac9233b0
ModelTypeNames: emit ENUM_UNDERLYING for enums
2023-07-26 10:01:27 +02:00
Pietro Fezzardi
8b2e3a70df
ModelTypeNames: annotate stack args with STACK
2023-07-26 10:01:27 +02:00
Djordje Todorovic
e6b128c17b
ModelToHeader: Print annotation __attributes__
...
This will be useful for `edit/add type` feature,
since we will be able to specify which ABI describes
a function, from the source code written in C.
2023-07-24 09:17:08 +02:00
Ivan Krysak
e0b956b1c2
Model: rework edit path helpers from the ground up
2023-07-21 04:58:50 +00:00
Ivan Krysak
b0dcc3d9ee
Formatting: forbid clang format off
2023-07-05 14:33:06 +02:00
Djordje Todorovic
286eb4d734
c-backend: Introduce PTMLCBuilder
...
This will be used to generate plain C.
2023-06-09 15:40:23 +02:00
Giacomo Vercesi
a4ad571e61
rcc: Fix typos
...
Fix the typos detected by `codespell`
2023-05-11 10:04:32 +02:00
Djordje Todorovic
ca7bc2e442
c-backend: Generate Inline Types in PTML
...
In ModelToHeader generate Inline Types in PTML by handling
Structs, Unions and Enums.
In addition, during the ModelToHeader we avoid producing
Structs that describe stacks, and in the DecompileFunction we
produce the definition of it inline if it is safe (referenced
only once).
2023-05-03 13:13:28 +02:00
Alessandro Di Federico
b0024a302f
Fixes for SPTAR passed on the stack
2023-03-15 10:28:24 +01:00
Ivan Krysak
c2f0fc19e5
ABI: FunctionType.h -> FunctionType/Layout.h
2023-03-15 10:28:24 +01:00
Pietro Fezzardi
6cca34c30d
Support array of pointers in getNamedCInstance
2023-01-17 12:31:22 +01:00
Massimo Fioravanti
87aef3fbad
revng-c now uses Model accessors
2022-12-12 11:35:52 +01:00
Pietro Fezzardi
ee0dc97464
Uniform printing return types of functions
2022-11-30 18:16:13 +01:00
Pietro Fezzardi
7b66b9d7f6
TypeNames: fix redundant whitespaces in types
2022-11-30 18:16:13 +01:00
Pietro Fezzardi
2e2489e79d
ModelTypeNames: handle returning aggregates
2022-11-30 18:16:13 +01:00
Pietro Fezzardi
389a184fc2
Handle CABIFunctionTypes returning struct types
2022-11-30 18:16:13 +01:00
Pietro Fezzardi
05c96a1a3a
Adopt abi::FunctionType::ArgumentKind
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
Pietro Fezzardi
8aaa3ca92e
Refactor PTML generation for functions
2022-11-16 16:02:09 +01:00
Pietro Fezzardi
e72a578743
Refactor PTML generation for local variables
2022-11-16 11:24:37 +01:00
Pietro Fezzardi
a23d4f8dcf
Ranks.h: simplify ranks, delete unnecessary ranks
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
992302e9e3
ModelTypeNames.cpp: no space after ptr return type
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
ff631c5364
PTMLC.h: switch to string-based return values
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
38ce08edba
PTMLC: add Const keyword
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
2ec8b7e32c
ModelToHeader: refactor creation of PTML Tags
2022-11-15 15:54:20 +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
2d1ade06b3
Support pointers to arrays in getNamedCInstance
2022-10-17 11:25:24 +02:00
Giacomo Vercesi
72050274e2
getNamedCInstance: drop declaration parameter
...
In all cases this is false
2022-10-11 17:36:29 +02:00
Giacomo Vercesi
8e996d2394
Output PTML in revng-c
...
Change the output of the backend of revng-c to PTML
2022-09-01 16:59:29 +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
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
Pietro Fezzardi
c41ca3a451
New revng helpers for Qualifier and QualifiedType
2022-03-17 17:15:50 +01:00