]> granicus.if.org Git - llvm/commit
[TableGen] Add "InitValue": Handle operands with set bit values in decoder methods
authorDaniel Sanders <daniel_l_sanders@apple.com>
Fri, 9 Aug 2019 17:30:33 +0000 (17:30 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Fri, 9 Aug 2019 17:30:33 +0000 (17:30 +0000)
commitbf5acac9aba9656b12eac905d4b3b177eb54c29a
tree45f0541073285793c3bab99c4bf847030ca959f5
parent7574afba909546d1476eb7fa57ca74804531076e
[TableGen] Add "InitValue": Handle operands with set bit values in decoder methods

Summary:
The problem:
  When an operand had bits explicitly set to "1" (as in the InitValue.td test case attached), the decoder was ignoring those bits, and the DecoderMethod was receiving an input where the bits were still zero.

The solution:
  We added an "InitValue" variable that stores the initial value of the operand based on what bits were explicitly initialized to 1 in TableGen code. The generated decoder code then uses that initial value to initialize the "tmp" variable, then calls fieldFromInstruction to read the values for the remaining bits that were left unknown in TableGen.

This is mainly useful when there are variations of an instruction that differ based on what bits are set in the operands, since this change makes it possible to access those bits in a DecoderMethod. The DecoderMethod can use those bits to know how to handle the input.

Patch by Nicolas Guillemot

Reviewers: craig.topper, dsanders, fhahn

Reviewed By: dsanders

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D63741

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368458 91177308-0d34-0410-b5e6-96231b3b80d8
test/TableGen/FixedLenDecoderEmitter/InitValue.td [new file with mode: 0644]
utils/TableGen/FixedLenDecoderEmitter.cpp