now can generate both targets for npvtx64. m_isPTX is set true, to distuish when to either skip or exlcusive euse export
This commit is contained in:
4
ispc.cpp
4
ispc.cpp
@@ -157,7 +157,7 @@ static const char *supportedCPUs[] = {
|
|||||||
#endif // LLVM 3.4+
|
#endif // LLVM 3.4+
|
||||||
};
|
};
|
||||||
|
|
||||||
Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
Target::Target(const char *arch, const char *cpu, const char *isa, bool pic, bool isPTX) :
|
||||||
m_target(NULL),
|
m_target(NULL),
|
||||||
m_targetMachine(NULL),
|
m_targetMachine(NULL),
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_1)
|
||||||
@@ -167,7 +167,7 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
|||||||
#endif
|
#endif
|
||||||
m_valid(false),
|
m_valid(false),
|
||||||
m_isa(SSE2),
|
m_isa(SSE2),
|
||||||
m_isPTX(false),
|
m_isPTX(isPTX),
|
||||||
m_arch(""),
|
m_arch(""),
|
||||||
m_is32Bit(true),
|
m_is32Bit(true),
|
||||||
m_cpu(""),
|
m_cpu(""),
|
||||||
|
|||||||
2
ispc.h
2
ispc.h
@@ -189,7 +189,7 @@ public:
|
|||||||
/** Initializes the given Target pointer for a target of the given
|
/** Initializes the given Target pointer for a target of the given
|
||||||
name, if the name is a known target. Returns true if the
|
name, if the name is a known target. Returns true if the
|
||||||
target was initialized and false if the name is unknown. */
|
target was initialized and false if the name is unknown. */
|
||||||
Target(const char *arch, const char *cpu, const char *isa, bool pic);
|
Target(const char *arch, const char *cpu, const char *isa, bool pic, bool isPTX = false);
|
||||||
|
|
||||||
/** Returns a comma-delimited string giving the names of the currently
|
/** Returns a comma-delimited string giving the names of the currently
|
||||||
supported compilation targets. */
|
supported compilation targets. */
|
||||||
|
|||||||
29
module.cpp
29
module.cpp
@@ -733,13 +733,11 @@ Module::AddFunctionDeclaration(const std::string &name,
|
|||||||
if (storageClass == SC_EXTERN_C) {
|
if (storageClass == SC_EXTERN_C) {
|
||||||
// Make sure the user hasn't supplied both an 'extern "C"' and a
|
// Make sure the user hasn't supplied both an 'extern "C"' and a
|
||||||
// 'task' qualifier with the function
|
// 'task' qualifier with the function
|
||||||
#if 0 /* NVPTX64::task_and_externC */
|
|
||||||
if (functionType->isTask && g->target->getISA() != Target::NVPTX64) {
|
if (functionType->isTask && g->target->getISA() != Target::NVPTX64) {
|
||||||
Error(pos, "\"task\" qualifier is illegal with C-linkage extern "
|
Error(pos, "\"task\" qualifier is illegal with C-linkage extern "
|
||||||
"function \"%s\". Ignoring this function.", name.c_str());
|
"function \"%s\". Ignoring this function.", name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
std::vector<Symbol *> funcs;
|
std::vector<Symbol *> funcs;
|
||||||
symbolTable->LookupFunction(name.c_str(), &funcs);
|
symbolTable->LookupFunction(name.c_str(), &funcs);
|
||||||
@@ -2316,11 +2314,15 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
const char *hostStubFileName,
|
const char *hostStubFileName,
|
||||||
const char *devStubFileName)
|
const char *devStubFileName)
|
||||||
{
|
{
|
||||||
if (target != NULL && !strcmp(target,"nvptx64"))
|
if (target != NULL && !strcmp(target,"nvptx64")) // NVPTX64
|
||||||
{
|
{
|
||||||
fprintf(stderr, "compiling nvptx64 \n");
|
|
||||||
// We're only compiling to a single target
|
// We're only compiling to a single target
|
||||||
g->target = new Target(arch, cpu, target, generatePIC);
|
const char * target_list[] = {"nvptx64", "avx"};
|
||||||
|
int errorCount = 0;
|
||||||
|
for (int itarget = 0; itarget < 2; itarget++)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "compiling nvptx64 : target= %s\n",target_list[itarget]);
|
||||||
|
g->target = new Target(arch, cpu, target_list[itarget], generatePIC, /* isPTX= */ true);
|
||||||
if (!g->target->isValid())
|
if (!g->target->isValid())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@@ -2342,9 +2344,14 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outFileName != NULL)
|
assert(outFileName != NULL);
|
||||||
if (!m->writeOutput(outputType, outFileName, includeFileName))
|
std::string targetOutFileName =
|
||||||
|
lGetTargetFileName(outFileName, target_list[itarget]);
|
||||||
|
if (!m->writeOutput(outputType, targetOutFileName.c_str(), includeFileName))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (itarget > 0)
|
||||||
|
{
|
||||||
if (headerFileName != NULL)
|
if (headerFileName != NULL)
|
||||||
if (!m->writeOutput(Module::Header, headerFileName))
|
if (!m->writeOutput(Module::Header, headerFileName))
|
||||||
return 1;
|
return 1;
|
||||||
@@ -2358,20 +2365,21 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
if (!m->writeOutput(Module::DevStub,devStubFileName))
|
if (!m->writeOutput(Module::DevStub,devStubFileName))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
++m->errorCount;
|
++m->errorCount;
|
||||||
|
|
||||||
int errorCount = m->errorCount;
|
errorCount += m->errorCount;
|
||||||
delete m;
|
delete m;
|
||||||
m = NULL;
|
m = NULL;
|
||||||
|
|
||||||
delete g->target;
|
delete g->target;
|
||||||
g->target = NULL;
|
g->target = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
return errorCount > 0;
|
return errorCount > 0;
|
||||||
}
|
}
|
||||||
else
|
else if (target == NULL || strchr(target, ',') == NULL) {
|
||||||
if (target == NULL || strchr(target, ',') == NULL) {
|
|
||||||
// We're only compiling to a single target
|
// We're only compiling to a single target
|
||||||
g->target = new Target(arch, cpu, target, generatePIC);
|
g->target = new Target(arch, cpu, target, generatePIC);
|
||||||
if (!g->target->isValid())
|
if (!g->target->isValid())
|
||||||
@@ -2542,4 +2550,5 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
|
|
||||||
return errorCount > 0;
|
return errorCount > 0;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user