asmjit::Environment Class Reference

Represents an environment, which is usually related to a Target.

Environment has usually an 'arch-subarch-vendor-os-abi' format, which is sometimes called "Triple" (historically it used to be 3 only parts) or "Tuple", which is a convention used by Debian Linux.

AsmJit doesn't support all possible combinations or architectures and ABIs, however, it models the environment similarly to other compilers for future extensibility.

Public Members

Static Public Attributes

Environment Detection

Public Types

Member Functions

Construction / Destruction
Overloaded Operators
Accessors

Static Functions

Static Utilities

Member Enumeration Documentation

Environment::Arch : uint32_tenum

Architecture.

ConstantDescription
kArchUnknown 

Unknown or uninitialized architecture.

kArch32BitMask 

Mask used by 32-bit architectures (odd are 32-bit, even are 64-bit).

kArchBigEndianMask 

Mask used by big-endian architectures.

kArchX86 

32-bit X86 architecture.

kArchX64 

64-bit X86 architecture also known as X86_64 and AMD64.

kArchRISCV32 

32-bit RISC-V architecture.

kArchRISCV64 

64-bit RISC-V architecture.

kArchARM 

32-bit ARM architecture (little endian).

kArchARM_BE 

32-bit ARM architecture (big endian).

kArchAArch64 

64-bit ARM architecture in (little endian).

kArchAArch64_BE 

64-bit ARM architecture in (big endian).

kArchThumb 

32-bit ARM in Thumb mode (little endian).

kArchThumb_BE 

32-bit ARM in Thumb mode (big endian).

kArchMIPS32_LE 

32-bit MIPS architecture in (little endian).

kArchMIPS32_BE 

32-bit MIPS architecture in (big endian).

kArchMIPS64_LE 

64-bit MIPS architecture in (little endian).

kArchMIPS64_BE 

64-bit MIPS architecture in (big endian).

kArchCount 

Count of architectures.

Environment::SubArch : uint32_tenum

Sub-architecture.

ConstantDescription
kSubArchUnknown 

Unknown or uninitialized architecture sub-type.

kSubArchCount 

Count of sub-architectures.

Environment::Vendor : uint32_tenum

Vendor.

Note
AsmJit doesn't use vendor information at the moment. It's provided for future use, if required.
ConstantDescription
kVendorUnknown 

Unknown or uninitialized vendor.

kVendorCount 

Count of vendor identifiers.

Environment::Platform : uint32_tenum

Platform / OS.

ConstantDescription
kPlatformUnknown 

Unknown or uninitialized platform.

kPlatformWindows 

Windows OS.

kPlatformOther 

Other platform, most likely POSIX based.

kPlatformLinux 

Linux OS.

kPlatformHurd 

GNU/Hurd OS.

kPlatformFreeBSD 

FreeBSD OS.

kPlatformOpenBSD 

OpenBSD OS.

kPlatformNetBSD 

NetBSD OS.

kPlatformDragonFlyBSD 

DragonFly BSD OS.

kPlatformHaiku 

Haiku OS.

kPlatformOSX 

Apple OSX.

kPlatformIOS 

Apple iOS.

kPlatformTVOS 

Apple TVOS.

kPlatformWatchOS 

Apple WatchOS.

kPlatformEmscripten 

Emscripten platform.

kPlatformCount 

Count of platform identifiers.

Environment::Abi : uint32_tenum

ABI.

ConstantDescription
kAbiUnknown 

Unknown or uninitialied environment.

kAbiMSVC 

Microsoft ABI.

kAbiGNU 

GNU ABI.

kAbiAndroid 

Android Environment / ABI.

kAbiCygwin 

Cygwin ABI.

kAbiCount 

Count of known ABI types.

Environment::Format : uint32_tenum

Object format.

Note
AsmJit doesn't really use anything except kFormatUnknown and kFormatJIT at the moment. Object file formats are provided for future extensibility and a possibility to generate object files at some point.
ConstantDescription
kFormatUnknown 

Unknown or uninitialized object format.

kFormatJIT 

JIT code generation object, most likely JitRuntime or a custom Target implementation.

kFormatELF 

Executable and linkable format (ELF).

kFormatCOFF 

Common object file format.

kFormatXCOFF 

Extended COFF object format.

kFormatMachO 

Mach object file format.

kFormatCount 

Count of object format types.

Member Function Documentation

bool Environment::empty() constnoexcept

Tests whether the environment is not set up.

Returns true if all members are zero, and thus unknown.

bool Environment::isInitialized() constnoexcept

Tests whether the environment is intialized, which means it must have a valid architecture.

void Environment::reset()noexcept

Resets all members of the environment to zero / unknown.

uint32_t Environment::arch() constnoexcept

Returns the architecture, see Arch.

uint32_t Environment::subArch() constnoexcept

Returns the sub-architecture, see SubArch.

uint32_t Environment::vendor() constnoexcept

Returns vendor, see Vendor.

uint32_t Environment::platform() constnoexcept

Returns target's platform or operating system, see Platform.

uint32_t Environment::abi() constnoexcept

Returns target's ABI, see Abi.

uint32_t Environment::format() constnoexcept

Returns target's object format, see Format.

bool Environment::is32Bit() constnoexcept[1/2]

Tests whether the architecture is 32-bit.

bool Environment::is64Bit() constnoexcept[1/2]

Tests whether the architecture is 64-bit.

bool Environment::isLittleEndian() constnoexcept[1/2]

Tests whether the architecture is little endian.

bool Environment::isBigEndian() constnoexcept[1/2]

Tests whether the architecture is big endian.

bool Environment::isFamilyX86() constnoexcept[1/2]

Tests whether this architecture is of X86 family.

bool Environment::isFamilyRISCV() constnoexcept[1/2]

Tests whether this architecture family is RISC-V (both 32-bit and 64-bit).

bool Environment::isFamilyARM() constnoexcept[1/2]

Tests whether this architecture family is ARM, Thumb, or AArch64.

bool Environment::isFamilyMIPS() constnoexcept[1/2]

Tests whether this architecture family is MISP or MIPS64.

bool Environment::isPlatformWindows() constnoexcept

Tests whether the environment platform is Windows.

bool Environment::isPlatformLinux() constnoexcept

Tests whether the environment platform is Linux.

bool Environment::isPlatformHurd() constnoexcept

Tests whether the environment platform is Hurd.

bool Environment::isPlatformHaiku() constnoexcept

Tests whether the environment platform is Haiku.

bool Environment::isPlatformBSD() constnoexcept

Tests whether the environment platform is any BSD.

bool Environment::isPlatformApple() constnoexcept

Tests whether the environment platform is any Apple platform (OSX, iOS, TVOS, WatchOS).

bool Environment::isAbiMSVC() constnoexcept

Tests whether the ABI is MSVC.

bool Environment::isAbiGNU() constnoexcept

Tests whether the ABI is GNU.

uint32_t Environment::stackAlignment() constnoexcept

Returns a calculated stack alignment for this environment.

uint32_t Environment::registerSize() constnoexcept

Returns a native register size of this architecture.

void Environment::setArch(uint32_t arch)noexcept

Sets the architecture to arch.

void Environment::setSubArch(uint32_t subArch)noexcept

Sets the sub-architecture to subArch.

void Environment::setVendor(uint32_t vendor)noexcept

Sets the vendor to vendor.

void Environment::setPlatform(uint32_t platform)noexcept

Sets the platform to platform.

void Environment::setAbi(uint32_t abi)noexcept

Sets the ABI to abi.

void Environment::setFormat(uint32_t format)noexcept

Sets the object format to format.

bool Environment::is32Bit(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture arch is 32-bit.

bool Environment::is64Bit(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture arch is 64-bit.

bool Environment::isLittleEndian(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture arch is little endian.

bool Environment::isBigEndian(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture arch is big endian.

bool Environment::isArchAArch64(uint32_t arch)staticnoexcept

Tests whether the given architecture is AArch64.

bool Environment::isFamilyX86(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture family is X86 or X64.

bool Environment::isFamilyRISCV(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture family is RISC-V (both 32-bit and 64-bit).

bool Environment::isFamilyARM(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture family is ARM, Thumb, or AArch64.

bool Environment::isFamilyMIPS(uint32_t arch)staticnoexcept[2/2]

Tests whether the given architecture family is MISP or MIPS64.

uint32_t Environment::registerSizeFromArch(uint32_t arch)staticnoexcept

Returns a native general purpose register size from the given architecture.

Member Data Documentation

uint8_t Environment::_arch

Architecture type, see Arch.

uint8_t Environment::_subArch

Sub-architecture type, see SubArch.

uint8_t Environment::_vendor

Vendor type, see Vendor.

uint8_t Environment::_platform

Platform type, see Platform.

uint8_t Environment::_abi

ABI type, see Abi.

uint8_t Environment::_format

Object format, see Format.

uint16_t Environment::_reserved

Reserved for future use, must be zero.

Arch Environment::kArchHost = DETECTED_AT_COMPILE_TIMEconstexprstaticconstexpr

Architecture detected at compile-time (architecture of the host).

SubArch Environment::kSubArchHost = DETECTED_AT_COMPILE_TIMEconstexprstaticconstexpr

Sub-architecture detected at compile-time (sub-architecture of the host).

Vendor Environment::kVendorHost = DETECTED_AT_COMPILE_TIMEconstexprstaticconstexpr

Vendor detected at compile-time (vendor of the host).

Platform Environment::kPlatformHost = DETECTED_AT_COMPILE_TIMEconstexprstaticconstexpr

Platform detected at compile-time (platform of the host).

Abi Environment::kAbiHost = DETECTED_AT_COMPILE_TIMEconstexprstaticconstexpr

ABI detected at compile-time (ABI of the host).