Commit Graph

563 Commits

Author SHA1 Message Date
Massimo Fioravanti 98ecd38162 Drop PureLLVMPipe
Now LLVM passes can be used directly in an LLVMPipe without specifying a
contract for it.
2022-02-07 22:24:39 +01:00
Alessandro Di Federico 3b7d7c5f7e Don't use llvm::outs 2022-02-07 22:24:39 +01:00
Alessandro Di Federico fec5f3537b s/Granularity/Rank/ 2022-02-07 22:24:39 +01:00
Alessandro Di Federico e2cd7cbcdf Pipeline: simplify LLVMContainer 2022-02-07 20:11:37 +01:00
Massimo Fioravanti 396095706f Minor changes to revngPipeline 2022-02-07 20:11:15 +01:00
Alessandro Di Federico 91fd04079a AllPasses.h: include Verify.h 2022-02-07 20:11:15 +01:00
Alessandro Di Federico 0f084ed620 Minor changes 2022-02-07 16:55:46 +01:00
Alessandro Di Federico 78be0e9268 Explode TupleTree.h 2022-01-31 16:28:26 +01:00
Alessandro Di Federico a353e00ac1 Introduce model passes 2022-01-31 16:28:14 +01:00
Alessandro Di Federico 3980ee3fad Introduce model tools 2022-01-31 16:28:14 +01:00
Alessandro Di Federico 29cf330fc8 TupleTreeDiff: use streams 2022-01-31 14:13:25 +01:00
Alessandro Di Federico 5c89a6a858 callOnPathSteps: fix UpcastablePointer handling
The version of callOnPathSteps without an actual instance was completely
ignoring the upcasted type of `UpcastablePointer`s. We now fix this by
calling the right template specialization, which we choose by inspecting
the key of the `UpcastablePointer`.
2022-01-31 14:13:25 +01:00
Alessandro Di Federico c1ec001f46 TupleTreeDiff: dump any object 2022-01-31 14:13:25 +01:00
Alessandro Di Federico b3d6c721ad Introduce purgeUnnamedAndUnreachableTypes 2022-01-27 11:51:03 +01:00
Alessandro Di Federico f3634e165f Introduce model::Type::localCompare 2022-01-27 11:51:03 +01:00
Alessandro Di Federico 74a7496020 deduplicateNames -> promoteOriginalName
This commit switches from `deduplicateNames`, which changed certain
`CustomName` values, to `promoteOriginalName`, which updates empty
`CustomName` using non-ambiguous versions of `OriginalName`.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 863652f480 Introduce OriginalName in the type system
The goal of `OriginalName` is to keep track of the original name of a
symbol upon import.

In future, this will also be used to promote it to `CustomName`.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 8d22c5205f Push CustomName to model::Type
Before this commit `CustomName` was in each inheritor, except for
`model::PrimitiveType`.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 54fcc1d7fe struct_impl.cpp.tpl: include headers in any case 2022-01-27 11:51:03 +01:00
Alessandro Di Federico 48565ee905 Move skip to STLExtras.h
It has nothing to do with IR.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 09054e637a Introduce TupleTree::replaceReferences 2022-01-27 11:51:03 +01:00
Alessandro Di Federico b31e7b1f5e Introduce model::Type::edges()
This makes building a graph for the type system very easy.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 56536ba231 STLExtras.h: introduce IsTupleLike concept
One day we'll need to make it report error messages in a more effective
way.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 80ed065206 model::Type: move makeTypeWithID to .cpp
It needs to see the full declaration of all concrete types.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 4f29a70df8 UpcastablePointer.h: pointee: skip over const 2022-01-27 11:51:03 +01:00
Alessandro Di Federico 7441497171 Function.h should not include Binary.h
`Function.h` should see a forward declaration of `model::Binary` and
`Binary.h` should include `Function.h`.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 97db1d5f50 Make TypePaths comparable 2022-01-27 11:51:03 +01:00
Alessandro Di Federico c9d47d4ee7 Drop model::EnumEntry::Aliases
They turn out to be problematic to handle in the model and not very
usable in practice.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 5484896e3f TupleTreeDiff: fix path construction
This commit fixes a bug that led to put in a `TupleTreePath` an object
instead of its key.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 1d839ba156 IRHelpers.h: drop erase_if
We have `llvm::erase_if`.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 3799f1e973 Whitespace and other minor changes 2022-01-25 21:27:05 +01:00
Alessandro Di Federico 3ab32cd2ef tuple_tree_generator: make fully standalone 2022-01-21 18:05:51 +01:00
Massimo Fioravanti 70ec456078 Introduce revng-pipeline 2022-01-17 18:17:54 +01:00
Massimo Fioravanti b4f9162078 Introduce helper function to emit indentation 2022-01-17 18:17:54 +01:00
Massimo Fioravanti afbebaf531 ProgramRunner: fix misuse of executable path
ProgramRunner was using garbage data instead of correctly using the path
to the current executable directory.
2022-01-17 18:17:54 +01:00
Filippo Cremonese 74217b4fe5 Generate C++ model from YAML definition
Model classes are now described by a YAML document, which is used to
generate C++ headers containing classes and all the boilerplate
required for YAML serialization/deserialization, usage in
SortedVectors, etc. See the README in include/revng/Model for more
info.
2022-01-13 14:34:11 +01:00
Filippo Cremonese fbeee896e1 Rename model::abi -> model::ABI 2022-01-10 10:31:27 +01:00
Filippo Cremonese a97efbaaf7 Add missing <map> include 2022-01-10 10:31:27 +01:00
Alessandro Di Federico 441a5552b7 ProgramRunner: do not depend on main
`main` is not in all cases a dynamically exported symbol, therefore,
it's not safe to rely on it.

This commit switches to use `PathList`'s `getCurrentExecutableFullPath`,
which reads `/proc/self/exe`.
2022-01-09 19:00:57 +01:00
Alessandro Di Federico cfb47157b9 clang-tidy: readability-identifier-naming
This commit fixes all the non-compliance with our preliminary clang-tidy
configuration, which will be merged soon.
2022-01-07 09:18:05 +01:00
Massimo Fioravanti bdcc1d2e30 BinaryFile::BinaryFile: accept object::Binary
The constructor now accepts a llvm::object::Binary directly rather than
a path. Will be used by the revng-pipeline which will retain ownership
of the binary.
2022-01-05 14:47:25 +01:00
Massimo Fioravanti 889b076828 AdvancedValueInfo: fix wrong NDEBUG check
A extra check was performed in release only rather than in debug only.
2022-01-05 14:47:25 +01:00
Massimo Fioravanti ec0fcfbe63 Model: separate mipsel from mips 2022-01-05 14:47:25 +01:00
Massimo Fioravanti fdfeb2b6e9 LoadModelPass: support for external model 2022-01-05 14:45:01 +01:00
Massimo Fioravanti 79d5ca1e27 Introduce FunctionTags::IsolatedRoot
This will be used by the revng-pipeline to tell apart a `root` calling
isolated functions from a regular one.
2022-01-05 14:45:01 +01:00
Massimo Fioravanti ca4c7e2c09 Add dereferenceIterator and mapToValueIterator
A dereference iterator is used to map a pointer-like object to the
pointee, as an example given a `vector<unique_ptr<int>> Vector`, using
`dereferenceRange(Vector)` will present a range of `int &` rather than a
range of `unique_ptr<int> &`.

mapToValueIterator can be used  on a map range
to access the underlying object directly rather
than the pair<key, object>.
2022-01-05 14:45:01 +01:00
Massimo Fioravanti 80c3121c29 Introduce ProgramRunner
The ProgramRunner will be used by revng-pipeline to invoke the external
linker to operate on object file stored on disk.
2022-01-05 14:45:01 +01:00
Massimo Fioravanti ac20314a92 Helpers to go from llvm:: to model::Function 2022-01-05 14:45:01 +01:00
Alessandro Di Federico d78993ac54 Add TupleTree file (de)serialization
Tuple tree file serialization will be used by the revng-pipeline as a
helper function to load and store the models in the working directory.
2022-01-05 14:44:57 +01:00
Pietro Fezzardi 2f524114e8 RecursiveCoroutine: add operator* for ergonomics
This allows e.g. the following programming pattern:

```
RecursiveCoroutine<std::optional<SomeType>> f();

int g() {
  return *f();
}
```

Without operator* defined for `RecursiveCoroutine` this would fail,
requiring an explicit cast such as:

```
int g() {
  return *static_cast<std::optional<SomeType>>(f());
}
```
2022-01-05 14:37:37 +01:00