]> granicus.if.org Git - llvm/commitdiff
[AArch64] Add AArch64Subtarget::isFusion function.
authorFlorian Hahn <florian.hahn@arm.com>
Wed, 12 Jul 2017 20:53:22 +0000 (20:53 +0000)
committerFlorian Hahn <florian.hahn@arm.com>
Wed, 12 Jul 2017 20:53:22 +0000 (20:53 +0000)
Summary:
isFusion returns true if the subtarget supports any kind of instruction
fusion, similar to ARMSubtarget::isFusion. This was suggested in D34142.

This changes the current behavior slightly, because the macro fusion mutation
is now added to the PostRA MachineScheduler in case the subtarget supports
any kind of fusion. I think that makes sense because if the PostRA
MachineScheduler is run, there is potential that instructions scheduled back to
back are re-scheduled.

Reviewers: evandro, t.p.northover, joelkevinjones, joel_k_jones, steleman

Reviewed By: joelkevinjones

Subscribers: joel_k_jones, aemerson, rengolin, javed.absar, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307842 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64Subtarget.h
lib/Target/AArch64/AArch64TargetMachine.cpp

index 7933e58c49eed755619e37800a62596e19ebc4e3..db53946cbc77f104c13882baa9f109550b9e6c67 100644 (file)
@@ -218,6 +218,13 @@ public:
   bool hasArithmeticCbzFusion() const { return HasArithmeticCbzFusion; }
   bool hasFuseAES() const { return HasFuseAES; }
   bool hasFuseLiterals() const { return HasFuseLiterals; }
+
+  /// \brief Return true if the CPU supports any kind of instruction fusion.
+  bool hasFusion() const {
+    return hasArithmeticBccFusion() || hasArithmeticCbzFusion() ||
+           hasFuseAES() || hasFuseLiterals();
+  }
+
   bool useRSqrt() const { return UseRSqrt; }
   unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
   unsigned getVectorInsertExtractBaseCost() const {
index 1252f9403812e7010fcf81c0264b2bff12edde7b..25bcc79b3493ca97f173cce3880033cdc1d443f8 100644 (file)
@@ -287,7 +287,7 @@ public:
   ScheduleDAGInstrs *
   createPostMachineScheduler(MachineSchedContext *C) const override {
     const AArch64Subtarget &ST = C->MF->getSubtarget<AArch64Subtarget>();
-    if (ST.hasFuseAES() || ST.hasFuseLiterals()) {
+    if (ST.hasFusion()) {
       // Run the Macro Fusion after RA again since literals are expanded from
       // pseudos then (v. addPreSched2()).
       ScheduleDAGMI *DAG = createGenericSchedPostRA(C);