Add support for compiling to multiple targets.
If a flag along the lines of "--target=sse4,avx-x2" is provided on the command-line, then the program will be compiled for each of the given targets, with a separate output file generated for each one. Further, an output file with dispatch functions that check the current system's CPU and then chooses the best available variant is also created. Issue #11.
This commit is contained in:
18
main.cpp
18
main.cpp
@@ -329,20 +329,6 @@ int main(int Argc, char *Argv[]) {
|
||||
if (debugSet && !optSet)
|
||||
g->opt.level = 0;
|
||||
|
||||
if (!Target::GetTarget(arch, cpu, target, generatePIC, &g->target))
|
||||
usage(1);
|
||||
|
||||
m = new Module(file);
|
||||
if (m->CompileFile() == 0) {
|
||||
if (outFileName != NULL)
|
||||
if (!m->WriteOutput(ot, outFileName))
|
||||
return 1;
|
||||
if (headerFileName != NULL)
|
||||
if (!m->WriteOutput(Module::Header, headerFileName))
|
||||
return 1;
|
||||
}
|
||||
int errorCount = m->errorCount;
|
||||
delete m;
|
||||
|
||||
return errorCount > 0;
|
||||
return Module::CompileAndOutput(file, arch, cpu, target, generatePIC,
|
||||
ot, outFileName, headerFileName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user