LLVM 20.0.0git
Macros | Functions | Variables
PHIElimination.cpp File Reference
#include "llvm/CodeGen/PHIElimination.h"
#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/MachineDomTreeUpdater.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>

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.
 
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.
 

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 49 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 333 of file PHIElimination.cpp.

References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), I, isImplicitlyDefined(), llvm::MachineOperand::isUndef(), and MRI.

◆ 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 324 of file PHIElimination.cpp.

References MRI.

Referenced by allPhiOperandsUndefined().

◆ STATISTIC() [1/3]

STATISTIC ( NumCriticalEdgesSplit  ,
"Number of critical edges split"   
)

◆ STATISTIC() [2/3]

STATISTIC ( NumLowered  ,
"Number of phis lowered"   
)

◆ STATISTIC() [3/3]

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

Variable Documentation

◆ allocation

Eliminate PHI nodes for register allocation

Definition at line 193 of file PHIElimination.cpp.

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 192 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")) ( "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 193 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.")) ( "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")) ( "phi-elim-split-all-critical-edges"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Split all critical edges during " "PHI elimination")   
)
static