@@ -296,6 +296,95 @@ namespace llvm {
296
296
}
297
297
};
298
298
299
+ class ElementUnorderedAtomicMemMoveInst : public IntrinsicInst {
300
+ private:
301
+ enum { ARG_DEST = 0 , ARG_SOURCE = 1 , ARG_LENGTH = 2 , ARG_ELEMENTSIZE = 3 };
302
+
303
+ public:
304
+ Value *getRawDest () const {
305
+ return const_cast <Value *>(getArgOperand (ARG_DEST));
306
+ }
307
+ const Use &getRawDestUse () const { return getArgOperandUse (ARG_DEST); }
308
+ Use &getRawDestUse () { return getArgOperandUse (ARG_DEST); }
309
+
310
+ // / Return the arguments to the instruction.
311
+ Value *getRawSource () const {
312
+ return const_cast <Value *>(getArgOperand (ARG_SOURCE));
313
+ }
314
+ const Use &getRawSourceUse () const { return getArgOperandUse (ARG_SOURCE); }
315
+ Use &getRawSourceUse () { return getArgOperandUse (ARG_SOURCE); }
316
+
317
+ Value *getLength () const {
318
+ return const_cast <Value *>(getArgOperand (ARG_LENGTH));
319
+ }
320
+ const Use &getLengthUse () const { return getArgOperandUse (ARG_LENGTH); }
321
+ Use &getLengthUse () { return getArgOperandUse (ARG_LENGTH); }
322
+
323
+ bool isVolatile () const { return false ; }
324
+
325
+ Value *getRawElementSizeInBytes () const {
326
+ return const_cast <Value *>(getArgOperand (ARG_ELEMENTSIZE));
327
+ }
328
+
329
+ ConstantInt *getElementSizeInBytesCst () const {
330
+ return cast<ConstantInt>(getRawElementSizeInBytes ());
331
+ }
332
+
333
+ uint32_t getElementSizeInBytes () const {
334
+ return getElementSizeInBytesCst ()->getZExtValue ();
335
+ }
336
+
337
+ // / This is just like getRawDest, but it strips off any cast
338
+ // / instructions that feed it, giving the original input. The returned
339
+ // / value is guaranteed to be a pointer.
340
+ Value *getDest () const { return getRawDest ()->stripPointerCasts (); }
341
+
342
+ // / This is just like getRawSource, but it strips off any cast
343
+ // / instructions that feed it, giving the original input. The returned
344
+ // / value is guaranteed to be a pointer.
345
+ Value *getSource () const { return getRawSource ()->stripPointerCasts (); }
346
+
347
+ unsigned getDestAddressSpace () const {
348
+ return cast<PointerType>(getRawDest ()->getType ())->getAddressSpace ();
349
+ }
350
+
351
+ unsigned getSourceAddressSpace () const {
352
+ return cast<PointerType>(getRawSource ()->getType ())->getAddressSpace ();
353
+ }
354
+
355
+ // / Set the specified arguments of the instruction.
356
+ void setDest (Value *Ptr ) {
357
+ assert (getRawDest ()->getType () == Ptr ->getType () &&
358
+ " setDest called with pointer of wrong type!" );
359
+ setArgOperand (ARG_DEST, Ptr );
360
+ }
361
+
362
+ void setSource (Value *Ptr ) {
363
+ assert (getRawSource ()->getType () == Ptr ->getType () &&
364
+ " setSource called with pointer of wrong type!" );
365
+ setArgOperand (ARG_SOURCE, Ptr );
366
+ }
367
+
368
+ void setLength (Value *L) {
369
+ assert (getLength ()->getType () == L->getType () &&
370
+ " setLength called with value of wrong type!" );
371
+ setArgOperand (ARG_LENGTH, L);
372
+ }
373
+
374
+ void setElementSizeInBytes (Constant *V) {
375
+ assert (V->getType () == Type::getInt8Ty (getContext ()) &&
376
+ " setElementSizeInBytes called with value of wrong type!" );
377
+ setArgOperand (ARG_ELEMENTSIZE, V);
378
+ }
379
+
380
+ static inline bool classof (const IntrinsicInst *I) {
381
+ return I->getIntrinsicID () == Intrinsic::memmove_element_unordered_atomic;
382
+ }
383
+ static inline bool classof (const Value *V) {
384
+ return isa<IntrinsicInst>(V) && classof (cast<IntrinsicInst>(V));
385
+ }
386
+ };
387
+
299
388
// / This is the common base class for memset/memcpy/memmove.
300
389
class MemIntrinsic : public IntrinsicInst {
301
390
public:
0 commit comments