LLVM API Documentation

Defines | Functions | Variables
PeepholeOptimizer.cpp File Reference
#include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <utility>
Include dependency graph for PeepholeOptimizer.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "peephole-opt"

Functions

 STATISTIC (NumReuse,"Number of extension results reused")
 STATISTIC (NumCmps,"Number of compares eliminated")
 STATISTIC (NumImmFold,"Number of move immediate folded")
 STATISTIC (NumLoadFold,"Number of loads folded")
 STATISTIC (NumSelects,"Number of selects optimized")
 STATISTIC (NumUncoalescableCopies,"Number of uncoalescable copies optimized")
 STATISTIC (NumRewrittenCopies,"Number of copies rewritten")
 INITIALIZE_PASS_BEGIN (PeepholeOptimizer,"peephole-opts","Peephole Optimizations", false, false) INITIALIZE_PASS_END(PeepholeOptimizer
static bool shareSameRegisterFile (const TargetRegisterInfo &TRI, const TargetRegisterClass *DefRC, unsigned DefSubReg, const TargetRegisterClass *SrcRC, unsigned SrcSubReg)
 Check if the registers defined by the pair (RegisterClass, SubReg) share the same register file.
static CopyRewriter * getCopyRewriter (MachineInstr &MI, const TargetInstrInfo &TII)
 Get the appropriated CopyRewriter for MI.

Variables

static cl::opt< boolAggressive ("aggressive-ext-opt", cl::Hidden, cl::desc("Aggressive extension optimization"))
static cl::opt< boolDisablePeephole ("disable-peephole", cl::Hidden, cl::init(false), cl::desc("Disable the peephole optimizer"))
static cl::opt< boolDisableAdvCopyOpt ("disable-adv-copy-opt", cl::Hidden, cl::init(false), cl::desc("Disable advanced copy optimization"))
peephole opts
peephole Peephole Optimizations
peephole Peephole false

Define Documentation

#define DEBUG_TYPE   "peephole-opt"

Definition at line 85 of file PeepholeOptimizer.cpp.


Function Documentation

static CopyRewriter* getCopyRewriter ( MachineInstr MI,
const TargetInstrInfo TII 
) [static]

Get the appropriated CopyRewriter for MI.

Returns:
A pointer to a dynamically allocated CopyRewriter or nullptr if no rewriter works for MI.

Definition at line 846 of file PeepholeOptimizer.cpp.

References llvm::TargetOpcode::COPY, llvm::TargetOpcode::EXTRACT_SUBREG, llvm::MachineInstr::getOpcode(), llvm::TargetOpcode::INSERT_SUBREG, llvm_unreachable, and llvm::TargetOpcode::REG_SEQUENCE.

INITIALIZE_PASS_BEGIN ( PeepholeOptimizer  ,
"peephole-opts ,
"Peephole Optimizations ,
false  ,
false   
)
static bool shareSameRegisterFile ( const TargetRegisterInfo TRI,
const TargetRegisterClass DefRC,
unsigned  DefSubReg,
const TargetRegisterClass SrcRC,
unsigned  SrcSubReg 
) [static]

Check if the registers defined by the pair (RegisterClass, SubReg) share the same register file.

Definition at line 504 of file PeepholeOptimizer.cpp.

References llvm::TargetRegisterInfo::getCommonSubClass(), llvm::TargetRegisterInfo::getCommonSuperRegClass(), llvm::TargetRegisterInfo::getMatchingSuperRegClass(), and std::swap().

STATISTIC ( NumReuse  ,
"Number of extension results reused"   
)
STATISTIC ( NumCmps  ,
"Number of compares eliminated"   
)
STATISTIC ( NumImmFold  ,
"Number of move immediate folded"   
)
STATISTIC ( NumLoadFold  ,
"Number of loads folded"   
)
STATISTIC ( NumSelects  ,
"Number of selects optimized"   
)
STATISTIC ( NumUncoalescableCopies  ,
"Number of uncoalescable copies optimized"   
)
STATISTIC ( NumRewrittenCopies  ,
"Number of copies rewritten"   
)

Variable Documentation

cl::opt<bool> Aggressive("aggressive-ext-opt", cl::Hidden, cl::desc("Aggressive extension optimization")) [static]
cl::opt<bool> DisableAdvCopyOpt("disable-adv-copy-opt", cl::Hidden, cl::init(false), cl::desc("Disable advanced copy optimization")) [static]
cl::opt<bool> DisablePeephole("disable-peephole", cl::Hidden, cl::init(false), cl::desc("Disable the peephole optimizer")) [static]
peephole Peephole false

Definition at line 300 of file PeepholeOptimizer.cpp.

peephole Peephole Optimizations

Definition at line 300 of file PeepholeOptimizer.cpp.

peephole opts

Definition at line 300 of file PeepholeOptimizer.cpp.