[PATCH] D45033: [DebugInfo] In GlobalISel, convert llvm.dbg.label to DBG_LABEL MI.
Hsiangkai Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 29 07:09:33 PDT 2018
HsiangKai created this revision.
HsiangKai added reviewers: rnk, chenwj.
Herald added subscribers: JDevlieghere, kristof.beyls, rovka.
Convert llvm.dbg.label(!label_metadata) to DBG_LABEL !label_metadata.
Repository:
rL LLVM
https://reviews.llvm.org/D45033
Files:
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
lib/CodeGen/GlobalISel/IRTranslator.cpp
lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
Index: lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
===================================================================
--- lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
+++ lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
@@ -142,6 +142,15 @@
return MIB.addImm(0).addMetadata(Variable).addMetadata(Expr);
}
+MachineInstrBuilder MachineIRBuilder::buildDbgLabel(const MDNode *Label) {
+ assert(isa<DILabel>(Label) && "not a label");
+ assert(cast<DILabel>(Label)->isValidLocationForIntrinsic(DL) &&
+ "Expected inlined-at fields to agree");
+ auto MIB = buildInstr(TargetOpcode::DBG_LABEL);
+
+ return MIB.addMetadata(Label);
+}
+
MachineInstrBuilder MachineIRBuilder::buildFrameIndex(unsigned Res, int Idx) {
assert(MRI->getType(Res).isPointer() && "invalid operand type");
return buildInstr(TargetOpcode::G_FRAME_INDEX)
Index: lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -670,6 +670,17 @@
DI.getVariable(), DI.getExpression());
return true;
}
+ case Intrinsic::dbg_label: {
+ const DbgLabelInst &DI = cast<DbgLabelInst>(CI);
+ assert(DI.getLabel() && "Missing label");
+
+ assert(DI.getLabel()->isValidLocationForIntrinsic(
+ MIRBuilder.getDebugLoc()) &&
+ "Expected inlined-at fields to agree");
+
+ MIRBuilder.buildDbgLabel(DI.getLabel());
+ return true;
+ }
case Intrinsic::vaend:
// No target I know of cares about va_end. Certainly no in-tree target
// does. Simplest intrinsic ever!
Index: include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
===================================================================
--- include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
+++ include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
@@ -203,6 +203,10 @@
const MDNode *Variable,
const MDNode *Expr);
+ /// Build and insert a DBG_LABEL instructions specifying that \p Label is
+ /// given. Convert "llvm.dbg.label Label" to "DBG_LABEL Label".
+ MachineInstrBuilder buildDbgLabel(const MDNode *Label);
+
/// Build and insert \p Res = G_FRAME_INDEX \p Idx
///
/// G_FRAME_INDEX materializes the address of an alloca value or other
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45033.140234.patch
Type: text/x-patch
Size: 2390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/3bedf20b/attachment.bin>
More information about the llvm-commits
mailing list