[PATCH] D127948: [TableGen] Add new operator !instanceof
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 21 16:49:04 PDT 2022
tra added inline comments.
================
Comment at: llvm/test/TableGen/instanceof.td:4-10
+//CHECK: def B0 {
+//CHECK: int value = 1;
+//CHECK: }
+
+//CHECK: def B1 {
+//CHECK: int value = 0;
+//CHECK: }
----------------
This test is rather hard to read as checks are placed all over the place, usually away from where the respective records are defined.
Alas, we don't have `CHECK-DAG-NEXT` we could use to do sequential matches in out of order chunks.
I guess the best we could do here is to have the tablegen source at the top of the file, and all the checks below, in order they are emitted by the tablegen, possibly with the comments referring to the relevant source code, if it's not obvious what exactly, and why, particular check statement tests for.
E.g. right now it's not obvious why the value of `B1` is 0 and `B0` is 1. See the other suggestion which may make the checks self-explanatory.
================
Comment at: llvm/test/TableGen/instanceof.td:19-20
+
+def B0 : B<"A0">;
+def B1 : B<"A1">;
+
----------------
These could use more descriptive names, possibly reflecting expected result.
E.g.
```
def A0 : A;
class A_check<string name>{
int exists = !instanceof<A>(name);
}
def A0_exists : A_check<"A0">;
def A1_missing : A_check<"A1">;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127948/new/
https://reviews.llvm.org/D127948
More information about the llvm-commits
mailing list