mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
CodeGen: Assert that inlined-at locations agree
As a follow-up to r234021, assert that a debug info intrinsic variable's `MDLocalVariable::getInlinedAt()` always matches the `MDLocation::getInlinedAt()` of its `!dbg` attachment. The goal here is to get rid of `MDLocalVariable::getInlinedAt()` entirely (PR22778), but I'll let these assertions bake for a while first. If you have an out-of-tree backend that just broke, you're probably attaching the wrong `DebugLoc` to a `DBG_VALUE` instruction. The one you want is the location that was attached to the corresponding `@llvm.dbg.declare` or `@llvm.dbg.value` call that you started with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234038 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -357,6 +357,8 @@ inline MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL,
|
|||||||
const MDNode *Variable, const MDNode *Expr) {
|
const MDNode *Variable, const MDNode *Expr) {
|
||||||
assert(DIVariable(Variable).Verify() && "not a DIVariable");
|
assert(DIVariable(Variable).Verify() && "not a DIVariable");
|
||||||
assert(DIExpression(Expr)->isValid() && "not a DIExpression");
|
assert(DIExpression(Expr)->isValid() && "not a DIExpression");
|
||||||
|
assert(DIVariable(Variable)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
if (IsIndirect)
|
if (IsIndirect)
|
||||||
return BuildMI(MF, DL, MCID)
|
return BuildMI(MF, DL, MCID)
|
||||||
.addReg(Reg, RegState::Debug)
|
.addReg(Reg, RegState::Debug)
|
||||||
|
@ -1587,6 +1587,14 @@ public:
|
|||||||
|
|
||||||
Metadata *getRawInlinedAt() const { return getOperand(4); }
|
Metadata *getRawInlinedAt() const { return getOperand(4); }
|
||||||
|
|
||||||
|
/// \brief Check that a location is valid for this variable.
|
||||||
|
///
|
||||||
|
/// Check that \c DL has the same inlined-at location as this variable,
|
||||||
|
/// making them valid for the same \a DbgInfoIntrinsic.
|
||||||
|
bool isValidLocationForIntrinsic(const MDLocation *DL) const {
|
||||||
|
return getInlinedAt() == (DL ? DL->getInlinedAt() : nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Get an inlined version of this variable.
|
/// \brief Get an inlined version of this variable.
|
||||||
///
|
///
|
||||||
/// Returns a version of this with \a getAlinedAt() set to \c InlinedAt.
|
/// Returns a version of this with \a getAlinedAt() set to \c InlinedAt.
|
||||||
|
@ -204,6 +204,8 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
|
|||||||
// as index into History. The full variables including the
|
// as index into History. The full variables including the
|
||||||
// piece expressions are attached to the MI.
|
// piece expressions are attached to the MI.
|
||||||
DIVariable Var = MI.getDebugVariable();
|
DIVariable Var = MI.getDebugVariable();
|
||||||
|
assert(Var->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
|
|
||||||
if (unsigned PrevReg = Result.getRegisterForVar(Var))
|
if (unsigned PrevReg = Result.getRegisterForVar(Var))
|
||||||
dropRegDescribedVar(RegVars, PrevReg, Var);
|
dropRegDescribedVar(RegVars, PrevReg, Var);
|
||||||
|
@ -734,6 +734,8 @@ void DwarfDebug::collectVariableInfoFromMMITable(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
DIVariable DV(VI.Var);
|
DIVariable DV(VI.Var);
|
||||||
|
assert(DV->isValidLocationForIntrinsic(VI.Loc) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
DIExpression Expr(VI.Expr);
|
DIExpression Expr(VI.Expr);
|
||||||
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
|
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
|
||||||
auto RegVar = make_unique<DbgVariable>(DV, Expr, this, VI.Slot);
|
auto RegVar = make_unique<DbgVariable>(DV, Expr, this, VI.Slot);
|
||||||
|
@ -1232,6 +1232,8 @@ void InlineSpiller::spillAroundUses(unsigned Reg) {
|
|||||||
DebugLoc DL = MI->getDebugLoc();
|
DebugLoc DL = MI->getDebugLoc();
|
||||||
DEBUG(dbgs() << "Modifying debug info due to spill:" << "\t" << *MI);
|
DEBUG(dbgs() << "Modifying debug info due to spill:" << "\t" << *MI);
|
||||||
MachineBasicBlock *MBB = MI->getParent();
|
MachineBasicBlock *MBB = MI->getParent();
|
||||||
|
assert(DIVariable(Var)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
BuildMI(*MBB, MBB->erase(MI), DL, TII.get(TargetOpcode::DBG_VALUE))
|
BuildMI(*MBB, MBB->erase(MI), DL, TII.get(TargetOpcode::DBG_VALUE))
|
||||||
.addFrameIndex(StackSlot)
|
.addFrameIndex(StackSlot)
|
||||||
.addImm(Offset)
|
.addImm(Offset)
|
||||||
|
@ -269,12 +269,6 @@ public:
|
|||||||
void emitDebugValues(VirtRegMap *VRM,
|
void emitDebugValues(VirtRegMap *VRM,
|
||||||
LiveIntervals &LIS, const TargetInstrInfo &TRI);
|
LiveIntervals &LIS, const TargetInstrInfo &TRI);
|
||||||
|
|
||||||
/// findDebugLoc - Return DebugLoc used for this DBG_VALUE instruction. A
|
|
||||||
/// variable may have more than one corresponding DBG_VALUE instructions.
|
|
||||||
/// Only first one needs DebugLoc to identify variable's lexical scope
|
|
||||||
/// in source file.
|
|
||||||
DebugLoc findDebugLoc();
|
|
||||||
|
|
||||||
/// getDebugLoc - Return DebugLoc of this UserValue.
|
/// getDebugLoc - Return DebugLoc of this UserValue.
|
||||||
DebugLoc getDebugLoc() { return dl;}
|
DebugLoc getDebugLoc() { return dl;}
|
||||||
void print(raw_ostream &, const TargetRegisterInfo *);
|
void print(raw_ostream &, const TargetRegisterInfo *);
|
||||||
@ -942,11 +936,6 @@ findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx,
|
|||||||
std::next(MachineBasicBlock::iterator(MI));
|
std::next(MachineBasicBlock::iterator(MI));
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLoc UserValue::findDebugLoc() {
|
|
||||||
DebugLoc D = dl;
|
|
||||||
dl = DebugLoc();
|
|
||||||
return D;
|
|
||||||
}
|
|
||||||
void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx,
|
void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx,
|
||||||
unsigned LocNo,
|
unsigned LocNo,
|
||||||
LiveIntervals &LIS,
|
LiveIntervals &LIS,
|
||||||
@ -955,11 +944,13 @@ void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx,
|
|||||||
MachineOperand &Loc = locations[LocNo];
|
MachineOperand &Loc = locations[LocNo];
|
||||||
++NumInsertedDebugValues;
|
++NumInsertedDebugValues;
|
||||||
|
|
||||||
|
assert(DIVariable(Variable)->isValidLocationForIntrinsic(getDebugLoc()) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
if (Loc.isReg())
|
if (Loc.isReg())
|
||||||
BuildMI(*MBB, I, findDebugLoc(), TII.get(TargetOpcode::DBG_VALUE),
|
BuildMI(*MBB, I, getDebugLoc(), TII.get(TargetOpcode::DBG_VALUE),
|
||||||
IsIndirect, Loc.getReg(), offset, Variable, Expression);
|
IsIndirect, Loc.getReg(), offset, Variable, Expression);
|
||||||
else
|
else
|
||||||
BuildMI(*MBB, I, findDebugLoc(), TII.get(TargetOpcode::DBG_VALUE))
|
BuildMI(*MBB, I, getDebugLoc(), TII.get(TargetOpcode::DBG_VALUE))
|
||||||
.addOperand(Loc)
|
.addOperand(Loc)
|
||||||
.addImm(offset)
|
.addImm(offset)
|
||||||
.addMetadata(Variable)
|
.addMetadata(Variable)
|
||||||
|
@ -301,13 +301,9 @@ void RAFast::spillVirtReg(MachineBasicBlock::iterator MI,
|
|||||||
const MDNode *Expr = DBG->getDebugExpression();
|
const MDNode *Expr = DBG->getDebugExpression();
|
||||||
bool IsIndirect = DBG->isIndirectDebugValue();
|
bool IsIndirect = DBG->isIndirectDebugValue();
|
||||||
uint64_t Offset = IsIndirect ? DBG->getOperand(1).getImm() : 0;
|
uint64_t Offset = IsIndirect ? DBG->getOperand(1).getImm() : 0;
|
||||||
DebugLoc DL;
|
DebugLoc DL = DBG->getDebugLoc();
|
||||||
if (MI == MBB->end()) {
|
assert(DIVariable(Var)->isValidLocationForIntrinsic(DL) &&
|
||||||
// If MI is at basic block end then use last instruction's location.
|
"Expected inlined-at fields to agree");
|
||||||
MachineBasicBlock::iterator EI = MI;
|
|
||||||
DL = (--EI)->getDebugLoc();
|
|
||||||
} else
|
|
||||||
DL = MI->getDebugLoc();
|
|
||||||
MachineInstr *NewDV =
|
MachineInstr *NewDV =
|
||||||
BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::DBG_VALUE))
|
BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::DBG_VALUE))
|
||||||
.addFrameIndex(FI)
|
.addFrameIndex(FI)
|
||||||
@ -877,6 +873,8 @@ void RAFast::AllocateBasicBlock() {
|
|||||||
const MDNode *Expr = MI->getDebugExpression();
|
const MDNode *Expr = MI->getDebugExpression();
|
||||||
DebugLoc DL = MI->getDebugLoc();
|
DebugLoc DL = MI->getDebugLoc();
|
||||||
MachineBasicBlock *MBB = MI->getParent();
|
MachineBasicBlock *MBB = MI->getParent();
|
||||||
|
assert(DIVariable(Var)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
MachineInstr *NewDV = BuildMI(*MBB, MBB->erase(MI), DL,
|
MachineInstr *NewDV = BuildMI(*MBB, MBB->erase(MI), DL,
|
||||||
TII->get(TargetOpcode::DBG_VALUE))
|
TII->get(TargetOpcode::DBG_VALUE))
|
||||||
.addFrameIndex(SS)
|
.addFrameIndex(SS)
|
||||||
|
@ -1131,6 +1131,8 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
|
|||||||
false);
|
false);
|
||||||
|
|
||||||
if (Op) {
|
if (Op) {
|
||||||
|
assert(DI->getVariable()->isValidLocationForIntrinsic(DbgLoc) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
if (Op->isReg()) {
|
if (Op->isReg()) {
|
||||||
Op->setIsDebug(true);
|
Op->setIsDebug(true);
|
||||||
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||||
@ -1155,6 +1157,8 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
|
|||||||
const DbgValueInst *DI = cast<DbgValueInst>(II);
|
const DbgValueInst *DI = cast<DbgValueInst>(II);
|
||||||
const MCInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
|
const MCInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
|
||||||
const Value *V = DI->getValue();
|
const Value *V = DI->getValue();
|
||||||
|
assert(DI->getVariable()->isValidLocationForIntrinsic(DbgLoc) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
if (!V) {
|
if (!V) {
|
||||||
// Currently the optimizer can produce this; insert an undef to
|
// Currently the optimizer can produce this; insert an undef to
|
||||||
// help debugging. Probably the optimizer should not do this.
|
// help debugging. Probably the optimizer should not do this.
|
||||||
|
@ -650,6 +650,8 @@ InstrEmitter::EmitDbgValue(SDDbgValue *SD,
|
|||||||
MDNode *Var = SD->getVariable();
|
MDNode *Var = SD->getVariable();
|
||||||
MDNode *Expr = SD->getExpression();
|
MDNode *Expr = SD->getExpression();
|
||||||
DebugLoc DL = SD->getDebugLoc();
|
DebugLoc DL = SD->getDebugLoc();
|
||||||
|
assert(DIVariable(Var)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
|
|
||||||
if (SD->getKind() == SDDbgValue::FRAMEIX) {
|
if (SD->getKind() == SDDbgValue::FRAMEIX) {
|
||||||
// Stack address; this needs to be lowered in target-dependent fashion.
|
// Stack address; this needs to be lowered in target-dependent fashion.
|
||||||
|
@ -5899,6 +5899,8 @@ SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,
|
|||||||
SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N,
|
SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N,
|
||||||
unsigned R, bool IsIndirect, uint64_t Off,
|
unsigned R, bool IsIndirect, uint64_t Off,
|
||||||
DebugLoc DL, unsigned O) {
|
DebugLoc DL, unsigned O) {
|
||||||
|
assert(DIVariable(Var)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
return new (Allocator) SDDbgValue(Var, Expr, N, R, IsIndirect, Off, DL, O);
|
return new (Allocator) SDDbgValue(Var, Expr, N, R, IsIndirect, Off, DL, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5906,6 +5908,8 @@ SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N,
|
|||||||
SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr,
|
SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr,
|
||||||
const Value *C, uint64_t Off,
|
const Value *C, uint64_t Off,
|
||||||
DebugLoc DL, unsigned O) {
|
DebugLoc DL, unsigned O) {
|
||||||
|
assert(DIVariable(Var)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
return new (Allocator) SDDbgValue(Var, Expr, C, Off, DL, O);
|
return new (Allocator) SDDbgValue(Var, Expr, C, Off, DL, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5913,6 +5917,8 @@ SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr,
|
|||||||
SDDbgValue *SelectionDAG::getFrameIndexDbgValue(MDNode *Var, MDNode *Expr,
|
SDDbgValue *SelectionDAG::getFrameIndexDbgValue(MDNode *Var, MDNode *Expr,
|
||||||
unsigned FI, uint64_t Off,
|
unsigned FI, uint64_t Off,
|
||||||
DebugLoc DL, unsigned O) {
|
DebugLoc DL, unsigned O) {
|
||||||
|
assert(DIVariable(Var)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
return new (Allocator) SDDbgValue(Var, Expr, FI, Off, DL, O);
|
return new (Allocator) SDDbgValue(Var, Expr, FI, Off, DL, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,12 +1000,14 @@ void SelectionDAGBuilder::resolveDanglingDebugInfo(const Value *V,
|
|||||||
unsigned DbgSDNodeOrder = DDI.getSDNodeOrder();
|
unsigned DbgSDNodeOrder = DDI.getSDNodeOrder();
|
||||||
MDLocalVariable *Variable = DI->getVariable();
|
MDLocalVariable *Variable = DI->getVariable();
|
||||||
MDExpression *Expr = DI->getExpression();
|
MDExpression *Expr = DI->getExpression();
|
||||||
|
assert(Variable->isValidLocationForIntrinsic(dl) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
uint64_t Offset = DI->getOffset();
|
uint64_t Offset = DI->getOffset();
|
||||||
// A dbg.value for an alloca is always indirect.
|
// A dbg.value for an alloca is always indirect.
|
||||||
bool IsIndirect = isa<AllocaInst>(V) || Offset != 0;
|
bool IsIndirect = isa<AllocaInst>(V) || Offset != 0;
|
||||||
SDDbgValue *SDV;
|
SDDbgValue *SDV;
|
||||||
if (Val.getNode()) {
|
if (Val.getNode()) {
|
||||||
if (!EmitFuncArgumentDbgValue(V, Variable, Expr, Offset, IsIndirect,
|
if (!EmitFuncArgumentDbgValue(V, Variable, Expr, dl, Offset, IsIndirect,
|
||||||
Val)) {
|
Val)) {
|
||||||
SDV = DAG.getDbgValue(Variable, Expr, Val.getNode(), Val.getResNo(),
|
SDV = DAG.getDbgValue(Variable, Expr, Val.getNode(), Val.getResNo(),
|
||||||
IsIndirect, Offset, dl, DbgSDNodeOrder);
|
IsIndirect, Offset, dl, DbgSDNodeOrder);
|
||||||
@ -4450,7 +4452,7 @@ static unsigned getTruncatedArgReg(const SDValue &N) {
|
|||||||
/// At the end of instruction selection, they will be inserted to the entry BB.
|
/// At the end of instruction selection, they will be inserted to the entry BB.
|
||||||
bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
|
bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
|
||||||
const Value *V, MDLocalVariable *Variable, MDExpression *Expr,
|
const Value *V, MDLocalVariable *Variable, MDExpression *Expr,
|
||||||
int64_t Offset, bool IsIndirect, const SDValue &N) {
|
MDLocation *DL, int64_t Offset, bool IsIndirect, const SDValue &N) {
|
||||||
const Argument *Arg = dyn_cast<Argument>(V);
|
const Argument *Arg = dyn_cast<Argument>(V);
|
||||||
if (!Arg)
|
if (!Arg)
|
||||||
return false;
|
return false;
|
||||||
@ -4501,13 +4503,15 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
|
|||||||
if (!Op)
|
if (!Op)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
assert(Variable->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
if (Op->isReg())
|
if (Op->isReg())
|
||||||
FuncInfo.ArgDbgValues.push_back(
|
FuncInfo.ArgDbgValues.push_back(
|
||||||
BuildMI(MF, getCurDebugLoc(), TII->get(TargetOpcode::DBG_VALUE),
|
BuildMI(MF, DL, TII->get(TargetOpcode::DBG_VALUE), IsIndirect,
|
||||||
IsIndirect, Op->getReg(), Offset, Variable, Expr));
|
Op->getReg(), Offset, Variable, Expr));
|
||||||
else
|
else
|
||||||
FuncInfo.ArgDbgValues.push_back(
|
FuncInfo.ArgDbgValues.push_back(
|
||||||
BuildMI(MF, getCurDebugLoc(), TII->get(TargetOpcode::DBG_VALUE))
|
BuildMI(MF, DL, TII->get(TargetOpcode::DBG_VALUE))
|
||||||
.addOperand(*Op)
|
.addOperand(*Op)
|
||||||
.addImm(Offset)
|
.addImm(Offset)
|
||||||
.addMetadata(Variable)
|
.addMetadata(Variable)
|
||||||
@ -4676,7 +4680,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
|||||||
else {
|
else {
|
||||||
// Address is an argument, so try to emit its dbg value using
|
// Address is an argument, so try to emit its dbg value using
|
||||||
// virtual register info from the FuncInfo.ValueMap.
|
// virtual register info from the FuncInfo.ValueMap.
|
||||||
EmitFuncArgumentDbgValue(Address, Variable, Expression, 0, false, N);
|
EmitFuncArgumentDbgValue(Address, Variable, Expression, dl, 0, false,
|
||||||
|
N);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} else if (AI)
|
} else if (AI)
|
||||||
@ -4693,7 +4698,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
|||||||
} else {
|
} else {
|
||||||
// If Address is an argument then try to emit its dbg value using
|
// If Address is an argument then try to emit its dbg value using
|
||||||
// virtual register info from the FuncInfo.ValueMap.
|
// virtual register info from the FuncInfo.ValueMap.
|
||||||
if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, 0, false,
|
if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, dl, 0, false,
|
||||||
N)) {
|
N)) {
|
||||||
// If variable is pinned by a alloca in dominating bb then
|
// If variable is pinned by a alloca in dominating bb then
|
||||||
// use StaticAllocaMap.
|
// use StaticAllocaMap.
|
||||||
@ -4744,7 +4749,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
|||||||
if (N.getNode()) {
|
if (N.getNode()) {
|
||||||
// A dbg.value for an alloca is always indirect.
|
// A dbg.value for an alloca is always indirect.
|
||||||
bool IsIndirect = isa<AllocaInst>(V) || Offset != 0;
|
bool IsIndirect = isa<AllocaInst>(V) || Offset != 0;
|
||||||
if (!EmitFuncArgumentDbgValue(V, Variable, Expression, Offset,
|
if (!EmitFuncArgumentDbgValue(V, Variable, Expression, dl, Offset,
|
||||||
IsIndirect, N)) {
|
IsIndirect, N)) {
|
||||||
SDV = DAG.getDbgValue(Variable, Expression, N.getNode(), N.getResNo(),
|
SDV = DAG.getDbgValue(Variable, Expression, N.getNode(), N.getResNo(),
|
||||||
IsIndirect, Offset, dl, SDNodeOrder);
|
IsIndirect, Offset, dl, SDNodeOrder);
|
||||||
|
@ -824,8 +824,9 @@ private:
|
|||||||
/// corresponding DBG_VALUE machine instruction for it now. At the end of
|
/// corresponding DBG_VALUE machine instruction for it now. At the end of
|
||||||
/// instruction selection, they will be inserted to the entry BB.
|
/// instruction selection, they will be inserted to the entry BB.
|
||||||
bool EmitFuncArgumentDbgValue(const Value *V, MDLocalVariable *Variable,
|
bool EmitFuncArgumentDbgValue(const Value *V, MDLocalVariable *Variable,
|
||||||
MDExpression *Expr, int64_t Offset,
|
MDExpression *Expr, MDLocation *DL,
|
||||||
bool IsIndirect, const SDValue &N);
|
int64_t Offset, bool IsIndirect,
|
||||||
|
const SDValue &N);
|
||||||
|
|
||||||
/// Return the next block after MBB, or nullptr if there is none.
|
/// Return the next block after MBB, or nullptr if there is none.
|
||||||
MachineBasicBlock *NextBlock(MachineBasicBlock *MBB);
|
MachineBasicBlock *NextBlock(MachineBasicBlock *MBB);
|
||||||
|
@ -501,12 +501,14 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
|
|||||||
MachineBasicBlock::iterator InsertPos = Def;
|
MachineBasicBlock::iterator InsertPos = Def;
|
||||||
const MDNode *Variable = MI->getDebugVariable();
|
const MDNode *Variable = MI->getDebugVariable();
|
||||||
const MDNode *Expr = MI->getDebugExpression();
|
const MDNode *Expr = MI->getDebugExpression();
|
||||||
|
DebugLoc DL = MI->getDebugLoc();
|
||||||
bool IsIndirect = MI->isIndirectDebugValue();
|
bool IsIndirect = MI->isIndirectDebugValue();
|
||||||
unsigned Offset = IsIndirect ? MI->getOperand(1).getImm() : 0;
|
unsigned Offset = IsIndirect ? MI->getOperand(1).getImm() : 0;
|
||||||
|
assert(DIVariable(Variable)->isValidLocationForIntrinsic(DL) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
// Def is never a terminator here, so it is ok to increment InsertPos.
|
// Def is never a terminator here, so it is ok to increment InsertPos.
|
||||||
BuildMI(*EntryMBB, ++InsertPos, MI->getDebugLoc(),
|
BuildMI(*EntryMBB, ++InsertPos, DL, TII->get(TargetOpcode::DBG_VALUE),
|
||||||
TII->get(TargetOpcode::DBG_VALUE), IsIndirect, LDI->second, Offset,
|
IsIndirect, LDI->second, Offset, Variable, Expr);
|
||||||
Variable, Expr);
|
|
||||||
|
|
||||||
// If this vreg is directly copied into an exported register then
|
// If this vreg is directly copied into an exported register then
|
||||||
// that COPY instructions also need DBG_VALUE, if it is the only
|
// that COPY instructions also need DBG_VALUE, if it is the only
|
||||||
@ -524,9 +526,10 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
|
|||||||
CopyUseMI = nullptr; break;
|
CopyUseMI = nullptr; break;
|
||||||
}
|
}
|
||||||
if (CopyUseMI) {
|
if (CopyUseMI) {
|
||||||
|
// Use MI's debug location, which describes where Variable was
|
||||||
|
// declared, rather than whatever is attached to CopyUseMI.
|
||||||
MachineInstr *NewMI =
|
MachineInstr *NewMI =
|
||||||
BuildMI(*MF, CopyUseMI->getDebugLoc(),
|
BuildMI(*MF, DL, TII->get(TargetOpcode::DBG_VALUE), IsIndirect,
|
||||||
TII->get(TargetOpcode::DBG_VALUE), IsIndirect,
|
|
||||||
CopyUseMI->getOperand(0).getReg(), Offset, Variable, Expr);
|
CopyUseMI->getOperand(0).getReg(), Offset, Variable, Expr);
|
||||||
MachineBasicBlock::iterator Pos = CopyUseMI;
|
MachineBasicBlock::iterator Pos = CopyUseMI;
|
||||||
EntryMBB->insertAfter(Pos, NewMI);
|
EntryMBB->insertAfter(Pos, NewMI);
|
||||||
|
@ -2417,6 +2417,8 @@ bool X86FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
|
|||||||
const MCInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
|
const MCInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
|
||||||
// FIXME may need to add RegState::Debug to any registers produced,
|
// FIXME may need to add RegState::Debug to any registers produced,
|
||||||
// although ESP/EBP should be the only ones at the moment.
|
// although ESP/EBP should be the only ones at the moment.
|
||||||
|
assert(DI->getVariable()->isValidLocationForIntrinsic(DbgLoc) &&
|
||||||
|
"Expected inlined-at fields to agree");
|
||||||
addFullAddress(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, II), AM)
|
addFullAddress(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, II), AM)
|
||||||
.addImm(0)
|
.addImm(0)
|
||||||
.addMetadata(DI->getVariable())
|
.addMetadata(DI->getVariable())
|
||||||
|
Reference in New Issue
Block a user