LLVM  8.0.1
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/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Bitcode/BitCodes.h"
#include "llvm/Bitcode/BitstreamWriter.h"
#include "llvm/Bitcode/LLVMBitCodes.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/Constant.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/Object/IRSymtab.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/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "llvm/IR/Metadata.def"

Go to the source code of this file.

Macros

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

Enumerations

enum  
 These are manifest constants used by the bitcode writer. More...
 
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 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)
 
static uint64_t getEncodedGVarFlags (GlobalVarSummary::GVarFlags Flags)
 
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. More...
 
static uint64_t getOptimizationFlags (const Value *V)
 
static uint64_t rotateSign (int64_t I)
 
static void emitSignedInt64 (SmallVectorImpl< uint64_t > &Vals, uint64_t V)
 
static void writeFunctionTypeMetadataRecords (BitstreamWriter &Stream, FunctionSummary *FS)
 Write the function type metadata related records that need to appear before a function summary entry (whether per-module or combined). More...
 
static void getReferencedTypeIds (FunctionSummary *FS, std::set< GlobalValue::GUID > &ReferencedTypeIds)
 Collect type IDs from type tests used by function. More...
 
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, const std::string &Id, const TypeIdSummary &Summary)
 
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. More...
 
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. More...
 
static void writeBitcodeHeader (BitstreamWriter &Stream)
 Helper to write the header common to all bitcode files. More...
 

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"))
 
cl::opt< boolWriteRelBFToSummary ("write-relbf-to-summary", cl::Hidden, cl::init(false), cl::desc("Write relative block frequency to function summary "))
 
FunctionSummary::ForceSummaryHotnessType ForceSummaryEdgesCold
 
static const uint64_t INDEX_VERSION = 6
 

Macro Definition Documentation

◆ HANDLE_MDNODE_LEAF [1/3]

#define HANDLE_MDNODE_LEAF (   CLASS)    CLASS##AbbrevID,

Definition at line 1951 of file BitcodeWriter.cpp.

◆ HANDLE_MDNODE_LEAF [2/3]

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

Definition at line 1951 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;
#define N
const unsigned Kind

Definition at line 1951 of file BitcodeWriter.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

These are manifest constants used by the bitcode writer.

They do not need to be kept in sync with the reader, but need to be consistent within this file.

Definition at line 100 of file BitcodeWriter.cpp.

◆ MetadataAbbrev

Enumerator
LastPlusOne 

Definition at line 1950 of file BitcodeWriter.cpp.

◆ StringEncoding

Enumerator
SE_Char6 
SE_Fixed7 
SE_Fixed8 

Definition at line 1106 of file BitcodeWriter.cpp.

Function Documentation

◆ 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 4126 of file BitcodeWriter.cpp.

References llvm::Triple::arm, assert(), llvm::BWH_HeaderSize, llvm::Triple::getArch(), llvm::Triple::ppc, llvm::Triple::ppc64, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase::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

Definition at line 2211 of file BitcodeWriter.cpp.

References llvm::any_of(), llvm::SmallVectorImpl< T >::append(), llvm::BitCodeAbbrevOp::Array, assert(), llvm::SmallVectorImpl< T >::assign(), llvm::BitstreamWriter::BackpatchWord(), llvm::StringRef::begin(), llvm::Function::begin(), llvm::tgtok::Bits, C, llvm::MCID::Call, llvm::bitc::CALL_CCONV, llvm::bitc::CALL_EXPLICIT_TYPE, llvm::bitc::CALL_FMF, llvm::bitc::CALL_MUSTTAIL, llvm::bitc::CALL_NOTAIL, llvm::bitc::CALL_TAIL, Callee, llvm::SwitchInst::cases(), llvm::LandingPadInst::Catch, llvm::BitCodeAbbrevOp::Char6, llvm::SmallVectorImpl< T >::clear(), llvm::ValueEnumerator::computeBitsRequiredForTypeIndicies(), llvm::bitc::CONSTANTS_BLOCK_ID, llvm::bitc::CST_CODE_AGGREGATE, llvm::bitc::CST_CODE_BLOCKADDRESS, llvm::bitc::CST_CODE_CE_BINOP, llvm::bitc::CST_CODE_CE_CAST, llvm::bitc::CST_CODE_CE_CMP, llvm::bitc::CST_CODE_CE_EXTRACTELT, llvm::bitc::CST_CODE_CE_GEP, llvm::bitc::CST_CODE_CE_GEP_WITH_INRANGE_INDEX, llvm::bitc::CST_CODE_CE_INBOUNDS_GEP, llvm::bitc::CST_CODE_CE_INSERTELT, llvm::bitc::CST_CODE_CE_SELECT, llvm::bitc::CST_CODE_CE_SHUFFLEVEC, llvm::bitc::CST_CODE_CE_SHUFVEC_EX, llvm::bitc::CST_CODE_CE_UNOP, llvm::bitc::CST_CODE_CSTRING, llvm::bitc::CST_CODE_DATA, llvm::bitc::CST_CODE_FLOAT, llvm::bitc::CST_CODE_INLINEASM, llvm::bitc::CST_CODE_INTEGER, llvm::bitc::CST_CODE_NULL, llvm::bitc::CST_CODE_SETTYPE, llvm::bitc::CST_CODE_STRING, llvm::bitc::CST_CODE_UNDEF, llvm::bitc::CST_CODE_WIDE_INTEGER, llvm::Value::dump(), E, llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitBlockInfoAbbrev(), llvm::BitstreamWriter::EmitRecord(), llvm::ValueSymbolTable::empty(), llvm::StringRef::end(), llvm::Function::end(), llvm::BitstreamWriter::EnterBlockInfoBlock(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), F(), llvm::LandingPadInst::Filter, first, llvm::BitCodeAbbrevOp::Fixed, llvm::bitc::FUNC_CODE_DEBUG_LOC, llvm::bitc::FUNC_CODE_DEBUG_LOC_AGAIN, llvm::bitc::FUNC_CODE_DECLAREBLOCKS, llvm::bitc::FUNC_CODE_INST_ALLOCA, llvm::bitc::FUNC_CODE_INST_ATOMICRMW, llvm::bitc::FUNC_CODE_INST_BINOP, llvm::bitc::FUNC_CODE_INST_BR, llvm::bitc::FUNC_CODE_INST_CALL, llvm::bitc::FUNC_CODE_INST_CAST, llvm::bitc::FUNC_CODE_INST_CATCHPAD, llvm::bitc::FUNC_CODE_INST_CATCHRET, llvm::bitc::FUNC_CODE_INST_CATCHSWITCH, llvm::bitc::FUNC_CODE_INST_CLEANUPPAD, llvm::bitc::FUNC_CODE_INST_CLEANUPRET, llvm::bitc::FUNC_CODE_INST_CMP2, llvm::bitc::FUNC_CODE_INST_CMPXCHG, llvm::bitc::FUNC_CODE_INST_EXTRACTELT, llvm::bitc::FUNC_CODE_INST_EXTRACTVAL, llvm::bitc::FUNC_CODE_INST_FENCE, llvm::bitc::FUNC_CODE_INST_GEP, llvm::bitc::FUNC_CODE_INST_INDIRECTBR, llvm::bitc::FUNC_CODE_INST_INSERTELT, llvm::bitc::FUNC_CODE_INST_INSERTVAL, llvm::bitc::FUNC_CODE_INST_INVOKE, llvm::bitc::FUNC_CODE_INST_LANDINGPAD, llvm::bitc::FUNC_CODE_INST_LOAD, llvm::bitc::FUNC_CODE_INST_LOADATOMIC, llvm::bitc::FUNC_CODE_INST_PHI, llvm::bitc::FUNC_CODE_INST_RESUME, llvm::bitc::FUNC_CODE_INST_RET, llvm::bitc::FUNC_CODE_INST_SHUFFLEVEC, llvm::bitc::FUNC_CODE_INST_STORE, llvm::bitc::FUNC_CODE_INST_STOREATOMIC, llvm::bitc::FUNC_CODE_INST_SWITCH, llvm::bitc::FUNC_CODE_INST_UNOP, llvm::bitc::FUNC_CODE_INST_UNREACHABLE, llvm::bitc::FUNC_CODE_INST_VAARG, llvm::bitc::FUNC_CODE_INST_VSELECT, llvm::bitc::FUNC_CODE_OPERAND_BUNDLE, llvm::bitc::FUNCTION_BLOCK_ID, llvm::AllocaInst::getAlignment(), getAlignment(), llvm::AllocaInst::getAllocatedType(), llvm::CallBase::getArgOperand(), llvm::ValueEnumerator::getAttributeListID(), llvm::CallBase::getAttributes(), llvm::ValueEnumerator::getBasicBlocks(), llvm::CallBase::getCalledValue(), llvm::CallBase::getCallingConv(), llvm::LandingPadInst::getClause(), llvm::BranchInst::getCondition(), llvm::SwitchInst::getCondition(), llvm::Value::getContext(), llvm::BitstreamWriter::GetCurrentBitNo(), llvm::Instruction::getDebugLoc(), llvm::SwitchInst::getDefaultDest(), llvm::ConstantDataSequential::getElementAsInteger(), getEncodedBinaryOpcode(), getEncodedCastOpcode(), getEncodedOrdering(), getEncodedRMWOperation(), getEncodedUnaryOpcode(), llvm::ValueEnumerator::getFunctionConstantRange(), llvm::CallBase::getFunctionType(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::ValueEnumerator::getMetadataOrNullID(), llvm::InvokeInst::getNormalDest(), llvm::CallBase::getNumArgOperands(), llvm::LandingPadInst::getNumClauses(), llvm::ConstantDataSequential::getNumElements(), llvm::PHINode::getNumIncomingValues(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getNumOperandBundles(), llvm::User::getNumOperands(), llvm::FunctionType::getNumParams(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getOperandBundleAt(), llvm::LLVMContext::getOperandBundleTagID(), getOptimizationFlags(), llvm::PPC::getPredicate(), llvm::APInt::getRawData(), getStringEncoding(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::ValueEnumerator::getTypeID(), llvm::ValueEnumerator::getTypes(), llvm::InvokeInst::getUnwindDest(), llvm::ValueEnumerator::getValueID(), llvm::ValueEnumerator::getValues(), llvm::Function::getValueSymbolTable(), H, llvm::GlobalObject::hasMetadata(), llvm::Instruction::hasMetadataOtherThanDebugLoc(), llvm::CallBase::hasOperandBundles(), I, llvm::ValueEnumerator::incorporateFunction(), isAtomic(), llvm::Instruction::isCast(), llvm::LandingPadInst::isCatch(), llvm::BitCodeAbbrevOp::isChar6(), llvm::LandingPadInst::isCleanup(), llvm::BranchInst::isConditional(), llvm::ConstantDataSequential::isCString(), llvm::GlobalValue::isDeclaration(), llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isFP128Ty(), llvm::Type::isHalfTy(), llvm::CallInst::isMustTailCall(), llvm::CallInst::isNoTailCall(), llvm::Constant::isNullValue(), llvm::Type::isPPC_FP128Ty(), llvm::AllocaInst::isSwiftError(), llvm::CallInst::isTailCall(), llvm::AllocaInst::isUsedWithInAlloca(), llvm::FunctionType::isVarArg(), llvm::Type::isVoidTy(), isVolatile(), isWeak(), llvm::Type::isX86_FP80Ty(), llvm_unreachable, llvm::SPII::Load, llvm::Log2_32(), llvm::Log2_32_Ceil(), llvm::Value::MaximumAlignment, llvm::bitc::MODULE_STRTAB_BLOCK_ID, llvm::bitc::MST_CODE_ENTRY, llvm::bitc::MST_CODE_HASH, Name, llvm::User::operands(), P, llvm::ValueEnumerator::purgeFunction(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MipsISD::Ret, SE_Char6, SE_Fixed7, llvm::MCID::Select, llvm::ValueEnumerator::setInstructionID(), llvm::ValueEnumerator::shouldPreserveUseListOrder(), SI, llvm::SPII::Store, llvm::bitc::USELIST_BLOCK_ID, llvm::bitc::USELIST_CODE_BB, llvm::bitc::USELIST_CODE_DEFAULT, llvm::ValueEnumerator::UseListOrders, llvm::bitc::VALUE_SYMTAB_BLOCK_ID, llvm::BitCodeAbbrevOp::VBR, llvm::bitc::VST_CODE_BBENTRY, llvm::bitc::VST_CODE_ENTRY, and llvm::bitc::VST_CODE_FNENTRY.

◆ getAttrKindEncoding()

static uint64_t getAttrKindEncoding ( Attribute::AttrKind  Kind)
static

Definition at line 594 of file BitcodeWriter.cpp.

References llvm::AArch64CC::AL, llvm::Attribute::Alignment, llvm::Attribute::AllocSize, llvm::Attribute::AlwaysInline, llvm::SmallVectorImpl< T >::append(), llvm::Attribute::ArgMemOnly, llvm::BitCodeAbbrevOp::Array, llvm::Type::ArrayTyID, llvm::bitc::ATTR_KIND_ALIGNMENT, llvm::bitc::ATTR_KIND_ALLOC_SIZE, llvm::bitc::ATTR_KIND_ALWAYS_INLINE, llvm::bitc::ATTR_KIND_ARGMEMONLY, llvm::bitc::ATTR_KIND_BUILTIN, llvm::bitc::ATTR_KIND_BY_VAL, llvm::bitc::ATTR_KIND_COLD, llvm::bitc::ATTR_KIND_CONVERGENT, llvm::bitc::ATTR_KIND_DEREFERENCEABLE, llvm::bitc::ATTR_KIND_DEREFERENCEABLE_OR_NULL, llvm::bitc::ATTR_KIND_IN_ALLOCA, llvm::bitc::ATTR_KIND_IN_REG, llvm::bitc::ATTR_KIND_INACCESSIBLEMEM_ONLY, llvm::bitc::ATTR_KIND_INACCESSIBLEMEM_OR_ARGMEMONLY, llvm::bitc::ATTR_KIND_INLINE_HINT, llvm::bitc::ATTR_KIND_JUMP_TABLE, llvm::bitc::ATTR_KIND_MIN_SIZE, 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_CAPTURE, llvm::bitc::ATTR_KIND_NO_DUPLICATE, llvm::bitc::ATTR_KIND_NO_IMPLICIT_FLOAT, llvm::bitc::ATTR_KIND_NO_INLINE, llvm::bitc::ATTR_KIND_NO_RECURSE, llvm::bitc::ATTR_KIND_NO_RED_ZONE, llvm::bitc::ATTR_KIND_NO_RETURN, llvm::bitc::ATTR_KIND_NO_UNWIND, llvm::bitc::ATTR_KIND_NOCF_CHECK, llvm::bitc::ATTR_KIND_NON_LAZY_BIND, llvm::bitc::ATTR_KIND_NON_NULL, llvm::bitc::ATTR_KIND_OPT_FOR_FUZZING, llvm::bitc::ATTR_KIND_OPTIMIZE_FOR_SIZE, llvm::bitc::ATTR_KIND_OPTIMIZE_NONE, 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_THREAD, llvm::bitc::ATTR_KIND_SHADOWCALLSTACK, 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_ERROR, llvm::bitc::ATTR_KIND_SWIFT_SELF, llvm::bitc::ATTR_KIND_UW_TABLE, llvm::bitc::ATTR_KIND_WRITEONLY, llvm::bitc::ATTR_KIND_Z_EXT, llvm::AMDGPU::HSAMD::Kernel::Key::Attrs, llvm::StringRef::begin(), llvm::Attribute::Builtin, llvm::Attribute::ByVal, llvm::BitCodeAbbrevOp::Char6, llvm::SmallVectorImpl< T >::clear(), llvm::Attribute::Cold, llvm::ValueEnumerator::computeBitsRequiredForTypeIndicies(), llvm::Attribute::Convergent, llvm::Attribute::Dereferenceable, llvm::Attribute::DereferenceableOrNull, llvm::Type::DoubleTyID, E, llvm::StructType::element_begin(), llvm::StructType::element_end(), llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitRecord(), llvm::StringRef::empty(), llvm::StringRef::end(), llvm::Attribute::EndAttrKinds, llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::BitCodeAbbrevOp::Fixed, llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::Type::FunctionTyID, llvm::PointerType::getAddressSpace(), llvm::ValueEnumerator::getAttributeGroupID(), llvm::ValueEnumerator::getAttributeGroups(), llvm::ValueEnumerator::getAttributeLists(), llvm::AttributeList::getAttributes(), getBitWidth(), llvm::SequentialType::getElementType(), llvm::PointerType::getElementType(), llvm::StructType::getName(), llvm::SequentialType::getNumElements(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getParamType(), llvm::FunctionType::getReturnType(), llvm::Type::getTypeID(), llvm::ValueEnumerator::getTypeID(), llvm::ValueEnumerator::getTypes(), llvm::Type::HalfTyID, llvm::AttributeSet::hasAttributes(), I, llvm::Attribute::InaccessibleMemOnly, llvm::Attribute::InaccessibleMemOrArgMemOnly, llvm::Attribute::InAlloca, llvm::AttributeList::index_begin(), llvm::AttributeList::index_end(), llvm::Attribute::InlineHint, llvm::Attribute::InReg, llvm::Type::IntegerTyID, llvm::StructType::isLiteral(), llvm::StructType::isOpaque(), llvm::StructType::isPacked(), llvm::FunctionType::isVarArg(), llvm::Attribute::JumpTable, Kind, llvm::Type::LabelTyID, llvm_unreachable, llvm::Type::MetadataTyID, llvm::Attribute::MinSize, llvm::Attribute::Naked, llvm::Attribute::Nest, llvm::Attribute::NoAlias, llvm::Attribute::NoBuiltin, llvm::Attribute::NoCapture, llvm::Attribute::NoCfCheck, llvm::Attribute::NoDuplicate, llvm::Attribute::NoImplicitFloat, llvm::Attribute::NoInline, llvm::Attribute::None, llvm::Attribute::NonLazyBind, llvm::Attribute::NonNull, llvm::Attribute::NoRecurse, llvm::Attribute::NoRedZone, llvm::Attribute::NoReturn, llvm::Attribute::NoUnwind, llvm::Attribute::OptForFuzzing, llvm::Attribute::OptimizeForSize, llvm::Attribute::OptimizeNone, llvm::bitc::PARAMATTR_BLOCK_ID, llvm::bitc::PARAMATTR_CODE_ENTRY, llvm::bitc::PARAMATTR_GROUP_BLOCK_ID, llvm::bitc::PARAMATTR_GRP_CODE_ENTRY, llvm::Type::PointerTyID, llvm::Type::PPC_FP128TyID, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Attribute::ReadNone, llvm::Attribute::ReadOnly, llvm::Attribute::Returned, llvm::Attribute::ReturnsTwice, llvm::Attribute::SafeStack, llvm::Attribute::SanitizeAddress, llvm::Attribute::SanitizeHWAddress, llvm::Attribute::SanitizeMemory, llvm::Attribute::SanitizeThread, llvm::Attribute::SExt, llvm::Attribute::ShadowCallStack, llvm::Attribute::Speculatable, llvm::Attribute::SpeculativeLoadHardening, llvm::ARM_MB::ST, llvm::Attribute::StackAlignment, llvm::Attribute::StackProtect, llvm::Attribute::StackProtectReq, llvm::Attribute::StackProtectStrong, llvm::Attribute::StrictFP, llvm::Attribute::StructRet, llvm::Type::StructTyID, llvm::Attribute::SwiftError, llvm::Attribute::SwiftSelf, T, llvm::Type::TokenTyID, llvm::bitc::TYPE_BLOCK_ID_NEW, llvm::bitc::TYPE_CODE_ARRAY, llvm::bitc::TYPE_CODE_DOUBLE, llvm::bitc::TYPE_CODE_FLOAT, llvm::bitc::TYPE_CODE_FP128, llvm::bitc::TYPE_CODE_FUNCTION, llvm::bitc::TYPE_CODE_HALF, llvm::bitc::TYPE_CODE_INTEGER, llvm::bitc::TYPE_CODE_LABEL, llvm::bitc::TYPE_CODE_METADATA, llvm::bitc::TYPE_CODE_NUMENTRY, llvm::bitc::TYPE_CODE_OPAQUE, llvm::bitc::TYPE_CODE_POINTER, llvm::bitc::TYPE_CODE_PPC_FP128, llvm::bitc::TYPE_CODE_STRUCT_ANON, llvm::bitc::TYPE_CODE_STRUCT_NAME, llvm::bitc::TYPE_CODE_STRUCT_NAMED, llvm::bitc::TYPE_CODE_TOKEN, llvm::bitc::TYPE_CODE_VECTOR, llvm::bitc::TYPE_CODE_VOID, llvm::bitc::TYPE_CODE_X86_FP80, llvm::bitc::TYPE_CODE_X86_MMX, llvm::Attribute::UWTable, llvm::BitCodeAbbrevOp::VBR, llvm::Type::VectorTyID, llvm::Type::VoidTyID, llvm::Attribute::WriteOnly, writeStringRecord(), llvm::Type::X86_FP80TyID, llvm::Type::X86_MMXTyID, and llvm::Attribute::ZExt.

◆ 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

◆ getEncodedGVarFlags()

static uint64_t getEncodedGVarFlags ( GlobalVarSummary::GVarFlags  Flags)
static

Definition at line 1003 of file BitcodeWriter.cpp.

References llvm::GlobalVarSummary::GVarFlags::ReadOnly.

Referenced by writeTypeIdSummaryRecord().

◆ getEncodedGVSummaryFlags()

static uint64_t getEncodedGVSummaryFlags ( GlobalValueSummary::GVFlags  Flags)
static

◆ getEncodedLinkage() [1/2]

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

◆ getEncodedLinkage() [2/2]

static unsigned getEncodedLinkage ( const GlobalValue GV)
static

Definition at line 973 of file BitcodeWriter.cpp.

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

◆ getEncodedOrdering()

static unsigned getEncodedOrdering ( AtomicOrdering  Ordering)
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 518 of file BitcodeWriter.cpp.

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

Referenced by emitSignedInt64().

◆ getEncodedUnnamedAddr()

static unsigned getEncodedUnnamedAddr ( const GlobalValue GV)
static

◆ 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

◆ getStringEncoding()

static StringEncoding getStringEncoding ( StringRef  Str)
static

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

Definition at line 1109 of file BitcodeWriter.cpp.

References llvm::AArch64CC::AL, llvm::BitCodeAbbrevOp::Array, llvm::tgtok::Bits, C, llvm::BitCodeAbbrevOp::Char6, llvm::SmallVectorImpl< T >::clear(), llvm::GlobalValue::DefaultStorageClass, llvm::GlobalValue::DefaultVisibility, llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitRecord(), F(), llvm::BitCodeAbbrevOp::Fixed, llvm::AttributeList::FunctionIndex, llvm::ValueEnumerator::getAttributeListID(), llvm::ValueEnumerator::getComdatID(), llvm::Module::getDataLayoutStr(), getEncodedDLLStorageClass(), getEncodedLinkage(), getEncodedThreadLocalMode(), getEncodedUnnamedAddr(), getEncodedVisibility(), llvm::Module::getModuleInlineAsm(), llvm::Module::getTargetTriple(), llvm::ValueEnumerator::getTypeID(), llvm::ValueEnumerator::getValueID(), llvm::Module::globals(), I, llvm::BitCodeAbbrevOp::isChar6(), llvm::Log2_32(), llvm::Log2_32_Ceil(), llvm::max(), llvm::bitc::MODULE_CODE_ALIAS, llvm::bitc::MODULE_CODE_ASM, llvm::bitc::MODULE_CODE_DATALAYOUT, llvm::bitc::MODULE_CODE_FUNCTION, llvm::bitc::MODULE_CODE_GCNAME, llvm::bitc::MODULE_CODE_GLOBALVAR, llvm::bitc::MODULE_CODE_IFUNC, llvm::bitc::MODULE_CODE_SECTIONNAME, llvm::bitc::MODULE_CODE_SOURCE_FILENAME, llvm::bitc::MODULE_CODE_TRIPLE, llvm::GlobalValue::None, P, llvm::SmallVectorTemplateBase< T >::push_back(), SE_Char6, SE_Fixed7, SE_Fixed8, llvm::BitCodeAbbrevOp::VBR, and writeStringRecord().

Referenced by emitSignedInt64(), and llvm::WriteIndexToFile().

◆ rotateSign()

static uint64_t rotateSign ( int64_t  I)
static

Definition at line 1473 of file BitcodeWriter.cpp.

References llvm::SmallString< InternalLen >::append(), llvm::SmallVectorImpl< T >::append(), llvm::BitCodeAbbrevOp::Array, assert(), llvm::BitCodeAbbrevOp::Blob, llvm::StringRef::bytes_begin(), llvm::StringRef::bytes_end(), llvm::SmallVectorImpl< T >::clear(), llvm::DIExpression::elements_begin(), llvm::DIExpression::elements_end(), llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitRecord(), llvm::BitstreamWriter::EmitRecordWithBlob(), llvm::BitstreamWriter::EmitVBR(), llvm::ArrayRef< T >::empty(), llvm::BitCodeAbbrevOp::Fixed, llvm::BitstreamWriter::FlushToWord(), llvm::DITypeRefArray::get(), llvm::MDNode::get(), llvm::DIType::getAlignInBits(), llvm::DIVariable::getAlignInBits(), llvm::DILocalVariable::getArg(), llvm::DIObjCProperty::getAttributes(), llvm::DICompositeType::getBaseType(), llvm::DISubroutineType::getCC(), llvm::DILexicalBlock::getColumn(), llvm::DICompileUnit::getDebugInfoForProfiling(), llvm::DICompositeType::getDiscriminator(), llvm::DILexicalBlockFile::getDiscriminator(), llvm::DICompileUnit::getDWOId(), llvm::DICompositeType::getElements(), llvm::DIExpression::getElements(), llvm::DIMacroFile::getElements(), llvm::DICompileUnit::getEmissionKind(), llvm::DIBasicType::getEncoding(), llvm::DIImportedEntity::getEntity(), llvm::DICompileUnit::getEnumTypes(), llvm::DINamespace::getExportSymbols(), llvm::DIGlobalVariableExpression::getExpression(), llvm::DIScope::getFile(), llvm::DIVariable::getFile(), llvm::DILabel::getFile(), llvm::DIObjCProperty::getFile(), llvm::DIMacroFile::getFile(), llvm::DIType::getFlags(), llvm::DILocalVariable::getFlags(), llvm::DICompileUnit::getGlobalVariables(), llvm::DICompileUnit::getImportedEntities(), llvm::DIType::getLine(), llvm::DILexicalBlock::getLine(), llvm::DIVariable::getLine(), llvm::DILabel::getLine(), llvm::DIObjCProperty::getLine(), llvm::DIImportedEntity::getLine(), llvm::DIMacro::getLine(), llvm::DIMacroFile::getLine(), llvm::DIMacroNode::getMacinfoType(), llvm::DICompileUnit::getMacros(), llvm::ValueEnumerator::getMetadataID(), llvm::ValueEnumerator::getMetadataOrNullID(), llvm::DICompileUnit::getNameTableKind(), llvm::DIType::getOffsetInBits(), llvm::DIImportedEntity::getRawFile(), llvm::DICompileUnit::getRawFlags(), llvm::DIObjCProperty::getRawGetterName(), llvm::DICompositeType::getRawIdentifier(), llvm::DIGlobalVariable::getRawLinkageName(), llvm::DIEnumerator::getRawName(), llvm::DIType::getRawName(), llvm::DINamespace::getRawName(), llvm::DITemplateParameter::getRawName(), llvm::DIVariable::getRawName(), llvm::DILabel::getRawName(), llvm::DIObjCProperty::getRawName(), llvm::DIImportedEntity::getRawName(), llvm::DIMacro::getRawName(), llvm::DICompileUnit::getRawProducer(), llvm::DIObjCProperty::getRawSetterName(), llvm::DICompileUnit::getRawSplitDebugFilename(), llvm::DIMacro::getRawValue(), llvm::DICompileUnit::getRetainedTypes(), llvm::DICompositeType::getRuntimeLang(), llvm::DICompileUnit::getRuntimeVersion(), llvm::DIScope::getScope(), llvm::DIType::getScope(), llvm::DILexicalBlockBase::getScope(), llvm::DINamespace::getScope(), llvm::DIVariable::getScope(), llvm::DILocalVariable::getScope(), llvm::DILabel::getScope(), llvm::DIImportedEntity::getScope(), llvm::DIType::getSizeInBits(), llvm::DICompileUnit::getSourceLanguage(), llvm::DICompileUnit::getSplitDebugInlining(), llvm::DIGlobalVariable::getStaticDataMemberDeclaration(), llvm::DINode::getTag(), llvm::DICompositeType::getTemplateParams(), llvm::DIGlobalVariable::getTemplateParams(), llvm::DITemplateParameter::getType(), llvm::DIVariable::getType(), llvm::DIObjCProperty::getType(), llvm::DISubroutineType::getTypeArray(), llvm::DIEnumerator::getValue(), llvm::DITemplateValueParameter::getValue(), llvm::DIGlobalVariableExpression::getVariable(), llvm::DICompositeType::getVTableHolder(), I, llvm::DIGlobalVariable::isDefinition(), llvm::MDNode::isDistinct(), llvm::DIGlobalVariable::isLocalToUnit(), llvm::DICompileUnit::isOptimized(), llvm::DIEnumerator::isUnsigned(), llvm::bitc::METADATA_BASIC_TYPE, llvm::bitc::METADATA_COMPILE_UNIT, llvm::bitc::METADATA_COMPOSITE_TYPE, llvm::bitc::METADATA_DERIVED_TYPE, llvm::bitc::METADATA_ENUMERATOR, llvm::bitc::METADATA_EXPRESSION, llvm::bitc::METADATA_FILE, llvm::bitc::METADATA_GLOBAL_VAR, llvm::bitc::METADATA_GLOBAL_VAR_EXPR, llvm::bitc::METADATA_IMPORTED_ENTITY, llvm::bitc::METADATA_LABEL, llvm::bitc::METADATA_LEXICAL_BLOCK, llvm::bitc::METADATA_LEXICAL_BLOCK_FILE, llvm::bitc::METADATA_LOCAL_VAR, llvm::bitc::METADATA_MACRO, llvm::bitc::METADATA_MACRO_FILE, llvm::bitc::METADATA_MODULE, llvm::bitc::METADATA_NAME, llvm::bitc::METADATA_NAMED_NODE, llvm::bitc::METADATA_NAMESPACE, llvm::bitc::METADATA_OBJC_PROPERTY, llvm::bitc::METADATA_STRINGS, llvm::bitc::METADATA_SUBPROGRAM, llvm::bitc::METADATA_SUBRANGE, llvm::bitc::METADATA_SUBROUTINE_TYPE, llvm::bitc::METADATA_TEMPLATE_TYPE, llvm::bitc::METADATA_TEMPLATE_VALUE, llvm::Module::named_metadata(), llvm::Module::named_metadata_empty(), llvm::MDNode::operands(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::SmallVectorBase::size(), llvm::ArrayRef< T >::size(), llvm::Sched::Source, llvm::BitCodeAbbrevOp::VBR, llvm::IndexedInstrProf::Version, llvm::RISCVFenceField::W, writeDIBasicType(), writeDICompileUnit(), writeDICompositeType(), writeDIDerivedType(), writeDIEnumerator(), writeDIExpression(), writeDIFile(), writeDIGlobalVariable(), writeDIGlobalVariableExpression(), writeDIImportedEntity(), writeDILabel(), writeDILexicalBlock(), writeDILexicalBlockFile(), writeDILocalVariable(), writeDIMacro(), writeDIMacroFile(), writeDIModule(), writeDINamespace(), writeDIObjCProperty(), writeDISubprogram(), writeDISubrange(), writeDISubroutineType(), writeDITemplateTypeParameter(), and writeDITemplateValueParameter().

◆ writeBitcodeHeader()

static void writeBitcodeHeader ( BitstreamWriter Stream)
static

Helper to write the header common to all bitcode files.

Definition at line 4173 of file BitcodeWriter.cpp.

References llvm::BitstreamWriter::Emit().

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

◆ writeFunctionTypeMetadataRecords()

static void writeFunctionTypeMetadataRecords ( BitstreamWriter Stream,
FunctionSummary FS 
)
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 4107 of file BitcodeWriter.cpp.

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

Referenced by emitDarwinBCHeaderAndTrailer().

◆ writeStringRecord()

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

◆ writeTypeIdSummaryRecord()

static void writeTypeIdSummaryRecord ( SmallVector< uint64_t, 64 > &  NameVals,
StringTableBuilder StrtabBuilder,
const std::string &  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

◆ ForceSummaryEdgesCold

Definition at line 64 of file ModuleSummaryAnalysis.cpp.

Referenced by computeFunctionSummary().

◆ INDEX_VERSION

const uint64_t INDEX_VERSION = 6
static

Definition at line 3604 of file BitcodeWriter.cpp.

◆ 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"))
static

◆ WriteRelBFToSummary

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