Commit Graph

2366 Commits

Author SHA1 Message Date
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
Giacomo Vercesi a4ad571e61 rcc: Fix typos
Fix the typos detected by `codespell`
2023-05-11 10:04: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
Djordje Todorovic ca7bc2e442 c-backend: Generate Inline Types in PTML
In ModelToHeader generate Inline Types in PTML by handling
Structs, Unions and Enums.

In addition, during the ModelToHeader we avoid producing
Structs that describe stacks, and in the DecompileFunction we
produce the definition of it inline if it is safe (referenced
only once).
2023-05-03 13:13:28 +02:00
Alessandro Di Federico 4b2e067574 rcc: ban functions we wrap 2023-04-28 14:34:52 +02:00
Alessandro Di Federico 4eeb942afb LLVMContainer: outline methods to .cpp 2023-04-28 14:34:49 +02:00
Alessandro Di Federico 8b3f641a29 Rename LLVMGlobalKindBase to LLVMKind 2023-04-28 14:34:49 +02:00
Massimo Fioravanti 4d4b587e1d Drop LLVMGlobalKindBase template argument 2023-04-28 14:34:47 +02:00
Alessandro Di Federico a0dcd176b2 Purge useless headers 2023-04-28 14:34:40 +02:00
Alessandro Di Federico 58b50e6b2a Dismiss LLVMContainerBase 2023-04-28 14:34:39 +02:00
Alessandro Di Federico f68185abc9 Push ParseCommandLineOptions into InitRevng 2023-04-28 14:34:35 +02:00
Alessandro Di Federico 50f396c43d Drop revng.csv in favor of a Tag 2023-04-28 14:04:32 +02:00
Alessandro Di Federico 8af3fd7fa3 LLVMContainer: do not duplicate appending globals
`llvm.global_ctors` and llvm.global_dtors were being cloned
exponentially many times. This was due to their `appending` linkage.
2023-04-28 14:04:32 +02:00
Alessandro Di Federico 2f917a2772 Introduce ModuleStatistics 2023-04-28 14:04:32 +02:00
Alessandro Di Federico 628aa42cc2 Introduce collectTypes 2023-04-28 14:04:31 +02:00
Alessandro Di Federico 170749b0aa Introduce revng::verify 2023-04-28 14:04:31 +02:00
Djordje Todorovic c9b2ffaf72 JumpTargetManager: improve data structures
This commit adopts `llvm::DenseSet`, `llvm::DenseMap` and
`std::unordered_set` where needed.
It also tweaks some `llvm::SmallVector` sizes.

It brings an additional ~3% improvement during lifting.
2023-04-27 19:22:03 +02:00
Ivan Krysak b2916e946f Yield: retire the old Graph 2023-04-27 18:12:52 +02:00
Ivan Krysak a532f738e2 Yield: switch to new layouter invocation style 2023-04-27 18:12:28 +02:00
Ivan Krysak 04cac0018d Yield: introduce new control flow graph type 2023-04-27 18:12:25 +02:00
Ivan Krysak 3774c9a3ab Yield: introduce new call graph type 2023-04-27 18:12:21 +02:00
Ivan Krysak c5805a754a Sugiyama: switch to the new internal graph 2023-04-27 18:10:06 +02:00
Ivan Krysak 52cfbe9523 Sugiyama: introduce new internal graph 2023-04-27 18:09:58 +02:00
Ivan Krysak 4cef969b96 Layout: introduce InputGraph and OutputGraph 2023-04-27 18:09:53 +02:00
Ivan Krysak 28574a87bc Yield: switch to layout's position and size 2023-04-27 18:09:38 +02:00
Ivan Krysak 1c2efd09db Layout: introduce LayoutableGraphTraits 2023-04-27 17:28:22 +02:00
Ivan Krysak 00b450a8c2 Sugiyama: move the namespace under layout
Also removed a few entities to avoid duplication in the full names:
- `yield::layout::sugiyama::LayoutOrientation`
  -> `yield::layout::sugiyama::Orientation`
- `yield::layout::sugiyama::layout(...)`
  -> `yield::layout::sugiyama::compute(...)`
2023-04-27 17:28:22 +02:00
Ivan Krysak 44b9bfd04c Yield: SugiyamaStyle as a part of GraphLayout 2023-04-27 17:28:22 +02:00
Ivan Krysak 268f53cdeb Sugiyama: move the "main" file inside the layouter 2023-04-27 17:28:22 +02:00
Ivan Krysak 6d43876e78 SVG: move one of the sugiyama::layout overloads
It isn't generic enough to be kept in the header, so it was moved
closer to its users.
2023-04-27 17:28:22 +02:00