Changeset View
Changeset View
Standalone View
Standalone View
lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
Context not available. | |||||
#include "DbgValueHistoryCalculator.h" | #include "DbgValueHistoryCalculator.h" | ||||
#include "llvm/CodeGen/MachineBasicBlock.h" | #include "llvm/CodeGen/MachineBasicBlock.h" | ||||
#include "llvm/CodeGen/MachineFunction.h" | #include "llvm/CodeGen/MachineFunction.h" | ||||
#include "llvm/IR/DebugInfo.h" | |||||
#include "llvm/Support/Debug.h" | #include "llvm/Support/Debug.h" | ||||
#include "llvm/Target/TargetRegisterInfo.h" | #include "llvm/Target/TargetRegisterInfo.h" | ||||
Context not available. | |||||
assert(MI.getNumOperands() > 1 && "Invalid machine instruction!"); | assert(MI.getNumOperands() > 1 && "Invalid machine instruction!"); | ||||
// Keep track of user variables. | // Keep track of user variables. | ||||
const MDNode *Var = MI.getDebugVariable(); | DIVariable Var = MI.getDebugVariable(); | ||||
// Variable is in a register, we need to check for clobbers. | // Variable is in a register, we need to check for clobbers. | ||||
if (isDbgValueInDefinedReg(&MI)) | if (isDbgValueInDefinedReg(&MI)) | ||||
LiveUserVar[MI.getOperand(0).getReg()] = Var; | LiveUserVar[MI.getOperand(0).getReg()] = Var; | ||||
// Check the history of this variable. | // Check the history of this variable. A variable may be fragmented | ||||
SmallVectorImpl<const MachineInstr *> &History = Result[Var]; | // into multiple pieces, but they still share one history. | ||||
DIVariable EntireVar = getEntireVariable(Var); | |||||
SmallVectorImpl<const MachineInstr *> &History = Result[EntireVar]; | |||||
if (!History.empty()) { | if (!History.empty()) { | ||||
// We have seen this variable before. Try to coalesce DBG_VALUEs. | // We have seen this variable before. Try to coalesce DBG_VALUEs. | ||||
const MachineInstr *Prev = History.back(); | const MachineInstr *Prev = History.back(); | ||||
Context not available. | |||||
LiveUserVar[Reg] = nullptr; | LiveUserVar[Reg] = nullptr; | ||||
// Was MD last defined by a DBG_VALUE referring to Reg? | // Was MD last defined by a DBG_VALUE referring to Reg? | ||||
auto HistI = Result.find(Var); | DIVariable EntireVar = getEntireVariable(DIVariable(Var)); | ||||
auto HistI = Result.find(EntireVar); | |||||
if (HistI == Result.end()) | if (HistI == Result.end()) | ||||
continue; | continue; | ||||
SmallVectorImpl<const MachineInstr *> &History = HistI->second; | SmallVectorImpl<const MachineInstr *> &History = HistI->second; | ||||
Context not available. |