mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
c8b25d40cb
Operands are maintained as a vector<Use> in the User class, and operator iterators are provided as before. Getting an operand no longer requires a virtual function call. WARNING: getOperand(x) where x >= getNumOperands() will now assert instead of returning null! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149 91177308-0d34-0410-b5e6-96231b3b80d8
34 lines
984 B
C++
34 lines
984 B
C++
//===-- iSwitch.cpp - Implement the Switch instruction -----------*- C++ -*--=//
|
|
//
|
|
// This file implements the Switch instruction...
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/iTerminators.h"
|
|
#include "llvm/BasicBlock.h"
|
|
#ifndef NDEBUG
|
|
#include "llvm/Type.h"
|
|
#endif
|
|
|
|
SwitchInst::SwitchInst(Value *V, BasicBlock *DefDest)
|
|
: TerminatorInst(Instruction::Switch) {
|
|
assert(V && DefDest);
|
|
Operands.push_back(Use(V, this));
|
|
Operands.push_back(Use(DefDest, this));
|
|
}
|
|
|
|
SwitchInst::SwitchInst(const SwitchInst &SI)
|
|
: TerminatorInst(Instruction::Switch) {
|
|
Operands.reserve(SI.Operands.size());
|
|
|
|
for (unsigned i = 0, E = SI.Operands.size(); i != E; i+=2) {
|
|
Operands.push_back(Use(SI.Operands[i], this));
|
|
Operands.push_back(Use(SI.Operands[i+1], this));
|
|
}
|
|
}
|
|
|
|
void SwitchInst::dest_push_back(ConstPoolVal *OnVal, BasicBlock *Dest) {
|
|
Operands.push_back(Use(OnVal, this));
|
|
Operands.push_back(Use(Dest, this));
|
|
}
|