llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.43k stars 12.16k forks source link

[DirectX] Design an approach for handling DebugInfo when writing DXIL #64775

Open bogner opened 1 year ago

bogner commented 1 year ago

We currently fall apart in DXILBitcodeWriter when trying to emit DXIL with DebugInfo. Some of this is relatively easy to deal with, but a lot of problems stem from the fact that the DI representation in metadata has changed a lot since DXIL was codified, and the naive "downgrade" approach kind of falls apart. We need to decide how we're going to handle this.

Presumably, the way forward is based on one of the following approaches:

AC:

llvmbot commented 1 year ago

@llvm/issue-subscribers-debuginfo

bogner commented 1 year ago

On further reflection I suspect a lot of this will just kind of work out. A lot of the constructs we struggle with are things that we aren't lowering to the DXIL representations yet (like globals associated with buffers), so once all of that's in place it's likely that we just won't have that many things to deal with here.

bogner commented 8 months ago

As evidenced by #85884 we will need to do something about debug intrinsics, which are being eliminated:

Presumably we'll need to reintroduce these when emitting DXIL

jmorse commented 8 months ago

Hola -- this is a fly-by comment, but we've designed the DPValue / DbgRecord / whatever-it-is-now information to have a one-to-one correspondence with debug intrinsics, so converting things back to intrinsic form should be straight forwards (there's a createDebugIntrinsic method that does most of it). Perhaps things will change more in the future, but for now it's pretty trivial, there's a convertFromNewDbgValues method hanging around on Module / Function / BasicBlock that does it for you.