1 //===- NVPTXSection.h - NVPTX-specific section representation -*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file declares the NVPTXSection class. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXSECTION_H 15 #define LLVM_LIB_TARGET_NVPTX_NVPTXSECTION_H 16 17 #include "llvm/IR/GlobalVariable.h" 18 #include "llvm/MC/MCSection.h" 19 20 namespace llvm { 21 /// Represents a section in PTX PTX does not have sections. We create this class 22 /// in order to use the ASMPrint interface. 23 /// 24 class NVPTXSection final : public MCSection { 25 virtual void anchor(); 26 public: NVPTXSection(SectionVariant V,SectionKind K)27 NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K, nullptr) {} ~NVPTXSection()28 ~NVPTXSection() {} 29 30 /// Override this as NVPTX has its own way of printing switching 31 /// to a section. PrintSwitchToSection(const MCAsmInfo & MAI,raw_ostream & OS,const MCExpr * Subsection)32 void PrintSwitchToSection(const MCAsmInfo &MAI, 33 raw_ostream &OS, 34 const MCExpr *Subsection) const override {} 35 36 /// Base address of PTX sections is zero. UseCodeAlign()37 bool UseCodeAlign() const override { return false; } isVirtualSection()38 bool isVirtualSection() const override { return false; } 39 }; 40 41 } // end namespace llvm 42 43 #endif 44