LLVM  8.0.1
Macros | Functions | Variables
PHIElimination.cpp File Reference
#include "PHIEliminationUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <iterator>
#include <utility>
Include dependency graph for PHIElimination.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "phi-node-elimination"
 

Functions

 STATISTIC (NumLowered, "Number of phis lowered")
 
 STATISTIC (NumCriticalEdgesSplit, "Number of critical edges split")
 
 STATISTIC (NumReused, "Number of reused lowered phis")
 
 INITIALIZE_PASS_BEGIN (PHIElimination, DEBUG_TYPE, "Eliminate PHI nodes for register allocation", false, false) INITIALIZE_PASS_END(PHIElimination
 
static bool isImplicitlyDefined (unsigned VirtReg, const MachineRegisterInfo &MRI)
 Return true if all defs of VirtReg are implicit-defs. More...
 
static bool allPhiOperandsUndefined (const MachineInstr &MPhi, const MachineRegisterInfo &MRI)
 Return true if all sources of the phi node are implicit_def's, or undef's. More...
 

Variables

static cl::opt< boolDisableEdgeSplitting ("disable-phi-elim-edge-splitting", cl::init(false), cl::Hidden, cl::desc("Disable critical edge splitting " "during PHI elimination"))
 
static cl::opt< boolSplitAllCriticalEdges ("phi-elim-split-all-critical-edges", cl::init(false), cl::Hidden, cl::desc("Split all critical edges during " "PHI elimination"))
 
static cl::opt< boolNoPhiElimLiveOutEarlyExit ("no-phi-elim-live-out-early-exit", cl::init(false), cl::Hidden, cl::desc("Do not use an early exit if isLiveOutPastPHIs returns true."))
 
 DEBUG_TYPE
 
Eliminate PHI nodes for register allocation
 
Eliminate PHI nodes for register false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "phi-node-elimination"

Definition at line 48 of file PHIElimination.cpp.

Function Documentation

◆ allPhiOperandsUndefined()

static bool allPhiOperandsUndefined ( const MachineInstr MPhi,
const MachineRegisterInfo MRI 
)
static

Return true if all sources of the phi node are implicit_def's, or undef's.

Definition at line 224 of file PHIElimination.cpp.

References llvm::LiveRange::addSegment(), assert(), llvm::MachineBasicBlock::begin(), llvm::LiveRange::begin(), llvm::BuildMI(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::LiveRange::createDeadDef(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::dbgs(), llvm::VNInfo::def, DefMI, llvm::MachineFunction::DeleteMachineInstr(), llvm::MachineBasicBlock::dump(), E, llvm::MachineBasicBlock::empty(), llvm::MachineBasicBlock::end(), llvm::LiveRange::end(), llvm::LiveRange::endIndex(), entry, llvm::LiveVariables::VarInfo::findKill(), llvm::findPHICopyInsertPoint(), llvm::MachineBasicBlock::front(), llvm::MCInstrInfo::get(), llvm::SlotIndex::getDeadSlot(), llvm::MachineInstr::getDebugLoc(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineLoopInfo::getLoopFor(), llvm::MachineOperand::getMBB(), llvm::LiveRange::getNextValue(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::SlotIndex::getRegSlot(), llvm::MachineOperand::getSubReg(), llvm::MachineFunction::getSubtarget(), llvm::LiveRange::getVNInfoAt(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SlotIndex::isDead(), llvm::MachineOperand::isDead(), llvm::MachineBasicBlock::isEHPad(), llvm::MachineInstr::isImplicitDef(), isImplicitlyDefined(), isLiveOut(), llvm::MachineInstr::isPHI(), llvm::MachineOperand::isUndef(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::LiveRange::liveAt(), LLVM_DEBUG, MRI, NoPhiElimLiveOutEarlyExit, llvm::printMBBReference(), llvm::printReg(), Reg, llvm::MachineBasicBlock::remove(), llvm::LiveRange::removeSegment(), llvm::LiveRange::removeValNo(), SI, llvm::SplitAllCriticalEdges(), llvm::MachineBasicBlock::SplitCriticalEdge(), llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_end(), llvm::MachineBasicBlock::succ_size(), llvm::MachineBasicBlock::successors(), TII, and VI.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( PHIElimination  ,
DEBUG_TYPE  ,
"Eliminate PHI nodes for register allocation ,
false  ,
false   
)

◆ isImplicitlyDefined()

static bool isImplicitlyDefined ( unsigned  VirtReg,
const MachineRegisterInfo MRI 
)
static

Return true if all defs of VirtReg are implicit-defs.

This includes registers with no defs.

Definition at line 215 of file PHIElimination.cpp.

References llvm::MachineRegisterInfo::def_instructions().

Referenced by allPhiOperandsUndefined().

◆ STATISTIC() [1/3]

STATISTIC ( NumLowered  ,
"Number of phis lowered"   
)

◆ STATISTIC() [2/3]

STATISTIC ( NumCriticalEdgesSplit  ,
"Number of critical edges split  
)

◆ STATISTIC() [3/3]

STATISTIC ( NumReused  ,
"Number of reused lowered phis"   
)

Variable Documentation

◆ allocation

Eliminate PHI nodes for register allocation

Definition at line 133 of file PHIElimination.cpp.

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 133 of file PHIElimination.cpp.

◆ DisableEdgeSplitting

cl::opt<bool> DisableEdgeSplitting("disable-phi-elim-edge-splitting", cl::init(false), cl::Hidden, cl::desc("Disable critical edge splitting " "during PHI elimination"))
static

◆ false

Eliminate PHI nodes for register false

Definition at line 133 of file PHIElimination.cpp.

◆ NoPhiElimLiveOutEarlyExit

cl::opt<bool> NoPhiElimLiveOutEarlyExit("no-phi-elim-live-out-early-exit", cl::init(false), cl::Hidden, cl::desc("Do not use an early exit if isLiveOutPastPHIs returns true."))
static

Referenced by allPhiOperandsUndefined().

◆ SplitAllCriticalEdges

cl::opt<bool> SplitAllCriticalEdges("phi-elim-split-all-critical-edges", cl::init(false), cl::Hidden, cl::desc("Split all critical edges during " "PHI elimination"))
static