[Layering] Move DebugLoc.h into the IR library. The implementation
authorChandler Carruth <chandlerc@gmail.com>
Wed, 5 Mar 2014 10:30:38 +0000 (10:30 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 5 Mar 2014 10:30:38 +0000 (10:30 +0000)
already lived there and it is where it belongs -- this is the in-memory
debug location representation.

This is just cleanup -- Modules can actually cope with this, but that
doesn't make it right. After chatting with folks that have out-of-tree
stuff, going ahead and moving the rest of the headers seems preferable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202960 91177308-0d34-0410-b5e6-96231b3b80d8

17 files changed:
include/llvm/CodeGen/GCMetadata.h
include/llvm/CodeGen/LexicalScopes.h
include/llvm/CodeGen/MachineCodeEmitter.h
include/llvm/CodeGen/MachineFunction.h
include/llvm/CodeGen/MachineInstr.h
include/llvm/CodeGen/MachineModuleInfo.h
include/llvm/CodeGen/SelectionDAGNodes.h
include/llvm/ExecutionEngine/JITEventListener.h
include/llvm/IR/DebugLoc.h [new file with mode: 0644]
include/llvm/IR/Instruction.h
include/llvm/Support/DebugLoc.h [deleted file]
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
lib/IR/DebugLoc.cpp
lib/Transforms/Instrumentation/GCOVProfiling.cpp

index 1070d29f73814a57c081bd22f0f2f6e0dbff5101..ea9454259ef3392095e9018cd4c875fd5f5c382a 100644 (file)
@@ -35,8 +35,8 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/Pass.h"
-#include "llvm/Support/DebugLoc.h"
 
 namespace llvm {
   class AsmPrinter;
index bfa787dbe591b01f6752ba146f2b9a450598b1d0..e0593f80ff94e4821dc80acf8865cd1e1a357d2e 100644 (file)
@@ -21,9 +21,9 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/ValueHandle.h"
-#include "llvm/Support/DebugLoc.h"
 #include <utility>
 namespace llvm {
 
index 9e41e6e9c1ee8c343bf17ed9c98b56fe802e1445..f729cedde4c16a9fc6bb64ae78b1edd268ba5ffb 100644 (file)
@@ -17,8 +17,8 @@
 #ifndef LLVM_CODEGEN_MACHINECODEEMITTER_H
 #define LLVM_CODEGEN_MACHINECODEEMITTER_H
 
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/DebugLoc.h"
 #include <string>
 
 namespace llvm {
index 09cc1e5dfb897f7bd70d51a206a26cb1bdd22777..652d63dbbf8efe47a62c10960299a7e841c04a0a 100644 (file)
@@ -20,9 +20,9 @@
 
 #include "llvm/ADT/ilist.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ArrayRecycler.h"
-#include "llvm/Support/DebugLoc.h"
 #include "llvm/Support/Recycler.h"
 
 namespace llvm {
index ba38e887ba5d86f73420742aaebab2983bcf5d2a..ff87a48efdb36b4bda9342dda4f7f8a7ce9cb190 100644 (file)
 #include "llvm/ADT/ilist.h"
 #include "llvm/ADT/ilist_node.h"
 #include "llvm/CodeGen/MachineOperand.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/InlineAsm.h"
 #include "llvm/MC/MCInstrDesc.h"
 #include "llvm/Support/ArrayRecycler.h"
-#include "llvm/Support/DebugLoc.h"
 #include "llvm/Target/TargetOpcodes.h"
 
 namespace llvm {
index b51020654af558267e05629114433a44597d5f36..c6bdd33cbc433ab4d08545e85bda0d5a55cb46a2 100644 (file)
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/ValueHandle.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MachineLocation.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/DebugLoc.h"
 #include "llvm/Support/Dwarf.h"
 
 namespace llvm {
index 00750f78fc0fd765883ebc6c29884be64388ac37..072b6af4d705e2ab41d903111921bbea2d2f4a79 100644 (file)
@@ -29,9 +29,9 @@
 #include "llvm/CodeGen/MachineMemOperand.h"
 #include "llvm/CodeGen/ValueTypes.h"
 #include "llvm/IR/Constants.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/DebugLoc.h"
 #include "llvm/Support/MathExtras.h"
 #include <cassert>
 
index ed66102d4696524f051b1f2c8dfc0fb0af77622d..8daf2bdacff5f01b2e5e851d1aac93109a285bbf 100644 (file)
@@ -16,8 +16,8 @@
 #define LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
 
 #include "llvm/Config/llvm-config.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/DebugLoc.h"
 #include <vector>
 
 namespace llvm {
diff --git a/include/llvm/IR/DebugLoc.h b/include/llvm/IR/DebugLoc.h
new file mode 100644 (file)
index 0000000..50b5d54
--- /dev/null
@@ -0,0 +1,120 @@
+//===- DebugLoc.h - Debug Location Information ------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines a number of light weight data structures used
+// to describe and track debug location information.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_IR_DEBUGLOC_H
+#define LLVM_IR_DEBUGLOC_H
+
+#include "llvm/Support/DataTypes.h"
+
+namespace llvm {
+  template <typename T> struct DenseMapInfo;
+  class MDNode;
+  class LLVMContext;
+
+  /// DebugLoc - Debug location id.  This is carried by Instruction, SDNode,
+  /// and MachineInstr to compactly encode file/line/scope information for an
+  /// operation.
+  class DebugLoc {
+    friend struct DenseMapInfo<DebugLoc>;
+
+    /// getEmptyKey() - A private constructor that returns an unknown that is
+    /// not equal to the tombstone key or DebugLoc().
+    static DebugLoc getEmptyKey() {
+      DebugLoc DL;
+      DL.LineCol = 1;
+      return DL;
+    }
+
+    /// getTombstoneKey() - A private constructor that returns an unknown that
+    /// is not equal to the empty key or DebugLoc().
+    static DebugLoc getTombstoneKey() {
+      DebugLoc DL;
+      DL.LineCol = 2;
+      return DL;
+    }
+
+    /// LineCol - This 32-bit value encodes the line and column number for the
+    /// location, encoded as 24-bits for line and 8 bits for col.  A value of 0
+    /// for either means unknown.
+    uint32_t LineCol;
+
+    /// ScopeIdx - This is an opaque ID# for Scope/InlinedAt information,
+    /// decoded by LLVMContext.  0 is unknown.
+    int ScopeIdx;
+  public:
+    DebugLoc() : LineCol(0), ScopeIdx(0) {}  // Defaults to unknown.
+
+    /// get - Get a new DebugLoc that corresponds to the specified line/col
+    /// scope/inline location.
+    static DebugLoc get(unsigned Line, unsigned Col,
+                        MDNode *Scope, MDNode *InlinedAt = 0);
+
+    /// getFromDILocation - Translate the DILocation quad into a DebugLoc.
+    static DebugLoc getFromDILocation(MDNode *N);
+
+    /// getFromDILexicalBlock - Translate the DILexicalBlock into a DebugLoc.
+    static DebugLoc getFromDILexicalBlock(MDNode *N);
+
+    /// isUnknown - Return true if this is an unknown location.
+    bool isUnknown() const { return ScopeIdx == 0; }
+
+    unsigned getLine() const {
+      return (LineCol << 8) >> 8;  // Mask out column.
+    }
+
+    unsigned getCol() const {
+      return LineCol >> 24;
+    }
+
+    /// getScope - This returns the scope pointer for this DebugLoc, or null if
+    /// invalid.
+    MDNode *getScope(const LLVMContext &Ctx) const;
+
+    /// getInlinedAt - This returns the InlinedAt pointer for this DebugLoc, or
+    /// null if invalid or not present.
+    MDNode *getInlinedAt(const LLVMContext &Ctx) const;
+
+    /// getScopeAndInlinedAt - Return both the Scope and the InlinedAt values.
+    void getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA,
+                              const LLVMContext &Ctx) const;
+
+    /// getScopeNode - Get MDNode for DebugLoc's scope, or null if invalid.
+    MDNode *getScopeNode(const LLVMContext &Ctx) const;
+
+    // getFnDebugLoc - Walk up the scope chain of given debug loc and find line
+    // number info for the function.
+    DebugLoc getFnDebugLoc(const LLVMContext &Ctx);
+
+    /// getAsMDNode - This method converts the compressed DebugLoc node into a
+    /// DILocation compatible MDNode.
+    MDNode *getAsMDNode(const LLVMContext &Ctx) const;
+
+    bool operator==(const DebugLoc &DL) const {
+      return LineCol == DL.LineCol && ScopeIdx == DL.ScopeIdx;
+    }
+    bool operator!=(const DebugLoc &DL) const { return !(*this == DL); }
+
+    void dump(const LLVMContext &Ctx) const;
+  };
+
+  template <>
+  struct DenseMapInfo<DebugLoc> {
+    static DebugLoc getEmptyKey() { return DebugLoc::getEmptyKey(); }
+    static DebugLoc getTombstoneKey() { return DebugLoc::getTombstoneKey(); }
+    static unsigned getHashValue(const DebugLoc &Key);
+    static bool isEqual(DebugLoc LHS, DebugLoc RHS) { return LHS == RHS; }
+  };
+} // end namespace llvm
+
+#endif /* LLVM_SUPPORT_DEBUGLOC_H */
index 8ba8b9c4f1afb74828cb3dbe894769a3c1e9d412..10742f153b5724c6ba7214bc19858cf21c2ba3c8 100644 (file)
@@ -17,8 +17,8 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/ilist_node.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/User.h"
-#include "llvm/Support/DebugLoc.h"
 
 namespace llvm {
 
diff --git a/include/llvm/Support/DebugLoc.h b/include/llvm/Support/DebugLoc.h
deleted file mode 100644 (file)
index f6cd19a..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-//===---- llvm/Support/DebugLoc.h - Debug Location Information --*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines a number of light weight data structures used
-// to describe and track debug location information.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_DEBUGLOC_H
-#define LLVM_SUPPORT_DEBUGLOC_H
-
-#include "llvm/Support/DataTypes.h"
-
-namespace llvm {
-  template <typename T> struct DenseMapInfo;
-  class MDNode;
-  class LLVMContext;
-
-  /// DebugLoc - Debug location id.  This is carried by Instruction, SDNode,
-  /// and MachineInstr to compactly encode file/line/scope information for an
-  /// operation.
-  class DebugLoc {
-    friend struct DenseMapInfo<DebugLoc>;
-
-    /// getEmptyKey() - A private constructor that returns an unknown that is
-    /// not equal to the tombstone key or DebugLoc().
-    static DebugLoc getEmptyKey() {
-      DebugLoc DL;
-      DL.LineCol = 1;
-      return DL;
-    }
-
-    /// getTombstoneKey() - A private constructor that returns an unknown that
-    /// is not equal to the empty key or DebugLoc().
-    static DebugLoc getTombstoneKey() {
-      DebugLoc DL;
-      DL.LineCol = 2;
-      return DL;
-    }
-
-    /// LineCol - This 32-bit value encodes the line and column number for the
-    /// location, encoded as 24-bits for line and 8 bits for col.  A value of 0
-    /// for either means unknown.
-    uint32_t LineCol;
-
-    /// ScopeIdx - This is an opaque ID# for Scope/InlinedAt information,
-    /// decoded by LLVMContext.  0 is unknown.
-    int ScopeIdx;
-  public:
-    DebugLoc() : LineCol(0), ScopeIdx(0) {}  // Defaults to unknown.
-
-    /// get - Get a new DebugLoc that corresponds to the specified line/col
-    /// scope/inline location.
-    static DebugLoc get(unsigned Line, unsigned Col,
-                        MDNode *Scope, MDNode *InlinedAt = 0);
-
-    /// getFromDILocation - Translate the DILocation quad into a DebugLoc.
-    static DebugLoc getFromDILocation(MDNode *N);
-
-    /// getFromDILexicalBlock - Translate the DILexicalBlock into a DebugLoc.
-    static DebugLoc getFromDILexicalBlock(MDNode *N);
-
-    /// isUnknown - Return true if this is an unknown location.
-    bool isUnknown() const { return ScopeIdx == 0; }
-
-    unsigned getLine() const {
-      return (LineCol << 8) >> 8;  // Mask out column.
-    }
-
-    unsigned getCol() const {
-      return LineCol >> 24;
-    }
-
-    /// getScope - This returns the scope pointer for this DebugLoc, or null if
-    /// invalid.
-    MDNode *getScope(const LLVMContext &Ctx) const;
-
-    /// getInlinedAt - This returns the InlinedAt pointer for this DebugLoc, or
-    /// null if invalid or not present.
-    MDNode *getInlinedAt(const LLVMContext &Ctx) const;
-
-    /// getScopeAndInlinedAt - Return both the Scope and the InlinedAt values.
-    void getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA,
-                              const LLVMContext &Ctx) const;
-
-    /// getScopeNode - Get MDNode for DebugLoc's scope, or null if invalid.
-    MDNode *getScopeNode(const LLVMContext &Ctx) const;
-
-    // getFnDebugLoc - Walk up the scope chain of given debug loc and find line
-    // number info for the function.
-    DebugLoc getFnDebugLoc(const LLVMContext &Ctx);
-
-    /// getAsMDNode - This method converts the compressed DebugLoc node into a
-    /// DILocation compatible MDNode.
-    MDNode *getAsMDNode(const LLVMContext &Ctx) const;
-
-    bool operator==(const DebugLoc &DL) const {
-      return LineCol == DL.LineCol && ScopeIdx == DL.ScopeIdx;
-    }
-    bool operator!=(const DebugLoc &DL) const { return !(*this == DL); }
-
-    void dump(const LLVMContext &Ctx) const;
-  };
-
-  template <>
-  struct DenseMapInfo<DebugLoc> {
-    static DebugLoc getEmptyKey() { return DebugLoc::getEmptyKey(); }
-    static DebugLoc getTombstoneKey() { return DebugLoc::getTombstoneKey(); }
-    static unsigned getHashValue(const DebugLoc &Key);
-    static bool isEqual(DebugLoc LHS, DebugLoc RHS) { return LHS == RHS; }
-  };
-} // end namespace llvm
-
-#endif /* LLVM_SUPPORT_DEBUGLOC_H */
index 6fceb05be525f2b5e8f962cf94e3381c0d473d63..315544b5dfe816b77e1ff5d729cbaa07bc3ac7bb 100644 (file)
@@ -25,9 +25,9 @@
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/LexicalScopes.h"
 #include "llvm/DebugInfo.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/MC/MachineLocation.h"
 #include "llvm/Support/Allocator.h"
-#include "llvm/Support/DebugLoc.h"
 
 namespace llvm {
 
index 510ad59f5c9271c3d7470e26b2c0604163b91df4..9e3d38f7ccdd038bbee974e1917479e93e840f28 100644 (file)
@@ -23,8 +23,8 @@
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/DebugInfo.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/MC/MCStreamer.h"
-#include "llvm/Support/DebugLoc.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 
 namespace llvm {
index b47d05708785e6ce96faef56ee0cec945815c934..dbf394fb1aa28aa7bd4945f0b868e73da2ee58b7 100644 (file)
@@ -32,8 +32,8 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetFrameLowering.h"
+#include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegisterInfo.h"
index 4af7172847d7b14528db29c91960976832cdc066..b62bd623c4247ee91ba13af55c85569475e23c8c 100644 (file)
@@ -15,8 +15,8 @@
 #define LLVM_CODEGEN_SDNODEDBGVALUE_H
 
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/DebugLoc.h"
 
 namespace llvm {
 
index 44fa67eb229d0e7a21e79443bad3ba0d16425d17..e4719e4ad7ebd742f0fcf7726bd9416ccf0dbc5b 100644 (file)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/DebugLoc.h"
+#include "llvm/IR/DebugLoc.h"
 #include "LLVMContextImpl.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/DebugInfo.h"
index 5d25d55ea6297e42403ba72d1e8dbb9eefd8d9db..d36923758b104e4e5d10514df724e9aab65ce6be 100644 (file)
@@ -25,6 +25,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/UniqueVector.h"
 #include "llvm/DebugInfo.h"
+#include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/InstIterator.h"
 #include "llvm/IR/Instructions.h"
@@ -33,7 +34,6 @@
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/DebugLoc.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"