This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

contribution


Dear Sir/Madam,

Recently I received the statement from FSF committee that my
contribution is accepted.

I guess now I can send the patch for your verification.

This patch represents "GNU_C/C++/Fortran/ObjC to C" converter as
GCC backend. It translates RTL to C code for general compiler.
Most of the tricks are implemented in plain C, but for some of them
GNU extensions was used as well as known pragmas.

This converter can be used to start GNU C/C++/Fortran development
on architectures where only C compiler is available.
It could be extremely useful in porting GNU-like application
(Linux for example) to new architectures where GNU
compiler collection is not yet available, but the native C compiler is.
This converter can improve GCC performance in some cases.
For example SPECfp benchmark 172.mgrid showed 48% improvement
compiled with "-O2 -Ws,-O2,-fno-strict-aliasing" vs plain GCC with "-O2"

This patch doesn't affect other backends, but some core files
were modified like "rtl.def".

Right now it's configured to support big endian target architecture,
but could be easily modified to support others.

Typical 'configure' run after patch applied:

./configure --prefix=/usr/local/new/bin --with-as=/usr/local/bin/gcc
--with-ld=/usr/local/bin/gcc --host=conv-sparc-sysv4 --target=conv-sparc-sysv4

Generated C code is compiled and linked by target compiler. In this
example the target compiler is "/usr/local/bin/gcc"

The "--host" and "--target" options could be anything of "conv-*-*"

Typical run of patched GCC:

/usr/local/new/bin/gcc -O2 -Ws,-O2,-fno-strict-aliasing file.c

The flag "-Ws," was added to GCC driver to pass arguments to
target C compiler.
The option "-fno-strict-aliasing" is recommended when GCC is used
as target compiler.

This converter doesn't support GNU inline assembler and wasn't tested
for Java.

This patch passed 'bootstrap' test and here is the list of failures in
GCC testsuite:
----------------------------------------- GCC ------------------------
gcc.c-torture/compile/20000804-1.c  - fails because of the inline asm.
gcc.c-torture/compile/951222-1.c    - this backend rejects wrong setjmp()
                                      use in the compile time
gcc.dg/asm-names.c                  - testsuite script can't interpret output

                === gcc Summary ===
# of expected passes            15272
# of unexpected failures        13
# of expected failures          76
# of unsupported tests          55

----------------------------------------- G++ -------------------------
g++.dg/mangle1.C  - mangling without '?' was used.
                    generated C code doesn't contain '?' or '.' symbols.
                    So the test failed.

g++.dg/special/conpr-1.C  - for some reason these tests fail for Sparc
g++.dg/special/conpr-2.C  - so they fail with this C converter too
g++.dg/special/conpr-3.C  -
g++.ext/instantiate1.C    -
g++.ext/instantiate2.C    -
g++.ext/instantiate3.C    -

g++.law/operators8.C      - difficult one
g++.pt/instantiate4.C     - this backend doesn't support recompiling/relinking

                === g++ Summary ===
# of expected passes            6473
# of unexpected failures        25
# of expected failures          103
# of untested testcases         21

----------------------------------------- G77 -------------------------
                === g77 Summary ===
# of expected passes            933
# of unsupported tests          8

----------------------------------------- objc ------------------------
                === objc Summary ===
# of expected passes            153
# of expected failures          1

-----------------------------------------------------------------------

This patch passed SPEC benchmark test and several benchmarks showed
the results better than with plain GCC.

Here are the changes to gcc-3.x.x/ChangeLog:

2002-03-29  Alexey Starovoytov  <alexey.starovoytov@sun.com>

        * config.sub: Add C converter support.

Here are the changes to gcc-3.x.x/gcc/ChangeLog:

2002-03-29  Alexey Starovoytov  <alexey.starovoytov@sun.com>

        * config/conv/conv-protos.h: New file.
        * config/conv/conv.c: New file.
        * config/conv/conv.h: New file.
        * config/conv/conv.md: New file.
        * config/conv/libgcc_extra.c: New file.
        * config/conv/sysv4.h: New file.
        * config/conv/t-svr4: New file.
        * config/conv/x-sysv4: New file.
        * config/conv/xm-sysv4.h: New file.
        * config.gcc (conv-*-*): New target.
        * configure (conv-*-*): New target.
        * builtins.c (expand_builtin_apply): support for new call_insn
        * c-common.c (c_common_nodes_and_builtins): C converter does
        support for builtin_setjmp and builtin_longjmp not as builtins
        * calls.c: support for new call_insn with unique call number
        * collect2.c (main): unset COMPILER_PATH and LIBRARY_PATH
        so the converter may work with target compiler GCC
        * dwarf2asm.c (dw2_asm_output_data_uleb128): 'assemble_integer'
        should be used when UNALIGNED_INT_ASM_OP not defined
        * emit-rtl.c: support for new call_insn
        * expr.c: support for new PUSH_ARG RTL
        * expr.h: support for new PUSH_ARG RTL
        * gcc.c: new -Ws option and gcc specs for C converter
        * integrate.c (copy_insn_list): support for new call_insn
        * jump.c (find_cross_jump): support for new call_insn
        * loop.c (move_movables): support for new call_insn
        * rtl.def: new CALL_INSN and PUSH_ARG
        * rtl.h: support for new call_insn
        * unroll.c (copy_loop_body): support for new call_insn

The full patch generated with "diff -rc3pN" is attached.

Sincerely,
Alexey Starovoytov

Attachment: gcc_all.diff.bz2
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]