Long Longs (inline functions)
K. Richard Magill
rich at rexago1.UUCP
Wed Mar 5 02:58:39 AEST 1986
in reference to functions vs inline code...
In article <3408 at umcp-cs.UUCP> chris at umcp-cs.UUCP (Chris Torek) writes:
>One method, used in the 4BSD kernel and in Franz Lisp, is to write
>a `sed' script, and run the output of the compiler through this.
>Thus what looks like a function call is actually expanded in-line:
>
> # foo.e - sed script to expand various routines in line
> #
> # Usage: /lib/cpp file.c | /lib/ccom | sed -f foo.e | /lib/c2 | \
> # as -o file.o
> # (or use .s files if your `as' cannot read pipes).
> #
> # Change calls to `foo' to a `bar' instruction.
> # Foo takes two arguments and presents a return
> # value in r0.
> /calls $2,_foo/s//movl (sp)+,r0\
> movl (sp)+,r1\
> bar r1,r0/
Paraphrased from "Maxicomputing in Microspace", (WE32100 info manual
select code 451-000):
Under the -O option the compiler expands functions inline providing,
1) the function has no local variables 2) no registers are saved 3)
the function appears in the same file. ...
K. Richard Magill
More information about the Comp.lang.c
mailing list