OLD | NEW |
1 //===-- X86SelectionDAGInfo.cpp - X86 SelectionDAG Info -------------------===// | 1 //===-- X86SelectionDAGInfo.cpp - X86 SelectionDAG Info -------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the X86SelectionDAGInfo class. | 10 // This file implements the X86SelectionDAGInfo class. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 SDValue | 52 SDValue |
53 X86SelectionDAGInfo::EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl, | 53 X86SelectionDAGInfo::EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl, |
54 SDValue Chain, | 54 SDValue Chain, |
55 SDValue Dst, SDValue Src, | 55 SDValue Dst, SDValue Src, |
56 SDValue Size, unsigned Align, | 56 SDValue Size, unsigned Align, |
57 bool isVolatile, | 57 bool isVolatile, |
58 MachinePointerInfo DstPtrInfo) const { | 58 MachinePointerInfo DstPtrInfo) const { |
59 ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size); | 59 ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size); |
60 const X86Subtarget &Subtarget = DAG.getTarget().getSubtarget<X86Subtarget>(); | 60 const X86Subtarget &Subtarget = DAG.getTarget().getSubtarget<X86Subtarget>(); |
61 | 61 |
| 62 // @LOCALMOD-BEGIN |
| 63 if (Subtarget.isTargetNaCl()) { |
| 64 // TODO: Can we allow this optimization for Native Client? |
| 65 // At the very least, pointer size needs to be fixed below. |
| 66 return SDValue(); |
| 67 } |
| 68 // @LOCALMOD-END |
62 #ifndef NDEBUG | 69 #ifndef NDEBUG |
63 // If the base register might conflict with our physical registers, bail out. | 70 // If the base register might conflict with our physical registers, bail out. |
64 unsigned ClobberSet[] = {X86::RCX, X86::RAX, X86::RDI, | 71 unsigned ClobberSet[] = {X86::RCX, X86::RAX, X86::RDI, |
65 X86::ECX, X86::EAX, X86::EDI}; | 72 X86::ECX, X86::EAX, X86::EDI}; |
66 assert(!isBaseRegConflictPossible(DAG, ClobberSet)); | 73 assert(!isBaseRegConflictPossible(DAG, ClobberSet)); |
67 #endif | 74 #endif |
68 | 75 |
69 // If to a segment-relative address space, use the default lowering. | 76 // If to a segment-relative address space, use the default lowering. |
70 if (DstPtrInfo.getAddrSpace() >= 256) | 77 if (DstPtrInfo.getAddrSpace() >= 256) |
71 return SDValue(); | 78 return SDValue(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // This requires the copy size to be a constant, preferably | 216 // This requires the copy size to be a constant, preferably |
210 // within a subtarget-specific limit. | 217 // within a subtarget-specific limit. |
211 ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size); | 218 ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size); |
212 const X86Subtarget &Subtarget = DAG.getTarget().getSubtarget<X86Subtarget>(); | 219 const X86Subtarget &Subtarget = DAG.getTarget().getSubtarget<X86Subtarget>(); |
213 if (!ConstantSize) | 220 if (!ConstantSize) |
214 return SDValue(); | 221 return SDValue(); |
215 uint64_t SizeVal = ConstantSize->getZExtValue(); | 222 uint64_t SizeVal = ConstantSize->getZExtValue(); |
216 if (!AlwaysInline && SizeVal > Subtarget.getMaxInlineSizeThreshold()) | 223 if (!AlwaysInline && SizeVal > Subtarget.getMaxInlineSizeThreshold()) |
217 return SDValue(); | 224 return SDValue(); |
218 | 225 |
| 226 // @LOCALMOD-BEGIN |
| 227 if (Subtarget.isTargetNaCl()) { |
| 228 // TODO(pdox): Allow use of the NaCl pseudo-instruction for REP MOV |
| 229 return SDValue(); |
| 230 } |
| 231 // @LOCALMOD-END |
| 232 |
219 /// If not DWORD aligned, it is more efficient to call the library. However | 233 /// If not DWORD aligned, it is more efficient to call the library. However |
220 /// if calling the library is not allowed (AlwaysInline), then soldier on as | 234 /// if calling the library is not allowed (AlwaysInline), then soldier on as |
221 /// the code generated here is better than the long load-store sequence we | 235 /// the code generated here is better than the long load-store sequence we |
222 /// would otherwise get. | 236 /// would otherwise get. |
223 if (!AlwaysInline && (Align & 3) != 0) | 237 if (!AlwaysInline && (Align & 3) != 0) |
224 return SDValue(); | 238 return SDValue(); |
225 | 239 |
226 // If to a segment-relative address space, use the default lowering. | 240 // If to a segment-relative address space, use the default lowering. |
227 if (DstPtrInfo.getAddrSpace() >= 256 || | 241 if (DstPtrInfo.getAddrSpace() >= 256 || |
228 SrcPtrInfo.getAddrSpace() >= 256) | 242 SrcPtrInfo.getAddrSpace() >= 256) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 DAG.getNode(ISD::ADD, dl, SrcVT, Src, | 297 DAG.getNode(ISD::ADD, dl, SrcVT, Src, |
284 DAG.getConstant(Offset, SrcVT)), | 298 DAG.getConstant(Offset, SrcVT)), |
285 DAG.getConstant(BytesLeft, SizeVT), | 299 DAG.getConstant(BytesLeft, SizeVT), |
286 Align, isVolatile, AlwaysInline, | 300 Align, isVolatile, AlwaysInline, |
287 DstPtrInfo.getWithOffset(Offset), | 301 DstPtrInfo.getWithOffset(Offset), |
288 SrcPtrInfo.getWithOffset(Offset))); | 302 SrcPtrInfo.getWithOffset(Offset))); |
289 } | 303 } |
290 | 304 |
291 return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Results); | 305 return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Results); |
292 } | 306 } |
OLD | NEW |