Loading plugins (dynamic libraries) before forwarding argument to LLVM

I’m new to clang so perhaps there already is a way to describe what I want to do.
I would like to be able to load a plugin before the driver forwards the argument given by -mllvm to LLVM. In my case this is useful to experiment with a backend scheduler: I first need to load the plugin which provides it and then select it via a LLVM option.
The problems is that, as far as I understand the code in tools/driver/cc1_main.cpp, impossible because the driver first forward arguments to LLVM and then load plugins.
Is there a good reason to have this order or is just arbitrary ?

As an experiment, I reordered the two things and manage to make it work the way I expected but I understand that -mllvm is not an option supposed to be used by every user :slight_smile: Is there a chance that such scenario be handle by clang in the future ?


Amaury Pouly