Commit Graph

1492 Commits

Author SHA1 Message Date
Filippo Cremonese 2b221ca66e tuple-tree-gen: support generating python 2022-03-22 14:53:01 +01:00
Alessandro Di Federico 2b55d1df22 Adopt cmake-format 2022-03-17 18:52:18 +01:00
Alvise de Faveri 16b7c61940 Add writeToLog() for types that have dump() 2022-03-17 18:52:18 +01:00
Alvise de Faveri 45784cce8c YAMLTraits: Add serializeToString() 2022-03-17 18:34:09 +01:00
Giacomo Vercesi e237ee75b0 Add custom traceback support 2022-03-17 18:33:59 +01:00
Alessandro Di Federico bc18091c7d Merge branch 'feature/qualifier-improvements' 2022-03-17 17:09:17 +01:00
Pietro Fezzardi fb54cc22a2 QualifiedType: new typedef-aware helper methods
This commit reworks the helper methods for model::QualifiedType, to
properly traverse typedefs.

These methods are used to check if a QualifiedType is:
- scalar
- primitive
- float
- void
- pointer
- array

This commit add the methods for checking pointers and arrays (that
weren't available before), reworks all the helpers so that they all
traverse typedefs, and adds comments so that it's clear that they
traverse typedefs.
2022-03-17 17:03:28 +01:00
Pietro Fezzardi 630fee4500 model::Qualifier: add static methods for filtering
This commit adds the static methods:
- model::Qualifier::isConst
- model::Qualifier::isArray
- model::Qualifier::isPointer

These methods replace the old, non-static, methods:
- model::Qualifier::isConst
- model::Qualifier::isArray
- model::Qualifier::isPointer

Having these method static is very helpful for filtering, when
iterating on sequences of qualifiers, such as:

  for (const auto &Q :
       llvm::make_filter_range(Qualifiers, Qualifier::isPointer)) {
    // do stuff with Q
  }

This will be very helpful for defining other helper functions for
model::QualifiedType.

This commit also drops the non-static version of the methods, since they
are redundant, and because they would cause ambiguity and failure of
type inference in the snippet above, making them effectively useless for
the goal they were designed for, which is filtering ranges.
2022-03-17 17:03:22 +01:00
Pietro Fezzardi 0158354dc7 DwarfImporter: fix order of Qualifiers
Before this commit the DwarfImporter was importing qualifiers in
reverse order.

As an example the following declaration in C:

  int *x[4];

was imported as a pointer to array, instead of an array of pointers.

This commit fixes the order of the qualifiers.
2022-03-17 17:02:48 +01:00
Alessandro Di Federico ee602fc5e0 Merge branch 'feature/revng-llvm-pipeline' 2022-03-17 17:02:16 +01:00
Alessandro Di Federico 173ad98661 revng driver: introduce --keep-temporaries 2022-03-17 16:46:02 +01:00
Alessandro Di Federico cdeb1ea507 revng driver: introduce --dry-run 2022-03-17 16:46:02 +01:00
Alessandro Di Federico 6832698e5b Introduce revng llvm pipeline
This is a wrapper to `revng-pipeline` designed to make the adoption of
pipelines easier for places where we are now using `revng opt`.
2022-03-17 16:46:02 +01:00
Alessandro Di Federico e753e28f43 revng: make more extensive use of relative paths 2022-03-17 16:46:02 +01:00
Alessandro Di Federico 3cc138c8d6 Drop cloneMetadata
It was an hack to circumvent a bug in LLVM.
The following LLVM commit properly fixes the problem:

    [Cloning] Clone metadata on function declarations
2022-03-17 16:46:02 +01:00
Alessandro Di Federico 0aef5adc32 Drop scripts/revng-translate reference 2022-03-17 16:46:02 +01:00
Alessandro Di Federico 586feabd3d Drop scripts/revng-model-dump 2022-03-17 16:46:02 +01:00
Alessandro Di Federico af6305725d Rewrite revng driver infrastructure
It really needed some fresh air.
2022-03-17 16:46:00 +01:00
Alessandro Di Federico 00ce580362 Introduce EnforceABI and PromoteCSV pipes 2022-03-17 14:10:50 +01:00
Alessandro Di Federico 9fb3b647a4 Introduce DropRootPass 2022-03-17 14:10:50 +01:00
Alessandro Di Federico fa3206b26d Rename Lifted tag to Isolated 2022-03-17 14:10:50 +01:00
Alessandro Di Federico ea6383c476 mv {d,registerD}efaultFunctionPrototype 2022-03-17 14:10:50 +01:00
Alessandro Di Federico df00a892dd Introduce revng.cli.lift 2022-03-17 14:10:50 +01:00
Alessandro Di Federico da7701bd4e Move all executables except revng to libexec/revng
We used to collect all binaries into the `bin/` directory. However this
led to confusions since certain commands where available both as
`revng-command` and `revng command`.

This commit moves all the executables except `revng` into
`libexec/revng`, which, according to FHS, is dedicated to "internal
binaries that are not intended to be executed directly by users or shell
scripts".
2022-03-17 14:10:50 +01:00
Alessandro Di Federico 0e387938be Move scripts/revng to revng/cli/revng.py 2022-03-16 22:10:15 +01:00
Alessandro Di Federico 997e7f60cb scripts/renvg: handle revng pipeline
Let `scripts/revng` intercept `revng-pipeline` invocations and add, not
only -load, but `-P` (pipelines) too.
2022-03-16 22:10:15 +01:00
Alessandro Di Federico bc8e6a6a24 Minor changes 2022-03-16 22:10:15 +01:00
Alessandro Di Federico edaf468c7c Merge branch 'feature/dematerialize-revng-lift' 2022-03-11 15:37:21 +01:00
Alessandro Di Federico 7d48059800 Turn revng-lift into a script 2022-03-11 15:37:12 +01:00
Alessandro Di Federico 0793e4afcb Turn lifting into a pass 2022-03-11 15:37:12 +01:00
Alessandro Di Federico 5e38805063 Rename detail namespaces into revng::detail 2022-03-11 15:37:12 +01:00
Alessandro Di Federico 857f3afcf6 Merge branch 'feature/reorganize-frontend' 2022-03-10 15:54:53 +01:00
Alessandro Di Federico cd7f1fced5 Update test results 2022-03-08 20:57:46 +01:00
Alessandro Di Federico ee0b8f44c1 Introduce BinaryImporter
This is a big step to split revng-lift in two parts: one that only
writes the model and one that actually lifts to LLVM IR.

* Introduce `revng import binary`
* Split off `BinaryFile.h`
* Drop `revng.h`
* `GeneratedCodeBasicInfo`: use model
* Reduce role of `GeneratedCodeBasicInfo` in favor of
  `model::Architecture` and `model::Register` methods
* `CodeGenerator`: adopt `RawBinaryView` and model
* `JumpTargetManager`: adopt `RawBinaryView` and model
* `ExternalJumpsHandler`: adopt model
* `InstructionTranslator`: discard `Architecture` in favor of
  `EndianessMismatch`
* Many other changes
2022-03-08 15:15:24 +01:00
Alessandro Di Federico e9b1879067 Handle invalid model::DynamicFunction::Prototype 2022-03-08 15:04:34 +01:00
Alessandro Di Federico ad7e6d9388 EFA: always perform stack adjustment 2022-03-08 15:04:34 +01:00
Alessandro Di Federico 60cce26768 Support streaming llvm::Errors to Loggers 2022-03-08 15:04:34 +01:00
Alessandro Di Federico 0a5d2c04a7 Rework LoadModelPass 2022-03-08 15:04:34 +01:00
Alessandro Di Federico 1a57229693 Introduce model::Binary::DefaultPrototype 2022-03-08 15:04:34 +01:00
Alessandro Di Federico b3bfd5c64d Introduce RawBinaryView 2022-03-08 15:04:34 +01:00
Alessandro Di Federico 1d1ae3f7d4 Add model::Binary::ExtraCodeAddresses 2022-03-08 15:04:34 +01:00
Alessandro Di Federico 7a35ef21be Extend model::Register
This is done in order to get rid of `BinaryFile`.
2022-03-08 15:04:29 +01:00
Alessandro Di Federico b65dc65037 Extend model::Architecture
This is done in order to get rid of `BinaryFile`.
2022-03-08 13:06:49 +01:00
Alessandro Di Federico a88a9e52c3 Improve model::Segment 2022-03-08 13:06:47 +01:00
Alessandro Di Federico 97f0941aee Introduce model::Section 2022-03-08 12:26:07 +01:00
Alessandro Di Federico 8570923d64 Introduce model::Relocation 2022-03-08 12:25:59 +01:00
Alessandro Di Federico 69cd0db81f tuple_tree_generator: make Key strongly typed 2022-03-08 12:25:47 +01:00
Alessandro Di Federico 39ace7dc56 mv revng{DwarfImporter,ModelImporterDwarf} 2022-03-08 12:25:47 +01:00
Alessandro Di Federico 81f21ae21d Make model::Binary::EntryPoint optional 2022-03-08 12:25:47 +01:00
Alessandro Di Federico 1cd17a13e8 readFromPointer: use bool IsLittleEndian 2022-03-08 12:25:47 +01:00