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

[Xtensa] Remove unnecessary MOVSP in epilogue. (LLVM-83) #44

Open
wants to merge 1 commit into
base: xtensa_release_11.0.0
Choose a base branch
from
Open

[Xtensa] Remove unnecessary MOVSP in epilogue. (LLVM-83) #44

wants to merge 1 commit into from

Conversation

inetbowser
Copy link

This PR removes the use of an unnecessary MOVSP in the function epilogue (#19 ). Restoring the frame pointer when using Xtensa Windowed Regisers option is not needed because original stack pointer will get restored when returning (goes to register window of caller which contains original stack pointer).

For reference:
test.c:

int secretpin() {
    return 1337;
}

Compiling with xtensa-esp32-elf-gcc -c test.c:

00000000 <secretpin>:
   0:	004136        	entry	a1, 32
   3:	017d      	mov.n	a7, a1
   5:	39a522        	movi	a2, 0x539
   8:	f01d      	retw.n

Compiling with $LLVM_INSTALL_DIR/bin/clang --target="xtensa-freestanding" -mcpu=esp32 -c test.c:

00000000 <secretpin>:
   0:	004136        	entry	a1, 32
   3:	017d      	mov.n	a7, a1
   5:	39a522        	movi	a2, 0x539
   8:	001710        	movsp	a1, a7
   b:	f01d      	retw.n

@github-actions github-actions bot changed the title [Xtensa] Remove unnecessary MOVSP in epilogue. [Xtensa] Remove unnecessary MOVSP in epilogue. (LLVM-83) Jan 26, 2021
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.

1 participant