This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Unify generation of scalar and struct-path TBAA tags
ClosedPublic

Authored by kosarev on Oct 3 2017, 7:10 AM.

Details

Summary

This patch makes it possible to produce access tags in a uniform manner regardless whether the resulting tag will be a scalar or a struct-path one. getAccessTagInfo() now takes care of the actual translation of access descriptors to tags and can handle all kinds of accesses. Facilities that specific to scalar accesses are eliminated.

Some more details:

  • DecorateInstructionWithTBAA() is not responsible for conversion of types to access tags anymore. Instead, it takes an access descriptor (TBAAAccessInfo) and generates corresponding access tag from it.
  • getTBAAInfoForVTablePtr() reworked to getTBAAVTablePtrAccessInfo() that now returns the virtual-pointer access descriptor and not the virtual-point type metadata.
  • Added function getTBAAMayAliasAccessInfo() that returns the descriptor for may-alias accesses.
  • getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now it is the only way to generate access tag by a given access descriptor. It is capable of producing both scalar and struct-path tags, depending on options and availability of the base access type. getTBAAScalarTagInfo() and its cache ScalarTagMetadataCache are eliminated.
  • Now that we do not need to care about whether the resulting access tag should be a scalar or struct-path one, getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
  • Added function getTBAAAccessInfo() that constructs access descriptor by a given QualType access type.

This is part of D37826 reworked to be a separate patch to simplify review.

Diff Detail

Repository
rL LLVM

Event Timeline

kosarev created this revision.Oct 3 2017, 7:10 AM

Just in case, please let me know if you think this change should further be broken down into smaller pieces. Thanks.

rjmccall accepted this revision.Oct 4 2017, 7:46 PM

LGTM with one comment fix that I noticed.

lib/CodeGen/CodeGenModule.h
659 ↗(On Diff #117519)

"an access"

This revision is now accepted and ready to land.Oct 4 2017, 7:46 PM
This revision was automatically updated to reflect the committed changes.