LLVM
8.0.1
|
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
Go to the source code of this file.
Functions | |
template<class ArgIt > | |
static void | EnsureFunctionExists (Module &M, const char *Name, ArgIt ArgBegin, ArgIt ArgEnd, Type *RetTy) |
static void | EnsureFPIntrinsicsExist (Module &M, Function &Fn, const char *FName, const char *DName, const char *LDName) |
template<class ArgIt > | |
static CallInst * | ReplaceCallWith (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. More... | |
static Value * | LowerBSWAP (LLVMContext &Context, Value *V, Instruction *IP) |
Emit the code to lower bswap of V before the specified instruction IP. More... | |
static Value * | LowerCTPOP (LLVMContext &Context, Value *V, Instruction *IP) |
Emit the code to lower ctpop of V before the specified instruction IP. More... | |
static Value * | LowerCTLZ (LLVMContext &Context, Value *V, Instruction *IP) |
Emit the code to lower ctlz of V before the specified instruction IP. More... | |
static void | ReplaceFPIntrinsicWithCall (CallInst *CI, const char *Fname, const char *Dname, const char *LDname) |
|
static |
Definition at line 38 of file IntrinsicLowering.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::Type::DoubleTyID, EnsureFunctionExists(), llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::Module::getContext(), llvm::Type::getDoubleTy(), llvm::Type::getFloatTy(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::Type::PPC_FP128TyID, and llvm::Type::X86_FP80TyID.
Referenced by llvm::IntrinsicLowering::AddPrototypes().
|
static |
Definition at line 28 of file IntrinsicLowering.cpp.
References llvm::FunctionType::get(), llvm::Module::getOrInsertFunction(), and I.
Referenced by llvm::IntrinsicLowering::AddPrototypes(), and EnsureFPIntrinsicsExist().
|
static |
Emit the code to lower bswap of V before the specified instruction IP.
Definition at line 165 of file IntrinsicLowering.cpp.
References assert(), llvm::IRBuilder< T, Inserter >::CreateAnd(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateOr(), llvm::IRBuilder< T, Inserter >::CreateShl(), llvm::ConstantInt::get(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::isIntOrIntVectorTy(), and llvm_unreachable.
Referenced by llvm::PPCTargetLowering::functionArgumentNeedsConsecutiveRegisters(), and llvm::IntrinsicLowering::LowerIntrinsicCall().
|
static |
Emit the code to lower ctlz of V before the specified instruction IP.
Definition at line 299 of file IntrinsicLowering.cpp.
References llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateNot(), llvm::IRBuilder< T, Inserter >::CreateOr(), llvm::ConstantInt::get(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), and LowerCTPOP().
Referenced by llvm::IntrinsicLowering::LowerIntrinsicCall().
|
static |
Emit the code to lower ctpop of V before the specified instruction IP.
Definition at line 260 of file IntrinsicLowering.cpp.
References assert(), llvm::IRBuilder< T, Inserter >::CreateAdd(), llvm::IRBuilder< T, Inserter >::CreateAnd(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::ConstantInt::get(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), and llvm::Type::isIntegerTy().
Referenced by LowerCTLZ(), llvm::IntrinsicLowering::LowerIntrinsicCall(), and llvm::AArch64TargetLowering::supportSwiftError().
|
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 65 of file IntrinsicLowering.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::FunctionType::get(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::Module::getOrInsertFunction(), llvm::Instruction::getParent(), I, llvm::Value::replaceAllUsesWith(), llvm::Value::setName(), and llvm::Value::use_empty().
Referenced by llvm::IntrinsicLowering::LowerIntrinsicCall(), and ReplaceFPIntrinsicWithCall().
|
static |
Definition at line 314 of file IntrinsicLowering.cpp.
References llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_end(), llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::CallBase::getArgOperand(), llvm::Value::getContext(), llvm::Type::getDoubleTy(), llvm::Type::getFloatTy(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm_unreachable, llvm::Type::PPC_FP128TyID, ReplaceCallWith(), and llvm::Type::X86_FP80TyID.
Referenced by llvm::IntrinsicLowering::LowerIntrinsicCall().