[llvm-commits] [llvm] r68602 - in /llvm/trunk/lib/Target/PIC16: PIC16AsmPrinter.cpp PIC16ISelLowering.cpp PIC16ISelLowering.h PIC16InstrInfo.td PIC16TargetAsmInfo.cpp
Sanjiv Gupta
sanjiv.gupta at microchip.com
Tue Apr 7 23:24:04 PDT 2009
Author: sgupta
Date: Wed Apr 8 01:24:04 2009
New Revision: 68602
URL: http://llvm.org/viewvc/llvm-project?rev=68602&view=rev
Log:
Emit .line debug directives for stoppoints. The debug location is retrieved by the MachineInstr itself, rather than by custom handling the DBG_STOPPOINT nodes.
Modified:
llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h
llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td
llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=68602&r1=68601&r2=68602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Wed Apr 8 01:24:04 2009
@@ -113,6 +113,8 @@
SectionFlags::Code);
O << "\n";
SwitchToSection (fCodeSection);
+
+ // Emit the frame address of the function at the beginning of code.
O << CurrentFnName << ":\n";
O << " retlw low(" << CurrentFnName << ".frame)\n";
O << " retlw high(" << CurrentFnName << ".frame)\n";
@@ -127,10 +129,23 @@
O << '\n';
}
CurBank = "";
+
+ // For emitting line directives, we need to keep track of the current
+ // source line. When it changes then only emit the line directive.
+ unsigned CurLine = 0;
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
+ // Emit the line directive if source line changed.
+ const DebugLoc DL = II->getDebugLoc();
+ if (!DL.isUnknown()) {
+ unsigned line = MF.getDebugLocTuple(DL).Line;
+ if (line != CurLine) {
+ O << "\t.line " << line << "\n";
+ CurLine = line;
+ }
+ }
// Print the assembly for the instruction.
- printMachineInstruction(II);
+ printMachineInstruction(II);
}
}
return false; // we didn't modify anything.
Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=68602&r1=68601&r2=68602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Wed Apr 8 01:24:04 2009
@@ -137,8 +137,6 @@
//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();
@@ -274,7 +272,6 @@
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";
}
}
@@ -825,21 +822,10 @@
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) {
Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=68602&r1=68601&r2=68602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Wed Apr 8 01:24:04 2009
@@ -52,7 +52,6 @@
SUBCC, // Compare for equality or inequality.
SELECT_ICC, // Psuedo to be caught in schedular and expanded to brcond.
BRCOND, // Conditional branch.
- PIC16StopPoint,
Dummy
};
@@ -111,7 +110,6 @@
SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG);
SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG);
- SDValue LowerStopPoint(SDValue Op, SelectionDAG &DAG);
SDValue getPIC16Cmp(SDValue LHS, SDValue RHS, unsigned OrigCC, SDValue &CC,
SelectionDAG &DAG, DebugLoc dl);
virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
Modified: llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td?rev=68602&r1=68601&r2=68602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td Wed Apr 8 01:24:04 2009
@@ -71,9 +71,6 @@
def PIC16callseq_end : SDNode<"ISD::CALLSEQ_END", SDTI8VoidOp,
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
-def PIC16StopPoint : SDNode<"PIC16ISD::PIC16StopPoint", SDTI8VoidOp,
- [SDNPHasChain]>;
-
// Low 8-bits of GlobalAddress.
def PIC16Lo : SDNode<"PIC16ISD::Lo", SDTI8UnaryOp>;
@@ -171,10 +168,6 @@
// PIC16 Instructions.
//===----------------------------------------------------------------------===//
-def line_directive : ByteFormat<0, (outs), (ins i8imm:$src),
- ".line $src",
- [(PIC16StopPoint (i8 imm:$src))]>;
-
// Pseudo-instructions.
def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i8imm:$amt),
"!ADJCALLSTACKDOWN $amt",
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp?rev=68602&r1=68601&r2=68602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp Wed Apr 8 01:24:04 2009
@@ -35,6 +35,9 @@
ReadOnlySection = getNamedSection("romdata.# ROMDATA", SectionFlags::None);
DataSection = getNamedSection("idata.# IDATA", SectionFlags::Writeable);
SwitchToSectionDirective = "";
+ // Need because otherwise a .text symbol is emitted by DwarfWriter
+ // in BeginModule, and gpasm cribbs for that .text symbol.
+ TextSection = getUnnamedSection("", SectionFlags::Code);
}
const char *PIC16TargetAsmInfo::getRomDirective(unsigned size) const
More information about the llvm-commits
mailing list