aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-13 07:54:42 +0000
committerChris Lattner <sabre@nondot.org>2007-02-13 07:54:42 +0000
commitf00042a9990d90885a8f236ed0f6bf07902d1374 (patch)
tree858cab704fd07ea16e1d808e49d61c180c031c31 /include
parentec79b3da13ae9ba09f52e177bd71fcc5669d61a5 (diff)
downloadexternal_llvm-f00042a9990d90885a8f236ed0f6bf07902d1374.zip
external_llvm-f00042a9990d90885a8f236ed0f6bf07902d1374.tar.gz
external_llvm-f00042a9990d90885a8f236ed0f6bf07902d1374.tar.bz2
Switch UnaryOperators to default to passing names up by const char* when possible.
This speeds up bcreading by 1.5%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/InstrTypes.h14
-rw-r--r--include/llvm/Instruction.h7
-rw-r--r--include/llvm/Instructions.h17
3 files changed, 26 insertions, 12 deletions
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index 348671a..0fff238 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -91,11 +91,11 @@ class UnaryInstruction : public Instruction {
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 @@ class CastInst : public UnaryInstruction {
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
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h
index 15c5919..7f7bcc8 100644
--- a/include/llvm/Instruction.h
+++ b/include/llvm/Instruction.h
@@ -41,10 +41,13 @@ class Instruction : public User {
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();
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 659659c..3d22ef2 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -222,11 +222,18 @@ class LoadInst : public UnaryInstruction {
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 @@ class VAArgInst : public UnaryInstruction {
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;