blob: 45a7309479ee2aa887703f69930e62d8690f35cc [file] [log] [blame]
Justin Holewinskiae556d32012-05-04 20:18:50 +00001//===- 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 Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXSECTION_H
15#define LLVM_LIB_TARGET_NVPTX_NVPTXSECTION_H
Justin Holewinskiae556d32012-05-04 20:18:50 +000016
Chandler Carruth9fb823b2013-01-02 11:36:10 +000017#include "llvm/IR/GlobalVariable.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000018#include "llvm/MC/MCSection.h"
Justin Holewinskiae556d32012-05-04 20:18:50 +000019#include <vector>
20
21namespace llvm {
Rafael Espindola665b0d32015-10-07 13:38:49 +000022/// Represents a section in PTX PTX does not have sections. We create this class
23/// in order to use the ASMPrint interface.
Justin Holewinskiae556d32012-05-04 20:18:50 +000024///
Rafael Espindola30d77772015-10-07 13:46:06 +000025class NVPTXSection final : public MCSection {
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000026 virtual void anchor();
Justin Holewinskiae556d32012-05-04 20:18:50 +000027public:
Rafael Espindola8ca44f02015-04-04 18:02:01 +000028 NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K, nullptr) {}
Rafael Espindola30d77772015-10-07 13:46:06 +000029 ~NVPTXSection() {}
Justin Holewinskiae556d32012-05-04 20:18:50 +000030
31 /// Override this as NVPTX has its own way of printing switching
32 /// to a section.
Craig Topper2865c982014-04-29 07:57:44 +000033 void PrintSwitchToSection(const MCAsmInfo &MAI,
34 raw_ostream &OS,
35 const MCExpr *Subsection) const override {}
Justin Holewinskiae556d32012-05-04 20:18:50 +000036
37 /// Base address of PTX sections is zero.
Craig Topper2865c982014-04-29 07:57:44 +000038 bool UseCodeAlign() const override { return false; }
39 bool isVirtualSection() const override { return false; }
Justin Holewinskiae556d32012-05-04 20:18:50 +000040};
41
42} // end namespace llvm
43
44#endif