LLVM 22.0.0git
IntrinsicLowering.cpp File Reference

Go to the source code of this file.

Functions

template<class ArgIt>
static CallInstReplaceCallWith (const char *NewFn, CallInst *CI, ArgIt ArgBegin, ArgIt ArgEnd, Type *RetTy)
 This function is used when we want to lower an intrinsic call to a call of an external function.
static ValueLowerBSWAP (LLVMContext &Context, Value *V, Instruction *IP)
 Emit the code to lower bswap of V before the specified instruction IP.
static ValueLowerCTPOP (LLVMContext &Context, Value *V, Instruction *IP)
 Emit the code to lower ctpop of V before the specified instruction IP.
static ValueLowerCTLZ (LLVMContext &Context, Value *V, Instruction *IP)
 Emit the code to lower ctlz of V before the specified instruction IP.
static void ReplaceFPIntrinsicWithCall (CallInst *CI, const char *Fname, const char *Dname, const char *LDname)

Function Documentation

◆ LowerBSWAP()

Value * LowerBSWAP ( LLVMContext & Context,
Value * V,
Instruction * IP )
static

Emit the code to lower bswap of V before the specified instruction IP.

Definition at line 53 of file IntrinsicLowering.cpp.

References assert(), and llvm_unreachable.

Referenced by llvm::IntrinsicLowering::LowerIntrinsicCall().

◆ LowerCTLZ()

Value * LowerCTLZ ( LLVMContext & Context,
Value * V,
Instruction * IP )
static

Emit the code to lower ctlz of V before the specified instruction IP.

Definition at line 187 of file IntrinsicLowering.cpp.

References LowerCTPOP().

Referenced by llvm::IntrinsicLowering::LowerIntrinsicCall(), and llvm::X86TargetLowering::LowerOperation().

◆ LowerCTPOP()

Value * LowerCTPOP ( LLVMContext & Context,
Value * V,
Instruction * IP )
static

Emit the code to lower ctpop of V before the specified instruction IP.

Definition at line 148 of file IntrinsicLowering.cpp.

References assert(), llvm::Count, LHS, and RHS.

Referenced by LowerCTLZ(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::ARMTargetLowering::LowerOperation(), and llvm::X86TargetLowering::LowerOperation().

◆ ReplaceCallWith()

template<class ArgIt>
CallInst * ReplaceCallWith ( const char * NewFn,
CallInst * CI,
ArgIt ArgBegin,
ArgIt ArgEnd,
Type * RetTy )
static

This function is used when we want to lower an intrinsic call to a call of an external function.

This handles hard cases such as when there was already a prototype for the external function, but that prototype doesn't match the arguments we expect to pass in.

Definition at line 30 of file IntrinsicLowering.cpp.

References llvm::FunctionType::get(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), I, llvm::Value::replaceAllUsesWith(), llvm::Value::setName(), and llvm::Value::use_empty().

Referenced by llvm::IntrinsicLowering::LowerIntrinsicCall(), and ReplaceFPIntrinsicWithCall().

◆ ReplaceFPIntrinsicWithCall()