From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a02ecdd4cb0f0996 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Pragma Inline and its Effects of Compilation Dependencies. Date: 2000/03/22 Message-ID: #1/1 X-Deja-AN: 600942804 Sender: bobduff@world.std.com (Robert A Duff) References: <8b64ul$jov$1@inputplus.demon.co.uk> <8b8gen$mko$1@nnrp1.deja.com> <38D7CABA.A73F88C6@cadence.com> <38D7F4D8.1AE44625@maths.unine.ch> <8b94tg$9jt$1@nnrp1.deja.com> <38D90027.9975BDB9@ftw.rsc.raytheon.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-03-22T00:00:00+00:00 List-Id: Wes Groleau writes: > I don't quite follow. If object code has been generated within > file xx.o for function XX.Func, what prevents a code generator, > when it reaches > > Rec.Field := XX.Func (P, Q); > > from streamlining the preamble and parameter setup and result > assignment, and copying the rest of the object code as is. Inlining is generally not done at the object code level, but at the level of some intermediate language that is higher level than machine code. The point is not just to save the call and return instructions, but to optimize the inlined code based on information at the call site. Eg: function F(X: Color) return String is begin case X is when Red => return "This"; when Green => return "That"; ... end case; end F; Then if you inline a call like "F(Red)", the entire thing boils down to a compile-time-known value. - Bob