[sdag] Add the helper I most want to the DAG -- building a bitcast
[oota-llvm.git] / lib / CodeGen / SelectionDAG / SelectionDAG.cpp
index efd4bd9a4d89369d923b036e3f2f94bfefb1f69e..b9eb8f0d0ff7ca49d6d6be7bdcb9b235f00ac9aa 100644 (file)
@@ -1810,6 +1810,13 @@ SDValue SelectionDAG::getMDNode(const MDNode *MD) {
   return SDValue(N, 0);
 }
 
+SDValue SelectionDAG::getBitcast(EVT VT, SDValue V) {
+  if (VT == V.getValueType())
+    return V;
+
+  return getNode(ISD::BITCAST, SDLoc(V), VT, V);
+}
+
 /// getAddrSpaceCast - Return an AddrSpaceCastSDNode.
 SDValue SelectionDAG::getAddrSpaceCast(SDLoc dl, EVT VT, SDValue Ptr,
                                        unsigned SrcAS, unsigned DestAS) {