const DbgValueInst *DI = cast<DbgValueInst>(II);
const MCInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
const Value *V = DI->getValue();
- assert(DI->getVariable()->isValidLocationForIntrinsic(MIMD.getDL()) &&
+ DIExpression *Expr = DI->getExpression();
+ DILocalVariable *Var = DI->getVariable();
+ assert(Var->isValidLocationForIntrinsic(MIMD.getDL()) &&
"Expected inlined-at fields to agree");
if (!V || isa<UndefValue>(V) || DI->hasArgList()) {
// DI is either undef or cannot produce a valid DBG_VALUE, so produce an
// undef DBG_VALUE to terminate any prior location.
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD.getDL(), II, false, 0U,
- DI->getVariable(), DI->getExpression());
+ Var, Expr);
return true;
}
if (const auto *CI = dyn_cast<ConstantInt>(V)) {
// See if there's an expression to constant-fold.
- DIExpression *Expr = DI->getExpression();
if (Expr)
std::tie(Expr, CI) = Expr->constantFold(CI);
if (CI->getBitWidth() > 64)
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, II)
.addCImm(CI)
.addImm(0U)
- .addMetadata(DI->getVariable())
+ .addMetadata(Var)
.addMetadata(Expr);
else
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, II)
.addImm(CI->getZExtValue())
.addImm(0U)
- .addMetadata(DI->getVariable())
+ .addMetadata(Var)
.addMetadata(Expr);
return true;
}
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, II)
.addFPImm(CF)
.addImm(0U)
- .addMetadata(DI->getVariable())
- .addMetadata(DI->getExpression());
+ .addMetadata(Var)
+ .addMetadata(Expr);
return true;
}
if (Register Reg = lookUpRegForValue(V)) {
if (!FuncInfo.MF->useDebugInstrRef()) {
bool IsIndirect = false;
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD.getDL(), II, IsIndirect,
- Reg, DI->getVariable(), DI->getExpression());
+ Reg, Var, Expr);
return true;
}
// If using instruction referencing, produce this as a DBG_INSTR_REF,
/* isUndef */ false, /* isEarlyClobber */ false,
/* SubReg */ 0, /* isDebug */ true)});
SmallVector<uint64_t, 2> Ops({dwarf::DW_OP_LLVM_arg, 0});
- auto *NewExpr = DIExpression::prependOpcodes(DI->getExpression(), Ops);
+ auto *NewExpr = DIExpression::prependOpcodes(Expr, Ops);
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD.getDL(),
TII.get(TargetOpcode::DBG_INSTR_REF), /*IsIndirect*/ false, MOs,
- DI->getVariable(), NewExpr);
+ Var, NewExpr);
return true;
}
// We don't know how to handle other cases, so we drop.