LLVM 20.0.0git
Macros | Functions | Variables
MachineCSE.cpp File Reference
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/ScopedHashTable.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/MCRegister.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/RecyclingAllocator.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   "machine-cse"
 

Functions

 STATISTIC (NumCoalesces, "Number of copies coalesced")
 
 STATISTIC (NumCSEs, "Number of common subexpression eliminated")
 
 STATISTIC (NumPREs, "Number of partial redundant expression" " transformed to fully redundant")
 
 STATISTIC (NumPhysCSEs, "Number of physreg referencing common subexpr eliminated")
 
 STATISTIC (NumCrossBBCSEs, "Number of cross-MBB physreg referencing CS eliminated")
 
 STATISTIC (NumCommutes, "Number of copies coalesced after commuting")
 
 INITIALIZE_PASS_BEGIN (MachineCSE, DEBUG_TYPE, "Machine Common Subexpression Elimination", false, false) INITIALIZE_PASS_END(MachineCSE
 
static bool isCallerPreservedOrConstPhysReg (MCRegister Reg, const MachineOperand &MO, const MachineFunction &MF, const TargetRegisterInfo &TRI, const TargetInstrInfo &TII)
 

Variables

static cl::opt< int > CSUsesThreshold ("csuses-threshold", cl::Hidden, cl::init(1024), cl::desc("Threshold for the size of CSUses"))
 
static cl::opt< boolAggressiveMachineCSE ("aggressive-machine-cse", cl::Hidden, cl::init(false), cl::desc("Override the profitability heuristics for Machine CSE"))
 
 DEBUG_TYPE
 
Machine Common Subexpression Elimination
 
Machine Common Subexpression false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "machine-cse"

Definition at line 50 of file MachineCSE.cpp.

Function Documentation

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( MachineCSE  ,
DEBUG_TYPE  ,
"Machine Common Subexpression Elimination"  ,
false  ,
false   
)

◆ isCallerPreservedOrConstPhysReg()

static bool isCallerPreservedOrConstPhysReg ( MCRegister  Reg,
const MachineOperand MO,
const MachineFunction MF,
const TargetRegisterInfo TRI,
const TargetInstrInfo TII 
)
static

Definition at line 268 of file MachineCSE.cpp.

References llvm::MachineFunction::getRegInfo(), MRI, TII, and TRI.

◆ STATISTIC() [1/6]

STATISTIC ( NumCoalesces  ,
"Number of copies coalesced"   
)

◆ STATISTIC() [2/6]

STATISTIC ( NumCommutes  ,
"Number of copies coalesced after commuting"   
)

◆ STATISTIC() [3/6]

STATISTIC ( NumCrossBBCSEs  ,
"Number of cross-MBB physreg referencing CS eliminated"   
)

◆ STATISTIC() [4/6]

STATISTIC ( NumCSEs  ,
"Number of common subexpression eliminated"   
)

◆ STATISTIC() [5/6]

STATISTIC ( NumPhysCSEs  ,
"Number of physreg referencing common subexpr eliminated"   
)

◆ STATISTIC() [6/6]

STATISTIC ( NumPREs  ,
"Number of partial redundant expression" " transformed to fully redundant"   
)

Variable Documentation

◆ AggressiveMachineCSE

cl::opt< bool > AggressiveMachineCSE("aggressive-machine-cse", cl::Hidden, cl::init(false), cl::desc("Override the profitability heuristics for Machine CSE")) ( "aggressive-machine-cse"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Override the profitability heuristics for Machine CSE")   
)
static

◆ CSUsesThreshold

cl::opt< int > CSUsesThreshold("csuses-threshold", cl::Hidden, cl::init(1024), cl::desc("Threshold for the size of CSUses")) ( "csuses-threshold"  ,
cl::Hidden  ,
cl::init(1024)  ,
cl::desc("Threshold for the size of CSUses")   
)
static

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 171 of file MachineCSE.cpp.

◆ Elimination

Machine Common Subexpression Elimination

Definition at line 172 of file MachineCSE.cpp.

◆ false

Machine Common Subexpression false

Definition at line 172 of file MachineCSE.cpp.