asmjit::FuncNode Class Reference

Function node represents a function used by BaseCompiler.

A function is composed of the following:

In a node list, the function and its body looks like the following:

[...] - Anything before the function.
[FuncNode] - Entry point of the function, acts as a label as well.
<Prolog> - Prolog inserted by the register allocator.
{...} - Function body - user code basically.
[ExitLabel] - Exit label
<Epilog> - Epilog inserted by the register allocator.
<Return> - Return inserted by the register allocator.
{...} - Can contain data or user code (error handling, special cases, ...).
[FuncEnd] - End sentinel
[...] - Anything after the function.

When a function is added to the compiler by BaseCompiler::addFunc() it actually inserts 3 nodes (FuncNode, ExitLabel, and FuncEnd) and sets the current cursor to be FuncNode. When BaseCompiler::endFunc() is called the cursor is set to FuncEnd. This guarantees that user can use ExitLabel as a marker after additional code or data can be placed, and it's a common practice.

Public Members

- Public Attributes inherited from asmjit::LabelNode
- Public Attributes inherited from asmjit::BaseNode


Member Functions

Construction & Destruction
- Public Member Functions inherited from asmjit::LabelNode
- Public Member Functions inherited from asmjit::BaseNode

Additional Inherited Members

- Public Types inherited from asmjit::BaseNode

Constructor & Destructor Documentation

FuncNode::FuncNode(BaseBuilder* cb)noexcept

Creates a new FuncNode instance.

Always use BaseCompiler::addFunc() to create FuncNode.

Member Function Documentation

LabelNode* FuncNode::exitNode() constnoexcept

Returns function exit LabelNode.

Label FuncNode::exitLabel() constnoexcept

Returns function exit label.

SentinelNode* FuncNode::endNode() constnoexcept

Returns "End of Func" sentinel.

FuncDetail& FuncNode::detail()noexcept[1/2]

Returns function declaration.

const FuncDetail& FuncNode::detail() constnoexcept[2/2]

Returns function declaration.

FuncFrame& FuncNode::frame()noexcept[1/2]

Returns function frame.

const FuncFrame& FuncNode::frame() constnoexcept[2/2]

Returns function frame.

bool FuncNode::hasRet() constnoexcept

Tests whether the function has a return value.

uint32_t FuncNode::argCount() constnoexcept

Returns arguments count.

ArgPack* FuncNode::argPacks() constnoexcept

Returns argument packs.

ArgPack& FuncNode::argPack(size_t argIndex) constnoexcept

Returns argument pack at argIndex.

void FuncNode::setArg(size_t argIndex, VirtReg* vReg)noexcept[1/2]

Sets argument at argIndex.

void FuncNode::setArg(size_t argIndex, size_t valueIndex, VirtReg* vReg)noexcept[2/2]

Sets argument at argIndex and valueIndex.

void FuncNode::resetArg(size_t argIndex)noexcept[1/2]

Resets argument pack at argIndex.

void FuncNode::resetArg(size_t argIndex, size_t valueIndex)noexcept[2/2]

Resets argument pack at argIndex.

uint32_t FuncNode::attributes() constnoexcept

Returns function attributes.

void FuncNode::addAttributes(uint32_t attrs)noexcept

Adds attrs to the function attributes.

Member Data Documentation

FuncDetail FuncNode::_funcDetail

Function detail.

FuncFrame FuncNode::_frame

Function frame.

LabelNode* FuncNode::_exitNode

Function exit label.

SentinelNode* FuncNode::_end

Function end (sentinel).

ArgPack* FuncNode::_args

Argument packs.