added a chain output
authorAndrew Lenharth <andrewl@lenharth.org>
Fri, 11 Nov 2005 22:48:54 +0000 (22:48 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Fri, 11 Nov 2005 22:48:54 +0000 (22:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24306 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 94ef5d5901f80c50484373d29b355f3157f94d11..3af9008a436f82210ebd748231e53cfbc66f9165 100644 (file)
@@ -308,6 +308,9 @@ namespace ISD {
     PCMARKER,
 
     // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
+    // The only operand is a chain and a value and a chain are produced.  The
+    // value is the contents of the architecture specific cycle counter like 
+    // register (or other high accuracy low latency clock source)
     READCYCLECOUNTER,
 
     // READPORT, WRITEPORT, READIO, WRITEIO - These correspond to the LLVM
index ae61e208963e4854cb761189efc68b6753053de5..01e76c1b42394d7c558db52116974f662902b257 100644 (file)
@@ -804,9 +804,17 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
     DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Tmp));
     return 0;
   }
-  case Intrinsic::readcyclecounter: 
-    setValue(&I, DAG.getNode(ISD::READCYCLECOUNTER, MVT::i64, getRoot()));
+  case Intrinsic::readcyclecounter: {
+    std::vector<MVT::ValueType> VTs;
+    VTs.push_back(MVT::i64);
+    VTs.push_back(MVT::Other);
+    std::vector<SDOperand> Ops;
+    Ops.push_back(getRoot());
+    SDOperand Tmp = DAG.getNode(ISD::READCYCLECOUNTER, VTs, Ops);
+    setValue(&I, Tmp);
+    DAG.setRoot(Tmp.getValue(1));
     return 0;
+  }
   case Intrinsic::cttz:
     setValue(&I, DAG.getNode(ISD::CTTZ,
                              getValue(I.getOperand(1)).getValueType(),