Commit Graph

70 Commits

Author SHA1 Message Date
Lauri Vasama 5d3e3f73d9 Add clift.require operation 2026-05-13 15:32:34 +02:00
Pietro Fezzardi 9e3c059d3f CBackend: finish cleanup of array bitcast, assign
This commit completes the piecewise revert of
a546be1386, now that it's no longer
needed.
2026-05-13 15:32:27 +02:00
Pietro Fezzardi 58e95d330f Drop assign_array macro
The macro is no longer necessary: the code now ensures we never
need to assign anything to an array, which would be ill-advised
nevertheless given that array-typed rvalues in C immediately
decay to pointers.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi 85a9780d28 Drop bit_cast_to_array macro
The macro is no longer necessary: the code now ensures we never
need to bitcast anything to an array, which would be ill-advised
nevertheless given that array-typed rvalues in C immediately
decay to pointers.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi a546be1386 CBackend: emit array assignments
Teach CliftToCEmitter how to emit assignments and bitcasts whose
target type is an array, by emitting calls to the new
assign_array and bit_cast_to_array macros. The shape of the call
encodes the element type and the number of elements, which is what
the macros need to expand correctly.
2026-05-08 11:37:10 +02:00
Lauri Vasama 15df286a6f Implement clift.implicit support in the backend 2026-05-04 10:49:06 +03:00
Lauri Vasama 04fe27b8e9 Migrate Clift users to CDataModel 2026-05-04 10:49:03 +03:00
Lauri Vasama be564f8944 Migrate isIntegerType users to unwrapped_isa 2026-04-30 15:09:16 +03:00
Lauri Vasama 1c768919d6 Streamline header emission implementation 2026-04-30 15:09:16 +03:00
Lauri Vasama c56742770b Use const ArrayRef in emitHelperHeader 2026-04-30 15:09:16 +03:00
Lauri Vasama b30b4feec9 Remove MLIRContext from TypeDefinitionEmitter API 2026-04-30 15:09:16 +03:00
Lauri Vasama 90e5dfd4c9 Pass MLIRContext by address
Passing by address is more conventional. This is what MLIR does most of
the time, and it avoids dereferences and addressofs everywhere.
2026-04-30 15:09:16 +03:00
Lauri Vasama a338194eb7 Move namespace mlir::clift out of namespace mlir 2026-04-27 12:48:24 +03:00
Ivan Krysak 71845dcbbb CliftEmitC: stop using mlir::clift namespace 2026-04-22 08:19:47 +00:00
Ivan Krysak 3de5b009e7 Clift: introduce simple passes for header tests 2026-04-22 08:19:29 +00:00
Ivan Krysak 681df85f5d EmitCPass: separate boilerplate for easier reuse 2026-04-22 08:19:28 +00:00
Ivan Krysak d9acaadfac CBackendPass.cpp -> CEmissionPasses.cpp 2026-04-22 08:19:28 +00:00
Ivan Krysak 7edc4b3da6 CEmitter: emit function type attributes 2026-04-22 08:19:28 +00:00
Ivan Krysak 481f8dba31 CEmitter: emit function comment with prototype 2026-04-22 08:19:27 +00:00
Ivan Krysak 74fa16dd13 Introduce helper header emitter 2026-04-22 08:19:25 +00:00
Ivan Krysak 7ab3d590e0 Introduce type and global header emitter 2026-04-22 08:18:52 +00:00
Ivan Krysak 405eebcbd1 TypeDefinitionEmitter: emit comments 2026-04-22 06:33:56 +00:00
Ivan Krysak 3bd8879948 CEmitter: Introduce doxygen emission helpers 2026-04-22 06:33:56 +00:00
Ivan Krysak 6d76908858 Introduce TypeDefinitionEmitter 2026-04-22 06:33:38 +00:00
Ivan Krysak d327cd3be5 emitCAttributes: introduce an array overload 2026-04-22 06:14:52 +00:00
Ivan Krysak c3b870beee CEmitter: make function prototype commentable
This wraps pieces of it (arguments and return value) into a commentable
region showing the UI where to direct the `"comment"` action.
2026-04-22 06:14:52 +00:00
Ivan Krysak 3e63412e8c CEmitter: make return value scope
This commit should be viewed in conjunction with the following one,
separating white-space only changes makes the next commit less noisy.
2026-04-22 06:14:52 +00:00
Ivan Krysak 9167153303 Only allow unit attributes on function operations 2026-04-22 06:14:52 +00:00
Lauri Vasama 8085a1e8e9 Improve integer literal emission 2026-04-08 12:31:45 +03:00
Lauri Vasama 0e7703e312 CBackend null pointer constant 2026-04-08 12:29:58 +03:00
Lauri Vasama 80731d1a10 Migrate users to new Clift type casts 2026-04-08 12:27:32 +03:00
Lauri Vasama 29c935ac90 Replace Clift type category helpers with casts 2026-04-08 12:25:04 +03:00
Lauri Vasama 9ba90e9b81 Replace ValueType with mlir::Type where applicable
`mlir::Type` is now used as the default C++ type for representing all
MLIR types, even when `ValueType` would be a valid constraint, unless
doing so provides a clear benefit in that specific context.
2026-04-08 12:20:00 +03:00
Lauri Vasama f9a4cb6384 Split up clift::dealias
* `unwrapTypedefs` matches `dealias(T, /*IgnoreQualifiers=*/true)`.
* `collapseTypedefs` matches `dealias(T)`.
2026-04-08 12:18:42 +03:00
Lauri Vasama be8351a17d Split up Clift PrimitiveType
* PrimitiveType is now an interface.
* VoidKind is now VoidType.
* FloatKind is now FloatType.
* The integer kinds are now IntegerType with IntegerKind.
2026-04-08 12:18:10 +03:00
Lauri Vasama a2be1b476a Split up Clift CastOp
* DecayOp - array or function to pointer decay. Not shown in C.
* BitCastOp - bit-preserving conversion. Emitted as bit_cast if
  necessary.
* ExtendOp - zero- or sign-extending conversion from any integer type to
  any wider integer type.
* TruncateOp - truncating conversion from any integer type to any
  narrower integer type.
* PtrResizeOp - resizes a pointer without changing its pointee type.
2026-04-08 12:11:54 +03:00
Lauri Vasama c0ca9222ce Fix Clift immediate emission 2026-04-08 11:12:41 +03:00
Ivan Krysak 82e86cf167 Emit prototype attributes *before* the prototype 2026-03-27 08:27:52 +00:00
Ivan Krysak 5ca78e8897 emitCAttributes: improve spacing control 2026-03-27 08:27:23 +00:00
Ivan Krysak a03e944403 CEmitter: emit unit attributes 2026-03-27 08:26:55 +00:00
Ivan Krysak 378bfb650f CliftEmitC: Attributes -> CAttributes 2026-03-27 08:22:23 +00:00
Ivan Krysak 882fed11ad emitFunctionPrototype: simplify helper handling 2026-03-27 08:13:25 +00:00
Ivan Krysak 318681cd42 Introduce TypeDependencyGraph 2026-03-27 08:05:10 +00:00
Ivan Krysak f4e7d50361 Allow C-Attributes to accept integers and types 2026-03-27 07:18:49 +00:00
Lauri Vasama ad6f6df04e Improve function arg/result attribute interface 2026-03-27 07:18:49 +00:00
Ivan Krysak b1781988e0 Backend: do not require full attribute presence 2026-03-27 07:18:49 +00:00
Ivan Krysak 35d0de2d41 clift.c_attributes: improve error message 2026-03-25 15:42:13 +00:00
Ivan Krysak 1310b6ab62 Clift: append C to attribute classes we emit 2026-03-25 15:42:13 +00:00
Ivan Krysak 41378913b2 CTokenEmitter: add a suffix-less literal helper 2026-03-04 08:20:00 +00:00
Ivan Krysak 1541d4b402 CEmitter: allow argumentless function declarations 2026-02-25 12:47:27 +01:00