Skip to content

Conversation

@DrXiao
Copy link
Collaborator

@DrXiao DrXiao commented Jun 30, 2024

This commit improves the division emulation in the Arm backend to enhance code reusability and eliminate potential issues.

Close #135

@jserv jserv requested a review from vacantron June 30, 2024 14:17
src/arm.c Outdated
return arm_transfer(cond, 0, 1, rn, rd, ofs);
}

int __push(arm_cond_t cond, int reg_list)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Both push and pop are pseudo-instructions. Can you avoid them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After reading ARM Architecture Reference Manual, I understand that push and pop are equivalent to stmdb and ldmia, respectively. But I don't see any description stating that push and pop are pseudo-instructions.

May I ask where it describes push and pop as pseudo-instructions? Although I can replace them with stmdb and ldmia, I want to understand push and pop further first before improving the implementation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

May I ask where it describes push and pop as pseudo-instructions?

See https://developer.arm.com/documentation/dui0489/i/arm-and-thumb-instructions/pop

Both __push and __pop are too generic, likely leading to unexpected symbol conflicts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Both push and pop are pseudo-instructions. Can you avoid them?

I think I misunderstood at the beginning. Originally, I thought it was related to code generation for Arm32 output.

However, the requested changes just entail that I should replace __push and __pop with __stmdb and __ldm in arm.c and arm-codegen.c. The purpose is to avoid symbol conflicts during compilation.

Is my understanding correct?

Copy link
Collaborator

Choose a reason for hiding this comment

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

However, the requested changes just entail that I should replace __push and __pop with __stmdb and __ldm in arm.c and arm-codegen.c. The purpose is to avoid symbol conflicts during compilation.

Exactly. Unless we can change symbol visibility on demand, we must handle symbol conflicts with care.

This commit improves the division emulation in the
Arm backend to enhance code reusability and eliminate
potential issues.

Close sysprog21#135
@DrXiao DrXiao requested a review from jserv July 3, 2024 00:44
@jserv jserv merged commit 0a830cc into sysprog21:master Jul 3, 2024
@jserv
Copy link
Collaborator

jserv commented Jul 3, 2024

Thank @DrXiao for contributing!

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.

Enhance the implementation of division emulation in the Arm backend

2 participants