42 Commits

Author SHA1 Message Date
Alessandro Di Federico 0385e4c652 Introduce revng::Configuration 2026-04-23 13:40:43 +02:00
Alessandro Di Federico ee9c77b719 appendTo: move to STLExtras.h 2026-04-23 13:40:42 +02:00
Giacomo Vercesi 798af62b87 Introduce helpers declarations
Re-organize the variants of `libtcg-helpers-*.bc` as such:
* `libtcg-helpers-full-$ARCH.bc`: unchanged, contains all helper
  function with their bodies and all CSVs.
* `libtcg-helpers-declarations-only-$ARCH.bc`: all helper
  functions have been turned to declarations. All CSVs (except a couple
  of special ones) have been dropped.
* `libtcg-helpers-to-inline-$ARCH.bc`: only functions with the
  `revng_inline` section retain their body. Only CSVs that are used by
  these functions are present.

Lift now loads only the `declarations-only` variant of helpers, as
their body is not required until `inline-helpers`. In `inline-helpers`
the `to-inline` variant is loaded and linked, which then allows the
helpers to be inlined.
2026-02-05 10:20:45 +01:00
Giacomo Vercesi 5250ffbb6b Introduce SimplePassManager
Add the `SimplePassManager` and `SimpleFunctionPassManager` classes
which add wrappers around the new LLVM pass manager. Change all the
applicable uses of the legacy pass manager with the wrapper.
2026-02-05 09:25:42 +01:00
Alessandro Di Federico a1f9bd2d16 Minor changes 2025-12-22 11:34:46 +01:00
Giacomo Vercesi e8f293271b BinariesContainer: page files to disk
Store the contents of the files deserialized by `BinariesContainer` to
disk via `TemporaryFile`. This also allows some pipes to avoid shuffling
data around since they needed a file on disk anyways.
2025-12-19 10:28:29 +01:00
Alessandro Di Federico 5820908675 Remove and ban \file 2025-12-16 17:41:55 +01:00
Giacomo Vercesi 1632aeac73 Comment run* function with inlinable content
Add `TODO` comments to piperuns' `run*` functions that will have content
inlined once the old pipeline is removed.
2025-12-10 16:16:14 +01:00
Giacomo Vercesi 296eb9a76f Make SingleOutputPipe uniform to other piperuns
Make the interface required by `SingleOutputPipe` similar to other
piperuns by requiring a constructor, the use of `PipeRunArgument`s and
the implementation of a non-static `run` function.
2025-12-10 15:05:53 +01:00
Giacomo Vercesi 159ca6b965 Add LinkForTranslation to pypeline 2025-11-18 17:47:54 +01:00
Giacomo Vercesi af4b447f89 Add CompileRootModule to pypeline 2025-11-18 17:47:54 +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 fa24a51b05 Don't ignore TargetRegistry::lookupTarget output 2025-10-13 10:26:41 +03:00
Alessandro Di Federico 6297537486 Drop Pipe::print 2024-09-27 12:07:18 +02:00
Alessandro Di Federico c8d4381297 s/Context &Ctx/Context &Context/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico 9bdce8e5c4 s/ExecutionContext &Ctx/ExecutionContext &EC/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico 12a0a89e15 Ensure every pipe commits what it should
This commit is the final step in ensuring all the pipes commit what they
should. It also asserts this actually happens, enabling us to easily
catch future problems.
2024-09-27 12:07:16 +02:00
Alessandro Di Federico 553d869d03 Drop Pipe::print method 2024-06-20 10:24:51 +02:00
Alessandro Di Federico 19c0999e65 Drop tools/link-for-translation 2024-02-09 10:04:26 +01:00
Ivan Krysak 77b1acaf00 Prefer uint64_t to size_t wherever relevant 2024-01-29 11:57:54 +02:00
Massimo Fioravanti c276a439b5 Add pipeline invalidation
Replace the stub implementation of invalidation with the proper
implementation. A ReadPathCache is added to each global so that it can
keep tracks of what target are associated to which read paths.
2024-01-02 11:14:56 +01:00
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00
Alessandro Di Federico 4eeb942afb LLVMContainer: outline methods to .cpp 2023-04-28 14:34:49 +02:00
Alessandro Di Federico 170749b0aa Introduce revng::verify 2023-04-28 14:04:31 +02:00
Alessandro Di Federico 171ba353e5 Adopt llvm/{Support,MC}/TargetRegistry.h 2023-04-08 08:42:24 +02:00
Ivan Krysak 64856306c4 BinaryImporter: rework command line interface 2023-03-15 10:19:03 +01:00
Alessandro Di Federico 991980806e LinkForTranslation: use -l:ld-linux-x86-64.so.2 2023-01-02 10:46:13 +01:00
Massimo Fioravanti 742e1a0c56 TupleTree: switch from public fields to accessors 2022-12-12 18:36:57 +01:00
Alessandro Di Federico 53616b34ea LinkForTranslation: use ld, not c++
This change enables us to depend on the linker only, not on the
compiler.
2022-10-29 12:11:17 +02:00
Massimo Fioravanti d55aa9b9e6 Pipeline: remove * from targets
Now * is just a pipeline frontend shorthand.
2022-10-20 14:20:12 +02:00
Massimo Fioravanti 9363bbd70a Pipeline: every container type has now a C++ type 2022-09-29 15:51:17 +02:00
Alessandro Di Federico f6d5cd24dd Give pretty names to temporary files 2022-09-26 18:09:01 +02:00
Alessandro Di Federico d1bc0405dc LinkForTranslation: add .note.GNU-stack
In LinkForTranslation we create an object file for each segment in the
input binary. In order to do this, we use `objcopy`. However, an object
file without a `.note.GNU-stack` section will trigger the linked program
to have the stack executable, which we don't want.

This led the linker to complain as follows:

    ld.bfd: warning: object.o: missing .note.GNU-stack section implies
    executable stack
    ld.bfd: NOTE: This behaviour is deprecated and will be removed in a
    future version of the linker

This commit adds to the `objcopy` invocation a flag to create the
`.note.GNU-stack` section.
2022-09-21 18:39:25 +02:00
Massimo Fioravanti 9ce7b1e527 Drop Pipe suffix from pipe names 2022-08-29 14:45:45 +02:00
Massimo Fioravanti 633f49c1ef Introduce dedicated namespace for kinds and ranks 2022-08-29 14:44:53 +02:00
Massimo Fioravanti 915c083661 Pipes: reorganize who defines pipes 2022-08-29 14:44:35 +02:00
Massimo Fioravanti 96bd5835d8 revng-pipeline: rework file-to-container syntax 2022-08-10 09:49:24 +02:00
Giacomo Vercesi b90773b642 Move librevngRecompile to analyses 2022-04-26 15:05:30 +02:00
Alessandro Di Federico 2ab50495aa LinkForTranslation: reorganize command printing 2022-03-28 12:17:05 +02:00
Massimo Fioravanti ce4934f48d Introduce revng-link-for-translation
`revng-link-for-translation` provides a standalone tool needed to
perform the final linking stage of the recompilation.
2022-03-28 12:17:05 +02:00
Massimo Fioravanti f63eefba2c Move LinkForTranslationPipe to lib/Recompile 2022-03-28 12:17:05 +02:00