|
|
|||
File indexing completed on 2026-05-10 08:43:22
0001 //===-- BitcodeWriterPass.h - Bitcode writing pass --------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 /// \file 0009 /// 0010 /// This file provides a bitcode writing pass. 0011 /// 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef LLVM_BITCODE_BITCODEWRITERPASS_H 0015 #define LLVM_BITCODE_BITCODEWRITERPASS_H 0016 0017 #include "llvm/IR/PassManager.h" 0018 0019 namespace llvm { 0020 class Module; 0021 class ModulePass; 0022 class Pass; 0023 class raw_ostream; 0024 0025 /// Create and return a pass that writes the module to the specified 0026 /// ostream. Note that this pass is designed for use with the legacy pass 0027 /// manager. 0028 /// 0029 /// If \c ShouldPreserveUseListOrder, encode use-list order so it can be 0030 /// reproduced when deserialized. 0031 ModulePass *createBitcodeWriterPass(raw_ostream &Str, 0032 bool ShouldPreserveUseListOrder = false); 0033 0034 /// Check whether a pass is a BitcodeWriterPass. 0035 bool isBitcodeWriterPass(Pass *P); 0036 0037 /// Pass for writing a module of IR out to a bitcode file. 0038 /// 0039 /// Note that this is intended for use with the new pass manager. To construct 0040 /// a pass for the legacy pass manager, use the function above. 0041 class BitcodeWriterPass : public PassInfoMixin<BitcodeWriterPass> { 0042 raw_ostream &OS; 0043 bool ShouldPreserveUseListOrder; 0044 bool EmitSummaryIndex; 0045 bool EmitModuleHash; 0046 0047 public: 0048 /// Construct a bitcode writer pass around a particular output stream. 0049 /// 0050 /// If \c ShouldPreserveUseListOrder, encode use-list order so it can be 0051 /// reproduced when deserialized. 0052 /// 0053 /// If \c EmitSummaryIndex, emit the summary index (currently 0054 /// for use in ThinLTO optimization). 0055 explicit BitcodeWriterPass(raw_ostream &OS, 0056 bool ShouldPreserveUseListOrder = false, 0057 bool EmitSummaryIndex = false, 0058 bool EmitModuleHash = false) 0059 : OS(OS), ShouldPreserveUseListOrder(ShouldPreserveUseListOrder), 0060 EmitSummaryIndex(EmitSummaryIndex), EmitModuleHash(EmitModuleHash) {} 0061 0062 /// Run the bitcode writer pass, and output the module to the selected 0063 /// output stream. 0064 PreservedAnalyses run(Module &M, ModuleAnalysisManager &); 0065 0066 static bool isRequired() { return true; } 0067 }; 0068 0069 } 0070 0071 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|