@@ -587,14 +587,34 @@ namespace LCompilers {
587587 int32_type, bound_type, nullptr ));
588588 }
589589
590+ bool skip_instantiation (PassOptions pass_options, int64_t id) {
591+ if (!pass_options.skip_optimization_func_instantiation .empty ()) {
592+ for (size_t i=0 ; i<pass_options.skip_optimization_func_instantiation .size (); i++) {
593+ if (pass_options.skip_optimization_func_instantiation [i] == id) {
594+ return true ;
595+ }
596+ }
597+ }
598+ return false ;
599+ }
590600
591601 ASR::expr_t * get_flipsign (ASR::expr_t * arg0, ASR::expr_t * arg1,
592- Allocator& al, ASR::TranslationUnit_t& unit, const Location& loc){
602+ Allocator& al, ASR::TranslationUnit_t& unit, const Location& loc,
603+ PassOptions pass_options){
604+ ASR::ttype_t * type = ASRUtils::expr_type (arg1);
605+ int64_t fp_s = static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions::FlipSign);
606+ if (skip_instantiation (pass_options, fp_s)) {
607+ Vec<ASR::expr_t *> args;
608+ args.reserve (al, 2 );
609+ args.push_back (al, arg0);
610+ args.push_back (al, arg1);
611+ return ASRUtils::EXPR (ASRUtils::make_IntrinsicScalarFunction_t_util (al, loc, fp_s,
612+ args.p , args.n , 0 , type, nullptr ));
613+ }
593614 ASRUtils::impl_function instantiate_function =
594615 ASRUtils::IntrinsicScalarFunctionRegistry::get_instantiate_function (
595616 static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions::FlipSign));
596617 Vec<ASR::ttype_t *> arg_types;
597- ASR::ttype_t * type = ASRUtils::expr_type (arg1);
598618 arg_types.reserve (al, 2 );
599619 arg_types.push_back (al, ASRUtils::expr_type (arg0));
600620 arg_types.push_back (al, ASRUtils::expr_type (arg1));
@@ -667,13 +687,23 @@ namespace LCompilers {
667687 }
668688
669689 ASR::expr_t * get_fma (ASR::expr_t * arg0, ASR::expr_t * arg1, ASR::expr_t * arg2,
670- Allocator& al, ASR::TranslationUnit_t& unit, Location& loc){
671-
690+ Allocator& al, ASR::TranslationUnit_t& unit, Location& loc,
691+ PassOptions pass_options){
692+ int64_t fma_id = static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions::FMA);
693+ ASR::ttype_t * type = ASRUtils::expr_type (arg0);
694+ if (skip_instantiation (pass_options, fma_id)) {
695+ Vec<ASR::expr_t *> args;
696+ args.reserve (al, 3 );
697+ args.push_back (al, arg0);
698+ args.push_back (al, arg1);
699+ args.push_back (al, arg2);
700+ return ASRUtils::EXPR (ASRUtils::make_IntrinsicScalarFunction_t_util (al, loc, fma_id,
701+ args.p , args.n , 0 , type, nullptr ));
702+ }
672703 ASRUtils::impl_function instantiate_function =
673704 ASRUtils::IntrinsicScalarFunctionRegistry::get_instantiate_function (
674705 static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions::FMA));
675706 Vec<ASR::ttype_t *> arg_types;
676- ASR::ttype_t * type = ASRUtils::expr_type (arg0);
677707 arg_types.reserve (al, 3 );
678708 arg_types.push_back (al, ASRUtils::expr_type (arg0));
679709 arg_types.push_back (al, ASRUtils::expr_type (arg1));
0 commit comments