brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 7cbc092 Raw
67 lines · c
1//===- Bitcode/Writer/DXILBitcodeWriter.cpp - DXIL Bitcode Writer ---------===//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-exception6//7//===----------------------------------------------------------------------===//8//9// Bitcode writer implementation.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_DXILWRITER_DXILBITCODEWRITER_H14#define LLVM_DXILWRITER_DXILBITCODEWRITER_H15 16#include "llvm/ADT/StringRef.h"17#include "llvm/IR/ModuleSummaryIndex.h"18#include "llvm/MC/StringTableBuilder.h"19#include "llvm/Support/Allocator.h"20#include "llvm/Support/MemoryBufferRef.h"21#include <memory>22#include <vector>23 24namespace llvm {25 26class BitstreamWriter;27class Module;28class raw_ostream;29 30namespace dxil {31 32class BitcodeWriter {33  SmallVectorImpl<char> &Buffer;34  std::unique_ptr<BitstreamWriter> Stream;35 36  StringTableBuilder StrtabBuilder{StringTableBuilder::RAW};37 38  // Owns any strings created by the irsymtab writer until we create the39  // string table.40  BumpPtrAllocator Alloc;41 42  void writeBlob(unsigned Block, unsigned Record, StringRef Blob);43 44  std::vector<Module *> Mods;45 46public:47  /// Create a BitcodeWriter that writes to Buffer.48  BitcodeWriter(SmallVectorImpl<char> &Buffer);49 50  ~BitcodeWriter();51 52  /// Write the specified module to the buffer specified at construction time.53  void writeModule(const Module &M);54};55 56/// Write the specified module to the specified raw output stream.57///58/// For streams where it matters, the given stream should be in "binary"59/// mode.60void WriteDXILToFile(const Module &M, raw_ostream &Out);61 62} // namespace dxil63 64} // namespace llvm65 66#endif // LLVM_DXILWRITER_DXILBITCODEWRITER_H67