diff options
author | Mon P Wang <wangmp@apple.com> | 2008-11-01 20:24:53 +0000 |
---|---|---|
committer | Mon P Wang <wangmp@apple.com> | 2008-11-01 20:24:53 +0000 |
commit | 769134be1eaec2dd758727b095bef827d517512b (patch) | |
tree | 2fbb4354a6179a4cc5836344589eebc5f735e3f5 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | |
parent | 20b96874500534bbd940f8a61588ccaf7547a9e4 (diff) | |
download | bcm5719-llvm-769134be1eaec2dd758727b095bef827d517512b.tar.gz bcm5719-llvm-769134be1eaec2dd758727b095bef827d517512b.zip |
Added interface to allow clients to create a MemIntrinsicNode for
target intrinsics that touches memory
llvm-svn: 58548
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index e34e78fca6d..738575380d0 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -2577,9 +2577,14 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I, Ops.push_back(getRoot()); } } - - // Add the intrinsic ID as an integer operand. - Ops.push_back(DAG.getConstant(Intrinsic, TLI.getPointerTy())); + + // Info is set by getTgtMemInstrinsic + TargetLowering::IntrinsicInfo Info; + bool IsTgtIntrinsic = TLI.getTgtMemIntrinsic(Info, I, Intrinsic); + + // Add the intrinsic ID as an integer operand if it's not a target intrinsic. + if (!IsTgtIntrinsic) + Ops.push_back(DAG.getConstant(Intrinsic, TLI.getPointerTy())); // Add all operands of the call to the operand list. for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i) { @@ -2610,7 +2615,15 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I, // Create the node. SDValue Result; - if (!HasChain) + if (IsTgtIntrinsic) { + // This is target intrinsic that touches memory + Result = DAG.getMemIntrinsicNode(Info.opc, VTList, VTs.size(), + &Ops[0], Ops.size(), + Info.memVT, Info.ptrVal, Info.offset, + Info.align, Info.vol, + Info.readMem, Info.writeMem); + } + else if (!HasChain) Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, VTList, VTs.size(), &Ops[0], Ops.size()); else if (I.getType() != Type::VoidTy) |