LLVM 23.0.0git
MCDXContainerWriter.h
Go to the documentation of this file.
1//===- llvm/MC/MCDXContainerWriter.h - DXContainer Writer -*- 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_MC_MCDXCONTAINERWRITER_H
10#define LLVM_MC_MCDXCONTAINERWRITER_H
11
13#include "llvm/MC/MCValue.h"
16
17namespace llvm {
18
20
22protected:
24
25public:
27
30 }
31 static bool classof(const MCObjectTargetWriter *W) {
32 return W->getFormat() == Triple::DXContainer;
33 }
34};
35
36/// Contains PDB output file name.
37static constexpr StringLiteral PdbFileNameSectionName = "PDBNAME";
38/// Contains module hash.
39static constexpr StringLiteral ModuleHashSectionName = "PDBHASH";
40
45
47protected:
49 llvm_unreachable("Unimplemented");
50 }
51
52 virtual bool shouldSkipSection(StringRef SectionName, size_t SectionSize) {
53 // Skip empty and auxiliary sections.
54 return SectionSize == 0 || SectionName == PdbFileNameSectionName ||
56 }
57
58public:
61
62 void write(raw_ostream &OS, const Triple &TT);
63};
64
66 public MCObjectWriter {
68 std::unique_ptr<MCDXContainerTargetWriter> TargetObjectWriter;
70 SmallVector<SmallString<0>> SectionBuffers;
71
72 void clearParts();
73
74protected:
76
77public:
78 DXContainerObjectWriter(std::unique_ptr<MCDXContainerTargetWriter> MOTW,
80 : W(OS, llvm::endianness::little), TargetObjectWriter(std::move(MOTW)) {}
81
82 uint64_t writeObject() override;
83};
84
85} // end namespace llvm
86
87#endif // LLVM_MC_MCDXCONTAINERWRITER_H
#define LLVM_ABI
Definition Compiler.h:215
static void write(bool isBE, void *P, T V)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
DXContainerObjectWriter(std::unique_ptr< MCDXContainerTargetWriter > MOTW, raw_pwrite_stream &OS)
ArrayRef< MCDXContainerPart > collectParts() override
virtual ArrayRef< MCDXContainerPart > collectParts()
virtual bool shouldSkipSection(StringRef SectionName, size_t SectionSize)
Triple::ObjectFormatType getFormat() const override
static bool classof(const MCObjectTargetWriter *W)
Base class for classes that define behaviour that is specific to both the target and the object forma...
MCObjectWriter()=default
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition StringRef.h:882
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
An abstract base class for streams implementations that also support a pwrite operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
static constexpr StringLiteral ModuleHashSectionName
Contains module hash.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1916
endianness
Definition bit.h:71
static constexpr StringLiteral PdbFileNameSectionName
Contains PDB output file name.
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:860
Adapter to write values to a stream in a particular byte order.