Path: blob/main/contrib/llvm-project/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.h
35293 views
//===- Bitcode/Writer/DXILBitcodeWriter.cpp - DXIL Bitcode Writer ---------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Bitcode writer implementation.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_DXILWRITER_DXILBITCODEWRITER_H13#define LLVM_DXILWRITER_DXILBITCODEWRITER_H1415#include "llvm/ADT/StringRef.h"16#include "llvm/IR/ModuleSummaryIndex.h"17#include "llvm/MC/StringTableBuilder.h"18#include "llvm/Support/Allocator.h"19#include "llvm/Support/MemoryBufferRef.h"20#include <map>21#include <memory>22#include <string>23#include <vector>2425namespace llvm {2627class BitstreamWriter;28class Module;29class raw_ostream;3031namespace dxil {3233class BitcodeWriter {34SmallVectorImpl<char> &Buffer;35std::unique_ptr<BitstreamWriter> Stream;3637StringTableBuilder StrtabBuilder{StringTableBuilder::RAW};3839// Owns any strings created by the irsymtab writer until we create the40// string table.41BumpPtrAllocator Alloc;4243void writeBlob(unsigned Block, unsigned Record, StringRef Blob);4445std::vector<Module *> Mods;4647public:48/// Create a BitcodeWriter that writes to Buffer.49BitcodeWriter(SmallVectorImpl<char> &Buffer);5051~BitcodeWriter();5253/// Write the specified module to the buffer specified at construction time.54void writeModule(const Module &M);55};5657/// Write the specified module to the specified raw output stream.58///59/// For streams where it matters, the given stream should be in "binary"60/// mode.61void WriteDXILToFile(const Module &M, raw_ostream &Out);6263} // namespace dxil6465} // namespace llvm6667#endif // LLVM_DXILWRITER_DXILBITCODEWRITER_H686970