/// Creates a SDDbgValue node.
SDDbgValue *getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R,
- bool IsIndirect, uint64_t Off, const DebugLoc &DL,
- unsigned O);
+ bool IsIndirect, const DebugLoc &DL, unsigned O);
/// Constant
SDDbgValue *getConstantDbgValue(MDNode *Var, MDNode *Expr, const Value *C,
- uint64_t Off, const DebugLoc &DL, unsigned O);
+ const DebugLoc &DL, unsigned O);
/// FrameIndex
SDDbgValue *getFrameIndexDbgValue(MDNode *Var, MDNode *Expr, unsigned FI,
- uint64_t Off, const DebugLoc &DL,
- unsigned O);
+ const DebugLoc &DL, unsigned O);
/// Remove the specified node from the system. If any of its
/// operands then becomes dead, remove them as well. Inform UpdateListener
MachineInstr *
InstrEmitter::EmitDbgValue(SDDbgValue *SD,
DenseMap<SDValue, unsigned> &VRBaseMap) {
- uint64_t Offset = SD->getOffset();
MDNode *Var = SD->getVariable();
MDNode *Expr = SD->getExpression();
DebugLoc DL = SD->getDebugLoc();
// EmitTargetCodeForFrameDebugValue is responsible for allocation.
return BuildMI(*MF, DL, TII->get(TargetOpcode::DBG_VALUE))
.addFrameIndex(SD->getFrameIx())
- .addImm(Offset)
+ .addImm(0)
.addMetadata(Var)
.addMetadata(Expr);
}
// Indirect addressing is indicated by an Imm as the second parameter.
if (SD->isIndirect())
- MIB.addImm(Offset);
- else {
- assert(Offset == 0 && "direct value cannot have an offset");
+ MIB.addImm(0U);
+ else
MIB.addReg(0U, RegState::Debug);
- }
MIB.addMetadata(Var);
MIB.addMetadata(Expr);
} u;
MDNode *Var;
MDNode *Expr;
- uint64_t Offset;
DebugLoc DL;
unsigned Order;
enum DbgValueKind kind;
public:
// Constructor for non-constants.
SDDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, bool indir,
- uint64_t off, DebugLoc dl, unsigned O)
- : Var(Var), Expr(Expr), Offset(off), DL(std::move(dl)), Order(O),
- IsIndirect(indir) {
+ DebugLoc dl, unsigned O)
+ : Var(Var), Expr(Expr), DL(std::move(dl)), Order(O), IsIndirect(indir) {
kind = SDNODE;
u.s.Node = N;
u.s.ResNo = R;
}
// Constructor for constants.
- SDDbgValue(MDNode *Var, MDNode *Expr, const Value *C, uint64_t off,
- DebugLoc dl, unsigned O)
- : Var(Var), Expr(Expr), Offset(off), DL(std::move(dl)), Order(O),
- IsIndirect(false) {
+ SDDbgValue(MDNode *Var, MDNode *Expr, const Value *C, DebugLoc dl, unsigned O)
+ : Var(Var), Expr(Expr), DL(std::move(dl)), Order(O), IsIndirect(false) {
kind = CONST;
u.Const = C;
}
// Constructor for frame indices.
- SDDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, uint64_t off, DebugLoc dl,
- unsigned O)
- : Var(Var), Expr(Expr), Offset(off), DL(std::move(dl)), Order(O),
- IsIndirect(false) {
+ SDDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, DebugLoc dl, unsigned O)
+ : Var(Var), Expr(Expr), DL(std::move(dl)), Order(O), IsIndirect(false) {
kind = FRAMEIX;
u.FrameIx = FI;
}
// Returns whether this is an indirect value.
bool isIndirect() const { return IsIndirect; }
- // Returns the offset.
- uint64_t getOffset() const { return Offset; }
-
// Returns the DebugLoc.
DebugLoc getDebugLoc() const { return DL; }
///
/// SDNode
SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N,
- unsigned R, bool IsIndirect, uint64_t Off,
+ unsigned R, bool IsIndirect,
const DebugLoc &DL, unsigned O) {
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
"Expected inlined-at fields to agree");
return new (DbgInfo->getAlloc())
- SDDbgValue(Var, Expr, N, R, IsIndirect, Off, DL, O);
+ SDDbgValue(Var, Expr, N, R, IsIndirect, DL, O);
}
/// Constant
SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr,
- const Value *C, uint64_t Off,
+ const Value *C,
const DebugLoc &DL, unsigned O) {
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
"Expected inlined-at fields to agree");
- return new (DbgInfo->getAlloc()) SDDbgValue(Var, Expr, C, Off, DL, O);
+ return new (DbgInfo->getAlloc()) SDDbgValue(Var, Expr, C, DL, O);
}
/// FrameIndex
SDDbgValue *SelectionDAG::getFrameIndexDbgValue(MDNode *Var, MDNode *Expr,
- unsigned FI, uint64_t Off,
- const DebugLoc &DL,
+ unsigned FI, const DebugLoc &DL,
unsigned O) {
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
"Expected inlined-at fields to agree");
- return new (DbgInfo->getAlloc()) SDDbgValue(Var, Expr, FI, Off, DL, O);
+ return new (DbgInfo->getAlloc()) SDDbgValue(Var, Expr, FI, DL, O);
}
namespace {
Dbg->getResNo() == From.getResNo() && !Dbg->isInvalidated()) {
assert(FromNode != ToNode &&
"Should not transfer Debug Values intranode");
- SDDbgValue *Clone =
- getDbgValue(Dbg->getVariable(), Dbg->getExpression(), ToNode,
- To.getResNo(), Dbg->isIndirect(), Dbg->getOffset(),
- Dbg->getDebugLoc(), Dbg->getOrder());
+ SDDbgValue *Clone = getDbgValue(Dbg->getVariable(), Dbg->getExpression(),
+ ToNode, To.getResNo(), Dbg->isIndirect(),
+ Dbg->getDebugLoc(), Dbg->getOrder());
ClonedDVs.push_back(Clone);
Dbg->setIsInvalidated();
}
DIExpression *Expr = DI->getExpression();
assert(Variable->isValidLocationForIntrinsic(dl) &&
"Expected inlined-at fields to agree");
- uint64_t Offset = 0;
SDDbgValue *SDV;
if (Val.getNode()) {
- if (!EmitFuncArgumentDbgValue(V, Variable, Expr, dl, Offset, false,
- Val)) {
- SDV = getDbgValue(Val, Variable, Expr, Offset, dl, DbgSDNodeOrder);
+ if (!EmitFuncArgumentDbgValue(V, Variable, Expr, dl, false, Val)) {
+ SDV = getDbgValue(Val, Variable, Expr, dl, DbgSDNodeOrder);
DAG.AddDbgValue(SDV, Val.getNode(), false);
}
} else
}
}
-/// EmitFuncArgumentDbgValue - If the DbgValueInst is a dbg_value of a function
-/// argument, create the corresponding DBG_VALUE machine instruction for it now.
-/// At the end of instruction selection, they will be inserted to the entry BB.
+/// If the DbgValueInst is a dbg_value of a function argument, create the
+/// corresponding DBG_VALUE machine instruction for it now. At the end of
+/// instruction selection, they will be inserted to the entry BB.
bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
const Value *V, DILocalVariable *Variable, DIExpression *Expr,
- DILocation *DL, int64_t Offset, bool IsDbgDeclare, const SDValue &N) {
+ DILocation *DL, bool IsDbgDeclare, const SDValue &N) {
const Argument *Arg = dyn_cast<Argument>(V);
if (!Arg)
return false;
if (Op->isReg())
FuncInfo.ArgDbgValues.push_back(
BuildMI(MF, DL, TII->get(TargetOpcode::DBG_VALUE), IsIndirect,
- Op->getReg(), Offset, Variable, Expr));
+ Op->getReg(), 0, Variable, Expr));
else
FuncInfo.ArgDbgValues.push_back(
BuildMI(MF, DL, TII->get(TargetOpcode::DBG_VALUE))
.add(*Op)
- .addImm(Offset)
+ .addImm(0)
.addMetadata(Variable)
.addMetadata(Expr));
/// Return the appropriate SDDbgValue based on N.
SDDbgValue *SelectionDAGBuilder::getDbgValue(SDValue N,
DILocalVariable *Variable,
- DIExpression *Expr, int64_t Offset,
+ DIExpression *Expr,
const DebugLoc &dl,
unsigned DbgSDNodeOrder) {
if (auto *FISDN = dyn_cast<FrameIndexSDNode>(N.getNode())) {
// Construct a FrameIndexDbgValue for FrameIndexSDNodes so we can describe
// stack slot locations as such instead of as indirectly addressed
// locations.
- return DAG.getFrameIndexDbgValue(Variable, Expr, FISDN->getIndex(), 0, dl,
+ return DAG.getFrameIndexDbgValue(Variable, Expr, FISDN->getIndex(), dl,
DbgSDNodeOrder);
}
- return DAG.getDbgValue(Variable, Expr, N.getNode(), N.getResNo(), false,
- Offset, dl, DbgSDNodeOrder);
+ return DAG.getDbgValue(Variable, Expr, N.getNode(), N.getResNo(), false, dl,
+ DbgSDNodeOrder);
}
// VisualStudio defines setjmp as _setjmp
if (isParameter && FINode) {
// Byval parameter. We have a frame index at this point.
SDV = DAG.getFrameIndexDbgValue(Variable, Expression,
- FINode->getIndex(), 0, dl, SDNodeOrder);
+ FINode->getIndex(), dl, SDNodeOrder);
} else if (isa<Argument>(Address)) {
// Address is an argument, so try to emit its dbg value using
// virtual register info from the FuncInfo.ValueMap.
- EmitFuncArgumentDbgValue(Address, Variable, Expression, dl, 0, true, N);
+ EmitFuncArgumentDbgValue(Address, Variable, Expression, dl, true, N);
return nullptr;
} else {
SDV = DAG.getDbgValue(Variable, Expression, N.getNode(), N.getResNo(),
- true, 0, dl, SDNodeOrder);
+ true, dl, SDNodeOrder);
}
DAG.AddDbgValue(SDV, N.getNode(), isParameter);
} else {
// If Address is an argument then try to emit its dbg value using
// virtual register info from the FuncInfo.ValueMap.
- if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, dl, 0, true,
+ if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, dl, true,
N)) {
DEBUG(dbgs() << "Dropping debug info for " << DI << "\n");
}
DILocalVariable *Variable = DI.getVariable();
DIExpression *Expression = DI.getExpression();
- uint64_t Offset = 0;
const Value *V = DI.getValue();
if (!V)
return nullptr;
SDDbgValue *SDV;
if (isa<ConstantInt>(V) || isa<ConstantFP>(V) || isa<UndefValue>(V)) {
- SDV = DAG.getConstantDbgValue(Variable, Expression, V, Offset, dl,
- SDNodeOrder);
+ SDV = DAG.getConstantDbgValue(Variable, Expression, V, dl, SDNodeOrder);
DAG.AddDbgValue(SDV, nullptr, false);
return nullptr;
}
if (!N.getNode() && isa<Argument>(V)) // Check unused arguments map.
N = UnusedArgNodeMap[V];
if (N.getNode()) {
- if (EmitFuncArgumentDbgValue(V, Variable, Expression, dl, Offset, false,
- N))
+ if (EmitFuncArgumentDbgValue(V, Variable, Expression, dl, false, N))
return nullptr;
- SDV = getDbgValue(N, Variable, Expression, Offset, dl, SDNodeOrder);
+ SDV = getDbgValue(N, Variable, Expression, dl, SDNodeOrder);
DAG.AddDbgValue(SDV, N.getNode(), false);
return nullptr;
}
void emitInlineAsmError(ImmutableCallSite CS, const Twine &Message);
- /// EmitFuncArgumentDbgValue - If V is an function argument then create
- /// corresponding DBG_VALUE machine instruction for it now. At the end of
- /// instruction selection, they will be inserted to the entry BB.
+ /// If V is an function argument then create corresponding DBG_VALUE machine
+ /// instruction for it now. At the end of instruction selection, they will be
+ /// inserted to the entry BB.
bool EmitFuncArgumentDbgValue(const Value *V, DILocalVariable *Variable,
DIExpression *Expr, DILocation *DL,
- int64_t Offset, bool IsDbgDeclare,
- const SDValue &N);
+ bool IsDbgDeclare, const SDValue &N);
/// Return the next block after MBB, or nullptr if there is none.
MachineBasicBlock *NextBlock(MachineBasicBlock *MBB);
/// Return the appropriate SDDbgValue based on N.
SDDbgValue *getDbgValue(SDValue N, DILocalVariable *Variable,
- DIExpression *Expr, int64_t Offset,
- const DebugLoc &dl, unsigned DbgSDNodeOrder);
+ DIExpression *Expr, const DebugLoc &dl,
+ unsigned DbgSDNodeOrder);
};
/// RegsForValue - This struct represents the registers (physical or virtual)