[cfe-commits] r124807 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CGClass.cpp CGExprCXX.cpp CodeGenFunction.h
Fariborz Jahanian
fjahanian at apple.com
Thu Feb 3 11:27:17 PST 2011
Author: fjahanian
Date: Thu Feb 3 13:27:17 2011
New Revision: 124807
URL: http://llvm.org/viewvc/llvm-project?rev=124807&view=rev
Log:
Clean up of -fapple-kext abi code. No change otherwise.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=124807&r1=124806&r2=124807&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Feb 3 13:27:17 2011
@@ -312,7 +312,6 @@
llvm::Value *
CodeGenFunction::BuildAppleKextVirtualCall(const CXXMethodDecl *MD,
NestedNameSpecifier *Qual,
- llvm::Value *This,
const llvm::Type *Ty) {
llvm::Value *VTable = 0;
assert((Qual->getKind() == NestedNameSpecifier::TypeSpec) &&
@@ -354,7 +353,6 @@
// It need be somehow inline expanded into the caller.
// -O does that. But need to support -O0 as well.
if (MD->isVirtual() && Type != Dtor_Base) {
- DD = cast<CXXDestructorDecl>(DD->getCanonicalDecl());
// Compute the function type we're calling.
const CGFunctionInfo *FInfo =
&CGM.getTypes().getFunctionInfo(cast<CXXDestructorDecl>(MD),
@@ -362,18 +360,18 @@
const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
const llvm::Type *Ty
= CGM.getTypes().GetFunctionType(*FInfo, FPT->isVariadic());
- if (!RD)
- RD = DD->getParent();
+
llvm::Value *VTable = CGM.getVTables().GetAddrOfVTable(RD);
Ty = Ty->getPointerTo()->getPointerTo();
VTable = Builder.CreateBitCast(VTable, Ty);
+ DD = cast<CXXDestructorDecl>(DD->getCanonicalDecl());
uint64_t VTableIndex =
- CGM.getVTables().getMethodVTableIndex(GlobalDecl(DD, Type));
+ CGM.getVTables().getMethodVTableIndex(GlobalDecl(DD, Type));
uint64_t AddressPoint =
- CGM.getVTables().getAddressPoint(BaseSubobject(RD, 0), RD);
+ CGM.getVTables().getAddressPoint(BaseSubobject(RD, 0), RD);
VTableIndex += AddressPoint;
llvm::Value *VFuncPtr =
- CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfnkxt");
+ CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfnkxt");
Callee = CGF.Builder.CreateLoad(VFuncPtr);
}
return Callee;
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=124807&r1=124806&r2=124807&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu Feb 3 13:27:17 2011
@@ -1270,7 +1270,8 @@
ForVirtualBase);
llvm::Value *Callee = 0;
if (getContext().getLangOptions().AppleKext)
- Callee = BuildAppleKextVirtualDestructorCall(DD, Type);
+ Callee = BuildAppleKextVirtualDestructorCall(DD, Type,
+ DD->getParent());
if (!Callee)
Callee = CGM.GetAddrOfCXXDestructor(DD, Type);
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=124807&r1=124806&r2=124807&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Thu Feb 3 13:27:17 2011
@@ -228,7 +228,7 @@
if (getContext().getLangOptions().AppleKext &&
MD->isVirtual() &&
ME->hasQualifier())
- Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), This, Ty);
+ Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), Ty);
else
Callee = CGM.GetAddrOfFunction(GlobalDecl(Dtor, Dtor_Complete), Ty);
}
@@ -241,7 +241,7 @@
if (getContext().getLangOptions().AppleKext &&
MD->isVirtual() &&
ME->hasQualifier())
- Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), This, Ty);
+ Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), Ty);
else
Callee = CGM.GetAddrOfFunction(MD, Ty);
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=124807&r1=124806&r2=124807&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Feb 3 13:27:17 2011
@@ -1661,12 +1661,11 @@
llvm::Value *This, const llvm::Type *Ty);
llvm::Value *BuildAppleKextVirtualCall(const CXXMethodDecl *MD,
NestedNameSpecifier *Qual,
- llvm::Value *This,
const llvm::Type *Ty);
llvm::Value *BuildAppleKextVirtualDestructorCall(const CXXDestructorDecl *DD,
CXXDtorType Type,
- const CXXRecordDecl *RD=0);
+ const CXXRecordDecl *RD);
RValue EmitCXXMemberCall(const CXXMethodDecl *MD,
llvm::Value *Callee,
More information about the cfe-commits
mailing list