To convert the StopPoint insn into an assembler directive by ISel, we need to have access to the line number field. So we convert that info as an operand by custom handling DBG_STOPPOINT in legalize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68329 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PIC16/PIC16ISelLowering.cpp b/lib/Target/PIC16/PIC16ISelLowering.cpp
index cbe3a9d..d50f57f 100644
--- a/lib/Target/PIC16/PIC16ISelLowering.cpp
+++ b/lib/Target/PIC16/PIC16ISelLowering.cpp
@@ -137,6 +137,8 @@
//setOperationAction(ISD::TRUNCATE, MVT::i16, Custom);
setTruncStoreAction(MVT::i16, MVT::i8, Custom);
+ setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Custom);
+
// Now deduce the information based on the above mentioned
// actions
computeRegisterProperties();
@@ -258,6 +260,7 @@
case PIC16ISD::SELECT_ICC: return "PIC16ISD::SELECT_ICC";
case PIC16ISD::BRCOND: return "PIC16ISD::BRCOND";
case PIC16ISD::Dummy: return "PIC16ISD::Dummy";
+ case PIC16ISD::PIC16StopPoint: return "PIC16ISD::PIC16StopPoint";
}
}
@@ -808,10 +811,21 @@
return LowerBR_CC(Op, DAG);
case ISD::SELECT_CC:
return LowerSELECT_CC(Op, DAG);
+ case ISD::DBG_STOPPOINT:
+ return LowerStopPoint(Op, DAG);
}
return SDValue();
}
+SDValue PIC16TargetLowering::LowerStopPoint(SDValue Op, SelectionDAG &DAG) {
+ DbgStopPointSDNode *SP = dyn_cast<DbgStopPointSDNode>(Op);
+ unsigned line = SP->getLine();
+ SDValue LineNode = DAG.getConstant(line, MVT::i8);
+ DebugLoc dl = Op.getDebugLoc();
+ return DAG.getNode(PIC16ISD::PIC16StopPoint, dl, MVT::Other,
+ Op.getOperand(0), LineNode);
+}
+
SDValue PIC16TargetLowering::ConvertToMemOperand(SDValue Op,
SelectionDAG &DAG,
DebugLoc dl) {