diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-15 17:06:11 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-15 17:06:11 +0000 | 
| commit | f3d15b0b3791d746d44d99b05d3bcb2e9bdf0eb3 (patch) | |
| tree | 5b6d391c72c9875f0065f0e772e872bc8544834b /lib/CodeGen/MachineModuleInfo.cpp | |
| parent | 66e41e3c6e8b8fbc48d5d3b4d2bd9ce0be4ecb75 (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/MachineModuleInfo.cpp')
| -rw-r--r-- | lib/CodeGen/MachineModuleInfo.cpp | 23 | 
1 files changed, 23 insertions, 0 deletions
| diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index 25284d6f5fcf..15778b46fe0a 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -563,3 +563,26 @@ unsigned MachineModuleInfo::getPersonalityIndex() const {    return 0;  } +namespace { +  /// VariableDebugSorter - Comparison to sort the VariableDbgInfo map +  /// by source location, to avoid depending on the arbitrary order that +  /// instruction selection visits variables in. +  struct VariableDebugSorter { +    bool operator()(const MachineModuleInfo::VariableDbgInfoMapTy::value_type &A, +                    const MachineModuleInfo::VariableDbgInfoMapTy::value_type &B) +                  const { +       if (A.second.second.getLine() != B.second.second.getLine()) +         return A.second.second.getLine() < B.second.second.getLine(); +       if (A.second.second.getCol() != B.second.second.getCol()) +         return A.second.second.getCol() < B.second.second.getCol(); +       return false; +    } +  }; +} + +MachineModuleInfo::VariableDbgInfoMapTy & +MachineModuleInfo::getVariableDbgInfo() { +  std::stable_sort(VariableDbgInfo.begin(), VariableDbgInfo.end(), +                   VariableDebugSorter()); +  return VariableDbgInfo; +} | 
