//===--- AArch64StorePairSuppress.cpp --- Suppress store pair formation ---===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This pass identifies floating point stores that should not be combined into // store pairs. Later we may do the same for floating point loads. // ===---------------------------------------------------------------------===// #include "AArch64InstrInfo.h" #include "AArch64Subtarget.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineTraceMetrics.h" #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/CodeGen/TargetSchedule.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" usingnamespacellvm; #define DEBUG_TYPE … #define STPSUPPRESS_PASS_NAME … namespace { class AArch64StorePairSuppress : public MachineFunctionPass { … }; char AArch64StorePairSuppress::ID = …; } // anonymous INITIALIZE_PASS(…) FunctionPass *llvm::createAArch64StorePairSuppressPass() { … } /// Return true if an STP can be added to this block without increasing the /// critical resource height. STP is good to form in Ld/St limited blocks and /// bad to form in float-point limited blocks. This is true independent of the /// critical path. If the critical path is longer than the resource height, the /// extra vector ops can limit physreg renaming. Otherwise, it could simply /// oversaturate the vector units. bool AArch64StorePairSuppress::shouldAddSTPToBlock(const MachineBasicBlock *BB) { … } /// Return true if this is a floating-point store smaller than the V reg. On /// cyclone, these require a vector shuffle before storing a pair. /// Ideally we would call getMatchingPairOpcode() and have the machine model /// tell us if it's profitable with no cpu knowledge here. /// /// FIXME: We plan to develop a decent Target abstraction for simple loads and /// stores. Until then use a nasty switch similar to AArch64LoadStoreOptimizer. bool AArch64StorePairSuppress::isNarrowFPStore(const MachineInstr &MI) { … } bool AArch64StorePairSuppress::runOnMachineFunction(MachineFunction &MF) { … }