class StringTableBuilder

Declaration

class StringTableBuilder { /* full declaration omitted */ };

Description

Utility for building string tables with deduplicated suffixes.

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:23

Member Variables

private DenseMap<llvm::CachedHashStringRef, size_t> StringIndexMap
private size_t Size = 0
private llvm::StringTableBuilder::Kind K
private unsigned int Alignment
private bool Finalized = false

Method Overview

Methods

StringTableBuilder(
    llvm::StringTableBuilder::Kind K,
    unsigned int Alignment = 1)

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:48

Parameters

llvm::StringTableBuilder::Kind K
unsigned int Alignment = 1

size_t add(llvm::CachedHashStringRef S)

Description

Add a string to the builder. Returns the position of S in the table. The position will be changed if finalize is used. Can only be used before the table is finalized.

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:54

Parameters

llvm::CachedHashStringRef S

size_t add(llvm::StringRef S)

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:55

Parameters

llvm::StringRef S

void clear()

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:83

bool contains(llvm::StringRef S) const

Description

Check if a string is contained in the string table. Since this class doesn't store the string values, this function can be used to check if storage needs to be done prior to adding the string.

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:75

Parameters

llvm::StringRef S

bool contains(llvm::CachedHashStringRef S) const

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:78

Parameters

llvm::CachedHashStringRef S

void finalize()

Description

Analyze the strings and build the final table. No more strings can be added after this point.

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:59

void finalizeInOrder()

Description

Finalize the string table without reording it. In this mode, offsets returned by add will still be valid.

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:63

void finalizeStringTable(bool Optimize)

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:44

Parameters

bool Optimize

size_t getOffset(
    llvm::CachedHashStringRef S) const

Description

Get the offest of a string in the string table. Can only be used after the table is finalized.

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:67

Parameters

llvm::CachedHashStringRef S

size_t getOffset(llvm::StringRef S) const

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:68

Parameters

llvm::StringRef S

size_t getSize() const

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:82

void initSize()

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:45

bool isFinalized() const

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:88

void write(llvm::raw_ostream& OS) const

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:85

Parameters

llvm::raw_ostream& OS

void write(uint8_t* Buf) const

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:86

Parameters

uint8_t* Buf

~StringTableBuilder()

Declared at: llvm/include/llvm/MC/StringTableBuilder.h:49