Detabification. Fixed indentation and spacing.
Changed cout to DOUT, and TODOs to FIXMEs.
Other changes as per coding conventions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51105 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp b/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp
index 07ebd99..512893b 100644
--- a/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp
+++ b/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp
@@ -56,11 +56,6 @@
/// PIC16-specific SelectionDAG.
PIC16TargetLowering PIC16Lowering;
- /// Subtarget - Keep a pointer to the PIC16Subtarget around so that we can
- /// make the right decision when generating code for different targets.
- //TODO: add initialization on constructor
- //const PIC16Subtarget *Subtarget;
-
public:
PIC16DAGToDAGISel(PIC16TargetMachine &tm) :
SelectionDAGISel(PIC16Lowering),
@@ -75,18 +70,18 @@
private:
// Include the pieces autogenerated from the target description.
- #include "PIC16GenDAGISel.inc"
+#include "PIC16GenDAGISel.inc"
SDNode *Select(SDOperand N);
// Select addressing mode. currently assume base + offset addr mode.
bool SelectAM(SDOperand Op, SDOperand N, SDOperand &Base, SDOperand &Offset);
bool SelectDirectAM(SDOperand Op, SDOperand N, SDOperand &Base,
- SDOperand &Offset);
+ SDOperand &Offset);
bool StoreInDirectAM(SDOperand Op, SDOperand N, SDOperand &fsr);
bool LoadFSR(SDOperand Op, SDOperand N, SDOperand &Base, SDOperand &Offset);
bool LoadNothing(SDOperand Op, SDOperand N, SDOperand &Base,
- SDOperand &Offset);
+ SDOperand &Offset);
// getI8Imm - Return a target constant with the specified
// value, of type i8.
@@ -95,9 +90,9 @@
}
- #ifndef NDEBUG
+#ifndef NDEBUG
unsigned Indent;
- #endif
+#endif
};
}
@@ -108,17 +103,16 @@
{
DEBUG(BB->dump());
// Codegen the basic block.
- #ifndef NDEBUG
+
DOUT << "===== Instruction selection begins:\n";
+#ifndef NDEBUG
Indent = 0;
- #endif
+#endif
// Select target instructions for the DAG.
SD.setRoot(SelectRoot(SD.getRoot()));
- #ifndef NDEBUG
DOUT << "===== Instruction selection ends:\n";
- #endif
SD.RemoveDeadNodes();
@@ -135,7 +129,7 @@
// if Address is FI, get the TargetFrameIndex.
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(N)) {
- cout << "--------- its frame Index\n";
+ DOUT << "--------- its frame Index\n";
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
Offset = CurDAG->getTargetConstant(0, MVT::i32);
return true;
@@ -154,11 +148,11 @@
Offset = CurDAG->getTargetConstant((unsigned char)GC->getValue(), MVT::i8);
if ((GA = dyn_cast<GlobalAddressSDNode>(N.getOperand(0)))) {
Base = CurDAG->getTargetGlobalAddress(GA->getGlobal(), MVT::i16,
- GC->getValue());
+ GC->getValue());
return true;
}
else if (FrameIndexSDNode *FIN
- = dyn_cast<FrameIndexSDNode>(N.getOperand(0))) {
+ = dyn_cast<FrameIndexSDNode>(N.getOperand(0))) {
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
return true;
}
@@ -168,7 +162,7 @@
}
-//FIXME: must also account for preinc/predec/postinc/postdec
+// FIXME: must also account for preinc/predec/postinc/postdec.
bool PIC16DAGToDAGISel::
StoreInDirectAM (SDOperand Op, SDOperand N, SDOperand &fsr)
{
@@ -181,12 +175,12 @@
else if (isa<RegisterSDNode>(N.Val)) {
//FIXME an attempt to retrieve the register number
//but does not work
- cout << "this is a register\n";
+ DOUT << "this is a register\n";
Reg = dyn_cast<RegisterSDNode>(N.Val);
fsr = CurDAG->getRegister(Reg->getReg(),MVT::i16);
}
else {
- cout << "this is not a register\n";
+ DOUT << "this is not a register\n";
// FIXME must use whatever load is using
fsr = CurDAG->getRegister(1,MVT::i16);
}
@@ -204,7 +198,7 @@
GA = dyn_cast<GlobalAddressSDNode>(N);
Offset = CurDAG->getTargetConstant((unsigned char)GA->getOffset(), MVT::i8);
Base = CurDAG->getTargetGlobalAddress(GA->getGlobal(), MVT::i16,
- GA->getOffset());
+ GA->getOffset());
return true;
}
else if (N.getOpcode() == PIC16ISD::Package) {
@@ -215,17 +209,17 @@
return false;
}
-//don't thake this seriously, it will change
+// LoadNothing - Don't thake this seriously, it will change.
bool PIC16DAGToDAGISel::
LoadNothing (SDOperand Op, SDOperand N, SDOperand &Base, SDOperand &Offset)
{
GlobalAddressSDNode *GA;
if (N.getOpcode() == ISD::GlobalAddress) {
GA = dyn_cast<GlobalAddressSDNode>(N);
- cout << "==========" << GA->getOffset() << "\n";
+ DOUT << "==========" << GA->getOffset() << "\n";
Offset = CurDAG->getTargetConstant((unsigned char)GA->getOffset(), MVT::i8);
Base = CurDAG->getTargetGlobalAddress(GA->getGlobal(), MVT::i16,
- GA->getOffset());
+ GA->getOffset());
return true;
}
@@ -233,34 +227,34 @@
}
-/// Select instructions not customized! Used for
-/// expanded, promoted and normal instructions
+/// Select - Select instructions not customized! Used for
+/// expanded, promoted and normal instructions.
SDNode* PIC16DAGToDAGISel::Select(SDOperand N)
{
SDNode *Node = N.Val;
unsigned Opcode = Node->getOpcode();
// Dump information about the Node being selected
- #ifndef NDEBUG
+#ifndef NDEBUG
DOUT << std::string(Indent, ' ') << "Selecting: ";
DEBUG(Node->dump(CurDAG));
DOUT << "\n";
Indent += 2;
- #endif
+#endif
// If we have a custom node, we already have selected!
if (Opcode >= ISD::BUILTIN_OP_END && Opcode < PIC16ISD::FIRST_NUMBER) {
- #ifndef NDEBUG
+#ifndef NDEBUG
DOUT << std::string(Indent-2, ' ') << "== ";
DEBUG(Node->dump(CurDAG));
DOUT << "\n";
Indent -= 2;
- #endif
+#endif
return NULL;
}
///
- // Instruction Selection not handled by custom or by the
+ // FIXME: Instruction Selection not handled by custom or by the
// auto-generated tablegen selection should be handled here.
///
switch(Opcode) {
@@ -270,7 +264,7 @@
// Select the default instruction.
SDNode *ResNode = SelectCode(N);
- #ifndef NDEBUG
+#ifndef NDEBUG
DOUT << std::string(Indent-2, ' ') << "=> ";
if (ResNode == NULL || ResNode == N.Val)
DEBUG(N.Val->dump(CurDAG));
@@ -278,7 +272,7 @@
DEBUG(ResNode->dump(CurDAG));
DOUT << "\n";
Indent -= 2;
- #endif
+#endif
return ResNode;
}