Commit Graph

6113 Commits

Author SHA1 Message Date
Alessandro Di Federico 61358cd862 Clift: adopt revng pipe for unit testing 2024-06-18 17:56:24 +02:00
Alessandro Di Federico 3dc8cf5e84 Minor changes 2024-06-18 17:56:24 +02:00
Alessandro Di Federico 903646ebd6 Merge branch 'feature/backup-restore' 2024-06-18 17:54:58 +02:00
Pietro Fezzardi b6c64c3d5a Merge branch feature/fix-dla-accesses-hierarchical 2024-06-18 11:20:26 +02:00
Pietro Fezzardi 4fc37fe7eb DLA: improve ArrangeAccessesHierarchically logs 2024-06-18 11:19:50 +02:00
Pietro Fezzardi 64d41a9b1d DLA: fix ArrangeAccessesHierarchically iteration
Before this commit the code was wrong in 2 ways:
- if failed to iterate on children, because it iterated a range that was
  effectively [begin, begin) instead of [begin, end)
- the update of the ARootNext iterator in the loop was broken, but it
  was impossible to realize that since the loop was never taken

This commit fixes both these intertwined problems.
2024-06-18 11:19:50 +02:00
Pietro Fezzardi e44eeb6345 Merge branch feature/weaken-clift-fieldattr-verify 2024-06-18 11:17:58 +02:00
Pietro Fezzardi 9d24e9372d Clift FieldAttr::verify: improve debug message 2024-06-18 11:17:41 +02:00
Pietro Fezzardi b9ef4b205c Clift parseCompositeType: improve debug messages 2024-06-18 11:17:18 +02:00
Pietro Fezzardi 8f81e3ff9a Temporarily remove recursive class type unit test
The FieldAttr::verify checking for non-complete field types was testing
for completeness too eagerly and was removed. Forbidding class type
recursion without indirection is desirable, but needs to be done less
eagerly. A new unit test to validate this via clift::ModuleOp::Verify
needs to be created to replace this one.
2024-06-18 11:14:10 +02:00
Lauri Vasama 6803317f56 Remove type completeness check in FieldAttr verify 2024-06-13 14:03:28 +03:00
Pietro Fezzardi cf41471d25 Merge branch 'feature/refactor-type-inlining' 2024-06-10 17:41:40 +02:00
Pietro Fezzardi 4549e71a22 Add TODO for future refactoring 2024-06-10 17:41:02 +02:00
Pietro Fezzardi 7e44777c98 ModelToHeader: reduce lifetime of TypeInlineHelper 2024-06-07 17:59:06 +02:00
Pietro Fezzardi 84a40d0239 TypeInlineHelper: clean up members and methods 2024-06-07 17:59:06 +02:00
Pietro Fezzardi d82255b3fa Don't inline pointer types
Support for them was subtly bugged in case of recursive types, and
properly supporting this is not trivial.
We disable them for now.
2024-06-07 17:59:06 +02:00
Pietro Fezzardi 7a38a257b9 Refactor TypeInlineHelper::findTypesToInline
This change is a preparation for further decoupling of the
TypeInlineHelper from its custom dependency graph type, to try and reuse
the DependencyGraph used in ModelToHeader.
2024-06-07 17:59:06 +02:00
Pietro Fezzardi e052dee40f Drop isCandidateForInline 2024-06-07 17:59:06 +02:00
Pietro Fezzardi 8a7b5d4a25 ModelToHeader: refactor printTypeDefinitions
This refactoring makes the code less redundant, more concise,
and more explicit about how it handle's type inlining, while adding
documentation.
2024-06-07 17:58:36 +02:00
Pietro Fezzardi 914ef9cc41 Better documentation for DisableStackTypeInlining 2024-06-07 17:56:14 +02:00
Pietro Fezzardi a44679f847 ModelToPTMLTypeHelpers.cpp: fix unaligned Doxygen 2024-06-07 17:55:52 +02:00
Giacomo Vercesi c1b59567c6 revng graphql: gracefully handle server disconnect
Gracefully handle the server disconnecting from a `revng graphql`
invocation. Instead of letting the stack trace be printed, output an
appropriate error message.
2024-06-06 16:35:26 +02:00
Giacomo Vercesi e0336096af S3StorageClient: actually check presence of file
In the `type` function, if a file is present in the index then it should
also be checked in the bucked via a HEAD call. This allows revng to
successfully start up even if a file in the `index.yml` files has been
deleted on S3.
2024-06-06 15:45:02 +02:00
Giacomo Vercesi db6c5d9b7c Model: avoid warning regarding unescaped \
In some of the descriptions of Model fields/methods there are specicial
doxygen commands, such as `\sa`. These show up in python in docstrings
unescaped, causing warnings such as `SyntaxWarning: invalid escape
sequence '\s'`. In order to avoid these, replace the `\` with `\\` which
escapes to a `\`.
2024-06-06 15:45:02 +02:00
Pietro Fezzardi 80663458bb Pipeline: add loop-rotate, to match do-while loops 2024-06-06 11:27:48 +02:00
Pietro Fezzardi 44a4a77d53 Backend: prevent emission of const variables
At the moment in C we can't emit variable declarations with inline
initialization. Not for some substantial problem, but we haven't
implemented it yet. As a result if TypeMap.at(VarDeclCall) returns a
const-qualified type we will end up generating C code that doesn't
compile, when it tries to assign a value to the variable for
initializing it separately from the declaration.
To work around this, until we don't support emission of variable
declarations with inline initialization, we have to strip away
constness.
2024-06-06 11:27:48 +02:00
Pietro Fezzardi 7caa5eda96 PeepholeOptimizationPass can reorder instructions 2024-06-06 10:43:17 +02:00
Pietro Fezzardi 0063acadf7 Merge branch 'feature/mlir-clift-tidying' 2024-06-05 15:39:29 +02:00
Lauri Vasama f4001063a7 Add note on temporary nature of scalar tuple 2024-06-05 15:07:23 +02:00
Lauri Vasama cccee1ed99 Add structured Clift type alias generation 2024-06-05 15:07:23 +02:00
Lauri Vasama bfe353d1f6 Improve Clift type and type attribute verification 2024-06-05 15:07:23 +02:00
Lauri Vasama dad3aa5406 Remove unhelpful assert in model type import 2024-06-05 15:07:23 +02:00
Lauri Vasama d822e463e2 Use clift::ValueType instead of mlir::Type 2024-06-05 15:07:23 +02:00
Lauri Vasama 6470dd34ff Miscellaneous Clift cleanup for consistency 2024-06-05 15:07:23 +02:00
Lauri Vasama 7ff16c9c2b Add abort on unsupported type in Clift printType 2024-06-05 15:07:23 +02:00
Lauri Vasama 9f7cfa183f Reorganize Clift code 2024-06-05 15:07:23 +02:00
Lauri Vasama 3ebf26bedf Improve static_asserts for kindToKind 2024-06-05 15:07:23 +02:00
Lauri Vasama 34d488a086 Add using directives for mlir::clift 2024-06-05 15:07:23 +02:00
Lauri Vasama b1afb79302 Add Clift_ prefix to all Clift tablegen defs 2024-06-05 15:07:23 +02:00
Lauri Vasama 0c8a04432e Fix use of size_t to represent type ID 2024-06-05 15:07:23 +02:00
Lauri Vasama 4ebe4fb140 Rename remaining Clift type definition attributes 2024-06-05 15:07:23 +02:00
Lauri Vasama a310080fbd Rename Clift StructType and UnionType attributes 2024-06-05 15:07:23 +02:00
Lauri Vasama 8f19b5f351 Remove redundant global namespace qualifiers 2024-06-05 15:07:23 +02:00
Pietro Fezzardi e78aaad61a ALAPVariableDeclaration: fix ValueCompareNode
`ValueCompareNode`s have an associated `BasicBlock` which must be taken
into account when performing the ALAP Variable Declaration routine.
2024-06-04 00:10:28 +02:00
Pietro Fezzardi 677155d436 TANP: fix off-by-one in wrapping ICmp reduction
This bug caused the expression x + (-2) < -3 to be rewritten as
(x > 2) || (x < -1), instead of (x > 2) && (x < -1).

We had tests for a very similar case, but this specific example was
triggered by having the two constant terms in the inequality with a
difference of only one.

This commit rewrites and unifies the logic for handling inequalities,
and adapts the test for checking this specific additional corner case.
2024-06-04 00:10:27 +02:00
Pietro Fezzardi 19e3818521 Make test for implicit C casts more robust
Before this commit, the test was implicitly relying on control-flow
recovery and on the specific order of the then/else scopes in an
if-statement.

This commit relaxes that requirement, since it's not part of what the
test is designed to test.
2024-05-30 12:00:50 +02:00
Pietro Fezzardi 6d071d0a5d Merge branch 'feature/optimize-switch' 2024-05-29 16:43:14 +02:00
Djordje Todorovic 6d31e1c0a9 Add test for simplify-switch 2024-05-29 16:27:52 +02:00
Djordje Todorovic 6941df12a3 Add SimplifySwitch Pipe 2024-05-29 16:27:52 +02:00
Pietro Fezzardi 01829cfb5a Merge branch 'feature/optimize-switch' 2024-05-29 16:26:12 +02:00