diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-31 17:06:31 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-31 17:06:31 +0000 | 
| commit | 735bee93f1285c5c55c64d80fdc2ede4c0f23341 (patch) | |
| tree | e1209c2a0b4880eee15e0ce705016372f7c88724 /contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp | |
| parent | 51315c45ff5643a27f9c84b816db54ee870ba29b (diff) | |
| parent | 486754660bb926339aefcf012a3f848592babb8b (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp | 31 | 
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp b/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp index ad473032db17..ec48231e5247 100644 --- a/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp +++ b/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp @@ -215,6 +215,19 @@ llvm::MDNode *CodeGenTBAA::getTypeInfo(QualType QTy) {    return MetadataCache[Ty] = TypeNode;  } +TBAAAccessInfo CodeGenTBAA::getAccessInfo(QualType AccessType) { +  // Pointee values may have incomplete types, but they shall never be +  // dereferenced. +  if (AccessType->isIncompleteType()) +    return TBAAAccessInfo::getIncompleteInfo(); + +  if (TypeHasMayAlias(AccessType)) +    return TBAAAccessInfo::getMayAliasInfo(); + +  uint64_t Size = Context.getTypeSizeInChars(AccessType).getQuantity(); +  return TBAAAccessInfo(getTypeInfo(AccessType), Size); +} +  TBAAAccessInfo CodeGenTBAA::getVTablePtrAccessInfo(llvm::Type *VTablePtrType) {    llvm::DataLayout DL(&Module);    unsigned Size = DL.getPointerTypeSize(VTablePtrType); @@ -391,3 +404,21 @@ CodeGenTBAA::mergeTBAAInfoForConditionalOperator(TBAAAccessInfo InfoA,    // access type regardless of their base types.    return TBAAAccessInfo::getMayAliasInfo();  } + +TBAAAccessInfo +CodeGenTBAA::mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo, +                                            TBAAAccessInfo SrcInfo) { +  if (DestInfo == SrcInfo) +    return DestInfo; + +  if (!DestInfo || !SrcInfo) +    return TBAAAccessInfo(); + +  if (DestInfo.isMayAlias() || SrcInfo.isMayAlias()) +    return TBAAAccessInfo::getMayAliasInfo(); + +  // TODO: Implement the rest of the logic here. For example, two accesses +  // with same final access types result in an access to an object of that final +  // access type regardless of their base types. +  return TBAAAccessInfo::getMayAliasInfo(); +}  | 
