- Aug 12, 2017
-
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
`GeneratedCodeBasicInfo` now exposes the instruction alignment of the current architecture, the stack pointer register, the size of the PC register, a reference to `anyPC` and correctly handles the `DispatcherFail` basic block.
-
Alessandro Di Federico authored
This commit extendes the FunctionCallIdentification pass to identify, for each function call, where the return address is stored, i.e., the link register. If the the return address is stored on the top of the stack then the link register is `nullptr`. This information is encoded as an extra argument to the marker `function_call`. This commit also makes the pass ignore dispatcher-related basic blocks and ensures that calls to `function_call` are placed *before* calls to `exitTB` so that they won't get purged.
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
Most of the times, when we need to get the next instruction, we actually want to skip over "marker" function calls (e.g., calls to `newpc` and `function_call`). `nextNonMarker` does exactly this. `FunctionCallIdentification::isCall` and `JumpTargetManager::setCFGForm` have also been extended to correctly handle such situations.
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
Serialization (in the form of the `revamb.jt.reasons` metadata) of the reason why a certain address is a jump target has been moved from `JumpTargetManager::finalizeJumpTargets` to a new function (`JumpTargetManager::createJTReasonMD`) which is invoked after the function boundaries detection algorithm has been run.
-
Alessandro Di Federico authored
`JumpTargetManager::translateIndirectJumps` has been pushed into `JumpTargetManager::finalizeJumpTargets`. Moreover, an safety check about the removal of `exitTB` has been introduced.
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
The basic block handling the default case of the dispatcher used not to be tagged with `revamb.block.type`, now it is.
-
Alessandro Di Federico authored
This commit introduces the `head` and `clear` methods for `QueueImpl` (i.e., `UniquedQueue` and `OnceQueue`).
-
Alessandro Di Federico authored
* QuickMetadata has been expanded to get a `MDString` or a `MDTuple` from a `StringRef`. * Introducing `skipCasts`, which, given a `Value`, returns the innermost part of the expression, skipping over casts. * Introducing `isCallTo`, which, given an `Instruction`, returns whether it's a call to a specific function or not. `getCallTo` is a sister function to be used in `if` statements. * Moving `skip` and `erase_if` in `ir-helpers.h` so that all the translation unit can benefit from their usage.
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
`alloca` instruction are passed as variadic arguments to `newpc` to prevent the optimizer from moving code around them. We used to cast them all to `i8*`, however these casts where breaking the convention of having all the `alloca` instructions at the beginning of the function. Since these casts were not really necessary, they have now been dropped.
-
Alessandro Di Federico authored
-
- Aug 01, 2017
-
-
Alessandro Di Federico authored
This commit introduces a new metadata (`revamb.jt.reasons`) containing a list of reasons why the initial PC of the current basic block has been identified as a jump target.
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
-
- Jul 07, 2017
-
-
Alessandro Di Federico authored
This commit fixes an assertion triggered by the fact that a segment includes exclusively zero-initialized data (i.e., size on file is 0, memory size is not). In this case LLVM detects the fact that the global variable associated to the segment is composed exclusively composed by 0s and uses a `ConstantAggregateZero` as an initializer instead of a `ConstantDataArray`. Currently the solution is ignore that data, however, in the future it might be beneficial to be able to read data from `.bss`, even if we just have zeros there. Thanks to Thorbjoern Schulz for reporting this bug.
-
- Apr 27, 2017
-
-
Alessandro Di Federico authored
-
- Apr 21, 2017
-
-
Alessandro Di Federico authored
This commit fixes some warnings given by GCC 6.3.0. * Some `assert(false)` are not recognized as `noreturn`ing. They have been replaced with `llvm_unreachable`. * Added `-Wno-ignored-attributes`: attributes are not part the function name mangling, and therefore they might create some problems when they are involved in template arguments. We don't care. * Specializations of `readPointer` functions in `binaryfile.h` are now `inline`, so they don't appear as "unused" functions.
-
- Apr 06, 2017
-
-
Alessandro Di Federico authored
QEMU marks each input instruction with a special pseudo-instruction. This commit makes revamb ignore such instructions coming after a write to a `btarget` variable, which is an indication that a delay slot is starting. In this way, the instruction will look larger and re-translating part of it will not break the branch instruction.
-
- Apr 04, 2017
-
-
Alessandro Di Federico authored
-
- Apr 03, 2017
-
-
Alessandro Di Federico authored
This simple commit should improve performance of the generated program sensibly. Basically all the global variables will have internal linkage from now on (unless the `--external` parameter is specified on the command line). This way, the compiler will be able to avoid load/store instructions when leaving code in the current translation unit.
-
Alessandro Di Federico authored
In `translate -O2` we optimize the LLVM IR both with `llc` and `opt`. However due to a bug in `translate`, `opt` was invoked but its output was never used.
-
Alessandro Di Federico authored
Introduce the `-disable-machine-licm` argument when the `translate` script invokes `llc` with `-O2`.
-
- Apr 02, 2017
-
-
Alessandro Di Federico authored
We used to assert that a `BoundedValue` must not have any entries in the `Bounds` field before translating a `boost::icl` interval to a `BoundedValue`. However, if the `Value` associated to the `BoundedValue` is a `Constant`, we might have an entry in `BoundedValue::Bounds` immediately after constructing the object. This commit fixes this problem by simply updating the assertion and clearing the field before re-populating it.
-
- Mar 31, 2017
-
-
Alessandro Di Federico authored
This commit introduces a docs target which translates `.rst` files into man pages or HTML documents and installs them in `/usr/share/man/man1` or `/usr/share/doc/revamb`.
-
Alessandro Di Federico authored
Update `GeneratedIRReference.rst:` to reflect recent changes to the `root` function. Specifically, the presence of the stack pointer argument and initialization of the program counter and the stack pointer. `FromIRToExecutable.rst` has been updated too, to take into account the new way we link `support.c`. Finally, the `--tracing` argument has been removed from `RevambUsage.rst` and the `-trace` argument is no documented in `TranslateUsage.rst`.
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
-
Alessandro Di Federico authored
To compare strings, `STREQUAL` should be used, not `EQUAL`. This prevented some inaccurate GCC warnings to be considered as non-errors.
-
Alessandro Di Federico authored
While materializing values in SET through the `OperationStack` we used to use as a type the type of the value associate to the currently used `BoundedValue`. This was wrong, this patch uses the type on the free operand on the top of the `OperationsStack` to perform the required computations.
-
Alessandro Di Federico authored
Landing pads are basically the `catch` blocks in C++ `try`/`catch` statements. So far we were missing them since they are encoded in a particular way in a way similar to DWARF debugging information in the `.eh_frame` and, more specifically, in the `.gcc_except_table` sections of ELF programs. This commit parses these sections so that the basic blocks associated to landing pads are correctly identified. Personality functions are detected too. A test is also introduced to assess the effectiveness of our code.
-
Alessandro Di Federico authored
-
- Mar 29, 2017
-
-
Alessandro Di Federico authored
Since we now support disjoint ranges in ORSA, let's test it. This commit also introduces some license disclaimers in tests assembly files.
-
- Mar 23, 2017
-
-
Alessandro Di Federico authored
`OSRA:handleComparison` was too big and complex, it has been mostly rewritten. * Create `OSRA::identifyComparisonOperands` which expands the argument of the comparison in a list of possible values (constants or OSRs). The new way in which we handle possible operands also fixes a bug showing up in case a constant OSR was being compared with an LLVM constant, which was checked for being a tautology/contradiction, preventing the reaching definitions of the operand to be considered too. * Squeeze more information from uge/ugt. Unsigned comparisons lead to two pieces information: the result of the comparison itself, and the fact the left-hand side is greather than or equal 0. This secondo information is precious, but we were not able to exploit it in the case the original comparison is already "greater than" or "greater than or equal". In fact, `x - 4 > 10` gives us `x >= 4` and `x > 14`, which boils down to `x > 14`. This commit introduces a change that handles this case as `NOT x - 4 <= 10` leading to the negation of `x >= 4` and `x < 14` which is way more informative. * Improve `OSRA::mergePredicate` and `OSRA::applyConstraints` interfaces. * In case a comparison instructions leads to multiple constraints on the same `Value`, these constraints are now first or-merged together and then propagated. This change improves the quality of the analysis in certain situations.
-
Alessandro Di Federico authored
This commit introduces radically changes the implementation of `BoundedValue`: it no longer represents a single, contiguous range, but an arbitrary number of ranges. The bounds are now represented through a `llvm::SmallVector<std::pair<uint64_t, uint64_t>, 3>`. * Introduce the `BoundedValue::bounds()` method, which allows to iterate over all the ranges that a `BoundedValue` represents. The `bounds` method returns a `Bounds` object, which can be used as a range composed by `BoundsIterator`. * All the methods dealing with the `BoundedValue`'s bounds have been rewritten. * New debugging information: "bv-merge". Print all the computations performed by `BoundedValue::mergeImpl`. * Drop dead code: `BoundedValue::setBound` and `isPositive` * Introduce `BoundedValue::isRightOpen` and drop `BoundedValue::isSingleRange`
-
Alessandro Di Federico authored
Some subtle bugs have been fixed in `OSRA::pathSensitiveMerge`: * Do not alter the current `BoundedValue` if merging a component would lead to bottom. * Do not deactivate a reacher in case an incoherent condition is met.
-
Alessandro Di Federico authored
In our reaching definition analysis we used to consider all the loads not reached by any store as definitions. However we forgot to actually register them as such, with the result that two consecutive loads from the same CSV would end up being two free loads.
-