case B##name: \
POP##nargs; \
res = emit_call (STR(F##name), comp.lisp_obj_type, nargs, args); \
- PUSH_LVAL (res); \
+ PUSH_RVAL (res); \
break
/* Emit calls to functions with prototype (ptrdiff_t nargs, Lisp_Object *args)
do { \
pop (nargs, &stack, args); \
res = emit_callN (name, nargs, args); \
- PUSH_LVAL (res); \
+ PUSH_RVAL (res); \
} while (0)
#define EMIT_ARITHCOMPARE(comparison) \
comp.int_type, \
comparison); \
res = emit_call ("arithcompare", comp.lisp_obj_type, 3, args); \
- PUSH_LVAL (res); \
+ PUSH_RVAL (res); \
} while (0)
return func;
}
-/* TODO this should return an rval */
-static gcc_jit_lvalue *
+static gcc_jit_rvalue *
emit_call (const char *f_name, gcc_jit_type *ret_type, unsigned nargs,
- gcc_jit_rvalue **args)
+ gcc_jit_rvalue **args)
{
Lisp_Object key = make_string (f_name, strlen (f_name));
EMACS_UINT hash = 0;
Lisp_Object value = HASH_VALUE (ht, hash_lookup (ht, key, &hash));
gcc_jit_function *func = (gcc_jit_function *) XFIXNUMPTR (value);
- gcc_jit_lvalue *res = gcc_jit_function_new_local(comp.func,
- NULL,
- ret_type,
- "res");
- gcc_jit_block_add_assignment(comp.bblock->gcc_bb, NULL,
- res,
- gcc_jit_context_new_call(comp.ctxt,
- NULL,
- func,
- nargs,
- args));
- return res;
+ return gcc_jit_context_new_call(comp.ctxt,
+ NULL,
+ func,
+ nargs,
+ args);
}
/* Close current basic block emitting a conditional. */
/* FIXME XUNTAG missing here. */
gcc_jit_block_end_with_return (call_pseudovector_typep_b,
NULL,
- gcc_jit_lvalue_as_rvalue(
- emit_call (
- "helper_PSEUDOVECTOR_TYPEP_XUNTAG",
- comp.bool_type,
- 2,
- args)));
+ emit_call ("helper_PSEUDOVECTOR_TYPEP_XUNTAG",
+ comp.bool_type,
+ 2,
+ args));
}
static gcc_jit_rvalue *
return gcc_jit_lvalue_as_rvalue (lisp_obj);
}
-static gcc_jit_lvalue *
+static gcc_jit_rvalue *
emit_callN (const char *f_name, unsigned nargs, gcc_jit_rvalue **args)
{
/* Here we set all the pointers into the scratch call area. */
EMACS_INT stack_depth, Lisp_Object *vectorp,
ptrdiff_t vector_size, Lisp_Object args_template)
{
- gcc_jit_lvalue *res;
+ gcc_jit_rvalue *res;
comp_f_res_t comp_res = { NULL, 0, 0 };
ptrdiff_t pc = 0;
gcc_jit_rvalue *args[4];
{
args[0] = emit_lisp_obj_from_ptr (comp.bblock, vectorp[op]);
res = emit_call ("Fsymbol_value", comp.lisp_obj_type, 1, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
}
comp.int_type,
SET_INTERNAL_SET);
res = emit_call ("set_internal", comp.lisp_obj_type, 4, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
}
break;
args[0] = emit_lisp_obj_from_ptr (comp.bblock, vectorp[op]);
pop (1, &stack, &args[1]);
res = emit_call ("specbind", comp.lisp_obj_type, 2, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
}
ptrdiff_t nargs = op + 1;
pop (nargs, &stack, args);
res = emit_callN ("Ffuncall", nargs, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
}
POP1;
args[1] = nil;
res = emit_call ("Fcons", comp.lisp_obj_type, 2, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
for (int i = 0; i < op; ++i)
{
POP2;
res = emit_call ("Fcons", comp.lisp_obj_type, 2, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
}
break;
}
comp.bblock->gcc_bb = sub1_fcall_block;
POP1;
res = emit_call ("Fsub1", comp.lisp_obj_type, 1, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
*comp.bblock = bb_orig;
comp.bblock->gcc_bb = add1_fcall_block;
POP1;
res = emit_call ("Fadd1", comp.lisp_obj_type, 1, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
*comp.bblock = bb_orig;
comp.lisp_obj_type,
1,
args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
CASE_CALL_NARGS (goto_char, 1);
comp.lisp_obj_type,
1,
args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
case Bpoint_min:
comp.lisp_obj_type,
1,
args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
CASE_CALL_NARGS (char_after, 1);
case Bpreceding_char:
res = emit_call ("Fprevious_char", comp.lisp_obj_type, 0, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
CASE_CALL_NARGS (current_column, 0);
POP1;
args[1] = nil;
res = emit_call ("Findent_to", comp.lisp_obj_type, 2, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
CASE_CALL_NARGS (eolp, 0);
PUSH_RVAL (emit_lisp_obj_from_ptr (comp.bblock,
intern ("interactive-p")));
res = emit_call ("call0", comp.lisp_obj_type, 1, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
CASE_CALL_NARGS (forward_char, 1);
POP1;
res = emit_call ("helper_save_window_excursion",
comp.lisp_obj_type, 1, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
case Bsave_restriction:
args[0] = emit_lisp_obj_from_ptr (comp.bblock,
save_restriction_restore);
- args[1] =
- gcc_jit_lvalue_as_rvalue (emit_call ("save_restriction_save",
- comp.lisp_obj_type,
- 0,
- NULL));
+ args[1] = emit_call ("save_restriction_save",
+ comp.lisp_obj_type,
+ 0,
+ NULL);
emit_call ("record_unwind_protect", comp.void_ptr_type, 2, args);
break;
POP1;
res = emit_call ("helper_temp_output_buffer_setup", comp.lisp_obj_type,
1, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
case Btemp_output_buffer_show: /* Obsolete since 24.1. */
case Bstringeqlsign:
POP2;
res = emit_call ("Fstring_equal", comp.lisp_obj_type, 2, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
case Bstringlss:
POP2;
res = emit_call ("Fstring_lessp", comp.lisp_obj_type, 2, args);
- PUSH_LVAL (res);
+ PUSH_RVAL (res);
break;
CASE_CALL_NARGS (equal, 2);