Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXSECTION_H |
| 15 | #define LLVM_LIB_TARGET_NVPTX_NVPTXSECTION_H |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 16 | |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 17 | #include "llvm/IR/GlobalVariable.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCSection.h" |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 19 | #include <vector> |
| 20 | |
| 21 | namespace llvm { |
| 22 | /// NVPTXSection - Represents a section in PTX |
| 23 | /// PTX does not have sections. We create this class in order to use |
| 24 | /// the ASMPrint interface. |
| 25 | /// |
| 26 | class NVPTXSection : public MCSection { |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 27 | virtual void anchor(); |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 28 | public: |
Rafael Espindola | 8ca44f0 | 2015-04-04 18:02:01 +0000 | [diff] [blame^] | 29 | NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K, nullptr) {} |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 30 | virtual ~NVPTXSection() {} |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 31 | |
| 32 | /// Override this as NVPTX has its own way of printing switching |
| 33 | /// to a section. |
Craig Topper | 2865c98 | 2014-04-29 07:57:44 +0000 | [diff] [blame] | 34 | void PrintSwitchToSection(const MCAsmInfo &MAI, |
| 35 | raw_ostream &OS, |
| 36 | const MCExpr *Subsection) const override {} |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 37 | |
| 38 | /// Base address of PTX sections is zero. |
Craig Topper | 2865c98 | 2014-04-29 07:57:44 +0000 | [diff] [blame] | 39 | bool UseCodeAlign() const override { return false; } |
| 40 | bool isVirtualSection() const override { return false; } |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | } // end namespace llvm |
| 44 | |
| 45 | #endif |