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 #include "llvm/Type.h"
13 SwitchInst::SwitchInst(Value *V, BasicBlock *DefDest)
14 : TerminatorInst(Instruction::Switch) {
16 Operands.push_back(Use(V, this));
17 Operands.push_back(Use(DefDest, this));
20 SwitchInst::SwitchInst(const SwitchInst &SI)
21 : TerminatorInst(Instruction::Switch) {
22 Operands.reserve(SI.Operands.size());
24 for (unsigned i = 0, E = SI.Operands.size(); i != E; i+=2) {
25 Operands.push_back(Use(SI.Operands[i], this));
26 Operands.push_back(Use(SI.Operands[i+1], this));
30 void SwitchInst::dest_push_back(ConstPoolVal *OnVal, BasicBlock *Dest) {
31 Operands.push_back(Use(OnVal, this));
32 Operands.push_back(Use(Dest, this));