@@ -85,6 +85,7 @@ enum class IntrinsicScalarFunctions : int64_t {
85
85
SymbolicPowQ,
86
86
SymbolicLogQ,
87
87
SymbolicSinQ,
88
+ SymbolicGetArgument,
88
89
// ...
89
90
};
90
91
@@ -152,6 +153,7 @@ inline std::string get_intrinsic_name(int x) {
152
153
INTRINSIC_NAME_CASE (SymbolicPowQ)
153
154
INTRINSIC_NAME_CASE (SymbolicLogQ)
154
155
INTRINSIC_NAME_CASE (SymbolicSinQ)
156
+ INTRINSIC_NAME_CASE (SymbolicGetArgument)
155
157
default : {
156
158
throw LCompilersException (" pickle: intrinsic_id not implemented" );
157
159
}
@@ -3116,6 +3118,54 @@ namespace SymbolicHasSymbolQ {
3116
3118
}
3117
3119
} // namespace SymbolicHasSymbolQ
3118
3120
3121
+ namespace SymbolicGetArgument {
3122
+ static inline void verify_args (const ASR::IntrinsicScalarFunction_t& x,
3123
+ diag::Diagnostics& diagnostics) {
3124
+ ASRUtils::require_impl (x.n_args == 2 , " Intrinsic function SymbolicGetArgument"
3125
+ " accepts exactly 2 argument" , x.base .base .loc , diagnostics);
3126
+
3127
+ ASR::ttype_t * arg1_type = ASRUtils::expr_type (x.m_args [0 ]);
3128
+ ASR::ttype_t * arg2_type = ASRUtils::expr_type (x.m_args [1 ]);
3129
+ ASRUtils::require_impl (ASR::is_a<ASR::SymbolicExpression_t>(*arg1_type),
3130
+ " SymbolicGetArgument expects the first argument to be of type SymbolicExpression" ,
3131
+ x.base .base .loc , diagnostics);
3132
+ ASRUtils::require_impl (ASR::is_a<ASR::Integer_t>(*arg2_type),
3133
+ " SymbolicGetArgument expects the second argument to be of type Integer" ,
3134
+ x.base .base .loc , diagnostics);
3135
+ }
3136
+
3137
+ static inline ASR::expr_t * eval_SymbolicGetArgument (Allocator &/* al*/ ,
3138
+ const Location &/* loc*/ , ASR::ttype_t *, Vec<ASR::expr_t *> &/* args*/ ) {
3139
+ /* TODO*/
3140
+ return nullptr ;
3141
+ }
3142
+
3143
+ static inline ASR::asr_t * create_SymbolicGetArgument (Allocator& al,
3144
+ const Location& loc, Vec<ASR::expr_t *>& args,
3145
+ const std::function<void (const std::string &, const Location &)> err) {
3146
+
3147
+ if (args.size () != 2 ) {
3148
+ err (" Intrinsic function SymbolicGetArguments accepts exactly 2 argument" , loc);
3149
+ }
3150
+
3151
+ ASR::ttype_t * arg1_type = ASRUtils::expr_type (args[0 ]);
3152
+ ASR::ttype_t * arg2_type = ASRUtils::expr_type (args[1 ]);
3153
+ if (!ASR::is_a<ASR::SymbolicExpression_t>(*arg1_type)) {
3154
+ err (" The first argument of SymbolicGetArgument function must be of type SymbolicExpression" ,
3155
+ args[0 ]->base .loc );
3156
+ }
3157
+ if (!ASR::is_a<ASR::Integer_t>(*arg2_type)) {
3158
+ err (" The second argument of SymbolicGetArgument function must be of type Integer" ,
3159
+ args[1 ]->base .loc );
3160
+ }
3161
+
3162
+ ASR::ttype_t *to_type = ASRUtils::TYPE (ASR::make_SymbolicExpression_t (al, loc));
3163
+ return UnaryIntrinsicFunction::create_UnaryFunction (al, loc, args, eval_SymbolicGetArgument,
3164
+ static_cast <int64_t >(IntrinsicScalarFunctions::SymbolicGetArgument),
3165
+ 0 , to_type);
3166
+ }
3167
+ } // namespace SymbolicGetArgument
3168
+
3119
3169
#define create_symbolic_query_macro (X ) \
3120
3170
namespace X { \
3121
3171
static inline void verify_args (const ASR::IntrinsicScalarFunction_t& x, \
@@ -3325,6 +3375,8 @@ namespace IntrinsicScalarFunctionRegistry {
3325
3375
{nullptr , &SymbolicLogQ::verify_args}},
3326
3376
{static_cast <int64_t >(IntrinsicScalarFunctions::SymbolicSinQ),
3327
3377
{nullptr , &SymbolicSinQ::verify_args}},
3378
+ {static_cast <int64_t >(IntrinsicScalarFunctions::SymbolicGetArgument),
3379
+ {nullptr , &SymbolicGetArgument::verify_args}},
3328
3380
};
3329
3381
3330
3382
static const std::map<int64_t , std::string>& intrinsic_function_id_to_name = {
@@ -3441,6 +3493,8 @@ namespace IntrinsicScalarFunctionRegistry {
3441
3493
" SymbolicLogQ" },
3442
3494
{static_cast <int64_t >(IntrinsicScalarFunctions::SymbolicSinQ),
3443
3495
" SymbolicSinQ" },
3496
+ {static_cast <int64_t >(IntrinsicScalarFunctions::SymbolicGetArgument),
3497
+ " SymbolicGetArgument" },
3444
3498
};
3445
3499
3446
3500
@@ -3502,6 +3556,7 @@ namespace IntrinsicScalarFunctionRegistry {
3502
3556
{" PowQ" , {&SymbolicPowQ::create_SymbolicPowQ, &SymbolicPowQ::eval_SymbolicPowQ}},
3503
3557
{" LogQ" , {&SymbolicLogQ::create_SymbolicLogQ, &SymbolicLogQ::eval_SymbolicLogQ}},
3504
3558
{" SinQ" , {&SymbolicSinQ::create_SymbolicSinQ, &SymbolicSinQ::eval_SymbolicSinQ}},
3559
+ {" GetArgument" , {&SymbolicGetArgument::create_SymbolicGetArgument, &SymbolicGetArgument::eval_SymbolicGetArgument}},
3505
3560
};
3506
3561
3507
3562
static inline bool is_intrinsic_function (const std::string& name) {
0 commit comments