LLVM 23.0.0git
NVPTXTargetStreamer.h
Go to the documentation of this file.
1//=====-- NVPTXTargetStreamer.h - NVPTX Target Streamer ------*- C++ -*--=====//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_NVPTX_MCTARGETDESC_NVPTXTARGETSTREAMER_H
10#define LLVM_LIB_TARGET_NVPTX_MCTARGETDESC_NVPTXTARGETSTREAMER_H
11
12#include "llvm/MC/MCStreamer.h"
13
14namespace llvm {
15class MCSection;
17
18/// Implments NVPTX-specific streamer.
20private:
22 bool HasSections = false;
23
24public:
27
28 /// Emit the banner which specifies details of PTX generator.
29 virtual void emitBanner() {}
30
31 /// Emit the PTX ISA version number.
32 virtual void emitVersionDirective(unsigned PTXVersion) {}
33
34 /// Emit architecture and platform target.
35 virtual void emitTargetDirective(StringRef Target, bool TexModeIndependent,
36 bool HasDebug) {}
37
38 /// Emit address size used for this PTX module.
39 virtual void emitAddressSizeDirective(unsigned AddrSize) {}
40
41 /// Outputs the list of the DWARF '.file' directives to the streamer.
43 /// Close last section.
44 void closeLastSection();
45
46 /// Record DWARF file directives for later output.
47 /// According to PTX ISA, CUDA Toolkit documentation, 11.5.3. Debugging
48 /// Directives: .file
49 /// (http://docs.nvidia.com/cuda/parallel-thread-execution/index.html#debugging-directives-file),
50 /// The .file directive is allowed only in the outermost scope, i.e., at the
51 /// same level as kernel and device function declarations. Also, the order of
52 /// the .loc and .file directive does not matter, .file directives may follow
53 /// the .loc directives where the file is referenced.
54 /// LLVM emits .file directives immediately the location debug info is
55 /// emitted, i.e. they may be emitted inside functions. We gather all these
56 /// directives and emit them outside of the sections and, thus, outside of the
57 /// functions.
59 void changeSection(const MCSection *CurSection, MCSection *Section,
60 uint32_t SubSection, raw_ostream &OS) override;
61 /// Emit the bytes in \p Data into the output.
62 ///
63 /// This is used to emit bytes in \p Data as sequence of .byte directives.
64 void emitRawBytes(StringRef Data) override;
65 /// Makes sure that labels are mangled the same way as the actual symbols.
66 void emitValue(const MCExpr *Value) override;
67};
68
71
72public:
75
76 void emitBanner() override;
77
78 void emitVersionDirective(unsigned PTXVersion) override;
79
80 void emitTargetDirective(StringRef Target, bool TexModeIndependent,
81 bool HasDebug) override;
82
83 void emitAddressSizeDirective(unsigned AddrSize) override;
84};
85
86} // end namespace llvm
87
88#endif
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:569
Streaming machine code generation interface.
Definition MCStreamer.h:222
MCTargetStreamer(MCStreamer &S)
void emitBanner() override
Emit the banner which specifies details of PTX generator.
void emitVersionDirective(unsigned PTXVersion) override
Emit the PTX ISA version number.
void emitTargetDirective(StringRef Target, bool TexModeIndependent, bool HasDebug) override
Emit architecture and platform target.
void emitAddressSizeDirective(unsigned AddrSize) override
Emit address size used for this PTX module.
NVPTXAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS)
void emitDwarfFileDirective(StringRef Directive) override
Record DWARF file directives for later output.
virtual void emitTargetDirective(StringRef Target, bool TexModeIndependent, bool HasDebug)
Emit architecture and platform target.
virtual void emitVersionDirective(unsigned PTXVersion)
Emit the PTX ISA version number.
virtual void emitBanner()
Emit the banner which specifies details of PTX generator.
virtual void emitAddressSizeDirective(unsigned AddrSize)
Emit address size used for this PTX module.
void outputDwarfFileDirectives()
Outputs the list of the DWARF '.file' directives to the streamer.
void emitRawBytes(StringRef Data) override
Emit the bytes in Data into the output.
void changeSection(const MCSection *CurSection, MCSection *Section, uint32_t SubSection, raw_ostream &OS) override
Update streamer for a new active section.
void emitValue(const MCExpr *Value) override
Makes sure that labels are mangled the same way as the actual symbols.
void closeLastSection()
Close last section.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition Value.h:75
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Definition InstrProf.h:221