Path: blob/main/contrib/llvm-project/llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
35271 views
//===-- NVPTXTargetMachine.h - Define TargetMachine for NVPTX ---*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file declares the NVPTX specific subclass of TargetMachine.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H13#define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H1415#include "NVPTXSubtarget.h"16#include "llvm/Target/TargetMachine.h"17#include <optional>18#include <utility>1920namespace llvm {2122/// NVPTXTargetMachine23///24class NVPTXTargetMachine : public LLVMTargetMachine {25bool is64bit;26std::unique_ptr<TargetLoweringObjectFile> TLOF;27NVPTX::DrvInterface drvInterface;28NVPTXSubtarget Subtarget;2930// Hold Strings that can be free'd all together with NVPTXTargetMachine31BumpPtrAllocator StrAlloc;32UniqueStringSaver StrPool;3334public:35NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,36StringRef FS, const TargetOptions &Options,37std::optional<Reloc::Model> RM,38std::optional<CodeModel::Model> CM, CodeGenOptLevel OP,39bool is64bit);40~NVPTXTargetMachine() override;41const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {42return &Subtarget;43}44const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget; }45bool is64Bit() const { return is64bit; }46NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }47UniqueStringSaver &getStrPool() const {48return const_cast<UniqueStringSaver &>(StrPool);49}5051TargetPassConfig *createPassConfig(PassManagerBase &PM) override;5253// Emission of machine code through MCJIT is not supported.54bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_pwrite_stream &,55bool = true) override {56return true;57}58TargetLoweringObjectFile *getObjFileLowering() const override {59return TLOF.get();60}6162MachineFunctionInfo *63createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,64const TargetSubtargetInfo *STI) const override;6566void registerDefaultAliasAnalyses(AAManager &AAM) override;6768void registerPassBuilderCallbacks(PassBuilder &PB) override;6970TargetTransformInfo getTargetTransformInfo(const Function &F) const override;7172bool isMachineVerifierClean() const override {73return false;74}7576std::pair<const Value *, unsigned>77getPredicatedAddrSpace(const Value *V) const override;78}; // NVPTXTargetMachine.7980class NVPTXTargetMachine32 : public NVPTXTargetMachine {81virtual void anchor();8283public:84NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,85StringRef FS, const TargetOptions &Options,86std::optional<Reloc::Model> RM,87std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,88bool JIT);89};9091class NVPTXTargetMachine64 : public NVPTXTargetMachine {92virtual void anchor();9394public:95NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,96StringRef FS, const TargetOptions &Options,97std::optional<Reloc::Model> RM,98std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,99bool JIT);100};101102} // end namespace llvm103104#endif105106107