1 //===- llvm/Transforms/Utils/LowerMemintrinsics.h ---------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // Lower memset, memcpy, memmov intrinsics to loops (e.g. for targets without 11 // library support). 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_TRANSFORMS_UTILS_LOWERMEMINTRINSICS_H 16 #define LLVM_TRANSFORMS_UTILS_LOWERMEMINTRINSICS_H 17 18 namespace llvm { 19 20 class ConstantInt; 21 class Instruction; 22 class MemCpyInst; 23 class MemMoveInst; 24 class MemSetInst; 25 class TargetTransformInfo; 26 class Value; 27 28 /// Emit a loop implementing the semantics of llvm.memcpy with the equivalent 29 /// arguments at \p InsertBefore. 30 void createMemCpyLoop(Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr, 31 Value *CopyLen, unsigned SrcAlign, unsigned DestAlign, 32 bool SrcIsVolatile, bool DstIsVolatile); 33 34 /// Emit a loop implementing the semantics of llvm.memcpy where the size is not 35 /// a compile-time constant. Loop will be insterted at \p InsertBefore. 36 void createMemCpyLoopUnknownSize(Instruction *InsertBefore, Value *SrcAddr, 37 Value *DstAddr, Value *CopyLen, 38 unsigned SrcAlign, unsigned DestAlign, 39 bool SrcIsVolatile, bool DstIsVolatile, 40 const TargetTransformInfo &TTI); 41 42 /// Emit a loop implementing the semantics of an llvm.memcpy whose size is a 43 /// compile time constant. Loop is inserted at \p InsertBefore. 44 void createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr, 45 Value *DstAddr, ConstantInt *CopyLen, 46 unsigned SrcAlign, unsigned DestAlign, 47 bool SrcIsVolatile, bool DstIsVolatile, 48 const TargetTransformInfo &TTI); 49 50 51 /// Expand \p MemCpy as a loop. \p MemCpy is not deleted. 52 void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI); 53 54 /// Expand \p MemMove as a loop. \p MemMove is not deleted. 55 void expandMemMoveAsLoop(MemMoveInst *MemMove); 56 57 /// Expand \p MemSet as a loop. \p MemSet is not deleted. 58 void expandMemSetAsLoop(MemSetInst *MemSet); 59 60 } // End llvm namespace 61 62 #endif 63