49#define DEBUG_TYPE "pre-isel-intrinsic-lowering"
55 "mem-intrinsic-expand-size",
61struct PreISelIntrinsicLowering {
70 const bool UseMemIntrinsicLibFunc;
72 explicit PreISelIntrinsicLowering(
77 bool UseMemIntrinsicLibFunc_ =
true)
78 : TM(TM_), ModuleLibcalls(ModuleLibcalls_), LookupTTI(LookupTTI_),
79 LookupTLI(LookupTLI_), UseMemIntrinsicLibFunc(UseMemIntrinsicLibFunc_) {
82 static bool shouldExpandMemIntrinsicWithSize(
Value *
Size,
83 const TargetTransformInfo &
TTI);
86 DenseMap<Constant *, GlobalVariable *> &CMap)
const;
87 bool lowerIntrinsics(
Module &M)
const;
98 Use *LastUse =
nullptr;
100 while (!Intrin.
use_empty() && (!LastUse || LastUse->getNext())) {
101 Use *U = LastUse ? LastUse->getNext() : &*Intrin.
use_begin();
102 bool Removed =
false;
106 Changed |= Removed = Callback(CI);
122 if (!CI || CI->getCalledOperand() != &
F)
127 B.CreatePtrAdd(CI->getArgOperand(0), CI->getArgOperand(1));
128 Value *OffsetI32 =
B.CreateAlignedLoad(Int32Ty, OffsetPtr,
Align(4));
130 Value *ResultPtr =
B.CreatePtrAdd(CI->getArgOperand(0), OffsetI32);
132 CI->replaceAllUsesWith(ResultPtr);
133 CI->eraseFromParent();
157 Result = Builder.getFalse();
179 "Pre-ISel intrinsics do lower into regular function calls");
191 M->getOrInsertFunction(NewFnName,
F.getFunctionType());
194 Fn->setLinkage(
F.getLinkage());
198 Fn->addFnAttr(Attribute::NonLazyBind);
207 if (CB->getCalledFunction() != &
F) {
209 "use expected to be the argument of operand bundle "
210 "\"clang.arc.attachedcall\"");
216 assert(CI->getCalledFunction() &&
"Cannot lower an indirect call!");
218 IRBuilder<> Builder(CI->getParent(), CI->getIterator());
221 CI->getOperandBundlesAsDefs(BundleList);
222 CallInst *NewCI = Builder.CreateCall(FCache, Args, BundleList);
240 if (
F.getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
242 NewCI->
addParamAttr(Index - AttributeList::FirstArgIndex,
243 Attribute::Returned);
245 if (!CI->use_empty())
246 CI->replaceAllUsesWith(NewCI);
247 CI->eraseFromParent();
255bool PreISelIntrinsicLowering::shouldExpandMemIntrinsicWithSize(
267 return SizeVal > Threshold || Threshold == 0;
278 return Lowering.getLibcallImpl(LC) != RTLIB::Unsupported;
288 return Lowering.getMemcpyImpl() != RTLIB::Unsupported;
304 Type *VTy = V->getType();
324 if (
DL.isBigEndian())
347bool PreISelIntrinsicLowering::expandMemIntrinsicUses(
348 Function &
F, DenseMap<Constant *, GlobalVariable *> &CMap)
const {
356 case Intrinsic::memcpy: {
358 Function *ParentFunc = Memcpy->getFunction();
359 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
360 if (shouldExpandMemIntrinsicWithSize(Memcpy->getLength(),
TTI)) {
361 if (UseMemIntrinsicLibFunc &&
368 Memcpy->eraseFromParent();
373 case Intrinsic::memcpy_inline: {
382 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
385 Memcpy->eraseFromParent();
388 case Intrinsic::memmove: {
391 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
392 if (shouldExpandMemIntrinsicWithSize(Memmove->getLength(),
TTI)) {
393 if (UseMemIntrinsicLibFunc &&
399 Memmove->eraseFromParent();
405 case Intrinsic::memset: {
408 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
409 if (shouldExpandMemIntrinsicWithSize(Memset->getLength(),
TTI)) {
410 if (UseMemIntrinsicLibFunc &&
416 Memset->eraseFromParent();
421 case Intrinsic::memset_inline: {
430 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
433 Memset->eraseFromParent();
436 case Intrinsic::experimental_memset_pattern: {
439 const TargetLibraryInfo &TLI = LookupTLI(*ParentFunc);
444 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
447 Memset->eraseFromParent();
453 Module *
M = Memset->getModule();
454 const DataLayout &
DL = Memset->getDataLayout();
456 Type *DestPtrTy = Memset->getRawDest()->getType();
458 StringRef FuncName =
"memset_pattern16";
460 Builder.getVoidTy(), DestPtrTy,
461 Builder.getPtrTy(), SizeTTy);
467 assert(Memset->getRawDest()->getType()->getPointerAddressSpace() == 0 &&
468 "Should have skipped if non-zero AS");
470 auto It = CMap.
find(PatternValue);
471 if (It != CMap.
end()) {
474 GV =
new GlobalVariable(
475 *M, PatternValue->
getType(),
true,
478 GlobalValue::UnnamedAddr::Global);
481 CMap[PatternValue] = GV;
483 Value *PatternPtr = GV;
484 Value *NumBytes = Builder.CreateMul(
485 TLI.
getAsSizeT(
DL.getTypeAllocSize(Memset->getValue()->getType()),
487 Builder.CreateZExtOrTrunc(Memset->getLength(), SizeTTy));
488 CallInst *MemsetPattern16Call =
489 Builder.CreateCall(MSP, {Memset->getRawDest(), PatternPtr, NumBytes});
493 AttrBuilder ArgAttrs(Memset->getContext(),
494 Memset->getAttributes().getParamAttrs(0));
497 Memset->getContext(), 0, ArgAttrs));
499 Memset->eraseFromParent();
527 Intr.
getIntrinsicID() == Intrinsic::ptrauth_auth ?
"__emupac_autda"
535 !
Key ||
Key->getZExtValue() != 2)
539 Attribute FSAttr =
F->getFnAttribute(
"target-features");
543 std::vector<OperandBundleDef> DSBundle;
548 auto *EmuCall =
B.CreateCall(
549 EmuIntr, {
Call->getArgOperand(0),
Call->getArgOperand(2)}, DSBundle);
550 Call->replaceAllUsesWith(EmuCall);
551 Call->eraseFromParent();
568 auto *Pointer =
Call->getArgOperand(0);
583 if (
Op->isNullValue()) {
589 if (
Op->isNullValue()) {
604 DSsToDeactivate.
insert(DS);
607 Call->eraseFromParent();
610 if (!DSsToDeactivate.
empty()) {
621 OldDS->replaceAllUsesWith(DS);
622 OldDS->eraseFromParent();
636 Br->setSuccessor(Br->getParent());
637 Call->eraseFromParent();
645 if (!
Call->getParent()->isEntryBlock() &&
647 [](
Instruction &
I) { return !I.mayHaveSideEffects(); })) {
662 if (BI->getSuccessor(0) ==
Call->getParent()) {
664 Cond = BI->getCondition();
669 Cond =
B.CreateNot(BI->getCondition());
672 B.CreateIntrinsic(Intrinsic::cond_loop,
Cond);
676 B.CreateIntrinsic(Intrinsic::cond_loop,
678 Call->eraseFromParent();
683bool PreISelIntrinsicLowering::lowerIntrinsics(
Module &M)
const {
685 DenseMap<Constant *, GlobalVariable *> CMap;
688 switch (
F.getIntrinsicID()) {
691 case Intrinsic::memcpy:
692 case Intrinsic::memcpy_inline:
693 case Intrinsic::memmove:
694 case Intrinsic::memset:
695 case Intrinsic::memset_inline:
696 case Intrinsic::experimental_memset_pattern:
697 Changed |= expandMemIntrinsicUses(
F, CMap);
699 case Intrinsic::load_relative:
702 case Intrinsic::can_load_speculatively:
705 case Intrinsic::is_constant:
706 case Intrinsic::objectsize:
709 TargetLibraryInfo &TLI = LookupTLI(*Parent);
715#define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
716 case Intrinsic::VPID:
717#include "llvm/IR/VPIntrinsics.def"
720 const TargetTransformInfo &
TTI = LookupTTI(*Parent);
726 Changed |= ED != VPExpansionDetails::IntrinsicUnchanged;
727 bool Removed = ED == VPExpansionDetails::IntrinsicReplaced;
731 case Intrinsic::objc_autorelease:
734 case Intrinsic::objc_autoreleasePoolPop:
737 case Intrinsic::objc_autoreleasePoolPush:
740 case Intrinsic::objc_autoreleaseReturnValue:
743 case Intrinsic::objc_copyWeak:
746 case Intrinsic::objc_destroyWeak:
749 case Intrinsic::objc_initWeak:
752 case Intrinsic::objc_loadWeak:
755 case Intrinsic::objc_loadWeakRetained:
758 case Intrinsic::objc_moveWeak:
761 case Intrinsic::objc_release:
764 case Intrinsic::objc_retain:
767 case Intrinsic::objc_retainAutorelease:
770 case Intrinsic::objc_retainAutoreleaseReturnValue:
774 case Intrinsic::objc_retainAutoreleasedReturnValue:
778 case Intrinsic::objc_claimAutoreleasedReturnValue:
782 case Intrinsic::objc_retainBlock:
785 case Intrinsic::objc_storeStrong:
788 case Intrinsic::objc_storeWeak:
791 case Intrinsic::objc_unsafeClaimAutoreleasedReturnValue:
793 lowerObjCCall(
F, RTLIB::impl_objc_unsafeClaimAutoreleasedReturnValue);
795 case Intrinsic::objc_retainedObject:
798 case Intrinsic::objc_unretainedObject:
801 case Intrinsic::objc_unretainedPointer:
804 case Intrinsic::objc_retain_autorelease:
807 case Intrinsic::objc_sync_enter:
810 case Intrinsic::objc_sync_exit:
813 case Intrinsic::acos:
814 case Intrinsic::asin:
815 case Intrinsic::atan:
817 case Intrinsic::cosh:
819 case Intrinsic::exp2:
820 case Intrinsic::exp10:
822 case Intrinsic::log2:
823 case Intrinsic::log10:
825 case Intrinsic::sinh:
827 case Intrinsic::tanh:
840 case Intrinsic::modf:
841 case Intrinsic::sincos:
842 case Intrinsic::sincospi:
857 LC = RTLIB::getMODF(VT);
860 LC = RTLIB::getSINCOS(VT);
863 LC = RTLIB::getSINCOSPI(VT);
873 case Intrinsic::ptrauth_sign:
874 case Intrinsic::ptrauth_auth:
877 case Intrinsic::protected_field_ptr:
880 case Intrinsic::cond_loop:
884 case Intrinsic::looptrap:
887 if (
auto *CondLoop =
M.getFunction(
"llvm.cond.loop"))
897class PreISelIntrinsicLoweringLegacyPass :
public ModulePass {
901 PreISelIntrinsicLoweringLegacyPass() : ModulePass(
ID) {}
903 void getAnalysisUsage(AnalysisUsage &AU)
const override {
910 bool runOnModule(
Module &M)
override {
911 const ModuleLibcallLoweringInfo &ModuleLibcalls =
912 getAnalysis<LibcallLoweringInfoWrapper>().getResult(M);
914 auto LookupTTI = [
this](
Function &
F) -> TargetTransformInfo & {
915 return this->getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
917 auto LookupTLI = [
this](
Function &
F) -> TargetLibraryInfo & {
918 return this->getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
F);
921 const auto *TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
922 PreISelIntrinsicLowering
Lowering(TM, ModuleLibcalls, LookupTTI, LookupTLI);
929char PreISelIntrinsicLoweringLegacyPass::ID;
932 "pre-isel-intrinsic-lowering",
933 "Pre-ISel Intrinsic Lowering",
false,
false)
940 "pre-isel-intrinsic-lowering",
944 return new PreISelIntrinsicLoweringLegacyPass();
961 PreISelIntrinsicLowering
Lowering(
TM, LibcallLowering, LookupTTI, LookupTLI);
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 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.
const SmallVectorImpl< MachineOperand > & Cond
This file describes how to lower LLVM code to machine code.
Target-Independent Code Generator Pass Configuration Options pass.
AnalysisUsage & addRequired()
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
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...
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...
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 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.
Value * getRawDest() 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.
ConstantInt * getAsSizeT(uint64_t V, const Module &M) const
Returns a constant materialized as a size_t type.
IntegerType * getSizeTType(const Module &M) const
Returns an IntegerType corresponding to size_t.
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...
virtual Value * emitCanLoadSpeculatively(IRBuilderBase &Builder, Value *Ptr, Value *Size) const
Emit code to check if a speculative load of the given size from Ptr is safe.
RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const
Get the libcall impl routine name for the specified libcall.
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.
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.
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.
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.
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...
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...
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.
IRBuilder(LLVMContext &, FolderTy, InserterTy, MDNode *, ArrayRef< OperandBundleDef >) -> IRBuilder< FolderTy, InserterTy >
OperandBundleDefT< Value * > OperandBundleDef
DWARFExpression::Operation Op
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.