summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMInstructionSelector.cpp
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2019-02-15 10:24:03 +0000
committerDiana Picus <diana.picus@linaro.org>2019-02-15 10:24:03 +0000
commita00425ff0d04ac862a7990e3826f5aa00dad5d56 (patch)
tree5fa3e3162c38bfda28b3c1d9e35faee17656cd17 /llvm/lib/Target/ARM/ARMInstructionSelector.cpp
parent0ed2d160635ddf1173049f1e6a28cd2458006348 (diff)
downloadbcm5719-llvm-a00425ff0d04ac862a7990e3826f5aa00dad5d56.tar.gz
bcm5719-llvm-a00425ff0d04ac862a7990e3826f5aa00dad5d56.zip
[ARM GlobalISel] Support branches for Thumb2
Just like arm mode, but with different opcodes. llvm-svn: 354113
Diffstat (limited to 'llvm/lib/Target/ARM/ARMInstructionSelector.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMInstructionSelector.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/llvm/lib/Target/ARM/ARMInstructionSelector.cpp b/llvm/lib/Target/ARM/ARMInstructionSelector.cpp
index 262300ebb62..3030e219474 100644
--- a/llvm/lib/Target/ARM/ARMInstructionSelector.cpp
+++ b/llvm/lib/Target/ARM/ARMInstructionSelector.cpp
@@ -106,6 +106,9 @@ private:
unsigned CMPri;
unsigned MOVCCr;
+ unsigned TSTri;
+ unsigned Bcc;
+
OpcodeCache(const ARMSubtarget &STI);
} const Opcodes;
@@ -300,6 +303,9 @@ ARMInstructionSelector::OpcodeCache::OpcodeCache(const ARMSubtarget &STI) {
STORE_OPCODE(CMPri, CMPri);
STORE_OPCODE(MOVCCr, MOVCCr);
+
+ STORE_OPCODE(TSTri, TSTri);
+ STORE_OPCODE(Bcc, Bcc);
#undef MAP_OPCODE
}
@@ -1008,17 +1014,19 @@ bool ARMInstructionSelector::select(MachineInstr &I,
}
// Set the flags.
- auto Test = BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(ARM::TSTri))
- .addReg(I.getOperand(0).getReg())
- .addImm(1)
- .add(predOps(ARMCC::AL));
+ auto Test =
+ BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(Opcodes.TSTri))
+ .addReg(I.getOperand(0).getReg())
+ .addImm(1)
+ .add(predOps(ARMCC::AL));
if (!constrainSelectedInstRegOperands(*Test, TII, TRI, RBI))
return false;
// Branch conditionally.
- auto Branch = BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(ARM::Bcc))
- .add(I.getOperand(1))
- .add(predOps(ARMCC::NE, ARM::CPSR));
+ auto Branch =
+ BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(Opcodes.Bcc))
+ .add(I.getOperand(1))
+ .add(predOps(ARMCC::NE, ARM::CPSR));
if (!constrainSelectedInstRegOperands(*Branch, TII, TRI, RBI))
return false;
I.eraseFromParent();
OpenPOWER on IntegriCloud