aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-13 06:14:53 +0000
committerChris Lattner <sabre@nondot.org>2001-10-13 06:14:53 +0000
commit9686fd11c4f9086fa283c3140efff967536b4d16 (patch)
treecfed6f60a7228e668d246ad3f3ef73ffac1fc86c
parent16ddd025451aff4573adad3e1a1fc2a5f9aa59a3 (diff)
Minor changes, add new ctor for invoke instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@735 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/iTerminators.h74
1 files changed, 70 insertions, 4 deletions
diff --git a/include/llvm/iTerminators.h b/include/llvm/iTerminators.h
index e1b53f0235..6fdf3604ea 100644
--- a/include/llvm/iTerminators.h
+++ b/include/llvm/iTerminators.h
@@ -44,10 +44,10 @@ public:
virtual const char *getOpcodeName() const { return "ret"; }
inline const Value *getReturnValue() const {
- return Operands.size() ? Operands[0] : 0;
+ return Operands.size() ? Operands[0].get() : 0;
}
inline Value *getReturnValue() {
- return Operands.size() ? Operands[0] : 0;
+ return Operands.size() ? Operands[0].get() : 0;
}
// Additionally, they must provide a method to get at the successors of this
@@ -84,10 +84,10 @@ public:
}
inline const Value *getCondition() const {
- return isUnconditional() ? 0 : Operands[2];
+ return isUnconditional() ? 0 : Operands[2].get();
}
inline Value *getCondition() {
- return isUnconditional() ? 0 : Operands[2];
+ return isUnconditional() ? 0 : Operands[2].get();
}
virtual const char *getOpcodeName() const { return "br"; }
@@ -190,4 +190,70 @@ public:
}
};
+
+//===---------------------------------------------------------------------------
+// InvokeInst - Invoke instruction
+//
+class InvokeInst : public TerminatorInst {
+ InvokeInst(const InvokeInst &BI);
+public:
+ InvokeInst(Value *Meth, BasicBlock *IfNormal, BasicBlock *IfException,
+ const vector<Value*> &Params, const string &Name = "");
+
+ virtual Instruction *clone() const { return new InvokeInst(*this); }
+
+ // getCalledMethod - Return the method called, or null if this is an indirect
+ // method invocation...
+ //
+ inline const Method *getCalledMethod() const {
+ return dyn_cast<Method>(Operands[0].get());
+ }
+ inline Method *getCalledMethod() {
+ return dyn_cast<Method>(Operands[0].get());
+ }
+
+ // getCalledValue - Get a pointer to a method that is invoked by this inst.
+ inline const Value *getCalledValue() const { return Operands[0]; }
+ inline Value *getCalledValue() { return Operands[0]; }
+
+ // get*Dest - Return the destination basic blocks...
+ inline const BasicBlock *getNormalDest() const {
+ return cast<BasicBlock>(Operands[1]);
+ }
+ inline BasicBlock *getNormalDest() {
+ return cast<BasicBlock>(Operands[1]);
+ }
+ inline const BasicBlock *getExceptionalDest() const {
+ return cast<BasicBlock>(Operands[2]);
+ }
+ inline BasicBlock *getExceptionalDest() {
+ return cast<BasicBlock>(Operands[2]);
+ }
+
+ virtual const char *getOpcodeName() const { return "invoke"; }
+
+ // Additionally, they must provide a method to get at the successors of this
+ // terminator instruction.
+ //
+ virtual const BasicBlock *getSuccessor(unsigned i) const {
+ return (i == 0) ? getNormalDest() :
+ ((i == 1) ? getExceptionalDest() : 0);
+ }
+ inline BasicBlock *getSuccessor(unsigned i) {
+ return (i == 0) ? getNormalDest() :
+ ((i == 1) ? getExceptionalDest() : 0);
+ }
+
+ virtual unsigned getNumSuccessors() const { return 2; }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const InvokeInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::Invoke);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
+};
+
#endif