You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(I'm not sure if implementing this is a good idea right now but) The very high-level idea would be:
Figure out a place in the pipeline where the layouts are already computed. E.g. layout information is needed for LLVM IR, so this information should be available when the compiler mode corresponds to -emit-irgen or later.
At this point, you need to somehow traverse the different nominal type declarations in the module, then I believe you'd need to do a mapping NominalTypeDecl -> Type -> SILType -> TypeInfo -> TypeLayoutEntry. I believe the TypeLayoutEntry values are the "final" form having all the details about layout, but not 100% sure about this.
You'll see some methods on TypeConverter such as convertType and methods on IRGenModule such as getStorageType, those seem to be relevant. You'll also see a TypeLayoutCache which has methods doing the last part, mapping SILType and TypeInfo values to TypeLayoutEntry} values.
That said, I'm not entirely sure what the cleanest way to get this information out would be.
theindigamer (JIRA User) thank you for the info, looks a bit complicated for my current knowledge set I guess. Let me stick with few more starter bugs before doing this. Thank you and sorry!
Additional Detail from JIRA
md5: 9ee01c76caeea20f34adfc65e4c6646b
Issue Description:
https://eli.thegreenplace.net/2012/12/17/dumping-a-c-objects-memory-layout-with-clang
Having something similar for Swift would be helpful for people optimizing the code as well as people working on the later stages of the compiler.
The text was updated successfully, but these errors were encountered: