Commit 3784f288 authored by Rishipal Singh Bhatia's avatar Rishipal Singh Bhatia

Moving more metadata variables to the new framework

Change-Id: I94c384387f617ac502bcd2b5eef3f0d217f23504
parent d447bc8d
...@@ -92,7 +92,7 @@ bool AddImplicitArgs::runOnModule(Module &M) ...@@ -92,7 +92,7 @@ bool AddImplicitArgs::runOnModule(Module &M)
(ctx->getModuleMetaData()->compOpt.HasBufferOffsetArg || (ctx->getModuleMetaData()->compOpt.HasBufferOffsetArg ||
IGC_IS_FLAG_ENABLED(EnableSupportBufferOffset))) IGC_IS_FLAG_ENABLED(EnableSupportBufferOffset)))
{ {
ImplicitArgs::addBufferOffsetArgs(*pFunc, m_pMdUtils); ImplicitArgs::addBufferOffsetArgs(*pFunc, m_pMdUtils, ctx->getModuleMetaData());
} }
// Create the new function body and insert it into the module // Create the new function body and insert it into the module
......
...@@ -384,11 +384,15 @@ void ImplicitArgs::addNumberedArgs(llvm::Function& F, ImplicitArg::ArgMap& argMa ...@@ -384,11 +384,15 @@ void ImplicitArgs::addNumberedArgs(llvm::Function& F, ImplicitArg::ArgMap& argMa
// Add one implicit argument for each pointer argument to global or constant buffer. // Add one implicit argument for each pointer argument to global or constant buffer.
// Note that F is the original input function (ie, without implicit arguments). // Note that F is the original input function (ie, without implicit arguments).
void ImplicitArgs::addBufferOffsetArgs(llvm::Function& F, IGCMD::MetaDataUtils* pMdUtils) void ImplicitArgs::addBufferOffsetArgs(llvm::Function& F, IGCMD::MetaDataUtils* pMdUtils, IGC::ModuleMetaData *modMD)
{ {
ImplicitArg::ArgMap OffsetArgs; ImplicitArg::ArgMap OffsetArgs;
FunctionInfoMetaDataHandle funcInfoMD = FunctionInfoMetaDataHandle funcInfoMD =
pMdUtils->getFunctionsInfoItem(const_cast<Function*>(&F)); pMdUtils->getFunctionsInfoItem(const_cast<Function*>(&F));
assert(modMD->FuncMD.find(&F) != modMD->FuncMD.end());
FunctionMetaData* funcMD = &modMD->FuncMD.find(&F)->second;
for (auto& Arg : F.args() ) for (auto& Arg : F.args() )
{ {
Value* AV = &Arg; Value* AV = &Arg;
...@@ -401,11 +405,16 @@ void ImplicitArgs::addBufferOffsetArgs(llvm::Function& F, IGCMD::MetaDataUtils* ...@@ -401,11 +405,16 @@ void ImplicitArgs::addBufferOffsetArgs(llvm::Function& F, IGCMD::MetaDataUtils*
} }
int argNo = Arg.getArgNo(); int argNo = Arg.getArgNo();
std::string argbaseType = "";
if (funcMD->m_OpenCLArgBaseTypes.size() > (unsigned)argNo)
argbaseType = funcMD->m_OpenCLArgBaseTypes[argNo];
// Do not generate implicit arg for any image arguments // Do not generate implicit arg for any image arguments
KernelArg::ArgType ImgArgType; KernelArg::ArgType ImgArgType;
if (KernelArg::isImage( if (KernelArg::isImage(
&Arg, funcInfoMD->getOpenCLArgBaseTypesItem(argNo), ImgArgType) || &Arg, argbaseType, ImgArgType) ||
KernelArg::isSampler(&Arg, funcInfoMD->getOpenCLArgBaseTypesItem(argNo))) KernelArg::isSampler(&Arg, argbaseType))
{ {
continue; continue;
} }
......
...@@ -276,7 +276,7 @@ namespace IGC ...@@ -276,7 +276,7 @@ namespace IGC
/// implicit argument for each explicit pointer argument to global or constant buffer. /// implicit argument for each explicit pointer argument to global or constant buffer.
/// @param F The function for which to create the implicit argument's metadata /// @param F The function for which to create the implicit argument's metadata
/// @param pMdUtils The Metadata API object /// @param pMdUtils The Metadata API object
static void addBufferOffsetArgs(llvm::Function& F, IGCMD::MetaDataUtils* pMdUtils); static void addBufferOffsetArgs(llvm::Function& F, IGCMD::MetaDataUtils* pMdUtils, IGC::ModuleMetaData* modMD);
/// @brief Returns the (implicit) function argument associated with the given implicit argument type /// @brief Returns the (implicit) function argument associated with the given implicit argument type
/// @param F The function for which the implict argument should be returned /// @param F The function for which the implict argument should be returned
......
...@@ -449,16 +449,20 @@ bool ProcessBuiltinMetaData::runOnModule(Module& M) ...@@ -449,16 +449,20 @@ bool ProcessBuiltinMetaData::runOnModule(Module& M)
void ProcessBuiltinMetaData::updateBuiltinFunctionMetaData(llvm::Function* pFunc) void ProcessBuiltinMetaData::updateBuiltinFunctionMetaData(llvm::Function* pFunc)
{ {
IGCMD::FunctionInfoMetaDataHandle fHandle = IGCMD::FunctionInfoMetaDataHandle(IGCMD::FunctionInfoMetaData::get()); IGCMD::FunctionInfoMetaDataHandle fHandle = IGCMD::FunctionInfoMetaDataHandle(IGCMD::FunctionInfoMetaData::get());
IGC::ModuleMetaData* modMD = getAnalysis<CodeGenContextWrapper>().getCodeGenContext()->getModuleMetaData();
FunctionMetaData *funcMD = &modMD->FuncMD[pFunc]; //okay to insert if not present
fHandle->setType(IGC::IGCMD::FunctionTypeEnum::OtherFunctionType); fHandle->setType(IGC::IGCMD::FunctionTypeEnum::OtherFunctionType);
funcMD->functionType = IGC::FunctionTypeMD::UserFunction;
for (auto arg = pFunc->arg_begin(); arg != pFunc->arg_end(); ++arg) for (auto arg = pFunc->arg_begin(); arg != pFunc->arg_end(); ++arg)
{ {
std::string typeStr; std::string typeStr;
llvm::raw_string_ostream x(typeStr); llvm::raw_string_ostream x(typeStr);
arg->getType()->print(x); arg->getType()->print(x);
fHandle->addOpenCLArgNamesItem(arg->getName()); funcMD->m_OpenCLArgNames.push_back(arg->getName());
fHandle->addOpenCLArgAccessQualifiersItem("none"); funcMD->m_OpenCLArgAccessQualifiers.push_back("none");
fHandle->addOpenCLArgBaseTypesItem(x.str()); funcMD->m_OpenCLArgBaseTypes.push_back(x.str());
} }
m_pMdUtil->setFunctionsInfoItem(pFunc, fHandle); m_pMdUtil->setFunctionsInfoItem(pFunc, fHandle);
} }
...@@ -331,17 +331,23 @@ void COpenCLKernel::CreateKernelArgInfo() ...@@ -331,17 +331,23 @@ void COpenCLKernel::CreateKernelArgInfo()
{ {
FunctionInfoMetaDataHandle funcInfoMD = m_pMdUtils->getFunctionsInfoItem(entry); FunctionInfoMetaDataHandle funcInfoMD = m_pMdUtils->getFunctionsInfoItem(entry);
uint count = funcInfoMD->size_OpenCLArgAccessQualifiers(); uint count = 0;
if (m_Context->getModuleMetaData()->FuncMD.find(entry) != m_Context->getModuleMetaData()->FuncMD.end())
{
FunctionMetaData* funcMD = &m_Context->getModuleMetaData()->FuncMD[entry];
count = funcMD->m_OpenCLArgAccessQualifiers.size();
}
for (uint i = 0; i < count; ++i) for (uint i = 0; i < count; ++i)
{ {
iOpenCL::KernelArgumentInfoAnnotation* kernelArgInfo = new iOpenCL::KernelArgumentInfoAnnotation(); iOpenCL::KernelArgumentInfoAnnotation* kernelArgInfo = new iOpenCL::KernelArgumentInfoAnnotation();
FunctionMetaData* funcMD = &m_Context->getModuleMetaData()->FuncMD[entry];
// Format the strings the way the OpenCL runtime expects them // Format the strings the way the OpenCL runtime expects them
// The access qualifier is expected to have a "__" prefix, // The access qualifier is expected to have a "__" prefix,
// or an upper-case "NONE" if there is no qualifier // or an upper-case "NONE" if there is no qualifier
kernelArgInfo->AccessQualifier = funcInfoMD->getOpenCLArgAccessQualifiersItem(i); kernelArgInfo->AccessQualifier = funcMD->m_OpenCLArgAccessQualifiers[i];
if (kernelArgInfo->AccessQualifier == "none" || kernelArgInfo->AccessQualifier == "") if (kernelArgInfo->AccessQualifier == "none" || kernelArgInfo->AccessQualifier == "")
{ {
kernelArgInfo->AccessQualifier = "NONE"; kernelArgInfo->AccessQualifier = "NONE";
...@@ -352,7 +358,7 @@ void COpenCLKernel::CreateKernelArgInfo() ...@@ -352,7 +358,7 @@ void COpenCLKernel::CreateKernelArgInfo()
} }
// The address space is expected to have a __ prefix // The address space is expected to have a __ prefix
switch (funcInfoMD->getOpenCLArgAddressSpacesItem(i)) switch(funcMD->m_OpenCLArgAddressSpaces[i])
{ {
case ADDRESS_SPACE_CONSTANT: case ADDRESS_SPACE_CONSTANT:
kernelArgInfo->AddressQualifier = "__constant"; kernelArgInfo->AddressQualifier = "__constant";
...@@ -373,13 +379,13 @@ void COpenCLKernel::CreateKernelArgInfo() ...@@ -373,13 +379,13 @@ void COpenCLKernel::CreateKernelArgInfo()
// ArgNames is not guaranteed to be present if -cl-kernel-arg-info // ArgNames is not guaranteed to be present if -cl-kernel-arg-info
// is not passed in. // is not passed in.
if (funcInfoMD->isOpenCLArgNamesHasValue()) if(funcMD->m_OpenCLArgNames.size() > i)
{ {
kernelArgInfo->ArgumentName = funcInfoMD->getOpenCLArgNamesItem(i); kernelArgInfo->ArgumentName = funcMD->m_OpenCLArgNames[i];
} }
// The type name is expected to also have the type size, appended after a ";" // The type name is expected to also have the type size, appended after a ";"
kernelArgInfo->TypeName = funcInfoMD->getOpenCLArgTypesItem(i) + ";"; kernelArgInfo->TypeName = funcMD->m_OpenCLArgTypes[i] + ";";
// Unfortunately, unlike SPIR, legacy OCL uses an ABI that has byval pointers. // Unfortunately, unlike SPIR, legacy OCL uses an ABI that has byval pointers.
// So, if the parameter is a byval pointer, look at the contained type // So, if the parameter is a byval pointer, look at the contained type
...@@ -397,7 +403,7 @@ void COpenCLKernel::CreateKernelArgInfo() ...@@ -397,7 +403,7 @@ void COpenCLKernel::CreateKernelArgInfo()
} }
// If there are no type qualifiers, "NONE" is expected // If there are no type qualifiers, "NONE" is expected
kernelArgInfo->TypeQualifier = funcInfoMD->getOpenCLArgTypeQualifiersItem(i); kernelArgInfo->TypeQualifier = funcMD->m_OpenCLArgTypeQualifiers[i];
if (kernelArgInfo->TypeQualifier == "") if (kernelArgInfo->TypeQualifier == "")
{ {
kernelArgInfo->TypeQualifier = "NONE"; kernelArgInfo->TypeQualifier = "NONE";
......
...@@ -464,7 +464,7 @@ VISAVariableLocation VISAModule::GetVariableLocation(const llvm::Instruction* pI ...@@ -464,7 +464,7 @@ VISAVariableLocation VISAModule::GetVariableLocation(const llvm::Instruction* pI
unsigned int explicitArgsNum = IGCLLVM::GetFuncArgSize(m_pEntryFunc) - itr->second->size_ImplicitArgInfoList(); unsigned int explicitArgsNum = IGCLLVM::GetFuncArgSize(m_pEntryFunc) - itr->second->size_ImplicitArgInfoList();
if (pArgument->getArgNo() < explicitArgsNum) if (pArgument->getArgNo() < explicitArgsNum)
{ {
const std::string typeStr = itr->second->getOpenCLArgBaseTypesItem(pArgument->getArgNo()); const std::string typeStr = modMD->FuncMD[const_cast<Function*>(m_pEntryFunc)].m_OpenCLArgBaseTypes[pArgument->getArgNo()];
KernelArg::ArgType argType = KernelArg::calcArgType(pArgument, typeStr); KernelArg::ArgType argType = KernelArg::calcArgType(pArgument, typeStr);
FunctionMetaData *funcMD = &modMD->FuncMD[const_cast<Function*>(m_pEntryFunc)]; FunctionMetaData *funcMD = &modMD->FuncMD[const_cast<Function*>(m_pEntryFunc)];
ResourceAllocMD *resourceAlloc = &funcMD->resourceAlloc; ResourceAllocMD *resourceAlloc = &funcMD->resourceAlloc;
......
This diff is collapsed.
This diff is collapsed.
...@@ -153,20 +153,22 @@ namespace //Anonymous ...@@ -153,20 +153,22 @@ namespace //Anonymous
class MetadataBuilder class MetadataBuilder
{ {
IGC::IGCMD::MetaDataUtils* _pMdUtils; IGC::IGCMD::MetaDataUtils* _pMdUtils;
IGC::ModuleMetaData* modMD;
DataContext& _dataContext; DataContext& _dataContext;
public: public:
MetadataBuilder(IGC::IGCMD::MetaDataUtils* pMdUtils, DataContext& dataContext) MetadataBuilder(IGC::IGCMD::MetaDataUtils* pMdUtils, DataContext& dataContext, IGC::ModuleMetaData* moduleMD)
: _pMdUtils(pMdUtils), _dataContext(dataContext) {} : modMD(moduleMD), _pMdUtils(pMdUtils), _dataContext(dataContext) {}
/// Return function metadata if function is kernel /// Return function metadata if function is kernel
IGC::IGCMD::FunctionInfoMetaDataHandle getKernelMetadata(const llvm::Function* func) IGC::FunctionMetaData* getKernelMetadata(const llvm::Function* func)
{ {
if (isEntryFunc(_pMdUtils, func)) if (isEntryFunc(_pMdUtils, func))
{ {
return _pMdUtils->getFunctionsInfoItem(const_cast<llvm::Function*>(func)); if (modMD->FuncMD.find(const_cast<llvm::Function*>(func)) != modMD->FuncMD.end())
return &modMD->FuncMD[const_cast<llvm::Function*>(func)];
} }
return IGC::IGCMD::FunctionInfoMetaDataHandle(nullptr); return nullptr;
} }
bool eraseKernelMetadata(llvm::Function* func, IGC::ModuleMetaData* modMD) { bool eraseKernelMetadata(llvm::Function* func, IGC::ModuleMetaData* modMD) {
...@@ -185,21 +187,22 @@ namespace //Anonymous ...@@ -185,21 +187,22 @@ namespace //Anonymous
} }
/// Return kernel argument type name from metadata /// Return kernel argument type name from metadata
IGC::IGCMD::FunctionInfoMetaData::OpenCLArgBaseTypesList::item_type getKernelArgTypeName(const llvm::Function* func, unsigned argNum) std::string getKernelArgTypeName(const llvm::Function* func, unsigned argNum)
{ {
auto funcInfoMD = getOrEmitKernelMetadata(func); auto funcInfoMD = getOrEmitKernelMetadata(const_cast<llvm::Function*>(func));
assert((funcInfoMD.get() != nullptr) && "cannot get or emit for kernel metadata"); assert((funcInfoMD != nullptr) && "cannot get or emit for kernel metadata");
assert(funcInfoMD->m_OpenCLArgBaseTypes.size() > (unsigned) argNum);
return funcInfoMD->getOpenCLArgBaseTypesItem(argNum); return funcInfoMD->m_OpenCLArgBaseTypes[argNum];
} }
/// Return function metadata if function is kernel, emit new kernel metadata if not. /// Return function metadata if function is kernel, emit new kernel metadata if not.
IGC::IGCMD::FunctionInfoMetaDataHandle getOrEmitKernelMetadata(const llvm::Function* func) FunctionMetaData* getOrEmitKernelMetadata(const llvm::Function* func)
{ {
auto kernelMD = getKernelMetadata(func); auto kernelMD = getKernelMetadata(func);
if (kernelMD.get() == nullptr) if (kernelMD == nullptr)
{ {
return EmitKernelMetadata(func); EmitKernelMetadata(const_cast<llvm::Function*>(func));
kernelMD = getKernelMetadata(func);
} }
return kernelMD; return kernelMD;
} }
...@@ -223,7 +226,7 @@ namespace //Anonymous ...@@ -223,7 +226,7 @@ namespace //Anonymous
// Function responsible for emitting special meta data for block dispatcher functions // // Function responsible for emitting special meta data for block dispatcher functions //
// this will be part of stadard meta data layout and will be consumed by the Target // // this will be part of stadard meta data layout and will be consumed by the Target //
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
IGC::IGCMD::FunctionInfoMetaDataHandle EmitKernelMetadata(const llvm::Function* kernelFunc); void EmitKernelMetadata(const llvm::Function* kernelFunc);
}; };
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -1193,10 +1196,10 @@ namespace //Anonymous ...@@ -1193,10 +1196,10 @@ namespace //Anonymous
public: public:
DataContext(IGC::IGCMD::MetaDataUtils* pMdUtils) DataContext(IGC::ModuleMetaData* modMD, IGC::IGCMD::MetaDataUtils* pMdUtils)
: _blocksNum(0) : _blocksNum(0)
, _kindQuery(*this) , _kindQuery(*this)
, _MDBuilder(pMdUtils, *this) , _MDBuilder(pMdUtils, *this, modMD)
{} {}
const KindQuery& getKindQuery() { return _kindQuery; } const KindQuery& getKindQuery() { return _kindQuery; }
...@@ -1289,7 +1292,7 @@ namespace //Anonymous ...@@ -1289,7 +1292,7 @@ namespace //Anonymous
auto modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData(); auto modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData();
// dataContext "owns" all created objects in internal "database" // dataContext "owns" all created objects in internal "database"
DataContext dataContext(pMdUtils); DataContext dataContext(modMD, pMdUtils);
// Inline functions which have device exec calls up to kernel or block_invoke level // Inline functions which have device exec calls up to kernel or block_invoke level
// to properly resolve parent argument number for the following case: // to properly resolve parent argument number for the following case:
...@@ -1608,7 +1611,7 @@ namespace //Anonymous ...@@ -1608,7 +1611,7 @@ namespace //Anonymous
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
// MetadataBuilder implementation // MetadataBuilder implementation
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
IGC::IGCMD::FunctionInfoMetaDataHandle MetadataBuilder::EmitKernelMetadata(const llvm::Function* kernelFunc) void MetadataBuilder::EmitKernelMetadata(const llvm::Function* kernelFunc)
{ {
// Helper structure for pretty printing types // Helper structure for pretty printing types
struct TypeNameHelper { struct TypeNameHelper {
...@@ -1670,11 +1673,13 @@ namespace //Anonymous ...@@ -1670,11 +1673,13 @@ namespace //Anonymous
//link dispatchMd to dispatch kernel //link dispatchMd to dispatch kernel
IGC::IGCMD::FunctionInfoMetaDataHandle dispatchMd = _pMdUtils->getOrInsertFunctionsInfoItem(const_cast<llvm::Function*>(kernelFunc)); IGC::IGCMD::FunctionInfoMetaDataHandle dispatchMd = _pMdUtils->getOrInsertFunctionsInfoItem(const_cast<llvm::Function*>(kernelFunc));
auto funcMD = &modMD->FuncMD[const_cast<llvm::Function*>(kernelFunc)];//insert if not present
//set function type for dispatch //set function type for dispatch
dispatchMd->setType(IGC::IGCMD::FunctionTypeEnum::EntryFunctionType); dispatchMd->setType(IGC::IGCMD::FunctionTypeEnum::EntryFunctionType);
funcMD->functionType = IGC::FunctionTypeMD::KernelFunction;
for (auto& arg : kernelFunc->args()) for (auto& arg : kernelFunc->args())
{ {
auto argType = arg.getType(); auto argType = arg.getType();
...@@ -1699,16 +1704,16 @@ namespace //Anonymous ...@@ -1699,16 +1704,16 @@ namespace //Anonymous
TypeNameHelper::Print(argType, os); TypeNameHelper::Print(argType, os);
} }
dispatchMd->addOpenCLArgAddressSpacesItem(addrSpace); // !"kernel_arg_addr_space" funcMD->m_OpenCLArgAddressSpaces.push_back(addrSpace);
dispatchMd->addOpenCLArgAccessQualifiersItem(accessQual); // !"kernel_arg_access_qual" funcMD->m_OpenCLArgAccessQualifiers.push_back(accessQual);
dispatchMd->addOpenCLArgTypesItem(typeName); // !"kernel_arg_type" funcMD->m_OpenCLArgTypes.push_back(typeName);
dispatchMd->addOpenCLArgTypeQualifiersItem(""); // !"kernel_arg_type_qual" funcMD->m_OpenCLArgTypeQualifiers.push_back("");
dispatchMd->addOpenCLArgBaseTypesItem(typeName); // !"kernel_arg_base_type" funcMD->m_OpenCLArgBaseTypes.push_back(typeName);
dispatchMd->addOpenCLArgNamesItem(arg.getName()); // !"kernel_arg_name" funcMD->m_OpenCLArgNames.push_back(arg.getName());
} }
//save changes
_pMdUtils->save(kernelFunc->getContext()); _pMdUtils->save(kernelFunc->getContext());
return dispatchMd;
return;
} }
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -1770,7 +1775,7 @@ namespace //Anonymous ...@@ -1770,7 +1775,7 @@ namespace //Anonymous
bool KindQuery::isKernel(const llvm::Function* func) const bool KindQuery::isKernel(const llvm::Function* func) const
{ {
return _dataContext.getMetaDataBuilder().getKernelMetadata(func).get() != nullptr; return _dataContext.getMetaDataBuilder().getKernelMetadata(func) != nullptr;
} }
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -1046,11 +1046,22 @@ KernelArgs::KernelArgs(const Function& F, const DataLayout* DL, MetaDataUtils* p ...@@ -1046,11 +1046,22 @@ KernelArgs::KernelArgs(const Function& F, const DataLayout* DL, MetaDataUtils* p
} }
} }
std::string argBaseType = "";
std::string argAccessQualItem = "";
if (it != moduleMD->FuncMD.end())
{
if (it->second.m_OpenCLArgBaseTypes.size() > (unsigned)i)
argBaseType = it->second.m_OpenCLArgBaseTypes[i];
if (it->second.m_OpenCLArgAccessQualifiers.size() > (unsigned)i)
argAccessQualItem = it->second.m_OpenCLArgAccessQualifiers[i];
}
KernelArg kernelArg = KernelArg( KernelArg kernelArg = KernelArg(
&(*funcArg), &(*funcArg),
DL, DL,
funcInfoMD->getOpenCLArgBaseTypesItem(i), argBaseType,
funcInfoMD->getOpenCLArgAccessQualifiersItem(i), argAccessQualItem,
location_index, location_index,
location_count, location_count,
needAllocation, needAllocation,
......
...@@ -228,9 +228,10 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M) ...@@ -228,9 +228,10 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M)
{ {
SPIRMD::KernelMetaData::ArgAddressSpacesList::const_iterator i = spirKernel->begin_ArgAddressSpaces(); SPIRMD::KernelMetaData::ArgAddressSpacesList::const_iterator i = spirKernel->begin_ArgAddressSpaces();
SPIRMD::KernelMetaData::ArgAddressSpacesList::const_iterator e = spirKernel->end_ArgAddressSpaces(); SPIRMD::KernelMetaData::ArgAddressSpacesList::const_iterator e = spirKernel->end_ArgAddressSpaces();
for (; i != e; ++i) for (; i != e; ++i)
{ {
fHandle->addOpenCLArgAddressSpacesItem(*i); funcMD.m_OpenCLArgAddressSpaces.push_back(*i);
} }
} }
...@@ -241,7 +242,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M) ...@@ -241,7 +242,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M)
SPIRMD::KernelMetaData::ArgAccessQualifiersList::const_iterator e = spirKernel->end_ArgAccessQualifiers(); SPIRMD::KernelMetaData::ArgAccessQualifiersList::const_iterator e = spirKernel->end_ArgAccessQualifiers();
for (; i != e; ++i) for (; i != e; ++i)
{ {
fHandle->addOpenCLArgAccessQualifiersItem(*i); funcMD.m_OpenCLArgAccessQualifiers.push_back(*i);
} }
} }
...@@ -252,7 +253,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M) ...@@ -252,7 +253,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M)
SPIRMD::KernelMetaData::ArgTypesList::const_iterator e = spirKernel->end_ArgTypes(); SPIRMD::KernelMetaData::ArgTypesList::const_iterator e = spirKernel->end_ArgTypes();
for (; i != e; ++i) for (; i != e; ++i)
{ {
fHandle->addOpenCLArgTypesItem(*i); funcMD.m_OpenCLArgTypes.push_back(*i);
} }
} }
...@@ -263,7 +264,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M) ...@@ -263,7 +264,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M)
SPIRMD::KernelMetaData::ArgBaseTypesList::const_iterator e = spirKernel->end_ArgBaseTypes(); SPIRMD::KernelMetaData::ArgBaseTypesList::const_iterator e = spirKernel->end_ArgBaseTypes();
for (; i != e; ++i) for (; i != e; ++i)
{ {
fHandle->addOpenCLArgBaseTypesItem(*i); funcMD.m_OpenCLArgBaseTypes.push_back(*i);
} }
} }
...@@ -274,7 +275,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M) ...@@ -274,7 +275,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M)
SPIRMD::KernelMetaData::ArgTypeQualifiersList::const_iterator e = spirKernel->end_ArgTypeQualifiers(); SPIRMD::KernelMetaData::ArgTypeQualifiersList::const_iterator e = spirKernel->end_ArgTypeQualifiers();
for (; i != e; ++i) for (; i != e; ++i)
{ {
fHandle->addOpenCLArgTypeQualifiersItem(*i); funcMD.m_OpenCLArgTypeQualifiers.push_back(*i);
} }
} }
...@@ -285,7 +286,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M) ...@@ -285,7 +286,7 @@ bool SPIRMetaDataTranslation::runOnModule(Module& M)
SPIRMD::KernelMetaData::ArgNamesList::const_iterator e = spirKernel->end_ArgNames(); SPIRMD::KernelMetaData::ArgNamesList::const_iterator e = spirKernel->end_ArgNames();
for (; i != e; ++i) for (; i != e; ++i)
{ {
fHandle->addOpenCLArgNamesItem(*i); funcMD.m_OpenCLArgNames.push_back(*i);
} }
} }
......
...@@ -75,6 +75,7 @@ namespace IGC ...@@ -75,6 +75,7 @@ namespace IGC
bool isEmulationArg = 0; bool isEmulationArg = 0;
}; };
//to hold metadata of every function //to hold metadata of every function
struct FunctionMetaData struct FunctionMetaData
{ {
...@@ -93,6 +94,16 @@ namespace IGC ...@@ -93,6 +94,16 @@ namespace IGC
bool groupIDPresent = false; bool groupIDPresent = false;
int privateMemoryPerWI = 0; int privateMemoryPerWI = 0;
bool globalIDPresent = false; bool globalIDPresent = false;
std::vector<int32_t> m_OpenCLArgAddressSpaces;
std::vector<std::string> m_OpenCLArgAccessQualifiers;
std::vector<std::string> m_OpenCLArgTypes;
std::vector<std::string> m_OpenCLArgBaseTypes;
std::vector<std::string> m_OpenCLArgTypeQualifiers;
std::vector<std::string> m_OpenCLArgNames;
}; };
// isCloned member is added to mark whether a function is clone // isCloned member is added to mark whether a function is clone
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment