added now NVPTX64 automatically emits unmasked extern "C" for task function with kernel attributes
This commit is contained in:
10
decl.cpp
10
decl.cpp
@@ -530,16 +530,22 @@ Declarator::InitFromType(const Type *baseType, DeclSpecs *ds) {
|
||||
|
||||
returnType = returnType->ResolveUnboundVariability(Variability::Varying);
|
||||
|
||||
bool isTask = ds && ((ds->typeQualifiers & TYPEQUAL_TASK) != 0);
|
||||
if (isTask && g->target->getISA() == Target::NVPTX64)
|
||||
{
|
||||
ds->storageClass = SC_EXTERN_C;
|
||||
ds->typeQualifiers |= TYPEQUAL_UNMASKED;
|
||||
}
|
||||
|
||||
bool isExternC = ds && (ds->storageClass == SC_EXTERN_C);
|
||||
bool isExported = ds && ((ds->typeQualifiers & TYPEQUAL_EXPORT) != 0);
|
||||
bool isTask = ds && ((ds->typeQualifiers & TYPEQUAL_TASK) != 0);
|
||||
bool isUnmasked = ds && ((ds->typeQualifiers & TYPEQUAL_UNMASKED) != 0);
|
||||
|
||||
if (isExported && isTask) {
|
||||
Error(pos, "Function can't have both \"task\" and \"export\" "
|
||||
"qualifiers");
|
||||
return;
|
||||
}j
|
||||
}
|
||||
#if 0 /* NVPTX64::task_and_externC */
|
||||
if (isExternC && isTask) {
|
||||
Error(pos, "Function can't have both \"extern \"C\"\" and \"task\" "
|
||||
|
||||
5
func.cpp
5
func.cpp
@@ -336,11 +336,12 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
||||
ctx->StoreInst(argIter, sym->storagePtr);
|
||||
ctx->EmitFunctionParameterDebugInfo(sym, i);
|
||||
}
|
||||
if (argIter == function->arg_end()) {
|
||||
if (argIter == function->arg_end())
|
||||
{
|
||||
Assert(type->isUnmasked || type->isExported);
|
||||
ctx->SetFunctionMask(LLVMMaskAllOn);
|
||||
}
|
||||
else
|
||||
else /* for NVPTX64 , function must be unmasked */
|
||||
assert(0);
|
||||
|
||||
llvm::NamedMDNode* annotations =
|
||||
|
||||
@@ -734,7 +734,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
||||
// Make sure the user hasn't supplied both an 'extern "C"' and a
|
||||
// 'task' qualifier with the function
|
||||
#if 0 /* NVPTX64::task_and_externC */
|
||||
if (functionType->isTask) {
|
||||
if (functionType->isTask && g->target->getISA() != Target::NVPTX64) {
|
||||
Error(pos, "\"task\" qualifier is illegal with C-linkage extern "
|
||||
"function \"%s\". Ignoring this function.", name.c_str());
|
||||
return;
|
||||
|
||||
4
type.cpp
4
type.cpp
@@ -2925,10 +2925,8 @@ FunctionType::GetReturnTypeString() const {
|
||||
llvm::FunctionType *
|
||||
FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool removeMask) const {
|
||||
|
||||
#if 0 /* NVPTX64::task_and_externC */
|
||||
if (isTask == true)
|
||||
if (isTask == true && g->target->getISA() != Target::NVPTX64)
|
||||
Assert(removeMask == false);
|
||||
#endif
|
||||
|
||||
// Get the LLVM Type *s for the function arguments
|
||||
std::vector<llvm::Type *> llvmArgTypes;
|
||||
|
||||
Reference in New Issue
Block a user