LLVM API Documentation

NVPTXISelDAGToDAG.h
Go to the documentation of this file.
00001 //===-- NVPTXISelDAGToDAG.h - A dag to dag inst selector for NVPTX --------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines an instruction selector for the NVPTX target.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXISELDAGTODAG_H
00015 #define LLVM_LIB_TARGET_NVPTX_NVPTXISELDAGTODAG_H
00016 
00017 #include "NVPTX.h"
00018 #include "NVPTXISelLowering.h"
00019 #include "NVPTXRegisterInfo.h"
00020 #include "NVPTXTargetMachine.h"
00021 #include "llvm/CodeGen/SelectionDAGISel.h"
00022 #include "llvm/IR/Intrinsics.h"
00023 #include "llvm/Support/Compiler.h"
00024 using namespace llvm;
00025 
00026 namespace {
00027 
00028 class LLVM_LIBRARY_VISIBILITY NVPTXDAGToDAGISel : public SelectionDAGISel {
00029 
00030   // If true, generate mul.wide from sext and mul
00031   bool doMulWide;
00032 
00033   int getDivF32Level() const;
00034   bool usePrecSqrtF32() const;
00035   bool useF32FTZ() const;
00036   bool allowFMA() const;
00037 
00038 public:
00039   explicit NVPTXDAGToDAGISel(NVPTXTargetMachine &tm,
00040                              CodeGenOpt::Level   OptLevel);
00041 
00042   // Pass Name
00043   const char *getPassName() const override {
00044     return "NVPTX DAG->DAG Pattern Instruction Selection";
00045   }
00046 
00047   const NVPTXSubtarget &Subtarget;
00048 
00049   bool SelectInlineAsmMemoryOperand(const SDValue &Op,
00050                                     char ConstraintCode,
00051                                     std::vector<SDValue> &OutOps) override;
00052 private:
00053 // Include the pieces autogenerated from the target description.
00054 #include "NVPTXGenDAGISel.inc"
00055 
00056   SDNode *Select(SDNode *N) override;
00057   SDNode *SelectIntrinsicNoChain(SDNode *N);
00058   SDNode *SelectIntrinsicChain(SDNode *N);
00059   SDNode *SelectTexSurfHandle(SDNode *N);
00060   SDNode *SelectLoad(SDNode *N);
00061   SDNode *SelectLoadVector(SDNode *N);
00062   SDNode *SelectLDGLDU(SDNode *N);
00063   SDNode *SelectStore(SDNode *N);
00064   SDNode *SelectStoreVector(SDNode *N);
00065   SDNode *SelectLoadParam(SDNode *N);
00066   SDNode *SelectStoreRetval(SDNode *N);
00067   SDNode *SelectStoreParam(SDNode *N);
00068   SDNode *SelectAddrSpaceCast(SDNode *N);
00069   SDNode *SelectTextureIntrinsic(SDNode *N);
00070   SDNode *SelectSurfaceIntrinsic(SDNode *N);
00071   SDNode *SelectBFE(SDNode *N);
00072         
00073   inline SDValue getI32Imm(unsigned Imm) {
00074     return CurDAG->getTargetConstant(Imm, MVT::i32);
00075   }
00076 
00077   // Match direct address complex pattern.
00078   bool SelectDirectAddr(SDValue N, SDValue &Address);
00079 
00080   bool SelectADDRri_imp(SDNode *OpNode, SDValue Addr, SDValue &Base,
00081                         SDValue &Offset, MVT mvt);
00082   bool SelectADDRri(SDNode *OpNode, SDValue Addr, SDValue &Base,
00083                     SDValue &Offset);
00084   bool SelectADDRri64(SDNode *OpNode, SDValue Addr, SDValue &Base,
00085                       SDValue &Offset);
00086 
00087   bool SelectADDRsi_imp(SDNode *OpNode, SDValue Addr, SDValue &Base,
00088                         SDValue &Offset, MVT mvt);
00089   bool SelectADDRsi(SDNode *OpNode, SDValue Addr, SDValue &Base,
00090                     SDValue &Offset);
00091   bool SelectADDRsi64(SDNode *OpNode, SDValue Addr, SDValue &Base,
00092                       SDValue &Offset);
00093 
00094   bool ChkMemSDNodeAddressSpace(SDNode *N, unsigned int spN) const;
00095 
00096 };
00097 }
00098 
00099 #endif