Create a switch instruction with the specified value, default dest, and with a hint for the number of cases that will be added (for efficient allocation).
Declared in <llvm/IR/IRBuilder.h>
SwitchInst*
CreateSwitch(
Value* V,
BasicBlock* Dest,
unsigned int NumCases = 10,
MDNode* BranchWeights = nullptr,
MDNode* Unpredictable = nullptr);
The created switch instruction.
| Name | Description |
|---|---|
| V | Input value. |
| Dest | Destination basic block. |
| NumCases | Hint for how many switch cases will be added. |
| BranchWeights | Optional branch-weight profile metadata. |
| Unpredictable | Optional unpredictable-branch metadata. |