Print "circular" warning message only in debug mode.
[oota-llvm.git] / lib / Target / SparcV9 / InstrSelection / InstrForest.cpp
index c24c35b640b15fcf3870cce15e84c9bca75e5f0f..c33faec9a04a6774f09bb2977f14aff52748a544 100644 (file)
@@ -21,6 +21,7 @@
 #include "llvm/Type.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "Support/STLExtras.h"
+#include <alloca.h>
 using std::cerr;
 using std::vector;
 
@@ -67,11 +68,10 @@ InstructionNode::InstructionNode(Instruction* I)
     {
       opLabel = AllocaN;                // Alloca(ptr, N) operation
     }
-  else if ((opLabel == Instruction::Load ||
-           opLabel == Instruction::GetElementPtr) &&
-          cast<MemAccessInst>(I)->hasIndices())
+  else if (opLabel == Instruction::GetElementPtr &&
+          cast<GetElementPtrInst>(I)->hasIndices())
     {
-      opLabel = opLabel + 100;          // load/getElem with index vector
+      opLabel = opLabel + 100;          // getElem with index vector
     }
   else if (opLabel == Instruction::Xor &&
            BinaryOperator::isNot(I))
@@ -118,21 +118,8 @@ InstructionNode::dumpNode(int indent) const
 {
   for (int i=0; i < indent; i++)
     cerr << "    ";
-  
-  cerr << getInstruction()->getOpcodeName();
-  const MachineCodeForInstruction &mvec =
-    MachineCodeForInstruction::get(getInstruction());
-
-  if (!mvec.empty())
-    cerr << "\tMachine Instructions:  ";
-
-  for (unsigned i = 0; i < mvec.size(); ++i) {
-    mvec[i]->dump();
-    if (i < mvec.size() - 1)
-      cerr << ";  ";
-  }
-  
-  cerr << "\n";
+  cerr << getInstruction()->getOpcodeName()
+       << " [label " << getOpLabel() << "]" << "\n";
 }
 
 
@@ -214,7 +201,6 @@ inline void
 InstrForest::noteTreeNodeForInstr(Instruction *instr,
                                  InstructionNode *treeNode)
 {
-  assert(treeNode->getNodeType() == InstrTreeNode::NTInstructionNode);
   (*this)[instr] = treeNode;
   treeRoots.push_back(treeNode);       // mark node as root of a new tree
 }
@@ -225,8 +211,8 @@ InstrForest::setLeftChild(InstrTreeNode *parent, InstrTreeNode *child)
 {
   parent->LeftChild = child;
   child->Parent = parent;
-  if (child->getNodeType() == InstrTreeNode::NTInstructionNode)
-    eraseRoot((InstructionNode*) child); // no longer a tree root
+  if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
+    eraseRoot(instrNode); // no longer a tree root
 }
 
 inline void
@@ -234,8 +220,8 @@ InstrForest::setRightChild(InstrTreeNode *parent, InstrTreeNode *child)
 {
   parent->RightChild = child;
   child->Parent = parent;
-  if (child->getNodeType() == InstrTreeNode::NTInstructionNode)
-    eraseRoot((InstructionNode*) child); // no longer a tree root
+  if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
+    eraseRoot(instrNode); // no longer a tree root
 }