Fixed some bugs.
[llvm/zpu.git] / lib / Target / PTX / PTXISelDAGToDAG.cpp
blobda9136511dbf175bef53b242988cd3711956e30d
1 //===-- PTXISelDAGToDAG.cpp - A dag to dag inst selector for PTX ----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines an instruction selector for the PTX target.
12 //===----------------------------------------------------------------------===//
14 #include "PTX.h"
15 #include "PTXTargetMachine.h"
16 #include "llvm/CodeGen/SelectionDAGISel.h"
18 using namespace llvm;
20 namespace {
21 // PTXDAGToDAGISel - PTX specific code to select PTX machine
22 // instructions for SelectionDAG operations.
23 class PTXDAGToDAGISel : public SelectionDAGISel {
24 public:
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
37 } // namespace
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);