|
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 prera ldst | opt |
| arm prera ldst | ARM_PREALLOC_LOAD_STORE_OPT_NAME |
| arm prera ldst | false |
| #define ARM_LOAD_STORE_OPT_NAME "ARM load / store optimization pass" |
Definition at line 95 of file ARMLoadStoreOptimizer.cpp.
Referenced by INITIALIZE_PASS().
| #define ARM_PREALLOC_LOAD_STORE_OPT_NAME "ARM pre- register allocation load / store optimization pass" |
Definition at line 2150 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 3044 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 626 of file ARMLoadStoreOptimizer.cpp.
References Reg.
|
static |
Definition at line 2558 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 3099 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 |
Searches for a increment or decrement of Reg after MBBI.
Definition at line 1252 of file ARMLoadStoreOptimizer.cpp.
References isIncrementOrDecrement(), MBB, MBBI, llvm::Offset, Reg, and TRI.
|
static |
Searches for an increment or decrement of Reg before MBBI.
Definition at line 1232 of file ARMLoadStoreOptimizer.cpp.
References isIncrementOrDecrement(), MBB, MBBI, llvm::Offset, and Reg.
|
static |
Definition at line 2528 of file ARMLoadStoreOptimizer.cpp.
Referenced by updateRegisterMapForDbgValueListAfterMove().
|
static |
Definition at line 2910 of file ARMLoadStoreOptimizer.cpp.
References MI.
Referenced by AdjustBaseAndOffset().
Definition at line 431 of file ARMLoadStoreOptimizer.cpp.
References llvm_unreachable, and Opc.
|
static |
Definition at line 256 of file ARMLoadStoreOptimizer.cpp.
References MI.
Referenced by mayCombineMisaligned().
|
static |
Definition at line 264 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 349 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 260 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 448 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 228 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 1401 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::add, llvm_unreachable, Mode, and Opc.
Referenced by createPostIncLoadStore().
|
static |
Definition at line 1376 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::add, llvm_unreachable, Mode, and Opc.
|
static |
Definition at line 1130 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 | ( | ARMLoadStoreOptLegacy | , |
| "arm-ldst-opt" | , | ||
| ARM_LOAD_STORE_OPT_NAME | , | ||
| false | , | ||
| false | ) const & |
Definition at line 212 of file ARMLoadStoreOptimizer.cpp.
References ARM_LOAD_STORE_OPT_NAME, const, and MI.
| INITIALIZE_PASS_BEGIN | ( | ARMPreAllocLoadStoreOptLegacy | , |
| "arm-prera-ldst-opt" | , | ||
| ARM_PREALLOC_LOAD_STORE_OPT_NAME | , | ||
| false | , | ||
| false | ) |
References ARM_PREALLOC_LOAD_STORE_OPT_NAME, and INITIALIZE_PASS_DEPENDENCY.
|
static |
Definition at line 1742 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 411 of file ARMLoadStoreOptimizer.cpp.
References isT1i32Load(), isT2i32Load(), and Opc.
Referenced by isLoadSingle(), and mayCombineMisaligned().
Definition at line 423 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 1200 of file ARMLoadStoreOptimizer.cpp.
References llvm::getInstrPredicate(), MI, and Reg.
Referenced by findIncDecAfter(), and findIncDecBefore().
|
static |
Definition at line 3024 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARMII::AddrModeMask, llvm::ARMII::AddrModeT2_i12, llvm::isLegalAddressImm(), and TII.
Definition at line 427 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 1687 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineMemOperand::getAlign(), llvm::MachineMemOperand::isAtomic(), llvm::MachineMemOperand::isVolatile(), and MI.
|
static |
Definition at line 2975 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 2997 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 2252 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 403 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Load().
Definition at line 415 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Store().
Definition at line 407 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Load().
Definition at line 419 of file ARMLoadStoreOptimizer.cpp.
References Opc.
Referenced by isi32Store().
|
static |
Definition at line 988 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 997 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 2545 of file ARMLoadStoreOptimizer.cpp.
References forEachDbgRegOperand(), and llvm::replace().
| arm prera ldst ARM_PREALLOC_LOAD_STORE_OPT_NAME |
Definition at line 2212 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 2212 of file ARMLoadStoreOptimizer.cpp.
| arm prera ldst opt |
Definition at line 2211 of file ARMLoadStoreOptimizer.cpp.