diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-21 08:06:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-21 08:06:59 +0000 |
commit | 5d4f5c724533b994de05df49ae259120482ec366 (patch) | |
tree | 3703686c4c6536e0c3103079f4d8562e64d675da /lib/CodeGen/CodeGenModule.cpp | |
parent | 99b53613ebe2c59d41030e987962c1ed101b2efe (diff) |
reduce redundant calls of getMangledName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 38b8d36ed5..04b423eeb3 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -398,13 +398,13 @@ void CodeGenModule::EmitAliases() { continue; } + const char *MangledName = getMangledName(D); llvm::GlobalValue *GA = new llvm::GlobalAlias(aliasee->getType(), llvm::Function::ExternalLinkage, - getMangledName(D), aliasee, - &getModule()); + MangledName, aliasee, &getModule()); - llvm::GlobalValue *&Entry = GlobalDeclMap[getMangledName(D)]; + llvm::GlobalValue *&Entry = GlobalDeclMap[MangledName]; if (Entry) { // If we created a dummy function for this then replace it. GA->takeName(Entry); @@ -597,7 +597,8 @@ void CodeGenModule::EmitGlobalDefinition(const ValueDecl *D) { const llvm::Type *Ty = getTypes().ConvertTypeForMem(ASTTy); // Lookup the entry, lazily creating it if necessary. - llvm::GlobalValue *&Entry = GlobalDeclMap[getMangledName(D)]; + const char *MangledName = getMangledName(D); + llvm::GlobalValue *&Entry = GlobalDeclMap[MangledName]; if (Entry) { const llvm::Type *PTy = llvm::PointerType::get(Ty, ASTTy.getAddressSpace()); @@ -610,7 +611,7 @@ void CodeGenModule::EmitGlobalDefinition(const ValueDecl *D) { llvm::GlobalVariable *GV = new llvm::GlobalVariable(Ty, false, llvm::GlobalValue::ExternalLinkage, - 0, getMangledName(D), &getModule(), + 0, MangledName, &getModule(), 0, ASTTy.getAddressSpace()); // Handle things which are present even on external declarations. @@ -665,13 +666,14 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { } const llvm::Type* InitType = Init->getType(); - llvm::GlobalValue *&Entry = GlobalDeclMap[getMangledName(D)]; + const char *MangledName = getMangledName(D); + llvm::GlobalValue *&Entry = GlobalDeclMap[MangledName]; llvm::GlobalVariable *GV = cast_or_null<llvm::GlobalVariable>(Entry); if (!GV) { GV = new llvm::GlobalVariable(InitType, false, llvm::GlobalValue::ExternalLinkage, - 0, getMangledName(D), + 0, MangledName, &getModule(), 0, ASTTy.getAddressSpace()); } else if (GV->hasInitializer() && !GV->getInitializer()->isNullValue()) { @@ -715,7 +717,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { // Make a new global with the correct type GV = new llvm::GlobalVariable(InitType, false, llvm::GlobalValue::ExternalLinkage, - 0, getMangledName(D), + 0, MangledName, &getModule(), 0, ASTTy.getAddressSpace()); // Steal the name of the old global GV->takeName(OldGV); |