Pre-RFC: Codegen plugins

Apparently my RFC isn’t really an RFC as I don’t have a clear idea on it, so I’m moving the discussion over here. The RFC in question is: https://github.com/rust-lang/rfcs/pull/170.

What I propose is to provide means to run custom codegen plugins, so that it’s possible to further extend compiling process. There’s a bunch of specific cases, that are not that interesting to be implemented in core rust but still important to other developers; for me personally that’s flexible linking and inline assembly options.

I saw your example using #[awesome_int], but do you have an actual use case? This sounds interesting, but I would love some more examples to back it up.

My two primary use cases are implementing these RFCs #44 and #55 (sorry, apparently I can’t write posts with links).

Where does it run? Before trans? After? Is it an LLVM pass? What are they allowed to modify? I don’t think it’s possible to define what a codegen plugin can do in a useful way without just implementing the feature you want mostly-in-rustc.

Furthermore, this is one of either:

  1. Not in need of an RFC, since it only affects the compiler internals and not the language
  2. Undesirable, since it would tie the language to a specific backend and backend architecture (LLVM and whatever trans does). Procedural syntax extensions and lints are speccable, though we wouldn’t want to spec what we have today. This is not.

I would think a plug in system does require an RFC. Plug-ins by their nature are user-visible (even if only developers of rust manufacture plug-ins, users would install and mix and match them).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.