[PATCH] D85741: [DebugInstrRef][1/9] Initial fields and instruction for instruction-referencing variable locations

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 08:45:47 PDT 2020


jmorse created this revision.
jmorse added a reviewer: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jmorse requested review of this revision.

This is a series of patches adding basic instruction-referencing functionality to debug instructions, as described in this RFC [0]. All of this work hinges on the stack of LiveDebugValues work at D83046 <https://reviews.llvm.org/D83046> which is getting reviewed: it may or may not finish anytime soon, but I've uploaded these patches for further transparency and reducing bus factor.

This patch series allows DBG_INSTR_REF instructions to reference instructions that are (initially) in the same block as the corresponding dbg.value; two other series will deal with:

- PHIs, and their passage through regalloc,
- COPYs.

This patch itself doesn't add any code, instead it adds some data structure fields: each MachineInstr now gets an instruction number field, and a corresponding field in MachineFunction records the "next" instruction number. The idea behind this is that each MachineInstr is going to carry around a unique identifier that DBG_INSTR_REFs refer to. This is the core part of the "lets refer to instructions" idea. Each DBG_INSTR_REF instruction has the format:

  DBG_INSTR_REF inst-num-imm, operand-num-imm, !DILocalVariable..., !DIExpression...

i.e., the first operand identifies an instruction number and an operand within that instruction. This means we can identify values by the place that they're defined, but an important design decision is that there's no direct connection between the two. It's inefficient to identify the instruction from the DBG_INSTR_REF, and vice versa. This may (or may not) be worthy of discussion.

[0] http://lists.llvm.org/pipermail/llvm-dev/2020-February/139440.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85741

Files:
  llvm/include/llvm/CodeGen/MachineFunction.h
  llvm/include/llvm/CodeGen/MachineInstr.h
  llvm/include/llvm/Support/TargetOpcodes.def
  llvm/include/llvm/Target/Target.td
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/MachineInstr.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85741.284757.patch
Type: text/x-patch
Size: 7898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200811/7560390d/attachment.bin>


More information about the llvm-commits mailing list