Ivan Krysak
eac296a99f
Standardize PTML tag emission in c backend
2025-05-08 15:42:00 +02:00
Ivan Krysak
fa2f243f12
PTML: avoid auto in constexpr string literals
2025-05-08 15:42:00 +02:00
Giacomo Vercesi
4e7469c1eb
ModelTypeNames: fix context-action
...
The `data-action-context-location` applies to only the variable portion
of a function argument, not the type and the variable.
2025-05-05 17:28:48 +02:00
Ivan Krysak
c6e38cd485
Return to using constant name builders
...
Because of how name builders used to lazy gather namespaces on the first
requested name, the objects were self mutating. As such only non-const
references could be used to pass them around.
Since that is no longer the case, this restores most of lost const
qualifiers.
2025-04-17 11:19:17 +03:00
Ivan Krysak
dce5c1a02c
NamingConfiguration: pull more prefixes inside
...
Unify additional values that used to be hardcoded in the old backend
under the same naming configuration root.
2025-04-17 11:19:17 +03:00
Ivan Krysak
f070f1f1e1
Model: sunset double name system
2025-04-17 11:19:17 +03:00
Ivan Krysak
645cf7fc2e
NameBuilder: sunset deduplication
...
This reworks NameBuilder to ease the transition to the system where
the model will be guaranteed to never contain any name collisions, both
between user-specified names and the automatic ones.
2025-04-15 16:35:42 +03:00
Pietro Fezzardi
142428c9a1
TypeNames: assert no CABIFT returns a RegisterSet
...
This assertion mirrors the equivalent set of assertions on RFT, that
never return ModelAggregate.
2025-01-29 15:17:15 +01:00
Lauri Vasama
bda55aac19
Add Clift C Backend
2025-01-10 08:04:20 +02:00
Lauri Vasama
03ef33f65c
Add function location reference functions
2025-01-02 11:25:32 +02:00
Alessandro Di Federico
143c315196
Merge revng-c into revng
2024-11-21 10:50:55 +01:00
Ivan Krysak
4582982075
Replace std::string_view with llvm::StringRef
2024-11-06 19:18:53 +02:00
Ivan Krysak
64446d0453
Adopt name builder across the model users
2024-11-06 19:18:53 +02:00
Alessandro Di Federico
98903f6b07
Move Ranks.h to revng
2024-11-04 15:09:56 +01:00
Alessandro Di Federico
2e4f4d09b9
Remaining FunctionTags have been moved to revng
2024-11-04 15:09:56 +01:00
Ivan Krysak
63a3c9cec0
PTML: move location creation to the type builder
2024-10-15 10:45:13 +03:00
Ivan Krysak
1a35cbcb77
Introduce PTMLCTypeBuilder
2024-10-15 10:45:13 +03:00
Ivan Krysak
f523edc863
Pipeline: toString -> locationString
2024-10-15 09:13:28 +02:00
Ivan Krysak
8288bd68d2
PTMLCBuilder: rename into ptml::CBuilder
2024-10-15 09:13:28 +02:00
Alessandro Di Federico
ca99bbbb66
Adopt toString()
2024-09-26 17:51:08 +02:00
Ivan Krysak
77c8e4b927
PTML: move annotation data to a new header
2024-09-04 16:43:57 +02:00
Ivan Krysak
cae04be8fd
PTMLCBuilder: clean up annotation method naming
2024-09-04 13:04:44 +03:00
Ivan Krysak
94a0ad6b93
Adopt reworked model::Type
2024-06-27 11:07:01 +02:00
Ivan Krysak
3705906074
Model: rename Type into TypeDefinition
2024-06-27 11:07:01 +02:00
Lauri Vasama
e2f3f31093
Introduce RawFunctionType::Architecture
2024-05-29 15:43:35 +02:00
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