Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added emition of the functions returning structure #366

Open
wants to merge 23 commits into
base: feature
Choose a base branch
from

Conversation

IgnatSergeev
Copy link
Contributor

@IgnatSergeev IgnatSergeev commented Feb 17, 2023

Добавлены несколько функций:

  1. Обрабатывающая вызов функций возвращающих структуры
  2. Вынесена загрузка аргументов функций при вызове

Изменены несколько функций:

  1. Обрабатывающая возвращение значения из функции
  2. Занимающаяся присвоением значению структуры(конкретно случай когда значение - вызов)
  3. Обрабатывающая все выражения(добавлена возможность обработки функций возвращающих структуру при не использовании её значения, в остальных случаях вызывается первая добавленная функция)
  4. Обрабатывающая декларацию функций(правильно обрабатывает функции возвращающие структуру)

…rget address) and added ability not to assign target(used in emit expression)

Fixed function_definition now it correctly works with functions returning structures
Fixed emit_expression now it can emit same type of functions
Fixed emit return stmt to work with these functions
libs/compiler/mipsgen.c Outdated Show resolved Hide resolved
@bugdea1er bugdea1er marked this pull request as draft February 21, 2023 12:02
@IgnatSergeev IgnatSergeev changed the title Fix functions returning structure Added emition of the functions returning structure Feb 27, 2023
@IgnatSergeev IgnatSergeev marked this pull request as ready for review March 14, 2023 13:29
* @param arg_reg_count Pointer to the number of stored argument registers
*
*/
static void emit_function_arguments_loading(encoder *const enc, const node *const nd, lvalue prev_arg_displ[], size_t *const arg_reg_count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Размер массива красивый

@@ -2719,10 +2949,37 @@ static rvalue emit_expression(encoder *const enc, const node *const nd)
return emit_literal_expression(enc, nd);

case EXPR_CALL:
return emit_call_expression(enc, nd);
if (type_is_structure(enc->sx, expression_get_type(nd)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В отдельную функцию emit_call_expression


case EXPR_MEMBER:
return emit_member_expression(enc, nd);
return emit_member_expression(enc, nd, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подписать boolean-параметры

@bugdea1er bugdea1er marked this pull request as draft March 14, 2023 15:34
@IgnatSergeev IgnatSergeev marked this pull request as ready for review March 28, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants