You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[TableGen] Add assert to validate Objects list for HwModeSelect (#123794)
- Bail out of TableGen if any asserts fail before running the backend.
- Add asserts to validate that the `Objects` and `Modes` lists for
various `HwModeSelect` subclasses are of same length.
- Eliminate equivalent check in CodeGenHWModes.cpp
// RUN: not llvm-tblgen %s 2>&1 | FileCheck %s -DFILE=%s
3
+
4
+
def a {
5
+
bits<2> opc = { 0, 1 };
6
+
bits<2> opc2 = { 1, 0 };
7
+
bits<1> opc3 = { 1 };
8
+
// CHECK: [[FILE]]:[[@LINE+1]]:15: error: Field 'a' of type 'bits<2>' is incompatible with value '{ opc{1}, opc{0}, opc2{1}, opc2{0} }' of type bit initializer with length 4
9
+
bits<2> a = { opc, opc2 }; // error!
10
+
}
11
+
12
+
def {
13
+
// CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'B1' of type 'bits<2>' is incompatible with value '{ 0, 1, 1 }' of type bit initializer with length 3
14
+
bits<2> B1 = 0b011; // bitfield is too small, reject
15
+
16
+
// CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'C1' of type 'bits<2>' is incompatible with value '{ 1, 1, 1 }' of type bit initializer with length 3
17
+
bits<2> C1 = 0b111; // bitfield is too small, reject
18
+
19
+
// CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'D3' of type 'bits<3>' is incompatible with value '{ 0, 0 }' of type bit initializer with length 2
20
+
bits<3> D3 = { 0, 0 }; // type mismatch. RHS doesn't have enough bits
21
+
22
+
// CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'D4' of type 'bits<3>' is incompatible with value '{ 0, 0 }' of type bit initializer with length 2
23
+
bits<3> D4 = { 0b00 }; // type mismatch. RHS doesn't have enough bits
24
+
25
+
bits<1> D7 = { 3 }; // type mismatch. LHS doesn't have enough bits
26
+
27
+
// CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'D8' of type 'bits<2>' is incompatible with value '{ 0 }' of type bit initializer with length 1
28
+
bits<2> D8 = { 0 }; // type mismatch. RHS doesn't have enough bits
29
+
30
+
// CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'F2' of type 'bits<7>' is incompatible with value '{ 0, 1, 1, 0, 0, 1, 0, 0 }' of type bit initializer with length 8
// CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'F3' of type 'bits<9>' is incompatible with value '{ 0, 1, 1, 0, 0, 1, 0, 0 }' of type bit initializer with length 8
// CHECK: [[FILE]]:[[@LINE+1]]:5: error: Initializer of 'typeName' in 'InvalidTypeA' could not be fully resolved: !strconcat("TestDialect", !strconcat(".", mnemonic))
20
20
def InvalidTypeA : InvalidType<"InvalidTypeA"> {
21
21
let parameters = (ins "int":$v0);
22
22
let builders = [
23
-
// CHECK: Builder DAG arguments must be either strings or defs which inherit from CArg
0 commit comments