LLVM  17.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 <cstdint>
18 #include <optional>
19 
20 namespace llvm {
21 
22 class AtomicMemCpyInst;
23 class ConstantInt;
24 class Instruction;
25 class MemCpyInst;
26 class MemMoveInst;
27 class MemSetInst;
28 class ScalarEvolution;
29 class TargetTransformInfo;
30 class Value;
31 struct Align;
32 
33 /// Emit a loop implementing the semantics of llvm.memcpy where the size is not
34 /// a compile-time constant. Loop will be insterted at \p InsertBefore.
36  Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr, Value *CopyLen,
37  Align SrcAlign, Align DestAlign, bool SrcIsVolatile, bool DstIsVolatile,
38  bool CanOverlap, const TargetTransformInfo &TTI,
39  std::optional<unsigned> AtomicSize = std::nullopt);
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.
44  Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr,
45  ConstantInt *CopyLen, Align SrcAlign, Align DestAlign, bool SrcIsVolatile,
46  bool DstIsVolatile, bool CanOverlap, const TargetTransformInfo &TTI,
47  std::optional<uint32_t> AtomicCpySize = std::nullopt);
48 
49 /// Expand \p MemCpy as a loop. \p MemCpy is not deleted.
50 void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI,
51  ScalarEvolution *SE = nullptr);
52 
53 /// Expand \p MemMove as a loop. \p MemMove is not deleted.
54 void expandMemMoveAsLoop(MemMoveInst *MemMove);
55 
56 /// Expand \p MemSet as a loop. \p MemSet is not deleted.
57 void expandMemSetAsLoop(MemSetInst *MemSet);
58 
59 /// Expand \p AtomicMemCpy as a loop. \p AtomicMemCpy is not deleted.
60 void expandAtomicMemCpyAsLoop(AtomicMemCpyInst *AtomicMemCpy,
61  const TargetTransformInfo &TTI,
62  ScalarEvolution *SE);
63 
64 } // End llvm namespace
65 
66 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Align
uint64_t Align
Definition: ELFObjHandler.cpp:82
llvm::TTI
TargetTransformInfo TTI
Definition: TargetTransformInfo.h:167
llvm::expandMemSetAsLoop
void expandMemSetAsLoop(MemSetInst *MemSet)
Expand MemSet as a loop. MemSet is not deleted.
Definition: LowerMemIntrinsics.cpp:566
llvm::expandMemMoveAsLoop
void expandMemMoveAsLoop(MemMoveInst *MemMove)
Expand MemMove as a loop. MemMove is not deleted.
Definition: LowerMemIntrinsics.cpp:555
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
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, std::optional< unsigned > AtomicSize=std::nullopt)
Emit a loop implementing the semantics of llvm.memcpy where the size is not a compile-time constant.
llvm::expandAtomicMemCpyAsLoop
void expandAtomicMemCpyAsLoop(AtomicMemCpyInst *AtomicMemCpy, const TargetTransformInfo &TTI, ScalarEvolution *SE)
Expand AtomicMemCpy as a loop. AtomicMemCpy is not deleted.
Definition: LowerMemIntrinsics.cpp:575
llvm::expandMemCpyAsLoop
void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI, ScalarEvolution *SE=nullptr)
Expand MemCpy as a loop. MemCpy is not deleted.
Definition: LowerMemIntrinsics.cpp:524
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, std::optional< uint32_t > AtomicCpySize=std::nullopt)
Emit a loop implementing the semantics of an llvm.memcpy whose size is a compile time constant.
Definition: LowerMemIntrinsics.cpp:20