1//===-- DXILWriterPass.h - Bitcode writing pass --------------*- 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/// \file
9///
10/// This file provides a bitcode writing pass.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_BITCODE_DXILWriterPass_H
15#define LLVM_BITCODE_DXILWriterPass_H
16
17#include "DirectX.h"
18#include "llvm/Bitcode/BitcodeWriter.h"
19#include "llvm/IR/Analysis.h"
20#include "llvm/IR/PassManager.h"
21#include "llvm/Support/CommandLine.h"
22
23namespace llvm {
24class Module;
25class raw_ostream;
26
27/// Create and return a pass that writes the module to the specified
28/// ostream.
29class DXILWriterPass : public RequiredPassInfoMixin<DXILWriterPass> {
30 raw_ostream &OS;
31
32public:
33 explicit DXILWriterPass(raw_ostream &OS = dbgs()) : OS(OS) {}
34 PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
35};
36
37ModulePass *createDXILWriterLegacyPass(raw_ostream &Str);
38
39/// Create and return a pass that writes the module to a global variable in the
40/// module for later emission in the MCStreamer.
41class DXILEmbedderPass : public RequiredPassInfoMixin<DXILEmbedderPass> {
42public:
43 PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
44};
45
46ModulePass *createDXILEmbedderLegacyPass();
47
48namespace dxil {
49extern cl::opt<bool> SourceInDebugModule;
50} // namespace dxil
51
52} // namespace llvm
53
54#endif
55