LLVM  10.0.0
Macros | Functions | Variables
InjectTLIMappings.cpp File Reference
#include "llvm/Transforms/Utils/InjectTLIMappings.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
Include dependency graph for InjectTLIMappings.cpp:

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 std::string mangleTLIName (StringRef VectorName, const CallInst &CI, unsigned VF)
 Helper function to map the TLI name to a strings that holds scalar-to-vector mapping. More...
 
static Type * ToVectorTy (Type *Scalar, unsigned VF, bool isScalable=false)
 A helper function for converting Scalar types to vector types. More...
 
static void addVariantDeclaration (CallInst &CI, const unsigned VF, const StringRef VFName)
 A helper function that adds the vector function declaration that vectorizes the CallInst CI with a vectorization factor of VF lanes. More...
 
static void addMappingsFromTLI (const TargetLibraryInfo &TLI, CallInst &CI)
 
static bool runImpl (const TargetLibraryInfo &TLI, Function &F)
 
 INITIALIZE_PASS_BEGIN (InjectTLIMappingsLegacy, DEBUG_TYPE, "Inject TLI Mappings", false, false) INITIALIZE_PASS_END(InjectTLIMappingsLegacy
 

Variables

 DEBUG_TYPE
 
Inject TLI Mappings
 
Inject TLI false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "inject-tli-mappings"

Function Documentation

◆ addMappingsFromTLI()

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

◆ addVariantDeclaration()

static void addVariantDeclaration ( CallInst &  CI,
const unsigned  VF,
const StringRef  VFName 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( InjectTLIMappingsLegacy  ,
DEBUG_TYPE  ,
"Inject TLI Mappings"  ,
false  ,
false   
)

◆ mangleTLIName()

static std::string mangleTLIName ( StringRef  VectorName,
const CallInst &  CI,
unsigned  VF 
)
static

Helper function to map the TLI name to a strings that holds scalar-to-vector mapping.

ZGV<isa><mask><vlen><vparams><scalarname>(<vectorname>)

where:

<isa> = "_LLVM_" <mask> = "N". Note: TLI does not support masked interfaces. <vlen> = Number of concurrent lanes, stored in the VectorizationFactor field of the VecDesc struct. <vparams> = "v", as many as are the number of parameters of CI. <scalarname> = the name of the scalar function called by CI. <vectorname> = the name of the vector function mapped by the TLI.

Definition at line 47 of file InjectTLIMappings.cpp.

References llvm::VFABI::_LLVM_, llvm::CallBase::getCalledFunction(), llvm::Value::getName(), llvm::CallBase::getNumArgOperands(), I, and llvm::raw_svector_ostream::str().

Referenced by addMappingsFromTLI().

◆ runImpl()

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

◆ STATISTIC() [1/3]

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

◆ STATISTIC() [2/3]

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

◆ STATISTIC() [3/3]

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

◆ ToVectorTy()

static Type* ToVectorTy ( Type *  Scalar,
unsigned  VF,
bool  isScalable = false 
)
static

A helper function for converting Scalar types to vector types.

If the incoming type is void, we return void. If the VF is 1, we return the scalar type.

Definition at line 61 of file InjectTLIMappings.cpp.

References llvm::VectorType::get(), and llvm::Type::isVoidTy().

Referenced by addVariantDeclaration().

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 181 of file InjectTLIMappings.cpp.

◆ false

Inject TLI false

Definition at line 181 of file InjectTLIMappings.cpp.

◆ Mappings

Inject TLI Mappings