[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h Instruction.h Instructions.h
Changes in directory llvm/include/llvm: InstrTypes.h updated: 1.62 - 1.63 Instruction.h updated: 1.81 - 1.82 Instructions.h updated: 1.61 - 1.62 --- Log message: Refactor the setName stuff, moving it down the inheritance hierarchy, to solve a crash in -instcombine -debug that was hit while investigating PR1217: http://llvm.org/PR1217 --- Diffs of the changes: (+42 -116) InstrTypes.h | 46 +++-- Instruction.h |8 +--- Instructions.h | 104 ++--- 3 files changed, 42 insertions(+), 116 deletions(-) Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.62 llvm/include/llvm/InstrTypes.h:1.63 --- llvm/include/llvm/InstrTypes.h:1.62 Tue Feb 13 03:26:04 2007 +++ llvm/include/llvm/InstrTypes.h Fri Feb 23 18:55:48 2007 @@ -29,19 +29,14 @@ /// class TerminatorInst : public Instruction { protected: - TerminatorInst(Instruction::TermOps iType, Use *Ops, unsigned NumOps, - Instruction *InsertBefore = 0); TerminatorInst(const Type *Ty, Instruction::TermOps iType, - Use *Ops, unsigned NumOps, - const std::string Name = , Instruction *InsertBefore = 0) -: Instruction(Ty, iType, Ops, NumOps, Name, InsertBefore) {} + Use *Ops, unsigned NumOps, + Instruction *InsertBefore = 0) +: Instruction(Ty, iType, Ops, NumOps, InsertBefore) {} - TerminatorInst(Instruction::TermOps iType, Use *Ops, unsigned NumOps, - BasicBlock *InsertAtEnd); TerminatorInst(const Type *Ty, Instruction::TermOps iType, - Use *Ops, unsigned NumOps, - const std::string Name, BasicBlock *InsertAtEnd) -: Instruction(Ty, iType, Ops, NumOps, Name, InsertAtEnd) {} + Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd) +: Instruction(Ty, iType, Ops, NumOps, InsertAtEnd) {} // Out of line virtual method, so the vtable, etc has a home. ~TerminatorInst(); @@ -90,13 +85,11 @@ class UnaryInstruction : public Instruction { Use Op; protected: - UnaryInstruction(const Type *Ty, unsigned iType, Value *V, - 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 char *Name, BasicBlock *IAE) -: Instruction(Ty, iType, Op, 1, Name, IAE), Op(V, this) { + UnaryInstruction(const Type *Ty, unsigned iType, Value *V, Instruction *IB =0) +: Instruction(Ty, iType, Op, 1, IB), Op(V, this) { + } + UnaryInstruction(const Type *Ty, unsigned iType, Value *V, BasicBlock *IAE) +: Instruction(Ty, iType, Op, 1, IAE), Op(V, this) { } public: // Out of line virtual method, so the vtable, etc has a home. @@ -123,20 +116,9 @@ protected: void init(BinaryOps iType); BinaryOperator(BinaryOps iType, Value *S1, Value *S2, const Type *Ty, - const std::string Name, Instruction *InsertBefore) -: Instruction(Ty, iType, Ops, 2, Name, InsertBefore) { - Ops[0].init(S1, this); - Ops[1].init(S2, this); -init(iType); - } + const std::string Name, Instruction *InsertBefore); BinaryOperator(BinaryOps iType, Value *S1, Value *S2, const Type *Ty, - const std::string Name, BasicBlock *InsertAtEnd) -: Instruction(Ty, iType, Ops, 2, Name, InsertAtEnd) { -Ops[0].init(S1, this); -Ops[1].init(S2, this); -init(iType); - } - + const std::string Name, BasicBlock *InsertAtEnd); public: /// Transparently provide more efficient getOperand methods. @@ -264,13 +246,13 @@ /// @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, 0, InsertBefore) { +: UnaryInstruction(Ty, iType, S, 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, 0, InsertAtEnd) { +: UnaryInstruction(Ty, iType, S, InsertAtEnd) { setName(Name); } public: Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.81 llvm/include/llvm/Instruction.h:1.82 --- llvm/include/llvm/Instruction.h:1.81Thu Feb 15 17:15:00 2007 +++ llvm/include/llvm/Instruction.h Fri Feb 23 18:55:48 2007 @@ -41,13 +41,9 @@ void setParent(BasicBlock *P); protected: Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, - const std::string Name, Instruction *InsertBefore = 0); + Instruction *InsertBefore = 0); Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, -
[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h Instruction.h Instructions.h
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.79Thu 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.hTue 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,