diff options
author | Pete Cooper <peter_cooper@apple.com> | 2014-08-07 05:46:57 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2014-08-07 05:46:57 +0000 |
commit | f5b7351124ed4a871112cfb63daa68bac22b2b28 (patch) | |
tree | 5cf858133a8c518a20078295c136f62896addf33 /test/TableGen | |
parent | 3f2aee7e02a5ddbe173bcf02fbb007f0dc71dcf0 (diff) |
TableGen: Change { } to only accept bits<n> entries when n == 1.
Prior to this change, it was legal to do something like
bits<2> opc = { 0, 1 };
bits<2> opc2 = { 1, 0 };
bits<2> a = { opc, opc2 };
This involved silently dropping bits from opc and opc2 which is very hard to debug.
Now the above test would be an error. Having tested with an assert, none of LLVM/clang was relying on this behaviour.
Thanks to Adam Nemet for the above test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r-- | test/TableGen/BitsInit.td | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/TableGen/BitsInit.td b/test/TableGen/BitsInit.td new file mode 100644 index 00000000000..28fd3196fd0 --- /dev/null +++ b/test/TableGen/BitsInit.td @@ -0,0 +1,22 @@ + +// RUN: not llvm-tblgen %s 2>&1 > %t +// RUN: FileCheck %s < %t + +def a { + bits<2> opc = { 0, 1 }; + bits<2> opc2 = { 1, 0 }; + bits<1> opc3 = { 1 }; + bits<2> a = { opc, opc2 }; // error! + bits<2> b = { opc{0}, opc2{0} }; + bits<2> c = { opc{1}, opc2{1} }; + bits<2> c = { opc3{0}, opc3 }; +} + +// CHECK: def a { +// CHECK: bits<2> opc = { 0, 1 }; +// CHECK: bits<2> opc2 = { 1, 0 }; +// CHECK: bits<1> opc3 = { 1 }; +// CHECK: bits<2> a = { ?, ? }; +// CHECK: bits<2> b = { 1, 0 }; +// CHECK: bits<2> c = { 1, 1 }; +// CHECK: } |