Allow separation of declarations and definitions in <Target>ISelDAGToDAG.inc
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 10 Nov 2017 18:36:04 +0000 (18:36 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 10 Nov 2017 18:36:04 +0000 (18:36 +0000)
commitb8c68c67dc21c989be4001045a00a0e8c6bea663
tree8e2a0879064985bd24dfb9f3c3b89b3d77132f60
parent43e7b7a57f7922284ff8778eefffea143ece7155
Allow separation of declarations and definitions in <Target>ISelDAGToDAG.inc

This patch adds the ability to include the member function declarations
in the instruction selector class separately from the member bodies.

Defining GET_DAGISEL_DECL macro to any value will only include the member
declarations. To include bodies, define GET_DAGISEL_BODY macro to be the
selector class name. Example:

  class FooDAGToDAGISel : public SelectionDAGISel {
    // Pull in declarations only.
    #define GET_DAGISEL_DECL
    #include "FooISelDAGToDAG.inc"
  };

  // Include the function bodies (with names qualified with the provided
  // class name).
  #define GET_DAGISEL_BODY FooDAGToDAGISel
  #include "FooISelDAGToDAG.inc"

When neither of the two macros are defined, the function bodies are emitted
inline (in the same way as before this patch).

Differential Revision: https://reviews.llvm.org/D39596

llvm-svn: 317903
llvm/utils/TableGen/DAGISelEmitter.cpp
llvm/utils/TableGen/DAGISelMatcherEmitter.cpp