Skip to content

Commit

Permalink
move bargraph out of loop use temp variable instead
Browse files Browse the repository at this point in the history
  • Loading branch information
crop2000 committed Dec 15, 2024
1 parent 97c175b commit 50b7cbf
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions compiler/generator/instructions_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,26 +1300,33 @@ ValueInst* InstructionsCompiler::generateBargraphAux(Tree sig, Tree path, ValueI
ValueInst* val = (gGlobal->gFAUSTFLOAT2Internal) ? bg_in : IB::genCastFloatMacroInst(bg_in);
StoreVarInst* res = IB::genStoreStructVar(varname, val);

string tempname;
BasicTyped* ctype;
getTypedNames(t, "Temp", ctype, tempname);

switch (t->variability()) {
case kKonst:
pushResetUIInstructions(res);
break;

case kBlock: {
if (gGlobal->gExtControl) {
pushControlDeclare(res);
pushControlDeclare(IB::genDecStackVar(tempname, ctype, val));
pushControlDeclare(IB::genStoreStructVar(varname, IB::genLoadStackVar(tempname)));
} else {
pushComputeBlockMethod(res);
pushComputeBlockMethod(IB::genDecStackVar(tempname, ctype, val));
pushComputeBlockMethod(IB::genStoreStructVar(varname, IB::genLoadStackVar(tempname)));
}
break;
}

case kSamp:
pushComputeDSPMethod(IB::genControlInst(getConditionCode(sig), res));
break;
// pushComputeBlockMethod(IB::genDecStackVar(tempname, ctype));//c
pushComputeBlockMethod(IB::genDecStackVar(tempname, ctype, IB::genLoadStructVar(varname)));//initialize for rust
pushComputeDSPMethod(IB::genControlInst(getConditionCode(sig), IB::genStoreStackVar(tempname, val)));
pushPostComputeBlockMethod(IB::genStoreStructVar(varname, IB::genLoadStackVar(tempname)));
return IB::genLoadStackVar(tempname);
}

// generateCacheCode(sig, IB::genLoadStructVar(varname));
return bg_in;
}

Expand Down

0 comments on commit 50b7cbf

Please sign in to comment.