xo-expression: + explicit_symbol_def feature in PrimitiveInterface

This commit is contained in:
Roland Conybeare 2024-06-19 18:14:02 -04:00
commit 37b2bc85a4
3 changed files with 39 additions and 7 deletions

View file

@ -13,6 +13,9 @@
namespace xo {
namespace ast {
class PrimitiveInterface : public FunctionInterface {
public:
using void_function_type = void (*)();
public:
PrimitiveInterface(TypeDescr fn_type)
: FunctionInterface(exprtype::primitive, fn_type) {}
@ -22,6 +25,19 @@ namespace xo {
return ref::brw<PrimitiveInterface>::from(x);
}
/** if true, Jit will try to explicitly symbol for this primitive
* (instead of looking it up in host process).
* Don't know if this works.
* Do know it's not needed for ::sin(), ::sqrt().
* Do know that my extern "C" functions like ::mul_i32(), ::mul_f64()
* need something else.
**/
virtual bool explicit_symbol_def() const = 0;
/** function address for this primitive
**/
virtual void_function_type function_address() const = 0;
// virtual const std::string & name() const;
// virtual int n_arg() const;
// virtual TypeDescr fn_retval() const;