LLVM  15.0.0git
LowerMemIntrinsics.h
Go to the documentation of this file.
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 
17 #include "llvm/ADT/Optional.h"
18 
19 namespace llvm {
20 
21 class AtomicMemCpyInst;
22 class ConstantInt;
23 class Instruction;
24 class MemCpyInst;
25 class MemMoveInst;
26 class MemSetInst;
27 class ScalarEvolution;
28 class TargetTransformInfo;
29 class Value;
30 struct Align;
31 
32 /// Emit a loop implementing the semantics of llvm.memcpy where the size is not
33 /// a compile-time constant. Loop will be insterted at \p InsertBefore.
34 void createMemCpyLoopUnknownSize(Instruction *InsertBefore, Value *SrcAddr,
35  Value *DstAddr, Value *CopyLen, Align SrcAlign,
36  Align DestAlign, bool SrcIsVolatile,
37  bool DstIsVolatile, bool CanOverlap,
38  const TargetTransformInfo &TTI,
39  Optional<unsigned> AtomicSize = None);
40 
41 /// Emit a loop implementing the semantics of an llvm.memcpy whose size is a
42 /// compile time constant. Loop is inserted at \p InsertBefore.
43 void createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr,
44  Value *DstAddr, ConstantInt *CopyLen,
45  Align SrcAlign, Align DestAlign,
46  bool SrcIsVolatile, bool DstIsVolatile,
47  bool CanOverlap, const TargetTransformInfo &TTI,
48  Optional<uint32_t> AtomicCpySize = None);
49 
50 /// Expand \p MemCpy as a loop. \p MemCpy is not deleted.
51 void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI,
52  ScalarEvolution *SE = nullptr);
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 /// Expand \p AtomicMemCpy as a loop. \p AtomicMemCpy is not deleted.
61 void expandAtomicMemCpyAsLoop(AtomicMemCpyInst *AtomicMemCpy,
62  const TargetTransformInfo &TTI,
63  ScalarEvolution *SE);
64 
65 } // End llvm namespace
66 
67 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
Optional.h
llvm::createMemCpyLoopUnknownSize
void createMemCpyLoopUnknownSize(Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr, Value *CopyLen, Align SrcAlign, Align DestAlign, bool SrcIsVolatile, bool DstIsVolatile, bool CanOverlap, const TargetTransformInfo &TTI, Optional< unsigned > AtomicSize=None)
Emit a loop implementing the semantics of llvm.memcpy where the size is not a compile-time constant.
Align
uint64_t Align
Definition: ELFObjHandler.cpp:81
llvm::None
const NoneType None
Definition: None.h:24
llvm::TTI
TargetTransformInfo TTI
Definition: TargetTransformInfo.h:162
llvm::expandMemSetAsLoop
void expandMemSetAsLoop(MemSetInst *MemSet)
Expand MemSet as a loop. MemSet is not deleted.
Definition: LowerMemIntrinsics.cpp:569
llvm::expandMemMoveAsLoop
void expandMemMoveAsLoop(MemMoveInst *MemMove)
Expand MemMove as a loop. MemMove is not deleted.
Definition: LowerMemIntrinsics.cpp:558
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::createMemCpyLoopKnownSize
void createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr, ConstantInt *CopyLen, Align SrcAlign, Align DestAlign, bool SrcIsVolatile, bool DstIsVolatile, bool CanOverlap, const TargetTransformInfo &TTI, Optional< uint32_t > AtomicCpySize=None)
Emit a loop implementing the semantics of an llvm.memcpy whose size is a compile time constant.
Definition: LowerMemIntrinsics.cpp:19
llvm::expandAtomicMemCpyAsLoop
void expandAtomicMemCpyAsLoop(AtomicMemCpyInst *AtomicMemCpy, const TargetTransformInfo &TTI, ScalarEvolution *SE)
Expand AtomicMemCpy as a loop. AtomicMemCpy is not deleted.
Definition: LowerMemIntrinsics.cpp:578
llvm::expandMemCpyAsLoop
void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI, ScalarEvolution *SE=nullptr)
Expand MemCpy as a loop. MemCpy is not deleted.
Definition: LowerMemIntrinsics.cpp:527