+ /// create() - Construct a binary instruction, given the opcode and the two
+ /// operands. Optionally (if InstBefore is specified) insert the instruction
+ /// into a BasicBlock right before the specified instruction. The specified
+ /// Instruction is allowed to be a dereferenced end iterator.
+ ///
+ static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2,
+ const std::string &Name = "",
+ Instruction *InsertBefore = 0);
+
+ /// create() - Construct a binary instruction, given the opcode and the two
+ /// operands. Also automatically insert this instruction to the end of the
+ /// BasicBlock specified.
+ ///
+ static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2,
+ const std::string &Name,
+ BasicBlock *InsertAtEnd);
+
+ /// create* - These methods just forward to create, and are useful when you
+ /// statically know what type of instruction you're going to create. These
+ /// helpers just save some typing.
+#define HANDLE_BINARY_INST(N, OPC, CLASS) \
+ static BinaryOperator *create##OPC(Value *V1, Value *V2, \
+ const std::string &Name = "") {\
+ return create(Instruction::OPC, V1, V2, Name);\
+ }
+#include "llvm/Instruction.def"
+#define HANDLE_BINARY_INST(N, OPC, CLASS) \
+ static BinaryOperator *create##OPC(Value *V1, Value *V2, \
+ const std::string &Name, BasicBlock *BB) {\
+ return create(Instruction::OPC, V1, V2, Name, BB);\
+ }
+#include "llvm/Instruction.def"
+#define HANDLE_BINARY_INST(N, OPC, CLASS) \
+ static BinaryOperator *create##OPC(Value *V1, Value *V2, \
+ const std::string &Name, Instruction *I) {\
+ return create(Instruction::OPC, V1, V2, Name, I);\
+ }
+#include "llvm/Instruction.def"
+
+
+ /// Helper functions to construct and inspect unary operations (NEG and NOT)
+ /// via binary operators SUB and XOR:
+ ///
+ /// createNeg, createNot - Create the NEG and NOT
+ /// instructions out of SUB and XOR instructions.
+ ///
+ static BinaryOperator *createNeg(Value *Op, const std::string &Name = "",
+ Instruction *InsertBefore = 0);
+ static BinaryOperator *createNeg(Value *Op, const std::string &Name,
+ BasicBlock *InsertAtEnd);
+ static BinaryOperator *createNot(Value *Op, const std::string &Name = "",
+ Instruction *InsertBefore = 0);
+ static BinaryOperator *createNot(Value *Op, const std::string &Name,
+ BasicBlock *InsertAtEnd);
+
+ /// isNeg, isNot - Check if the given Value is a NEG or NOT instruction.
+ ///
+ static bool isNeg(const Value *V);
+ static bool isNot(const Value *V);
+
+ /// getNegArgument, getNotArgument - Helper functions to extract the
+ /// unary argument of a NEG or NOT operation implemented via Sub or Xor.
+ ///
+ static const Value* getNegArgument(const BinaryOperator* Bop);
+ static Value* getNegArgument( BinaryOperator* Bop);
+ static const Value* getNotArgument(const BinaryOperator* Bop);
+ static Value* getNotArgument( BinaryOperator* Bop);