I cannot find a libgcc function for this builtin. Therefor expanding it to a noop...
[oota-llvm.git] / lib / CodeGen / SelectionDAG / LegalizeDAG.cpp
index 0d6a47c01366954a712434cb814c1970a52410b9..9355e4871fe4dc38b2e25f242f3f8121c5f95e0a 100644 (file)
@@ -1135,11 +1135,21 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
 
   case ISD::MEMBARRIER: {
     assert(Node->getNumOperands() == 6 && "Invalid MemBarrier node!");
-    SDOperand Ops[6];
-    Ops[0] = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
-    for (int x = 1; x < 6; ++x)
-      Ops[x] = PromoteOp(Node->getOperand(x));
-    Result = DAG.UpdateNodeOperands(Result, &Ops[0], 6);
+    switch (TLI.getOperationAction(ISD::MEMBARRIER, MVT::Other)) {
+    default: assert(0 && "This action is not supported yet!");
+    case TargetLowering::Legal: {
+      SDOperand Ops[6];
+      Ops[0] = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
+      for (int x = 1; x < 6; ++x)
+        Ops[x] = PromoteOp(Node->getOperand(x));
+      Result = DAG.UpdateNodeOperands(Result, &Ops[0], 6);
+      break;
+    }
+    case TargetLowering::Expand:
+      //There is no libgcc call for this op
+      Result = Node->getOperand(0);  // Noop
+    break;
+    }
     break;
   }