More constification of things. More comments added. No functionality
[oota-llvm.git] / lib / CodeGen / SelectionDAG / SelectionDAG.cpp
index f8e1fea679c68a4df03bea5476867556dfe50a4c..eb3729c813f6ba17b7d6df43b6fb1aa19d0c6e44 100644 (file)
@@ -176,6 +176,27 @@ bool ISD::isBuildVectorAllZeros(const SDNode *N) {
   return true;
 }
 
+/// isScalarToVector - Return true if the specified node is a
+/// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low
+/// element is not an undef.
+bool ISD::isScalarToVector(const SDNode *N) {
+  if (N->getOpcode() == ISD::SCALAR_TO_VECTOR)
+    return true;
+
+  if (N->getOpcode() != ISD::BUILD_VECTOR)
+    return false;
+  if (N->getOperand(0).getOpcode() == ISD::UNDEF)
+    return false;
+  unsigned NumElems = N->getNumOperands();
+  for (unsigned i = 1; i < NumElems; ++i) {
+    SDOperand V = N->getOperand(i);
+    if (V.getOpcode() != ISD::UNDEF)
+      return false;
+  }
+  return true;
+}
+
+
 /// isDebugLabel - Return true if the specified node represents a debug
 /// label (i.e. ISD::LABEL or TargetInstrInfo::LABEL node and third operand
 /// is 0).
@@ -340,7 +361,7 @@ static void AddNodeIDNode(FoldingSetNodeID &ID, SDNode *N) {
   default: break;  // Normal nodes don't need extra info.
   case ISD::TargetConstant:
   case ISD::Constant:
-    ID.AddInteger(cast<ConstantSDNode>(N)->getValue());
+    ID.Add(cast<ConstantSDNode>(N)->getAPIntValue());
     break;
   case ISD::TargetConstantFP:
   case ISD::ConstantFP: {
@@ -3792,6 +3813,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
       return "<<Unknown Target Node>>";
     }
    
+  case ISD::MEMBARRIER:    return "MemBarrier";
   case ISD::PCMARKER:      return "PCMarker";
   case ISD::READCYCLECOUNTER: return "ReadCycleCounter";
   case ISD::SRCVALUE:      return "SrcValue";