]> granicus.if.org Git - llvm/commit
[GlobalISel][TableGen] Fix handling of default operands
authorDiana Picus <diana.picus@linaro.org>
Wed, 17 May 2017 08:57:28 +0000 (08:57 +0000)
committerDiana Picus <diana.picus@linaro.org>
Wed, 17 May 2017 08:57:28 +0000 (08:57 +0000)
commit3bbcbfa0750d3ae2b9894c56672ff5d7bf11fa39
tree81211bab56435d088deb6d857f893bb28894bca5
parent28aa6e3bb4fd633d0bc2d153669cdf9c4acbded7
[GlobalISel][TableGen] Fix handling of default operands

When looping through a destination pattern's operands to decide how many
default operands we need to introduce, we used to count the "expanded"
number of operands. So if one default operand would be rendered as 2
values, we'd count it as 2 operands, when in fact it needs to count as
only 1 operand regardless of how many values it expands to.

This turns out to be a problem only in some very specific cases, e.g.
when we have one operand with multiple default values followed by more
operands with default values (see the new test). In such a situation
we'd stop looping before looking at all the operands, and then error out
assuming that we don't have enough default operands to make up the
shortfall.

At the moment this only affects ARM.

The patch removes the loop counting default operands entirely and
assumes that we'll have to introduce values for any default operand that
we find (i.e. we're assuming it cannot be given as a child at all). It
also extracts the code for adding renderers for default operands into a
helper method.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303240 91177308-0d34-0410-b5e6-96231b3b80d8
test/TableGen/GlobalISelEmitter.td
utils/TableGen/GlobalISelEmitter.cpp