LLVM 20.0.0git
Namespaces | Macros | Enumerations | Functions | Variables
BitcodeWriter.cpp File Reference
#include "llvm/Bitcode/BitcodeWriter.h"
#include "ValueEnumerator.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitcode/BitcodeCommon.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/LLVMBitCodes.h"
#include "llvm/Bitstream/BitCodes.h"
#include "llvm/Bitstream/BitstreamWriter.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRangeList.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalIFunc.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/UseListOrder.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/MC/StringTableBuilder.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Object/IRSymtab.h"
#include "llvm/ProfileData/MemProf.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SHA1.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "llvm/IR/Metadata.def"

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define HANDLE_MDNODE_LEAF(CLASS)   CLASS##AbbrevID,
 
#define HANDLE_MDNODE_LEAF(CLASS)   unsigned CLASS##Abbrev = 0;
 
#define HANDLE_MDNODE_LEAF(CLASS)
 

Enumerations

enum  StringEncoding { SE_Char6 , SE_Fixed7 , SE_Fixed8 }
 
enum  MetadataAbbrev : unsigned { LastPlusOne }
 

Functions

static unsigned getEncodedCastOpcode (unsigned Opcode)
 
static unsigned getEncodedUnaryOpcode (unsigned Opcode)
 
static unsigned getEncodedBinaryOpcode (unsigned Opcode)
 
static unsigned getEncodedRMWOperation (AtomicRMWInst::BinOp Op)
 
static unsigned getEncodedOrdering (AtomicOrdering Ordering)
 
static void writeStringRecord (BitstreamWriter &Stream, unsigned Code, StringRef Str, unsigned AbbrevToUse)
 
static uint64_t getAttrKindEncoding (Attribute::AttrKind Kind)
 
static void emitSignedInt64 (SmallVectorImpl< uint64_t > &Vals, uint64_t V)
 
static void emitWideAPInt (SmallVectorImpl< uint64_t > &Vals, const APInt &A)
 
static void emitConstantRange (SmallVectorImpl< uint64_t > &Record, const ConstantRange &CR, bool EmitBitWidth)
 
static unsigned getEncodedLinkage (const GlobalValue::LinkageTypes Linkage)
 
static unsigned getEncodedLinkage (const GlobalValue &GV)
 
static uint64_t getEncodedFFlags (FunctionSummary::FFlags Flags)
 
static uint64_t getEncodedGVSummaryFlags (GlobalValueSummary::GVFlags Flags, bool ImportAsDecl=false)
 
static uint64_t getEncodedGVarFlags (GlobalVarSummary::GVarFlags Flags)
 
static uint64_t getEncodedHotnessCallEdgeInfo (const CalleeInfo &CI)
 
static uint64_t getEncodedRelBFCallEdgeInfo (const CalleeInfo &CI)
 
static unsigned getEncodedVisibility (const GlobalValue &GV)
 
static unsigned getEncodedDLLStorageClass (const GlobalValue &GV)
 
static unsigned getEncodedThreadLocalMode (const GlobalValue &GV)
 
static unsigned getEncodedComdatSelectionKind (const Comdat &C)
 
static unsigned getEncodedUnnamedAddr (const GlobalValue &GV)
 
static StringEncoding getStringEncoding (StringRef Str)
 Determine the encoding to use for the given string name and length.
 
static unsigned serializeSanitizerMetadata (const GlobalValue::SanitizerMetadata &Meta)
 
static uint64_t getOptimizationFlags (const Value *V)
 
template<typename Fn >
static void writeFunctionTypeMetadataRecords (BitstreamWriter &Stream, FunctionSummary *FS, Fn GetValueID)
 Write the function type metadata related records that need to appear before a function summary entry (whether per-module or combined).
 
static void getReferencedTypeIds (FunctionSummary *FS, std::set< GlobalValue::GUID > &ReferencedTypeIds)
 Collect type IDs from type tests used by function.
 
static void writeWholeProgramDevirtResolutionByArg (SmallVector< uint64_t, 64 > &NameVals, const std::vector< uint64_t > &args, const WholeProgramDevirtResolution::ByArg &ByArg)
 
static void writeWholeProgramDevirtResolution (SmallVector< uint64_t, 64 > &NameVals, StringTableBuilder &StrtabBuilder, uint64_t Id, const WholeProgramDevirtResolution &Wpd)
 
static void writeTypeIdSummaryRecord (SmallVector< uint64_t, 64 > &NameVals, StringTableBuilder &StrtabBuilder, StringRef Id, const TypeIdSummary &Summary)
 
static void writeTypeIdCompatibleVtableSummaryRecord (SmallVector< uint64_t, 64 > &NameVals, StringTableBuilder &StrtabBuilder, StringRef Id, const TypeIdCompatibleVtableInfo &Summary, ValueEnumerator &VE)
 
static void collectMemProfCallStacks (FunctionSummary *FS, std::function< LinearFrameId(unsigned)> GetStackIndex, MapVector< CallStackId, llvm::SmallVector< LinearFrameId > > &CallStacks)
 
static DenseMap< CallStackId, LinearCallStackIdwriteMemoryProfileRadixTree (MapVector< CallStackId, llvm::SmallVector< LinearFrameId > > &&CallStacks, BitstreamWriter &Stream, unsigned RadixAbbrev)
 
static void writeFunctionHeapProfileRecords (BitstreamWriter &Stream, FunctionSummary *FS, unsigned CallsiteAbbrev, unsigned AllocAbbrev, unsigned ContextIdAbbvId, bool PerModule, std::function< unsigned(const ValueInfo &VI)> GetValueID, std::function< unsigned(unsigned)> GetStackIndex, bool WriteContextSizeInfoIndex, DenseMap< CallStackId, LinearCallStackId > &CallStackPos, CallStackId &CallStackCount)
 
static void writeIdentificationBlock (BitstreamWriter &Stream)
 Create the "IDENTIFICATION_BLOCK_ID" containing a single string with the current llvm version, and a record for the epoch number.
 
static void writeInt32ToBuffer (uint32_t Value, SmallVectorImpl< char > &Buffer, uint32_t &Position)
 
static void emitDarwinBCHeaderAndTrailer (SmallVectorImpl< char > &Buffer, const Triple &TT)
 If generating a bc file on darwin, we have to emit a header and trailer to make it compatible with the system archiver.
 
static void writeBitcodeHeader (BitstreamWriter &Stream)
 Helper to write the header common to all bitcode files.
 
static const chargetSectionNameForBitcode (const Triple &T)
 
static const chargetSectionNameForCommandline (const Triple &T)
 

Variables

static cl::opt< unsignedIndexThreshold ("bitcode-mdindex-threshold", cl::Hidden, cl::init(25), cl::desc("Number of metadatas above which we emit an index " "to enable lazy-loading"))
 
static cl::opt< uint32_tFlushThreshold ("bitcode-flush-threshold", cl::Hidden, cl::init(512), cl::desc("The threshold (unit M) for flushing LLVM bitcode."))
 
static cl::opt< boolWriteRelBFToSummary ("write-relbf-to-summary", cl::Hidden, cl::init(false), cl::desc("Write relative block frequency to function summary "))
 
bool WriteNewDbgInfoFormatToBitcode
 
llvm::cl::opt< boolUseNewDbgInfoFormat
 

Macro Definition Documentation

◆ HANDLE_MDNODE_LEAF [1/3]

#define HANDLE_MDNODE_LEAF (   CLASS)    CLASS##AbbrevID,

Definition at line 2389 of file BitcodeWriter.cpp.

◆ HANDLE_MDNODE_LEAF [2/3]

#define HANDLE_MDNODE_LEAF (   CLASS)    unsigned CLASS##Abbrev = 0;

Definition at line 2389 of file BitcodeWriter.cpp.

◆ HANDLE_MDNODE_LEAF [3/3]

#define HANDLE_MDNODE_LEAF (   CLASS)
Value:
case Metadata::CLASS##Kind: \
if (MDAbbrevs) \
write##CLASS(cast<CLASS>(N), Record, \
(*MDAbbrevs)[MetadataAbbrev::CLASS##AbbrevID]); \
else \
write##CLASS(cast<CLASS>(N), Record, CLASS##Abbrev); \
continue;
Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue)
Definition: DWP.cpp:625
#define N

Definition at line 2389 of file BitcodeWriter.cpp.

Enumeration Type Documentation

◆ MetadataAbbrev

Enumerator
LastPlusOne 

Definition at line 2388 of file BitcodeWriter.cpp.

◆ StringEncoding

Enumerator
SE_Char6 
SE_Fixed7 
SE_Fixed8 

Definition at line 1408 of file BitcodeWriter.cpp.

Function Documentation

◆ collectMemProfCallStacks()

static void collectMemProfCallStacks ( FunctionSummary FS,
std::function< LinearFrameId(unsigned)>  GetStackIndex,
MapVector< CallStackId, llvm::SmallVector< LinearFrameId > > &  CallStacks 
)
static

◆ emitConstantRange()

static void emitConstantRange ( SmallVectorImpl< uint64_t > &  Record,
const ConstantRange CR,
bool  EmitBitWidth 
)
static

◆ emitDarwinBCHeaderAndTrailer()

static void emitDarwinBCHeaderAndTrailer ( SmallVectorImpl< char > &  Buffer,
const Triple TT 
)
static

If generating a bc file on darwin, we have to emit a header and trailer to make it compatible with the system archiver.

To do this we emit the following header, and then emit a trailer that pads the file out to be a multiple of 16 bytes.

struct bc_header { uint32_t Magic; // 0x0B17C0DE uint32_t Version; // Version, currently always 0. uint32_t BitcodeOffset; // Offset to traditional bitcode file. uint32_t BitcodeSize; // Size of traditional bitcode file. uint32_t CPUType; // CPU specifier. ... potentially more later ... };

Definition at line 5199 of file BitcodeWriter.cpp.

References llvm::Triple::arm, assert(), llvm::BWH_HeaderSize, llvm::Triple::ppc, llvm::Triple::ppc64, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), llvm::Triple::thumb, writeInt32ToBuffer(), llvm::Triple::x86, and llvm::Triple::x86_64.

Referenced by llvm::WriteBitcodeToFile().

◆ emitSignedInt64()

static void emitSignedInt64 ( SmallVectorImpl< uint64_t > &  Vals,
uint64_t  V 
)
static

◆ emitWideAPInt()

static void emitWideAPInt ( SmallVectorImpl< uint64_t > &  Vals,
const APInt A 
)
static

Definition at line 929 of file BitcodeWriter.cpp.

References A, and emitSignedInt64().

Referenced by emitConstantRange().

◆ getAttrKindEncoding()

static uint64_t getAttrKindEncoding ( Attribute::AttrKind  Kind)
static

Definition at line 712 of file BitcodeWriter.cpp.

References llvm::bitc::ATTR_KIND_ALIGNMENT, llvm::bitc::ATTR_KIND_ALLOC_ALIGN, llvm::bitc::ATTR_KIND_ALLOC_KIND, llvm::bitc::ATTR_KIND_ALLOC_SIZE, llvm::bitc::ATTR_KIND_ALLOCATED_POINTER, llvm::bitc::ATTR_KIND_ALWAYS_INLINE, llvm::bitc::ATTR_KIND_BUILTIN, llvm::bitc::ATTR_KIND_BY_VAL, llvm::bitc::ATTR_KIND_BYREF, llvm::bitc::ATTR_KIND_COLD, llvm::bitc::ATTR_KIND_CONVERGENT, llvm::bitc::ATTR_KIND_CORO_ELIDE_SAFE, llvm::bitc::ATTR_KIND_CORO_ONLY_DESTROY_WHEN_COMPLETE, llvm::bitc::ATTR_KIND_DEAD_ON_UNWIND, llvm::bitc::ATTR_KIND_DEREFERENCEABLE, llvm::bitc::ATTR_KIND_DEREFERENCEABLE_OR_NULL, llvm::bitc::ATTR_KIND_DISABLE_SANITIZER_INSTRUMENTATION, llvm::bitc::ATTR_KIND_ELEMENTTYPE, llvm::bitc::ATTR_KIND_FNRETTHUNK_EXTERN, llvm::bitc::ATTR_KIND_HOT, llvm::bitc::ATTR_KIND_HYBRID_PATCHABLE, llvm::bitc::ATTR_KIND_IMMARG, llvm::bitc::ATTR_KIND_IN_ALLOCA, llvm::bitc::ATTR_KIND_IN_REG, llvm::bitc::ATTR_KIND_INITIALIZES, llvm::bitc::ATTR_KIND_INLINE_HINT, llvm::bitc::ATTR_KIND_JUMP_TABLE, llvm::bitc::ATTR_KIND_MEMORY, llvm::bitc::ATTR_KIND_MIN_SIZE, llvm::bitc::ATTR_KIND_MUSTPROGRESS, llvm::bitc::ATTR_KIND_NAKED, llvm::bitc::ATTR_KIND_NEST, llvm::bitc::ATTR_KIND_NO_ALIAS, llvm::bitc::ATTR_KIND_NO_BUILTIN, llvm::bitc::ATTR_KIND_NO_CALLBACK, llvm::bitc::ATTR_KIND_NO_CAPTURE, llvm::bitc::ATTR_KIND_NO_DIVERGENCE_SOURCE, llvm::bitc::ATTR_KIND_NO_DUPLICATE, llvm::bitc::ATTR_KIND_NO_EXT, llvm::bitc::ATTR_KIND_NO_IMPLICIT_FLOAT, llvm::bitc::ATTR_KIND_NO_INLINE, llvm::bitc::ATTR_KIND_NO_MERGE, llvm::bitc::ATTR_KIND_NO_PROFILE, llvm::bitc::ATTR_KIND_NO_RECURSE, llvm::bitc::ATTR_KIND_NO_RED_ZONE, llvm::bitc::ATTR_KIND_NO_RETURN, llvm::bitc::ATTR_KIND_NO_SANITIZE_BOUNDS, llvm::bitc::ATTR_KIND_NO_SANITIZE_COVERAGE, llvm::bitc::ATTR_KIND_NO_UNWIND, llvm::bitc::ATTR_KIND_NOCF_CHECK, llvm::bitc::ATTR_KIND_NOFPCLASS, llvm::bitc::ATTR_KIND_NOFREE, llvm::bitc::ATTR_KIND_NON_LAZY_BIND, llvm::bitc::ATTR_KIND_NON_NULL, llvm::bitc::ATTR_KIND_NOSYNC, llvm::bitc::ATTR_KIND_NOUNDEF, llvm::bitc::ATTR_KIND_NULL_POINTER_IS_VALID, llvm::bitc::ATTR_KIND_OPT_FOR_FUZZING, llvm::bitc::ATTR_KIND_OPTIMIZE_FOR_DEBUGGING, llvm::bitc::ATTR_KIND_OPTIMIZE_FOR_SIZE, llvm::bitc::ATTR_KIND_OPTIMIZE_NONE, llvm::bitc::ATTR_KIND_PREALLOCATED, llvm::bitc::ATTR_KIND_PRESPLIT_COROUTINE, llvm::bitc::ATTR_KIND_RANGE, llvm::bitc::ATTR_KIND_READ_NONE, llvm::bitc::ATTR_KIND_READ_ONLY, llvm::bitc::ATTR_KIND_RETURNED, llvm::bitc::ATTR_KIND_RETURNS_TWICE, llvm::bitc::ATTR_KIND_S_EXT, llvm::bitc::ATTR_KIND_SAFESTACK, llvm::bitc::ATTR_KIND_SANITIZE_ADDRESS, llvm::bitc::ATTR_KIND_SANITIZE_HWADDRESS, llvm::bitc::ATTR_KIND_SANITIZE_MEMORY, llvm::bitc::ATTR_KIND_SANITIZE_MEMTAG, llvm::bitc::ATTR_KIND_SANITIZE_NUMERICAL_STABILITY, llvm::bitc::ATTR_KIND_SANITIZE_REALTIME, llvm::bitc::ATTR_KIND_SANITIZE_REALTIME_BLOCKING, llvm::bitc::ATTR_KIND_SANITIZE_THREAD, llvm::bitc::ATTR_KIND_SANITIZE_TYPE, llvm::bitc::ATTR_KIND_SHADOWCALLSTACK, llvm::bitc::ATTR_KIND_SKIP_PROFILE, llvm::bitc::ATTR_KIND_SPECULATABLE, llvm::bitc::ATTR_KIND_SPECULATIVE_LOAD_HARDENING, llvm::bitc::ATTR_KIND_STACK_ALIGNMENT, llvm::bitc::ATTR_KIND_STACK_PROTECT, llvm::bitc::ATTR_KIND_STACK_PROTECT_REQ, llvm::bitc::ATTR_KIND_STACK_PROTECT_STRONG, llvm::bitc::ATTR_KIND_STRICT_FP, llvm::bitc::ATTR_KIND_STRUCT_RET, llvm::bitc::ATTR_KIND_SWIFT_ASYNC, llvm::bitc::ATTR_KIND_SWIFT_ERROR, llvm::bitc::ATTR_KIND_SWIFT_SELF, llvm::bitc::ATTR_KIND_UW_TABLE, llvm::bitc::ATTR_KIND_VSCALE_RANGE, llvm::bitc::ATTR_KIND_WILLRETURN, llvm::bitc::ATTR_KIND_WRITABLE, llvm::bitc::ATTR_KIND_WRITEONLY, llvm::bitc::ATTR_KIND_Z_EXT, llvm::Attribute::EmptyKey, llvm::Attribute::EndAttrKinds, llvm_unreachable, llvm::Attribute::None, and llvm::Attribute::TombstoneKey.

◆ getEncodedBinaryOpcode()

static unsigned getEncodedBinaryOpcode ( unsigned  Opcode)
static

◆ getEncodedCastOpcode()

static unsigned getEncodedCastOpcode ( unsigned  Opcode)
static

◆ getEncodedComdatSelectionKind()

static unsigned getEncodedComdatSelectionKind ( const Comdat C)
static

◆ getEncodedDLLStorageClass()

static unsigned getEncodedDLLStorageClass ( const GlobalValue GV)
static

◆ getEncodedFFlags()

static uint64_t getEncodedFFlags ( FunctionSummary::FFlags  Flags)
static

Definition at line 1247 of file BitcodeWriter.cpp.

◆ getEncodedGVarFlags()

static uint64_t getEncodedGVarFlags ( GlobalVarSummary::GVarFlags  Flags)
static

Definition at line 1286 of file BitcodeWriter.cpp.

◆ getEncodedGVSummaryFlags()

static uint64_t getEncodedGVSummaryFlags ( GlobalValueSummary::GVFlags  Flags,
bool  ImportAsDecl = false 
)
static

Definition at line 1264 of file BitcodeWriter.cpp.

◆ getEncodedHotnessCallEdgeInfo()

static uint64_t getEncodedHotnessCallEdgeInfo ( const CalleeInfo CI)
static

Definition at line 1292 of file BitcodeWriter.cpp.

References llvm::CalleeInfo::HasTailCall, and llvm::CalleeInfo::Hotness.

◆ getEncodedLinkage() [1/2]

static unsigned getEncodedLinkage ( const GlobalValue GV)
static

Definition at line 1243 of file BitcodeWriter.cpp.

References getEncodedLinkage(), and llvm::GlobalValue::getLinkage().

◆ getEncodedLinkage() [2/2]

static unsigned getEncodedLinkage ( const GlobalValue::LinkageTypes  Linkage)
static

◆ getEncodedOrdering()

static unsigned getEncodedOrdering ( AtomicOrdering  Ordering)
static

◆ getEncodedRelBFCallEdgeInfo()

static uint64_t getEncodedRelBFCallEdgeInfo ( const CalleeInfo CI)
static

◆ getEncodedRMWOperation()

static unsigned getEncodedRMWOperation ( AtomicRMWInst::BinOp  Op)
static

◆ getEncodedThreadLocalMode()

static unsigned getEncodedThreadLocalMode ( const GlobalValue GV)
static

◆ getEncodedUnaryOpcode()

static unsigned getEncodedUnaryOpcode ( unsigned  Opcode)
static

Definition at line 624 of file BitcodeWriter.cpp.

References llvm_unreachable, and llvm::bitc::UNOP_FNEG.

◆ getEncodedUnnamedAddr()

static unsigned getEncodedUnnamedAddr ( const GlobalValue GV)
static

Definition at line 1355 of file BitcodeWriter.cpp.

References llvm::GlobalValue::getUnnamedAddr(), and llvm_unreachable.

◆ getEncodedVisibility()

static unsigned getEncodedVisibility ( const GlobalValue GV)
static

◆ getOptimizationFlags()

static uint64_t getOptimizationFlags ( const Value V)
static

◆ getReferencedTypeIds()

static void getReferencedTypeIds ( FunctionSummary FS,
std::set< GlobalValue::GUID > &  ReferencedTypeIds 
)
static

Collect type IDs from type tests used by function.

Definition at line 4120 of file BitcodeWriter.cpp.

◆ getSectionNameForBitcode()

static const char * getSectionNameForBitcode ( const Triple T)
static

◆ getSectionNameForCommandline()

static const char * getSectionNameForCommandline ( const Triple T)
static

◆ getStringEncoding()

static StringEncoding getStringEncoding ( StringRef  Str)
static

Determine the encoding to use for the given string name and length.

Definition at line 1411 of file BitcodeWriter.cpp.

References llvm::CallingConv::C, llvm::BitCodeAbbrevOp::isChar6(), SE_Char6, SE_Fixed7, and SE_Fixed8.

◆ serializeSanitizerMetadata()

static unsigned serializeSanitizerMetadata ( const GlobalValue::SanitizerMetadata Meta)
static

Definition at line 1428 of file BitcodeWriter.cpp.

◆ writeBitcodeHeader()

static void writeBitcodeHeader ( BitstreamWriter Stream)
static

Helper to write the header common to all bitcode files.

Definition at line 5246 of file BitcodeWriter.cpp.

References llvm::BitstreamWriter::Emit().

Referenced by llvm::BitcodeWriter::BitcodeWriter().

◆ writeFunctionHeapProfileRecords()

static void writeFunctionHeapProfileRecords ( BitstreamWriter Stream,
FunctionSummary FS,
unsigned  CallsiteAbbrev,
unsigned  AllocAbbrev,
unsigned  ContextIdAbbvId,
bool  PerModule,
std::function< unsigned(const ValueInfo &VI)>  GetValueID,
std::function< unsigned(unsigned)>  GetStackIndex,
bool  WriteContextSizeInfoIndex,
DenseMap< CallStackId, LinearCallStackId > &  CallStackPos,
CallStackId CallStackCount 
)
static

◆ writeFunctionTypeMetadataRecords()

template<typename Fn >
static void writeFunctionTypeMetadataRecords ( BitstreamWriter Stream,
FunctionSummary FS,
Fn  GetValueID 
)
static

◆ writeIdentificationBlock()

static void writeIdentificationBlock ( BitstreamWriter Stream)
static

◆ writeInt32ToBuffer()

static void writeInt32ToBuffer ( uint32_t  Value,
SmallVectorImpl< char > &  Buffer,
uint32_t Position 
)
static

Definition at line 5180 of file BitcodeWriter.cpp.

References llvm::support::endian::write32le().

Referenced by emitDarwinBCHeaderAndTrailer().

◆ writeMemoryProfileRadixTree()

static DenseMap< CallStackId, LinearCallStackId > writeMemoryProfileRadixTree ( MapVector< CallStackId, llvm::SmallVector< LinearFrameId > > &&  CallStacks,
BitstreamWriter Stream,
unsigned  RadixAbbrev 
)
static

◆ writeStringRecord()

static void writeStringRecord ( BitstreamWriter Stream,
unsigned  Code,
StringRef  Str,
unsigned  AbbrevToUse 
)
static

◆ writeTypeIdCompatibleVtableSummaryRecord()

static void writeTypeIdCompatibleVtableSummaryRecord ( SmallVector< uint64_t, 64 > &  NameVals,
StringTableBuilder StrtabBuilder,
StringRef  Id,
const TypeIdCompatibleVtableInfo Summary,
ValueEnumerator VE 
)
static

◆ writeTypeIdSummaryRecord()

static void writeTypeIdSummaryRecord ( SmallVector< uint64_t, 64 > &  NameVals,
StringTableBuilder StrtabBuilder,
StringRef  Id,
const TypeIdSummary Summary 
)
static

◆ writeWholeProgramDevirtResolution()

static void writeWholeProgramDevirtResolution ( SmallVector< uint64_t, 64 > &  NameVals,
StringTableBuilder StrtabBuilder,
uint64_t  Id,
const WholeProgramDevirtResolution Wpd 
)
static

◆ writeWholeProgramDevirtResolutionByArg()

static void writeWholeProgramDevirtResolutionByArg ( SmallVector< uint64_t, 64 > &  NameVals,
const std::vector< uint64_t > &  args,
const WholeProgramDevirtResolution::ByArg ByArg 
)
static

Variable Documentation

◆ FlushThreshold

cl::opt< uint32_t > FlushThreshold("bitcode-flush-threshold", cl::Hidden, cl::init(512), cl::desc("The threshold (unit M) for flushing LLVM bitcode.")) ( "bitcode-flush-threshold"  ,
cl::Hidden  ,
cl::init(512)  ,
cl::desc("The threshold (unit M) for flushing LLVM bitcode.")   
)
static

◆ IndexThreshold

cl::opt< unsigned > IndexThreshold("bitcode-mdindex-threshold", cl::Hidden, cl::init(25), cl::desc("Number of metadatas above which we emit an index " "to enable lazy-loading")) ( "bitcode-mdindex-threshold"  ,
cl::Hidden  ,
cl::init(25)  ,
cl::desc("Number of metadatas above which we emit an index " "to enable lazy-loading")   
)
static

◆ UseNewDbgInfoFormat

llvm::cl::opt<bool> UseNewDbgInfoFormat
extern

◆ WriteNewDbgInfoFormatToBitcode

bool WriteNewDbgInfoFormatToBitcode
extern

Definition at line 47 of file BasicBlock.cpp.

◆ WriteRelBFToSummary

cl::opt< bool > WriteRelBFToSummary("write-relbf-to-summary", cl::Hidden, cl::init(false), cl::desc("Write relative block frequency to function summary ")) ( "write-relbf-to-summary"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Write relative block frequency to function summary ")   
)
static