1 //===-- PTXISelDAGToDAG.cpp - A dag to dag inst selector for PTX ----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines an instruction selector for the PTX target.
12 //===----------------------------------------------------------------------===//
15 #include "PTXTargetMachine.h"
16 #include "llvm/CodeGen/SelectionDAGISel.h"
21 // PTXDAGToDAGISel - PTX specific code to select PTX machine
22 // instructions for SelectionDAG operations.
23 class PTXDAGToDAGISel
: public SelectionDAGISel
{
25 PTXDAGToDAGISel(PTXTargetMachine
&TM
, CodeGenOpt::Level OptLevel
);
27 virtual const char *getPassName() const {
28 return "PTX DAG->DAG Pattern Instruction Selection";
31 SDNode
*Select(SDNode
*Node
);
33 // Include the pieces auto'gened from the target description
34 #include "PTXGenDAGISel.inc"
36 }; // class PTXDAGToDAGISel
39 // createPTXISelDag - This pass converts a legalized DAG into a
40 // PTX-specific DAG, ready for instruction scheduling
41 FunctionPass
*llvm::createPTXISelDag(PTXTargetMachine
&TM
,
42 CodeGenOpt::Level OptLevel
) {
43 return new PTXDAGToDAGISel(TM
, OptLevel
);
46 PTXDAGToDAGISel::PTXDAGToDAGISel(PTXTargetMachine
&TM
,
47 CodeGenOpt::Level OptLevel
)
48 : SelectionDAGISel(TM
, OptLevel
) {}
50 SDNode
*PTXDAGToDAGISel::Select(SDNode
*Node
) {
51 // SelectCode() is auto'gened
52 return SelectCode(Node
);