diff options
author | Eric Christopher <echristo@apple.com> | 2008-08-08 19:39:37 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2008-08-08 19:39:37 +0000 |
commit | 7a61d701c0870642e075e90b6a1ad03a8ac9bc67 (patch) | |
tree | e0930f7b8a66648b8a93e802cd415f24bdf3891f /include | |
parent | d9cc749318cc9ab4f36efe8a44201a72adbda2b2 (diff) |
Have IRBuilder take a template argument on whether or not to preserve
names. This can save a lot of allocations if you aren't going to be
looking at the output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54546 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm-c/Core.h | 2 | ||||
-rw-r--r-- | include/llvm/Support/IRBuilder.h | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index bbef134a0b..188377fd4a 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -708,7 +708,7 @@ namespace llvm { DEFINE_ISA_CONVERSION_FUNCTIONS (Value, LLVMValueRef ) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef ) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder, LLVMBuilderRef ) + DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef ) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(PATypeHolder, LLVMTypeHandleRef ) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ModuleProvider, LLVMModuleProviderRef) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer, LLVMMemoryBufferRef ) diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index c316f57268..9c3ff61ef8 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -33,7 +33,9 @@ namespace llvm { /// supports nul-terminated C strings. For fully generic names, use /// I->setName(). For access to extra instruction properties, use the mutators /// (e.g. setVolatile) on the instructions after they have been created. -class IRBuilder { +/// The template argument handles whether or not to preserve names in the final +/// instruction output. This defaults to on. +template <bool preserveNames=true> class IRBuilder { BasicBlock *BB; BasicBlock::iterator InsertPt; public: @@ -81,7 +83,7 @@ public: /// template instantiation. void InsertHelper(Instruction *I, const char *Name) const { if (BB) BB->getInstList().insert(InsertPt, I); - if (Name[0]) + if (preserveNames && Name[0]) I->setName(Name); } |