|
LLVM 24.0.0git
|
#include "ARM.h"#include "ARMBaseInstrInfo.h"#include "ARMBaseRegisterInfo.h"#include "ARMISelLowering.h"#include "ARMMachineFunctionInfo.h"#include "ARMSubtarget.h"#include "MCTargetDesc/ARMAddressingModes.h"#include "MCTargetDesc/ARMBaseInfo.h"#include "Utils/ARMBaseInfo.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SetVector.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/iterator_range.h"#include "llvm/Analysis/AliasAnalysis.h"#include "llvm/CodeGen/LiveRegUnits.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineDominators.h"#include "llvm/CodeGen/MachineFrameInfo.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachineInstr.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachineMemOperand.h"#include "llvm/CodeGen/MachineOperand.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/RegisterClassInfo.h"#include "llvm/CodeGen/TargetFrameLowering.h"#include "llvm/CodeGen/TargetInstrInfo.h"#include "llvm/CodeGen/TargetLowering.h"#include "llvm/CodeGen/TargetRegisterInfo.h"#include "llvm/CodeGen/TargetSubtargetInfo.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DebugLoc.h"#include "llvm/IR/Function.h"#include "llvm/IR/Type.h"#include "llvm/InitializePasses.h"#include "llvm/MC/MCInstrDesc.h"#include "llvm/Pass.h"#include "llvm/Support/Allocator.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/raw_ostream.h"#include <cassert>#include <cstddef>#include <cstdlib>#include <iterator>#include <limits>#include <utility>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "arm-ldst-opt" |
| #define | ARM_LOAD_STORE_OPT_NAME "ARM load / store optimization pass" |
| #define | ARM_PREALLOC_LOAD_STORE_OPT_NAME "ARM pre- register allocation load / store optimization pass" |
Variables | |
| static cl::opt< bool > | AssumeMisalignedLoadStores ("arm-assume-misaligned-load-store", cl::Hidden, cl::init(false), cl::desc("Be more conservative in ARM load/store opt")) |
| This switch disables formation of double/multi instructions that could potentially lead to (new) alignment traps even with CCR.UNALIGN_TRP disabled. | |
| arm ldst | opt |
| arm ldst | ARM_LOAD_STORE_OPT_NAME |
| arm ldst | false |
| arm prera ldst | ARM_PREALLOC_LOAD_STORE_OPT_NAME |
| #define ARM_LOAD_STORE_OPT_NAME "ARM load / store optimization pass" |
Definition at line 95 of file ARMLoadStoreOptimizer.cpp.
Referenced by INITIALIZE_PASS_BEGIN().
| #define ARM_PREALLOC_LOAD_STORE_OPT_NAME "ARM pre- register allocation load / store optimization pass" |
Definition at line 2160 of file ARMLoadStoreOptimizer.cpp.
Referenced by INITIALIZE_PASS_BEGIN().
| #define DEBUG_TYPE "arm-ldst-opt" |
Definition at line 72 of file ARMLoadStoreOptimizer.cpp.
|
static |
Definition at line 3054 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), assert(), llvm::BuildMI(), llvm::MachineInstrBuilder::cloneMemRefs(), llvm::MachineRegisterInfo::constrainRegClass(), getBaseOperandIndex(), llvm::MachineFunction::getRegInfo(), llvm::isLegalAddressImm(), llvm_unreachable, MI, llvm::Offset, TII, and TRI.
Definition at line 634 of file ARMLoadStoreOptimizer.cpp.
References Reg.
|
static |
Definition at line 2568 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 3109 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::add, llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::ARMII::AddrModeMask, llvm::ARMII::AddrModeT2_i7, llvm::ARMII::AddrModeT2_i7s2, llvm::ARMII::AddrModeT2_i7s4, llvm::ARMII::AddrModeT2_i8, llvm::BuildMI(), llvm::MachineInstrBuilder::cloneMemRefs(), llvm::MachineRegisterInfo::constrainRegClass(), llvm::Define, getPostIndexedLoadStoreOpcode(), llvm::MachineFunction::getRegInfo(), llvm_unreachable, MI, llvm::Offset, llvm::ARM_AM::sub, TII, and TRI.
|
static |
Definition at line 221 of file ARMLoadStoreOptimizer.cpp.
References const, definesCPSR(), and MI.
Referenced by llvm::ARMTargetLowering::AdjustInstrPostInstrSelection(), definesCPSR(), and isIncrementOrDecrement().
|
static |
Searches for a increment or decrement of Reg after MBBI.
Definition at line 1260 of file ARMLoadStoreOptimizer.cpp.
References isIncrementOrDecrement(), MBB, MBBI, Off, llvm::Offset, Reg, and TRI.
|
static |
Searches for an increment or decrement of Reg before MBBI.
Definition at line 1240 of file ARMLoadStoreOptimizer.cpp.
References isIncrementOrDecrement(), MBB, MBBI, llvm::Offset, and Reg.
|
static |
Definition at line 2538 of file ARMLoadStoreOptimizer.cpp.
Referenced by updateRegisterMapForDbgValueListAfterMove().
|
static |
Definition at line 2920 of file ARMLoadStoreOptimizer.cpp.
References MI.
Referenced by AdjustBaseAndOffset().
Definition at line 437 of file ARMLoadStoreOptimizer.cpp.
References llvm_unreachable, and Opc.
|
static |
Definition at line 262 of file ARMLoadStoreOptimizer.cpp.
References MI.
Referenced by mayCombineMisaligned().
|
static |
Definition at line 270 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::da, llvm::ARM_AM::db, llvm::ARM_AM::ia, llvm::ARM_AM::ib, llvm_unreachable, and Mode.
|
static |
Definition at line 355 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::da, llvm::ARM_AM::db, llvm::ARM_AM::ia, llvm::ARM_AM::ib, and llvm_unreachable.
|
static |
Definition at line 266 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 454 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 234 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::getAM3Offset(), llvm::ARM_AM::getAM3Op(), llvm::ARM_AM::getAM5Offset(), llvm::ARM_AM::getAM5Op(), MI, llvm::Offset, and llvm::ARM_AM::sub.
|
static |
Definition at line 1409 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::add, llvm_unreachable, Mode, and Opc.
Referenced by createPostIncLoadStore().
|
static |
Definition at line 1384 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::add, llvm_unreachable, Mode, and Opc.
|
static |
Definition at line 1138 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::da, llvm::ARM_AM::db, llvm::ARM_AM::ia, llvm::ARM_AM::ib, llvm_unreachable, Mode, and Opc.
| INITIALIZE_PASS_BEGIN | ( | ARMLoadStoreOptLegacy | , |
| "arm-ldst-opt" | , | ||
| ARM_LOAD_STORE_OPT_NAME | , | ||
| false | , | ||
| false | ) |
References ARM_LOAD_STORE_OPT_NAME, and INITIALIZE_PASS_DEPENDENCY.
| INITIALIZE_PASS_BEGIN | ( | ARMPreAllocLoadStoreOptLegacy | , |
| "arm-prera-ldst-opt" | , | ||
| ARM_PREALLOC_LOAD_STORE_OPT_NAME | , | ||
| false | , | ||
| false | ) |
References ARM_PREALLOC_LOAD_STORE_OPT_NAME, INITIALIZE_PASS_DEPENDENCY, and INITIALIZE_PASS_END.
|
static |
Definition at line 1750 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineInstrBuilder::cloneMemRefs(), llvm::getDeadRegState(), llvm::getDefRegState(), llvm::getKillRegState(), llvm::getUndefRegState(), MBB, MBBI, MI, llvm::Offset, Reg, and TII.
|
static |
References AssumeMisalignedLoadStores, InstReorderLimit(), Modified, TII, and TRI.
Referenced by InstReorderLimit().
Definition at line 417 of file ARMLoadStoreOptimizer.cpp.
References isT1i32Load(), isT2i32Load(), and Opc.
Referenced by isLoadSingle(), and mayCombineMisaligned().
Definition at line 429 of file ARMLoadStoreOptimizer.cpp.
References isT1i32Store(), isT2i32Store(), and Opc.
Referenced by mayCombineMisaligned().
|
static |
Check if the given instruction increments or decrements a register and return the amount it is incremented/decremented.
Returns 0 if the CPSR flags generated by the instruction are possibly read as well.
Definition at line 1208 of file ARMLoadStoreOptimizer.cpp.
References definesCPSR(), llvm::getInstrPredicate(), MI, and Reg.
Referenced by findIncDecAfter(), and findIncDecBefore().
|
static |
Definition at line 3034 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARMII::AddrModeMask, llvm::ARMII::AddrModeT2_i12, Imm, llvm::isLegalAddressImm(), and TII.
Definition at line 433 of file ARMLoadStoreOptimizer.cpp.
References isi32Load(), and Opc.
|
static |
Returns true if instruction is a memory operation that this pass is capable of operating on.
Definition at line 1695 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineMemOperand::getAlign(), llvm::MachineMemOperand::isAtomic(), llvm::MachineMemOperand::isVolatile(), and MI.
|
static |
Definition at line 2985 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 3007 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 2262 of file ARMLoadStoreOptimizer.cpp.
References AbstractManglingParser< Derived, Alloc >::NumOps, llvm::sampleprof::Base, llvm::SmallPtrSetImpl< PtrType >::count(), llvm::SmallSet< T, N, C >::count(), E(), llvm::MachineOperand::getReg(), I, llvm::SmallSet< T, N, C >::insert(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), Reg, llvm::SmallSet< T, N, C >::size(), and TRI.
Definition at line 409 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Load().
Definition at line 421 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Store().
Definition at line 413 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Load().
Definition at line 425 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Store().
|
static |
Definition at line 996 of file ARMLoadStoreOptimizer.cpp.
References llvm::abs(), and llvm::Offset.
|
static |
Return true for loads/stores that can be combined to a double/multi operation without increasing the requirements for alignment.
Definition at line 1005 of file ARMLoadStoreOptimizer.cpp.
References llvm::TargetSubtargetInfo::getFrameLowering(), getLoadStoreBaseOp(), getReg(), llvm::TargetFrameLowering::getTransientStackAlign(), isi32Load(), isi32Store(), and MI.
| STATISTIC | ( | NumLDMGened | , |
| "Number of ldm instructions generated" | ) |
| STATISTIC | ( | NumLDRD2LDM | , |
| "Number of ldrd instructions turned back into ldm" | ) |
| STATISTIC | ( | NumLDRD2LDR | , |
| "Number of ldrd instructions turned back into ldr's" | ) |
| STATISTIC | ( | NumLDRDFormed | , |
| "Number of ldrd created before allocation" | ) |
| STATISTIC | ( | NumLdStMoved | , |
| "Number of load / store instructions moved" | ) |
| STATISTIC | ( | NumSTMGened | , |
| "Number of stm instructions generated" | ) |
| STATISTIC | ( | NumSTRD2STM | , |
| "Number of strd instructions turned back into stm" | ) |
| STATISTIC | ( | NumSTRD2STR | , |
| "Number of strd instructions turned back into str's" | ) |
| STATISTIC | ( | NumSTRDFormed | , |
| "Number of strd created before allocation" | ) |
| STATISTIC | ( | NumVLDMGened | , |
| "Number of vldm instructions generated" | ) |
| STATISTIC | ( | NumVSTMGened | , |
| "Number of vstm instructions generated" | ) |
|
static |
Definition at line 2555 of file ARMLoadStoreOptimizer.cpp.
References forEachDbgRegOperand(), and llvm::replace().
| arm ldst ARM_LOAD_STORE_OPT_NAME |
Definition at line 219 of file ARMLoadStoreOptimizer.cpp.
| arm prera ldst ARM_PREALLOC_LOAD_STORE_OPT_NAME |
Definition at line 2222 of file ARMLoadStoreOptimizer.cpp.
|
static |
This switch disables formation of double/multi instructions that could potentially lead to (new) alignment traps even with CCR.UNALIGN_TRP disabled.
This can be used to create libraries that are robust even when users provoke undefined behaviour by supplying misaligned pointers.
Referenced by InstReorderLimit().
| arm prera ldst false |
Definition at line 219 of file ARMLoadStoreOptimizer.cpp.
| arm prera ldst opt |
Definition at line 218 of file ARMLoadStoreOptimizer.cpp.