LLVM
8.0.1
|
This file contains a pass that transforms CBZ/CBNZ/TBZ/TBNZ instructions into a conditional branch (B.cond), when the NZCV flags can be set for "free". More...
#include "AArch64.h"
#include "AArch64Subtarget.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "aarch64-cond-br-tuning" |
#define | AARCH64_CONDBR_TUNING_NAME "AArch64 Conditional Branch Tuning" |
Functions | |
INITIALIZE_PASS (AArch64CondBrTuning, "aarch64-cond-br-tuning", AARCH64_CONDBR_TUNING_NAME, false, false) void AArch64CondBrTuning | |
This file contains a pass that transforms CBZ/CBNZ/TBZ/TBNZ instructions into a conditional branch (B.cond), when the NZCV flags can be set for "free".
This is preferred on targets that have more flexibility when scheduling B.cond instructions as compared to CBZ/CBNZ/TBZ/TBNZ (assuming all other variables are equal). This can also reduce register pressure.
A few examples:
1) add w8, w0, w1 -> cmn w0, w1 ; CMN is an alias of ADDS. cbz w8, .LBB_2 -> b.eq .LBB0_2
2) add w8, w0, w1 -> adds w8, w0, w1 ; w8 has multiple uses. cbz w8, .LBB1_2 -> b.eq .LBB1_2
3) sub w8, w0, w1 -> subs w8, w0, w1 ; w8 has multiple uses. tbz w8, #31, .LBB6_2 -> b.pl .LBB6_2
Definition in file AArch64CondBrTuning.cpp.
#define AARCH64_CONDBR_TUNING_NAME "AArch64 Conditional Branch Tuning" |
Definition at line 45 of file AArch64CondBrTuning.cpp.
#define DEBUG_TYPE "aarch64-cond-br-tuning" |
Definition at line 44 of file AArch64CondBrTuning.cpp.
INITIALIZE_PASS | ( | AArch64CondBrTuning | , |
"aarch64-cond-br-tuning" | , | ||
AARCH64_CONDBR_TUNING_NAME | , | ||
false | , | ||
false | |||
) |
Definition at line 73 of file AArch64CondBrTuning.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addMBB(), assert(), llvm::BuildMI(), llvm::dbgs(), DefMI, E, llvm::AArch64CC::EQ, llvm::MachineInstr::eraseFromParent(), llvm::MachineFunctionPass::getAnalysisUsage(), llvm::MachineInstr::getDebugLoc(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getImm(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getName(), llvm::MachineInstr::getNumExplicitOperands(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::MachineOperand::isDead(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, LLVM_FALLTHROUGH, llvm_unreachable, MI, llvm::AArch64CC::MI, MRI, llvm::AArch64CC::NE, llvm::AArch64CC::PL, llvm::MachineInstr::print(), llvm::MachineOperand::setIsDead(), TII, and TRI.