Compiler implementation of the D programming language.

Walter Bright
Boost License 1.0
struct Target;

Describes a back-end target. At present it is incomplete, but in the future it should grow to contain most or all target machine and target O/S specific information.

In many cases, calls to sizeof() can't be used directly for getting data type sizes since cross compiling is supported and would end up using the host sizes rather than the target sizes.

uint ptrsize;

size of a pointer in bytes

uint realsize;

size a real consumes in memory

uint realpad;

padding added to the CPU real size to bring it up to realsize

uint realalignsize;

alignment for reals

uint classinfosize;

size of ClassInfo

ulong maxStaticDataSize;

maximum size of static data

struct FPTypeProperties(T);

Values representing all properties for floating point types

real_t max;

largest representable value that's not infinity

real_t min_normal;

smallest representable normalized value that's not 0

real_t nan;

NaN value

real_t infinity;

infinity value

real_t epsilon;

smallest increment to the value 1

d_int64 dig;

number of decimal digits of precision

d_int64 mant_dig;

number of bits in mantissa

d_int64 max_exp;

maximum int value such that 2max_exp-1 is representable

d_int64 min_exp;

minimum int value such that 2min_exp-1 is representable as a normalized value

d_int64 max_10_exp;

maximum int value such that 10max_10_exp is representable

d_int64 min_10_exp;

minimum int value such that 10min_10_exp is representable as a normalized value

FPTypeProperties!float FloatProperties;
FPTypeProperties!double DoubleProperties;
FPTypeProperties!real_t RealProperties;
void _init(ref const Param params);

Initialize the Target

void deinitialize();

Deinitializes the global state of the compiler.

This can be used to restore the state set by _init to its original state.

uint alignsize(Type type);

Requested target memory alignment size of the given type.

Type type type to inspect
alignment in bytes
uint fieldalign(Type type);

Requested target field alignment size of the given type.

Type type type to inspect
alignment in bytes
uint critsecsize();

Size of the target OS critical section.

size in bytes
Type va_listType();

Type for the va_list type for the target.

For Posix/x86_64 this returns the type which will really be used for passing an argument of type va_list.
Type that represents va_list.
int isVectorTypeSupported(int sz, Type type);

Checks whether the target supports a vector type.

int sz vector type size in bytes
Type type vector element type
0 vector type is supported, 1 vector type is not supported on the target at all 2 vector element type is not supported 3 vector size is not supported
bool isVectorOpSupported(Type type, ubyte op, Type t2 = null);

Checks whether the target supports the given operation for vectors.

Type type target type of operation
ubyte op the unary or binary op being done on the type
Type t2 type of second operand if op is a binary operation
true if the operation is supported or type is not a vector
LINK systemLinkage();

Default system linkage for the target.

LINK to use for extern(System)
TypeTuple toArgTypes(Type t);

Describes how an argument type is passed to a function on target.

Type t type to break down
tuple of types if type is passed in one or more registers empty tuple if type is always passed on the stack null if the type is a void or argtypes aren't supported by the target
bool isReturnOnStack(TypeFunction tf, bool needsThis);

Determine return style of function - whether in registers or through a hidden pointer to the caller's stack.

TypeFunction tf function type to check
bool needsThis true if the function type is for a non-static member function
true if return value from function is on the stack
ulong parameterSize(ref const Loc loc, Type t);

Determine the size a value of type t will be when it is passed on the function parameter stack.

Loc loc location to use for error messages
Type t type of parameter
size used on parameter stack
Expression getTargetInfo(const(char)* name, ref const Loc loc);

Get targetInfo by key

const(char)* name name of targetInfo to get
Loc loc location to use for error messages
Expression for the requested targetInfo
bool isXmmSupported();
true if xmm usage is supported
struct TargetC;

Functions and variables specific to interfacing with extern(C) ABI.

uint longsize;

size of a C long or unsigned long type

uint long_doublesize;

size of a C long double

uint criticalSectionSize;

size of os critical section

struct TargetCPP;

Functions and variables specific to interface with extern(C++) ABI.

bool reverseOverloads;

set if overloaded functions are grouped and in reverse order (such as in dmc and cl)

bool exceptions;

set if catching C++ exceptions is supported

bool twoDtorInVtable;

target C++ ABI puts deleting and non-deleting destructor into vtable

const(char)* toMangle(Dsymbol s);

Mangle the given symbol for C++ ABI.

Dsymbol s declaration with C++ linkage
string mangling of symbol
const(char)* typeInfoMangle(ClassDeclaration cd);

Get RTTI mangling of the given class declaration for C++ ABI.

ClassDeclaration cd class with C++ linkage
string mangling of C++ typeinfo
const(char)* typeMangle(Type t);

Gets vendor-specific type mangling for C++ ABI.

Type t type to inspect
string if type is mangled specially on target null if unhandled
Type parameterType(Parameter p);

Get the type that will really be used for passing the given argument to an extern(C++) function.

Parameter p parameter to be passed.
Type to use for parameter p.
bool fundamentalType(const Type t, ref bool isFundamental);

Checks whether type is a vendor-specific fundamental type.

Type t type to inspect
bool isFundamental where to store result
true if isFundamental was set by function
Target target;

© 1999–2019 The D Language Foundation
Licensed under the Boost License 1.0.