BFC-Compiler
A C23 Brainfuck compiler
Loading...
Searching...
No Matches
bfc_codegen_internal.h File Reference

Internal backend contract and assembly representation. More...

#include <stddef.h>
#include <stdint.h>
#include "bfc_codegen.h"
#include "bfc_target.h"

Go to the source code of this file.

Data Structures

struct  bfc_backend_t
 Immutable callback table implemented by one target backend. More...
struct  bfc_asm
 Mutable assembly-generation state shared by generic codegen and backends. More...

Functions

bfc_error_t bfc_codegen_emit_text (bfc_asm_t *asm_prog, const char *text)
 Appends raw text to the assembly buffer.
bfc_error_t bfc_codegen_emit_block (bfc_asm_t *asm_prog, const bfc_ir_block_t *ir_block)
 Recursively emits every instruction in an IR block.
bfc_error_t bfc_codegen_emitf (bfc_asm_t *asm_prog, const char *format,...)
 Formats and appends one assembly fragment.

Variables

const bfc_backend_t BFC_BACKEND_WINDOWS_X86_64
 Backend descriptor declarations.
const bfc_backend_t BFC_BACKEND_WINDOWS_I386
const bfc_backend_t BFC_BACKEND_WINDOWS_AARCH64
const bfc_backend_t BFC_BACKEND_MACOS_AARCH64
 Immutable backend descriptor exported to generic code generation.
const bfc_backend_t BFC_BACKEND_MACOS_X86_64
 Immutable backend descriptor exported to generic code generation.
const bfc_backend_t BFC_BACKEND_LINUX_AARCH64
const bfc_backend_t BFC_BACKEND_LINUX_X86_64

Detailed Description

Internal backend contract and assembly representation.

Shared only by generic code generation and target-specific backend implementations.

Function Documentation

◆ bfc_codegen_emit_block()

bfc_error_t bfc_codegen_emit_block ( bfc_asm_t * asm_prog,
const bfc_ir_block_t * ir_block )

Recursively emits every instruction in an IR block.

Dispatches every IR operation through the active backend.

Recursively emits every instruction in an IR block.

◆ bfc_codegen_emit_text()

bfc_error_t bfc_codegen_emit_text ( bfc_asm_t * asm_prog,
const char * text )

Appends raw text to the assembly buffer.

Appends null-terminated text while preserving the assembly-buffer invariant.

Appends raw text to the assembly buffer.

◆ bfc_codegen_emitf()

bfc_error_t bfc_codegen_emitf ( bfc_asm_t * asm_prog,
const char * format,
... )

Formats and appends one assembly fragment.

Formats one assembly fragment into a bounded temporary buffer and appends it.

Formats and appends one assembly fragment.

Variable Documentation

◆ BFC_BACKEND_WINDOWS_X86_64

const bfc_backend_t BFC_BACKEND_WINDOWS_X86_64
extern

Backend descriptor declarations.