Commit Graph

2366 Commits

Author SHA1 Message Date
Alessandro Di Federico 1cd17a13e8 readFromPointer: use bool IsLittleEndian 2022-03-08 12:25:47 +01:00
Alessandro Di Federico 75b5620703 Introduce OverflowSafeInt 2022-03-08 12:25:47 +01:00
Alessandro Di Federico f44363f621 Introduce TemporaryFile 2022-03-08 12:25:47 +01:00
Alessandro Di Federico af79107b8b Move Integral concept to Concepts.h 2022-03-08 12:25:35 +01:00
Alessandro Di Federico 7c515ff997 Use std::string for MaterializedValue::SymbolName 2022-03-08 12:25:35 +01:00
Pietro Fezzardi 269d729554 FilteredGraphs: add filter() method
The method allows to access the filter function and is useful for
templating.
2022-03-02 15:40:27 +01:00
Alvise de Faveri 0659e6b6a3 Model: Improve getCallSitePrototype() helper
1. Hoist the logic to retrieve a model CallEdge from an llvm::CallInst
   out of `getCallSitePrototype()`, in a separate `getCallEdge()`
   function.
2. Modify `getCallSitePrototype()` so that the parent function's type is
   optional.
2022-03-02 15:40:27 +01:00
Alvise de Faveri ea53846fa0 Add Qualifier::createPointer(Architecture) 2022-03-02 15:40:27 +01:00
Alvise de Faveri 62b5ec38cd Add CallEdge::isDirect() 2022-03-02 15:40:27 +01:00
Antonio Frighetto e798131082 O2Pipe: fix pipe name 2022-03-02 15:40:27 +01:00
Massimo Fioravanti b982b69c5d revng-model-inject: support model-less modules
Inject is meant to inject a model into an `llvm::Module`, but it fails
when operating on a Module that had no model metadata.

This commit fixes the bug.
2022-03-02 15:40:27 +01:00
Pietro Fezzardi cb51965f6e DLAComputeNonInterferingComponents: fix moveEdges
This DLAStep was moving edges improperly before this commit.
In particular, edges were detected solely looking at source and target
edge, not looking at the edge itself. This was leading to wrong results
whenever a node N1 had many outgoing edges to a child node N2, at
different offsets, where all the edges were moved instead of just the
correct ones.

In order to fix this, this commit:
- reworks the logic of `moveEdges`, switching to iterator-based logic
- reworks the struct OrderedChild used internally by
  DLAComputeNonInterferingComponents, so that it is also iterator-based
- re-uses common code for field size computation
2022-03-01 12:52:58 +01:00
Pietro Fezzardi 5cdc63cda6 Apply new revng coding conventions 2022-02-28 18:02:25 +01:00
Alessandro Di Federico 984aea88ae Minor changes 2022-02-25 00:32:46 +01:00
Ivan Krysak 868970c5e7 ABI: specify stack alignment 2022-02-25 00:32:01 +01:00
Ivan Krysak fca0df8dd2 ABI: specify who's responsible for stack cleanup 2022-02-25 00:31:37 +01:00
Ivan Krysak 2c35fc87d5 Conversion to RawFunctionType cannot fail 2022-02-25 00:31:14 +01:00
Ivan Krysak b14fee7515 Implement abi::FunctionType::layout()
The `Layout` data structure works as a common view over
`RawFunctionType` and `CABIFunctionType`.
2022-02-25 00:30:14 +01:00
Ivan Krysak 541643afc3 Move function type conversion to librevngABI 2022-02-24 23:56:30 +01:00
Filippo Cremonese 8511cbf40b tuple_tree_generator: drop tags
They were more harmful than beneficial.
2022-02-23 17:36:34 +01:00
Alessandro Di Federico 10dc6744b4 mv include/revng/{Model,TupleTree}/EnumTraits.h
`EnumTraits.h` is not model-specific.
2022-02-23 17:32:50 +01:00
Ivan Krysak 242b885a78 Remove obsolete ABI utilities 2022-02-14 13:35:37 +01:00
Ivan Krysak 371f5c4555 Implement ABI-based register state deductions
This will help EarlyFunctionAnalysis in providing more accurate results,
in case assumptions about the ABI can be made.
2022-02-14 13:35:37 +01:00
Ivan Krysak 9771ae29d6 Move RegisterState to ABI 2022-02-14 13:35:37 +01:00
Ivan Krysak cafe44097b ABI: introduce default function type generation 2022-02-14 13:35:37 +01:00
Ivan Krysak 8d876b0def ABI: introduce bulk function conversion 2022-02-14 13:35:37 +01:00
Ivan Krysak e20e65ca9a Require a description when registering a pass 2022-02-14 13:35:36 +01:00
Ivan Krysak 7369e49eba Implement "best effort" function type convertion 2022-02-14 13:35:36 +01:00
Ivan Krysak 5c671e8446 Add abi::Trait specialization for s390x ABI 2022-02-14 13:35:36 +01:00
Ivan Krysak 75c00f5112 Add abi::Trait specialization for mips ABI 2022-02-14 13:35:36 +01:00
Ivan Krysak c9daab2ce4 Add abi::Trait specializations for arm ABIs 2022-02-14 13:35:36 +01:00
Ivan Krysak 4069d547b6 Add abi::Trait specializations for x86 ABIs 2022-02-14 13:35:36 +01:00
Ivan Krysak 756d0f7376 Add abi::Trait specializations for x86_64 ABIs 2022-02-14 13:35:36 +01:00
Ivan Krysak d30c4c54fb Introduce trait to describe ABIs 2022-02-14 13:35:36 +01:00
Ivan Krysak 68129c9221 Add model::Binary::DefaultABI field 2022-02-14 13:35:36 +01:00
Ivan Krysak d108f7f049 Extend model::ABI enumeration 2022-02-14 11:28:36 +01:00
Ivan Krysak c14567e3d0 Make TupleTree::visitReferences public 2022-02-14 11:28:36 +01:00
Ivan Krysak fd3e7243c1 Remove an unused parameter from TupleTree::clone 2022-02-14 11:28:36 +01:00
Ivan Krysak ec625e8533 Define architecture-specific register access 2022-02-14 11:28:36 +01:00
Ivan Krysak 9b7eb76ac4 Introduce enumSwitch 2022-02-14 11:28:36 +01:00
Ivan Krysak 3bb266125c Add always_true and always_false traits 2022-02-14 10:57:10 +01:00
Ivan Krysak a21dff02de Add additional registers to the model 2022-02-14 10:57:00 +01:00
Ivan Krysak 7151c587f9 Prevent TupleTreeReference::isValid() asserts 2022-02-14 10:56:50 +01:00
Ivan Krysak dfeb437b45 Fix a minor convertible_to concept issue 2022-02-14 10:56:40 +01:00
Alessandro Di Federico 806f076709 Minor changes 2022-02-14 09:39:44 +01:00
Alvise de Faveri 1a39994759 Add HelpersToHeader pass 2022-02-10 17:12:56 +01:00
Alvise de Faveri 73c743597b Pull out DepGraph and naming from ModelToHeader
Separate `ModelToHeader.cpp` into 3 different files:

1. DependencyGraph, used to calculate the precedence between
   type declarations
2. ModelTypeNames, that holds all the naming logic, whose
   primitives are accessible from other modules through a
   public header
3. ModelToHeader, that now contains only the logic to print
   out declarations and definitions

Also add a compilation test for the headers generated by this pass.
2022-02-10 17:12:56 +01:00
Alvise de Faveri 70724920bb Move ModelToHeader to HeadersGeneration 2022-02-10 17:12:56 +01:00
Alvise de Faveri 6411302bfd Fix handling of dispatcher fallthrough in Tiling
**Symptoms**: a correct visit of the GHAST resulted in an incorrect
visit order of the CFG (some instructions were visited before their
operands)

**Causes**: When creating the tile of a dispatcher with an inline
successor and a fallthrough, the predecessors of the dispatcher
were correctly connected to the new tile, but the fallthrough
was not, leading to a split in the GHAST between nodes that should
have been connected

**Solution**: Setting `PostDomBB = Fallthrough` if there is a
fallthrough just before calling `createTile()` corrects
this behavior, connecting the tile to its fallthrough node
2022-02-09 18:53:12 +01:00
Alvise de Faveri 7b144b2556 Don't upgrade while and doWhile in the GHAST
We should never be changing the nature of a `while` node into a
`doWhile` and vice-versa: we only upgrade standard nodes in
either a `while` or a `doWhile`.
2022-02-09 18:53:12 +01:00