[cfe-commits] r98248 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CGDebugInfo.cpp CGRTTI.cpp CGVtable.cpp CGVtable.h

Anders Carlsson andersca at mac.com
Wed Mar 10 23:15:17 PST 2010


Author: andersca
Date: Thu Mar 11 01:15:17 2010
New Revision: 98248

URL: http://llvm.org/viewvc/llvm-project?rev=98248&view=rev
Log:
Rename getVirtualBaseOffsetIndex to getVirtualBaseOffsetOffset to reflect what it actually does.

Modified:
    cfe/trunk/lib/CodeGen/CGClass.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGRTTI.cpp
    cfe/trunk/lib/CodeGen/CGVtable.cpp
    cfe/trunk/lib/CodeGen/CGVtable.h

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=98248&r1=98247&r2=98248&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu Mar 11 01:15:17 2010
@@ -98,7 +98,7 @@
   }
   if (VBase)
     VirtualOffset = 
-      getVtableInfo().getVirtualBaseOffsetIndex(ClassDecl, BaseClassDecl);
+      getVtableInfo().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
   
   uint64_t Offset = 
     ComputeNonVirtualBaseClassOffset(getContext(), Paths.front(), Start);
@@ -1540,11 +1540,11 @@
                                                  Int8PtrTy->getPointerTo());
   VTablePtr = Builder.CreateLoad(VTablePtr, "vtable");
 
-  int64_t VBaseOffsetIndex = 
-    CGM.getVtableInfo().getVirtualBaseOffsetIndex(ClassDecl, BaseClassDecl);
+  int64_t VBaseOffsetOffset = 
+    CGM.getVtableInfo().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
   
   llvm::Value *VBaseOffsetPtr = 
-    Builder.CreateConstGEP1_64(VTablePtr, VBaseOffsetIndex, "vbase.offset.ptr");
+    Builder.CreateConstGEP1_64(VTablePtr, VBaseOffsetOffset, "vbase.offset.ptr");
   const llvm::Type *PtrDiffTy = 
     ConvertType(getContext().getPointerDiffType());
   

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=98248&r1=98247&r2=98248&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Mar 11 01:15:17 2010
@@ -649,9 +649,9 @@
       cast<CXXRecordDecl>(BI->getType()->getAs<RecordType>()->getDecl());
     
     if (BI->isVirtual()) {
-      // virtual base offset index is -ve. The code generator emits dwarf
+      // virtual base offset offset is -ve. The code generator emits dwarf
       // expression where it expects +ve number.
-      BaseOffset = 0 - CGM.getVtableInfo().getVirtualBaseOffsetIndex(RD, Base);
+      BaseOffset = 0 - CGM.getVtableInfo().getVirtualBaseOffsetOffset(RD, Base);
       BFlags = llvm::DIType::FlagVirtual;
     } else
       BaseOffset = RL.getBaseClassOffset(Base);

Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=98248&r1=98247&r2=98248&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Thu Mar 11 01:15:17 2010
@@ -760,7 +760,7 @@
     // subobject. For a virtual base, this is the offset in the virtual table of
     // the virtual base offset for the virtual base referenced (negative).
     if (Base->isVirtual())
-      OffsetFlags = CGM.getVtableInfo().getVirtualBaseOffsetIndex(RD, BaseDecl);
+      OffsetFlags = CGM.getVtableInfo().getVirtualBaseOffsetOffset(RD, BaseDecl);
     else {
       const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
       OffsetFlags = Layout.getBaseClassOffset(BaseDecl) / 8;

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=98248&r1=98247&r2=98248&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Mar 11 01:15:17 2010
@@ -1412,8 +1412,8 @@
           VBaseOffsetOffsets.lookup(Offset.VirtualBase);
       } else {
         Adjustment.VBaseOffsetOffset = 
-          VtableInfo.getVirtualBaseOffsetIndex(Offset.DerivedClass,
-                                               Offset.VirtualBase);
+          VtableInfo.getVirtualBaseOffsetOffset(Offset.DerivedClass,
+                                                Offset.VirtualBase);
       }
 
       // FIXME: Once the assert in getVirtualBaseOffsetIndex is back again,
@@ -2696,7 +2696,7 @@
     CXXRecordDecl *D = cast<CXXRecordDecl>(qD->getAs<RecordType>()->getDecl());
     CXXRecordDecl *B = cast<CXXRecordDecl>(qB->getAs<RecordType>()->getDecl());
     if (D != MostDerivedClass)
-      return CGM.getVtableInfo().getVirtualBaseOffsetIndex(D, B);
+      return CGM.getVtableInfo().getVirtualBaseOffsetOffset(D, B);
     llvm::DenseMap<const CXXRecordDecl *, Index_t>::iterator i;
     i = VBIndex.find(B);
     if (i != VBIndex.end())
@@ -3444,13 +3444,13 @@
   return 0;
 }
 
-int64_t CGVtableInfo::getVirtualBaseOffsetIndex(const CXXRecordDecl *RD, 
-                                                const CXXRecordDecl *VBase) {
+int64_t CGVtableInfo::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD, 
+                                                 const CXXRecordDecl *VBase) {
   ClassPairTy ClassPair(RD, VBase);
   
-  VirtualBaseClassIndiciesTy::iterator I = 
-    VirtualBaseClassIndicies.find(ClassPair);
-  if (I != VirtualBaseClassIndicies.end())
+  VirtualBaseClassOffsetOffsetsMapTy::iterator I = 
+    VirtualBaseClassOffsetOffsets.find(ClassPair);
+  if (I != VirtualBaseClassOffsetOffsets.end())
     return I->second;
   
   // FIXME: This seems expensive.  Can we do a partial job to get
@@ -3466,17 +3466,17 @@
     // Insert all types.
     ClassPairTy ClassPair(RD, I->first);
     
-    VirtualBaseClassIndicies.insert(std::make_pair(ClassPair, I->second));
+    VirtualBaseClassOffsetOffsets.insert(std::make_pair(ClassPair, I->second));
   }
   
-  I = VirtualBaseClassIndicies.find(ClassPair);
+  I = VirtualBaseClassOffsetOffsets.find(ClassPair);
   // FIXME: The assertion below assertion currently fails with the old vtable 
   /// layout code if there is a non-virtual thunk adjustment in a vtable.
   // Once the new layout is in place, this return should be removed.
-  if (I == VirtualBaseClassIndicies.end())
+  if (I == VirtualBaseClassOffsetOffsets.end())
     return 0;
   
-  assert(I != VirtualBaseClassIndicies.end() && "Did not find index!");
+  assert(I != VirtualBaseClassOffsetOffsets.end() && "Did not find index!");
   
   return I->second;
 }

Modified: cfe/trunk/lib/CodeGen/CGVtable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.h?rev=98248&r1=98247&r2=98248&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.h (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.h Thu Mar 11 01:15:17 2010
@@ -149,10 +149,12 @@
   typedef std::pair<const CXXRecordDecl *,
                     const CXXRecordDecl *> ClassPairTy;
 
-  /// VirtualBaseClassIndicies - Contains the index into the vtable where the
-  /// offsets for virtual bases of a class are stored.
-  typedef llvm::DenseMap<ClassPairTy, int64_t> VirtualBaseClassIndiciesTy;
-  VirtualBaseClassIndiciesTy VirtualBaseClassIndicies;
+  /// VirtualBaseClassOffsetOffsets - Contains the vtable offset (relative to 
+  /// the address point) in bytes where the offsets for virtual bases of a class
+  /// are stored.
+  typedef llvm::DenseMap<ClassPairTy, int64_t> 
+    VirtualBaseClassOffsetOffsetsMapTy;
+  VirtualBaseClassOffsetOffsetsMapTy VirtualBaseClassOffsetOffsets;
 
   /// Vtables - All the vtables which have been defined.
   llvm::DenseMap<const CXXRecordDecl *, llvm::GlobalVariable *> Vtables;
@@ -202,13 +204,13 @@
   /// stored.
   uint64_t getMethodVtableIndex(GlobalDecl GD);
 
-  /// getVirtualBaseOffsetIndex - Return the index (relative to the vtable
-  /// address point) where the offset of the virtual base that contains the
-  /// given Base is stored, otherwise, if no virtual base contains the given
+  /// getVirtualBaseOffsetOffset - Return the offset in bytes (relative to the
+  /// vtable address point) where the offset of the virtual base that contains 
+  /// the given base is stored, otherwise, if no virtual base contains the given
   /// class, return 0.  Base must be a virtual base class or an unambigious
   /// base.
-  int64_t getVirtualBaseOffsetIndex(const CXXRecordDecl *RD,
-                                    const CXXRecordDecl *VBase);
+  int64_t getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
+                                     const CXXRecordDecl *VBase);
 
   AdjustmentVectorTy *getAdjustments(GlobalDecl GD);
 





More information about the cfe-commits mailing list