Re: [Suif-talk] Loop transformations in SUIF + patch for gcc 3
Marc Gonzalez-Sigler <[email protected]> Fri, 24 Sep 2004 16:17:24 +0200
| Newsgroups | gmane.comp.compilers.suif.bugs |
|---|---|
| Message-ID | <[email protected]> |
Marc Gonzalez-Sigler wrote:
> One last comment, why does SUIF generate an incorrect preprocessor
> command line?
>
> $ scc -v toto.c
> CPP: /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cpp -D__SCC__ GNU
> -I/local/gonzalez/suif/suifhome/i386-redhat-linux/include -undef
> -U__GNUC__ -U__GNUC_MINOR__ toto.c /tmp/scc09600_0.i
> cpp: too many input files
> /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cpp -D__SCC__ GNU
> -I/local/gonzalez/suif/suifhome/i386-redhat-linux/include -undef
> -U__GNUC__ -U__GNUC_MINOR__ toto.c /tmp/scc09600_0.i
> FAILED (exit status 0x1)
>
> I think the problem comes from the "GNU" token.
>
> In suifhome/src/basesuif/scc/commands.def
>
> String predefined_path(suif_top);
> predefined_path += '/';
> predefined_path += target_machine;
> predefined_path += "/predefined.txt";
> *p->flags[0] += " ";
> string_from_file(predefined_path.string(), p->flags[0]);
>
> $ cat suifhome/i386-redhat-linux/predefined.txt
> GNU
>
> What is the purpose of predefined.txt? Did older versions of cpp
> accept flags without a "-" prefix?
I think this FAQ partly answers my question. I guess I'll simply delete
predefined.txt since I don't plan to use cross-compilation yet.
4. Q: ``If I want to run the output program on a different machine
than the one on which I run SUIF, can I do that?''
A: Yes, this is called cross-compiling, and SUIF is generally
capable of cross compiling for any target machine that has an
ANSI C compiler. There are a couple of issues you should be
aware of, though. They have to do with ensuring that SUIF
uses information about the true target machine instead of
information about that machine on which SUIF is running.
Since the most common case is to target the machine on which
SUIF is running (or a machine with the same processor and OS),
by default SUIF uses the information about the machine on
which it is running as the target information. Since SUIF is
designed to facilitate cross-compilation, the assumptions
about the target machine are made at only two points in the
compilation:
* The C pre-processor stage (note that this stage is used in
Fortran compilation, not just C compilation). At the
pre-processor stage, system include files are incorporated
into the program by directives such as
``#include <stdio.h>''. These include files are highly
system-dependent. Typically they are provided by the OS,
mostly in /usr/include. To cross-compile, you must first
run the passes that come before the C pre-processor (cpp),
which is nothing for C programs, but is the ``sf2c'' pass
for Fortran programs (run ``scc -.c file.f'') on the
machine that runs SUIF. Then, you must transfer all the
files to the target machine, run the pre-processor to
generate .i files (cpp on some systems, ``cc -E'' on other
systems, and other things on other systems). Then you
must transfer all the .i files back to the machine running
SUIF and then you can continue the compilation from the .i
files. That always works. As an alternative, you can try
duplicating the entire /usr/include directory tree for
target machine <machine> under
$SUIFHOME/<machine>/include. You also have to generate
the proper $SUIFHOME/<machine>/predefined.txt file showing
what pre-defined macros <machine> defines by default in
its pre-processor (see
$SUIFHOME/src/basesuif/config/README.config for details).
If you can do that correctly, then all you have to do is
specify ``-Target <machine>'' to scc and it will be able
to run cpp on the SUIF machine and yet get everything
correctly set up for <machine> as target.
[...]
$SUIFHOME/src/basesuif/config/README.config
BASESUIF CONFIGURATION PACKAGE
==============================
This sub-package of the basesuif package configures machine-specific
files that are needed to run parts of the SUIF system.
Right now, the only thing it configures is the
$SUIFHOME/$MACHINE/predefined.txt file. That file contains command
line options for the C pre-processor to tell it what symbols to
predefine.
Since this is so machine-dependent, it's not unusual for it to fail on
system to which this package has not yet been ported. If you install
on a system which is not one of the ones listed in the ReleaseNotes as
working with this version of suifbase, you should at least check and
make sure this package has worked correctly on your system. It's
designed to be easy to port to new systems.
If your system isn't recognized, this package tries to get its
configuration information from gcc. If gcc is not going to be your
back-end compiler, this information may not be correct.
$SUIFHOME/src/basesuif/config/find-predefines-gcc
#!/bin/sh
#
# file "find-predefines-gcc"
#
# This is a script to automatically figure out which pre-processing
# tokens are pre-defined by the gcc compiler and list them in header
# file format. It is known to work with gcc 2.6.3; it may or may not
# work with later versions.
#
# --Chris Wilson <[email protected]>
#
# usage: find-predefines-gcc <outfile_name>
[...]
--
Regards, Marc
_______________________________________________
To unsubscribe, send mail to [email protected]
or visit http://suif.stanford.edu/mailman/listinfo/suif-bugs