[FEA] Add support for typed constant in debug info metadata emission.#1326
[FEA] Add support for typed constant in debug info metadata emission.#1326esc merged 2 commits intonumba:mainfrom
Conversation
Thank you for the PR, @jiel-nv. |
Thank you @swap357. I've submitted a fix. |
gmarkall
left a comment
There was a problem hiding this comment.
Thanks for the PR - this looks good to me. I've checked it aligns with other IR documented in the LLVM Language reference manual, e.g. https://llvm.org/docs/LangRef.html#ditemplatevalueparameter which gives value: i32 7 as an example. I also notes that the use of typed constants is consistent with general usage in metadata nodes (c.f. https://llvm.org/docs/LangRef.html#metadata-nodes-mdnode).
Add support for typed constants in debug info metadata fields (like extraData in DIDerivedType):
e.g.
!8 = !DIDerivedType(tag: DW_TAG_member, ... , extraData: i32 1)
or
!24 = !DIDerivedType(tag: DW_TAG_member, ... , extraData: i8 2)
The extraData field should be LLVM IR ConstantAsMetadata wrapping a typed constant (like ConstantInt) in LLVM IR text format which appears as typed constants like:
i32 1
i8 2
Also add a llvmlite test to guard this change.
I have tested this change with the Numba and Numba-CUDA debuginfo tests locally as well, with no issues.