Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:43

0001 //===- llvm/Transforms/Utils/LowerMemIntrinsics.h ---------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Lower memset, memcpy, memmov intrinsics to loops (e.g. for targets without
0010 // library support).
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_TRANSFORMS_UTILS_LOWERMEMINTRINSICS_H
0015 #define LLVM_TRANSFORMS_UTILS_LOWERMEMINTRINSICS_H
0016 
0017 #include <cstdint>
0018 #include <optional>
0019 
0020 namespace llvm {
0021 
0022 class AtomicMemCpyInst;
0023 class ConstantInt;
0024 class Instruction;
0025 class MemCpyInst;
0026 class MemMoveInst;
0027 class MemSetInst;
0028 class MemSetPatternInst;
0029 class ScalarEvolution;
0030 class TargetTransformInfo;
0031 class Value;
0032 struct Align;
0033 
0034 /// Emit a loop implementing the semantics of llvm.memcpy where the size is not
0035 /// a compile-time constant. Loop will be insterted at \p InsertBefore.
0036 void createMemCpyLoopUnknownSize(
0037     Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr, Value *CopyLen,
0038     Align SrcAlign, Align DestAlign, bool SrcIsVolatile, bool DstIsVolatile,
0039     bool CanOverlap, const TargetTransformInfo &TTI,
0040     std::optional<unsigned> AtomicSize = std::nullopt);
0041 
0042 /// Emit a loop implementing the semantics of an llvm.memcpy whose size is a
0043 /// compile time constant. Loop is inserted at \p InsertBefore.
0044 void createMemCpyLoopKnownSize(
0045     Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr,
0046     ConstantInt *CopyLen, Align SrcAlign, Align DestAlign, bool SrcIsVolatile,
0047     bool DstIsVolatile, bool CanOverlap, const TargetTransformInfo &TTI,
0048     std::optional<uint32_t> AtomicCpySize = std::nullopt);
0049 
0050 /// Expand \p MemCpy as a loop. \p MemCpy is not deleted.
0051 void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI,
0052                         ScalarEvolution *SE = nullptr);
0053 
0054 /// Expand \p MemMove as a loop. \p MemMove is not deleted. Returns true if the
0055 /// memmove was lowered.
0056 bool expandMemMoveAsLoop(MemMoveInst *MemMove, const TargetTransformInfo &TTI);
0057 
0058 /// Expand \p MemSet as a loop. \p MemSet is not deleted.
0059 void expandMemSetAsLoop(MemSetInst *MemSet);
0060 
0061 /// Expand \p MemSetPattern as a loop. \p MemSet is not deleted.
0062 void expandMemSetPatternAsLoop(MemSetPatternInst *MemSet);
0063 
0064 /// Expand \p AtomicMemCpy as a loop. \p AtomicMemCpy is not deleted.
0065 void expandAtomicMemCpyAsLoop(AtomicMemCpyInst *AtomicMemCpy,
0066                               const TargetTransformInfo &TTI,
0067                               ScalarEvolution *SE);
0068 
0069 } // End llvm namespace
0070 
0071 #endif