Are purely out-of-tree targets supported? A search in Discourse didn’t return much relevant or up-to-date information on the topic. While the target-dependent class hierarchy is designed to allow a backend to implement subclasses within the confines of its own llvm/lib/Target/
subdirectory, there are a number of puzzle pieces that are not as well decoupled. Here are a (most likely incomplete) list of issues I found:
-
Enum types like
Triple
,MVT
andValueType
are maintained by hand, and seem to require intrusive in-tree changes if I were to add an out-of-tree target. -
The
llvm::Intrinsic
enum is generated by TableGen, which we can teach to read input from an out-of-tree target source directory, but the target-specificIntrinsic
enums are sometimes used in common code (usually under Analysis, CodeGen, and Transforms), and such uses may not properly delegate unrecognized cases to the target properly. -
ELF and DWARF support similarly depends on hand-written enums. The implementation does not seem modularized; much of the code consists of
switch
statements, and adding a new target requires addingcase
statements in a whole bunch of places. -
lld and Clang have more, bigger, issues of similar nature, but let’s just discuss LLVM for now.
I understand that most of the time, when we talk about “out-of-tree target”, we really mean “downstream fork of the whole tree with a new target”. But was LLVM ever intended to be able to support a purely out-of-tree target, and if so, should we try to rebuild and maintain that ability? Or if it still has that ability, can someone point me to a user guide?
Thanks!