23#define LOONGARCH_LATE_BRANCH_OPT_NAME "LoongArch Late Branch Optimisation Pass"
44char LoongArchLateBranchOptLegacy::ID = 0;
65 if (
Cond.size() < 2 || !
Cond[1].isReg() ||
66 Cond[1].getReg() != LoongArch::R0)
72 if (
Cond.size() < 3 || !
Cond[1].isReg() || !
Cond[2].isReg() ||
73 Cond[1].getReg() !=
Cond[2].getReg())
91 while (!
MBB.succ_empty())
92 MBB.removeSuccessor(
MBB.succ_end() - 1);
97 if (Fallthrough !=
MBB.getParent()->end())
98 MBB.addSuccessor(&*Fallthrough);
115bool LoongArchLateBranchOptLegacy::runOnMachineFunction(
MachineFunction &MF) {
122 return new LoongArchLateBranchOptLegacy();
const AArch64InstrInfo & TII
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static bool runLateBranchOpt(MachineFunction &MF)
MachineBasicBlock * Folded
SmallVector< MachineOperand, 4 > Cond
#define LOONGARCH_LATE_BRANCH_OPT_NAME
static bool runOnBasicBlock(MachineBasicBlock *MBB, unsigned BasicBlockNum, VRegRenamer &Renamer)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
BasicBlockListType::iterator iterator
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Pass manager infrastructure for declaring and invalidating analyses.
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
FunctionPass * createLoongArchLateBranchOptLegacyPass()