Commit Graph

907 Commits

Author SHA1 Message Date
Massimo Fioravanti 7804dab1d5 Add model tracking visits
Implement the core visits that are able to inspect the model bypassing
the instrumentation.
2023-04-21 17:30:33 +02:00
Massimo Fioravanti fbb978629d Instrument model generator to track acceses 2023-04-21 17:30:33 +02:00
Massimo Fioravanti 776294cfe0 Fix: add missing methods of TrackingContainer
TrackingContainer was missing some methods needed to implement visits
2023-04-21 17:30:33 +02:00
Giacomo Vercesi a2b7d0e0bf PipelineC: add tracing
Add support for tracing onto the PipelineC. This is done by:
1. Creating wrapper functions for each PipelineC function with the
   script in `scripts/PipelineC_add_tracing.py`. These will call a
   special function called `wrap` which will ultimately call a method
   with a `_` prepended to the name
2. Conversion of all PipelineC methods in `PipelineC.cpp` to `static`
   and their rename with a `_` in front, in order for them to work with
   the wrapper function in (1)
3. Generation of 2 additional include files, one for types and one for
   functions, to be used by users of tracing files in order to have
   introspection.

These steps allow the creation of a trace file with the use of the
`REVNG_C_API_TRACE_PATH` environment variable. The traces can then be
used in conjunction with the `revng trace run` and `revng trace
inspect` commands.
2023-04-20 14:43:13 +02:00
Giacomo Vercesi 19bb38d32b PipelineC: fix UAF on rp_targets_list
The underlying rp_target pointer was not stable, switch to returning a
copy of the target instead.
2023-04-20 14:43:13 +02:00
Giacomo Vercesi 566cb6310b PipelineC: make indexed object stably sorted
Many Pipeline objects (Globals, Ranks, Kinds, Targets in a TargetList)
were ordered by load order, this makes the playback of traces difficult.
Moreover the order of loading of pipeline files also influences the
ordering of other elements (Step, Analys{is,esLists}). These are also
ordered to prevent incosistent ordering.
2023-04-20 14:43:13 +02:00
Giacomo Vercesi 8d89c6a318 PipelineC: rp_initialize: only use argc and argv
Switch from specifying `libraries` and `pipelines` in `rp_initialize`
and `rp_manager_create` to the use of command-line options that are to
be passed via `argc` and `argv` in `rp_initialize`.
2023-04-20 14:43:12 +02:00
Giacomo Vercesi 9a972009d1 PipelineC: size and const-correctness
Fix the return type (often mismatched from uint64_t to int) and the
const-correctness of many functions in PipelineC
2023-04-20 14:43:12 +02:00
Alessandro Di Federico 5b8d5a8a41 Introduce OpaqueFunctionsPool::initializeFromName 2023-04-14 08:36:05 +02:00
Alessandro Di Federico 40135aad97 Drop CSVAliasAnalysisPass 2023-04-13 18:11:48 +02:00
Alessandro Di Federico 8ef567471b LLVMContainer::mergeBackImpl: postpone verify
This commit moves module verification after cleanup.
2023-04-13 18:11:48 +02:00
Alessandro Di Federico 060d26f212 Introduce getLocation(Instruction *) 2023-04-13 18:11:48 +02:00
Alessandro Di Federico 8c5f6628d1 Stop considering Instructions Taggable
Adding custom (i.e., non-dbg) metadata to Instructions has proven to be
too brittle.
2023-04-13 18:11:48 +02:00
Alessandro Di Federico bce3555285 Drop CallToLifted tag
This commit drops the `CallToLifted` tag in favor of a
`getCallToIsolatedFunction` function which checks if the call has the
`IsolatedFunction` tag. The function also assumes that indirect calls
are calls to lifted functions.
2023-04-13 18:11:48 +02:00
Alessandro Di Federico 92b9ba5571 Import findPhiTreeLeaves 2023-04-08 08:42:24 +02:00
Alessandro Di Federico dc7f731bef Mark build_PlainMetaAddress as const 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 995d44cf73 Implement Location::{parent,back} 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 52ee85f55f Implement efa::BasicBlock::contains 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 6564fc0568 Minor changes 2023-04-08 08:42:24 +02:00
Alessandro Di Federico daafc6a1e7 AVI: handle SCEV's scSequentialUMinExpr 2023-04-08 08:42:24 +02:00
Alessandro Di Federico bcd374038c s/zextOrSelf/zext/g 2023-04-08 08:42:24 +02:00
Alessandro Di Federico ae871f5062 Adopt setOnlyReadsMemory 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 43fd690ea8 InaccessibleMemOnly: adopt MemoryEffects 2023-04-08 08:42:24 +02:00
Alessandro Di Federico e131817334 Drop usage of Type::getPointerElementType 2023-04-08 08:42:24 +02:00
Alessandro Di Federico f777ccc4d3 Replace llvm::sys::fs::F_None with OF_None 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 06f9bca598 Adopt {add,remove}FnAttribute 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 394111ed40 Add missing includes 2023-04-08 08:42:24 +02:00
Alessandro Di Federico d2caa1fad0 Make CreateLoad usages opaque pointers-compatible 2023-04-08 08:42:24 +02:00
Alessandro Di Federico dbcdad0a4d Switch from llvm::Optional to std::optional 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 389342411a Drop makeArrayRef 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 5ed9432a68 Fix ambiguous template function
Bumping LLVM version turned these into compiler errors.
2023-04-08 08:42:23 +02:00
Alessandro Di Federico e3f9519ffc Get rid of std::iterator 2023-04-08 08:42:23 +02:00
Alessandro Di Federico 74ae629853 Drop experimental from coroutines 2023-04-08 08:42:23 +02:00
Alessandro Di Federico 52521f8cac Adopt more standard library's features 2023-04-08 08:42:23 +02:00
Alessandro Di Federico b2f22c168f Adopt clang-format 16 2023-04-08 08:42:23 +02:00
Pietro Fezzardi ca1fd101db Add opaque function to LLVM test helpers
This commits adds an opaque function that can be called by simple LLVM
IR snippets used in unit tests.
2023-04-06 14:25:18 +02:00
Kacper Kołodziej e7bb7d09df Rename getStrByAddress to getStringByAddress
We don't use abbreviations in names.
2023-04-04 09:30:09 +02:00
Pietro Fezzardi 4c2602e956 RawBinaryView: add getStrByAddress method
This method is similar to `getByAddress`, but it returns an
`llvm::StringRef`.

It is intended for those users that need to manipulate the bytes as
strings. In those cases, the `llvm::ArrayRef<uint8_t>` returned by
`getByAddress` is not suitable, because it triggers warnings due to
`uint8_t` not being the same as `char`.
2023-04-04 09:30:09 +02:00
Kacper Kołodziej 1b8801c9dc Add RawBinaryView::isReadOnly method
isReadOnly returns true if segment which contains region defined with
 MetaAddress and size is not writable.
2023-04-04 09:30:08 +02:00
Giacomo Vercesi 2e96e09f63 Drop analyze-all
Drop all the uses of analyzeAll and swap its use with the invocation of
the appropriate analysesList
2023-03-22 17:50:02 +01:00
Massimo Fioravanti 312e2e8d53 Add analyses lists
Introduces the possibility of specifiying lists of analyses as way to
give them coherent names.
2023-03-22 17:31:46 +01:00
Giacomo Vercesi c7d13fd176 PipelineC: fix model verification clause
In the previous implementation of Model.verify an llvm::Error was
returned. Some call sites retained the logic associated with it. Fix
these with the correct logic.
Also fix an instance of `verify` that was missing an assert.
2023-03-20 16:20:06 +01:00
Giacomo Vercesi 3b94dfae4b PipelineC: rework rp_error data type
Drop the use of unique_ptr within the rp_error data type and instead use
std::monostate. Also fix the functions to allow the use of `nullptr` as
the error parameter
2023-03-20 16:08:04 +01:00
Ivan Krysak 64856306c4 BinaryImporter: rework command line interface 2023-03-15 10:19:03 +01:00
Ivan Krysak e84c76019a ABI: introduce an additional definition option
The new option is `NoRegisterArgumentsCanComeAfterStackOnes`
If it's set to `true`, then no register argument can follow any stack
argument under the said abi, otherwise such "shuffling" of arguments
is allowed.
2023-03-15 10:19:03 +01:00
Ivan Krysak 4d21a88777 Model: remove an obsolete function conversion pass 2023-03-15 10:19:03 +01:00
Ivan Krysak fba30712cc ABI: introduce abi::FunctionType::filterTypes 2023-03-15 10:19:03 +01:00
Ivan Krysak a0adafeab0 ABI: take advantage of register state deductions
This makes the conversions more robust, since everything can rely on
the same tools for filling in missing registers and ordering them based
on the ABI requirements.
2023-03-15 10:19:03 +01:00
Ivan Krysak 1d1003b7e5 ABI: introduce TypeBucket helper 2023-03-15 10:19:02 +01:00
Ivan Krysak 8a1d62728d ABI: remove constexpr abi trait 2023-03-15 10:19:02 +01:00