checkpoint

This commit is contained in:
Evghenii
2013-10-29 13:36:31 +01:00
parent b2baa35c3d
commit ac700d4860
5 changed files with 85 additions and 3 deletions

View File

@@ -2316,6 +2316,61 @@ Module::CompileAndOutput(const char *srcFile,
const char *hostStubFileName,
const char *devStubFileName)
{
if (target != NULL && !strcmp(target,"nvptx64"))
{
fprintf(stderr, "compiling nvptx64 \n");
// We're only compiling to a single target
g->target = new Target(arch, cpu, target, generatePIC);
if (!g->target->isValid())
return 1;
m = new Module(srcFile);
if (m->CompileFile() == 0) {
if (outputType == CXX) {
if (target == NULL || strncmp(target, "generic-", 8) != 0) {
Error(SourcePos(), "When generating C++ output, one of the \"generic-*\" "
"targets must be used.");
return 1;
}
}
else if (outputType == Asm || outputType == Object) {
if (target != NULL && strncmp(target, "generic-", 8) == 0) {
Error(SourcePos(), "When using a \"generic-*\" compilation target, "
"%s output can not be used.",
(outputType == Asm) ? "assembly" : "object file");
return 1;
}
}
if (outFileName != NULL)
if (!m->writeOutput(outputType, outFileName, includeFileName))
return 1;
if (headerFileName != NULL)
if (!m->writeOutput(Module::Header, headerFileName))
return 1;
if (depsFileName != NULL)
if (!m->writeOutput(Module::Deps,depsFileName))
return 1;
if (hostStubFileName != NULL)
if (!m->writeOutput(Module::HostStub,hostStubFileName))
return 1;
if (devStubFileName != NULL)
if (!m->writeOutput(Module::DevStub,devStubFileName))
return 1;
}
else
++m->errorCount;
int errorCount = m->errorCount;
delete m;
m = NULL;
delete g->target;
g->target = NULL;
return errorCount > 0;
}
else
if (target == NULL || strchr(target, ',') == NULL) {
// We're only compiling to a single target
g->target = new Target(arch, cpu, target, generatePIC);