ARM: support .watchos_version_min and .tvos_version_min.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DebugLocEntry.h
index 184fb295784a6e5f5e5d321fbcf74724a74ea94e..bbe53249a08493a27dd1c28444535c82d161604c 100644 (file)
@@ -9,6 +9,8 @@
 
 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DEBUGLOCENTRY_H
 #define LLVM_LIB_CODEGEN_ASMPRINTER_DEBUGLOCENTRY_H
+
+#include "DebugLocStream.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DebugInfo.h"
@@ -17,7 +19,7 @@
 
 namespace llvm {
 class AsmPrinter;
-class MDNode;
+
 /// \brief This struct describes location entries emitted in the .debug_loc
 /// section.
 class DebugLocEntry {
@@ -28,25 +30,25 @@ class DebugLocEntry {
 public:
   /// \brief A single location or constant.
   struct Value {
-    Value(const MDNode *Expr, int64_t i)
+    Value(const DIExpression *Expr, int64_t i)
         : Expression(Expr), EntryKind(E_Integer) {
       Constant.Int = i;
     }
-    Value(const MDNode *Expr, const ConstantFP *CFP)
+    Value(const DIExpression *Expr, const ConstantFP *CFP)
         : Expression(Expr), EntryKind(E_ConstantFP) {
       Constant.CFP = CFP;
     }
-    Value(const MDNode *Expr, const ConstantInt *CIP)
+    Value(const DIExpression *Expr, const ConstantInt *CIP)
         : Expression(Expr), EntryKind(E_ConstantInt) {
       Constant.CIP = CIP;
     }
-    Value(const MDNode *Expr, MachineLocation Loc)
+    Value(const DIExpression *Expr, MachineLocation Loc)
         : Expression(Expr), EntryKind(E_Location), Loc(Loc) {
-      assert(cast<MDExpression>(Expr)->isValid());
+      assert(cast<DIExpression>(Expr)->isValid());
     }
 
     /// Any complex address location expression for this Value.
-    const MDNode *Expression;
+    const DIExpression *Expression;
 
     /// Type of entry that this represents.
     enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt };
@@ -71,9 +73,7 @@ public:
     const ConstantInt *getConstantInt() const { return Constant.CIP; }
     MachineLocation getLoc() const { return Loc; }
     bool isBitPiece() const { return getExpression()->isBitPiece(); }
-    DIExpression getExpression() const {
-      return cast_or_null<MDExpression>(Expression);
-    }
+    const DIExpression *getExpression() const { return Expression; }
     friend bool operator==(const Value &, const Value &);
     friend bool operator<(const Value &, const Value &);
   };
@@ -82,8 +82,6 @@ private:
   /// A nonempty list of locations/constants belonging to this entry,
   /// sorted by offset.
   SmallVector<Value, 1> Values;
-  SmallString<8> DWARFBytes;
-  SmallVector<std::string, 1> Comments;
 
 public:
   DebugLocEntry(const MCSymbol *B, const MCSymbol *E, Value Val)
@@ -97,9 +95,8 @@ public:
   /// Return true if the merge was successful.
   bool MergeValues(const DebugLocEntry &Next) {
     if (Begin == Next.Begin) {
-      DIExpression Expr = cast_or_null<MDExpression>(Values[0].Expression);
-      DIExpression NextExpr =
-          cast_or_null<MDExpression>(Next.Values[0].Expression);
+      auto *Expr = cast_or_null<DIExpression>(Values[0].Expression);
+      auto *NextExpr = cast_or_null<DIExpression>(Next.Values[0].Expression);
       if (Expr->isBitPiece() && NextExpr->isBitPiece()) {
         addValues(Next.Values);
         End = Next.End;
@@ -146,12 +143,8 @@ public:
   }
 
   /// \brief Lower this entry into a DWARF expression.
-  void finalize(const AsmPrinter &AP, const MDBasicType *TypeIdentifierMap);
-
-  /// \brief Return the lowered DWARF expression.
-  StringRef getDWARFBytes() const { return DWARFBytes; }
-  /// \brief Return the assembler comments for the lowered DWARF expression.
-  const SmallVectorImpl<std::string> &getComments() const { return Comments; }
+  void finalize(const AsmPrinter &AP, DebugLocStream::ListBuilder &List,
+                const DIBasicType *BT);
 };
 
 /// \brief Compare two Values for equality.