This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Add calling conventions to DISubroutineType
ClosedPublic

Authored by rnk on Jun 8 2016, 9:54 AM.

Details

Summary

This should have been a very simple change, but it was greatly
complicated by the construction of new Decls during IR generation.

In particular, we reconstruct the AST function type in order to get the
implicit 'this' parameter into C++ method types.

We also have to worry about FunctionDecls whose types are not
FunctionTypes because CGBlocks.cpp constructs some dummy FunctionDecls
with 'void' type.

Depends on D21114

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 60055.Jun 8 2016, 9:54 AM
rnk retitled this revision from to [DebugInfo] Add calling conventions to DISubroutineType.
rnk updated this object.
rnk added reviewers: aprantl, dblaikie.
rnk added a subscriber: cfe-commits.
aprantl edited edge metadata.Jun 8 2016, 11:13 AM

Assuming that we could usually get the calling convention from the Function — what's the motivation for emitting the calling convention of a subprogram that has been optimized away?

rnk added a comment.Jun 8 2016, 11:30 AM

Assuming that we could usually get the calling convention from the Function — what's the motivation for emitting the calling convention of a subprogram that has been optimized away?

I don't have any motivation to emit DISubprograms for optimized away code, but Functions aren't always available. Function pointers can also have calling conventions, and they will only have a DISubroutineType.

aprantl accepted this revision.Jun 8 2016, 11:58 AM
aprantl edited edge metadata.

Function pointers make sense to me, thanks!
LGTM

lib/CodeGen/CGDebugInfo.cpp
834 ↗(On Diff #60055)

I just wanted to say that it would be nice to have this function in DIBuilder, but then realized that CallingConv is defined in clang.

This revision is now accepted and ready to land.Jun 8 2016, 11:58 AM
This revision was automatically updated to reflect the committed changes.