[cfe-commits] r91520 - in /cfe/trunk: lib/CodeGen/CGException.cpp lib/CodeGen/CGExprCXX.cpp lib/CodeGen/CGRTTI.cpp lib/CodeGen/CodeGenModule.h test/CodeGenCXX/dyncast.cpp
Anders Carlsson
andersca at mac.com
Tue Dec 15 23:05:41 PST 2009
Author: andersca
Date: Wed Dec 16 01:05:41 2009
New Revision: 91520
URL: http://llvm.org/viewvc/llvm-project?rev=91520&view=rev
Log:
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
Modified:
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CGRTTI.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/test/CodeGenCXX/dyncast.cpp
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=91520&r1=91519&r2=91520&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Dec 16 01:05:41 2009
@@ -264,7 +264,7 @@
// Now throw the exception.
const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(getLLVMContext());
- llvm::Constant *TypeInfo = CGM.GenerateRTTI(ThrowType);
+ llvm::Constant *TypeInfo = CGM.GetAddrOfRTTI(ThrowType);
llvm::Constant *Dtor = llvm::Constant::getNullValue(Int8PtrTy);
if (getInvokeDest()) {
@@ -347,8 +347,7 @@
for (unsigned i = 0; i < Proto->getNumExceptions(); ++i) {
QualType Ty = Proto->getExceptionType(i);
- llvm::Value *EHType
- = CGM.GenerateRTTI(Ty.getNonReferenceType());
+ llvm::Value *EHType = CGM.GetAddrOfRTTI(Ty.getNonReferenceType());
SelectorArgs.push_back(EHType);
}
if (Proto->getNumExceptions())
@@ -487,8 +486,8 @@
const CXXCatchStmt *C = S.getHandler(i);
VarDecl *CatchParam = C->getExceptionDecl();
if (CatchParam) {
- llvm::Value *EHType
- = CGM.GenerateRTTI(C->getCaughtType().getNonReferenceType());
+ llvm::Value *EHType
+ = CGM.GetAddrOfRTTI(C->getCaughtType().getNonReferenceType());
SelectorArgs.push_back(EHType);
} else {
// null indicates catch all
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=91520&r1=91519&r2=91520&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Dec 16 01:05:41 2009
@@ -469,9 +469,9 @@
V = Builder.CreateLoad(V);
return V;
}
- return Builder.CreateBitCast(CGM.GenerateRTTI(RD), LTy);
+ return Builder.CreateBitCast(CGM.GetAddrOfRTTI(RD), LTy);
}
- return Builder.CreateBitCast(CGM.GenerateRTTI(Ty), LTy);
+ return Builder.CreateBitCast(CGM.GetAddrOfRTTI(Ty), LTy);
}
llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
@@ -550,8 +550,8 @@
// FIXME: Calculate better hint.
llvm::Value *hint = llvm::ConstantInt::get(PtrDiffTy, -1ULL);
- llvm::Value *SrcArg = CGM.GenerateRTTIRef(SrcTy);
- llvm::Value *DstArg = CGM.GenerateRTTIRef(DstTy);
+ llvm::Value *SrcArg = CGM.GetAddrOfRTTI(SrcTy);
+ llvm::Value *DstArg = CGM.GetAddrOfRTTI(DstTy);
V = Builder.CreateBitCast(V, PtrToInt8Ty);
V = Builder.CreateCall4(CGM.CreateRuntimeFunction(FTy, "__dynamic_cast"),
V, SrcArg, DstArg, hint);
Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=91520&r1=91519&r2=91520&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Wed Dec 16 01:05:41 2009
@@ -485,21 +485,3 @@
return RTTIBuilder(*this).BuildType(Ty);
}
-
-llvm::Constant *CodeGenModule::GenerateRTTIRef(const CXXRecordDecl *RD) {
- RTTIBuilder b(*this);
-
- return b.Buildclass_type_infoRef(RD);
-}
-
-llvm::Constant *CodeGenModule::GenerateRTTI(const CXXRecordDecl *RD) {
- RTTIBuilder b(*this);
-
- return b.Buildclass_type_info(RD, llvm::GlobalValue::ExternalLinkage);
-}
-
-llvm::Constant *CodeGenModule::GenerateRTTI(QualType Ty) {
- RTTIBuilder b(*this);
-
- return b.BuildType(Ty);
-}
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=91520&r1=91519&r2=91520&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Wed Dec 16 01:05:41 2009
@@ -219,17 +219,6 @@
/// decl.
llvm::Constant *GetAddrOfRTTI(const CXXRecordDecl *RD);
- /// GenerateRTTI - Generate the rtti information for the given type.
- llvm::Constant *GenerateRTTI(const CXXRecordDecl *RD);
-
- /// GenerateRTTIRef - Generate a reference to the rtti information for the
- /// given type.
- llvm::Constant *GenerateRTTIRef(const CXXRecordDecl *RD);
-
- /// GenerateRTTI - Generate the rtti information for the given
- /// non-class type.
- llvm::Constant *GenerateRTTI(QualType Ty);
-
llvm::Constant *GetAddrOfThunk(GlobalDecl GD,
const ThunkAdjustment &ThisAdjustment);
llvm::Constant *GetAddrOfCovariantThunk(GlobalDecl GD,
Modified: cfe/trunk/test/CodeGenCXX/dyncast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dyncast.cpp?rev=91520&r1=91519&r2=91520&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/dyncast.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dyncast.cpp Wed Dec 16 01:05:41 2009
@@ -97,7 +97,7 @@
// CHECK-LL-NEXT: br i1 %4, label %5, label %9
// CHECK-LL: ; <label>:5
// CHECK-LL-NEXT: %6 = bitcast %class.test1_A* %tmp to i8*
-// CHECK-LL-NEXT: %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast ({{.*}} @_ZTI7test1_B to i8*), i8* bitcast (i8** @_ZTI7test1_D to i8*), i64 -1)
+// CHECK-LL-NEXT: %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast (%0* @_ZTI7test1_B to i8*), i8* bitcast (%1* @_ZTI7test1_D to i8*), i64 -1) ; <i8*> [#uses=1]
// CHECK-LL-NEXT: %8 = bitcast i8* %7 to %class.test1_D*
// CHECK-LL-NEXT: br label %10
// CHECK-LL: ; <label>:9
More information about the cfe-commits
mailing list