diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-12-06 18:36:25 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-12-06 18:36:25 +0000 |
| commit | bf62d647de980ba01cd2f3f47adc9bc1b7ec3d19 (patch) | |
| tree | 7829fa991010c407346a354c9e124292192f1154 /clang/lib/Serialization/ASTReaderDecl.cpp | |
| parent | 9bc2677b8ce6ffe8bf1de76e6293d555bcaf3f0e (diff) | |
| download | bcm5719-llvm-bf62d647de980ba01cd2f3f47adc9bc1b7ec3d19.tar.gz bcm5719-llvm-bf62d647de980ba01cd2f3f47adc9bc1b7ec3d19.zip | |
Re-implement caching for the linkage calculation of declarations.
My previous attempt at solving the compile-time problem with many
redeclarations of the same entity cached both linkage and visibility,
while this patch only tackles linkage. There are several reasons for
this difference:
- Linkage is a language concept, and is evaluated many times during
semantic analysis and codegen, while visibility is only a
code-generation concept that is evaluated only once per (unique)
declaration. Hence, we *must* optimize linkage calculations but
don't need to optimize visibility computation.
- Once we know the linkage of a declaration, subsequent
redeclarations can't change that linkage. Hence, cache
invalidation is far simpler than for visibility, where a later
redeclaration can completely change the visibility.
- We have 3 spare bits in Decl to store the linkage cache, so the
cache doesn't increase the size of declarations. With the
visibility+linkage cache, NamedDecl got larger.
llvm-svn: 121023
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index adbf3bff3c3..7053f404e43 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -384,7 +384,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { // FunctionDecl's body is handled last at ASTDeclReader::Visit, // after everything else is read. - FD->setStorageClass((StorageClass)Record[Idx++]); + FD->SClass = (StorageClass)Record[Idx++]; FD->setStorageClassAsWritten((StorageClass)Record[Idx++]); FD->setInlineSpecified(Record[Idx++]); FD->setVirtualAsWritten(Record[Idx++]); @@ -651,7 +651,7 @@ void ASTDeclReader::VisitIndirectFieldDecl(IndirectFieldDecl *FD) { void ASTDeclReader::VisitVarDecl(VarDecl *VD) { VisitDeclaratorDecl(VD); VisitRedeclarable(VD); - VD->setStorageClass((StorageClass)Record[Idx++]); + VD->SClass = (StorageClass)Record[Idx++]; VD->setStorageClassAsWritten((StorageClass)Record[Idx++]); VD->setThreadSpecified(Record[Idx++]); VD->setCXXDirectInitializer(Record[Idx++]); |

