[cfe-commits] r46804 - in /cfe/trunk/CodeGen: CodeGenTypes.cpp CodeGenTypes.h

Chris Lattner sabre at nondot.org
Tue Feb 5 21:21:55 PST 2008


Author: lattner
Date: Tue Feb  5 23:21:55 2008
New Revision: 46804

URL: http://llvm.org/viewvc/llvm-project?rev=46804&view=rev
Log:
rename TypeHolderMap to TypeCache, which more aptly describes what it is.

Modified:
    cfe/trunk/CodeGen/CodeGenTypes.cpp
    cfe/trunk/CodeGen/CodeGenTypes.h

Modified: cfe/trunk/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.cpp?rev=46804&r1=46803&r2=46804&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.cpp Tue Feb  5 23:21:55 2008
@@ -95,23 +95,22 @@
 const llvm::Type *CodeGenTypes::ConvertType(QualType T) {
   // See if type is already cached.
   llvm::DenseMap<Type *, llvm::PATypeHolder>::iterator
-    I = TypeHolderMap.find(T.getTypePtr());
+    I = TypeCache.find(T.getTypePtr());
   // If type is found in map and this is not a definition for a opaque
   // place holder type then use it. Otherwise convert type T.
-  if (I != TypeHolderMap.end())
+  if (I != TypeCache.end())
     return I->second.get();
 
   const llvm::Type *ResultType = ConvertNewType(T);
-  TypeHolderMap.insert(std::make_pair(T.getTypePtr(), 
-                                      llvm::PATypeHolder(ResultType)));
+  TypeCache.insert(std::make_pair(T.getTypePtr(), 
+                                  llvm::PATypeHolder(ResultType)));
   return ResultType;
 }
 
-/// ConvertTypeForMem - Convert type T into a llvm::Type. Maintain and use
-/// type cache through TypeHolderMap.  This differs from ConvertType in that
-/// it is used to convert to the memory representation for a type.  For
-/// example, the scalar representation for _Bool is i1, but the memory
-/// representation is usually i8 or i32, depending on the target.
+/// ConvertTypeForMem - Convert type T into a llvm::Type.  This differs from
+/// ConvertType in that it is used to convert to the memory representation for
+/// a type.  For example, the scalar representation for _Bool is i1, but the
+/// memory representation is usually i8 or i32, depending on the target.
 const llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T) {
   const llvm::Type *R = ConvertType(T);
   
@@ -251,8 +250,8 @@
       const llvm::Type *RType = llvm::PointerType::get(ResultType, 
                                           FP.getResultType().getAddressSpace());
       QualType RTy = Context.getPointerType(FP.getResultType());
-      TypeHolderMap.insert(std::make_pair(RTy.getTypePtr(), 
-                                          llvm::PATypeHolder(RType)));
+      TypeCache.insert(std::make_pair(RTy.getTypePtr(), 
+                                      llvm::PATypeHolder(RType)));
   
       ArgTys.push_back(RType);
       ResultType = llvm::Type::VoidTy;
@@ -302,8 +301,8 @@
       QualType PTy = Context.getPointerType(ATy);
       unsigned AS = ATy.getAddressSpace();
       const llvm::Type *PtrTy = llvm::PointerType::get(Ty, AS);
-      TypeHolderMap.insert(std::make_pair(PTy.getTypePtr(), 
-                                          llvm::PATypeHolder(PtrTy)));
+      TypeCache.insert(std::make_pair(PTy.getTypePtr(), 
+                                      llvm::PATypeHolder(PtrTy)));
 
       ArgTys.push_back(PtrTy);
     }
@@ -342,7 +341,7 @@
       // type.  This will later be refined to the actual type.
       ResultType = llvm::OpaqueType::get();
       TagDeclTypes.insert(std::make_pair(TD, ResultType));
-      TypeHolderMap.insert(std::make_pair(T.getTypePtr(), ResultType));
+      TypeCache.insert(std::make_pair(T.getTypePtr(), ResultType));
     }
     
     // Layout fields.

Modified: cfe/trunk/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.h?rev=46804&r1=46803&r2=46804&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.h Tue Feb  5 23:21:55 2008
@@ -100,11 +100,11 @@
 private:
   llvm::DenseMap<const FieldDecl *, BitFieldInfo> BitFields;
 
-  /// TypeHolderMap - This map keeps cache of llvm::Types (through PATypeHolder)
+  /// TypeCache - This map keeps cache of llvm::Types (through PATypeHolder)
   /// and maps llvm::Types to corresponding clang::Type. llvm::PATypeHolder is
   /// used instead of llvm::Type because it allows us to bypass potential 
   /// dangling type pointers due to type refinement on llvm side.
-  llvm::DenseMap<Type *, llvm::PATypeHolder> TypeHolderMap;
+  llvm::DenseMap<Type *, llvm::PATypeHolder> TypeCache;
 
   /// ConvertNewType - Convert type T into a llvm::Type. Do not use this
   /// method directly because it does not do any type caching. This method
@@ -119,15 +119,13 @@
   TargetInfo &getTarget() const { return Target; }
   ASTContext &getContext() const { return Context; }
 
-  /// ConvertType - Convert type T into a llvm::Type. Maintain and use
-  /// type cache through TypeHolderMap.
+  /// ConvertType - Convert type T into a llvm::Type.  
   const llvm::Type *ConvertType(QualType T);
   
-  /// ConvertTypeForMem - Convert type T into a llvm::Type. Maintain and use
-  /// type cache through TypeHolderMap.  This differs from ConvertType in that
-  /// it is used to convert to the memory representation for a type.  For
-  /// example, the scalar representation for _Bool is i1, but the memory
-  /// representation is usually i8 or i32, depending on the target.
+  /// ConvertTypeForMem - Convert type T into a llvm::Type.  This differs from
+  /// ConvertType in that it is used to convert to the memory representation for
+  /// a type.  For example, the scalar representation for _Bool is i1, but the
+  /// memory representation is usually i8 or i32, depending on the target.
   const llvm::Type *ConvertTypeForMem(QualType T);
   
   





More information about the cfe-commits mailing list