2009-06-19 22:08:58 +00:00
|
|
|
//===---- llvm/DebugLoc.h - Debug Location Information ----------*- C++ -*-===//
|
2009-01-26 07:41:49 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-06-19 22:08:58 +00:00
|
|
|
// This file defines a number of light weight data structures used
|
|
|
|
// to describe and track debug location information.
|
2009-01-28 01:19:52 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-01-26 07:41:49 +00:00
|
|
|
|
2009-06-19 22:08:58 +00:00
|
|
|
#ifndef LLVM_DEBUGLOC_H
|
|
|
|
#define LLVM_DEBUGLOC_H
|
2009-01-26 07:41:49 +00:00
|
|
|
|
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llvm {
|
2009-08-28 23:24:31 +00:00
|
|
|
class MDNode;
|
2009-01-26 07:41:49 +00:00
|
|
|
|
2009-01-28 01:19:52 +00:00
|
|
|
/// DebugLoc - Debug location id. This is carried by SDNode and MachineInstr
|
|
|
|
/// to index into a vector of unique debug location tuples.
|
2009-01-26 07:41:49 +00:00
|
|
|
class DebugLoc {
|
|
|
|
unsigned Idx;
|
|
|
|
|
|
|
|
public:
|
2009-01-27 21:15:07 +00:00
|
|
|
DebugLoc() : Idx(~0U) {} // Defaults to invalid.
|
2009-01-26 07:41:49 +00:00
|
|
|
|
2009-02-17 01:04:54 +00:00
|
|
|
static DebugLoc getUnknownLoc() { DebugLoc L; L.Idx = ~0U; return L; }
|
2009-01-26 07:41:49 +00:00
|
|
|
static DebugLoc get(unsigned idx) { DebugLoc L; L.Idx = idx; return L; }
|
|
|
|
|
2009-02-03 22:49:14 +00:00
|
|
|
unsigned getIndex() const { return Idx; }
|
|
|
|
|
2009-01-28 01:19:52 +00:00
|
|
|
/// isUnknown - Return true if there is no debug info for the SDNode /
|
|
|
|
/// MachineInstr.
|
2009-02-17 01:04:54 +00:00
|
|
|
bool isUnknown() const { return Idx == ~0U; }
|
2009-02-06 21:34:12 +00:00
|
|
|
|
2009-02-06 23:17:54 +00:00
|
|
|
bool operator==(const DebugLoc &DL) const { return Idx == DL.Idx; }
|
|
|
|
bool operator!=(const DebugLoc &DL) const { return !(*this == DL); }
|
2009-01-26 07:41:49 +00:00
|
|
|
};
|
|
|
|
|
2010-01-16 06:09:35 +00:00
|
|
|
/// DebugLocTracker - This class tracks debug location information.
|
2009-01-26 07:41:49 +00:00
|
|
|
///
|
|
|
|
struct DebugLocTracker {
|
2009-01-28 01:19:52 +00:00
|
|
|
/// DebugLocations - A vector of unique DebugLocTuple's.
|
|
|
|
///
|
2010-01-16 06:09:35 +00:00
|
|
|
std::vector<MDNode *> DebugLocations;
|
2009-01-26 07:41:49 +00:00
|
|
|
|
2009-02-11 00:18:15 +00:00
|
|
|
/// DebugIdMap - This maps DebugLocTuple's to indices into the
|
|
|
|
/// DebugLocations vector.
|
2010-01-16 06:09:35 +00:00
|
|
|
DenseMap<MDNode *, unsigned> DebugIdMap;
|
2009-01-26 07:41:49 +00:00
|
|
|
|
2009-01-26 23:47:30 +00:00
|
|
|
DebugLocTracker() {}
|
2009-01-26 07:41:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
2009-06-19 22:08:58 +00:00
|
|
|
#endif /* LLVM_DEBUGLOC_H */
|