diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-03-08 00:58:38 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-03-08 00:58:38 +0000 |
commit | 27b7db549e4c5bff4579d209304de5628513edeb (patch) | |
tree | 57198f184b01fe55ebbca8a70a05c679e1011b97 /lib/CodeGen | |
parent | a2fcff4d97c8fecd58cd977c45f1a883bc6ae1c3 (diff) |
Implement x86 support for @llvm.prefetch. It corresponds to prefetcht{0|1|2} and prefetchnta instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 18 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 14 |
3 files changed, 29 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index fd9cf15443..8e59b53d1c 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1142,6 +1142,24 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { } break; + case ISD::PREFETCH: + assert(Node->getNumOperands() == 4 && "Invalid Prefetch node!"); + switch (TLI.getOperationAction(ISD::PREFETCH, MVT::Other)) { + default: assert(0 && "This action is not supported yet!"); + case TargetLowering::Legal: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the address. + Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the rw specifier. + Tmp4 = LegalizeOp(Node->getOperand(3)); // Legalize locality specifier. + Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3, Tmp4); + break; + case TargetLowering::Expand: + // It's a noop. + Result = LegalizeOp(Node->getOperand(0)); + break; + } + break; + case ISD::MEMBARRIER: { assert(Node->getNumOperands() == 6 && "Invalid MemBarrier node!"); switch (TLI.getOperationAction(ISD::MEMBARRIER, MVT::Other)) { diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 1db78fe2a4..b3251b066a 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3788,6 +3788,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { return "<<Unknown Target Node>>"; } + case ISD::PREFETCH: return "Prefetch"; case ISD::MEMBARRIER: return "MemBarrier"; case ISD::ATOMIC_LCS: return "AtomicLCS"; case ISD::ATOMIC_LAS: return "AtomicLAS"; diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 016bb10584..1140e20a44 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2996,10 +2996,6 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { DAG.setRoot(DAG.getNode(ISD::STACKRESTORE, MVT::Other, getRoot(), Tmp)); return 0; } - case Intrinsic::prefetch: - // FIXME: Currently discarding prefetches. - return 0; - case Intrinsic::var_annotation: // Discard annotate attributes return 0; @@ -3050,6 +3046,16 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { DAG.setRoot(DAG.getNode(ISD::TRAP, MVT::Other, getRoot())); return 0; } + case Intrinsic::prefetch: { + SDOperand Ops[4]; + Ops[0] = getRoot(); + Ops[1] = getValue(I.getOperand(1)); + Ops[2] = getValue(I.getOperand(2)); + Ops[3] = getValue(I.getOperand(3)); + DAG.setRoot(DAG.getNode(ISD::PREFETCH, MVT::Other, &Ops[0], 4)); + return 0; + } + case Intrinsic::memory_barrier: { SDOperand Ops[6]; Ops[0] = getRoot(); |