2021-10-11 18:20:23 -03:00

349 lines
7.3 KiB
Groff

.\" @(#)inline.1 1.1 92/07/30 SMI; from UCB 4.3 BSD
.TH INLINE 1 "23 September 1987"
.SH NAME
inline \- in-line procedure call expander
.SH SYNOPSIS
.B /usr/lib/inline
.RB [ " \-w " ]
.RB [ " \-v " ]
.RB [ " \-o"
.IR outputfile " ]"
.RB [ " \-i"
.IR inlinefile " ] .\|.\|."
.RI [ " cpu-option " ]
.RI [ " fpu-option " ]
.IR filename .\|.\|.
.SH DESCRIPTION
.IX "inline command" "" "\fLinline\fR command"
.IX "expand assembly-language calls in-line, \fLinline\fP"
.IX "procedure calls, assembler, expand in-line, \fLinline\fP"
.LP
.B inline
expands assembly language calls in the indicated source files
into copies of the corresponding procedure bodies obtained from an
.IR inlinefile
specified with the
.B \-i
option.
If no
.I inlinefile
is specified, the
source files are simply concatenated and written to the standard
output. If no source files are specified, the input is read from
the standard input.
.LP
Inline itself is little more than a sed script. Almost all of
the benefit produced is derived from subsequent peephole
optimization.
.SH OPTIONS
.TP
.B \-w
Display warnings for duplicate definitions on the standard error.
.TP
.B \-v
Verbose. Display the names of routines that were actually
in-line expanded in the sourcefile on the standard error.
.TP
.BI \-o " outputfile"
write output to the indicated file; standard output by default.
.TP
.BI \-i " inlinefile"
Read in-line code templates from
.IR inlinefile .
.TP
.I cpu-option
Specify templates for the machine architecture of a Sun-2 or Sun-3
system. If this option is omitted, the proper template for the
host architecture is used. Can be one of:
.RS
.RS
.TP 10
.B \-mc68010
expand
.B .mc68010
code templates
.PD 0
.TP
.B \-mc68020
expand
.B .mc68020
code templates
.PD
.RE
.RE
.TP
.I fpu-option
Specify a floating-point processor option for a Sun-2 or Sun-3
system. Can be one of:
.RS
.RS
.TP 10
.B \-fsoft
expand
.B .fsoft
code templates (the default)
.PD 0
.TP
.B \-fswitch
expand
.B .fswitch
code templates
.TP
.B \-fsky
expand
.B .fsky
code templates
.RB ( \-mc68010
only)
.TP
.B \-f68881
expand
.B .f68881
code templates
.RB ( \-mc68020
only)
.TP
.B \-ffpa
expand
.B .ffpa
code templates
.RB ( \-mc68020
only)
.PD
.RE
.RE
.SH USAGE
Each
.I inlinefile
contains one or more labeled assembly language templates of the form:
.RS
.nf
.ft I
inline-directive
\&.\|.\|.
instructions
\&.\|.\|.
\&.end
.ft R
.fi
.RE
.LP
where the
.I instructions
constitute an in-line expansion of the named routine. An
.I "inline-directive"
is a command of the form:
.IP
.BI .inline "\ \ \ identifier" , " argsize"
.LP
This declares a block of code for the routine named by
.IR identifier ,
with
.I argsize
bytes of arguments.
.RI ( argsize
is optional on Sun-4 systems). Calls to the named routine are replaced
by the code in the in-line template.
.br
.ne 10
.LP
For Sun-2 and Sun-3 systems, the following additional forms
are recognized:
.RS
.TP 9
.B "\&.mc68010
.IB " identifier" , " argsize"
.PD 0
.TP
.B "\&.mc68020
.IB " identifier" , " argsize"
.TP
.B "\&.fsoft
.IB " identifier" , " argsize"
.TP
.B "\&.fswitch
.IB " identifier" , " argsize"
.TP
.B "\&.fsky
.IB " identifier" , " argsize"
.TP
.B \&.f68881
.IB " identifier" , " argsize"
.TP
.B \&.ffpa
.IB " identifier" , " argsize"
.DT
.PD
.RE
.LP
These forms are similar to
.BR .inline ,
with the addition of a
.SM CPU
or
.SM FPU
specification. The template is only expanded if
the specified target system matches the value of the target
.SM CPU
or
.SM FPU
type, as determined by the command-line options, or
if none were given, by the type of the host system.
.LP
Multiple templates are permitted; matching templates after the first
are ignored. Duplicate templates may be placed in order of decreasing
performance of the corresponding hardware; thus the most efficient
usable version will be selected.
.SS Coding Conventions for all Sun Systems
In-line templates should be coded as expansions of C-compatible
procedure calls,
with the difference that the return address cannot be depended
upon to be in the expected place, since no call instruction will
have been executed. See
.SM FILES,
below, for examples.
.LP
In-line templates must conform to standard Sun parameter passing
and register usage conventions, as detailed below. They must
not call routines that violate these conventions; for example,
assembly language routines such as
.BR setjmp (3V)
may cause problems.
.LP
Registers other than the ones mentioned below must not be
used or set.
.LP
Branch instructions in an in-line template may only transfer
to numeric labels
.RB ( 1f ,
.BR 2b ,
and so on) defined within the in-line
template. No other control transfers are allowed.
.LP
Only opcodes and addressing modes generated by Sun
compilers are guaranteed to work. Binary encodings of
instructions are not supported.
.LP
.SS Coding Conventions for Sun-2 and Sun-3 Systems
Arguments are passed in 32-bit aligned memory locations
starting at
.BR sp@ .
Note that there is no return address on
the stack, since no
.B jbsr
instruction will have been executed.
.LP
Results are returned in
.B d0
or
.BR d0/d1 .
.LP
The following registers may be used as temporaries: registers
.BR a0 ,
.BR a1 ,
.BR d0 ,
and
.BR d1
on the
.SM MC68010
and
.SM MC68020;
registers
.B fp0
and
.B fp1
on the
.SM MC68881;
registers
.B fpa0
through
.B fpa3
on the Sun Floating-Point Accelerator. No other registers may be used.
.LP
The template must delete exactly
.I argsize
bytes from the
stack. This is to enable
.B inline
to deal with autoincrement and
autodecrement addressing modes, which in turn are used by
.B c2
to delimit the lifetimes of stack temporaries.
.LP
The stack must not underflow the level of the last argument.
.LP
Use
.BI j cc
branch mnemonics instead of
.BI b cc.
The
.BI b cc
ops are span limited and will fail if retargeted to a label whose
span overflows the branch displacement field.
.SS Coding Conventions for Sun-4 Systems
Arguments are passed in registers
.BR %o0-%o5 ,
followed by memory locations starting at
.BR [%sp+0x5c] .
.B %sp
is guaranteed to be 64-bit aligned. The contents of
.B %o7
are undefined, since no call instruction will have been executed.
.LP
Results are returned in
.B %o0
or
.BR %f0/%f1 .
.LP
Registers
.B %o0-%o5
and
.B %f0-%f31
may be used as temporaries.
.LP
Integral and single-precision floating-point arguments are
32-bit aligned.
.LP
Double-precision floating-point arguments are guaranteed to
be 64-bit aligned if their offsets are multiples of 8.
.LP
Each control-transfer instruction (branches and calls) must be
immediately followed by a nop.
.LP
Call instructions must include an extra (final) argument which
indicates the number of registers used to pass parameters
to the called routine.
.LP
Note that for Sun-4 systems, the instruction following an
expanded 'call' is inserted by
.B inline
.I before
the expanded code to preserve the semantics of the call's delay slot.
.SH FILES
.PD 0
.TP 20
.B /usr/lib/inline
in-line procedure call expander
.TP
.B /usr/lib/fsoft/libm.il
in-line templates for software floating point (Sun-2 and Sun-3 only)
.TP
.B /usr/lib/fswitch/libm.il
in-line templates for switched floating point (Sun-2 and Sun-3 only)
.TP
.B /usr/lib/fsky/libm.il
in-line templates for Sky FFP (Sun-2 only)
.TP
.B /usr/lib/f68881/libm.il
in-line templates for Motorola 68881 (Sun-3 only)
.TP
.B /usr/lib/ffpa/libm.il
in-line templates for Sun FPA (Sun-3 only)
.PD
.SH WARNING
.B inline
does not check for violations of the coding conventions described
above.