[cfe-commits] r55303 - in /cfe/trunk/lib/CodeGen: CodeGenModule.cpp CodeGenModule.h

Daniel Dunbar daniel at zuster.org
Sun Aug 24 23:18:58 PDT 2008


Author: ddunbar
Date: Mon Aug 25 01:18:57 2008
New Revision: 55303

URL: http://llvm.org/viewvc/llvm-project?rev=55303&view=rev
Log:
Use DenseMap on IdentifierInfo instead of StringMap.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.h

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=55303&r1=55302&r2=55303&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Aug 25 01:18:57 2008
@@ -250,7 +250,7 @@
       // Check if we have used a decl with the same name
       // FIXME: The AST should have some sort of aggregate decls or
       // global symbol map.
-      if (!GlobalDeclMap.count(D->getName()))
+      if (!GlobalDeclMap.count(D->getIdentifier()))
         continue;
 
       // Emit the definition.
@@ -362,7 +362,7 @@
   const llvm::Type *PTy = llvm::PointerType::get(Ty, ASTTy.getAddressSpace());
 
   // Lookup the entry, lazily creating it if necessary.
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   if (!Entry)
     Entry = new llvm::GlobalVariable(Ty, false, 
                                      llvm::GlobalValue::ExternalLinkage,
@@ -396,7 +396,7 @@
   }
   const llvm::Type* InitType = Init->getType();
 
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   llvm::GlobalVariable *GV = cast_or_null<llvm::GlobalVariable>(Entry);
   
   if (!GV) {
@@ -542,7 +542,7 @@
   const llvm::Type *PTy = llvm::PointerType::get(Ty, ASTTy.getAddressSpace());
   
   // Lookup the entry, lazily creating it if necessary.
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   if (!Entry)
     Entry = EmitForwardFunctionDefinition(D);
 
@@ -550,7 +550,7 @@
 }
 
 void CodeGenModule::EmitGlobalFunctionDefinition(const FunctionDecl *D) {
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   if (!Entry) {
     Entry = EmitForwardFunctionDefinition(D);
   } else {

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=55303&r1=55302&r2=55303&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Mon Aug 25 01:18:57 2008
@@ -31,6 +31,7 @@
 namespace clang {
   class ASTContext;
   class FunctionDecl;
+  class IdentifierInfo;
   class ObjCMethodDecl;
   class ObjCImplementationDecl;
   class ObjCCategoryImplDecl;
@@ -76,7 +77,7 @@
   /// decl, they should be bitcasted on retrieval. Also note that the
   /// globals are keyed on their source name, not the global name
   /// (which may change with attributes such as asm-labels).
-  llvm::StringMap<llvm::GlobalValue*> GlobalDeclMap;
+  llvm::DenseMap<IdentifierInfo*, llvm::GlobalValue*> GlobalDeclMap;
 
   /// List of static global for which code generation is delayed. When
   /// the translation unit has been fully processed we will lazily





More information about the cfe-commits mailing list