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