LLVM  13.0.0git
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"
19 
20 namespace llvm {
21 
22 /// NVPTXTargetMachine
23 ///
25  bool is64bit;
26  // Use 32-bit pointers for accessing const/local/short AS.
27  bool UseShortPointers;
28  std::unique_ptr<TargetLoweringObjectFile> TLOF;
29  NVPTX::DrvInterface drvInterface;
30  NVPTXSubtarget Subtarget;
31 
32  // Hold Strings that can be free'd all together with NVPTXTargetMachine
33  ManagedStringPool ManagedStrPool;
34 
35 public:
36  NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
39  CodeGenOpt::Level OP, bool is64bit);
40 
41  ~NVPTXTargetMachine() override;
42  const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {
43  return &Subtarget;
44  }
45  const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget; }
46  bool is64Bit() const { return is64bit; }
47  bool useShortPointers() const { return UseShortPointers; }
48  NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
50  return const_cast<ManagedStringPool *>(&ManagedStrPool);
51  }
52 
54 
55  // Emission of machine code through MCJIT is not supported.
57  bool = true) override {
58  return true;
59  }
61  return TLOF.get();
62  }
63 
64  void adjustPassManager(PassManagerBuilder &) override;
66  bool DebugPassManager) 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,
81  CodeGenOpt::Level OL, bool JIT);
82 };
83 
85  virtual void anchor();
86 public:
87  NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
90  CodeGenOpt::Level OL, bool JIT);
91 };
92 
93 } // end namespace llvm
94 
95 #endif
llvm
Definition: AllocatorList.h:23
llvm::NVPTXTargetMachine::isMachineVerifierClean
bool isMachineVerifierClean() const override
Returns true if the target is expected to pass all machine verifier checks.
Definition: NVPTXTargetMachine.h:70
llvm::NVPTXTargetMachine::~NVPTXTargetMachine
~NVPTXTargetMachine() override
llvm::TargetOptions
Definition: TargetOptions.h:119
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:71
llvm::Function
Definition: Function.h:61
llvm::NVPTXTargetMachine::is64Bit
bool is64Bit() const
Definition: NVPTXTargetMachine.h:46
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:124
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:167
llvm::NVPTXTargetMachine::getTargetTransformInfo
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
Definition: NVPTXTargetMachine.cpp:241
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::NVPTXTargetMachine32::NVPTXTargetMachine32
NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Definition: NVPTXTargetMachine.cpp:138
ManagedStringPool.h
llvm::TargetMachine::RM
Reloc::Model RM
Definition: TargetMachine.h:100
llvm::Optional< Reloc::Model >
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::X86AS::FS
@ FS
Definition: X86.h:183
llvm::NVPTXTargetMachine
NVPTXTargetMachine.
Definition: NVPTXTargetMachine.h:24
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::TargetLoweringObjectFile
Definition: TargetLoweringObjectFile.h:43
TargetMachine.h
llvm::PassBuilder
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:139
llvm::NVPTX::DrvInterface
DrvInterface
Definition: NVPTX.h:70
llvm::NVPTXTargetMachine::getManagedStrPool
ManagedStringPool * getManagedStrPool() const
Definition: NVPTXTargetMachine.h:49
llvm::NVPTXTargetMachine::createPassConfig
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Definition: NVPTXTargetMachine.cpp:199
llvm::NVPTXTargetMachine::useShortPointers
bool useShortPointers() const
Definition: NVPTXTargetMachine.h:47
llvm::PassManagerBuilder
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like...
Definition: PassManagerBuilder.h:59
llvm::NVPTXSubtarget
Definition: NVPTXSubtarget.h:31
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
llvm::NVPTXTargetMachine32
Definition: NVPTXTargetMachine.h:75
llvm::NVPTXTargetMachine::NVPTXTargetMachine
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)
Definition: NVPTXTargetMachine.cpp:111
llvm::NVPTXTargetMachine::getSubtargetImpl
const NVPTXSubtarget * getSubtargetImpl() const
Definition: NVPTXTargetMachine.h:45
llvm::raw_pwrite_stream
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:406
llvm::EngineKind::JIT
@ JIT
Definition: ExecutionEngine.h:525
llvm::NVPTXTargetMachine::registerPassBuilderCallbacks
void registerPassBuilderCallbacks(PassBuilder &PB, bool DebugPassManager) override
Allow the target to modify the pass pipeline with New Pass Manager (similar to adjustPassManager for ...
Definition: NVPTXTargetMachine.cpp:212
llvm::NVPTXTargetMachine::addPassesToEmitMC
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.
Definition: NVPTXTargetMachine.h:56
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:115
OP
#define OP(n)
Definition: regex2.h:73
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::ManagedStringPool
ManagedStringPool - The strings allocated from a managed string pool are owned by the string pool and...
Definition: ManagedStringPool.h:25
llvm::NVPTXTargetMachine64::NVPTXTargetMachine64
NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Definition: NVPTXTargetMachine.cpp:148
llvm::NVPTXTargetMachine::getSubtargetImpl
const NVPTXSubtarget * getSubtargetImpl(const Function &) const override
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
Definition: NVPTXTargetMachine.h:42
llvm::NVPTXTargetMachine64
Definition: NVPTXTargetMachine.h:84
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:386
NVPTXSubtarget.h
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39
llvm::NVPTXTargetMachine::getDrvInterface
NVPTX::DrvInterface getDrvInterface() const
Definition: NVPTXTargetMachine.h:48
llvm::NVPTXTargetMachine::adjustPassManager
void adjustPassManager(PassManagerBuilder &) override
Allow the target to modify the pass manager, e.g.
Definition: NVPTXTargetMachine.cpp:203
llvm::NVPTXTargetMachine::getObjFileLowering
TargetLoweringObjectFile * getObjFileLowering() const override
Definition: NVPTXTargetMachine.h:60