llvm-project/llvm/test/TableGen
Michael Liao 026f833368 Re-work bit/bits value resolving in tblgen
- This patch is inspired by the failure of the following code snippet
  which is used to convert enumerable values into encoding bits to
  improve the readability of td files.

  class S<int s> {
    bits<2> V = !if(!eq(s, 8),  {0, 0},
                !if(!eq(s, 16), {0, 1},
                !if(!eq(s, 32), {1, 0},
                !if(!eq(s, 64), {1, 1}, {?, ?}))));
  }

  Later, PR8330 is found to report not exactly the same bug relevant
  issue to bit/bits values.

- Instead of resolving bit/bits values separately through
  resolveBitReference(), this patch adds getBit() for all Inits and
  resolves bit value by resolving plus getting the specified bit. This
  unifies the resolving of bit with other values and removes redundant
  logic for resolving bit only. In addition,
  BitsInit::resolveReferences() is optimized to take advantage of this
  origanization by resolving VarBitInit's variable reference first and
  then getting bits from it.

- The type interference in '!if' operator is revised to support possible
  combinations of int and bits/bit in MHS and RHS.

- As there may be illegal assignments from integer value to bit, says
  assign 2 to a bit, but we only check this during instantiation in some
  cases, e.g.

  bit V = !if(!eq(x, 17), 0, 2);

  Verbose diagnostic message is generated when invalid value is
  resolveed to help locating the error.

- PR8330 is fixed as well.

llvm-svn: 163360
2012-09-06 23:32:48 +00:00
..
2003-08-03-PassCode.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
2006-09-18-LargeInt.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
2010-03-24-PrematureDefaults.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
AnonDefinitionOnDemand.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
BitsInitOverflow.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
CStyleComment.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
Dag.td Add NAME Member 2011-10-19 13:04:13 +00:00
DefmInherit.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
DefmInsideMultiClass.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
FieldAccess.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
ForeachList.td Add Foreach Loop 2012-02-22 16:09:41 +00:00
ForeachLoop.td Add support for range expressions in TableGen foreach loops. 2012-05-24 22:17:39 +00:00
ForwardRef.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
GeneralList.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
Include.inc
Include.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
IntBitInit.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
LazyChange.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
LetInsideMultiClasses.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
ListArgs.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
ListArgsSimple.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
ListConversion.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
ListManip.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
ListOfList.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
ListSlices.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
LoLoL.td XFAIL tblgen tests on leak checkers. 2011-10-10 13:09:59 +00:00
MultiClass.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
MultiClassDefName.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
MultiClassInherit.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
MultiPat.td XFAIL tblgen tests on leak checkers. 2011-10-10 13:09:59 +00:00
NestedForeach.td Add Foreach Loop 2012-02-22 16:09:41 +00:00
Paste.td XFAIL test on leak checkers. 2011-10-24 17:24:05 +00:00
SetTheory.td Teach tblgen's set theory "sequence" operator to support an optional stride operand. 2012-05-24 21:37:08 +00:00
SiblingForeach.td Add Foreach Loop 2012-02-22 16:09:41 +00:00
Slice.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
String.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
SuperSubclassSameName.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
TargetInstrInfo.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
TargetInstrSpec.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
TemplateArgRename.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
Tree.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
TreeNames.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
TwoLevelName.td Fix infinite loop in nested multiclasses. 2012-03-07 16:39:35 +00:00
UnsetBitInit.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
UnterminatedComment.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
cast.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
defmclass.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
eq.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
eqbit.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
foreach.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
if.td Re-work bit/bits value resolving in tblgen 2012-09-06 23:32:48 +00:00
ifbit.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
lisp.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
list-element-bitref.td Re-work bit/bits value resolving in tblgen 2012-09-06 23:32:48 +00:00
lit.local.cfg Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed. 2012-02-16 06:28:33 +00:00
nested-comment.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
pr8330.td Re-work bit/bits value resolving in tblgen 2012-09-06 23:32:48 +00:00
strconcat.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
subst.td Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
subst2.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00
usevalname.td s/tblgen/llvm-tblgen/g in a few missed places, including the tests 2011-10-06 13:39:59 +00:00