[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)
commit017fca0272cebfbf84182d0c49cbce1c3e926905
treea7445bb5b262b0e8fa813bcda8816398e077c24e
parente5a1173f67f8bf56bc1df93b8c4fd49e8ed69994
[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.

llvm-svn: 213277
llvm/docs/TableGen/LangIntro.rst
llvm/lib/TableGen/Record.cpp
llvm/test/TableGen/math.td