+//===----------------------------------------------------------------------===//
+// UnaryInstruction Class
+//===----------------------------------------------------------------------===//
+
+class UnaryInstruction : public Instruction {
+ Use Op;
+protected:
+ UnaryInstruction(const Type *Ty, unsigned iType, Value *V,
+ const std::string &Name = "", Instruction *IB = 0)
+ : Instruction(Ty, iType, &Op, 1, Name, IB), Op(V, this) {
+ }
+ UnaryInstruction(const Type *Ty, unsigned iType, Value *V,
+ const std::string &Name, BasicBlock *IAE)
+ : Instruction(Ty, iType, &Op, 1, Name, IAE), Op(V, this) {
+ }
+public:
+
+ // Transparently provide more efficient getOperand methods.
+ Value *getOperand(unsigned i) const {
+ assert(i == 0 && "getOperand() out of range!");
+ return Op;
+ }
+ void setOperand(unsigned i, Value *Val) {
+ assert(i == 0 && "setOperand() out of range!");
+ Op = Val;
+ }
+ unsigned getNumOperands() const { return 1; }
+};