-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating a Dplug plugin #40
Comments
Yes... well... sort of. It's easy for some languages, but very hard for others! The tricky bit is that the HEART code which gets converted to the target language uses SSA form. That means it needs to be free to jump between syntactic blocks. At the moment we can emit LLVM IR (which is also SSA form) and C++ (which can emulate SSA form using goto for the jumps) but converting SSA to a language without a goto statement, or which has limits on where a goto can jump to is far from a straight conversion. WASM is such a target, and we currently rely on LLVM to do the hard conversion of SSA-form to WASM (but future extensions to the WASM spec will probably add support for SSA-like syntax). I'm assuming Dplug uses D (?), and I hope D is too sensible to allow random goto statements, so you're have a tough time doing that. It's possible of course - in compiler literature there's lots of papers about how to do this SSA -> non-SSA conversion process, but it's a tough one. |
Thanks for the write-up. In terms of control flow, D has D when using the LLVM D compiler (LDC) can also ingest fragments LLVM IR (have to be known at compile-time though) and passthrough it. In practice Dplug uses this compiler for all platforms. https://wiki.dlang.org/LDC_inline_IR One example of D taking LLVM IR is implementing: int add(int a, int b)
{
return inlineIR!(`
%r = add i32 %0, %1
ret i32 %r`, int)(a, b);
} ( |
Interesting. Well, if D really does allow free gotos then generating it would be a similar task to our C++ generator. I would say "have a go at it yourself" but actually that might be tricky at the moment, as there are utilities you'd need which we've not yet moved into our open-source code section.. we're aiming to refactor things to make it possible for people to create their own back-ends as soon as possible, we're just not quite settled on the right APIs for it yet. |
Would it be possible to export to a plugin in another langage than C++? (and another framework than JUCE)
Curious about what the possibilities of SOULLang are, and what another backend entails.
The text was updated successfully, but these errors were encountered: