#include "AMDGPULibFunc.h"
#include "AMDGPU.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacellvm;
static cl::opt<bool> EnableOCLManglingMismatchWA(
"amdgpu-enable-ocl-mangling-mismatch-workaround", cl::init(true),
cl::ReallyHidden,
cl::desc("Enable the workaround for OCL name mangling mismatch."));
namespace {
enum EManglingParam { … };
struct ManglingRule { … };
class UnmangledFuncInfo { … };
unsigned ManglingRule::getNumArgs() const { … }
static constexpr ManglingRule manglingRules[] = …;
const UnmangledFuncInfo UnmangledFuncInfo::Table[] = …;
const unsigned UnmangledFuncInfo::TableSize = …;
static AMDGPULibFunc::Param getRetType(AMDGPULibFunc::EFuncId id,
const AMDGPULibFunc::Param (&Leads)[2]) { … }
class ParamIterator { … };
AMDGPULibFunc::Param ParamIterator::getNextParam() { … }
inline static void drop_front(StringRef& str, size_t n = 1) { … }
static bool eatTerm(StringRef& mangledName, const char c) { … }
template <size_t N>
static bool eatTerm(StringRef& mangledName, const char (&str)[N]) { … }
static int eatNumber(StringRef& s) { … }
static StringRef eatLengthPrefixedName(StringRef& mangledName) { … }
}
AMDGPUMangledLibFunc::AMDGPUMangledLibFunc() { … }
AMDGPUUnmangledLibFunc::AMDGPUUnmangledLibFunc() { … }
AMDGPUMangledLibFunc::AMDGPUMangledLibFunc(
EFuncId id, const AMDGPUMangledLibFunc ©From) { … }
AMDGPUMangledLibFunc::AMDGPUMangledLibFunc(EFuncId id, FunctionType *FT,
bool SignedInts) { … }
static int parseVecSize(StringRef& mangledName) { … }
static AMDGPULibFunc::ENamePrefix parseNamePrefix(StringRef& mangledName) { … }
StringMap<int> ManglingRule::buildManglingRulesMap() { … }
bool AMDGPUMangledLibFunc::parseUnmangledName(StringRef FullName) { … }
namespace {
struct ItaniumParamParser { … };
}
bool ItaniumParamParser::parseItaniumParam(StringRef& param,
AMDGPULibFunc::Param &res) { … }
bool AMDGPUMangledLibFunc::parseFuncName(StringRef &mangledName) { … }
bool AMDGPUUnmangledLibFunc::parseFuncName(StringRef &Name) { … }
bool AMDGPULibFunc::parse(StringRef FuncName, AMDGPULibFunc &F) { … }
StringRef AMDGPUMangledLibFunc::getUnmangledName(StringRef mangledName) { … }
template <typename Stream>
void AMDGPUMangledLibFunc::writeName(Stream &OS) const { … }
std::string AMDGPUMangledLibFunc::mangle() const { … }
static const char *getItaniumTypeName(AMDGPULibFunc::EType T) { … }
namespace {
class ItaniumMangler { … };
}
std::string AMDGPUMangledLibFunc::mangleNameItanium() const { … }
AMDGPULibFuncBase::Param AMDGPULibFuncBase::Param::getFromTy(Type *Ty,
bool Signed) { … }
static Type* getIntrinsicParamType(
LLVMContext& C,
const AMDGPULibFunc::Param& P,
bool useAddrSpace) { … }
FunctionType *AMDGPUMangledLibFunc::getFunctionType(Module &M) const { … }
unsigned AMDGPUMangledLibFunc::getNumArgs() const { … }
unsigned AMDGPUUnmangledLibFunc::getNumArgs() const { … }
std::string AMDGPUMangledLibFunc::getName() const { … }
bool AMDGPULibFunc::isCompatibleSignature(const FunctionType *FuncTy) const { … }
Function *AMDGPULibFunc::getFunction(Module *M, const AMDGPULibFunc &fInfo) { … }
FunctionCallee AMDGPULibFunc::getOrInsertFunction(Module *M,
const AMDGPULibFunc &fInfo) { … }
StringMap<unsigned> UnmangledFuncInfo::buildNameMap() { … }
bool UnmangledFuncInfo::lookup(StringRef Name, ID &Id) { … }
AMDGPULibFunc::AMDGPULibFunc(const AMDGPULibFunc &F) { … }
AMDGPULibFunc &AMDGPULibFunc::operator=(const AMDGPULibFunc &F) { … }
AMDGPULibFunc::AMDGPULibFunc(EFuncId Id, const AMDGPULibFunc &CopyFrom) { … }
AMDGPULibFunc::AMDGPULibFunc(EFuncId Id, FunctionType *FT, bool SignedInts) { … }
AMDGPULibFunc::AMDGPULibFunc(StringRef Name, FunctionType *FT) { … }
void AMDGPULibFunc::initMangled() { … }
AMDGPULibFunc::Param *AMDGPULibFunc::getLeads() { … }
const AMDGPULibFunc::Param *AMDGPULibFunc::getLeads() const { … }