Commit Graph

48 Commits

Author SHA1 Message Date
Giacomo Vercesi 11f1e532c6 Implement dirty bit on Container
Add a `Dirty` boolean to the `ContainerBase` class. This will be set to
true when the container mutates itself (e.g. remove, mergeBack, clear).
The dirty bit is reset when running `PipelineManager.store`.
2025-04-03 15:59:18 +02:00
Lauri Vasama d6a2ee387e Add aliases for Clift types without handles 2025-03-24 09:26:43 +02:00
Lauri Vasama e9c329e51d Rename Clift unique handle to handle 2025-03-24 09:26:43 +02:00
Lauri Vasama 1325c75979 Move Clift op custom parsers out of header 2025-03-24 09:26:43 +02:00
Lauri Vasama c85275cc70 Add expression region utilities in CliftOps.h 2025-03-24 09:26:43 +02:00
Lauri Vasama b97c55980b Change Clift type constraints to ValueType
clift.indirection %p : <8 to !int32_t>

The concrete type kinds would cause types in the assembly to be emitted
without type mnemonics. See the example above.
2025-03-24 09:26:43 +02:00
Lauri Vasama 5f475739ef Rename reinterpret, add convert cast 2025-03-24 09:26:43 +02:00
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
Lauri Vasama 5bd481ae5a Overhaul clift.function assembly syntax
Old syntax:
```
        unique_handle = "/model-type/1",
        name = "my_function",
        return_type = !t,
        argument_types = [
                !t
        ]
>
```

New syntax:
```
        "/model-type/1" as "my_function" : !t(!t)
>
```

* Rename clift.function mnemonic to clift.func.
2025-03-24 09:26:43 +02:00
Lauri Vasama 281bf283e2 Overhaul clift.typedef assembly syntax
Old syntax:
```
	unique_handle = "/model-type/1",
	name = "my_typedef",
	underlying_type = !t
>
```

New syntax:
```
	"/model-type/1" as "my_typedef" : !t
>
```
2025-03-24 09:26:43 +02:00
Lauri Vasama ea78766f10 Overhaul clift.enum assembly syntax
Old syntax:
```
	unique_handle = "/model-type/1",
	name = "my_enum",
	underlying_type = !t,
	fields = [
		<
			name = "my_enumerator",
			raw_value = 42
		>
	]
>
```

New syntax:
```
	"/model-type/1" as "my_enum" : !t {
		42 as "my_enumerator"
	}
>
```
2025-03-24 09:26:43 +02:00
Lauri Vasama 8482bcbf90 Overhaul clift.defined assembly syntax
Old syntax:
```
!clift.defined<#t>
!clift.defined<is_const = true, #t>
```

New syntax:
```
!clift.defined<#t>
!clift.defined<const #t>
```
2025-03-24 09:26:43 +02:00
Lauri Vasama 64fc21e9dd Overhaul clift.pointer assembly syntax
Old syntax:
```
!clift.pointer<pointer_size = 8, pointee_type = !t>
!clift.pointer<is_const = true, pointer_size = 8, pointee_type = !t>
```

New syntax:
```
!clift.ptr<8 to !t>
!clift.ptr<const 8 to !t>
```
2025-03-24 09:26:43 +02:00
Lauri Vasama 872b157774 Overhaul clift.array assembly syntax
Old syntax:
```
!clift.array<elements_count = 42, element_type = !t>
```

New syntax:
```
!clift.array<42 x !t>
```
2025-03-24 09:26:43 +02:00
Lauri Vasama eaf1bf35aa Overhaul clift.primitive assembly syntax
Old syntax:
```
!clift.primitive<SignedKind 8>
!clift.primitive<is_const = true, SignedKind 8>
```

New syntax:
```
!clift.primitive<signed 8>
!clift.primitive<const signed 8>
```
2025-03-24 09:26:43 +02:00
Lauri Vasama e2f4af30e9 Add custom builder for Clift FunctionOp 2025-03-24 09:26:43 +02:00
Lauri Vasama 8f44ebe12d Improve Clift type constraint error messages 2025-03-24 09:26:43 +02:00
Lauri Vasama 23b47f825e Add Clift AggregateOp 2025-03-24 09:17:38 +02:00
Lauri Vasama 1b63797640 Add Clift TernaryOp 2025-03-19 12:57:22 +02:00
Lauri Vasama 747a792f0f Add Clift pointer arithmetic ops 2025-03-19 12:57:22 +02:00
Lauri Vasama 66246218b7 Add Clift StringOp 2025-03-19 12:57:21 +02:00
Lauri Vasama df2003efb8 Add clift::removeConst in CliftTypes.h 2025-03-19 12:57:20 +02:00
Lauri Vasama da9df369fc Loosen Clift logical op type constraints 2025-03-19 12:57:20 +02:00
Lauri Vasama 4a334bef7b Move Clift type helpers to CliftTypes.h 2025-03-19 12:57:19 +02:00
Lauri Vasama c472dd3cae Move ScopedExchange to revng/ADT/ 2025-03-19 12:57:19 +02:00
Lauri Vasama eec882dac1 Add clift::GlobalOpInterface 2025-03-19 12:57:19 +02:00
Lauri Vasama 44c9388930 Rename Clift comparison operations 2025-03-19 12:57:18 +02:00
Lauri Vasama 08c2c0a477 Remove ScalarTupleType
After converting type IDs to unique handles it was decided to remove
scalar tuple types in favour of generated structs with non-model unique
handles.
2025-03-19 12:57:18 +02:00
Lauri Vasama 386efffb2f Convert TypeDefinitionAttr ID to UniqueHandle 2025-03-19 12:57:17 +02:00
Lauri Vasama 6343bfcb40 Add c-verify pass 2025-01-30 14:52:47 +02:00
Lauri Vasama 998114501b Replace PlatformInfo with TargetCImplementation 2025-01-30 14:52:47 +02:00
Lauri Vasama 06d91d485d Factor visitation out of ModuleOp verify 2025-01-30 14:52:47 +02:00
Lauri Vasama fc203afb49 Remove unused CastOp purpose attribute 2025-01-29 23:58:24 +01:00
Lauri Vasama 4a0867e394 Add emit-c MLIR pass 2025-01-10 08:04:20 +02:00
Lauri Vasama bda55aac19 Add Clift C Backend 2025-01-10 08:04:20 +02:00
Lauri Vasama 216489b06d Fix ModelOption value name 2025-01-10 08:03:20 +02:00
Lauri Vasama 4cedc22efb Merge access ops into AccessOp with indirect flag 2025-01-02 11:25:32 +02:00
Lauri Vasama fd4033ce7e Add ClassTypeAttr for structs and unions 2025-01-02 11:25:32 +02:00
Lauri Vasama 769c357648 Merge SizedType into TypeDefinitionAttr 2025-01-02 11:25:32 +02:00
Lauri Vasama 9f6003f1f4 Add SwitchOp::getConditionType 2025-01-02 11:25:32 +02:00
Lauri Vasama 11ff4d7abd Fix relational op tablegen naming 2025-01-02 11:25:32 +02:00
Lauri Vasama fe2e70e885 Improve label and goto ops 2025-01-02 11:25:32 +02:00
Lauri Vasama 3b8e9dc3bb Loosen YieldOp verification
Yield is not return. There is no need to verify the types being yielded.
f; is a valid expression statement, even when f is a function. In this
case a function is yielded, but that is fine.
2025-01-02 11:25:32 +02:00
Lauri Vasama 4052863dcf Fix CliftAttributes.td formatting 2025-01-02 11:25:32 +02:00
Lauri Vasama e0c3f352d8 Fix CliftInterfaces.td formatting 2025-01-02 11:25:32 +02:00
Lauri Vasama 8be366b168 Move MLIR includes to mlir/CMakeLists.txt 2025-01-02 11:25:32 +02:00
Lauri Vasama 3232105320 Make clift::ModuleOp IsolatedFromAbove 2025-01-02 11:25:32 +02:00
Alessandro Di Federico 143c315196 Merge revng-c into revng 2024-11-21 10:50:55 +01:00