brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 36db760 Raw
64 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIB_TARGET_NVPTX_MCTARGETDESC_NVPTXTARGETSTREAMER_H10#define LLVM_LIB_TARGET_NVPTX_MCTARGETDESC_NVPTXTARGETSTREAMER_H11 12#include "llvm/MC/MCStreamer.h"13 14namespace llvm {15class MCSection;16 17/// Implments NVPTX-specific streamer.18class NVPTXTargetStreamer : public MCTargetStreamer {19private:20  SmallVector<std::string, 4> DwarfFiles;21  bool HasSections = false;22 23public:24  NVPTXTargetStreamer(MCStreamer &S);25  ~NVPTXTargetStreamer() override;26 27  /// Outputs the list of the DWARF '.file' directives to the streamer.28  void outputDwarfFileDirectives();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. Debugging34  /// Directives: .file35  /// (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 the37  /// same level as kernel and device function declarations. Also, the order of38  /// the .loc and .file directive does not matter, .file directives may follow39  /// the .loc directives where the file is referenced.40  /// LLVM emits .file directives immediately the location debug info is41  /// emitted, i.e. they may be emitted inside functions. We gather all these42  /// directives and emit them outside of the sections and, thus, outside of the43  /// functions.44  void emitDwarfFileDirective(StringRef Directive) override;45  void changeSection(const MCSection *CurSection, MCSection *Section,46                     uint32_t 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  /// Makes sure that labels are mangled the same way as the actual symbols.52  void emitValue(const MCExpr *Value) override;53};54 55class NVPTXAsmTargetStreamer : public NVPTXTargetStreamer {56public:57  NVPTXAsmTargetStreamer(MCStreamer &S);58  ~NVPTXAsmTargetStreamer() override;59};60 61} // end namespace llvm62 63#endif64