LLVM  8.0.1
Macros | Functions
AArch64RedundantCopyElimination.cpp File Reference
#include "AArch64.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/LiveRegUnits.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"
Include dependency graph for AArch64RedundantCopyElimination.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "aarch64-copyelim"
 

Functions

 STATISTIC (NumCopiesRemoved, "Number of copies removed.")
 
 INITIALIZE_PASS (AArch64RedundantCopyElimination, "aarch64-copyelim", "AArch64 redundant copy elimination pass", false, false) bool AArch64RedundantCopyElimination
 It's possible to determine the value of a register based on a dominating condition. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "aarch64-copyelim"

Definition at line 65 of file AArch64RedundantCopyElimination.cpp.

Function Documentation

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( AArch64RedundantCopyElimination  ,
"aarch64-copyelim"  ,
"AArch64 redundant copy elimination pass ,
false  ,
false   
)

It's possible to determine the value of a register based on a dominating condition.

To do so, this function checks to see if the basic block MBB is the target of a conditional branch CondBr with an equality comparison. If the branch is a CBZ/CBNZ, we know the value of its source operand is zero in MBB for some cases. Otherwise, we find and inspect the NZCV setting instruction (e.g., SUBS, ADDS). If this instruction defines a register other than WZR/XZR, we know the value of the destination register is zero in MMB for some cases. In addition, if the NZCV setting instruction is comparing against a constant we know the other source register is equal to the constant in MBB for some cases. If we find any constant values, push a physical register and constant value pair onto the KnownRegs vector and return true. Otherwise, return false if no known values were found.

Definition at line 110 of file AArch64RedundantCopyElimination.cpp.

References llvm::LiveRegUnits::accumulateUsedDefed(), llvm::MachineBasicBlock::addLiveIn(), llvm::all_of(), llvm::any_of(), assert(), llvm::LiveRegUnits::available(), llvm::MachineBasicBlock::begin(), llvm::LiveRegUnits::clear(), llvm::dbgs(), E, llvm::SmallVectorBase::empty(), llvm::MachineBasicBlock::end(), llvm::AArch64CC::EQ, llvm::MachineInstr::eraseFromParent(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getImm(), llvm::MachineBasicBlock::getLastNonDebugInstr(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::MachineInstr::implicit_operands(), llvm::LiveRegUnits::init(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::insert(), llvm::MachineInstr::isCopy(), llvm::MachineBasicBlock::isLiveIn(), llvm::MachineInstr::isMoveImmediate(), llvm::MachineRegisterInfo::isReserved(), llvm::MCRegisterInfo::isSuperRegister(), LLVM_DEBUG, LLVM_FALLTHROUGH, llvm::make_range(), MI, llvm::MachineInstr::modifiesRegister(), llvm::AArch64CC::NE, llvm::RISCVFenceField::O, llvm::SmallVectorTemplateBase< T >::pop_back(), llvm::MachineBasicBlock::pred_begin(), llvm::MachineBasicBlock::pred_size(), llvm::MachineBasicBlock::rend(), llvm::SmallVectorBase::size(), llvm::MachineBasicBlock::succ_size(), and std::swap().

◆ STATISTIC()

STATISTIC ( NumCopiesRemoved  ,
"Number of copies removed."   
)