LLVM 19.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 "NVPTXSubtarget.h"
18#include <optional>
19#include <utility>
20
21namespace 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 BumpPtrAllocator StrAlloc;
35 UniqueStringSaver StrPool;
36
37public:
38 NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
40 std::optional<Reloc::Model> RM,
41 std::optional<CodeModel::Model> CM, CodeGenOptLevel OP,
42 bool is64bit);
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<UniqueStringSaver &>(StrPool);
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
68 const TargetSubtargetInfo *STI) const override;
69
70 void registerDefaultAliasAnalyses(AAManager &AAM) override;
71
73 bool PopulateClassToPassNames) override;
74
76
77 bool isMachineVerifierClean() const override {
78 return false;
79 }
80
81 std::pair<const Value *, unsigned>
82 getPredicatedAddrSpace(const Value *V) const override;
83}; // NVPTXTargetMachine.
84
86 virtual void anchor();
87
88public:
89 NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,
91 std::optional<Reloc::Model> RM,
92 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
93 bool JIT);
94};
95
97 virtual void anchor();
98
99public:
100 NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
102 std::optional<Reloc::Model> RM,
103 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
104 bool JIT);
105};
106
107} // end namespace llvm
108
109#endif
#define F(x, y, z)
Definition: MD5.cpp:55
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
Basic Register Allocator
A manager for alias analyses.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Context object for machine code objects.
Definition: MCContext.h:76
TargetLoweringObjectFile * getObjFileLowering() const override
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
void registerDefaultAliasAnalyses(AAManager &AAM) override
Allow the target to register alias analyses with the AAManager for use with the new pass manager.
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,...
const NVPTXSubtarget * getSubtargetImpl() const
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.
~NVPTXTargetMachine() override
NVPTX::DrvInterface getDrvInterface() const
void registerPassBuilderCallbacks(PassBuilder &PB, bool PopulateClassToPassNames) override
Allow the target to modify the pass pipeline.
bool isMachineVerifierClean() const override
Returns true if the target is expected to pass all machine verifier checks.
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
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...
UniqueStringSaver & getStrPool() const
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:104
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
std::unique_ptr< const MCSubtargetInfo > STI
TargetOptions Options
Target-Independent Code Generator Pass Configuration Options.
TargetSubtargetInfo - Generic base class for all target subtargets.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Definition: StringSaver.h:44
LLVM Value Representation.
Definition: Value.h:74
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:444
DrvInterface
Definition: NVPTX.h:78
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54
#define OP(n)
Definition: regex2.h:73
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...