LLVM  6.0.0svn
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/LiveIntervalAnalysis.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/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetOpcodes.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.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)
 isImplicitlyDefined - Return true if all defs of VirtReg are implicit-defs. More...
 
static bool isSourceDefinedByImplicitDef (const MachineInstr *MPhi, const MachineRegisterInfo *MRI)
 isSourceDefinedByImplicitDef - Return true if all sources of the phi node are implicit_def'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

◆ 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

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

This includes registers with no defs.

Definition at line 217 of file PHIElimination.cpp.

References llvm::MachineRegisterInfo::def_instructions().

Referenced by isSourceDefinedByImplicitDef().

◆ isSourceDefinedByImplicitDef()

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

isSourceDefinedByImplicitDef - Return true if all sources of the phi node are implicit_def's.

Definition at line 227 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(), DEBUG, llvm::VNInfo::def, DefMI, llvm::MachineFunction::DeleteMachineInstr(), llvm::MachineBasicBlock::dump(), llvm::MachineBasicBlock::empty(), llvm::MachineBasicBlock::end(), llvm::LiveRange::end(), llvm::LiveRange::endIndex(), 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(), 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(), MRI, NoPhiElimLiveOutEarlyExit, llvm::PrintReg(), 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.

◆ 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

◆ 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