54 bool should_assign_stack_locations,
59 if (parameter_info !=
nullptr) {
64 const intptr_t max_arguments_in_registers =
65 !
target.IsNull() ?
target.MaxNumberOfParametersInRegisters(zone) : 0;
69 intptr_t stack_parameters_size_in_words = 0;
70 for (intptr_t i = 0; i < argc; ++i) {
71 auto rep = argument_rep(i);
74 if (i < max_arguments_in_registers) {
77#if defined(TARGET_ARCH_IS_32_BIT)
78 if (
auto [lo_reg, hi_reg] = cpu_allocator.AllocatePair();
83 if (
auto reg = cpu_allocator.Allocate(); reg !=
kNoRegister) {
96 if (
auto reg = cpu_allocator.Allocate(); reg !=
kNoRegister) {
108 intptr_t size_in_words;
111 size_in_words = compiler::target::kIntSpillFactor;
115 size_in_words = compiler::target::kDoubleSpillFactor;
126 stack_parameters_size_in_words += size_in_words;
129 if (parameter_info !=
nullptr) {
130 (*parameter_info)[i] = {location, rep};
134 if (parameter_info ==
nullptr || !should_assign_stack_locations) {
135 return stack_parameters_size_in_words;
140 const intptr_t offset_to_last_parameter_slot_from_fp =
141 (compiler::target::frame_layout.param_end_from_fp + 1);
142 intptr_t offset_in_words_from_fp = offset_to_last_parameter_slot_from_fp;
143 for (intptr_t i = argc - 1; i >= 0; --i) {
144 auto& [location, representation] = (*parameter_info)[i];
149 switch (representation) {
151 if (compiler::target::kIntSpillFactor == 1) {
154 ASSERT(compiler::target::kIntSpillFactor == 2);
159 offset_in_words_from_fp += compiler::target::kIntSpillFactor;
164 offset_in_words_from_fp += compiler::target::kDoubleSpillFactor;
169 offset_in_words_from_fp += 1;
179 (offset_in_words_from_fp - offset_to_last_parameter_slot_from_fp) ==
180 stack_parameters_size_in_words);
182 return stack_parameters_size_in_words;
intptr_t ComputeCallingConvention(Zone *zone, const Function &target, intptr_t argc, std::function< Representation(intptr_t)> argument_rep, bool should_assign_stack_locations, ParameterInfoArray *parameter_info)