Commit Graph

3340 Commits

Author SHA1 Message Date
Giacomo Vercesi 18509a4ca0 Add missing string to VH.fail
Add missing string to invocations of `VH.fail` that do not depend on a
child's `verify` method.
2025-09-09 12:27:33 +02:00
Ivan Krysak 471e0d9c11 Old backend: always emit debug information
Because of a sub-par heuristic designed to avoid emitting
*unnecessary* debug information tags, some of the *necessary*
tags were lost as well, leading to debug information mismatch
between the backend and the UI.

Note that this is not a fix, this commit simply removes
the heuristic in question, leading to ~2x increase in
output c file size.
2025-09-08 16:33:51 +02:00
Giacomo Vercesi eba55456f6 NameBuilder: fix a use-after-free bug 2025-09-08 16:33:51 +02:00
Ivan Krysak f03654564e Emit _STARTS_AT on fields with custom names 2025-09-05 10:15:32 +03: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 c6a175a1b9 Rename _START_AT -> _STARTS_AT 2025-08-29 14:00:29 +03:00
Pietro Fezzardi 308d2cda0a DecompileFunction: handle struct-returning helpers
This commit fixes DecompileFunction.cpp to ensure that it can properly
handle calls to helpers that return struct types on LLVM IR.
In the past, these were properly handled but in the current tests this
kind of helpers never reach the C backend anymore.
This is a preliminary change necessary for updating libtcg, where this
kind of helpers will start to appear again.
2025-07-28 14:21:32 +02:00
Andrea Gussoni ba7ee595b5 BeautifyGHAST: introduce soft failure
Introduce an additional consistency check for loops having an empty body
at the beginning of the `beautify` pipeline.
2025-07-23 13:39:30 +02:00
Ivan Krysak f6970ff70a TypeNames: fix function prototype return value tag 2025-07-23 11:38:53 +02:00
Ivan Krysak e6d8ac2c87 Model: improve RFT verification output 2025-07-23 11:38:53 +02:00
Ivan Krysak a285ad2785 IRHelperRegister: get a comment from Description 2025-07-23 11:38:53 +02:00
Ivan Krysak 97aa3c8247 std::string: use implicit default constructor 2025-07-23 11:38:53 +02:00
Ivan Krysak 290d2e2c57 ptml::CTypeBuilder: rename into ModelCBuilder 2025-07-23 11:38:53 +02:00
Ivan Krysak 9e5053d9fd CMakeLists: remove unused variables 2025-07-23 11:38:52 +02:00
Ivan Krysak f391392fe9 Use explicit separator strings 2025-07-23 11:38:52 +02:00
Ivan Krysak 3750f96065 DecompilePipe: report problem variable names 2025-07-23 11:38:52 +02:00
Ivan Krysak 99476b249e NamespaceBuilder: add variable and label support 2025-07-23 11:38:52 +02:00
Ivan Krysak 0572de8990 TypePathHelpers: fix incorrect return value paths 2025-07-23 11:38:52 +02:00
Ivan Krysak 743998c956 LocalVariables: adopt IR helper registry 2025-07-23 11:38:51 +02:00
Ivan Krysak 742bda05ba New backend: adopt new variable and label tagging 2025-07-23 11:38:51 +02:00
Ivan Krysak c7c61dbc04 New backend: drop leading _ in variable names 2025-07-23 11:38:51 +02:00
Ivan Krysak db2b95cd23 Old backend: adopt new variable and label tagging 2025-07-23 11:38:51 +02:00
Ivan Krysak 21734cad34 CTypeBuilder: add new variable and label tagging 2025-07-23 11:38:51 +02:00
Ivan Krysak 36ce22cd4e STLExtras: change notNull to return a reference 2025-07-23 11:38:51 +02:00
Ivan Krysak 554ffa376a model::Function: introduce GotoLabels field 2025-07-23 11:38:51 +02:00
Ivan Krysak 1ebeb8f493 model::Function: introduce LocalVariables field 2025-07-23 11:38:50 +02:00
Ivan Krysak 4e3c6cccd0 Model: introduce LocalIdentifier struct 2025-07-23 11:38:50 +02:00
Ivan Krysak d7c089799c StatementComment: separate location verification 2025-07-23 11:38:50 +02:00
Ivan Krysak 3c9aa5f4b2 Pipes: pull tryExtractAddress up 2025-07-23 11:38:50 +02:00
Ivan Krysak 8dff23d586 MetaAddress: pull addressesToString up 2025-07-23 11:38:50 +02:00
Ivan Krysak b982ae68d0 NamingConfiguration: add UnnamedGotoLabelPrefix 2025-07-23 11:38:50 +02:00
Ivan Krysak b5337d78da Minor Improvements 2025-07-23 11:38:50 +02:00
Andrea Gussoni 6a90277db2 ScopeGraph: rename scope-graph-dumper 2025-07-23 11:34:13 +02:00
Andrea Gussoni c060f07ecd ScopeGraph: add scope-graph-output cl::opt 2025-07-23 11:34:13 +02:00
Andrea Gussoni 1ccce1c76a ScopeGraph: remove the ScopeGraphLogger library 2025-07-23 11:34:13 +02:00
Andrea Gussoni 1faa781e6a CommandLine: drop pathToStream
Remove `pathToStream` in favour of `llvm::ToolOutputFile`.
2025-07-23 11:34:13 +02:00
Lauri Vasama e9b18d448b Add Clift emit-c pipe and end-to-end tests 2025-07-17 16:45:03 +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
Lauri Vasama 780e774b20 Add Clift legalization pipe 2025-07-17 16:45:03 +02:00
Lauri Vasama 9d39020034 Add LLVM-to-Clift import pipe 2025-07-17 16:45:03 +02:00
Lauri Vasama 4e17287cfc Add LLVM-to-Clift import 2025-07-17 16:45:03 +02:00
Lauri Vasama b9ce0a87df Add Clift model verification 2025-07-17 16:45:03 +02:00
Lauri Vasama abc842a87e Change undef expression emission
```
// Old output:
/* undef */ (T){0}

// New output:
undef_T()
```

This matches the output emitted by the old backend.
2025-07-17 16:45:03 +02:00
Lauri Vasama fa184b9212 Add Clift backend support for pointer sizes 2025-07-17 16:45:03 +02:00
Lauri Vasama eb4e96dcdf Fix Clift backend names emission
This commit fixes name emission for different kinds of entities such as
artificial RFT return type structs and helper function return types.
2025-07-17 16:45:03 +02:00
Lauri Vasama 1addc26e58 Add remove-constant-array-returns pass 2025-07-17 16:45:03 +02:00
Lauri Vasama d70c9404f3 Add a helper for LLVM IR lookup by meta-address 2025-07-17 16:45:03 +02:00
Lauri Vasama 83c0073d31 Enable PTML output in Clift backend 2025-07-17 16:45:03 +02:00
Lauri Vasama 183f045616 Fix CliftAttributes abort message 2025-07-17 16:45:03 +02:00