StackThreads/MP: version 0.77 User's Guide
stgcc
or stg++
are shell scripts that call gcc
or
g++
, respectively. Below we say gcc
to refer to both
gcc
and g++
, and use stgcc
to refer to both
stgcc
and stg++
.
What it basically does is to intercept the compilation process that outputs object file just after gcc emits assembly, extract some information about stack frame formats of each procedure from, and put some tricky pieces of code at each procedure epilogue sequence.
stgcc
is intended to be usable wherever gcc
is used,
unless a command line option fundamentally conflicts with what
StackThreads/MP assumes. Most command line options are passed as is to
gcc
, but it must recognize some of the parameters that controls
compilation. Certainly you do not have to know what it is exactly doing
and you should not even have to learn anything, as long as you already
know gcc
.
What you have to know, however, is things that might conflict with your
tricky way of using gcc
. At present, stgcc
does not
produce any error even when a conflicting option is given. So, it is
possible that even when a compilation succeeds, the resulting program is
erroneous. We are trying to improve this in future. To be sure, give
--show_commands
option to stgcc
, which displays invoked
subcommands.
-ffixed-REG
in gcc
). The reserved register is:
%ebx
on i386,
%l7
on SPARC,
$23
on Mips, and
$14
on Alpha.
Options are automatically specified by stgcc
so you do not normally
notice this. But if you want to reserve this register or another for
your purpose, this is likely to be a problem. Contact me if you want to
do this anyway.
stgcc
turns off inlining by giving
-fno-inline-functions
and -fno-default-inline
to
gcc
. We assume that a procedure call written in
ST_CREATE_THREAD(e)
is translated into a procedure
call in assembly level. In other words, e must not be inlined. This
may severely hurt performance of some programs, but for now there are no
ways to prohibit inlining of a particular call site or a particular
function.
You can instruct the compiler to explicitly inline some functions by
giving inline
directive before a procedure definition.
stgcc
gives -fno-omit-frame-pointer
to gcc
,
so that each procedure keeps a separate frame pointer. Therefore giving
-fomit-frame-pointer
to stgcc
conflicts with this. This
has no performance effects on i386 and SPARC, but may have some on Mips
and Alpha.
stgcc
turns off the use of register windows by
giving -mflat
to gcc
. Hence giving -mno-flat
to
stgcc
conflicts with this.
To summarize, the following options are prohibited in StackThreads/MP.
-finline-functions, -fdefault-inline, -fomit-frame-pointer
,
and -ffixed-REG
are prohibited on all CPUs
-mno-flat
is prohibited on SPARC
Here is the list of options supported by stgcc
, in addition to
all options supported by gcc
.
--show_commands
shows all subcommands invoked by
stgcc
. This should be of no interest for you, but when you get
strange compile-time errors, you might want to look at what stgcc
is doing.
--leave_tmps
does not remove temporary files created during
compilation. This should be of no interest for you, but when you get
strange compile-time errors, you might want to look at temporary files.
--dbg
is equivalent to giving both --show_commands
--leave_tmps
.
--no_postprocess
does not postprocess the assembly
file generated by gcc
. Modules compiled with this option cannot
use StackThreads/MP primitives. This option is primarily useful when you
(1) when you want squeeze performance of some modules that never use
StackThreads/MP primitives, or (2) investigate performance impact of
postprocessing. Normally, compiling everything without this option will
suffice.
--compiler=cc
specified the underlying C compiler
invoked from stgcc
. We currently assume the underlying C compiler
is stgcc
in many ways, so the presence of this option does not
imply you can use any C compiler. Do not give anything except for
gcc
or g++
.
Normally, stgcc
defines STHREADS
to 1. When
--no_postprocess
is given, stgcc
does not define
STHREADS
but instead defines STHREADS_NOPP
to 1.