nvptx64 generates 2 targets: task and normal function for nvptx64 and export for avx only
This commit is contained in:
15
decl.cpp
15
decl.cpp
@@ -531,7 +531,7 @@ 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)
|
||||
if (isTask && g->target->isPTX()) //getISA() == Target::NVPTX64)
|
||||
{
|
||||
ds->storageClass = SC_EXTERN_C;
|
||||
ds->typeQualifiers |= TYPEQUAL_UNMASKED;
|
||||
@@ -546,13 +546,12 @@ Declarator::InitFromType(const Type *baseType, DeclSpecs *ds) {
|
||||
"qualifiers");
|
||||
return;
|
||||
}
|
||||
#if 0 /* NVPTX64::task_and_externC */
|
||||
if (isExternC && isTask) {
|
||||
Error(pos, "Function can't have both \"extern \"C\"\" and \"task\" "
|
||||
"qualifiers");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (!g->target->isPTX())
|
||||
if (isExternC && isTask) {
|
||||
Error(pos, "Function can't have both \"extern \"C\"\" and \"task\" "
|
||||
"qualifiers");
|
||||
return;
|
||||
}
|
||||
if (isExternC && isExported) {
|
||||
Error(pos, "Function can't have both \"extern \"C\"\" and \"export\" "
|
||||
"qualifiers");
|
||||
|
||||
2
func.cpp
2
func.cpp
@@ -527,6 +527,8 @@ Function::GenerateIR() {
|
||||
const FunctionType *type= CastType<FunctionType>(sym->type);
|
||||
if (g->target->getISA() == Target::NVPTX64 && type->isExported)
|
||||
return;
|
||||
if (g->target->getISA() != Target::NVPTX64 && g->target->isPTX() && !type->isExported)
|
||||
return;
|
||||
}
|
||||
{
|
||||
FunctionEmitContext ec(this, sym, function, firstStmtPos);
|
||||
|
||||
20
module.cpp
20
module.cpp
@@ -733,7 +733,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
||||
if (storageClass == SC_EXTERN_C) {
|
||||
// Make sure the user hasn't supplied both an 'extern "C"' and a
|
||||
// 'task' qualifier with the function
|
||||
if (functionType->isTask && g->target->getISA() != Target::NVPTX64) {
|
||||
if (functionType->isTask && !g->target->isPTX()) { //tISA() != Target::NVPTX64) {
|
||||
Error(pos, "\"task\" qualifier is illegal with C-linkage extern "
|
||||
"function \"%s\". Ignoring this function.", name.c_str());
|
||||
return;
|
||||
@@ -2319,6 +2319,11 @@ Module::CompileAndOutput(const char *srcFile,
|
||||
// We're only compiling to a single target
|
||||
const char * target_list[] = {"nvptx64", "avx"};
|
||||
int errorCount = 0;
|
||||
|
||||
const char *suffix_orig = strrchr(outFileName, '.');
|
||||
++suffix_orig;
|
||||
assert(suffix_orig!=NULL);
|
||||
|
||||
for (int itarget = 0; itarget < 2; itarget++)
|
||||
{
|
||||
fprintf(stderr, "compiling nvptx64 : target= %s\n",target_list[itarget]);
|
||||
@@ -2345,8 +2350,19 @@ Module::CompileAndOutput(const char *srcFile,
|
||||
}
|
||||
|
||||
assert(outFileName != NULL);
|
||||
std::string targetOutFileName =
|
||||
|
||||
std::string targetOutFileName =
|
||||
lGetTargetFileName(outFileName, target_list[itarget]);
|
||||
if (outputType == Asm)
|
||||
{
|
||||
const char * targetOutFileName_c = targetOutFileName.c_str();
|
||||
const int suffix = strrchr(targetOutFileName_c, '.') - targetOutFileName_c + 1;
|
||||
if (itarget == 1 && !strcasecmp(suffix_orig, "ptx"))
|
||||
{
|
||||
targetOutFileName[suffix ] = 's';
|
||||
targetOutFileName[suffix+1] = 0;
|
||||
}
|
||||
}
|
||||
if (!m->writeOutput(outputType, targetOutFileName.c_str(), includeFileName))
|
||||
return 1;
|
||||
|
||||
|
||||
2
type.cpp
2
type.cpp
@@ -2925,7 +2925,7 @@ FunctionType::GetReturnTypeString() const {
|
||||
llvm::FunctionType *
|
||||
FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool removeMask) const {
|
||||
|
||||
if (isTask == true && g->target->getISA() != Target::NVPTX64)
|
||||
if (isTask == true && !g->target->isPTX()) //getISA() != Target::NVPTX64)
|
||||
Assert(removeMask == false);
|
||||
|
||||
// Get the LLVM Type *s for the function arguments
|
||||
|
||||
Reference in New Issue
Block a user