Commit Graph

1432 Commits

Author SHA1 Message Date
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 a44679f847 ModelToPTMLTypeHelpers.cpp: fix unaligned Doxygen 2024-06-07 17:55:52 +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
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 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
Djordje Todorovic 6941df12a3 Add SimplifySwitch Pipe 2024-05-29 16:27:52 +02:00
Lauri Vasama ba58ec8edb Add import-clift-types pipe 2024-05-29 15:43:35 +02:00
Lauri Vasama ba914a1bb5 Replace MLIR container and LLVM import pipe 2024-05-29 15:43:35 +02:00
Lauri Vasama a8e2bb8c48 Add ImportModelType pass, register in clift-opt 2024-05-29 15:43:35 +02:00
Lauri Vasama 7abadd08ae Add model types to Clift MLIR import 2024-05-29 15:43:35 +02:00
Lauri Vasama 8063efb1e2 Install MLIRCliftDialect library 2024-05-29 15:43:35 +02:00
Lauri Vasama f4ff27b221 Add ScalarTupleType for RawFunctionType return 2024-05-29 15:43:35 +02:00
Lauri Vasama 9f99866edd Move CliftStorage.h to lib/ 2024-05-29 15:43:35 +02:00
Lauri Vasama 6db424b02b Factor Clift type parsing out into separate files 2024-05-29 15:43:35 +02:00
Lauri Vasama 10a80de57f Fix Clift type parsing
* Allow empty parameter list for FunctionAttr.
* Allow empty field list for struct but not union.
2024-05-29 15:43:35 +02:00
Lauri Vasama 84f7926c9c Naming and reorganization for consistency 2024-05-29 15:43:35 +02:00
Lauri Vasama 1059c51292 Refactor StructTypeStorage and UnionTypeStorage 2024-05-29 15:43:35 +02:00
Lauri Vasama b5b79709be Fix spelling of OnUnexpectedToken 2024-05-29 15:43:35 +02:00
Lauri Vasama dbdb4aabcb Add alias for error emission function_ref 2024-05-29 15:43:35 +02:00
Lauri Vasama 58e5a55403 Add support for typedef as enum underlying type 2024-05-29 15:43:35 +02:00
Lauri Vasama 50252c0ec6 Fix no-op asserts 2024-05-29 15:43:35 +02:00
Lauri Vasama 38c0605e76 Fix error message in StructType::parse 2024-05-29 15:43:35 +02:00
Lauri Vasama 25c4710c9a Fix EnumAttr::verify
* Fix enumerator value strict ordering check.
* Remove enumerator name uniqueness check.
2024-05-29 15:43:35 +02:00
Lauri Vasama 786740f935 Fix PointerType::verify
Allow pointers with sizes 4 or 8, matching the model.
2024-05-29 15:43:35 +02:00
Lauri Vasama c24f40ad43 Add missing verify functions 2024-05-29 15:43:35 +02:00
Lauri Vasama 73187864ee Fix UnionType::verify
* Add field type completeness check.
* Remove field name uniqueness check.
2024-05-29 15:43:35 +02:00
Lauri Vasama 5341c2bb0a Fix StructType::verify
* Simplify offset and size checks.
* Add field type completeness check.
* Remove field name uniqueness check.
2024-05-29 15:43:35 +02:00
Lauri Vasama 3a547889a3 Move struct,union get,getChecked defs to .cpp
There seem to be some issues with defining these in headers due to the
storage type being incomplete. The storage type is only defined in the
.cpp file.
2024-05-29 15:43:35 +02:00
Lauri Vasama e9cacbc613 Replace unsigned long with uint64_t 2024-05-29 15:43:35 +02:00
Lauri Vasama 9730b00e88 Remove UnionType::verify size parameter 2024-05-29 15:43:35 +02:00
Lauri Vasama 689b7b08f8 Add TODO on add_mlir_dialect_library 2024-05-29 15:43:35 +02:00
Lauri Vasama e2f3f31093 Introduce RawFunctionType::Architecture 2024-05-29 15:43:35 +02:00
Lauri Vasama d49a06bf25 Fix spelling of DefaultRawType 2024-05-29 15:43:35 +02:00
Lauri Vasama c20c1e9e85 Fix spelling of FunctionEntryMDName 2024-05-29 15:43:35 +02:00
Pietro Fezzardi e1a59e527a TypeNames: fix missing trailing \n in PTML comment
The missing \n was causing following type declaration to be wrongly
commented out.
2024-05-29 15:34:26 +02:00