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