[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h

Chris Lattner lattner at cs.uiuc.edu
Wed Jun 9 20:49:01 PDT 2004


Changes in directory llvm/include/llvm:

InstrTypes.h updated: 1.38 -> 1.39

---
Log message:

Add new BinaryOperator::createAdd/Sub/... methods to avoid having to type
llvm::Instruction:: all of the time.


---
Diffs of the changes:  (+16 -0)

Index: llvm/include/llvm/InstrTypes.h
diff -u llvm/include/llvm/InstrTypes.h:1.38 llvm/include/llvm/InstrTypes.h:1.39
--- llvm/include/llvm/InstrTypes.h:1.38	Wed May 26 19:15:23 2004
+++ llvm/include/llvm/InstrTypes.h	Wed Jun  9 20:43:29 2004
@@ -106,6 +106,22 @@
   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"
                                
 
   /// Helper functions to construct and inspect unary operations (NEG and NOT)





More information about the llvm-commits mailing list