Commit Graph

70 Commits

Author SHA1 Message Date
Alessandro Di Federico 143c315196 Merge revng-c into revng 2024-11-21 10:50:55 +01:00
Alessandro Di Federico 2e4f4d09b9 Remaining FunctionTags have been moved to revng 2024-11-04 15:09:56 +01:00
Alessandro Di Federico 800340d6e8 IRHelpers.cpp has been moved to revng 2024-11-04 15:09:56 +01:00
Ivan Krysak 1a35cbcb77 Introduce PTMLCTypeBuilder 2024-10-15 10:45:13 +03:00
Alessandro Di Federico ca99bbbb66 Adopt toString() 2024-09-26 17:51:08 +02:00
Alessandro Di Federico 0cb3eedd37 Do not use CallBase::getCalledFunction
Use our wrapper, which does not return nullptr if the `FunctionType`s do
not match.
2024-08-07 15:40:56 +02:00
Ivan Krysak 94a0ad6b93 Adopt reworked model::Type 2024-06-27 11:07:01 +02:00
Ivan Krysak c2b4fb70bb Model: rename TypePath to DefinitionReference 2024-06-27 11:07:01 +02:00
Ivan Krysak 3705906074 Model: rename Type into TypeDefinition 2024-06-27 11:07:01 +02:00
Alessandro Di Federico 5186a58053 s/FunctionMetadata/ControlFlowGraph/ 2024-06-18 17:56:24 +02:00
Alessandro Di Federico 0c212b66d9 Relicense to MIT 2024-02-29 17:03:36 +01:00
Pietro Fezzardi 0a90048663 DLA: recursively update nested struct types
This enables e.g. updating nested structs representing Sections inside
Segments.
2024-02-08 18:09:12 +01:00
Pietro Fezzardi fa48e50403 DLA: simplify fillStructWithRecoveredDLATypes
The function now takes 2 arguments less.
2024-02-08 18:09:12 +01:00
Pietro Fezzardi f7eed33dac DLA Backend: only emit valid model::PrimitiveTypes
Before this commit, DLA didn't do any checks on the validity of the
model::PrimitiveTypes that it generated.
This could cause invalid PrimitiveTypes to be generated, with weird
sizes not supported by the Model.
This commit fixes this problem, generating empty model::StructTypes with
the proper sizes instead.
2024-02-04 16:07:31 +01:00
Pietro Fezzardi 24cb43ce9c Make RawFunctionType::StackArgumentsType a TTR
This is homogeneous with all other nullable references to types in the
model, such as the StackFrameType in model::Function, and others.
2023-12-05 16:56:52 +01:00
Pietro Fezzardi 842b5e1075 Make Segment::Type a TupleTreeReference
This is homogeneous with all other nullable references to types in the
model, such as the StackFrameType in model::Function, and others.
2023-12-05 16:56:52 +01:00
Pietro Fezzardi 75aff6a4a9 DLA: always copy fields when updating Model
Before this commit, DLA's backend often emitted things like:

```c
struct x {
  struct y {
    int32_t z;
    uint8_t padding[4];
  } _offset_0;
  uint8_t padding[8];
};
```

This is suboptimal, since the fields of y actually can just be inlined
into x, giving:

```c
struct x {
  int32_t z;
  uint8_t padding[12];
};
```

This behaviour was due to a logic bug carried over from old versions of
the code, and partially extended, but never revisited nor thought
through.

This commit fixes the problem, making the second behaviour the only
thing DLA ever does when updating the model.
Basically, struct fields are copied over field by field, instead of
inserting the bulk struct (y in the example) inside the larger struct to
update (x in the example).
2023-10-18 15:19:52 +02:00
Alessandro Di Federico cb8aa3d929 Adopt .prototype()
Also adopt `QualifiedType::getFunctionType` where appropriate in order
to unwrap typedefs.
2023-10-05 19:18:38 +02:00
Alessandro Di Federico cae213b36b Minor changes 2023-10-05 18:45:17 +02:00
Alessandro Di Federico 489dddd0e7 TupleTreeReference::isValid is for assertions only 2023-08-23 16:37:39 +02:00
Pietro Fezzardi f3bec5673a DLA: emit NonScalar nodes as StructTypes 2023-08-21 16:18:31 +02:00
Ivan Krysak 2987b5621b Model: update constuctors with an extra field 2023-07-21 04:58:50 +00:00
Ivan Krysak b0dcc3d9ee Formatting: forbid clang format off 2023-07-05 14:33:06 +02:00
Ivan Krysak 888e5371eb Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-05 06:06:07 +00:00
Giacomo Vercesi a4ad571e61 rcc: Fix typos
Fix the typos detected by `codespell`
2023-05-11 10:04:32 +02:00
Ivan Krysak d08c9387d2 DLA: stop updating aggregate return value types 2023-03-15 10:28:24 +01:00
Massimo Fioravanti 87aef3fbad revng-c now uses Model accessors 2022-12-12 11:35:52 +01:00
Pietro Fezzardi a72f24ef5a DLAUpdateModelTypes.cpp: fix update of stack frame 2022-12-05 17:03:21 +01:00
Pietro Fezzardi d3f2584158 DLA: fully support update of CABIFunctionTypes 2022-11-30 18:16:13 +01:00
Pietro Fezzardi 1af6c75fc5 DLAUpdateModelTypes.cpp: new assertions & comments 2022-11-30 11:37:00 +01:00
Massimo Fioravanti 335d402245 Change signatures to forward metadata cache. 2022-11-22 12:27:02 +01:00
Antonio Frighetto 9aa9007f18 DLA/Backend: do not add new overlapping fields
Make sure we do not introduce new fields that overlap the
original ones, should they exist.
2022-11-03 14:47:47 +01:00
Pietro Fezzardi 84d427d240 DLAMakeModelTypes: emit Generic instead of Number 2022-09-29 18:38:11 +02:00
Pietro Fezzardi c5236310a9 Use uint64_t only in dla::OffsetExpression
Before this commit we were using int64_t for Offset, Strides, and
TripCounts.

Originally, this choice was intended because for some time we envisioned
actually having a use for negative values, but in the end we decided
there's no use for those.

This commit switches all to unsigned integers, allowing to remove some
static_cast across the codebase, and overall easing typicall computation
we have to perform on those fields.
2022-09-29 18:38:11 +02:00
Antonio Frighetto a7ddddce92 DLA: recover model::Segment type
DLA now handles `segmentRef` opaque function calls.
2022-07-19 13:51:06 +02:00
Alvise de Faveri 16fba5be15 DLA: Never create a new type for the stack 2022-06-13 15:20:07 +02:00
Pietro Fezzardi 31419a5fd1 Remove old unused dla::Layout class
This class was introduced before having model::Type, to represent
roughly the same information.

Now it's dead code and this commit removes it.
2022-05-26 16:46:47 +02:00
Pietro Fezzardi 3e78b3c9e6 DLA: fix handling of Functions without stack args 2022-05-25 17:23:42 +02:00
Alessandro Di Federico 2e434dbd7e DLA: relax handling of stack arguments
This commit improves how DLA commits its results into
`model::RawFunctionType::StackArgumentsType`.
2022-05-03 21:48:07 +02:00
Giacomo Vercesi ab125b35b0 Fix License headers
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
2022-04-19 12:17:59 +02:00
Pietro Fezzardi 36541ae5cd QualifiedType RawFunctionType.StackArgumentsType 2022-04-08 17:58:06 +02:00
Giacomo Vercesi da06acf29e Update to reflect removal of tags from model YAML 2022-04-08 17:57:23 +02:00
Antonio Frighetto 765219d58c Support for control-flow graph out of the model
The control-flow graph has been taken out of the model. Related changes
to `getCallSitePrototype` have been here addressed.
2022-04-06 16:25:05 +02:00
Pietro Fezzardi 0796e00d71 DLAMakeModelTypes: fix array fields 2022-03-28 09:51:01 +02:00
Alvise de Faveri ddf8adca70 DLA: drop ModelFuncHelpers and use shared ones 2022-03-22 10:55:16 +01:00
Pietro Fezzardi f69f68fe35 DLA: dump .dot for debug in dla::StepManager
Before this commit, each dla::Step handled the printing of its own .dot
files for debug.
This commit moves the logic for dumping the .dot files into the main
loop of dla::StepManager, guarding it with a single Logger.
2022-03-22 10:48:03 +01:00
Pietro Fezzardi 9f1bbc8b49 Drop deprecated \brief Doxygen directive
\brief is a stupid feature that we should stop using:
https://lists.llvm.org/pipermail/llvm-dev/2015-May/085152.html
2022-03-22 10:48:03 +01:00
Pietro Fezzardi 3678e4f730 DLA: completely remove Inheritance edges 2022-03-21 17:08:46 +01:00
Pietro Fezzardi c98794d9b0 Rework DLAMakeModelTypes to fix several bugs
Before this commit, DLAMakeModelTypes was generating broken types in
several corner cases involving unions with children at offset different
than zero, and strided accesses.

This commit fixes these issues and reworks the pass to also consider
strides and model::Qualifiers in the correct order.
2022-03-21 09:48:26 +01:00
Pietro Fezzardi c3cf053b58 DLAMakeLayouts: fix order of strides 2022-03-21 09:40:31 +01:00