[llvm-commits] [llvm] r135245 - in /llvm/trunk: include/llvm-c/Target.h include/llvm/Target/TargetData.h lib/Target/Target.cpp lib/Target/TargetData.cpp

Chris Lattner sabre at nondot.org
Thu Jul 14 22:21:59 PDT 2011


Author: lattner
Date: Fri Jul 15 00:21:59 2011
New Revision: 135245

URL: http://llvm.org/viewvc/llvm-project?rev=135245&view=rev
Log:
remove the InvalidateStructLayoutInfo API, which is dead and unnecessary now
that type refinement is toast.

Modified:
    llvm/trunk/include/llvm-c/Target.h
    llvm/trunk/include/llvm/Target/TargetData.h
    llvm/trunk/lib/Target/Target.cpp
    llvm/trunk/lib/Target/TargetData.cpp

Modified: llvm/trunk/include/llvm-c/Target.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=135245&r1=135244&r2=135245&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Target.h (original)
+++ llvm/trunk/include/llvm-c/Target.h Fri Jul 15 00:21:59 2011
@@ -147,12 +147,6 @@
 unsigned long long LLVMOffsetOfElement(LLVMTargetDataRef, LLVMTypeRef StructTy,
                                        unsigned Element);
 
-/** Struct layouts are speculatively cached. If a TargetDataRef is alive when
-    types are being refined and removed, this method must be called whenever a
-    struct type is removed to avoid a dangling pointer in this cache.
-    See the method llvm::TargetData::InvalidateStructLayoutInfo. */
-void LLVMInvalidateStructLayout(LLVMTargetDataRef, LLVMTypeRef StructTy);
-
 /** Deallocates a TargetData.
     See the destructor llvm::TargetData::~TargetData. */
 void LLVMDisposeTargetData(LLVMTargetDataRef);

Modified: llvm/trunk/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=135245&r1=135244&r2=135245&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetData.h (original)
+++ llvm/trunk/include/llvm/Target/TargetData.h Fri Jul 15 00:21:59 2011
@@ -272,12 +272,6 @@
   /// information is lazily cached.
   const StructLayout *getStructLayout(const StructType *Ty) const;
 
-  /// InvalidateStructLayoutInfo - TargetData speculatively caches StructLayout
-  /// objects.  If a TargetData object is alive when types are being refined and
-  /// removed, this method must be called whenever a StructType is removed to
-  /// avoid a dangling pointer in this cache.
-  void InvalidateStructLayoutInfo(const StructType *Ty) const;
-
   /// getPreferredAlignment - Return the preferred alignment of the specified
   /// global.  This includes an explicitly requested alignment (if the global
   /// has one).

Modified: llvm/trunk/lib/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.cpp?rev=135245&r1=135244&r2=135245&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Target.cpp (original)
+++ llvm/trunk/lib/Target/Target.cpp Fri Jul 15 00:21:59 2011
@@ -97,10 +97,6 @@
   return unwrap(TD)->getStructLayout(STy)->getElementOffset(Element);
 }
 
-void LLVMInvalidateStructLayout(LLVMTargetDataRef TD, LLVMTypeRef StructTy) {
-  unwrap(TD)->InvalidateStructLayoutInfo(unwrap<StructType>(StructTy));
-}
-
 void LLVMDisposeTargetData(LLVMTargetDataRef TD) {
   delete unwrap(TD);
 }

Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=135245&r1=135244&r2=135245&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Fri Jul 15 00:21:59 2011
@@ -329,15 +329,6 @@
     }
   }
 
-  void InvalidateEntry(const StructType *Ty) {
-    LayoutInfoTy::iterator I = LayoutInfo.find(Ty);
-    if (I == LayoutInfo.end()) return;
-    
-    I->second->~StructLayout();
-    free(I->second);
-    LayoutInfo.erase(I);
-  }
-
   StructLayout *&operator[](const StructType *STy) {
     return LayoutInfo[STy];
   }
@@ -375,16 +366,6 @@
   return L;
 }
 
-/// InvalidateStructLayoutInfo - TargetData speculatively caches StructLayout
-/// objects.  If a TargetData object is alive when types are being refined and
-/// removed, this method must be called whenever a StructType is removed to
-/// avoid a dangling pointer in this cache.
-void TargetData::InvalidateStructLayoutInfo(const StructType *Ty) const {
-  if (!LayoutMap) return;  // No cache.
-
-  static_cast<StructLayoutMap*>(LayoutMap)->InvalidateEntry(Ty);
-}
-
 std::string TargetData::getStringRepresentation() const {
   std::string Result;
   raw_string_ostream OS(Result);





More information about the llvm-commits mailing list