LLVM 20.0.0git
Classes | Enumerations | Functions | Variables
llvm::remarks Namespace Reference

Classes

struct  Argument
 A key-value pair with a debug location that is used to display the remarks at the right place in the source. More...
 
struct  BitstreamMetaParserHelper
 Helper to parse a META_BLOCK for a bitstream remark container. More...
 
struct  BitstreamMetaSerializer
 Serializer of metadata for bitstream remarks. More...
 
struct  BitstreamParserHelper
 Helper to parse any bitstream remark container. More...
 
struct  BitstreamRemarkParser
 Parses and holds the state of the latest parsed remark. More...
 
struct  BitstreamRemarkParserHelper
 Helper to parse a REMARK_BLOCK for a bitstream remark container. More...
 
struct  BitstreamRemarkSerializer
 Implementation of the remark serializer using LLVM bitstream. More...
 
struct  BitstreamRemarkSerializerHelper
 Serialize the remarks to LLVM bitstream. More...
 
class  EndOfFileError
 
class  HotnessThresholdParser
 
struct  MetaSerializer
 This is the base class for a remark metadata serializer. More...
 
struct  ParsedStringTable
 In-memory representation of the string table parsed from a buffer (e.g. More...
 
struct  Remark
 A remark type used for both emission and parsing. More...
 
struct  RemarkLinker
 
struct  RemarkLocation
 The debug location used to track a remark back to the source file. More...
 
struct  RemarkParser
 Parser used to parse a raw buffer to remarks::Remark objects. More...
 
struct  RemarkSerializer
 This is the base class for a remark serializer. More...
 
class  RemarkStreamer
 
struct  StringTable
 The string table used for serializing remarks. More...
 
struct  YAMLMetaSerializer
 
class  YAMLParseError
 
struct  YAMLRemarkParser
 Regular YAML to Remark parser. More...
 
struct  YAMLRemarkSerializer
 Serialize the remarks to YAML. More...
 
struct  YAMLStrTabMetaSerializer
 
struct  YAMLStrTabRemarkParser
 YAML with a string table to Remark parser. More...
 
struct  YAMLStrTabRemarkSerializer
 Serialize the remarks to YAML using a string table. More...
 

Enumerations

enum class  BitstreamRemarkContainerType {
  SeparateRemarksMeta , SeparateRemarksFile , Standalone , First = SeparateRemarksMeta ,
  Last = Standalone
}
 Type of the remark container. More...
 
enum  BlockIDs { META_BLOCK_ID = bitc::FIRST_APPLICATION_BLOCKID , REMARK_BLOCK_ID }
 The possible blocks that will be encountered in a bitstream remark container. More...
 
enum  RecordIDs {
  RECORD_META_CONTAINER_INFO = 1 , RECORD_META_REMARK_VERSION , RECORD_META_STRTAB , RECORD_META_EXTERNAL_FILE ,
  RECORD_REMARK_HEADER , RECORD_REMARK_DEBUG_LOC , RECORD_REMARK_HOTNESS , RECORD_REMARK_ARG_WITH_DEBUGLOC ,
  RECORD_REMARK_ARG_WITHOUT_DEBUGLOC , RECORD_FIRST = RECORD_META_CONTAINER_INFO , RECORD_LAST = RECORD_REMARK_ARG_WITHOUT_DEBUGLOC
}
 The possible records that can be encountered in the previously described blocks. More...
 
enum class  Type {
  Unknown , Passed , Missed , Analysis ,
  AnalysisFPCommute , AnalysisAliasing , Failure , First = Unknown ,
  Last = Failure
}
 The type of the remark. More...
 
enum class  Format { Unknown , YAML , YAMLStrTab , Bitstream }
 The format used for serializing/deserializing remarks. More...
 
enum class  SerializerMode { Separate , Standalone }
 

Functions

constexpr StringLiteral ContainerMagic ("RMRK")
 The magic number used for identifying remark blocks.
 
Expected< std::optional< uint64_t > > parseHotnessThresholdOption (StringRef Arg)
 
StringRef typeToStr (Type Ty)
 
template<typename T >
bool operator< (const std::optional< T > &LHS, const std::optional< T > &RHS)
 Comparison operators for Remark objects and dependent objects.
 
bool operator== (const RemarkLocation &LHS, const RemarkLocation &RHS)
 
bool operator!= (const RemarkLocation &LHS, const RemarkLocation &RHS)
 
bool operator< (const RemarkLocation &LHS, const RemarkLocation &RHS)
 
bool operator== (const Argument &LHS, const Argument &RHS)
 
bool operator!= (const Argument &LHS, const Argument &RHS)
 
bool operator< (const Argument &LHS, const Argument &RHS)
 
bool operator== (const Remark &LHS, const Remark &RHS)
 
bool operator!= (const Remark &LHS, const Remark &RHS)
 
bool operator< (const Remark &LHS, const Remark &RHS)
 
raw_ostreamoperator<< (raw_ostream &OS, const RemarkLocation &RLoc)
 
raw_ostreamoperator<< (raw_ostream &OS, const Argument &Arg)
 
raw_ostreamoperator<< (raw_ostream &OS, const Remark &Remark)
 
constexpr StringLiteral Magic ("REMARKS")
 
Expected< FormatparseFormat (StringRef FormatStr)
 Parse and validate a string for the remark format.
 
Expected< FormatmagicToFormat (StringRef Magic)
 Parse and validate a magic number to a remark format.
 
Expected< std::optional< StringRef > > getRemarksSectionContents (const object::ObjectFile &Obj)
 Returns a buffer with the contents of the remarks section depending on the format of the file.
 
Expected< std::unique_ptr< RemarkParser > > createRemarkParser (Format ParserFormat, StringRef Buf)
 
Expected< std::unique_ptr< RemarkParser > > createRemarkParser (Format ParserFormat, StringRef Buf, ParsedStringTable StrTab)
 
Expected< std::unique_ptr< RemarkParser > > createRemarkParserFromMeta (Format ParserFormat, StringRef Buf, std::optional< ParsedStringTable > StrTab=std::nullopt, std::optional< StringRef > ExternalFilePrependPath=std::nullopt)
 
Expected< std::unique_ptr< RemarkSerializer > > createRemarkSerializer (Format RemarksFormat, SerializerMode Mode, raw_ostream &OS)
 Create a remark serializer.
 
Expected< std::unique_ptr< RemarkSerializer > > createRemarkSerializer (Format RemarksFormat, SerializerMode Mode, raw_ostream &OS, remarks::StringTable StrTab)
 Create a remark serializer that uses a pre-filled string table.
 
Expected< std::unique_ptr< BitstreamRemarkParser > > createBitstreamParserFromMeta (StringRef Buf, std::optional< ParsedStringTable > StrTab=std::nullopt, std::optional< StringRef > ExternalFilePrependPath=std::nullopt)
 
Expected< std::unique_ptr< YAMLRemarkParser > > createYAMLParserFromMeta (StringRef Buf, std::optional< ParsedStringTable > StrTab=std::nullopt, std::optional< StringRef > ExternalFilePrependPath=std::nullopt)
 

Variables

constexpr uint64_t CurrentContainerVersion = 0
 The current version of the remark container.
 
constexpr StringRef MetaBlockName = StringRef("Meta", 4)
 
constexpr StringRef RemarkBlockName = StringRef("Remark", 6)
 
constexpr StringRef MetaContainerInfoName = StringRef("Container info", 14)
 
constexpr StringRef MetaRemarkVersionName = StringRef("Remark version", 14)
 
constexpr StringRef MetaStrTabName = StringRef("String table", 12)
 
constexpr StringRef MetaExternalFileName = StringRef("External File", 13)
 
constexpr StringRef RemarkHeaderName = StringRef("Remark header", 13)
 
constexpr StringRef RemarkDebugLocName = StringRef("Remark debug location", 21)
 
constexpr StringRef RemarkHotnessName = StringRef("Remark hotness", 14)
 
constexpr StringRef RemarkArgWithDebugLocName
 
constexpr StringRef RemarkArgWithoutDebugLocName = StringRef("Argument", 8)
 
constexpr uint64_t CurrentRemarkVersion = 0
 The current version of the remark entry.
 

Enumeration Type Documentation

◆ BitstreamRemarkContainerType

Type of the remark container.

The remark container has two modes:

  • separate: the metadata is separate from the remarks and points to the auxiliary file that contains the remarks.
  • standalone: the metadata and the remarks are emitted together.
Enumerator
SeparateRemarksMeta 

The metadata emitted separately.

This will contain the following:

  • Container version and type
  • String table
  • External file
SeparateRemarksFile 

The remarks emitted separately.

This will contain the following:

  • Container version and type
  • Remark version
Standalone 

Everything is emitted together.

This will contain the following:

  • Container version and type
  • Remark version
  • String table
First 
Last 

Definition at line 35 of file BitstreamRemarkContainer.h.

◆ BlockIDs

The possible blocks that will be encountered in a bitstream remark container.

Enumerator
META_BLOCK_ID 

The metadata block is mandatory.

It should always come after the BLOCKINFO_BLOCK, and contains metadata that should be used when parsing REMARK_BLOCKs. There should always be only one META_BLOCK.

REMARK_BLOCK_ID 

One remark entry is represented using a REMARK_BLOCK.

There can be multiple REMARK_BLOCKs in the same file.

Definition at line 59 of file BitstreamRemarkContainer.h.

◆ Format

enum class llvm::remarks::Format
strong

The format used for serializing/deserializing remarks.

Enumerator
Unknown 
YAML 
YAMLStrTab 
Bitstream 

Definition at line 25 of file RemarkFormat.h.

◆ RecordIDs

The possible records that can be encountered in the previously described blocks.

Enumerator
RECORD_META_CONTAINER_INFO 
RECORD_META_REMARK_VERSION 
RECORD_META_STRTAB 
RECORD_META_EXTERNAL_FILE 
RECORD_REMARK_HEADER 
RECORD_REMARK_DEBUG_LOC 
RECORD_REMARK_HOTNESS 
RECORD_REMARK_ARG_WITH_DEBUGLOC 
RECORD_REMARK_ARG_WITHOUT_DEBUGLOC 
RECORD_FIRST 
RECORD_LAST 

Definition at line 75 of file BitstreamRemarkContainer.h.

◆ SerializerMode

enum class llvm::remarks::SerializerMode
strong
Enumerator
Separate 
Standalone 

Definition at line 28 of file RemarkSerializer.h.

◆ Type

enum class llvm::remarks::Type
strong

The type of the remark.

MessagePack types as defined in the standard, with the exception of Integer being divided into a signed Int and unsigned UInt variant in order to map directly to C++ types.

The types map onto corresponding union members of the Object struct.

Enumerator
Unknown 
Passed 
Missed 
Analysis 
AnalysisFPCommute 
AnalysisAliasing 
Failure 
First 
Last 

Definition at line 65 of file Remark.h.

Function Documentation

◆ ContainerMagic()

constexpr StringLiteral llvm::remarks::ContainerMagic ( "RMRK"  )
constexpr

The magic number used for identifying remark blocks.

Referenced by magicToFormat(), llvm::remarks::BitstreamRemarkSerializerHelper::setupBlockInfo(), and validateMagicNumber().

◆ createBitstreamParserFromMeta()

Expected< std::unique_ptr< BitstreamRemarkParser > > llvm::remarks::createBitstreamParserFromMeta ( StringRef  Buf,
std::optional< ParsedStringTable StrTab = std::nullopt,
std::optional< StringRef ExternalFilePrependPath = std::nullopt 
)

◆ createRemarkParser() [1/2]

Expected< std::unique_ptr< RemarkParser > > llvm::remarks::createRemarkParser ( Format  ParserFormat,
StringRef  Buf 
)

◆ createRemarkParser() [2/2]

Expected< std::unique_ptr< RemarkParser > > llvm::remarks::createRemarkParser ( Format  ParserFormat,
StringRef  Buf,
ParsedStringTable  StrTab 
)

◆ createRemarkParserFromMeta()

Expected< std::unique_ptr< RemarkParser > > llvm::remarks::createRemarkParserFromMeta ( Format  ParserFormat,
StringRef  Buf,
std::optional< ParsedStringTable StrTab = std::nullopt,
std::optional< StringRef ExternalFilePrependPath = std::nullopt 
)

◆ createRemarkSerializer() [1/2]

Expected< std::unique_ptr< RemarkSerializer > > llvm::remarks::createRemarkSerializer ( Format  RemarksFormat,
SerializerMode  Mode,
raw_ostream OS 
)

◆ createRemarkSerializer() [2/2]

Expected< std::unique_ptr< RemarkSerializer > > llvm::remarks::createRemarkSerializer ( Format  RemarksFormat,
SerializerMode  Mode,
raw_ostream OS,
remarks::StringTable  StrTab 
)

Create a remark serializer that uses a pre-filled string table.

Definition at line 38 of file RemarkSerializer.cpp.

References llvm::createStringError(), llvm_unreachable, OS, and llvm::RemarksFormat.

◆ createYAMLParserFromMeta()

Expected< std::unique_ptr< YAMLRemarkParser > > llvm::remarks::createYAMLParserFromMeta ( StringRef  Buf,
std::optional< ParsedStringTable StrTab = std::nullopt,
std::optional< StringRef ExternalFilePrependPath = std::nullopt 
)

◆ getRemarksSectionContents()

Expected< std::optional< StringRef > > llvm::remarks::getRemarksSectionContents ( const object::ObjectFile Obj)

Returns a buffer with the contents of the remarks section depending on the format of the file.

If the section doesn't exist, this returns an empty optional.

Definition at line 39 of file RemarkLinker.cpp.

References getRemarksSectionName(), llvm::object::ObjectFile::sections(), and llvm::Expected< T >::takeError().

Referenced by llvm::remarks::RemarkLinker::link().

◆ Magic()

constexpr StringLiteral llvm::remarks::Magic ( "REMARKS"  )
constexpr

◆ magicToFormat()

Expected< Format > llvm::remarks::magicToFormat ( StringRef  Magic)

◆ operator!=() [1/3]

bool llvm::remarks::operator!= ( const Argument LHS,
const Argument RHS 
)
inline

Definition at line 180 of file Remark.h.

References LHS, and RHS.

◆ operator!=() [2/3]

bool llvm::remarks::operator!= ( const Remark LHS,
const Remark RHS 
)
inline

Definition at line 196 of file Remark.h.

References LHS, and RHS.

◆ operator!=() [3/3]

bool llvm::remarks::operator!= ( const RemarkLocation LHS,
const RemarkLocation RHS 
)
inline

Definition at line 167 of file Remark.h.

References LHS, and RHS.

◆ operator<() [1/4]

bool llvm::remarks::operator< ( const Argument LHS,
const Argument RHS 
)
inline

Definition at line 184 of file Remark.h.

References LHS, and RHS.

◆ operator<() [2/4]

bool llvm::remarks::operator< ( const Remark LHS,
const Remark RHS 
)
inline

Definition at line 200 of file Remark.h.

References LHS, and RHS.

◆ operator<() [3/4]

bool llvm::remarks::operator< ( const RemarkLocation LHS,
const RemarkLocation RHS 
)
inline

Definition at line 171 of file Remark.h.

References LHS, and RHS.

◆ operator<() [4/4]

template<typename T >
bool llvm::remarks::operator< ( const std::optional< T > &  LHS,
const std::optional< T > &  RHS 
)

Comparison operators for Remark objects and dependent objects.

Definition at line 148 of file Remark.h.

References LHS, and RHS.

◆ operator<<() [1/3]

raw_ostream & llvm::remarks::operator<< ( raw_ostream OS,
const Argument Arg 
)
inline

Definition at line 212 of file Remark.h.

References OS, and llvm::remarks::Argument::print().

◆ operator<<() [2/3]

raw_ostream & llvm::remarks::operator<< ( raw_ostream OS,
const Remark Remark 
)
inline

Definition at line 217 of file Remark.h.

References OS, and llvm::remarks::Remark::print().

◆ operator<<() [3/3]

raw_ostream & llvm::remarks::operator<< ( raw_ostream OS,
const RemarkLocation RLoc 
)
inline

Definition at line 207 of file Remark.h.

References OS, and llvm::remarks::RemarkLocation::print().

◆ operator==() [1/3]

bool llvm::remarks::operator== ( const Argument LHS,
const Argument RHS 
)
inline

Definition at line 176 of file Remark.h.

References LHS, llvm::operator==(), and RHS.

◆ operator==() [2/3]

bool llvm::remarks::operator== ( const Remark LHS,
const Remark RHS 
)
inline

Definition at line 189 of file Remark.h.

References LHS, llvm::operator==(), and RHS.

◆ operator==() [3/3]

bool llvm::remarks::operator== ( const RemarkLocation LHS,
const RemarkLocation RHS 
)
inline

Definition at line 161 of file Remark.h.

References LHS, llvm::operator==(), and RHS.

◆ parseFormat()

Expected< Format > llvm::remarks::parseFormat ( StringRef  FormatStr)

◆ parseHotnessThresholdOption()

Expected< std::optional< uint64_t > > llvm::remarks::parseHotnessThresholdOption ( StringRef  Arg)
inline

◆ typeToStr()

StringRef llvm::remarks::typeToStr ( Type  Ty)
inline

Definition at line 77 of file Remark.h.

References Analysis, AnalysisAliasing, AnalysisFPCommute, Missed, Passed, and Unknown.

Referenced by llvm::remarks::Remark::print().

Variable Documentation

◆ CurrentContainerVersion

constexpr uint64_t llvm::remarks::CurrentContainerVersion = 0
constexpr

The current version of the remark container.

Note: this is different from the version of the remark entry.

Definition at line 26 of file BitstreamRemarkContainer.h.

Referenced by llvm::remarks::BitstreamMetaSerializer::emit().

◆ CurrentRemarkVersion

constexpr uint64_t llvm::remarks::CurrentRemarkVersion = 0
constexpr

The current version of the remark entry.

Definition at line 28 of file Remark.h.

Referenced by llvm::remarks::BitstreamMetaSerializer::emit(), emitVersion(), and parseVersion().

◆ MetaBlockName

constexpr StringRef llvm::remarks::MetaBlockName = StringRef("Meta", 4)
constexpr

◆ MetaContainerInfoName

constexpr StringRef llvm::remarks::MetaContainerInfoName = StringRef("Container info", 14)
constexpr

◆ MetaExternalFileName

constexpr StringRef llvm::remarks::MetaExternalFileName = StringRef("External File", 13)
constexpr

◆ MetaRemarkVersionName

constexpr StringRef llvm::remarks::MetaRemarkVersionName = StringRef("Remark version", 14)
constexpr

◆ MetaStrTabName

constexpr StringRef llvm::remarks::MetaStrTabName = StringRef("String table", 12)
constexpr

◆ RemarkArgWithDebugLocName

constexpr StringRef llvm::remarks::RemarkArgWithDebugLocName
constexpr
Initial value:
=
StringRef("Argument with debug location", 28)

Definition at line 99 of file BitstreamRemarkContainer.h.

Referenced by llvm::remarks::BitstreamRemarkSerializerHelper::setupRemarkBlockInfo().

◆ RemarkArgWithoutDebugLocName

constexpr StringRef llvm::remarks::RemarkArgWithoutDebugLocName = StringRef("Argument", 8)
constexpr

◆ RemarkBlockName

constexpr StringRef llvm::remarks::RemarkBlockName = StringRef("Remark", 6)
constexpr

◆ RemarkDebugLocName

constexpr StringRef llvm::remarks::RemarkDebugLocName = StringRef("Remark debug location", 21)
constexpr

◆ RemarkHeaderName

constexpr StringRef llvm::remarks::RemarkHeaderName = StringRef("Remark header", 13)
constexpr

◆ RemarkHotnessName

constexpr StringRef llvm::remarks::RemarkHotnessName = StringRef("Remark hotness", 14)
constexpr