[llvm-branch-commits] [llvm] [3/7][PISA] Add PISA register file, instruction set, and MC layer (PR #214107)

Mateusz Chudyk via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 7 06:57:38 PDT 2026


================
@@ -0,0 +1,344 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// DAG operator used for dag representation of a condition flag: (cflag FlagName value)
+// These are used in EnumOptionOpnd to represent certain
+def cflag;
+
+// Function to find index of a item from a list of string.
+// Note that tablegen does not allow recursive definition.
+class getIndexFromList<list<string> slist, string item> {
----------------
mateuszchudyk wrote:

I think the generic version of that could be implemented using !foldl. Something like this:

```
tmp = !foldl(1 /* init */, slist, acc, var, /*expr pseudo-code*/
		if (acc > 0) {
			if (var == item)
				acc = -acc
			else
				acc = acc + 1
		}
)

result = tmp < 0 ? -tmp - 1 : -1;
```

https://github.com/llvm/llvm-project/pull/214107


More information about the llvm-branch-commits mailing list