Commit Graph

987 Commits

Author SHA1 Message Date
Ivan Krysak ce6d9a6dbf Formatting: forbid \brief 2023-07-05 14:33:03 +02:00
Ivan Krysak ee0dc1866d Forbid clang format off 2023-07-03 15:23:10 +00:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00
Ivan Krysak 5779cd878d KOCs: make more STL-like
This adds a couple of newer methods missing from these templates.
2023-07-02 15:06:11 +00:00
Ivan Krysak 4ab4d85ead STLExtras: remove incomplete iterator concepts 2023-07-02 15:06:11 +00:00
Ivan Krysak 690df84eca Concepts: prefer non-strict SpecializationOf
Not every case can benefit from extra liniency, so they were manually
reviewed on a case by case basis.

Additionally, this drops a couple of "this should be a non-strict
specialization" commits, because of a bug with clang
(see the GenericGraph concepts rework commit for more details) as
to avoid confusion (we wouldn't want anyone trying to solve these
"todo"s) until the clang struct type deduction is fixed. Especially
considering that there are currently no cases where these softer
versions would be beneficial (we never inherit from templates in
question).
2023-07-02 15:06:11 +00:00
Ivan Krysak 37b8f80bf1 Concepts: introduce SpecializationOf
It was not available earlier because it required clang-13+
2023-07-02 17:05:52 +02:00
Ivan Krysak b927e26f94 Drop concepts provided by the standard library
We needed these because our libc++ version didn't provide them. Now that
that's no longer the case, they can be safely dropped.
2023-07-02 13:20:49 +02:00
Ivan Krysak a123ec2c35 Remove clang-format off around concepts
Now that clang-format no longer breaks anything involving a concept or
a requires clause on sight, these are no longer necessary
2023-07-02 13:20:49 +02:00
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00
Ivan Krysak 01b4ec36c9 Formatting: set AllowShortEnumsOnASingleLine
The new value is `false`.
2023-07-02 13:15:08 +02:00
Ivan Krysak c523167302 Formatting: enforce access modifier whitespaces 2023-07-02 13:09:52 +02:00
Ivan Krysak 7ed14ca65c Minor improvements 2023-07-02 11:06:55 +00:00
Alessandro Di Federico a65ccc3413 Introduce ValueMaterializer
`ValueMaterializer` is a rewrite of what was called `AdvancedValueInfo`
which follows the same principles.

The main benefits over the old version is:

* We materialize the data-flow graph and the CFG of the relevant part of
  root. This makes debugging significantly easier.
* We drop the old MonotoneFramework infrastructure in favor of
  getMaximalFixedPoint.
* We significantly reduce the amount of queries we make to
  AdvancedValueInfo.
2023-06-30 13:39:22 +02:00
Alessandro Di Federico 4c01d9c28d BidirectionalNode: implement edge removal 2023-06-30 13:38:27 +02:00
Alessandro Di Federico 4edcb6dd49 MetaAddress::decomposeIntegerPC: accept APInt 2023-06-30 13:35:04 +02:00
Alessandro Di Federico 466871e866 Introduce RegisterClobberer 2023-06-30 13:28:36 +02:00
Alessandro Di Federico f120ad334c Statistics.h: rework 2023-06-30 13:06:58 +02:00
Alessandro Di Federico 5e72f8e31b ConstantRangeSet::dump: custom APInt formatter 2023-06-30 12:35:18 +02:00
Alessandro Di Federico 08b8b0bd9f ConstantRangeSet::size: fix corner case
In order to correctly represent the size of a 32-bit ConstantRange, you
need 33 bits.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico b21861b7f9 GraphTraits<GenericGraph>: fix const support
GraphTraits were not fully usable in case of a `const` graph due to a
missing std::conditional_t for the definition of the `Node` type.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico 5ebec631b9 getMaximalFixedPoint: fix Flow argument type 2023-06-30 12:35:18 +02:00
Ivan Krysak e3be901f1f STLExtras: allow skip to result in empty ranges
This only affects the case where the number of elements to be skipped
exactly matches the number of elements in the container.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico d3c37fc692 ProgramCounterHandler::expandNewPC: take CallBase 2023-06-30 12:35:18 +02:00
Alessandro Di Federico 84dd10cbdb GenerichGraph.h: nullptr-initialize Edge::Neighbor 2023-06-30 12:35:18 +02:00
Alessandro Di Federico b53d3f457b Minor changes 2023-06-30 12:35:18 +02:00
Alessandro Di Federico fa61c784c2 Reintroduce st0_x86 as floating point return value 2023-06-23 17:54:16 +02:00
Djordje Todorovic f05c08547d ptml: Introduce PTMLBuilder class
By using this class we can create ptml::Tags without
XML tags. It is useful in the revng-c part when we
want to generate Plain C. All PTML Tags, from now on,
should be created via this class only.

In addition, port `Yield` library to be using this.
2023-06-09 17:15:30 +02:00
Ivan Krysak ec90ac0083 yield::Instruction: add getRelativeAddressBase
This helper computes the architecture-specific base for PC-relative
immediate originating from the given instruction.
2023-05-25 06:36:58 +00:00
Ivan Krysak 37d0a6cd62 yield::Tag: remove obsolete comparator
Due to the specifics of how `SortedVector` works, the comparator in
question was never used - keeping it will only lead to further confusion
2023-05-25 06:36:35 +00:00
Ivan Krysak c21f2649c9 Assembly: introduce new tags
This also reorders the enum, because when two tags collide (they have
the same `from` and `to` points, they are sorted based on the enum
values.

The new order ensures that the values we are more likely to choose
to preserve are closer to the bottom. Since each token can only have one
type associated with it, we choose the lowest one by default.
2023-05-25 06:36:02 +00:00
Ivan Krysak 084bcfa57b yield::Tag: remove a duplicate constructor
`using generated::Tag::Tag` already provides the same one.
2023-05-25 06:25:07 +00:00
Ivan Krysak 02978910b0 STLExtras: introduce zip_pairs skip flavour
I found that it leads to better looking code when the check of whether
the range in question even has enough elements to skip is inside
the helper.

As such a separate type of skip entry point was introduced: one that
allows to iterate over the container pairwise

Now, instead of asserting, the loop just does nothing in cases like
```cpp
for (const auto &Element : zip_pairs(make_empty_range())
  do_stuff();
```
2023-05-25 06:25:07 +00:00
Ivan Krysak 83e48bbc3a LLVMDisassemblerInterface: remove unused argument 2023-05-25 06:25:07 +00:00
Ivan Krysak 5b2af637de Minor Changes 2023-05-25 06:25:07 +00:00
Ivan Krysak c838d2b019 CrossRelations: greatly simplify Relation Targets
This improves readability of the serialized version quite a bit.
2023-05-17 14:08:06 +02:00
Ivan Krysak eae029d156 CrossRelations: merge IsCalledFrom flavors
`IsDynamicallyCalledFrom` is removed in favour of `IsCalledFrom`.

Looking at just how similar the actual uses of both are, there's not
much reason to keep them separate.
2023-05-17 14:08:06 +02:00
Ivan Krysak 641fb61f7b EFA: upgrade buildControlFlowGraph
It now assumes that the nodes of the graph it constructs also require
the function entry point on top of the basic block ID.
2023-05-17 14:08:05 +02:00
Ivan Krysak fade3ec01f CallGraph: switch to pipeline::Location 2023-05-17 14:08:05 +02:00
Ivan Krysak 7322d1a845 ControlFlow: switch to pipeline::Location 2023-05-17 14:08:05 +02:00
Ivan Krysak 50b5abf505 Yield: add isEmpty() helper to graph nodes 2023-05-17 14:08:05 +02:00
Ivan Krysak 045cdefcac GraphLayout: move outside of yield 2023-05-17 14:08:04 +02:00
Ivan Krysak d99b0241e8 Minor improvements 2023-05-17 14:08:04 +02:00
Alessandro Di Federico 739bed3c1d DetectABI: serialize CFG in root
This is done mainly so that downstream passes do not need to run
`CollectCFG` to store information that has already been computed but not
serialized.

This come at the cost of computing the CFG also of functions we don't
want to analyze in `DetectABI`.
2023-05-17 11:17:44 +02:00
Alessandro Di Federico f1f8c217e7 TypeCopier: reset TTR's root pointer after copy 2023-05-17 11:17:35 +02:00
Giacomo Vercesi 31cd2b53f9 rcc: add codespell
Add codespell to the list of checks performed by
revng-check-conventions. This should reduce the amount of typos present
in the revng codebase.
2023-05-11 10:05:32 +02:00
Alessandro Di Federico f562d0373f Importers: fix usage of BaseAddress
This commit ensure the BaseAddress is propagate as appropriate to all
levels of the importers and that it is ignored for executables
(non-PIC).

This was a recurring source of importing the same function twice, once
relocated, once not.
2023-05-10 09:20:40 +02:00
Alessandro Di Federico 73fb1a31c9 Outline TypeCopier
This commit also drop the suggestion that it should be used for copying
prototypes only.
2023-05-10 09:20:15 +02:00
Alessandro Di Federico 579b9a749f Introduce GenericGraph::operator= 2023-05-10 09:17:35 +02:00
Alessandro Di Federico 4c0f809626 Introduce PathList::list 2023-05-10 09:17:35 +02:00