William Woodruff via llvm-dev
2020-Jan-29 16:21 UTC
[llvm-dev] Mapping from IR instructions to MIR?
Hi all, I'd like to use LLVM to generate a total mapping from IR instructions to their lowered MIR counterpart(s), post all gMIR/legalization/ISel passes. However, I'm having trouble figuring out whether this is currently supported somewhere in the backend/has a known correct approach. Does anybody know if this is something currently do-able within the backend? I've run into a bit of a dead end with IRTranslator. There's also a comment in LegalizerHelper.h that suggests the presence of configurable "RecordInsertInstruction" functions[1], but I can't find any other references to it. Thanks! William Woodruff [1]: https://github.com/llvm/llvm-project/blob/a9af1dc34d33762751958a91aa8b82b856c2077a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h#L91 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200129/a78c282b/attachment.html>
Jeremy Morse via llvm-dev
2020-Jan-30 13:53 UTC
[llvm-dev] Mapping from IR instructions to MIR?
Hi William, On Wed, Jan 29, 2020 at 4:21 PM William Woodruff via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I'd like to use LLVM to generate a total mapping from IR instructions to their lowered MIR counterpart(s), post all gMIR/legalization/ISel passes. However, I'm having trouble figuring out whether this is currently supported somewhere in the backend/has a known correct approach.Does debugging information fit your use case? An IR instruction's DebugLoc tracks its line number (and more), which is preserved through to the corresponding MIR instructions. Due to the optimisations involved in isel, I don't think it's guaranteed that an IR instruction has to have one corresponding MIR instruction, there can be several, or none. -- Thanks, Jeremy