Commit Graph

48 Commits

Author SHA1 Message Date
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 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
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 290d2e2c57 ptml::CTypeBuilder: rename into ModelCBuilder 2025-07-23 11:38:53 +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 eac296a99f Standardize PTML tag emission in c backend 2025-05-08 15:42:00 +02:00
Ivan Krysak f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Alessandro Di Federico 143c315196 Merge revng-c into revng 2024-11-21 10:50:55 +01:00
Ivan Krysak 64446d0453 Adopt name builder across the model users 2024-11-06 19:18:53 +02:00
Alessandro Di Federico 98903f6b07 Move Ranks.h to revng 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 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
Ivan Krysak 77c8e4b927 PTML: move annotation data to a new header 2024-09-04 16:43:57 +02:00
Ivan Krysak cae04be8fd PTMLCBuilder: clean up annotation method naming 2024-09-04 13:04:44 +03:00
Pietro Fezzardi dfe3f4cb47 Rename revng C headers for decompiled code
Strip away the 'revng-' prefix from the filename.
2024-06-27 17:26:18 -04:00
Pietro Fezzardi 8a95a0b9c9 HelpersToHeader: enable printing plain C 2024-06-27 17:14:28 -04:00
Alessandro Di Federico 0c212b66d9 Relicense to MIT 2024-02-29 17:03:36 +01:00
Pietro Fezzardi 8d9f07d7a7 Change indentation of all decompiled C code
This commit changes the indentation of all the C code we emit, from 4
whitespaces to only 2 whitespaces.
2023-09-21 15:17:44 +02:00
Alessandro Di Federico f3d6bbb047 s/ThePTMLCBuilder/B/g 2023-08-23 16:40:54 +02:00
Alessandro Di Federico a207ef7c44 Minor changes 2023-08-23 16:12:51 +02:00
Ivan Krysak e0b956b1c2 Model: rework edit path helpers from the ground up 2023-07-21 04:58:50 +00:00
Djordje Todorovic 286eb4d734 c-backend: Introduce PTMLCBuilder
This will be used to generate plain C.
2023-06-09 15:40:23 +02:00
Kacper Kołodziej 5b94a5a649 HelpersToHeaders: skip unnecessary helpers 2023-02-07 17:43:05 +01:00
Pietro Fezzardi 97b23935de Handle FunctionTags::Exceptional
This is necessary for e.g. the abort function.
2023-01-17 11:14:47 +01:00
Pietro Fezzardi 1bec5bd2ab Define all primitive types in dedicated header
This commit does the following:
- drops revngfloat.h
- disables printing primitive types in ModelToHeader
- creates a new header revng-primitive-types.h which includes all the
  declarations of all revng primitive types
2022-11-30 18:16:13 +01:00
Pietro Fezzardi c93392fa3b Refactor PTML generation for helpers 2022-11-15 15:54:20 +01:00
Pietro Fezzardi e1ded3a479 HelpersToHeader: refactor PTML Tags 2022-11-15 15:54:20 +01:00
Pietro Fezzardi 2ec8b7e32c ModelToHeader: refactor creation of PTML Tags 2022-11-15 15:54:20 +01:00
Giacomo Vercesi 8e996d2394 Output PTML in revng-c
Change the output of the backend of revng-c to PTML
2022-09-01 16:59:29 +02:00
Alvise de Faveri 52dd37d0ed HelpersToHeader: Whitelist helpers
Explicitly list the functions whose prototype should be serialized
in the `revng_helpers` header. This is more robust with respect to
future opcodes added in the IR.
2022-06-01 11:27:34 +02:00
Pietro Fezzardi 0b64b58e84 Unify recompilation tests
Before this commit we were using xargs to speed-up recompilation tests,
which kinda sucked because:
- it spawned a lot of processes, one for each file to recompile
- the runtime of each test was dominated by parsing the headers, that
  were included over and over again in each C file

Now we collapse all the C files together, which gives us 2 benefits:
- we only spawn a single process for each recompilation test, meaning
  that cmake can do a better job at parallelizing without starving
  others
- the headers are included and parsed only once, speeding up the
  compilation further
2022-04-29 15:04:27 +02:00
Pietro Fezzardi b909bb6629 New MarkAssignments library in IRCanonicalization
This library replaces the old AddIRSerializationMarkers, cleaning up a
lot of historcal baggage, merging Liveness and MarkAnalysis, and
adopting a more accurate naming across all the codebase.
2022-04-21 18:13:51 +02:00
Giacomo Vercesi ab125b35b0 Fix License headers
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
2022-04-19 12:17:59 +02:00
Pietro Fezzardi 9f1bbc8b49 Drop deprecated \brief Doxygen directive
\brief is a stupid feature that we should stop using:
https://lists.llvm.org/pipermail/llvm-dev/2015-May/085152.html
2022-03-22 10:48:03 +01:00
Alessandro Di Federico 77335d036a Rename Lifted tag to Isolated 2022-03-17 14:08:05 +01:00
Pietro Fezzardi 5cdc63cda6 Apply new revng coding conventions 2022-02-28 18:02:25 +01:00
Alvise de Faveri 1a39994759 Add HelpersToHeader pass 2022-02-10 17:12:56 +01:00