Add a couple of extra casts to avoid extra #include
[oota-llvm.git] / lib / VMCore / iSwitch.cpp
1 //===-- iSwitch.cpp - Implement the Switch instruction -----------*- C++ -*--=//
2 //
3 // This file implements the Switch instruction...
4 //
5 //===----------------------------------------------------------------------===//
6
7 #include "llvm/iTerminators.h"
8 #include "llvm/BasicBlock.h"
9 #ifndef NDEBUG
10 #include "llvm/Type.h"
11 #endif
12
13 SwitchInst::SwitchInst(Value *V, BasicBlock *DefDest) 
14   : TerminatorInst(Instruction::Switch) {
15   assert(V && DefDest);
16   Operands.push_back(Use(V, this));
17   Operands.push_back(Use(DefDest, this));
18 }
19
20 SwitchInst::SwitchInst(const SwitchInst &SI) 
21   : TerminatorInst(Instruction::Switch) {
22   Operands.reserve(SI.Operands.size());
23
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));
27   }
28 }
29
30 void SwitchInst::dest_push_back(Constant *OnVal, BasicBlock *Dest) {
31   Operands.push_back(Use((Value*)OnVal, this));
32   Operands.push_back(Use((Value*)Dest, this));
33 }