De-unionize fields in Token class.
 - This is fairly gross but although the code is conceptually the
   same, introducting the union causes gcc 4.2 on x86 (darwin, if that
   matters) to pessimize LexTokenInternal which is critical to our
   preprocessor performance.

This speeds up -Eonly lexing of Cocoa.h by ~4.7% in my timings and
reduces the code size of LexTokenInternal by 8.6%.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59725 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h
index 1dd6d7b..ce68785 100644
--- a/include/clang/Lex/Token.h
+++ b/include/clang/Lex/Token.h
@@ -34,22 +34,22 @@
   /// The location of the token.
   SourceLocation Loc;
 
-  union {
-    /// The end of the SourceRange of an annotation token.
-    unsigned AnnotEndLocID;
+  // Conceptually these next two fields could be in a union with
+  // access depending on isAnnotationToken(). However, this causes gcc
+  // 4.2 to pessimize LexTokenInternal, a very performance critical
+  // routine. Keeping as separate members with casts until a more
+  // beautiful fix presents itself.
 
-    /// The length of the token text itself.
-    unsigned Length;
-  };
-  
-  union {
-    /// IdentifierInfo - If this was an identifier, this points to the uniqued
-    /// information about this identifier.
-    IdentifierInfo *IdentInfo;
+  /// UintData - This holds either the length of the token text, when
+  /// a normal token, or the end of the SourceRange when an annotation
+  /// token.
+  unsigned UintData;
 
-    /// AnnotVal - Information specific to an annotation token.
-    void *AnnotVal;
-  };
+  /// PtrData - For normal tokens, this points to the uniqued
+  /// information for the identifier (if an identifier token) or
+  /// null. For annotation tokens, this points to information specific
+  /// to the annotation token.
+  void *PtrData;
 
   /// Kind - The actual flavor of token this is.
   ///
@@ -86,19 +86,19 @@
   SourceLocation getLocation() const { return Loc; }
   unsigned getLength() const {
     assert(!isAnnotationToken() && "Used Length on annotation token");
-    return Length;
+    return UintData;
   }
 
   void setLocation(SourceLocation L) { Loc = L; }
-  void setLength(unsigned Len) { Length = Len; }
+  void setLength(unsigned Len) { UintData = Len; }
 
   SourceLocation getAnnotationEndLoc() const {
     assert(isAnnotationToken() && "Used AnnotEndLocID on non-annotation token");
-    return SourceLocation::getFromRawEncoding(AnnotEndLocID);
+    return SourceLocation::getFromRawEncoding(UintData);
   }
   void setAnnotationEndLoc(SourceLocation L) {
     assert(isAnnotationToken() && "Used AnnotEndLocID on non-annotation token");
-    AnnotEndLocID = L.getRawEncoding();
+    UintData = L.getRawEncoding();
   }
 
   /// getAnnotationRange - SourceRange of the group of tokens that this
@@ -119,25 +119,25 @@
   ///
   void startToken() {
     Flags = 0;
-    IdentInfo = 0;
+    PtrData = 0;
     Loc = SourceLocation();
   }
   
   IdentifierInfo *getIdentifierInfo() const {
     assert(!isAnnotationToken() && "Used IdentInfo on annotation token");
-    return IdentInfo;
+    return (IdentifierInfo*) PtrData;
   }
   void setIdentifierInfo(IdentifierInfo *II) {
-    IdentInfo = II;
+    PtrData = (void*) II;
   }
 
   void *getAnnotationValue() const {
     assert(isAnnotationToken() && "Used AnnotVal on non-annotation token");
-    return AnnotVal;
+    return PtrData;
   }
   void setAnnotationValue(void *val) {
     assert(isAnnotationToken() && "Used AnnotVal on non-annotation token");
-    AnnotVal = val;
+    PtrData = val;
   }
   
   /// setFlag - Set the specified flag.