From 3c827a79cb7d04c255db8080e682ee2c6912373d Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 5 Aug 2008 23:31:02 +0000 Subject: Change CodeGen of global decls to key off of the name (instead of having multiple bindings from all the possible decls which conceptually map to the same global). - This eliminates CodeGen depending on the LLVM module for name lookup. - This also eliminates the need for ReplaceMapValuesWith (hurrah). - This handles lookups for FunctionDecls correctly in the presence of aliases, this was previously broken. - WIP: Can still clean up & unify variable and function emission. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54382 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index c243590955..d90ebb4b36 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -69,11 +69,13 @@ class CodeGenModule { llvm::Function *MemMoveFn; llvm::Function *MemSetFn; - /// GlobalDeclMap - Mapping of decls to global variables we have + /// GlobalDeclMap - Mapping of decl names global variables we have /// already emitted. Note that the entries in this map are the - /// actual global and therefore may not be of the same type as the - /// decl, they should be bitcasted on retrieval. - llvm::DenseMap GlobalDeclMap; + /// actual globals and therefore may not be of the same type as the + /// 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 GlobalDeclMap; /// List of static global for which code generation is delayed. When /// the translation unit has been fully processed we will lazily @@ -172,11 +174,6 @@ public: VisibilityAttr::VisibilityTypes); private: - /// ReplaceMapValuesWith - This is a really slow and bad function that - /// searches for any entries in GlobalDeclMap that point to OldVal, changing - /// them to point to NewVal. This is badbadbad, FIXME! - void ReplaceMapValuesWith(llvm::GlobalValue *OldVal, llvm::GlobalValue *NewVal); - void SetFunctionAttributes(const FunctionDecl *FD, llvm::Function *F, const llvm::FunctionType *FTy); -- cgit v1.2.3