Commit Graph

2797 Commits

Author SHA1 Message Date
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 7f66f25253 mlir::clift::ClassAttr: add attribute support 2026-03-27 07:19:27 +00:00
Ivan Krysak 928bcdb118 mlir::clift::FunctionType: add attribute support 2026-03-27 07:19:27 +00:00
Ivan Krysak 8a3a2082b5 CAttributeAttr: enforce argument types 2026-03-27 07:19:27 +00:00
Ivan Krysak f4e7d50361 Allow C-Attributes to accept integers and types 2026-03-27 07:18:49 +00:00
Lauri Vasama ad6f6df04e Improve function arg/result attribute interface 2026-03-27 07:18:49 +00:00
Ivan Krysak cdc633e31d CliftPipes: drop Pipe from filenames
This removes unnecessary Pipe from filenames which the directory name
already contains.

This also renames some of them to match the *new* pipeline.
2026-03-27 07:18:49 +00:00
Ivan Krysak 278b898793 llvm-to-clift -> clifter 2026-03-27 07:05:44 +00:00
Ivan Krysak addfc543c8 import-model-names -> import-descriptive-info 2026-03-26 16:28:48 +00:00
Ivan Krysak 6dc6ad2cf3 importModelTypes -> importTypes 2026-03-26 16:28:48 +00:00
Ivan Krysak 53a476e9ee importNames -> importDescriptiveInfo
This opens up the possibility of importing more than just names.
2026-03-26 16:28:48 +00:00
Ivan Krysak 79618b3b63 CliftImportModel: extract name importing 2026-03-26 16:00:49 +00:00
Ivan Krysak 01658cab09 import-model-names: split into two
One is module-granularity (name unchanged). The other (new) one
is function-granularity: `import-function-model-names`.
2026-03-26 16:00:49 +00:00
Ivan Krysak 58facb0de2 pipebox: introduce two more clift containers
`CliftSingleTypeContainer` for a type-level entity and
`CliftModuleContainer` for a binary-level one (like a header).
2026-03-25 17:26:24 +00:00
Ivan Krysak b76a09d483 pipebox: rename CliftContainer.h
The new name is `CliftContainers.h`.
2026-03-25 17:26:24 +00:00
Ivan Krysak 2841f8ab84 Introduce module-level CliftContainer 2026-03-25 17:26:24 +00:00
Ivan Krysak a3c43f92d4 Rename CliftContainer > CliftFunctionContainer 2026-03-25 15:42:13 +00:00
Ivan Krysak 2d2ba9c107 Split clift kinds into two: module and function 2026-03-25 15:42:13 +00:00
Ivan Krysak 1310b6ab62 Clift: append C to attribute classes we emit 2026-03-25 15:42:13 +00:00
Ivan Krysak 5fdc99c4da Minor improvements 2026-03-25 15:42:13 +00:00
Andrea Gussoni 02cc6923d0 EmitFieldAccesses: implement pass
The `EmitFieldAccesses` pass transforms `clift` by taking pointer-typed
expressions computed via integerr arithmetic with type-safe field
accesses and array accesses.

The transformation is split in three main phases:
1) `PointerArithmetic` computation.
2) `BestTraversal` computation.
3) `FieldAccess` `clift` rewrite.

The high level driver is implemented in the `EmitFieldAccesses` header
and cpp, while the nested 3 phases are implemented respectively in
`PointerArithmetic`, `BestTraversal` and `FieldAccessReplacement`.

The `computerPointerArithmetic` phase is concerned with taking a
pointer-typed `ExpressionOp`, called `PointerToReplace`, and expressing
it in a `BasePointer+Offset` form.

The `computeBestTraversal` phase is concerned with computing the best
traversal of the type pointed to by `BasePointer`, that can be used to
rewrite the pointer arithmetic in `clift` with just field accesses and
array subscripts.

The `replaceFieldAccess` phase takes the `Traversal` computed at the
previous step, and actually rewrites in `clift` the `PointerToReplace`
in terms of field accesses and array accesses w.r.t. the `BasePointer`.
2026-03-18 17:25:13 +01:00
Giacomo Vercesi 6ec9f9a952 TupleTree: overhaul reference caching
Overhaul the logic and method names involved in enabling and disabling
reference caching in `TupleTree<T>`. `TupleTreeReference<T, U>` now
lazily caches the target and will traverse the path only when needed.
Also expose and use these functions in the new pipeline, which should
provide some speedup when executing a `Schedule`.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi 704c5e9bbb TupleTree: fix broken operator==
The `operator==` for keyed `StructDefinitions` was the comparison
between keys, which is misleading.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi 1193b6ef34 TupleTree: upgrade Version: 0
When a `TupleTree` is deserialized, if it has the `Version` field set to
0 upgrade it automatically to the `SchemaVersion`.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi d479438d3c Add ImportFromC analysis to pypeline 2026-03-04 14:58:02 +01:00
Giacomo Vercesi 8804092b90 Add ConvertFunctionsToRaw analysis to pypeline 2026-03-04 14:58:02 +01:00
Ivan Krysak 41378913b2 CTokenEmitter: add a suffix-less literal helper 2026-03-04 08:20:00 +00:00
Ivan Krysak b63102ed12 CTokenEmitter: introduce Macro entity kind 2026-02-27 18:28:12 +00:00
Ivan Krysak cd6c6bd22d Introduce isSeparateDeclarationAllowed helper
This is a replacement for `isDeclarationTheSameAsDefinition`.
2026-02-27 18:28:12 +00:00
Ivan Krysak 3bec80c9ba PTML: introduce c.macro token type 2026-02-27 18:28:12 +00:00
Ivan Krysak c1f05e4d24 Ranks: introduce the macro location 2026-02-27 18:28:12 +00:00
Ivan Krysak 1a91707a2b GenericGraph: introduce empty() method 2026-02-25 14:10:44 +01:00
Ivan Krysak 1c56e34350 NameBuilder: introduce isAutomaticName 2026-02-25 14:10:44 +01:00
Ivan Krysak 8a6706e7ac Doxygen: leave a TODO 2026-02-25 14:10:44 +01:00
Ivan Krysak 1541d4b402 CEmitter: allow argumentless function declarations 2026-02-25 12:47:27 +01:00
Ivan Krysak 4514620e9f CEmitter: introduce chooseEntityKind helper 2026-02-25 12:47:27 +01:00
Ivan Krysak 83304a14df Annotations: introduce a way to assert the name 2026-02-25 12:47:27 +01:00
Ivan Krysak 91ed5e33a8 PTML: make enum scope named for consistency sake 2026-02-25 12:47:27 +01:00
Ivan Krysak 5bcccf57d3 CEmitter: rename C field into Tokens 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
Ivan Krysak 0b2853f624 Extract emitFunctionPrototype helper 2026-02-25 12:47:27 +01:00
Ivan Krysak f0e00d66ab Do not use doxygen for TODOs 2026-02-25 12:47:27 +01:00
Ivan Krysak 22fe32afa2 Minor improvements 2026-02-25 12:47:27 +01:00
Ivan Krysak b5f98fcae9 check-conventions: ban anonymous header namespaces 2026-02-25 12:47:27 +01:00
Giacomo Vercesi f1878f1194 pypeline: drop TraceRunner
Drop the `pypeline-trace-run` executable, as its purposed has been
superseded by the combination of `--debug` and native pipe/analysis
runners.
2026-02-16 10:34:39 +01:00
Giacomo Vercesi 25ba3115c4 pypeline: implement native run-{pipe,analysis}
Implement C++-only command-line executables that allow running a single
pipe/analysis without the involvement of python.
2026-02-16 10:34:38 +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
Lauri Vasama d37d32e4b2 Add Clift function type to-do 2026-02-13 08:41:39 +02:00
Lauri Vasama 07fbf344c2 Implement Clift PTML instruction tag emission 2026-02-13 08:41:39 +02:00