aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2005-11-20 21:32:07 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2005-11-20 21:32:07 +0000
commitf70e30b41dc6a92733681dcea2c06d8b3dd488db (patch)
tree32729af5b378897971cc80a624db8cf33b83c9cb /lib/CodeGen/SelectionDAG
parent6bf234c4a894b898954f8be3fb5973caba241012 (diff)
The first patch of X86 support for read cycle counter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 31b0e0815d..429abf3be2 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1168,6 +1168,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
if (Tmp1 != Node->getOperand(0))
Result = DAG.getNode(ISD::READCYCLECOUNTER, MVT::i64, Tmp1);
break;
+
case ISD::TRUNCSTORE:
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the pointer.
@@ -3336,6 +3337,17 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
Hi = DAG.getConstant(0, NVT);
break;
}
+
+ case ISD::READCYCLECOUNTER:
+ if (TLI.getOperationAction(ISD::READCYCLECOUNTER, VT) == TargetLowering::Custom) {
+ SDOperand Chain = LegalizeOp(Node->getOperand(0));
+ AddLegalizedOperand(SDOperand(Node, 1), Chain);
+ SDOperand t = TLI.LowerOperation(Op, DAG);
+ ExpandOp(t, Lo, Hi);
+ } else
+ assert(0 && "Must custom expand ReadCycleCounter");
+ break;
+
// These operators cannot be expanded directly, emit them as calls to
// library functions.
case ISD::FP_TO_SINT: