Remove support for unary operators.
[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
10 SwitchInst::SwitchInst(Value *V, BasicBlock *DefDest) 
11   : TerminatorInst(Instruction::Switch) {
12   assert(V && DefDest);
13   Operands.push_back(Use(V, this));
14   Operands.push_back(Use(DefDest, this));
15 }
16
17 SwitchInst::SwitchInst(const SwitchInst &SI) 
18   : TerminatorInst(Instruction::Switch) {
19   Operands.reserve(SI.Operands.size());
20
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));
24   }
25 }
26
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));
30 }