149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===- NVPTXSection.h - NVPTX-specific section representation -*- C++ -*-===// 249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// The LLVM Compiler Infrastructure 449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// This file is distributed under the University of Illinois Open Source 649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// License. See LICENSE.TXT for details. 749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===----------------------------------------------------------------------===// 949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 1049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// This file declares the NVPTXSection class. 1149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 1249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===----------------------------------------------------------------------===// 1349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 1449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#ifndef LLVM_NVPTXSECTION_H 1549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#define LLVM_NVPTXSECTION_H 1649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 170b8c9a80f20772c3793201ab5b251d3520b9cea3Chandler Carruth#include "llvm/IR/GlobalVariable.h" 18a1514e24cc24b050f53a12650e047799358833a1Chandler Carruth#include "llvm/MC/MCSection.h" 1949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#include <vector> 2049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 2149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskinamespace llvm { 2249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski/// NVPTXSection - Represents a section in PTX 2349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski/// PTX does not have sections. We create this class in order to use 2449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski/// the ASMPrint interface. 2549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski/// 2649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskiclass NVPTXSection : public MCSection { 27354362524a72b3fa43a6c09380b7ae3b2380cbbaJuergen Ributzka virtual void anchor(); 2849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskipublic: 2949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K) {} 30354362524a72b3fa43a6c09380b7ae3b2380cbbaJuergen Ributzka virtual ~NVPTXSection() {} 3149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 3249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski /// Override this as NVPTX has its own way of printing switching 3349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski /// to a section. 34dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines void PrintSwitchToSection(const MCAsmInfo &MAI, 35dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines raw_ostream &OS, 36dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines const MCExpr *Subsection) const override {} 3749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 3849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski /// Base address of PTX sections is zero. 39dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines bool isBaseAddressKnownZero() const override { return true; } 40dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines bool UseCodeAlign() const override { return false; } 41dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines bool isVirtualSection() const override { return false; } 42dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines std::string getLabelBeginName() const override { return ""; } 43dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines std::string getLabelEndName() const override { return ""; } 4449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski}; 4549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 4649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski} // end namespace llvm 4749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 4849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#endif 49