LLVM
8.0.1
|
#include "llvm/CodeGen/GlobalISel/CombinerHelper.h"
Public Member Functions | |
CombinerHelper (GISelChangeObserver &Observer, MachineIRBuilder &B) | |
void | replaceRegWith (MachineRegisterInfo &MRI, unsigned FromReg, unsigned ToReg) const |
MachineRegisterInfo::replaceRegWith() and inform the observer of the changes. More... | |
void | replaceRegOpWith (MachineRegisterInfo &MRI, MachineOperand &FromRegOp, unsigned ToReg) const |
Replace a single register operand with a new register and inform the observer of the changes. More... | |
bool | tryCombineCopy (MachineInstr &MI) |
If MI is COPY, try to combine it. More... | |
bool | tryCombineExtendingLoads (MachineInstr &MI) |
If MI is extend that consumes the result of a load, try to combine it. More... | |
bool | tryCombine (MachineInstr &MI) |
Try to transform MI by using all of the above combine functions. More... | |
Definition at line 29 of file CombinerHelper.h.
CombinerHelper::CombinerHelper | ( | GISelChangeObserver & | Observer, |
MachineIRBuilder & | B | ||
) |
Definition at line 22 of file CombinerHelper.cpp.
void CombinerHelper::replaceRegOpWith | ( | MachineRegisterInfo & | MRI, |
MachineOperand & | FromRegOp, | ||
unsigned | ToReg | ||
) | const |
Replace a single register operand with a new register and inform the observer of the changes.
Definition at line 38 of file CombinerHelper.cpp.
References assert(), llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineOperand::getParent(), and llvm::MachineOperand::setReg().
Referenced by tryCombineExtendingLoads().
void CombinerHelper::replaceRegWith | ( | MachineRegisterInfo & | MRI, |
unsigned | FromReg, | ||
unsigned | ToReg | ||
) | const |
MachineRegisterInfo::replaceRegWith() and inform the observer of the changes.
Definition at line 26 of file CombinerHelper.cpp.
References llvm::MachineIRBuilder::buildCopy(), llvm::GISelChangeObserver::changingAllUsesOfReg(), llvm::MachineRegisterInfo::constrainRegAttrs(), llvm::GISelChangeObserver::finishedChangingAllUsesOfReg(), and llvm::MachineRegisterInfo::replaceRegWith().
Referenced by tryCombineCopy(), and tryCombineExtendingLoads().
bool CombinerHelper::tryCombine | ( | MachineInstr & | MI | ) |
Try to transform MI
by using all of the above combine functions.
Returns true if changed.
Definition at line 331 of file CombinerHelper.cpp.
References tryCombineCopy(), and tryCombineExtendingLoads().
bool CombinerHelper::tryCombineCopy | ( | MachineInstr & | MI | ) |
If MI
is COPY, try to combine it.
Returns true if MI changed.
Definition at line 49 of file CombinerHelper.cpp.
References DefMI, llvm::MachineInstr::eraseFromParent(), function, llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineOperand::getMBB(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::MachineInstr::isPHI(), llvm::LLT::isValid(), MI, replaceRegWith(), and UseMI.
Referenced by tryCombine().
bool CombinerHelper::tryCombineExtendingLoads | ( | MachineInstr & | MI | ) |
If MI
is extend that consumes the result of a load, try to combine it.
Returns true if MI changed.
rewrites to:
rewrites to:
Definition at line 155 of file CombinerHelper.cpp.
References assert(), llvm::dbgs(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getParent(), llvm::MachineOperand::getReg(), llvm::LLT::getSizeInBits(), LLVM_DEBUG, MRI, llvm::SmallVectorTemplateBase< T >::push_back(), replaceRegOpWith(), replaceRegWith(), llvm::MachineInstr::setDesc(), llvm::MachineOperand::setReg(), and UseMI.
Referenced by tryCombine().