Skip to content
Snippets Groups Projects
  1. Aug 12, 2017
  2. Aug 01, 2017
  3. Jul 07, 2017
    • Alessandro Di Federico's avatar
      Handle `.bss`-only data segment · 9db62b28
      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.
      9db62b28
  4. Apr 27, 2017
  5. Apr 21, 2017
    • Alessandro Di Federico's avatar
      Fix GCC 6.3.0 warnings · 24c1df35
      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.
      24c1df35
  6. Apr 06, 2017
    • Alessandro Di Federico's avatar
      Merge delay slots into branch instruction · f92ccfa5
      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.
      f92ccfa5
  7. Apr 04, 2017
  8. Apr 03, 2017
    • Alessandro Di Federico's avatar
      Set CSVs linkage to internal · e0315833
      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.
      e0315833
    • Alessandro Di Federico's avatar
      Bugfix: use `opt` output in `translate` · e01f0cc2
      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.
      e01f0cc2
    • Alessandro Di Federico's avatar
      Disable slow backend optimization · 12ed8219
      Alessandro Di Federico authored
      Introduce the `-disable-machine-licm` argument when the `translate`
      script invokes `llc` with `-O2`.
      12ed8219
  9. Apr 02, 2017
    • Alessandro Di Federico's avatar
      OSRA: clear `BoundedVvalue::Bounds` before merging · 0ba8bb80
      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.
      0ba8bb80
  10. Mar 31, 2017
    • Alessandro Di Federico's avatar
      Install documentation · d4168436
      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`.
      d4168436
    • Alessandro Di Federico's avatar
      docs: reflect recent changes to `root` and linking · 89d49789
      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`.
      89d49789
    • Alessandro Di Federico's avatar
      3c2e7791
    • Alessandro Di Federico's avatar
      Minor fixes to make clang happy · bfcd5044
      Alessandro Di Federico authored
      bfcd5044
    • Alessandro Di Federico's avatar
      Fix typo in CMakeLists.txt · e540400f
      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.
      e540400f
    • Alessandro Di Federico's avatar
      SET: use the appropriate type while materializing · 6d9b0c43
      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.
      6d9b0c43
    • Alessandro Di Federico's avatar
      Detect `try`/`catch` landing pads · d8f13c79
      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.
      d8f13c79
    • Alessandro Di Federico's avatar
      c81dd323
  11. Mar 29, 2017
  12. Mar 23, 2017
    • Alessandro Di Federico's avatar
      Rewrite `OSRA::handleComparison` · 66ef40f9
      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.
      66ef40f9
    • Alessandro Di Federico's avatar
      `BoundedValue`: support for multiple ranges · 5b8fb1af
      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`
      5b8fb1af
    • Alessandro Di Federico's avatar
      Improve `OSRA::pathSensitiveMerge` · 4089c203
      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.
      4089c203
    • Alessandro Di Federico's avatar
      `ReachingDefinitionsPass`: free loads are definers · 1d967349
      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.
      1d967349
Loading