LLVM  10.0.0svn
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 
14 namespace llvm {
15 class MCSection;
16 
17 /// Implments NVPTX-specific streamer.
19 private:
20  SmallVector<std::string, 4> DwarfFiles;
21  bool HasSections = false;
22 
23 public:
25  ~NVPTXTargetStreamer() override;
26 
27  /// Outputs the list of the DWARF '.file' directives to the streamer.
29  /// Close last section.
30  void closeLastSection();
31 
32  /// Record DWARF file directives for later output.
33  /// According to PTX ISA, CUDA Toolkit documentation, 11.5.3. Debugging
34  /// Directives: .file
35  /// (http://docs.nvidia.com/cuda/parallel-thread-execution/index.html#debugging-directives-file),
36  /// The .file directive is allowed only in the outermost scope, i.e., at the
37  /// same level as kernel and device function declarations. Also, the order of
38  /// the .loc and .file directive does not matter, .file directives may follow
39  /// the .loc directives where the file is referenced.
40  /// LLVM emits .file directives immediately the location debug info is
41  /// emitted, i.e. they may be emitted inside functions. We gather all these
42  /// directives and emit them outside of the sections and, thus, outside of the
43  /// functions.
44  void emitDwarfFileDirective(StringRef Directive) override;
45  void changeSection(const MCSection *CurSection, MCSection *Section,
46  const MCExpr *SubSection, raw_ostream &OS) override;
47  /// Emit the bytes in \p Data into the output.
48  ///
49  /// This is used to emit bytes in \p Data as sequence of .byte directives.
50  void emitRawBytes(StringRef Data) override;
51 };
52 
53 } // end namespace llvm
54 
55 #endif
void closeLastSection()
Close last section.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Target specific streamer interface.
Definition: MCStreamer.h:91
void emitRawBytes(StringRef Data) override
Emit the bytes in Data into the output.
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
Streaming machine code generation interface.
Definition: MCStreamer.h:196
void changeSection(const MCSection *CurSection, MCSection *Section, const MCExpr *SubSection, raw_ostream &OS) override
Update streamer for a new active section.
void emitDwarfFileDirective(StringRef Directive) override
Record DWARF file directives for later output.
Implments NVPTX-specific streamer.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
void outputDwarfFileDirectives()
Outputs the list of the DWARF &#39;.file&#39; directives to the streamer.