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

Chris Lattner sabre at nondot.org
Mon Feb 12 23:55:03 PST 2007



Changes in directory llvm/include/llvm:

InstrTypes.h updated: 1.60 -> 1.61
Instruction.h updated: 1.79 -> 1.80
Instructions.h updated: 1.57 -> 1.58
---
Log message:

Switch UnaryOperators to default to passing names up by const char* when possible.
This speeds up bcreading by 1.5%.


---
Diffs of the changes:  (+26 -12)

 InstrTypes.h   |   14 ++++++++------
 Instruction.h  |    7 +++++--
 Instructions.h |   17 +++++++++++++----
 3 files changed, 26 insertions(+), 12 deletions(-)


Index: llvm/include/llvm/InstrTypes.h
diff -u llvm/include/llvm/InstrTypes.h:1.60 llvm/include/llvm/InstrTypes.h:1.61
--- llvm/include/llvm/InstrTypes.h:1.60	Tue Jan 16 20:46:11 2007
+++ llvm/include/llvm/InstrTypes.h	Tue Feb 13 01:54:42 2007
@@ -91,11 +91,11 @@
   Use Op;
 protected:
   UnaryInstruction(const Type *Ty, unsigned iType, Value *V,
-                   const std::string &Name = "", Instruction *IB = 0)
+                   const char *Name = 0, 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)
+                   const char *Name = 0, BasicBlock *IAE)
     : Instruction(Ty, iType, &Op, 1, Name, IAE), Op(V, this) {
   }
 public:
@@ -263,13 +263,15 @@
 protected:
   /// @brief Constructor with insert-before-instruction semantics for subclasses
   CastInst(const Type *Ty, unsigned iType, Value *S, 
-      const std::string &Name = "", Instruction *InsertBefore = 0)
-    : UnaryInstruction(Ty, iType, S, Name, InsertBefore) {
+           const std::string &Name = "", Instruction *InsertBefore = 0)
+    : UnaryInstruction(Ty, iType, S, 0, InsertBefore) {
+    setName(Name);
   }
   /// @brief Constructor with insert-at-end-of-block semantics for subclasses
   CastInst(const Type *Ty, unsigned iType, Value *S, 
-      const std::string &Name, BasicBlock *InsertAtEnd)
-    : UnaryInstruction(Ty, iType, S, Name, InsertAtEnd) {
+           const std::string &Name, BasicBlock *InsertAtEnd)
+    : UnaryInstruction(Ty, iType, S, 0, InsertAtEnd) {
+    setName(Name);
   }
 public:
   /// Provides a way to construct any of the CastInst subclasses using an 


Index: llvm/include/llvm/Instruction.h
diff -u llvm/include/llvm/Instruction.h:1.79 llvm/include/llvm/Instruction.h:1.80
--- llvm/include/llvm/Instruction.h:1.79	Thu Feb  1 20:16:21 2007
+++ llvm/include/llvm/Instruction.h	Tue Feb 13 01:54:42 2007
@@ -41,10 +41,13 @@
   void setParent(BasicBlock *P);
 protected:
   Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
-              const std::string &Name = "",
-              Instruction *InsertBefore = 0);
+              const std::string &Name, Instruction *InsertBefore = 0);
   Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
               const std::string &Name, BasicBlock *InsertAtEnd);
+  Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
+              const char *Name = 0, Instruction *InsertBefore = 0);
+  Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
+              const char *Name, BasicBlock *InsertAtEnd);
 public:
   // Out of line virtual method, so the vtable, etc has a home.
   ~Instruction();


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.57 llvm/include/llvm/Instructions.h:1.58
--- llvm/include/llvm/Instructions.h:1.57	Tue Feb 13 00:22:32 2007
+++ llvm/include/llvm/Instructions.h	Tue Feb 13 01:54:42 2007
@@ -222,11 +222,18 @@
 public:
   LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBefore);
   LoadInst(Value *Ptr, const std::string &Name, BasicBlock *InsertAtEnd);
-  explicit LoadInst(Value *Ptr, const std::string &Name = "",
-                    bool isVolatile = false, Instruction *InsertBefore = 0);
+  LoadInst(Value *Ptr, const std::string &Name, bool isVolatile = false,
+           Instruction *InsertBefore = 0);
   LoadInst(Value *Ptr, const std::string &Name, bool isVolatile,
            BasicBlock *InsertAtEnd);
 
+  LoadInst(Value *Ptr, const char *Name, Instruction *InsertBefore);
+  LoadInst(Value *Ptr, const char *Name, BasicBlock *InsertAtEnd);
+  explicit LoadInst(Value *Ptr, const char *Name = 0, bool isVolatile = false,
+                    Instruction *InsertBefore = 0);
+  LoadInst(Value *Ptr, const char *Name, bool isVolatile,
+           BasicBlock *InsertAtEnd);
+  
   /// isVolatile - Return true if this is a load from a volatile memory
   /// location.
   ///
@@ -828,11 +835,13 @@
 public:
   VAArgInst(Value *List, const Type *Ty, const std::string &Name = "",
              Instruction *InsertBefore = 0)
-    : UnaryInstruction(Ty, VAArg, List, Name, InsertBefore) {
+    : UnaryInstruction(Ty, VAArg, List, 0, InsertBefore) {
+    setName(Name);
   }
   VAArgInst(Value *List, const Type *Ty, const std::string &Name,
             BasicBlock *InsertAtEnd)
-    : UnaryInstruction(Ty, VAArg, List, Name, InsertAtEnd) {
+    : UnaryInstruction(Ty, VAArg, List, 0, InsertAtEnd) {
+    setName(Name);
   }
 
   virtual VAArgInst *clone() const;






More information about the llvm-commits mailing list