Commit Graph

7265 Commits

Author SHA1 Message Date
Ivan Krysak 458cb1f3fe CAttributeListBuilder: expose append method 2026-04-22 08:19:27 +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 280d66a441 CTokenEmitter: wrap everything into a <div> 2026-04-22 06:33:56 +00:00
Ivan Krysak c704aac1c5 CEmitter: add emitCategoryComment helper 2026-04-22 06:33:56 +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 8c3cbcca23 DoxygenEmitter: add internal indentation support 2026-04-22 06:33:56 +00:00
Ivan Krysak 8e456cbca9 CDoxygenEmitter: add one-shot comment helpers 2026-04-22 06:33:56 +00:00
Ivan Krysak 30e8f4e53e CDoxygenEmitter: introduce in-place factories 2026-04-22 06:33:56 +00:00
Ivan Krysak 141bddb241 CDoxygenEmitter: pull factories in as methods 2026-04-22 06:33:56 +00:00
Ivan Krysak 995a94877d CDoxygenEmitter: factor configuration out 2026-04-22 06:33:56 +00:00
Ivan Krysak 2f8557a418 Doxygen unit test: improve the error message 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 539a8370c6 CAttributeListBuilder: allow chaining the methods
This lets callees do stuff like:
```cpp
CAttributeListBuilder{Context}
  .setOrUpdate<"_MY_ATTRIBUTE_1">()
  .setOrUpdate<"_MY_ATTRIBUTE_2">()
  .setOrUpdate<"_MY_ATTRIBUTE_3">()
  .get()
```
2026-04-22 06:14:52 +00:00
Ivan Krysak 0189089930 Introduce TypeEmitterConfiguration 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 ac3df7460d Introduce clift::ClassType::getCAttributes 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 f1739e1a0f IndentingEmitter: drop emitNewline 2026-04-22 06:14:50 +00:00
Ivan Krysak f3df0e20b9 Minor improvements 2026-04-21 07:54:50 +00:00
Pietro Fezzardi 15196ecdc5 Merge branch feature/emit-field-accesses-indirect 2026-04-14 11:23:20 +02:00
Andrea Gussoni 4e3af009fe Expressions: fold x[0] into *x
Implement a DDR rewriting for folding the `x[0]` into `*x`, in order
to avoid a useless verbose syntax. Due to concatenation of rewrites, we
will get `&(x[0])` transformed into `x`, which is the rewriting we are
aiming to.
2026-04-14 09:52:07 +02:00
Andrea Gussoni 8359b4da26 EmitFieldAccesses: indirection propagation test 2026-04-14 09:50:48 +02: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 f6b1772bbd EmitFieldAccesses: add const-qualified test 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 715a2e54b0 IndentingEmitter: initialize IndentationString 2026-04-13 11:39:55 +02:00
Pietro Fezzardi fa5b9c99c2 Merge branch 'feature/prepare-sts-alias-analysis' 2026-04-10 16:06:02 +02:00
Pietro Fezzardi e399f381ea CommonTypeMethods: add getters for function types 2026-04-10 15:27:24 +02:00
Pietro Fezzardi 4735dfb460 Fix model-migration.yml: bash negation 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 df5139027c Add -fno-strict-aliasing to compile-flags.cfg 2026-04-10 15:27:24 +02:00
Pietro Fezzardi 7dce4fba42 Improve documentation of compile-flags.cfg 2026-04-10 15:27:24 +02:00
Pietro Fezzardi 59f91dcfc0 MakeModelGEP: drop unnecessary includes 2026-04-10 15:27:24 +02:00
Alessandro Di Federico d440e20a9a Merge branch 'feature/pypeline-integrate-scripting' 2026-04-10 11:45:25 +02:00
Giacomo Vercesi a8e13e4ee7 docs: fix
Fix the docs so that `revng test-docs` passes. Rework the
`model-from-scrach.md` to use the new pipeline.
2026-04-10 11:45:13 +02:00
Giacomo Vercesi aa28975c3f LocalStorageProvider: prune on startup
Add two situations where the cache is pruned on startup, removing all
the cached objects from storage:
1. the version field does not match the current one
2. the model has been changed out of band

The second one is very important as it allows to use the revng2 CLI
while editing the model manually on disk.
2026-04-10 11:45:13 +02:00