diff options
| author | Diana Picus <diana.picus@linaro.org> | 2019-02-28 11:13:05 +0000 |
|---|---|---|
| committer | Diana Picus <diana.picus@linaro.org> | 2019-02-28 11:13:05 +0000 |
| commit | cf0ff638bce4219d408c3b0ac3aa9a21a77a9c16 (patch) | |
| tree | 05c825680715c2f1732ea65f69853540ed6c1b44 /llvm/lib/Target | |
| parent | 5306a71480e1652d7afa0b055fd577a062251055 (diff) | |
| download | bcm5719-llvm-cf0ff638bce4219d408c3b0ac3aa9a21a77a9c16.tar.gz bcm5719-llvm-cf0ff638bce4219d408c3b0ac3aa9a21a77a9c16.zip | |
[ARM GlobalISel] Make arm_i32imm an IntImmLeaf
This gets rid of some duplication in the TableGen definition, but it
forces us to keep both a pointer and a reference to the subtarget in the
ARMInstructionSelector. That is pretty ugly but it might be a reasonable
trade-off, since the TableGen descriptions should outlive the code in
the selector (or in the worst case we can update to use just the
reference when we get rid of DAGISel).
Differential Revision: https://reviews.llvm.org/D58031
llvm-svn: 355083
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMInstrInfo.td | 18 | ||||
| -rw-r--r-- | llvm/lib/Target/ARM/ARMInstructionSelector.cpp | 5 |
2 files changed, 8 insertions, 15 deletions
diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.td b/llvm/lib/Target/ARM/ARMInstrInfo.td index 6555590fc5d..b2f0fef1938 100644 --- a/llvm/lib/Target/ARM/ARMInstrInfo.td +++ b/llvm/lib/Target/ARM/ARMInstrInfo.td @@ -717,23 +717,11 @@ def mod_imm_neg : Operand<i32>, PatLeaf<(imm), [{ } /// arm_i32imm - True for +V6T2, or when isSOImmTwoParVal() -def arm_i32imm : PatLeaf<(imm), [{ +def arm_i32imm : IntImmLeaf<i32, [{ if (Subtarget->useMovt()) return true; - return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue()); -}]> { - // Ideally this would be an IntImmLeaf, but then we wouldn't have access to - // the MachineFunction. - let GISelPredicateCode = [{ - if (STI.useMovt()) - return true; - - const auto &MO = MI.getOperand(1); - if (!MO.isCImm()) - return false; - return ARM_AM::isSOImmTwoPartVal(MO.getCImm()->getZExtValue()); - }]; -} + return ARM_AM::isSOImmTwoPartVal(Imm.getZExtValue()); +}]>; /// imm0_1 predicate - Immediate in the range [0,1]. def Imm0_1AsmOperand: ImmAsmOperand<0,1> { let Name = "Imm0_1"; } diff --git a/llvm/lib/Target/ARM/ARMInstructionSelector.cpp b/llvm/lib/Target/ARM/ARMInstructionSelector.cpp index ec61677736b..d69f3265ec1 100644 --- a/llvm/lib/Target/ARM/ARMInstructionSelector.cpp +++ b/llvm/lib/Target/ARM/ARMInstructionSelector.cpp @@ -75,6 +75,11 @@ private: const ARMRegisterBankInfo &RBI; const ARMSubtarget &STI; + // FIXME: This is necessary because DAGISel uses "Subtarget->" and GlobalISel + // uses "STI." in the code generated by TableGen. If we want to reuse some of + // the custom C++ predicates written for DAGISel, we need to have both around. + const ARMSubtarget *Subtarget = &STI; + // Store the opcodes that we might need, so we don't have to check what kind // of subtarget (ARM vs Thumb) we have all the time. struct OpcodeCache { |

