LLVM API Documentation

NVPTXTargetMachine.h
Go to the documentation of this file.
00001 //===-- NVPTXTargetMachine.h - Define TargetMachine for NVPTX ---*- C++ -*-===//
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 declares the NVPTX specific subclass of TargetMachine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
00015 #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
00016 
00017 #include "NVPTXSubtarget.h"
00018 #include "ManagedStringPool.h"
00019 #include "llvm/Target/TargetFrameLowering.h"
00020 #include "llvm/Target/TargetMachine.h"
00021 #include "llvm/Target/TargetSelectionDAGInfo.h"
00022 
00023 namespace llvm {
00024 
00025 /// NVPTXTargetMachine
00026 ///
00027 class NVPTXTargetMachine : public LLVMTargetMachine {
00028   NVPTXSubtarget Subtarget;
00029 
00030   // Hold Strings that can be free'd all together with NVPTXTargetMachine
00031   ManagedStringPool ManagedStrPool;
00032 
00033 public:
00034   NVPTXTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
00035                      const TargetOptions &Options, Reloc::Model RM,
00036                      CodeModel::Model CM, CodeGenOpt::Level OP, bool is64bit);
00037 
00038   const NVPTXSubtarget *getSubtargetImpl() const override { return &Subtarget; }
00039 
00040   ManagedStringPool *getManagedStrPool() const {
00041     return const_cast<ManagedStringPool *>(&ManagedStrPool);
00042   }
00043 
00044   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
00045 
00046   // Emission of machine code through MCJIT is not supported.
00047   bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_ostream &,
00048                          bool = true) override {
00049     return true;
00050   }
00051 
00052 }; // NVPTXTargetMachine.
00053 
00054 class NVPTXTargetMachine32 : public NVPTXTargetMachine {
00055   virtual void anchor();
00056 public:
00057   NVPTXTargetMachine32(const Target &T, StringRef TT, StringRef CPU,
00058                        StringRef FS, const TargetOptions &Options,
00059                        Reloc::Model RM, CodeModel::Model CM,
00060                        CodeGenOpt::Level OL);
00061 };
00062 
00063 class NVPTXTargetMachine64 : public NVPTXTargetMachine {
00064   virtual void anchor();
00065 public:
00066   NVPTXTargetMachine64(const Target &T, StringRef TT, StringRef CPU,
00067                        StringRef FS, const TargetOptions &Options,
00068                        Reloc::Model RM, CodeModel::Model CM,
00069                        CodeGenOpt::Level OL);
00070 };
00071 
00072 } // end namespace llvm
00073 
00074 #endif