Ok, here is the asm code generated without -O2 option for the textfill and textfunction:
Code: Select all
$LC0:
	.ascii	"This should be line one\000"
	.align	3
$LC1:
	.ascii	"Followed by line two\000"
	.align	3
$LC2:
	.ascii	"Line three is the same\000"
	.align	3
$LC3:
	.ascii	"So line four has same format\000"
	.align	3
$LC4:
	.ascii	"Why should five not also?\000"
	.text
	.align	2
	.globl	_Z8textfillv
	.ent	_Z8textfillv
_Z8textfillv:
	.frame	$fp,32,$31		# vars= 0, regs= 4/0, args= 0, extra= 0
	.mask	0xc0000000,-16
	.fmask	0x00000000,0
	subu	$sp,$sp,32
	sd	$31,16($sp)
	sd	$fp,0($sp)
	move	$fp,$sp
	la	$4,textarray
	la	$5,$LC0
	jal	strcpy
	la	$4,textarray+30
	la	$5,$LC1
	jal	strcpy
	la	$4,textarray+60
	la	$5,$LC2
	jal	strcpy
	la	$4,textarray+90
	la	$5,$LC3
	jal	strcpy
	la	$4,textarray+120
	la	$5,$LC4
	jal	strcpy
	move	$sp,$fp
	ld	$31,16($sp)
	ld	$fp,0($sp)
	addu	$sp,$sp,32
	j	$31
	.end	_Z8textfillv
$Lfe2:
	.size	_Z8textfillv,$Lfe2-_Z8textfillv
	.rdata
	.align	3
$LC5:
	.ascii	"%s [%d]\n\000"
	.text
	.align	2
	.globl	_Z12textfunctionv
	.ent	_Z12textfunctionv
_Z12textfunctionv:
	.frame	$fp,48,$31		# vars= 16, regs= 4/0, args= 0, extra= 0
	.mask	0xc0000000,-16
	.fmask	0x00000000,0
	subu	$sp,$sp,48
	sd	$31,32($sp)
	sd	$fp,16($sp)
	move	$fp,$sp
	jal	_Z8textfillv
	sw	$0,0($fp)
$L4:
	lw	$2,0($fp)
	slt	$2,$2,5
	bne	$2,$0,$L7
	b	$L3
$L7:
	lw	$3,0($fp)
	li	$2,30			# 0x1e
	mult	$3,$3,$2
	la	$2,textarray
	addu	$2,$3,$2
	move	$4,$2
	jal	strlen
	move	$6,$2
	lw	$3,0($fp)
	li	$2,30			# 0x1e
	mult	$3,$3,$2
	la	$2,textarray
	addu	$2,$3,$2
	la	$4,$LC5
	move	$5,$2
	jal	printf
	lw	$2,0($fp)
	addu	$2,$2,1
	sw	$2,0($fp)
	b	$L4
$L3:
	move	$sp,$fp
	ld	$31,32($sp)
	ld	$fp,16($sp)
	addu	$sp,$sp,48
	j	$31
	.end	_Z12textfunctionv
$Lfe3:
	.size	_Z12textfunctionv,$Lfe3-_Z12textfunctionv
	.ident	"GCC: (GNU) 3.2.2"
And the same functions, compiled with -O2 option produces this, which seems to have attempted to inline strcpy:
Code: Select all
$LC0:
	.ascii	"This should be line one\000"
	.align	3
$LC4:
	.ascii	"Why should five not also?\000"
	.align	3
$LC1:
	.ascii	"Followed by line two\000"
	.align	3
$LC2:
	.ascii	"Line three is the same\000"
	.align	3
$LC3:
	.ascii	"So line four has same format\000"
	.text
	.align	2
	.p2align 3,,7
	.globl	_Z8textfillv
	.ent	_Z8textfillv
_Z8textfillv:
	.frame	$sp,0,$31		# vars= 0, regs= 0/0, args= 0, extra= 0
	.mask	0x00000000,0
	.fmask	0x00000000,0
	lui	$3,%hi($LC0) # high
	lui	$4,%hi($LC4) # high
	addiu	$3,$3,%lo($LC0) # low
	lui	$2,%hi(textarray) # high
	ld	$8,16($3)
	addiu	$2,$2,%lo(textarray) # low
	lq $5,0($3)
	addiu	$4,$4,%lo($LC4) # low
	lui	$3,%hi($LC1) # high
	sd	$8,16($2)
	addiu	$3,$3,%lo($LC1) # low
	sq $5,0($2)
	lhu	$10,24($4)
	addu	$7,$2,120
	lq $6,0($4)
	ld	$9,16($4)
	ldl	$4,7($3)
	ldr	$4,0($3)
	ldl	$5,15($3)
	ldr	$5,8($3)
	lwl	$8,19($3)
	lwr	$8,16($3)
	lb	$11,20($3)
	sdl	$4,37($2)
	sdr	$4,30($2)
	sdl	$5,45($2)
	sdr	$5,38($2)
	swl	$8,49($2)
	swr	$8,46($2)
	sb	$11,50($2)
	lui	$4,%hi($LC2) # high
	addiu	$4,$4,%lo($LC2) # low
	ldl	$3,7($4)
	ldr	$3,0($4)
	ldl	$5,15($4)
	ldr	$5,8($4)
	lw	$8,16($4)
	lh	$11,20($4)
	sdl	$3,67($2)
	sdr	$3,60($2)
	sdl	$5,75($2)
	sdr	$5,68($2)
	sw	$8,76($2)
	sh	$11,80($2)
	lb	$3,22($4)
	sb	$3,82($2)
	lui	$3,%hi($LC3) # high
	addiu	$3,$3,%lo($LC3) # low
	ldl	$4,7($3)
	ldr	$4,0($3)
	ldl	$5,15($3)
	ldr	$5,8($3)
	ldl	$8,23($3)
	ldr	$8,16($3)
	lwl	$11,27($3)
	lwr	$11,24($3)
	sdl	$4,97($2)
	sdr	$4,90($2)
	sdl	$5,105($2)
	sdr	$5,98($2)
	sdl	$8,113($2)
	sdr	$8,106($2)
	swl	$11,117($2)
	swr	$11,114($2)
	lb	$4,28($3)
	sb	$4,118($2)
	sq $6,120($2)
	sh	$10,24($7)
	.set	noreorder
	.set	nomacro
	j	$31
	sd	$9,16($7)
	.set	macro
	.set	reorder
	.end	_Z8textfillv
$Lfe2:
	.size	_Z8textfillv,$Lfe2-_Z8textfillv
	.rdata
	.align	3
$LC5:
	.ascii	"%s [%d]\n\000"
	.text
	.align	2
	.p2align 3,,7
	.globl	_Z12textfunctionv
	.ent	_Z12textfunctionv
_Z12textfunctionv:
	.frame	$sp,64,$31		# vars= 0, regs= 8/0, args= 0, extra= 0
	.mask	0x80070000,-16
	.fmask	0x00000000,0
	subu	$sp,$sp,64
	sd	$18,32($sp)
	sd	$17,16($sp)
	sd	$16,0($sp)
	sd	$31,48($sp)
	.set	noreorder
	.set	nomacro
	jal	_Z8textfillv
	lui	$18,%hi($LC5) # high
	.set	macro
	.set	reorder
	lui	$2,%hi(textarray) # high
	addiu	$16,$2,%lo(textarray) # low
	addu	$17,$16,150
$L8:
	.set	noreorder
	.set	nomacro
	jal	strlen
	move	$4,$16
	.set	macro
	.set	reorder
	addiu	$4,$18,%lo($LC5) # low
	move	$5,$16
	move	$6,$2
	.set	noreorder
	.set	nomacro
	jal	printf
	addu	$16,$16,30
	.set	macro
	.set	reorder
	slt	$3,$16,$17
	.set	noreorder
	.set	nomacro
	bne	$3,$0,$L8
	ld	$31,48($sp)
	.set	macro
	.set	reorder
	ld	$18,32($sp)
	ld	$17,16($sp)
	ld	$16,0($sp)
	#nop
	.set	noreorder
	.set	nomacro
	j	$31
	addu	$sp,$sp,64
	.set	macro
	.set	reorder
	.end	_Z12textfunctionv
$Lfe3:
	.size	_Z12textfunctionv,$Lfe3-_Z12textfunctionv
	.ident	"GCC: (GNU) 3.2.2"