[DebugInfo] LiveDebugValues: move DBG_VALUE creation into VarLoc class
authorJeremy Morse <jeremy.morse.llvm@gmail.com>
Fri, 4 Oct 2019 10:53:47 +0000 (10:53 +0000)
committerJeremy Morse <jeremy.morse.llvm@gmail.com>
Fri, 4 Oct 2019 10:53:47 +0000 (10:53 +0000)
commit61800a75b77db89f0b85aa40fe1bfe8b7c92ea1a
tree208da4983e953aef6b313cacfdafaff980576daa
parent90cfbf35c97d87fdaf6b96a970e97a35fd9fccca
[DebugInfo] LiveDebugValues: move DBG_VALUE creation into VarLoc class

Rather than having a mixture of location-state shared between DBG_VALUEs
and VarLoc objects in LiveDebugValues, this patch makes VarLoc the
master record of variable locations. The refactoring means that the
transfer of locations from one place to another is always a performed by
an operation on an existing VarLoc, that produces another transferred
VarLoc. DBG_VALUEs are only created at the end of LiveDebugValues, once
all locations are known. As a plus, there is now only one method where
DBG_VALUEs can be created.

The test case added covers a circumstance that is now impossible to
express in LiveDebugValues: if an already-indirect DBG_VALUE is spilt,
previously it would have been restored-from-spill as a direct DBG_VALUE.
We now don't lose this information along the way, as VarLocs always
refer back to the "original" non-transfer DBG_VALUE, and we can always
work out whether a location was "originally" indirect.

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

llvm-svn: 373727
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir