From 3804100feba794fe86fd7d0130f67780e1debea9 Mon Sep 17 00:00:00 2001 From: Thirumalai-Shaktivel Date: Sun, 13 Aug 2023 21:53:05 +0530 Subject: [PATCH] Rename `IntrinsicFunction` to `IntrinsicScalarFunction` --- src/libasr/ASR.asdl | 2 +- src/libasr/asr_utils.cpp | 2 +- src/libasr/asr_utils.h | 4 +- src/libasr/asr_verify.cpp | 8 +- src/libasr/codegen/asr_to_c_cpp.h | 10 +- src/libasr/codegen/asr_to_julia.cpp | 9 +- src/libasr/codegen/asr_to_llvm.cpp | 28 +- src/libasr/pass/array_op.cpp | 4 +- src/libasr/pass/intrinsic_function.cpp | 18 +- src/libasr/pass/intrinsic_function_registry.h | 335 +++++++++--------- src/libasr/pass/replace_symbolic.cpp | 74 ++-- src/libasr/pass/where.cpp | 6 +- src/lpython/semantics/python_ast_to_asr.cpp | 22 +- src/lpython/semantics/python_attribute_eval.h | 18 +- tests/reference/asr-constants1-5828e8a.json | 2 +- tests/reference/asr-constants1-5828e8a.stdout | 14 +- tests/reference/asr-elemental_01-b58df26.json | 2 +- .../reference/asr-elemental_01-b58df26.stdout | 12 +- tests/reference/asr-expr_05-3a37324.json | 2 +- tests/reference/asr-expr_05-3a37324.stdout | 4 +- tests/reference/asr-expr_09-f3e89c8.json | 2 +- tests/reference/asr-expr_09-f3e89c8.stdout | 14 +- tests/reference/asr-expr_14-f2bd343.json | 2 +- tests/reference/asr-expr_14-f2bd343.stdout | 12 +- tests/reference/asr-list1-770ba33.json | 2 +- tests/reference/asr-list1-770ba33.stdout | 4 +- tests/reference/asr-set1-b7b913a.json | 2 +- tests/reference/asr-set1-b7b913a.stdout | 4 +- tests/reference/asr-structs_05-fa98307.json | 2 +- tests/reference/asr-structs_05-fa98307.stdout | 8 +- .../asr-test_builtin_abs-c74d2c9.json | 2 +- .../asr-test_builtin_abs-c74d2c9.stdout | 24 +- .../asr-test_builtin_pow-f02fcda.json | 2 +- .../asr-test_builtin_pow-f02fcda.stdout | 34 +- .../asr-test_c_interop_01-e374f43.json | 2 +- .../asr-test_c_interop_01-e374f43.stdout | 8 +- .../asr-test_complex_01-a6def58.json | 2 +- .../asr-test_complex_01-a6def58.stdout | 42 +-- .../asr-test_complex_02-782ba2d.json | 2 +- .../asr-test_complex_02-782ba2d.stdout | 8 +- tests/reference/asr-test_max_min-3c2fc51.json | 2 +- .../reference/asr-test_max_min-3c2fc51.stdout | 12 +- .../reference/asr-test_numpy_03-e600a49.json | 2 +- .../asr-test_numpy_03-e600a49.stdout | 8 +- .../reference/asr-test_numpy_04-ecbb614.json | 2 +- .../asr-test_numpy_04-ecbb614.stdout | 12 +- 46 files changed, 395 insertions(+), 397 deletions(-) diff --git a/src/libasr/ASR.asdl b/src/libasr/ASR.asdl index e038f1ef36..faae1d5af6 100644 --- a/src/libasr/ASR.asdl +++ b/src/libasr/ASR.asdl @@ -235,7 +235,7 @@ expr | NamedExpr(expr target, expr value, ttype type) | FunctionCall(symbol name, symbol? original_name, call_arg* args, ttype type, expr? value, expr? dt) - | IntrinsicFunction(int intrinsic_id, expr* args, int overload_id, + | IntrinsicScalarFunction(int intrinsic_id, expr* args, int overload_id, ttype? type, expr? value) | IntrinsicArrayFunction(int arr_intrinsic_id, expr* args, int overload_id, ttype? type, expr? value) diff --git a/src/libasr/asr_utils.cpp b/src/libasr/asr_utils.cpp index 160d799cc7..9afe430659 100644 --- a/src/libasr/asr_utils.cpp +++ b/src/libasr/asr_utils.cpp @@ -1293,7 +1293,7 @@ ASR::asr_t* make_Cast_t_value(Allocator &al, const Location &a_loc, args.reserve(al, 1); args.push_back(al, a_arg); LCompilers::ASRUtils::create_intrinsic_function create_function = - LCompilers::ASRUtils::IntrinsicFunctionRegistry::get_create_function("SymbolicInteger"); + LCompilers::ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("SymbolicInteger"); value = ASR::down_cast(create_function(al, a_loc, args, [](const std::string&, const Location&) { })); diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index d468ad7d83..3d0549c2c9 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -4167,7 +4167,7 @@ static inline ASR::expr_t* cast_to_descriptor(Allocator& al, ASR::expr_t* arg) { return arg; } -static inline ASR::asr_t* make_IntrinsicFunction_t_util( +static inline ASR::asr_t* make_IntrinsicScalarFunction_t_util( Allocator &al, const Location &a_loc, int64_t a_intrinsic_id, ASR::expr_t** a_args, size_t n_args, int64_t a_overload_id, ASR::ttype_t* a_type, ASR::expr_t* a_value) { @@ -4186,7 +4186,7 @@ static inline ASR::asr_t* make_IntrinsicFunction_t_util( } } - return ASR::make_IntrinsicFunction_t(al, a_loc, a_intrinsic_id, + return ASR::make_IntrinsicScalarFunction_t(al, a_loc, a_intrinsic_id, a_args, n_args, a_overload_id, a_type, a_value); } diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index caa2fcb5e1..4fb63d60ca 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -974,16 +974,16 @@ class VerifyVisitor : public BaseWalkVisitor } } - void visit_IntrinsicFunction(const ASR::IntrinsicFunction_t& x) { + void visit_IntrinsicScalarFunction(const ASR::IntrinsicScalarFunction_t& x) { if( !check_external ) { - BaseWalkVisitor::visit_IntrinsicFunction(x); + BaseWalkVisitor::visit_IntrinsicScalarFunction(x); return ; } - ASRUtils::verify_function verify_ = ASRUtils::IntrinsicFunctionRegistry + ASRUtils::verify_function verify_ = ASRUtils::IntrinsicScalarFunctionRegistry ::get_verify_function(x.m_intrinsic_id); LCOMPILERS_ASSERT(verify_ != nullptr); verify_(x, diagnostics); - BaseWalkVisitor::visit_IntrinsicFunction(x); + BaseWalkVisitor::visit_IntrinsicScalarFunction(x); } void visit_IntrinsicArrayFunction(const ASR::IntrinsicArrayFunction_t& x) { diff --git a/src/libasr/codegen/asr_to_c_cpp.h b/src/libasr/codegen/asr_to_c_cpp.h index f629b7e760..71bd2f1fba 100644 --- a/src/libasr/codegen/asr_to_c_cpp.h +++ b/src/libasr/codegen/asr_to_c_cpp.h @@ -2739,12 +2739,12 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) { src = indent + sym_name + "(" + construct_call_args(x.n_args, x.m_args) + ");\n"; } - #define SET_INTRINSIC_NAME(X, func_name) \ - case (static_cast(ASRUtils::IntrinsicFunctions::X)) : { \ - out += func_name; break; \ + #define SET_INTRINSIC_NAME(X, func_name) \ + case (static_cast(ASRUtils::IntrinsicScalarFunctions::X)) : { \ + out += func_name; break; \ } - void visit_IntrinsicFunction(const ASR::IntrinsicFunction_t &x) { + void visit_IntrinsicScalarFunction(const ASR::IntrinsicScalarFunction_t &x) { std::string out; std::string indent(4, ' '); switch (x.m_intrinsic_id) { @@ -2762,7 +2762,7 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) { SET_INTRINSIC_NAME(Exp2, "exp2"); SET_INTRINSIC_NAME(Expm1, "expm1"); default : { - throw LCompilersException("IntrinsicFunction: `" + throw LCompilersException("IntrinsicScalarFunction: `" + ASRUtils::get_intrinsic_name(x.m_intrinsic_id) + "` is not implemented"); } diff --git a/src/libasr/codegen/asr_to_julia.cpp b/src/libasr/codegen/asr_to_julia.cpp index c9f67f1b4d..35c899f95d 100644 --- a/src/libasr/codegen/asr_to_julia.cpp +++ b/src/libasr/codegen/asr_to_julia.cpp @@ -1893,12 +1893,7 @@ class ASRToJuliaVisitor : public ASR::BaseVisitor src = out; } - #define SET_INTRINSIC_NAME(X, func_name) \ - case (static_cast(ASRUtils::IntrinsicFunctions::X)) : { \ - out += func_name; break; \ - } - - void visit_IntrinsicFunction(const ASR::IntrinsicFunction_t &x) { + void visit_IntrinsicScalarFunction(const ASR::IntrinsicScalarFunction_t &x) { std::string out; LCOMPILERS_ASSERT(x.n_args == 1); visit_expr(*x.m_args[0]); @@ -1917,7 +1912,7 @@ class ASRToJuliaVisitor : public ASR::BaseVisitor SET_INTRINSIC_NAME(Exp2, "exp2"); SET_INTRINSIC_NAME(Expm1, "expm1"); default : { - throw LCompilersException("IntrinsicFunction: `" + throw LCompilersException("IntrinsicScalarFunction: `" + ASRUtils::get_intrinsic_name(x.m_intrinsic_id) + "` is not implemented"); } diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index c7eace7b74..ee6533c8f6 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -1779,9 +1779,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor llvm_utils->set_api->remove_item(pset, el, *module, asr_el_type); } - void visit_IntrinsicFunction(const ASR::IntrinsicFunction_t& x) { - switch (static_cast(x.m_intrinsic_id)) { - case ASRUtils::IntrinsicFunctions::ListIndex: { + void visit_IntrinsicScalarFunction(const ASR::IntrinsicScalarFunction_t& x) { + switch (static_cast(x.m_intrinsic_id)) { + case ASRUtils::IntrinsicScalarFunctions::ListIndex: { ASR::expr_t* m_arg = x.m_args[0]; ASR::expr_t* m_ele = x.m_args[1]; ASR::expr_t* m_start = nullptr; @@ -1807,11 +1807,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor generate_ListIndex(m_arg, m_ele, m_start, m_end); break ; } - case ASRUtils::IntrinsicFunctions::ListReverse: { + case ASRUtils::IntrinsicScalarFunctions::ListReverse: { generate_ListReverse(x.m_args[0]); break; } - case ASRUtils::IntrinsicFunctions::ListPop: { + case ASRUtils::IntrinsicScalarFunctions::ListPop: { switch(x.m_overload_id) { case 0: generate_ListPop_0(x.m_args[0]); @@ -1822,27 +1822,27 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } break; } - case ASRUtils::IntrinsicFunctions::Reserve: { + case ASRUtils::IntrinsicScalarFunctions::Reserve: { generate_Reserve(x.m_args[0], x.m_args[1]); break; } - case ASRUtils::IntrinsicFunctions::DictKeys: { + case ASRUtils::IntrinsicScalarFunctions::DictKeys: { generate_DictElems(x.m_args[0], 0); break; } - case ASRUtils::IntrinsicFunctions::DictValues: { + case ASRUtils::IntrinsicScalarFunctions::DictValues: { generate_DictElems(x.m_args[0], 1); break; } - case ASRUtils::IntrinsicFunctions::SetAdd: { + case ASRUtils::IntrinsicScalarFunctions::SetAdd: { generate_SetAdd(x.m_args[0], x.m_args[1]); break; } - case ASRUtils::IntrinsicFunctions::SetRemove: { + case ASRUtils::IntrinsicScalarFunctions::SetRemove: { generate_SetRemove(x.m_args[0], x.m_args[1]); break; } - case ASRUtils::IntrinsicFunctions::Exp: { + case ASRUtils::IntrinsicScalarFunctions::Exp: { switch (x.m_overload_id) { case 0: { ASR::expr_t* m_arg = x.m_args[0]; @@ -1856,7 +1856,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } break ; } - case ASRUtils::IntrinsicFunctions::Exp2: { + case ASRUtils::IntrinsicScalarFunctions::Exp2: { switch (x.m_overload_id) { case 0: { ASR::expr_t* m_arg = x.m_args[0]; @@ -1870,7 +1870,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } break ; } - case ASRUtils::IntrinsicFunctions::Expm1: { + case ASRUtils::IntrinsicScalarFunctions::Expm1: { switch (x.m_overload_id) { case 0: { ASR::expr_t* m_arg = x.m_args[0]; @@ -1885,7 +1885,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor break ; } default: { - throw CodeGenError( ASRUtils::IntrinsicFunctionRegistry:: + throw CodeGenError( ASRUtils::IntrinsicScalarFunctionRegistry:: get_intrinsic_function_name(x.m_intrinsic_id) + " is not implemented by LLVM backend.", x.base.base.loc); } diff --git a/src/libasr/pass/array_op.cpp b/src/libasr/pass/array_op.cpp index 8f5d99f3d3..551babf582 100644 --- a/src/libasr/pass/array_op.cpp +++ b/src/libasr/pass/array_op.cpp @@ -1014,8 +1014,8 @@ class ReplaceArrayOp: public ASR::BaseExprReplacer { result_var = nullptr; } - void replace_IntrinsicFunction(ASR::IntrinsicFunction_t* x) { - if(!ASRUtils::IntrinsicFunctionRegistry::is_elemental(x->m_intrinsic_id)) { + void replace_IntrinsicScalarFunction(ASR::IntrinsicScalarFunction_t* x) { + if(!ASRUtils::IntrinsicScalarFunctionRegistry::is_elemental(x->m_intrinsic_id)) { return ; } replace_intrinsic_function(x); diff --git a/src/libasr/pass/intrinsic_function.cpp b/src/libasr/pass/intrinsic_function.cpp index 3d0e73a061..c9ee2712cc 100644 --- a/src/libasr/pass/intrinsic_function.cpp +++ b/src/libasr/pass/intrinsic_function.cpp @@ -25,7 +25,7 @@ in the backend. */ -class ReplaceIntrinsicFunction: public ASR::BaseExprReplacer { +class ReplaceIntrinsicFunctions: public ASR::BaseExprReplacer { private: @@ -35,14 +35,14 @@ class ReplaceIntrinsicFunction: public ASR::BaseExprReplacer& func2intrinsicid_) : al(al_), global_scope(global_scope_), func2intrinsicid(func2intrinsicid_) {} - void replace_IntrinsicFunction(ASR::IntrinsicFunction_t* x) { + void replace_IntrinsicScalarFunction(ASR::IntrinsicScalarFunction_t* x) { Vec new_args; - // Replace any IntrinsicFunctions in the argument first: + // Replace any IntrinsicScalarFunctions in the argument first: { new_args.reserve(al, x->n_args); for( size_t i = 0; i < x->n_args; i++ ) { @@ -63,7 +63,7 @@ class ReplaceIntrinsicFunction: public ASR::BaseExprReplacer id and look it up. ASRUtils::impl_function instantiate_function = - ASRUtils::IntrinsicFunctionRegistry::get_instantiate_function(x->m_intrinsic_id); + ASRUtils::IntrinsicScalarFunctionRegistry::get_instantiate_function(x->m_intrinsic_id); if( instantiate_function == nullptr ) { return ; } @@ -137,15 +137,15 @@ The following visitor calls the above replacer i.e., ReplaceFunctionCalls on expressions present in ASR so that FunctionCall get replaced everywhere and we don't end up with false positives. */ -class ReplaceIntrinsicFunctionVisitor : public ASR::CallReplacerOnExpressionsVisitor +class ReplaceIntrinsicFunctionsVisitor : public ASR::CallReplacerOnExpressionsVisitor { private: - ReplaceIntrinsicFunction replacer; + ReplaceIntrinsicFunctions replacer; public: - ReplaceIntrinsicFunctionVisitor(Allocator& al_, SymbolTable* global_scope_, + ReplaceIntrinsicFunctionsVisitor(Allocator& al_, SymbolTable* global_scope_, std::map& func2intrinsicid_) : replacer(al_, global_scope_, func2intrinsicid_) {} @@ -377,7 +377,7 @@ class ReplaceFunctionCallReturningArrayVisitor : public ASR::CallReplacerOnExpre void pass_replace_intrinsic_function(Allocator &al, ASR::TranslationUnit_t &unit, const LCompilers::PassOptions& /*pass_options*/) { std::map func2intrinsicid; - ReplaceIntrinsicFunctionVisitor v(al, unit.m_global_scope, func2intrinsicid); + ReplaceIntrinsicFunctionsVisitor v(al, unit.m_global_scope, func2intrinsicid); v.visit_TranslationUnit(unit); ReplaceFunctionCallReturningArrayVisitor u(al, func2intrinsicid); u.visit_TranslationUnit(unit); diff --git a/src/libasr/pass/intrinsic_function_registry.h b/src/libasr/pass/intrinsic_function_registry.h index be69e2cd90..637ee58ed0 100644 --- a/src/libasr/pass/intrinsic_function_registry.h +++ b/src/libasr/pass/intrinsic_function_registry.h @@ -19,13 +19,13 @@ To add a new function implementation, 1. Create a new namespace like, `Sin`, `LogGamma` in this file. 2. In the above created namespace add `eval_*`, `instantiate_*`, and `create_*`. -3. Then register in the maps present in `IntrinsicFunctionRegistry`. +3. Then register in the maps present in `IntrinsicScalarFunctionRegistry`. You can use helper macros and define your own helper macros to reduce the code size. */ -enum class IntrinsicFunctions : int64_t { +enum class IntrinsicScalarFunctions : int64_t { Sin, Cos, Tan, @@ -71,9 +71,9 @@ enum class IntrinsicFunctions : int64_t { // ... }; -#define INTRINSIC_NAME_CASE(X) \ - case (static_cast(ASRUtils::IntrinsicFunctions::X)) : { \ - return #X; \ +#define INTRINSIC_NAME_CASE(X) \ + case (static_cast(ASRUtils::IntrinsicScalarFunctions::X)) : { \ + return #X; \ } inline std::string get_intrinsic_name(int x) { @@ -141,7 +141,7 @@ typedef ASR::asr_t* (*create_intrinsic_function)( const std::function); typedef void (*verify_function)( - const ASR::IntrinsicFunction_t&, + const ASR::IntrinsicScalarFunction_t&, diag::Diagnostics&); typedef ASR::expr_t* (*get_initial_value_func)(Allocator&, ASR::ttype_t*); @@ -166,7 +166,7 @@ class ASRBuilder { ASR::Constructor(al, loc, value, type)) \ #define declare_basic_variables(name) \ - std::string fn_name = scope->get_unique_name(name, false); \ + std::string fn_name = scope->get_unique_name(name, false); \ SymbolTable *fn_symtab = al.make_new(scope); \ ASRBuilder b(al, loc); \ Vec args; args.reserve(al, 1); \ @@ -188,7 +188,7 @@ class ASRBuilder { #define declare(var_name, type, intent) \ b.Variable(fn_symtab, var_name, type, ASR::intentType::intent) - #define fill_func_arg(arg_name, type) { \ + #define fill_func_arg(arg_name, type) { \ auto arg = declare(arg_name, type, In); \ args.push_back(al, arg); } @@ -295,8 +295,8 @@ class ASRBuilder { ASR::binopType::Mul, right, int32, nullptr)) #define iSub(left, right) EXPR(ASR::make_IntegerBinOp_t(al, loc, left, \ ASR::binopType::Sub, right, int32, nullptr)) - #define iDiv(left, right) r2i32(EXPR(ASR::make_RealBinOp_t(al, loc, i2r32(left),\ - ASR::binopType::Div, i2r32(right), real32, nullptr))) + #define iDiv(left, right) r2i32(EXPR(ASR::make_RealBinOp_t(al, loc, \ + i2r32(left), ASR::binopType::Div, i2r32(right), real32, nullptr))) #define rDiv(left, right) EXPR(ASR::make_RealBinOp_t(al, loc, left, \ ASR::binopType::Div, right, real32, nullptr)) @@ -323,16 +323,16 @@ class ASRBuilder { #define iGt(x, y) EXPR(ASR::make_IntegerCompare_t(al, loc, x, \ ASR::cmpopType::Gt, y, logical, nullptr)) - #define ArraySize_1(x, dim) EXPR(make_ArraySize_t_util(al, loc, x, dim, \ + #define ArraySize_1(x, dim) EXPR(make_ArraySize_t_util(al, loc, x, dim, \ int32, nullptr)) - #define ArraySize_2(x, dim, t) EXPR(make_ArraySize_t_util(al, loc, x, dim, \ + #define ArraySize_2(x, dim, t) EXPR(make_ArraySize_t_util(al, loc, x, dim, \ t, nullptr)) #define fGtE(x, y) EXPR(ASR::make_RealCompare_t(al, loc, x, \ ASR::cmpopType::GtE, y, logical, nullptr)) #define fLt(x, y) EXPR(ASR::make_RealCompare_t(al, loc, x, \ ASR::cmpopType::Lt, y, logical, nullptr)) - #define fGt(x, y) EXPR(ASR::make_RealCompare_t(al, loc, x, \ + #define fGt(x, y) EXPR(ASR::make_RealCompare_t(al, loc, x, \ ASR::cmpopType::Gt, y, logical, nullptr)) #define sEq(x, y) EXPR(ASR::make_StringCompare_t(al, loc, x, \ @@ -781,7 +781,7 @@ static inline ASR::asr_t* create_UnaryFunction(Allocator& al, const Location& lo value = eval_function(al, loc, type, arg_values); } - return ASRUtils::make_IntrinsicFunction_t_util(al, loc, intrinsic_id, + return ASRUtils::make_IntrinsicScalarFunction_t_util(al, loc, intrinsic_id, args.p, args.n, overload_id, type, value); } @@ -871,7 +871,8 @@ static inline ASR::symbol_t *create_KMP_function(Allocator &al, return fn_sym; } -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, + diag::Diagnostics& diagnostics) { const Location& loc = x.base.base.loc; ASRUtils::require_impl(x.n_args == 1, "Elemental intrinsics must have only 1 input argument", @@ -907,7 +908,7 @@ static inline ASR::asr_t* create_LogGamma(Allocator& al, const Location& loc, } return UnaryIntrinsicFunction::create_UnaryFunction(al, loc, args, - eval_log_gamma, static_cast(ASRUtils::IntrinsicFunctions::LogGamma), + eval_log_gamma, static_cast(IntrinsicScalarFunctions::LogGamma), 0, type); } @@ -924,8 +925,8 @@ static inline ASR::expr_t* instantiate_LogGamma (Allocator &al, } // namespace LogGamma -// `X` is the name of the function in the IntrinsicFunctions enum and we use -// the same name for `create_X` and other places +// `X` is the name of the function in the IntrinsicScalarFunctions enum and +// we use the same name for `create_X` and other places // `stdeval` is the name of the function in the `std` namespace for compile // numerical time evaluation // `lcompilers_name` is the name that we use in the C runtime library @@ -958,7 +959,7 @@ namespace X { args[0]->base.loc); \ } \ return UnaryIntrinsicFunction::create_UnaryFunction(al, loc, args, \ - eval_##X, static_cast(ASRUtils::IntrinsicFunctions::X),\ + eval_##X, static_cast(IntrinsicScalarFunctions::X), \ 0, type); \ } \ static inline ASR::expr_t* instantiate_##X (Allocator &al, \ @@ -987,7 +988,7 @@ create_trig(Tanh, tanh, tanh) namespace Abs { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { const Location& loc = x.base.base.loc; ASRUtils::require_impl(x.n_args == 1, "Elemental intrinsics must have only 1 input argument", @@ -1060,7 +1061,7 @@ namespace Abs { ASRUtils::extract_kind_from_ttype_t(type))); } return UnaryIntrinsicFunction::create_UnaryFunction(al, loc, args, eval_Abs, - static_cast(ASRUtils::IntrinsicFunctions::Abs), 0, type); + static_cast(IntrinsicScalarFunctions::Abs), 0, type); } static inline ASR::expr_t* instantiate_Abs(Allocator &al, const Location &loc, @@ -1175,7 +1176,7 @@ namespace Abs { namespace Sign { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 2, "ASR Verify: Call to sign must have exactly two arguments", x.base.base.loc, diagnostics); @@ -1228,8 +1229,8 @@ namespace Sign { arg_values.push_back(al, expr_value(args[1])); m_value = eval_Sign(al, loc, expr_type(args[0]), arg_values); } - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::Sign), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::Sign), args.p, args.n, 0, ASRUtils::expr_type(args[0]), m_value); } @@ -1304,7 +1305,7 @@ namespace X { args[0]->base.loc); \ } \ return UnaryIntrinsicFunction::create_UnaryFunction(al, loc, args, eval_##X, \ - static_cast(ASRUtils::IntrinsicFunctions::X), 0, type); \ + static_cast(IntrinsicScalarFunctions::X), 0, type); \ } \ } // namespace X @@ -1314,7 +1315,7 @@ create_exp_macro(Expm1, expm1) namespace ListIndex { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args <= 4, "Call to list.index must have at most four arguments", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])) && @@ -1381,8 +1382,8 @@ static inline ASR::asr_t* create_ListIndex(Allocator& al, const Location& loc, } ASR::ttype_t *to_type = int32; ASR::expr_t* compile_time_value = eval_list_index(al, loc, to_type, arg_values); - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::ListIndex), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::ListIndex), args.p, args.size(), overload_id, to_type, compile_time_value); } @@ -1390,7 +1391,7 @@ static inline ASR::asr_t* create_ListIndex(Allocator& al, const Location& loc, namespace ListReverse { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 1, "Call to list.reverse must have exactly one argument", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])), @@ -1421,8 +1422,8 @@ static inline ASR::asr_t* create_ListReverse(Allocator& al, const Location& loc, } ASR::expr_t* compile_time_value = eval_list_reverse(al, loc, nullptr, arg_values); return ASR::make_Expr_t(al, loc, - ASRUtils::EXPR(ASRUtils::make_IntrinsicFunction_t_util(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::ListReverse), + ASRUtils::EXPR(ASRUtils::make_IntrinsicScalarFunction_t_util(al, loc, + static_cast(IntrinsicScalarFunctions::ListReverse), args.p, args.size(), 0, nullptr, compile_time_value))); } @@ -1430,7 +1431,7 @@ static inline ASR::asr_t* create_ListReverse(Allocator& al, const Location& loc, namespace ListPop { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args <= 2, "Call to list.pop must have at most one argument", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])), @@ -1480,8 +1481,8 @@ static inline ASR::asr_t* create_ListPop(Allocator& al, const Location& loc, ASR::ttype_t *to_type = list_type; ASR::expr_t* compile_time_value = eval_list_pop(al, loc, to_type, arg_values); int64_t overload_id = (args.size() == 2); - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::ListPop), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::ListPop), args.p, args.size(), overload_id, to_type, compile_time_value); } @@ -1489,7 +1490,7 @@ static inline ASR::asr_t* create_ListPop(Allocator& al, const Location& loc, namespace Reserve { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 2, "Call to reserve must have exactly one argument", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])), @@ -1529,8 +1530,8 @@ static inline ASR::asr_t* create_Reserve(Allocator& al, const Location& loc, } ASR::expr_t* compile_time_value = eval_reserve(al, loc, nullptr, arg_values); return ASR::make_Expr_t(al, loc, - ASRUtils::EXPR(ASRUtils::make_IntrinsicFunction_t_util(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::Reserve), + ASRUtils::EXPR(ASRUtils::make_IntrinsicScalarFunction_t_util(al, loc, + static_cast(IntrinsicScalarFunctions::Reserve), args.p, args.size(), 0, nullptr, compile_time_value))); } @@ -1538,7 +1539,7 @@ static inline ASR::asr_t* create_Reserve(Allocator& al, const Location& loc, namespace DictKeys { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 1, "Call to dict.keys must have no argument", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])), @@ -1575,8 +1576,8 @@ static inline ASR::asr_t* create_DictKeys(Allocator& al, const Location& loc, } ASR::ttype_t *to_type = List(dict_keys_type); ASR::expr_t* compile_time_value = eval_dict_keys(al, loc, to_type, arg_values); - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::DictKeys), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::DictKeys), args.p, args.size(), 0, to_type, compile_time_value); } @@ -1584,7 +1585,7 @@ static inline ASR::asr_t* create_DictKeys(Allocator& al, const Location& loc, namespace DictValues { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 1, "Call to dict.values must have no argument", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])), @@ -1621,8 +1622,8 @@ static inline ASR::asr_t* create_DictValues(Allocator& al, const Location& loc, } ASR::ttype_t *to_type = List(dict_values_type); ASR::expr_t* compile_time_value = eval_dict_values(al, loc, to_type, arg_values); - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::DictValues), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::DictValues), args.p, args.size(), 0, to_type, compile_time_value); } @@ -1630,7 +1631,7 @@ static inline ASR::asr_t* create_DictValues(Allocator& al, const Location& loc, namespace SetAdd { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 2, "Call to set.add must have exactly one argument", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])), @@ -1670,8 +1671,8 @@ static inline ASR::asr_t* create_SetAdd(Allocator& al, const Location& loc, } ASR::expr_t* compile_time_value = eval_set_add(al, loc, nullptr, arg_values); return ASR::make_Expr_t(al, loc, - ASRUtils::EXPR(ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::SetAdd), + ASRUtils::EXPR(ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::SetAdd), args.p, args.size(), 0, nullptr, compile_time_value))); } @@ -1679,7 +1680,7 @@ static inline ASR::asr_t* create_SetAdd(Allocator& al, const Location& loc, namespace SetRemove { -static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { +static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 2, "Call to set.remove must have exactly one argument", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])), @@ -1719,8 +1720,8 @@ static inline ASR::asr_t* create_SetRemove(Allocator& al, const Location& loc, } ASR::expr_t* compile_time_value = eval_set_remove(al, loc, nullptr, arg_values); return ASR::make_Expr_t(al, loc, - ASRUtils::EXPR(ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::SetRemove), + ASRUtils::EXPR(ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::SetRemove), args.p, args.size(), 0, nullptr, compile_time_value))); } @@ -1728,7 +1729,7 @@ static inline ASR::asr_t* create_SetRemove(Allocator& al, const Location& loc, namespace Max { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args > 1, "ASR Verify: Call to max0 must have at least two arguments", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])) || @@ -1789,12 +1790,12 @@ namespace Max { } if (is_compile_time) { ASR::expr_t *value = eval_Max(al, loc, expr_type(args[0]), arg_values); - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::Max), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::Max), args.p, args.n, 0, ASRUtils::expr_type(args[0]), value); } else { - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::Max), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::Max), args.p, args.n, 0, ASRUtils::expr_type(args[0]), nullptr); } } @@ -1843,7 +1844,7 @@ namespace Max { namespace Min { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args > 1, "ASR Verify: Call to min0 must have at least two arguments", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])) || @@ -1904,12 +1905,12 @@ namespace Min { } if (is_compile_time) { ASR::expr_t *value = eval_Min(al, loc, expr_type(args[0]), arg_values); - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::Min), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::Min), args.p, args.n, 0, ASRUtils::expr_type(args[0]), value); } else { - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::Min), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::Min), args.p, args.n, 0, ASRUtils::expr_type(args[0]), nullptr); } } @@ -1970,7 +1971,7 @@ namespace Min { namespace Partition { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 2, "Call to partition must have exactly two arguments", x.base.base.loc, diagnostics); ASRUtils::require_impl(ASR::is_a(*ASRUtils::expr_type(x.m_args[0])) && @@ -2043,8 +2044,8 @@ namespace Partition { value = eval_Partition(al, loc, s_str, s_sep); } - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::Partition), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::Partition), e_args.p, e_args.n, 0, return_type, value); } @@ -2087,7 +2088,7 @@ namespace Partition { namespace SymbolicSymbol { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { const Location& loc = x.base.base.loc; ASRUtils::require_impl(x.n_args == 1, "SymbolicSymbol intrinsic must have exactly 1 input argument", @@ -2120,14 +2121,14 @@ namespace SymbolicSymbol { ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_SymbolicExpression_t(al, loc)); return UnaryIntrinsicFunction::create_UnaryFunction(al, loc, args, eval_SymbolicSymbol, - static_cast(ASRUtils::IntrinsicFunctions::SymbolicSymbol), 0, to_type); + static_cast(IntrinsicScalarFunctions::SymbolicSymbol), 0, to_type); } } // namespace SymbolicSymbol #define create_symbolic_binary_macro(X) \ namespace X{ \ - static inline void verify_args(const ASR::IntrinsicFunction_t& x, \ + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, \ diag::Diagnostics& diagnostics) { \ ASRUtils::require_impl(x.n_args == 2, "Intrinsic function `"#X"` accepts" \ "exactly 2 arguments", x.base.base.loc, diagnostics); \ @@ -2169,8 +2170,8 @@ namespace X{ } \ ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_SymbolicExpression_t(al, loc)); \ ASR::expr_t* compile_time_value = eval_##X(al, loc, to_type, arg_values); \ - return ASR::make_IntrinsicFunction_t(al, loc, \ - static_cast(ASRUtils::IntrinsicFunctions::X), \ + return ASR::make_IntrinsicScalarFunction_t(al, loc, \ + static_cast(IntrinsicScalarFunctions::X), \ args.p, args.size(), 0, to_type, compile_time_value); \ } \ } // namespace X @@ -2184,7 +2185,7 @@ create_symbolic_binary_macro(SymbolicDiff) namespace SymbolicPi { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 0, "SymbolicPi does not take arguments", x.base.base.loc, diagnostics); } @@ -2200,8 +2201,8 @@ namespace SymbolicPi { const std::function /*err*/) { ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_SymbolicExpression_t(al, loc)); ASR::expr_t* compile_time_value = eval_SymbolicPi(al, loc, to_type, args); - return ASR::make_IntrinsicFunction_t(al, loc, - static_cast(ASRUtils::IntrinsicFunctions::SymbolicPi), + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::SymbolicPi), nullptr, 0, 0, to_type, compile_time_value); } @@ -2209,7 +2210,7 @@ namespace SymbolicPi { namespace SymbolicInteger { - static inline void verify_args(const ASR::IntrinsicFunction_t& x, diag::Diagnostics& diagnostics) { + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args == 1, "SymbolicInteger intrinsic must have exactly 1 input argument", x.base.base.loc, diagnostics); @@ -2231,14 +2232,14 @@ namespace SymbolicInteger { const std::function /*err*/) { ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_SymbolicExpression_t(al, loc)); return UnaryIntrinsicFunction::create_UnaryFunction(al, loc, args, eval_SymbolicInteger, - static_cast(ASRUtils::IntrinsicFunctions::SymbolicInteger), 0, to_type); + static_cast(IntrinsicScalarFunctions::SymbolicInteger), 0, to_type); } } // namespace SymbolicInteger #define create_symbolic_unary_macro(X) \ namespace X { \ - static inline void verify_args(const ASR::IntrinsicFunction_t& x, \ + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, \ diag::Diagnostics& diagnostics) { \ const Location& loc = x.base.base.loc; \ ASRUtils::require_impl(x.n_args == 1, \ @@ -2270,7 +2271,7 @@ namespace X { \ ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_SymbolicExpression_t(al, loc)); \ return UnaryIntrinsicFunction::create_UnaryFunction(al, loc, args, eval_##X, \ - static_cast(ASRUtils::IntrinsicFunctions::X), 0, to_type); \ + static_cast(IntrinsicScalarFunctions::X), 0, to_type); \ } \ } // namespace X @@ -2282,176 +2283,176 @@ create_symbolic_unary_macro(SymbolicAbs) create_symbolic_unary_macro(SymbolicExpand) -namespace IntrinsicFunctionRegistry { +namespace IntrinsicScalarFunctionRegistry { static const std::map>& intrinsic_function_by_id_db = { - {static_cast(ASRUtils::IntrinsicFunctions::LogGamma), + {static_cast(IntrinsicScalarFunctions::LogGamma), {&LogGamma::instantiate_LogGamma, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Sin), + {static_cast(IntrinsicScalarFunctions::Sin), {&Sin::instantiate_Sin, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Cos), + {static_cast(IntrinsicScalarFunctions::Cos), {&Cos::instantiate_Cos, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Tan), + {static_cast(IntrinsicScalarFunctions::Tan), {&Tan::instantiate_Tan, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Asin), + {static_cast(IntrinsicScalarFunctions::Asin), {&Asin::instantiate_Asin, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Acos), + {static_cast(IntrinsicScalarFunctions::Acos), {&Acos::instantiate_Acos, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Atan), + {static_cast(IntrinsicScalarFunctions::Atan), {&Atan::instantiate_Atan, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Sinh), + {static_cast(IntrinsicScalarFunctions::Sinh), {&Sinh::instantiate_Sinh, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Cosh), + {static_cast(IntrinsicScalarFunctions::Cosh), {&Cosh::instantiate_Cosh, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Tanh), + {static_cast(IntrinsicScalarFunctions::Tanh), {&Tanh::instantiate_Tanh, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Exp), + {static_cast(IntrinsicScalarFunctions::Exp), {nullptr, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Exp2), + {static_cast(IntrinsicScalarFunctions::Exp2), {nullptr, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Expm1), + {static_cast(IntrinsicScalarFunctions::Expm1), {nullptr, &UnaryIntrinsicFunction::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Abs), + {static_cast(IntrinsicScalarFunctions::Abs), {&Abs::instantiate_Abs, &Abs::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Partition), + {static_cast(IntrinsicScalarFunctions::Partition), {&Partition::instantiate_Partition, &Partition::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::ListIndex), + {static_cast(IntrinsicScalarFunctions::ListIndex), {nullptr, &ListIndex::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::ListReverse), + {static_cast(IntrinsicScalarFunctions::ListReverse), {nullptr, &ListReverse::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::DictKeys), + {static_cast(IntrinsicScalarFunctions::DictKeys), {nullptr, &DictKeys::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::DictValues), + {static_cast(IntrinsicScalarFunctions::DictValues), {nullptr, &DictValues::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::ListPop), + {static_cast(IntrinsicScalarFunctions::ListPop), {nullptr, &ListPop::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Reserve), + {static_cast(IntrinsicScalarFunctions::Reserve), {nullptr, &Reserve::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SetAdd), + {static_cast(IntrinsicScalarFunctions::SetAdd), {nullptr, &SetAdd::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SetRemove), + {static_cast(IntrinsicScalarFunctions::SetRemove), {nullptr, &SetRemove::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Max), + {static_cast(IntrinsicScalarFunctions::Max), {&Max::instantiate_Max, &Max::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Min), + {static_cast(IntrinsicScalarFunctions::Min), {&Min::instantiate_Min, &Min::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::Sign), + {static_cast(IntrinsicScalarFunctions::Sign), {&Sign::instantiate_Sign, &Sign::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicSymbol), + {static_cast(IntrinsicScalarFunctions::SymbolicSymbol), {nullptr, &SymbolicSymbol::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicAdd), + {static_cast(IntrinsicScalarFunctions::SymbolicAdd), {nullptr, &SymbolicAdd::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicSub), + {static_cast(IntrinsicScalarFunctions::SymbolicSub), {nullptr, &SymbolicSub::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicMul), + {static_cast(IntrinsicScalarFunctions::SymbolicMul), {nullptr, &SymbolicMul::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicDiv), + {static_cast(IntrinsicScalarFunctions::SymbolicDiv), {nullptr, &SymbolicDiv::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicPow), + {static_cast(IntrinsicScalarFunctions::SymbolicPow), {nullptr, &SymbolicPow::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicPi), + {static_cast(IntrinsicScalarFunctions::SymbolicPi), {nullptr, &SymbolicPi::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicInteger), + {static_cast(IntrinsicScalarFunctions::SymbolicInteger), {nullptr, &SymbolicInteger::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicDiff), + {static_cast(IntrinsicScalarFunctions::SymbolicDiff), {nullptr, &SymbolicDiff::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicExpand), + {static_cast(IntrinsicScalarFunctions::SymbolicExpand), {nullptr, &SymbolicExpand::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicSin), + {static_cast(IntrinsicScalarFunctions::SymbolicSin), {nullptr, &SymbolicSin::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicCos), + {static_cast(IntrinsicScalarFunctions::SymbolicCos), {nullptr, &SymbolicCos::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicLog), + {static_cast(IntrinsicScalarFunctions::SymbolicLog), {nullptr, &SymbolicLog::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicExp), + {static_cast(IntrinsicScalarFunctions::SymbolicExp), {nullptr, &SymbolicExp::verify_args}}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicAbs), + {static_cast(IntrinsicScalarFunctions::SymbolicAbs), {nullptr, &SymbolicAbs::verify_args}}, }; static const std::map& intrinsic_function_id_to_name = { - {static_cast(ASRUtils::IntrinsicFunctions::LogGamma), + {static_cast(IntrinsicScalarFunctions::LogGamma), "log_gamma"}, - {static_cast(ASRUtils::IntrinsicFunctions::Sin), + {static_cast(IntrinsicScalarFunctions::Sin), "sin"}, - {static_cast(ASRUtils::IntrinsicFunctions::Cos), + {static_cast(IntrinsicScalarFunctions::Cos), "cos"}, - {static_cast(ASRUtils::IntrinsicFunctions::Tan), + {static_cast(IntrinsicScalarFunctions::Tan), "tan"}, - {static_cast(ASRUtils::IntrinsicFunctions::Asin), + {static_cast(IntrinsicScalarFunctions::Asin), "asin"}, - {static_cast(ASRUtils::IntrinsicFunctions::Acos), + {static_cast(IntrinsicScalarFunctions::Acos), "acos"}, - {static_cast(ASRUtils::IntrinsicFunctions::Atan), + {static_cast(IntrinsicScalarFunctions::Atan), "atan"}, - {static_cast(ASRUtils::IntrinsicFunctions::Sinh), + {static_cast(IntrinsicScalarFunctions::Sinh), "sinh"}, - {static_cast(ASRUtils::IntrinsicFunctions::Cosh), + {static_cast(IntrinsicScalarFunctions::Cosh), "cosh"}, - {static_cast(ASRUtils::IntrinsicFunctions::Tanh), + {static_cast(IntrinsicScalarFunctions::Tanh), "tanh"}, - {static_cast(ASRUtils::IntrinsicFunctions::Abs), + {static_cast(IntrinsicScalarFunctions::Abs), "abs"}, - {static_cast(ASRUtils::IntrinsicFunctions::Exp), + {static_cast(IntrinsicScalarFunctions::Exp), "exp"}, - {static_cast(ASRUtils::IntrinsicFunctions::Exp2), + {static_cast(IntrinsicScalarFunctions::Exp2), "exp2"}, - {static_cast(ASRUtils::IntrinsicFunctions::Expm1), + {static_cast(IntrinsicScalarFunctions::Expm1), "expm1"}, - {static_cast(ASRUtils::IntrinsicFunctions::ListIndex), + {static_cast(IntrinsicScalarFunctions::ListIndex), "list.index"}, - {static_cast(ASRUtils::IntrinsicFunctions::ListReverse), + {static_cast(IntrinsicScalarFunctions::ListReverse), "list.reverse"}, - {static_cast(ASRUtils::IntrinsicFunctions::ListPop), + {static_cast(IntrinsicScalarFunctions::ListPop), "list.pop"}, - {static_cast(ASRUtils::IntrinsicFunctions::Reserve), + {static_cast(IntrinsicScalarFunctions::Reserve), "reserve"}, - {static_cast(ASRUtils::IntrinsicFunctions::DictKeys), + {static_cast(IntrinsicScalarFunctions::DictKeys), "dict.keys"}, - {static_cast(ASRUtils::IntrinsicFunctions::DictValues), + {static_cast(IntrinsicScalarFunctions::DictValues), "dict.values"}, - {static_cast(ASRUtils::IntrinsicFunctions::SetAdd), + {static_cast(IntrinsicScalarFunctions::SetAdd), "set.add"}, - {static_cast(ASRUtils::IntrinsicFunctions::SetRemove), + {static_cast(IntrinsicScalarFunctions::SetRemove), "set.remove"}, - {static_cast(ASRUtils::IntrinsicFunctions::Max), + {static_cast(IntrinsicScalarFunctions::Max), "max"}, - {static_cast(ASRUtils::IntrinsicFunctions::Min), + {static_cast(IntrinsicScalarFunctions::Min), "min"}, - {static_cast(ASRUtils::IntrinsicFunctions::Sign), + {static_cast(IntrinsicScalarFunctions::Sign), "sign"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicSymbol), + {static_cast(IntrinsicScalarFunctions::SymbolicSymbol), "Symbol"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicAdd), + {static_cast(IntrinsicScalarFunctions::SymbolicAdd), "SymbolicAdd"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicSub), + {static_cast(IntrinsicScalarFunctions::SymbolicSub), "SymbolicSub"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicMul), + {static_cast(IntrinsicScalarFunctions::SymbolicMul), "SymbolicMul"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicDiv), + {static_cast(IntrinsicScalarFunctions::SymbolicDiv), "SymbolicDiv"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicPow), + {static_cast(IntrinsicScalarFunctions::SymbolicPow), "SymbolicPow"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicPi), + {static_cast(IntrinsicScalarFunctions::SymbolicPi), "pi"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicInteger), + {static_cast(IntrinsicScalarFunctions::SymbolicInteger), "SymbolicInteger"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicDiff), + {static_cast(IntrinsicScalarFunctions::SymbolicDiff), "SymbolicDiff"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicExpand), + {static_cast(IntrinsicScalarFunctions::SymbolicExpand), "SymbolicExpand"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicSin), + {static_cast(IntrinsicScalarFunctions::SymbolicSin), "SymbolicSin"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicCos), + {static_cast(IntrinsicScalarFunctions::SymbolicCos), "SymbolicCos"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicLog), + {static_cast(IntrinsicScalarFunctions::SymbolicLog), "SymbolicLog"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicExp), + {static_cast(IntrinsicScalarFunctions::SymbolicExp), "SymbolicExp"}, - {static_cast(ASRUtils::IntrinsicFunctions::SymbolicAbs), + {static_cast(IntrinsicScalarFunctions::SymbolicAbs), "SymbolicAbs"}, }; @@ -2511,16 +2512,16 @@ namespace IntrinsicFunctionRegistry { } static inline bool is_elemental(int64_t id) { - ASRUtils::IntrinsicFunctions id_ = static_cast(id); - return ( id_ == ASRUtils::IntrinsicFunctions::Abs || - id_ == ASRUtils::IntrinsicFunctions::Cos || - id_ == ASRUtils::IntrinsicFunctions::Gamma || - id_ == ASRUtils::IntrinsicFunctions::LogGamma || - id_ == ASRUtils::IntrinsicFunctions::Sin || - id_ == ASRUtils::IntrinsicFunctions::Exp || - id_ == ASRUtils::IntrinsicFunctions::Exp2 || - id_ == ASRUtils::IntrinsicFunctions::Expm1 || - id_ == ASRUtils::IntrinsicFunctions::SymbolicSymbol); + IntrinsicScalarFunctions id_ = static_cast(id); + return ( id_ == IntrinsicScalarFunctions::Abs || + id_ == IntrinsicScalarFunctions::Cos || + id_ == IntrinsicScalarFunctions::Gamma || + id_ == IntrinsicScalarFunctions::LogGamma || + id_ == IntrinsicScalarFunctions::Sin || + id_ == IntrinsicScalarFunctions::Exp || + id_ == IntrinsicScalarFunctions::Exp2 || + id_ == IntrinsicScalarFunctions::Expm1 || + id_ == IntrinsicScalarFunctions::SymbolicSymbol); } static inline create_intrinsic_function get_create_function(const std::string& name) { @@ -2555,7 +2556,7 @@ namespace IntrinsicFunctionRegistry { return true; } -} // namespace IntrinsicFunctionRegistry +} // namespace IntrinsicScalarFunctionRegistry /************************* Intrinsic Impure Function **************************/ enum class IntrinsicImpureFunctions : int64_t { diff --git a/src/libasr/pass/replace_symbolic.cpp b/src/libasr/pass/replace_symbolic.cpp index f0cda46468..eb0a0211e4 100644 --- a/src/libasr/pass/replace_symbolic.cpp +++ b/src/libasr/pass/replace_symbolic.cpp @@ -349,8 +349,8 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor(*arg)) { return arg; - } else if (ASR::is_a(*arg)) { - this->visit_IntrinsicFunction(*ASR::down_cast(arg)); + } else if (ASR::is_a(*arg)) { + this->visit_IntrinsicFunction(*ASR::down_cast(arg)); } else if (ASR::is_a(*arg)) { this->visit_Cast(*ASR::down_cast(arg)); } else { @@ -360,24 +360,24 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitorm_args[0]); ASR::expr_t* value2 = handle_argument(al, loc, x->m_args[1]); perform_symbolic_binary_operation(al, loc, module_scope, new_name, target, value1, value2); } - void process_unary_operator(Allocator &al, const Location &loc, ASR::IntrinsicFunction_t* x, SymbolTable* module_scope, + void process_unary_operator(Allocator &al, const Location &loc, ASR::IntrinsicScalarFunction_t* x, SymbolTable* module_scope, const std::string& new_name, ASR::expr_t* target) { ASR::expr_t* value1 = handle_argument(al, loc, x->m_args[0]); perform_symbolic_unary_operation(al, loc, module_scope, new_name, target, value1); } - void process_intrinsic_function(Allocator &al, const Location &loc, ASR::IntrinsicFunction_t* x, SymbolTable* module_scope, + void process_intrinsic_function(Allocator &al, const Location &loc, ASR::IntrinsicScalarFunction_t* x, SymbolTable* module_scope, ASR::expr_t* target){ int64_t intrinsic_id = x->m_intrinsic_id; - switch (static_cast(intrinsic_id)) { - case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicPi: { + switch (static_cast(intrinsic_id)) { + case LCompilers::ASRUtils::IntrinsicScalarFunctions::SymbolicPi: { std::string new_name = "basic_const_pi"; symbolic_dependencies.push_back(new_name); if (!module_scope->get_symbol(new_name)) { @@ -422,7 +422,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitorget_symbol(new_name)) { @@ -475,51 +475,51 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitorparent; - if (ASR::is_a(*x.m_value)) { - ASR::IntrinsicFunction_t* intrinsic_func = ASR::down_cast(x.m_value); + if (ASR::is_a(*x.m_value)) { + ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast(x.m_value); if (intrinsic_func->m_type->type == ASR::ttypeType::SymbolicExpression) { process_intrinsic_function(al, x.base.base.loc, intrinsic_func, module_scope, x.m_target); } @@ -543,11 +543,11 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitorm_kind == ASR::cast_kindType::IntegerToSymbolicExpression) { ASR::expr_t* cast_arg = cast_t->m_arg; ASR::expr_t* cast_value = cast_t->m_value; - if (ASR::is_a(*cast_value)) { - ASR::IntrinsicFunction_t* intrinsic_func = ASR::down_cast(cast_value); + if (ASR::is_a(*cast_value)) { + ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast(cast_value); int64_t intrinsic_id = intrinsic_func->m_intrinsic_id; - if (static_cast(intrinsic_id) == - LCompilers::ASRUtils::IntrinsicFunctions::SymbolicInteger) { + if (static_cast(intrinsic_id) == + LCompilers::ASRUtils::IntrinsicScalarFunctions::SymbolicInteger) { int const_value = 0; if (ASR::is_a(*cast_arg)){ ASR::IntegerConstant_t* const_int = ASR::down_cast(cast_arg); @@ -678,8 +678,8 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor(*val) && ASR::is_a(*ASRUtils::expr_type(val))) { - ASR::IntrinsicFunction_t* intrinsic_func = ASR::down_cast(val); + } else if (ASR::is_a(*val) && ASR::is_a(*ASRUtils::expr_type(val))) { + ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast(val); ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_SymbolicExpression_t(al, x.base.base.loc)); std::string symengine_var = symengine_stack.push(); ASR::symbol_t *arg = ASR::down_cast(ASR::make_Variable_t( @@ -762,7 +762,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitortype == ASR::ttypeType::SymbolicExpression) { SymbolTable* module_scope = current_scope->parent; @@ -780,7 +780,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor(x); + ASR::IntrinsicScalarFunction_t &xx = const_cast(x); ASR::expr_t* target = ASRUtils::EXPR(ASR::make_Var_t(al, x.base.base.loc, arg)); process_intrinsic_function(al, x.base.base.loc, &xx, module_scope, target); } @@ -807,11 +807,11 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor(*cast_value)) { - ASR::IntrinsicFunction_t* intrinsic_func = ASR::down_cast(cast_value); + if (ASR::is_a(*cast_value)) { + ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast(cast_value); int64_t intrinsic_id = intrinsic_func->m_intrinsic_id; - if (static_cast(intrinsic_id) == - LCompilers::ASRUtils::IntrinsicFunctions::SymbolicInteger) { + if (static_cast(intrinsic_id) == + LCompilers::ASRUtils::IntrinsicScalarFunctions::SymbolicInteger) { int const_value = 0; if (ASR::is_a(*cast_arg)){ ASR::IntegerConstant_t* const_int = ASR::down_cast(cast_arg); @@ -885,8 +885,8 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor(*expr)) { var_sym = ASR::down_cast(expr)->m_v; - } else if (ASR::is_a(*expr)) { - ASR::IntrinsicFunction_t* intrinsic_func = ASR::down_cast(expr); + } else if (ASR::is_a(*expr)) { + ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast(expr); this->visit_IntrinsicFunction(*intrinsic_func); var_sym = current_scope->get_symbol(symengine_stack.pop()); } else if (ASR::is_a(*expr)) { @@ -968,4 +968,4 @@ void pass_replace_symbolic(Allocator &al, ASR::TranslationUnit_t &unit, v.visit_TranslationUnit(unit); } -} // namespace LCompilers \ No newline at end of file +} // namespace LCompilers diff --git a/src/libasr/pass/where.cpp b/src/libasr/pass/where.cpp index e1ad88c7fc..49459b2e75 100644 --- a/src/libasr/pass/where.cpp +++ b/src/libasr/pass/where.cpp @@ -96,7 +96,7 @@ class ReplaceVar : public ASR::BaseExprReplacer BinOpReplacement(make_RealBinOp_t) } - void replace_IntrinsicFunction(ASR::IntrinsicFunction_t* x) { + void replace_IntrinsicScalarFunction(ASR::IntrinsicScalarFunction_t* x) { Vec args; args.reserve(al, x->n_args); for (size_t i=0; in_args; i++) { @@ -106,7 +106,9 @@ class ReplaceVar : public ASR::BaseExprReplacer args.push_back(al, *current_expr); } ASR::ttype_t* type = ASRUtils::expr_type(args[0]); - ASR::expr_t* new_expr = ASRUtils::EXPR(ASRUtils::make_IntrinsicFunction_t_util(al, x->base.base.loc, x->m_intrinsic_id, args.p, x->n_args, x->m_overload_id, type, x->m_value)); + ASR::expr_t* new_expr = ASRUtils::EXPR( + ASRUtils::make_IntrinsicScalarFunction_t_util(al, x->base.base.loc, + x->m_intrinsic_id, args.p, x->n_args, x->m_overload_id, type, x->m_value)); *current_expr = new_expr; } diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index fef167d873..08b8d71bfa 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2312,23 +2312,23 @@ class CommonVisitor : public AST::BaseVisitor { ASRUtils::create_intrinsic_function create_function; switch (op) { case (ASR::binopType::Add): { - create_function = ASRUtils::IntrinsicFunctionRegistry::get_create_function("SymbolicAdd"); + create_function = ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("SymbolicAdd"); break; } case (ASR::binopType::Sub): { - create_function = ASRUtils::IntrinsicFunctionRegistry::get_create_function("SymbolicSub"); + create_function = ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("SymbolicSub"); break; } case (ASR::binopType::Mul): { - create_function = ASRUtils::IntrinsicFunctionRegistry::get_create_function("SymbolicMul"); + create_function = ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("SymbolicMul"); break; } case (ASR::binopType::Div): { - create_function = ASRUtils::IntrinsicFunctionRegistry::get_create_function("SymbolicDiv"); + create_function = ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("SymbolicDiv"); break; } case (ASR::binopType::Pow): { - create_function = ASRUtils::IntrinsicFunctionRegistry::get_create_function("SymbolicPow"); + create_function = ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("SymbolicPow"); break; } default: { @@ -3321,11 +3321,11 @@ class CommonVisitor : public AST::BaseVisitor { ASR::symbol_t *s = current_scope->resolve_symbol(name); LCOMPILERS_ASSERT(s); tmp = ASR::make_Var_t(al, x.base.base.loc, s); - } else if (ASRUtils::IntrinsicFunctionRegistry::is_intrinsic_function(name) && + } else if (ASRUtils::IntrinsicScalarFunctionRegistry::is_intrinsic_function(name) && (not_cpython_builtin.find(name) == not_cpython_builtin.end() || imported_functions.find(name) != imported_functions.end() )) { ASRUtils::create_intrinsic_function create_func = - ASRUtils::IntrinsicFunctionRegistry::get_create_function(name); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function(name); Vec args_; tmp = create_func(al, x.base.base.loc, args_, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); @@ -6639,7 +6639,7 @@ class BodyVisitor : public CommonVisitor { return; } else if( call_name == "reserve" ) { ASRUtils::create_intrinsic_function create_func = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("reserve"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("reserve"); Vec args_exprs; args_exprs.reserve(al, args.size()); for( size_t i = 0; i < args.size(); i++ ) { args_exprs.push_back(al, args[i].m_value); @@ -7427,13 +7427,13 @@ class BodyVisitor : public CommonVisitor { imported_functions[call_name] == "sympy"){ intrinsic_name = "Symbolic" + std::string(1, std::toupper(call_name[0])) + call_name.substr(1); } - if ((ASRUtils::IntrinsicFunctionRegistry::is_intrinsic_function(intrinsic_name) || + if ((ASRUtils::IntrinsicScalarFunctionRegistry::is_intrinsic_function(intrinsic_name) || ASRUtils::IntrinsicArrayFunctionRegistry::is_intrinsic_function(intrinsic_name)) && (not_cpython_builtin.find(call_name) == not_cpython_builtin.end() || imported_functions.find(call_name) != imported_functions.end() )) { ASRUtils::create_intrinsic_function create_func; - if (ASRUtils::IntrinsicFunctionRegistry::is_intrinsic_function(intrinsic_name)) { - create_func = ASRUtils::IntrinsicFunctionRegistry::get_create_function(intrinsic_name); + if (ASRUtils::IntrinsicScalarFunctionRegistry::is_intrinsic_function(intrinsic_name)) { + create_func = ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function(intrinsic_name); } else { create_func = ASRUtils::IntrinsicArrayFunctionRegistry::get_create_function(intrinsic_name); } diff --git a/src/lpython/semantics/python_attribute_eval.h b/src/lpython/semantics/python_attribute_eval.h index 6355db3b5f..8bb8296a8d 100644 --- a/src/lpython/semantics/python_attribute_eval.h +++ b/src/lpython/semantics/python_attribute_eval.h @@ -203,7 +203,7 @@ struct AttributeHandler { args_with_list.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("list.index"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("list.index"); return create_function(al, loc, args_with_list, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -217,7 +217,7 @@ struct AttributeHandler { args_with_list.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("list.reverse"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("list.reverse"); return create_function(al, loc, args_with_list, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -231,7 +231,7 @@ struct AttributeHandler { args_with_list.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("list.pop"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("list.pop"); return create_function(al, loc, args_with_list, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -304,7 +304,7 @@ struct AttributeHandler { args_with_set.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("set.add"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("set.add"); return create_function(al, loc, args_with_set, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -318,7 +318,7 @@ struct AttributeHandler { args_with_set.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("set.remove"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("set.remove"); return create_function(al, loc, args_with_set, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -395,7 +395,7 @@ struct AttributeHandler { args_with_dict.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("dict.keys"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("dict.keys"); return create_function(al, loc, args_with_dict, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -409,7 +409,7 @@ struct AttributeHandler { args_with_dict.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("dict.values"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("dict.values"); return create_function(al, loc, args_with_dict, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -423,7 +423,7 @@ struct AttributeHandler { args_with_list.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("diff"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("diff"); return create_function(al, loc, args_with_list, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } @@ -437,7 +437,7 @@ struct AttributeHandler { args_with_list.push_back(al, args[i]); } ASRUtils::create_intrinsic_function create_function = - ASRUtils::IntrinsicFunctionRegistry::get_create_function("expand"); + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function("expand"); return create_function(al, loc, args_with_list, [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }); } diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index d6b1bb7d3f..b6b29d17c1 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "9ee2a3ca03f116d819095a08b7600931b18ffc887fb3670e65905935", + "stdout_hash": "6a720ac727aa279e50caba080213442c089fcaaf28297bbbb524c825", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index b60004d11c..21cf100828 100644 --- a/tests/reference/asr-constants1-5828e8a.stdout +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -84,7 +84,7 @@ [] [(= (Var 5 a) - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(IntegerConstant 5 (Integer 4))] 0 @@ -95,7 +95,7 @@ ) (= (Var 5 a) - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(IntegerUnaryMinus (IntegerConstant 500 (Integer 4)) @@ -110,7 +110,7 @@ ) (= (Var 5 a) - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Cast (LogicalConstant @@ -129,7 +129,7 @@ ) (= (Var 5 a) - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Cast (LogicalConstant @@ -149,7 +149,7 @@ (= (Var 5 b) (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealConstant 3.450000 @@ -174,7 +174,7 @@ (= (Var 5 b) (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealUnaryMinus (RealConstant @@ -206,7 +206,7 @@ (= (Var 5 b) (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(FunctionCall 5 complex@__lpython_overloaded_5__complex diff --git a/tests/reference/asr-elemental_01-b58df26.json b/tests/reference/asr-elemental_01-b58df26.json index cccbcdc88a..b08b7d9464 100644 --- a/tests/reference/asr-elemental_01-b58df26.json +++ b/tests/reference/asr-elemental_01-b58df26.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-elemental_01-b58df26.stdout", - "stdout_hash": "7ce2e5fe829c8e51cf8f467dfd726fef8da1601c714b5af3e24dd1af", + "stdout_hash": "6fd3b9bf7ded59e56672127135e71ffe94a3e2715eb5ae6c1d77ea82", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-elemental_01-b58df26.stdout b/tests/reference/asr-elemental_01-b58df26.stdout index 35f6dfef21..2f65df2e15 100644 --- a/tests/reference/asr-elemental_01-b58df26.stdout +++ b/tests/reference/asr-elemental_01-b58df26.stdout @@ -1868,7 +1868,7 @@ (IntegerConstant 1 (Integer 4))) [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ArrayItem @@ -1969,7 +1969,7 @@ block [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -2337,7 +2337,7 @@ (IntegerConstant 1 (Integer 4))) [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp @@ -2598,7 +2598,7 @@ (IntegerConstant 1 (Integer 4))) [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp @@ -2734,7 +2734,7 @@ block [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp @@ -3044,7 +3044,7 @@ block [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp diff --git a/tests/reference/asr-expr_05-3a37324.json b/tests/reference/asr-expr_05-3a37324.json index 429df1293d..adb113e146 100644 --- a/tests/reference/asr-expr_05-3a37324.json +++ b/tests/reference/asr-expr_05-3a37324.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr_05-3a37324.stdout", - "stdout_hash": "b647c29262d846c6a9470081add7c497093bf643f3834e9504dbe784", + "stdout_hash": "e568b4fb4b9a08389b8d7639ee6e08ad43ec2b8086a7486598ffd92b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr_05-3a37324.stdout b/tests/reference/asr-expr_05-3a37324.stdout index ff617f0e44..90bdf0425d 100644 --- a/tests/reference/asr-expr_05-3a37324.stdout +++ b/tests/reference/asr-expr_05-3a37324.stdout @@ -1193,7 +1193,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1255,7 +1255,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall diff --git a/tests/reference/asr-expr_09-f3e89c8.json b/tests/reference/asr-expr_09-f3e89c8.json index 4ca67315f8..2c3196b845 100644 --- a/tests/reference/asr-expr_09-f3e89c8.json +++ b/tests/reference/asr-expr_09-f3e89c8.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr_09-f3e89c8.stdout", - "stdout_hash": "ecfde426a62ac9860418a88dd60edcea1ce2ac278554857680143a35", + "stdout_hash": "ba3074d0bc0b2017872e27e730d06054b799d295c6599949176a0e15", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr_09-f3e89c8.stdout b/tests/reference/asr-expr_09-f3e89c8.stdout index b4d42d17fd..b6bad33ca5 100644 --- a/tests/reference/asr-expr_09-f3e89c8.stdout +++ b/tests/reference/asr-expr_09-f3e89c8.stdout @@ -656,7 +656,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 4 x) @@ -684,7 +684,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 4 y) @@ -712,7 +712,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 4 e) @@ -740,7 +740,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 4 d) @@ -845,7 +845,7 @@ (IntegerConstant 1 (Integer 4))) [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ListItem @@ -880,7 +880,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ListItem @@ -915,7 +915,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp diff --git a/tests/reference/asr-expr_14-f2bd343.json b/tests/reference/asr-expr_14-f2bd343.json index 452209d030..59cc62002a 100644 --- a/tests/reference/asr-expr_14-f2bd343.json +++ b/tests/reference/asr-expr_14-f2bd343.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr_14-f2bd343.stdout", - "stdout_hash": "38802a7dc7857816979d9549fda992e3637ca30ab8db286db22340a4", + "stdout_hash": "b03cf9660c69a5bd18468550cc176ffd6f219869f5b9a198c2b23e71", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr_14-f2bd343.stdout b/tests/reference/asr-expr_14-f2bd343.stdout index b0ccff35bb..004396081b 100644 --- a/tests/reference/asr-expr_14-f2bd343.stdout +++ b/tests/reference/asr-expr_14-f2bd343.stdout @@ -387,7 +387,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 3 a3) @@ -456,7 +456,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 3 b3) @@ -527,7 +527,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 3 c3) @@ -598,7 +598,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 3 d3) @@ -711,7 +711,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(ComplexBinOp (ComplexBinOp @@ -842,7 +842,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(ComplexBinOp (ComplexBinOp diff --git a/tests/reference/asr-list1-770ba33.json b/tests/reference/asr-list1-770ba33.json index dfd4479604..9a3720e721 100644 --- a/tests/reference/asr-list1-770ba33.json +++ b/tests/reference/asr-list1-770ba33.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-list1-770ba33.stdout", - "stdout_hash": "bdbe744ed90d9e0317c8370db8b793bff41ddd23c7ee9c0ccf9b1360", + "stdout_hash": "6b6e9737c184719a7d269490a7fcdfe22f3c1e69d34e20502528f1ac", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-list1-770ba33.stdout b/tests/reference/asr-list1-770ba33.stdout index 382d2be8eb..5042167566 100644 --- a/tests/reference/asr-list1-770ba33.stdout +++ b/tests/reference/asr-list1-770ba33.stdout @@ -322,7 +322,7 @@ ) (= (Var 3 d) - (IntrinsicFunction + (IntrinsicScalarFunction ListPop [(Var 3 a)] 0 @@ -333,7 +333,7 @@ ) (= (Var 3 d) - (IntrinsicFunction + (IntrinsicScalarFunction ListPop [(Var 3 a) (IntegerConstant 2 (Integer 4))] diff --git a/tests/reference/asr-set1-b7b913a.json b/tests/reference/asr-set1-b7b913a.json index 244a944ea3..3f8600d01f 100644 --- a/tests/reference/asr-set1-b7b913a.json +++ b/tests/reference/asr-set1-b7b913a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-set1-b7b913a.stdout", - "stdout_hash": "64366c80a466b43ffcd25c03d279a6c1b8a17e7e3fa53b6cd7733271", + "stdout_hash": "5cedd001b9359adb6bbe66fb49cbbcdb2b13fbc5eae198660c91a996", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-set1-b7b913a.stdout b/tests/reference/asr-set1-b7b913a.stdout index 22196244c7..ed54f5debe 100644 --- a/tests/reference/asr-set1-b7b913a.stdout +++ b/tests/reference/asr-set1-b7b913a.stdout @@ -109,7 +109,7 @@ () ) (Expr - (IntrinsicFunction + (IntrinsicScalarFunction SetAdd [(Var 3 a) (IntegerConstant 9 (Integer 4))] @@ -119,7 +119,7 @@ ) ) (Expr - (IntrinsicFunction + (IntrinsicScalarFunction SetRemove [(Var 3 a) (IntegerConstant 4 (Integer 4))] diff --git a/tests/reference/asr-structs_05-fa98307.json b/tests/reference/asr-structs_05-fa98307.json index 380d435e1d..38fdafab0c 100644 --- a/tests/reference/asr-structs_05-fa98307.json +++ b/tests/reference/asr-structs_05-fa98307.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-structs_05-fa98307.stdout", - "stdout_hash": "dc3d73243eff18d08010fb4566a90b895639855e74a4c5622445f790", + "stdout_hash": "9a947180189938b72d890313d7745a3f4a41d546b6dba9e19e7a9c20", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-structs_05-fa98307.stdout b/tests/reference/asr-structs_05-fa98307.stdout index fca01278d3..c2f191904d 100644 --- a/tests/reference/asr-structs_05-fa98307.stdout +++ b/tests/reference/asr-structs_05-fa98307.stdout @@ -1061,7 +1061,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (StructInstanceMember @@ -1108,7 +1108,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (StructInstanceMember @@ -1277,7 +1277,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (StructInstanceMember @@ -1324,7 +1324,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (StructInstanceMember diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.json b/tests/reference/asr-test_builtin_abs-c74d2c9.json index dbbb9a2057..ce0899d23b 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.json +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_abs-c74d2c9.stdout", - "stdout_hash": "8704ba46954782edf300582475bf3afa482fd9a44fee030a0731b8b9", + "stdout_hash": "86d0821d3e240a6645d0f7778a81076160e627a1e8a61e4b2c9056b3", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout index 15b17d931a..45fc58f6b9 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout @@ -188,7 +188,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 x)] 0 @@ -222,7 +222,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 x)] 0 @@ -241,7 +241,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealConstant 5.500000 @@ -269,7 +269,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealUnaryMinus (RealConstant @@ -327,7 +327,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 x2)] 0 @@ -363,7 +363,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 i)] 0 @@ -379,7 +379,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(IntegerUnaryMinus (IntegerConstant 1 (Integer 4)) @@ -416,7 +416,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 i2)] 0 @@ -451,7 +451,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 i3)] 0 @@ -486,7 +486,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 i4)] 0 @@ -515,7 +515,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Cast (Var 3 b) @@ -544,7 +544,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Cast (Var 3 b) diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index 290dcad76c..91386137d8 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.json +++ b/tests/reference/asr-test_builtin_pow-f02fcda.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_pow-f02fcda.stdout", - "stdout_hash": "d9a0be4ec0fc5fcd2189eb31e408db9e1f874faf0f0cde793e12a82a", + "stdout_hash": "86fd31e26dc71b764870beccd023c01728fa926e21e792467b972dac", "stderr": "asr-test_builtin_pow-f02fcda.stderr", "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index b7d5db5213..dbdee2fdcf 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stdout +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stdout @@ -931,7 +931,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -964,7 +964,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1010,7 +1010,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1043,7 +1043,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1076,7 +1076,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1112,7 +1112,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1168,7 +1168,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1224,7 +1224,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1284,7 +1284,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1340,7 +1340,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1388,7 +1388,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1436,7 +1436,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1491,7 +1491,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1536,7 +1536,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1588,7 +1588,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1633,7 +1633,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -1707,7 +1707,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall diff --git a/tests/reference/asr-test_c_interop_01-e374f43.json b/tests/reference/asr-test_c_interop_01-e374f43.json index 716a796db4..a35f2d0c2b 100644 --- a/tests/reference/asr-test_c_interop_01-e374f43.json +++ b/tests/reference/asr-test_c_interop_01-e374f43.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_c_interop_01-e374f43.stdout", - "stdout_hash": "36d1ce849d522551d3a6959c4120c020948daffd48736099af330484", + "stdout_hash": "54f0e7b627f6a658a8ff7c49f02434b2c7e8393c3c9553a884506837", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_c_interop_01-e374f43.stdout b/tests/reference/asr-test_c_interop_01-e374f43.stdout index cc56fb110b..cffa869f5b 100644 --- a/tests/reference/asr-test_c_interop_01-e374f43.stdout +++ b/tests/reference/asr-test_c_interop_01-e374f43.stdout @@ -379,7 +379,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -414,7 +414,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -458,7 +458,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall @@ -514,7 +514,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (FunctionCall diff --git a/tests/reference/asr-test_complex_01-a6def58.json b/tests/reference/asr-test_complex_01-a6def58.json index 09ea0ce87b..93dbd3520d 100644 --- a/tests/reference/asr-test_complex_01-a6def58.json +++ b/tests/reference/asr-test_complex_01-a6def58.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_01-a6def58.stdout", - "stdout_hash": "0692ef127000dfc8a418218e1e295bd41b5e17a46d06e21890961e99", + "stdout_hash": "3014b21f4eacfbd2e80338fa6d2ede719f2fcb2a282208a82b690d05", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_01-a6def58.stdout b/tests/reference/asr-test_complex_01-a6def58.stdout index 6723075df5..7b5bdd50b7 100644 --- a/tests/reference/asr-test_complex_01-a6def58.stdout +++ b/tests/reference/asr-test_complex_01-a6def58.stdout @@ -403,7 +403,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexRe @@ -432,7 +432,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -482,7 +482,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexRe @@ -518,7 +518,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -567,7 +567,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexRe @@ -596,7 +596,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -645,7 +645,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexRe @@ -674,7 +674,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -728,7 +728,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexRe @@ -757,7 +757,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -846,7 +846,7 @@ (Assert (RealCompare (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -1341,7 +1341,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Cast @@ -1385,7 +1385,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Cast @@ -1468,7 +1468,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Cast @@ -1512,7 +1512,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Cast @@ -1595,7 +1595,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexRe @@ -1627,7 +1627,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -1696,7 +1696,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexRe @@ -1735,7 +1735,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ComplexIm @@ -1921,7 +1921,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 3 a) @@ -1946,7 +1946,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Var 3 b) diff --git a/tests/reference/asr-test_complex_02-782ba2d.json b/tests/reference/asr-test_complex_02-782ba2d.json index 015ae824e7..742c8f2111 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.json +++ b/tests/reference/asr-test_complex_02-782ba2d.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_02-782ba2d.stdout", - "stdout_hash": "2219e40d60d28c61a23b07625bb185439d8338973c5d2312f2252718", + "stdout_hash": "3f0a840a1eb752387e2049015be0637113191365ad20e7451d46d059", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_02-782ba2d.stdout b/tests/reference/asr-test_complex_02-782ba2d.stdout index 3bf7785968..0235c9b205 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.stdout +++ b/tests/reference/asr-test_complex_02-782ba2d.stdout @@ -220,11 +220,11 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 x)] 0 @@ -273,10 +273,10 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(Var 3 y)] 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index fac7be8045..e3b8a49d99 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_max_min-3c2fc51.stdout", - "stdout_hash": "2f0d706f9ac6d985b0781a10cb989bccf5923a82410bf4d526b32935", + "stdout_hash": "881f7e396fc973454dd4b027af902eb829651c88f89246e0e79bf1f1", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.stdout b/tests/reference/asr-test_max_min-3c2fc51.stdout index f035e16398..abd9844b3f 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.stdout +++ b/tests/reference/asr-test_max_min-3c2fc51.stdout @@ -569,7 +569,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Min [(Var 6 d) (Var 6 e) @@ -587,7 +587,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Min [(Var 6 e) (Var 6 f)] @@ -696,7 +696,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Min [(Var 5 a) (Var 5 b)] @@ -713,7 +713,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Min [(Var 5 a) (Var 5 b) @@ -731,7 +731,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Min [(IntegerConstant 1 (Integer 4)) (IntegerConstant 2 (Integer 4)) @@ -752,7 +752,7 @@ ) (Assert (IntegerCompare - (IntrinsicFunction + (IntrinsicScalarFunction Min [(IntegerConstant 1 (Integer 4)) (IntegerConstant 6 (Integer 4))] diff --git a/tests/reference/asr-test_numpy_03-e600a49.json b/tests/reference/asr-test_numpy_03-e600a49.json index abc35eb0ac..ddbf4a99ac 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.json +++ b/tests/reference/asr-test_numpy_03-e600a49.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_numpy_03-e600a49.stdout", - "stdout_hash": "fb4a623059b7a8e743a10f405685a9a8a1ade809ae6520425bd579be", + "stdout_hash": "835121cdfc4e1a33435c47fa2170d19d4a0dfc986b2a72dbbd6e944f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_numpy_03-e600a49.stdout b/tests/reference/asr-test_numpy_03-e600a49.stdout index 164ea92fba..e481348c05 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.stdout +++ b/tests/reference/asr-test_numpy_03-e600a49.stdout @@ -477,7 +477,7 @@ (IntegerConstant 1 (Integer 4))) [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp @@ -633,7 +633,7 @@ (IntegerConstant 1 (Integer 4))) [(Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp @@ -810,7 +810,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp @@ -971,7 +971,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (RealBinOp diff --git a/tests/reference/asr-test_numpy_04-ecbb614.json b/tests/reference/asr-test_numpy_04-ecbb614.json index e76f1f0e38..5174fffde5 100644 --- a/tests/reference/asr-test_numpy_04-ecbb614.json +++ b/tests/reference/asr-test_numpy_04-ecbb614.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_numpy_04-ecbb614.stdout", - "stdout_hash": "e799b8f3fc51ba9c73139a5f846eed42ccd500e8820257594909d567", + "stdout_hash": "f903d0f571e9c7a0d6201d1616168474deec149f823ba9075f82bf05", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_numpy_04-ecbb614.stdout b/tests/reference/asr-test_numpy_04-ecbb614.stdout index fb12d54db2..8033c0919c 100644 --- a/tests/reference/asr-test_numpy_04-ecbb614.stdout +++ b/tests/reference/asr-test_numpy_04-ecbb614.stdout @@ -181,7 +181,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ArrayItem @@ -214,7 +214,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ArrayItem @@ -247,7 +247,7 @@ ) (Assert (RealCompare - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(RealBinOp (ArrayItem @@ -371,7 +371,7 @@ (Assert (RealCompare (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(IntegerBinOp (ArrayItem @@ -406,7 +406,7 @@ (Assert (RealCompare (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(IntegerBinOp (ArrayItem @@ -441,7 +441,7 @@ (Assert (RealCompare (Cast - (IntrinsicFunction + (IntrinsicScalarFunction Abs [(IntegerBinOp (ArrayItem