LLVM
15.0.0git
|
A wrapper class to simplify modification of SwitchInst cases along with their prof branch_weights metadata. More...
#include "llvm/IR/Instructions.h"
Public Types | |
using | CaseWeightOpt = Optional< uint32_t > |
Public Member Functions | |
SwitchInst * | operator-> () |
SwitchInst & | operator* () |
operator SwitchInst * () | |
SwitchInstProfUpdateWrapper (SwitchInst &SI) | |
~SwitchInstProfUpdateWrapper () | |
SwitchInst::CaseIt | removeCase (SwitchInst::CaseIt I) |
Delegate the call to the underlying SwitchInst::removeCase() and remove correspondent branch weight. More... | |
void | addCase (ConstantInt *OnVal, BasicBlock *Dest, CaseWeightOpt W) |
Delegate the call to the underlying SwitchInst::addCase() and set the specified branch weight for the added case. More... | |
SymbolTableList< Instruction >::iterator | eraseFromParent () |
Delegate the call to the underlying SwitchInst::eraseFromParent() and mark this object to not touch the underlying SwitchInst in destructor. More... | |
void | setSuccessorWeight (unsigned idx, CaseWeightOpt W) |
CaseWeightOpt | getSuccessorWeight (unsigned idx) |
Static Public Member Functions | |
static CaseWeightOpt | getSuccessorWeight (const SwitchInst &SI, unsigned idx) |
Protected Member Functions | |
MDNode * | buildProfBranchWeightsMD () |
void | init () |
Static Protected Member Functions | |
static MDNode * | getProfBranchWeightsMD (const SwitchInst &SI) |
A wrapper class to simplify modification of SwitchInst cases along with their prof branch_weights metadata.
Definition at line 3585 of file Instructions.h.
Definition at line 3598 of file Instructions.h.
|
inline |
Definition at line 3603 of file Instructions.h.
|
inline |
Definition at line 3605 of file Instructions.h.
References buildProfBranchWeightsMD(), and SI.
void SwitchInstProfUpdateWrapper::addCase | ( | ConstantInt * | OnVal, |
BasicBlock * | Dest, | ||
SwitchInstProfUpdateWrapper::CaseWeightOpt | W | ||
) |
Delegate the call to the underlying SwitchInst::addCase() and set the specified branch weight for the added case.
Definition at line 4467 of file Instructions.cpp.
References assert(), SI, and llvm::RISCVFenceField::W.
Referenced by unswitchTrivialSwitch().
|
protected |
Definition at line 4415 of file Instructions.cpp.
References llvm::all_of(), assert(), llvm::MDBuilder::createBranchWeights(), SI, and llvm::RISCVFenceField::W.
Referenced by ~SwitchInstProfUpdateWrapper().
SymbolTableList< Instruction >::iterator SwitchInstProfUpdateWrapper::eraseFromParent | ( | ) |
Delegate the call to the underlying SwitchInst::eraseFromParent() and mark this object to not touch the underlying SwitchInst in destructor.
Definition at line 4486 of file Instructions.cpp.
References SI.
Referenced by unswitchTrivialSwitch().
|
staticprotected |
Definition at line 4407 of file Instructions.cpp.
References SI.
Referenced by getSuccessorWeight(), and init().
|
static |
Definition at line 4519 of file Instructions.cpp.
References getProfBranchWeightsMD(), llvm::None, and SI.
SwitchInstProfUpdateWrapper::CaseWeightOpt SwitchInstProfUpdateWrapper::getSuccessorWeight | ( | unsigned | idx | ) |
Definition at line 4495 of file Instructions.cpp.
References llvm::None.
Referenced by unswitchTrivialSwitch().
|
protected |
Definition at line 4433 of file Instructions.cpp.
References llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), getProfBranchWeightsMD(), llvm_unreachable, move, and SI.
Referenced by SwitchInstProfUpdateWrapper().
|
inline |
Definition at line 3601 of file Instructions.h.
References SI.
|
inline |
Definition at line 3600 of file Instructions.h.
References SI.
|
inline |
Definition at line 3599 of file Instructions.h.
References SI.
SwitchInst::CaseIt SwitchInstProfUpdateWrapper::removeCase | ( | SwitchInst::CaseIt | I | ) |
Delegate the call to the underlying SwitchInst::removeCase() and remove correspondent branch weight.
Definition at line 4453 of file Instructions.cpp.
References assert(), I, and SI.
Referenced by eliminateDeadSwitchCases(), and unswitchTrivialSwitch().
void SwitchInstProfUpdateWrapper::setSuccessorWeight | ( | unsigned | idx, |
SwitchInstProfUpdateWrapper::CaseWeightOpt | W | ||
) |
Definition at line 4501 of file Instructions.cpp.
References SI, and llvm::RISCVFenceField::W.
Referenced by unswitchTrivialSwitch().