llvm-project/llvm/lib
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
..
Analysis Release build: guard dump functions with "ifndef NDEBUG" 2012-09-06 19:55:56 +00:00
Archive Mark checkSignature const, and in turn stop casting away const from 2012-09-05 22:09:23 +00:00
AsmParser [ms-inline asm] Enumerate the InlineAsm dialects and rename the nsdialect to 2012-09-05 19:00:49 +00:00
Bitcode Dont cast away const needlessly. Found by gcc48 -Wcast-qual. 2012-09-06 15:42:13 +00:00
CodeGen Release build: guard dump functions with "ifndef NDEBUG" 2012-09-06 19:06:06 +00:00
DebugInfo Stop casting away const qualifier needlessly. 2012-09-05 22:26:57 +00:00
ExecutionEngine Stop casting away const qualifier needlessly. 2012-09-05 22:26:57 +00:00
Linker Move the "findUsedStructTypes" functionality outside of the Module class. 2012-08-03 00:30:35 +00:00
MC Release build: guard dump functions with "ifndef NDEBUG" 2012-09-06 19:55:56 +00:00
Object Reverting r 160419. 2012-07-19 21:43:55 +00:00
Support Whitespace. 2012-09-06 03:02:56 +00:00
TableGen Re-work bit/bits value resolving in tblgen 2012-09-06 23:32:48 +00:00
Target Remove unused variable introduced by r163346. 2012-09-06 23:31:29 +00:00
Transforms Release build: guard dump functions with "ifndef NDEBUG" 2012-09-06 19:55:56 +00:00
VMCore Stop casting away const qualifier needlessly. 2012-09-05 22:26:57 +00:00
CMakeLists.txt Move TableGen's parser and entry point into a library 2011-10-01 16:41:13 +00:00
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Makefile Remove more of llvmc and dependencies. 2011-09-20 00:34:27 +00:00