LLVM  5.0.0
Macros | Functions | Variables
AArch64LoadStoreOptimizer.cpp File Reference
#include "AArch64InstrInfo.h"
#include "AArch64Subtarget.h"
#include "MCTargetDesc/AArch64AddressingModes.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.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/IR/DebugLoc.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include <cassert>
#include <cstdint>
#include <iterator>
#include <limits>
Include dependency graph for AArch64LoadStoreOptimizer.cpp:

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"
 

Functions

 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")
 
 STATISTIC (NumZeroStoresPromoted,"Number of narrow zero stores promoted")
 
 STATISTIC (NumLoadsFromStoresPromoted,"Number of loads from stores promoted")
 
 INITIALIZE_PASS (AArch64LoadStoreOpt,"aarch64-ldst-opt", AARCH64_LOAD_STORE_OPT_NAME, false, false) static bool isNarrowStore(unsigned Opc)
 
static int getMemScale (MachineInstr &MI)
 
static unsigned getMatchingNonSExtOpcode (unsigned Opc, bool *IsValidLdStrOpc=nullptr)
 
static unsigned getMatchingWideOpcode (unsigned Opc)
 
static unsigned getMatchingPairOpcode (unsigned Opc)
 
static unsigned isMatchingStore (MachineInstr &LoadInst, MachineInstr &StoreInst)
 
static unsigned getPreIndexedOpcode (unsigned Opc)
 
static unsigned getPostIndexedOpcode (unsigned Opc)
 
static bool isPairedLdSt (const MachineInstr &MI)
 
static const MachineOperand & getLdStRegOp (const MachineInstr &MI, unsigned PairedRegOp=0)
 
static const MachineOperand & getLdStBaseOp (const MachineInstr &MI)
 
static const MachineOperand & getLdStOffsetOp (const MachineInstr &MI)
 
static bool isLdOffsetInRangeOfSt (MachineInstr &LoadInst, MachineInstr &StoreInst, const AArch64InstrInfo *TII)
 
static bool isPromotableZeroStoreInst (MachineInstr &MI)
 
static void trackRegDefsUses (const MachineInstr &MI, BitVector &ModifiedRegs, BitVector &UsedRegs, const TargetRegisterInfo *TRI)
 trackRegDefsUses - Remember what registers the specified instruction uses and modifies. More...
 
static bool inBoundsForPair (bool IsUnscaled, int Offset, int OffsetStride)
 
static int alignTo (int Num, int PowOf2)
 
static bool mayAlias (MachineInstr &MIa, MachineInstr &MIb, AliasAnalysis *AA)
 
static bool mayAlias (MachineInstr &MIa, SmallVectorImpl< MachineInstr * > &MemInsns, AliasAnalysis *AA)
 
static bool areCandidatesToMergeOrPair (MachineInstr &FirstMI, MachineInstr &MI, LdStPairFlags &Flags, const AArch64InstrInfo *TII)
 

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)
 

Macro Definition Documentation

#define AARCH64_LOAD_STORE_OPT_NAME   "AArch64 load / store optimization pass"

Definition at line 63 of file AArch64LoadStoreOptimizer.cpp.

#define DEBUG_TYPE   "aarch64-ldst-opt"

Definition at line 44 of file AArch64LoadStoreOptimizer.cpp.

Function Documentation

static int alignTo ( int  Num,
int  PowOf2 
)
static

Definition at line 964 of file AArch64LoadStoreOptimizer.cpp.

static bool areCandidatesToMergeOrPair ( MachineInstr &  FirstMI,
MachineInstr &  MI,
LdStPairFlags &  Flags,
const AArch64InstrInfo *  TII 
)
static
static const MachineOperand& getLdStBaseOp ( const MachineInstr &  MI)
static
static const MachineOperand& getLdStOffsetOp ( const MachineInstr &  MI)
static
static const MachineOperand& getLdStRegOp ( const MachineInstr &  MI,
unsigned  PairedRegOp = 0 
)
static
static unsigned getMatchingNonSExtOpcode ( unsigned  Opc,
bool *  IsValidLdStrOpc = nullptr 
)
static

Definition at line 260 of file AArch64LoadStoreOptimizer.cpp.

References llvm::max().

Referenced by areCandidatesToMergeOrPair().

static unsigned getMatchingPairOpcode ( unsigned  Opc)
static

Definition at line 320 of file AArch64LoadStoreOptimizer.cpp.

References llvm_unreachable().

Referenced by areCandidatesToMergeOrPair().

static unsigned getMatchingWideOpcode ( unsigned  Opc)
static

Definition at line 301 of file AArch64LoadStoreOptimizer.cpp.

References llvm_unreachable().

static int getMemScale ( MachineInstr &  MI)
static
static unsigned getPostIndexedOpcode ( unsigned  Opc)
static

Definition at line 453 of file AArch64LoadStoreOptimizer.cpp.

References llvm_unreachable().

static unsigned getPreIndexedOpcode ( unsigned  Opc)
static

Definition at line 390 of file AArch64LoadStoreOptimizer.cpp.

References llvm_unreachable().

static bool inBoundsForPair ( bool  IsUnscaled,
int  Offset,
int  OffsetStride 
)
static

Definition at line 947 of file AArch64LoadStoreOptimizer.cpp.

INITIALIZE_PASS ( AArch64LoadStoreOpt  ,
"aarch64-ldst-opt"  ,
AARCH64_LOAD_STORE_OPT_NAME  ,
false  ,
false   
)

Definition at line 187 of file AArch64LoadStoreOptimizer.cpp.

static bool isLdOffsetInRangeOfSt ( MachineInstr &  LoadInst,
MachineInstr &  StoreInst,
const AArch64InstrInfo *  TII 
)
static
static unsigned isMatchingStore ( MachineInstr &  LoadInst,
MachineInstr &  StoreInst 
)
static
static bool isPairedLdSt ( const MachineInstr &  MI)
static
static bool isPromotableZeroStoreInst ( MachineInstr &  MI)
static
static bool mayAlias ( MachineInstr &  MIa,
MachineInstr &  MIb,
AliasAnalysis *  AA 
)
static
static bool mayAlias ( MachineInstr &  MIa,
SmallVectorImpl< MachineInstr * > &  MemInsns,
AliasAnalysis *  AA 
)
static

Definition at line 981 of file AArch64LoadStoreOptimizer.cpp.

References mayAlias().

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"   
)
STATISTIC ( NumZeroStoresPromoted  ,
"Number of narrow zero stores promoted"   
)
STATISTIC ( NumLoadsFromStoresPromoted  ,
"Number of loads from stores promoted"   
)
static void trackRegDefsUses ( const MachineInstr &  MI,
BitVector &  ModifiedRegs,
BitVector &  UsedRegs,
const TargetRegisterInfo *  TRI 
)
static

trackRegDefsUses - Remember what registers the specified instruction uses and modifies.

Definition at line 922 of file AArch64LoadStoreOptimizer.cpp.

References assert(), llvm::MCRegAliasIterator::isValid(), llvm::MachineInstr::operands(), llvm::BitVector::set(), and llvm::BitVector::setBitsNotInMask().

Variable Documentation

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