summaryrefslogtreecommitdiff
path: root/utils/TableGen/FixedLenDecoderEmitter.cpp
diff options
context:
space:
mode:
authorMichael Liao <michael.liao@intel.com>2012-09-06 23:32:48 +0000
committerMichael Liao <michael.liao@intel.com>2012-09-06 23:32:48 +0000
commit307525cd24c3b9c081ddb3c34a3418f2875cd556 (patch)
tree7d756c1fb08e7cf37ccf39641fc45070459185a4 /utils/TableGen/FixedLenDecoderEmitter.cpp
parent35e3aed169aa7fc9c7118f24e5e2a07e25bef512 (diff)
downloadllvm-307525cd24c3b9c081ddb3c34a3418f2875cd556.tar.gz
llvm-307525cd24c3b9c081ddb3c34a3418f2875cd556.tar.bz2
llvm-307525cd24c3b9c081ddb3c34a3418f2875cd556.tar.xz
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
Diffstat (limited to 'utils/TableGen/FixedLenDecoderEmitter.cpp')
-rw-r--r--utils/TableGen/FixedLenDecoderEmitter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp
index e89c393b6a..aa6d7962a0 100644
--- a/utils/TableGen/FixedLenDecoderEmitter.cpp
+++ b/utils/TableGen/FixedLenDecoderEmitter.cpp
@@ -1783,7 +1783,7 @@ static bool populateInstruction(const CodeGenInstruction &CGI, unsigned Opc,
VarInit *Var = 0;
VarBitInit *BI = dynamic_cast<VarBitInit*>(Bits.getBit(bi));
if (BI)
- Var = dynamic_cast<VarInit*>(BI->getVariable());
+ Var = dynamic_cast<VarInit*>(BI->getBitVar());
else
Var = dynamic_cast<VarInit*>(Bits.getBit(bi));