mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Add a new setSuccessor method to terminator instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2730 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b3eac89323
commit
195755ced7
@ -35,6 +35,7 @@ public:
|
||||
//
|
||||
virtual const BasicBlock *getSuccessor(unsigned idx) const = 0;
|
||||
virtual unsigned getNumSuccessors() const = 0;
|
||||
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) = 0;
|
||||
|
||||
inline BasicBlock *getSuccessor(unsigned idx) {
|
||||
return (BasicBlock*)((const TerminatorInst *)this)->getSuccessor(idx);
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
assert(0 && "ReturnInst has no successors!");
|
||||
abort();
|
||||
}
|
||||
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||
assert(0 && "ReturnInst has no successors!");
|
||||
}
|
||||
virtual unsigned getNumSuccessors() const { return 0; }
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
@ -105,6 +108,11 @@ public:
|
||||
return (BasicBlock*)((const BranchInst *)this)->getSuccessor(idx);
|
||||
}
|
||||
|
||||
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||
assert(idx < getNumSuccessors() && "Successor # out of range for Branch!");
|
||||
Operands[idx] = (Value*)NewSucc;
|
||||
}
|
||||
|
||||
virtual unsigned getNumSuccessors() const { return 1+isConditional(); }
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
@ -156,6 +164,11 @@ public:
|
||||
return cast<BasicBlock>(Operands[idx*2+1].get());
|
||||
}
|
||||
|
||||
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||
assert(idx < getNumSuccessors() && "Successor # out of range for switch!");
|
||||
Operands[idx*2+1] = (Value*)NewSucc;
|
||||
}
|
||||
|
||||
// getSuccessorValue - Return the value associated with the specified
|
||||
// successor.
|
||||
inline const Constant *getSuccessorValue(unsigned idx) const {
|
||||
@ -231,6 +244,11 @@ public:
|
||||
return i == 0 ? getNormalDest() : getExceptionalDest();
|
||||
}
|
||||
|
||||
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||
assert(idx < 2 && "Successor # out of range for invoke!");
|
||||
Operands[idx+1] = (Value*)NewSucc;
|
||||
}
|
||||
|
||||
virtual unsigned getNumSuccessors() const { return 2; }
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
|
Loading…
Reference in New Issue
Block a user