[LLVMdev] Dynamic configuration for llvmc2

Mikhail Glushenkov foldr at codedgers.com
Mon Nov 17 13:50:48 PST 2008


Hi,

> I've found that often I want to save some kind of information in a
> variable and then use that variable when constructing the command
> line. This is not possible without hooks, but hooks are limited in
> what they can do (they can only do simple string substitution).

Would it help if it was allowed to pass arguments to hooks?  So that
you could write, for example:

(cmd_line "$CALL(MyHook, $INFILE, $OUTFILE)")

> Basically, my concern with TableGen is that a lot of work has gone
> into creating a small domain-specific scripting language in
> TableGen, when maybe a real scripting language would be easier to
> use.

As Anton said, that was intentional. We wanted to minimize the number
of dependencies and keep the driver lean and mean.

> How would you feel about a plugin that reads its configuration from
> an external specs file written in, say, Lua? It looks like the
> design of llvmc2 allows plugins that dynamically set up nodes and
> edges instead of statically reading them, and it could be a good
> solution for drivers with complex requirements. I could start work
> on such a thing if you thought it was a good idea.

I think that such a project could be useful - as long as it is
implemented strictly as a plugin (of course, some things could be
changed/added to the core to make life easier for you - but we're not
going to add a dependency on the whole lua VM).

However, to make this work you will need more than just the ability to
modify the compilation graph. One thing that comes to mind is the need
to provide Lua implementations for the various Edge* classes
(otherwise you can't use edges with non-default weights). You'll also
need to interface with LLVM's CommandLine library somehow (easy to do
in C++, where we just auto-generate the appropriate objects).




More information about the llvm-dev mailing list