Commit Graph

1642 Commits

Author SHA1 Message Date
Antonio Frighetto 4eb0f3c29a IRHelpers: overload extract for int64_t 2021-12-15 18:03:30 +01:00
Antonio Frighetto b80be110ae ZipMapIterator: add support for llvm::DenseMap 2021-12-15 18:03:30 +01:00
Antonio Frighetto 20211fc3f6 DwarfImporter: exclude empty names 2021-12-15 18:03:30 +01:00
Antonio Frighetto 31620e4efd CodeGenerator: record static functions as well 2021-12-15 18:03:30 +01:00
Antonio Frighetto f1ac5e4075 Model: handle NoReturn functions in CallEdge 2021-12-15 18:03:30 +01:00
Antonio Frighetto 034618d228 FunctionIsolation: fix object passed by copy 2021-12-15 18:03:30 +01:00
Alessandro Di Federico 4401871489 FunctionIsolation: handle NoReturn attribute 2021-12-15 18:03:30 +01:00
Alessandro Di Federico 96d133d72f Introduce model::FunctionAttributes 2021-12-15 18:03:30 +01:00
Alessandro Di Federico 6dd346ab04 Move GCBI.getMetaAddressMetadata to IRHelpers.h 2021-12-15 18:03:30 +01:00
Alessandro Di Federico f4d09bc5ff Improve scripts/compare-yaml
* Rename from compare-json.py to compare-yaml
* Handle YAML
* Support certain characteristics of the model
* Use subgraph matching to perform comparisons
* Introduce some testing
* Drop Python 2 support
* Reformat
2021-12-15 18:03:30 +01:00
Alessandro Di Federico 1d8e274dcd Do not by pass HARD flags 2021-12-15 18:03:28 +01:00
Alvise de Faveri 2f4b716e6b Add Model::toString() and writeToFile()
These functions can be used in conjunction to dump the Model on a
file during a gdb session, for example:

```
(gdb)  p  writeToFile(Model->toString(), "/tmp/model.yaml")
```
2021-11-19 10:17:09 +01:00
Alvise de Faveri 267410ac43 Add Attribute::WillReturn to ReadOnly funcs
Without this attribute, newer versions of llvm are not able to
remove calls to `ReadOnly` functions whose return value is unused.

This is instead the expected behavior for the functions that are
generated by `revng` with the `ReadOnly` attribute.
2021-11-19 10:17:02 +01:00
Alessandro Di Federico d3cee7611d revng-dump-model: consider generic MetaAddress too 2021-11-19 10:12:23 +01:00
Alessandro Di Federico 54573608fe revng-dump-model: consume all the input 2021-11-19 10:12:23 +01:00
Alessandro Di Federico e1dadae08d revng-dump-model: ignore YAML tags 2021-11-19 10:12:23 +01:00
Antonio Frighetto adcda3532b AVI: fix error in detection of stores to PC 2021-11-18 15:30:07 +01:00
Alessandro Di Federico 9b61ad1772 scripts/revng: fix typo in ASan handling 2021-11-08 16:18:27 +01:00
Ivan Krysak 52f7432f1b Add model::Architecture::getPointerSize() 2021-11-08 16:17:47 +01:00
Alvise de Faveri 2e19fade43 Fix memory leak in TupleTreeKeyWrapper::clone
ConcreteTupleTreeKeyWrapper::clone() should cleanup the Target object
befor cloning, otherwise the destructor of the inner Pointer object
is never called.
2021-10-27 08:42:53 +02:00
Alessandro Di Federico 0b7787967d Merge branch 'feature/dynamic-functions' 2021-10-21 15:55:44 +02:00
Alessandro Di Federico 93b93a3908 scripts/revng: fix computation of libs dependencies 2021-10-21 15:02:01 +02:00
Pietro Fezzardi c050dcb621 Handle missing model in SerializeModelPass
Before this commit, SerializeModelPass and SerializeModelWrapperPass had
hard dependencies on the passes that load the model from LLVM-IR.

This commit makes this dependency optional. When the passes for model
serialization are executed, if they see that nobody requested to load
the model, they will not try to serialize it.

This prevents them from crashing when running in pipelines that only
contain passes that ignore the model.

This is particularly beneficial because `revng opt` automatically adds
`-serialize-model` at the end of each pipeline and, before this commit,
this meant that `revng opt` could not be used for unit-testing simple
llvm passes that do not use the model.

With this commit, `revng opt` can be used for unit-tests, even on LLVM IR
with missing model.
2021-10-21 15:02:01 +02:00
Andrea Gussoni cd9e4b5df1 check-revng-conventions: improve c files exclusion 2021-10-21 15:02:01 +02:00
Alessandro Di Federico 0a6c52a590 Update docs/GeneratedIRReference.rst
* Drop outdated portion describing ABI/CFG metadata that are now stored
  in the model.
* Introduce MetaAddress concept.
* Describe the four-parts program counter CSVs.
* Update description of the dispatcher.
* Update description of `function_call` and `newpc`.
2021-10-21 15:02:00 +02:00
Alessandro Di Federico 83f420abda Introduce dump method for model structs 2021-10-21 15:02:00 +02:00
Alessandro Di Federico eb2c3df925 Tag with MetaAddress functions and call sites 2021-10-21 15:02:00 +02:00
Alessandro Di Federico 8546a0c786 CallEdge: only indirect calls have a prototype 2021-10-21 15:01:59 +02:00
Alessandro Di Federico 89532890ed Introduce support for importing DWARF information 2021-10-21 15:01:20 +02:00
Alessandro Di Federico 3a3eea0cf5 Introduce support for dynamic functions 2021-10-21 15:01:19 +02:00
Alessandro Di Federico a023bfa7f5 Introduce ABI handling 2021-10-18 20:44:58 +02:00
Alessandro Di Federico 0dfc81da41 Minor model improvements
* Introduce some documentation for the model.
* Improve the way enums are serialized/deserialized.
* Mark certain fields of model data structures as optional.
* introduces some error messages during model validation.
2021-10-18 20:44:58 +02:00
Alessandro Di Federico 5b50a3320f Introduce error messages during model validation 2021-10-18 20:44:58 +02:00
Alessandro Di Federico 34ae75c800 model: handle 80 bits floats (12 bytes) 2021-10-18 20:44:58 +02:00
Alessandro Di Federico 06043b92c6 PromoteCSV: do not promote the stack pointer 2021-10-18 20:44:58 +02:00
Alessandro Di Federico d5bfb872d6 Introduce SortedVector::isSorted
This is a debug method.
2021-10-18 20:44:58 +02:00
Alessandro Di Federico 2fec214959 Fix QualifiedType::isScalar 2021-10-18 20:44:58 +02:00
Alessandro Di Federico fe2e9427c1 scripts/revng: use gdb -q 2021-10-18 20:44:58 +02:00
Alessandro Di Federico d40c8d4589 scripts/revng: use 4 spaces to indent 2021-10-18 20:44:58 +02:00
Alessandro Di Federico e29c36cd51 Drop --disable-enforce-abi-safety-checks 2021-10-18 20:44:58 +02:00
Alessandro Di Federico 18cfbdbfe0 Whitespace and other minor changes 2021-10-18 12:39:21 +02:00
Ivan Krysak 6714c4cb58 Add Node::copy() and Node::move()
Those member functions are an easy way to reach the underlying node data
without affecting the edges stored by the node.
2021-10-04 14:38:42 +02:00
Alessandro Di Federico 6c2bc944c2 Merge branch 'feature/misc-model-improvements' 2021-09-02 14:56:01 +02:00
Pietro Fezzardi a0dbea19e5 Prevent model::Type CustomNames from colliding
This commit reserves the "unnamed_" prefix for revng.
The first use of this reserved prefix is in `model::Type`s
`CustomName`s and `model::Identifier`s.
This commit also makes the `verify()` method stricter for
`model::Identifier` so that an `Identifier` whose name starts with the
reserved prefix does fails verification.
2021-09-02 14:55:47 +02:00
Pietro Fezzardi 3d38451abd Enable error checking on Model deserialization
This commit changes the `TupleTree::deserialize` method to return an
`llvm::ErrorOr<TupleTree>`, enabling users to choose their policies on
error reporting.
2021-09-02 14:42:51 +02:00
Pietro Fezzardi bae9214652 Stricten verification for model::Identifier
Now only `Identifier`s that are valid C identifiers are guaranteed to
verify.
The `fromString` factory is updated accordingly.
2021-09-02 14:42:47 +02:00
Pietro Fezzardi 48f6a60629 Fix callOnPathSteps for KeyedObjectContainer
callOnPathSteps was using linear scan search in KeyedObjectContainer.
This commit fixes it for using binary search, dramatically improving
performance in workloads that do lots of lookups.
2021-09-02 14:39:23 +02:00
Pietro Fezzardi 3f5644dd02 Add operator<=> for model::Qualifier
This allows to keep `model::Qualifier`s in ordered containers, which is
necessary e.g. in `revng-c`.
2021-09-02 14:39:23 +02:00
Pietro Fezzardi aa46b03050 Add name() members to various Model types 2021-09-02 14:39:23 +02:00
Pietro Fezzardi 44b348db6a Provide efficient getName for model::Type enums 2021-09-02 14:39:23 +02:00