LLVM  14.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 #include <utility>
20 
21 namespace llvm {
22 
23 /// NVPTXTargetMachine
24 ///
26  bool is64bit;
27  // Use 32-bit pointers for accessing const/local/short AS.
28  bool UseShortPointers;
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,
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  bool useShortPointers() const { return UseShortPointers; }
49  NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
51  return const_cast<ManagedStringPool *>(&ManagedStrPool);
52  }
53 
55 
56  // Emission of machine code through MCJIT is not supported.
58  bool = true) override {
59  return true;
60  }
62  return TLOF.get();
63  }
64 
65  void adjustPassManager(PassManagerBuilder &) override;
67 
69 
70  bool isMachineVerifierClean() const override {
71  return false;
72  }
73 
74  std::pair<const Value *, unsigned>
75  getPredicatedAddrSpace(const Value *V) const override;
76 }; // NVPTXTargetMachine.
77 
79  virtual void anchor();
80 public:
81  NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,
84  CodeGenOpt::Level OL, bool JIT);
85 };
86 
88  virtual void anchor();
89 public:
90  NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
93  CodeGenOpt::Level OL, bool JIT);
94 };
95 
96 } // end namespace llvm
97 
98 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
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:124
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::Function
Definition: Function.h:62
llvm::NVPTXTargetMachine::is64Bit
bool is64Bit() const
Definition: NVPTXTargetMachine.h:47
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:137
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:169
llvm::NVPTXTargetMachine::getTargetTransformInfo
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
Definition: NVPTXTargetMachine.cpp:240
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:139
llvm::X86AS::FS
@ FS
Definition: X86.h:188
ManagedStringPool.h
llvm::TargetMachine::RM
Reloc::Model RM
Definition: TargetMachine.h:103
llvm::Optional< Reloc::Model >
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::NVPTXTargetMachine
NVPTXTargetMachine.
Definition: NVPTXTargetMachine.h:25
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::TargetLoweringObjectFile
Definition: TargetLoweringObjectFile.h:44
TargetMachine.h
llvm::PassBuilder
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:94
llvm::NVPTX::DrvInterface
DrvInterface
Definition: NVPTX.h:70
llvm::NVPTXTargetMachine::registerPassBuilderCallbacks
void registerPassBuilderCallbacks(PassBuilder &PB) override
Allow the target to modify the pass pipeline with New Pass Manager (similar to adjustPassManager for ...
Definition: NVPTXTargetMachine.cpp:213
llvm::NVPTXTargetMachine::getManagedStrPool
ManagedStringPool * getManagedStrPool() const
Definition: NVPTXTargetMachine.h:50
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:200
llvm::NVPTXTargetMachine::useShortPointers
bool useShortPointers() const
Definition: NVPTXTargetMachine.h:48
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
PB
PassBuilder PB(Machine, PassOpts->PTO, None, &PIC)
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
llvm::NVPTXTargetMachine32
Definition: NVPTXTargetMachine.h:78
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:112
llvm::NVPTXTargetMachine::getSubtargetImpl
const NVPTXSubtarget * getSubtargetImpl() const
Definition: NVPTXTargetMachine.h:46
llvm::raw_pwrite_stream
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:417
llvm::EngineKind::JIT
@ JIT
Definition: ExecutionEngine.h:524
llvm::NVPTXTargetMachine::getPredicatedAddrSpace
std::pair< const Value *, unsigned > getPredicatedAddrSpace(const Value *V) const override
If the specified predicate checks whether a generic pointer falls within a specified address space,...
Definition: NVPTXTargetMachine.cpp:245
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:57
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:121
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:149
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:43
llvm::NVPTXTargetMachine64
Definition: NVPTXTargetMachine.h:87
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:406
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:49
llvm::NVPTXTargetMachine::adjustPassManager
void adjustPassManager(PassManagerBuilder &) override
Allow the target to modify the pass manager, e.g.
Definition: NVPTXTargetMachine.cpp:204
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::NVPTXTargetMachine::getObjFileLowering
TargetLoweringObjectFile * getObjFileLowering() const override
Definition: NVPTXTargetMachine.h:61