LLVM 24.0.0git
DirectXContainerObjectWriter.cpp
Go to the documentation of this file.
1//===-- DirectXContainerObjectWriter.cpp - DX object 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// This file contains DXContainer object writers for the DirectX backend.
10//
11//===----------------------------------------------------------------------===//
12
15
16using namespace llvm;
17
18cl::opt<bool> dxil::EmbedDebug("dx-embed-debug",
19 cl::desc("Embed PDB in shader container"));
20cl::opt<bool> dxil::SlimDebug("dx-slim-debug",
21 cl::desc("Generate slim PDB without ILDB part"));
23 "dx-pdb-path",
24 cl::desc("Write debug information to the given file, or automatically "
25 "named file in directory when ending in '/'"),
26 cl::value_desc("filename"));
27
28static cl::opt<bool>
29 StripDebug("dx-strip-debug",
30 cl::desc("Strip debug information from shader bytecode"));
31
32namespace {
33class DirectXContainerObjectWriter : public MCDXContainerTargetWriter {
34public:
35 DirectXContainerObjectWriter() : MCDXContainerTargetWriter() {}
36
37 // The ILDB part, present when the module has debug info, is embedded unless
38 // it is stripped or written to a PDB. -dx-embed-debug overrides the latter
39 // two, and slim debug omits ILDB from every output.
40 bool shouldSkipSection(StringRef SectionName) const override {
41 return SectionName == "ILDB" &&
44 }
45};
46} // namespace
47
48std::unique_ptr<MCObjectTargetWriter>
50 return std::make_unique<DirectXContainerObjectWriter>();
51}
static cl::opt< bool > StripDebug("dx-strip-debug", cl::desc("Strip debug information from shader bytecode"))
const char SectionName[]
cl::opt< bool > EmbedDebug
cl::opt< std::string > PdbDebugPath
cl::opt< bool > SlimDebug
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectTargetWriter > createDXContainerTargetObjectWriter()