Commit Graph

3815 Commits

Author SHA1 Message Date
Ivan Krysak 5f511d8e17 verify-against-model: split into two
The resulting pipes are:
1. binary-granularity one with the name unchanged
2. function-granularity one called `verify-function-against-model`.
2026-04-22 08:19:30 +00:00
Ivan Krysak e693cdbd53 model-verify-clift -> verify-against-model 2026-04-22 08:19:30 +00:00
Ivan Krysak ce7e5a3917 CliftModelVerify: improve error message wording 2026-04-22 08:19:30 +00:00
Ivan Krysak 40a5c76e81 CliftModelVerify: factor error creation out
This heavily improves readability of the messages themselves.
2026-04-22 08:19:29 +00:00
Ivan Krysak b46c54308a Remove unused logic that slipped through 2026-04-22 08:19:29 +00:00
Ivan Krysak 3de5b009e7 Clift: introduce simple passes for header tests 2026-04-22 08:19:29 +00:00
Ivan Krysak 681df85f5d EmitCPass: separate boilerplate for easier reuse 2026-04-22 08:19:28 +00:00
Ivan Krysak d9acaadfac CBackendPass.cpp -> CEmissionPasses.cpp 2026-04-22 08:19:28 +00:00
Ivan Krysak 7edc4b3da6 CEmitter: emit function type attributes 2026-04-22 08:19:28 +00:00
Ivan Krysak 481f8dba31 CEmitter: emit function comment with prototype 2026-04-22 08:19:27 +00:00
Ivan Krysak 74fa16dd13 Introduce helper header emitter 2026-04-22 08:19:25 +00:00
Ivan Krysak 7ab3d590e0 Introduce type and global header emitter 2026-04-22 08:18:52 +00:00
Ivan Krysak 405eebcbd1 TypeDefinitionEmitter: emit comments 2026-04-22 06:33:56 +00:00
Ivan Krysak 3bd8879948 CEmitter: Introduce doxygen emission helpers 2026-04-22 06:33:56 +00:00
Ivan Krysak d3e22a2b05 CTokenEmitter: add #pragma once helper 2026-04-22 06:33:56 +00:00
Ivan Krysak 6d76908858 Introduce TypeDefinitionEmitter 2026-04-22 06:33:38 +00:00
Ivan Krysak d327cd3be5 emitCAttributes: introduce an array overload 2026-04-22 06:14:52 +00:00
Ivan Krysak c3b870beee CEmitter: make function prototype commentable
This wraps pieces of it (arguments and return value) into a commentable
region showing the UI where to direct the `"comment"` action.
2026-04-22 06:14:52 +00:00
Ivan Krysak 3e63412e8c CEmitter: make return value scope
This commit should be viewed in conjunction with the following one,
separating white-space only changes makes the next commit less noisy.
2026-04-22 06:14:52 +00:00
Ivan Krysak f69a0345b7 CTokenEmitter: introduce Commentable region 2026-04-22 06:14:52 +00:00
Ivan Krysak 9167153303 Only allow unit attributes on function operations 2026-04-22 06:14:52 +00:00
Ivan Krysak 58cff91c3b CTokenEmitter: allow identifiers in comments 2026-04-22 06:14:52 +00:00
Ivan Krysak 2f692a7265 Fix unnecessary _CAN_CONTAIN_CODE bug 2026-04-22 06:14:52 +00:00
Ivan Krysak f3df0e20b9 Minor improvements 2026-04-21 07:54:50 +00:00
Andrea Gussoni 8a87c034a8 EmitFieldAccesses: re-run on indirection
Re-run the emit-field-accesses if any replacement propagates a type
through an IndirectionOp. This is needed to discover new rewriting
opportunities enabled by the newly typed pointers.
2026-04-14 09:50:48 +02:00
Andrea Gussoni 0e63c46930 EmitFieldAccesses: propagate through indirection
After a replacement, check if the replaced value feeds into an
IndirectionOp. If the "rich" pre-bitcast value has a ptr<ptr<T>>
type, create a new typed IndirectionOp and insert a fixup bitcast
for existing non-lvalue uses. Lvalue uses (assign LHS) stay on the
old indirection to preserve type and lvalue constraints.

Returns true if propagation occurred, signaling the EFA driver to
rerun and discover new rewriting opportunities.
2026-04-14 09:50:48 +02:00
Andrea Gussoni e0a9f4f484 EmitFieldAccesses: ignore qualifiers on Types 2026-04-14 09:24:48 +02:00
Pietro Fezzardi e399f381ea CommonTypeMethods: add getters for function types 2026-04-10 15:27:24 +02:00
Pietro Fezzardi 762e3e9def Better RecursivelyDeleteTriviallyDeadInstructions 2026-04-10 15:27:24 +02:00
Pietro Fezzardi 74e3a6873e BeautifyGHAST: use mayHaveSideEffects() method 2026-04-10 15:27:24 +02:00
Pietro Fezzardi 6e3afe097b PromoteCSVs: drop unused Initializers member 2026-04-10 15:27:24 +02:00
Pietro Fezzardi 23bd3f6c46 ExitSSA: don't declare to preserve the CFG 2026-04-10 15:27:24 +02:00
Pietro Fezzardi cc441ccd5c ExitSSA: fix insertion point past PHIs
Before this commit, the insertion point for load instructions was being
set before a PHINode, causing the IR to temporarily fail verification.
The effect of this logic bug did not propagate outside the pass, because
all PHINodes are removed at the end of the pass, but it made debugging
harder.

This commit fixes the problem by always setting the insert point after
all the PHINodes.
2026-04-10 15:27:24 +02:00
Pietro Fezzardi 59f91dcfc0 MakeModelGEP: drop unnecessary includes 2026-04-10 15:27:24 +02:00
Giacomo Vercesi 90e8cce41e model: rework python mixin infrastructure
Rework the python mixin infrastructure for the model. Mixins are now
specified explicitly instead of using the `ast` module. The mixins are
loaded relative to the generated python file, this allows to have two
models: `revng.model` and `revng.project.model`. The latter is augmented
via mixins to have project-specific facilities such as `get_artifact`
and artifact accessors.
2026-04-10 11:45:12 +02:00
Lauri Vasama c18164c25d Simplify IndentingEmitter; make configurable 2026-04-09 18:37:46 +03:00
Lauri Vasama cacaa9fff1 Fix CTokenEmitter::CommentEmitter newlines 2026-04-09 18:37:46 +03:00
Lauri Vasama 553c740e2d Remove pointers to array in model type import
Pointers to array of T are now converted to pointers to T.
2026-04-08 12:32:18 +03:00
Lauri Vasama 8085a1e8e9 Improve integer literal emission 2026-04-08 12:31:45 +03:00
Lauri Vasama 4cadcafa2c Move operand constraints from C++ to tablegen 2026-04-08 12:30:31 +03:00
Lauri Vasama 0e7703e312 CBackend null pointer constant 2026-04-08 12:29:58 +03:00
Lauri Vasama d35e54627c Add Clift ValueType interface
Value types is the set of non-array object types. These types are
assignable, can be used as function parameters, and as return types
(along with void), and in other scenarios where the type must have usual
value-like behaviour with no weirdness (such as array decay).
2026-04-08 12:28:45 +03:00
Lauri Vasama 80731d1a10 Migrate users to new Clift type casts 2026-04-08 12:27:32 +03:00
Lauri Vasama fb3cdbdf38 Rename ValueType to AddressableType 2026-04-08 12:26:18 +03:00
Lauri Vasama 29c935ac90 Replace Clift type category helpers with casts 2026-04-08 12:25:04 +03:00
Lauri Vasama db2b57e867 Add Clift ObjectType type interface 2026-04-08 12:22:33 +03:00
Lauri Vasama 92ad229ff0 Move BytecodeClassAttr into a separate file 2026-04-08 12:21:16 +03:00
Lauri Vasama 9ba90e9b81 Replace ValueType with mlir::Type where applicable
`mlir::Type` is now used as the default C++ type for representing all
MLIR types, even when `ValueType` would be a valid constraint, unless
doing so provides a clear benefit in that specific context.
2026-04-08 12:20:00 +03:00
Lauri Vasama f9a4cb6384 Split up clift::dealias
* `unwrapTypedefs` matches `dealias(T, /*IgnoreQualifiers=*/true)`.
* `collapseTypedefs` matches `dealias(T)`.
2026-04-08 12:18:42 +03:00
Lauri Vasama be8351a17d Split up Clift PrimitiveType
* PrimitiveType is now an interface.
* VoidKind is now VoidType.
* FloatKind is now FloatType.
* The integer kinds are now IntegerType with IntegerKind.
2026-04-08 12:18:10 +03:00