[cfe-commits] r102275 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CodeGenFunction.h

Anders Carlsson andersca at mac.com
Sat Apr 24 14:51:08 PDT 2010


Author: andersca
Date: Sat Apr 24 16:51:08 2010
New Revision: 102275

URL: http://llvm.org/viewvc/llvm-project?rev=102275&view=rev
Log:
Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.

Modified:
    cfe/trunk/lib/CodeGen/CGClass.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=102275&r1=102274&r2=102275&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sat Apr 24 16:51:08 2010
@@ -229,10 +229,9 @@
 }
 
 llvm::Value *
-CodeGenFunction::GetAddressOfBaseClass(llvm::Value *Value,
-                                       const CXXRecordDecl *Class,
-                                       const CXXRecordDecl *BaseClass,
-                                       bool NullCheckValue) {
+CodeGenFunction::OldGetAddressOfBaseClass(llvm::Value *Value,
+                                          const CXXRecordDecl *Class,
+                                          const CXXRecordDecl *BaseClass) {
   QualType BTy =
     getContext().getCanonicalType(
       getContext().getTypeDeclType(BaseClass));
@@ -282,22 +281,6 @@
     return Builder.CreateBitCast(Value, BasePtrTy);
   }    
 
-  llvm::BasicBlock *CastNull = 0;
-  llvm::BasicBlock *CastNotNull = 0;
-  llvm::BasicBlock *CastEnd = 0;
-  
-  if (NullCheckValue) {
-    CastNull = createBasicBlock("cast.null");
-    CastNotNull = createBasicBlock("cast.notnull");
-    CastEnd = createBasicBlock("cast.end");
-    
-    llvm::Value *IsNull = 
-      Builder.CreateICmpEQ(Value,
-                           llvm::Constant::getNullValue(Value->getType()));
-    Builder.CreateCondBr(IsNull, CastNull, CastNotNull);
-    EmitBlock(CastNotNull);
-  }
-  
   llvm::Value *VirtualOffset = 0;
 
   if (VBase)
@@ -308,21 +291,6 @@
   
   // Cast back.
   Value = Builder.CreateBitCast(Value, BasePtrTy);
- 
-  if (NullCheckValue) {
-    Builder.CreateBr(CastEnd);
-    EmitBlock(CastNull);
-    Builder.CreateBr(CastEnd);
-    EmitBlock(CastEnd);
-    
-    llvm::PHINode *PHI = Builder.CreatePHI(Value->getType());
-    PHI->reserveOperandSpace(2);
-    PHI->addIncoming(Value, CastNotNull);
-    PHI->addIncoming(llvm::Constant::getNullValue(Value->getType()), 
-                     CastNull);
-    Value = PHI;
-  }
-  
   return Value;
 }
 
@@ -631,10 +599,8 @@
   CXXCtorType CtorType = Ctor_Complete;
   
   if (ClassDecl) {
-    Dest = GetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl,
-                                 /*NullCheckValue=*/false);
-    Src = GetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl,
-                                /*NullCheckValue=*/false);
+    Dest = OldGetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl);
+    Src = OldGetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl);
 
     // We want to call the base constructor.
     CtorType = Ctor_Base;
@@ -663,10 +629,8 @@
                                         const CXXRecordDecl *BaseClassDecl,
                                         QualType Ty) {
   if (ClassDecl) {
-    Dest = GetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl,
-                                 /*NullCheckValue=*/false);
-    Src = GetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl,
-                                /*NullCheckValue=*/false);
+    Dest = OldGetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl);
+    Src = OldGetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl);
   }
   if (BaseClassDecl->hasTrivialCopyAssignment()) {
     EmitAggregateCopy(Dest, Src, Ty);
@@ -1300,9 +1264,8 @@
       continue;
     const CXXDestructorDecl *D = BaseClassDecl->getDestructor(getContext());
     
-    llvm::Value *V = GetAddressOfBaseClass(LoadCXXThis(),
-                                           ClassDecl, BaseClassDecl, 
-                                           /*NullCheckValue=*/false);
+    llvm::Value *V = OldGetAddressOfBaseClass(LoadCXXThis(),
+                                              ClassDecl, BaseClassDecl);
     EmitCXXDestructorCall(D, Dtor_Base, V);
   }
 }
@@ -1678,8 +1641,7 @@
   if (CodeGenVTables::needsVTTParameter(CurGD) && NearestVBase) {
     // We need to use the virtual base offset offset because the virtual base
     // might have a different offset in the most derived class.
-    VTableField = GetAddressOfBaseClass(LoadCXXThis(), VTableClass, RD, 
-                                        /*NullCheckValue=*/false);
+    VTableField = OldGetAddressOfBaseClass(LoadCXXThis(), VTableClass, RD);
   } else {
     const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext());
 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=102275&r1=102274&r2=102275&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat Apr 24 16:51:08 2010
@@ -780,13 +780,13 @@
                                                bool IsVirtual,
                                                const CXXRecordDecl *Derived,
                                                const CXXRecordDecl *Base);
-  
+
+  llvm::Value *OldGetAddressOfBaseClass(llvm::Value *Value,
+                                        const CXXRecordDecl *ClassDecl,
+                                        const CXXRecordDecl *BaseClassDecl);
+
   /// GetAddressOfBaseClass - This function will add the necessary delta to the
   /// load of 'this' and returns address of the base class.
-  llvm::Value *GetAddressOfBaseClass(llvm::Value *Value,
-                                     const CXXRecordDecl *ClassDecl,
-                                     const CXXRecordDecl *BaseClassDecl,
-                                     bool NullCheckValue);
   llvm::Value *GetAddressOfBaseClass(llvm::Value *Value, 
                                      const CXXRecordDecl *ClassDecl,
                                      const CXXBaseSpecifierArray &BasePath, 





More information about the cfe-commits mailing list