Skip to content

Commit

Permalink
Improve compilation options pretty printing.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Apr 16, 2021
1 parent 9002a6a commit c06e9c6
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 37 deletions.
3 changes: 0 additions & 3 deletions compiler/generator/c/c_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ CodeContainer* CCodeContainer::createContainer(const string& name, int numInputs
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for C\n");
}
if (gGlobal->gOpenCLSwitch) {
throw faustexception("ERROR : OpenCL not supported for C\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/csharp/csharp_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ CodeContainer* CSharpCodeContainer::createContainer(const string& name, const st
{
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for CSharp\n");
}
if (gGlobal->gFloatSize == 3) {
throw faustexception("ERROR : quad format not supported for CSharp\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/dlang/dlang_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ CodeContainer* DLangCodeContainer::createContainer(const string& name, const str
{
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for D\n");
}
if (gGlobal->gFloatSize == 3) {
throw faustexception("ERROR : quad format not supported for D\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/interpreter/interpreter_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ CodeContainer* InterpreterCodeContainer<REAL>::createContainer(const string& nam
{
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for Interpreter\n");
}
if (gGlobal->gOpenCLSwitch) {
throw faustexception("ERROR : OpenCL not supported for Interpreter\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/java/java_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ CodeContainer* JAVACodeContainer::createContainer(const string& name, const stri
{
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for Java\n");
}
if (gGlobal->gFloatSize == 3) {
throw faustexception("ERROR : quad format not supported for Java\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/llvm/llvm_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ CodeContainer* LLVMCodeContainer::createContainer(const string& name, int numInp
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for LLVM\n");
}
if (gGlobal->gFloatSize == 3) {
throw faustexception("ERROR : quad format not supported for LLVM\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/rust/rust_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ CodeContainer* RustCodeContainer::createContainer(const string& name, int numInp
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for Rust\n");
}
if (gGlobal->gFloatSize == 3) {
throw faustexception("ERROR : quad format not supported for Rust\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/wasm/wasm_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ CodeContainer* WASMCodeContainer::createContainer(const string& name, int numInp
{
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for WebAssembly\n");
}
if (gGlobal->gFloatSize == 3) {
throw faustexception("ERROR : quad format not supported for WebAssembly\n");
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/generator/wasm/wast_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ CodeContainer* WASTCodeContainer::createContainer(const string& name, int numInp
{
CodeContainer* container;

if (gGlobal->gMemoryManager) {
throw faustexception("ERROR : -mem not supported for WebAssembly\n");
}
if (gGlobal->gFloatSize == 3) {
throw faustexception("ERROR : quad format not supported for WebAssembly\n");
}
Expand Down
18 changes: 9 additions & 9 deletions compiler/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,13 @@ static string printFloat()
{
switch (gGlobal->gFloatSize) {
case 1:
return " -single";
return "-single ";
case 2:
return " -double";
return "-double ";
case 3:
return " -quad";
return "-quad ";
case 4:
return " -fp";
return "-fp ";
default:
faustassert(false);
return "";
Expand Down Expand Up @@ -636,12 +636,12 @@ void global::printCompilationOptions(stringstream& dst, bool backend)
if (gSchedulerSwitch) dst << "-sch ";
if (gOpenMPSwitch) dst << "-omp " << ((gOpenMPLoop) ? "-pl " : "");
if (gVectorSwitch) {
dst << "-vec"
<< " -lv " << gVectorLoopVariant << " -vs " << gVecSize << ((gFunTaskSwitch) ? " -fun" : "")
<< ((gGroupTaskSwitch) ? " -g" : "") << ((gDeepFirstSwitch) ? " -dfs" : "")
<< printFloat() << " -ftz " << gFTZMode << " -mcd " << gGlobal->gMaxCopyDelay;
dst << "-vec "
<< "-lv " << gVectorLoopVariant << " " << "-vs " << gVecSize << " " << ((gFunTaskSwitch) ? "-fun " : "")
<< ((gGroupTaskSwitch) ? "-g " : "") << ((gDeepFirstSwitch) ? "-dfs " : "")
<< printFloat() << "-ftz " << gFTZMode << " " << "-mcd " << gGlobal->gMaxCopyDelay;
} else {
dst << printFloat() << " -ftz " << gFTZMode;
dst << printFloat() << "-ftz " << gFTZMode;
}

// Add 'compile_options' metadata
Expand Down
7 changes: 6 additions & 1 deletion compiler/libcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ static bool processCmdline(int argc, const char* argv[])

// Check options coherency
if (gGlobal->gInPlace && gGlobal->gVectorSwitch) {
throw faustexception("ERROR : 'in-place' option can only be used in scalar mode\n");
throw faustexception("ERROR : '-inpl' option can only be used in scalar mode\n");
}

#if 0
Expand Down Expand Up @@ -730,6 +730,7 @@ static bool processCmdline(int argc, const char* argv[])
throw faustexception("ERROR : '-dlt < INT_MAX' option can only be used in scalar mode and not with the 'ocpp' backend\n");
}

// gComputeMix check
if (gGlobal->gComputeMix && gGlobal->gOutputLang == "ocpp") {
throw faustexception("ERROR : -cm cannot be used with the 'ocpp' backend\n");
}
Expand All @@ -746,6 +747,10 @@ static bool processCmdline(int argc, const char* argv[])
throw faustexception("ERROR : -fx can ony be used with 'c', 'cpp' or 'ocpp' backends\n");
}

if (gGlobal->gMemoryManager && gGlobal->gOutputLang != "cpp" && gGlobal->gOutputLang != "ocpp") {
throw faustexception("ERROR : -mem can ony be used with 'cpp' or 'ocpp' backends\n");
}

if (gGlobal->gArchFile != ""
&& ((gGlobal->gOutputLang == "wast")
|| (gGlobal->gOutputLang == "wasm")
Expand Down

0 comments on commit c06e9c6

Please sign in to comment.