| 
    LLVM 22.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 = std::optional<uint32_t> | 
Public Member Functions | |
| SwitchInst * | operator-> () | 
| SwitchInst & | operator* () | 
| operator SwitchInst * () | |
| SwitchInstProfUpdateWrapper (SwitchInst &SI) | |
| ~SwitchInstProfUpdateWrapper () | |
| LLVM_ABI SwitchInst::CaseIt | removeCase (SwitchInst::CaseIt I) | 
| Delegate the call to the underlying SwitchInst::removeCase() and remove correspondent branch weight.   | |
| LLVM_ABI 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.   | |
| LLVM_ABI Instruction::InstListType::iterator | eraseFromParent () | 
| Delegate the call to the underlying SwitchInst::eraseFromParent() and mark this object to not touch the underlying SwitchInst in destructor.   | |
| LLVM_ABI void | setSuccessorWeight (unsigned idx, CaseWeightOpt W) | 
| LLVM_ABI CaseWeightOpt | getSuccessorWeight (unsigned idx) | 
Static Public Member Functions | |
| static LLVM_ABI CaseWeightOpt | getSuccessorWeight (const SwitchInst &SI, unsigned idx) | 
Protected Member Functions | |
| LLVM_ABI void | init () | 
A wrapper class to simplify modification of SwitchInst cases along with their prof branch_weights metadata.
Definition at line 3534 of file Instructions.h.
| using llvm::SwitchInstProfUpdateWrapper::CaseWeightOpt = std::optional<uint32_t> | 
Definition at line 3543 of file Instructions.h.
      
  | 
  inline | 
Definition at line 3548 of file Instructions.h.
References init().
      
  | 
  inline | 
Definition at line 3550 of file Instructions.h.
References llvm::setBranchWeights().
| 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 4174 of file Instructions.cpp.
References assert(), and llvm::SmallVector.
Referenced by eliminateDeadSwitchCases(), and unswitchTrivialSwitch().
| Instruction::InstListType::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 4193 of file Instructions.cpp.
Referenced by unswitchTrivialSwitch().
      
  | 
  static | 
Definition at line 4226 of file Instructions.cpp.
References llvm::mdconst::extract(), and llvm::getBranchWeightMDNode().
| SwitchInstProfUpdateWrapper::CaseWeightOpt SwitchInstProfUpdateWrapper::getSuccessorWeight | ( | unsigned | idx | ) | 
Definition at line 4202 of file Instructions.cpp.
Referenced by eliminateDeadSwitchCases(), and unswitchTrivialSwitch().
      
  | 
  protected | 
Definition at line 4143 of file Instructions.cpp.
References llvm::extractBranchWeights(), llvm::getBranchWeightMDNode(), llvm::getNumBranchWeights(), and llvm_unreachable.
Referenced by SwitchInstProfUpdateWrapper().
      
  | 
  inline | 
Definition at line 3546 of file Instructions.h.
      
  | 
  inline | 
Definition at line 3545 of file Instructions.h.
      
  | 
  inline | 
Definition at line 3544 of file Instructions.h.
| SwitchInst::CaseIt SwitchInstProfUpdateWrapper::removeCase | ( | SwitchInst::CaseIt | I | ) | 
Delegate the call to the underlying SwitchInst::removeCase() and remove correspondent branch weight.
Definition at line 4160 of file Instructions.cpp.
Referenced by eliminateDeadSwitchCases(), and unswitchTrivialSwitch().
| void SwitchInstProfUpdateWrapper::setSuccessorWeight | ( | unsigned | idx, | 
| SwitchInstProfUpdateWrapper::CaseWeightOpt | W ) | 
Definition at line 4208 of file Instructions.cpp.
References llvm::SmallVector.
Referenced by eliminateDeadSwitchCases(), and unswitchTrivialSwitch().