LLVM: lib/IR/AsmWriter.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define CC_VLS_CASE(ABI_VLEN)
#define ST_DEBUG(X)
#define HANDLE_MDNODE_LEAF(CLASS)
Enumerations
enum PrefixType { GlobalPrefix, ComdatPrefix, LabelPrefix, LocalPrefix, NoPrefix }
Functions
static const Value * skipMetadataWrapper (const Value *V)
Look for a value that might be wrapped as metadata, e.g.
static void orderValue (const Value *V, OrderMap &OM)
static OrderMap orderModule (const Module *M)
static std::vector< unsigned > predictValueUseListOrder (const Value *V, unsigned ID, const OrderMap &OM)
static UseListOrderMap predictUseListOrder (const Module *M)
static const Module * getModuleFromVal (const Value *V)
static const Module * getModuleFromDPI (const DbgMarker *Marker)
static const Module * getModuleFromDPI (const DbgRecord *DR)
static void printCallingConv (unsigned cc, raw_ostream &Out)
static void printLLVMName (raw_ostream &OS, StringRef Name, PrefixType Prefix)
Turn the specified name into an 'LLVM name', which is either prefixed with % (if the string only contains simple characters) or is surrounded with ""'s (if it has special chars in it).
static void printLLVMName (raw_ostream &OS, const Value *V)
Turn the specified name into an 'LLVM name', which is either prefixed with % (if the string only contains simple characters) or is surrounded with ""'s (if it has special chars in it).
static void printShuffleMask (raw_ostream &Out, Type *Ty, ArrayRef< int > Mask)
static SlotTracker * createSlotTracker (const Value *V)
static void writeAsOperandInternal (raw_ostream &Out, const Value *V, AsmWriterContext &WriterCtx, bool PrintType=false)
static void writeAsOperandInternal (raw_ostream &Out, const Metadata *MD, AsmWriterContext &WriterCtx, bool FromValue=false)
static void writeOptimizationInfo (raw_ostream &Out, const User *U)
static void writeAPFloatInternal (raw_ostream &Out, const APFloat &APF)
static void writeConstantInternal (raw_ostream &Out, const Constant *CV, AsmWriterContext &WriterCtx)
static void writeMDTuple (raw_ostream &Out, const MDTuple *Node, AsmWriterContext &WriterCtx)
static void writeMetadataAsOperand (raw_ostream &Out, const Metadata *MD, AsmWriterContext &WriterCtx)
static void writeGenericDINode (raw_ostream &Out, const GenericDINode *N, AsmWriterContext &WriterCtx)
static void writeDILocation (raw_ostream &Out, const DILocation *DL, AsmWriterContext &WriterCtx)
static void writeDIAssignID (raw_ostream &Out, const DIAssignID *DL, AsmWriterContext &WriterCtx)
static void writeDISubrange (raw_ostream &Out, const DISubrange *N, AsmWriterContext &WriterCtx)
static void writeDIGenericSubrange (raw_ostream &Out, const DIGenericSubrange *N, AsmWriterContext &WriterCtx)
static void writeDIEnumerator (raw_ostream &Out, const DIEnumerator *N, AsmWriterContext &)
static void writeDIBasicType (raw_ostream &Out, const DIBasicType *N, AsmWriterContext &WriterCtx)
static void writeDIFixedPointType (raw_ostream &Out, const DIFixedPointType *N, AsmWriterContext &WriterCtx)
static void writeDIStringType (raw_ostream &Out, const DIStringType *N, AsmWriterContext &WriterCtx)
static void writeDIDerivedType (raw_ostream &Out, const DIDerivedType *N, AsmWriterContext &WriterCtx)
static void writeDISubrangeType (raw_ostream &Out, const DISubrangeType *N, AsmWriterContext &WriterCtx)
static void writeDICompositeType (raw_ostream &Out, const DICompositeType *N, AsmWriterContext &WriterCtx)
static void writeDISubroutineType (raw_ostream &Out, const DISubroutineType *N, AsmWriterContext &WriterCtx)
static void writeDIFile (raw_ostream &Out, const DIFile *N, AsmWriterContext &)
static void writeDICompileUnit (raw_ostream &Out, const DICompileUnit *N, AsmWriterContext &WriterCtx)
static void writeDISubprogram (raw_ostream &Out, const DISubprogram *N, AsmWriterContext &WriterCtx)
static void writeDILexicalBlock (raw_ostream &Out, const DILexicalBlock *N, AsmWriterContext &WriterCtx)
static void writeDILexicalBlockFile (raw_ostream &Out, const DILexicalBlockFile *N, AsmWriterContext &WriterCtx)
static void writeDINamespace (raw_ostream &Out, const DINamespace *N, AsmWriterContext &WriterCtx)
static void writeDICommonBlock (raw_ostream &Out, const DICommonBlock *N, AsmWriterContext &WriterCtx)
static void writeDIMacro (raw_ostream &Out, const DIMacro *N, AsmWriterContext &WriterCtx)
static void writeDIMacroFile (raw_ostream &Out, const DIMacroFile *N, AsmWriterContext &WriterCtx)
static void writeDIModule (raw_ostream &Out, const DIModule *N, AsmWriterContext &WriterCtx)
static void writeDITemplateTypeParameter (raw_ostream &Out, const DITemplateTypeParameter *N, AsmWriterContext &WriterCtx)
static void writeDITemplateValueParameter (raw_ostream &Out, const DITemplateValueParameter *N, AsmWriterContext &WriterCtx)
static void writeDIGlobalVariable (raw_ostream &Out, const DIGlobalVariable *N, AsmWriterContext &WriterCtx)
static void writeDILocalVariable (raw_ostream &Out, const DILocalVariable *N, AsmWriterContext &WriterCtx)
static void writeDILabel (raw_ostream &Out, const DILabel *N, AsmWriterContext &WriterCtx)
static void writeDIExpression (raw_ostream &Out, const DIExpression *N, AsmWriterContext &WriterCtx)
static void writeDIArgList (raw_ostream &Out, const DIArgList *N, AsmWriterContext &WriterCtx, bool FromValue=false)
static void writeDIGlobalVariableExpression (raw_ostream &Out, const DIGlobalVariableExpression *N, AsmWriterContext &WriterCtx)
static void writeDIObjCProperty (raw_ostream &Out, const DIObjCProperty *N, AsmWriterContext &WriterCtx)
static void writeDIImportedEntity (raw_ostream &Out, const DIImportedEntity *N, AsmWriterContext &WriterCtx)
static void writeMDNodeBodyInternal (raw_ostream &Out, const MDNode *Node, AsmWriterContext &Ctx)
static const char * getWholeProgDevirtResKindName (WholeProgramDevirtResolution::Kind K)
static const char * getWholeProgDevirtResByArgKindName (WholeProgramDevirtResolution::ByArg::Kind K)
static const char * getTTResKindName (TypeTestResolution::Kind K)
static const char * getSummaryKindName (GlobalValueSummary::SummaryKind SK)
static std::string getLinkageName (GlobalValue::LinkageTypes LT)
static std::string getLinkageNameWithSpace (GlobalValue::LinkageTypes LT)
static const char * getVisibilityName (GlobalValue::VisibilityTypes Vis)
static const char * getImportTypeName (GlobalValueSummary::ImportKind IK)
static void printMetadataIdentifier (StringRef Name, formatted_raw_ostream &Out)
static void printVisibility (GlobalValue::VisibilityTypes Vis, formatted_raw_ostream &Out)
static void printDSOLocation (const GlobalValue &GV, formatted_raw_ostream &Out)
static void printDLLStorageClass (GlobalValue::DLLStorageClassTypes SCT, formatted_raw_ostream &Out)
static void printThreadLocalModel (GlobalVariable::ThreadLocalMode TLM, formatted_raw_ostream &Out)
static StringRef getUnnamedAddrEncoding (GlobalVariable::UnnamedAddr UA)
static void maybePrintComdat (formatted_raw_ostream &Out, const GlobalObject &GO)
static void maybePrintCallAddrSpace (const Value *Operand, const Instruction *I, raw_ostream &Out)
static bool isReferencingMDNode (const Instruction &I)
static bool printWithoutType (const Value &V, raw_ostream &O, SlotTracker *Machine, const Module *M)
Print without a type, skipping the TypePrinting object.
static void printAsOperandImpl (const Value &V, raw_ostream &O, bool PrintType, ModuleSlotTracker &MST)
static void printMetadataImplRec (raw_ostream &ROS, const Metadata &MD, AsmWriterContext &WriterCtx)
Recursive version of printMetadataImpl.
static void printMetadataImpl (raw_ostream &ROS, const Metadata &MD, ModuleSlotTracker &MST, const Module *M, bool OnlyAsOperand, bool PrintAsTree=false)
Variables
static cl::opt< bool > PrintInstAddrs ("print-inst-addrs", cl::Hidden, cl::desc("Print addresses of instructions when dumping"))
static cl::opt< bool > PrintInstDebugLocs ("print-inst-debug-locs", cl::Hidden, cl::desc("Pretty print debug locations of instructions when dumping"))
static cl::opt< bool > PrintProfData ("print-prof-data", cl::Hidden, cl::desc("Pretty print perf data (branch weights, etc) when dumping"))
static cl::opt< bool > PreserveAssemblyUseListOrder ("preserve-ll-uselistorder", cl::Hidden, cl::init(false), cl::desc("Preserve use-list order when writing LLVM assembly."))

CC_VLS_CASE

#define CC_VLS_CASE ( ABI_VLEN )

Value:

case CallingConv::RISCV_VLSCall_##ABI_VLEN: \

Out << "riscv_vls_cc(" #ABI_VLEN ")"; \

break;

Referenced by printCallingConv().

HANDLE_MDNODE_LEAF

#define HANDLE_MDNODE_LEAF ( CLASS )

Value:

case Metadata::CLASS##Kind: \

break;

LLVM_ABI Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue, Dwarf64StrOffsetsPromotion StrOffsetsOptValue)

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

ST_DEBUG

OrderMap

UseListOrderMap

PrefixType

Enumerator
GlobalPrefix
ComdatPrefix
LabelPrefix
LocalPrefix
NoPrefix

Definition at line 450 of file AsmWriter.cpp.

createSlotTracker()

getImportTypeName()

getLinkageName()

Definition at line 3416 of file AsmWriter.cpp.

References llvm::GlobalValue::AppendingLinkage, llvm::GlobalValue::AvailableExternallyLinkage, llvm::GlobalValue::CommonLinkage, llvm::GlobalValue::ExternalLinkage, llvm::GlobalValue::ExternalWeakLinkage, llvm::GlobalValue::InternalLinkage, llvm::GlobalValue::LinkOnceAnyLinkage, llvm::GlobalValue::LinkOnceODRLinkage, llvm_unreachable, llvm::GlobalValue::PrivateLinkage, llvm::GlobalValue::WeakAnyLinkage, and llvm::GlobalValue::WeakODRLinkage.

Referenced by getLinkageNameWithSpace().

getLinkageNameWithSpace()

getModuleFromDPI() [1/2]

getModuleFromDPI() [2/2]

getModuleFromVal()

getSummaryKindName()

getTTResKindName()

getUnnamedAddrEncoding()

StringRef getUnnamedAddrEncoding ( GlobalVariable::UnnamedAddr UA) static

getVisibilityName()

getWholeProgDevirtResByArgKindName()

getWholeProgDevirtResKindName()

isReferencingMDNode()

maybePrintCallAddrSpace()

maybePrintComdat()

orderModule()

orderValue()

predictUseListOrder()

predictValueUseListOrder()

printAsOperandImpl()

printCallingConv()

Definition at line 345 of file AsmWriter.cpp.

References llvm::CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0, llvm::CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X1, llvm::CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2, llvm::CallingConv::AArch64_SVE_VectorCall, llvm::CallingConv::AArch64_VectorCall, llvm::CallingConv::AMDGPU_CS, llvm::CallingConv::AMDGPU_CS_Chain, llvm::CallingConv::AMDGPU_CS_ChainPreserve, llvm::CallingConv::AMDGPU_ES, llvm::CallingConv::AMDGPU_Gfx, llvm::CallingConv::AMDGPU_Gfx_WholeWave, llvm::CallingConv::AMDGPU_GS, llvm::CallingConv::AMDGPU_HS, llvm::CallingConv::AMDGPU_KERNEL, llvm::CallingConv::AMDGPU_LS, llvm::CallingConv::AMDGPU_PS, llvm::CallingConv::AMDGPU_VS, llvm::CallingConv::AnyReg, llvm::CallingConv::ARM_AAPCS, llvm::CallingConv::ARM_AAPCS_VFP, llvm::CallingConv::ARM_APCS, llvm::CallingConv::AVR_INTR, llvm::CallingConv::AVR_SIGNAL, CC_VLS_CASE, llvm::CallingConv::CFGuard_Check, llvm::CallingConv::CHERIoT_CompartmentCall, llvm::CallingConv::CHERIoT_CompartmentCallee, llvm::CallingConv::CHERIoT_LibraryCall, llvm::CallingConv::Cold, llvm::CallingConv::CXX_FAST_TLS, llvm::CallingConv::DUMMY_HHVM, llvm::CallingConv::DUMMY_HHVM_C, llvm::CallingConv::Fast, llvm::CallingConv::GHC, llvm::CallingConv::GRAAL, llvm::CallingConv::Intel_OCL_BI, llvm::CallingConv::M68k_RTD, llvm::CallingConv::MSP430_INTR, llvm::CallingConv::PreserveAll, llvm::CallingConv::PreserveMost, llvm::CallingConv::PreserveNone, llvm::CallingConv::PTX_Device, llvm::CallingConv::PTX_Kernel, llvm::CallingConv::RISCV_VectorCall, llvm::CallingConv::SPIR_FUNC, llvm::CallingConv::SPIR_KERNEL, llvm::CallingConv::Swift, llvm::CallingConv::SwiftTail, llvm::CallingConv::Tail, llvm::CallingConv::Win64, llvm::CallingConv::X86_64_SysV, llvm::CallingConv::X86_FastCall, llvm::CallingConv::X86_INTR, llvm::CallingConv::X86_RegCall, llvm::CallingConv::X86_StdCall, llvm::CallingConv::X86_ThisCall, and llvm::CallingConv::X86_VectorCall.

printDLLStorageClass()

printDSOLocation()

printLLVMName() [1/2]

printLLVMName() [2/2]

Turn the specified name into an 'LLVM name', which is either prefixed with % (if the string only contains simple characters) or is surrounded with ""'s (if it has special chars in it).

Print it out.

Definition at line 492 of file AsmWriter.cpp.

References ComdatPrefix, GlobalPrefix, LabelPrefix, LocalPrefix, NoPrefix, and llvm::printLLVMNameWithoutPrefix().

Referenced by maybePrintComdat(), llvm::Comdat::print(), llvm::printBasicBlock(), printLLVMName(), and writeAsOperandInternal().

printMetadataIdentifier()

printMetadataImpl()

Definition at line 5362 of file AsmWriter.cpp.

References llvm::dyn_cast(), llvm::ModuleSlotTracker::getMachine(), llvm::isa(), N, writeAsOperandInternal(), and writeMDNodeBodyInternal().

Referenced by llvm::Metadata::print(), llvm::Metadata::print(), llvm::Metadata::printAsOperand(), llvm::Metadata::printAsOperand(), llvm::MDNode::printTree(), and llvm::MDNode::printTree().

printMetadataImplRec()

printShuffleMask()

printThreadLocalModel()

printVisibility()

printWithoutType()

skipMetadataWrapper()

Look for a value that might be wrapped as metadata, e.g.

a value in a metadata operand. Returns the input value as-is if it is not wrapped.

Definition at line 124 of file AsmWriter.cpp.

References llvm::dyn_cast().

Referenced by orderModule().

writeAPFloatInternal()

Definition at line 1516 of file AsmWriter.cpp.

References assert(), llvm::APFloatBase::BFloat(), llvm::APFloat::bitcastToAPInt(), llvm::APFloat::convert(), llvm::APFloat::convertToDouble(), llvm::format_hex(), llvm::format_hex_no_prefix(), llvm::APInt::getHiBits(), llvm::APInt::getLoBits(), llvm::APFloat::getSemantics(), llvm::APFloat::getSNaN(), llvm::APInt::getZExtValue(), llvm::APFloatBase::IEEEdouble(), llvm::APFloatBase::IEEEhalf(), llvm::APFloatBase::IEEEquad(), llvm::APFloatBase::IEEEsingle(), llvm::isDigit(), llvm::APFloat::isInfinity(), llvm::APFloat::isNaN(), llvm::APFloat::isNegative(), llvm::APFloat::isSignaling(), llvm_unreachable, llvm::APFloatBase::PPCDoubleDouble(), llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloat::toString(), and llvm::APFloatBase::x87DoubleExtended().

Referenced by writeConstantInternal().

writeAsOperandInternal() [1/2]

Definition at line 2786 of file AsmWriter.cpp.

References assert(), llvm::cast(), llvm::dyn_cast(), llvm::SlotTracker::getMetadataSlot(), llvm::isa(), N, llvm::printEscapedString(), writeAsOperandInternal(), writeDIArgList(), writeDIExpression(), and writeDILocation().

writeAsOperandInternal() [2/2]

void writeAsOperandInternal ( raw_ostream & Out, const Value * V, AsmWriterContext & WriterCtx, bool PrintType = false ) static

Definition at line 2701 of file AsmWriter.cpp.

References llvm::InlineAsm::AD_Intel, assert(), createSlotTracker(), llvm::dyn_cast(), llvm::isa(), Machine, llvm::printEscapedString(), printLLVMName(), writeAsOperandInternal(), and writeConstantInternal().

Referenced by printAsOperandImpl(), printMetadataImpl(), printMetadataImplRec(), printWithoutType(), writeAsOperandInternal(), writeAsOperandInternal(), writeConstantInternal(), writeDIArgList(), writeMDTuple(), and writeMetadataAsOperand().

writeConstantInternal()

Definition at line 1609 of file AsmWriter.cpp.

References llvm::cast(), llvm::dyn_cast(), GEP, llvm::Constant::getAggregateElement(), llvm::Constant::getSplatValue(), llvm::Value::getType(), llvm::isa(), NC, llvm::printEscapedString(), printShuffleMask(), writeAPFloatInternal(), writeAsOperandInternal(), and writeOptimizationInfo().

Referenced by llvm::Value::print(), and writeAsOperandInternal().

writeDIArgList()

writeDIAssignID()

writeDIBasicType()

writeDICommonBlock()

writeDICompileUnit()

writeDICompositeType()

writeDIDerivedType()

writeDIEnumerator()

writeDIExpression()

writeDIFile()

writeDIFixedPointType()

writeDIGenericSubrange()

writeDIGlobalVariable()

writeDIGlobalVariableExpression()

writeDIImportedEntity()

writeDILabel()

writeDILexicalBlock()

writeDILexicalBlockFile()

writeDILocalVariable()

writeDILocation()

writeDIMacro()

writeDIMacroFile()

writeDIModule()

writeDINamespace()

writeDIObjCProperty()

writeDIStringType()

writeDISubprogram()

writeDISubrange()

writeDISubrangeType()

writeDISubroutineType()

writeDITemplateTypeParameter()

writeDITemplateValueParameter()

writeGenericDINode()

writeMDNodeBodyInternal()

writeMDTuple()

writeMetadataAsOperand()

writeOptimizationInfo()

PreserveAssemblyUseListOrder

cl::opt< bool > PreserveAssemblyUseListOrder("preserve-ll-uselistorder", cl::Hidden, cl::init(false), cl::desc("Preserve use-list order when writing LLVM assembly.")) ( "preserve-ll-uselistorder" , cl::Hidden , cl::init(false) , cl::desc("Preserve use-list order when writing LLVM assembly.") ) static

PrintInstAddrs

PrintInstDebugLocs

PrintProfData

cl::opt< bool > PrintProfData("print-prof-data", cl::Hidden, cl::desc("Pretty print perf data (branch weights, etc) when dumping")) ( "print-prof-data" , cl::Hidden , cl::desc("Pretty print perf data (branch weights, etc) when dumping") ) static