141 Commits

Author SHA1 Message Date
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 a12880aa27 Append legacy- to the old pipes 2026-06-15 17:28:22 +02:00
Andrea Gussoni ada6ef50f2 HelpersToHeader: remove _PACKED handling
Uniform the `struct` emission to use the `_PACKED` version, and use
`llvm::alignTo` to compute the alignment.
2026-05-29 17:12:35 +02:00
Andrea Gussoni 6c293bb732 HelpersToHeader: relax non packed struct check 2026-05-12 16:28:11 +02:00
Pietro Fezzardi 93d6e76b5b HelpersToHeader: use DataLayout for helper structs
When emitting the header for QEMU/revng helper struct types, use
the LLVM DataLayout to walk the StructType, so that field offsets
and the overall struct size match what LLVM actually produces. The
old code printed fields in declaration order without consulting
the layout, which broke whenever the struct included padding.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi 80a33109eb Print opaque types in model header
Emit forward declarations and definitions of the opaque-array
artificial structs from the C model header (and from the helpers
header). Definitions are gated on a new DefineOpaqueTypes flag
threaded through PTMLHeaderBuilder::printModelHeader so that the
helpers header keeps emitting only the declarations.
2026-05-08 11:37:10 +02:00
Ivan Krysak 729b025de3 CAttributes.h: move back to PTML
When `revng` and `revng-c` were being merged, this header founds its
way into `revngSupport` even though it makes more sense under the PTML
umbrella.
2026-03-27 07:19:27 +00:00
Ivan Krysak e706628a49 Rename Annotations.h into CAttributes.h 2026-03-27 07:19:27 +00:00
Ivan Krysak 532f81edd3 Old Headers: fix a broken comment 2026-02-25 12:47:27 +01:00
Ivan Krysak f73bbf7a08 Annotation: expose raw access
This allows the existing annotation registry to be reused in a more
convenient nature. Before now, it was only used for *parsing* or,
rather, *verifying* annotations. Now that we can take advantage of
it for emission as well, there's more control it needs to provide
in particular as far as annotation arguments are concerned.
2026-02-25 12:47:27 +01:00
Giacomo Vercesi 27f419c8cd Fix and ban namespace clobbering
Fix an instance where the `std` namespace got clobbered into the global
namespace by accident.
2026-02-16 10:34:38 +01:00
Giacomo Vercesi 05dc279ef2 Add emit-c-as-single-file to pypeline 2025-12-10 16:16:14 +01:00
Giacomo Vercesi 296eb9a76f Make SingleOutputPipe uniform to other piperuns
Make the interface required by `SingleOutputPipe` similar to other
piperuns by requiring a constructor, the use of `PipeRunArgument`s and
the implementation of a non-static `run` function.
2025-12-10 15:05:53 +01:00
Giacomo Vercesi cf52901d6d Add GenerateModelTypeDefinition to pypeline 2025-11-18 17:47:54 +01:00
Giacomo Vercesi ddb36fc70f Add ModelToHeader to pypeline 2025-11-18 17:47:54 +01:00
Alessandro Di Federico c883bed765 Drop Logger's StaticEnabled feature 2025-10-31 17:25:03 +01:00
Alessandro Di Federico 4fb6b5f4e1 Minor changes 2025-10-24 18:20:48 +02:00
Alessandro Di Federico f8bd4c3bac Move around some files in preparation for libtcg
* Make the following private headers public:
  * Lift/CPUStateAccessAnalysisPass.h
  * Lift/CSVOffsets.h
  * Lift/PTCDump.h
  * Lift/VariableManager.h
* Move from revngSupport to revngLift:
  * IRAnnotators.{h,cpp}
  * SelfReferencingDbgAnnotationWriter.{h,cpp}
* Move from revngSupport to revngModel:
  * FunctionTags.{h,cpp}
  * ProgramCounterHandler.{h,cpp}
* Move from revngSupport to revngRecompile:
  * OriginalAssemblyAnnotationWriter.{h,cpp}
2025-10-24 15:34:11 +02:00
Ivan Krysak cd7f3f8ffd ModelCBuilder: rework handling of padding fields 2025-09-04 16:57:16 +03:00
Ivan Krysak 3eea4c4094 Always emit _SIZE on struct definitions 2025-09-04 16:57:12 +03:00
Ivan Krysak 290d2e2c57 ptml::CTypeBuilder: rename into ModelCBuilder 2025-07-23 11:38:53 +02:00
Lauri Vasama 28550f2f57 Add explicit pointer size support in old backend
When `Configuration.ExplicitTargetPointerSize` is set, the backend uses
explicit pointer type sizes (e.g. `pointer32_t(T)`).
2025-07-17 16:45:03 +02:00
Pietro Fezzardi ea3cbe4c1b Drop type inlining
Type inlining was a feature that allowed type definitions of
structs/unions/enums to be printed in C directly inside the definition
of another parent struct/union, if the inner type was only used once in
the parent type.

This kind of reasoning is inherently global: a type definition of the
subtype can be inlined in the parent type one only if *globally* the
subtype it isn't referred anywhere else.

This caused issues with type inlining inside definitions of stack types
in the body of functions. Indeed, for a given function, due to type
inlining, it was necessary to do global reasoning about what other types
could be inlined in the definition of the function's stack frame type.
This, in turn, had heavy consequences on invalidation, because any
change to any type (even if it wasn't referred in a given function's
body) was causing invalidation of all functions' bodies.

For this reason it was decided to drop the type inlining feature.
2025-05-28 17:11:56 +02:00
Pietro Fezzardi 28f180dcb8 Rename CTypeBuilder::printTypeDefinition
to printDefinition.
2025-05-28 17:11:11 +02:00
Pietro Fezzardi c8e8f095fb PTMLCTypeBuilder: replace getIndented{Tag,Scope}
These methods had a misleading name, because they always returned a
ScopeTag, and never indented anything.
As a result they were misused or used in a confusing way in most of
their uses.

They have now both been replaced by two different overloaded methods
with the name getScopeTag.

This commit also fixes all their broken uses.
2025-05-14 10:11:46 +02:00
Pietro Fezzardi f27467679a HelpersToHeader: fix helpers returning structs
Before the printed prototype of a helper returning a struct was broken,
because it lacked surrounding curly braces.

This commit fixes the problem.
2025-05-13 17:12:40 +02:00
Ivan Krysak c7bba8c1b9 Prevent Support headers from depending on PTML 2025-05-08 15:42:01 +02:00
Ivan Krysak fd48523914 Minor improvements 2025-05-08 15:42:01 +02:00
Ivan Krysak 0a097c067b TypeNames: suppress selected comment newlines 2025-05-08 15:42:01 +02:00
Ivan Krysak eac296a99f Standardize PTML tag emission in c backend 2025-05-08 15:42:00 +02:00
Ivan Krysak 79964eac74 Avoid ' misuse in error messages and comments 2025-04-17 16:41:21 +02:00
Ivan Krysak 57b5eb7f98 NameBuilder: allow different name checkers 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
Alessandro Di Federico 11d8515f46 ModelToHeader: adjust blank lines 2024-11-27 17:18:12 +01:00
Alessandro Di Federico 143c315196 Merge revng-c into revng 2024-11-21 10:50:55 +01:00
Ivan Krysak 7a827b4ef5 Use doxygen for header grouping 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 8cd4ee3b59 Move Kinds.h to revng 2024-11-04 15:09:56 +01:00
Alessandro Di Federico 98903f6b07 Move Ranks.h to revng 2024-11-04 15:09:56 +01:00
Alessandro Di Federico 4e670ac8e6 Either link revngcSupport or revngSupport 2024-11-04 15:09:56 +01:00
Alessandro Di Federico 89f828c694 Link some revng libraries 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 94d860e2b2 Clean up builder configuration
This also re-enables stack inlining by default.
2024-10-15 10:45:13 +03:00
Ivan Krysak 1a35cbcb77 Introduce PTMLCTypeBuilder 2024-10-15 10:45:13 +03:00
Ivan Krysak 8aa7b55e2d PTMLIndentedOstream: rename into IndentedOstream 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 19d033958e Drop TargetListContainer 2024-09-27 10:35:10 +02:00
Alessandro Di Federico 8a5ae5f9c1 s/ExecutionContext &Ctx/ExecutionContext &EC/g 2024-09-27 10:35:10 +02:00
Alessandro Di Federico 4653796008 Drop Pipe::print 2024-09-27 10:35:10 +02:00