inlining or not inlining...

bearophile bearophileHUGS at lycos.com
Fri Feb 11 03:01:22 PST 2011


Walter:

> While in isolation that's a good idea, how far should it be taken? Should the 
> compiler emit information on which variables wound up in which registers, and 
> why? What about other of the myriad of compiler optimizations?

Inlining is an important optimization, so give this information to the programmer is a good start.

With CommonLisp compiler when you compile with max optimization levels the compiler gives many comments that explain why it isn't optimizing something, including some forms of inlining, see for example:
http://shootout.alioth.debian.org/u32/program.php?test=fasta&lang=sbcl&id=3

Part of the comments:

; --> CEILING MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL FUNCTION IF VALUES 1+ 
; ==>
;   (+ SB-C::TRU 1)
; 
; note: forced to do GENERIC-+ (cost 10)
;       unable to do inline fixnum arithmetic (cost 1) because:
;       The first argument is a INTEGER, not a FIXNUM.
;       The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES FIXNUM &REST T).
;       unable to do inline fixnum arithmetic (cost 2) because:
;       The first argument is a INTEGER, not a FIXNUM.
;       The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES FIXNUM &REST T).
;       etc.

Another similar kind of useful notes from the compiler:
http://d.puremagic.com/issues/show_bug.cgi?id=5070

Bye,
bearophile


More information about the Digitalmars-d mailing list