Silk

silk/target

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.

Typed compile-time facts for the selected compilation profile.

When to use

Use arch and operatingSystem to select source behavior for a machine. Use pointerBits for pointer-sized arithmetic. Read logical artifact and runtime requests through silk.compilation.

Details

These facts are fixed before static evaluation. They have no runtime storage.

Import as Target with import silk.target { Target }.

Public declarations: 11.

Arch

pub enum Arch

The instruction-set architectures supported by the compiler.

Aarch64

Aarch64 = 0

The Aarch64 choice.

Wasm32

Wasm32 = 1

The Wasm32 choice.

X86_64

X86_64 = 2

The X86_64 choice.

OperatingSystem

pub enum OperatingSystem

The operating systems supported by the compiler.

Darwin

Darwin = 0

The Darwin choice.

Linux

Linux = 1

The Linux choice.

Freestanding

Freestanding = 2

The Freestanding choice.

Abi

pub enum Abi

The platform calling conventions supported by the compiler.

Apple

Apple = 0

The Apple choice.

Gnu

Gnu = 1

The Gnu choice.

Wasm

Wasm = 2

The Wasm choice.

ObjectFormat

pub enum ObjectFormat

The object-file formats supported by the compiler.

MachO

MachO = 0

The MachO choice.

Elf

Elf = 1

The Elf choice.

Wasm

Wasm = 2

The Wasm choice.

Endianness

pub enum Endianness

The byte orders supported by the compiler.

Little

Little = 0

The Little choice.

pointerBits

pub const pointerBits: u32

The pointer width of the selected compilation target, in bits.

usizeMax

pub const usizeMax: usize

The greatest usize value supported by the selected compilation target.

isizeMax

pub const isizeMax: isize

The greatest isize value supported by the selected compilation target.

isizeMin

pub const isizeMin: isize

The least isize value supported by the selected compilation target.

pointerAlignment

pub const pointerAlignment: u32

The alignment of a data pointer, in bytes.

Target

pub struct Target

The scope for Target operations.

Details

This owner carries no data. Select it with import silk.target { Target } to access its inherent operations.

Associated function Target.arch

pub static fn arch() -> Arch

Returns the selected Arch during static evaluation.

Associated function Target.operatingSystem

pub static fn operatingSystem() -> OperatingSystem

Returns the selected OperatingSystem during static evaluation.

Associated function Target.abi

pub static fn abi() -> Abi

Returns the selected Abi during static evaluation.

Associated function Target.objectFormat

pub static fn objectFormat() -> ObjectFormat

Returns the selected ObjectFormat during static evaluation.

Associated function Target.endianness

pub static fn endianness() -> Endianness

Returns the selected Endianness during static evaluation.

Associated function Target.cpu

pub static fn cpu() -> string<'static>

Returns the logical cpu selection.

Associated function Target.deployment

pub static fn deployment() -> string<'static>

Returns the logical deployment selection.

Associated function Target.hasCpuFeature

pub static fn hasCpuFeature(static value: string<'static>) -> bool

Whether a canonical CPU feature is enabled.

On this page