diff options
| author | Daniel Sanders <daniel_l_sanders@apple.com> | 2018-06-15 23:13:43 +0000 |
|---|---|---|
| committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2018-06-15 23:13:43 +0000 |
| commit | 8ead1290e687b27bb7bd877b6b1768f6579d84b7 (patch) | |
| tree | 8e921892b6b973e610c9cc1f0d81992b3c50b2c9 /llvm/lib/Target/ARM | |
| parent | 4c35d598e0dd31955dcd630ed17af32766e1224b (diff) | |
| download | bcm5719-llvm-8ead1290e687b27bb7bd877b6b1768f6579d84b7.tar.gz bcm5719-llvm-8ead1290e687b27bb7bd877b6b1768f6579d84b7.zip | |
[globalisel][tablegen] Add support for C++ predicates on PatFrags and use it to support BFC on ARM.
So far, we've only handled special cases of PatFrag like ImmLeaf. This patch
adds support for the remaining cases using similar mechanisms.
Like most C++ code from SelectionDAG, GISel and DAGISel expect to operate on
different types and representations and as such the code is not compatible
between the two. It's therefore necessary to add an alternative implementation
in the GISelPredicateCode field.
The target test for this feature could easily be done with IntImmLeaf and this
would save on a little boilerplate. The reason I've chosen to implement this
using PatFrag.GISelPredicateCode and not IntImmLeaf is because I was unable to
find a rule that was blocked solely by lack of support for PatFrag predicates. I
found that the ones I investigated as being likely candidates for the test
were further blocked by other things.
llvm-svn: 334871
Diffstat (limited to 'llvm/lib/Target/ARM')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMInstrInfo.td | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.td b/llvm/lib/Target/ARM/ARMInstrInfo.td index 600e3b07a44..b9639eafbaa 100644 --- a/llvm/lib/Target/ARM/ARMInstrInfo.td +++ b/llvm/lib/Target/ARM/ARMInstrInfo.td @@ -883,6 +883,16 @@ def bf_inv_mask_imm : Operand<i32>, let PrintMethod = "printBitfieldInvMaskImmOperand"; let DecoderMethod = "DecodeBitfieldMaskOperand"; let ParserMatchClass = BitfieldAsmOperand; + let GISelPredicateCode = [{ + // There's better methods of implementing this check. IntImmLeaf<> would be + // equivalent and have less boilerplate but we need a test for C++ + // predicates and this one causes new rules to be imported into GlobalISel + // without requiring additional features first. + const auto &MO = MI.getOperand(1); + if (!MO.isCImm()) + return false; + return ARM::isBitFieldInvertedMask(MO.getCImm()->getZExtValue()); + }]; } def imm1_32_XFORM: SDNodeXForm<imm, [{ |

