diff options
author | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-06 08:17:48 +0000 |
---|---|---|
committer | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-06 08:17:48 +0000 |
commit | 383890bad473c1df16a4397aa669b801712b13d8 (patch) | |
tree | 427d5183a2fa98149e930eff6d1e8c1eaf4a6a48 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 468e2f63f4742e403b77d3862d848a8479426c39 (diff) | |
download | llvm-383890bad473c1df16a4397aa669b801712b13d8.zip llvm-383890bad473c1df16a4397aa669b801712b13d8.tar.gz llvm-383890bad473c1df16a4397aa669b801712b13d8.tar.bz2 |
Refine generation of TBAA information in clang
This patch is an attempt to clarify and simplify generation and
propagation of TBAA information. The idea is to pack all values
that describe a memory access, namely, base type, access type and
offset, into a single structure. This is supposed to make further
changes, such as adding support for unions and array members,
easier to prepare and review.
DecorateInstructionWithTBAA() is no more responsible for
converting types to tags. These implicit conversions not only
complicate reading the code, but also suggest assigning scalar
access tags while we generally prefer full-size struct-path tags.
TBAAPathTag is replaced with TBAAAccessInfo; the latter is now
the type of the keys of the cache map that translates access
descriptors to metadata nodes.
Fixed a bug with writing to a wrong map in
getTBAABaseTypeMetadata() (former getTBAAStructTypeInfo()).
We now check for valid base access types every time we
dereference a field. The original code only checks the top-level
base type. See isValidBaseType() / isTBAAPathStruct() calls.
Some entities have been renamed to sound more adequate and less
confusing/misleading in presence of path-aware TBAA information.
Now we do not lookup twice for the same cache entry in
getAccessTagInfo().
Refined relevant comments and descriptions.
Differential Revision: https://reviews.llvm.org/D37826
llvm-svn: 315048
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 8cee6b6..68be87f 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1914,14 +1914,14 @@ public: LValueBaseInfo BaseInfo = LValueBaseInfo(AlignmentSource::Type)) { return LValue::MakeAddr(Addr, T, getContext(), BaseInfo, - CGM.getTBAATypeInfo(T)); + CGM.getTBAAAccessInfo(T)); } LValue MakeAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment, LValueBaseInfo BaseInfo = LValueBaseInfo(AlignmentSource::Type)) { return LValue::MakeAddr(Address(V, Alignment), T, getContext(), - BaseInfo, CGM.getTBAATypeInfo(T)); + BaseInfo, CGM.getTBAAAccessInfo(T)); } LValue MakeNaturalAlignPointeeAddrLValue(llvm::Value *V, QualType T); @@ -3060,7 +3060,14 @@ public: SourceLocation Loc, LValueBaseInfo BaseInfo = LValueBaseInfo(AlignmentSource::Type), - TBAAAccessInfo TBAAInfo = TBAAAccessInfo(), + bool isNontemporal = false) { + return EmitLoadOfScalar(Addr, Volatile, Ty, Loc, BaseInfo, + CGM.getTBAAAccessInfo(Ty), isNontemporal); + } + + llvm::Value *EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, + SourceLocation Loc, LValueBaseInfo BaseInfo, + TBAAAccessInfo TBAAInfo, bool isNontemporal = false); /// EmitLoadOfScalar - Load a scalar value from an address, taking @@ -3076,7 +3083,14 @@ public: bool Volatile, QualType Ty, LValueBaseInfo BaseInfo = LValueBaseInfo(AlignmentSource::Type), - TBAAAccessInfo TBAAInfo = TBAAAccessInfo(), + bool isInit = false, bool isNontemporal = false) { + EmitStoreOfScalar(Value, Addr, Volatile, Ty, BaseInfo, + CGM.getTBAAAccessInfo(Ty), isInit, isNontemporal); + } + + void EmitStoreOfScalar(llvm::Value *Value, Address Addr, + bool Volatile, QualType Ty, + LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo, bool isInit = false, bool isNontemporal = false); /// EmitStoreOfScalar - Store a scalar value to an address, taking |