llvm-6502/lib/TableGen
Michael Liao 307525cd24 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163360 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 23:32:48 +00:00
..
CMakeLists.txt Move llvm-tblgen's StringMatcher into the TableGen library so it can 2012-05-02 17:32:48 +00:00
Error.cpp Print out the location of expanded multiclass defs in TableGen errors. 2012-08-22 23:33:58 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Main.cpp Fix 80 columns. 2012-06-01 00:58:41 +00:00
Makefile
Record.cpp Re-work bit/bits value resolving in tblgen 2012-09-06 23:32:48 +00:00
StringMatcher.cpp Emit memcmp directly from the StringMatcherEmitter. 2012-05-20 18:10:42 +00:00
TableGenAction.cpp Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:50:00 +00:00
TableGenBackend.cpp Emit TableGen's header comment with C-style comments, so it can be used from C89 code. 2012-06-19 17:04:16 +00:00
TGLexer.cpp Add Foreach Loop 2012-02-22 16:09:41 +00:00
TGLexer.h Add Foreach Loop 2012-02-22 16:09:41 +00:00
TGParser.cpp Re-work bit/bits value resolving in tblgen 2012-09-06 23:32:48 +00:00
TGParser.h Simplify TGParser::ProcessForEachDefs. 2012-05-24 22:17:33 +00:00