module volt.semantic.classify

Code Map

module volt.semantic.classify;


//! Making the code more readable.
enum IgnoreStorage;

//! Returns the size of a given ir.PrimitiveType in bytes.
fn size(kind: ir.PrimitiveType.Kind) size_t { }
//! Returns the size of a given ir.Type in bytes.
fn size(target: TargetInfo, node: ir.Node) size_t { }
//! Returns the size of a given ir.Struct in bytes.
//! https://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86
fn structSize(target: TargetInfo, s: ir.Struct) size_t { }
//! Returns the size of a given ir.Union in bytes.
fn unionSize(target: TargetInfo, u: ir.Union) size_t { }
//! Returns the offset adjusted to alignment.
fn calcAlignment(a: size_t, offset: size_t) size_t { }
//! Returns the offset adjusted to alignment of type.
fn calcAlignment(target: TargetInfo, t: ir.Type, offset: size_t) size_t { }
fn alignment(target: TargetInfo, kind: ir.PrimitiveType.Kind) size_t { }
fn alignment(target: TargetInfo, node: ir.Type) size_t { }
//! Returns the size of a given ir.Struct in bytes.
fn structAlignment(target: TargetInfo, s: ir.Struct) size_t { }
//! Returns the size of a given ir.Union in bytes.
fn unionAlignment(target: TargetInfo, u: ir.Union) size_t { }
fn isValidWithExp(exp: ir.Exp) bool { }
//! Remove types masking a type (e.g. enum).
fn realType(t: ir.Type, stripEnum: bool) ir.Type { }
//! struct Struct { ... } a := Struct(12); // isValueExp() == false b :=
//! a(12); // isValueExp() == true, despite the same type.
fn isValueExp(exp: ir.Exp) bool { }
//! A type without mutable indirection is a pure value type -- it cannot
//! mutate any other memory than its own, or is composed of the above. This
//! is useful for making const and friends more user friendly.
fn mutableIndirection(t: ir.Type) bool { }
fn isAuto(t: ir.Type) bool { }
fn isBool(t: ir.Type) bool { }
//! Is this an array of characters?
fn isString(t: ir.Type) bool { }
//! Is this type a character type?
fn isChar(t: ir.Type) bool { }
fn isArray(t: ir.Type) bool { }
fn isStaticArray(t: ir.Type) bool { }
fn effectivelyConst(type: ir.Type) bool { }
fn isPointer(t: ir.Type) bool { }
fn isDelegate(t: ir.Type) bool { }
fn isIntegral(t: ir.Type) bool { }
fn isIntegralOrBool(t: ir.Type) bool { }
fn isIntegral(kind: ir.PrimitiveType.Kind) bool { }
fn isIntegralOrBool(kind: ir.PrimitiveType.Kind) bool { }
fn isFloatingPoint(t: ir.Type) bool { }
fn isF32(t: ir.Type) bool { }
fn isFloatingPoint(kind: ir.PrimitiveType.Kind) bool { }
fn isUnsigned(kind: ir.PrimitiveType.Kind) bool { }
fn isOkayForPointerArithmetic(kind: ir.PrimitiveType.Kind) bool { }
fn isBitsType(type: ir.Type) bool { }
fn isAggregate(type: ir.Type) bool { }
fn isInt(type: ir.Type) bool { }
fn isVoid(type: ir.Type) bool { }
//! Determines whether the two given types are the same.
fn typesEqual(a: ir.Type, b: ir.Type, ignoreStorage: bool) bool { }
fn typeToRuntimeConstant(lp: LanguagePass, current: ir.Scope, type: ir.Type) i32 { }
//! Does the given property need to have child set?
fn isMember(prop: ir.PropertyExp) bool { }
//! Is the given exp a backend constant, this is the minimum that a backend
//! needs to implement in order to fully support Volt.
fn isBackendConstant(exp: ir.Exp) bool { }
fn isAssign(exp: ir.Exp) bool { }
fn isAssign(op: ir.BinOp.Op) bool { }
fn isAssignable(exp: ir.Exp) bool { }
fn isLValue(exp: ir.Exp) bool { }
fn isLValueOrAssignable(exp: ir.Exp, assign: bool) bool { }
fn isRefVar(exp: ir.Exp) bool { }
fn isComparison(t: ir.BinOp.Op) bool { }
fn isConstant(e: ir.Exp) bool { }
fn isValidPointerArithmeticOperation(t: ir.BinOp.Op) bool { }
fn isImplicitlyConvertable(from: ir.Type, to: ir.Type) bool { }
fn fitsInPrimitive(target: TargetInfo, t: ir.PrimitiveType, e: ir.Exp) bool { }
//! If the given scope is in a function, return it. Otherwise, return
//! null.
fn getParentFunction(current: ir.Scope) ir.Function { }
fn isInFunction(ctx: Context) bool { }
fn isFunctionMemberOrConstructor(func: ir.Function) bool { }
fn isFunctionStatic(func: ir.Function) bool { }
fn isVariableStatic(var: ir.Variable) bool { }
fn isNull(e: ir.Exp) bool { }
fn isNested(s: ir.Variable.Storage) bool { }
//! Returns true if one of fns's types match fnToMatch. False
//! otherwise.(If fns is empty, this function returns false).
fn containsMatchingFunction(fns: ir.Function[], fnToMatch: ir.Function) bool { }
fn isNested(func: ir.Function) bool { }
//! Used to determine whether a store is local to a function and therefore
//! can not be shadowed by a with statement.
fn isStoreLocal(lp: LanguagePass, current: ir.Scope, store: ir.Store) bool { }
//! Retrieves the types of Variables in _struct, in the order they appear.
fn getStructFieldTypes(_struct: ir.Struct) ir.Type[] { }
//! Retrieves the Variables in _struct, in the order they appear.
fn getAggregateFieldVars(_struct: ir.Aggregate) ir.Variable[] { }
fn getStructFunctions(_struct: ir.Struct) ir.Function[] { }
fn getClassFunctions(_class: ir.Class) ir.Function[] { }
//! If the given scope is a function, and that function has a this
//! reference that is a class, or is a static function in a class, return
//! true and set theClass to that class. Otherwise, return false.
fn getMethodParent(_scope: ir.Scope, theClass: ir.Class) bool { }
//! Returns: true if child is a child of parent.
fn inheritsFrom(child: ir.Class, parent: ir.Class) bool { }
fn isOrInheritsFrom(a: ir.Class, b: ir.Class) bool { }
fn isPointerToClass(t: ir.Type) bool { }
//! How far removed from Object is this class?
fn distanceFromObject(_class: ir.Class) size_t { }
//! Given two classes, return their closest relative.
fn commonParent(a: ir.Class, b: ir.Class) ir.Class { }
fn opOverloadableOrNull(t: ir.Type) ir.Aggregate { }
fn overloadName(op: ir.BinOp.Op) string { }
fn overloadPostfixName(op: ir.Postfix.Op) string { }
fn overloadPostfixAssignName(oldname: string) string { }
fn overloadUnaryMinusName() string { }
fn overloadDollarName() string { }
fn size(kind: ir.PrimitiveType.Kind) size_t

Returns the size of a given ir.PrimitiveType in bytes.

fn size(target: TargetInfo, node: ir.Node) size_t

Returns the size of a given ir.Type in bytes.

fn structSize(target: TargetInfo, s: ir.Struct) size_t

Returns the size of a given ir.Struct in bytes. https://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86

fn unionSize(target: TargetInfo, u: ir.Union) size_t

Returns the size of a given ir.Union in bytes.

fn calcAlignment(a: size_t, offset: size_t) size_t

Returns the offset adjusted to alignment.

fn calcAlignment(target: TargetInfo, t: ir.Type, offset: size_t) size_t

Returns the offset adjusted to alignment of type.

fn structAlignment(target: TargetInfo, s: ir.Struct) size_t

Returns the size of a given ir.Struct in bytes.

fn unionAlignment(target: TargetInfo, u: ir.Union) size_t

Returns the size of a given ir.Union in bytes.

fn realType(t: ir.Type, stripEnum: bool) ir.Type

Remove types masking a type (e.g. enum).

fn isValueExp(exp: ir.Exp) bool

struct Struct { ... } a := Struct(12); // isValueExp() == false b := a(12); // isValueExp() == true, despite the same type.

fn mutableIndirection(t: ir.Type) bool

A type without mutable indirection is a pure value type -- it cannot mutate any other memory than its own, or is composed of the above. This is useful for making const and friends more user friendly.

Given a Variable with a const type that does not have mutableIndirection it is safe to copy that value and pass it to a non-const function, like so:

void bar(int f); void foo(const(int) i) { bar(i); }

fn isString(t: ir.Type) bool

Is this an array of characters?

fn isChar(t: ir.Type) bool

Is this type a character type?

enum IgnoreStorage

Making the code more readable.

fn typesEqual(a: ir.Type, b: ir.Type, ignoreStorage: bool) bool

Determines whether the two given types are the same.

Not similar. Not implicitly convertable. The same type. Returns: true if they're the same, false otherwise.

fn isMember(prop: ir.PropertyExp) bool

Does the given property need to have child set?

fn isBackendConstant(exp: ir.Exp) bool

Is the given exp a backend constant, this is the minimum that a backend needs to implement in order to fully support Volt.

Backends may support more.

fn getParentFunction(current: ir.Scope) ir.Function

If the given scope is in a function, return it. Otherwise, return null.

fn containsMatchingFunction(fns: ir.Function[], fnToMatch: ir.Function) bool

Returns true if one of fns's types match fnToMatch. False otherwise.(If fns is empty, this function returns false).

fn isStoreLocal(lp: LanguagePass, current: ir.Scope, store: ir.Store) bool

Used to determine whether a store is local to a function and therefore can not be shadowed by a with statement.

fn getStructFieldTypes(_struct: ir.Struct) ir.Type[]

Retrieves the types of Variables in _struct, in the order they appear.

fn getAggregateFieldVars(_struct: ir.Aggregate) ir.Variable[]

Retrieves the Variables in _struct, in the order they appear.

fn getMethodParent(_scope: ir.Scope, theClass: ir.Class) bool

If the given scope is a function, and that function has a this reference that is a class, or is a static function in a class, return true and set theClass to that class. Otherwise, return false.

fn inheritsFrom(child: ir.Class, parent: ir.Class) bool

Returns: true if child is a child of parent.

fn distanceFromObject(_class: ir.Class) size_t

How far removed from Object is this class?

fn commonParent(a: ir.Class, b: ir.Class) ir.Class

Given two classes, return their closest relative.