This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] DISubprogram flags get their own flags word. NFC
ClosedPublic

Authored by probinson on Nov 15 2018, 12:25 PM.

Details

Summary

Take existing bitfields in DISubprogram and formalize them
into a flags word analogous to DINode::DIFlags, except these
flags are all specific to subprograms.

This patch does NOT change bitcode or IR formats; that will
be in a follow-up (this one is big enough already).

My goal is to have a better place to add new subprogram-specific
flags such as the ones in D54043. We could also consider moving
some subprogram-specific flags from DIFlags to DISPFlags.

Note that I have NOT YET run clang-format, as I think the diff is
easier to read in its current state. i will definitely run it before
committing.

Diff Detail

Repository
rL LLVM

Event Timeline

probinson created this revision.Nov 15 2018, 12:25 PM

Just to make sure I'm reading this correctly: This patch does not change the bitcode format in any way?

llvm/include/llvm/IR/DebugInfoSPFlags.def
27 ↗(On Diff #174268)

Personally I would just stick these macros next to the DIFlag macros so they are easier to find.

This looks generally good. For the subsequent bitcode patch we need to be careful about backwards-compatibility.

llvm/include/llvm/IR/DebugInfoMetadata.h
1622 ↗(On Diff #174268)

We usually also #undef the macro after we're done, in case we need to include the def file again.

llvm/include/llvm/IR/DebugInfoSPFlags.def
19 ↗(On Diff #174268)

That C++-style comment on the same line as the macro looks dangerous :-)

Just to make sure I'm reading this correctly: This patch does not change the bitcode format in any way?

That's correct, I intentionally avoided doing that. I plan a follow-up that does change the bitcode format, storing the DISPFlags all in one word instead of scattered as they are now. Then future new flags can be added without affecting bitcode layout.

dblaikie added inline comments.Nov 15 2018, 1:10 PM
llvm/include/llvm/IR/DebugInfoMetadata.h
1622 ↗(On Diff #174268)

Undefing inside the def file's probably more reliable?

llvm/include/llvm/IR/DebugInfoSPFlags.def
19 ↗(On Diff #174268)

Any particular danger you've got in mind that wouldn't come up with a comment on a separate line?

aprantl added inline comments.Nov 15 2018, 1:16 PM
llvm/include/llvm/IR/DebugInfoSPFlags.def
19 ↗(On Diff #174268)

You're right, this is a macro expansion, not a definition, so regardless of how the user defines the macro the comment probably won't hurt.

probinson updated this revision to Diff 174284.Nov 15 2018, 2:23 PM
probinson marked 2 inline comments as done.

Remove new .def file, move content into DebugInfoFlags.def.
Fix one oversight in Clang part, lit tests now all pass.

probinson updated this revision to Diff 174388.Nov 16 2018, 9:37 AM

Delete unneeded ctor. Clang-format.

I think this looks good now.

llvm/include/llvm/IR/DebugInfoFlags.def
14 ↗(On Diff #174284)

Btw. I think this comment is out-of-date and can be removed.

I think this looks good now.

Can you make that official? :-)

llvm/include/llvm/IR/DebugInfoFlags.def
14 ↗(On Diff #174284)

Will do.

aprantl accepted this revision.Nov 16 2018, 10:35 AM
This revision is now accepted and ready to land.Nov 16 2018, 10:35 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 8 2019, 12:06 PM
SouraVX removed a subscriber: SouraVX.Oct 8 2019, 12:06 PM