Commit Graph

2366 Commits

Author SHA1 Message Date
Alessandro Di Federico dee2cf0d04 Reimplement the reaching definition analyses
This commit reimplements the (conditional) reaching definitions passes
as an instance of a monotone framework.

The `ConditionNumberingPass` has also been reworked in the way it
exposes its results, but it's otherwise unchanged.

A proper unit testing framework is also available to ensure everything
works as supposed to.
2018-10-16 17:39:22 +02:00
Alessandro Di Federico b6ee8480da Extend MonotoneFrameworkSet
This commit simply adds a couple of handy methods to
`MonotoneFrameworkSet` such as `begin`, `end`, `erase`, `erase_if`,
`contains` and `size`.
2018-10-16 16:55:12 +02:00
Alessandro Di Federico f305541d5e Introduce MonotoneFramework::handleEdge
In a `MonotoneFramework` it is sometimes necessary to change the
information propagated on a branch w.r.t. another branch.

This commit introduces the `handleEdge` function that allows
`MonotoneFramework` implementors to modify the `LatticeElement` produced
by `transfer`.
2018-10-16 16:52:24 +02:00
Alessandro Di Federico 873dd13dd5 Introduce dumpModule
`dumpModule` is a debug function that can be called from GDB to dump a
`Module *` to a chosen path.
2018-10-16 16:51:52 +02:00
Alessandro Di Federico e80b05a48e Move MonotoneFramework.h to libSupport
`MonotoneFramework.h` has been moved into `include/revng/Support` so
that it can be employed by components outside `libStackAnalysis`.
2018-10-16 16:25:29 +02:00
Alessandro Di Federico cc02713f6d Abandon argparse in favor of LLVM's CommandLine
This commit dismisses the `argparse` library (the only non-runtime C
component of rev.ng) in favor of LLVM's CommandLine library, which
offers several benefits. Among others, now command line arguments can be
easily specified as a global variable, decentralizing their management
and avoiding the long list of arguments in the constructor of singleton
objects such as `CodeGenerator`.
2018-10-03 23:11:13 +02:00
Alessandro Di Federico 43cf36bfce Introduce revng_log and abandon DBG(...)
This commit introduces `revng_log`, a macro analagous to `revng_assert`,
which basically allows to have the benefit of the `Logger` class without
having to compute the expression to log if the logger is disabled.

This commit also completely dismisses the `DBG` macro, converting all
the old code to `Logger` + `revng_log`.
2018-10-03 23:11:13 +02:00
Alessandro Di Federico cf8d6d530e Whitespaces and other minor fixes 2018-10-03 23:11:12 +02:00
Alessandro Di Federico 076aeac7f3 Move and rename all files
This commit moves around most files. The new directory structure is as
follows:

* `lib/$LIBRARY/`: contains a library, i.e., a set of `.cpp` files used
  by multiple libraries/tools.
* `include/revng/$LIBRARY/`: contains the public headers associated to
  the library in `lib/$LIBRARY/`.
* `tools/$TOOL/`: directory where all the `.cpp` files (and private
  headers) for a tool reside. Currently we have two tools: `revamb` and
  `revamb-dump`.

On top of this, all file names are now in camel case.
2018-10-03 23:11:12 +02:00
Alessandro Di Federico 386492e8fe Fix definition of ID for templated passes
`FunctionPass` has a static field `ID`. In templated passes, this needs
to be declared in the header file and defined in a `.cpp` file.

This does this, the right way.
2018-09-29 16:50:36 +02:00
Alessandro Di Federico e74ee1431d Enforce struct/class usage coherency 2018-09-29 13:05:16 +02:00
Alessandro Di Federico f819962527 Switch to new assertion system globally
This commit enforces on the whole project the usage of our own assertion
system. This means all calls to `abort`, `assert` and `llvm_unreachable`
have been replaced with calls to `revng_abort`, `revng_assert` and
`revng_unreachable`, respectively.

The error messages, usually expressed as `assert(Condition &&
"Message")` have now been replaced using the second (optional) argument
of `revng_assert`.

Additionally, all the `assert(false)` statements have been replaced with
calls to `revng_abort`. Apart from readibility, this ensures the
compilers is aware of the fact that call will never return.

This change will enable us to drop many statements whose sole purpose
was marking a variable employed in an assertion as used in release
mode. In fact, with the new assertion system this is no longer
necessary.
2018-09-29 13:05:16 +02:00
Alessandro Di Federico e053b215d8 Drop _ prefix in include guards
We used to have a `_` prefix for include guards macros, however,
according to the standard, macros starting with an underscore are
reserved. This commit drops them all.
2018-09-26 08:59:59 +02:00
Alessandro Di Federico 047ae0d4d8 Apply clang-format globally
This commit applies our `clang-format` rules globally. From now on, all
commits should respect our configuration file.

Pretty large change.
2018-09-21 20:08:45 +02:00
Alessandro Di Federico 384c317ef1 Introduce using to increase readibility
This commit introduces `using` statements and `constexpr` functions to
increase readibility of various types.
2018-09-21 20:05:18 +02:00
Alessandro Di Federico 7fe00c08dd Rewrite the stack and introduce the ABI analyses
This is a very large commit importing the reviewed (and heavily
simplified) stack analysis and the new ABI analysis, which provides
information on the calling convention of each function and so on.

For an overview of the new analyses please consult OVERVIEW.md.
2018-09-18 15:58:20 +02:00