[all-commits] [llvm/llvm-project] 8496fc: [DebugInstrRef][1/3] Track PHI values through regi...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Wed May 26 12:24:44 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8496fc2ec8046727e298629aa74943be0137267b
      https://github.com/llvm/llvm-project/commit/8496fc2ec8046727e298629aa74943be0137267b
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineFunction.h
    M llvm/include/llvm/CodeGen/MachineInstr.h
    M llvm/include/llvm/Support/TargetOpcodes.def
    M llvm/include/llvm/Target/Target.td
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/CodeGen/LiveDebugVariables.cpp
    M llvm/lib/CodeGen/PHIElimination.cpp
    M llvm/lib/CodeGen/PrologEpilogInserter.cpp
    A llvm/test/DebugInfo/MIR/InstrRef/phi-regallocd-to-stack.mir
    A llvm/test/DebugInfo/MIR/InstrRef/phi-through-regalloc.mir

  Log Message:
  -----------
  [DebugInstrRef][1/3] Track PHI values through register allocation

This patch introduces "DBG_PHI" instructions, a marker of where a PHI
instruction used to be, before PHI elimination. Under the instruction
referencing model, we want to know where every value in the function is
defined -- and a PHI, even if implicit, is such a place.

Just like instruction numbers, we can use this to identify a value to be
used as a variable value, but we don't need to know what instruction
defines that value, for example:

bb1:
   DBG_PHI $rax, 1
   [... more insts ... ]
bb2:
   DBG_INSTR_REF 1, 0, !1234, !DIExpression()

This specifies that on entry to bb1, whatever value is in $rax is known
as value number one -- and the later DBG_INSTR_REF marks the position
where variable !1234 should take on value number one.

PHI locations are stored in MachineFunction for the duration of the
regalloc phase in the DebugPHIPositions map. The map is populated by
PHIElimination, and then flushed back into the instruction stream by
virtregrewriter. A small amount of maintenence is needed in
LiveDebugVariables to account for registers being split, but only for
individual positions, not for entire ranges of blocks.

Differential Revision: https://reviews.llvm.org/D86812




More information about the All-commits mailing list