LLVM  14.0.0git
BitcodeWriterPass.h
Go to the documentation of this file.
1 //===-- BitcodeWriterPass.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_BITCODEWRITERPASS_H
15 #define LLVM_BITCODE_BITCODEWRITERPASS_H
16 
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/IR/PassManager.h"
19 
20 namespace llvm {
21 class Module;
22 class ModulePass;
23 class Pass;
24 class raw_ostream;
25 
26 /// Create and return a pass that writes the module to the specified
27 /// ostream. Note that this pass is designed for use with the legacy pass
28 /// manager.
29 ///
30 /// If \c ShouldPreserveUseListOrder, encode use-list order so it can be
31 /// reproduced when deserialized.
32 ///
33 /// If \c EmitSummaryIndex, emit the summary index (currently for use in ThinLTO
34 /// optimization).
35 ///
36 /// If \c EmitModuleHash, compute and emit the module hash in the bitcode
37 /// (currently for use in ThinLTO incremental build).
38 ModulePass *createBitcodeWriterPass(raw_ostream &Str,
39  bool ShouldPreserveUseListOrder = false,
40  bool EmitSummaryIndex = false,
41  bool EmitModuleHash = false);
42 
43 /// Check whether a pass is a BitcodeWriterPass.
45 
46 /// Pass for writing a module of IR out to a bitcode file.
47 ///
48 /// Note that this is intended for use with the new pass manager. To construct
49 /// a pass for the legacy pass manager, use the function above.
50 class BitcodeWriterPass : public PassInfoMixin<BitcodeWriterPass> {
51  raw_ostream &OS;
52  bool ShouldPreserveUseListOrder;
53  bool EmitSummaryIndex;
54  bool EmitModuleHash;
55 
56 public:
57  /// Construct a bitcode writer pass around a particular output stream.
58  ///
59  /// If \c ShouldPreserveUseListOrder, encode use-list order so it can be
60  /// reproduced when deserialized.
61  ///
62  /// If \c EmitSummaryIndex, emit the summary index (currently
63  /// for use in ThinLTO optimization).
65  bool ShouldPreserveUseListOrder = false,
66  bool EmitSummaryIndex = false,
67  bool EmitModuleHash = false)
68  : OS(OS), ShouldPreserveUseListOrder(ShouldPreserveUseListOrder),
69  EmitSummaryIndex(EmitSummaryIndex), EmitModuleHash(EmitModuleHash) {}
70 
71  /// Run the bitcode writer pass, and output the module to the selected
72  /// output stream.
74 
75  static bool isRequired() { return true; }
76 };
77 
78 }
79 
80 #endif
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1965
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::BitcodeWriterPass::isRequired
static bool isRequired()
Definition: BitcodeWriterPass.h:75
llvm::createBitcodeWriterPass
ModulePass * createBitcodeWriterPass(raw_ostream &Str, bool ShouldPreserveUseListOrder=false, bool EmitSummaryIndex=false, bool EmitModuleHash=false)
Create and return a pass that writes the module to the specified ostream.
Definition: BitcodeWriterPass.cpp:77
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::BitcodeWriterPass
Pass for writing a module of IR out to a bitcode file.
Definition: BitcodeWriterPass.h:50
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::BitcodeWriterPass::BitcodeWriterPass
BitcodeWriterPass(raw_ostream &OS, bool ShouldPreserveUseListOrder=false, bool EmitSummaryIndex=false, bool EmitModuleHash=false)
Construct a bitcode writer pass around a particular output stream.
Definition: BitcodeWriterPass.h:64
PassManager.h
llvm::BitcodeWriterPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
Run the bitcode writer pass, and output the module to the selected output stream.
Definition: BitcodeWriterPass.cpp:22
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::isBitcodeWriterPass
bool isBitcodeWriterPass(Pass *P)
Check whether a pass is a BitcodeWriterPass.
Definition: BitcodeWriterPass.cpp:84