LLVM 24.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
54public:
57
58 void write(raw_ostream &OS, const Triple &TT);
59};
60
62 public MCObjectWriter {
64 std::unique_ptr<MCDXContainerTargetWriter> TargetObjectWriter;
66 SmallVector<SmallString<0>> SectionBuffers;
67
68 void clearParts();
69
70protected:
72 bool shouldSkipSection(StringRef SectionName, size_t SectionSize) override;
73
74public:
75 DXContainerObjectWriter(std::unique_ptr<MCDXContainerTargetWriter> MOTW,
77 : W(OS, llvm::endianness::little), TargetObjectWriter(std::move(MOTW)) {}
78
79 uint64_t writeObject() override;
80};
81
82} // end namespace llvm
83
84#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)
bool shouldSkipSection(StringRef SectionName, size_t SectionSize) override
ArrayRef< MCDXContainerPart > collectParts() override
virtual ArrayRef< MCDXContainerPart > collectParts()
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:888
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:48
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:1917
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:878
Adapter to write values to a stream in a particular byte order.