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
14#include "DirectXMCOptions.h"
16
17using namespace llvm;
18
19namespace {
20class DirectXContainerObjectWriter : public MCDXContainerTargetWriter {
21 const DirectXMCOptions &CLOpts;
22
23public:
24 DirectXContainerObjectWriter(const DirectXMCOptions &CLOpts)
25 : MCDXContainerTargetWriter(), CLOpts(CLOpts) {}
26
27 // The ILDB part, present when the module has debug info, is embedded unless
28 // it is stripped or written to a PDB. -dx-embed-debug overrides the latter
29 // two, and slim debug omits ILDB from every output.
30 bool shouldSkipSection(StringRef SectionName) const override {
31 return SectionName == "ILDB" &&
32 (CLOpts.slim_debug ||
33 (!CLOpts.embed_debug &&
34 (CLOpts.strip_debug || !CLOpts.pdb_path.empty())));
35 }
36};
37} // namespace
38
39std::unique_ptr<MCObjectTargetWriter>
40llvm::createDXContainerTargetObjectWriter(const DirectXMCOptions &CLOpts) {
41 return std::make_unique<DirectXContainerObjectWriter>(CLOpts);
42}
const char SectionName[]
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectTargetWriter > createDXContainerTargetObjectWriter(const DirectXMCOptions &CLOpts)