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.

uint32_t FuncNode::argCount() constnoexcept

Returns arguments count.

uint32_t FuncNode::retCount() constnoexcept

Returns returns count.

VirtReg** FuncNode::args() constnoexcept

Returns arguments list.

VirtReg* FuncNode::arg(uint32_t i) constnoexcept

Returns argument at i.

void FuncNode::setArg(uint32_t i, VirtReg* vReg)noexcept

Sets argument at i.

void FuncNode::resetArg(uint32_t i)noexcept

Resets argument at i.

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).

VirtReg** FuncNode::_args

Arguments array as VirtReg.