This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Collect information about sizes of accesses and access types for TBAA
ClosedPublic

Authored by kosarev on Nov 17 2017, 7:12 AM.

Details

Summary

The information about access and type sizes is necessary for producing TBAA metadata in the new size-aware format. With this patch, D39955 and D39956 in place we should be able to change CodeGenTBAA::createScalarTypeNode() and CodeGenTBAA::getBaseTypeInfo() to generate metadata in the new format under the -new-struct-path-tbaa command-line option. For now, this new information remains unused.

Diff Detail

Repository
rL LLVM

Event Timeline

kosarev created this revision.Nov 17 2017, 7:12 AM
kosarev added inline comments.Nov 22 2017, 1:58 AM
lib/CodeGen/CGClass.cpp
2426 ↗(On Diff #123333)

Now that type and access descriptors include information about sizes, the function needs to know the type of the virtual table pointer to access.

lib/CodeGen/CodeGenModule.cpp
139 ↗(On Diff #123333)

To clarify why we pass the module instead of LLVM context: we need it to compute the size of virtual table pointers as their types are llvm::Type types and not clang::Type or QualType ones.

585 ↗(On Diff #123333)

getAccessTagInfo() will raise an assertion failure if such an access descriptor is passed to it. This way we explicitly claim that generating access tags for incomplete objects is not allowed.

rjmccall accepted this revision.Nov 26 2017, 3:21 PM

Alright, I guess this all makes sense. We do have some extensions that are playing around with v-table pointers, so it's probably fair to require the v-table pointer type to be passed down instead of assuming it's just the generic pointer size.

This revision is now accepted and ready to land.Nov 26 2017, 3:21 PM
This revision was automatically updated to reflect the committed changes.