home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gcc.help
- Path: sparky!uunet!spool.mu.edu!umn.edu!umeecs!sparky.eecs.umich.edu!burks
- From: burks@sparky.eecs.umich.edu (Timothy Burks)
- Subject: gcc 2.2.2: inlining problems
- Message-ID: <1992Sep14.165825.664@zip.eecs.umich.edu>
- Sender: news@zip.eecs.umich.edu (Mr. News)
- Organization: University of Michigan EECS Dept., Ann Arbor, MI
- Date: Mon, 14 Sep 1992 16:58:25 GMT
- Lines: 109
-
-
-
- How can I get gcc to inline this code (taken from the gcc.info files)?
-
-
- ------- start of test.C ----------------------------------
- static inline int inc (int *a) {(*a)++;}
-
- main () {
- int a = 0;
- inc (&a);
- inc (&a);
- inc (&a);
- }
- ------- end of test.C -------------------------------------
-
-
- When I compile w/ gcc 2.2.2 (using -S and -Winline), I get
- no warnings and the following decmips assembly code:
-
-
- ------- start of test.s ----------------------------------
- .file 1 "test.C"
-
- # GNU C++ 2.2.2 [AL 1.1, MM 19] DECstation running ultrix compiled by GNU C
-
- # Cc1 defaults:
-
- # Cc1 arguments (-G value = 8, Cpu = default, ISA = 1):
- # -quiet -dumpbase -Winline -o
-
- gcc2_compiled.:
- .text
- .align 2
- .globl main
-
- .loc 1 3
- .ent main
- main:
- subu $sp,$sp,40 # vars= 8, regs= 2/0, args = 16, extra= 8
- .frame $fp,0,$31
- .mask 0xc0000000,-20
- .fmask 0x00000000,0
- sw $31,20($sp)
- sw $fp,16($sp)
- addu $fp,$sp,40 # set up frame pointer
- jal __main
- sw $0,-12($fp)
- subu $2,$fp,12
- move $4,$2
- jal inc__FPi ****************** NON-INLINED REFERENCE!
- subu $2,$fp,12
- move $4,$2
- jal inc__FPi ****************** NON-INLINED REFERENCE!
- subu $2,$fp,12
- move $4,$2
- jal inc__FPi ****************** NON-INLINED REFERENCE!
- move $2,$0
- j $L3
- j $L3
- $L3:
- subu $sp,$fp,40 # sp not trusted here
- lw $31,20($sp)
- lw $fp,16($sp)
- addu $sp,$sp,40
- j $31
- .end main
- .align 2
-
- .loc 1 1
- .ent inc__FPi
- inc__FPi:
- subu $sp,$sp,16 # vars= 0, regs= 1/0, args = 0, extra= 8
- .frame $fp,0,$31
- .mask 0x40000000,-16
- .fmask 0x00000000,0
- sw $fp,0($sp)
- addu $fp,$sp,16 # set up frame pointer
- move $2,$4
- lw $3,0($2)
- addu $4,$3,1
- sw $4,0($2)
- j $L2
- j $L1
- $L2:
- $L1:
- subu $sp,$fp,16 # sp not trusted here
- lw $fp,0($sp)
- addu $sp,$sp,16
- j $31
- .end inc__FPi
-
- ------- end of test.s -------------------------------------
-
- I get similar results when I compile on a SPARC.
-
- Thanks,
-
- Tim
- ----
- MMMM MMMM Tim Burks
- MM M M MM University of Michigan/Advanced Computer Architecture Lab
- MM M MM Ann Arbor, MI 48109
- MMMM MMMM burks@eecs.umich.edu
- --
- MMMM MMMM Tim Burks
- MM M M MM University of Michigan/Advanced Computer Architecture Lab
- MM M MM Ann Arbor, MI 48109
- MMMM MMMM burks@eecs.umich.edu
-