Commit Graph

49 Commits

Author SHA1 Message Date
Ivan Krysak ae3f19664a ModelPasses: introduce fix-model 2025-04-17 11:19:17 +03:00
Ivan Krysak acb7d595ef Model: introduce a primitive typedef removal pass 2025-04-17 11:19:17 +03:00
Ivan Krysak cf78106d54 Model: introduce a name deduplication pass 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 705e4a5955 auto [...] -> auto &&[...] 2025-02-13 13:10:51 +02:00
Ivan Krysak 288448f009 Never include model::VerifyHelper from headers 2025-02-13 13:09:50 +02:00
Ivan Krysak 4a2db0ba4f UpcastablePointer: streamline empty behavior 2024-06-27 11:05:52 +02:00
Ivan Krysak 3c974fea7c Model: make purge-invalid-types softer 2024-06-27 11:05:51 +02:00
Ivan Krysak dfa7478685 Adopt reworked model::Type 2024-06-27 11:05:51 +02:00
Ivan Krysak b6625e8913 Model: simplify fixModel pass
Instead of getting reimplemented/updated, it now just reuses normal
type verification routines.
2024-06-27 11:05:50 +02:00
Ivan Krysak 927e8006b9 Model: rename TypePath to DefinitionReference 2024-06-27 11:05:49 +02:00
Ivan Krysak ac587cbb4f Model: rename Type into TypeDefinition 2024-06-27 11:05:48 +02:00
Ivan Krysak b2959e36df Minor improvements 2024-06-27 11:05:48 +02:00
Alessandro Di Federico c346e60ee7 PromoteOriginalName: no globals with local names
This commit ensures we do not introduce new global symbols that would
make local symbols invalid.
2024-03-01 14:53:06 +01:00
Alessandro Di Federico 0da9d1e1a4 Model: fix handling of 0-sized arguments
We used to support having a single `void` argument. It was for some
C-compatibility ambitions, but just omitting the argument is perfectly
fine.

Also, the DWARF importer has been fixed to handle typedef'd void as
arguments.

More in general, arguments are now required to always have a size.
2024-03-01 14:53:06 +01: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 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
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
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00
Ivan Krysak 17c128c59b Make ABI depend on ModelPasses
Before now the dependency was the other way around
2023-03-15 10:19:03 +01:00
Ivan Krysak 4d21a88777 Model: remove an obsolete function conversion pass 2023-03-15 10:19:03 +01:00
Ivan Krysak 01a05e2037 ABI: separate convertions based on the direction 2023-03-15 10:19:02 +01:00
Ivan Krysak 3687869795 Model: make AddPrimitiveTypes a pure analysis 2023-03-15 10:19:01 +01:00
Djordje Todorovic 0f7c473cf3 FixModel: factor out logic of type deletion 2023-01-27 17:46:23 +01:00
Djordje Todorovic 5be245c971 FixModel: filter zero-sized fields 2023-01-27 17:46:21 +01:00
Djordje Todorovic e1b070f2da FixModel: filter out empty arrays 2023-01-27 17:46:18 +01:00
Djordje Todorovic 961f9e5461 Model: search debug info locally upon import
Also find prototypes in Models of dynamic libs for both PE and ELF.
2022-12-13 11:26:54 +01:00
Massimo Fioravanti 742e1a0c56 TupleTree: switch from public fields to accessors 2022-12-12 18:36:57 +01:00
Alessandro Di Federico 446db0b62c Model type purge: do not purge primitives 2022-11-30 15:06:54 +01:00
Pietro Fezzardi df30792435 PrimitiveType: support for 80 and 96 bits types
This commit completes the support of various rare PrimitiveTypes, that
has been added opportunistically over time and has remained inconsistent
across the codebase:

- float80_t
- float96_t
- generic80_t
- generic96_t

The first two are necessary because on some platforms long double is
either 10 or 12 bytes wide.

The second two are necessary because the Generic PrimitiveType should
allow all non-zero byte sizes allowed by any other PrimitiveType.
2022-11-30 15:06:54 +01:00
Massimo Fioravanti 9363bbd70a Pipeline: every container type has now a C++ type 2022-09-29 15:51:17 +02:00
Djordje Todorovic 5559d8431b Introduce fix-model model pass 2022-09-21 18:37:36 +02:00
Massimo Fioravanti 915c083661 Pipes: reorganize who defines pipes 2022-08-29 14:44:35 +02:00
Ivan Krysak 65d1a016d4 Standardize concept naming across the codebase 2022-08-05 17:27:56 +03:00
Djordje Todorovic 1243d1061c Introduce revng model hard-purge
In addition, introduce a new model Pass:

  revng model opt -prune-unsused-types
2022-07-28 15:02:55 +02:00
Antonio Frighetto 186d907be3 Model: extend model::Segment
`Segment` now includes a `Type` of struct kind. This is intended to
emit the segment as a struct later in decompilation. The implementation
of name has also been added.
2022-07-22 16:10:51 +02:00
Pietro Fezzardi 7f65b1117a New AddPrimitiveTypesPipe
This pipe is executed during the Lift step and populates the model with
all the required primitive types.
2022-04-12 16:40:27 +02:00
Pietro Fezzardi 6b2b2e8ada Make model::Type::edges() method const 2022-04-08 18:58:58 +02:00
Ivan Krysak 1b03adca5e Make function type convertions self-sufficient 2022-03-28 15:38:04 +02:00
Alessandro Di Federico 2b55d1df22 Adopt cmake-format 2022-03-17 18:52:18 +01:00
Alessandro Di Federico bc8e6a6a24 Minor changes 2022-03-16 22:10:15 +01:00
Ivan Krysak 2c35fc87d5 Conversion to RawFunctionType cannot fail 2022-02-25 00:31:14 +01:00
Ivan Krysak 541643afc3 Move function type conversion to librevngABI 2022-02-24 23:56:30 +01:00
Ivan Krysak 8d876b0def ABI: introduce bulk function conversion 2022-02-14 13:35:37 +01:00
Ivan Krysak e20e65ca9a Require a description when registering a pass 2022-02-14 13:35:36 +01:00
Alessandro Di Federico ec6d4dbe74 Ensure all files end with a newline 2022-02-14 10:56:15 +01:00
Alessandro Di Federico a353e00ac1 Introduce model passes 2022-01-31 16:28:14 +01:00