52#define DEBUG_TYPE "pre-isel-intrinsic-lowering"
58 "mem-intrinsic-expand-size",
65 "bounded-memset-inline-size",
66 cl::desc(
"Set maximum bound of a variable-length memset to expand inline"),
71struct PreISelIntrinsicLowering {
81 const bool UseMemIntrinsicLibFunc;
83 explicit PreISelIntrinsicLowering(
89 bool UseMemIntrinsicLibFunc_ =
true)
90 : TM(TM_), ModuleLibcalls(ModuleLibcalls_), LookupTTI(LookupTTI_),
91 LookupTLI(LookupTLI_), LookupAC(LookupAC_),
92 UseMemIntrinsicLibFunc(UseMemIntrinsicLibFunc_) {}
94 static bool shouldExpandMemIntrinsicWithSize(
Value *
Size,
95 const TargetTransformInfo &
TTI);
96 bool tryExpandBoundedMemSet(MemSetInst *Memset,
97 const TargetTransformInfo &
TTI)
const;
100 DenseMap<Constant *, GlobalVariable *> &CMap)
const;
101 bool lowerIntrinsics(
Module &M)
const;
112 Use *LastUse =
nullptr;
114 while (!Intrin.
use_empty() && (!LastUse || LastUse->getNext())) {
115 Use *U = LastUse ? LastUse->getNext() : &*Intrin.
use_begin();
116 bool Removed =
false;
120 Changed |= Removed = Callback(CI);
136 if (!CI || CI->getCalledOperand() != &
F)
140 Value *Ptr = CI->getArgOperand(0);
141 Value *OffsetPtr =
B.CreatePtrAddWithSExtOrTrunc(Ptr, CI->getArgOperand(1));
142 Value *OffsetI32 =
B.CreateAlignedLoad(Int32Ty, OffsetPtr,
Align(4));
144 Value *ResultPtr =
B.CreatePtrAddWithSExtOrTrunc(Ptr, OffsetI32);
146 CI->replaceAllUsesWith(ResultPtr);
147 CI->eraseFromParent();
171 Result = Builder.getFalse();
193 "Pre-ISel intrinsics do lower into regular function calls");
205 M->getOrInsertFunction(NewFnName,
F.getFunctionType());
208 Fn->setLinkage(
F.getLinkage());
212 Fn->addFnAttr(Attribute::NonLazyBind);
221 if (CB->getCalledFunction() != &
F) {
223 "use expected to be the argument of operand bundle "
224 "\"clang.arc.attachedcall\"");
230 assert(CI->getCalledFunction() &&
"Cannot lower an indirect call!");
235 CI->getOperandBundlesAsDefs(BundleList);
236 CallInst *NewCI = Builder.CreateCall(FCache, Args, BundleList);
254 if (
F.getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
256 NewCI->
addParamAttr(Index - AttributeList::FirstArgIndex,
257 Attribute::Returned);
259 if (!CI->use_empty())
260 CI->replaceAllUsesWith(NewCI);
261 CI->eraseFromParent();
269bool PreISelIntrinsicLowering::shouldExpandMemIntrinsicWithSize(
281 return SizeVal > Threshold || Threshold == 0;
292 return Lowering.getLibcallImpl(LC) != RTLIB::Unsupported;
302 return Lowering.getMemcpyImpl() != RTLIB::Unsupported;
307bool PreISelIntrinsicLowering::tryExpandBoundedMemSet(
308 MemSetInst *Memset,
const TargetTransformInfo &
TTI)
const {
310 if (!TM || TM->
getOptLevel() == CodeGenOptLevel::None)
327 SQ.AC = &LookupAC(*
F);
335 if (RangeAttr.isValid())
359 Type *VTy =
V->getType();
379 if (
DL.isBigEndian())
402bool PreISelIntrinsicLowering::expandMemIntrinsicUses(
403 Function &
F, DenseMap<Constant *, GlobalVariable *> &CMap)
const {
411 case Intrinsic::memcpy: {
413 Function *ParentFunc = Memcpy->getFunction();
414 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
415 if (shouldExpandMemIntrinsicWithSize(Memcpy->getLength(),
TTI)) {
416 if (UseMemIntrinsicLibFunc &&
423 Memcpy->eraseFromParent();
428 case Intrinsic::memcpy_inline: {
437 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
440 Memcpy->eraseFromParent();
443 case Intrinsic::memmove: {
446 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
447 if (shouldExpandMemIntrinsicWithSize(Memmove->getLength(),
TTI)) {
448 if (UseMemIntrinsicLibFunc &&
454 Memmove->eraseFromParent();
460 case Intrinsic::memset: {
463 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
464 if (tryExpandBoundedMemSet(Memset,
TTI)) {
469 if (shouldExpandMemIntrinsicWithSize(Memset->
getLength(),
TTI)) {
470 if (UseMemIntrinsicLibFunc &&
481 case Intrinsic::memset_inline: {
490 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
496 case Intrinsic::experimental_memset_pattern: {
499 const TargetLibraryInfo &
TLI = LookupTLI(*ParentFunc);
504 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
517 Type *SizeTTy =
TLI.getSizeTType(*M);
518 StringRef FuncName =
"memset_pattern16";
520 Builder.getVoidTy(), DestPtrTy,
521 Builder.getPtrTy(), SizeTTy);
528 "Should have skipped if non-zero AS");
530 auto It = CMap.
find(PatternValue);
531 if (It != CMap.
end()) {
534 GV =
new GlobalVariable(
535 *M, PatternValue->
getType(),
true,
538 GlobalValue::UnnamedAddr::Global);
541 CMap[PatternValue] = GV;
543 Value *PatternPtr = GV;
544 Value *NumBytes = Builder.CreateMul(
547 Builder.CreateZExtOrTrunc(Memset->
getLength(), SizeTTy));
548 CallInst *MemsetPattern16Call =
549 Builder.CreateCall(MSP, {Memset->
getRawDest(), PatternPtr, NumBytes});
587 Intr.
getIntrinsicID() == Intrinsic::ptrauth_auth ?
"__emupac_autda"
595 !
Key ||
Key->getZExtValue() != 2)
599 Attribute FSAttr =
F->getFnAttribute(
"target-features");
603 std::vector<OperandBundleDef> DSBundle;
608 auto *EmuCall =
B.CreateCall(
609 EmuIntr, {
Call->getArgOperand(0),
Call->getArgOperand(2)}, DSBundle);
610 Call->replaceAllUsesWith(EmuCall);
611 Call->eraseFromParent();
628 auto *Pointer =
Call->getArgOperand(0);
643 if (
Op->isNullValue()) {
649 if (
Op->isNullValue()) {
664 DSsToDeactivate.
insert(DS);
667 Call->eraseFromParent();
670 if (!DSsToDeactivate.
empty()) {
681 OldDS->replaceAllUsesWith(DS);
682 OldDS->eraseFromParent();
696 Br->setSuccessor(Br->getParent());
697 Call->eraseFromParent();
705 if (!
Call->getParent()->isEntryBlock() &&
707 [](
Instruction &
I) { return !I.mayHaveSideEffects(); })) {
722 if (BI->getSuccessor(0) ==
Call->getParent()) {
724 Cond = BI->getCondition();
729 Cond =
B.CreateNot(BI->getCondition());
732 B.CreateIntrinsic(Intrinsic::cond_loop,
Cond);
736 B.CreateIntrinsic(Intrinsic::cond_loop,
738 Call->eraseFromParent();
743bool PreISelIntrinsicLowering::lowerIntrinsics(
Module &M)
const {
745 DenseMap<Constant *, GlobalVariable *> CMap;
748 switch (
F.getIntrinsicID()) {
751 case Intrinsic::memcpy:
752 case Intrinsic::memcpy_inline:
753 case Intrinsic::memmove:
754 case Intrinsic::memset:
755 case Intrinsic::memset_inline:
756 case Intrinsic::experimental_memset_pattern:
757 Changed |= expandMemIntrinsicUses(
F, CMap);
759 case Intrinsic::load_relative:
762 case Intrinsic::can_load_speculatively:
765 case Intrinsic::is_constant:
766 case Intrinsic::objectsize:
769 TargetLibraryInfo &
TLI = LookupTLI(*Parent);
775#define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
776 case Intrinsic::VPID:
777#include "llvm/IR/VPIntrinsics.def"
780 const TargetTransformInfo &
TTI = LookupTTI(*Parent);
786 Changed |= ED != VPExpansionDetails::IntrinsicUnchanged;
787 bool Removed = ED == VPExpansionDetails::IntrinsicReplaced;
791 case Intrinsic::objc_autorelease:
794 case Intrinsic::objc_autoreleasePoolPop:
797 case Intrinsic::objc_autoreleasePoolPush:
800 case Intrinsic::objc_autoreleaseReturnValue:
803 case Intrinsic::objc_copyWeak:
806 case Intrinsic::objc_destroyWeak:
809 case Intrinsic::objc_initWeak:
812 case Intrinsic::objc_loadWeak:
815 case Intrinsic::objc_loadWeakRetained:
818 case Intrinsic::objc_moveWeak:
821 case Intrinsic::objc_release:
824 case Intrinsic::objc_retain:
827 case Intrinsic::objc_retainAutorelease:
830 case Intrinsic::objc_retainAutoreleaseReturnValue:
834 case Intrinsic::objc_retainAutoreleasedReturnValue:
838 case Intrinsic::objc_claimAutoreleasedReturnValue:
842 case Intrinsic::objc_retainBlock:
845 case Intrinsic::objc_storeStrong:
848 case Intrinsic::objc_storeWeak:
851 case Intrinsic::objc_unsafeClaimAutoreleasedReturnValue:
853 lowerObjCCall(
F, RTLIB::impl_objc_unsafeClaimAutoreleasedReturnValue);
855 case Intrinsic::objc_retainedObject:
858 case Intrinsic::objc_unretainedObject:
861 case Intrinsic::objc_unretainedPointer:
864 case Intrinsic::objc_retain_autorelease:
867 case Intrinsic::objc_sync_enter:
870 case Intrinsic::objc_sync_exit:
873 case Intrinsic::acos:
874 case Intrinsic::asin:
875 case Intrinsic::atan:
877 case Intrinsic::cosh:
879 case Intrinsic::exp2:
880 case Intrinsic::exp10:
882 case Intrinsic::log2:
883 case Intrinsic::log10:
885 case Intrinsic::sinh:
887 case Intrinsic::tanh:
900 case Intrinsic::modf:
901 case Intrinsic::sincos:
902 case Intrinsic::sincospi:
918 LC = RTLIB::getMODF(VT);
921 LC = RTLIB::getSINCOS(VT);
924 LC = RTLIB::getSINCOSPI(VT);
930 const LibcallLoweringInfo &Libcalls =
937 case Intrinsic::ptrauth_sign:
938 case Intrinsic::ptrauth_auth:
941 case Intrinsic::protected_field_ptr:
944 case Intrinsic::cond_loop:
948 case Intrinsic::looptrap:
951 if (
auto *CondLoop =
M.getFunction(
"llvm.cond.loop"))
961class PreISelIntrinsicLoweringLegacyPass :
public ModulePass {
965 PreISelIntrinsicLoweringLegacyPass() : ModulePass(
ID) {}
967 void getAnalysisUsage(AnalysisUsage &AU)
const override {
975 bool runOnModule(
Module &M)
override {
976 const ModuleLibcallLoweringInfo &ModuleLibcalls =
977 getAnalysis<LibcallLoweringInfoWrapper>().getResult(M);
979 auto LookupTTI = [
this](
Function &
F) -> TargetTransformInfo & {
980 return this->getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
982 auto LookupTLI = [
this](
Function &
F) -> TargetLibraryInfo & {
983 return this->getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
F);
985 auto LookupAC = [
this](
Function &
F) -> AssumptionCache & {
986 return this->getAnalysis<AssumptionCacheTracker>().getAssumptionCache(
F);
989 const auto *TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
990 PreISelIntrinsicLowering
Lowering(TM, ModuleLibcalls, LookupTTI, LookupTLI,
998char PreISelIntrinsicLoweringLegacyPass::ID;
1001 "pre-isel-intrinsic-lowering",
1002 "Pre-ISel Intrinsic Lowering",
false,
false)
1010 "pre-isel-intrinsic-lowering",
1014 return new PreISelIntrinsicLoweringLegacyPass();
1034 PreISelIntrinsicLowering
Lowering(
TM, LibcallLowering, LookupTTI, LookupTLI,
const AArch64Subtarget & Subtarget
const TargetLowering & TLI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static bool setNonLazyBind(Function &F)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Module.h This file contains the declarations for the Module class.
This defines the Use class.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
Machine Check Debug Module
This file defines ARC utility functions which are used by various parts of the compiler.
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static cl::opt< int64_t > MemIntrinsicExpandSizeThresholdOpt("mem-intrinsic-expand-size", cl::desc("Set minimum mem intrinsic size to expand in IR"), cl::init(-1), cl::Hidden)
Threshold to leave statically sized memory intrinsic calls.
static bool canEmitMemcpy(const ModuleLibcallLoweringInfo &ModuleLowering, const TargetMachine *TM, Function *F)
static GlobalValue * getDeactivationSymbol(CallInst *Call)
static cl::opt< uint64_t > BoundedMemSetInlineSizeOpt("bounded-memset-inline-size", cl::desc("Set maximum bound of a variable-length memset to expand inline"), cl::Hidden)
Maximum bound of a memset with non-constant length for it to be expanded inline.
static bool canEmitLibcall(const ModuleLibcallLoweringInfo &ModuleLowering, const TargetMachine *TM, Function *F, RTLIB::Libcall LC)
static bool forEachCall(Function &Intrin, T Callback)
static bool expandLoopTrap(Function &Intr)
static bool expandCondLoop(Function &Intr)
pre isel intrinsic Pre ISel Intrinsic Lowering
static bool lowerCanLoadSpeculatively(Function &F, const TargetMachine *TM)
Lower @llvm.can.load.speculatively using target-specific expansion.
static CallInst::TailCallKind getOverridingTailCallKind(const Function &F)
static bool expandPtrauthForEmuPAC(Function &Intr)
static Constant * getMemSetPattern16Value(MemSetPatternInst *Inst, const TargetLibraryInfo &TLI)
static bool expandProtectedFieldPtr(Function &Intr)
static bool lowerObjCCall(Function &F, RTLIB::LibcallImpl NewFn, bool setNonLazyBind=false)
static bool lowerLoadRelative(Function &F)
This file contains the declarations for profiling metadata utility functions.
SmallVector< MachineOperand, 4 > Cond
This file describes how to lower LLVM code to machine code.
Target-Independent Code Generator Pass Configuration Options pass.
const AArch64TargetLowering * getTargetLowering() const override
uint64_t getZExtValue() const
Get zero extended value.
bool ugt(const APInt &RHS) const
Unsigned greater than comparison.
AnalysisUsage & addRequired()
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
A function analysis which provides an AssumptionCache.
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of @llvm.assume calls within a function.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
InstListType::iterator iterator
Instruction iterators...
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
void setAttributes(AttributeList A)
Set the attributes for this call.
Value * getArgOperand(unsigned i) const
AttributeList getAttributes() const
Return the attributes for this call.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
This class represents a function call, abstracting a target machine's calling convention.
void setTailCallKind(TailCallKind TCK)
static LLVM_ABI Constant * get(ArrayType *T, ArrayRef< Constant * > V)
static LLVM_ABI Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)
static LLVM_ABI ConstantInt * getFalse(LLVMContext &Context)
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
LLVM_ABI APInt getUnsignedMin() const
Return the smallest unsigned value contained in the ConstantRange.
LLVM_ABI bool isEmptySet() const
Return true if this set contains no members.
LLVM_ABI APInt getUnsignedMax() const
Return the largest unsigned value contained in the ConstantRange.
LLVM_ABI ConstantRange intersectWith(const ConstantRange &CR, PreferredRangeType Type=Smallest) const
Return the range that results from the intersection of this range with another range.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
iterator find(const_arg_type_t< KeyT > Val)
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
const Function & getFunction() const
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
void setUnnamedAddr(UnnamedAddr Val)
Module * getParent()
Get the module that this global value is contained inside of...
@ HiddenVisibility
The GV is hidden.
@ PrivateLinkage
Like Internal, but omit from symbol table.
@ ExternalLinkage
Externally visible function.
void setAlignment(Align Align)
Sets the alignment attribute of the GlobalVariable.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
LLVM_ABI const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
LLVM_ABI void setAAMetadata(const AAMDNodes &N)
Sets the AA metadata on this instruction from the AAMDNodes structure.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
LLVM_ABI const Function * getFunction() const
Return the function this instruction belongs to.
LLVM_ABI AAMDNodes getAAMetadata() const
Returns the AA metadata for this instruction.
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this instruction belongs to.
static LLVM_ABI bool mayLowerToFunctionCall(Intrinsic::ID IID)
Check if the intrinsic might lower into a regular function call in the course of IR transformations.
Tracks which library functions to use for a particular subtarget or function.
RTLIB::LibcallImpl getVectorLibcallImplOrMasked(RTLIB::Libcall Call) const
Return the implementation for Call, or for its masked variant if Call has no implementation.
Value * getLength() const
Value * getRawDest() const
const Use & getLengthUse() const
This class wraps the llvm.experimental.memset.pattern intrinsic.
Records a mapping from an opaque lowering context to its LibcallLoweringInfo.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
static LLVM_ABI PointerType * get(LLVMContext &C, unsigned AddressSpace)
This constructs an opaque pointer to an object in a numbered address space.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
Analysis pass providing the TargetTransformInfo.
Analysis pass providing the TargetLibraryInfo.
Provides information about what library functions are available for the current target.
bool isOperationExpand(unsigned Op, EVT VT) const
Return true if the specified operation is illegal on this target or unlikely to be made legal with cu...
int IntrinsicIDToISD(Intrinsic::ID ID) const
Get the ISD node that corresponds to the Intrinsic ID.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Primary interface to the complete machine description for the target machine.
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
virtual bool canLowerCondLoop() const
Returns whether the backend can lower the llvm.cond.loop intrinsic.
Target-Independent Code Generator Pass Configuration Options.
virtual const TargetLowering * getTargetLowering() const
Triple - Helper class for working with autoconf configuration names.
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
A Use represents the edge between a Value definition and its users.
LLVM_ABI unsigned getOperandNo() const
Return the operand # of this use in its User.
void setOperand(unsigned i, Value *Val)
Value * getOperand(unsigned i) const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void setName(const Twine &Name)
Change the name of the value.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVMContext & getContext() const
All values hold a context through their type.
iterator_range< user_iterator > users()
An efficient, type-erasing, non-owning reference to a callable.
const ParentTy * getParent() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ DELETED_NODE
DELETED_NODE - This is an illegal value that is used to catch errors.
@ FMODF
FMODF - Decomposes the operand into integral and fractional parts, each having the same type and sign...
@ FSINCOSPI
FSINCOSPI - Compute both the sine and cosine times pi more accurately than FSINCOS(pi*x),...
@ FSINCOS
FSINCOS - Compute both fsin and fcos as a single operation.
initializer< Ty > init(const Ty &Val)
LLVM_ABI bool IsNeverTail(ARCInstKind Class)
Test if the given class represents instructions which are never safe to mark with the "tail" keyword.
LLVM_ABI bool IsAlwaysTail(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the "tail" keyword...
ARCInstKind
Equivalence classes of instructions in the ARC Model.
LLVM_ABI ARCInstKind GetFunctionClass(const Function *F)
Determine if F is one of the special known Functions.
std::optional< Function * > getAttachedARCFunction(const CallBase *CB)
This function returns operand bundle clang_arc_attachedcall's argument, which is the address of the A...
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool lowerUnaryVectorIntrinsicAsLoop(Module &M, CallInst *CI)
Lower CI as a loop.
@ Known
Known to have no common set bits.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI bool lowerConstantIntrinsics(Function &F, const TargetLibraryInfo &TLI, DominatorTree *DT)
LLVM_ABI bool expandMemMoveAsLoop(MemMoveInst *MemMove, const TargetTransformInfo &TTI)
Expand MemMove as a loop.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
LLVM_ABI void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
LLVM_ABI bool inferNonMandatoryLibFuncAttrs(Module *M, StringRef Name, const TargetLibraryInfo &TLI)
Analyze the name and prototype of the given function and set any applicable attributes.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
LLVM_ABI bool isLibFuncEmittable(const Module *M, const TargetLibraryInfo *TLI, LibFunc TheLibFunc)
Check whether the library function is available on target and also that it in the current Module is a...
LLVM_ABI ModulePass * createPreISelIntrinsicLoweringPass()
This pass lowers the @llvm.load.relative and @llvm.objc.
LLVM_ABI const LibcallLoweringInfo & getLibcallLowering(const ModuleLibcallLoweringInfo &ModuleInfo, const TargetSubtargetInfo &Subtarget)
Resolve the LibcallLoweringInfo for Subtarget from the module-level ModuleInfo, applying the subtarge...
IRBuilder(LLVMContext &, FolderTy, InserterTy) -> IRBuilder< FolderTy, InserterTy >
LLVM_ABI FunctionCallee getOrInsertLibFunc(Module *M, const TargetLibraryInfo &TLI, LibFunc TheLibFunc, FunctionType *T, AttributeList AttributeList)
Calls getOrInsertFunction() and then makes sure to add mandatory argument attributes.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI MDNode * getExplicitlyUnknownBranchWeightsIfProfiled(Function &F, StringRef PassName)
Returns a metadata node containing unknown branch weights if the function has an entry count,...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
LLVM_ABI VPExpansionDetails expandVectorPredicationIntrinsic(VPIntrinsic &VPI, const TargetTransformInfo &TTI)
Expand a vector predication intrinsic.
OperandBundleDefT< Value * > OperandBundleDef
LLVM_ABI ConstantRange computeConstantRangeIncludingKnownBits(const WithCache< const Value * > &V, bool ForSigned, const SimplifyQuery &SQ)
Combine constant ranges from computeConstantRange() and computeKnownBits().
DWARFExpression::Operation Op
LLVM_ABI void expandBoundedMemSet(MemSetInst *MemSet, uint64_t MinLen, uint64_t MaxLen, const KnownBits &LenKnown)
Expand MemSet, whose length is known to be in [MinLen, MaxLen] and to have the known bits LenKnown,...
LLVM_ABI void expandMemSetAsLoop(MemSetInst *MemSet, const TargetTransformInfo *TTI=nullptr)
Expand MemSet as a loop.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI void expandMemSetPatternAsLoop(MemSetPatternInst *MemSet, const TargetTransformInfo *TTI=nullptr)
Expand MemSetPattern as a loop.
auto predecessors(const MachineBasicBlock *BB)
LLVM_ABI void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI, ScalarEvolution *SE=nullptr)
Expand MemCpy as a loop. MemCpy is not deleted.
LLVM_ABI Instruction * SplitBlockAndInsertIfThen(Value *Cond, BasicBlock::iterator SplitBefore, bool Unreachable, MDNode *BranchWeights=nullptr, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, BasicBlock *ThenBlock=nullptr)
Split the containing block at the specified instruction - everything before SplitBefore stays in the ...
VPExpansionDetails
Represents the details the expansion of a VP intrinsic.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static LLVM_ABI EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl)
Get the libcall routine name for the specified libcall implementation.