Commit Graph

6113 Commits

Author SHA1 Message Date
Alessandro Di Federico 93b7420c8a Implement model::Function::dumpCFG 2021-02-19 09:39:49 +01:00
Alessandro Di Federico 82605514c4 model: prepare for ABI information
This commit also drops some dead code and fixes Model tests accordingly.
2021-02-19 09:39:49 +01:00
Alessandro Di Federico 6cfcd087b7 Introduce ProgramCounterHandler::loadPC 2021-02-18 19:13:06 +01:00
Alessandro Di Federico 8952ca3cc1 IRHelpers.h: introduce createFunctionType 2021-02-18 18:46:49 +01:00
Alessandro Di Federico 575a0d6a6d IRHelpers.h: introduce isHelper 2021-02-18 18:46:49 +01:00
Alessandro Di Federico 0ebb32f25e GCBI: make certain methods static 2021-02-18 18:46:49 +01:00
Alessandro Di Federico ee9f2192f3 KOC::batch_insert: return newly created object 2021-02-18 18:46:49 +01:00
Alessandro Di Federico 2d22b31d00 revng-all-binaries: depend on early-linked-module-* 2021-02-18 18:46:49 +01:00
Alessandro Di Federico a314fd61ef Import revng-dump-model 2021-02-18 18:46:49 +01:00
Alessandro Di Federico e9ca81247d Improve get*FromYAML*
This commit fixes the following issues:

1. It introduces `getNameFromYAMLEnumScalar` which returns a
   `llvm::StringRef` instead of a `std::string`.
2. Lets users decide what to do when `getValueFromYAMLScalar` does not
   get any match (abort by defaul, or return an "Invalid" value).
2021-02-18 18:44:42 +01:00
Alessandro Di Federico a96c6d4931 get{Name,Value}FromYAMLScalar: support quotes 2021-02-18 18:44:42 +01:00
Alessandro Di Federico 60ae42aa46 Introduce GCBI::arch() 2021-02-18 18:44:42 +01:00
Alessandro Di Federico 0ab1b786b6 check-revng-conventions: static in C headers is OK 2021-02-18 18:44:42 +01:00
Pietro Fezzardi 448d7366ac Small lib to detect isolated functions using Model 2021-02-18 11:59:05 +01:00
Pietro Fezzardi cc65e946cb RestructureCFG: fix exit dispatcher to backedges 2021-02-18 11:59:05 +01:00
Pietro Fezzardi b23cf45fd9 RestructureCFG: refactor entry and exit dispatcher 2021-02-18 11:59:05 +01:00
Pietro Fezzardi 444663ed94 RestructureCFG: refactor logging of MetaRegions 2021-02-18 11:59:04 +01:00
Pietro Fezzardi 1616b9d0ab Fix checkMetaRegionConsistency
This function was intended to check that backedges are entirely enclosed
inside metaregions, i.e. that we cannot have a backedge jumping from a
metaregion to an outer or an inner one.

Before this commit, the assertion was tautological.
2021-02-18 11:59:04 +01:00
Pietro Fezzardi 9a4bb33bfe RegionCFG: refactor simplifySCSAbnormalRetreating 2021-02-18 11:59:03 +01:00
Pietro Fezzardi 2998494d18 RegionCFG: use meaningful names for dummy nodes
This helps debugging.
2021-02-18 11:59:03 +01:00
Alessandro Di Federico 685dbfd3f7 Whitespace and other minor changes 2021-02-18 08:48:39 +01:00
Alvise de Faveri 495e725d14 ADT: Enclose RPOExt in the llvm namespace 2021-02-17 16:50:32 +01:00
Alessandro Di Federico 98996a5d47 Merge branch 'feature/improve-model' 2021-02-17 11:56:24 +01:00
Alessandro Di Federico 49287e9de7 Improve Model and TupleTree
This commit:

* Drops `KeyTraits::toString`: if needed, use `getNameFromYAMLScalar`.
* Makes many methods in TupleTree.h return `nullptr` or `std::optional`
  in order to gracefully handle failures.
* Provides `KeyTraits` specializations for integral types and tuple-like
  composed by types providing `KeyTraits`.
* Introduces `CompositeScalar`, which enables tuple-like objects to be
  YAML-serializable scalars by joining the YAML-serialization of its
  members through a customziable character.
* Implements `PathMatcher`, a very simple "regular expression" mechanism
  for paths on tuple trees.
* Introduce testing for the Model.
2021-02-17 11:48:46 +01:00
Alessandro Di Federico 071cce12f6 KeyTraits::toInts: handle invalid MetaAddress 2021-02-17 11:46:46 +01:00
Alessandro Di Federico e382f40119 get*FromYAML* handle scalars and enumeration 2021-02-17 11:45:28 +01:00
Alessandro Di Federico 6e6483b5eb Whitespace changes 2021-02-17 11:44:41 +01:00
Alessandro Di Federico 7f86530e74 MetaAddress::verify: handle invalid types 2021-02-17 11:44:23 +01:00
Pietro Fezzardi 85971bcc06 revng-lift: write empty Model in lifted Modules 2021-02-17 11:37:01 +01:00
Pietro Fezzardi 10b90d6e15 SerializeModelPass: static method to write Model 2021-02-17 11:37:00 +01:00
Pietro Fezzardi 645484f699 LoadModelPass: add static function to read Model 2021-02-17 11:37:00 +01:00
Pietro Fezzardi 8ffcd49dd2 RecursiveCoroutine: fix reference arguments
Before this commit, recursive coroutines did not work properly if they
had out arguments with reference type.
The reason is that `rc_run` was inferring the type of its arguments from
the arguments themselves, not from the prototype of the recursive
coroutine.

Hence, code snippets like the following did not work properly, because
`rc_run` was taking x by value, not by reference.

```
RecursiveCoroutine<void> accumulate_on_i(int &i) {
  // ...
}

int f() {
  int x = 0;
  rc_run(accumulate_on_i, x);
  return x;
}
```

This commit fixes the problem. Now the arguments of `rc_run` are
properly forwarded to the recursive coroutine.
2021-02-17 11:37:00 +01:00
Pietro Fezzardi 3116b67948 Ensure to find an isolated function in tests 2021-02-11 16:26:20 +01:00
Pietro Fezzardi eda6e60330 decompileFunction: run only on isolated functions 2021-02-11 16:25:42 +01:00
Filippo Cremonese f05f785023 Fix revng_merge_dynamic installation
This commit also substantially reorganizes the root CMakeLists.txt.
2021-02-10 00:00:38 +01:00
Alessandro Di Federico 4d3d625957 Merge branch 'feature/serializable-graph' 2021-02-09 23:19:13 +01:00
Alain Carlucci 8e275ed957 ADT: Add SerializableGraph 2021-02-09 22:44:01 +01:00
Pietro Fezzardi 148119c528 PromoteStackPointer: make local sp aligned 2021-02-09 15:07:04 +01:00
Alain Carlucci f3d755e0ff TupleTree*.h: add missing include 2021-02-08 12:25:34 +01:00
Alain Carlucci 557ee758e6 MetaAddress: enable quoting on YAML serialization
Enable quotes around MetaAddress during serialization, since ':' is a
valid YAML separator, which causes wrong deserialization when a vector
of MetaAddress is serialized as a list
2021-02-08 12:25:12 +01:00
Pietro Fezzardi c9a98f3ccd CMakeLists.txt: remove redundant tests and deps 2021-02-05 16:09:16 +01:00
Pietro Fezzardi f01fe2ec7a MarkForSerialization: fix needsVarDecl 2021-02-05 15:45:11 +01:00
Pietro Fezzardi 87119ca1ca Remove standalone tests for AddSCEVBarrierPass
Now these tests run as part of the tests for decompilation with DLA.
2021-02-04 18:32:10 +01:00
Pietro Fezzardi 2820fc395c Fix emission of (?:) with ptr type and int args 2021-02-04 18:09:53 +01:00
Pietro Fezzardi f722224a09 Emit return statements returning a ConstantStruct 2021-02-04 16:01:26 +01:00
Pietro Fezzardi b98228eed0 Fix generation of bool typedef in C 2021-02-04 14:33:41 +01:00
Pietro Fezzardi 87c248a941 CMakeLists.txt: reduce the number of tests
Before this commit, the decompilation tests were executed on all the
artifacts coming from revng runtime tests.
This commit restricts this, running it only on the artifacts for the
'printf' runtime test.

We consider this restriction not to be harmful to tests, because the
'printf' test already contains all the libc, which is actually what
really stress-tests the decompiler.
Running only on 'printf' should be enough to trigger bugs on rare code
paths, as showed in the past, while considerably reducing the runtime of
the tests.
2021-02-03 17:17:18 +01:00
Pietro Fezzardi ec86afdc5a decompileFunction: run doFinalization at end 2021-02-03 16:20:44 +01:00
Pietro Fezzardi 21053432b7 CMakeLists.txt: remove verbose logs for tests 2021-02-03 16:20:44 +01:00
Pietro Fezzardi d6ba89b8a9 Add tests for decompilation pipeline with DLA 2021-02-03 12:42:10 +01:00