Skip to content

Commit

Permalink
Deactivate 'Const' optimization in InstructionsCompiler::generateVari…
Browse files Browse the repository at this point in the history
…ableStore.
  • Loading branch information
sletz committed Mar 31, 2024
1 parent ab77016 commit 81cf3d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 9 additions & 3 deletions compiler/generator/instructions_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,8 @@ ValueInst* InstructionsCompiler::generateVariableStore(Tree sig, ValueInst* exp)
switch (t->variability()) {
case kKonst:
getTypedNames(t, "Const", ctype, vname);

/* TODO: deactivated for now since getOccurrence fails in some cases
// The variable is used in compute (kBlock or kSamp), so define is as a field in the DSP struct
if (o->getOccurrence(kBlock) || o->getOccurrence(kSamp)) {
pushDeclare(InstBuilder::genDecStructVar(vname, InstBuilder::genBasicTyped(ctype)));
Expand All @@ -1045,6 +1047,12 @@ ValueInst* InstructionsCompiler::generateVariableStore(Tree sig, ValueInst* exp)
pushInitMethod(InstBuilder::genDecStackVar(vname, InstBuilder::genBasicTyped(ctype), exp));
return InstBuilder::genLoadStackVar(vname);
}
*/

// Always put variables in DSP struct for now
pushDeclare(InstBuilder::genDecStructVar(vname, InstBuilder::genBasicTyped(ctype)));
pushInitMethod(InstBuilder::genStoreStructVar(vname, exp));
return InstBuilder::genLoadStructVar(vname);

case kBlock:
if (gGlobal->gOneSample >= 0 || gGlobal->gOneSampleControl) {
Expand All @@ -1063,10 +1071,8 @@ ValueInst* InstructionsCompiler::generateVariableStore(Tree sig, ValueInst* exp)

case kSamp:
getTypedNames(t, "Temp", ctype, vname);

// Only generated for the DSP loop
if (gGlobal->gHasTeeLocal) {

if (dynamic_cast<NullValueInst*>(getConditionCode(sig))) {
pushComputeDSPMethod(InstBuilder::genDecStackVar(vname, InstBuilder::genBasicTyped(ctype)));
} else {
Expand All @@ -1077,8 +1083,8 @@ ValueInst* InstructionsCompiler::generateVariableStore(Tree sig, ValueInst* exp)
pushComputeBlockMethod(InstBuilder::genDecStackVar(vname, InstBuilder::genBasicTyped(ctype), InstBuilder::genLoadStructVar(vname_perm)));
pushPostComputeBlockMethod(InstBuilder::genStoreStructVar(vname_perm, InstBuilder::genLoadStackVar(vname)));
}

return InstBuilder::genTeeVar(vname, exp);

} else {

if (dynamic_cast<NullValueInst*>(getConditionCode(sig))) {
Expand Down
6 changes: 1 addition & 5 deletions compiler/generator/jsfx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ Currently has available features :
* Bargraph for MIDI output
* Test MIDI and slider scaling with FAUST MIDI laws (steps)


# Possible improvements
# Possible improvements

* GFX (graphics) section described by user and compiled with an architecture file or similar mechanism
* Or a GFX library accessible by sliders metadata



0 comments on commit 81cf3d7

Please sign in to comment.