Conditional includes in TableGen?

Hello the list,

We have just moved things over to using the new multiple register size things, but this is not (yet?) supported by FastISel. This isn’t an issue for us, because fast isel never worked for our extensions to base MIPS. We’ve temporarily simply disabled fast isel entirely, but it would be nice if we could only include our .td file for the TableGen runs that are *not* generating the fast isel code.

Looking at the tablegen docs, I can’t see any mechanism that allows me to conditionally include a file. Does this exist in any form?


I don’t think there is no C-style conditional include in tablegen. Maybe you can do what you want by defining a file scope Predicates?

There isn't really any such thing.

You can hack it though through invocations of llvm-tblgen:

real/ <- the actual .td file
fake/ <- empty

For the invocations that use the real file:
   llvm-tblgen -Ireal ...
The the other ones:
   llvm-tblgen -Ifake ...

It's not pretty, but it may do as a workaround. If there is a need for it, maybe we could consider implementing some simple preprocessing directives, such as #if/#else/#endif and #define for macros (without logical operators), but only allow boolean values (i.e. a macro is either defined or not defined, and that's it).