Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!shelby!neon!neon.Stanford.EDU!ham From: ham@Neon.Stanford.EDU (Peter R. Ham) Newsgroups: gnu.gcc.bug Subject: "funny" gcc output for mips Message-ID: Date: 12 Nov 89 17:50:25 GMT Sender: USENET News System Distribution: gnu Organization: Stanford University Lines: 53 I don't understand why the mips port of gcc seems to reserve r30 as a frame pointer. Why is this necessary? The mips cc seems to try to avoid this. In addition, why isn't the value of the stack pointer (r29) assumed to be preserved across function calls? For example: The following c code: extern void bar(); void foo() { bar(); } Produces the following assebly: # .verstamp 2 0 gcc_compiled.: .text .align 2 .globl foo .ent foo foo: subu $29,8 # saveregs= 8 .frame $30,0,$31 .mask 0xc0000000,-4 sw $31,4($29) sw $30,0($29) addiu $30,$29,8 # define fp addiu $29,$29,0xfff0 #subsi3 $29,16 -> $29 jal bar # call with 16 arguments addiu $29,$29,0x10 #addsi3 $29,16 -> $29 addu $8,$0,$30 # don't trust sp? lw $31,-4($8) lw $30,-8($8) addu $29,$0,$8 # sp not trusted here j $31 .end foo -- Peter Ham PO Box 3430 (h)(415) 322-4390 MS Computer Science Student Stanford, CA ham@cs.stanford.edu Stanford University 94309 (o)(415) 723-2067