LLVM API Documentation
#include "llvm/Bitcode/ReaderWriter.h"
#include "ValueEnumerator.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Bitcode/BitstreamWriter.h"
#include "llvm/Bitcode/LLVMBitCodes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/UseListOrder.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/raw_ostream.h"
#include <cctype>
#include <map>
Go to the source code of this file.
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 38 of file BitcodeWriter.cpp.
anonymous enum |
EmitDarwinBCHeader - 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 1940 of file BitcodeWriter.cpp.
static void EmitDarwinBCHeaderAndTrailer | ( | SmallVectorImpl< char > & | Buffer, |
const Triple & | TT | ||
) | [static] |
Definition at line 1954 of file BitcodeWriter.cpp.
References llvm::Triple::arm, DarwinBCHeaderSize, llvm::Triple::getArch(), llvm::Triple::ppc, llvm::Triple::ppc64, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::Triple::thumb, WriteInt32ToBuffer(), llvm::Triple::x86, and llvm::Triple::x86_64.
Referenced by llvm::WriteBitcodeToFile().
static void emitSignedInt64 | ( | SmallVectorImpl< uint64_t > & | Vals, |
uint64_t | V | ||
) | [static] |
Definition at line 902 of file BitcodeWriter.cpp.
References llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by pushValueSigned(), and WriteConstants().
static uint64_t getAttrKindEncoding | ( | Attribute::AttrKind | Kind | ) | [static] |
Definition at line 157 of file BitcodeWriter.cpp.
References llvm::Attribute::Alignment, llvm::Attribute::AlwaysInline, llvm::bitc::ATTR_KIND_ALIGNMENT, llvm::bitc::ATTR_KIND_ALWAYS_INLINE, llvm::bitc::ATTR_KIND_BUILTIN, llvm::bitc::ATTR_KIND_BY_VAL, llvm::bitc::ATTR_KIND_COLD, llvm::bitc::ATTR_KIND_DEREFERENCEABLE, llvm::bitc::ATTR_KIND_IN_ALLOCA, llvm::bitc::ATTR_KIND_IN_REG, 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_RED_ZONE, llvm::bitc::ATTR_KIND_NO_RETURN, llvm::bitc::ATTR_KIND_NO_UNWIND, llvm::bitc::ATTR_KIND_NON_LAZY_BIND, llvm::bitc::ATTR_KIND_NON_NULL, 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_SANITIZE_ADDRESS, llvm::bitc::ATTR_KIND_SANITIZE_MEMORY, llvm::bitc::ATTR_KIND_SANITIZE_THREAD, 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_STRUCT_RET, llvm::bitc::ATTR_KIND_UW_TABLE, llvm::bitc::ATTR_KIND_Z_EXT, llvm::Attribute::Builtin, llvm::Attribute::ByVal, llvm::Attribute::Cold, llvm::Attribute::Dereferenceable, llvm::Attribute::EndAttrKinds, llvm::Attribute::InAlloca, llvm::Attribute::InlineHint, llvm::Attribute::InReg, llvm::Attribute::JumpTable, llvm_unreachable, llvm::Attribute::MinSize, llvm::Attribute::Naked, llvm::Attribute::Nest, llvm::Attribute::NoAlias, llvm::Attribute::NoBuiltin, llvm::Attribute::NoCapture, llvm::Attribute::NoDuplicate, llvm::Attribute::NoImplicitFloat, llvm::Attribute::NoInline, llvm::Attribute::None, llvm::Attribute::NonLazyBind, llvm::Attribute::NonNull, llvm::Attribute::NoRedZone, llvm::Attribute::NoReturn, llvm::Attribute::NoUnwind, llvm::Attribute::OptimizeForSize, llvm::Attribute::OptimizeNone, llvm::Attribute::ReadNone, llvm::Attribute::ReadOnly, llvm::Attribute::Returned, llvm::Attribute::ReturnsTwice, llvm::Attribute::SanitizeAddress, llvm::Attribute::SanitizeMemory, llvm::Attribute::SanitizeThread, llvm::Attribute::SExt, llvm::Attribute::StackAlignment, llvm::Attribute::StackProtect, llvm::Attribute::StackProtectReq, llvm::Attribute::StackProtectStrong, llvm::Attribute::StructRet, llvm::Attribute::UWTable, and llvm::Attribute::ZExt.
Referenced by WriteAttributeGroupTable().
static unsigned GetEncodedBinaryOpcode | ( | unsigned | Opcode | ) | [static] |
Definition at line 80 of file BitcodeWriter.cpp.
References llvm::APIntOps::And(), llvm::bitc::BINOP_ADD, llvm::bitc::BINOP_AND, llvm::bitc::BINOP_ASHR, llvm::bitc::BINOP_LSHR, llvm::bitc::BINOP_MUL, llvm::bitc::BINOP_OR, llvm::bitc::BINOP_SDIV, llvm::bitc::BINOP_SHL, llvm::bitc::BINOP_SREM, llvm::bitc::BINOP_SUB, llvm::bitc::BINOP_UDIV, llvm::bitc::BINOP_UREM, llvm::bitc::BINOP_XOR, llvm_unreachable, llvm::LShr, llvm::APIntOps::Or(), and llvm::APIntOps::Xor().
Referenced by WriteConstants(), and WriteInstruction().
static unsigned GetEncodedCastOpcode | ( | unsigned | Opcode | ) | [static] |
Definition at line 61 of file BitcodeWriter.cpp.
References llvm::AddrSpaceCast, llvm::bitc::CAST_ADDRSPACECAST, llvm::bitc::CAST_BITCAST, llvm::bitc::CAST_FPEXT, llvm::bitc::CAST_FPTOSI, llvm::bitc::CAST_FPTOUI, llvm::bitc::CAST_FPTRUNC, llvm::bitc::CAST_INTTOPTR, llvm::bitc::CAST_PTRTOINT, llvm::bitc::CAST_SEXT, llvm::bitc::CAST_SITOFP, llvm::bitc::CAST_TRUNC, llvm::bitc::CAST_UITOFP, llvm::bitc::CAST_ZEXT, llvm::FPExt, llvm::FPToSI, llvm::IntToPtr, llvm_unreachable, llvm::SExt, llvm::SIToFP, and llvm::Trunc.
Referenced by WriteConstants(), and WriteInstruction().
static unsigned getEncodedComdatSelectionKind | ( | const Comdat & | C | ) | [static] |
Definition at line 524 of file BitcodeWriter.cpp.
References llvm::Comdat::Any, llvm::bitc::COMDAT_SELECTION_KIND_ANY, llvm::bitc::COMDAT_SELECTION_KIND_EXACT_MATCH, llvm::bitc::COMDAT_SELECTION_KIND_LARGEST, llvm::bitc::COMDAT_SELECTION_KIND_NO_DUPLICATES, llvm::bitc::COMDAT_SELECTION_KIND_SAME_SIZE, llvm::Comdat::ExactMatch, llvm::Comdat::getSelectionKind(), llvm::Comdat::Largest, llvm_unreachable, llvm::Comdat::NoDuplicates, and llvm::Comdat::SameSize.
Referenced by writeComdats().
static unsigned getEncodedDLLStorageClass | ( | const GlobalValue & | GV | ) | [static] |
Definition at line 504 of file BitcodeWriter.cpp.
References llvm::GlobalValue::DefaultStorageClass, llvm::GlobalValue::DLLExportStorageClass, llvm::GlobalValue::DLLImportStorageClass, llvm::GlobalValue::getDLLStorageClass(), and llvm_unreachable.
Referenced by WriteModuleInfo().
static unsigned getEncodedLinkage | ( | const GlobalValue & | GV | ) | [static] |
Definition at line 478 of file BitcodeWriter.cpp.
References llvm::GlobalValue::AppendingLinkage, llvm::GlobalValue::AvailableExternallyLinkage, llvm::GlobalValue::CommonLinkage, llvm::GlobalValue::ExternalLinkage, llvm::GlobalValue::ExternalWeakLinkage, llvm::GlobalValue::getLinkage(), llvm::GlobalValue::InternalLinkage, llvm::GlobalValue::LinkOnceAnyLinkage, llvm::GlobalValue::LinkOnceODRLinkage, llvm_unreachable, llvm::GlobalValue::PrivateLinkage, llvm::GlobalValue::WeakAnyLinkage, and llvm::GlobalValue::WeakODRLinkage.
Referenced by WriteModuleInfo().
static unsigned GetEncodedOrdering | ( | AtomicOrdering | Ordering | ) | [static] |
Definition at line 121 of file BitcodeWriter.cpp.
References llvm::Acquire, llvm::AcquireRelease, llvm_unreachable, llvm::Monotonic, llvm::NotAtomic, llvm::bitc::ORDERING_ACQREL, llvm::bitc::ORDERING_ACQUIRE, llvm::bitc::ORDERING_MONOTONIC, llvm::bitc::ORDERING_NOTATOMIC, llvm::bitc::ORDERING_RELEASE, llvm::bitc::ORDERING_SEQCST, llvm::bitc::ORDERING_UNORDERED, llvm::Release, llvm::SequentiallyConsistent, and llvm::Unordered.
Referenced by WriteInstruction().
static unsigned GetEncodedRMWOperation | ( | AtomicRMWInst::BinOp | Op | ) | [static] |
Definition at line 104 of file BitcodeWriter.cpp.
References llvm::AtomicRMWInst::Add, llvm::AtomicRMWInst::And, llvm_unreachable, llvm::AtomicRMWInst::Max, llvm::AtomicRMWInst::Min, llvm::AtomicRMWInst::Nand, llvm::AtomicRMWInst::Or, llvm::bitc::RMW_ADD, llvm::bitc::RMW_AND, llvm::bitc::RMW_MAX, llvm::bitc::RMW_MIN, llvm::bitc::RMW_NAND, llvm::bitc::RMW_OR, llvm::bitc::RMW_SUB, llvm::bitc::RMW_UMAX, llvm::bitc::RMW_UMIN, llvm::bitc::RMW_XCHG, llvm::bitc::RMW_XOR, llvm::AtomicRMWInst::Sub, llvm::AtomicRMWInst::UMax, llvm::AtomicRMWInst::UMin, llvm::AtomicRMWInst::Xchg, and llvm::AtomicRMWInst::Xor.
Referenced by WriteInstruction().
static unsigned GetEncodedSynchScope | ( | SynchronizationScope | SynchScope | ) | [static] |
Definition at line 134 of file BitcodeWriter.cpp.
References llvm::CrossThread, llvm_unreachable, llvm::SingleThread, llvm::bitc::SYNCHSCOPE_CROSSTHREAD, and llvm::bitc::SYNCHSCOPE_SINGLETHREAD.
Referenced by WriteInstruction().
static unsigned getEncodedThreadLocalMode | ( | const GlobalValue & | GV | ) | [static] |
Definition at line 513 of file BitcodeWriter.cpp.
References llvm::GlobalValue::GeneralDynamicTLSModel, llvm::GlobalValue::getThreadLocalMode(), llvm::GlobalValue::InitialExecTLSModel, llvm_unreachable, llvm::GlobalValue::LocalDynamicTLSModel, llvm::GlobalValue::LocalExecTLSModel, and llvm::GlobalValue::NotThreadLocal.
Referenced by WriteModuleInfo().
static unsigned getEncodedVisibility | ( | const GlobalValue & | GV | ) | [static] |
Definition at line 495 of file BitcodeWriter.cpp.
References llvm::GlobalValue::DefaultVisibility, llvm::GlobalValue::getVisibility(), llvm::GlobalValue::HiddenVisibility, llvm_unreachable, and llvm::GlobalValue::ProtectedVisibility.
Referenced by WriteModuleInfo().
static uint64_t GetOptimizationFlags | ( | const Value * | V | ) | [static] |
Definition at line 710 of file BitcodeWriter.cpp.
References llvm::FastMathFlags::AllowReciprocal, llvm::FastMathFlags::NoInfs, llvm::FastMathFlags::NoNaNs, llvm::FastMathFlags::NoSignedZeros, llvm::bitc::OBO_NO_SIGNED_WRAP, llvm::bitc::OBO_NO_UNSIGNED_WRAP, llvm::bitc::PEO_EXACT, and llvm::FastMathFlags::UnsafeAlgebra.
Referenced by WriteConstants(), and WriteInstruction().
static void pushValue | ( | const Value * | V, |
unsigned | InstID, | ||
SmallVectorImpl< unsigned > & | Vals, | ||
ValueEnumerator & | VE | ||
) | [static] |
pushValue - Like PushValueAndType, but where the type of the value is omitted (perhaps it was already encoded in an earlier operand).
Definition at line 1211 of file BitcodeWriter.cpp.
References llvm::ValueEnumerator::getValueID(), and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by WriteInstruction().
static bool PushValueAndType | ( | const Value * | V, |
unsigned | InstID, | ||
SmallVectorImpl< unsigned > & | Vals, | ||
ValueEnumerator & | VE | ||
) | [static] |
PushValueAndType - The file has to encode both the value and type id for many values, because we need to know what type to create for forward references. However, most operands are not forward references, so this type field is not needed.
This function adds V's value ID to Vals. If the value ID is higher than the instruction ID, then it is a forward reference, and it also includes the type ID. The value ID that is written is encoded relative to the InstID.
Definition at line 1196 of file BitcodeWriter.cpp.
References llvm::Value::getType(), llvm::ValueEnumerator::getTypeID(), llvm::ValueEnumerator::getValueID(), and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by WriteInstruction().
static void pushValueSigned | ( | const Value * | V, |
unsigned | InstID, | ||
SmallVectorImpl< uint64_t > & | Vals, | ||
ValueEnumerator & | VE | ||
) | [static] |
Definition at line 1218 of file BitcodeWriter.cpp.
References emitSignedInt64(), and llvm::ValueEnumerator::getValueID().
Referenced by WriteInstruction().
static void WriteAttributeGroupTable | ( | const ValueEnumerator & | VE, |
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 250 of file BitcodeWriter.cpp.
References llvm::ARM_PROC::A, llvm::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::AttributeSet::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitRecord(), llvm::StringRef::empty(), llvm::StringRef::end(), llvm::AttributeSet::end(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::ValueEnumerator::getAttributeGroupID(), llvm::ValueEnumerator::getAttributeGroups(), getAttrKindEncoding(), llvm::Attribute::getKindAsEnum(), llvm::Attribute::getKindAsString(), llvm::AttributeSet::getNumSlots(), llvm::AttributeSet::getSlotAttributes(), llvm::AttributeSet::getSlotIndex(), llvm::Attribute::getValueAsInt(), llvm::Attribute::getValueAsString(), I, llvm::Attribute::isEnumAttribute(), llvm::Attribute::isIntAttribute(), llvm::bitc::PARAMATTR_GROUP_BLOCK_ID, llvm::bitc::PARAMATTR_GRP_CODE_ENTRY, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by WriteModule().
static void WriteAttributeTable | ( | const ValueEnumerator & | VE, |
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 298 of file BitcodeWriter.cpp.
References llvm::ARM_PROC::A, llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitRecord(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::ValueEnumerator::getAttributeGroupID(), llvm::ValueEnumerator::getAttributes(), llvm::AttributeSet::getNumSlots(), llvm::AttributeSet::getSlotAttributes(), llvm::bitc::PARAMATTR_BLOCK_ID, llvm::bitc::PARAMATTR_CODE_ENTRY, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by WriteModule().
static void WriteBlockInfo | ( | const ValueEnumerator & | VE, |
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 1713 of file BitcodeWriter.cpp.
References llvm::BitCodeAbbrev::Add(), llvm::BitCodeAbbrevOp::Array, llvm::BitCodeAbbrevOp::Char6, llvm::bitc::CONSTANTS_BLOCK_ID, CONSTANTS_CE_CAST_Abbrev, CONSTANTS_INTEGER_ABBREV, CONSTANTS_NULL_Abbrev, CONSTANTS_SETTYPE_ABBREV, llvm::bitc::CST_CODE_CE_CAST, llvm::bitc::CST_CODE_INTEGER, llvm::bitc::CST_CODE_NULL, llvm::bitc::CST_CODE_SETTYPE, llvm::BitstreamWriter::EmitBlockInfoAbbrev(), llvm::BitstreamWriter::EnterBlockInfoBlock(), llvm::BitstreamWriter::ExitBlock(), llvm::BitCodeAbbrevOp::Fixed, llvm::bitc::FUNC_CODE_INST_BINOP, llvm::bitc::FUNC_CODE_INST_CAST, llvm::bitc::FUNC_CODE_INST_LOAD, llvm::bitc::FUNC_CODE_INST_RET, llvm::bitc::FUNC_CODE_INST_UNREACHABLE, llvm::bitc::FUNCTION_BLOCK_ID, FUNCTION_INST_BINOP_ABBREV, FUNCTION_INST_BINOP_FLAGS_ABBREV, FUNCTION_INST_CAST_ABBREV, FUNCTION_INST_LOAD_ABBREV, FUNCTION_INST_RET_VAL_ABBREV, FUNCTION_INST_RET_VOID_ABBREV, FUNCTION_INST_UNREACHABLE_ABBREV, llvm::ValueEnumerator::getTypes(), llvm_unreachable, llvm::Log2_32_Ceil(), llvm::bitc::VALUE_SYMTAB_BLOCK_ID, llvm::BitCodeAbbrevOp::VBR, VST_BBENTRY_6_ABBREV, llvm::bitc::VST_CODE_BBENTRY, llvm::bitc::VST_CODE_ENTRY, VST_ENTRY_6_ABBREV, VST_ENTRY_7_ABBREV, and VST_ENTRY_8_ABBREV.
Referenced by WriteModule().
static void writeComdats | ( | const ValueEnumerator & | VE, |
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 540 of file BitcodeWriter.cpp.
References llvm::CallingConv::C, llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitRecord(), llvm::ValueEnumerator::getComdats(), getEncodedComdatSelectionKind(), llvm::bitc::MODULE_CODE_COMDAT, and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by WriteModule().
static void WriteConstants | ( | unsigned | FirstVal, |
unsigned | LastVal, | ||
const ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream, | ||
bool | isGlobal | ||
) | [static] |
Definition at line 909 of file BitcodeWriter.cpp.
References llvm::BitCodeAbbrev::Add(), llvm::BitCodeAbbrevOp::Array, llvm::CallingConv::C, llvm::WinEH::CE, llvm::BitCodeAbbrevOp::Char6, llvm::SmallVectorImpl< T >::clear(), llvm::tgtok::Code, llvm::bitc::CONSTANTS_BLOCK_ID, CONSTANTS_CE_CAST_Abbrev, CONSTANTS_INTEGER_ABBREV, CONSTANTS_SETTYPE_ABBREV, 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_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_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(), llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitRecord(), emitSignedInt64(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), ExtractElement(), F(), llvm::FCmp, llvm::BitCodeAbbrevOp::Fixed, llvm::ConstantDataSequential::getElementAsInteger(), GetEncodedBinaryOpcode(), GetEncodedCastOpcode(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::ConstantDataSequential::getNumElements(), llvm::User::getNumOperands(), llvm::User::getOperand(), GetOptimizationFlags(), llvm::APInt::getRawData(), llvm::Value::getType(), llvm::ValueEnumerator::getTypeID(), llvm::ValueEnumerator::getValueID(), llvm::ValueEnumerator::getValues(), I, llvm::InsertElement, llvm::Instruction::isCast(), llvm::BitCodeAbbrevOp::isChar6(), llvm::ConstantDataSequential::isCString(), llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isFP128Ty(), llvm::Type::isHalfTy(), llvm::Constant::isNullValue(), llvm::Type::isPPC_FP128Ty(), llvm::Type::isX86_FP80Ty(), llvm_unreachable, llvm::Log2_32_Ceil(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::MCID::Select.
Referenced by WriteFunction(), and WriteModuleConstants().
static void WriteFunction | ( | const Function & | F, |
ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream | ||
) | [static] |
WriteFunction - Emit a function body to the module stream.
Definition at line 1639 of file BitcodeWriter.cpp.
References llvm::Function::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitRecord(), llvm::Function::end(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::bitc::FUNC_CODE_DEBUG_LOC, llvm::bitc::FUNC_CODE_DEBUG_LOC_AGAIN, llvm::bitc::FUNC_CODE_DECLAREBLOCKS, llvm::bitc::FUNCTION_BLOCK_ID, llvm::ValueEnumerator::getBasicBlocks(), llvm::DebugLoc::getCol(), llvm::ValueEnumerator::getFunctionConstantRange(), llvm::DebugLoc::getLine(), llvm::DebugLoc::getScopeAndInlinedAt(), llvm::ValueEnumerator::getValueID(), llvm::Function::getValueSymbolTable(), I, llvm::ValueEnumerator::incorporateFunction(), llvm::DebugLoc::isUnknown(), llvm::ValueEnumerator::purgeFunction(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::shouldPreserveBitcodeUseListOrder(), WriteConstants(), WriteFunctionLocalMetadata(), WriteInstruction(), WriteMetadataAttachment(), WriteUseListBlock(), and WriteValueSymbolTable().
Referenced by WriteModule().
static void WriteFunctionLocalMetadata | ( | const Function & | F, |
const ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 825 of file BitcodeWriter.cpp.
References llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), F(), llvm::ValueEnumerator::getFunctionLocalMDValues(), llvm::bitc::METADATA_BLOCK_ID, N, llvm::SmallVectorTemplateCommon< T, typename >::size(), and WriteMDNode().
Referenced by WriteFunction().
static void WriteInstruction | ( | const Instruction & | I, |
unsigned | InstID, | ||
ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream, | ||
SmallVectorImpl< unsigned > & | Vals | ||
) | [static] |
WriteInstruction - Emit an instruction to the specified stream.
Definition at line 1227 of file BitcodeWriter.cpp.
References llvm::Alloca, llvm::Call, llvm::SwitchInst::case_begin(), llvm::SwitchInst::case_end(), llvm::LandingPadInst::Catch, llvm::SmallVectorImpl< T >::clear(), llvm::tgtok::Code, llvm::BitstreamWriter::EmitRecord(), ExtractElement(), llvm::ExtractValue, llvm::FCmp, llvm::LandingPadInst::Filter, 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_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_INBOUNDS_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_UNREACHABLE, llvm::bitc::FUNC_CODE_INST_VAARG, llvm::bitc::FUNC_CODE_INST_VSELECT, FUNCTION_INST_BINOP_ABBREV, FUNCTION_INST_BINOP_FLAGS_ABBREV, FUNCTION_INST_CAST_ABBREV, FUNCTION_INST_LOAD_ABBREV, FUNCTION_INST_RET_VAL_ABBREV, FUNCTION_INST_RET_VOID_ABBREV, FUNCTION_INST_UNREACHABLE_ABBREV, llvm::AllocaInst::getAlignment(), llvm::CallInst::getArgOperand(), llvm::ValueEnumerator::getAttributeID(), llvm::CallInst::getAttributes(), llvm::InvokeInst::getAttributes(), llvm::CallInst::getCalledValue(), llvm::InvokeInst::getCalledValue(), llvm::CallInst::getCallingConv(), llvm::InvokeInst::getCallingConv(), llvm::LandingPadInst::getClause(), llvm::BranchInst::getCondition(), llvm::SwitchInst::getCondition(), llvm::SwitchInst::getDefaultDest(), GetEncodedBinaryOpcode(), GetEncodedCastOpcode(), GetEncodedOrdering(), GetEncodedRMWOperation(), GetEncodedSynchScope(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::InvokeInst::getNormalDest(), llvm::CallInst::getNumArgOperands(), llvm::LandingPadInst::getNumClauses(), llvm::PHINode::getNumIncomingValues(), llvm::User::getNumOperands(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), GetOptimizationFlags(), llvm::LandingPadInst::getPersonalityFn(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::ValueEnumerator::getTypeID(), llvm::InvokeInst::getUnwindDest(), llvm::ValueEnumerator::getValueID(), I, llvm::InsertElement, isAtomic(), llvm::Instruction::isCast(), llvm::LandingPadInst::isCatch(), llvm::LandingPadInst::isCleanup(), llvm::BranchInst::isConditional(), llvm::CallInst::isMustTailCall(), llvm::CallInst::isTailCall(), llvm::AllocaInst::isUsedWithInAlloca(), llvm::LandingPad, llvm::SPII::Load, llvm::Log2_32(), llvm::Value::MaximumAlignment, llvm::TargetOpcode::PHI, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), pushValue(), PushValueAndType(), pushValueSigned(), llvm::MipsISD::Ret, llvm::MCID::Select, llvm::ValueEnumerator::setInstructionID(), llvm::SPII::Store, and llvm::VAArg.
Referenced by WriteFunction().
static void WriteInt32ToBuffer | ( | uint32_t | Value, |
SmallVectorImpl< char > & | Buffer, | ||
uint32_t & | Position | ||
) | [static] |
Definition at line 1945 of file BitcodeWriter.cpp.
Referenced by EmitDarwinBCHeaderAndTrailer().
static void WriteMDNode | ( | const MDNode * | N, |
const ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream, | ||
SmallVectorImpl< uint64_t > & | Record | ||
) | [static] |
Definition at line 740 of file BitcodeWriter.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitRecord(), llvm::Value::getContext(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), llvm::Value::getType(), llvm::ValueEnumerator::getTypeID(), llvm::ValueEnumerator::getValueID(), llvm::Type::getVoidTy(), llvm::MDNode::isFunctionLocal(), llvm::bitc::METADATA_FN_NODE, llvm::bitc::METADATA_NODE, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by WriteFunctionLocalMetadata(), and WriteModuleMetadata().
static void WriteMetadataAttachment | ( | const Function & | F, |
const ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 845 of file BitcodeWriter.cpp.
References llvm::Function::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitRecord(), llvm::SmallVectorBase::empty(), llvm::Function::end(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::ValueEnumerator::getInstructionID(), llvm::ValueEnumerator::getValueID(), I, llvm::bitc::METADATA_ATTACHMENT, llvm::bitc::METADATA_ATTACHMENT_ID, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by WriteFunction().
static void WriteModule | ( | const Module * | M, |
BitstreamWriter & | Stream | ||
) | [static] |
WriteModule - Emit the specified module to the bitstream.
Definition at line 1874 of file BitcodeWriter.cpp.
References llvm::Module::begin(), llvm::BitstreamWriter::EmitRecord(), llvm::Module::end(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), F(), llvm::Module::getValueSymbolTable(), llvm::bitc::MODULE_BLOCK_ID, llvm::bitc::MODULE_CODE_VERSION, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::shouldPreserveBitcodeUseListOrder(), WriteAttributeGroupTable(), WriteAttributeTable(), WriteBlockInfo(), writeComdats(), WriteFunction(), WriteModuleConstants(), WriteModuleInfo(), WriteModuleMetadata(), WriteModuleMetadataStore(), WriteTypeTable(), WriteUseListBlock(), and WriteValueSymbolTable().
Referenced by llvm::WriteBitcodeToFile().
static void WriteModuleConstants | ( | const ValueEnumerator & | VE, |
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 1174 of file BitcodeWriter.cpp.
References llvm::ValueEnumerator::getValues(), and WriteConstants().
Referenced by WriteModule().
static void WriteModuleInfo | ( | const Module * | M, |
const ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 555 of file BitcodeWriter.cpp.
References llvm::ARM_PROC::A, llvm::BitCodeAbbrev::Add(), llvm::SmallVectorImpl< T >::clear(), llvm::GlobalValue::DefaultStorageClass, llvm::GlobalValue::DefaultVisibility, llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitRecord(), F(), llvm::BitCodeAbbrevOp::Fixed, llvm::ValueEnumerator::getAttributeID(), llvm::ValueEnumerator::getComdatID(), llvm::Module::getDataLayoutStr(), getEncodedDLLStorageClass(), getEncodedLinkage(), getEncodedThreadLocalMode(), getEncodedVisibility(), llvm::Module::getModuleInlineAsm(), llvm::Module::getTargetTriple(), llvm::ValueEnumerator::getTypeID(), llvm::ValueEnumerator::getValueID(), llvm::Module::globals(), llvm::Log2_32(), llvm::Log2_32_Ceil(), 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_SECTIONNAME, llvm::bitc::MODULE_CODE_TRIPLE, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::BitCodeAbbrevOp::VBR, and WriteStringRecord().
Referenced by WriteModule().
static void WriteModuleMetadata | ( | const Module * | M, |
const ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 759 of file BitcodeWriter.cpp.
References llvm::BitCodeAbbrev::Add(), llvm::SmallVectorImpl< T >::append(), llvm::BitCodeAbbrevOp::Array, llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitRecord(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::BitCodeAbbrevOp::Fixed, llvm::ValueEnumerator::getMDValues(), llvm::NamedMDNode::getName(), llvm::NamedMDNode::getNumOperands(), llvm::NamedMDNode::getOperand(), llvm::ValueEnumerator::getValueID(), I, llvm::bitc::METADATA_BLOCK_ID, llvm::bitc::METADATA_NAME, llvm::bitc::METADATA_NAMED_NODE, llvm::bitc::METADATA_STRING, N, llvm::Module::named_metadata_begin(), llvm::Module::named_metadata_end(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::StringRef::size(), and WriteMDNode().
Referenced by WriteModule().
static void WriteModuleMetadataStore | ( | const Module * | M, |
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 878 of file BitcodeWriter.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::BitstreamWriter::EmitRecord(), llvm::SmallVectorBase::empty(), llvm::StringRef::end(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::Module::getMDKindNames(), llvm::bitc::METADATA_BLOCK_ID, llvm::bitc::METADATA_KIND, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by WriteModule().
static void WriteStringRecord | ( | unsigned | Code, |
StringRef | Str, | ||
unsigned | AbbrevToUse, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 142 of file BitcodeWriter.cpp.
References llvm::BitstreamWriter::EmitRecord(), llvm::BitCodeAbbrevOp::isChar6(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::StringRef::size().
Referenced by WriteModuleInfo(), and WriteTypeTable().
static void WriteTypeTable | ( | const ValueEnumerator & | VE, |
BitstreamWriter & | Stream | ||
) | [static] |
WriteTypeTable - Write out the type table for a module.
Definition at line 319 of file BitcodeWriter.cpp.
References llvm::BitCodeAbbrevOp::Array, llvm::Type::ArrayTyID, llvm::BitCodeAbbrevOp::Char6, llvm::SmallVectorImpl< T >::clear(), llvm::tgtok::Code, llvm::Type::DoubleTyID, llvm::StructType::element_begin(), llvm::StructType::element_end(), llvm::BitstreamWriter::EmitAbbrev(), llvm::BitstreamWriter::EmitRecord(), llvm::StringRef::empty(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::BitCodeAbbrevOp::Fixed, llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::Type::FunctionTyID, llvm::PointerType::getAddressSpace(), getBitWidth(), llvm::SequentialType::getElementType(), llvm::StructType::getName(), llvm::ArrayType::getNumElements(), llvm::VectorType::getNumElements(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getParamType(), llvm::FunctionType::getReturnType(), llvm::ValueEnumerator::getTypeID(), llvm::Type::getTypeID(), llvm::ValueEnumerator::getTypes(), llvm::Type::HalfTyID, I, llvm::Type::IntegerTyID, llvm::StructType::isLiteral(), llvm::StructType::isOpaque(), llvm::StructType::isPacked(), llvm::FunctionType::isVarArg(), llvm::Type::LabelTyID, llvm::Log2_32_Ceil(), llvm::Type::MetadataTyID, llvm::Type::PointerTyID, llvm::Type::PPC_FP128TyID, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::AArch64DB::ST, llvm::Type::StructTyID, T, 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_VECTOR, llvm::bitc::TYPE_CODE_VOID, llvm::bitc::TYPE_CODE_X86_FP80, llvm::bitc::TYPE_CODE_X86_MMX, llvm::BitCodeAbbrevOp::VBR, llvm::Type::VectorTyID, llvm::Type::VoidTyID, WriteStringRecord(), llvm::Type::X86_FP80TyID, and llvm::Type::X86_MMXTyID.
Referenced by WriteModule().
static void WriteUseList | ( | ValueEnumerator & | VE, |
UseListOrder && | Order, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 1605 of file BitcodeWriter.cpp.
References llvm::tgtok::Code, llvm::BitstreamWriter::EmitRecord(), llvm::ValueEnumerator::getValueID(), I, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::bitc::USELIST_CODE_BB, and llvm::bitc::USELIST_CODE_DEFAULT.
Referenced by WriteUseListBlock().
static void WriteUseListBlock | ( | const Function * | F, |
ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 1621 of file BitcodeWriter.cpp.
References llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), F(), llvm::bitc::USELIST_BLOCK_ID, llvm::ValueEnumerator::UseListOrders, and WriteUseList().
Referenced by WriteFunction(), and WriteModule().
static void WriteValueSymbolTable | ( | const ValueSymbolTable & | VST, |
const ValueEnumerator & | VE, | ||
BitstreamWriter & | Stream | ||
) | [static] |
Definition at line 1548 of file BitcodeWriter.cpp.
References llvm::ValueSymbolTable::begin(), llvm::CallingConv::C, llvm::SmallVectorImpl< T >::clear(), llvm::tgtok::Code, llvm::BitstreamWriter::EmitRecord(), llvm::ValueSymbolTable::empty(), llvm::ValueSymbolTable::end(), llvm::BitstreamWriter::EnterSubblock(), llvm::BitstreamWriter::ExitBlock(), llvm::StringMapEntry< ValueTy >::getKeyData(), llvm::StringMapEntryBase::getKeyLength(), llvm::ValueEnumerator::getValueID(), llvm::BitCodeAbbrevOp::isChar6(), Name, P, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::bitc::VALUE_SYMTAB_BLOCK_ID, VST_BBENTRY_6_ABBREV, llvm::bitc::VST_CODE_BBENTRY, llvm::bitc::VST_CODE_ENTRY, VST_ENTRY_6_ABBREV, VST_ENTRY_7_ABBREV, and VST_ENTRY_8_ABBREV.
Referenced by WriteFunction(), and WriteModule().