asmjit::CallConv Struct Reference

Function calling convention.

Function calling convention is a scheme that defines how function parameters are passed and how function returns its result. AsmJit defines a variety of architecture and OS specific calling conventions and also provides a compile time detection to make the code-generation easier.

Public Members

Members

Static Public Attributes

Constants

Classes

Member Functions

Construction & Destruction
Accessors

Member Function Documentation

Error CallConv::init(CallConvId ccId, const Environment& environment)noexcept◆ 

Initializes this calling convention to the given ccId based on the environment.

See CallConvId and Environment for more details.

void CallConv::reset()noexcept◆ 

Resets this CallConv struct into a defined state.

It's recommended to reset the CallConv struct in case you would like create a custom calling convention as it prevents from using an uninitialized data (CallConv doesn't have a constructor that would initialize it, it's just a struct).

Arch CallConv::arch() constnoexcept◆ 

Returns the target architecture of this calling convention.

void CallConv::setArch(Arch arch)noexcept◆ 

Sets the target architecture of this calling convention.

CallConvId CallConv::id() constnoexcept◆ 

Returns the calling convention id.

void CallConv::setId(CallConvId ccId)noexcept◆ 

Sets the calling convention id.

CallConvStrategy CallConv::strategy() constnoexcept◆ 

Returns the strategy used to assign registers to arguments.

void CallConv::setStrategy(CallConvStrategy ccStrategy)noexcept◆ 

Sets the strategy used to assign registers to arguments.

bool CallConv::hasFlag(CallConvFlags flag) constnoexcept◆ 

Tests whether the calling convention has the given flag set.

CallConvFlags CallConv::flags() constnoexcept◆ 

Returns the calling convention flags, see Flags.

void CallConv::setFlags(CallConvFlags flag)noexcept◆ 

Adds the calling convention flags, see Flags.

void CallConv::addFlags(CallConvFlags flags)noexcept◆ 

Adds the calling convention flags, see Flags.

bool CallConv::hasRedZone() constnoexcept◆ 

Tests whether this calling convention specifies 'RedZone'.

bool CallConv::hasSpillZone() constnoexcept◆ 

Tests whether this calling convention specifies 'SpillZone'.

uint32_t CallConv::redZoneSize() constnoexcept◆ 

Returns size of 'RedZone'.

uint32_t CallConv::spillZoneSize() constnoexcept◆ 

Returns size of 'SpillZone'.

void CallConv::setRedZoneSize(uint32_t size)noexcept◆ 

Sets size of 'RedZone'.

void CallConv::setSpillZoneSize(uint32_t size)noexcept◆ 

Sets size of 'SpillZone'.

uint32_t CallConv::naturalStackAlignment() constnoexcept◆ 

Returns a natural stack alignment.

void CallConv::setNaturalStackAlignment(uint32_t value)noexcept◆ 

Sets a natural stack alignment.

This function can be used to override the default stack alignment in case that you know that it's alignment is different. For example it allows to implement custom calling conventions that guarantee higher stack alignment.

uint32_t CallConv::saveRestoreRegSize(RegGroup group) constnoexcept◆ 

Returns the size of a register (or its part) to be saved and restored of the given group.

void CallConv::setSaveRestoreRegSize(RegGroup group, uint32_t size)noexcept◆ 

Sets the size of a vector register (or its part) to be saved and restored.

uint32_t CallConv::saveRestoreAlignment(RegGroup group) constnoexcept◆ 

Returns the alignment of a save-restore area of the given group.

void CallConv::setSaveRestoreAlignment(RegGroup group, uint32_t alignment)noexcept◆ 

Sets the alignment of a save-restore area of the given group.

const uint8_t* CallConv::passedOrder(RegGroup group) constnoexcept◆ 

Returns the order of passed registers of the given group.

RegMask CallConv::passedRegs(RegGroup group) constnoexcept◆ 

Returns the mask of passed registers of the given group.

void CallConv::setPassedToNone(RegGroup group)noexcept◆ 

Resets the order and mask of passed registers.

void CallConv::setPassedOrder(RegGroup group, uint32_t a0, uint32_t a1 = 0xFF, uint32_t a2 = 0xFF, uint32_t a3 = 0xFF, uint32_t a4 = 0xFF, uint32_t a5 = 0xFF, uint32_t a6 = 0xFF, uint32_t a7 = 0xFF)noexcept◆ 

Sets the order and mask of passed registers.

RegMask CallConv::preservedRegs(RegGroup group) constnoexcept◆ 

Returns preserved register mask of the given group.

void CallConv::setPreservedRegs(RegGroup group, RegMask regs)noexcept◆ 

Sets preserved register mask of the given group.

Member Data Documentation

uint32_t CallConv::kMaxRegArgsPerGroup = 16constexprstaticconstexpr◆ 

Maximum number of register arguments per register group.

Note
This is not really AsmJit's limitation, it's just the number that makes sense considering all common calling conventions. Usually even conventions that use registers to pass function arguments are limited to 8 and less arguments passed via registers per group.

Arch CallConv::_arch◆ 

Target architecture.

CallConvId CallConv::_id◆ 

Calling convention id.

CallConvStrategy CallConv::_strategy◆ 

Register assignment strategy.

uint8_t CallConv::_redZoneSize◆ 

Red zone size (AMD64 == 128 bytes).

uint8_t CallConv::_spillZoneSize◆ 

Spill zone size (WIN-X64 == 32 bytes).

uint8_t CallConv::_naturalStackAlignment◆ 

Natural stack alignment as defined by OS/ABI.

CallConvFlags CallConv::_flags◆ 

Calling convention flags.

Support::Array<uint8_t, Globals::kNumVirtGroups>CallConv::_saveRestoreRegSize◆ 

Size to save/restore per register group.

Support::Array<uint8_t, Globals::kNumVirtGroups>CallConv::_saveRestoreAlignment◆ 

Alignment of save/restore groups.

Support::Array<RegMask, Globals::kNumVirtGroups>CallConv::_passedRegs◆ 

Mask of all passed registers, per group.

Support::Array<RegMask, Globals::kNumVirtGroups>CallConv::_preservedRegs◆ 

Mask of all preserved registers, per group.

Support::Array<RegOrder, Globals::kNumVirtGroups>CallConv::_passedOrder◆ 

Passed registers' order, per register group.