1//===- llvm/Transforms/Utils/LowerMemIntrinsics.h ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Lower memset, memcpy, memmov intrinsics to loops (e.g. for targets without
10// library support).
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_UTILS_LOWERMEMINTRINSICS_H
15#define LLVM_TRANSFORMS_UTILS_LOWERMEMINTRINSICS_H
16
17namespace llvm {
18
19class ConstantInt;
20class Instruction;
21class MemCpyInst;
22class MemMoveInst;
23class MemSetInst;
24class TargetTransformInfo;
25class Value;
26struct Align;
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.
30void createMemCpyLoopUnknownSize(Instruction *InsertBefore, Value *SrcAddr,
31 Value *DstAddr, Value *CopyLen,
32 Align SrcAlign, Align 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.
38void createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr,
39 Value *DstAddr, ConstantInt *CopyLen,
40 Align SrcAlign, Align DestAlign,
41 bool SrcIsVolatile, bool DstIsVolatile,
42 const TargetTransformInfo &TTI);
43
44/// Expand \p MemCpy as a loop. \p MemCpy is not deleted.
45void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI);
46
47/// Expand \p MemMove as a loop. \p MemMove is not deleted.
48void expandMemMoveAsLoop(MemMoveInst *MemMove);
49
50/// Expand \p MemSet as a loop. \p MemSet is not deleted.
51void expandMemSetAsLoop(MemSetInst *MemSet);
52
53} // End llvm namespace
54
55#endif
56