From bd03668b7794bfe4470e7b7335b8371a03697708 Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Fri, 30 Aug 2024 13:35:14 +0200 Subject: [PATCH] Implement soundfile handling at init stage in C, C++, LLVM and Interp backend. --- architecture/ca-gtk.cpp | 24 +++++++--- architecture/faust/dsp/dsp-tools.h | 30 ++++++++++++ architecture/faust/gui/CInterface.h | 1 + compiler/documentator/doc.cpp | 4 +- compiler/generator/code_container.cpp | 19 ++++++-- compiler/generator/code_container.hh | 7 +++ compiler/generator/instructions.hh | 7 +++ compiler/generator/instructions_compiler.cpp | 4 ++ .../generator/llvm/llvm_code_container.cpp | 48 +++++++++++++++++-- .../generator/llvm/llvm_code_container.hh | 11 ++--- compiler/generator/llvm/llvm_dsp_aux.cpp | 17 +++++-- compiler/generator/llvm/llvm_dsp_aux.hh | 19 ++++++-- compiler/generator/sha_key.hh | 8 +++- compiler/global.cpp | 5 +- compiler/libcode.cpp | 3 ++ compiler/parser/sourcefetcher.cpp | 2 +- compiler/signals/sigtyperules.cpp | 16 +++++-- .../transform/sigNewConstantPropagation.cpp | 4 +- tests/impulse-tests/Makefile | 1 + tools/benchmark/interp-tracer.cpp | 4 +- 20 files changed, 190 insertions(+), 44 deletions(-) diff --git a/architecture/ca-gtk.cpp b/architecture/ca-gtk.cpp index 836279c2ef..b42e6bb167 100644 --- a/architecture/ca-gtk.cpp +++ b/architecture/ca-gtk.cpp @@ -61,6 +61,7 @@ #ifdef SOUNDFILE #include "faust/gui/SoundUI.h" +#include "faust/dsp/dsp-tools.h" #endif // Always include this file, otherwise -nvoices only mode does not compile.... @@ -218,19 +219,28 @@ int main(int argc, char* argv[]) cout << "HTTPD is on" << endl; #endif +#ifdef SOUNDFILE + { + // Init default DSP to get the SR + coreaudio audio(srate, fpb); + default_dsp def_dsp; + if (!audio.init(name, &def_dsp)) { + cerr << "Unable to init audio" << endl; + exit(1); + } + // After audio init to get SR + srate = audio.getSampleRate(); + } + SoundUI soundinterface("", srate); + DSP->buildUserInterface(&soundinterface); +#endif + coreaudio audio(srate, fpb); if (!audio.init(name, DSP)) { cerr << "Unable to init audio" << endl; exit(1); } -// After audio init to get SR -#ifdef SOUNDFILE - // Use bundle path - SoundUI soundinterface("", audio.getSampleRate()); - DSP->buildUserInterface(&soundinterface); -#endif - #ifdef OSCCTRL OSCUI oscinterface(name, argc, argv); DSP->buildUserInterface(&oscinterface); diff --git a/architecture/faust/dsp/dsp-tools.h b/architecture/faust/dsp/dsp-tools.h index bf8b2076e3..af4e153558 100644 --- a/architecture/faust/dsp/dsp-tools.h +++ b/architecture/faust/dsp/dsp-tools.h @@ -225,5 +225,35 @@ class AudioChannels FAUSTFLOAT** buffers() { return fChannels; } }; +// Default DSP +struct default_dsp : public dsp { + + int getNumInputs() { return 1; } + + int getNumOutputs() { return 1; } + + void buildUserInterface(UI* ui_interface) {} + + int getSampleRate() { return 44100; } + + void init(int sample_rate) {} + + void instanceInit(int sample_rate) {} + + void instanceConstants(int sample_rate) {} + + void instanceResetUserInterface() {} + + void instanceClear() {} + + dsp* clone() { return new default_dsp(); } + + void metadata(Meta* m) {} + + void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) + {} + +}; + #endif /************************** END dsp-tools.h **************************/ diff --git a/architecture/faust/gui/CInterface.h b/architecture/faust/gui/CInterface.h index 3e7a265db8..e7944b8a89 100644 --- a/architecture/faust/gui/CInterface.h +++ b/architecture/faust/gui/CInterface.h @@ -111,6 +111,7 @@ typedef void (* buildUserInterfaceFun) (dsp_imp* dsp, UIGlue* ui); typedef int (* getSampleRateFun) (dsp_imp* dsp); typedef void (* initFun) (dsp_imp* dsp, int sample_rate); typedef void (* classInitFun) (int sample_rate); +typedef void (* staticInitFun) (dsp_imp* dsp, int sample_rate); typedef void (* instanceInitFun) (dsp_imp* dsp, int sample_rate); typedef void (* instanceConstantsFun) (dsp_imp* dsp, int sample_rate); typedef void (* instanceResetUserInterfaceFun) (dsp_imp* dsp); diff --git a/compiler/documentator/doc.cpp b/compiler/documentator/doc.cpp index 09376a1337..d1ffaba24f 100644 --- a/compiler/documentator/doc.cpp +++ b/compiler/documentator/doc.cpp @@ -858,7 +858,7 @@ static void printDocDgm(const Tree expr, const char* svgTopDir, ostream& docout, * Warning : pdflatex can't directly include SVG files ! */ char dgmid[MAXIDCHARS + 1]; - sprintf(dgmid, "%02d", i); + snprintf(dgmid, sizeof(dgmid), "%02d", i); string thisdgmdir = subst("$0/svg-$1", svgTopDir, dgmid); // cerr << "Documentator : printDocDgm : drawSchema in '" << gCurrentDir << "/" << thisdgmdir << // "'" << endl; @@ -1026,7 +1026,7 @@ static char* legalFileName(const Tree t, int n, char* dst) static string calcNumberedName(const char* base, int i) { char nb[MAXIDCHARS + 1]; - sprintf(nb, "%03d", i); + snprintf(nb, sizeof(nb), "%03d", i); return subst("$0$1", base, nb); } diff --git a/compiler/generator/code_container.cpp b/compiler/generator/code_container.cpp index b1ca75256b..793a48dc1e 100644 --- a/compiler/generator/code_container.cpp +++ b/compiler/generator/code_container.cpp @@ -477,9 +477,6 @@ void CodeContainer::processFIR(void) createMemoryLayout(); } - // Possibly generate JSON - generateJSONFile(); - // Sort struct fields by size and type // 05/16/17 : deactivated since it slows down the code... /* @@ -505,6 +502,15 @@ void CodeContainer::processFIR(void) fCurLoop->generateScalarLoop("count")); endTiming("FIR var checker"); } + +#ifdef FIR_BUILD + if (global::isDebug("FIR_PRINTER")) { + stringstream res; + FIRInstVisitor fir_visitor(&res); + flattenFIR()->accept(&fir_visitor); + std::cout << res.str(); + } +#endif } // Possibly rewrite arrays access using iZone/fZone @@ -540,12 +546,15 @@ void CodeContainer::rewriteInZones() void CodeContainer::mergeSubContainers() { + BlockInst* sub_ui = new BlockInst(); + for (const auto& it : fSubContainers) { // Merge the subcontainer in the main one fExtGlobalDeclarationInstructions->merge(it->fExtGlobalDeclarationInstructions); fGlobalDeclarationInstructions->merge(it->fGlobalDeclarationInstructions); fDeclarationInstructions->merge(it->fDeclarationInstructions); fControlDeclarationInstructions->merge(it->fControlDeclarationInstructions); + sub_ui->merge(it->fUserInterfaceInstructions); // TO CHECK (used for waveform initialisation which has to be moved first...) fStaticInitInstructions->mergeFront(it->fStaticInitInstructions); // Then clear it @@ -553,9 +562,13 @@ void CodeContainer::mergeSubContainers() it->fExtGlobalDeclarationInstructions->fCode.clear(); it->fDeclarationInstructions->fCode.clear(); it->fControlDeclarationInstructions->fCode.clear(); + it->fUserInterfaceInstructions->fCode.clear(); it->fStaticInitInstructions->fCode.clear(); } + // Insert subcontainer UIs at the end of the top group, just before the last closeBox + fUserInterfaceInstructions->insert(fUserInterfaceInstructions->size() - 1, sub_ui); + // Possibly rewrite access in iZone/fZone rewriteInZones(); } diff --git a/compiler/generator/code_container.hh b/compiler/generator/code_container.hh index 1da0b4dbdc..8b5c993bae 100644 --- a/compiler/generator/code_container.hh +++ b/compiler/generator/code_container.hh @@ -640,6 +640,13 @@ class CodeContainer : public virtual Garbageable { return inst; } + StatementInst* pushPreUserInterfaceMethod(StatementInst* inst) + { + faustassert(inst); + fUserInterfaceInstructions->pushFrontInst(inst); + return inst; + } + StatementInst* pushAllocateMethod(StatementInst* inst) { faustassert(inst); diff --git a/compiler/generator/instructions.hh b/compiler/generator/instructions.hh index 6510216716..7a49e0fa15 100644 --- a/compiler/generator/instructions.hh +++ b/compiler/generator/instructions.hh @@ -1016,6 +1016,13 @@ struct BlockInst : public StatementInst { } } + void insert(int index, BlockInst* inst) + { + auto it = fCode.begin(); + std::advance(it, index); + fCode.insert(it, inst); + } + int size() const { return int(fCode.size()); } bool hasReturn() const; diff --git a/compiler/generator/instructions_compiler.cpp b/compiler/generator/instructions_compiler.cpp index 78462d104a..faf464ee94 100644 --- a/compiler/generator/instructions_compiler.cpp +++ b/compiler/generator/instructions_compiler.cpp @@ -28,6 +28,7 @@ #include "instructions_compiler.hh" #include "instructions_compiler1.hh" #include "instructions_compiler_jax.hh" +#include "interpreter_code_container.hh" #include "normalform.hh" #include "prim2.hh" #include "recursivness.hh" @@ -429,6 +430,9 @@ CodeContainer* InstructionsCompiler::signal2Container(const string& name, Tree s } else if (gGlobal->gOutputLang == "jax") { InstructionsCompilerJAX C(container); C.compileSingleSignal(sig); + } else if (gGlobal->gOutputLang == "interp") { + InterpreterInstructionsCompiler C(container); + C.compileSingleSignal(sig); } else { // Special compiler for -fx mode if (gGlobal->gFloatSize == 4) { diff --git a/compiler/generator/llvm/llvm_code_container.cpp b/compiler/generator/llvm/llvm_code_container.cpp index cee1af2e31..827360940b 100644 --- a/compiler/generator/llvm/llvm_code_container.cpp +++ b/compiler/generator/llvm/llvm_code_container.cpp @@ -214,8 +214,13 @@ void LLVMCodeContainer::produceInternal() dsp_factory_base* LLVMCodeContainer::produceFactory() { - // Generate gub containers - generateSubContainers(); + if (gGlobal->gInlineTable) { + // Sub containers are merged in the main class + mergeSubContainers(); + } else { + // Generate sub containers + generateSubContainers(); + } // Build DSP struct generateDeclarations(&fStructVisitor); @@ -230,7 +235,11 @@ dsp_factory_base* LLVMCodeContainer::produceFactory() generateExtGlobalDeclarations(fCodeProducer); generateGlobalDeclarations(fCodeProducer); - generateStaticInitFun("classInit" + fKlassName, false)->accept(fCodeProducer); + if (gGlobal->gInlineTable) { + generateStaticInitFun("staticInit" + fKlassName, false)->accept(fCodeProducer); + } else { + generateStaticInitFun("classInit" + fKlassName, false)->accept(fCodeProducer); + } generateInstanceClear("instanceClear" + fKlassName, "dsp", false, false)->accept(fCodeProducer); generateInstanceConstants("instanceConstants" + fKlassName, "dsp", false, false) ->accept(fCodeProducer); @@ -275,6 +284,39 @@ dsp_factory_base* LLVMCodeContainer::produceFactory() return new llvm_dynamic_dsp_factory_aux("", fModule, fContext, "", -1); } +DeclareFunInst* LLVMCodeContainer::generateStaticInitFun(const string& name, bool isstatic) +{ + Names args; + if (gGlobal->gInlineTable) { + args.push_back(IB::genNamedTyped("dsp", Typed::kObj_ptr)); + } + args.push_back(IB::genNamedTyped("sample_rate", Typed::kInt32)); + + BlockInst* block = IB::genBlockInst(); + + if (gGlobal->gInlineTable) { + BlockInst* inlined = inlineSubcontainersFunCalls(fStaticInitInstructions); + block->pushBackInst(inlined); + } else { + block->pushBackInst(fStaticInitInstructions); + block->pushBackInst(fPostStaticInitInstructions); + } + + // 20/11/16 : added in generateInstanceInitFun, is this needed here ? + /* + init_block->pushBackInst(fResetUserInterfaceInstructions); + init_block->pushBackInst(fClearInstructions); + */ + + // Explicit return + block->pushBackInst(IB::genRetInst()); + + // Creates function + FunTyped* fun_type = IB::genFunTyped(args, IB::genVoidTyped(), + (isstatic) ? FunTyped::kStatic : FunTyped::kDefault); + return IB::genDeclareFunInst(name, fun_type, block); +} + // Scalar LLVMScalarCodeContainer::LLVMScalarCodeContainer(const string& name, int numInputs, int numOutputs) : LLVMCodeContainer(name, numInputs, numOutputs) diff --git a/compiler/generator/llvm/llvm_code_container.hh b/compiler/generator/llvm/llvm_code_container.hh index 90d24ce6db..e97230a1f8 100644 --- a/compiler/generator/llvm/llvm_code_container.hh +++ b/compiler/generator/llvm/llvm_code_container.hh @@ -55,15 +55,10 @@ class LLVMCodeContainer : public virtual CodeContainer { template void generateGetJSON() { - LLVMPtrType string_ptr = llvm::PointerType::get(fBuilder->getInt8Ty(), 0); - LLVMVecTypes getJSON_args; -#if LLVM_VERSION_MAJOR >= 16 - llvm::FunctionType* getJSON_type = - llvm::FunctionType::get(string_ptr, llvm::ArrayRef(getJSON_args), false); -#else + LLVMPtrType string_ptr = llvm::PointerType::get(fBuilder->getInt8Ty(), 0); + LLVMVecTypes getJSON_args; llvm::FunctionType* getJSON_type = llvm::FunctionType::get(string_ptr, makeArrayRef(getJSON_args), false); -#endif LLVMFun getJSON = llvm::Function::Create(getJSON_type, llvm::GlobalValue::ExternalLinkage, "getJSON" + fKlassName, fModule); @@ -111,6 +106,8 @@ class LLVMCodeContainer : public virtual CodeContainer { CodeContainer* createScalarContainer(const std::string& name, int sub_container_type); static CodeContainer* createContainer(const std::string& name, int numInputs, int numOutputs); + + DeclareFunInst* generateStaticInitFun(const std::string& name, bool isstatic); }; class LLVMScalarCodeContainer : public LLVMCodeContainer { diff --git a/compiler/generator/llvm/llvm_dsp_aux.cpp b/compiler/generator/llvm/llvm_dsp_aux.cpp index b09eb1964c..b6e42c3f38 100644 --- a/compiler/generator/llvm/llvm_dsp_aux.cpp +++ b/compiler/generator/llvm/llvm_dsp_aux.cpp @@ -96,15 +96,17 @@ dsp_factory_table llvm_dsp_factory_aux::gLLVMFactoryTable; // Set of externally defined functions, to be linked with the LLVM module set llvm_dsp_factory_aux::gForeignFunctions; -uint64_t llvm_dsp_factory_aux::loadOptimize(const string& function) +uint64_t llvm_dsp_factory_aux::loadOptimize(const string& function, bool strict) { uint64_t fun = fJIT->getFunctionAddress(function); if (fun) { return fun; - } else { + } else if (strict) { stringstream error; error << "ERROR : loadOptimize failed for '" << function << "'\n"; throw faustexception(error.str()); + } else { + return 0; } } @@ -204,6 +206,7 @@ void llvm_dsp_factory_aux::init(const string& type_name, const string& dsp_name) fInstanceConstants = nullptr; fInstanceClear = nullptr; fClassInit = nullptr; + fStaticInit = nullptr; fCompute = nullptr; // By default fClassName = "mydsp"; @@ -267,7 +270,8 @@ bool llvm_dsp_factory_aux::initJITAux() fDestroy = (destroyDspFun)loadOptimize("destroy" + fClassName); fInstanceConstants = (instanceConstantsFun)loadOptimize("instanceConstants" + fClassName); fInstanceClear = (instanceClearFun)loadOptimize("instanceClear" + fClassName); - fClassInit = (classInitFun)loadOptimize("classInit" + fClassName); + fClassInit = (classInitFun)loadOptimize("classInit" + fClassName, false); + fStaticInit = (staticInitFun)loadOptimize("staticInit" + fClassName, false); fCompute = (computeFun)loadOptimize("compute" + fClassName); fGetJSON = (getJSONFun)loadOptimize("getJSON" + fClassName); @@ -397,11 +401,16 @@ void llvm_dsp::init(int sample_rate) void llvm_dsp::classInit(int sample_rate) { - fFactory->getFactory()->fClassInit(sample_rate); + if (fFactory->getFactory()->fClassInit) { + fFactory->getFactory()->fClassInit(sample_rate); + } } void llvm_dsp::instanceInit(int sample_rate) { + if (fFactory->getFactory()->fStaticInit) { + fFactory->getFactory()->fStaticInit(fDSP, sample_rate); + } instanceConstants(sample_rate); instanceResetUserInterface(); instanceClear(); diff --git a/compiler/generator/llvm/llvm_dsp_aux.hh b/compiler/generator/llvm/llvm_dsp_aux.hh index 0edbc6cfc9..76372d22a0 100644 --- a/compiler/generator/llvm/llvm_dsp_aux.hh +++ b/compiler/generator/llvm/llvm_dsp_aux.hh @@ -181,11 +181,15 @@ class llvm_dsp_factory_aux : public dsp_factory_imp { destroyDspFun fDestroy; initFun fInstanceConstants; instanceClearFun fInstanceClear; - classInitFun fClassInit; - computeFun fCompute; - getJSONFun fGetJSON; + // fClassInit in used in default compilation mode + classInitFun fClassInit; + // fStaticInit in used in -it compilation mode + staticInitFun fStaticInit; + computeFun fCompute; + getJSONFun fGetJSON; - uint64_t loadOptimize(const std::string& function); + // Returns the function address or 0 + uint64_t loadOptimize(const std::string& function, bool strict = true); void init(const std::string& dsp_name, const std::string& type_name); @@ -305,7 +309,12 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory, public faust_smartable llvm_dsp* createDSPInstance(); - void classInit(int sample_rate) { fFactory->fClassInit(sample_rate); } + void classInit(int sample_rate) + { + if (fFactory->fClassInit) { + fFactory->fClassInit(sample_rate); + } + } void setMemoryManager(dsp_memory_manager* manager) { fFactory->setMemoryManager(manager); } dsp_memory_manager* getMemoryManager() { return fFactory->getMemoryManager(); } diff --git a/compiler/generator/sha_key.hh b/compiler/generator/sha_key.hh index 8cb4b37bfc..a9af93e5da 100644 --- a/compiler/generator/sha_key.hh +++ b/compiler/generator/sha_key.hh @@ -324,9 +324,13 @@ extern "C" FAUST_API void generateCSHA1(const char* data, char* sha_key) const char* H = "0123456789ABCDEF"; char c1 = H[(obuf[i] >> 4)]; char c2 = H[(obuf[i] & 15)]; - sha_key += c1; - sha_key += c2; + + *sha_key = c1; + sha_key++; + *sha_key = c2; + sha_key++; } + *sha_key = '\0'; // Null terminate the string } #endif diff --git a/compiler/global.cpp b/compiler/global.cpp index 8161f32f33..c45b08cf7b 100644 --- a/compiler/global.cpp +++ b/compiler/global.cpp @@ -1723,8 +1723,8 @@ bool global::processCmdline(int argc, const char* argv[]) } // gInlinetable check - if (gInlineTable && (gOutputLang != "cpp" && gOutputLang != "c")) { - throw faustexception("ERROR : -it can only be used with 'cpp' and 'c' backends\n"); + if (gInlineTable && (gOutputLang != "cpp" && gOutputLang != "c" && gOutputLang != "llvm")) { + throw faustexception("ERROR : -it can only be used with 'cpp', 'c' and 'llvm' backends\n"); } // gMemoryManager check @@ -2477,6 +2477,7 @@ string global::printHelp() << endl; sstr << tab << "FAUST_DEBUG = FAUST_LLVM2 print LLVM IR after optimisation." << endl; + sstr << tab << "FAUST_DEBUG = FIR_PRINTER print FIR after generation." << endl; sstr << tab << "FAUST_DEBUG = FAUST_LLVM_NO_FM deactivate fast-math optimisation in LLVM IR." << endl; diff --git a/compiler/libcode.cpp b/compiler/libcode.cpp index 404e8dfc1a..b4af3e45c7 100644 --- a/compiler/libcode.cpp +++ b/compiler/libcode.cpp @@ -956,6 +956,9 @@ static void generateCodeAux1(unique_ptr& helpers, unique_ptr& } } } + + // Possibly generate JSON + gContainer->generateJSONFile(); } #ifdef OCPP_BUILD diff --git a/compiler/parser/sourcefetcher.cpp b/compiler/parser/sourcefetcher.cpp index e0e29b2472..eff82ab507 100644 --- a/compiler/parser/sourcefetcher.cpp +++ b/compiler/parser/sourcefetcher.cpp @@ -682,7 +682,7 @@ const char* http_strerror() stringIndex = strstr(originalError, "%d"); strncat(convertedError, originalError, /* Copy up to %d */ labs(long(stringIndex - originalError))); - sprintf(&convertedError[strlen(convertedError)], "%d", errorInt); + snprintf(&convertedError[strlen(convertedError)], sizeof(convertedError), "%d", errorInt); stringIndex += 2; /* Skip past the %d */ strcat(convertedError, stringIndex); diff --git a/compiler/signals/sigtyperules.cpp b/compiler/signals/sigtyperules.cpp index b6b3bb4baa..4fa3044819 100644 --- a/compiler/signals/sigtyperules.cpp +++ b/compiler/signals/sigtyperules.cpp @@ -640,7 +640,9 @@ static Type inferSigType(Tree sig, Tree env) } else if (isSigSoundfile(sig, l)) { - return makeSimpleType(kInt, kBlock, kExec, kVect, kNum, interval(0, INT32_MAX)); + // computability should be kExec if the soundfile can be changed at runtime with the GUI + // (which is not implemented yet), so kInit for now + return makeSimpleType(kInt, kBlock, kInit, kVect, kNum, interval(0, INT32_MAX)); } else if (isSigSoundfileLength(sig, sf, part)) { @@ -648,7 +650,9 @@ static Type inferSigType(Tree sig, Tree env) Type t2 = T(part, env); checkPartInterval(sig, t2); int c = std::max(int(kBlock), t2->variability()); - return makeSimpleType(kInt, c, kExec, kVect, kNum, interval(0, INT32_MAX)); + // computability should be kExec if the soundfile can be changed at runtime with the GUI + // (which is not implemented yet), so kInit for now + return makeSimpleType(kInt, c, kInit, kVect, kNum, interval(0, INT32_MAX)); } else if (isSigSoundfileRate(sig, sf, part)) { @@ -656,7 +660,9 @@ static Type inferSigType(Tree sig, Tree env) Type t2 = T(part, env); checkPartInterval(sig, t2); int c = std::max(int(kBlock), t2->variability()); - return makeSimpleType(kInt, c, kExec, kVect, kNum, interval(0, INT32_MAX)); + // computability should be kExec if the soundfile can be changed at runtime with the GUI + // (which is not implemented yet), so kInit for now + return makeSimpleType(kInt, c, kInit, kVect, kNum, interval(0, INT32_MAX)); } else if (isSigSoundfileBuffer(sig, sf, x, part, z)) { @@ -665,7 +671,9 @@ static Type inferSigType(Tree sig, Tree env) Type tp = T(part, env); T(z, env); checkPartInterval(sig, tp); - return makeSimpleType(kReal, kSamp, kExec, kVect, kNum, interval(-1, 1)); + // computability should be kExec if the soundfile can be changed at runtime with the GUI + // (which is not implemented yet), so kInit for now + return makeSimpleType(kReal, kSamp, kInit, kVect, kNum, interval(-1, 1)); } else if (isSigAttach(sig, s1, s2)) { diff --git a/compiler/transform/sigNewConstantPropagation.cpp b/compiler/transform/sigNewConstantPropagation.cpp index 99a2008eb3..900ca96bf3 100644 --- a/compiler/transform/sigNewConstantPropagation.cpp +++ b/compiler/transform/sigNewConstantPropagation.cpp @@ -77,8 +77,8 @@ Tree SigNewConstantPropagation::transformation(Tree sig) */ Tree SigNewConstantPropagation::postprocess(Tree sig) { - int opnum, projnum; - Tree t1, t2, rg, var, le; + int opnum; + Tree t1, t2; if (isSigBinOp(sig, &opnum, t1, t2)) { BinOp* op = gBinOpTable[opnum]; diff --git a/tests/impulse-tests/Makefile b/tests/impulse-tests/Makefile index afa0508fd3..eef21c4640 100644 --- a/tests/impulse-tests/Makefile +++ b/tests/impulse-tests/Makefile @@ -288,6 +288,7 @@ wast: llvm: export FAUST_OPT=FAUST_LLVM_NO_FM; \ $(MAKE) -f Make.llvm outdir=llvm/double FAUSTOPTIONS="-I dsp" + $(MAKE) -f Make.llvm outdir=llvm/double/it FAUSTOPTIONS="-I dsp -it" $(MAKE) -f Make.llvm outdir=llvm/double/ftz1 FAUSTOPTIONS="-I dsp -ftz 1" $(MAKE) -f Make.llvm outdir=llvm/double/ftz2 FAUSTOPTIONS="-I dsp -ftz 2" $(MAKE) -f Make.llvm outdir=llvm/double/ct FAUSTOPTIONS="-I dsp -ct 0" diff --git a/tools/benchmark/interp-tracer.cpp b/tools/benchmark/interp-tracer.cpp index f588af9828..9e54b4e85e 100644 --- a/tools/benchmark/interp-tracer.cpp +++ b/tools/benchmark/interp-tracer.cpp @@ -211,12 +211,12 @@ int main(int argc, char* argv[]) cout << "Using interpreter backend" << endl; if (trace_mode > 0) { - char mode[8]; sprintf(mode, "%d", trace_mode); + char mode[8]; snprintf(mode, sizeof(mode), "%d", trace_mode); setenv("FAUST_INTERP_TRACE", mode, 1); } if (is_output > 0) { - char mode[8]; sprintf(mode, "%d", is_output); + char mode[8]; snprintf(mode, sizeof(mode), "%d", is_output); setenv("FAUST_INTERP_OUTPUT", mode, 1); }