LLVM 20.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/DerivedTypes.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 <algorithm>
#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 97 of file ARMLoadStoreOptimizer.cpp.
#define ARM_PREALLOC_LOAD_STORE_OPT_NAME "ARM pre- register allocation load / store optimization pass" |
Definition at line 2135 of file ARMLoadStoreOptimizer.cpp.
#define DEBUG_TYPE "arm-ldst-opt" |
Definition at line 74 of file ARMLoadStoreOptimizer.cpp.
|
static |
Definition at line 3015 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), assert(), llvm::BuildMI(), llvm::MachineInstrBuilder::cloneMemRefs(), getBaseOperandIndex(), llvm::MachineFunction::getRegInfo(), llvm::isLegalAddressImm(), llvm_unreachable, MI, MRI, llvm::Offset, TII, and TRI.
|
static |
Definition at line 617 of file ARMLoadStoreOptimizer.cpp.
|
static |
Definition at line 2526 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 3070 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineInstrBuilder::add(), llvm::ARM_AM::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::RegState::Define, getPostIndexedLoadStoreOpcode(), llvm::MachineFunction::getRegInfo(), llvm_unreachable, MI, MRI, llvm::Offset, llvm::ARM_AM::sub, TII, TRI, and llvm::MCInstrDesc::TSFlags.
|
static |
Searches for a increment or decrement of Reg
after MBBI
.
Definition at line 1243 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::getParent(), isIncrementOrDecrement(), MBB, MBBI, llvm::Offset, and TRI.
|
static |
Searches for an increment or decrement of Reg
before MBBI
.
Definition at line 1223 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::getParent(), isIncrementOrDecrement(), MBB, MBBI, and llvm::Offset.
|
static |
Definition at line 2494 of file ARMLoadStoreOptimizer.cpp.
Referenced by updateRegisterMapForDbgValueListAfterMove().
|
static |
Definition at line 2881 of file ARMLoadStoreOptimizer.cpp.
References MI.
Referenced by AdjustBaseAndOffset().
Definition at line 423 of file ARMLoadStoreOptimizer.cpp.
References llvm_unreachable.
|
static |
Definition at line 248 of file ARMLoadStoreOptimizer.cpp.
References MI.
Referenced by mayCombineMisaligned().
|
static |
Definition at line 256 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 341 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 252 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 440 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 220 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 1392 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::add, and llvm_unreachable.
Referenced by createPostIncLoadStore().
|
static |
Definition at line 1367 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::add, and llvm_unreachable.
|
static |
Definition at line 1121 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARM_AM::da, llvm::ARM_AM::db, llvm::ARM_AM::ia, llvm::ARM_AM::ib, and llvm_unreachable.
INITIALIZE_PASS | ( | ARMLoadStoreOpt | , |
"arm-ldst-opt" | , | ||
ARM_LOAD_STORE_OPT_NAME | , | ||
false | , | ||
false | |||
) | const & |
Definition at line 204 of file ARMLoadStoreOptimizer.cpp.
References MI.
INITIALIZE_PASS_BEGIN | ( | ARMPreAllocLoadStoreOpt | , |
"arm-prera-ldst-opt" | , | ||
ARM_PREALLOC_LOAD_STORE_OPT_NAME | , | ||
false | , | ||
false | |||
) |
|
static |
Definition at line 1733 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, and TII.
|
static |
References AssumeMisalignedLoadStores, Modified, MRI, TII, and TRI.
Definition at line 403 of file ARMLoadStoreOptimizer.cpp.
References isT1i32Load(), and isT2i32Load().
Referenced by isLoadSingle(), and mayCombineMisaligned().
Definition at line 415 of file ARMLoadStoreOptimizer.cpp.
References isT1i32Store(), and isT2i32Store().
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 1191 of file ARMLoadStoreOptimizer.cpp.
References llvm::getInstrPredicate(), and MI.
Referenced by findIncDecAfter(), and findIncDecBefore().
|
static |
Definition at line 2995 of file ARMLoadStoreOptimizer.cpp.
References llvm::ARMII::AddrModeMask, llvm::ARMII::AddrModeT2_i12, llvm::isLegalAddressImm(), and TII.
Definition at line 419 of file ARMLoadStoreOptimizer.cpp.
References isi32Load().
|
static |
Returns true if instruction is a memory operation that this pass is capable of operating on.
Definition at line 1678 of file ARMLoadStoreOptimizer.cpp.
References llvm::MachineMemOperand::getAlign(), llvm::MachineMemOperand::isAtomic(), llvm::MachineMemOperand::isVolatile(), and MI.
|
static |
Definition at line 2946 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 2968 of file ARMLoadStoreOptimizer.cpp.
References MI.
|
static |
Definition at line 2218 of file ARMLoadStoreOptimizer.cpp.
References llvm::sampleprof::Base, llvm::SmallSet< T, N, C >::count(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::MachineOperand::getReg(), I, llvm::SmallSet< T, N, C >::insert(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), llvm::SmallSet< T, N, C >::size(), and TRI.
Definition at line 395 of file ARMLoadStoreOptimizer.cpp.
Referenced by isi32Load().
Definition at line 407 of file ARMLoadStoreOptimizer.cpp.
Referenced by isi32Store().
Definition at line 399 of file ARMLoadStoreOptimizer.cpp.
Referenced by isi32Load().
Definition at line 411 of file ARMLoadStoreOptimizer.cpp.
Referenced by isi32Store().
|
static |
Definition at line 979 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 988 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 2511 of file ARMLoadStoreOptimizer.cpp.
References for(), forEachDbgRegOperand(), I, and if().
arm prera ldst ARM_PREALLOC_LOAD_STORE_OPT_NAME |
Definition at line 2191 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 2191 of file ARMLoadStoreOptimizer.cpp.
arm prera ldst opt |
Definition at line 2190 of file ARMLoadStoreOptimizer.cpp.
Referenced by llvm::lto::backend(), llvm::LTOCodeGenerator::optimize(), and llvm::lto::thinBackend().