LLVM 20.0.0git
Macros | Functions
InjectTLIMappings.cpp File Reference
#include "llvm/Transforms/Utils/InjectTLIMappings.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/VFABIDemangler.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "inject-tli-mappings"
 

Functions

 STATISTIC (NumCallInjected, "Number of calls in which the mappings have been injected.")
 
 STATISTIC (NumVFDeclAdded, "Number of function declarations that have been added.")
 
 STATISTIC (NumCompUsedAdded, "Number of `@llvm.compiler.used` operands that have been added.")
 
static void addVariantDeclaration (CallInst &CI, const ElementCount &VF, const VecDesc *VD)
 A helper function that adds the vector variant declaration for vectorizing the CallInst CI with a vectorization factor of VF lanes.
 
static void addMappingsFromTLI (const TargetLibraryInfo &TLI, CallInst &CI)
 
static bool runImpl (const TargetLibraryInfo &TLI, Function &F)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "inject-tli-mappings"

Definition at line 26 of file InjectTLIMappings.cpp.

Function Documentation

◆ addMappingsFromTLI()

static void addMappingsFromTLI ( const TargetLibraryInfo TLI,
CallInst CI 
)
static

◆ addVariantDeclaration()

static void addVariantDeclaration ( CallInst CI,
const ElementCount VF,
const VecDesc VD 
)
static

A helper function that adds the vector variant declaration for vectorizing the CallInst CI with a vectorization factor of VF lanes.

For each mapping, TLI provides a VABI prefix, which contains all information required to create vector function declaration.

Definition at line 40 of file InjectTLIMappings.cpp.

References llvm::appendToCompilerUsed(), assert(), llvm::Function::copyAttributesFrom(), llvm::Function::Create(), llvm::VFABI::createFunctionType(), llvm::dbgs(), DEBUG_TYPE, llvm::CallBase::getCalledFunction(), llvm::CallBase::getFunctionType(), llvm::Instruction::getModule(), llvm::VecDesc::getVectorFnName(), llvm::VecDesc::getVectorFunctionABIVariantString(), Info, LLVM_DEBUG, llvm::Function::size(), and llvm::VFABI::tryDemangleForVFABI().

Referenced by addMappingsFromTLI().

◆ runImpl()

static bool runImpl ( const TargetLibraryInfo TLI,
Function F 
)
static

Definition at line 124 of file InjectTLIMappings.cpp.

References addMappingsFromTLI(), F, I, and instructions.

◆ STATISTIC() [1/3]

STATISTIC ( NumCallInjected  ,
"Number of calls in which the mappings have been injected."   
)

◆ STATISTIC() [2/3]

STATISTIC ( NumCompUsedAdded  ,
"Number of `@llvm.compiler.used` operands that have been added."   
)

◆ STATISTIC() [3/3]

STATISTIC ( NumVFDeclAdded  ,
"Number of function declarations that have been added."   
)