3016 Commits

Author SHA1 Message Date
Andrea Gussoni 06733a9f3a InlineHelpers: split into link / inline / delete
Split the `InlineHelpers` pass into the three phases:

- `link-helpers-to-inline` links the missing `revng_inline` helper
  bodies from the `libtcg-helpers-to-inline-arch` module.
- `inline-helpers` inlines, in every function except those tagged
  `Root` or `Helper`, the calls to `revng_inline` helpers whose
  critical arguments on the call site are constant.
- `delete-helper-bodies` drops from the module the body of every
  `revng_inline` function, leaving only the declaration.

The three passes live in a dedicated `revngInlineHelpers` library
(`lib/InlineHelpers/` + `include/revng/InlineHelpers/`), so that
libraries which do not depend on `revngFunctionIsolation` can use them
without creating cyclic dependencies.
2026-06-19 15:35:18 +02:00
Alessandro Di Federico 903617e79e IRHelpers: turn some functions into IRBuilder::* 2026-06-19 09:18:16 +02:00
Alessandro Di Federico 63734b7ca0 Canonicalize: ban pointers
In order to ensure there are no `alloca`s containing pointers, we change
the passes that emit them to emit instead integer scalars of the same
type.
2026-06-19 09:18:16 +02:00
Alessandro Di Federico 3e31edf817 Introduce FixPointerSize
This commit introduces `FixPointerSize`, a pipe changing the
`DataLayout` of module in order to have a pointer size identical to the
one of `targetABI()`.

The pipe also performs safety checks to ensure this does not corrupt
semantics.
2026-06-19 09:18:16 +02:00
Alessandro Di Federico ffaf735219 sqlite: open read-only when appropriate 2026-06-19 09:18:15 +02:00
Alessandro Di Federico b5e3ccba9e Do not allocate const objects 2026-06-18 16:44:15 +02:00
Giacomo Vercesi dfb9a36bb2 pypeline: implement compression
Implement compression of objects before they are saved into the storage
provider. Each container type can specify which algorithm to use
(currently `none` or `zstd`) and the compression level.
2026-06-17 10:06:35 +02:00
Giacomo Vercesi e1b86f757a pypeline: move container from using to subclasses
Change byte containers from being just a `using` of the relative class
(e.g. `BytesContainer`) to a full fledged subclass. This has the
following benefits:
* The template arguments are now laid out in the container class body,
  making it more readable.
* The creation of a new class creates a new symbol, improving
  debuggability as now the container classes have their own name rather
  than the expanded base class template.
2026-06-17 10:06:35 +02:00
Giacomo Vercesi b1857d18ee Merge Clift{Function,SingleType}Container
The two containers were identical modulo the `Kind`. Use a base class
and make the two subclasses.
2026-06-17 10:06:35 +02:00
Ivan Krysak 1609bbe745 Restore the separate enum declaration node 2026-06-16 18:43:45 +02:00
Pietro Fezzardi 6a3ab92a9d Mark to-be-dropped pipeline names as legacy
Several components in both pipeline YAMLs are slated for removal.
Prepend a legacy prefix to their names, and to the matching c++ code, so
they are clearly distinguished from the new Clift-based pipeline until
they are dropped.
2026-06-15 17:28:22 +02:00
Ivan Krysak e02aa215fa makeNameAttr: soften the check
When de-serializing, MLIR pre-populates the value outside of our
control. As such, we cannot assert that it's always empty. So,
the least we can do is assert that value is the same.
2026-06-15 17:28:22 +02:00
Ivan Krysak 0d2ae728f3 makeNameAttr: better error message 2026-06-15 17:28:22 +02:00
Lauri Vasama aa48a01400 Fix overwriting of names in Clift type import 2026-06-15 17:28:22 +02:00
Ivan Krysak 2a2854c020 CliftEmitC: always emit opaque types in headers 2026-06-15 17:28:22 +02:00
Ivan Krysak a83521d337 Ensure no duplicate opaque types in headers 2026-06-15 17:28:22 +02:00
Ivan Krysak 3a6ed1e7eb CliftContainer: accept owning module references 2026-06-15 17:28:22 +02:00
Ivan Krysak b383c9a111 Pipebox: improve an error message 2026-06-15 17:28:22 +02:00
Ivan Krysak 77affee259 importType: provide a error-less overload 2026-06-15 17:28:22 +02:00
Ivan Krysak 686dc0877a hasModuleAttr -> isCliftModule 2026-06-15 17:28:22 +02:00
Ivan Krysak 93e9b41769 EnforceABI: drop an unused class declaration 2026-06-15 17:28:22 +02:00
Ivan Krysak 53b868e48f PTML: drop unused interfaces 2026-06-15 17:28:22 +02:00
Ivan Krysak 81190634df ABI: drop unused interfaces 2026-06-15 17:28:22 +02:00
Ivan Krysak 529b36a91c ADT: drop unused interfaces 2026-06-15 17:28:22 +02:00
Ivan Krysak 5ddde903c5 emit-c-as-directory: move to new backend 2026-06-15 17:28:22 +02:00
Ivan Krysak 14ea4b6cd7 emit-c-as-single-file: move to new backend 2026-06-15 17:28:22 +02:00
Ivan Krysak 190405a77b Rename decompile-to-X pipes to emit-c-as-X
Note that the artifact names were intentionally left untouched.
2026-06-15 17:28:22 +02:00
Ivan Krysak 4381f86f31 emit-c: expose options 2026-06-15 17:28:22 +02:00
Ivan Krysak 7a10b14f68 Allow setting type emission options from pipeline 2026-06-15 17:28:22 +02:00
Ivan Krysak 1a349d1d38 emit-type-definition: expose options 2026-06-15 17:28:22 +02:00
Ivan Krysak 7ca3ee4893 emit-helper-header: expose options 2026-06-15 17:28:22 +02:00
Ivan Krysak a01969b790 emit-type-and-global-header: pipe configuration 2026-06-15 17:28:22 +02:00
Ivan Krysak c510881250 CEmissionPipeConfiguration: introduce 2026-06-15 17:28:22 +02:00
Ivan Krysak c122118e07 TLT: add a TODO 2026-06-15 17:28:22 +02:00
Ivan Krysak 8426cf96cb emit-type-definition: new pipeline 2026-06-15 17:28:22 +02:00
Ivan Krysak c11cc04768 CliftContainers: standardize context accessors 2026-06-15 17:28:22 +02:00
Ivan Krysak 12355dc51e emit-helper-header: new pipeline 2026-06-15 17:28:22 +02:00
Ivan Krysak c82a01f68b emit-type-and-global-header: new pipeline 2026-06-15 17:28:22 +02:00
Ivan Krysak 6f9f6cf593 Introduce PTMLCTypeBytesContainer 2026-06-15 17:28:22 +02:00
Ivan Krysak 93f6be619a import-segment-declarations: new pipeline 2026-06-15 17:28:22 +02:00
Ivan Krysak 9a0d984c14 import-function-declarations: new pipeline 2026-06-15 17:28:22 +02:00
Ivan Krysak b1dc230199 import-types: new pipeline 2026-06-15 17:28:22 +02:00
Ivan Krysak 2da35c1252 Clift: pull all the module creation in one place 2026-06-15 17:28:22 +02:00
Ivan Krysak bb71b0e5a6 Clift: pull all the context creation in one place 2026-06-15 17:28:22 +02:00
Ivan Krysak c4104388ea CliftEmitC: expose emitTypes 2026-06-15 17:28:22 +02:00
Ivan Krysak eb5c6938ef CliftEmitC: expose emitCommonIncludes 2026-06-15 17:28:22 +02:00
Ivan Krysak b9e5355d5a CliftEmitC: avoid uninitialized primitives 2026-06-15 17:28:22 +02:00
Ivan Krysak 57bbb7b962 Do not propagate model unnecessarily 2026-06-15 17:28:22 +02:00
Ivan Krysak ee5534c0ee Introduce single type emission helper 2026-06-15 17:28:22 +02:00
Ivan Krysak 29ff972daa Move the opaque type gatherer to model::Binary 2026-06-15 17:28:22 +02:00