mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
Actually source file has already been uniquified into an id during isel. Eliminate the StringMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63009 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d0adbb5b7d
commit
c4b1abd81e
@ -14,7 +14,6 @@
|
|||||||
#define LLVM_CODEGEN_DEBUGLOC_H
|
#define LLVM_CODEGEN_DEBUGLOC_H
|
||||||
|
|
||||||
#include "llvm/ADT/DenseMap.h"
|
#include "llvm/ADT/DenseMap.h"
|
||||||
#include "llvm/ADT/StringMap.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -22,10 +21,10 @@ namespace llvm {
|
|||||||
/// DebugLocTuple - Debug location tuple of filename id, line and column.
|
/// DebugLocTuple - Debug location tuple of filename id, line and column.
|
||||||
///
|
///
|
||||||
struct DebugLocTuple {
|
struct DebugLocTuple {
|
||||||
unsigned FileId, Line, Col;
|
unsigned Src, Line, Col;
|
||||||
|
|
||||||
DebugLocTuple(unsigned fi, unsigned l, unsigned c)
|
DebugLocTuple(unsigned s, unsigned l, unsigned c)
|
||||||
: FileId(fi), Line(l), Col(c) {};
|
: Src(s), Line(l), Col(c) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DebugLoc - Debug location id. This is carried by SDNode and
|
/// DebugLoc - Debug location id. This is carried by SDNode and
|
||||||
@ -51,14 +50,14 @@ namespace llvm {
|
|||||||
return DebugLocTuple(~1U, ~1U, ~1U);
|
return DebugLocTuple(~1U, ~1U, ~1U);
|
||||||
}
|
}
|
||||||
static unsigned getHashValue(const DebugLocTuple &Val) {
|
static unsigned getHashValue(const DebugLocTuple &Val) {
|
||||||
return DenseMapInfo<unsigned>::getHashValue(Val.FileId) ^
|
return DenseMapInfo<unsigned>::getHashValue(Val.Src) ^
|
||||||
DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
|
DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
|
||||||
DenseMapInfo<unsigned>::getHashValue(Val.Col);
|
DenseMapInfo<unsigned>::getHashValue(Val.Col);
|
||||||
}
|
}
|
||||||
static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) {
|
static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) {
|
||||||
return LHS.FileId == RHS.FileId &&
|
return LHS.Src == RHS.Src &&
|
||||||
LHS.Line == RHS.Line &&
|
LHS.Line == RHS.Line &&
|
||||||
LHS.Col == RHS.Col;
|
LHS.Col == RHS.Col;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isPod() { return true; }
|
static bool isPod() { return true; }
|
||||||
@ -70,18 +69,6 @@ namespace llvm {
|
|||||||
/// DebugLocTracker - This class tracks debug location information.
|
/// DebugLocTracker - This class tracks debug location information.
|
||||||
///
|
///
|
||||||
struct DebugLocTracker {
|
struct DebugLocTracker {
|
||||||
// NumFilenames - Size of the DebugFilenames vector.
|
|
||||||
//
|
|
||||||
unsigned NumFilenames;
|
|
||||||
|
|
||||||
// DebugFilenames - A vector of unique file names.
|
|
||||||
//
|
|
||||||
std::vector<std::string> DebugFilenames;
|
|
||||||
|
|
||||||
// DebugFilenamesMap - File name to DebugFilenames index map.
|
|
||||||
//
|
|
||||||
StringMap<unsigned> DebugFilenamesMap;
|
|
||||||
|
|
||||||
// NumDebugLocations - Size of the DebugLocations vector.
|
// NumDebugLocations - Size of the DebugLocations vector.
|
||||||
unsigned NumDebugLocations;
|
unsigned NumDebugLocations;
|
||||||
|
|
||||||
@ -93,12 +80,9 @@ namespace llvm {
|
|||||||
// DebugLocations vector.
|
// DebugLocations vector.
|
||||||
DebugIdMapType DebugIdMap;
|
DebugIdMapType DebugIdMap;
|
||||||
|
|
||||||
DebugLocTracker() : NumFilenames(0), NumDebugLocations(0) {}
|
DebugLocTracker() : NumDebugLocations(0) {}
|
||||||
|
|
||||||
~DebugLocTracker() {
|
~DebugLocTracker() {
|
||||||
NumFilenames = 0;
|
|
||||||
DebugFilenames.clear();
|
|
||||||
DebugFilenamesMap.clear();
|
|
||||||
DebugLocations.clear();
|
DebugLocations.clear();
|
||||||
DebugIdMap.clear();
|
DebugIdMap.clear();
|
||||||
}
|
}
|
||||||
|
@ -312,9 +312,9 @@ public:
|
|||||||
//
|
//
|
||||||
|
|
||||||
/// lookUpDebugLocId - Look up the DebugLocTuple index with the given
|
/// lookUpDebugLocId - Look up the DebugLocTuple index with the given
|
||||||
/// filename, line, and column. It may add a new filename and / or
|
/// source file, line, and column. It may add a new filename and / or
|
||||||
/// a new DebugLocTuple.
|
/// a new DebugLocTuple.
|
||||||
unsigned lookUpDebugLocId(const char *Filename, unsigned Line, unsigned Col);
|
unsigned lookUpDebugLocId(unsigned Src, unsigned Line, unsigned Col);
|
||||||
};
|
};
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
@ -379,23 +379,11 @@ MachineFunction& MachineFunction::get(const Function *F)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// lookUpDebugLocId - Look up the DebugLocTuple index with the given
|
/// lookUpDebugLocId - Look up the DebugLocTuple index with the given
|
||||||
/// filename, line, and column. It may add a new filename and / or
|
/// source file, line, and column. It may add a new filename and / or
|
||||||
/// a new DebugLocTuple.
|
/// a new DebugLocTuple.
|
||||||
unsigned MachineFunction::lookUpDebugLocId(const char *Filename, unsigned Line,
|
unsigned MachineFunction::lookUpDebugLocId(unsigned Src, unsigned Line,
|
||||||
unsigned Col) {
|
unsigned Col) {
|
||||||
unsigned FileId;
|
struct DebugLocTuple Tuple(Src, Line, Col);
|
||||||
StringMap<unsigned>::iterator I =
|
|
||||||
DebugLocInfo.DebugFilenamesMap.find(Filename);
|
|
||||||
if (I != DebugLocInfo.DebugFilenamesMap.end())
|
|
||||||
FileId = I->second;
|
|
||||||
else {
|
|
||||||
// Add a new filename.
|
|
||||||
FileId = DebugLocInfo.NumFilenames++;
|
|
||||||
DebugLocInfo.DebugFilenames.push_back(Filename);
|
|
||||||
DebugLocInfo.DebugFilenamesMap[Filename] = FileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DebugLocTuple Tuple(FileId, Line, Col);
|
|
||||||
DebugIdMapType::iterator II = DebugLocInfo.DebugIdMap.find(Tuple);
|
DebugIdMapType::iterator II = DebugLocInfo.DebugIdMap.find(Tuple);
|
||||||
if (II != DebugLocInfo.DebugIdMap.end())
|
if (II != DebugLocInfo.DebugIdMap.end())
|
||||||
return II->second;
|
return II->second;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user