Commit Graph

212 Commits

Author SHA1 Message Date
Ivan Krysak 81190634df ABI: drop unused interfaces 2026-06-15 17:28:22 +02:00
Ivan Krysak 8cd3248175 abi::...::Layout: function-type-layout logger 2026-06-15 17:28:22 +02:00
Ivan Krysak 0d0d455b19 abi::FunctionType::Layout: move yaml traits higher 2026-06-15 17:28:22 +02:00
Ivan Krysak 4c6fe97059 abi::getDataModel: introduce 2026-06-15 11:47:41 +02:00
Ivan Krysak ea785998ec Minor improvements 2026-06-15 11:47:41 +02:00
Alessandro Di Federico 51526e9777 ABI/Layout: move YAML traits to header
The YAML traits for Layout (and friends) move into Layout.h so callers
can serialize a Layout directly without pulling in Layout.cpp's
internals. As a result StackSpan gains default-initialized fields and
its operator+ is hoisted to a free function (with the symmetric
uint64+StackSpan overload) so it works with the YAML mapping.
2026-06-11 17:39:53 +02:00
Andrea Gussoni 530ce317c1 ABI: use llvm::alignToPowerOf2
`llvm::alignToPowerOf2` covers the same semantics of the dropped
`alignedOffset` method, including the power of 2 assertion.
2026-05-29 17:12:35 +02:00
Lauri Vasama 0ab9f769dd Add CDataModel in ABI definition 2026-05-02 17:21:47 +03:00
Alessandro Di Federico c1b3f23cf5 Uniform Binary::get{Definition,Binary}Reference 2026-04-24 17:54:09 +02: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 8804092b90 Add ConvertFunctionsToRaw analysis to pypeline 2026-03-04 14:58:02 +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 aa2597d13b model::Function: add stack frame name and comment
* StackFrameType() is removed.
* StackFrame() is introduced in its place.
* Use StackFrame().Type() to acess the stack frame type.
2026-02-13 08:41:39 +02:00
Alessandro Di Federico a1f9bd2d16 Minor changes 2025-12-22 11:34:46 +01:00
Alessandro Di Federico 5820908675 Remove and ban \file 2025-12-16 17:41:55 +01:00
Giacomo Vercesi e35f5750de Add ConvertFunctionsToCABI analysis to pypeline 2025-12-10 16:16:14 +01:00
Alessandro Di Federico 1429b526ab Introduce libtcg
This commit drops libptc in favor of its new form libtcg.

It brings several improvements, among which:

* The QEMU version we work on has been upgraded.
* CPUStateAccessAnalysis has been reimplemented in a way that makes it
  easier to debug and solves some limitations (e.g., tracking leaking
  pointers).
* Identification of pieces of the CPU state that are read by each helper
  and fixing access to the CPU state is now performed at build-time.
* We no longer mmap the code we need to translate, dropping all the
  issues related to code that needed to be mapped where something is
  already present.
* We now have two distinct flavors of helper modules: the full one and
  the "slim" one. The latter contains the definition only of functions
  we intend to inline. It is used in most of the pipeline, a good thing
  since we spend less time optimizing code we don't really care about.
  The full module is only used on the re-compilation branch of the
  pipeline.
* We no longer split the `cpu_loop` function.
* We change MetaAddress to rely on architectures from `model::` as
  opposed to the LLVM ones.
* We no longer attach debug info to LLVM IR containing the original
  assembly.
* We now verify that the lifted code only contains code we expect.
2025-10-31 17:25:03 +01: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 29e0dc3b3f ABI: make TTG verification more strict
Some stuff that was before implicitly checked during deserialization
now need explicit checks, those are introduced here.
2025-10-13 18:33:10 +03:00
Ivan Krysak 77ea07c364 Minor improvements 2025-10-08 12:22:30 +03:00
Ivan Krysak 97aa3c8247 std::string: use implicit default constructor 2025-07-23 11:38:53 +02:00
Ivan Krysak f391392fe9 Use explicit separator strings 2025-07-23 11:38:52 +02:00
Giacomo Vercesi d62b7b6b1a TTG: inline root type in schema
Move the root type inside the schema definition, as it is a property of
it and not of the generator.
2025-06-25 15:40:13 +02:00
Pietro Fezzardi e68ab95102 MakeModelCasts: cast array indices to integers 2025-05-29 09:38:09 +02:00
Ivan Krysak 2619406ea7 ABI: fix ABI.FloatsUseGPRs() misuse 2025-05-08 15:42:01 +02:00
Khaled Ismaeel 531d9b866c Remove the now-redundant HEADERS list 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 63469c9cd6 Use unified YAML schemas in the build process
In this commit we instruct the build system to use the unified schema
files  instead of collecting the `TUPLE-TREE-YAML` comments.

The fixes to C++ files are necessary because they depend on the order
of the fields in the schema, which was changed.
2025-04-30 15:08:45 +02:00
Ivan Krysak 79964eac74 Avoid ' misuse in error messages and comments 2025-04-17 16:41:21 +02:00
Ivan Krysak 57b5eb7f98 NameBuilder: allow different name checkers 2025-04-17 11:19:17 +03:00
Ivan Krysak f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Ivan Krysak 645cf7fc2e NameBuilder: sunset deduplication
This reworks NameBuilder to ease the transition to the system where
the model will be guaranteed to never contain any name collisions, both
between user-specified names and the automatic ones.
2025-04-15 16:35:42 +03:00
Ivan Krysak 3edb6cbb9b Minor improvements 2025-04-15 16:35:42 +03:00
Ivan Krysak 48b6ab7597 ABI: fix a rare crash on a misaligned argument 2025-03-05 08:57:35 +02:00
Ivan Krysak 705e4a5955 auto [...] -> auto &&[...] 2025-02-13 13:10:51 +02:00
Ivan Krysak f494ae5f5f Standardize comment formatting
Use `*something*` instead of `_something_` when adding emphasis.
2025-02-13 13:09:50 +02:00
Ivan Krysak d4ab801ab7 Rename range_with_value_type into RangeOf
Original name was reminiscent of the STL, but there's no such concept
in there, as such it's probably better to use revng naming convention
instead.
2025-02-13 13:09:50 +02:00
Ivan Krysak a93ffd3760 Rename UnusedStackArgumentBytes
Old name was `StackBytesAllocatedForRegisterArguments`.
2025-02-12 16:43:19 +02:00
Ivan Krysak 9bb71627ea ToCABI: do basic float detection cleanup
Note that this whole thing is going to get redesigned from scratch
(by manifesting a proper type system graph) when we'll finally start
working on the *real* float support.
2025-02-12 16:43:11 +02:00
Ivan Krysak e4d9a022cd ToCABI: factor alignment computation out
Alignment considerations all over the place where growing increasingly
verbose and complex, increasing the likelihood of getting them wrong.

This unifies all the alignment logic in one place.
2025-02-12 16:43:05 +02:00
Ivan Krysak a5a2bead4f ABI: fix success detection and trailing padding
There were issues with how trailing padding is processed which sometimes
led to it being discarded. That should not happen from now on.

As a size benefit this also strictens the exit condition and improves
wording on some of the comments.
2025-02-12 16:40:59 +02:00
Ivan Krysak 7ad6b52974 ABI: improve distributor safety
This makes sure we never try to use a distributor object after
discarding some of its outputs.
2025-02-12 16:36:20 +02:00
Ivan Krysak ab535feb13 ABI: always use distributor for index selection 2025-02-12 16:36:20 +02:00
Ivan Krysak 8e85515969 ABI: fix mishandling of the top of the stack
Some ABI's (think mips) require a part of the stack to be reserved,
but before this patch we treated those fields as arguments.

Note that this analysis never inserts fields, so if there are no
sufficient field already inserted before-hand it's just going to fail
the conversion (for example, if the field at the *newly adjusted*
offset 0 is not present).
2025-02-12 16:36:20 +02:00
Ivan Krysak 566cbad8ae ToCABI: switch argument verification pair
Before this, arguments were verified in a (current, next) pair,
this makes it so (previous, next) pair is used instead.
2025-02-12 16:36:20 +02:00
Ivan Krysak c861e1c552 ToCABI: bundle argument-specific data together 2025-02-12 16:36:20 +02:00
Ivan Krysak 2521ffc1be ABI: allow ValueDistributor reassignment 2025-02-12 16:36:20 +02:00
Ivan Krysak 69144a7e3b ToCABI: improve function name logging 2025-02-12 16:36:18 +02:00
Ivan Krysak 492c169217 ToCABI: mark AAPCS64 as a safe ABI 2025-02-12 16:26:56 +02:00
Ivan Krysak 9186d476d2 ToCABI: fix mistreating of the safe cli argument 2025-02-12 16:26:56 +02:00
Ivan Krysak 850677115e Minor improvements 2025-02-12 16:26:56 +02:00