LLVM  4.0.0
NVPTXTargetMachine.h
Go to the documentation of this file.
1 //===-- NVPTXTargetMachine.h - Define TargetMachine for NVPTX ---*- C++ -*-===//
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 declares the NVPTX specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
16 
17 #include "ManagedStringPool.h"
18 #include "NVPTXSubtarget.h"
22 
23 namespace llvm {
24 
25 /// NVPTXTargetMachine
26 ///
28  bool is64bit;
29  std::unique_ptr<TargetLoweringObjectFile> TLOF;
30  NVPTX::DrvInterface drvInterface;
31  NVPTXSubtarget Subtarget;
32 
33  // Hold Strings that can be free'd all together with NVPTXTargetMachine
34  ManagedStringPool ManagedStrPool;
35 
36 public:
37  NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
38  StringRef FS, const TargetOptions &Options,
40  CodeGenOpt::Level OP, bool is64bit);
41 
42  ~NVPTXTargetMachine() override;
43  const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {
44  return &Subtarget;
45  }
46  const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget; }
47  bool is64Bit() const { return is64bit; }
48  NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
50  return const_cast<ManagedStringPool *>(&ManagedStrPool);
51  }
52 
53  TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
54 
55  // Emission of machine code through MCJIT is not supported.
56  bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_pwrite_stream &,
57  bool = true) override {
58  return true;
59  }
61  return TLOF.get();
62  }
63 
64  void addEarlyAsPossiblePasses(PassManagerBase &PM) override;
66 
67 }; // NVPTXTargetMachine.
68 
70  virtual void anchor();
71 public:
72  NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,
73  StringRef FS, const TargetOptions &Options,
76 };
77 
79  virtual void anchor();
80 public:
81  NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
82  StringRef FS, const TargetOptions &Options,
85 };
86 
87 } // end namespace llvm
88 
89 #endif
Analysis pass providing the TargetTransformInfo.
ManagedStringPool - The strings allocated from a managed string pool are owned by the string pool and...
DrvInterface
Definition: NVPTX.h:63
Target-Independent Code Generator Pass Configuration Options.
Context object for machine code objects.
Definition: MCContext.h:51
TargetIRAnalysis getTargetIRAnalysis() override
Get a TargetIRAnalysis implementation for the target.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
const NVPTXSubtarget * getSubtargetImpl(const Function &) const override
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
TargetLoweringObjectFile * getObjFileLowering() const override
NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL)
This class describes a target machine that is implemented with the LLVM target-independent code gener...
ManagedStringPool * getManagedStrPool() const
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Target - Wrapper for Target specific information.
NVPTXTargetMachine.
~NVPTXTargetMachine() override
void addEarlyAsPossiblePasses(PassManagerBase &PM) override
Add target-specific function passes that should be run as early as possible in the optimization pipel...
bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_pwrite_stream &, bool=true) override
Add passes to the specified pass manager to get machine code emitted with the MCJIT.
NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL)
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:333
const NVPTXSubtarget * getSubtargetImpl() const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
#define OP(n)
Definition: regex2.h:70
NVPTX::DrvInterface getDrvInterface() const
NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OP, bool is64bit)