static void make_types (struct top_level *top_level) { top_level->numeric_type = gcc_jit_context_get_type (top_level->ctxt, GCC_JIT_TYPE_DOUBLE); top_level->numeric_type_ptr = gcc_jit_type_get_pointer (top_level->numeric_type); top_level->zero = gcc_jit_context_zero (top_level->ctxt, top_level->numeric_type); top_level->int_type = gcc_jit_context_get_type (top_level->ctxt, GCC_JIT_TYPE_INT); top_level->void_type = gcc_jit_context_get_type (top_level->ctxt, GCC_JIT_TYPE_VOID); top_level->a = gcc_jit_context_new_field (top_level->ctxt, NULL, top_level->numeric_type, "a"); top_level->b = gcc_jit_context_new_field (top_level->ctxt, NULL, top_level->numeric_type, "b"); top_level->c = gcc_jit_context_new_field (top_level->ctxt, NULL, top_level->numeric_type, "c"); top_level->discriminant = gcc_jit_context_new_field (top_level->ctxt, NULL, top_level->numeric_type, "discriminant"); gcc_jit_field *fields[] = {top_level->a, top_level->b, top_level->c, top_level->discriminant}; top_level->struct_quadratic = gcc_jit_struct_as_type ( gcc_jit_context_new_struct_type (top_level->ctxt, NULL, "quadratic", 4, fields)); top_level->quadratic_ptr = gcc_jit_type_get_pointer (top_level->struct_quadratic); }
void create_code (gcc_jit_context *ctxt, void *user_data) { /* Let's try to inject the equivalent of: struct foo; extern void called_function (struct foo *ptr); void test_fn () { struct foo f; called_function (f); } and verify that we get a type error (foo * vs foo). */ gcc_jit_type *void_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); gcc_jit_struct *struct_foo = gcc_jit_context_new_struct_type (ctxt, NULL, "foo", 0, NULL); gcc_jit_type *foo_ptr = gcc_jit_type_get_pointer (gcc_jit_struct_as_type (struct_foo)); gcc_jit_param *param = gcc_jit_context_new_param (ctxt, NULL, foo_ptr, "ptr"); gcc_jit_function *called_function = gcc_jit_context_new_function (ctxt, NULL, GCC_JIT_FUNCTION_IMPORTED, void_type, "called_function", 1, ¶m, 0); gcc_jit_function *test_fn = gcc_jit_context_new_function (ctxt, NULL, GCC_JIT_FUNCTION_EXPORTED, void_type, "test_fn", 0, NULL, 0); gcc_jit_lvalue *f = gcc_jit_function_new_local ( test_fn, NULL, gcc_jit_struct_as_type (struct_foo), "f"); gcc_jit_block *block = gcc_jit_function_new_block (test_fn, NULL); gcc_jit_rvalue *arg = gcc_jit_lvalue_as_rvalue (f); gcc_jit_block_add_eval ( block, NULL, gcc_jit_context_new_call ( ctxt, NULL, called_function, 1, &arg)); gcc_jit_block_end_with_void_return (block, NULL); }
static void create_use_of_void_return (gcc_jit_context *ctxt) { /* Let's try to inject the equivalent of: void test_of_void_return (int *out) { *out = 1; return; } */ gcc_jit_type *void_t = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); gcc_jit_type *int_t = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); gcc_jit_type *int_ptr_t = gcc_jit_type_get_pointer (int_t); /* Build the test_fn. */ gcc_jit_param *param_out = gcc_jit_context_new_param (ctxt, NULL, int_ptr_t, "out"); gcc_jit_function *test_fn = gcc_jit_context_new_function (ctxt, NULL, GCC_JIT_FUNCTION_EXPORTED, void_t, "test_of_void_return", 1, ¶m_out, 0); gcc_jit_block *initial = gcc_jit_function_new_block (test_fn, "initial"); gcc_jit_block_add_assignment ( initial, NULL, /* "*out = ..." */ gcc_jit_rvalue_dereference (gcc_jit_param_as_rvalue (param_out), NULL), gcc_jit_context_one (ctxt, int_t)); gcc_jit_block_end_with_void_return (initial, NULL); }
static void create_overflow_fn (gcc_jit_context *ctxt, gcc_jit_type *type, const char *funcname, const char *builtin_name) { /* Create the equivalent of this C: int test_overflow_T_OP (T x, T y, int *ovf) { T result; result = x OP y; *ovf = ...; // did overflow happen? return result; } */ gcc_jit_type *t_bool = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_BOOL); gcc_jit_type *t_bool_star = gcc_jit_type_get_pointer (t_bool); gcc_jit_param *x = gcc_jit_context_new_param ( ctxt, NULL, type, "x"); gcc_jit_param *y = gcc_jit_context_new_param ( ctxt, NULL, type, "y"); gcc_jit_param *ovf = gcc_jit_context_new_param ( ctxt, NULL, t_bool_star, "ovf"); gcc_jit_param *params[3] = {x, y, ovf}; gcc_jit_function *func = gcc_jit_context_new_function (ctxt, NULL, GCC_JIT_FUNCTION_EXPORTED, type, funcname, 3, params, 0); gcc_jit_lvalue *result = gcc_jit_function_new_local (func, NULL, type, "result"); gcc_jit_block *b_initial = gcc_jit_function_new_block (func, "initial"); /* The builtins are listed in builtins.def as being variadic, but the have these signatures: bool __builtin_add_overflow (type1 a, type2 b, type3 *res); bool __builtin_sub_overflow (type1 a, type2 b, type3 *res); bool __builtin_mul_overflow (type1 a, type2 b, type3 *res); */ gcc_jit_function *builtin_fn = gcc_jit_context_get_builtin_function (ctxt, builtin_name); /* Construct a call of the form: (returns bool) __builtin_add_overflow (x, y, &result). */ gcc_jit_rvalue *args[3] = {gcc_jit_param_as_rvalue (x), gcc_jit_param_as_rvalue (y), gcc_jit_lvalue_get_address (result, NULL)}; gcc_jit_rvalue *call = gcc_jit_context_new_call (ctxt, NULL, builtin_fn, 3, args); /* "*ovf = BUILTIN_CALL ();" */ gcc_jit_block_add_assignment ( b_initial, NULL, gcc_jit_rvalue_dereference (gcc_jit_param_as_rvalue (ovf), NULL), call); /* "return result;" */ gcc_jit_block_end_with_return ( b_initial, NULL, gcc_jit_lvalue_as_rvalue (result)); }
/* Build various compound expressions, and verify that they have sane debug strings. */ void create_code (gcc_jit_context *ctxt, void *user_data) { /* Make a singly-linked list type: struct node { struct node *next; int value; }; */ gcc_jit_type *t_int = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); gcc_jit_struct *t_node = gcc_jit_context_new_opaque_struct (ctxt, NULL, "node"); gcc_jit_type *t_node_ptr = gcc_jit_type_get_pointer (gcc_jit_struct_as_type (t_node)); gcc_jit_field *f_next = gcc_jit_context_new_field (ctxt, NULL, t_node_ptr, "next"); gcc_jit_field *f_value = gcc_jit_context_new_field (ctxt, NULL, t_int, "value"); gcc_jit_field *fields[] = {f_next, f_value}; gcc_jit_struct_set_fields (t_node, NULL, 2, fields); /* Create a dummy function so that we have locals/params to build expressions with. */ gcc_jit_type *t_void = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); gcc_jit_function *fn = gcc_jit_context_new_function (ctxt, NULL, GCC_JIT_FUNCTION_EXPORTED, t_void, "test_debug_strings", 0, NULL, 0); gcc_jit_rvalue *ptr = gcc_jit_lvalue_as_rvalue ( gcc_jit_function_new_local (fn, NULL, t_node_ptr, "ptr")); gcc_jit_rvalue *a = gcc_jit_lvalue_as_rvalue ( gcc_jit_function_new_local (fn, NULL, t_int, "a")); gcc_jit_rvalue *b = gcc_jit_lvalue_as_rvalue ( gcc_jit_function_new_local (fn, NULL, t_int, "b")); gcc_jit_rvalue *c = gcc_jit_lvalue_as_rvalue ( gcc_jit_function_new_local (fn, NULL, t_int, "c")); gcc_jit_rvalue *d = gcc_jit_lvalue_as_rvalue ( gcc_jit_function_new_local (fn, NULL, t_int, "d")); #define CHECK_RVALUE_DEBUG_STRING(RVALUE, EXPECTED) \ CHECK_STRING_VALUE ( \ gcc_jit_object_get_debug_string (gcc_jit_rvalue_as_object (RVALUE)), \ (EXPECTED)) #define CHECK_LVALUE_DEBUG_STRING(LVALUE, EXPECTED) \ CHECK_STRING_VALUE ( \ gcc_jit_object_get_debug_string (gcc_jit_lvalue_as_object (LVALUE)), \ (EXPECTED)) /* Verify various simple compound expressions. */ { CHECK_RVALUE_DEBUG_STRING (ptr, "ptr"); gcc_jit_lvalue *deref = gcc_jit_rvalue_dereference_field (ptr, NULL, f_value); CHECK_LVALUE_DEBUG_STRING (deref, "ptr->value"); gcc_jit_rvalue *deref_as_rvalue = gcc_jit_lvalue_as_rvalue (deref); #define BINOP(OP, A, B) \ gcc_jit_context_new_binary_op (ctxt, NULL, \ GCC_JIT_BINARY_OP_##OP, t_int, (A), (B)) #define COMPARISON(OP, A, B) \ gcc_jit_context_new_comparison (ctxt, NULL, \ GCC_JIT_COMPARISON_##OP,(A), (B)) CHECK_RVALUE_DEBUG_STRING ( BINOP (PLUS, deref_as_rvalue, deref_as_rvalue), "ptr->value + ptr->value"); CHECK_RVALUE_DEBUG_STRING ( BINOP (MULT, deref_as_rvalue, deref_as_rvalue), "ptr->value * ptr->value"); /* Multiplication has higher precedence in C than addition, so this dump shouldn't contain parentheses. */ CHECK_RVALUE_DEBUG_STRING ( BINOP (PLUS, BINOP (MULT, a, b), BINOP (MULT, c, d)), "a * b + c * d"); /* ...but this one should. */ CHECK_RVALUE_DEBUG_STRING ( BINOP (MULT, BINOP (PLUS, a, b), BINOP (PLUS, c, d)), "(a + b) * (c + d)"); /* Equal precedences don't need parentheses. */ CHECK_RVALUE_DEBUG_STRING ( BINOP (MULT, BINOP (MULT, a, b), BINOP (MULT, c, d)), "a * b * c * d"); /* Comparisons and logical ops. */ CHECK_RVALUE_DEBUG_STRING ( COMPARISON (LT, a, b), "a < b"); CHECK_RVALUE_DEBUG_STRING ( BINOP (LOGICAL_AND, COMPARISON (LT, a, b), COMPARISON (GT, c, d)), "a < b && c > d"); CHECK_RVALUE_DEBUG_STRING ( BINOP (LOGICAL_AND, BINOP (LOGICAL_OR, COMPARISON (LT, a, b), COMPARISON (LT, a, c)), BINOP (LOGICAL_OR, COMPARISON (GT, d, b), COMPARISON (GT, d, c))), "(a < b || a < c) && (d > b || d > c)"); CHECK_RVALUE_DEBUG_STRING ( BINOP (LOGICAL_OR, BINOP (LOGICAL_AND, COMPARISON (LT, a, b), COMPARISON (LT, a, c)), BINOP (LOGICAL_AND, COMPARISON (GT, d, b), COMPARISON (GT, d, c))), "a < b && a < c || d > b && d > c"); #undef BINOP #undef COMPARISON } /* PR jit/66539 "Missing parentheses in jit dumps". Construct the equivalent of ((cast)ptr->next)->next and verify that the appropriate parentheses appear in the debug string. */ { /* "ptr->next". */ gcc_jit_lvalue *inner_deref = gcc_jit_rvalue_dereference_field (ptr, NULL, f_next); /* "((node *)ptr->next)"; the cast is redundant, purely to exercise dumping. */ gcc_jit_rvalue *test_cast = gcc_jit_context_new_cast (ctxt, NULL, gcc_jit_lvalue_as_rvalue (inner_deref), t_node_ptr); /* "((node *)ptr->next)->next". */ gcc_jit_lvalue *outer_deref = gcc_jit_rvalue_dereference_field (test_cast, /* gcc_jit_rvalue *ptr */ NULL, /* gcc_jit_location *loc */ f_next); /* gcc_jit_field *field */ CHECK_LVALUE_DEBUG_STRING (outer_deref, "((struct node *)ptr->next)->next"); } #undef CHECK_LVALUE_DEBUG_STRING }
void create_code (gcc_jit_context *ctxt, void *user_data) { /* Let's try to inject the equivalent of: double test_nested_loops (int n, double *a, double *b) { double result = 0.; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) result += a[i] * b[j]; return result } */ gcc_jit_type *val_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_DOUBLE); gcc_jit_type *ptr_type = gcc_jit_type_get_pointer (val_type); gcc_jit_type *int_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); gcc_jit_type *return_type = val_type; gcc_jit_param *param_n = gcc_jit_context_new_param (ctxt, NULL, int_type, "n"); gcc_jit_param *param_a = gcc_jit_context_new_param (ctxt, NULL, ptr_type, "a"); gcc_jit_param *param_b = gcc_jit_context_new_param (ctxt, NULL, ptr_type, "b"); gcc_jit_param *params[3] = {param_n, param_a, param_b}; gcc_jit_function *func = gcc_jit_context_new_function (ctxt, NULL, GCC_JIT_FUNCTION_EXPORTED, return_type, "test_nested_loops", 3, params, 0); /* Create locals. */ gcc_jit_lvalue *result = gcc_jit_function_new_local (func, NULL, val_type, "result"); gcc_jit_lvalue *i = gcc_jit_function_new_local (func, NULL, int_type, "i"); gcc_jit_lvalue *j = gcc_jit_function_new_local (func, NULL, int_type, "j"); /* Create basic blocks. */ gcc_jit_block *b_entry = gcc_jit_function_new_block (func, "b_entry"); gcc_jit_block *b_outer_loop_cond = gcc_jit_function_new_block (func, "b_outer_loop_cond"); gcc_jit_block *b_outer_loop_head = gcc_jit_function_new_block (func, "b_outer_loop_head"); gcc_jit_block *b_outer_loop_tail = gcc_jit_function_new_block (func, "b_outer_loop_tail"); gcc_jit_block *b_inner_loop_cond = gcc_jit_function_new_block (func, "b_inner_loop_cond"); gcc_jit_block *b_inner_loop_body = gcc_jit_function_new_block (func, "b_inner_loop_body"); gcc_jit_block *b_exit = gcc_jit_function_new_block (func, "b_exit"); /* Populate b_entry. */ /* "result = 0.;" */ gcc_jit_block_add_assignment ( b_entry, NULL, result, gcc_jit_context_zero (ctxt, val_type)); /* "i = 0;" */ gcc_jit_block_add_assignment ( b_entry, NULL, i, gcc_jit_context_zero (ctxt, int_type)); gcc_jit_block_end_with_jump (b_entry, NULL, b_outer_loop_cond); /* Populate b_outer_loop_cond. */ gcc_jit_block_end_with_conditional ( b_outer_loop_cond, NULL, /* (i < n) */ gcc_jit_context_new_comparison ( ctxt, NULL, GCC_JIT_COMPARISON_LT, gcc_jit_lvalue_as_rvalue (i), gcc_jit_param_as_rvalue (param_n)), b_outer_loop_head, b_exit); /* Populate b_outer_loop_head. */ /* j = 0; */ gcc_jit_block_add_assignment ( b_outer_loop_head, NULL, j, gcc_jit_context_zero (ctxt, int_type)); gcc_jit_block_end_with_jump (b_outer_loop_head, NULL, b_inner_loop_cond); /* Populate b_inner_loop_cond. */ gcc_jit_block_end_with_conditional ( b_inner_loop_cond, NULL, /* (j < n) */ gcc_jit_context_new_comparison ( ctxt, NULL, GCC_JIT_COMPARISON_LT, gcc_jit_lvalue_as_rvalue (j), gcc_jit_param_as_rvalue (param_n)), b_inner_loop_body, b_outer_loop_tail); /* Populate b_inner_loop_body. */ /* "result += a[i] * b[j];" */ gcc_jit_block_add_assignment_op ( b_inner_loop_body, NULL, result, GCC_JIT_BINARY_OP_PLUS, gcc_jit_context_new_binary_op ( ctxt, NULL, GCC_JIT_BINARY_OP_MULT, val_type, gcc_jit_lvalue_as_rvalue ( gcc_jit_context_new_array_access( ctxt, NULL, gcc_jit_param_as_rvalue (param_a), gcc_jit_lvalue_as_rvalue (i))), gcc_jit_lvalue_as_rvalue ( gcc_jit_context_new_array_access( ctxt, NULL, gcc_jit_param_as_rvalue (param_b), gcc_jit_lvalue_as_rvalue (j))))); /* "j++" */ gcc_jit_block_add_assignment_op ( b_inner_loop_body, NULL, j, GCC_JIT_BINARY_OP_PLUS, gcc_jit_context_one (ctxt, int_type)); gcc_jit_block_end_with_jump (b_inner_loop_body, NULL, b_inner_loop_cond); /* Populate b_outer_loop_tail. */ /* "i++" */ gcc_jit_block_add_assignment_op ( b_outer_loop_tail, NULL, i, GCC_JIT_BINARY_OP_PLUS, gcc_jit_context_one (ctxt, int_type)); gcc_jit_block_end_with_jump (b_outer_loop_tail, NULL, b_outer_loop_cond); /* Populate b_exit. */ /* "return result;" */ gcc_jit_block_end_with_return ( b_exit, NULL, gcc_jit_lvalue_as_rvalue (result)); }
void create_code (gcc_jit_context *ctxt, void * user_data) { gcc_jit_type *type_void = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); gcc_jit_type *type_int = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); gcc_jit_type *type_unsigned_char = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_UNSIGNED_CHAR); gcc_jit_type *type_void_ptr = gcc_jit_type_get_pointer (type_void); gcc_jit_type *type_void_ptr_ptr = gcc_jit_type_get_pointer (type_void_ptr); gcc_jit_type *type_unsigned_char__ = gcc_jit_type_get_pointer (type_unsigned_char); gcc_jit_field *field_x = gcc_jit_context_new_field (ctxt, NULL, /* gcc_jit_location *loc */ type_int, /* gcc_jit_type *type, */ "x"); /* const char *name */ gcc_jit_field *field_y = gcc_jit_context_new_field (ctxt, NULL, /* gcc_jit_location *loc */ type_int, /* gcc_jit_type *type, */ "y"); /* const char *name */ gcc_jit_struct *struct_struct_ip_coord = gcc_jit_context_new_opaque_struct (ctxt, NULL, /* gcc_jit_location *loc */ "ip_coord"); /* const char *name */ gcc_jit_field *fields_fields_0x18dc9d0[2] = { field_x, field_y, }; gcc_jit_struct_set_fields (struct_struct_ip_coord, /* gcc_jit_struct *struct_type */ NULL, /* gcc_jit_location *loc */ 2, /* int num_fields */ fields_fields_0x18dc9d0); /* gcc_jit_field **fields */ gcc_jit_field *field_size = gcc_jit_context_new_field (ctxt, NULL, /* gcc_jit_location *loc */ gcc_jit_struct_as_type (struct_struct_ip_coord), /* gcc_jit_type *type, */ "size"); /* const char *name */ gcc_jit_field *field_imrow = gcc_jit_context_new_field (ctxt, NULL, /* gcc_jit_location *loc */ type_void_ptr_ptr, /* gcc_jit_type *type, */ "imrow"); /* const char *name */ gcc_jit_struct *struct_struct_ip_image = gcc_jit_context_new_opaque_struct (ctxt, NULL, /* gcc_jit_location *loc */ "ip_image"); /* const char *name */ gcc_jit_field *fields_fields_0x18dd310[] = { field_size, field_imrow }; gcc_jit_struct_set_fields (struct_struct_ip_image, /* gcc_jit_struct *struct_type */ NULL, /* gcc_jit_location *loc */ 2, /* int num_fields */ fields_fields_0x18dd310); /* gcc_jit_field **fields */ gcc_jit_type *type_struct_ip_image__ = gcc_jit_type_get_pointer (gcc_jit_struct_as_type (struct_struct_ip_image)); gcc_jit_param *param_dest = gcc_jit_context_new_param (ctxt, NULL, /* gcc_jit_location *loc */ type_struct_ip_image__, /*gcc_jit_type *type */ "dest"); /* const char *name */ gcc_jit_param *param_src = gcc_jit_context_new_param (ctxt, NULL, /* gcc_jit_location *loc */ type_struct_ip_image__, /*gcc_jit_type *type */ "src"); /* const char *name */ gcc_jit_param *params_for_func_ip_jit_im_add_clip_UBYTE[2] = { param_dest, param_src, }; gcc_jit_function *func_ip_jit_im_add_clip_UBYTE = gcc_jit_context_new_function (ctxt, /* gcc_jit_context *ctxt */ NULL, /* gcc_jit_location *loc */ GCC_JIT_FUNCTION_EXPORTED, /* enum gcc_jit_function_kind kind */ type_void, /* gcc_jit_type *return_type */ "ip_jit_im_add_clip_UBYTE", /* const char *name */ 2, /* int num_params */ params_for_func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_param **params */ 0); /* int is_variadic */ gcc_jit_lvalue *local_rowlen = gcc_jit_function_new_local (func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_function *func */ NULL, /* gcc_jit_location *loc */ type_int, /* gcc_jit_type *type */ "rowlen"); /* const char *name */ gcc_jit_lvalue *local_numrows = gcc_jit_function_new_local (func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_function *func */ NULL, /* gcc_jit_location *loc */ type_int, /* gcc_jit_type *type */ "numrows"); /* const char *name */ gcc_jit_lvalue *local_j = gcc_jit_function_new_local (func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_function *func */ NULL, /* gcc_jit_location *loc */ type_int, /* gcc_jit_type *type */ "j"); /* const char *name */ gcc_jit_lvalue *local_dptr = gcc_jit_function_new_local (func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_function *func */ NULL, /* gcc_jit_location *loc */ type_unsigned_char__, /* gcc_jit_type *type */ "dptr"); /* const char *name */ gcc_jit_lvalue *local_sptr = gcc_jit_function_new_local (func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_function *func */ NULL, /* gcc_jit_location *loc */ type_unsigned_char__, /* gcc_jit_type *type */ "sptr"); /* const char *name */ gcc_jit_lvalue *local_i = gcc_jit_function_new_local (func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_function *func */ NULL, /* gcc_jit_location *loc */ type_int, /* gcc_jit_type *type */ "i"); /* const char *name */ gcc_jit_block *block_F1 = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "F1"); gcc_jit_block *block_C1 = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "C1"); gcc_jit_block *block_L1 = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "L1"); gcc_jit_block *block_C2 = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "C2"); gcc_jit_block *block_L2 = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "L2"); gcc_jit_block *block_A2 = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "A2"); gcc_jit_block *block_A1 = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "A1"); gcc_jit_lvalue *lvalue_dest__size= gcc_jit_rvalue_dereference_field (gcc_jit_param_as_rvalue (param_dest), /* gcc_jit_rvalue *ptr */ NULL, /* gcc_jit_location *loc */ field_size); /* gcc_jit_field *field */ gcc_jit_rvalue *rvalue_dest__size_x = gcc_jit_rvalue_access_field (gcc_jit_lvalue_as_rvalue (lvalue_dest__size), /*gcc_jit_rvalue *struct_or_union */ NULL, /*gcc_jit_location *loc */ field_x); gcc_jit_block_add_assignment (block_F1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_rowlen, /* gcc_jit_lvalue *lvalue */ rvalue_dest__size_x); /* gcc_jit_rvalue *rvalue */ gcc_jit_rvalue *rvalue_dest__size_y = gcc_jit_rvalue_access_field (gcc_jit_lvalue_as_rvalue (lvalue_dest__size), /*gcc_jit_rvalue *struct_or_union */ NULL, /*gcc_jit_location *loc */ field_y); gcc_jit_block_add_assignment (block_F1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_numrows, /* gcc_jit_lvalue *lvalue */ rvalue_dest__size_y); /* gcc_jit_rvalue *rvalue */ gcc_jit_rvalue *rvalue__int_0 = gcc_jit_context_new_rvalue_from_int (ctxt, /* gcc_jit_context *ctxt */ type_int, /* gcc_jit_type *numeric_type */ 0); /* int value */ gcc_jit_block_add_assignment (block_F1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_j, /* gcc_jit_lvalue *lvalue */ rvalue__int_0); /* gcc_jit_rvalue *rvalue */ gcc_jit_block_end_with_jump (block_F1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ block_C1); /* gcc_jit_block *target */ gcc_jit_rvalue *rvalue_j___numrows = gcc_jit_context_new_comparison (ctxt, NULL, /* gcc_jit_location *loc */ GCC_JIT_COMPARISON_LT, /* enum gcc_jit_comparison op */ gcc_jit_lvalue_as_rvalue (local_j), /* gcc_jit_rvalue *a */ gcc_jit_lvalue_as_rvalue (local_numrows)); /* gcc_jit_rvalue *b */ gcc_jit_block_end_with_conditional (block_C1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ rvalue_j___numrows, /* gcc_jit_rvalue *boolval */ block_L1, /* gcc_jit_block *on_true */ block_A1); /* gcc_jit_block *on_false */ gcc_jit_lvalue *lvalue_dest__imrow= gcc_jit_rvalue_dereference_field (gcc_jit_param_as_rvalue (param_dest), /* gcc_jit_rvalue *ptr */ NULL, /* gcc_jit_location *loc */ field_imrow); /* gcc_jit_field *field */ gcc_jit_lvalue *lvalue_dest__imrow_j_ = gcc_jit_context_new_array_access (ctxt, /* gcc_jit_context *ctxt */ NULL, /*gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (lvalue_dest__imrow), /* gcc_jit_rvalue *ptr */ gcc_jit_lvalue_as_rvalue (local_j)); /* gcc_jit_rvalue *index */ gcc_jit_rvalue *rvalue__unsigned_char___dest__imrow_j_ = gcc_jit_context_new_cast (ctxt, NULL, /* gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (lvalue_dest__imrow_j_), /* gcc_jit_rvalue *rvalue */ type_unsigned_char__); /* gcc_jit_type *type */ gcc_jit_block_add_assignment (block_L1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_dptr, /* gcc_jit_lvalue *lvalue */ rvalue__unsigned_char___dest__imrow_j_); /* gcc_jit_rvalue *rvalue */ gcc_jit_lvalue *lvalue_src__imrow= gcc_jit_rvalue_dereference_field (gcc_jit_param_as_rvalue (param_src), /* gcc_jit_rvalue *ptr */ NULL, /* gcc_jit_location *loc */ field_imrow); /* gcc_jit_field *field */ gcc_jit_lvalue *lvalue_src__imrow_j_ = gcc_jit_context_new_array_access (ctxt, /* gcc_jit_context *ctxt */ NULL, /*gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (lvalue_src__imrow), /* gcc_jit_rvalue *ptr */ gcc_jit_lvalue_as_rvalue (local_j)); /* gcc_jit_rvalue *index */ gcc_jit_rvalue *rvalue__unsigned_char___src__imrow_j_ = gcc_jit_context_new_cast (ctxt, NULL, /* gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (lvalue_src__imrow_j_), /* gcc_jit_rvalue *rvalue */ type_unsigned_char__); /* gcc_jit_type *type */ gcc_jit_block_add_assignment (block_L1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_sptr, /* gcc_jit_lvalue *lvalue */ rvalue__unsigned_char___src__imrow_j_); /* gcc_jit_rvalue *rvalue */ gcc_jit_rvalue *rvalue__int_0_0x18dd890 = gcc_jit_context_new_rvalue_from_int (ctxt, /* gcc_jit_context *ctxt */ type_int, /* gcc_jit_type *numeric_type */ 0); /* int value */ gcc_jit_block_add_assignment (block_L1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_i, /* gcc_jit_lvalue *lvalue */ rvalue__int_0_0x18dd890); /* gcc_jit_rvalue *rvalue */ gcc_jit_block_end_with_jump (block_L1, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ block_C2); /* gcc_jit_block *target */ gcc_jit_rvalue *rvalue_i___rowlen = gcc_jit_context_new_comparison (ctxt, NULL, /* gcc_jit_location *loc */ GCC_JIT_COMPARISON_LT, /* enum gcc_jit_comparison op */ gcc_jit_lvalue_as_rvalue (local_i), /* gcc_jit_rvalue *a */ gcc_jit_lvalue_as_rvalue (local_rowlen)); /* gcc_jit_rvalue *b */ gcc_jit_block_end_with_conditional (block_C2, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ rvalue_i___rowlen, /* gcc_jit_rvalue *boolval */ block_L2, /* gcc_jit_block *on_true */ block_A2); /* gcc_jit_block *on_false */ gcc_jit_lvalue *dereference__dptr = gcc_jit_rvalue_dereference (gcc_jit_lvalue_as_rvalue (local_dptr), /* gcc_jit_rvalue *rvalue */ NULL); /* gcc_jit_location *loc */ gcc_jit_lvalue *dereference__sptr = gcc_jit_rvalue_dereference (gcc_jit_lvalue_as_rvalue (local_sptr), /* gcc_jit_rvalue *rvalue */ NULL); /* gcc_jit_location *loc */ gcc_jit_block *block_p_C1_true = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "p_C1_true"); gcc_jit_block *block_p_C1_end = gcc_jit_function_new_block (func_ip_jit_im_add_clip_UBYTE, "p_C1_end"); gcc_jit_lvalue *local_ival = gcc_jit_function_new_local (func_ip_jit_im_add_clip_UBYTE, /* gcc_jit_function *func */ NULL, /* gcc_jit_location *loc */ type_int, /* gcc_jit_type *type */ "ival"); /* const char *name */ gcc_jit_rvalue *rvalue__int__dptr = gcc_jit_context_new_cast (ctxt, NULL, /* gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (dereference__dptr), /* gcc_jit_rvalue *rvalue */ type_int); /* gcc_jit_type *type */ gcc_jit_rvalue *rvalue__int__sptr = gcc_jit_context_new_cast (ctxt, NULL, /* gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (dereference__sptr), /* gcc_jit_rvalue *rvalue */ type_int); /* gcc_jit_type *type */ gcc_jit_rvalue *rvalue__int__dptr____int__sptr = gcc_jit_context_new_binary_op (ctxt, NULL, /* gcc_jit_location *loc */ GCC_JIT_BINARY_OP_PLUS, /* enum gcc_jit_binary_op op */ type_int, /* gcc_jit_type *result_type */ rvalue__int__dptr, /* gcc_jit_rvalue *a */ rvalue__int__sptr); /* gcc_jit_rvalue *b */ gcc_jit_block_add_assignment (block_L2, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_ival, /* gcc_jit_lvalue *lvalue */ rvalue__int__dptr____int__sptr); /* gcc_jit_rvalue *rvalue */ gcc_jit_rvalue *rvalue__int_255 = gcc_jit_context_new_rvalue_from_int (ctxt, /* gcc_jit_context *ctxt */ type_int, /* gcc_jit_type *numeric_type */ 255); /* int value */ gcc_jit_rvalue *rvalue_ival____int_255 = gcc_jit_context_new_comparison (ctxt, NULL, /* gcc_jit_location *loc */ GCC_JIT_COMPARISON_GT, /* enum gcc_jit_comparison op */ gcc_jit_lvalue_as_rvalue (local_ival), /* gcc_jit_rvalue *a */ rvalue__int_255); /* gcc_jit_rvalue *b */ gcc_jit_block_end_with_conditional (block_L2, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ rvalue_ival____int_255, /* gcc_jit_rvalue *boolval */ block_p_C1_true, /* gcc_jit_block *on_true */ block_p_C1_end); /* gcc_jit_block *on_false */ gcc_jit_block_add_assignment (block_p_C1_true, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_ival, /* gcc_jit_lvalue *lvalue */ rvalue__int_255); /* gcc_jit_rvalue *rvalue */ gcc_jit_block_end_with_jump (block_p_C1_true, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ block_p_C1_end); /* gcc_jit_block *target */ gcc_jit_rvalue *rvalue__unsigned_char_ival = gcc_jit_context_new_cast (ctxt, NULL, /* gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (local_ival), /* gcc_jit_rvalue *rvalue */ type_unsigned_char); /* gcc_jit_type *type */ gcc_jit_lvalue *dereference__dptr_0x18df2e0 = gcc_jit_rvalue_dereference (gcc_jit_lvalue_as_rvalue (local_dptr), /* gcc_jit_rvalue *rvalue */ NULL); /* gcc_jit_location *loc */ gcc_jit_block_add_assignment (block_p_C1_end, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ dereference__dptr_0x18df2e0, /* gcc_jit_lvalue *lvalue */ rvalue__unsigned_char_ival); /* gcc_jit_rvalue *rvalue */ gcc_jit_rvalue *rvalue__int_1 = gcc_jit_context_new_rvalue_from_int (ctxt, /* gcc_jit_context *ctxt */ type_int, /* gcc_jit_type *numeric_type */ 1); /* int value */ gcc_jit_lvalue *lvalue_dptr__int_1_ = gcc_jit_context_new_array_access (ctxt, /* gcc_jit_context *ctxt */ NULL, /*gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (local_dptr), /* gcc_jit_rvalue *ptr */ rvalue__int_1); /* gcc_jit_rvalue *index */ gcc_jit_rvalue *address_of__dptr__int_1_ = gcc_jit_lvalue_get_address (lvalue_dptr__int_1_, /* gcc_jit_lvalue *lvalue */ NULL); /* gcc_jit_location *loc */ gcc_jit_block_add_assignment (block_p_C1_end, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_dptr, /* gcc_jit_lvalue *lvalue */ address_of__dptr__int_1_); /* gcc_jit_rvalue *rvalue */ gcc_jit_rvalue *rvalue__int_1_0x18df500 = gcc_jit_context_new_rvalue_from_int (ctxt, /* gcc_jit_context *ctxt */ type_int, /* gcc_jit_type *numeric_type */ 1); /* int value */ gcc_jit_lvalue *lvalue_sptr__int_1_ = gcc_jit_context_new_array_access (ctxt, /* gcc_jit_context *ctxt */ NULL, /*gcc_jit_location *loc */ gcc_jit_lvalue_as_rvalue (local_sptr), /* gcc_jit_rvalue *ptr */ rvalue__int_1_0x18df500); /* gcc_jit_rvalue *index */ gcc_jit_rvalue *address_of__sptr__int_1_ = gcc_jit_lvalue_get_address (lvalue_sptr__int_1_, /* gcc_jit_lvalue *lvalue */ NULL); /* gcc_jit_location *loc */ gcc_jit_block_add_assignment (block_p_C1_end, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_sptr, /* gcc_jit_lvalue *lvalue */ address_of__sptr__int_1_); /* gcc_jit_rvalue *rvalue */ gcc_jit_rvalue *rvalue__int_1_0x18df650 = gcc_jit_context_new_rvalue_from_int (ctxt, /* gcc_jit_context *ctxt */ type_int, /* gcc_jit_type *numeric_type */ 1); /* int value */ gcc_jit_rvalue *rvalue_i____int_1 = gcc_jit_context_new_binary_op (ctxt, NULL, /* gcc_jit_location *loc */ GCC_JIT_BINARY_OP_PLUS, /* enum gcc_jit_binary_op op */ type_int, /* gcc_jit_type *result_type */ gcc_jit_lvalue_as_rvalue (local_i), /* gcc_jit_rvalue *a */ rvalue__int_1_0x18df650); /* gcc_jit_rvalue *b */ gcc_jit_block_add_assignment (block_p_C1_end, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_i, /* gcc_jit_lvalue *lvalue */ rvalue_i____int_1); /* gcc_jit_rvalue *rvalue */ gcc_jit_block_end_with_jump (block_p_C1_end, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ block_C2); /* gcc_jit_block *target */ gcc_jit_rvalue *rvalue__int_1_0x18df7e0 = gcc_jit_context_new_rvalue_from_int (ctxt, /* gcc_jit_context *ctxt */ type_int, /* gcc_jit_type *numeric_type */ 1); /* int value */ gcc_jit_rvalue *rvalue_j____int_1 = gcc_jit_context_new_binary_op (ctxt, NULL, /* gcc_jit_location *loc */ GCC_JIT_BINARY_OP_PLUS, /* enum gcc_jit_binary_op op */ type_int, /* gcc_jit_type *result_type */ gcc_jit_lvalue_as_rvalue (local_j), /* gcc_jit_rvalue *a */ rvalue__int_1_0x18df7e0); /* gcc_jit_rvalue *b */ gcc_jit_block_add_assignment (block_A2, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ local_j, /* gcc_jit_lvalue *lvalue */ rvalue_j____int_1); /* gcc_jit_rvalue *rvalue */ gcc_jit_block_end_with_jump (block_A2, /*gcc_jit_block *block */ NULL, /* gcc_jit_location *loc */ block_C1); /* gcc_jit_block *target */ gcc_jit_block_end_with_void_return (block_A1, /*gcc_jit_block *block */ NULL); /* gcc_jit_location *loc */ }