summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorIvan A. Kosarev <ikosarev@accesssoftek.com>2017-10-02 09:54:47 +0000
committerIvan A. Kosarev <ikosarev@accesssoftek.com>2017-10-02 09:54:47 +0000
commitc6e3259e7046af28706e8c7477bc522875d15956 (patch)
tree10815c3f50223200f4e2af6ee471def901a9f244 /lib/CodeGen/CGExpr.cpp
parent1b6da5f2b894561cd4c6c6355cba118e9c23e4b7 (diff)
[CodeGen] Do not refer to complete TBAA info where we actually deal with just TBAA access types
This patch fixes misleading names of entities related to getting, setting and generation of TBAA access type descriptors. This is effectively an attempt to provide a review for D37826 by breaking it into smaller pieces. Differential Revision: https://reviews.llvm.org/D38404 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 4659d1b520..b37036659c 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -1165,7 +1165,7 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
Scope.ForceCleanup({&V});
return LValue::MakeAddr(Address(V, LV.getAlignment()), LV.getType(),
getContext(), LV.getBaseInfo(),
- LV.getTBAAInfo());
+ LV.getTBAAAccessType());
}
// FIXME: Is it possible to create an ExprWithCleanups that produces a
// bitfield lvalue or some other non-simple lvalue?
@@ -1365,7 +1365,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(LValue lvalue,
SourceLocation Loc) {
return EmitLoadOfScalar(lvalue.getAddress(), lvalue.isVolatile(),
lvalue.getType(), Loc, lvalue.getBaseInfo(),
- lvalue.getTBAAInfo(),
+ lvalue.getTBAAAccessType(),
lvalue.getTBAABaseType(), lvalue.getTBAAOffset(),
lvalue.isNontemporal());
}
@@ -1477,7 +1477,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
QualType Ty,
SourceLocation Loc,
LValueBaseInfo BaseInfo,
- llvm::MDNode *TBAAInfo,
+ llvm::MDNode *TBAAAccessType,
QualType TBAABaseType,
uint64_t TBAAOffset,
bool isNontemporal) {
@@ -1508,7 +1508,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
// Atomic operations have to be done on integral types.
LValue AtomicLValue =
- LValue::MakeAddr(Addr, Ty, getContext(), BaseInfo, TBAAInfo);
+ LValue::MakeAddr(Addr, Ty, getContext(), BaseInfo, TBAAAccessType);
if (Ty->isAtomicType() || LValueIsSuitableForInlineAtomic(AtomicLValue)) {
return EmitAtomicLoad(AtomicLValue, Loc).getScalarVal();
}
@@ -1519,11 +1519,11 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
Load->getContext(), llvm::ConstantAsMetadata::get(Builder.getInt32(1)));
Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
}
- if (TBAAInfo) {
+ if (TBAAAccessType) {
bool MayAlias = BaseInfo.getMayAlias();
llvm::MDNode *TBAA = MayAlias
- ? CGM.getTBAAInfo(getContext().CharTy)
- : CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo, TBAAOffset);
+ ? CGM.getTBAATypeInfo(getContext().CharTy)
+ : CGM.getTBAAStructTagInfo(TBAABaseType, TBAAAccessType, TBAAOffset);
if (TBAA)
CGM.DecorateInstructionWithTBAA(Load, TBAA, MayAlias);
}
@@ -1566,7 +1566,7 @@ llvm::Value *CodeGenFunction::EmitFromMemory(llvm::Value *Value, QualType Ty) {
void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
bool Volatile, QualType Ty,
LValueBaseInfo BaseInfo,
- llvm::MDNode *TBAAInfo,
+ llvm::MDNode *TBAAAccessType,
bool isInit, QualType TBAABaseType,
uint64_t TBAAOffset,
bool isNontemporal) {
@@ -1596,7 +1596,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
Value = EmitToMemory(Value, Ty);
LValue AtomicLValue =
- LValue::MakeAddr(Addr, Ty, getContext(), BaseInfo, TBAAInfo);
+ LValue::MakeAddr(Addr, Ty, getContext(), BaseInfo, TBAAAccessType);
if (Ty->isAtomicType() ||
(!isInit && LValueIsSuitableForInlineAtomic(AtomicLValue))) {
EmitAtomicStore(RValue::get(Value), AtomicLValue, isInit);
@@ -1610,11 +1610,11 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
llvm::ConstantAsMetadata::get(Builder.getInt32(1)));
Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
}
- if (TBAAInfo) {
+ if (TBAAAccessType) {
bool MayAlias = BaseInfo.getMayAlias();
llvm::MDNode *TBAA = MayAlias
- ? CGM.getTBAAInfo(getContext().CharTy)
- : CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo, TBAAOffset);
+ ? CGM.getTBAATypeInfo(getContext().CharTy)
+ : CGM.getTBAAStructTagInfo(TBAABaseType, TBAAAccessType, TBAAOffset);
if (TBAA)
CGM.DecorateInstructionWithTBAA(Store, TBAA, MayAlias);
}
@@ -1624,8 +1624,9 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *value, LValue lvalue,
bool isInit) {
EmitStoreOfScalar(value, lvalue.getAddress(), lvalue.isVolatile(),
lvalue.getType(), lvalue.getBaseInfo(),
- lvalue.getTBAAInfo(), isInit, lvalue.getTBAABaseType(),
- lvalue.getTBAAOffset(), lvalue.isNontemporal());
+ lvalue.getTBAAAccessType(), isInit,
+ lvalue.getTBAABaseType(), lvalue.getTBAAOffset(),
+ lvalue.isNontemporal());
}
/// EmitLoadOfLValue - Given an expression that represents a value lvalue, this
@@ -3725,9 +3726,9 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
if (CGM.shouldUseTBAA()) {
llvm::MDNode *tbaa;
if (mayAlias)
- tbaa = CGM.getTBAAInfo(getContext().CharTy);
+ tbaa = CGM.getTBAATypeInfo(getContext().CharTy);
else
- tbaa = CGM.getTBAAInfo(type);
+ tbaa = CGM.getTBAATypeInfo(type);
if (tbaa)
CGM.DecorateInstructionWithTBAA(load, tbaa);
}
@@ -3778,8 +3779,8 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
// Fields of may_alias structs act like 'char' for TBAA purposes.
// FIXME: this should get propagated down through anonymous structs
// and unions.
- if (mayAlias && LV.getTBAAInfo())
- LV.setTBAAInfo(CGM.getTBAAInfo(getContext().CharTy));
+ if (mayAlias && LV.getTBAAAccessType())
+ LV.setTBAAAccessType(CGM.getTBAATypeInfo(getContext().CharTy));
return LV;
}