Commit Graph

347 Commits

Author SHA1 Message Date
Ivan Krysak 4e81a34cd7 ABI: separate 'gcc' editions of microsoft ABIs 2024-02-09 15:09:37 +00:00
Ivan Krysak fffd62391c Model: introduce hasMetadata helper 2024-02-09 15:09:37 +00:00
Alessandro Di Federico d9367954a4 Convert all public strings to kebab-case 2024-02-09 10:04:24 +01:00
Ivan Krysak 54ffd723e6 ABI: decouple alignment from model::VerifyHelper 2024-01-29 11:57:54 +02:00
Ivan Krysak a2ef041cb2 Move TypeBucket to the model 2024-01-29 11:57:54 +02:00
Ivan Krysak 77b1acaf00 Prefer uint64_t to size_t wherever relevant 2024-01-29 11:57:54 +02:00
Massimo Fioravanti c276a439b5 Add pipeline invalidation
Replace the stub implementation of invalidation with the proper
implementation. A ReadPathCache is added to each global so that it can
keep tracks of what target are associated to which read paths.
2024-01-02 11:14:56 +01:00
Alessandro Di Federico 73a1827c29 Import QualifiedType::stripPointer 2023-12-12 12:04:34 +01:00
Giacomo Vercesi 8504a96020 RawFunctionType: use NamedTypedRegister for return
Use the `NamedTypedRegister` type for return values in
`RawFunctionType`. This allows return values to be renamed at the user's
discretion.
2023-12-11 12:03:45 +01:00
Alessandro Di Federico 10dcb7be11 Fix semantics of model::Types purging passes
One of the two passes to purge unused types from the model had a
ill-defined semantics.

This commit simplifies them in two passes: one that purges all the types
unreachable from outside `Binary::Types` and one that does the same but
also preserves types with a `CustomName` or an `OriginalName`.
2023-12-05 16:19:39 +01:00
Pietro Fezzardi bbcb4df839 TypeSystemPrinter: print segment types 2023-12-05 16:19:39 +01:00
Pietro Fezzardi 1285c6e7af 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:19:38 +01:00
Pietro Fezzardi 48b27af795 Make Segment::Type a TupleTreeReference
This is homogeneous with all other nullable reference to types in the
model, like the StackFrameType in model::Function, and others.
2023-12-05 16:19:38 +01:00
Giacomo Vercesi 94efdc142a Drop model::editPath helpers
With the introduction of `data-action-context-location` the helpers in
the `model::editPath` namespace are no longer needed.
2023-11-03 16:31:02 +01:00
Ivan Krysak cfe28d8e56 Stop using std:: prefix for u?int\d+_t types 2023-11-02 17:10:03 +01:00
Alessandro Di Federico 2cbf3a8313 TypeCopier: minor rework 2023-10-05 10:19:44 +02:00
Alessandro Di Federico 456b916bcc Move TypePath definition 2023-10-05 10:19:44 +02:00
Alessandro Di Federico bf66ecc389 {,Dynamic}Function::Prototype: support typedefs 2023-10-05 10:19:44 +02:00
Giacomo Vercesi 29b229455f Tuple Tree: rename Parent in struct.h.tpl
Rename the Parent attribute of a struct to BaseClass to avoid conflicts
with Tuple Tree structs that might need that attribute.
2023-09-14 15:44:32 +02:00
Alessandro Di Federico 26310efc1c TypeCopier::copyTypeInto: fix returning wrong type
TypeCopier::copyTypeInto used to return a random type among those just
created instead of the new version of the originally requested type.
2023-09-11 14:15:37 +02:00
Alessandro Di Federico b5aa75f1f1 Introduce model::PrimitiveType::fromName 2023-08-23 16:14:05 +02:00
Alessandro Di Federico f6a5857d80 StructType: move the Size field up 2023-08-23 16:14:05 +02:00
Alessandro Di Federico f51af94e8f TupleTreeReference::isValid is for assertions only 2023-08-23 16:14:05 +02:00
Alessandro Di Federico a5b380b201 Model: rework how we name things
This commit improves the formalization of how we handle names.

The main changes are:

* Now `_` is a reserved prefix and all the generated names start with
  `_`.
* The model verification routine now checks that `CustomName`s in the
  global scope do not collide with any local namespace (e.g., fields of
  a `StructType`).
* We changed the prefix `prefix_` to `unreserved_` to better convey the
  fact that the prefix has been introduce to use an non-reserved name.
2023-08-23 16:14:04 +02:00
Alessandro Di Federico 247879f7fc model::Type::ID: switch to progressive IDs
This commit switches `model::Type::ID` from being a GUID to be a
progressive number, in order to make things easier for humans.

On top of this, this commit introduces the following changes:

* TypeCopier: import all the necessary PrimitiveTypes and improve
  handling of CustomName.
* Move Kind as the last field of the key of each TupleTree type used in
  an `UpcastablePointer`.
* Update the ground truth of tests to ignore the `CustomName` in favor
  of focusing on `OriginalName`.
* Increase adoption of `model::Binary::makeType`, equivalent to
  `Binary.recordNewType(makeType<model::*Type>())`.
2023-08-23 16:14:04 +02:00
Alessandro Di Federico e63573ee81 Introduce model::Binary::path 2023-08-23 16:14:04 +02:00
Alessandro Di Federico 67be2c30b8 Introduce PrimitiveType::FirstNonPrimitiveID 2023-08-23 16:14:04 +02:00
Alessandro Di Federico 56268e94b0 VerifyHelper: handle fail in type verification
Before this commit, if there was a failure during the verification of a
type (which is recursive), we'd get an assertion in ~VerifyHelper due to
a "pending" type still being verified.
2023-08-23 16:14:04 +02:00
Pietro Fezzardi 72bedb7dfd TypeSystemPrinter: print DynamicFunctions 2023-08-21 12:29:31 +02:00
Alessandro Di Federico 1d53bf4696 Introduce getLLVMIntegerTypeFor 2023-07-26 10:16:25 +02:00
Djordje Todorovic 60ebfa950d VerifyHelper: Remember the reason of fail
In some cases we want to know what was the reason of some error
without crashing the revng.
2023-07-24 09:22:07 +02:00
Ivan Krysak 888b083248 Model: introduce edit path helpers for comments 2023-07-21 17:25:24 +02:00
Ivan Krysak 5c31405e63 Model: rework edit path helpers from the ground up 2023-07-21 17:25:24 +02:00
Ivan Krysak 0c8a5aaffb Model: move edit path helpers in from PTML 2023-07-21 17:25:24 +02:00
Ivan Krysak 70a5c8edd0 Model: make metadata utilities more generic 2023-07-21 17:25:24 +02:00
Ivan Krysak 560ed4f55e Model: add ReturnValueComment field to functions 2023-07-21 17:25:24 +02:00
Ivan Krysak 485ef34a12 Model: add Comment field all across the board 2023-07-21 17:25:24 +02:00
Ivan Krysak 8a9b253314 Model: clean type constructors up 2023-07-21 17:25:24 +02:00
Ivan Krysak 1e9e38548d Model: make register name check stricter 2023-07-21 17:25:24 +02:00
Ivan Krysak bc0eebaad1 Model: enforce consistent name fields 2023-07-21 17:25:24 +02:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00
Ivan Krysak 01b4ec36c9 Formatting: set AllowShortEnumsOnASingleLine
The new value is `false`.
2023-07-02 13:15:08 +02:00
Ivan Krysak 7ed14ca65c Minor improvements 2023-07-02 11:06:55 +00:00
Alessandro Di Federico fa61c784c2 Reintroduce st0_x86 as floating point return value 2023-06-23 17:54:16 +02:00
Alessandro Di Federico f1f8c217e7 TypeCopier: reset TTR's root pointer after copy 2023-05-17 11:17:35 +02:00
Giacomo Vercesi 31cd2b53f9 rcc: add codespell
Add codespell to the list of checks performed by
revng-check-conventions. This should reduce the amount of typos present
in the revng codebase.
2023-05-11 10:05:32 +02:00
Alessandro Di Federico f562d0373f Importers: fix usage of BaseAddress
This commit ensure the BaseAddress is propagate as appropriate to all
levels of the importers and that it is ignored for executables
(non-PIC).

This was a recurring source of importing the same function twice, once
relocated, once not.
2023-05-10 09:20:40 +02:00
Alessandro Di Federico 73fb1a31c9 Outline TypeCopier
This commit also drop the suggestion that it should be used for copying
prototypes only.
2023-05-10 09:20:15 +02:00
Alessandro Di Federico 52521f8cac Adopt more standard library's features 2023-04-08 08:42:23 +02:00