CIRCT 22.0.0git
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
circt::arc::runtime::FmtDescriptor Struct Reference

A format descriptor, to be given to arcRuntimeFormat. More...

#include <FmtDescriptor.h>

Collaboration diagram for circt::arc::runtime::FmtDescriptor:
Collaboration graph
[legend]

Classes

struct  IntFmt
 Integer formatting options. More...
 
struct  LiteralFmt
 Literal string formatting options. More...
 
struct  SmallLiteral
 Literal string (small string optimization). More...
 

Public Types

enum  Action : uint64_t {
  Action_End = 0 , Action_Literal , Action_LiteralSmall , Action_Int ,
  Action_Char
}
 The action to take for this descriptor. More...
 

Public Member Functions

 FmtDescriptor ()
 Default construction creates an end of string descriptor.
 

Static Public Member Functions

static FmtDescriptor createLiteral (int64_t width)
 Creates a literal string descriptor.
 
static FmtDescriptor createSmallLiteral (std::string_view str)
 Creates a small literal string descriptor.
 
static FmtDescriptor createInt (int32_t bitwidth, int8_t radix, bool isLeftAligned, int32_t specifierWidth, bool isUpperCase, bool isSigned)
 Creates an integer descriptor.
 
static FmtDescriptor createChar ()
 Creates a char descriptor.
 

Public Attributes

Action action
 
union { 
 
   LiteralFmt   literal 
 
   IntFmt   intFmt 
 
   SmallLiteral   smallLiteral 
 
};  
 

Detailed Description

A format descriptor, to be given to arcRuntimeFormat.

arcRuntimeFormat takes an array of FmtDescriptor and a variadic argument list. Each FmtDescriptor describes how to format the corresponding argument. The array is terminated by a FmtDescriptor with action Action_End.

Definition at line 37 of file FmtDescriptor.h.

Member Enumeration Documentation

◆ Action

The action to take for this descriptor.

We use uint64_t to ensure that the descriptor is always 16 bytes in size with zero padding.

Enumerator
Action_End 

End of the format string, no action to take.

Action_Literal 

Prints a literal string.

Action_LiteralSmall 

Prints a literal string (small string optimization).

Action_Int 

Prints an integer.

Action_Char 

Prints a character (c).

Definition at line 104 of file FmtDescriptor.h.

Constructor & Destructor Documentation

◆ FmtDescriptor()

circt::arc::runtime::FmtDescriptor::FmtDescriptor ( )
inline

Default construction creates an end of string descriptor.

Definition at line 39 of file FmtDescriptor.h.

References action, and Action_End.

Member Function Documentation

◆ createChar()

static FmtDescriptor circt::arc::runtime::FmtDescriptor::createChar ( )
inlinestatic

Creates a char descriptor.

The character value will be passed as a variadic argument by value.

Definition at line 94 of file FmtDescriptor.h.

References action, and Action_Char.

◆ createInt()

static FmtDescriptor circt::arc::runtime::FmtDescriptor::createInt ( int32_t  bitwidth,
int8_t  radix,
bool  isLeftAligned,
int32_t  specifierWidth,
bool  isUpperCase,
bool  isSigned 
)
inlinestatic

Creates an integer descriptor.

bitwidth: The bitwidth of the integer value. radix: The radix to use for formatting. Must be one of {2, 8, 10, 16}. isLeftAligned: Whether the value is left aligned. specifierWidth: The minumum width of the output in characters. isUpperCase: Whether to use uppercase hex letters. isSigned: Whether to treat the value as signed.

The integer value will be passed as a variadic argument by pointer.

Definition at line 77 of file FmtDescriptor.h.

References action, Action_Int, circt::arc::runtime::FmtDescriptor::IntFmt::bitwidth, intFmt, circt::arc::runtime::FmtDescriptor::IntFmt::isLeftAligned, circt::arc::runtime::FmtDescriptor::IntFmt::isSigned, circt::arc::runtime::FmtDescriptor::IntFmt::isUpperCase, circt::arc::runtime::FmtDescriptor::IntFmt::radix, and circt::arc::runtime::FmtDescriptor::IntFmt::specifierWidth.

◆ createLiteral()

static FmtDescriptor circt::arc::runtime::FmtDescriptor::createLiteral ( int64_t  width)
inlinestatic

Creates a literal string descriptor.

width: The width of the literal string in characters.

The string itself will be passed as a variadic argument (const char*).

Definition at line 49 of file FmtDescriptor.h.

References action, Action_Literal, literal, and circt::arc::runtime::FmtDescriptor::LiteralFmt::width.

◆ createSmallLiteral()

static FmtDescriptor circt::arc::runtime::FmtDescriptor::createSmallLiteral ( std::string_view  str)
inlinestatic

Creates a small literal string descriptor.

Definition at line 57 of file FmtDescriptor.h.

References action, Action_LiteralSmall, assert(), circt::arc::runtime::FmtDescriptor::SmallLiteral::data, and smallLiteral.

Member Data Documentation

◆ [union]

◆ action

Action circt::arc::runtime::FmtDescriptor::action

◆ intFmt

IntFmt circt::arc::runtime::FmtDescriptor::intFmt

Definition at line 151 of file FmtDescriptor.h.

Referenced by arcRuntimeIR_format(), and createInt().

◆ literal

LiteralFmt circt::arc::runtime::FmtDescriptor::literal

Definition at line 150 of file FmtDescriptor.h.

Referenced by arcRuntimeIR_format(), and createLiteral().

◆ smallLiteral

SmallLiteral circt::arc::runtime::FmtDescriptor::smallLiteral

Definition at line 152 of file FmtDescriptor.h.

Referenced by arcRuntimeIR_format(), and createSmallLiteral().


The documentation for this struct was generated from the following file: