AsmPrinter: Rewrite initialization of DbgVariable, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 21 Jun 2015 16:50:43 +0000 (16:50 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 21 Jun 2015 16:50:43 +0000 (16:50 +0000)
commit01a8dc8ca61974beb5283f5e75a85644ab84b40d
tree5b6da250e477ab4c5bb8542ffb6c5811ef925cb2
parent87f860c737b303b604a3abf89aee2e4d83ce7857
AsmPrinter: Rewrite initialization of DbgVariable, NFC

There are three types of `DbgVariable`:
  - alloca variables, created based on the MMI table,
  - register variables, created based on DBG_VALUE instructions, and
  - optimized-out variables.

This commit reconfigures `DbgVariable` to make it easier to tell which
kind we have, and make initialization a little clearer.

For MMI/alloca variables, `FrameIndex.size()` must always equal
`Expr.size()`, and there shouldn't be an `MInsn`.  For register
variables (with a `MInsn`), `FrameIndex` must be empty, and `Expr`
should have 0 or 1 element depending on whether it has a complex
expression (registers with multiple locations use `DebugLocListIndex`).
Optimized-out variables shouldn't have any of these fields.

Moreover, this separates DBG_VALUE initialization until after the
variable is created, simplifying logic in a future commit that changes
`collectVariableInfo()` to stop creating empty .debug_loc entries/lists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240243 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h