Skip to content

Instantly share code, notes, and snippets.

@marclave
Created May 30, 2016 14:41
Show Gist options
  • Save marclave/10d1192f5de3ed745dfc69429f2fc3a6 to your computer and use it in GitHub Desktop.
Save marclave/10d1192f5de3ed745dfc69429f2fc3a6 to your computer and use it in GitHub Desktop.
Array Register SENG440 Example

[marclave@ugls20 SENG440]$ cat arrayNoRegister.c

int main(void)
{
	int b[10];

	return 0;
}

[marclave@ugls20 SENG440]$ arm-linux-gcc -S -o arrayNoRegister arrayNoRegister.c [marclave@ugls20 SENG440]$ cat arrayNoRegister

	.arch armv4t
	.fpu softvfp
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 18, 4
	.file	"arrayNoRegister.c"
	.text
	.align	2
	.global	main
	.type	main, %function
main:
	@ Function supports interworking.
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #44
	mov	r3, #0
	mov	r0, r3
	add	sp, fp, #0
	ldmfd	sp!, {fp}
	bx	lr
	.size	main, .-main
	.ident	"GCC: (Sourcery G++ Lite 2008q3-72) 4.3.2"
	.section	.note.GNU-stack,"",%progbits

[marclave@ugls20 SENG440]$ cat arrayRegisterExample.c

int main(void)
{
	register int a[10];

	return 0;
}

[marclave@ugls20 SENG440]$ arm-linux-gcc -S -o arrayRegisterExample arrayRegisterExample.c [marclave@ugls20 SENG440]$ cat arrayRegisterExample

	.arch armv4t
	.fpu softvfp
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 18, 4
	.file	"arrayRegisterExample.c"
	.text
	.align	2
	.global	main
	.type	main, %function
main:
	@ Function supports interworking.
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #44
	mov	r3, #0
	mov	r0, r3
	add	sp, fp, #0
	ldmfd	sp!, {fp}
	bx	lr
	.size	main, .-main
	.ident	"GCC: (Sourcery G++ Lite 2008q3-72) 4.3.2"
	.section	.note.GNU-stack,"",%progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment