diff --git a/xls/dslx/type_system/deduce.cc b/xls/dslx/type_system/deduce.cc index 83cbf78ce2..57c28d22a9 100644 --- a/xls/dslx/type_system/deduce.cc +++ b/xls/dslx/type_system/deduce.cc @@ -2202,13 +2202,13 @@ absl::StatusOr> DeduceSpawn(const Spawn* node, // Gather up the type of all the (actual) arguments. std::vector config_args; - XLS_RETURN_IF_ERROR(InstantiateParametricArgs( + XLS_RETURN_IF_ERROR(AppendArgsForInstantiation( node, node->callee(), node->config()->args(), ctx, &config_args)); std::vector next_args; next_args.push_back( InstantiateArg{std::make_unique(), node->span()}); - XLS_RETURN_IF_ERROR(InstantiateParametricArgs( + XLS_RETURN_IF_ERROR(AppendArgsForInstantiation( node, node->callee(), node->next()->args(), ctx, &next_args)); // For each [constexpr] arg, mark the associated Param as constexpr. diff --git a/xls/dslx/type_system/deduce_invocation.cc b/xls/dslx/type_system/deduce_invocation.cc index 7b3552f121..d7f1418423 100644 --- a/xls/dslx/type_system/deduce_invocation.cc +++ b/xls/dslx/type_system/deduce_invocation.cc @@ -199,14 +199,14 @@ absl::StatusOr DeduceInstantiation( {}}; } -absl::Status InstantiateParametricArgs( +absl::Status AppendArgsForInstantiation( const Instantiation* inst, const Expr* callee, absl::Span args, DeduceCtx* ctx, std::vector* instantiate_args) { for (Expr* arg : args) { XLS_ASSIGN_OR_RETURN(std::unique_ptr type, DeduceAndResolve(arg, ctx)); VLOG(5) << absl::StreamFormat( - "InstantiateParametricArgs; arg: `%s` deduced: `%s` @ %s", + "AppendArgsForInstantiation; arg: `%s` deduced: `%s` @ %s", arg->ToString(), type->ToString(), arg->span().ToString()); XLS_RET_CHECK(!type->IsMeta()) << "parametric arg: " << arg->ToString() << " type: " << type->ToString(); @@ -240,8 +240,8 @@ absl::StatusOr> DeduceInvocation(const Invocation* node, // Gather up the type of all the (actual) arguments. std::vector args; - XLS_RETURN_IF_ERROR(InstantiateParametricArgs(node, node->callee(), - node->args(), ctx, &args)); + XLS_RETURN_IF_ERROR(AppendArgsForInstantiation(node, node->callee(), + node->args(), ctx, &args)); // Find the callee as a DSLX Function from the expression. auto resolve_fn = [](const Instantiation* node, diff --git a/xls/dslx/type_system/deduce_invocation.h b/xls/dslx/type_system/deduce_invocation.h index a7e795b8f6..46be6588c1 100644 --- a/xls/dslx/type_system/deduce_invocation.h +++ b/xls/dslx/type_system/deduce_invocation.h @@ -17,15 +17,12 @@ #include #include -#include #include -#include "absl/container/flat_hash_map.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/types/span.h" #include "xls/dslx/frontend/ast.h" -#include "xls/dslx/interp_value.h" #include "xls/dslx/type_system/ast_env.h" #include "xls/dslx/type_system/deduce_ctx.h" #include "xls/dslx/type_system/parametric_constraint.h" @@ -37,9 +34,10 @@ namespace xls::dslx { absl::StatusOr> DeduceInvocation(const Invocation* node, DeduceCtx* ctx); -// Helper that deduces the concrete types of the arguments to a parametric -// function or proc and returns them to the caller. -absl::Status InstantiateParametricArgs( +// Helper that deduces the concrete types of the arguments and appends them to +// "instantiate_args" -- getting them in this form is often a pre-step in +// instantiating a parametric function or proc. +absl::Status AppendArgsForInstantiation( const Instantiation* inst, const Expr* callee, absl::Span args, DeduceCtx* ctx, std::vector* instantiate_args);