Commit Graph

1064 Commits

Author SHA1 Message Date
Alessandro Di Federico a6abb1ebd1 tmp 2021-05-12 09:20:43 +02:00
Alessandro Di Federico c0dc0e85be [REWORD] Fix dispatcher.external 2021-05-11 21:52:42 +02:00
Alessandro Di Federico b0e82f709e [REWORD] Fix AVI 2021-05-11 21:52:22 +02:00
Alessandro Di Federico 9be97248ce Reorganize VariableManager
This commit slightly improves VariableManager's API and, most
importantly, undef-initializes all TCG variables in order to avoid
creation of complex PHIs.
2021-05-08 19:27:57 +02:00
Alessandro Di Federico cfddcceb3e IRHelpers: non-const getModule(...) 2021-05-08 19:27:57 +02:00
Alessandro Di Federico 82260c2693 Make dumping assembly and PTC optional
Output files can become *very* large.

This commit disables by default dumping disassembled instructions and
PTC code into the IR.
2021-05-08 19:27:57 +02:00
Alessandro Di Federico 91991bb694 Handle PHIs in lifted code
In large binaries PHI nodes show up. As a consequence, calls to `newpc`
are no longer the first instruction.

This commit uses the `getFirstNonPHI` method to fix this issue.
2021-05-08 19:19:41 +02:00
Alessandro Di Federico c04a30e703 Model: fake functions have no blocks 2021-05-08 11:39:10 +02:00
Alessandro Di Federico 1ac2884f2e Handle blocks ending with unreachable
Sometimes basic blocks end with an
2021-05-08 11:39:10 +02:00
Alessandro Di Federico 871931b9cd Test TupleTreeDiff on Model
`TupleTreeDiff` was not being tested.

This commit implements several `operator==` that are required to
successfully instantiate `TupleTreeDiff`.
2021-05-06 15:42:16 +02:00
Alessandro Di Federico e62f888381 Drop KeyTraits
This commit drops the KeyTraits in favor of a std::any-like solution.
Basically, we type erase any key the user wants to employ, just exposing
a virtual version of the destructor, a comparison operator and a clone
primitive.
2021-05-06 15:42:00 +02:00
Pietro Fezzardi b58693b8e8 RecursiveCoroutine: enable direct continuation
Before this commit, the execution logic of RecursiveCoroutine used an
underlying std::stack allocated on the heap to hold all the
coroutine_handles. It also manually managed passing return values from
callees to callers.

This commit drops this unnecessary auxiliary stack.
When a RecursiveCoroutine co_awaits another one, the handle of the
awaiter is injected into the awaitee, so that when the awaitee is done
it can directly execute the remaining part of the awaiter as a
continuation.
2021-05-05 17:48:04 +02:00
Alessandro Di Federico bca502aeaa Merge branch 'feature/extend-model' 2021-05-05 17:13:16 +02:00
Alessandro Di Federico 7e637beef3 Import static TupleTree validation routines 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 9650369fa7 Import TupleTree and TupleTreeReference 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 0d77258109 Introduce HasKeyObjectTraits concept 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 508bc4eb00 Minor changes 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 6fd8a87572 TupleTree, visit: rename and make more usable 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 51682eb024 model::FunctionEdge: carve out CallEdge 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 582dee6fcc TupleTree: support UpcastablePointer 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 702f4230ac Import UpcastablePointer 2021-05-05 17:10:12 +02:00
Alessandro Di Federico a6468d8d22 Minor changes 2021-05-05 17:10:12 +02:00
Pietro Fezzardi 50681284c0 Conceptify revng
Use concepts across revng wherever possible, to keep the code concise
and easier to understand.
2021-05-05 17:10:12 +02:00
Alessandro Di Federico dde698e201 Merge branch 'feature/inline-helpers' 2021-05-03 18:32:06 +02:00
Alessandro Di Federico 2c7fa21065 Enable -inline-helpers 2021-04-30 14:52:25 +02:00
Alessandro Di Federico 0c671ea7ae Introduce RemoveExceptionalCalls
RemoveExceptionalCalls is a simple pass whose goal is to drop all the
calls to functions marked as `Exceptional` and replace them with an
`UnrechableInst`.

This is mainly useful in the decompilation pipeline.
2021-04-30 14:52:25 +02:00
Alessandro Di Federico ce87c30490 Introduce InlineHelpers
InlineHelpers is a simple pass that recursively inlines all the
functions belonging to the section `revng_inline` in isolated functions.
2021-04-30 14:52:25 +02:00
Pietro Fezzardi b6327b0526 PromoteCSVs: fix CSV list initialization 2021-04-30 14:52:25 +02:00
Pietro Fezzardi 223d022968 replaceFunction: preserve metadata 2021-04-30 14:52:25 +02:00
Alessandro Di Federico 96a3cb83d3 Merge branch 'feature/function-tags' 2021-04-23 09:37:26 +02:00
Alessandro Di Federico 53f6328507 Introduce PromoteCSVs
This commit takes out of EnforceABI the part taking care of creating
wrappers for calls to helpers and promoting CSV to local variables.
This decoupling, enables to run -promote-csvs multiple times, for
instance after inlining.
2021-04-22 18:07:24 +02:00
Alessandro Di Federico 2e9c2ee275 Introduce FunctionTags
FunctionTags goal is to solve the long-standing problem of identifying
what type of function are we dealing with. Is it a lifted function? An
helper?

Now we have a sane way to determine this using Metadata and a proper
API.
2021-04-22 18:07:24 +02:00
Alessandro Di Federico e166ccf860 Merge branch 'feature/llvm-11-preparation' 2021-04-22 18:06:55 +02:00
Alessandro Di Federico 2ea5723a53 s/getCalledValue/getCalledOperand/g 2021-04-22 18:06:27 +02:00
Alessandro Di Federico aeb81c4218 Don't implicitly use StringRef as std::string 2021-04-22 18:06:27 +02:00
Alessandro Di Federico d6df9b682f Use MaybeAlign 2021-04-22 18:06:27 +02:00
Alessandro Di Federico bd3e048647 CPUStateAccessFixer: do not call delete directly 2021-04-22 18:06:27 +02:00
Alessandro Di Federico e92cbd91a1 LoadInst::LoadInst: pass pointee type 2021-04-22 18:06:27 +02:00
Alessandro Di Federico 93ef716311 Module::getFunction returns Function * 2021-04-22 18:06:27 +02:00
Alessandro Di Federico 90c93bfc26 Do not include PassSupport.h directly 2021-04-22 18:06:27 +02:00
Alessandro Di Federico 1e8c43b1d5 PCH::store: pass IRBuilder by reference 2021-04-22 18:06:27 +02:00
Alessandro Di Federico fee270b64e Minor changes 2021-04-22 18:06:27 +02:00
Alessandro Di Federico 0fcaf7f065 Merge branch 'feature/improve-performance' 2021-04-22 18:06:09 +02:00
Alessandro Di Federico 3ce9acf198 AVI: ignore function calls
This commit further reduces the time spent in AVI by considering all the
function calls as indirect. In fact, we currently don't handle indirect
jumps whose target is affected by computation happening before a
function call.
2021-04-22 18:05:39 +02:00
Alessandro Di Federico 33fbcd7ac2 AVI: stop backward exploration at dispatcher
This commit greatly improves the performance by ensuring that, when
computing the set of nodes we want to consider for AVI, we do not
traverse the dispatcher.

Doing so, means including *a lot* of irrelevant nodes and wasting a lot
of computation, since the CFG usually is not influenced by stuff
happening before an indirect jump.

In at least a situation the speedup is in the order of 20x, however this
depends on the size of the binary, since traversing the dispatcher means
including all the binary in the computations (as opposed to just the set
of blocks involved in the dataflow to compute a certain expression).
2021-04-22 18:05:39 +02:00
Alessandro Di Federico 84a4aef1ee nodesBetween: introduce ignore list 2021-04-22 18:05:39 +02:00
Alessandro Di Federico a27ee2faa6 Merge branch 'feature/prepare-helpers-inlining' 2021-04-22 18:05:10 +02:00
Alessandro Di Federico 0e21755eb0 Handle more count-leading-zeros helpers 2021-04-22 18:03:53 +02:00
Alessandro Di Federico 618dbf3673 s/CSVsUsedByHelperCall/CSVsUsage/g 2021-04-22 18:03:53 +02:00
Alessandro Di Federico 8c27f2bfcd OpaqueFunctionsPool: enumeration and registration 2021-04-22 18:03:53 +02:00