Get rid of one more non-DebugLoc getNode and
[oota-llvm.git] / lib / CodeGen / MachineFunction.cpp
index 434034b888f04af14163def35df34cd275bc2edf..cf7f39140b8663e25daf837a8973b3001d2b7384 100644 (file)
@@ -380,11 +380,11 @@ MachineFunction& MachineFunction::get(const Function *F)
 }
 
 /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
-/// source file, line, and column. If none currently exists, create add a new
-/// new DebugLocTuple and insert it into the DebugIdMap.
+/// source file, line, and column. If none currently exists, create a new
+/// DebugLocTuple, and insert it into the DebugIdMap.
 unsigned MachineFunction::getOrCreateDebugLocID(unsigned Src, unsigned Line,
                                                 unsigned Col) {
-  struct DebugLocTuple Tuple(Src, Line, Col);
+  DebugLocTuple Tuple(Src, Line, Col);
   DenseMap<DebugLocTuple, unsigned>::iterator II
     = DebugLocInfo.DebugIdMap.find(Tuple);
   if (II != DebugLocInfo.DebugIdMap.end())
@@ -396,6 +396,14 @@ unsigned MachineFunction::getOrCreateDebugLocID(unsigned Src, unsigned Line,
   return Id;
 }
 
+/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
+DebugLocTuple MachineFunction::getDebugLocTuple(DebugLoc DL) const {
+  unsigned Idx = DL.getIndex();
+  assert(Idx < DebugLocInfo.DebugLocations.size() &&
+         "Invalid index into debug locations!");
+  return DebugLocInfo.DebugLocations[Idx];
+}
+
 //===----------------------------------------------------------------------===//
 //  MachineFrameInfo implementation
 //===----------------------------------------------------------------------===//