LLVM  3.7.0
Macros | Functions
ARMLoadStoreOptimizer.cpp File Reference
#include "ARM.h"
#include "ARMBaseInstrInfo.h"
#include "ARMBaseRegisterInfo.h"
#include "ARMISelLowering.h"
#include "ARMMachineFunctionInfo.h"
#include "ARMSubtarget.h"
#include "MCTargetDesc/ARMAddressingModes.h"
#include "ThumbRegisterInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
Include dependency graph for ARMLoadStoreOptimizer.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "arm-ldst-opt"
 

Functions

 STATISTIC (NumLDMGened,"Number of ldm instructions generated")
 
 STATISTIC (NumSTMGened,"Number of stm instructions generated")
 
 STATISTIC (NumVLDMGened,"Number of vldm instructions generated")
 
 STATISTIC (NumVSTMGened,"Number of vstm instructions generated")
 
 STATISTIC (NumLdStMoved,"Number of load / store instructions moved")
 
 STATISTIC (NumLDRDFormed,"Number of ldrd created before allocation")
 
 STATISTIC (NumSTRDFormed,"Number of strd created before allocation")
 
 STATISTIC (NumLDRD2LDM,"Number of ldrd instructions turned back into ldm")
 
 STATISTIC (NumSTRD2STM,"Number of strd instructions turned back into stm")
 
 STATISTIC (NumLDRD2LDR,"Number of ldrd instructions turned back into ldr's")
 
 STATISTIC (NumSTRD2STR,"Number of strd instructions turned back into str's")
 
static bool definesCPSR (const MachineInstr *MI)
 
static int getMemoryOpOffset (const MachineInstr *MI)
 
static const MachineOperandgetLoadStoreBaseOp (const MachineInstr &MI)
 
static const MachineOperandgetLoadStoreRegOp (const MachineInstr &MI)
 
static int getLoadStoreMultipleOpcode (unsigned Opcode, ARM_AM::AMSubMode Mode)
 
static ARM_AM::AMSubMode getLoadStoreMultipleSubMode (unsigned Opcode)
 
static bool isT1i32Load (unsigned Opc)
 
static bool isT2i32Load (unsigned Opc)
 
static bool isi32Load (unsigned Opc)
 
static bool isT1i32Store (unsigned Opc)
 
static bool isT2i32Store (unsigned Opc)
 
static bool isi32Store (unsigned Opc)
 
static bool isLoadSingle (unsigned Opc)
 
static unsigned getImmScale (unsigned Opc)
 
static unsigned getLSMultipleTransferSize (const MachineInstr *MI)
 
static bool ContainsReg (const ArrayRef< std::pair< unsigned, bool >> &Regs, unsigned Reg)
 
static bool isValidLSDoubleOffset (int Offset)
 
static bool isMatchingDecrement (MachineInstr *MI, unsigned Base, unsigned Bytes, unsigned Limit, ARMCC::CondCodes Pred, unsigned PredReg)
 
static bool isMatchingIncrement (MachineInstr *MI, unsigned Base, unsigned Bytes, unsigned Limit, ARMCC::CondCodes Pred, unsigned PredReg)
 
static unsigned getUpdatingLSMultipleOpcode (unsigned Opc, ARM_AM::AMSubMode Mode)
 
static unsigned getPreIndexedLoadStoreOpcode (unsigned Opc, ARM_AM::AddrOpc Mode)
 
static unsigned getPostIndexedLoadStoreOpcode (unsigned Opc, ARM_AM::AddrOpc Mode)
 
static bool isMemoryOp (const MachineInstr *MI)
 Returns true if instruction is a memory operation that this pass is capable of operating on. More...
 
static void InsertLDR_STR (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, int Offset, bool isDef, DebugLoc DL, unsigned NewOpc, unsigned Reg, bool RegDeadKill, bool RegUndef, unsigned BaseReg, bool BaseKill, bool BaseUndef, bool OffKill, bool OffUndef, ARMCC::CondCodes Pred, unsigned PredReg, const TargetInstrInfo *TII, bool isT2)
 
static bool IsSafeAndProfitableToMove (bool isLd, unsigned Base, MachineBasicBlock::iterator I, MachineBasicBlock::iterator E, SmallPtrSetImpl< MachineInstr * > &MemOps, SmallSet< unsigned, 4 > &MemRegs, const TargetRegisterInfo *TRI)
 
static void concatenateMemOperands (MachineInstr *MI, MachineInstr *Op0, MachineInstr *Op1)
 Copy Op0 and Op1 operands into a new array assigned to MI. More...
 

Macro Definition Documentation

#define DEBUG_TYPE   "arm-ldst-opt"

Definition at line 49 of file ARMLoadStoreOptimizer.cpp.

Function Documentation

static void concatenateMemOperands ( MachineInstr MI,
MachineInstr Op0,
MachineInstr Op1 
)
static
static bool ContainsReg ( const ArrayRef< std::pair< unsigned, bool >> &  Regs,
unsigned  Reg 
)
static

Definition at line 554 of file ARMLoadStoreOptimizer.cpp.

static bool definesCPSR ( const MachineInstr MI)
static
static unsigned getImmScale ( unsigned  Opc)
static

Definition at line 365 of file ARMLoadStoreOptimizer.cpp.

References llvm_unreachable.

static const MachineOperand& getLoadStoreBaseOp ( const MachineInstr MI)
static

Definition at line 190 of file ARMLoadStoreOptimizer.cpp.

References llvm::MachineInstr::getOperand().

static int getLoadStoreMultipleOpcode ( unsigned  Opcode,
ARM_AM::AMSubMode  Mode 
)
static
static ARM_AM::AMSubMode getLoadStoreMultipleSubMode ( unsigned  Opcode)
static
static const MachineOperand& getLoadStoreRegOp ( const MachineInstr MI)
static

Definition at line 194 of file ARMLoadStoreOptimizer.cpp.

References llvm::MachineInstr::getOperand().

static unsigned getLSMultipleTransferSize ( const MachineInstr MI)
static
static int getMemoryOpOffset ( const MachineInstr MI)
static
static unsigned getPostIndexedLoadStoreOpcode ( unsigned  Opc,
ARM_AM::AddrOpc  Mode 
)
static

Definition at line 1252 of file ARMLoadStoreOptimizer.cpp.

References llvm::ARM_AM::add, and llvm_unreachable.

static unsigned getPreIndexedLoadStoreOpcode ( unsigned  Opc,
ARM_AM::AddrOpc  Mode 
)
static

Definition at line 1227 of file ARMLoadStoreOptimizer.cpp.

References llvm::ARM_AM::add, and llvm_unreachable.

static unsigned getUpdatingLSMultipleOpcode ( unsigned  Opc,
ARM_AM::AMSubMode  Mode 
)
static
static void InsertLDR_STR ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
int  Offset,
bool  isDef,
DebugLoc  DL,
unsigned  NewOpc,
unsigned  Reg,
bool  RegDeadKill,
bool  RegUndef,
unsigned  BaseReg,
bool  BaseKill,
bool  BaseUndef,
bool  OffKill,
bool  OffUndef,
ARMCC::CondCodes  Pred,
unsigned  PredReg,
const TargetInstrInfo TII,
bool  isT2 
)
static
static bool isi32Load ( unsigned  Opc)
static

Definition at line 345 of file ARMLoadStoreOptimizer.cpp.

References isT1i32Load(), and isT2i32Load().

Referenced by isLoadSingle().

static bool isi32Store ( unsigned  Opc)
static

Definition at line 357 of file ARMLoadStoreOptimizer.cpp.

References isT1i32Store(), and isT2i32Store().

static bool isLoadSingle ( unsigned  Opc)
static

Definition at line 361 of file ARMLoadStoreOptimizer.cpp.

References isi32Load().

static bool isMatchingDecrement ( MachineInstr MI,
unsigned  Base,
unsigned  Bytes,
unsigned  Limit,
ARMCC::CondCodes  Pred,
unsigned  PredReg 
)
static
static bool isMatchingIncrement ( MachineInstr MI,
unsigned  Base,
unsigned  Bytes,
unsigned  Limit,
ARMCC::CondCodes  Pred,
unsigned  PredReg 
)
static
static bool isMemoryOp ( const MachineInstr MI)
static
static bool IsSafeAndProfitableToMove ( bool  isLd,
unsigned  Base,
MachineBasicBlock::iterator  I,
MachineBasicBlock::iterator  E,
SmallPtrSetImpl< MachineInstr * > &  MemOps,
SmallSet< unsigned, 4 > &  MemRegs,
const TargetRegisterInfo TRI 
)
static
static bool isT1i32Load ( unsigned  Opc)
static

Definition at line 337 of file ARMLoadStoreOptimizer.cpp.

Referenced by isi32Load().

static bool isT1i32Store ( unsigned  Opc)
static

Definition at line 349 of file ARMLoadStoreOptimizer.cpp.

Referenced by isi32Store().

static bool isT2i32Load ( unsigned  Opc)
static

Definition at line 341 of file ARMLoadStoreOptimizer.cpp.

Referenced by isi32Load().

static bool isT2i32Store ( unsigned  Opc)
static

Definition at line 353 of file ARMLoadStoreOptimizer.cpp.

Referenced by isi32Store().

static bool isValidLSDoubleOffset ( int  Offset)
static

Definition at line 894 of file ARMLoadStoreOptimizer.cpp.

References llvm::abs().

STATISTIC ( NumLDMGened  ,
"Number of ldm instructions generated"   
)
STATISTIC ( NumSTMGened  ,
"Number of stm instructions generated"   
)
STATISTIC ( NumVLDMGened  ,
"Number of vldm instructions generated"   
)
STATISTIC ( NumVSTMGened  ,
"Number of vstm instructions generated"   
)
STATISTIC ( NumLdStMoved  ,
"Number of load / store instructions moved"   
)
STATISTIC ( NumLDRDFormed  ,
"Number of ldrd created before allocation  
)
STATISTIC ( NumSTRDFormed  ,
"Number of strd created before allocation  
)
STATISTIC ( NumLDRD2LDM  ,
"Number of ldrd instructions turned back into ldm"   
)
STATISTIC ( NumSTRD2STM  ,
"Number of strd instructions turned back into stm"   
)
STATISTIC ( NumLDRD2LDR  ,
"Number of ldrd instructions turned back into ldr's"   
)
STATISTIC ( NumSTRD2STR  ,
"Number of strd instructions turned back into str's"   
)