diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-21 09:44:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-21 09:44:56 +0000 |
commit | 45470943a9bcaa55e859db2e7236897412cfc0dd (patch) | |
tree | 12ddc097ffb07e296255dc1ea26919df0673091c /clang/lib/CodeGen/CodeGenModule.h | |
parent | a85d68e5d8adbe917c36d27e517071ec3838d46b (diff) | |
download | bcm5719-llvm-45470943a9bcaa55e859db2e7236897412cfc0dd.tar.gz bcm5719-llvm-45470943a9bcaa55e859db2e7236897412cfc0dd.zip |
now that all the decl reference and creation stuff is going through two
very simple places, reimplement the deferred decl emission logic to not be O(N^2),
fixing PR3810.
llvm-svn: 67447
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 47456804d3a..91030e7aa35 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -95,8 +95,12 @@ class CodeGenModule : public BlockModule { /// 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 mangled name, not the global name - /// (which may change with attributes such as asm-labels). This key + /// (which may change with attributes such as asm-labels). The key /// to this map should be generated using getMangledName(). + /// + /// Note that this map always lines up exactly with the contents of the LLVM + /// IR symbol table, but this is quicker to query since it is doing uniqued + /// pointer lookups instead of full string lookups. llvm::DenseMap<const char*, llvm::GlobalValue*> GlobalDeclMap; /// \brief Contains the strings used for mangled names. @@ -111,13 +115,17 @@ class CodeGenModule : public BlockModule { /// and may reference forward. std::vector<const ValueDecl*> Aliases; - /// DeferredDecls - List of decls for which code generation has been - /// deferred. When the translation unit has been fully processed we - /// will lazily emit definitions for only the decls that were - /// actually used. This should contain only Function and Var decls, - /// and only those which actually define something. - std::list<const ValueDecl*> DeferredDecls; + /// DeferredDecls - This contains all the decls which have definitions but + /// which are deferred for emission and therefore should only be output if + /// they are actually used. If a decl is in this, then it is known to have + /// not been referenced yet. The key to this map is a uniqued mangled name. + llvm::DenseMap<const char*, const ValueDecl*> DeferredDecls; + /// DeferredDeclsToEmit - This is a list of deferred decls which we have seen + /// that *are* actually referenced. These get code generated when the module + /// is done. + std::vector<const ValueDecl*> DeferredDeclsToEmit; + /// LLVMUsed - List of global values which are required to be /// present in the object file; bitcast to i8*. This is used for /// forcing visibility of symbols which may otherwise be optimized |