[llvm] r312042 - [dwarfdump] Pretty print location expressions and location lists

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 14:41:21 PDT 2017


Author: rnk
Date: Tue Aug 29 14:41:21 2017
New Revision: 312042

URL: http://llvm.org/viewvc/llvm-project?rev=312042&view=rev
Log:
[dwarfdump] Pretty print location expressions and location lists

Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771

I can't seem to commandeer the old review, so I'm creating a new one.

With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:

    DW_AT_location [DW_FORM_data4]        (0x00000000
       0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
       0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
       0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
       0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)

And like this for debug_loc.dwo entries:
    DW_AT_location [DW_FORM_sec_offset]   (0x00000000
      Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
      Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)

Simple locations without ranges are printed inline:

   DW_AT_location [DW_FORM_block1]       (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)

The debug_loc(.dwo) dumping in changed accordingly to factor the code.

Reviewers: dblaikie, aprantl, friss

Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere

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

Added:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFExpression.h
    llvm/trunk/lib/DebugInfo/DWARF/DWARFExpression.cpp
Modified:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
    llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt
    llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
    llvm/trunk/lib/DebugInfo/DWARF/LLVMBuild.txt
    llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
    llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
    llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll
    llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll
    llvm/trunk/test/CodeGen/X86/2010-01-18-DbgValue.ll
    llvm/trunk/test/CodeGen/X86/2011-01-24-DbgValue-Before-Use.ll
    llvm/trunk/test/CodeGen/X86/dbg-baseptr.ll
    llvm/trunk/test/DebugInfo/AArch64/asan-stack-vars.ll
    llvm/trunk/test/DebugInfo/AArch64/bitfields.ll
    llvm/trunk/test/DebugInfo/AArch64/coalescing.ll
    llvm/trunk/test/DebugInfo/AArch64/frameindices.ll
    llvm/trunk/test/DebugInfo/AMDGPU/variable-locations.ll
    llvm/trunk/test/DebugInfo/ARM/PR16736.ll
    llvm/trunk/test/DebugInfo/ARM/PR26163.ll
    llvm/trunk/test/DebugInfo/ARM/bitfield.ll
    llvm/trunk/test/DebugInfo/ARM/partial-subreg.ll
    llvm/trunk/test/DebugInfo/ARM/s-super-register.ll
    llvm/trunk/test/DebugInfo/ARM/split-complex.ll
    llvm/trunk/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll
    llvm/trunk/test/DebugInfo/MIR/AArch64/clobber-sp.mir
    llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg-piece.mir
    llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg.mir
    llvm/trunk/test/DebugInfo/MIR/X86/bit-piece-dh.mir
    llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll
    llvm/trunk/test/DebugInfo/Mips/dsr-non-fixed-objects.ll
    llvm/trunk/test/DebugInfo/Sparc/subreg.ll
    llvm/trunk/test/DebugInfo/SystemZ/variable-loc.ll
    llvm/trunk/test/DebugInfo/X86/DW_AT_location-reference.ll
    llvm/trunk/test/DebugInfo/X86/FrameIndexExprs.ll
    llvm/trunk/test/DebugInfo/X86/PR26148.ll
    llvm/trunk/test/DebugInfo/X86/array.ll
    llvm/trunk/test/DebugInfo/X86/bitfields.ll
    llvm/trunk/test/DebugInfo/X86/block-capture.ll
    llvm/trunk/test/DebugInfo/X86/constant-loclist.ll
    llvm/trunk/test/DebugInfo/X86/data_member_location.ll
    llvm/trunk/test/DebugInfo/X86/dbg-declare-alloca.ll
    llvm/trunk/test/DebugInfo/X86/dbg-declare-arg.ll
    llvm/trunk/test/DebugInfo/X86/dbg-declare.ll
    llvm/trunk/test/DebugInfo/X86/dbg-merge-loc-entry.ll
    llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll
    llvm/trunk/test/DebugInfo/X86/dbg-value-frame-index.ll
    llvm/trunk/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
    llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll
    llvm/trunk/test/DebugInfo/X86/debug-info-packed-struct.ll
    llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll
    llvm/trunk/test/DebugInfo/X86/debug-loc-frame.ll
    llvm/trunk/test/DebugInfo/X86/debug-loc-offset.ll
    llvm/trunk/test/DebugInfo/X86/dw_op_minus_direct.ll
    llvm/trunk/test/DebugInfo/X86/fi-expr.ll
    llvm/trunk/test/DebugInfo/X86/fi-piece.ll
    llvm/trunk/test/DebugInfo/X86/fission-cu.ll
    llvm/trunk/test/DebugInfo/X86/fission-ranges.ll
    llvm/trunk/test/DebugInfo/X86/float_const_loclist.ll
    llvm/trunk/test/DebugInfo/X86/frame-register.ll
    llvm/trunk/test/DebugInfo/X86/inlined-formal-parameter.ll
    llvm/trunk/test/DebugInfo/X86/live-debug-variables.ll
    llvm/trunk/test/DebugInfo/X86/op_deref.ll
    llvm/trunk/test/DebugInfo/X86/parameters.ll
    llvm/trunk/test/DebugInfo/X86/partial-constant.ll
    llvm/trunk/test/DebugInfo/X86/pieces-1.ll
    llvm/trunk/test/DebugInfo/X86/pieces-2.ll
    llvm/trunk/test/DebugInfo/X86/pieces-3.ll
    llvm/trunk/test/DebugInfo/X86/pieces-4.ll
    llvm/trunk/test/DebugInfo/X86/reference-argument.ll
    llvm/trunk/test/DebugInfo/X86/single-dbg_value.ll
    llvm/trunk/test/DebugInfo/X86/single-fi.ll
    llvm/trunk/test/DebugInfo/X86/split-global.ll
    llvm/trunk/test/DebugInfo/X86/sret.ll
    llvm/trunk/test/DebugInfo/X86/stack-value-dwarf2.ll
    llvm/trunk/test/DebugInfo/X86/stack-value-piece.ll
    llvm/trunk/test/DebugInfo/X86/subregisters.ll
    llvm/trunk/test/DebugInfo/X86/template.ll
    llvm/trunk/test/DebugInfo/X86/this-stack_value.ll
    llvm/trunk/test/DebugInfo/dwarfdump-debug-loc-simple.test
    llvm/trunk/test/tools/dsymutil/ARM/scattered.c
    llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test
    llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
    llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test
    llvm/trunk/test/tools/dsymutil/X86/common-sym.test
    llvm/trunk/tools/llvm-dwarfdump/CMakeLists.txt
    llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Tue Aug 29 14:41:21 2017
@@ -43,6 +43,7 @@
 namespace llvm {
 
 class DataExtractor;
+class MCRegisterInfo;
 class MemoryBuffer;
 class raw_ostream;
 
@@ -85,6 +86,8 @@ class DWARFContext : public DIContext {
   bool CheckedForDWP = false;
   std::string DWPName;
 
+  std::unique_ptr<MCRegisterInfo> RegInfo;
+
   /// Read compile units from the debug_info section (if necessary)
   /// and store them in CUs.
   void parseCompileUnits();
@@ -106,9 +109,9 @@ protected:
 
 public:
   DWARFContext(std::unique_ptr<const DWARFObject> DObj,
-               std::string DWPName = "")
-      : DIContext(CK_DWARF), DWPName(std::move(DWPName)),
-        DObj(std::move(DObj)) {}
+               std::string DWPName = "");
+  ~DWARFContext();
+
   DWARFContext(DWARFContext &) = delete;
   DWARFContext &operator=(DWARFContext &) = delete;
 
@@ -243,6 +246,8 @@ public:
 
   std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath);
 
+  const MCRegisterInfo *getRegisterInfo() const { return RegInfo.get(); }
+
   /// Function used to handle default error reporting policy. Prints a error
   /// message and returns Continue, so DWARF context ignores the error.
   static ErrorPolicy defaultErrorHandler(Error E);
@@ -255,6 +260,11 @@ public:
   create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
          uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost);
 
+  /// Loads register info for the architecture of the provided object file.
+  /// Improves readability of dumped DWARF expressions. Requires the caller to
+  /// have initialized the relevant target descriptions.
+  Error loadRegisterInfo(const object::ObjectFile &Obj);
+
 private:
   /// Return the compile unit that includes an offset (relative to .debug_info).
   DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset);

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h Tue Aug 29 14:41:21 2017
@@ -10,16 +10,19 @@
 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
 
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
 #include <cstdint>
 
 namespace llvm {
-
+class DWARFUnit;
+class MCRegisterInfo;
 class raw_ostream;
 
 class DWARFDebugLoc {
+public:
   /// A single location within a location list.
   struct Entry {
     /// The beginning address of the instruction range.
@@ -27,7 +30,7 @@ class DWARFDebugLoc {
     /// The ending address of the instruction range.
     uint64_t End;
     /// The location of the variable within the specified range.
-    SmallVector<unsigned char, 4> Loc;
+    SmallVector<char, 4> Loc;
   };
 
   /// A list of locations that contain one variable.
@@ -37,42 +40,64 @@ class DWARFDebugLoc {
     unsigned Offset;
     /// All the locations in which the variable is stored.
     SmallVector<Entry, 2> Entries;
+    /// Dump this list on OS.
+    void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
+              const MCRegisterInfo *MRI, unsigned Indent) const;
   };
 
+private:
   using LocationLists = SmallVector<LocationList, 4>;
 
   /// A list of all the variables in the debug_loc section, each one describing
   /// the locations in which the variable is stored.
   LocationLists Locations;
 
+  unsigned AddressSize;
+
+  bool IsLittleEndian;
+
 public:
   /// Print the location lists found within the debug_loc section.
-  void dump(raw_ostream &OS) const;
+  void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo) const;
 
   /// Parse the debug_loc section accessible via the 'data' parameter using the
   /// address size also given in 'data' to interpret the address ranges.
   void parse(const DWARFDataExtractor &data);
+
+  Optional<LocationList> parseOneLocationList(DWARFDataExtractor Data,
+                                              uint32_t *Offset);
 };
 
 class DWARFDebugLocDWO {
+public:
   struct Entry {
     uint64_t Start;
     uint32_t Length;
-    SmallVector<unsigned char, 4> Loc;
+    SmallVector<char, 4> Loc;
   };
 
   struct LocationList {
     unsigned Offset;
     SmallVector<Entry, 2> Entries;
+    void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
+              const MCRegisterInfo *RegInfo, unsigned Indent) const;
   };
 
+private:
   using LocationLists = SmallVector<LocationList, 4>;
 
   LocationLists Locations;
 
+  unsigned AddressSize;
+
+  bool IsLittleEndian;
+
 public:
   void parse(DataExtractor data);
-  void dump(raw_ostream &OS) const;
+  void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo) const;
+
+  static Optional<LocationList> parseOneLocationList(DataExtractor Data,
+                                                     uint32_t *Offset);
 };
 
 } // end namespace llvm

Added: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFExpression.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFExpression.h?rev=312042&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFExpression.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFExpression.h Tue Aug 29 14:41:21 2017
@@ -0,0 +1,151 @@
+//===--- DWARFExpression.h - DWARF Expression handling ----------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_DWARFEXPRESSION_H
+#define LLVM_DEBUGINFO_DWARFEXPRESSION_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/iterator.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/DataExtractor.h"
+
+namespace llvm {
+class DWARFUnit;
+class MCRegisterInfo;
+class raw_ostream;
+
+class DWARFExpression {
+public:
+  class iterator;
+
+  /// This class represents an Operation in the Expression. Each operation can
+  /// have up to 2 oprerands.
+  ///
+  /// An Operation can be in Error state (check with isError()). This
+  /// means that it couldn't be decoded successfully and if it is the
+  /// case, all others fields contain undefined values.
+  class Operation {
+  public:
+    /// Size and signedness of expression operations' operands.
+    enum Encoding : uint8_t {
+      Size1 = 0,
+      Size2 = 1,
+      Size4 = 2,
+      Size8 = 3,
+      SizeLEB = 4,
+      SizeAddr = 5,
+      SizeRefAddr = 6,
+      SizeBlock = 7, ///< Preceding operand contains block size
+      SignBit = 0x8,
+      SignedSize1 = SignBit | Size1,
+      SignedSize2 = SignBit | Size2,
+      SignedSize4 = SignBit | Size4,
+      SignedSize8 = SignBit | Size8,
+      SignedSizeLEB = SignBit | SizeLEB,
+      SizeNA = 0xFF ///< Unused operands get this encoding.
+    };
+
+    enum DwarfVersion : uint8_t {
+      DwarfNA, ///< Serves as a marker for unused entries
+      Dwarf2 = 2,
+      Dwarf3,
+      Dwarf4
+    };
+
+    /// Description of the encoding of one expression Op.
+    struct Description {
+      DwarfVersion Version; ///< Dwarf version where the Op was introduced.
+      Encoding Op[2];       ///< Encoding for Op operands, or SizeNA.
+
+      Description(DwarfVersion Version = DwarfNA, Encoding Op1 = SizeNA,
+                  Encoding Op2 = SizeNA)
+          : Version(Version) {
+        Op[0] = Op1;
+        Op[1] = Op2;
+      }
+    };
+
+  private:
+    friend class DWARFExpression::iterator;
+    uint8_t Opcode; ///< The Op Opcode, DW_OP_<something>.
+    Description Desc;
+    bool Error;
+    uint32_t EndOffset;
+    uint64_t Operands[2];
+
+  public:
+    Description &getDescription() { return Desc; }
+    uint8_t getCode() { return Opcode; }
+    uint64_t getRawOperand(unsigned Idx) { return Operands[Idx]; }
+    uint32_t getEndOffset() { return EndOffset; }
+    bool extract(DataExtractor Data, uint16_t Version, uint8_t AddressSize,
+                 uint32_t Offset);
+    bool isError() { return Error; }
+    bool print(raw_ostream &OS, const DWARFExpression *U,
+               const MCRegisterInfo *RegInfo, bool isEH);
+  };
+
+  /// An iterator to go through the expression operations.
+  class iterator
+      : public iterator_facade_base<iterator, std::forward_iterator_tag, Operation> {
+    friend class DWARFExpression;
+    DWARFExpression *Expr;
+    uint32_t Offset;
+    Operation Op;
+    iterator(DWARFExpression *Expr, uint32_t Offset)
+        : Expr(Expr), Offset(Offset) {
+      Op.Error =
+          Offset >= Expr->Data.getData().size() ||
+          !Op.extract(Expr->Data, Expr->Version, Expr->AddressSize, Offset);
+    }
+
+  public:
+    class Operation &operator++() {
+      Offset = Op.isError() ? Expr->Data.getData().size() : Op.EndOffset;
+      Op.Error =
+          Offset >= Expr->Data.getData().size() ||
+          !Op.extract(Expr->Data, Expr->Version, Expr->AddressSize, Offset);
+      return Op;
+    }
+
+    class Operation &operator*() {
+      return Op;
+    }
+
+    // Comparison operators are provided out of line.
+    friend bool operator==(const iterator &, const iterator &);
+  };
+
+  DWARFExpression(DataExtractor Data, uint16_t Version, uint8_t AddressSize)
+      : Data(Data), Version(Version), AddressSize(AddressSize) {
+    assert(AddressSize == 8 || AddressSize == 4);
+  }
+
+  iterator begin() { return iterator(this, 0); }
+  iterator end() { return iterator(this, Data.getData().size()); }
+
+  void print(raw_ostream &OS, const MCRegisterInfo *RegInfo);
+
+private:
+  DataExtractor Data;
+  uint16_t Version;
+  uint8_t AddressSize;
+};
+
+inline bool operator==(const DWARFExpression::iterator &LHS,
+                       const DWARFExpression::iterator &RHS) {
+  return LHS.Expr == RHS.Expr && LHS.Offset == RHS.Offset;
+}
+
+inline bool operator!=(const DWARFExpression::iterator &LHS,
+                       const DWARFExpression::iterator &RHS) {
+  return !(LHS == RHS);
+}
+}
+#endif

Modified: llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt Tue Aug 29 14:41:21 2017
@@ -15,6 +15,7 @@ add_llvm_library(LLVMDebugInfoDWARF
   DWARFDebugPubTable.cpp
   DWARFDebugRangeList.cpp
   DWARFDie.cpp
+  DWARFExpression.cpp
   DWARFFormValue.cpp
   DWARFGdbIndex.cpp
   DWARFTypeUnit.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Tue Aug 29 14:41:21 2017
@@ -31,6 +31,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFSection.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
 #include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
+#include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/Object/Decompressor.h"
 #include "llvm/Object/MachO.h"
 #include "llvm/Object/ObjectFile.h"
@@ -40,6 +41,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cstdint>
@@ -59,6 +61,12 @@ using DWARFLineTable = DWARFDebugLine::L
 using FileLineInfoKind = DILineInfoSpecifier::FileLineInfoKind;
 using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind;
 
+DWARFContext::DWARFContext(std::unique_ptr<const DWARFObject> DObj,
+                           std::string DWPName)
+    : DIContext(CK_DWARF), DWPName(std::move(DWPName)), DObj(std::move(DObj)) {}
+
+DWARFContext::~DWARFContext() = default;
+
 static void dumpAccelSection(raw_ostream &OS, StringRef Name,
                              const DWARFObject &Obj,
                              const DWARFSection &Section,
@@ -237,12 +245,12 @@ void DWARFContext::dump(raw_ostream &OS,
 
   if (DumpType == DIDT_All || DumpType == DIDT_Loc) {
     OS << "\n.debug_loc contents:\n";
-    getDebugLoc()->dump(OS);
+    getDebugLoc()->dump(OS, getRegisterInfo());
   }
 
   if (DumpType == DIDT_All || DumpType == DIDT_LocDwo) {
     OS << "\n.debug_loc.dwo contents:\n";
-    getDebugLocDWO()->dump(OS);
+    getDebugLocDWO()->dump(OS, getRegisterInfo());
   }
 
   if (DumpType == DIDT_All || DumpType == DIDT_Frames) {
@@ -1295,3 +1303,19 @@ DWARFContext::create(const StringMap<std
       llvm::make_unique<DWARFObjInMemory>(Sections, AddrSize, isLittleEndian);
   return llvm::make_unique<DWARFContext>(std::move(DObj), "");
 }
+
+Error DWARFContext::loadRegisterInfo(const object::ObjectFile &Obj) {
+  // Detect the architecture from the object file. We usually don't need OS
+  // info to lookup a target and create register info.
+  Triple TT;
+  TT.setArch(Triple::ArchType(Obj.getArch()));
+  TT.setVendor(Triple::UnknownVendor);
+  TT.setOS(Triple::UnknownOS);
+  std::string TargetLookupError;
+  const Target *TheTarget =
+      TargetRegistry::lookupTarget(TT.str(), TargetLookupError);
+  if (!TargetLookupError.empty())
+    return make_error<StringError>(TargetLookupError, inconvertibleErrorCode());
+  RegInfo.reset(TheTarget->createMCRegInfo(TT.str()));
+  return Error::success();
+}

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp Tue Aug 29 14:41:21 2017
@@ -11,7 +11,10 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/Dwarf.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
+#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
@@ -20,104 +23,160 @@
 
 using namespace llvm;
 
-void DWARFDebugLoc::dump(raw_ostream &OS) const {
+// When directly dumping the .debug_loc without a compile unit, we have to guess
+// at the DWARF version. This only affects DW_OP_call_ref, which is a rare
+// expression that LLVM doesn't produce. Guessing the wrong version means we
+// won't be able to pretty print expressions in DWARF2 binaries produced by
+// non-LLVM tools.
+static void dumpExpression(raw_ostream &OS, ArrayRef<char> Data,
+                           bool IsLittleEndian, unsigned AddressSize,
+                           const MCRegisterInfo *MRI) {
+  DWARFDataExtractor Extractor(StringRef(Data.data(), Data.size()),
+                               IsLittleEndian, AddressSize);
+  DWARFExpression(Extractor, AddressSize, dwarf::DWARF_VERSION).print(OS, MRI);
+}
+
+void DWARFDebugLoc::LocationList::dump(raw_ostream &OS, bool IsLittleEndian,
+                                       unsigned AddressSize,
+                                       const MCRegisterInfo *MRI,
+                                       unsigned Indent) const {
+  for (const Entry &E : Entries) {
+    OS << '\n';
+    OS.indent(Indent);
+    OS << format("0x%016" PRIx64, E.Begin) << " - "
+       << format("0x%016" PRIx64, E.End) << ": ";
+
+    dumpExpression(OS, E.Loc, IsLittleEndian, AddressSize, MRI);
+  }
+}
+
+void DWARFDebugLoc::dump(raw_ostream &OS, const MCRegisterInfo *MRI) const {
   for (const LocationList &L : Locations) {
     OS << format("0x%8.8x: ", L.Offset);
-    const unsigned Indent = 12;
-    for (const Entry &E : L.Entries) {
-      if (&E != L.Entries.begin())
-        OS.indent(Indent);
-      OS << "Beginning address offset: " << format("0x%016" PRIx64, E.Begin)
-         << '\n';
-      OS.indent(Indent) << "   Ending address offset: "
-                        << format("0x%016" PRIx64, E.End) << '\n';
-      OS.indent(Indent) << "    Location description: ";
-      for (unsigned char Loc : E.Loc) {
-        OS << format("%2.2x ", Loc);
-      }
-      OS << "\n\n";
+    L.dump(OS, IsLittleEndian, AddressSize, MRI, 12);
+    OS << "\n\n";
+  }
+}
+
+Optional<DWARFDebugLoc::LocationList>
+DWARFDebugLoc::parseOneLocationList(DWARFDataExtractor Data, unsigned *Offset) {
+  LocationList LL;
+  LL.Offset = *Offset;
+
+  // 2.6.2 Location Lists
+  // A location list entry consists of:
+  while (true) {
+    Entry E;
+    if (!Data.isValidOffsetForDataOfSize(*Offset, 2 * Data.getAddressSize())) {
+      llvm::errs() << "Location list overflows the debug_loc section.\n";
+      return None;
+    }
+
+    // 1. A beginning address offset. ...
+    E.Begin = Data.getRelocatedAddress(Offset);
+
+    // 2. An ending address offset. ...
+    E.End = Data.getRelocatedAddress(Offset);
+
+    // The end of any given location list is marked by an end of list entry,
+    // which consists of a 0 for the beginning address offset and a 0 for the
+    // ending address offset.
+    if (E.Begin == 0 && E.End == 0)
+      return LL;
+
+    if (!Data.isValidOffsetForDataOfSize(*Offset, 2)) {
+      llvm::errs() << "Location list overflows the debug_loc section.\n";
+      return None;
+    }
+
+    unsigned Bytes = Data.getU16(Offset);
+    if (!Data.isValidOffsetForDataOfSize(*Offset, Bytes)) {
+      llvm::errs() << "Location list overflows the debug_loc section.\n";
+      return None;
     }
+    // A single location description describing the location of the object...
+    StringRef str = Data.getData().substr(*Offset, Bytes);
+    *Offset += Bytes;
+    E.Loc.reserve(str.size());
+    std::copy(str.begin(), str.end(), std::back_inserter(E.Loc));
+    LL.Entries.push_back(std::move(E));
   }
 }
 
 void DWARFDebugLoc::parse(const DWARFDataExtractor &data) {
+  IsLittleEndian = data.isLittleEndian();
+  AddressSize = data.getAddressSize();
+
   uint32_t Offset = 0;
-  while (data.isValidOffset(Offset+data.getAddressSize()-1)) {
-    Locations.resize(Locations.size() + 1);
-    LocationList &Loc = Locations.back();
-    Loc.Offset = Offset;
-    // 2.6.2 Location Lists
-    // A location list entry consists of:
-    while (true) {
-      // A beginning and ending address offsets.
-      Entry E;
-      E.Begin = data.getRelocatedAddress(&Offset);
-      E.End = data.getRelocatedAddress(&Offset);
-
-      // The end of any given location list is marked by an end of list entry,
-      // which consists of a 0 for the beginning address offset and a 0 for the
-      // ending address offset.
-      if (E.Begin == 0 && E.End == 0)
-        break;
-
-      unsigned Bytes = data.getU16(&Offset);
-      // A single location description describing the location of the object...
-      StringRef str = data.getData().substr(Offset, Bytes);
-      Offset += Bytes;
-      E.Loc.append(str.begin(), str.end());
-      Loc.Entries.push_back(std::move(E));
-    }
+  while (data.isValidOffset(Offset + data.getAddressSize() - 1)) {
+    if (auto LL = parseOneLocationList(data, &Offset))
+      Locations.push_back(std::move(*LL));
+    else
+      break;
   }
   if (data.isValidOffset(Offset))
     errs() << "error: failed to consume entire .debug_loc section\n";
 }
 
+Optional<DWARFDebugLocDWO::LocationList>
+DWARFDebugLocDWO::parseOneLocationList(DataExtractor Data, unsigned *Offset) {
+  LocationList LL;
+  LL.Offset = *Offset;
+
+  // dwarf::DW_LLE_end_of_list_entry is 0 and indicates the end of the list.
+  while (auto Kind =
+             static_cast<dwarf::LocationListEntry>(Data.getU8(Offset))) {
+    if (Kind != dwarf::DW_LLE_startx_length) {
+      llvm::errs() << "error: dumping support for LLE of kind " << (int)Kind
+                   << " not implemented\n";
+      return None;
+    }
+
+    Entry E;
+    E.Start = Data.getULEB128(Offset);
+    E.Length = Data.getU32(Offset);
+
+    unsigned Bytes = Data.getU16(Offset);
+    // A single location description describing the location of the object...
+    StringRef str = Data.getData().substr(*Offset, Bytes);
+    *Offset += Bytes;
+    E.Loc.resize(str.size());
+    std::copy(str.begin(), str.end(), E.Loc.begin());
+
+    LL.Entries.push_back(std::move(E));
+  }
+  return LL;
+}
+
 void DWARFDebugLocDWO::parse(DataExtractor data) {
+  IsLittleEndian = data.isLittleEndian();
+  AddressSize = data.getAddressSize();
+
   uint32_t Offset = 0;
   while (data.isValidOffset(Offset)) {
-    Locations.resize(Locations.size() + 1);
-    LocationList &Loc = Locations.back();
-    Loc.Offset = Offset;
-    dwarf::LocationListEntry Kind;
-    while ((Kind = static_cast<dwarf::LocationListEntry>(
-                data.getU8(&Offset))) != dwarf::DW_LLE_end_of_list) {
-
-      if (Kind != dwarf::DW_LLE_startx_length) {
-        errs() << "error: dumping support for LLE of kind " << (int)Kind
-               << " not implemented\n";
-        return;
-      }
-
-      Entry E;
-
-      E.Start = data.getULEB128(&Offset);
-      E.Length = data.getU32(&Offset);
-
-      unsigned Bytes = data.getU16(&Offset);
-      // A single location description describing the location of the object...
-      StringRef str = data.getData().substr(Offset, Bytes);
-      Offset += Bytes;
-      E.Loc.resize(str.size());
-      std::copy(str.begin(), str.end(), E.Loc.begin());
+    if (auto LL = parseOneLocationList(data, &Offset))
+      Locations.push_back(std::move(*LL));
+    else
+      return;
+  }
+}
 
-      Loc.Entries.push_back(std::move(E));
-    }
+void DWARFDebugLocDWO::LocationList::dump(raw_ostream &OS, bool IsLittleEndian,
+                                          unsigned AddressSize,
+                                          const MCRegisterInfo *MRI,
+                                          unsigned Indent) const {
+  for (const Entry &E : Entries) {
+    OS << '\n';
+    OS.indent(Indent);
+    OS << "Addr idx " << E.Start << " (w/ length " << E.Length << "): ";
+    dumpExpression(OS, E.Loc, IsLittleEndian, AddressSize, MRI);
   }
 }
 
-void DWARFDebugLocDWO::dump(raw_ostream &OS) const {
+void DWARFDebugLocDWO::dump(raw_ostream &OS, const MCRegisterInfo *MRI) const {
   for (const LocationList &L : Locations) {
     OS << format("0x%8.8x: ", L.Offset);
-    const unsigned Indent = 12;
-    for (const Entry &E : L.Entries) {
-      if (&E != L.Entries.begin())
-        OS.indent(Indent);
-      OS << "Beginning address index: " << E.Start << '\n';
-      OS.indent(Indent) << "                 Length: " << E.Length << '\n';
-      OS.indent(Indent) << "   Location description: ";
-      for (unsigned char Loc : E.Loc)
-        OS << format("%2.2x ", Loc);
-      OS << "\n\n";
-    }
+    L.dump(OS, IsLittleEndian, AddressSize, MRI, /*Indent=*/12);
+    OS << "\n\n";
   }
 }

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp Tue Aug 29 14:41:21 2017
@@ -16,6 +16,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
 #include "llvm/Object/ObjectFile.h"
@@ -81,6 +82,47 @@ static void dumpRanges(const DWARFObject
   }
 }
 
+static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
+                         DWARFUnit *U, unsigned Indent) {
+  DWARFContext &Ctx = U->getContext();
+  const DWARFObject &Obj = Ctx.getDWARFObj();
+  const MCRegisterInfo *MRI = Ctx.getRegisterInfo();
+  if (FormValue.isFormClass(DWARFFormValue::FC_Block) ||
+      FormValue.isFormClass(DWARFFormValue::FC_Exprloc)) {
+    ArrayRef<uint8_t> Expr = *FormValue.getAsBlock();
+    DataExtractor Data(StringRef((const char *)Expr.data(), Expr.size()),
+                       Ctx.isLittleEndian(), 0);
+    DWARFExpression(Data, U->getVersion(), U->getAddressByteSize())
+        .print(OS, MRI);
+    return;
+  }
+
+  FormValue.dump(OS);
+  if (FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) {
+    const DWARFSection &LocSection = Obj.getLocSection();
+    const DWARFSection &LocDWOSection = Obj.getLocDWOSection();
+    uint32_t Offset = *FormValue.getAsSectionOffset();
+
+    if (!LocSection.Data.empty()) {
+      DWARFDebugLoc DebugLoc;
+      DWARFDataExtractor Data(Obj, LocSection, Ctx.isLittleEndian(),
+                              Obj.getAddressSize());
+      auto LL = DebugLoc.parseOneLocationList(Data, &Offset);
+      if (LL)
+        LL->dump(OS, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, Indent);
+      else
+        OS << "error extracting location list.";
+    } else if (!LocDWOSection.Data.empty()) {
+      DataExtractor Data(LocDWOSection.Data, Ctx.isLittleEndian(), 0);
+      auto LL = DWARFDebugLocDWO::parseOneLocationList(Data, &Offset);
+      if (LL)
+        LL->dump(OS, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, Indent);
+      else
+        OS << "error extracting location list.";
+    }
+  }
+}
+
 static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
                           uint32_t *OffsetPtr, dwarf::Attribute Attr,
                           dwarf::Form Form, unsigned Indent,
@@ -129,6 +171,9 @@ static void dumpAttribute(raw_ostream &O
     WithColor(OS, Color) << Name;
   else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line)
     OS << *formValue.getAsUnsignedConstant();
+  else if (Attr == DW_AT_location || Attr == DW_AT_frame_base ||
+           Attr == DW_AT_data_member_location)
+    dumpLocation(OS, formValue, U, sizeof(BaseIndent) + Indent + 4);
   else
     formValue.dump(OS, DumpOpts);
 

Added: llvm/trunk/lib/DebugInfo/DWARF/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFExpression.cpp?rev=312042&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFExpression.cpp (added)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFExpression.cpp Tue Aug 29 14:41:21 2017
@@ -0,0 +1,272 @@
+//===-- DWARFExpression.cpp -----------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
+#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
+#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/Support/Format.h"
+#include <cassert>
+#include <cstdint>
+#include <vector>
+
+using namespace llvm;
+using namespace dwarf;
+
+namespace llvm {
+
+typedef std::vector<DWARFExpression::Operation::Description> DescVector;
+
+static DescVector getDescriptions() {
+  DescVector Descriptions;
+  typedef DWARFExpression::Operation Op;
+  typedef Op::Description Desc;
+
+  Descriptions.resize(0xff);
+  Descriptions[DW_OP_addr] = Desc(Op::Dwarf2, Op::SizeAddr);
+  Descriptions[DW_OP_deref] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_const1u] = Desc(Op::Dwarf2, Op::Size1);
+  Descriptions[DW_OP_const1s] = Desc(Op::Dwarf2, Op::SignedSize1);
+  Descriptions[DW_OP_const2u] = Desc(Op::Dwarf2, Op::Size2);
+  Descriptions[DW_OP_const2s] = Desc(Op::Dwarf2, Op::SignedSize2);
+  Descriptions[DW_OP_const4u] = Desc(Op::Dwarf2, Op::Size4);
+  Descriptions[DW_OP_const4s] = Desc(Op::Dwarf2, Op::SignedSize4);
+  Descriptions[DW_OP_const8u] = Desc(Op::Dwarf2, Op::Size8);
+  Descriptions[DW_OP_const8s] = Desc(Op::Dwarf2, Op::SignedSize8);
+  Descriptions[DW_OP_constu] = Desc(Op::Dwarf2, Op::SizeLEB);
+  Descriptions[DW_OP_consts] = Desc(Op::Dwarf2, Op::SignedSizeLEB);
+  Descriptions[DW_OP_dup] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_drop] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_over] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_pick] = Desc(Op::Dwarf2, Op::Size1);
+  Descriptions[DW_OP_swap] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_rot] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_xderef] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_abs] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_and] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_div] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_minus] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_mod] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_mul] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_neg] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_not] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_or] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_plus] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_plus_uconst] = Desc(Op::Dwarf2, Op::SizeLEB);
+  Descriptions[DW_OP_shl] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_shr] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_shra] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_xor] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_skip] = Desc(Op::Dwarf2, Op::SignedSize2);
+  Descriptions[DW_OP_bra] = Desc(Op::Dwarf2, Op::SignedSize2);
+  Descriptions[DW_OP_eq] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_ge] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_gt] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_le] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_lt] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_ne] = Desc(Op::Dwarf2);
+  for (uint16_t LA = DW_OP_lit0; LA <= DW_OP_lit31; ++LA)
+    Descriptions[LA] = Desc(Op::Dwarf2);
+  for (uint16_t LA = DW_OP_reg0; LA <= DW_OP_reg31; ++LA)
+    Descriptions[LA] = Desc(Op::Dwarf2);
+  for (uint16_t LA = DW_OP_breg0; LA <= DW_OP_breg31; ++LA)
+    Descriptions[LA] = Desc(Op::Dwarf2, Op::SignedSizeLEB);
+  Descriptions[DW_OP_regx] = Desc(Op::Dwarf2, Op::SizeLEB);
+  Descriptions[DW_OP_fbreg] = Desc(Op::Dwarf2, Op::SignedSizeLEB);
+  Descriptions[DW_OP_bregx] = Desc(Op::Dwarf2, Op::SizeLEB, Op::SignedSizeLEB);
+  Descriptions[DW_OP_piece] = Desc(Op::Dwarf2, Op::SizeLEB);
+  Descriptions[DW_OP_deref_size] = Desc(Op::Dwarf2, Op::Size1);
+  Descriptions[DW_OP_xderef_size] = Desc(Op::Dwarf2, Op::Size1);
+  Descriptions[DW_OP_nop] = Desc(Op::Dwarf2);
+  Descriptions[DW_OP_push_object_address] = Desc(Op::Dwarf3);
+  Descriptions[DW_OP_call2] = Desc(Op::Dwarf3, Op::Size2);
+  Descriptions[DW_OP_call4] = Desc(Op::Dwarf3, Op::Size4);
+  Descriptions[DW_OP_call_ref] = Desc(Op::Dwarf3, Op::SizeRefAddr);
+  Descriptions[DW_OP_form_tls_address] = Desc(Op::Dwarf3);
+  Descriptions[DW_OP_call_frame_cfa] = Desc(Op::Dwarf3);
+  Descriptions[DW_OP_bit_piece] = Desc(Op::Dwarf3, Op::SizeLEB, Op::SizeLEB);
+  Descriptions[DW_OP_implicit_value] =
+      Desc(Op::Dwarf3, Op::SizeLEB, Op::SizeBlock);
+  Descriptions[DW_OP_stack_value] = Desc(Op::Dwarf3);
+  Descriptions[DW_OP_GNU_push_tls_address] = Desc(Op::Dwarf3);
+  Descriptions[DW_OP_GNU_addr_index] = Desc(Op::Dwarf4, Op::SizeLEB);
+  Descriptions[DW_OP_GNU_const_index] = Desc(Op::Dwarf4, Op::SizeLEB);
+  return Descriptions;
+}
+
+static DWARFExpression::Operation::Description getOpDesc(unsigned OpCode) {
+  // FIXME: Make this constexpr once all compilers are smart enough to do it.
+  static DescVector Descriptions = getDescriptions();
+  assert(OpCode < Descriptions.size());
+  return Descriptions[OpCode];
+}
+
+static uint8_t getRefAddrSize(uint8_t AddrSize, uint16_t Version) {
+  return (Version == 2) ? AddrSize : 4;
+}
+
+bool DWARFExpression::Operation::extract(DataExtractor Data, uint16_t Version,
+                                         uint8_t AddressSize, uint32_t Offset) {
+  Opcode = Data.getU8(&Offset);
+
+  Desc = getOpDesc(Opcode);
+  if (Desc.Version == Operation::DwarfNA)
+    return false;
+
+  for (unsigned Operand = 0; Operand < 2; ++Operand) {
+    unsigned Size = Desc.Op[Operand];
+    unsigned Signed = Size & Operation::SignBit;
+
+    if (Size == Operation::SizeNA)
+      break;
+
+    switch (Size & ~Operation::SignBit) {
+    case Operation::Size1:
+      Operands[Operand] = Data.getU8(&Offset);
+      if (Signed)
+        Operands[Operand] = (int8_t)Operands[Operand];
+      break;
+    case Operation::Size2:
+      Operands[Operand] = Data.getU16(&Offset);
+      if (Signed)
+        Operands[Operand] = (int16_t)Operands[Operand];
+      break;
+    case Operation::Size4:
+      Operands[Operand] = Data.getU32(&Offset);
+      if (Signed)
+        Operands[Operand] = (int32_t)Operands[Operand];
+      break;
+    case Operation::Size8:
+      Operands[Operand] = Data.getU64(&Offset);
+      break;
+    case Operation::SizeAddr:
+      if (AddressSize == 8) {
+        Operands[Operand] = Data.getU64(&Offset);
+      } else {
+        assert(AddressSize == 4);
+        Operands[Operand] = Data.getU32(&Offset);
+      }
+      break;
+    case Operation::SizeRefAddr:
+      if (getRefAddrSize(AddressSize, Version) == 8) {
+        Operands[Operand] = Data.getU64(&Offset);
+      } else {
+        assert(getRefAddrSize(AddressSize, Version) == 4);
+        Operands[Operand] = Data.getU32(&Offset);
+      }
+      break;
+    case Operation::SizeLEB:
+      if (Signed)
+        Operands[Operand] = Data.getSLEB128(&Offset);
+      else
+        Operands[Operand] = Data.getULEB128(&Offset);
+      break;
+    case Operation::SizeBlock:
+      // We need a size, so this cannot be the first operand
+      if (Operand == 0)
+        return false;
+      // Store the offset of the block as the value.
+      Operands[Operand] = Offset;
+      Offset += Operands[Operand - 1];
+      break;
+    default:
+      llvm_unreachable("Unknown DWARFExpression Op size");
+    }
+  }
+
+  EndOffset = Offset;
+  return true;
+}
+
+static bool prettyPrintRegisterOp(raw_ostream &OS, uint8_t Opcode,
+                                  uint64_t Operands[2],
+                                  const MCRegisterInfo *MRI, bool isEH) {
+  if (!MRI)
+    return false;
+
+  uint64_t DwarfRegNum;
+  unsigned OpNum = 0;
+
+  if (Opcode == DW_OP_bregx || Opcode == DW_OP_regx)
+    DwarfRegNum = Operands[OpNum++];
+  else if (Opcode >= DW_OP_breg0 && Opcode < DW_OP_bregx)
+    DwarfRegNum = Opcode - DW_OP_breg0;
+  else
+    DwarfRegNum = Opcode - DW_OP_reg0;
+
+  int LLVMRegNum = MRI->getLLVMRegNum(DwarfRegNum, isEH);
+  if (LLVMRegNum >= 0) {
+    if (const char *RegName = MRI->getName(LLVMRegNum)) {
+      if ((Opcode >= DW_OP_breg0 && Opcode <= DW_OP_breg31) ||
+          Opcode == DW_OP_bregx)
+        OS << format(" %s%+" PRId64, RegName, Operands[OpNum]);
+      else
+        OS << ' ' << RegName;
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool DWARFExpression::Operation::print(raw_ostream &OS,
+                                       const DWARFExpression *Expr,
+                                       const MCRegisterInfo *RegInfo,
+                                       bool isEH) {
+  if (Error) {
+    OS << "decoding error.";
+    return false;
+  }
+
+  StringRef Name = OperationEncodingString(Opcode);
+  assert(!Name.empty() && "DW_OP has no name!");
+  OS << Name;
+
+  if ((Opcode >= DW_OP_breg0 && Opcode <= DW_OP_breg31) ||
+      (Opcode >= DW_OP_reg0 && Opcode <= DW_OP_reg31) ||
+      Opcode == DW_OP_bregx || Opcode == DW_OP_regx)
+    if (prettyPrintRegisterOp(OS, Opcode, Operands, RegInfo, isEH))
+      return true;
+
+  for (unsigned Operand = 0; Operand < 2; ++Operand) {
+    unsigned Size = Desc.Op[Operand];
+    unsigned Signed = Size & Operation::SignBit;
+
+    if (Size == Operation::SizeNA)
+      break;
+
+    if (Size == Operation::SizeBlock) {
+      uint32_t Offset = Operands[Operand];
+      for (unsigned i = 0; i < Operands[Operand - 1]; ++i)
+        OS << format(" 0x%02x", Expr->Data.getU8(&Offset));
+    } else {
+      if (Signed)
+        OS << format(" %+" PRId64, (int64_t)Operands[Operand]);
+      else
+        OS << format(" 0x%" PRIx64, Operands[Operand]);
+    }
+  }
+  return true;
+}
+
+void DWARFExpression::print(raw_ostream &OS, const MCRegisterInfo *RegInfo) {
+  for (auto &Op : *this) {
+    if (!Op.print(OS, this, RegInfo, /* isEH */ false)) {
+      uint32_t FailOffset = Op.getEndOffset();
+      while (FailOffset < Data.getData().size())
+        OS << format(" %02x", Data.getU8(&FailOffset));
+      return;
+    }
+    if (Op.getEndOffset() < Data.getData().size())
+      OS << ", ";
+  }
+}
+
+} // namespace llvm

Modified: llvm/trunk/lib/DebugInfo/DWARF/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/LLVMBuild.txt?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/LLVMBuild.txt (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/LLVMBuild.txt Tue Aug 29 14:41:21 2017
@@ -19,4 +19,4 @@
 type = Library
 name = DebugInfoDWARF
 parent = DebugInfo
-required_libraries = BinaryFormat Object Support
+required_libraries = BinaryFormat Object MC Support

Modified: llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll Tue Aug 29 14:41:21 2017
@@ -9,24 +9,17 @@ target triple = "thumbv7-apple-darwin10"
 @x3 = internal global i8 1, align 1, !dbg !6
 @x4 = internal global i8 1, align 1, !dbg !8
 @x5 = global i8 1, align 1, !dbg !10
-; Check debug info output for merged global.
-; DW_AT_location
-; 0x03 DW_OP_addr
-; 0x.. .long __MergedGlobals
-; 0x10 DW_OP_constu
-; 0x.. offset
-; 0x22 DW_OP_plus
 
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x1"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x5> 03 [[ADDR:.. .. .. ..]]   )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (DW_OP_addr [[ADDR:0x[0-9a-fA-F]+]])
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x2"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x7> 03 [[ADDR]] 23 01  )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (DW_OP_addr [[ADDR]], DW_OP_plus_uconst 0x1)
 
 ; Function Attrs: nounwind optsize
 define zeroext i8 @get1(i8 zeroext %a) #0 !dbg !16 {

Modified: llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll Tue Aug 29 14:41:21 2017
@@ -1,23 +1,15 @@
 ; RUN: llc -arm-global-merge -global-merge-group-by-use=false -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
 
-; Check debug info output for merged global.
-; DW_AT_location
-; 0x03 DW_OP_addr
-; 0x.. .long __MergedGlobals
-; 0x10 DW_OP_constu
-; 0x.. offset
-; 0x22 DW_OP_plus
-
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x1"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x5> 03 [[ADDR:.. .. .. ..]]   )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (DW_OP_addr [[ADDR:0x[0-9a-fA-F]+]])
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x2"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x7> 03 [[ADDR]] 23 04  )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (DW_OP_addr [[ADDR]], DW_OP_plus_uconst 0x4)
 
 source_filename = "test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll"
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"

Modified: llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll Tue Aug 29 14:41:21 2017
@@ -5,17 +5,11 @@
 ; CHECK-NOT: DW_TAG_subprogram
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
-; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]	([[MYDATA_LOC:0x[0-9a-f]*]])
+; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
+; CHECK-NEXT:    0x{{.*}} - 0x{{.*}}: {{.*}} DW_OP_plus_uconst 0x4, DW_OP_deref, DW_OP_plus_uconst 0x18
+; CHECK-NEXT:    0x{{.*}} - 0x{{.*}}: {{.*}} DW_OP_plus_uconst 0x4, DW_OP_deref, DW_OP_plus_uconst 0x18
 ; CHECK-NEXT: DW_AT_name {{.*}} "mydata"
 
-; debug_loc content
-; CHECK: .debug_loc contents:
-; CHECK: [[MYDATA_LOC]]: Beginning address offset: {{.*}}
-; CHECK-NOT: {{0x[0-9a-f]*}}: Beginning address offset
-; CHECK: Location description: {{.*}} 23 04 06 23 18
-; CHECK-NOT: {{0x[0-9a-f]*}}: Beginning address offset
-; CHECK: Location description: {{.*}} 23 04 06 23 18
-
 ; Radar 9331779
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
 target triple = "thumbv7-apple-ios"

Modified: llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll Tue Aug 29 14:41:21 2017
@@ -5,12 +5,9 @@ target triple = "thumbv7-apple-macosx10.
 
 ; Just making sure the first part of the location isn't a repetition
 ; of the size of the location description.
-;
-; 0x90   DW_OP_regx of super-register
 
-; CHECK: 0x00000000: Beginning address offset:
-; CHECK-NEXT:           Ending address offset:
-; CHECK-NEXT:            Location description: 90 {{.. .. $}}
+; CHECK: 0x00000000:
+; CHECK-NEXT:        0x{{[0-9]*[a-f]*}} - 0x{{[0-9]*[a-f]*}}: DW_OP_regx D8
 
 define void @_Z3foov() optsize ssp !dbg !1 {
 entry:

Modified: llvm/trunk/test/CodeGen/X86/2010-01-18-DbgValue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-01-18-DbgValue.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2010-01-18-DbgValue.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2010-01-18-DbgValue.ll Tue Aug 29 14:41:21 2017
@@ -5,8 +5,7 @@
 ; CHECK-LABEL: DW_TAG_subprogram
 ; CHECK:   DW_AT_name [DW_FORM_strp]       ( {{.*}}"foo")
 ; CHECK:   DW_TAG_formal_parameter
-; CHECK-NEXT:     DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 {{..}} )
-;                                                             DW_OP_fbreg ??
+; CHECK-NEXT:     DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg {{[^ ]*}})
 ; CHECK-NEXT:     DW_AT_name [DW_FORM_strp]     ( {{.*}}"my_r0")
 
 %struct.Pt = type { double, double }

Modified: llvm/trunk/test/CodeGen/X86/2011-01-24-DbgValue-Before-Use.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-01-24-DbgValue-Before-Use.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2011-01-24-DbgValue-Before-Use.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2011-01-24-DbgValue-Before-Use.ll Tue Aug 29 14:41:21 2017
@@ -9,7 +9,8 @@ target triple = "x86_64-apple-darwin10.0
 ; CHECK: DW_TAG_variable
 ; CHECK: DW_TAG_variable
 ; CHECK-NEXT:   DW_AT_location
-; CHECK-NEXT:   DW_AT_name {{.*}} "z_s"
+; CHECK-NOT: DW_{{TAG|AT}}
+; CHECK:   DW_AT_name {{.*}} "z_s"
 ; CHECK-NEXT:   DW_AT_decl_file
 ; CHECK-NEXT:   DW_AT_decl_line
 ; CHECK-NEXT:   DW_AT_type{{.*}}{[[TYPE:.*]]}

Modified: llvm/trunk/test/CodeGen/X86/dbg-baseptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-baseptr.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dbg-baseptr.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dbg-baseptr.ll Tue Aug 29 14:41:21 2017
@@ -22,12 +22,10 @@ define i32 @f0(%struct.s* byval align 8
 ; DWARF-LABEL: .debug_info contents:
 
 ; DWARF-LABEL: DW_TAG_subprogram
-; DWARF:   DW_AT_frame_base [DW_FORM_exprloc]      (<0x1> 57 )
-;                                                       0x57 -> RSP
+; DWARF:   DW_AT_frame_base [DW_FORM_exprloc]      (DW_OP_reg7 RSP)
 ; DWARF:   DW_AT_name [DW_FORM_strp]       ( {{.*}}"f0")
 ; DWARF:   DW_TAG_formal_parameter
-; DWARF-NEXT:     DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 08 )
-;                                                        DW_OP_fbreg (0x91) 0x08
+; DWARF-NEXT:     DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg +8)
 ; DWARF-NEXT:     DW_AT_name [DW_FORM_strp]     ( {{.*}}"input")
 
 
@@ -48,12 +46,10 @@ define i32 @f1(%struct.s* byval align 8
 }
 
 ; DWARF-LABEL: DW_TAG_subprogram
-; DWARF:   DW_AT_frame_base [DW_FORM_exprloc]      (<0x1> 56 )
-;                                                       0x56 -> RBP
+; DWARF:   DW_AT_frame_base [DW_FORM_exprloc]      (DW_OP_reg6 RBP)
 ; DWARF:   DW_AT_name [DW_FORM_strp]       ( {{.*}}"f1")
 ; DWARF:   DW_TAG_formal_parameter
-; DWARF-NEXT:     DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 10 )
-;                                                        DW_OP_fbreg (0x91) 0x10
+; DWARF-NEXT:     DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg +16)
 ; DWARF-NEXT:     DW_AT_name [DW_FORM_strp]     ( {{.*}}"input")
 
 ; CHECK-LABEL: f2:
@@ -75,12 +71,10 @@ define i32 @f2(%struct.s* byval align 8
 
 ; "input" should still be referred to through RBP.
 ; DWARF-LABEL: DW_TAG_subprogram
-; DWARF:   DW_AT_frame_base [DW_FORM_exprloc]      (<0x1> 56 )
-;                                                       0x56 -> RBP
+; DWARF:   DW_AT_frame_base [DW_FORM_exprloc]      (DW_OP_reg6 RBP)
 ; DWARF:   DW_AT_name [DW_FORM_strp]       ( {{.*}}"f2")
 ; DWARF:   DW_TAG_formal_parameter
-; DWARF-NEXT:     DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 10 )
-;                                                        DW_OP_fbreg (0x91) 0x10
+; DWARF-NEXT:     DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg +16)
 ; DWARF-NEXT:     DW_AT_name [DW_FORM_strp]     ( {{.*}}"input")
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata)

Modified: llvm/trunk/test/DebugInfo/AArch64/asan-stack-vars.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/asan-stack-vars.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/AArch64/asan-stack-vars.ll (original)
+++ llvm/trunk/test/DebugInfo/AArch64/asan-stack-vars.ll Tue Aug 29 14:41:21 2017
@@ -27,13 +27,11 @@
 ; CHECK-NEXT:   DW_AT_high_pc [DW_FORM_addr]    ([[FN_END:.*]])
 ; CHECK: "_cmd"
 ; CHECK: DW_TAG_formal_parameter
-; CHECK-NEXT: DW_AT_location {{.*}} ([[OFS:.*]])
+; CHECK-NEXT: DW_AT_location
+; CHECK-NEXT:   0x{{0*}} - 0x{{.*}}:
+; CHECK-NOT:    DW_AT_
+; CHECK:        0x{{.*}} - [[FN_END]]:
 ; CHECK-NEXT: DW_AT_name {{.*}}"imageSize"
-;
-; CHECK: .debug_loc contents:
-; CHECK: [[OFS]]: Beginning address offset: 0x0000000000000000
-; CHECK_NOT: 0x{{.*}}: Beginning
-; CHECK:          Ending address offset: [[FN_END]]
 
 ; ModuleID = 'm.m'
 source_filename = "m.m"

Modified: llvm/trunk/test/DebugInfo/AArch64/bitfields.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/bitfields.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/AArch64/bitfields.ll (original)
+++ llvm/trunk/test/DebugInfo/AArch64/bitfields.ll Tue Aug 29 14:41:21 2017
@@ -19,12 +19,12 @@
 ; CHECK:      DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK-NEXT: DW_AT_bit_size   {{.*}} (0x02)
 ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00)
-; CHECK-NEXT: DW_AT_data_member_location {{.*}} 00
+; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 
 ; CHECK: DW_TAG_member
 ; CHECK-NEXT: DW_AT_name{{.*}}"b"
 ; CHECK-NOT: DW_TAG_member
-; CHECK:      DW_AT_data_member_location {{.*}} 04
+; CHECK:      DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
 
 ; CHECK: DW_TAG_member
 ; CHECK-NEXT: DW_AT_name{{.*}}"c"
@@ -32,7 +32,7 @@
 ; CHECK:      DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK-NEXT: DW_AT_bit_size   {{.*}} (0x01)
 ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00)
-; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08
+; CHECK:      DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
 
 ; CHECK: DW_TAG_member
 ; CHECK-NEXT: DW_AT_name{{.*}}"d"
@@ -40,7 +40,7 @@
 ; CHECK:      DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK-NEXT: DW_AT_bit_size   {{.*}} (0x1c)
 ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x01)
-; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08
+; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
 
 ; ModuleID = 'bitfields.c'
 source_filename = "test/DebugInfo/AArch64/bitfields.ll"

Modified: llvm/trunk/test/DebugInfo/AArch64/coalescing.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/coalescing.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/AArch64/coalescing.ll (original)
+++ llvm/trunk/test/DebugInfo/AArch64/coalescing.ll Tue Aug 29 14:41:21 2017
@@ -23,10 +23,8 @@ entry:
   ; CHECK: .debug_info contents:
   ; CHECK: DW_TAG_variable
   ; CHECK-NEXT: DW_AT_location
+  ; CHECK-NEXT: DW_OP_breg31 WSP+12, DW_OP_deref
   ; CHECK-NEXT: DW_AT_name {{.*}}"size"
-  ; CHECK: .debug_loc contents:
-  ; Expecting the encoding for sp+12: DW_OP_breg31 0c
-  ; CHECK: Location description: 8f 0c
   ret void, !dbg !18
 }
 

Modified: llvm/trunk/test/DebugInfo/AArch64/frameindices.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/frameindices.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/AArch64/frameindices.ll (original)
+++ llvm/trunk/test/DebugInfo/AArch64/frameindices.ll Tue Aug 29 14:41:21 2017
@@ -5,8 +5,7 @@
 ; CHECK: DW_TAG_inlined_subroutine
 ; CHECK:    "_Z3f111A"
 ; CHECK: DW_TAG_formal_parameter
-; CHECK: DW_AT_location [DW_FORM_block1]    (<0x0c> 93 01 91 51 93 0f 93 01 91 4a 93 07 )
-;  -- piece 0x00000001, fbreg -47, piece 0x0000000f, piece 0x00000001, fbreg -54, piece 0x00000007 ------^
+; CHECK: DW_AT_location [DW_FORM_block1]    (DW_OP_piece 0x1, DW_OP_fbreg -47, DW_OP_piece 0xf, DW_OP_piece 0x1, DW_OP_fbreg -54, DW_OP_piece 0x7)
 ; CHECK: DW_AT_abstract_origin {{.*}} "p1"
 ;
 ; long a;

Modified: llvm/trunk/test/DebugInfo/AMDGPU/variable-locations.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AMDGPU/variable-locations.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/AMDGPU/variable-locations.ll (original)
+++ llvm/trunk/test/DebugInfo/AMDGPU/variable-locations.ll Tue Aug 29 14:41:21 2017
@@ -19,7 +19,7 @@ declare void @llvm.dbg.declare(metadata,
 ; CHECK-NEXT: DW_AT_external
 ; CHECK-NEXT: DW_AT_decl_file
 ; CHECK-NEXT: DW_AT_decl_line
-; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x09> 03 00 00 00 00 00 00 00 00 )
+; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x0)
 @GlobA = common addrspace(1) global i32 0, align 4, !dbg !0
 
 ; CHECK: {{.*}}DW_TAG_variable
@@ -28,20 +28,20 @@ declare void @llvm.dbg.declare(metadata,
 ; CHECK-NEXT: DW_AT_external
 ; CHECK-NEXT: DW_AT_decl_file
 ; CHECK-NEXT: DW_AT_decl_line
-; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x09> 03 00 00 00 00 00 00 00 00 )
+; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x0)
 @GlobB = common addrspace(1) global i32 0, align 4, !dbg !6
 
 define amdgpu_kernel void @kernel1(
 ; CHECK: {{.*}}DW_TAG_formal_parameter
-; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x06> 91 04 10 01 16 18 )
+; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +4, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef)
 ; CHECK-NEXT: DW_AT_name {{.*}}"ArgN"
     i32 %ArgN,
 ; CHECK: {{.*}}DW_TAG_formal_parameter
-; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x06> 91 08 10 01 16 18 )
+; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +8, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef)
 ; CHECK-NEXT: DW_AT_name {{.*}}"ArgA"
     i32 addrspace(1)* %ArgA,
 ; CHECK: {{.*}}DW_TAG_formal_parameter
-; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x06> 91 10 10 01 16 18 )
+; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +16, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef)
 ; CHECK-NEXT: DW_AT_name {{.*}}"ArgB"
     i32 addrspace(1)* %ArgB) !dbg !13 {
 entry:

Modified: llvm/trunk/test/DebugInfo/ARM/PR16736.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/PR16736.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/ARM/PR16736.ll (original)
+++ llvm/trunk/test/DebugInfo/ARM/PR16736.ll Tue Aug 29 14:41:21 2017
@@ -1,10 +1,23 @@
 ; RUN: llc -filetype=asm < %s | FileCheck %s
 ; RUN: llc -filetype=obj < %s \
-; RUN:   | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
+; RUN:   | llvm-dwarfdump -debug-dump=info - | FileCheck %s --check-prefix=DWARF
 ;
 ; CHECK: @DEBUG_VALUE: h:x <- [DW_OP_plus_uconst {{.*}}] [%R{{.*}}+0]
-; DWARF: Location description: {{7[0-9] [0-9]+ $}}
-;                              DW_OP_breg. +..
+; DWARF: DW_TAG_formal_parameter
+; DWARF:       DW_AT_location
+; DWARF-NEXT:    DW_OP_reg0 R0
+; DWARF: DW_TAG_formal_parameter
+; DWARF:       DW_AT_location
+; DWARF-NEXT:    DW_OP_reg1 R1
+; DWARF: DW_TAG_formal_parameter
+; DWARF:       DW_AT_location
+; DWARF-NEXT:    DW_OP_reg2 R2
+; DWARF: DW_TAG_formal_parameter
+; DWARF:       DW_AT_location
+; DWARF-NEXT:    DW_OP_reg3 R3
+; DWARF: DW_TAG_formal_parameter
+; DWARF: DW_AT_location
+; DWARF-NEXT: DW_OP_breg7 R7+8
 ; generated from:
 ; clang -cc1 -triple  thumbv7 -S -O1 arm.cpp  -g
 ;

Modified: llvm/trunk/test/DebugInfo/ARM/PR26163.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/PR26163.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/ARM/PR26163.ll (original)
+++ llvm/trunk/test/DebugInfo/ARM/PR26163.ll Tue Aug 29 14:41:21 2017
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
 ;
 ; Checks that we're creating two ranges, one that terminates immediately
 ; and one that spans the rest of the function. This isn't necessarily the
@@ -6,13 +6,11 @@
 ; one has a bit_piece), but it is what is currently being emitted, any
 ; change here needs to be intentional, so the test is very specific.
 ;
-; CHECK: .debug_loc contents:
-; CHECK: 0x00000000: Beginning address offset: 0x0000000000000004
-; CHECK:                Ending address offset: 0x0000000000000004
-; CHECK:                 Location description: 10 00 9f
-; CHECK:             Beginning address offset: 0x0000000000000004
-; CHECK:                Ending address offset: 0x0000000000000014
-; CHECK:                 Location description: 10 00 9f
+; CHECK: DW_TAG_inlined_subroutine
+; CHECK: DW_TAG_variable
+; CHECK:   DW_AT_location [DW_FORM_sec_offset] ({{.*}}
+; CHECK:      0x0000000000000004 - 0x0000000000000004: DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x8
+; CHECK:      0x0000000000000004 - 0x0000000000000014: DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
 
 ; Created form the following test case (PR26163) with
 ; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c

Modified: llvm/trunk/test/DebugInfo/ARM/bitfield.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/bitfield.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/ARM/bitfield.ll (original)
+++ llvm/trunk/test/DebugInfo/ARM/bitfield.ll Tue Aug 29 14:41:21 2017
@@ -14,7 +14,7 @@
 ; CHECK:          DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK:          DW_AT_bit_size   {{.*}} (0x1c)
 ; CHECK:          DW_AT_bit_offset {{.*}} (0xfffffffffffffff8)
-; CHECK:          DW_AT_data_member_location {{.*}}00
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 source_filename = "test/DebugInfo/ARM/bitfield.ll"
 target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
 target triple = "thumbv7-apple-ios"

Modified: llvm/trunk/test/DebugInfo/ARM/partial-subreg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/partial-subreg.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/ARM/partial-subreg.ll (original)
+++ llvm/trunk/test/DebugInfo/ARM/partial-subreg.ll Tue Aug 29 14:41:21 2017
@@ -8,12 +8,9 @@
 ; CHECK: DW_TAG_subprogram
 ; CHECK:   DW_AT_name {{.*}}"subscript.get"
 ; CHECK:  DW_TAG_formal_parameter
-; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]	(0x00000000)
-; CHECK: .debug_loc
-; CHECK: 0x00000000: Beginning address offset
-; CHECK-NEXT:           Ending address offset
-; CHECK-NEXT:            Location description: 90 90 02 93 08 90 91 02 93 04
-;                        d16, piece 0x00000008, d17, piece 0x00000004
+; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]	({{.*}}
+; CHECK-NEXT:  0x{{.*}} - 0x{{.*}}: DW_OP_regx D16, DW_OP_piece 0x8, DW_OP_regx D17, DW_OP_piece 0x4, DW_OP_regx D16, DW_OP_piece 0x8, DW_OP_regx D17, DW_OP_piece 0x4
+
 source_filename = "simd.ll"
 target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
 target triple = "armv7-apple-ios7.0"

Modified: llvm/trunk/test/DebugInfo/ARM/s-super-register.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/s-super-register.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/ARM/s-super-register.ll (original)
+++ llvm/trunk/test/DebugInfo/ARM/s-super-register.ll Tue Aug 29 14:41:21 2017
@@ -4,8 +4,7 @@ target triple = "thumbv7-apple-macosx10.
 
 ; The S registers on ARM are expressed as pieces of their super-registers in DWARF.
 ;
-; 0x90   DW_OP_regx of super-register
-; CHECK:            Location description: 90
+; CHECK: DW_OP_regx
 
 define void @_Z3foov() optsize ssp !dbg !1 {
 entry:

Modified: llvm/trunk/test/DebugInfo/ARM/split-complex.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/split-complex.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/ARM/split-complex.ll (original)
+++ llvm/trunk/test/DebugInfo/ARM/split-complex.ll Tue Aug 29 14:41:21 2017
@@ -14,8 +14,7 @@ entry:
   ; The target has no native double type.
   ; SROA split the complex value into two i64 values.
   ; CHECK: DW_TAG_formal_parameter
-  ; CHECK-NEXT:  DW_AT_location [DW_FORM_block1]	(<0x04> 10 00 93 08 )
-  ;              DW_AT_location       ( constu 0x00000000, piece 0x00000008 )
+  ; CHECK-NEXT:  DW_AT_location [DW_FORM_block1]	(DW_OP_constu 0x0, DW_OP_piece 0x8)
   ; CHECK-NEXT:  DW_AT_name {{.*}} "c"
   tail call void @llvm.dbg.value(metadata i64 0, metadata !14, metadata !17), !dbg !16
   ; Manually removed to disable location list emission:

Modified: llvm/trunk/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll Tue Aug 29 14:41:21 2017
@@ -23,8 +23,11 @@
 ;   return c;
 ; }
 
-; DWARF23: Location description: 10 0d {{$}}
-; DWARF4: Location description: 10 0d 9f
+; CHECK: DW_TAG_variable
+; CHECK: DW_AT_location
+; CHECK-NOT: DW_AT
+; DWARF23: DW_OP_constu 0xd{{$}}
+; DWARF4: DW_OP_constu 0xd, DW_OP_stack_value{{$}}
 
 ; Function Attrs: uwtable
 define i32 @main() #0 !dbg !4 {

Modified: llvm/trunk/test/DebugInfo/MIR/AArch64/clobber-sp.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/MIR/AArch64/clobber-sp.mir?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/MIR/AArch64/clobber-sp.mir (original)
+++ llvm/trunk/test/DebugInfo/MIR/AArch64/clobber-sp.mir Tue Aug 29 14:41:21 2017
@@ -3,20 +3,11 @@
 # CHECK: .debug_info contents:
 # CHECK: DW_TAG_formal_parameter
 # CHECK: DW_TAG_formal_parameter
-# CHECK-NEXT: DW_AT_location [DW_FORM_data4]	([[LOC:.*]])
+# CHECK-NEXT: DW_AT_location
+# CHECK-NEXT:   0x0000000000000000 - 0x0000000000000014: DW_OP_reg1 W1
+# CHECK-NEXT:   0x0000000000000014 - 0x0000000000000038: DW_OP_breg31 WSP+8
 # CHECK-NEXT: DW_AT_name {{.*}}"y"
-# CHECK: .debug_loc contents:
-# CHECK: [[LOC]]:
-# CHECK-SAME:        Beginning address offset: 0x0000000000000000
-# CHECK-NEXT:		Ending address offset: 0x0000000000000014
-# CHECK-NEXT:		 Location description: 51
-#                                              reg1
-#
-# The range of y's [SP+8] location must not be interrupted by the call to h.
-# CHECK:	     Beginning address offset: 0x0000000000000014
-# CHECK-NEXT:		Ending address offset: 0x0000000000000038
-# CHECK-NEXT:   	 Location description: 8f 08
-#                                              breg31 +8
+
 --- |
   ; Generated at -Os from:
   ;   struct Rect {

Modified: llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg-piece.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg-piece.mir?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg-piece.mir (original)
+++ llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg-piece.mir Tue Aug 29 14:41:21 2017
@@ -1,14 +1,11 @@
 # RUN: llc -start-before=livedebugvalues -filetype=obj -o - %s | \
-# RUN:     llvm-dwarfdump - | FileCheck %s
+# RUN:     llvm-dwarfdump -debug-dump=info - | FileCheck %s
 # CHECK: .debug_info contents:
 # CHECK: DW_TAG_variable
-# CHECK-NEXT: DW_AT_location [DW_FORM_data4]	([[OFS:.*]])
+# CHECK-NEXT: DW_AT_location
+# CHECK-NEXT: 0x0000000000000010 - 0x0000000000000018: DW_OP_piece 0x10, DW_OP_regx D0, DW_OP_piece 0x8, DW_OP_regx D1, DW_OP_piece 0x8)
 # CHECK-NEXT: DW_AT_name {{.*}}"vec"
-# CHECK: .debug_loc contents:
-# CHECK: [[OFS]]: Beginning address offset: 0x0000000000000010
-# CHECK:             Ending address offset: 0x0000000000000018
-# CHECK:              Location description: 93 10 90 80 02 93 08 90 81 02 93 08 
-#                  piece 0x00000010, d0, piece 0x00000008, d1, piece 0x00000008
+
 --- |
   ; Generate from (and then manually modified to incorporate a DW_OP_LLVM_fragment):
   ; typedef float vec2 __attribute__((vector_size(16)));

Modified: llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg.mir?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg.mir (original)
+++ llvm/trunk/test/DebugInfo/MIR/ARM/split-superreg.mir Tue Aug 29 14:41:21 2017
@@ -2,13 +2,10 @@
 # RUN:     llvm-dwarfdump - | FileCheck %s
 # CHECK: .debug_info contents:
 # CHECK: DW_TAG_variable
-# CHECK-NEXT: DW_AT_location [DW_FORM_data4]	([[OFS:.*]])
+# CHECK-NEXT: DW_AT_location
+# CHECK-NEXT: 0x0000000000000010 - 0x0000000000000018: DW_OP_regx D0, DW_OP_piece 0x8, DW_OP_regx D1, DW_OP_piece 0x8)
 # CHECK-NEXT: DW_AT_name {{.*}}"vec"
-# CHECK: .debug_loc contents:
-# CHECK: [[OFS]]: Beginning address offset: 0x0000000000000010
-# CHECK:             Ending address offset: 0x0000000000000018
-# CHECK:              Location description: 90 80 02 93 08 90 81 02 93 08 
-#                                           d0, piece 0x00000008, d1, piece 0x00000008
+
 --- |
   ; Generated from:
   ; typedef float vec2 __attribute__((vector_size(16)));

Modified: llvm/trunk/test/DebugInfo/MIR/X86/bit-piece-dh.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/MIR/X86/bit-piece-dh.mir?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/MIR/X86/bit-piece-dh.mir (original)
+++ llvm/trunk/test/DebugInfo/MIR/X86/bit-piece-dh.mir Tue Aug 29 14:41:21 2017
@@ -1,8 +1,7 @@
 # RUN: llc -filetype=obj -o - %s | llvm-dwarfdump --debug-dump=info - | FileCheck %s
 # CHECK: .debug_info contents:
 # CHECK: DW_TAG_variable
-#                                           rdx, bit-piece 8 8
-# CHECK-NEXT: DW_AT_location {{.*}}         51 9d 08 08
+# CHECK-NEXT: DW_AT_location {{.*}}         (DW_OP_reg1 RDX, DW_OP_bit_piece 0x8 0x8)
 # CHECK-NEXT: DW_AT_name {{.*}}"dh"
 --- |
   ; Manually created after:

Modified: llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll (original)
+++ llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll Tue Aug 29 14:41:21 2017
@@ -1,7 +1,5 @@
 ; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj -relocation-model=pic <%s | \
-; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F0
-; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj -relocation-model=pic <%s | \
-; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F1
+; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s
 
 ; void foo(int *);
 ;
@@ -22,15 +20,12 @@ declare void @llvm.lifetime.end(i64, i8*
 
 declare void @foo(i32*)
 
-; F0: DW_AT_name {{.*}}"e"
-; F0: DW_TAG_variable
-; F0-NEXT: DW_AT_location [DW_FORM_sec_offset]   ([[LOC:.*]])
-; F0-NEXT: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000006b] = "x")
-;
-; x -> DW_OP_reg1(51)
-; F0: [[LOC]]: Beginning address offset: 0x0000000000000028
-; F0:             Ending address offset: 0x000000000000002c
-; F0:              Location description: 51
+; CHECK: DW_AT_name {{.*}}"e"
+; CHECK: DW_TAG_variable
+; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (
+; CHECK-NEXT:   0x0000000000000028 - 0x000000000000002c: DW_OP_reg1 AT_64
+; CHECK-NEXT:   0x000000000000002c - 0x0000000000000048: DW_OP_breg29 SP_64+16, DW_OP_deref)
+; CHECK-NEXT: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000006b] = "x")
 
 define i32 @f0(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !4 {
 entry:
@@ -57,16 +52,11 @@ entry:
 }
 
 
-; F1: DW_AT_name {{.*}}"x"
-; F1: DW_AT_name {{.*}}"e"
-; F1: DW_TAG_variable
-; F1-NEXT: DW_AT_location [DW_FORM_sec_offset]   ([[LOC:.*]])
-; F1-NEXT: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000006b] = "x")
-
-; x -> DW_OP_reg1(51)
-; F1: [[LOC]]: Beginning address offset: 0x0000000000000080
-; F1:             Ending address offset: 0x0000000000000084
-; F1:              Location description: 51
+; CHECK: DW_TAG_variable
+; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]  (
+; CHECK-NEXT:   0x0000000000000080 - 0x0000000000000084: DW_OP_reg1 AT_64
+; CHECK-NEXT:   0x0000000000000084 - 0x0000000000000098: DW_OP_breg29 SP_64+16, DW_OP_deref)
+; CHECK-NEXT: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000006b] = "x")
 
 define i32 @f1(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !15 {
 entry:

Modified: llvm/trunk/test/DebugInfo/Mips/dsr-non-fixed-objects.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Mips/dsr-non-fixed-objects.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Mips/dsr-non-fixed-objects.ll (original)
+++ llvm/trunk/test/DebugInfo/Mips/dsr-non-fixed-objects.ll Tue Aug 29 14:41:21 2017
@@ -1,7 +1,5 @@
 ; RUN: llc -march=mips -mcpu=mips32r2 -O0 -filetype=obj -fast-isel=0 <%s | \
-; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F2
-; RUN: llc -march=mips -mcpu=mips32r2 -O0 -filetype=obj -fast-isel=0 <%s | \
-; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F3
+; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata)
 
@@ -22,9 +20,9 @@ declare void @foo(i32*)
 ;   return w;
 ; }
 
-; c -> DW_OP_breg29(r29): 16
-; F2: DW_AT_location [DW_FORM_exprloc]      (<0x2> 8d 10 )
-; F2: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000065] = "c")
+; CHECK: DW_TAG_subprogram
+; CHECK: DW_AT_location [DW_FORM_exprloc]      (DW_OP_breg29 SP_64+36)
+; CHECK: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000065] = "c")
 
 ; Function Attrs: nounwind
 define i32 @f2(i32 signext %a, i32 signext %b) !dbg !4 {
@@ -46,9 +44,9 @@ entry:
   ret i32 %2, !dbg !27
 }
 
-; c -> DW_OP_breg23(r23): 16
-; F3: DW_AT_location [DW_FORM_exprloc]      (<0x2> 87 10 )
-; F3: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000065] = "c")
+; CHECK: DW_TAG_subprogram
+; CHECK: DW_AT_location [DW_FORM_exprloc]      (DW_OP_breg23 S7_64+32)
+; CHECK: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000065] = "c")
 
 define i32* @f3(i32 signext %a, i32 signext %b) !dbg !8 {
 entry:

Modified: llvm/trunk/test/DebugInfo/Sparc/subreg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Sparc/subreg.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Sparc/subreg.ll (original)
+++ llvm/trunk/test/DebugInfo/Sparc/subreg.ll Tue Aug 29 14:41:21 2017
@@ -1,7 +1,6 @@
-; RUN: llc -filetype=obj -O0 < %s -mtriple sparc64-unknown-linux-gnu | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -filetype=obj -O0 < %s -mtriple sparc64-unknown-linux-gnu | llvm-dwarfdump - -debug-dump=loc | FileCheck %s
 ; The undescribable 128-bit register should be split into two 64-bit registers.
-; CHECK: Location description: 90 48 93 08 90 49 93 08
-;                              DW_OP_reg74 DW_OP_piece 8 DW_OP_reg75 DW_OP_piece 8 ...
+; CHECK: {{.*}} - {{.*}}: DW_OP_regx D0, DW_OP_piece 0x8, DW_OP_regx D1, DW_OP_piece 0x8
 
 target datalayout = "E-m:e-i64:64-n32:64-S128"
 target triple = "sparc64"

Modified: llvm/trunk/test/DebugInfo/SystemZ/variable-loc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/SystemZ/variable-loc.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/SystemZ/variable-loc.ll (original)
+++ llvm/trunk/test/DebugInfo/SystemZ/variable-loc.ll Tue Aug 29 14:41:21 2017
@@ -14,9 +14,8 @@
 ; CHECK: brasl   %r14, populate_array at PLT
 
 ; DEBUG: DW_TAG_variable
-; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xa401 is SLEB128 encoded 164.
 ; DEBUG-NOT: DW_TAG
-; DEBUG: DW_AT_location {{.*}}(<0x3> 91 a4 01 )
+; DEBUG: DW_AT_location {{.*}}(DW_OP_fbreg +164)
 ; DEBUG-NOT: DW_TAG
 ; DEBUG: DW_AT_name {{.*}} "main_arr"
 

Modified: llvm/trunk/test/DebugInfo/X86/DW_AT_location-reference.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/DW_AT_location-reference.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/DW_AT_location-reference.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/DW_AT_location-reference.ll Tue Aug 29 14:41:21 2017
@@ -31,22 +31,18 @@
 ; // The 'x' variable and its symbol reference location
 ; CHECK: .debug_info contents:
 ; CHECK:      DW_TAG_variable
-; CHECK-NEXT:   DW_AT_location [DW_FORM_sec_offset] (0x00000000)
+; CHECK-NEXT:   DW_AT_location [DW_FORM_sec_offset] (0x00000000
+; Check that the location contains only 4 ranges - this verifies that the 4th
+; and 5th ranges were successfully merged into a single range.
+; CHECK-NEXT:   0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}:
+; CHECK-NEXT:   0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}:
+; CHECK-NEXT:   0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}:
+; CHECK-NEXT:   0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}: {{.*}})
 ; CHECK-NEXT:   DW_AT_name {{.*}} "x"
 ; CHECK-NEXT:   DW_AT_decl_file
 ; CHECK-NEXT:   DW_AT_decl_line
 ; CHECK-NEXT:   DW_AT_type
 
-; Check that the location contains only 4 ranges - this verifies that the 4th
-; and 5th ranges were successfully merged into a single range.
-; CHECK: .debug_loc contents:
-; CHECK: 0x00000000:
-; CHECK: Beginning address offset:
-; CHECK: Beginning address offset:
-; CHECK: Beginning address offset:
-; CHECK: Beginning address offset:
-; CHECK-NOT: Beginning address offset:
-
 ; Check that we have no relocations in Darwin's output.
 ; DARWIN-NOT: X86_64_RELOC{{.*}} __debug_loc
 

Modified: llvm/trunk/test/DebugInfo/X86/FrameIndexExprs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/FrameIndexExprs.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/FrameIndexExprs.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/FrameIndexExprs.ll Tue Aug 29 14:41:21 2017
@@ -3,8 +3,7 @@
 ; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
 ; CHECK: DW_TAG_formal_parameter
 ; CHECK: DW_TAG_formal_parameter
-; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]  (<0xa> 91 78 93 03 93 06 91 7d 93 03 )
-;           fbreg -8, piece 0x00000003, piece 0x00000006, fbreg -3, piece 0x00000003 
+; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg -8, DW_OP_piece 0x3, DW_OP_piece 0x6, DW_OP_fbreg -3, DW_OP_piece 0x3)
 ; CHECK-NEXT: DW_AT_abstract_origin {{.*}}"p"
 source_filename = "bugpoint-reduced-simplified.ll"
 target triple = "x86_64-apple-darwin"

Modified: llvm/trunk/test/DebugInfo/X86/PR26148.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/PR26148.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/PR26148.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/PR26148.ll Tue Aug 29 14:41:21 2017
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - -debug-dump=loc | FileCheck %s
 ;
 ; Created using clang -g -O3 from:
 ; struct S0 {
@@ -19,14 +19,8 @@
 ; AS in 26163, we expect two ranges (as opposed to one), the first one being zero sized
 ;
 ;
-; CHECK:             Beginning address offset: 0x0000000000000004
-; CHECK:                Ending address offset: 0x0000000000000004
-; CHECK:                 Location description: 10 03 93 04 55 93 02
-; constu 0x00000003, piece 0x00000004, rdi, piece 0x00000002
-; CHECK:             Beginning address offset: 0x0000000000000004
-; CHECK:                Ending address offset: 0x0000000000000014
-; CHECK:                 Location description: 10 03 93 04 10 00
-; constu 0x00000003, piece 0x00000004, constu 0x00000000, piece 0x00000004
+; CHECK: 0x0000000000000004 - 0x0000000000000004: DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_reg5 RDI, DW_OP_piece 0x2
+; CHECK: 0x0000000000000004 - 0x0000000000000014: DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_piece 0x4
 
 source_filename = "test/DebugInfo/X86/PR26148.ll"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Modified: llvm/trunk/test/DebugInfo/X86/array.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/array.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/array.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/array.ll Tue Aug 29 14:41:21 2017
@@ -21,8 +21,7 @@
 ; CHECK: callq _f
 
 ; DWARF: DW_TAG_variable
-; 	"<0x2> 91 00" means fbreg 0, i.e. offset RSP+0.
-; DWARF-NEXT:              DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 00 )
+; DWARF-NEXT:              DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg +0)
 ; DWARF-NEXT:              DW_AT_name [DW_FORM_strp]     ( {{.*}} = "array")
 
 ; ModuleID = '/tmp/array.c'

Modified: llvm/trunk/test/DebugInfo/X86/bitfields.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/bitfields.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/bitfields.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/bitfields.ll Tue Aug 29 14:41:21 2017
@@ -19,12 +19,12 @@
 ; CHECK:      DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK-NEXT: DW_AT_bit_size   {{.*}} (0x02)
 ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x1e)
-; CHECK-NEXT: DW_AT_data_member_location {{.*}} 00
+; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 
 ; CHECK: DW_TAG_member
 ; CHECK-NEXT: DW_AT_name{{.*}}"b"
 ; CHECK-NOT: DW_TAG_member
-; CHECK:      DW_AT_data_member_location {{.*}} 04
+; CHECK:      DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
 
 ; CHECK: DW_TAG_member
 ; CHECK-NEXT: DW_AT_name{{.*}}"c"
@@ -32,7 +32,7 @@
 ; CHECK:      DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK-NEXT: DW_AT_bit_size   {{.*}} (0x01)
 ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x1f)
-; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08
+; CHECK:      DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
 
 ; CHECK: DW_TAG_member
 ; CHECK-NEXT: DW_AT_name{{.*}}"d"
@@ -40,7 +40,7 @@
 ; CHECK:      DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK-NEXT: DW_AT_bit_size   {{.*}} (0x1c)
 ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x03)
-; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08
+; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
 
 ; ModuleID = 'bitfields.c'
 source_filename = "test/DebugInfo/X86/bitfields.ll"

Modified: llvm/trunk/test/DebugInfo/X86/block-capture.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/block-capture.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/block-capture.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/block-capture.ll Tue Aug 29 14:41:21 2017
@@ -4,8 +4,7 @@
 ; Checks that we emit debug info for the block variable declare.
 ; CHECK: DW_TAG_subprogram
 ; CHECK: DW_TAG_variable
-;                                              fbreg +8, deref, +32
-; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x05> 91 08 06 23 20 )
+; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +8, DW_OP_deref, DW_OP_plus_uconst 0x20)
 ; CHECK-NEXT: DW_AT_name {{.*}} "block"
 
 ; Extracted from the clang output for:

Modified: llvm/trunk/test/DebugInfo/X86/constant-loclist.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/constant-loclist.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/constant-loclist.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/constant-loclist.ll Tue Aug 29 14:41:21 2017
@@ -1,24 +1,22 @@
-; RUN: %llc_dwarf -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
+; RUN: %llc_dwarf -filetype=obj %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
 
 ; A hand-written testcase to check 64-bit constant handling in location lists.
 
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT: DW_AT_location [DW_FORM_data4]	(0x[[D:.*]])
+; CHECK-NEXT: DW_AT_location [DW_FORM_data4]	(
+; CHECK-NEXT:   0x{{.*}} - 0x{{.*}}: DW_OP_constu 0x4000000000000000)
 ; CHECK-NEXT: DW_AT_name {{.*}}"d"
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT: DW_AT_location [DW_FORM_data4]	(0x[[I:.*]])
+; CHECK-NEXT: DW_AT_location [DW_FORM_data4]	(
+; CHECK-NEXT:   0x{{.*}} - 0x{{.*}}: DW_OP_consts +0
+; CHECK-NEXT:   0x{{.*}} - 0x{{.*}}: DW_OP_consts +4611686018427387904)
 ; CHECK-NEXT: DW_AT_name {{.*}}"i"
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT: DW_AT_location [DW_FORM_data4]	(0x[[U:.*]])
+; CHECK-NEXT: DW_AT_location [DW_FORM_data4]	(
+; CHECK-NEXT:   0x{{.*}} - 0x{{.*}}: DW_OP_constu 0x0
+; CHECK-NEXT:   0x{{.*}} - 0x{{.*}}: DW_OP_constu 0x4000000000000000)
 ; CHECK-NEXT: DW_AT_name {{.*}}"u"
-; CHECK: .debug_loc contents:
-; CHECK: [[D]]:
-; CHECK: Location description: 10 80 80 80 80 80 80 80 80 40
-; CHECK: [[I]]:
-; CHECK: Location description: 11 80 80 80 80 80 80 80 80 c0 00
-; CHECK: [[U]]:
-; CHECK: Location description: 10 80 80 80 80 80 80 80 80 40 
 
 source_filename = "test.c"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Modified: llvm/trunk/test/DebugInfo/X86/data_member_location.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/data_member_location.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/data_member_location.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/data_member_location.ll Tue Aug 29 14:41:21 2017
@@ -20,11 +20,11 @@
 
 ; DWARF2: DW_AT_name {{.*}} "c"
 ; DWARF2-NOT: DW_TAG
-; DWARF2: DW_AT_data_member_location {{.*}} (<0x02> 23 00 )
+; DWARF2: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 
 ; DWARF2: DW_AT_name {{.*}} "i"
 ; DWARF2-NOT: DW_TAG
-; DWARF2: DW_AT_data_member_location {{.*}} (<0x02> 23 04 )
+; DWARF2: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
 
 source_filename = "test/DebugInfo/X86/data_member_location.ll"
 

Modified: llvm/trunk/test/DebugInfo/X86/dbg-declare-alloca.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-declare-alloca.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-declare-alloca.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-declare-alloca.ll Tue Aug 29 14:41:21 2017
@@ -8,9 +8,8 @@
 ; CHECK-LABEL: use_dbg_declare:
 ; CHECK-NOT: #DEBUG_VALUE
 
-; 	"<0x2> 91 00" means "fbreg uleb(0)", i.e. RSP+0.
 ; DWARF: DW_TAG_variable
-; DWARF-NEXT:              DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 00 )
+; DWARF-NEXT:              DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg +0)
 ; DWARF-NEXT:              DW_AT_name [DW_FORM_strp]     ( {{.*}} = "o")
 
 

Modified: llvm/trunk/test/DebugInfo/X86/dbg-declare-arg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-declare-arg.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-declare-arg.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-declare-arg.ll Tue Aug 29 14:41:21 2017
@@ -5,13 +5,9 @@ target triple = "x86_64-apple-macosx10.6
 ;
 ; CHECK: DW_AT_name {{.*}}"j"
 ; CHECK: DW_TAG_variable  
-; CHECK-NEXT:   DW_AT_location [DW_FORM_sec_offset] (0x00000000)
+; CHECK-NEXT:   DW_AT_location [DW_FORM_sec_offset] (
+; CHECK-NEXT:     0x{{.*}} - 0x{{.*}}: DW_OP_breg7 RSP+8)
 ; CHECK-NEXT:   DW_AT_name {{.*}}"my_a"
-; CHECK: .debug_loc contents:
-; CHECK: 0x00000000: Beginning address offset:
-; CHECK-NEXT:           Ending address offset:
-; CHECK-NEXT:            Location description: 77 08
-;                                              rsp+8
 
 %class.A = type { i32, i32, i32, i32 }
 

Modified: llvm/trunk/test/DebugInfo/X86/dbg-declare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-declare.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-declare.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-declare.ll Tue Aug 29 14:41:21 2017
@@ -8,7 +8,7 @@
 
 ; "[DW_FORM_exprloc] <0x2> 91 XX" means fbreg uleb(XX)
 ; DWARF-LABEL: DW_TAG_formal_parameter
-; DWARF-NEXT:              DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 70 )
+; DWARF-NEXT:              DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg -16)
 ; DWARF-NEXT:              DW_AT_name [DW_FORM_strp]     ( {{.*}} = "x")
 
 ; FIXME: There is no debug info to describe "a".

Modified: llvm/trunk/test/DebugInfo/X86/dbg-merge-loc-entry.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-merge-loc-entry.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-merge-loc-entry.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-merge-loc-entry.ll Tue Aug 29 14:41:21 2017
@@ -7,7 +7,7 @@ target datalayout = "e-p:64:64:64-i1:8:8
 target triple = "x86_64-apple-darwin8"
 
 ; Test that consecutive, identical DBG_VALUEs are merged.
-;CHECK: DW_AT_location{{.*}}(<0x1> 55 )
+; CHECK: DW_AT_location{{.*}}(DW_OP_reg5 RDI)
 
 %0 = type { i64, i1 }
 

Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll Tue Aug 29 14:41:21 2017
@@ -21,29 +21,14 @@
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
-; CHECK:     DW_AT_location [DW_FORM_data4]	([[LOC:.*]])
+; CHECK:     DW_AT_location {{.*}}({{.*}}
+; CHECK-NEXT:  0x{{0*.*}} - [[C1:0x.*]]: DW_OP_consts +3
+; CHECK-NEXT:      [[C1]] - [[C2:0x.*]]: DW_OP_consts +7
+; CHECK-NEXT:      [[C2]] - [[R1:0x.*]]: DW_OP_reg0 RAX
+; CHECK-NEXT:      [[R1]] - [[R2:0x.*]]: DW_OP_breg7 RSP+4, DW_OP_deref)
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_name{{.*}}"i"
-; CHECK: .debug_loc contents:
-; CHECK: [[LOC]]:
-;        consts 0x00000003
-; CHECK: Beginning address offset: 0x0000000000000{{.*}}
-; CHECK:    Ending address offset: [[C1:.*]]
-; CHECK:     Location description: 11 03
-;        consts 0x00000007
-; CHECK: Beginning address offset: [[C1]]
-; CHECK:    Ending address offset: [[C2:.*]]
-; CHECK:     Location description: 11 07
-;        rax
-; CHECK: Beginning address offset: [[C2]]
-; CHECK:    Ending address offset: [[R1:.*]]
-; CHECK:     Location description: 50
-;         rdi+0
-; CHECK: Beginning address offset: [[R1]]
-; CHECK:    Ending address offset: [[R2:.*]]
-; CHECK:     Location description: 77 04
-;         rsp+4
-;
+
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.9.0"
 

Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-frame-index.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-frame-index.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-value-frame-index.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-value-frame-index.ll Tue Aug 29 14:41:21 2017
@@ -21,8 +21,8 @@ while.end:
 
 ; CHECK-LABEL: test
 ; CHECK:       #DEBUG_VALUE: test:w <- [DW_OP_plus_uconst 8] [%RSP+0]
-; DWARF:       Location description: 77 08
-;                                    DW_OP_breg7 +8
+; DWARF:  DW_AT_location [DW_FORM_sec_offset] (
+; DWARF-NEXT:   {{.*}} - {{.*}}: DW_OP_breg7 RSP+8)
 
 declare i1 @fn(i64*, i64*, i64*, i8*, i64, i64*, i32*, i8*)
 declare void @llvm.dbg.value(metadata, metadata, metadata)

Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-regmask-clobber.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-value-regmask-clobber.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-value-regmask-clobber.ll Tue Aug 29 14:41:21 2017
@@ -22,14 +22,10 @@
 ; argc is the first formal parameter.
 ; DWARF: .debug_info contents:
 ; DWARF:  DW_TAG_formal_parameter
-; DWARF-NEXT:    DW_AT_location [DW_FORM_sec_offset]   ([[argc_loc_offset:0x.*]])
+; DWARF-NEXT:    DW_AT_location [DW_FORM_sec_offset]   ({{0x.*}}
+; DWARF-NEXT:      0x0000000000000000 - 0x0000000000000013: DW_OP_reg2 RCX)
 ; DWARF-NEXT:    DW_AT_name [DW_FORM_strp]     {{.*}} "argc"
 
-; DWARF: .debug_loc contents:
-; DWARF: [[argc_loc_offset]]: Beginning address offset: 0x0000000000000000
-; DWARF-NEXT:                    Ending address offset: 0x0000000000000013
-; DWARF-NEXT:                     Location description: 52
-
 ; ModuleID = 't.cpp'
 source_filename = "test/DebugInfo/X86/dbg-value-regmask-clobber.ll"
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"

Modified: llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll Tue Aug 29 14:41:21 2017
@@ -27,10 +27,7 @@
 ; CHECK-NOT: {{DW_TAG|NULL}}
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
-; 0x06 = DW_OP_deref
-; 0x23 = DW_OP_uconst
-; 0x91 = DW_OP_fbreg
-; CHECK: DW_AT_location{{.*}}91 {{[0-9]+}} 06 23 {{[0-9]+}} )
+; CHECK: DW_AT_location{{.*}}(DW_OP_fbreg -24, DW_OP_deref, DW_OP_plus_uconst 0x20)
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_name{{.*}}"self"
 ; CHECK-NOT: DW_TAG

Modified: llvm/trunk/test/DebugInfo/X86/debug-info-packed-struct.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-info-packed-struct.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-info-packed-struct.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-info-packed-struct.ll Tue Aug 29 14:41:21 2017
@@ -29,15 +29,15 @@ target triple = "x86_64-apple-darwin"
 ; CHECK:      DW_AT_byte_size {{.*}} (0x18)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l0_ofs0"
-; CHECK:          DW_AT_data_member_location {{.*}}00
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l0_ofs8"
-; CHECK:          DW_AT_data_member_location {{.*}}08
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l0_ofs16"
 ; CHECK:          DW_AT_bit_size   {{.*}} (0x01)
 ; CHECK:          DW_AT_bit_offset {{.*}} (0x1f)
-; CHECK:          DW_AT_data_member_location {{.*}}10
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x10)
 
 ; // ---------------------------------------------------------------------
 ; // Implicitly packed.
@@ -62,16 +62,16 @@ target triple = "x86_64-apple-darwin"
 ; CHECK:      DW_AT_byte_size {{.*}} (0x0c)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l1_ofs0"
-; CHECK:          DW_AT_data_member_location {{.*}}00
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l1_ofs1"
-; CHECK:          DW_AT_data_member_location {{.*}}01
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x1)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l1_ofs9"
 ; CHECK:          DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK:          DW_AT_bit_size   {{.*}} (0x01)
 ; CHECK:          DW_AT_bit_offset {{.*}} (0x17)
-; CHECK:          DW_AT_data_member_location {{.*}}08
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
 
 ; // ---------------------------------------------------------------------
 ; // Explicitly packed.
@@ -95,16 +95,16 @@ target triple = "x86_64-apple-darwin"
 ; CHECK:      DW_AT_byte_size {{.*}} (0x0a)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l2_ofs0"
-; CHECK:          DW_AT_data_member_location {{.*}}00
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l2_ofs1"
-; CHECK:          DW_AT_data_member_location {{.*}}01
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x1)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l2_ofs9"
 ; CHECK:          DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK:          DW_AT_bit_size   {{.*}} (0x01)
 ; CHECK:          DW_AT_bit_offset {{.*}} (0x17)
-; CHECK:          DW_AT_data_member_location {{.*}}08
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
 
 ; // ---------------------------------------------------------------------
 ; // Explicitly packed with different alignment.
@@ -128,16 +128,16 @@ target triple = "x86_64-apple-darwin"
 ; CHECK:      DW_AT_byte_size {{.*}} (0x10)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l3_ofs0"
-; CHECK:          DW_AT_data_member_location {{.*}}00
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l3_ofs4"
-; CHECK:          DW_AT_data_member_location {{.*}}04
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
 ; CHECK:      DW_TAG_member
 ; CHECK:          DW_AT_name {{.*}} "l3_ofs12"
 ; CHECK:          DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK:          DW_AT_bit_size   {{.*}} (0x01)
 ; CHECK:          DW_AT_bit_offset {{.*}} (0x1f)
-; CHECK:          DW_AT_data_member_location {{.*}}0c
+; CHECK:          DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0xc)
 
 !llvm.dbg.cu = !{!2}
 !llvm.module.flags = !{!49, !50}

Modified: llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll Tue Aug 29 14:41:21 2017
@@ -1,6 +1,6 @@
 ; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
 ; RUN: llc  -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj < %s \
-; RUN:   | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
+; RUN:   | llvm-dwarfdump -debug-dump=info - | FileCheck %s --check-prefix=DWARF
 
 ; Verify that we have correct debug info for local variables in code
 ; instrumented with AddressSanitizer.
@@ -30,8 +30,9 @@
 ; CHECK:      .quad .Lfunc_begin0-.Lfunc_begin0
 ; CHECK-NEXT: .quad [[START_LABEL]]-.Lfunc_begin0
 ; CHECK: DW_OP_breg5
-; DWARF: Location description: 75 00 06
-;                              DW_OP_breg5+0 DW_OP_deref
+; DWARF:       DW_TAG_formal_parameter
+; DWARF:         DW_AT_location
+; DWARF-NEXT:      {{.*}} - {{.*}}: DW_OP_breg5 RDI+0, DW_OP_deref
 
 ; Then it's addressed via %rsp:
 ; CHECK:      .quad [[START_LABEL]]-.Lfunc_begin0
@@ -39,8 +40,7 @@
 ; CHECK: DW_OP_breg7
 ; CHECK-NEXT: [[OFFSET]]
 ; CHECK: DW_OP_deref
-; DWARF: Location description: {{77 .. 06 06}}
-;                              DW_OP_breg7+OFFSET DW_OP_deref DW_OP_deref
+; DWARF-NEXT:      {{.*}} - {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_deref, DW_OP_deref)
 
 ; ModuleID = 'test.cc'
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

Modified: llvm/trunk/test/DebugInfo/X86/debug-loc-frame.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-loc-frame.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-loc-frame.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-loc-frame.ll Tue Aug 29 14:41:21 2017
@@ -26,18 +26,10 @@
 ; CHECK:      DW_TAG_subprogram
 ; CHECK-NOT:  NULL
 ; CHECK:      DW_TAG_variable
-; CHECK:      DW_AT_location [DW_FORM_sec_offset] ([[DEBUGLOCOFFSET:0x[0-9a-f]+]]){{[[:space:]].*}}"val"
-
-; See that 'val' has at least one location entry with a DW_op_breg? operand.
-; The DWARF DW_op_breg* ops are encoded from 0x70 to 0x8f, but checking for an
-; op in the range from 0x70 to 0x7f should suffice because that range covers
-; all integer GPRs.
-;
-; CHECK: .debug_loc contents:
-; CHECK-NOT: .debug{{.*}} contents
-; CHECK: [[DEBUGLOCOFFSET]]: Beginning
-; CHECK-NOT: {{0x[0-9a-f]+}}: Beginning
-; CHECK: Location description: 7{{[0-9a-f] .*}}
+; CHECK:      DW_AT_location [DW_FORM_sec_offset] ({{.*}}
+; CHECK-NEXT:   {{0x.*}} - {{0x.*}}: DW_OP_reg0 RAX
+; CHECK-NEXT:   {{0x.*}} - {{0x.*}}: DW_OP_breg7 RSP+4, DW_OP_deref)
+; CHECK-NEXT: DW_AT_name {{.*}}"val"
 
 ; ModuleID = 'frame.c'
 source_filename = "frame.c"

Modified: llvm/trunk/test/DebugInfo/X86/debug-loc-offset.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-loc-offset.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-loc-offset.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-loc-offset.ll Tue Aug 29 14:41:21 2017
@@ -23,7 +23,8 @@
 ; }
 
 ; Compiled separately for i386-pc-linux-gnu and linked together.
-; This ensures that we have multiple compile units so that we can verify that
+; This ensures that we have multiple compile units and multiple location lists
+; so that we can verify that
 ; debug_loc entries are relative to the low_pc of the CU. The loc entry for
 ; the byval argument in foo.cpp is in the second CU and so should have
 ; an offset relative to that CU rather than from the beginning of the text
@@ -32,7 +33,7 @@
 ; Checking that we have two compile units with two sets of high/lo_pc.
 ; CHECK: .debug_info contents
 ; CHECK: DW_TAG_compile_unit
-; CHECK: DW_AT_low_pc
+; CHECK: DW_AT_low_pc {{.*}} (0x0000000000000020)
 ; CHECK: DW_AT_high_pc
 
 ; CHECK: DW_TAG_subprogram
@@ -41,21 +42,37 @@
 ; CHECK-NOT: {{DW_TAG|NULL}}
 ; CHECK: DW_TAG_formal_parameter
 ; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_location [DW_FORM_sec_offset]   (0x00000000)
-; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_name [DW_FORM_strp]{{.*}}"a"
+; CHECK:       DW_AT_location [DW_FORM_sec_offset]   ({{.*}}
+; CHECK-NEXT:    0x0000000000000000 - 0x0000000000000017: DW_OP_breg0 EAX+0, DW_OP_deref
+; CHECK-NEXT:    0x0000000000000017 - 0x0000000000000043: DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
+; CHECK-NEXT:  DW_AT_name [DW_FORM_strp]{{.*}}"a"
 
 ; CHECK: DW_TAG_variable
 ; CHECK: DW_AT_location [DW_FORM_exprloc]
 ; CHECK-NOT: DW_AT_location
 
 ; CHECK: DW_TAG_compile_unit
-; CHECK: DW_AT_low_pc
+; CHECK: DW_AT_low_pc {{.*}} (0x0000000000000000)
 ; CHECK: DW_AT_high_pc
 
+; CHECK: DW_TAG_subprogram
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3bari"
+; CHECK-NOT: {{DW_TAG|NULL}}
+; CHECK: DW_TAG_formal_parameter
+; CHECK-NOT: DW_TAG
+; CHECK:       DW_AT_location [DW_FORM_sec_offset]   ({{.*}}
+; CHECK-NEXT:    0x0000000000000000 - 0x000000000000000a: DW_OP_consts +0, DW_OP_stack_value
+; CHECK-NEXT:    0x000000000000000a - 0x0000000000000017: DW_OP_consts +1, DW_OP_stack_value)
+; CHECK-NEXT:  DW_AT_name [DW_FORM_strp]{{.*}}"b"
+
 ; CHECK: .debug_loc contents:
-; CHECK: 0x00000000: Beginning address offset: 0x0000000000000000
-; CHECK:                Ending address offset: 0x0000000000000017
+; CHECK:       0x00000000:
+; CHECK-NEXT:    0x0000000000000000 - 0x000000000000000a: DW_OP_consts +0, DW_OP_stack_value
+; CHECK-NEXT:    0x000000000000000a - 0x0000000000000017: DW_OP_consts +1, DW_OP_stack_value
+; CHECK:       0x00000022:
+; CHECK-NEXT:    0x0000000000000000 - 0x0000000000000017: DW_OP_breg0 EAX+0, DW_OP_deref
+; CHECK-NEXT:    0x0000000000000017 - 0x0000000000000043: DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
 
 %struct.A = type { i32 (...)**, i32 }
 
@@ -64,8 +81,9 @@ define i32 @_Z3bari(i32 %b) #0 !dbg !4 {
 entry:
   %b.addr = alloca i32, align 4
   store i32 %b, i32* %b.addr, align 4
-  call void @llvm.dbg.declare(metadata i32* %b.addr, metadata !21, metadata !DIExpression()), !dbg !22
+  call void @llvm.dbg.value(metadata i32 0, metadata !21, metadata !DIExpression()), !dbg !22
   %0 = load i32, i32* %b.addr, align 4, !dbg !23
+  call void @llvm.dbg.value(metadata i32 1, metadata !21, metadata !DIExpression()), !dbg !22
   %add = add nsw i32 %0, 4, !dbg !23
   ret i32 %add, !dbg !23
 }
@@ -73,6 +91,8 @@ entry:
 ; Function Attrs: nounwind readnone
 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
 
+declare void @llvm.dbg.value(metadata, metadata, metadata) #1
+
 define void @_Z3baz1A(%struct.A* %a) #2 !dbg !14 {
 entry:
   %z = alloca i32, align 4

Modified: llvm/trunk/test/DebugInfo/X86/dw_op_minus_direct.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dw_op_minus_direct.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dw_op_minus_direct.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dw_op_minus_direct.ll Tue Aug 29 14:41:21 2017
@@ -13,12 +13,13 @@
 ; DWARF2: .debug_info
 ; DWARF2: DW_TAG_formal_parameter
 ; DWARF2-NEXT: DW_AT_name {{.*}}"i"
-; DWARF2-NOT:  DW_AT_location
+; DWARF2-NOT:      DW_AT_location
 
-; CHECK: Beginning address offset: 0x0000000000000000
-; CHECK:    Ending address offset: 0x0000000000000004
-; CHECK:     Location description: 70 00 10 ff ff ff ff 0f 1a 10 01 1c 9f
+; CHECK: .debug_loc contents:
+; CHECK: 0x00000000:
+; CHECK-NEXT:   0x0000000000000000 - 0x0000000000000004: DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_constu 0x1, DW_OP_minus, DW_OP_stack_value
 ;        rax+0, constu 0xffffffff, and, constu 0x00000001, minus, stack-value
+
 source_filename = "minus.c"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.12.0"

Modified: llvm/trunk/test/DebugInfo/X86/fi-expr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fi-expr.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fi-expr.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/fi-expr.ll Tue Aug 29 14:41:21 2017
@@ -3,8 +3,9 @@
 ; A hand-crafted FrameIndex location with a DW_OP_deref.
 ; CHECK: DW_TAG_formal_parameter
 ;                                          fbreg -8, deref
-; CHECK-NEXT: DW_AT_location {{.*}} (<0x3> 91 78 06 )
+; CHECK-NEXT: DW_AT_location {{.*}} (DW_OP_fbreg -8, DW_OP_deref)
 ; CHECK-NEXT: DW_AT_name {{.*}} "foo"
+
 define void @f(i8* %bar) !dbg !6 {
 entry:
   %foo.addr = alloca i8*

Modified: llvm/trunk/test/DebugInfo/X86/fi-piece.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fi-piece.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fi-piece.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/fi-piece.ll Tue Aug 29 14:41:21 2017
@@ -5,8 +5,7 @@
 ; CHECK: DW_TAG_subprogram
 ; CHECK:   DW_AT_abstract_origin
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT:   DW_AT_location [DW_FORM_exprloc]	(<0x8> 91 7c 93 02 91 78 93 02 )
-;                       fbreg -8, piece 0x00000002, fbreg -4, piece 0x00000002
+; CHECK-NEXT:   DW_AT_location [DW_FORM_exprloc]	(DW_OP_fbreg -4, DW_OP_piece 0x2, DW_OP_fbreg -8, DW_OP_piece 0x2)
 ; CHECK-NEXT:   DW_AT_abstract_origin {{.*}}"a"
 ; Inlined variable, not to be merged.
 ; CHECK-NOT: DW_TAG

Modified: llvm/trunk/test/DebugInfo/X86/fission-cu.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-cu.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fission-cu.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/fission-cu.ll Tue Aug 29 14:41:21 2017
@@ -79,7 +79,7 @@ source_filename = "test/DebugInfo/X86/fi
 ; CHECK: DW_AT_external [DW_FORM_flag_present]   (true)
 ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
 ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
-; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x2> fb 00 )
+; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0)
 ; CHECK: [[TYPE]]: DW_TAG_base_type
 ; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000004) string = "int")
 

Modified: llvm/trunk/test/DebugInfo/X86/fission-ranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-ranges.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fission-ranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/fission-ranges.ll Tue Aug 29 14:41:21 2017
@@ -12,10 +12,10 @@
 
 
 ; CHECK: .debug_info.dwo contents:
-; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[A:0x[0-9a-z]*]])
-; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[E:0x[0-9a-z]*]])
-; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[B:0x[0-9a-z]*]])
-; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[D:0x[0-9a-z]*]])
+; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[A:0x[0-9a-z]*]]
+; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[E:0x[0-9a-z]*]]
+; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[B:0x[0-9a-z]*]]
+; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[D:0x[0-9a-z]*]]
 ; CHECK: DW_AT_ranges [DW_FORM_sec_offset]   (0x00000000
 ; CHECK: .debug_loc contents:
 ; CHECK-NOT: Beginning address offset
@@ -24,22 +24,16 @@
 ; Don't assume these locations are entirely correct - feel free to update them
 ; if they've changed due to a bugfix, change in register allocation, etc.
 
-; CHECK: [[A]]: Beginning address index: 2
-; CHECK-NEXT:                    Length: 169
-; CHECK-NEXT:      Location description: 11 00
-; CHECK-NEXT: {{^$}}
-; CHECK-NEXT:   Beginning address index: 3
-; CHECK-NEXT:                    Length: 25
-; CHECK-NEXT:      Location description: 50
-; CHECK: [[E]]: Beginning address index: 4
-; CHECK-NEXT:                    Length: 19
-; CHECK-NEXT:      Location description: 50
-; CHECK: [[B]]: Beginning address index: 5
-; CHECK-NEXT:                    Length: 17
-; CHECK-NEXT:      Location description: 50
-; CHECK: [[D]]: Beginning address index: 6
-; CHECK-NEXT:                    Length: 17
-; CHECK-NEXT:      Location description: 50
+; CHECK:      [[A]]:
+; CHECK-NEXT:   Addr idx 2 (w/ length 169): DW_OP_consts +0, DW_OP_stack_value
+; CHECK-NEXT:   Addr idx 3 (w/ length 25): DW_OP_reg0 RAX
+; CHECK:      [[E]]:
+; CHECK-NEXT:   Addr idx 4 (w/ length 19): DW_OP_reg0 RAX
+; CHECK:      [[B]]:
+; CHECK-NEXT:   Addr idx 5 (w/ length 17): DW_OP_reg0 RAX
+; CHECK:      [[D]]:
+; CHECK-NEXT:   Addr idx 6 (w/ length 17): DW_OP_reg0 RAX
+
 
 ; Make sure we don't produce any relocations in any .dwo section (though in particular, debug_info.dwo)
 ; HDR-NOT: .rela.{{.*}}.dwo

Modified: llvm/trunk/test/DebugInfo/X86/float_const_loclist.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/float_const_loclist.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/float_const_loclist.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/float_const_loclist.ll Tue Aug 29 14:41:21 2017
@@ -20,21 +20,14 @@
 ;
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT:  DW_AT_location {{.*}} (0x[[LD:.*]])
+; CHECK-NEXT:  DW_AT_location {{.*}} (
+; CHECK-NEXT:    [[START:0x.*]] - [[END:0x.*]]: DW_OP_constu 0xc8f5c28f5c28f800, DW_OP_piece 0x8, DW_OP_constu 0x4000, DW_OP_bit_piece 0x10 0x40)
 ; CHECK-NEXT:  DW_AT_name {{.*}}"ld"
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT:  DW_AT_location {{.*}} (0x[[F:.*]])
+; CHECK-NEXT:  DW_AT_location {{.*}} (
+; CHECK-NEXT:    [[START]] - [[END]]: DW_OP_constu 0x4048f5c3)
 ; CHECK-NEXT:  DW_AT_name {{.*}}"f"
-;
-; CHECK: .debug_loc contents:
-; CHECK: [[LD]]: Beginning address offset: [[START:.*]]
-; CHECK:            Ending address offset: [[END:.*]]
-; CHECK: Location description: 10 80 f0 a3 e1 f5 d1 f0 fa c8 01 93 08 10 80 80 01 9d 10 40
-;                   constu 0xc8f5c28f5c28f800, piece 8, constu 0x00004000, bit-piece 16 64
-; CHECK: [[F]]: Beginning address offset: [[START]]
-; CHECK:           Ending address offset: [[END]]
-; CHECK:            Location description: 10 c3 eb a3 82 04
-;                                         constu ...
+
 source_filename = "test.c"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.11.0"

Modified: llvm/trunk/test/DebugInfo/X86/frame-register.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/frame-register.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/frame-register.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/frame-register.ll Tue Aug 29 14:41:21 2017
@@ -1,7 +1,6 @@
 ; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump --debug-dump=info - | FileCheck %s
 ; CHECK: DW_TAG_variable
-;                                                      DW_OP_fbreg
-; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 00 )
+; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg +0)
 ; CHECK-NEXT: DW_AT_name {{.*}}"i"
 
 target datalayout = "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"

Modified: llvm/trunk/test/DebugInfo/X86/inlined-formal-parameter.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/inlined-formal-parameter.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/inlined-formal-parameter.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/inlined-formal-parameter.ll Tue Aug 29 14:41:21 2017
@@ -19,11 +19,10 @@
 ; CHECK:       DW_TAG_inlined_subroutine
 ; CHECK-NEXT:    DW_AT_abstract_origin {{.*}} "bar"
 ; CHECK:         DW_TAG_formal_parameter
-; CHECK-NEXT:      DW_AT_location [DW_FORM_data4]	(0x00000000)
+; CHECK-NEXT:      DW_AT_location [DW_FORM_data4]	(
+; CHECK-NEXT:        {{.*}} - {{.*}}: DW_OP_consts +0)
 ; CHECK-NEXT:      DW_AT_abstract_origin {{.*}} "a"
-;
-; CHECK: .debug_loc
-; CHECK: Location description: 11 00
+
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-darwin"
 

Modified: llvm/trunk/test/DebugInfo/X86/live-debug-variables.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/live-debug-variables.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/live-debug-variables.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/live-debug-variables.ll Tue Aug 29 14:41:21 2017
@@ -22,8 +22,11 @@
 ;          F(a,b,c,d,e);
 ; }
 
-; CHECK: Beginning address offset
-; CHECK-NOT: Beginning address offset
+; CHECK:      .debug_loc contents:
+; CHECK-NEXT: 0x00000000:
+; CHECK-NEXT:              0x000000000000001f - 0x000000000000003c: DW_OP_reg3 RBX
+;   We should only have one entry
+; CHECK-NOT: :
 
 declare i32 @foobar(i32, i32, i32, i32, i32)
 

Modified: llvm/trunk/test/DebugInfo/X86/op_deref.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/op_deref.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/op_deref.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/op_deref.ll Tue Aug 29 14:41:21 2017
@@ -5,19 +5,16 @@
 ; RUN:     | llvm-dwarfdump -debug-dump=info - \
 ; RUN:     | FileCheck %s -check-prefix=CHECK -check-prefix=DWARF3
 
-; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle
-; DW_AT_location lists yet.
-; DWARF4: DW_AT_location [DW_FORM_sec_offset]                      (0x00000000)
+; DWARF4: DW_AT_location [DW_FORM_sec_offset]                      (0x00000000
+; DWARF4-NEXT:  {{.*}}: DW_OP_breg2 RCX+0, DW_OP_deref
 
-; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle
-; DW_AT_location lists yet.
-; DWARF3: DW_AT_location [DW_FORM_data4]                      (0x00000000)
+; DWARF3: DW_AT_location [DW_FORM_data4]                      (0x00000000
+; DWARF3-NEXT:  {{.*}}: DW_OP_breg2 RCX+0, DW_OP_deref
 
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_name [DW_FORM_strp]  ( .debug_str[0x00000067] = "vla")
 
-; Unfortunately llvm-dwarfdump can't unparse a list of DW_AT_locations
-; right now, so we check the asm output:
+; Check the DEBUG_VALUE comments for good measure.
 ; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o - -filetype=asm | FileCheck %s -check-prefix=ASM-CHECK
 ; vla should have a register-indirect address at one point.
 ; ASM-CHECK: DEBUG_VALUE: vla <- [DW_OP_deref] [%RCX+0]

Modified: llvm/trunk/test/DebugInfo/X86/parameters.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/parameters.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/parameters.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/parameters.ll Tue Aug 29 14:41:21 2017
@@ -1,7 +1,7 @@
 ; REQUIRES: object-emission
 ;
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -O0 -filetype=obj < %s > %t
-; RUN: llvm-dwarfdump %t | FileCheck %s
+; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
 ; Test case derived from compiling the following source with clang -g:
 ;
@@ -23,21 +23,25 @@
 ; }
 
 ; CHECK: debug_info contents
-; 0x74 is DW_OP_breg4, showing that the parameter is accessed indirectly
-; (with a zero offset) from the register parameter.
-; CHECK: DW_AT_location {{.*}} 74 00 06
-
+; The parameter is accessed indirectly (with a zero offset) from the second
+; register parameter. RDI is consumed by 'sret'.
+; CHECK: DW_TAG_subprogram
+; CHECK: DW_AT_name{{.*}} = "func"
+; CHECK: DW_TAG_formal_parameter
+; CHECK: DW_AT_location {{.*}} (DW_OP_breg4 RSI+0, DW_OP_deref)
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_name{{.*}} = "f"
-;
-; CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9]*]])
+
+; CHECK: DW_TAG_subprogram
+; CHECK: DW_AT_name{{.*}} = "func2"
+; CHECK: DW_TAG_formal_parameter
+; CHECK: DW_AT_location{{.*}}(DW_OP_fbreg +23)
+; CHECK: DW_TAG_formal_parameter
+; CHECK: DW_AT_location{{.*}}(
+; CHECK-NEXT: {{.*}}: DW_OP_breg4 RSI+0, DW_OP_deref
+; CHECK-NEXT: {{.*}}: DW_OP_breg7 RSP+8, DW_OP_deref, DW_OP_deref)
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_name{{.*}} = "g"
-;
-; CHECK: debug_loc contents
-; CHECK:         [[G_LOC]]: Beginning
-; CHECK-NEXT:               Ending
-; CHECK-NEXT: Location description: 74 00
 
 %"struct.pr14763::foo" = type { i8 }
 

Modified: llvm/trunk/test/DebugInfo/X86/partial-constant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/partial-constant.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/partial-constant.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/partial-constant.ll Tue Aug 29 14:41:21 2017
@@ -16,9 +16,10 @@
 ;
 ; The constant should NOT be available for the entire function.
 ; CHECK-NOT: DW_AT_const_value
-; CHECK: .debug_loc
-; CHECK: Location description: 10 01 9f
-;                              constu 0x00000001, stack-value
+; CHECK: .debug_loc contents:
+; CHECK-NEXT: 0x00000000:
+; CHECK-NEXT:   {{.*}}: DW_OP_constu 0x1, DW_OP_stack_value
+
 source_filename = "test.ii"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.12.0"

Modified: llvm/trunk/test/DebugInfo/X86/pieces-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/pieces-1.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/pieces-1.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/pieces-1.ll Tue Aug 29 14:41:21 2017
@@ -17,14 +17,9 @@
 ; CHECK: .debug_loc contents:
 ;
 
-; 0x0000000000000000 - 0x0000000000000006: rdi, piece 0x00000008, rsi, piece 0x00000004
-; CHECK:            Beginning address offset: 0x0000000000000000
-; CHECK:               Ending address offset: [[LTMP3:.*]]
-; CHECK:                Location description: 55 93 08 54 93 04
-; 0x0000000000000006 - 0x0000000000000008: rbp-8, piece 0x00000008, rax, piece 0x00000004 )
-; CHECK:            Beginning address offset: [[LTMP3]]
-; CHECK:               Ending address offset: [[END:.*]]
-; CHECK:                Location description: 76 78 93 08 54 93 04
+; CHECK: 0x0000000000000000 - [[LTMP3:.*]]: DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_reg4 RSI, DW_OP_piece 0x4
+; 0x0000000000000006 - 0x0000000000000008: rbp-8, piece 0x8, rax, piece 0x4 )
+; CHECK: [[LTMP3]] - {{.*}}: DW_OP_breg6 RBP-8, DW_OP_piece 0x8, DW_OP_reg4 RSI, DW_OP_piece 0x4
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.9.0"

Modified: llvm/trunk/test/DebugInfo/X86/pieces-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/pieces-2.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/pieces-2.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/pieces-2.ll Tue Aug 29 14:41:21 2017
@@ -17,15 +17,10 @@
 ;
 ;
 ; CHECK: DW_TAG_variable [4]
-; CHECK-NEXT:   DW_AT_location [DW_FORM_data4]        ([[LOC:.*]])
+; CHECK-NEXT:   DW_AT_location [DW_FORM_data4] (
+; CHECK-NEXT:     0x0000000000000004 - 0x0000000000000005: DW_OP_reg0 RAX, DW_OP_piece 0x4)
 ; CHECK-NEXT:  DW_AT_name {{.*}}"i1"
-;
-; CHECK: .debug_loc
-; CHECK: [[LOC]]: Beginning address offset: 0x0000000000000004
-; CHECK-NEXT:        Ending address offset: 0x0000000000000005
-;                                           rax, piece 0x00000004
-; CHECK-NEXT:         Location description: 50 93 04
-;
+
 ; ModuleID = '/Volumes/Data/llvm/test/DebugInfo/X86/sroasplit-1.ll'
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.9.0"

Modified: llvm/trunk/test/DebugInfo/X86/pieces-3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/pieces-3.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/pieces-3.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/pieces-3.ll Tue Aug 29 14:41:21 2017
@@ -16,26 +16,14 @@
 ;    }
 ;
 ; CHECK: DW_TAG_formal_parameter [3]
-; CHECK-NEXT:   DW_AT_location [DW_FORM_data4]        ([[LOC1:.*]])
+; CHECK-NEXT:   DW_AT_location [DW_FORM_data4]        (
+; CHECK-NEXT:     0x0000000000000000 - 0x0000000000000004: DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_piece 0x4, DW_OP_reg4 RSI, DW_OP_piece 0x4
+; CHECK-NEXT:     0x0000000000000004 - 0x0000000000000008: DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_piece 0x4, DW_OP_reg4 RSI, DW_OP_piece 0x4)
 ; CHECK-NEXT:   DW_AT_name {{.*}}"outer"
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT:   DW_AT_location
-;                                     rsi, piece 0x00000004
-; CHECK-SAME:                         54 93 04
+; CHECK-NEXT:   DW_AT_location {{.*}}(DW_OP_reg4 RSI, DW_OP_piece 0x4)
 ; CHECK-NEXT:   "i1"
-;
-; CHECK: .debug_loc
-; CHECK: [[LOC1]]: Beginning address offset: 0x0000000000000000
-; CHECK-NEXT:         Ending address offset: 0x0000000000000004
-;             rdi, piece 0x00000008, piece 0x00000004, rsi, piece 0x00000004
-; CHECK-NEXT: Location description: 55 93 08 93 04 54 93 04
-; This location is split into two ranges with identical locations
-; because it comes from a DBG_VALUE %RSI followed by a DBG_VALUE %ESI.
-; CHECK:           Beginning address offset: 0x0000000000000004
-; CHECK-NEXT:         Ending address offset: 0x0000000000000008
-; CHECK-NEXT: Location description: 55 93 08 93 04 54 93 04
 
-;
 ; ModuleID = '/Volumes/Data/llvm/test/DebugInfo/X86/sroasplit-2.ll'
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.9.0"

Modified: llvm/trunk/test/DebugInfo/X86/pieces-4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/pieces-4.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/pieces-4.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/pieces-4.ll Tue Aug 29 14:41:21 2017
@@ -1,5 +1,5 @@
 ; RUN: llc < %s | FileCheck %s
-; RUN: llc -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
+; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-dump=loc - | FileCheck %s --check-prefix=DWARF
 
 ; Compile the following with -O1:
 
@@ -22,8 +22,10 @@
 ; CHECK:               #NO_APP
 ; CHECK:               movl    [[offs]](%rsp), %eax          # 4-byte Reload
 ; CHECK:               retq
-; DWARF: Location description: {{77 .. 93 04 10 00 9f 93 04}}
-; DW_OP_breg7+offs DW_OP_piece 4 DW_OP_constu 0 DW_OP_stack_value DW_OP_piece 4
+
+; DWARF: .debug_loc contents:
+; DWARF-NEXT: 0x00000000:
+; DWARF-NEXT: {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
 
 ; ModuleID = 't.c'
 source_filename = "t.c"

Modified: llvm/trunk/test/DebugInfo/X86/reference-argument.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/reference-argument.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/reference-argument.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/reference-argument.ll Tue Aug 29 14:41:21 2017
@@ -12,9 +12,7 @@
 ; CHECK:       DW_AT_name {{.*}} "this"
 ; CHECK-NOT:   DW_TAG_subprogram
 ; CHECK:     DW_TAG_formal_parameter
-; CHECK-NEXT:  DW_AT_location 
-;                                rsi+0
-; CHECK-SAME:                    74 00
+; CHECK-NEXT:  DW_AT_location {{.*}}(DW_OP_breg4 RSI+0)
 ; CHECK-NEXT:  DW_AT_name {{.*}} "v"
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"

Modified: llvm/trunk/test/DebugInfo/X86/single-dbg_value.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/single-dbg_value.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/single-dbg_value.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/single-dbg_value.ll Tue Aug 29 14:41:21 2017
@@ -5,14 +5,13 @@
 ;
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
-; CHECK-NEXT:   DW_AT_location [DW_FORM_data4]
+; CHECK-NEXT:   DW_AT_location [DW_FORM_data4] (
+; CHECK-NEXT:     {{.*}}: DW_OP_reg0 RAX)
 ; CHECK-NEXT:   DW_AT_name{{.*}}"a"
-; CHECK: .debug_loc contents:
-;                               rax
-; CHECK:  Location description: 50
+
 ; SANITY: DBG_VALUE
 ; SANITY-NOT: DBG_VALUE
-; ModuleID = 'test.ll'
+
 ; Compiled with -O:
 ;   void h(int);
 ;   int g();
@@ -21,6 +20,8 @@
 ;     int a = g();
 ;     h(a);
 ;   }
+
+; ModuleID = 'test.ll'
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx"
 

Modified: llvm/trunk/test/DebugInfo/X86/single-fi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/single-fi.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/single-fi.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/single-fi.ll Tue Aug 29 14:41:21 2017
@@ -3,7 +3,7 @@
 ; A single FI location. This used to trigger an assertion in debug libstdc++.
 ; CHECK: DW_TAG_formal_parameter
 ;                                          fbreg -8
-; CHECK-NEXT: DW_AT_location {{.*}} (<0x2> 91 78 )
+; CHECK-NEXT: DW_AT_location {{.*}} (DW_OP_fbreg -8)
 ; CHECK-NEXT: DW_AT_name {{.*}} "dipsy"
 define void @tinkywinky(i8* %dipsy) !dbg !6 {
 entry:

Modified: llvm/trunk/test/DebugInfo/X86/split-global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/split-global.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/split-global.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/split-global.ll Tue Aug 29 14:41:21 2017
@@ -11,21 +11,19 @@ target triple = "x86_64-apple-macosx10.1
 ; CHECK: DW_TAG_variable
 ; CHECK-NEXT: DW_AT_name {{.*}}"point"
 ; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_location [DW_FORM_exprloc]	(<0x16> 03 04 00 00 00 00 00 00 00 93 04 03 00 00 00 00 00 00 00 00 93 04 )
-;     [0x0000000000000004], piece 0x00000004, [0x0000000000000000], piece 0x00000004
+; CHECK: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addr 0x4, DW_OP_piece 0x4, DW_OP_addr 0x0, DW_OP_piece 0x4)
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_TAG
 ; CHECK: DW_TAG_variable
 ; CHECK-NEXT: DW_AT_name {{.*}}"part_const"
 ; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_location [DW_FORM_exprloc]	(<0x10> 03 08 00 00 00 00 00 00 00 93 04 10 02 9f 93 04 )
+; CHECK: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addr 0x8, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4)
 ;     [0x0000000000000008], piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_TAG_variable
 ; CHECK-NEXT: DW_AT_name {{.*}}"full_const"
 ; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_location [DW_FORM_exprloc]	(<0xa> 10 01 9f 93 04 10 02 9f 93 04 )
-;     constu 0x00000001, stack-value, piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004
+; CHECK: DW_AT_location [DW_FORM_exprloc]	(DW_OP_constu 0x1, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4)
 ; CHECK-NOT: DW_TAG
 @point.y = global i32 2, align 4, !dbg !13
 @point.x = global i32 1, align 4, !dbg !12

Modified: llvm/trunk/test/DebugInfo/X86/sret.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/sret.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/sret.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/sret.ll Tue Aug 29 14:41:21 2017
@@ -10,13 +10,10 @@
 ; RUN: llc -O0 -fast-isel=false -mtriple=x86_64-apple-darwin -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
 ; CHECK: _ZN1B9AInstanceEv
 ; CHECK: DW_TAG_variable  
-; CHECK-NEXT:   DW_AT_location [DW_FORM_sec_offset] (0x00000000)
+; CHECK-NEXT:   DW_AT_location [DW_FORM_sec_offset] (0x00000000
+; CHECK-NEXT:     {{.*}} - {{.*}}: DW_OP_breg5 RDI+0
+; CHECK-NEXT:     {{.*}} - {{.*}}: DW_OP_breg6 RBP-24, DW_OP_deref)
 ; CHECK-NEXT:   DW_AT_name {{.*}}"a"
-; CHECK: .debug_loc contents:
-; CHECK: 0x00000000: Beginning address offset:
-; CHECK-NEXT:                Ending address offset:
-; CHECK-NEXT:                 Location description: 75 00
-;                                                   rdi+0
 
 %class.A = type { i32 (...)**, i32 }
 %class.B = type { i8 }

Modified: llvm/trunk/test/DebugInfo/X86/stack-value-dwarf2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stack-value-dwarf2.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/stack-value-dwarf2.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/stack-value-dwarf2.ll Tue Aug 29 14:41:21 2017
@@ -1,7 +1,8 @@
-; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump -debug-dump=loc - | FileCheck %s
+
 ; Note that it would be even better to avoid emitting the empty piece.
-; CHECK:  Location description: 93 08
-;                               piece 0x00000008
+; CHECK:  {{.*}}: DW_OP_piece 0x8{{$}}
+
 source_filename = "bugpoint-reduced-simplified.ll"
 target triple = "i386-apple-ios7.0.0"
 

Modified: llvm/trunk/test/DebugInfo/X86/stack-value-piece.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stack-value-piece.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/stack-value-piece.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/stack-value-piece.ll Tue Aug 29 14:41:21 2017
@@ -18,25 +18,22 @@
 ; CHECK: DW_TAG_subprogram
 ; CHECK:   DW_AT_name {{.*}} "i"
 ; CHECK:   DW_TAG_variable
-; CHECK-NEXT:   DW_AT_location {{.*}} ([[I:.*]])
+; CHECK-NEXT:   DW_AT_location {{.*}} ([[I:.*]]
+; CHECK-NEXT:     {{.*}} - {{.*}}: DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
 ; CHECK-NEXT:   DW_AT_name {{.*}} "r"
 ;
 ; CHECK: DW_TAG_subprogram
 ; CHECK:   DW_AT_name {{.*}} "f"
 ; CHECK:   DW_TAG_variable
-; CHECK-NEXT:   DW_AT_location {{.*}} ([[F:.*]])
+; CHECK-NEXT:   DW_AT_location {{.*}} ([[F:.*]]
+; CHECK-NEXT:     {{.*}} - {{.*}}: DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
 ; CHECK-NEXT:   DW_AT_name {{.*}} "r"
 ;
 ; CHECK: .debug_loc contents:
-; CHECK: [[I]]: Beginning address offset:
-; CHECK-NEXT:           Ending address offset:
-; CHECK-NEXT:            Location description: 55 93 04 10 00 9f 93 04 
-; rdi, piece 0x00000004, constu 0x00000000, stack-value, piece 0x00000004
-;
-; CHECK: [[F]]: Beginning address offset:
-; CHECK-NEXT:           Ending address offset:
-; CHECK-NEXT:            Location description: 61 93 04 10 00 9f 93 04
-; reg17, piece 0x00000004, constu 0x00000000, stack-value, piece 0x00000004
+; CHECK:      [[I]]:
+; CHECK-NEXT:   {{.*}} - {{.*}}: DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
+; CHECK:      [[F]]:
+; CHECK-NEXT:   {{.*}} - {{.*}}: DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
 
 source_filename = "stack-value-piece.c"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Modified: llvm/trunk/test/DebugInfo/X86/subregisters.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/subregisters.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/subregisters.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/subregisters.ll Tue Aug 29 14:41:21 2017
@@ -8,11 +8,9 @@
 ;
 ; CHECK:  .debug_info contents:
 ; CHECK:  DW_TAG_variable
-; CHECK-NEXT:  DW_AT_location [DW_FORM_data4]	(0x00000000)
+; CHECK-NEXT:  DW_AT_location [DW_FORM_data4]	(
+; CHECK-NEXT:    {{.*}} - {{.*}}: DW_OP_reg4 RSI)
 ; CHECK-NEXT:  DW_AT_name [DW_FORM_strp]{{.*}} "a"
-; CHECK: .debug_loc contents:
-;                                    rsi
-; CHECK:       Location description: 54
 ;
 ; struct bar {
 ;   int a;

Modified: llvm/trunk/test/DebugInfo/X86/template.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/template.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/template.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/template.ll Tue Aug 29 14:41:21 2017
@@ -29,7 +29,7 @@
 ; The address of the global 'glbl', followed by DW_OP_stack_value (9f), to use
 ; the value immediately, rather than indirecting through the address.
 
-; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]{{ *}}(<0xa> 03 00 00 00 00 00 00 00 00 9f )
+; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]{{ *}}(DW_OP_addr 0x0, DW_OP_stack_value)
 ; CHECK-NOT: NULL
 
 ; CHECK: DW_TAG_GNU_template_template_param

Modified: llvm/trunk/test/DebugInfo/X86/this-stack_value.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/this-stack_value.ll?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/this-stack_value.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/this-stack_value.ll Tue Aug 29 14:41:21 2017
@@ -18,8 +18,8 @@
 ; modified by the debugger.
 ;
 ; ASM: [DW_OP_stack_value]
-; CHECK:  DW_AT_location {{.*}} 70 00 9f
-;                               rax+0, stack-value
+; CHECK:  DW_AT_location {{.*}} (DW_OP_breg0 RAX+0, DW_OP_stack_value)
+
 source_filename = "ab.cpp"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.12.0"

Modified: llvm/trunk/test/DebugInfo/dwarfdump-debug-loc-simple.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-debug-loc-simple.test?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-debug-loc-simple.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-debug-loc-simple.test Tue Aug 29 14:41:21 2017
@@ -3,24 +3,20 @@ Note: the input file was generated from
 
 CHECK: .debug_info
 CHECK: DW_AT_name{{.*}}"f"
-CHECK: DW_AT_location{{.*}}([[F_LOC:0x[0-9a-f]*]])
+CHECK: DW_AT_location{{.*}}([[F_LOC:0x[0-9a-f]*]]
+CHECK-NEXT:    0x0000000000000000 - 0x0000000000000023: DW_OP_reg1 ECX
+CHECK-NEXT:    0x0000000000000023 - 0x000000000000005d: DW_OP_breg5 EBP-16)
 CHECK: DW_AT_name{{.*}}"g"
-CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9a-f]*]])
+CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9a-f]*]]
+CHECK-NEXT:    0x0000000000000000 - 0x0000000000000020: DW_OP_reg0 EAX
+CHECK-NEXT:    0x0000000000000020 - 0x000000000000005d: DW_OP_breg5 EBP-12)
+
 CHECK: .debug_loc contents:
-CHECK-NEXT: [[F_LOC]]: Beginning address offset: 0x0000000000000000
-CHECK-NEXT:               Ending address offset: 0x0000000000000023
+CHECK-NEXT: [[F_LOC]]:
 this is actually the wrong location due to PR14763, but that doesn't matter for
 the purposes of testing dwarfdump
-CHECK-NEXT:                Location description: 51
-CHECK-NEXT: {{^$}}
-CHECK-NEXT:            Beginning address offset: 0x0000000000000023
-CHECK-NEXT:               Ending address offset: 0x000000000000005d
-CHECK-NEXT:                Location description: 75 70
-CHECK-NEXT: {{^$}}
-CHECK-NEXT: [[G_LOC]]: Beginning address offset: 0x0000000000000000
-CHECK-NEXT:               Ending address offset: 0x0000000000000020
-CHECK-NEXT:               Location description: 50
-CHECK-NEXT: {{^$}}
-CHECK-NEXT:            Beginning address offset: 0x0000000000000020
-CHECK-NEXT:               Ending address offset: 0x000000000000005d
-CHECK-NEXT:                Location description: 75 74
+CHECK-NEXT:             0x0000000000000000 - 0x0000000000000023: DW_OP_reg1 ECX
+CHECK-NEXT:             0x0000000000000023 - 0x000000000000005d: DW_OP_breg5 EBP-16
+CHECK: [[G_LOC]]:
+CHECK-NEXT:             0x0000000000000000 - 0x0000000000000020: DW_OP_reg0 EAX
+CHECK-NEXT:             0x0000000000000020 - 0x000000000000005d: DW_OP_breg5 EBP-12

Modified: llvm/trunk/test/tools/dsymutil/ARM/scattered.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/ARM/scattered.c?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/ARM/scattered.c (original)
+++ llvm/trunk/test/tools/dsymutil/ARM/scattered.c Tue Aug 29 14:41:21 2017
@@ -6,7 +6,6 @@ int bar = 42;
 
 CHECK: DW_TAG_variable
 CHECK-NOT: DW_TAG
-CHECK: DW_AT_name{{.*}}"bar"
-CHECK-NOT: DW_TAG
-CHECK: DW_AT_location{{.*}}<0x05> 03 10 00 01 00 
-
+CHECK: DW_AT_name{{.*}}
+"bar" CHECK - NOT : DW_TAG
+                        CHECK : DW_AT_location{{.*}}(DW_OP_addr 0x10010)

Modified: llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test (original)
+++ llvm/trunk/test/tools/dsymutil/X86/basic-linking-x86.test Tue Aug 29 14:41:21 2017
@@ -31,19 +31,19 @@ CHECK:      DW_AT_external [DW_FORM_flag
 CHECK:      DW_AT_accessibility [DW_FORM_data1]	(DW_ACCESS_public)
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000ea0)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000ec4)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 CHECK:      DW_TAG_formal_parameter [3]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000056] = "argc")
 CHECK:        DW_AT_decl_file [DW_FORM_data1]       ("/Inputs{{[/\\]}}basic1.c")
 CHECK:        DW_AT_decl_line [DW_FORM_data1]	(23)
 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0063 => {0x00000063})
-CHECK:        DW_AT_location [DW_FORM_block1]	(<0x02> 91 78 )
+CHECK:        DW_AT_location [DW_FORM_block1]	(DW_OP_fbreg -8)
 CHECK:      DW_TAG_formal_parameter [3]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000005b] = "argv")
 CHECK:        DW_AT_decl_file [DW_FORM_data1]	("/Inputs{{[/\\]}}basic1.c")
 CHECK:        DW_AT_decl_line [DW_FORM_data1]	(23)
 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x006a => {0x0000006a})
-CHECK:        DW_AT_location [DW_FORM_block1]	(<0x02> 91 70 )
+CHECK:        DW_AT_location [DW_FORM_block1]	(DW_OP_fbreg -16)
 CHECK:      NULL
 CHECK:    DW_TAG_base_type [4]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000060] = "int")
@@ -75,31 +75,31 @@ CHECK:    DW_TAG_variable [7]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000072] = "private_int")
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
-BASIC:      DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 )
-ARCHIVE:    DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 )
+BASIC:      DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001008)
+ARCHIVE:    DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001004)
 CHECK:    DW_TAG_variable [7]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000007e] = "baz")
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
-CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 00 10 00 00 01 00 00 00 )
+CHECK:      DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001000)
 CHECK:    DW_TAG_subprogram [2] *
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000082] = "foo")
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000ed0)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f19)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 CHECK:      DW_TAG_formal_parameter [3]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0026 => {0x000000a7})
-CHECK:        DW_AT_location [DW_FORM_block1]	(<0x02> 91 7c )
+CHECK:        DW_AT_location [DW_FORM_block1]	(DW_OP_fbreg -4)
 CHECK:      NULL
 CHECK:    DW_TAG_subprogram [8]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000008a] = "inc")
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f20)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f37)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 CHECK:    NULL
 
 CHECK:  Compile Unit:
@@ -114,8 +114,8 @@ CHECK:    DW_TAG_variable [9]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000097] = "val")
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x003c => {0x00000162})
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
-BASIC:      DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 )
-ARCHIVE:    DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 )
+BASIC:      DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001004)
+ARCHIVE:    DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001008)
 CHECK:    DW_TAG_volatile_type [10]
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0041 => {0x00000167})
 CHECK:    DW_TAG_base_type [4]
@@ -125,18 +125,18 @@ CHECK:      DW_AT_name [DW_FORM_strp]
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0041 => {0x00000167})
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f40)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f84)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 CHECK:      DW_TAG_formal_parameter [3]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0041 => {0x00000167})
-CHECK:        DW_AT_location [DW_FORM_block1]	(<0x02> 91 78 )
+CHECK:        DW_AT_location [DW_FORM_block1]	(DW_OP_fbreg -8)
 CHECK:      NULL
 CHECK:    DW_TAG_subprogram [8]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000008a] = "inc")
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0041 => {0x00000167})
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f90)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000fa9)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 
 CHECK:    NULL
 

Modified: llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test (original)
+++ llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test Tue Aug 29 14:41:21 2017
@@ -16,19 +16,19 @@ CHECK:    DW_AT_high_pc [DW_FORM_data4]
 CHECK:    DW_TAG_subprogram [2] *
 CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f40)
 CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x0000000b)
-CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(DW_OP_reg6 RBP)
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000027] = "main")
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
 CHECK:      DW_AT_prototyped [DW_FORM_flag_present]	(true)
 CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x00000000000000a1)
 CHECK:      DW_AT_external [DW_FORM_flag_present]	(true)
 CHECK:      DW_TAG_formal_parameter [3]  
-CHECK:        DW_AT_location [DW_FORM_exprloc]	(<0x3> 55 93 04 )
+CHECK:        DW_AT_location [DW_FORM_exprloc]	(DW_OP_reg5 RDI, DW_OP_piece 0x4)
 CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000002c] = "argc")
 CHECK:        DW_AT_decl_file [DW_FORM_data1]       ("/Inputs{{[/\\]}}basic1.c")
 CHECK:        DW_AT_type [DW_FORM_ref_addr] (0x00000000000000a1)
 CHECK:      DW_TAG_formal_parameter [4]  
-CHECK:        DW_AT_location [DW_FORM_exprloc]	(<0x1> 54 )
+CHECK:        DW_AT_location [DW_FORM_exprloc]	(DW_OP_reg4 RSI)
 CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000031] = "argv")
 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0060 => {0x00000060})
 CHECK:      NULL
@@ -55,11 +55,11 @@ CHECK:    DW_TAG_base_type [7]
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000044] = "int")
 CHECK:    DW_TAG_variable [8]  
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000048] = "baz")
-CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 00 10 00 00 01 00 00 00 )
+CHECK:      DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x100001000)
 CHECK:    DW_TAG_variable [8]  
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000004c] = "private_int")
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
-CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 08 10 00 00 01 00 00 00 )
+CHECK:      DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x100001008)
 CHECK:    DW_TAG_subprogram [9]  
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000058] = "inc")
 CHECK:      DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
@@ -67,13 +67,14 @@ CHECK:      DW_AT_inline [DW_FORM_data1]
 CHECK:    DW_TAG_subprogram [10] *
 CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f50)
 CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x00000037)
-CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(DW_OP_reg6 RBP)
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000005c] = "foo")
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
 CHECK:      DW_AT_prototyped [DW_FORM_flag_present]	(true)
 CHECK:      DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
 CHECK:      DW_TAG_formal_parameter [11]
-CHECK:        DW_AT_location [DW_FORM_sec_offset]   (0x00000000)
+CHECK:        DW_AT_location [DW_FORM_sec_offset]   (0x00000000
+CHECK:          0x0000000000000000 - 0x000000000000000c: DW_OP_reg5 RDI, DW_OP_piece 0x4)
 CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000060] = "arg")
 CHECK:        DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
 CHECK:      DW_TAG_inlined_subroutine [12]  
@@ -94,7 +95,7 @@ CHECK:    DW_AT_high_pc [DW_FORM_data4]
 CHECK:    DW_TAG_variable [13]  
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000006d] = "val")
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
-CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 04 10 00 00 01 00 00 00 )
+CHECK:      DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x100001004)
 CHECK:    DW_TAG_volatile_type [14]  
 CHECK:    DW_TAG_subprogram [15]  
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000058] = "inc")
@@ -102,10 +103,12 @@ CHECK:      DW_AT_inline [DW_FORM_data1]
 CHECK:    DW_TAG_subprogram [2] *
 CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f90)
 CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x00000024)
-CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(DW_OP_reg6 RBP)
 CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000071] = "bar")
 CHECK:      DW_TAG_formal_parameter [16]
-CHECK:        DW_AT_location [DW_FORM_sec_offset]   (0x00000025)
+CHECK:        DW_AT_location [DW_FORM_sec_offset]   (0x00000025
+CHECK:          0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
+CHECK:          0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4)
 CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000060] = "arg")
 CHECK:      DW_TAG_inlined_subroutine [17]  
 CHECK:        DW_AT_abstract_origin [DW_FORM_ref4]	(cu + 0x0044 => {0x0000015f} "inc")
@@ -118,17 +121,13 @@ CHECK:    NULL
 
 
 CHECK: .debug_loc contents:
-CHECK-NEXT: 0x00000000: Beginning address offset: 0x0000000000000000
-CHECK-NEXT:                Ending address offset: 0x000000000000000c
-CHECK-NEXT:                 Location description: 55 93 04
-CHECK-NEXT: {{^$}}
-CHECK-NEXT: 0x00000025: Beginning address offset: 0x0000000000000000
-CHECK-NEXT:                Ending address offset: 0x000000000000000f
-CHECK-NEXT:                 Location description: 55 93 04 
-CHECK-NEXT: {{^$}}
-CHECK-NEXT:             Beginning address offset: 0x0000000000000019
-CHECK-NEXT:                Ending address offset: 0x000000000000001d
-CHECK-NEXT:                 Location description: 55 93 04 
+CHECK-NEXT: 0x00000000:
+CHECK-NEXT:              0x0000000000000000 - 0x000000000000000c: DW_OP_reg5 RDI, DW_OP_piece 0x4
+CHECK-NOT: :
+CHECK:      0x00000025:
+CHECK-NEXT:              0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
+CHECK-NEXT:              0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4
+
 
 CHECK: .debug_aranges contents:
 CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00

Modified: llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test (original)
+++ llvm/trunk/test/tools/dsymutil/X86/basic-lto-linking-x86.test Tue Aug 29 14:41:21 2017
@@ -24,15 +24,15 @@ CHECK:      DW_AT_external [DW_FORM_flag
 CHECK:      DW_AT_accessibility [DW_FORM_data1]	(DW_ACCESS_public)
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f40)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]     (0x0000000100000f4b)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 CHECK:      DW_TAG_formal_parameter [3]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000056] = "argc")
 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0063 => {0x00000063})
-CHECK:        DW_AT_location [DW_FORM_block1]	(<0x03> 55 93 04 )
+CHECK:        DW_AT_location [DW_FORM_block1]	(DW_OP_reg5 RDI, DW_OP_piece 0x4)
 CHECK:      DW_TAG_formal_parameter [3]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000005b] = "argv")
 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x006a => {0x0000006a})
-CHECK:        DW_AT_location [DW_FORM_block1]	(<0x01> 54 )
+CHECK:        DW_AT_location [DW_FORM_block1]	(DW_OP_reg4 RSI)
 CHECK:      NULL
 CHECK:    DW_TAG_base_type [4]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000060] = "int")
@@ -62,21 +62,22 @@ CHECK:    DW_TAG_variable [7]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000072] = "private_int")
 CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
-CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 )
+CHECK:      DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001008)
 CHECK:    DW_TAG_variable [7]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000007e] = "baz")
 CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
-CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 00 10 00 00 01 00 00 00 )
+CHECK:      DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001000)
 CHECK:    DW_TAG_subprogram [8] *
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000082] = "foo")
 CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f50)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f89)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 CHECK:      DW_TAG_formal_parameter [9]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
 CHECK:        DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
-CHECK:        DW_AT_location [DW_FORM_data4]        (0x00000000)
+CHECK:        DW_AT_location [DW_FORM_data4]        (0x00000000
+CHECK:          0x0000000000000000 - 0x000000000000000e: DW_OP_reg5 RDI, DW_OP_piece 0x4)
 CHECK:      DW_TAG_inlined_subroutine [10]
 CHECK:        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x00a7 => {0x00000128} "inc")
 CHECK:        DW_AT_low_pc [DW_FORM_addr]   (0x0000000100000f63)
@@ -101,7 +102,7 @@ CHECK:    DW_TAG_variable [12]
 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000097] = "val")
 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x003c => {0x00000176})
 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
-CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 )
+CHECK:      DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001004)
 CHECK:    DW_TAG_volatile_type [13]
 CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
 CHECK:    DW_TAG_subprogram [8] *
@@ -109,11 +110,13 @@ CHECK:      DW_AT_name [DW_FORM_strp]
 CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f90)
 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000fb4)
-CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
+CHECK:      DW_AT_frame_base [DW_FORM_block1]	(DW_OP_reg6 RBP)
 CHECK:      DW_TAG_formal_parameter [9]
 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
 CHECK:        DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
-CHECK:        DW_AT_location [DW_FORM_data4]        (0x00000025)
+CHECK:        DW_AT_location [DW_FORM_data4]        (0x00000025
+CHECK:          0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
+CHECK:          0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4)
 CHECK:      DW_TAG_lexical_block [14] *
 CHECK:        DW_AT_low_pc [DW_FORM_addr]   (0x0000000100000f94)
 CHECK:        DW_AT_high_pc [DW_FORM_addr]  (0x0000000100000fa7)
@@ -129,18 +132,13 @@ CHECK:      DW_AT_name [DW_FORM_strp]
 CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
 CHECK:    NULL
 
-CHECK:.debug_loc contents:
-CHECK-NEXT: 0x00000000: Beginning address offset: 0x0000000000000000
-CHECK-NEXT:                Ending address offset: 0x000000000000000e
-CHECK-NEXT:                 Location description: 55 93 04 
-CHECK-NEXT: {{^$}}
-CHECK-NEXT: 0x00000025: Beginning address offset: 0x0000000000000000
-CHECK-NEXT:                Ending address offset: 0x000000000000000f
-CHECK-NEXT:                 Location description: 55 93 04 
-CHECK-NEXT: {{^$}}
-CHECK-NEXT:             Beginning address offset: 0x0000000000000019
-CHECK-NEXT:                Ending address offset: 0x000000000000001d
-CHECK-NEXT:                 Location description: 55 93 04 
+CHECK: .debug_loc contents:
+CHECK-NEXT: 0x00000000:
+CHECK-NEXT:              0x0000000000000000 - 0x000000000000000e: DW_OP_reg5 RDI, DW_OP_piece 0x4
+CHECK-NOT: :
+CHECK:      0x00000025:
+CHECK-NEXT:              0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
+CHECK-NEXT:              0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4
 
 CHECK: .debug_aranges contents:
 CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00

Modified: llvm/trunk/test/tools/dsymutil/X86/common-sym.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/common-sym.test?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/common-sym.test (original)
+++ llvm/trunk/test/tools/dsymutil/X86/common-sym.test Tue Aug 29 14:41:21 2017
@@ -11,7 +11,7 @@ $ clang common.macho.x86_64.o -o common.
 CHECK:   DW_TAG_variable
 CHECK:     DW_AT_name {{.*}} "common"
 CHECK-NOT: {{NULL|DW_TAG}}
-CHECK:     DW_AT_location {{.*}} (<0x09> 03 00 10 00 00 01 00 00 00 )
+CHECK:     DW_AT_location {{.*}} (DW_OP_addr 0x100001000)
 
 CHECK:   DW_TAG_subprogram
 CHECK-NEXT:     DW_AT_low_pc{{.*}}(0x0000000100000f80)

Modified: llvm/trunk/tools/llvm-dwarfdump/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/CMakeLists.txt?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-dwarfdump/CMakeLists.txt Tue Aug 29 14:41:21 2017
@@ -1,5 +1,8 @@
 set(LLVM_LINK_COMPONENTS
   DebugInfoDWARF
+  AllTargetsDescs
+  AllTargetsInfos
+  MC
   Object
   Support
   )

Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=312042&r1=312041&r2=312042&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Tue Aug 29 14:41:21 2017
@@ -26,6 +26,7 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cstring>
@@ -94,7 +95,9 @@ static void error(StringRef Filename, st
 }
 
 static void DumpObjectFile(ObjectFile &Obj, Twine Filename) {
-  std::unique_ptr<DIContext> DICtx = DWARFContext::create(Obj);
+  std::unique_ptr<DWARFContext> DICtx = DWARFContext::create(Obj);
+  logAllUnhandledErrors(DICtx->loadRegisterInfo(Obj), errs(),
+                        Filename.str() + ": ");
 
   outs() << Filename.str() << ":\tfile format " << Obj.getFileFormatName()
          << "\n\n";
@@ -209,6 +212,9 @@ int main(int argc, char **argv) {
   PrettyStackTraceProgram X(argc, argv);
   llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
 
+  llvm::InitializeAllTargetInfos();
+  llvm::InitializeAllTargetMCs();
+
   cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n");
 
   // Defaults to a.out if no filenames specified.




More information about the llvm-commits mailing list