diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-05 23:31:02 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-05 23:31:02 +0000 |
commit | 829e988899d92ded0c55228976ff80d278fda8d2 (patch) | |
tree | 4b5e152d473b642e7b1e23910ba246a6b956e3b5 /clang/lib/CodeGen/CodeGenModule.h | |
parent | de565e3bc9c498712952410577f7a5cf36a8e83d (diff) | |
download | bcm5719-llvm-829e988899d92ded0c55228976ff80d278fda8d2.tar.gz bcm5719-llvm-829e988899d92ded0c55228976ff80d278fda8d2.zip |
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.
llvm-svn: 54382
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index c243590955b..d90ebb4b361 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/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<const Decl*, llvm::GlobalValue*> 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<llvm::GlobalValue*> 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); |