1 //===-- iSwitch.cpp - Implement the Switch instruction -----------*- C++ -*--=//
3 // This file implements the Switch instruction...
5 //===----------------------------------------------------------------------===//
7 #include "llvm/iTerminators.h"
8 #include "llvm/BasicBlock.h"
10 SwitchInst::SwitchInst(Value *V, BasicBlock *DefDest)
11 : TerminatorInst(Instruction::Switch) {
13 Operands.push_back(Use(V, this));
14 Operands.push_back(Use(DefDest, this));
17 SwitchInst::SwitchInst(const SwitchInst &SI)
18 : TerminatorInst(Instruction::Switch) {
19 Operands.reserve(SI.Operands.size());
21 for (unsigned i = 0, E = SI.Operands.size(); i != E; i+=2) {
22 Operands.push_back(Use(SI.Operands[i], this));
23 Operands.push_back(Use(SI.Operands[i+1], this));
27 void SwitchInst::dest_push_back(Constant *OnVal, BasicBlock *Dest) {
28 Operands.push_back(Use((Value*)OnVal, this));
29 Operands.push_back(Use((Value*)Dest, this));