summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-01-19 23:13:15 +0000
committerTed Kremenek <kremenek@apple.com>2009-01-19 23:13:15 +0000
commit8433f0b400683a539c25f40047eb8cbf92dca92c (patch)
tree24246e6d0a07026f28c840768c6a56e88472d734 /clang/lib
parentea9f1d3c47a5fa42bee7207e8c588f61bb31b183 (diff)
downloadbcm5719-llvm-8433f0b400683a539c25f40047eb8cbf92dca92c.tar.gz
bcm5719-llvm-8433f0b400683a539c25f40047eb8cbf92dca92c.zip
PTH: Emitted tokens now consist of 12 bytes that are loaded used 3 32-bit loads. This reduces user time but increases system time because of the slightly larger PTH file. Although there is no performance win on Cocoa.h and -Eonly, overall this seems like a good step.
llvm-svn: 62542
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/PTHLexer.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp
index 7df8e35986e..87eb255da10 100644
--- a/clang/lib/Lex/PTHLexer.cpp
+++ b/clang/lib/Lex/PTHLexer.cpp
@@ -25,7 +25,7 @@
#include "llvm/ADT/OwningPtr.h"
using namespace clang;
-#define DISK_TOKEN_SIZE (1+1+3+4+2)
+#define DISK_TOKEN_SIZE (1+1+2+4+4)
//===----------------------------------------------------------------------===//
// Utility methods for reading from the mmap'ed PTH file.
@@ -107,11 +107,14 @@ LexNextToken:
const unsigned char *CurPtrShadow = CurPtr;
// Read in the data for the token.
- tok::TokenKind TKind = (tok::TokenKind) Read8(CurPtrShadow);
- Token::TokenFlags TFlags = (Token::TokenFlags) Read8(CurPtrShadow);
- uint32_t IdentifierID = Read24(CurPtrShadow);
+ unsigned Word0 = Read32(CurPtrShadow);
+ uint32_t IdentifierID = Read32(CurPtrShadow);
uint32_t FileOffset = Read32(CurPtrShadow);
- uint32_t Len = Read16(CurPtrShadow);
+
+ tok::TokenKind TKind = (tok::TokenKind) (Word0 & 0xFF);
+ Token::TokenFlags TFlags = (Token::TokenFlags) ((Word0 >> 8) & 0xFF);
+ uint32_t Len = Word0 >> 16;
+
CurPtr = CurPtrShadow;
//===--------------------------------------==//
OpenPOWER on IntegriCloud