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 where the size is not 29 /// a compile-time constant. Loop will be insterted at \p InsertBefore. 30 void createMemCpyLoopUnknownSize(Instruction *InsertBefore, Value *SrcAddr, 31 Value *DstAddr, Value *CopyLen, 32 unsigned SrcAlign, unsigned DestAlign, 33 bool SrcIsVolatile, bool DstIsVolatile, 34 const TargetTransformInfo &TTI); 35 36 /// Emit a loop implementing the semantics of an llvm.memcpy whose size is a 37 /// compile time constant. Loop is inserted at \p InsertBefore. 38 void createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr, 39 Value *DstAddr, ConstantInt *CopyLen, 40 unsigned SrcAlign, unsigned DestAlign, 41 bool SrcIsVolatile, bool DstIsVolatile, 42 const TargetTransformInfo &TTI); 43 44 45 /// Expand \p MemCpy as a loop. \p MemCpy is not deleted. 46 void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI); 47 48 /// Expand \p MemMove as a loop. \p MemMove is not deleted. 49 void expandMemMoveAsLoop(MemMoveInst *MemMove); 50 51 /// Expand \p MemSet as a loop. \p MemSet is not deleted. 52 void expandMemSetAsLoop(MemSetInst *MemSet); 53 54 } // End llvm namespace 55 56 #endif 57