sun::semantic_analysis::constants

sun::semantic_analysis::constants

namespace · Source (opens in a new tab)

Evaluates constant expressions while a program is being analyzed.

Classes

Structs

Functions

adoptType

public · function · Source (opens in a new tab)

std::optional< ConstantValue > sun::semantic_analysis::constants::adoptType(ConstantValue value, const sun::types::TypePtr &type)

Gives a value read from a bundle the type of the global it belongs to, and its elements the types that follow from it.

A bundle stores values without types. Returns nothing when the value does not have the shape of the type, which means the bundle and its metadata disagree.

Related: ConstantValue, sun::types::TypePtr

getIntegerBitWidth

public · function · Source (opens in a new tab)

std::optional< unsigned > sun::semantic_analysis::constants::getIntegerBitWidth(const sun::types::Type &type)

Number of bits generated code uses for a value of this type, or nothing when the type is not held as an integer.

Related: sun::types::Type

Variables

kMaxCallDepth

public · variable · Source (opens in a new tab)

size_t sun::semantic_analysis::constants::kMaxCallDepth = 200

Most function calls in progress at once while evaluating an initializer.

kMaxEvaluationSteps

public · variable · Source (opens in a new tab)

size_t sun::semantic_analysis::constants::kMaxEvaluationSteps = 1'000'000

Most statements and loop turns evaluated for one initializer.

A function that never finishes must not hang the compiler; past the limit the global is initialized at startup.

Enums

GlobalInitKind

public · enum · Source (opens in a new tab)

enum class sun::semantic_analysis::constants::GlobalInitKind

Where a file-scope variable's first value comes from.

Image

Image

No documentation comment.

Startup

Startup

No documentation comment.