forked from OSchip/llvm-project
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
llvm-svn: 91520
This commit is contained in:
parent
18ada9856f
commit
07863b8b6e
|
@ -264,7 +264,7 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) {
|
|||
|
||||
// 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 @@ void CodeGenFunction::EmitStartEHSpec(const Decl *D) {
|
|||
|
||||
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 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
|
|||
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
|
||||
|
|
|
@ -469,9 +469,9 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
|
|||
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 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
|
|||
|
||||
// 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);
|
||||
|
|
|
@ -485,21 +485,3 @@ llvm::Constant *CodeGenModule::GetAddrOfRTTI(QualType Ty) {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -219,17 +219,6 @@ public:
|
|||
/// 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,
|
||||
|
|
|
@ -97,7 +97,7 @@ void test1() {
|
|||
// 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
|
||||
|
|
Loading…
Reference in New Issue