LLVM 20.0.0git
|
#include "AArch64InstrInfo.h"
#include "AArch64MachineFunctionInfo.h"
#include "AArch64Subtarget.h"
#include "MCTargetDesc/AArch64AddressingModes.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/DebugCounter.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
#include <functional>
#include <iterator>
#include <limits>
#include <optional>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "aarch64-ldst-opt" |
#define | AARCH64_LOAD_STORE_OPT_NAME "AArch64 load / store optimization pass" |
Variables | |
static cl::opt< unsigned > | LdStLimit ("aarch64-load-store-scan-limit", cl::init(20), cl::Hidden) |
static cl::opt< unsigned > | UpdateLimit ("aarch64-update-scan-limit", cl::init(100), cl::Hidden) |
static cl::opt< unsigned > | LdStConstLimit ("aarch64-load-store-const-scan-limit", cl::init(10), cl::Hidden) |
static cl::opt< bool > | EnableRenaming ("aarch64-load-store-renaming", cl::init(true), cl::Hidden) |
#define AARCH64_LOAD_STORE_OPT_NAME "AArch64 load / store optimization pass" |
Definition at line 91 of file AArch64LoadStoreOptimizer.cpp.
#define DEBUG_TYPE "aarch64-ldst-opt" |
Definition at line 56 of file AArch64LoadStoreOptimizer.cpp.
|
static |
Definition at line 1324 of file AArch64LoadStoreOptimizer.cpp.
|
static |
Definition at line 1410 of file AArch64LoadStoreOptimizer.cpp.
References assert(), llvm::MachineInstr::FrameDestroy, llvm::MachineInstr::FrameSetup, getMatchingNonSExtOpcode(), getMatchingPairOpcode(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::hasOrderedMemoryRef(), llvm::AArch64InstrInfo::isPreLdSt(), isPreLdStPairCandidate(), MI, needsWinCFI(), and TII.
|
static |
Definition at line 1471 of file AArch64LoadStoreOptimizer.cpp.
References llvm::dbgs(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getParent(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isEarlyClobber(), llvm::MachineOperand::isImplicit(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isRenamable(), isRewritableImplicitDef(), llvm::MachineOperand::isTied(), LLVM_DEBUG, and TRI.
Referenced by canRenameUpToDef().
|
static |
Definition at line 1608 of file AArch64LoadStoreOptimizer.cpp.
References llvm::LiveRegUnits::accumulate(), for(), llvm::ilist_node_impl< OptionsT >::getIterator(), getLdStRegOp(), llvm::MachineOperand::getReg(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MachineInstr::isPseudo(), MI, Success, and TRI.
Referenced by findRenameRegForSameLdStRegPair().
|
static |
Definition at line 1504 of file AArch64LoadStoreOptimizer.cpp.
References llvm::LiveRegUnits::accumulate(), llvm::any_of(), canRenameMOP(), llvm::dbgs(), forAllMIsUntilDef(), llvm::MachineInstr::FrameSetup, getLdStRegOp(), llvm::MachineOperand::getReg(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MachineOperand::isDebug(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), LdStLimit, LLVM_DEBUG, llvm::MachineInstr::mayStore(), MI, llvm::MachineInstr::operands(), and TRI.
Referenced by findRenameRegForSameLdStRegPair().
DEBUG_COUNTER | ( | RegRenamingCounter | , |
DEBUG_TYPE "-reg-renaming" | , | ||
"Controls which pairs are considered for renaming" | |||
) |
|
static |
Definition at line 1696 of file AArch64LoadStoreOptimizer.cpp.
References canRenameUntilSecondLoad(), canRenameUpToDef(), getLdStRegOp(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineInstr::mayLoad(), MI, llvm::DebugCounter::shouldExecute(), llvm::MachineRegisterInfo::tracksLiveness(), TRI, and tryToFindRegisterToRename().
|
static |
Definition at line 872 of file AArch64LoadStoreOptimizer.cpp.
References llvm::any_of(), I, llvm::MachineBasicBlock::instr_rend(), llvm::instructionsWithoutDebug(), MBB, MI, and TRI.
Referenced by canRenameUpToDef().
Definition at line 511 of file AArch64LoadStoreOptimizer.cpp.
References llvm_unreachable.
|
static |
Definition at line 652 of file AArch64LoadStoreOptimizer.cpp.
References assert(), Idx, llvm::AArch64InstrInfo::isPairedLdSt(), llvm::AArch64InstrInfo::isPreLdSt(), and MI.
Referenced by canRenameUntilSecondLoad(), canRenameUpToDef(), findRenameRegForSameLdStRegPair(), and isPromotableZeroStoreInst().
Definition at line 274 of file AArch64LoadStoreOptimizer.cpp.
Referenced by areCandidatesToMergeOrPair().
Definition at line 346 of file AArch64LoadStoreOptimizer.cpp.
References llvm_unreachable.
Referenced by areCandidatesToMergeOrPair().
Definition at line 327 of file AArch64LoadStoreOptimizer.cpp.
References llvm_unreachable.
Definition at line 521 of file AArch64LoadStoreOptimizer.cpp.
References llvm_unreachable.
Definition at line 438 of file AArch64LoadStoreOptimizer.cpp.
References llvm_unreachable.
|
static |
Definition at line 634 of file AArch64LoadStoreOptimizer.cpp.
References llvm::AArch64InstrInfo::getMemScale(), llvm::AArch64InstrInfo::isPairedLdSt(), isTagStore(), and MI.
Definition at line 1307 of file AArch64LoadStoreOptimizer.cpp.
References llvm::Offset.
INITIALIZE_PASS | ( | AArch64LoadStoreOpt | , |
"aarch64-ldst-opt" | , | ||
AARCH64_LOAD_STORE_OPT_NAME | , | ||
false | , | ||
false | |||
) |
Definition at line 245 of file AArch64LoadStoreOptimizer.cpp.
|
static |
Definition at line 663 of file AArch64LoadStoreOptimizer.cpp.
References assert(), llvm::MachineOperand::getImm(), llvm::AArch64InstrInfo::getLdStOffsetOp(), isMatchingStore(), and TII.
|
static |
Definition at line 408 of file AArch64LoadStoreOptimizer.cpp.
References llvm::Instruction::getOpcode(), and llvm_unreachable.
Referenced by isLdOffsetInRangeOfSt().
|
static |
Definition at line 763 of file AArch64LoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 706 of file AArch64LoadStoreOptimizer.cpp.
References llvm::AArch64InstrInfo::getLdStOffsetOp(), isImm(), and MI.
|
static |
Definition at line 600 of file AArch64LoadStoreOptimizer.cpp.
References llvm::MachineInstr::getOpcode(), and MI.
Referenced by areCandidatesToMergeOrPair().
|
static |
Definition at line 688 of file AArch64LoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 681 of file AArch64LoadStoreOptimizer.cpp.
References getLdStRegOp(), llvm::MachineOperand::getReg(), and MI.
Definition at line 776 of file AArch64LoadStoreOptimizer.cpp.
Referenced by canRenameMOP().
|
static |
Definition at line 262 of file AArch64LoadStoreOptimizer.cpp.
References MI.
Referenced by getPrePostIndexedMemOpInfo().
|
static |
Definition at line 1328 of file AArch64LoadStoreOptimizer.cpp.
References llvm::dbgs(), LLVM_DEBUG, and llvm::MachineInstr::mayAlias().
Referenced by llvm::HexagonInstrInfo::expandPostRAPseudo().
|
static |
Definition at line 2002 of file AArch64LoadStoreOptimizer.cpp.
References assert(), End, llvm::MachineInstr::FrameDestroy, llvm::MachineInstr::FrameSetup, llvm::MachineFunction::getFrameInstructions(), llvm::MCCFIInstruction::getOperation(), MI, llvm::MCCFIInstruction::OpDefCfa, and llvm::MCCFIInstruction::OpDefCfaOffset.
|
static |
Definition at line 1403 of file AArch64LoadStoreOptimizer.cpp.
References llvm::MachineFunction::getFunction(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getTarget(), llvm::Function::needsUnwindTableEntry(), and llvm::MCAsmInfo::usesWindowsCFI().
Referenced by areCandidatesToMergeOrPair().
STATISTIC | ( | NumConstOffsetFolded | , |
"Number of const offset of index address folded" | |||
) |
STATISTIC | ( | NumFailedAlignmentCheck | , |
"Number of load/store pair transformation " "not passed the alignment check" | |||
) |
STATISTIC | ( | NumLoadsFromStoresPromoted | , |
"Number of loads from stores promoted" | |||
) |
STATISTIC | ( | NumPairCreated | , |
"Number of load/store pair instructions generated" | |||
) |
STATISTIC | ( | NumPostFolded | , |
"Number of post-index updates folded" | |||
) |
STATISTIC | ( | NumPreFolded | , |
"Number of pre-index updates folded" | |||
) |
STATISTIC | ( | NumUnscaledPairCreated | , |
"Number of load/store from unscaled generated" | |||
) |
|
static |
Definition at line 1652 of file AArch64LoadStoreOptimizer.cpp.
References llvm::LiveRegUnits::addReg(), llvm::all_of(), llvm::any_of(), llvm::LiveRegUnits::available(), llvm::CallingConv::C, llvm::dbgs(), llvm::MachineFunction::getRegInfo(), LLVM_DEBUG, llvm::printReg(), and TRI.
Referenced by findRenameRegForSameLdStRegPair().
|
static |
Definition at line 894 of file AArch64LoadStoreOptimizer.cpp.
References llvm::LiveRegUnits::addReg(), MI, llvm::phys_regs_and_masks(), and llvm::LiveRegUnits::removeReg().
|
static |
|
static |
|
static |
Referenced by canRenameUpToDef().