LLVM  9.0.0svn
NVPTXTargetMachine.h
Go to the documentation of this file.
1 //===-- NVPTXTargetMachine.h - Define TargetMachine for NVPTX ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the NVPTX specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
14 #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
15 
16 #include "ManagedStringPool.h"
17 #include "NVPTXSubtarget.h"
21 
22 namespace llvm {
23 
24 /// NVPTXTargetMachine
25 ///
27  bool is64bit;
28  // Use 32-bit pointers for accessing const/local/short AS.
29  bool UseShortPointers;
30  std::unique_ptr<TargetLoweringObjectFile> TLOF;
31  NVPTX::DrvInterface drvInterface;
32  NVPTXSubtarget Subtarget;
33 
34  // Hold Strings that can be free'd all together with NVPTXTargetMachine
35  ManagedStringPool ManagedStrPool;
36 
37 public:
38  NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
39  StringRef FS, const TargetOptions &Options,
41  CodeGenOpt::Level OP, bool is64bit);
42 
43  ~NVPTXTargetMachine() override;
44  const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {
45  return &Subtarget;
46  }
47  const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget; }
48  bool is64Bit() const { return is64bit; }
49  bool useShortPointers() const { return UseShortPointers; }
50  NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
52  return const_cast<ManagedStringPool *>(&ManagedStrPool);
53  }
54 
56 
57  // Emission of machine code through MCJIT is not supported.
59  bool = true) override {
60  return true;
61  }
63  return TLOF.get();
64  }
65 
66  void adjustPassManager(PassManagerBuilder &) override;
67 
69 
70  bool isMachineVerifierClean() const override {
71  return false;
72  }
73 }; // NVPTXTargetMachine.
74 
76  virtual void anchor();
77 public:
78  NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,
79  StringRef FS, const TargetOptions &Options,
81  CodeGenOpt::Level OL, bool JIT);
82 };
83 
85  virtual void anchor();
86 public:
87  NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
88  StringRef FS, const TargetOptions &Options,
90  CodeGenOpt::Level OL, bool JIT);
91 };
92 
93 } // end namespace llvm
94 
95 #endif
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like...
This class represents lattice values for constants.
Definition: AllocatorList.h:23
F(f)
ManagedStringPool - The strings allocated from a managed string pool are owned by the string pool and...
DrvInterface
Definition: NVPTX.h:61
bool isMachineVerifierClean() const override
Returns true if the target is expected to pass all machine verifier checks.
Target-Independent Code Generator Pass Configuration Options.
Context object for machine code objects.
Definition: MCContext.h:62
ManagedStringPool * getManagedStrPool() const
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&#39;s TargetSubtargetInf...
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
TargetLoweringObjectFile * getObjFileLowering() const override
NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OP, bool is64bit)
This class describes a target machine that is implemented with the LLVM target-independent code gener...
NVPTX::DrvInterface getDrvInterface() const
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Target - Wrapper for Target specific information.
NVPTXTargetMachine.
~NVPTXTargetMachine() override
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.
TargetOptions Options
void adjustPassManager(PassManagerBuilder &) override
Allow the target to modify the pass manager, e.g.
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:340
const NVPTXSubtarget * getSubtargetImpl() const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
#define OP(n)
Definition: regex2.h:73