[TableGen] Allow shift operators to take bits<n>
authorAdam Nemet <anemet@apple.com>
Thu, 17 Jul 2014 17:04:27 +0000 (17:04 +0000)
committerAdam Nemet <anemet@apple.com>
Thu, 17 Jul 2014 17:04:27 +0000 (17:04 +0000)
commit30cced119be0dc3fffdd553cba575c9c27e93bf3
tree79838918fab49b0adab5e342bf3440e0ef4f01e9
parent07bc0b6ae6129fed1d0235a3053967ee87a031ea
[TableGen] Allow shift operators to take bits<n>

Convert the operand to int if possible, i.e. if the value is properly
initialized.  (I suppose there is further room for improvement here to also
peform the shift if the uninitialized bits are shifted out.)

With this little change we can now compute the scaling factor for compressed
displacement with pure tablegen code in the X86 backend.  This is useful
because both the X86-disassembler-specific part of tablegen and the assembler
need this and TD is the natural sharing place.

The patch also adds the missing documentation for the shift and add operator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213277 91177308-0d34-0410-b5e6-96231b3b80d8
docs/TableGen/LangIntro.rst
lib/TableGen/Record.cpp
test/TableGen/math.td