jit_blocks 0.1.0
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
jit_blocks.h File Reference
#include <sys/types.h>
#include <libgccjit.h>
#include <stdbool.h>
#include "jit_blocks/jit_blocks_export.h"
Include dependency graph for jit_blocks.h:

Go to the source code of this file.

Data Structures

struct  jit_blocks_expr_context
 Context of calculation. More...
 
struct  jit_blocks_dynswitch_cond_t
 A condition for the dynamic switch. More...
 

Typedefs

typedef gcc_jit_context *(* jit_blocks_context_builder_t) (void)
 A jit_blocks_context_builder_t allocates a fresh gcc_jit_context, potentially sets some default options, and returns a new context builder.
 
typedef int(* jit_blocks_divide_by_k_int_t) (int dividend)
 
typedef long(* jit_blocks_divide_by_k_long_t) (long dividend)
 
typedef void(* jit_blocks_funccalls_func_ptr_t) (void *)
 
typedef void(* jit_blocks_funccalls_output_func_t) (void *arg)
 
typedef struct jit_blocks_expr_context jit_blocks_expr_context
 Context of calculation.
 
typedef void(* jit_blocks_expr_func_t) (jit_blocks_expr_context *ctx)
 Users could pass arbitrary functions to process the expression.
 
typedef void(* jit_blocks_dynswitch_func_ptr_t) (void *ctx, long val)
 The function pointer type called in each condition.
 
typedef struct jit_blocks_dynswitch_cond_t jit_blocks_dynswitch_cond_t
 A condition for the dynamic switch.
 
typedef jit_blocks_dynswitch_func_ptr_t jit_blocks_dynswitch_result_t
 The output function pointer type.
 

Functions

JIT_BLOCKS_EXPORT jit_blocks_context_builder_t jit_blocks_get_easy_context_builder (void)
 Returns the global jit_blocks_context_builder_t used for all easy (aka non-aux) APIs.
 
JIT_BLOCKS_EXPORT void jit_blocks_set_easy_context_builder (jit_blocks_context_builder_t builder)
 Sets the global jit_blocks_context_builder_t used for all easy (aka non-aux) APIs.
 
JIT_BLOCKS_EXPORT jit_blocks_divide_by_k_int_t jit_blocks_build_divide_by_k_int (int divisor, gcc_jit_result **out_res)
 
JIT_BLOCKS_EXPORT jit_blocks_divide_by_k_int_t jit_blocks_build_divide_by_k_int_aux (int divisor, gcc_jit_context *custom_context, gcc_jit_result **out_res)
 
JIT_BLOCKS_EXPORT jit_blocks_divide_by_k_long_t jit_blocks_build_divide_by_k_long (long divisor, gcc_jit_result **out_res)
 
JIT_BLOCKS_EXPORT jit_blocks_divide_by_k_long_t jit_blocks_build_divide_by_k_long_aux (long divisor, gcc_jit_context *custom_context, gcc_jit_result **out_res)
 
JIT_BLOCKS_EXPORT jit_blocks_funccalls_output_func_t jit_blocks_funccalls_build (const jit_blocks_funccalls_func_ptr_t *records, int num_records, gcc_jit_result **out_res)
 
JIT_BLOCKS_EXPORT jit_blocks_funccalls_output_func_t jit_blocks_funccalls_build_aux (const jit_blocks_funccalls_func_ptr_t *records, int num_records, gcc_jit_context *custom_context, gcc_jit_result **out_res)
 
JIT_BLOCKS_EXPORT jit_blocks_expr_contextjit_blocks_expr_context_new (int initial_stack_capacity)
 Creates a new context with the given initial stack capacity.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_context_release (jit_blocks_expr_context *ctx)
 Destroys the context and frees all associated resources.
 
JIT_BLOCKS_EXPORT bool jit_blocks_expr_context_push (jit_blocks_expr_context *ctx, double value)
 Pushes a double onto the stack.
 
JIT_BLOCKS_EXPORT bool jit_blocks_expr_context_pop (jit_blocks_expr_context *ctx, double *out_value)
 Pops a double from the stack.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_op_plus (jit_blocks_expr_context *ctx)
 Pops two doubles from the stack, adds them, and pushes the result back.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_op_minus (jit_blocks_expr_context *ctx)
 Pops two doubles from the stack, subtracts the second from the first, and pushes the result back.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_op_multiply (jit_blocks_expr_context *ctx)
 Pops two doubles from the stack, multiplies them, and pushes the result back.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_op_divide (jit_blocks_expr_context *ctx)
 Pops two doubles from the stack, divides the first by the second, and pushes the result back.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_op_negate (jit_blocks_expr_context *ctx)
 Pops a double from the stack, negates it, and pushes the result back.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_op_abs (jit_blocks_expr_context *ctx)
 Pops 1 double from the stack, converts it to its absolute value, and pushes the result back.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_pow (jit_blocks_expr_context *ctx)
 Pops 2 doubles from the stack, computes the power of the first number to the second number, and pushes the result back.
 
JIT_BLOCKS_EXPORT void jit_blocks_expr_ops_parse (const char *ops[], int ops_cnt, jit_blocks_expr_func_t *out_funcs)
 Parses arithmetic operations from the given string, and stores the parsed operations into out_funcs array.
 
JIT_BLOCKS_EXPORT jit_blocks_expr_func_t jit_blocks_expr_build (const jit_blocks_expr_func_t *ops, int num_ops, gcc_jit_result **out_res)
 Creates a function that performs the given arithmetic operations on the initial_ctx stack, and pushes the result back onto the stack.
 
JIT_BLOCKS_EXPORT jit_blocks_expr_func_t jit_blocks_expr_build_aux (const jit_blocks_expr_func_t *ops, int num_ops, gcc_jit_context *ctx, gcc_jit_result **out_res)
 
JIT_BLOCKS_EXPORT jit_blocks_dynswitch_result_t jit_blocks_dynswitch_build (const jit_blocks_dynswitch_cond_t *conds, int num_conds, jit_blocks_dynswitch_func_ptr_t default_func, gcc_jit_result **out_res)
 Builds a function that performs a dynamic switch.
 
JIT_BLOCKS_EXPORT jit_blocks_dynswitch_result_t jit_blocks_dynswitch_build_aux (const jit_blocks_dynswitch_cond_t *conds, int num_conds, jit_blocks_dynswitch_func_ptr_t default_func, gcc_jit_context *ctx, gcc_jit_result **out_res)