[PATCH] D38788: [CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue base info
Ivan A. Kosarev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 11 01:57:24 PDT 2017
kosarev created this revision.
kosarev added a project: clang.
Prepared on top of https://reviews.llvm.org/D38733.
Repository:
rL LLVM
https://reviews.llvm.org/D38788
Files:
CodeGen/CGClass.cpp
CodeGen/CGExpr.cpp
CodeGen/CodeGenFunction.h
Index: CodeGen/CodeGenFunction.h
===================================================================
--- CodeGen/CodeGenFunction.h
+++ CodeGen/CodeGenFunction.h
@@ -3327,7 +3327,8 @@
Address EmitCXXMemberDataPointerAddress(const Expr *E, Address base,
llvm::Value *memberPtr,
const MemberPointerType *memberPtrType,
- LValueBaseInfo *BaseInfo = nullptr);
+ LValueBaseInfo *BaseInfo = nullptr,
+ TBAAAccessInfo *TBAAInfo = nullptr);
RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E,
ReturnValueSlot ReturnValue);
Index: CodeGen/CGExpr.cpp
===================================================================
--- CodeGen/CGExpr.cpp
+++ CodeGen/CGExpr.cpp
@@ -4571,11 +4571,12 @@
= E->getRHS()->getType()->getAs<MemberPointerType>();
LValueBaseInfo BaseInfo;
+ TBAAAccessInfo TBAAInfo;
Address MemberAddr =
- EmitCXXMemberDataPointerAddress(E, BaseAddr, OffsetV, MPT, &BaseInfo);
+ EmitCXXMemberDataPointerAddress(E, BaseAddr, OffsetV, MPT, &BaseInfo,
+ &TBAAInfo);
- return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo,
- CGM.getTBAAAccessInfo(MPT->getPointeeType()));
+ return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo, TBAAInfo);
}
/// Given the address of a temporary variable, produce an r-value of
Index: CodeGen/CGClass.cpp
===================================================================
--- CodeGen/CGClass.cpp
+++ CodeGen/CGClass.cpp
@@ -129,13 +129,16 @@
CodeGenFunction::EmitCXXMemberDataPointerAddress(const Expr *E, Address base,
llvm::Value *memberPtr,
const MemberPointerType *memberPtrType,
- LValueBaseInfo *BaseInfo) {
+ LValueBaseInfo *BaseInfo,
+ TBAAAccessInfo *TBAAInfo) {
// Ask the ABI to compute the actual address.
llvm::Value *ptr =
CGM.getCXXABI().EmitMemberDataPointerAddress(*this, E, base,
memberPtr, memberPtrType);
QualType memberType = memberPtrType->getPointeeType();
+ if (TBAAInfo)
+ *TBAAInfo = CGM.getTBAAAccessInfo(memberType);
CharUnits memberAlign = getNaturalTypeAlignment(memberType, BaseInfo);
memberAlign =
CGM.getDynamicOffsetAlignment(base.getAlignment(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38788.118560.patch
Type: text/x-patch
Size: 2706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171011/53ab4c71/attachment.bin>
More information about the cfe-commits
mailing list