mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Make the order in which variables are described in debug information
independent of the order that isel happens to visit the dbg_declare intrinsics. This fixes a bug in which the formal arguments were being printed in reverse order, now that fast isel is going bottom up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108369 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user