Files
revng-revng/tests/unit/mlir_lit_tests/expressions/aggregate-struct.mlir
Lauri Vasama f884642f59 Overhaul clift.struct, clift.union assembly syntax
Old syntax:
```
	unique_handle = "/model-type/1",
	name = "my_struct",
	size = 2,
	fields = [
		<
			offset = 0
			name = "",
			type = !t
		>,
		<
			offset = 1,
			name = "my_field",
			type = !t
		>
	]
>

	unique_handle = "/model-type/1",
	name = "my_union",
	fields = [
		<
			offset = 0,
			name = "",
			type = !t
		>,
		<
			offset = 0,
			name = "my_field",
			type = !t
		>
	]
>
```

New syntax:
```
	"/model-type/1" as "my_struct" : size(1) {
		offset(0) : !t,
		offset(1) as "my_field" : !t
	}
>

	"/model-type/1" as "my_union" : {
		!t,
		"my_field" : !t
	}
>
```
2025-03-24 09:26:43 +02:00

22 lines
492 B
MLIR

//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
// RUN: %revngcliftopt %s
!int32_t = !clift.primitive<signed 4>
!int32_t$const = !clift.primitive<const signed 4>
!s = !clift.defined<#clift.struct<
"" : size(8) {
offset(0) as "x" : !int32_t,
offset(4) as "y" : !int32_t
}
>>
%0 = clift.undef : !int32_t
%a = clift.aggregate(%0, %0) : !s
%1 = clift.undef : !int32_t$const
%b = clift.aggregate(%1 : !int32_t$const, %1 : !int32_t$const) : !s