[llvm-commits] [ Tag: parallel] CVS: llvm/include/llvm/iTerminators.h
Misha Brukman
brukman at cs.uiuc.edu
Thu Jan 29 19:22:05 PST 2004
Changes in directory llvm/include/llvm:
iTerminators.h updated: 1.37 -> 1.37.4.1
---
Log message:
Add definition of parallel branch instruction class.
---
Diffs of the changes: (+37 -0)
Index: llvm/include/llvm/iTerminators.h
diff -u llvm/include/llvm/iTerminators.h:1.37 llvm/include/llvm/iTerminators.h:1.37.4.1
--- llvm/include/llvm/iTerminators.h:1.37 Thu Nov 20 12:11:47 2003
+++ llvm/include/llvm/iTerminators.h Thu Jan 29 19:21:19 2004
@@ -151,6 +151,43 @@
}
};
+//===---------------------------------------------------------------------------
+// ParaBrInst - Parallel Branch instruction.
+//
+class ParaBrInst : public TerminatorInst {
+ ParaBrInst(const ParaBrInst &BI);
+public:
+ ParaBrInst(BasicBlock *one, BasicBlock *two);
+
+ virtual Instruction *clone() const { return new ParaBrInst(*this); }
+
+ virtual const BasicBlock *getSuccessor(unsigned i) const {
+ assert(i < getNumSuccessors() && "Successor # out of range for ParaBr!");
+ return (i == 0) ? cast<BasicBlock>(Operands[0].get()) :
+ cast<BasicBlock>(Operands[1].get());
+ }
+ inline BasicBlock *getSuccessor(unsigned idx) {
+ const ParaBrInst *BI = this;
+ return const_cast<BasicBlock*>(BI->getSuccessor(idx));
+ }
+
+ virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
+ assert(idx < getNumSuccessors() && "Successor # out of range for Branch!");
+ Operands[idx] = reinterpret_cast<Value*>(NewSucc);
+ }
+
+ virtual unsigned getNumSuccessors() const { return 2; /* support n>2? */ }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const ParaBrInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::ParaBr);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
+};
+
//===---------------------------------------------------------------------------
// SwitchInst - Multiway switch
More information about the llvm-commits
mailing list