Page MenuHomePhabricator

[DebugInfo] Enable the capability of attaching metadata to BasicBlock.
AbandonedPublic

Authored by HsiangKai on Mar 29 2018, 11:25 PM.

Details

Reviewers
rnk
chenwj
aprantl
Summary

In order to attach debug info to labels. We need to enable the capability of attaching metadata to BasicBlock. If we have following LLVM IR fragment,

top:

%0 = load i32, i32* %a.addr, align 4

we could attach debug metadata to label 'top' as follow

top: !10

%0 = load i32, i32* %a.addr, align 4

!10 = DILabel(name: top, ...)

Diff Detail

Repository
rL LLVM

Event Timeline

HsiangKai created this revision.Mar 29 2018, 11:25 PM

Add DILabel to SlotTracker in IR AsmWriter.

I don't understand the part of BasicBlock, the others LGTM.

include/llvm/IR/BasicBlock.h
66

Would you mind elaborating what the enum, RefCountBits and RefCountMask are for?

lib/IR/AsmWriter.cpp
2930

If I understand correctly, BB->getAllMetadata() should return MD of label? InstMD is kind of confusing here. It makes me think you want to get MD of instructions within the basic block. Maybe LabelMD would be better?

I replied to the thread on llvm-dev. We also need a plan for how to update this metadata in the inliner.

HsiangKai abandoned this revision.Apr 2 2018, 8:09 AM

As discussed in llvm-dev mailing list, we should attach label metadata in intrinsic instead of basic block.