aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-10 23:56:25 +0000
committer(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-10 23:56:25 +0000
commit2bffd6f3bba6e1746f5b7cd524d76b5b2e2eb48e (patch)
tree0d98bcea72447280d7282a59a38a7b203eabc2ef
parent59bc598e01e292d67c32b6ae240b4544d4c234ab (diff)
This commit was manufactured by cvs2svn to create tagapple/gcc-1749
'apple-gcc-1749'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/apple-gcc-1749@81686 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--CHANGES.Apple265
-rw-r--r--ChangeLog.apple-ppc24
-rw-r--r--GNUmakefile88
-rw-r--r--README.Apple463
-rwxr-xr-xbuild_gcc375
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/ChangeLog.apple-ppc464
-rw-r--r--gcc/ChangeLog.lno2010
-rw-r--r--gcc/Makefile.in212
-rw-r--r--gcc/ada/5qsystem.ads236
-rw-r--r--gcc/ada/5xcrtl.ads159
-rw-r--r--gcc/ada/5zstchop.adb255
-rw-r--r--gcc/ada/s-stchop.adb273
-rw-r--r--gcc/ada/s-stchop.ads74
-rw-r--r--gcc/alias.c87
-rw-r--r--gcc/basic-block.h43
-rw-r--r--gcc/bb-reorder.c1023
-rw-r--r--gcc/builtins.c1
-rw-r--r--gcc/c-common.c446
-rw-r--r--gcc/c-common.h127
-rw-r--r--gcc/c-convert.c12
-rw-r--r--gcc/c-cppbuiltin.c30
-rw-r--r--gcc/c-decl.c812
-rw-r--r--gcc/c-dmp-tree.c520
-rw-r--r--gcc/c-idebug.c57
-rw-r--r--gcc/c-incpath.c8
-rw-r--r--gcc/c-lang.c22
-rw-r--r--gcc/c-lex.c150
-rw-r--r--gcc/c-objc-common.c15
-rw-r--r--gcc/c-opts.c196
-rw-r--r--gcc/c-parse.in12
-rw-r--r--gcc/c-pch.c34
-rw-r--r--gcc/c-pragma.c18
-rw-r--r--gcc/c-pragma.h4
-rw-r--r--gcc/c-tree.h19
-rw-r--r--gcc/c-typeck.c200
-rw-r--r--gcc/c.opt99
-rw-r--r--gcc/calls.c135
-rw-r--r--gcc/cfgbuild.c8
-rw-r--r--gcc/cfgcleanup.c80
-rw-r--r--gcc/cfghooks.c6
-rw-r--r--gcc/cfglayout.c73
-rw-r--r--gcc/cfglayout.h4
-rw-r--r--gcc/cfgloop.c17
-rw-r--r--gcc/cfgloop.h119
-rw-r--r--gcc/cfgloopanal.c17
-rw-r--r--gcc/cfgloopmanip.c27
-rw-r--r--gcc/cfgrtl.c148
-rw-r--r--gcc/combine.c54
-rw-r--r--gcc/common.opt94
-rw-r--r--gcc/config/darwin-c.c243
-rw-r--r--gcc/config/darwin-crt2.c11
-rw-r--r--gcc/config/darwin-driver.c989
-rw-r--r--gcc/config/darwin-protos.h40
-rw-r--r--gcc/config/darwin.c696
-rw-r--r--gcc/config/darwin.h447
-rw-r--r--gcc/config/h8300/t-rtems7
-rw-r--r--gcc/config/host-linux.c137
-rw-r--r--gcc/config/host-solaris.c79
-rw-r--r--gcc/config/i386/darwin.h89
-rw-r--r--gcc/config/i386/i386.c68
-rw-r--r--gcc/config/i386/i386.h23
-rw-r--r--gcc/config/rs6000/altivec.h26
-rw-r--r--gcc/config/rs6000/altivec.md53
-rw-r--r--gcc/config/rs6000/builtin.ops297
-rw-r--r--gcc/config/rs6000/darwin-fpsave.asm69
-rw-r--r--gcc/config/rs6000/darwin-vecsave.asm133
-rw-r--r--gcc/config/rs6000/darwin-worldsave.asm233
-rw-r--r--gcc/config/rs6000/darwin.h165
-rwxr-xr-xgcc/config/rs6000/ops-to-gp620
-rw-r--r--gcc/config/rs6000/rs6000-c.c124
-rw-r--r--gcc/config/rs6000/rs6000-protos.h12
-rw-r--r--gcc/config/rs6000/rs6000.c965
-rw-r--r--gcc/config/rs6000/rs6000.h74
-rw-r--r--gcc/config/rs6000/rs6000.md281
-rw-r--r--gcc/config/rs6000/sysv4.h7
-rw-r--r--gcc/config/rs6000/t-darwin8
-rw-r--r--gcc/config/rs6000/t-linux646
-rw-r--r--gcc/config/rs6000/t-rs60001
-rw-r--r--gcc/config/rs6000/t-rtems86
-rw-r--r--gcc/config/rs6000/vec.h4515
-rw-r--r--gcc/config/rs6000/vec.ops1025
-rw-r--r--gcc/config/t-darwin4
-rw-r--r--gcc/config/t-slibgcc-darwin3
-rw-r--r--gcc/config/x-linux4
-rw-r--r--gcc/config/x-solaris4
-rwxr-xr-xgcc/configure146
-rw-r--r--gcc/configure.ac16
-rw-r--r--gcc/coretypes.h2
-rw-r--r--gcc/cp/ChangeLog.apple-ppc5
-rw-r--r--gcc/cp/Make-lang.in38
-rw-r--r--gcc/cp/call.c65
-rw-r--r--gcc/cp/class.c205
-rw-r--r--gcc/cp/cp-dmp-tree.c1326
-rw-r--r--gcc/cp/cp-idebug.c463
-rw-r--r--gcc/cp/cp-lang.c63
-rw-r--r--gcc/cp/cp-root.h4
-rw-r--r--gcc/cp/cp-tree.h55
-rw-r--r--gcc/cp/decl.c226
-rw-r--r--gcc/cp/decl2.c102
-rw-r--r--gcc/cp/g++spec.c11
-rw-r--r--gcc/cp/init.c10
-rw-r--r--gcc/cp/lang-specs.h5
-rw-r--r--gcc/cp/lex.c62
-rw-r--r--gcc/cp/lex.h15
-rw-r--r--gcc/cp/mangle.c30
-rw-r--r--gcc/cp/method.c8
-rw-r--r--gcc/cp/optimize.c190
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/cp/rtti.c9
-rw-r--r--gcc/cp/tree.c10
-rw-r--r--gcc/cp/typeck.c240
-rw-r--r--gcc/cp/typeck2.c10
-rw-r--r--gcc/cppcharset.c40
-rw-r--r--gcc/cpperror.c27
-rw-r--r--gcc/cppfiles.c10
-rw-r--r--gcc/cpphash.h32
-rw-r--r--gcc/cppinit.c27
-rw-r--r--gcc/cpplib.c98
-rw-r--r--gcc/cpplib.h129
-rw-r--r--gcc/cpppch.c59
-rw-r--r--gcc/cse.c89
-rw-r--r--gcc/dbxout.c149
-rw-r--r--gcc/debug.c3
-rw-r--r--gcc/debug.h7
-rw-r--r--gcc/defaults.h15
-rw-r--r--gcc/df.c1177
-rw-r--r--gcc/df.h49
-rw-r--r--gcc/diagnostic.c29
-rw-r--r--gcc/dmp-tree.c3695
-rw-r--r--gcc/dmp-tree.h116
-rw-r--r--gcc/doc/cpp.texi26
-rw-r--r--gcc/doc/cppopts.texi25
-rw-r--r--gcc/doc/extend.texi72
-rw-r--r--gcc/doc/gcc.texi4
-rw-r--r--gcc/doc/include/sourcecode.texi35
-rw-r--r--gcc/doc/invoke.texi661
-rw-r--r--gcc/doc/rtl.texi10
-rw-r--r--gcc/doc/tm.texi31
-rw-r--r--gcc/doloop.c4
-rw-r--r--gcc/dominance.c2
-rw-r--r--gcc/dwarf2out.c162
-rw-r--r--gcc/expmed.c11
-rw-r--r--gcc/expr.c14
-rw-r--r--gcc/f/Make-lang.in4
-rw-r--r--gcc/f/com.c31
-rw-r--r--gcc/final.c79
-rw-r--r--gcc/flags.h96
-rw-r--r--gcc/fold-const.c50
-rw-r--r--gcc/function.c41
-rw-r--r--gcc/function.h3
-rw-r--r--gcc/gcc.c763
-rw-r--r--gcc/gcc.h9
-rw-r--r--gcc/gcse.c69
-rw-r--r--gcc/gengtype.c40
-rw-r--r--gcc/ginclude/stdarg.h7
-rw-r--r--gcc/ginclude/varargs.h8
-rw-r--r--gcc/global.c64
-rw-r--r--gcc/hooks.c34
-rw-r--r--gcc/hooks.h7
-rw-r--r--gcc/idebug.c639
-rw-r--r--gcc/ifcvt.c34
-rw-r--r--gcc/java/Make-lang.in4
-rw-r--r--gcc/java/decl.c1
-rw-r--r--gcc/java/lang.c31
-rw-r--r--gcc/lambda-code.c1769
-rw-r--r--gcc/lambda-mat.c568
-rw-r--r--gcc/lambda-trans.c294
-rw-r--r--gcc/lambda.h303
-rw-r--r--gcc/langhooks-def.h26
-rw-r--r--gcc/langhooks.c33
-rw-r--r--gcc/langhooks.h17
-rw-r--r--gcc/libgcc2.c8
-rw-r--r--gcc/loop-doloop.c502
-rw-r--r--gcc/loop-invariant.c932
-rw-r--r--gcc/loop-iv.c11
-rw-r--r--gcc/loop-unroll.c4
-rw-r--r--gcc/loop-unswitch.c4
-rw-r--r--gcc/loop.c101
-rw-r--r--gcc/loop.h5
-rw-r--r--gcc/mkinstalldirs0
-rwxr-xr-xgcc/move-if-change0
-rw-r--r--gcc/objc/Make-lang.in32
-rw-r--r--gcc/objc/config-lang.in6
-rw-r--r--gcc/objc/objc-act.c138
-rw-r--r--gcc/objc/objc-act.h3
-rw-r--r--gcc/objc/objc-dmp-tree.c285
-rw-r--r--gcc/objc/objc-idebug.c72
-rw-r--r--gcc/objc/objc-lang.c4
-rw-r--r--gcc/objc/objc-root.h4
-rw-r--r--gcc/objcp/.cvsignore4
-rw-r--r--gcc/objcp/Make-lang.in222
-rw-r--r--gcc/objcp/config-lang.in43
-rw-r--r--gcc/objcp/lang-specs.h59
-rw-r--r--gcc/objcp/objcp-decl.c306
-rw-r--r--gcc/objcp/objcp-decl.h100
-rw-r--r--gcc/objcp/objcp-root.h4
-rw-r--r--gcc/opts.c684
-rw-r--r--gcc/output.h14
-rw-r--r--gcc/params.def21
-rw-r--r--gcc/passes.c51
-rw-r--r--gcc/predict.c11
-rw-r--r--gcc/print-rtl.c10
-rw-r--r--gcc/print-tree.c8
-rw-r--r--gcc/ra-build.c6
-rw-r--r--gcc/regrename.c17
-rw-r--r--gcc/reload.c36
-rw-r--r--gcc/rtl.c2
-rw-r--r--gcc/rtl.h38
-rw-r--r--gcc/sched-rgn.c9
-rw-r--r--gcc/simplify-rtx.c6
-rw-r--r--gcc/stor-layout.c81
-rw-r--r--gcc/stringpool.c1
-rw-r--r--gcc/target-def.h31
-rw-r--r--gcc/target.h34
-rw-r--r--gcc/targhooks.c8
-rw-r--r--gcc/targhooks.h3
-rw-r--r--gcc/testsuite/ChangeLog.apple-ppc4
-rw-r--r--gcc/testsuite/ChangeLog.lno121
-rw-r--r--gcc/testsuite/UNTESTABLE57
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa3001.a507
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa3002.a318
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa3003.a243
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa3004.a235
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4001.a218
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4002.a182
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4003.a326
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4004.a431
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4005.a683
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4006.a319
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4007.a334
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4008.a662
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4009.a619
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4010.a275
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4011.a376
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4012.a305
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4013.a203
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4014.a359
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4015.a580
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4016.a685
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4017.a337
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4018.a379
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4019.a1027
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4020.a688
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4021.a311
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4022.a531
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4023.a585
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4024.a350
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4025.a376
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4026.a526
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4027.a342
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4028.a331
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4029.a333
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4030.a414
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4031.a291
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4032.a457
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4033.a405
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa4034.a281
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5011.a471
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5012.a536
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5015.a342
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a01.a338
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a02.a328
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a03.a426
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a04.a434
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a05.a338
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a06.a334
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a07.a413
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a08.a474
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a09.a400
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa5a10.a551
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa8001.a243
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa8002.a285
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa8003.a214
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa9001.a287
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxa9002.a482
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa001.a279
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa002.a257
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa003.a293
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa004.a260
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa005.a292
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa006.a285
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa007.a263
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa008.a271
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa009.a290
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa010.a335
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa011.a266
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa012.a167
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa013.a167
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa014.a178
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa015.a227
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa016.a462
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa017.a400
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa018.a277
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaa019.a138
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxab001.a272
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxac001.a292
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxac002.a426
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxac003.a376
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxac004.a310
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxac005.a343
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaca01.a291
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaca02.a360
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxacb01.a264
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxacb02.a421
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxacc01.a299
-rw-r--r--gcc/testsuite/ada/acats/tests/cxa/cxaf001.a199
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf1001.a261
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf2001.a755
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf2002.a352
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf2003.a363
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf2004.a513
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf2005.a293
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf2a01.a448
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf2a02.a354
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3001.a192
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3002.a231
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3003.a292
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3004.a257
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a01.a167
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a02.a267
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a03.a429
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a04.a293
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a05.a266
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a06.a302
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a07.a337
-rw-r--r--gcc/testsuite/ada/acats/tests/cxf/cxf3a08.a289
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg1001.a276
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg1002.a198
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg1003.a478
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg1004.a360
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg1005.a393
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2001.a322
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2002.a468
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2003.a701
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2004.a499
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2005.a204
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2006.a281
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2007.a291
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2008.a948
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2009.a421
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2010.a892
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2011.a490
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2012.a438
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2013.a367
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2014.a399
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2015.a686
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2016.a482
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2017.a296
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2018.a355
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2019.a338
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2020.a351
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2021.a386
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2022.a309
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2023.a351
-rw-r--r--gcc/testsuite/ada/acats/tests/cxg/cxg2024.a191
-rw-r--r--gcc/testsuite/g++.dg/abi/layout2.C2
-rw-r--r--gcc/testsuite/g++.dg/align-test-1.C347
-rw-r--r--gcc/testsuite/g++.dg/altivec-1.C12
-rw-r--r--gcc/testsuite/g++.dg/altivec-2.C15
-rw-r--r--gcc/testsuite/g++.dg/altivec-3.C21
-rw-r--r--gcc/testsuite/g++.dg/altivec-4.C129
-rw-r--r--gcc/testsuite/g++.dg/altivec-5.C19
-rw-r--r--gcc/testsuite/g++.dg/apple-altivec-1.C9
-rw-r--r--gcc/testsuite/g++.dg/charset/asm1.c14
-rw-r--r--gcc/testsuite/g++.dg/charset/asm2.c33
-rw-r--r--gcc/testsuite/g++.dg/charset/asm3.c10
-rw-r--r--gcc/testsuite/g++.dg/charset/asm4.c8
-rw-r--r--gcc/testsuite/g++.dg/charset/attribute1.c10
-rw-r--r--gcc/testsuite/g++.dg/charset/attribute2.c8
-rw-r--r--gcc/testsuite/g++.dg/charset/extern1.cc15
-rw-r--r--gcc/testsuite/g++.dg/charset/extern2.cc5
-rw-r--r--gcc/testsuite/g++.dg/charset/string.c5
-rw-r--r--gcc/testsuite/g++.dg/const-cfstring-1.C26
-rw-r--r--gcc/testsuite/g++.dg/debug/debug8.C29
-rw-r--r--gcc/testsuite/g++.dg/eh/spec7.C35
-rw-r--r--gcc/testsuite/g++.dg/expr/align68k-1.C46
-rw-r--r--gcc/testsuite/g++.dg/expr/align68k-2.C38
-rw-r--r--gcc/testsuite/g++.dg/expr/cast-ptr-1.C15
-rw-r--r--gcc/testsuite/g++.dg/expr/fieldref1.C23
-rw-r--r--gcc/testsuite/g++.dg/ext/anon-struct4.C3
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib14.C13
-rw-r--r--gcc/testsuite/g++.dg/init/ctor3.C6
-rw-r--r--gcc/testsuite/g++.dg/init/ref11.C13
-rw-r--r--gcc/testsuite/g++.dg/init/union1.C5
-rw-r--r--gcc/testsuite/g++.dg/kext1.C11
-rw-r--r--gcc/testsuite/g++.dg/kext2.C13
-rw-r--r--gcc/testsuite/g++.dg/kext3.C18
-rw-r--r--gcc/testsuite/g++.dg/lookup/enum1.C5
-rw-r--r--gcc/testsuite/g++.dg/lookup/struct2.C7
-rw-r--r--gcc/testsuite/g++.dg/opt/eh1.C21
-rw-r--r--gcc/testsuite/g++.dg/overload/ref1.C21
-rw-r--r--gcc/testsuite/g++.dg/parse/builtin2.C5
-rw-r--r--gcc/testsuite/g++.dg/parse/crash14.C20
-rw-r--r--gcc/testsuite/g++.dg/parse/non-dependent3.C17
-rw-r--r--gcc/testsuite/g++.dg/parse/template14.C17
-rw-r--r--gcc/testsuite/g++.dg/pascal-strings-1.C44
-rw-r--r--gcc/testsuite/g++.dg/pascal-strings-2.C43
-rw-r--r--gcc/testsuite/g++.dg/preserve-PPC-CR.C41
-rw-r--r--gcc/testsuite/g++.dg/template/spec12.C18
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-7.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/static3.C2
-rw-r--r--gcc/testsuite/gcc.apple/Wextra-tokens.c21
-rw-r--r--gcc/testsuite/gcc.apple/Wfour-char-constants-1.c12
-rw-r--r--gcc/testsuite/gcc.apple/Wfour-char-constants-2.c12
-rw-r--r--gcc/testsuite/gcc.apple/Wlong-double.c11
-rw-r--r--gcc/testsuite/gcc.apple/Wmost.c19
-rw-r--r--gcc/testsuite/gcc.apple/align-test-1.c605
-rw-r--r--gcc/testsuite/gcc.apple/align-test-2.c152
-rw-r--r--gcc/testsuite/gcc.apple/align-test-3.c123
-rw-r--r--gcc/testsuite/gcc.apple/align-test-4.c224
-rw-r--r--gcc/testsuite/gcc.apple/align-test-4.h43
-rw-r--r--gcc/testsuite/gcc.apple/align-test-5a.c87
-rw-r--r--gcc/testsuite/gcc.apple/align-test-5b.c87
-rw-r--r--gcc/testsuite/gcc.apple/align-test-5c.c87
-rw-r--r--gcc/testsuite/gcc.apple/altivec-1.c124
-rw-r--r--gcc/testsuite/gcc.apple/altivec-2.c9
-rw-r--r--gcc/testsuite/gcc.apple/applecc.c14
-rw-r--r--gcc/testsuite/gcc.apple/const-cfstring-1.c29
-rw-r--r--gcc/testsuite/gcc.apple/const-cfstring-2.c13
-rw-r--r--gcc/testsuite/gcc.apple/const-cfstring-3.c29
-rw-r--r--gcc/testsuite/gcc.apple/dg.exp (renamed from gcc/testsuite/gcc.dg/charset/charset.exp)32
-rw-r--r--gcc/testsuite/gcc.apple/execute/bitfield-1.c52
-rw-r--r--gcc/testsuite/gcc.apple/execute/execute.exp43
-rw-r--r--gcc/testsuite/gcc.apple/framework1.c12
-rw-r--r--gcc/testsuite/gcc.apple/import.c9
-rw-r--r--gcc/testsuite/gcc.apple/importee.h3
-rw-r--r--gcc/testsuite/gcc.apple/inttypes-1.c21
-rw-r--r--gcc/testsuite/gcc.apple/no-warning.c8
-rw-r--r--gcc/testsuite/gcc.apple/one.framework/Headers/one.h3
-rw-r--r--gcc/testsuite/gcc.apple/pascal-strings-1.c46
-rw-r--r--gcc/testsuite/gcc.apple/pascal-strings-2.c45
-rw-r--r--gcc/testsuite/gcc.apple/preprocess.s16
-rw-r--r--gcc/testsuite/gcc.apple/special/liblongcall.c9
-rw-r--r--gcc/testsuite/gcc.apple/special/longcall-prog.c17
-rw-r--r--gcc/testsuite/gcc.apple/special/longcall.exp69
-rw-r--r--gcc/testsuite/gcc.apple/special/special.exp42
-rw-r--r--gcc/testsuite/gcc.apple/special/zerofill.c5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/simd-4.x4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040308-1.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040309-1.c24
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040311-1.c68
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040313-1.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/simd-1.x7
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/simd-2.x7
-rw-r--r--gcc/testsuite/gcc.dg/20020416-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/20040322-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/20040331-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/20040409-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wshadow-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/altivec-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/altivec-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/altivec-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/altivec-varargs-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/builtin-inf-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/builtins-35.c6
-rw-r--r--gcc/testsuite/gcc.dg/builtins-36.c79
-rw-r--r--gcc/testsuite/gcc.dg/builtins-37.c29
-rw-r--r--gcc/testsuite/gcc.dg/c90-intprom-1.c47
-rw-r--r--gcc/testsuite/gcc.dg/c99-complex-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/c99-intprom-1.c77
-rw-r--r--gcc/testsuite/gcc.dg/cast-ptr-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm1.c14
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm3.c33
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm4.c10
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm5.c8
-rw-r--r--gcc/testsuite/gcc.dg/charset/attribute1.c10
-rw-r--r--gcc/testsuite/gcc.dg/charset/attribute2.c8
-rw-r--r--gcc/testsuite/gcc.dg/charset/string.c5
-rw-r--r--gcc/testsuite/gcc.dg/compare8.c21
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5a_main.c14
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5a_x.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5a_y.c25
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5b_main.c14
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5b_x.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5b_y.c25
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6a_main.c14
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6a_x.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6a_y.c25
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6b_main.c14
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6b_x.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6b_y.c25
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7a_main.c14
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7a_x.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7a_y.c25
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7b_main.c14
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7b_x.c43
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7b_y.c25
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c++98-pedantic.cc11
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c++98.cc11
-rw-r--r--gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/extratokens.c3
-rw-r--r--gcc/testsuite/gcc.dg/cpp/if-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/include2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/skipping2.c3
-rw-r--r--gcc/testsuite/gcc.dg/cpp/sysmac2.c3
-rw-r--r--gcc/testsuite/gcc.dg/debug/20020220-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/debug-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/debug/debug-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die1.c8
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die2.c7
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die3.c11
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die5.c12
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die6.c12
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die7.c14
-rw-r--r--gcc/testsuite/gcc.dg/dg.exp2
-rw-r--r--gcc/testsuite/gcc.dg/format/c90-printf-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/format/c90-scanf-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/format/strfmon-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/gnu89-init-3.c18
-rw-r--r--gcc/testsuite/gcc.dg/i386-387-7.c10
-rw-r--r--gcc/testsuite/gcc.dg/i386-387-8.c12
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/incomplete-3.c9
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/undeclared-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/undeclared-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/pch/apple-altivec-1.c126
-rw-r--r--gcc/testsuite/gcc.dg/pch/apple-altivec-1.hs2
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1.hs3
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1b.c5
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1b.hs3
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-2.hs1
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-3.hs3
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-4.hs1
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-5.c5
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-5.hs1
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-6.c5
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-6.hs1
-rw-r--r--gcc/testsuite/gcc.dg/reg-vol-struct-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/spill-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/ss/README17
-rw-r--r--gcc/testsuite/gcc.dg/ss/one.c18
-rw-r--r--gcc/testsuite/gcc.dg/ss/one.ssh13
-rw-r--r--gcc/testsuite/gcc.dg/ss/ss-cmd1.c10
-rw-r--r--gcc/testsuite/gcc.dg/ss/ss.exp235
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-convert-1.c138
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-ctype-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-ctype-2.c107
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-power-1.c105
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c42
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/20040216-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c35
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-03.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-04.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-05.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-06.c50
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-07.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-08.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-09.c41
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c.ddall215
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-11.c59
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-12.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-13.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-14.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-15.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-16.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-17.c35
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-18.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-19.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-20.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-21.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-22.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-23.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-24.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-25.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-26.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-28.c39
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-29.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c.ddall383
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c.ddall143
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c35
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c.ddall47
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c46
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c.ddall113
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c.ddall47
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c.ddall167
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c35
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c.ddall221
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-37.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-38.c48
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-39.c45
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-40.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-41.c52
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-42.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-43.c64
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-44.c38
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-45.c44
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-46.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-47.c35
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-48.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-49.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-50.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-51.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c.ddall203
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-53.c128
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-54.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-55.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-56.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-57.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-58.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c.ddall275
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c.ddall107
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp (renamed from gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp)13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-1.c101
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-10.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-11.c51
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-12.c55
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-13.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-14.c49
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-15.c50
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-16.c49
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-17.c140
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-18.c139
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-19.c139
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-2.c50
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-20.c139
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-21.c140
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-22.c140
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-23.c140
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-24.c140
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-25.c66
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-26.c51
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c57
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-28.c54
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-29.c60
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-3.c63
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-4.c51
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-5.c69
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-6.c71
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-7.c64
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-8.c50
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-9.c50
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-all.c228
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-none.c190
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect.exp35
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040308-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040308-2.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040308-3.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040308-4.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/copy-headers.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ivcanon-1.c37
-rw-r--r--gcc/testsuite/gcc.dg/typespec-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/va-arg-2.c7
-rw-r--r--gcc/testsuite/gcc.dg/verbose-asm-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/wtr-conversion-1.c3
-rw-r--r--gcc/testsuite/lib/g++.exp8
-rw-r--r--gcc/testsuite/lib/gcc.exp7
-rw-r--r--gcc/testsuite/lib/obj-c++-dg.exp165
-rw-r--r--gcc/testsuite/lib/obj-c++.exp311
-rw-r--r--gcc/testsuite/lib/scanasm.exp6
-rw-r--r--gcc/testsuite/lib/scantree.exp45
-rw-r--r--gcc/testsuite/obj-c++.dg/basic.mm24
-rw-r--r--gcc/testsuite/obj-c++.dg/dg.exp40
-rw-r--r--gcc/testsuite/obj-c++.dg/method-1.mm30
-rw-r--r--gcc/testsuite/obj-c++.dg/super-class-1.mm30
-rw-r--r--gcc/testsuite/obj-c++/redo-dg.exp38
-rw-r--r--gcc/testsuite/obj-c++/redo-old-deja.exp63
-rw-r--r--gcc/testsuite/objc.dg/call-super-1.m3
-rw-r--r--gcc/testsuite/objc.dg/category-1.m12
-rw-r--r--gcc/testsuite/objc.dg/const-cfstring-1.m56
-rw-r--r--gcc/testsuite/objc.dg/const-cfstring-2.m26
-rw-r--r--gcc/testsuite/objc.dg/const-str-3.m8
-rw-r--r--gcc/testsuite/objc.dg/dg.exp3
-rw-r--r--gcc/testsuite/objc.dg/encode-1.m13
-rw-r--r--gcc/testsuite/objc.dg/nested-func-1.m1
-rw-r--r--gcc/testsuite/objc.dg/objc.c6
-rw-r--r--gcc/timevar.c69
-rw-r--r--gcc/timevar.def11
-rw-r--r--gcc/toplev.c265
-rw-r--r--gcc/toplev.h5
-rw-r--r--gcc/tree-alias-common.c7
-rw-r--r--gcc/tree-cfg.c137
-rw-r--r--gcc/tree-chrec.c2011
-rw-r--r--gcc/tree-chrec.h352
-rw-r--r--gcc/tree-data-ref.c1740
-rw-r--r--gcc/tree-data-ref.h184
-rw-r--r--gcc/tree-dg.c583
-rw-r--r--gcc/tree-dg.h87
-rw-r--r--gcc/tree-dump.c14
-rw-r--r--gcc/tree-elim-check.c478
-rw-r--r--gcc/tree-flow-inline.h64
-rw-r--r--gcc/tree-flow.h64
-rw-r--r--gcc/tree-fold-const.c222
-rw-r--r--gcc/tree-fold-const.h245
-rw-r--r--gcc/tree-into-ssa.c718
-rw-r--r--gcc/tree-loop-linear.c113
-rw-r--r--gcc/tree-mudflap.c55
-rw-r--r--gcc/tree-optimize.c30
-rw-r--r--gcc/tree-pass.h14
-rw-r--r--gcc/tree-pretty-print.c50
-rw-r--r--gcc/tree-scalar-evolution.c3768
-rw-r--r--gcc/tree-scalar-evolution.h40
-rw-r--r--gcc/tree-ssa-alias.c47
-rw-r--r--gcc/tree-ssa-dce.c27
-rw-r--r--gcc/tree-ssa-dom.c16
-rw-r--r--gcc/tree-ssa-loop-im.c1094
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c487
-rw-r--r--gcc/tree-ssa-loop-ivopts.c5077
-rw-r--r--gcc/tree-ssa-loop-manip.c1020
-rw-r--r--gcc/tree-ssa-loop-unswitch.c283
-rw-r--r--gcc/tree-ssa-loop.c74
-rw-r--r--gcc/tree-ssa-operands.c31
-rw-r--r--gcc/tree-ssa-operands.h1
-rw-r--r--gcc/tree-ssa-phiopt.c631
-rw-r--r--gcc/tree-ssa-return.c232
-rw-r--r--gcc/tree-ssa.c203
-rw-r--r--gcc/tree-ssanames.c6
-rw-r--r--gcc/tree-vectorizer.c3403
-rw-r--r--gcc/tree-vectorizer.h179
-rw-r--r--gcc/tree.c143
-rw-r--r--gcc/tree.def19
-rw-r--r--gcc/tree.h118
-rw-r--r--gcc/unroll.c2
-rw-r--r--gcc/varasm.c156
-rw-r--r--gcc/varray.c3
-rw-r--r--gcc/varray.h65
-rw-r--r--gcc/version.c17
-rw-r--r--include/demangle.h4
-rw-r--r--libada/configure.ac65
-rw-r--r--libiberty/vasprintf.c3
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java87
-rw-r--r--libjava/gnu/java/net/protocol/core/Connection.java172
-rw-r--r--libjava/gnu/java/net/protocol/core/CoreInputStream.java90
-rw-r--r--libjava/gnu/java/net/protocol/core/Handler.java28
-rw-r--r--libjava/gnu/java/net/protocol/core/natCoreInputStream.cc51
-rw-r--r--libjava/gnu/regexp/CharIndexed.java84
-rw-r--r--libjava/gnu/regexp/CharIndexedCharArray.java62
-rw-r--r--libjava/gnu/regexp/CharIndexedInputStream.java149
-rw-r--r--libjava/gnu/regexp/CharIndexedReader.java142
-rw-r--r--libjava/gnu/regexp/CharIndexedString.java64
-rw-r--r--libjava/gnu/regexp/CharIndexedStringBuffer.java62
-rw-r--r--libjava/gnu/regexp/MessagesBundle.properties22
-rw-r--r--libjava/gnu/regexp/MessagesBundle_fr.properties22
-rw-r--r--libjava/gnu/regexp/RE.java1350
-rw-r--r--libjava/gnu/regexp/REException.java182
-rw-r--r--libjava/gnu/regexp/REFilterInputStream.java140
-rw-r--r--libjava/gnu/regexp/REFilterReader.java117
-rw-r--r--libjava/gnu/regexp/REMatch.java263
-rw-r--r--libjava/gnu/regexp/REMatchEnumeration.java135
-rw-r--r--libjava/gnu/regexp/RESyntax.java521
-rw-r--r--libjava/gnu/regexp/REToken.java86
-rw-r--r--libjava/gnu/regexp/RETokenAny.java73
-rw-r--r--libjava/gnu/regexp/RETokenBackRef.java72
-rw-r--r--libjava/gnu/regexp/RETokenChar.java91
-rw-r--r--libjava/gnu/regexp/RETokenEnd.java75
-rw-r--r--libjava/gnu/regexp/RETokenEndSub.java53
-rw-r--r--libjava/gnu/regexp/RETokenLookAhead.java68
-rw-r--r--libjava/gnu/regexp/RETokenOneOf.java130
-rw-r--r--libjava/gnu/regexp/RETokenPOSIX.java144
-rw-r--r--libjava/gnu/regexp/RETokenRange.java69
-rw-r--r--libjava/gnu/regexp/RETokenRepeated.java227
-rw-r--r--libjava/gnu/regexp/RETokenStart.java87
-rw-r--r--libjava/gnu/regexp/RETokenWordBoundary.java104
-rw-r--r--libjava/gnu/regexp/UncheckedRE.java109
-rw-r--r--libjava/javax/swing/plaf/basic/BasicProgressBarUI.java820
-rw-r--r--libjava/javax/swing/plaf/basic/BasicSeparatorUI.java266
-rw-r--r--libjava/javax/swing/plaf/basic/BasicSliderUI.java2213
-rw-r--r--libstdc++-v3/config/allocator/bitmap_allocator_base.h37
-rw-r--r--libstdc++-v3/config/allocator/malloc_allocator_base.h37
-rw-r--r--libstdc++-v3/config/allocator/mt_allocator_base.h37
-rw-r--r--libstdc++-v3/config/allocator/new_allocator_base.h37
-rw-r--r--libstdc++-v3/config/os/bsd/darwin/ctype_base.h77
-rw-r--r--libstdc++-v3/config/os/bsd/darwin/ctype_inline.h95
-rw-r--r--libstdc++-v3/config/os/bsd/darwin/ctype_noninline.h82
-rw-r--r--libstdc++-v3/config/os/bsd/darwin/os_defines.h161
-rw-r--r--libstdc++-v3/docs/html/ext/ballocator_doc.txt374
-rw-r--r--libstdc++-v3/include/bits/c++config2
-rw-r--r--libstdc++-v3/include/c_std/std_cctype.h21
-rw-r--r--libstdc++-v3/include/std/std_fstream.h6
-rw-r--r--libstdc++-v3/libsupc++/eh_alloc.cc8
-rw-r--r--libstdc++-v3/libsupc++/eh_terminate.cc47
-rw-r--r--libstdc++-v3/libsupc++/new_handler.cc16
-rw-r--r--libstdc++-v3/libsupc++/new_op.cc26
-rw-r--r--libstdc++-v3/libsupc++/new_opnt.cc13
-rw-r--r--libstdc++-v3/libsupc++/pure.cc12
-rw-r--r--libstdc++-v3/src/functexcept.cc6
-rw-r--r--libstdc++-v3/src/ios.cc11
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator/14176.cc42
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc67
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc125
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc71
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc125
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc67
-rw-r--r--libstdc++-v3/testsuite/26_numerics/cmath/overloads.cc27
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/13450.cc75
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/pow.cc14
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray_subset_assignment.cc88
-rwxr-xr-xltconfig3
-rw-r--r--ltmain.sh30
-rwxr-xr-xmaintainer-scripts/import-prune24
-rwxr-xr-xmaintainer-scripts/local-summary60
-rwxr-xr-xmaintainer-scripts/local-untested9
-rw-r--r--man-pages/README4
-rw-r--r--man-pages/cpp3.1821
-rw-r--r--man-pages/gcc3.15764
-rw-r--r--man-pages/gcov3.1453
-rw-r--r--more-hdrs/assert.h71
-rw-r--r--more-hdrs/float.h98
-rw-r--r--more-hdrs/inttypes.h308
-rw-r--r--more-hdrs/machine/limits.h11
-rw-r--r--more-hdrs/ppc_intrinsics.h939
-rw-r--r--more-hdrs/stdarg.h6
-rw-r--r--more-hdrs/stdbool.h2
-rw-r--r--more-hdrs/stdint.h203
-rw-r--r--more-hdrs/varargs.h6
-rw-r--r--order-files/HOW TO BUILD170
-rw-r--r--order-files/cc1.order1188
-rw-r--r--order-files/cc1obj.order2163
-rw-r--r--order-files/cc1objplus.order952
-rw-r--r--order-files/cc1plus.order1356
-rw-r--r--pbproj/gcc3.pbproj/dpatel.pbxuser208
-rw-r--r--pbproj/gcc3.pbproj/project.pbxproj191
-rw-r--r--pbproj/gcc3.pbproj/spolk.pbxuser370
-rw-r--r--pbproj/gcc3.pbproj/zlaski.pbxuser225
838 files changed, 90681 insertions, 64724 deletions
diff --git a/CHANGES.Apple b/CHANGES.Apple
new file mode 100644
index 00000000000..96d8c9d1e52
--- /dev/null
+++ b/CHANGES.Apple
@@ -0,0 +1,265 @@
+APPLE LOCAL file maintenance
+
+This files lists all of Apple's local changes, the people responsible
+for them, and their current status.
+
+List owners by email name. Possible statuses:
+ local not accepted/able for FSF GCC, permanently local
+ submit should submit to FSF GCC at some point
+ submitted submitted to FSF GCC, awaiting approval/disapproval
+ accepted in FSF GCC, expected to appear in next import
+ mixed for large patches, parts could go into FSF GCC
+ unknown not known what to do with
+
+Owner Status Name of change
+----- ------ --------------
+shebs local #import not deprecated
+mrs unknown %b/save-temps can clobber input file (radar 2871891)
+dalej unknown 'reg + index' reg case.
+dalej unknown +2 (could be conditionalized)
+dalej unknown , a temporary kludge
+dalej unknown , for now, don't count pseudos
+shebs local -ObjC
+dpatel unknown -Werror
+dpatel unknown -Wextra-tokens
+shebs local -Wfour-char-constants
+dpatel unknown -Wlong-double
+dpatel unknown -Wmost
+shebs unknown -Wnewline-eof
+dpatel local -Wno-#warnings
+zlaski local -Wno-altivec-long-deprecated
+shebs unknown -Wpragma-once
+dpatel local -dependency-file
+austern local -fapple-kext
+shebs unknown -ffppc
+austern unknown -findirect-virtual-calls
+stuart local -fobey-inline
+austern unknown -fterminated-vtables
+dpatel local -header-mapfile
+dpatel local -header-mapfile bandaid for buffer overflows
+shebs local -malign-mac68k
+stuart unknown -mlong-branch
+dalej submit -pg fix
+dpatel local -arch
+austern local 2.95-compatibility stuff
+austern local 2.95-ptmf-compatibility
+dpatel local 2920964
+stuart unknown 8-byte-struct hack
+dalej unknown ?
+shebs unknown Agree with <stdio.h> prototype
+shebs mixed AltiVec
+shebs unknown Altivec related
+shebs local Apple banner
+shebs local Apple version
+shebs submitted C++ EH
+shebs unknown CALL_ON_LOAD/CALL_ON_UNLOAD pragmas
+mrs unknown CALL_ON_MODULE_BIND deprecated
+dalej unknown CCUNS, CCFP, CCEQ patterns
+mrs unknown Constructors return THIS
+mrs unknown EH VALID_FDE_P
+mrs unknown EH runtime
+mrs unknown Enable $ in identifiers in assembly.
+mrs submit FSF candidate
+dalej unknown MEM_OFFSET setting
+zlaski local MW compatibility
+mrs unknown Mach time
+shebs local Macintosh alignment
+shebs submit OS pragma hook
+zlaski submit Objective-C++
+shebs local PPC_INTRINSICS
+zlaski local Pascal strings
+dalej unknown RTX_COST for multiply
+dalej unknown Reduce code size / improve performance
+stuart submit Stripped encodings ('!T_' and '!t_') should match.
+dalej unknown accept hard R12 as target reg
+zlaski submit add + for GNU runtime only
+dalej unknown add mode change case
+mrs unknown alignment
+mrs unknown alloca
+mrs unknown alloca not in std
+austern local apple kext alignment
+austern local apple-kext Radar #2849864
+shebs submit asm flags
+mrs unknown assembly "abort" directive
+dalej unknown avoid out-of-bounds refs
+austern unknown be permissive by default
+dalej unknown better induction variable selection
+zlaski submit bitfield alignment
+zlaski submit bool encoding
+dalej unknown branch cost
+shebs local build machinery
+zlaski submit call super
+stuart unknown callers_lr_already_saved
+austern unknown cc1plus spec
+zlaski unknown check ctype also
+austern unknown coalescing
+dalej unknown code size reduction / performance enhancement
+dalej unknown combine hoisted consts
+dalej unknown compare >= 0, not > 0.
+stuart submit const_data
+zlaski local constant cfstrings
+zlaski submit constant strings
+mrs unknown control opt level.
+austern unknown correct constructor inlining
+shebs local darwin host
+mrs unknown darwin mmap bug workaround
+shebs unknown darwin native
+shebs unknown darwin native (?)
+shebs unknown darwin native, AltiVec
+shebs unknown darwin-specific headers
+shebs unknown darwin_set_section_for_var_p
+dalej unknown dbj
+austern local ddtor double destructor
+shebs local debugging
+mrs unknown declare string functions
+stuart submitted decloning
+stuart submitted decloning structors
+stuart unknown default to ppro
+shebs unknown direct-binding-refs
+shebs accepted disable Dwarf 2 until assembler fixed
+shebs local disable generic AltiVec patterns
+dalej unknown disable strict aliasing; breaks too much existing code.
+dalej unknown disallow (not (SYM))
+dalej unknown div by const
+shebs unknown do not extern fp save/restore
+austern unknown do not forward reference anonymous enum
+dalej unknown do not use float fieldmode
+shebs local documentation
+shebs unknown don't define SAVE_FP_PREFIX and friends
+austern local double destructor
+mrs unknown eh in data segment
+dpatel unknown error-colon
+shebs local fat builds
+shebs local fat builds readability
+mrs unknown fde end extension
+zlaski submit finish file hook
+dalej unknown fix 2857104
+dalej unknown fix 2866661
+zlaski submit fix OBJC codegen
+shebs unknown fix prototypes
+shebs unknown fix redundant add?
+shebs unknown flag translation
+zlaski unknown flag_objc
+dalej unknown for TRUNC_DIV_EXPR
+dalej unknown for now
+mrs submited framework headers
+dalej local fused multiply-add
+mrs unknown gdb only used symbols
+dpatel unknown handle -Wno-system-headers (2910306)
+shebs submit handle ~ in pathnames
+dalej unknown improve performance
+shebs submit include guard for darwin.h
+dalej unknown indirect calls in R12
+stuart local indirect sibcalls
+mrs submit insert assembly ".abort" directive on fatal error
+mrs unknown interrupt signal handler (radar 2941633)
+zlaski submit ivar access
+zlaski local keep tables in sync comment
+mrs unknown keymgr
+austern unknown libcc_kext
+austern unknown libm
+zlaski submit libobjc
+shebs unknown linker flags
+dpatel unknown long double warning
+stuart unknown long-branch
+shebs local maintenance
+shebs unknown make easy_vector_constant globally visible (rs6000-protos.h)
+austern unknown make libstdc++ more fine-grained
+shebs local man pages
+shebs local manual
+zlaski submit method encoding
+shebs unknown more orphaned code
+dalej unknown move '<' case down?
+zlaski submit move is_class_name to stub-objc.c
+dalej unknown move loads out of loops
+zlaski submit move lookup_interface to stub-objc.c
+zlaski submit move lookup_objc_ivar to stub-objc.c
+zlaski submit msg send super
+dalej unknown multiply cost pulled into function
+dalej unknown multiply-add
+zlaski submit mystery binfo
+zlaski submit nested functions
+dpatel submitted new tree dump
+shebs unknown no soft-float multilibs
+stuart local obey inline
+zlaski submit objc bug fix
+zlaski submit objc finish file
+shebs submit objc stret methods
+dalej unknown optimization
+shebs local order files
+mrs unknown parsedir
+shebs unknown pass reload addr by address
+shebs unknown performance enhancement
+shebs unknown performance improvement
+shebs local preprocess .s files
+dalej unknown preserve CR2 for save_world prologues
+austern unknown private extern
+austern unknown private extern Radar 2872481
+zlaski submit protocol qual
+shebs unknown prototypes
+shebs local prune man page
+dalej unknown put this insn after the loop in all cases
+mrs submit radar 2466994 - -no-c++filt
+mrs submit radar 2466994 - pass linker output through c++filt
+dpatel local radar 2866081: Env. variable -O override
+dpatel local radar 2866081: Env. variable override
+mrs unknown radar 2871891 - %b/%B & -save-temps can clobber input file
+dalej unknown recompute PIC register use
+dalej unknown record that float extend is a copy
+dalej unknown reduce code size
+austern unknown reduce emergency buffer size
+dalej submit reenable some lost combines
+shebs unknown remove a stub tweak
+dalej unknown remove invalid delete
+austern unknown remove machopic_output_possible_stub_label
+dalej unknown remove this so combine doesn't generate it
+shebs unknown remove vasprintf prototype
+shebs submit rename for HFS
+shebs local report bugs to Apple
+dalej unknown restoration of inmode/outmode
+dalej unknown rewrite weight computation
+dalej unknown save and restore LR
+dalej unknown separate cl into c,*l; switch and attr's expanded to match
+zlaski unknown separate outputdir
+mrs submit setrlimit
+shebs unknown setting of all callee-saved regs removed
+stuart submit sibcall
+stuart submit sibcall 3007352
+stuart submit sibcall patterns
+shebs unknown size of bool
+dalej unknown special ObjC method use of R12
+shebs unknown static const members
+shebs unknown static structors in __StaticInit section
+stuart submitted structor decloning
+stuart submitted structor thunks
+dalej unknown subtract 1
+shebs local supply missing ctype.h decls
+zlaski submit suppress method inlining
+shebs unknown temporary pragmas
+austern local terminated-vtables
+stuart unknown test for flag_pic deleted deliberately
+shebs unknown testsuite
+shebs local testsuite OS flush bug workaround
+shebs unknown testsuite multiply defined
+stuart unknown thunks
+shebs unknown time formatting
+dalej unknown try destroyed input
+shebs unknown try to improve ggc
+dalej unknown tweak default optimizations
+dpatel unknown unavailable
+dpatel unknown unavailable (Radar 2809697)
+shebs unknown unnecessary test?
+dalej unknown use R12 as register for indirect calls. This improves
+dalej unknown use new pseudo for temp; reusing reg confuses PRE
+dalej unknown use r12 for indirect calls
+dalej unknown volatile pic base reg in leaves
+austern unknown weak definition
+austern unknown weak import
+austern unknown weak_import (Radar 2809704)
+shebs unknown what is this for?
+shebs unknown why is this needed?
+mrs unknown work around Radar 2844245.
+shebs local work around a makeinfo complaint
+shebs unknown world save/restore
+austern unknown write used class statics
+shebs submit zerofill
diff --git a/ChangeLog.apple-ppc b/ChangeLog.apple-ppc
new file mode 100644
index 00000000000..3bce49e15b4
--- /dev/null
+++ b/ChangeLog.apple-ppc
@@ -0,0 +1,24 @@
+2004-05-06 Mike Stump <mrs@apple.com>
+
+ * build_gcc: Fix manual page name for g++.1.
+
+2004-04-29 Robert Bowdidge <bowdidge@apple.com>
+
+ Radar 3628023
+ * build_gcc: correctly lipo gcov
+
+2004-04-29 Devang Patel <dpatel@apple.com>
+
+ Merge lno-branch as of 2004:04:18 00:00 into
+ apple-ppc-branch.
+
+2004-04-22 Devang Patel <dpatel@apple.com>
+
+ Radar 3401402 and 3511029
+ * build_gcc: Add support to build darwin driver.
+
+2004-04-21 Robert Bowdidge <bowdidge@apple.com>
+
+ * build_gcc: Add --disable-libmudflap to the list of options to
+ configure. Option needed to keep gcc building on recent internal
+ builds of the OS. [Radar 3630321]
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 00000000000..ce0b8336ef0
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,88 @@
+# APPLE LOCAL file build machinery
+# Apple GCC Compiler Makefile for use by buildit.
+#
+# This makefile is intended only for use with B&I buildit. For "normal"
+# builds use the conventional FSF top-level makefile.
+#
+# You can specify TARGETS=ppc (or i386) on the buildit command line to
+# limit the build to just one target. The default is for ppc and i386.
+# The compiler targetted at this host gets built anyway, but not installed
+# unless it's listed in TARGETS.
+
+# Include the set of standard Apple makefile definitions.
+ifndef CoreOSMakefiles
+CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
+endif
+include $(CoreOSMakefiles)/Standard/Standard.make
+
+# Enable Apple extensions to (gnu)make.
+USE_APPLE_PB_SUPPORT = all
+
+HOSTS = ppc i386 # `arch`
+targets = echo $${TARGETS:-'ppc i386'}
+TARGETS := $(shell $(targets))
+
+RC_ARCHS = $(HOSTS)
+
+SRCROOT = .
+
+SRC = `cd $(SRCROOT) && pwd | sed s,/private,,`
+OBJROOT = $(SRC)/obj
+SYMROOT = $(OBJROOT)/../sym
+DSTROOT = $(OBJROOT)/../dst
+
+PREFIX = /usr
+
+#######################################################################
+
+install: $(OBJROOT) $(SYMROOT) $(DSTROOT)
+ cd $(OBJROOT) && \
+ $(SRC)/build_gcc "$(RC_ARCHS)" "$(TARGETS)" \
+ $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT)
+
+# installhdrs does nothing, because the headers aren't useful until
+# the compiler is installed.
+installhdrs:
+
+# We build and install in one shell script.
+build:
+
+installsrc:
+ @echo
+ @echo ++++++++++++++++++++++
+ @echo + Installing sources +
+ @echo ++++++++++++++++++++++
+ @echo
+ if [ $(SRCROOT) != . ]; then \
+ $(PAX) -rw . $(SRCROOT); \
+ fi
+ find -d "$(SRCROOT)" \( -type d -a -name CVS -o \
+ -type f -a -name .DS_Store -o \
+ -name \*~ -o -name .\#\* \) \
+ -exec rm -rf {} \;
+
+#######################################################################
+
+clean:
+ @echo
+ @echo ++++++++++++
+ @echo + Cleaning +
+ @echo ++++++++++++
+ @echo
+ @if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \
+ echo '*** DELETING ' $(OBJROOT); \
+ rm -rf $(OBJROOT); \
+ fi
+ @if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \
+ echo '*** DELETING ' $(SYMROOT); \
+ rm -rf $(SYMROOT); \
+ fi
+ @if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \
+ echo '*** DELETING ' $(DSTROOT); \
+ rm -rf $(DSTROOT); \
+ fi
+
+#######################################################################
+
+$(OBJROOT) $(SYMROOT) $(DSTROOT):
+ mkdir -p $@
diff --git a/README.Apple b/README.Apple
new file mode 100644
index 00000000000..c0d5abadd4c
--- /dev/null
+++ b/README.Apple
@@ -0,0 +1,463 @@
+APPLE LOCAL file documentation
+
+This file describes Apple's version of GCC 3.x modified for Darwin /
+Mac OS X. Although Apple's stated policy is to contribute all of its
+GCC work to the FSF GCC mainstream, at any given moment there will be
+changes that are permanently unacceptable for FSF GCC, in need of
+rework before acceptance, or that we simply aren't ready to send in.
+This version of GCC contains all those changes.
+
+In keeping with provision 2a of the GPL, each Apple change is marked
+with a comment saying "APPLE LOCAL", followed by optional words "begin",
+"end", or "file", followed by a short phrase describing the change
+generally ("AltiVec" for instance, if the change is related to AltiVec
+support), followed by an optional date in the form yyyy-mm-dd,
+optionally followed by the initials or email address of the person
+making the change. The words "begin" and "end" indicate that the
+comments delimit a multi-line change, while the word "file" indicates
+that the entire file is an Apple addition. Additional explanatory
+comments should be in a separate comment.
+
+You may also isolate Apple's changes by diffing with the FSF mainline
+sources as of the date mentioned in gcc/version.c; this date is
+updated in the FSF repository daily, and is preserved when we import
+FSF sources into Apple's repository (the tag for the imported source
+is "fsf-cvs").
+
+The primary purpose of this version of GCC is to be the main system
+compiler for Darwin and Mac OS X. However, since additions such as
+PFE precompiled headers and Objective-C++ are of interest on other
+platforms, we have generally conditionalized Mac-specific code so that
+the compiler will build and run elsewhere. You may however run into
+mistakes; please let us know about them and we will
+fix these if possible.
+
+NOTE! It's best to assume that this code has been updated from FSF
+development sources recently, and has received very little testing
+before being imported. There is a good chance that your favorite
+program will not compile or run when compiled with this program. The
+version of the compiler that ships with OS X is the standard for
+correctness; any time something works with that compiler but fails
+with this one is probably a bug, and should be reported to
+darwin-development@lists.apple.com.
+
+PREREQUISITES
+
+Presumably if you're reading this, you've figured out how to get the
+sources. :-) But just to be complete, these sources are available from
+the Darwin repository at opensource.apple.com, CVS module "gcc3". See
+http://www.opensource.apple.com/tools/cvs if this isn't enough info
+yet.
+
+If you want C++ exception handling to work, you will need a modified
+crt1.o. (crt1.o is the bit of code that sets up for execution and
+calls your program's main().) The modified crt1.o is standard in 10.2,
+but 10.1, you will need to set it up yourself.
+
+If you can't get a modified crt1.o from somebody else, you can patch a
+copy of the sources to the "Csu" project and build it yourself. The
+patch is included in this directory, as "csu-patch". The build is
+easy, just say "make" in the Csu directory, and then copy the crt1.o
+to /usr/lib/crt1.o (as usual, it's prudent to keep around a copy of
+the original crt1.o, just in case). You will need to have built the
+"cctools" project as well, in order to get the helper tool "indr"
+(which is expected to be installed as /usr/local/bin/indr).
+
+BUILDING, THE APPLE WAY
+
+To build things the Apple way, just say (in the source directory)
+
+ mkdir -p build/obj build/dst build/sym
+ gnumake install RC_OS=macos RC_ARCHS=ppc TARGETS=ppc \
+ SRCROOT=`pwd` OBJROOT=`pwd`/build/obj \
+ DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym
+
+This will configure and then do a full bootstrap build, with all the
+results going into the subdirectory build/ that you created. The
+final results will be in the "dest root" directory build/dst, in the
+form of an image of the installed directory structure. The drivers
+and other user-visible tools have a "3" suffixed, so for instance the
+driver is /usr/bin/gcc3, and the demangler is /usr/bin/c++filt3.
+
+To install the results, become root and do
+
+ ditto build/dst /
+
+Various knobs and switches are available, but even so, the Apple
+makefile machinery is mainly designed for mass builds of all the
+projects that make up Darwin and/or Mac OS X, and is thus not as
+flexible as the standard GCC build process.
+
+To build for i386 Darwin, set TARGETS=i386. To build fat, set
+RC_ARCHS='i386 ppc' TARGETS='i386 ppc'. Note that you must have a
+complete set of fat libraries and i386-targeting cctools for this
+all to work.
+
+You can set the four *ROOT variables to point anywhere, but they must
+always be absolute pathnames.
+
+This way of building may or may not work on non-Macs, and if it
+doesn't, you're on your own.
+
+BUILDING, THE FSF WAY
+
+In general, standard GCC procedures work for building this version.
+We recommend that you build in a separate objdir; create a sibling
+to the toplevel source dir, call it whatever you want, cd into it,
+and say "../gcc3/configure". This way you can have more than one
+build using the same set of sources.
+
+If you insist on building in the source directory using "./configure",
+the GNUmakefile that supports the Apple build process (see above) will
+shadow your makefile, and you will need to override this behavior by
+saying "make -f Makefile" (or by moving GNUmakefile out of the way).
+
+For instance:
+
+ mkdir darwin
+ cd darwin
+ ../gcc3/configure --prefix=/tmp/testplace
+ make bootstrap
+ make install
+
+does a full build, plus two generations of self-compilation for
+GCC proper, then an install.
+
+To avoid building every language, use --enable-languages argument to
+configure. For instance, '--enable-languages=objc,c++,objc++' skips
+the Fortran and Java compilers. (The C compiler will always be
+built.)
+
+To build an x86 cross-compiler, add "--target=i386-darwin" to the
+configure line. The x86 compiler works, but to make it useful you
+will need libraries and such from x86 Darwin.
+
+There is a ProjectBuilder (PB) project also, but at the moment it's
+only useful for browsing. We expect to make it useful for building
+eventually. To keep it out of the way until then, it's in
+"pbproj/gcc3.pbproj".
+
+Tools built the FSF way are *not* usually going to be dropin
+replacements for already-installed tools built the Apple way, because
+search paths and other details will be different.
+
+TESTING
+
+This package includes a copy of the test framework of DejaGNU, for
+convenience in running GCC's testsuite. If you've done a make
+from the top, DejaGNU will have been built already; otherwise at
+the top of the objdir say "make all-dejagnu".
+
+Once the DejaGNU is available, you can cd into the gcc objdir and type
+"make check" to run all the tests. This will take several hours. You
+can do things like "make check-gcc" just to run C tests, or "make
+check-g77" for Fortran tests, which take less time.
+
+USING
+
+While this compiler can be used with 10.1, it is aimed at 10.2
+(Jaguar) and later releases. Built correctly, using the "Apple way",
+it can be a dropin replacement for the 10.2 system compiler.
+
+* Compatibility Issues
+
+This section lists areas where this compiler behaves differently
+from other versions of GCC.
+
+Built-in functions are not automatically declared
+
+GCC knows about some functions, such as memcpy, so it can generate
+better code for them. However, 2.95.2 let C++ programs refer to them
+without ever declaring them. The current C++ compiler now does the
+right thing by requiring you to declare all functions.
+
+alloca is a built-in function
+
+Normally only __builtin_alloca is a built-in function, and user
+code #defines alloca as __builtin_alloca. This version of GCC
+also recognizes alloca as built-in, and compiles it into a single
+stack adjustment.
+
+va_arg cannot take chars, shorts, or floats
+
+You can no longer pass "char", "short", or "float" as the second
+argument to va_arg() when using varargs.
+
+#pragma once is silently accepted
+
+GCC handles #pragma once correctly, but the standard compiler warns
+that the pragma is obsolete. This version of GCC is silent by
+default. Use -Wpragma-once to see the warnings again.
+
+#import is silently accepted
+
+GCC handles #import correctly, but the standard compiler warns that
+the directive is obsolete. This version of GCC is silent by default.
+Use -Wimport to see the warnings again.
+
+Extra tokens after #endif and friends are silently accepted
+
+Standard GCC now warns about extra tokens after #endif and other
+preprocessor directives. This version of GCC is silent by default.
+Use -Wextra-tokens to see these warnings.
+
+Files with missing newlines are silently accepted
+
+Standard GCC warns about files that do not end with a newline.
+This seems to be common in Apple headers and sources, so this
+version does not warn. Use -Wnewline-eof to see these warnings.
+
+-fpermissive by default
+
+The C++ compiler is normally strict about adherence to the language
+standard, but the -fpermissive flag is available to convert many
+errors into warnings. Apple's compiler is set to be permissive
+by default. This is temporary as of 1/27/02.
+
+GNU stddef.h not installed
+
+If built the Apple way, GCC's stddef.h is installed as "gnu-stddef.h",
+and so by default you will get the /usr/include/stddef.h that comes
+with Darwin.
+
+libobjc not built
+
+Since GNU libobjc and its headers would mask the system library
+and headers, this version of GCC does not build or install them
+if targeting Darwin.
+
+Objective-C structure returns
+
+When using the NeXT runtime, methods returning structures will work,
+while they will fail when using FSF GCC.
+
+All assembly files are preprocessed
+
+FSF GCC only runs the C preprocessor on files with extension .S, and
+does not run it on files ending in .s. Apple GCC runs the
+preprocessor on .s files also.
+
+Bug reporting address different
+
+If the compiler gets an internal error, it will ask you to report the
+error to Apple, rather than to the FSF.
+
+* Extensions
+
+This section briefly describes Apple's extensions to GCC. Further
+details may be found in the GCC manual (usually).
+
+__APPLE_CC__
+
+The preprocessor symbol __APPLE_CC__ identifies a specific "build
+number" of the compiler. These numbers are finer-grained than the
+generic GCC version numbers, and for gcc3 they range from 1000 up
+(2.95.2 versions are in the 900s).
+
+Framework includes
+
+Headers may be found by pathname in the usual way, or as part of
+"frameworks" which are assemblages of library/headers/resources. For
+instance, #include <IOKit/IOTypes.h> will be found as
+/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h. The
+-F<pathname> adds <pathname> as a place to search for frameworks; by
+default, the compiler will look in /System/Library/Frameworks,
+/Library/Frameworks, and /Local/Library/Frameworks.
+
+Frameworks may also have subframeworks, and the framework include
+machinery will find headers in subframeworks if the outer framework
+(known as an "umbrella framework) is being included.
+
+Objective-C++
+
+Objective-C++ is C++ extended to understand Objective-C constructs.
+The two object models are separate and "mutually oblivious", so C++
+code generally works unchanged, as well as Objective-C code that
+conforms to C++ restrictions (similar to the restrictions placed on
+plain C code by C++). Objective-C++ files must have the extension .mm
+or .M (but note that .M will conflict with .m files on HFS
+filesystems, so .mm is preferred).
+
+Pascal strings
+
+The flag -fpascal-strings enables the use of "\p" to designate a
+length byte, originally used for C-Pascal interoperation on Macs, but
+now mostly a human-appendix-like compatibility option.
+
+Macintosh alignment
+
+The options -malign-mac68k, -malign-power, and -malign-natural are
+available to control whether the alignment of structure fields
+follows 68K, PowerPC, or "natural" rules. These options are
+useful to applications which need to be binary-compatible with
+very old Mac applications, libraries, or resources. The "natural"
+alignment mode may be useful to applications whose performance is
+sensitive to misaligned data accesses.
+
+In addition, #pragma options align=<option> is available, where
+<option> may be mac68k, native, natural, packed, power, or reset.
+(native == power on a PowerPC.) The pragma effectively pushes the
+alignment onto a stack, while align=reset pops the alignment, thus
+allowing nested pragmas to work. #pragma pack is also available and
+works with the same stack.
+
+private extern symbols
+
+You can declare symbols as "private extern", which means that they
+behave as extern until linking, then they are made private, and are
+not visible outside the library. To declare something as private
+extern, add "__private_extern__" where you might normally say
+"extern".
+
+Coalescing
+
+Using "-fcoalesce", "-fcoalesce-templates" and "-fweak-coalesced"
+flags can reduce the amount of duplicated code. Coalescing and C++
+template coalescing are enabled by default, at least if a
+recent-enough cctools version (10.2 or later) has been installed.
+
+-dynamiclib
+
+You can build shared libraries (aka dylibs) by using -dynamiclib.
+This invokes libtool (not to be confused with GNU libtool) instead of
+ld. See the libtool man page for more detail on options that can be
+passed to libtool.
+
+Linker flags
+
+This version of GCC understands the plethora of linker-related flags,
+such as -framework, -flat_namespace, etc. The functionality should be
+the same as for 2.95.2 and as documented in the linker man page; any
+discrepancies are probably bugs.
+
+AltiVec
+
+The complete AltiVec programming interface, as defined in the PIM, is
+available. Use -faltivec to enable it.
+
+Note that the PIM, section 2.1 mentions that AltiVec data types using
+the 'long' keyword (i.e., vector [un]signed long) are deprecated and
+that the 'int' should be used. The compiler will thus issue a warning
+for these cases. The warning may be suppressed by specifying
+-Wno-altivec-long-deprecated.
+
+-mdynamic-no-pic
+
+The option -mdynamic-no-pic generates code that make references to
+PIC, but is not itself position-independent and thus more efficient.
+This option is suitable for applications but not dylibs.
+
+unavailable attribute
+
+The attribute "unavailable" is available :-) to declare that a
+symbol is not available.
+
+weak_import attribute
+
+The attribute weak_import is available to declare that a symbol
+should be designated as a weak reference.
+
+CALL_ON_LOAD and CALL_ON_UNLOAD pragmas
+
+The pragmas CALL_ON_LOAD and CALL_ON_UNLOAD allow you to declare
+that a given name is the name of a function to be called when
+a module is loaded or unloaded by the system.
+
+IOKit support
+
+There are a number of changes to support the building of IOKit drivers.
+
+The option -findirect-virtual-calls forces all virtual calls to go
+through the vtable, while the option -fterminated-vtables adds a null
+termination to vtables. -fapple-kext turns on all of these, plus any
+future options that may be needed to compile kexts.
+
+There is a library libcc_kext.a that is libgcc.a compiled static and
+including only routines that are allowed in the kernel.
+
+The PowerPC-only option -mlong-branch is available to generate full
+32-bit jumps, since kexts may not be loaded at addresses close to the
+kernel.
+
+Dependency file names
+
+When you use -MD to output dependencies, you can also use
+-dependency-file <name> to write the dependencies into the file named
+<name>. (By default, they go into <inputfilename>.d .)
+
+Fat builds
+
+You can compile for a specific target type by using -arch <archname>.
+Multiple -arch options also work, and result in "fat binaries". -arch
+works with -c, -precomp (to make fat precomps), but not -S or
+-save-temps.
+
+At present, only "i386" and "ppc" may be used as architecture names.
+Note that building for a specific arch will only work if you have
+assembler and libraries for that arch.
+
+-ObjC, -ObjC++
+
+These options set the default language to be Objective-C and
+Objective-C++, respectively. Note that this behavior is slightly
+different from the -x options, because -x affects only the files
+appearing after it on the command line, while -ObjC and -ObjC++ affect
+all input files. Nevertheless, -x is standard and thus preferable.
+(-fobjc works and is equivalent to -ObjC, but it's even more
+deprecated.)
+
+-Wmost
+
+The option -Wmost is equivalent to -Wall -Wno-parentheses. It is
+present for compatibility with some existing Mac OS X projects.
+
+-Wno-#warnings
+
+The option -Wno-#warnings suppresses warnings issued by #warning.
+
+-Wno-altivec-long-deprecated
+
+The option -Wno-altivec-long-deprecated suppresses warnings about
+'int' being preferred to 'long' in AltiVec vector types.
+
+-Werror suppression
+
+The environment variable QA_DISABLE_WERROR, if set (to any value),
+disables the effect of -Werror on the command line; warnings will
+not result in an error.
+
+PB indexing
+
+If the environment variable PB_INDEX_SOCKET_PORT is defined, then the
+compiler will output PB indexing information to that port. The option
+-fdebug-gen-index will do the same port, but sending the information
+to standard output, for debugging indexing.
+
+Header mapfiles
+
+This is the support for a PB feature where actual pathnames for
+headers come from a given file rather than being searched for in the
+various include paths. It's not useful outside of the PB environment.
+
+QA_OVERRIDE_GCC3_OPTIONS environment variable
+
+Allows overriding, adding, or changing options sent to toplev.c. This
+allows you, for example, to override the -O setting that the driver
+sends to the command line. Documentation is in toplev.c.
+
+* Miscellaneous Issues
+
+GCC uses a syntax for rlwinm instructions that is only supported
+by the assembler in 10.1 or later. If you need to run 10.0, and
+can't build cctools-364, then you can try to dig up the workaround;
+versions of gcc3 before December 2001 have it, look for references
+to rlwinm in gcc/config/rs6000/rs6000.md.
+
+TO DO
+
+This section lists specific features that we're still working on.
+
+Make fat building work when the compiler is built the FSF way.
+
+Implement floating point precision control (-ffppc) for i386.
+
diff --git a/build_gcc b/build_gcc
new file mode 100755
index 00000000000..1d7394f72d4
--- /dev/null
+++ b/build_gcc
@@ -0,0 +1,375 @@
+#!/bin/sh
+# APPLE LOCAL file B&I
+
+set -x
+
+# -arch arguments are different than configure arguments. We need to
+# translate them.
+
+TRANSLATE_ARCH="sed -e s/ppc/powerpc/ -e s/i386/i686/"
+
+# Build GCC the "Apple way".
+# Parameters:
+
+# The first parameter is a space-separated list of the architectures
+# the compilers will run on. For instance, "ppc i386". If the
+# current machine isn't in the list, it will (effectively) be added.
+HOSTS=`echo $1 | $TRANSLATE_ARCH `
+
+# The second parameter is a space-separated list of the architectures the
+# compilers will generate code for. If the current machine isn't in
+# the list, a compiler for it will get built anyway, but won't be
+# installed.
+TARGETS=`echo $2 | $TRANSLATE_ARCH`
+
+# The GNU makefile target ('bootstrap' by default).
+BOOTSTRAP=${BOOTSTRAP-bootstrap}
+
+# The B&I build srcript (~rc/bin/buildit) accepts an '-othercflags'
+# command-line flag, and captures the argument to that flag in
+# $RC_NONARCH_CFLAGS (and mysteriously prepends '-pipe' thereto).
+# We will allow this to override the default $CFLAGS and $CXXFLAGS.
+
+CFLAGS=${RC_NONARCH_CFLAGS/-pipe/}
+CFLAGS=${CFLAGS:-"-g -O2"}
+
+# This isn't a parameter; it is the architecture of the current machine.
+BUILD=`arch | $TRANSLATE_ARCH`
+
+# The third parameter is the path to the compiler sources. There should
+# be a shell script named 'configure' in this directory. This script
+# makes a copy...
+ORIG_SRC_DIR="$3"
+
+# The fourth parameter is the location where the compiler will be installed,
+# normally "/usr". You can move it once it's built, so this mostly controls
+# the layout of $DEST_DIR.
+DEST_ROOT="$4"
+
+# The fifth parameter is the place where the compiler will be copied once
+# it's built.
+DEST_DIR="$5"
+
+# The sixth parameter is a directory in which to place information (like
+# unstripped executables and generated source files) helpful in debugging
+# the resulting compiler.
+SYM_DIR="$6"
+
+# The current working directory is where the build will happen.
+# It may already contain a partial result of an interrupted build,
+# in which case this script will continue where it left off.
+DIR=`pwd`
+
+# This isn't a parameter; it's the version of the compiler that we're
+# about to build. It's included in the names of various files and
+# directories in the installed image.
+VERS=`sed -n -e '/version_string/s/.*\"\([^ \"]*\)[ \"].*/\1/p' \
+ < $ORIG_SRC_DIR/gcc/version.c || exit 1`
+
+# This isn't a parameter either, it's the major version of the compiler
+# to be built. It's VERS but only up to the second '.' (if there is one).
+MAJ_VERS=`echo $VERS | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/'`
+
+########################################
+# Run the build.
+
+# Create the source tree we'll actually use to build, deleting
+# tcl since it doesn't actually build properly in a cross environment
+# and we don't really need it.
+SRC_DIR=$DIR/src
+rm -rf $SRC_DIR || exit 1
+mkdir $SRC_DIR || exit 1
+ln -s $ORIG_SRC_DIR/* $SRC_DIR/ || exit 1
+rm -rf $SRC_DIR/tcl $SRC_DIR/expect $SRC_DIR/dejagnu || exit 1
+
+# These are the configure and build flags that are used.
+CONFIGFLAGS="--disable-checking \
+ --prefix=$DEST_ROOT \
+ --disable-libmudflap \
+ --mandir=\${prefix}/share/man \
+ --enable-languages=c,objc,c++ --disable-libada \
+ --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \
+ --with-gxx-include-dir=\${prefix}/include/gcc/darwin/$MAJ_VERS/c++ \
+ --build=$BUILD-apple-darwin"
+
+# Figure out how many make processes to run.
+SYSCTL=`sysctl -n hw.activecpu`
+
+# hw.activecpu only available in 10.2.6 and later
+if [ -z "$SYSCTL" ]; then
+ SYSCTL=`sysctl -n hw.ncpu`
+fi
+
+# sysctl -n hw.* does not work when invoked via B&I chroot /BuildRoot.
+# Builders can default to 2, since even if they are single processor,
+# nothing else is running on the machine.
+if [ -z "$SYSCTL" ]; then
+ SYSCTL=2
+fi
+
+# The $LOCAL_MAKEFLAGS variable can be used to override $MAKEFLAGS.
+MAKEFLAGS=${LOCAL_MAKEFLAGS-"-j $SYSCTL"}
+
+# Build the native GCC. Do this even if the user didn't ask for it
+# because it'll be needed for the bootstrap.
+mkdir -p $DIR/obj-$BUILD-$BUILD $DIR/dst-$BUILD-$BUILD || exit 1
+cd $DIR/obj-$BUILD-$BUILD || exit 1
+if [ \! -f $DIR/$BUILD-configured ] ; then
+ $SRC_DIR/configure $CONFIGFLAGS \
+ --host=$BUILD-apple-darwin --target=$BUILD-apple-darwin || exit 1
+ touch $DIR/$BUILD-configured || exit 1
+fi
+make $MAKEFLAGS $BOOTSTRAP CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
+ CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+
+# Add the compiler we just built to the path, giving it appropriate names.
+D=$DIR/dst-$BUILD-$BUILD/usr/bin
+ln -f $D/gcc-$MAJ_VERS $D/gcc || exit 1
+ln -f $D/gcc $D/$BUILD-apple-darwin-gcc || exit 1
+PATH=$DIR/dst-$BUILD-$BUILD/usr/bin:$PATH
+
+# The cross-tools' build process expects to find certain programs
+# under names like 'i386-apple-darwin-ar'; so make them.
+# Annoyingly, ranlib changes behaviour depending on what you call it,
+# so we have to use a shell script for indirection, grrr.
+rm -rf $DIR/bin || exit 1
+mkdir $DIR/bin || exit 1
+for prog in ar nm ranlib ; do
+ for t in `echo $TARGETS $HOSTS | sort -u`; do
+ P=$DIR/bin/${t}-apple-darwin-${prog}
+ echo '#!/bin/sh' > $P || exit 1
+ echo 'exec /usr/bin/'${prog}' $*' >> $P || exit 1
+ chmod a+x $P || exit 1
+ done
+done
+PATH=$DIR/bin:$PATH
+
+# Build the cross-compilers, using the compiler we just built.
+for t in $TARGETS ; do
+ if [ $t != $BUILD ] ; then
+ mkdir -p $DIR/obj-$BUILD-$t $DIR/dst-$BUILD-$t || exit 1
+ cd $DIR/obj-$BUILD-$t || exit 1
+ $SRC_DIR/configure $CONFIGFLAGS \
+ --program-prefix=$t-apple-darwin- \
+ --host=$BUILD-apple-darwin --target=$t-apple-darwin || exit 1
+ make $MAKEFLAGS all CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+ make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$t install-gcc install-target \
+ CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+
+ # Add the compiler we just built to the path.
+ PATH=$DIR/dst-$BUILD-$t/usr/bin:$PATH
+ fi
+done
+
+# Rearrange various libraries, for no really good reason.
+for t in $TARGETS ; do
+ DT=$DIR/dst-$BUILD-$t
+ D=`echo $DT/usr/lib/gcc/$t-apple-darwin/$VERS`
+ if [ $t == $BUILD ] ; then
+ mv $DT/usr/lib/libstdc++.a $D || exit 1
+ mv $DT/usr/lib/libsupc++.a $D || exit 1
+ else
+ DD=$DT/usr/${t}-apple-darwin/lib
+ mv $DD/libstdc++.a $D || exit 1
+ mv $DD/libsupc++.a $D || exit 1
+ fi
+ mv $D/static/libgcc.a $D/libgcc_static.a || exit 1
+ mv $D/kext/libgcc.a $D/libcc_kext.a || exit 1
+ rm -r $D/static $D/kext || exit 1
+done
+
+# Build the cross-hosted compilers.
+for h in $HOSTS ; do
+ if [ $h != $BUILD ] ; then
+ for t in $TARGETS ; do
+ mkdir -p $DIR/obj-$h-$t $DIR/dst-$h-$t || exit 1
+ cd $DIR/obj-$h-$t || exit 1
+ if [ $h = $t ] ; then
+ pp=
+ else
+ pp=$t-apple-darwin-
+ fi
+
+ $SRC_DIR/configure $CONFIGFLAGS \
+ --program-prefix=$pp \
+ --host=$h-apple-darwin --target=$t-apple-darwin || exit 1
+ make $MAKEFLAGS all-gcc CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+ make $MAKEFLAGS DESTDIR=$DIR/dst-$h-$t install-gcc \
+ CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+ done
+ fi
+done
+
+########################################
+# Construct the actual destination root, by copying stuff from
+# $DIR/dst-* to $DEST_DIR, with occasional 'lipo' commands.
+
+cd $DEST_DIR || exit 1
+
+# Clean out DEST_DIR in case -noclean was passed to buildit.
+rm -rf * || exit 1
+
+# HTML documentation
+HTMLDIR=/Developer/Documentation/DeveloperTools
+mkdir -p .$HTMLDIR || exit 1
+cp -rp $DIR/obj-$BUILD-$BUILD/gcc/doc/HTML/* .$HTMLDIR/ || exit 1
+
+# Manual pages
+mkdir -p .$DEST_ROOT/share || exit 1
+cp -rp $DIR/dst-$BUILD-$BUILD$DEST_ROOT/share/man .$DEST_ROOT/share/ \
+ || exit 1
+
+# libexec
+LIBEXEC_FILES=` \
+ ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/libexec/gcc/$BUILD-apple-darwin/$VERS \
+ | grep -v install-tools || exit 1`
+for t in $TARGETS ; do
+ DL=$DEST_ROOT/libexec/gcc/$t-apple-darwin/$VERS
+ mkdir -p .$DL || exit 1
+ for f in $LIBEXEC_FILES ; do
+ lipo -output .$DL/$f -create $DIR/dst-*-$t$DL/$f || exit 1
+ done
+done
+
+# bin
+# The native drivers ('native' is different in different architectures).
+BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \
+ | grep -v gccbug | grep -v gcov || exit 1`
+mkdir .$DEST_ROOT/bin
+for f in $BIN_FILES ; do
+ lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1
+done
+# gcov, which is special only because it gets built multiple times and lipo
+# will complain if we try to add two architectures into the same output.
+TARG0=`echo $TARGETS | cut -d ' ' -f 1`
+lipo -output .$DEST_ROOT/bin/gcov-$MAJ_VERS -create \
+ $DIR/dst-*-$TARG0$DEST_ROOT/bin/*gcov* || exit 1
+# The fully-named drivers, which have the same target on every host.
+for t in $TARGETS ; do
+ lipo -output .$DEST_ROOT/bin/$t-apple-darwin-gcc-$VERS -create \
+ $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin-gcc-$MAJ_VERS || exit 1
+ lipo -output .$DEST_ROOT/bin/$t-apple-darwin-g++-$VERS -create \
+ $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin-g++-$MAJ_VERS || exit 1
+done
+
+# lib
+mkdir -p .$DEST_ROOT/lib/gcc || exit 1
+for t in $TARGETS ; do
+ cp -rp $DIR/dst-$BUILD-$t$DEST_ROOT/lib/gcc/$t-apple-darwin \
+ .$DEST_ROOT/lib/gcc || exit 1
+done
+SHARED_LIBS=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/lib | grep '\.dylib$'`
+for l in $SHARED_LIBS ; do
+ F=$DIR/dst-$BUILD-$BUILD$DEST_ROOT/lib/$l
+ if [ \! -L $F ] ; then
+ if [ -f $DIR/dst-$BUILD-*$DEST_ROOT/*-apple-darwin/lib/$l ] ; then
+ lipo -output .$DEST_ROOT/lib/$l -create $F \
+ $DIR/dst-$BUILD-*$DEST_ROOT/*-apple-darwin/lib/$l || exit 1
+ else
+ cp -p $F .$DEST_ROOT/lib/$l || exit 1
+ fi
+ F1=`echo $l \
+ | sed 's/\(\.[0-9]\{1,\}\)\(\.[0-9]\{1,\}\)\{1,\}\.dylib/\1.dylib/'`
+ F0=`echo $l | sed 's/\(\.[0-9]\{1,\}\)\{1,\}\.dylib/.dylib/'`
+ ln -s $l .$DEST_ROOT/lib/$F1 || exit 1
+ for t in $TARGETS ; do
+ ln -s ../../../$F1 .$DEST_ROOT/lib/gcc/$t-apple-darwin/$VERS/$F0 \
+ || exit 1
+ done
+ fi
+done
+
+# FIXME
+# This is a workaround for gcc_select, pending approval of a patch that
+# makes it unnecessary. Radar 3538294.
+mkdir -p .$DEST_ROOT/libexec/gcc/darwin/ppc/$MAJ_VERS
+mkdir -p .$DEST_ROOT/lib/gcc/darwin/$MAJ_VERS
+
+# include
+HEADERPATH=$DEST_ROOT/include/gcc/darwin/$MAJ_VERS
+mkdir -p .$HEADERPATH || exit 1
+cp -rp $DIR/dst-$BUILD-$BUILD$HEADERPATH/c++ \
+ .$HEADERPATH/ || exit 1
+for t in $TARGETS ; do
+ DS=$HEADERPATH/c++
+ [ $t = $BUILD ] || \
+ cp -rp $DIR/dst-$BUILD-$t$DS/$t-apple-darwin .$DS/ || exit 1
+done
+
+# Some headers are installed from more-hdrs/. They all share
+# one common feature: they shouldn't be installed here. Sometimes,
+# they should be part of FSF GCC and installed from there; sometimes,
+# they should be installed by some completely different package; sometimes,
+# they only exist for codewarrior compatibility and codewarrior should provide
+# its own.
+cd $SRC_DIR/more-hdrs
+for h in `echo [^C]*` ; do
+ cp -r $h $DEST_DIR$HEADERPATH/$h || exit 1
+ for t in $TARGETS ; do
+ THEADERPATH=$DEST_DIR$DEST_ROOT/lib/gcc/${t}-apple-darwin/$VERS/include
+ [ -f $THEADERPATH/$h ] || \
+ ln -s ../../../../../include/gcc/darwin/$MAJ_VERS/$h $THEADERPATH/$h || \
+ exit 1
+ done
+done
+
+# Build driver-driver using fully-named drivers
+for t in $TARGETS ; do
+ $DEST_DIR$DEST_ROOT/bin/$t-apple-darwin-gcc-$VERS \
+ $ORIG_SRC_DIR/gcc/config/darwin-driver.c \
+ -DPDN="\"-apple-darwin-gcc-$VERS\"" \
+ -DIL="\"$DEST_ROOT/bin/\"" -I $ORIG_SRC_DIR/include \
+ -I $ORIG_SRC_DIR/gcc -I $ORIG_SRC_DIR/gcc/config \
+ -liberty -L$DIR/dst-$BUILD-$t$DEST_ROOT/lib/ \
+ -L$DIR/dst-$BUILD-$t$DEST_ROOT/$t-apple-darwin/lib/ \
+ -o $DEST_DIR/$DEST_ROOT/bin/tmp-$t-gcc-$MAJ_VERS || exit 1
+
+ $DEST_DIR$DEST_ROOT/bin/$t-apple-darwin-gcc-$VERS \
+ $ORIG_SRC_DIR/gcc/config/darwin-driver.c \
+ -DPDN="\"-apple-darwin-g++-$VERS\"" \
+ -DIL="\"$DEST_ROOT/bin/\"" -I $ORIG_SRC_DIR/include \
+ -I $ORIG_SRC_DIR/gcc -I $ORIG_SRC_DIR/gcc/config \
+ -liberty -L$DIR/dst-$BUILD-$t$DEST_ROOT/lib/ \
+ -L$DIR/dst-$BUILD-$t$DEST_ROOT/$t-apple-darwin/lib/ \
+ -o $DEST_DIR/$DEST_ROOT/bin/tmp-$t-g++-$MAJ_VERS || exit 1
+done
+
+lipo -output $DEST_DIR/$DEST_ROOT/bin/gcc-$MAJ_VERS -create \
+ $DEST_DIR/$DEST_ROOT/bin/tmp-*-gcc-$MAJ_VERS || exit 1
+
+lipo -output $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS -create \
+ $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
+
+ln -f $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS $DEST_DIR/$DEST_ROOT/bin/c++-$MAJ_VERS || exit 1
+
+rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-gcc-$MAJ_VERS || exit 1
+rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
+
+
+########################################
+# Save the source files and objects needed for debugging
+
+cd $SYM_DIR || exit 1
+
+# Clean out SYM_DIR in case -noclean was passed to buildit.
+rm -rf * || exit 1
+
+# Save executables and libraries.
+cd $DEST_DIR || exit 1
+find . \( -perm -0111 -or -name \*.a \) -type f -print \
+ | cpio -pdml $SYM_DIR || exit 1
+# Save source files.
+mkdir $SYM_DIR/src || exit 1
+cd $DIR || exit 1
+find obj-* -name \*.\[chy\] -print | cpio -pdml $SYM_DIR/src || exit 1
+
+########################################
+# Strip the executables and libraries
+find $DEST_DIR -perm -0111 \! -name \*.dylib -type f -print \
+ | xargs strip || exit 1
+find $DEST_DIR \( -name \*.a -or -name \*.dylib \) -type f -print \
+ | xargs strip -SX || exit 1
+
+# Done!
+exit 0
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 821b5f849e6..e97a86358e1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+/* APPLE LOCAL IN FSF 2004-04-27 */
+2004-04-28 Stuart Hastings <stuart@apple.com>
+
+ * config/rs6000/rs6000.c (macho_branch_islands): Fix sprintf arguments.
+ * config/rs6000/rs6000.md (output_call): Fix arguments.
+
+2004-04-27 Geoffrey Keating <geoffk@apple.com>
+
+ * config/darwin.h (STARTFILE_SPEC): Use %s to find crt2.o.
+ * config/darwin-crt2.c: Only have contents on __ppc__.
+
2004-03-18 Mark Mitchell <mark@codesourcery.com>
* c-decl.c (grokdeclarator): Do not complain about redeclaring
diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc
new file mode 100644
index 00000000000..2ecf3989aa9
--- /dev/null
+++ b/gcc/ChangeLog.apple-ppc
@@ -0,0 +1,464 @@
+2004-05-06 Caroline Tice <ctice@apple.com
+
+ * config/rs6000/rs6000.c (rs6000_override_options): Modify to
+ not turn on hot/cold partitioning in the presence of exception
+ handling.
+
+2004-05-06 Dale Johannesen <dalej@apple.com>
+
+ * Merge from lno branch as of 04-24. Files changed:
+ lambda-code.c
+ lambda.h
+ tree-chrec.c
+ tree-chrec.h
+ tree-data-ref.c
+ tree-elim-check.c
+ tree-flow.h
+ tree-loop-linear.c
+ tree-scalar-evolution.c
+ tree-ssa-loop-im.c
+ tree-ssa-loop-ivopts.c
+ tree-ssa-loop-manip.c
+ tree-ssa-loop.c
+ tree-vectorizer.c
+ tree-vectorizer.h
+
+2004-05-04 Caroline Tice <ctice@apple.com>
+
+ * config/rs6000/darwin.h (FP_SAVE_INLINE): Modify this to
+ always be 1 ("on") if the optimization level is -O3 or
+ higher.
+
+2004-04-30 Dale Johannesen <dalej@apple.com>
+
+ * cse.c (cse_insn): Don't add REG_EQUAL note for
+ (CONST (MINUS (LABEL_REF) (0))).
+
+2004-04-30 Caroline Tice <ctice@apple.com>
+
+ * varasm.c (unlikely_section_label): New global variable.
+ (unlikely_text_section): Change variable name from
+ 'unlikely_section_name' to 'unlikely_section_label', make it a global
+ variable, and move the code to generate its value to
+ assemble_start_function.
+ (assemble_start_function): Add code to generate *correct* value for
+ 'unlikely_section_label'. Now makes use of value from 'fnname'
+ parameter.
+
+2004-04-29 Devang Patel <dpatel@apple.com>
+
+ gcc/loop-iv.c : Merge from lno-branch as of 2004:04:19 00:00.
+ gcc/tree-pass.h : Merge from lno-branch as of 2004:04:19 00:00.
+ gcc/tree-ssa-alias.c : Merge from lno-branch as of 2004:04:19 00:00.
+ gcc/tree-ssa-phiopt.c : Merge from lno-branch as of 2004:04:19 00:00.
+
+2004-04-29 Devang Patel <dpatel@apple.com>
+
+ Merge lno-branch as of 2004:04:18 00:00 into
+ apple-ppc-branch.
+
+
+2004-04-28 Fariborz Jahanian <fjahanian@apple.com>
+
+ * function.c (assign_parms): Add 2nd iteration over vector args
+ if needed.
+ * calls.c (initialize_argument_information): Add new argument,
+ add 2nd iteration over vector arguments if needed.
+ * target-def.h (default_skip_vec_args, TARGET_SKIP_VEC_ARGS): New.
+ * target.h (skip_vec_args): Added to calls structure.
+ * targhooks.c (default_skip_vec_args): Default
+ definition.
+ * targhooks.h (default_skip_vec_args): Declaration.
+ * config/rs6000/rs6000.c (skip_vec_args): New definition.
+
+2004-04-27 Devang Patel <dpatel@apple.com>
+
+ * config/darwin.h (LINK_COMMAND_SPEC): Use darwin_arch_ld_spec.
+ * config/rs6000/darwin.h (DARWIN_ARCH_ASM_SPEC): New.
+ (DARWIN_ARCH_SPEC): Rename as...
+ (DARWIN_ARCH_LD_SPEC): New name.
+ * config/i386/darwin.h (DARWIN_ARCH_ASM_SPEC): New.
+ (DARWIN_ARCH_SPEC): Rename as...
+ (DARWIN_ARCH_LD_SPEC): New name.
+
+2004-04-26 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * configure.ac: Add test for -Wno-long-double.
+ * Makefile.in (STRICT2_WARN): Add -Wno-long-double.
+ (alloc-pool.o-warn): Delete.
+ (ggc-page.o-warn): Delete.
+ * configure: Regenerate.
+
+2004-04-23 Dale Johannesen <dalej@apple.com>
+
+ Radars 3480058, 3178986
+
+ * c-decl.c (merge_decls): Preserve duplicate_decl bit.
+ (merge_translation_unit_decls): Rewritten so -fno-common works.
+ * opts.c (decode_options): Turn on flag_no_common with -fast or -fastcp.
+ * tree.h (struct tree_decl): Add duplicate_decl bit and DECL_DUPLICATE_DECL.
+ * varasm.c (assemble_variable): Use it.
+ * config/rs6000/rs6000.c (rs6000_override_options): Remove
+ reorder-blocks-and-partition from -fast*. Enable align-natural with -fastcp.
+ * ../libstdc++-v3/include/std/std_fstream.h (basic_ifstream): Make
+ _M_filebuf 8-byte aligned.
+ (basic_ofstream): Ditto.
+
+2004-04-22 Devang Patel <dpatel@apple.com>
+
+ Radar 3401402 and 3511029
+
+ Remove FAT Build support from gcc.c
+
+ * gcc.c (struct arch_config_out): Remove.
+ (struct arch_out): Remove.
+ (num_arches, curent_arch, final_output): Remove.
+ (set_new_arch): Remove.
+ (%T support): Remove.
+ (%f support): Remove.
+ (%F support): Remove.
+ ('@' support in specs): Remove.
+ (ofile_merge_spec): Remove.
+ (exec_merge_spec): Remove.
+ (build_search_list): Remove fat builds readibility change.
+ (SWITCH_IGNORE_RESTORE): Remove.
+ (-arch support): Remove.
+ * config/darwin.h (LINK_COMMAND_SPEC): Remove -arch*. Add %(darwin_arch_spec).
+ * confiig/i386/darwin.h (ASM_SPEC): Add %(darwin_arch_spec).
+ (DARWIN_ARCH_SPEC): New.
+ * confiig/rs6000/darwin.h (ASM_SPEC): Add %(darwin_arch_spec).
+ (DARWIN_ARCH_SPEC): New.
+ * config/rs6000/rs6000.h (SUBTARGET_EXTRA_SPECS): Surround it with #ifndef.
+ * config/darwin-driver.c: New file.
+
+2004-04-20 Geoffrey Keating <geoffk@apple.com>
+
+ * c-cppbuiltin.c (define__GNUC__): Better precision and more
+ error checking for code defining __APPLE_CC__.
+ * testsuite/gcc.apple/applecc.c: New.
+
+2004-04-15 Devang Patel <dpatel@apple.com>
+
+ * config/i386.h: Add static tree nodes for vector types to
+ accomodate tree.h changes due to local Altivec patch.
+
+2004-04-15 Caroline Tice <ctice@apple.com>
+
+ Fix various problems related to hot/cold partitioning (but not all of
+ them yet).
+ * bb-reorder.c (tm_p.h): Add new include statement.
+ (HAVE_return): Define HAVE_return appropriately if not already defined.
+ (find_rarely_executed_basic_blocks_and_crossing_edges): Modify to
+ only mark crossing edges if architecture supports named sections.
+ (fix_crossing_conditional_branches): Add test for HAVE_return before
+ calling gen_return.
+ (fix_crossing_unconditional_branches): Change VOIDmode to Pmode in call
+ to gen_rtl_LABEL_REF.
+ (fix_edges_for_rarely_executed_code): Only "fix" branches and add
+ REG_CROSSING_JUMP notes if the architecture supports named sections.
+ (reorder_basic_blocks): Change (* targetm.cannot_modify_jumps_p ())
+ into (targetm.cannot_modify_jumps_p ()). Modify to only add
+ NOTE_INSN_UNLIKELY_EXECUTED_CODE notes if the architecture supports
+ named sections.
+ * cfglayout.c (fixup_reorder_chain): Modify code that adds
+ NOTE_INSN_UNLIKELY_EXECUTED_CODE and REG_CROSSING_JUMP notes, to only
+ do so if architecture supports named sections.
+ * cfgrtl.c (target.h): Add new include statement.
+ (force_nonfallthru_and_redirect): Modify code that adds
+ NOTE_INSN_UNLIKELY_EXECUTED_CODE and REG_CROSSING_JUMP notes, to only
+ do so if architecture supports named sections.
+ (commit_one_edge_insertion): Likewise.
+ * dbxout.c (dbxout_source_file): Fix bug, when writing out source
+ location debug information, to not change to the wrong section.
+ * defaults.h (NORMAL_TEXT_SECTION_NAME): Remove this definition.
+ (SECTION_FORMAT_STRING): Remove this definition.
+ * final.c (final_scan_insn): Remove unnecessary in_unlikely_text_section
+ test from if statement. Modify code that switches sections to not
+ do so if architecture does not support named sections. Cleaned up
+ if statement.
+ * ifcvt.c (if_convert): Modified test that disables optimization when
+ partitioning, to not disable it if the architecture does not support
+ named sections.
+ * passes.c (rest_of_compilation): Removed flag_exceptions test from
+ code that calls partitioning, as this is already taken care of
+ in decode_options.
+ * predict.c (choose_function_section): Modify to NOT choose hot or
+ cold sections for the function decl if we are doing partitioning
+ optimization (want to leave it up to the hot/cold partitioning
+ optimization, which is more fine-grained).
+ * varasm.c (text_section): Restore code that outputs assembly for
+ the text section to its original code.
+ (unlikely_text_section): Modify to always use named_section for
+ writing out section directive, remove unnecessary ifdef, and
+ use ASM_OUTPUT_LABEL for labelling the start of the
+ cold section.
+ (in_unlikely_text_section): Modify to deal correctly with being in
+ a named section.
+ (function_section): Restore code for generating section directives
+ to its original order.
+ * config/darwin.c (darwin_asm_named_section): Restore code that
+ generates section directive to its original state.
+ * config/i386/darwin.h (ASM_OUTPUT_ALIGN): Add in_unlikely_text_section ()
+ to an if test that tests for in_text_section ().
+ * config/rs6000/darwin.h (NORMAL_TEXT_SECTION_NAME): Remove definition.
+ (SECTION_FORMAT_STRING): Remove definition.
+
+2004-04-10 Paolo Bonzini <bonzini@gnu.org>
+ Richard Henderson <rth@redhat.com>
+
+ PR target/14899
+
+ * c-common.c (vector_types_compatible_p): New function.
+ * c-typeck.c (comptypes): Recurse on vector types,
+ treat a non-opaque type as equivalent to an opaque type.
+ (convert_for_assignment): Use vector_types_compatible_p.
+ (digest_init): Use vector_types_compatible_p to check
+ validness of constant vector initializers; otherwise treat
+ them as scalars
+ * tree.c (make_or_reuse_type): New.
+ (build_common_tree_nodes): Use it.
+ * cp/call.c (standard_conversion): Likewise.
+ * cp/typeck.c (comptypes): Recurse on vector types, do not
+ treat a non-opaque type as equivalent to an opaque type.
+ (convert_for_assignment): Use vector_types_compatible_p.
+
+2004-04-13 Fariborz Jahanian <fjahanian@apple.com>
+
+ * combine.c (combine_instructions):
+ Try insn with each REG_EQUAL note it links back to.
+ (unmentioned_reg_p_1, unmentioned_reg_p): New functions.
+ Brought from tree-ssa branch.
+
+2004-04-09 Dale Johannesen <dalej@apple.com>
+
+ Roll in gcc-1552 enhancement for separate stack temps.
+ Turn on -fstrict-aliasing with -fast.
+ * function.c (assign_stack_local_with_alias): New function.
+ * rtl.h (assign_stack_local_with_alias): Declare it.
+ * config/rs6000/rs6000.c (rs6000_override_options): Turn on strict
+ aliasing with -fast.
+ * config/rs6000/rs6000.md (floatsidf2): Use
+ assign_stack_local_with_alias.
+ (floatunssidf2): Ditto.
+ (fix_truncdfsi2): Ditto.
+
+2004-04-07 Fariborz Jahanian <fjahanian@apple.com>
+
+ Roll in Ziem Laski's Altivec front-end fixes to
+ support MOTOROLA's Altivec syntax.
+ * Makefile.in: Add c-lex.o dependencies.
+ * c-common.c (vector_constructor_from_expr): New function.
+ * c-common.h (vector_constructor_from_expr): Add declaration.
+ * c-lex.c: include target.h, cpphash.h. Add lexer support
+ for new syntax.
+ (c_lex_prepend): new function. (c_lex_peek): new function.
+ * c-pragma.h: add (c_lex_peek, c_lex_prepend) declarations.
+
+2004-04-06 Dale Johannesen <dalej@apple.com>
+
+ Roll in Zdenek Dvorak's rewrite of doloop optimization.
+ * Makefile.in: add loop-doloop.*, remove doloop.*
+ * loop-doloop.c: New.
+ * doloop.c: Remove.
+ * cfgloop.h: Add new function declarations.
+ * cfgloopanal.c: Add get_loop_level.
+ * loop-iv.c: Recognize unexecuted loops.
+ * loop.c: Remove call to old doloop optimization.
+ * loop.h: Remove LOOP_BCT.
+ * passes.c: Ditto. Call new doloop optimization.
+ * config/rs6000/rs6000-protos.h: Remove duplicate declarations.
+ * config/rs6000/rs6000.c: Cosmetic cleanups. Add -freorder-blocks
+ to -fast.
+
+2004-04-02 Ziemowit Laski <zlaski@apple.com>
+
+ Remove APPLE LOCAL AltiVec code whenever possible; merge in
+ AltiVec/VECTOR_TYPE-handling code from mainline.
+
+2004-04-01 Fariborz Jahanian <fjahanian@apple.com>
+
+ * Makefile.in: add $(PARAMS_H) $(TM_P_H) dependencies
+ for sched-rgn.o.
+ * params.def: add definitions for
+ max-sched-region-blocks and max-sched-region-insns.
+ * sched-rgn.c (too_large): change return type to bool.
+ Use the parametrized values of max-sched-region-blocks,
+ max-sched-region-insns for computing upper limits for
+ interblock scheduling.
+ * doc/invoke.texi: Document max-sched-region-blocks,
+ max-sched-region-insns.
+
+2004-04-01 Caroline Tice <ctice@apple.com>
+
+ * basic-block.h (struct edge_def): Add new field, crossing_edge.
+ (struct basic_block_def): Add new field, partition.
+ (UNPARTITIONED, HOT_PARTITION, COLD_PARTITION): New constant macro
+ definitions.
+ (partition_hot_cold_basic_blocks): Add extern function
+ declaration.
+ * bb-reorder.c (function.h, obstack.h, expr.h, regs.h): Add four new
+ include statements.
+ (N_ROUNDS): Increase the maximum number of rounds by 1.
+ (branch_threshold): Add array value for new round.
+ (exec_threshold): Add array value for new round.
+ (push_to_next_round_p): New function.
+ (add_unlikely_executed_notes): New function.
+ (find_rarely_executed_basic_blocks_and_crossing_edges): New function.
+ (mark_bb_for_unlikely_executed_section): New function.
+ (add_labels_and_missing_jumps): New function.
+ (add_reg_crossing_jump_notes): New function.
+ (fix_up_fall_thru_edges): New function.
+ (find_jump_block): New function.
+ (fix_crossing_conditional_branches): New function.
+ (fix_crossing_unconditional_branches): New function.
+ (fix_edges_for_rarely_executed_code): New function.
+ (partition_hot_cold_basic_blocks): New function.
+ (find_traces): Add an extra round for partitioning hot/cold
+ basic blocks.
+ (find_traces_1_round): Add a parameter. Modify to push all cold blocks,
+ and only cold blocks, into the last (extra) round of collecting traces.
+ (better_edge_p): Add a parameter. Modify to favor non-crossing edges
+ over crossing edges.
+ (bb_to_key): Add code to correctly identify cold blocks when
+ doing partitioning.
+ (connect_traces): Modify to connect all the non-cold traces first, then
+ go back and connect up all the cold traces.
+ (reorder_basic_blocks): Add call to add_unlikely_executed_notes.
+ * cfg.c (entry_exit_blocks): Add initialization for partition field in
+ entry and exit blocks.
+ * cfgbuild.c (make_edges): Update current_function_has_computed_jump
+ if we are doing hot/cold partitioning.
+ * cfgcleanup.c (cfglayout.h): Add new include statement.
+ (try_simplify_condjump): Modify to not attempt on blocks with jumps
+ that cross section boundaries.
+ (try_forward_edges): Likewise.
+ (merge_blocks_move_predecessor_nojumps): Likewise.
+ (merge_blocks_move_successor_nojumps): Likewise.
+ (merge_blocks_move): Likewise.
+ (try_crossjump_to_edge): Modify to not attempt after we have done
+ the block partitioning.
+ (try_crossjump_bb): Modify to not attempt on blocks with jumps that
+ cross section boundaries.
+ (try_optimize_cfg): Likewise.
+ * cfghooks.c (tidy_fallthru_edges): Modify to not remove indirect
+ jumps that cross section boundaries.
+ * cfglayout.c (flags.h): Add new include statement.
+ (update_unlikely_executed_notes): New function.
+ (fixup_reorder_chain): Add code so when a new jumping basic block is
+ added, it's UNLIKELY_EXECUTED_CODE and REG_CROSSING_JUMP notes are
+ updated appropriately.
+ (duplicate_insn_chain): Add code to duplicate the new NOTE insn
+ introduced by this optimization.
+ * cfglayout.h (scan_ahead_for_unlikely_executed_note): Add new
+ extern function declaration.
+ * cfgrtl.c (can_delete_note_p): Add NOTE_INSN_UNLIKELY_EXECUTED_CODE to
+ list of notes that can be deleted.
+ (create_basic_block_structure): Add initialization for partition field.
+ (rtl_can_merge_blocks): Modify to test blocks for jumps that cross
+ section boundaries.
+ (try_redirect_by_replacing_jump): Modify to not attempt on jumps that
+ cross section boundaries.
+ (commit_one_edge_insertion): Add code so newly created basic block
+ ends up in correct (hot or cold) section. Modify to disallow
+ insertions before NOTE_INSN_UNLIKELY_EXECUTED_CODE notes.
+ (rtl_verify_flow_info_1): Add code to verify that no fall_thru edge
+ crosses section boundaries.
+ (cfg_layout_can_merge_blocks_p): Modify to test blocks for jumps that
+ cross section boundaries.
+ (force_nonfallthru_and_redirect): Modify to make sure new basic block
+ ends up in correct section, with correct notes attached.
+ * common.opt (freorder-blocks-and-partition): Add new flag for this
+ optimization.
+ * dbxout.c (dbx_function_end): Add code to make sure scope labels at
+ the end of functions are written into the correct (hot or cold)
+ section.
+ (dbx_source_file): Add code so writing debug file information
+ doesn't incorrectly change sections.
+ * defaults.h (NORMAL_TEXT_SECTION_NAME): New constant macro, for use
+ in partitioning hot/cold basic blocks into separate sections.
+ (SECTION_FORMAT_STRING): New constant macro, for linux/i386 hot/cold
+ section partitioning.
+ (HAS_LONG_COND_BRANCH): New constant macro, indicating whether or not
+ conditional branches can span all of memory.
+ (HAS_LONG_UNCOND_BRANCH): New constant macro, indicationg whether or not
+ unconditional branches can span all of memory.
+ * final.c (scan_ahead_for_unlikely_executed_note): New function.
+ (final_scan_insn): Add code to check for NOTE instruction indicating
+ whether basic block belongs in hot or cold section, and to make sure
+ the current basic block is being written to the appropriate section.
+ Also added code to ensure that jump table basic blocks end up in the
+ correct section.
+ * flags.h (flag_reorder_blocks_and_partition): New flag.
+ * ifcvt.c (find_if_case_1): Modify to not attempt if conversion if
+ one of the branches has a jump that crosses between sections.
+ (find_if_case_2): Likewise.
+ (ifcvt): Modify to not attempt to mark loop exit edges after
+ hot/cold partitioning has occurred.
+ * opts.c (decode_options): Code to handle new flag,
+ flag_reorder_blocks_and_partition; also to turn it off if
+ flag_exceptions is on.
+ (common_handle_option): Code to handle new flag,
+ flag_reorder_blocks_and_partition.
+ * output.h (unlikely_text_section): New extern function declaration.
+ (in_unlikely_text_section): New extern function declaration.
+ * passes.c (rest_of_handle_stack_regs): Add
+ flag_reorder_blocks_and_partition as an 'or' condition for calling
+ reorder_basic_blocks.
+ (rest_of_handle_reorder_blocks): Add flag_reorder_blocks_and_partition
+ as an 'or' condition for calling reorder_basic_blocks.
+ (rest_of_compilation): Add call to partition_hot_cold_basic_blocks.
+ * print-rtl.c (print_rtx): Add code for handling new note,
+ NOTE_INSN_UNLIKELY_EXECUTED_CODE
+ * rtl.c (NOTE_INSN_UNLIKELY_EXECUTED_CODE): New note insn (see below).
+ (REG_CROSSING_JUMP): New kind of reg_note, to mark jumps that
+ cross between section boundaries.
+ * rtl.h (NOTE_INSN_UNLIKELY_EXECUTED_CODE): New note instruction,
+ indicating the basic block containing it belongs in the cold section.
+ (REG_CROSSING_JUMP): New type of reg_note, to mark jumps that cross
+ between hot and cold sections.
+ * toplev.c (flag_reorder_blocks_and_partition): Add code to
+ initialize this flag, and to tie it to the command-line option
+ freorder-blocks-and-partition.
+ * varasm.c (cfglayout.h): Add new include statement.
+ (unlikely_section_label_printed): New global variable, used for
+ determining when to output section name labels for cold sections.
+ (in_section): Add in_unlikely_executed_text to enum data structure.
+ (text_section): Modify code to use SECTION_FORMAT_STRING and
+ NORMAL_TEXT_SECTION_NAME macros.
+ (unlikely_text_section): New function.
+ (in_unlikely_text_section): New function.
+ (function_section): Add code to make sure beginning of function is
+ written into correct section (hot or cold).
+ (assemble_start_function): Add code to make sure stuff is written to
+ the correct section.
+ (assemble_zeros): Add in_unlikely_text_section as an 'or' condition
+ to an if statement that was checking 'in_text_section'.
+ (assemble_variable): Add 'in_unlikely_text_section' as an 'or'
+ condition to an if statement that was checking 'in_text_section'.
+ (default_section_type_flags_1): Add check: if in cold section
+ flags = SECTION_CODE.
+ * config/darwin.c (darwin_asm_named_section): Modify to use
+ SECTION_FORMAT_STRING if we are partitioning hot/cold blocks.
+ * config/i386/i386.h (HAS_LONG_COND_BRANCH): Defined this macro
+ specifically for the i386.
+ (HAS_LONG_UNCOND_BRANCH): Defined this macro specifically for the i386.
+ * config/rs6000/darwin.h (UNLIKELY_EXECUTED_TEXT_SECTION_NAME): Change
+ text string to something more informative.
+ (NORMAL_TEXT_SECTION_NAME): Add new definition.
+ (SECTION_FORMAT_STRING): Add new definition.
+ * config/rs6000/rs6000.c (rs6000_assemble_integer): Add
+ '!in_unlikely_text_section' as an 'and' condition to an if statement
+ that was already checking '!in_text_section'.
+ (rs6000_override_options): Turn on flag_reorder_blocks_and_partition
+ with "-fast".
+ * config/rs6000/sysv4.h (HOT_TEXT_SECTION_NAME,NORMAL_TEXT_SECTION_NAME,
+ UNLIKELY_EXECUTED_TEXT_SECTION_NAME,SECTION_FORMAT_STRING): Make
+ sure these are properly defined for linux on ppc.
+ * doc/invoke.texi (freorder-blocks-and-partition): Add documentation
+ for this new flag.
+ * doc/rtl.texi (REG_CROSSING_JUMP): Add documentation for new
+ reg_note.
+ * doc/tm.texi (NORMAL_TEXT_SECTION_NAME, SECTION_FORMAT_STRING,
+ HAS_LONG_COND_BRANCH, HAS_LONG_UNCOND_BRANCH): Add documentation for
+ these new macros.
+
diff --git a/gcc/ChangeLog.lno b/gcc/ChangeLog.lno
new file mode 100644
index 00000000000..93d59c8ae42
--- /dev/null
+++ b/gcc/ChangeLog.lno
@@ -0,0 +1,2010 @@
+2004-04-16 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ Merge from tree-ssa branch:
+
+ 2004-03-25 Diego Novillo <dnovillo@redhat.com>
+ * tree-ssa-alias.c (struct alias_info): Change type of field
+ 'num_references' to varray_type. Update all users.
+
+2004-04-15 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-into-ssa.c (struct mark_def_sites_global_data): Change type of
+ names_to_rename to sbitmap.
+ (insert_phi_nodes_for, insert_phi_nodes_1, insert_phi_nodes):
+ Allocate worklist globally.
+ (ssa_mark_def_sites_initialize_block, ssa_mark_phi_uses,
+ ssa_mark_def_sites, ssa_rewrite_initialize_block,
+ ssa_rewrite_phi_arguments, ssa_rewrite_stmt, rewrite_ssa_into_ssa):
+ Use sbitmaps instead of bitmaps.
+
+2004-04-15 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * tree-scalar-evolution.c (instantiate_parameters): Don't keep
+ symbols after instantiation. Fully instantiate parameters,
+ or fail on chrec_top.
+
+2004-04-15 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * tree-fold-const.h (chrec_merge_types): Move it...
+ * tree-chrec.c (multiply_int, divide_int, add_int, substract_int,
+ integer_divides_p, lcm, gcd, update_initial_condition_to_origin,
+ remove_initial_condition, ): Removed.
+ (evolution_function_in_loop_num): Renamed into
+ hide_evolution_in_other_loops_than_loop.
+ (hide_evolution_in_loop, hide_evolution_in_other_loops_than_loop): New.
+ (chrec_merge_types): ... here.
+ (chrec_merge): Answer chrec_top on EXPONENTIAL_CHREC.
+ (ziv_subscript_p, siv_subscript_p, analyze_ziv_subscript,
+ analyze_siv_subscript, analyze_siv_subscript_cst_affine,
+ analyze_siv_subscript_affine_cst, analyze_siv_subscript_affine_affine,
+ chrec_steps_divide_constant_p, analyze_miv_subscript,
+ analyze_overlapping_iterations): Moved from here...
+ * tree-chrec.h (evolution_function_in_loop_num): Rename declaration.
+ (hide_evolution_in_other_loops_than_loop, hide_evolution_in_loop): New.
+ (analyze_overlapping_iterations): No longer extern.
+
+ * tree-data-ref.c (ziv_subscript_p, siv_subscript_p,
+ analyze_ziv_subscript,
+ analyze_siv_subscript, analyze_siv_subscript_cst_affine,
+ analyze_siv_subscript_affine_cst, analyze_siv_subscript_affine_affine,
+ chrec_steps_divide_constant_p, analyze_miv_subscript,
+ analyze_overlapping_iterations): ... there.
+ (initialize_data_dependence_relation,
+ access_functions_are_affine_or_constant_p): Moved down.
+ (compute_all_dependences): Moved down. Now is static.
+ (build_classic_dir_vector): New.
+ (build_classic_dist_vector):
+ (find_data_references): Renamed find_data_references_in_loop.
+ Now is static.
+ (compute_data_dependences_for_loop): New.
+ (analyze_all_data_dependences): Use compute_data_dependences_for_loop.
+ * tree-data-ref.h (dd_info_available): Don't declare it extern.
+
+ * tree-scalar-evolution.c (dd_info_available): Declare static.
+ (select_outer_and_current_evolutions): Removed.
+ (stats_*): Move the static variables in the chrec_stats structure.
+ (chrec_stats): New structure.
+ (first_iteration_non_satisfying_1): In the multivariate case,
+ don't forget that the outer loops can change the number of iterations.
+ (cannot_analyze_loop_nb_iterations_yet): Removed.
+ (follow_ssa_edge_inner_loop_phi): Refine the case where the
+ evolution of the inner loop is symbolic.
+ (number_of_iterations_in_loop): Factor the end of the cases.
+
+ * tree-dg.c (classic_dist, classic_dir): Declared static.
+ (dg_delete_graph): Delete the classic_dist and classic_dir.
+ (dg_create_graph): Adapt to use compute_data_dependences_for_loop.
+ (gate_ddg, gate_delete_ddg, pass_ddg, pass_delete_ddg): Moved in
+ tree-scalar-evolution.c.
+ * tree-dg.h (dg_create_graph): Pass in struct loops.
+
+2004-04-15 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-data-ref.h (struct data_reference): New field "aux".
+ * tree-vectorizer.h (aligned_access_p, unknown_alignment_for_access_p):
+ New functions.
+ (DR_MISLAIGNMENT): New macro, for accessing the new 'aux' field in
+ data_reference.
+ * tree-vectorizer.c: (vect_analyze_data_refs_alignment): New function.
+ (vect_compute_data_refs_alignment): New function.
+ (vect_compute_data_ref_alignment): New function.
+ (vect_enhance_data_refs_alignment): New function.
+ (vect_force_dr_alignment_p): New function.
+ (vect_align_data_ref): Use new functions aligned_access_p and
+ vect_force_dr_alignment_p.
+ (vect_analyze_data_ref_access): Alignment related checks moved to new
+ functions that deal with alignment.
+ (vect_analyze_data_refs): Likewise.
+ (vect_analyze_loop): Call vect_analyze_data_refs_alignment.
+
+2004-04-15 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * loop-invariant.c (may_assign_reg_p): Prevent unused parameter
+ warning.
+ * tree-ssa-loop-manip.c (find_use_block, find_use_blocks,
+ defined_inside_loop_p): Removed.
+ (add_exit_phis_var, add_exit_phis, rewrite_into_loop_closed_ssa):
+ Make more efficient.
+ (find_uses_to_rename_use, find_uses_to_rename_stmt,
+ find_uses_to_rename): New functions.
+
+2004-04-15 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-flow.h (compute_global_livein): Declare.
+ * tree-into-ssa.c (struct def_blocks_d): New field
+ phi_blocks.
+ (compute_global_livein): Export.
+ (set_def_block): Record phi_blocks.
+ (get_def_blocks_for): Allocate phi_blocks.
+ (mark_def_sites): Changed due to set_def_block change.
+ (ssa_mark_def_sites_initialize_block, ssa_mark_def_sites):
+ Make virtual defs be kills.
+ (insert_phi_nodes_for): Handle old phi nodes more efficiently.
+ (def_blocks_free): XFREE the bitmaps.
+ * tree-ssa-loop-manip.c (add_exit_phis_use, add_exit_phis_stmt):
+ Removed.
+ (get_loops_exits): Return bitmap.
+ (add_exit_phis_var, find_use_block, find_use_blocks,
+ defined_inside_loop_p): New functions.
+ (add_exit_phis): Use add_exit_phis_var.
+ (rewrite_into_loop_closed_ssa): Reorganize.
+ * tree-ssa-loop.c (pass_loop): Add garbage collection.
+
+2004-04-14 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-chrec.c (chrec_convert): Handle extending correctly.
+ * tree-scalar-evolution.c (set_scev_keep_symbolic): Removed.
+ (set_scalar_evolution): Do not use it.
+ (get_scalar_evolution): Only handle ssa names and constants.
+ (interpret_loop_phi): When interpreting subloop, compute the
+ evolution in outer loop afterwards.
+ (analyze_scalar_evolution_in_loop): New.
+ * tree-scalar-evolution.h (analyze_scalar_evolution_in_loop): Declare.
+ * tree-ssa-loop-ivopts.c: Include tree-fold-const.h, tree-chrec.h
+ and tree-scalar-evolution.h.
+ (tree_ssa_iv_optimize_init): Call scev_initialize.
+ (determine_biv_step, find_bivs, mark_bivs,
+ find_givs_in_stmt): Use scev analyzer.
+ (find_givs_in_stmt_scev): New function.
+ (find_induction_variables): Remove TODO comment.
+ (force_var_cost): Test for TREE_INVARIANT, not for
+ is_gimple_min_invariant.
+ (find_optimal_iv_set): Update comment.
+ (tree_ssa_iv_optimize_finalize): Call scev_finalize.
+
+2004-04-13 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa.c (raise_value): Removed.
+ (get_eq_name, check_phi_redundancy): New.
+ (kill_redundant_phi_nodes): Use standard algorithm.
+
+2004-04-12 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-manip.c (allocate_new_names): Use duplicate_ssa_name.
+ Preserve SSA_NAME_OCCURS_IN_ABNORMAL_PHI flag.
+
+2004-04-10 Daniel Berlin <dberlin@dberlin.org>
+
+ * lambda-code.c (lambda_loopnest_transform): Add comments.
+
+2004-04-09 David Edelsohn <edelsohn@gnu.org>
+
+ Backport from mainline:
+ * config/rs6000/t-linux64 (bispecs): Don't add -mlong-double-128 for
+ 32-bit builds when defaulting to 32-bit.
+
+2004-04-09 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * loop-iv.c (iv_number_of_iterations): Sign extend the constant value
+ appropriately for the target mode.
+ * tree-fold-const.c (tree_fold_gcd): Make more efficient.
+ * tree-ssa-loop-manip.c (add_exit_phis_use): Do not add unnecessary
+ phis.
+ (rewrite_into_loop_closed_ssa): Fix comment.
+
+2004-04-09 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * cfgrtl.c (purge_dead_edges): Clean the EDGE_ABNORMAL_CALL flags.
+ * loop-iv.c (iv_number_of_iterations): Handle the case when we prove
+ that the loop does not roll.
+ * opts.c (decode_options): Enable -floop-optimize2 and
+ -ftree-loop-optimize by default.
+ * tree-cfg.c (factored_computed_goto_label,
+ factored_computed_goto): Removed.
+ (factor_computed_gotos): Do not record them.
+ (disband_implicit_edges): Do not unfactor computed jumps.
+ * tree-ssa-loop-ivopts.c (force_gimple_operand): Give correct types
+ to temporary variables.
+ (idx_force_simple, create_iv, rewrite_use_nonlinear_expr,
+ rewrite_use_address, rewrite_use_compare, rewrite_use_outer):
+ Changed due to force_gimple_operand change.
+ (find_bivs): Handle ill-typed assignments correctly.
+
+2004-04-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * passes.c (rest_of_compilation): Enable rest_of_handle_loop2 by
+ flag_loop_optimize2.
+ * tree-scalar-evolution.c (scev_initialize): Find loop exits.
+
+2004-04-02 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (rewrite_use_outer): Do not remove ssa names
+ prematurely.
+
+2004-04-01 Mostafa Hagog <mustafa@il.ibm.com>
+ Dorit Naishlos <dorit@il.ibm.com>
+
+ * config/rs6000/rs6000.md ("*ctrsi_internal1", "*ctrsi_internal2",
+ "*ctrdi_internal1", "*ctrdi_internal2", "*ctrsi_internal3",
+ "*ctrsi_internal4", "*ctrdi_internal3", "*ctrdi_internal4",
+ "*ctrsi_internal5", "*ctrsi_internal6", "*ctrdi_internal5",
+ "*ctrdi_internal6"): Replace register_operand with nonimmediate_operand
+
+2004-03-31 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-into-ssa.c (ssa_rewrite_initialize_block): Update
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
+ (ssa_rewrite_phi_arguments): Ditto.
+ * tree-ssa.c (kill_redundant_phi_nodes): Prevent replacing
+ ssa names that occur in abnormal phi nodes.
+ * tree-ssa-loop-ivopts.c (get_var_def): Handle non-invariant
+ non-ssa name operands.
+ * java/decl.c (java_init_decl_processing): Initialize
+ long_integer_type_node.
+
+2004-03-31 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (idx_find_step): Prevent misscompilation
+ in case the index overflows.
+
+2004-03-31 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>,
+ Dorit Naishlos <DORIT@il.ibm.com>
+
+ * tree-scalar-evolution.c (dump_chrecs_stats): Prevent format warning.
+
+2004-03-30 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * lambda-code.c (gcc_loop_to_lambda_loop): Changed due to changes in
+ scev.
+ * tree-data-ref.c (analyze_array_indexes, analyze_array): Ditto.
+ * tree-elim-check.c (try_eliminate_check): Ditto.
+ * tree-vectorizer.c (vect_analyze_scalar_cycles): Ditto.
+ * tree-chrec.c (chrec_fold_plus_1): Handle exponential + peeled chrec
+ correctly. Use correct types.
+ (chrec_fold_negate): New.
+ (chrec_merge): Short-circuit the case when the merged values are
+ identical.
+ (no_evolution_in_loop_p): Handle chrec_top correctly.
+ (chrec_convert): Handle polynomial and exponential chrecs corectly.
+ (chrec_type): Use TREE_TYPE.
+ * tree-chrec.h (chrec_fold_negate): Declare.
+ * tree-phinodes.c (create_phi_node): Do not initialize PHI_MARKED.
+ * tree-scalar-evolution.c: Handle evolutions analysed from different
+ loops correctly. Do not use PHI_MARKED. Use correct types.
+ * tree-scalar-evolution.h (analyze_scalar_evolution,
+ instantiate_parameters): Declaration changed.
+ (struct scev_info_str): Moved to tree-scalar-evolution.c.
+ (MI_VAR, MI_INNER_LOOPS_CHREC, MI_OUTER_LOOPS_CHREC): Removed.
+ (new_scev_info_str): Moved to tree-scalar-evolution.c.
+ * tree-ssa-loop-manip.c (add_exit_phis_use): Just add exit phis for
+ superloops of the loop containing the definition.
+ * tree.h (PHI_MARKED): Removed.
+ (tree_phi_node): Field 'marked' removed.
+
+2004-03-30 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * tree-chrec.c (chrec_contains_symbols): Factorize conditions,
+ chrec_not_analyzed_yet is a NULL_TREE.
+ * tree-chrec.h (prove_truth_value_{lt, le, ge, ne, gt, eq}.c):
+ Removed.
+ (evolution_function_is_multivariate,
+ evolution_function_is_peeled_affine_p): New.
+ * tree-data-ref.c (analyze_all_data_dependences): Dump some
+ statistics on the data dependences.
+ * tree-elim-check.c (not_code, prove_truth_value): New.
+ (try_eliminate_check): Use prove_truth_value.
+ * tree-fold-const.h (tree_is_ne): New.
+ * tree-scalar-evolution.c (types_forbid_solutions_p,
+ first_iteration_non_satisfying_noev_noev,
+ first_iteration_non_satisfying_noev_ev,
+ first_iteration_non_satisfying_ev_noev,
+ first_iteration_non_satisfying_ev_ev,
+ first_iteration_non_satisfying_1,
+ first_iteration_non_satisfying,
+ gather_stats_on_scev_database): New functions.
+ (nb_iterations_less, nb_iterations_eq, nb_iterations_ne): Removed.
+ (set_nb_iterations_in_loop): Be more careful on overflow.
+ (number_of_iterations_in_loop): Use first_iteration_non_satisfying.
+ * tree-scalar-evolution.h (first_iteration_non_satisfying,
+ gather_stats_on_scev_database): Declared.
+
+2004-03-30 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (iv_value): Use correct type.
+ (may_eliminate_iv): Add a fixme comment.
+
+2004-03-29 Devang Patel <dpatel@apple.com>
+
+ * tree-flow.h (tree_ssa_loop_version): Add new parameter, basic_block *.
+ (update_lv_condition): New.
+ * tree-ssa-loop-manip.c (copy_phi_nodes): nreverse copied phi nodes list
+ to ensure that phi nodes remain in same order.
+ (lv_update_pending_stmts): Do not nreverse pending list.
+ (lv_adjust_loop_header_phi): Walk two phi nodes list in parallel.
+ (tree_ssa_loop_version): Now condition_bb is input parameter.
+ (update_lv_condition): New.
+ (test_loop_versioning): Use update_lv_condition.
+ * tree-ssa-loop-unswitch.c (tree_unswitch_loop): Update function
+ tree_ssa_loop_version () call by adding 4th parameter.
+
+2004-03-29 Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
+
+ * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
+ Fix unused vars warning with -disable-checking.
+ * df.c (df_reg_def_chain_create, df_reg_use_chain_create): Ditto.
+
+2004-03-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * cfghooks.c (split_edge): Update IRREDUCIBLE_LOOP flags.
+ * tree-flow-inline.h (bsi_after_labels): New.
+ * tree-flow.h (struct ssa_name_ann_d): Add need_phi_state field.
+ (bsi_after_labels, rewrite_ssa_into_ssa, duplicate_ssa_name,
+ tree_ssa_dce_no_cfg_changes, rewrite_into_loop_closed_ssa,
+ verify_loop_closed_ssa, compute_phi_arg_on_exit): Declare.
+ (tree_loop_optimizer_init): Declaration changed.
+ * tree-into-ssa.c (struct mark_def_sites_global_data): Add
+ names_to_rename and ssa_names fields.
+ (insert_phi_nodes, get_value_for, set_value_for, set_def_block,
+ set_livein_block, insert_phi_nodes_1, insert_phi_nodes_for,
+ register_new_def, get_reaching_def, rewrite_into_ssa): Handle
+ rewriting of ssa names.
+ (get_phi_state, set_phi_state, ssa_mark_def_sites_initialize_block,
+ ssa_mark_phi_uses, ssa_mark_def_sites, duplicate_ssa_name,
+ ssa_rewrite_initialize_block, ssa_rewrite_phi_arguments,
+ ssa_rewrite_finalize_block, ssa_rewrite_stmt, rewrite_ssa_into_ssa):
+ New functions.
+ * tree-scalar-evolution.c (scev_initialize): Changed due to
+ tree_loop_optimizer_init change.
+ * tree-ssa-dce.c (perform_tree_ssa_dce, perform_tree_ssa_dce,
+ tree_ssa_cd_dce): Handle no cfg changes mode.
+ (tree_ssa_dce_no_cfg_changes): Resurrect.
+ * tree-ssa-loop-im.c (move_computations): Preserve loop closed ssa.
+ * tree-ssa-loop-ivopts.c (struct version_info): Field outermost_usage
+ removed.
+ (update_outermost_usage, find_outermost_usage): Removed.
+ (ip_normal_pos): Fix.
+ (tree_ssa_iv_optimize_init): Do not call find_outermost_usage.
+ (find_interesting_uses_stmt): Use loop closed ssa form.
+ (find_interesting_uses_outside): New.
+ (find_interesting_uses): Use it.
+ (determine_iv_cost): Prefer IP_NORMAL to IP_END.
+ (split_loop_exit_edge, protect_loop_closed_ssa_form_use,
+ protect_loop_closed_ssa_form, compute_phi_arg_on_exit): New functions.
+ (rewrite_use_outer): Preserve loop closed ssa form.
+ (tree_ssa_iv_optimize): Verify loop closed ssa form.
+ * tree-ssa-loop-manip.c (mfb_redirect_exit_edges): Removed.
+ (free_new_names): Free old ssa names.
+ (extend_exit_phi_nodes, add_exit_phis_edge,
+ add_exit_phis_use, add_exit_phis_stmt, add_exit_phis,
+ get_loops_exits, rewrite_into_loop_closed_ssa,
+ check_loop_closed_ssa_use, check_loop_closed_ssa_stmt,
+ verify_loop_closed_ssa): New functions.
+ (tree_duplicate_loop_to_header_edge): Use loop closed ssa form.
+ (tree_ssa_loop_version): Handle irreducible loops correctly.
+ * tree-ssa-loop.c (tree_loop_optimizer_init): Create loop closed ssa
+ form.
+ (tree_ssa_loop_opt, copy_loop_headers): Changed due to
+ tree_loop_optimizer_init change.
+
+2004-03-25 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * tree-data-ref.c (subscript_dependence_tester): Removed.
+ (build_classic_dist_vector): Implement the subscript tester:
+ test for different distances carried by the same loop.
+
+2004-03-23 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * tree-cfg.c (print_loop): Modify dump formatting.
+ (debug_loop_ir): Renamed tree_debug_loops.
+ (tree_debug_loop): New.
+ * tree-chrec.c: Restructure for handling more carefully types.
+ * tree-chre.h: Same.
+ * tree-fold-const.h: Same.
+ * tree-fold-const.c: Same.
+ * tree-scalar-evolution.c: Same.
+ * tree-scalar-evolution.h: Same.
+ * tree-data-ref.c (dump_data_dependence_relation): Remove the
+ dump of the base_name because it produces too many conflicts in
+ the diffs of the testsuite.
+ (compute_all_dependences): Use pointers to the dependence_relations varray.
+ (int_cst_value, build_classic_dist_vector): New.
+ (find_data_references): Use pointers to datarefs varray.
+ (analyze_all_data_dependences): Compute the classic distances.
+ * tree-data-ref.h: Declare functions.
+ * tree-dg.c (dg_create_graph): Update the uses of the data-ref functions.
+ * tree-flow.h (debug_loop_ir): Renamed to tree_debug_loops.
+ (tree_debug_loop): Declare.
+
+2004-03-23 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-flow.h (tree_ssa_dce_no_cfg_changes): Declaration removed.
+ * tree-ssa-dce.c (remove_dead_stmt): Invalidate dominators if we
+ thread the edge.
+ (tree_ssa_dce_no_cfg_changes): Removed.
+ (perform_tree_ssa_dce, tree_ssa_dce, perform_tree_ssa_dce): Remove
+ no cfg changes mode.
+ * tree-ssa-loop-ivopts.c (force_gimple_operand): Handle overflowed
+ constants.
+ (find_interesting_uses_outer_or_nonlin): New.
+ (find_interesting_uses_op, find_interesting_uses_outer): Use it.
+ (find_interesting_uses_cond, idx_record_use,
+ find_interesting_uses_stmt): Changed due to find_interesting_uses_op
+ change.
+ (create_new_iv, remove_statement, rewrite_use_nonlinear_expr,
+ rewrite_use_outer, tree_ssa_iv_optimize): Handle direct removal of
+ unused ivs.
+ (remove_unused_ivs): New.
+ (tree_ssa_iv_optimize_loop): Call it.
+
+2004-03-23 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * Makefile.in (SCEV_H): New.
+ (tree-ssa-loop-ivcanon.o, tree-ssa-loop-ivopts.o,
+ tree-scalar-evolution.o, tree-data-ref.o, tree-dg.o,
+ tree-elim-check.o, tree-vectorizer.o, tree-loop-linear.o,
+ lambda-code.o): Use it.
+ * tree-chrec.h (build_interval_chrec, build_polynomial_chrec,
+ build_exponential_chrec, build_peeled_chrec): Give a type to the
+ chrec node.
+ * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Preserve correct
+ type.
+ (analyze_evolution_in_loop): Fix test for edges from inside the loop.
+ (scev_initialize): New.
+ (scev_init): Use it.
+ (scev_finalize): New.
+ (scev_done): Use it.
+ * tree-flow-inline.h (loop_of_stmt): Handle initialization statements
+ without crash.
+ * tree-scalar-evolution.h (scev_initialize, scev_finalize): Declare.
+
+2004-03-23 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-vectorizer.c: (vect_align_data_ref): Check for DECL_ALIGN
+ instead of TYPE_ALIGN. Check for DECL_EXTERNAL.
+ (vect_analyze_data_refs): Check for DECL_EXTERNAL.
+
+ Add documentation for functions.
+
+2004-03-22 Dale Johannesen <dalej@apple.com>
+
+ * Makefile.in (OBJS-common): Remove duplicate loop-iv.o.
+
+2004-03-22 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c: Avoid usage of global variables.
+
+2004-03-21 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-unswitch.o: New file.
+ * Makefile.in (tree-ssa-loop-unswitch.o): Add.
+ (tree-ssa-loop-im.o): Add flags.h dependency.
+ * flags.h (flag_unswitch_loops): Declaration moved from ...
+ * toplev.h (flag_unswitch_loops): ... here.
+ * tree-flow.h (tree_ssa_loop_version): Declaration changed.
+ (tree_ssa_unswitch_loops, estimate_loop_size): Declare.
+ * tree-ssa-loop-im.c: Include flags.h.
+ (movement_possibility, stmt_cost, move_computations_stmt):
+ Handle unswitchable conditions.
+ * tree-ssa-loop-ivcanon.c (estimate_loop_size): Export.
+ * tree-ssa-loop-ivopts.c (find_interesting_uses_cond): Handle
+ if (0) and if (1).
+ * tree-ssa-loop-manip.c (tree_ssa_loop_version): Return the newly
+ created loop.
+ * tree-ssa-loop.c (tree_ssa_loop_opt): Call tree_ssa_unswitch_loops.
+
+2004-03-20 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ Merge from tree-ssa branch (lno-merge-20040321).
+
+2004-03-20 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-vectorizer.c: (vect_init_vector): New function.
+ (vect_get_vec_def_for_operand): Support loop invariant uses.
+ (vect_is_simple_use): Likewise.
+ (vect_mark_stmts_to_be_vectorized): Likewise.
+ (vect_analyze_scalar_cycles): Redundant check removed.
+
+ (vect_analyze_operations): Don't fail for vdefs that have uses
+ outside the loop.
+
+ (vect_stmt_relevant_p): A call to get_stmt_operands removed (already
+ performed at new_loop_vec_info).
+ (vect_mark_stmts_to_be_vectorized): Likewise.
+
+ (need_imm_uses_for): New Function.
+ (vectorize_loops): Add call to compute_immediate_uses and free_df.
+
+2004-03-20 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-chrec.c (chrec_fold_multiply_ival_cst): Handle negative
+ constants correctly.
+ * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
+ Enable use of scev.
+
+2004-03-20 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ PR optimization/14658
+ * loop-invariant.c (move_invariant_reg): Handle assignments
+ with nontrivial lhs correctly.
+
+2004-03-18 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * df.c (df_reg_def_chain_create, df_reg_use_chain_create): Do not clean
+ up the old information here.
+ (df_reg_def_chain_clean, df_reg_use_chain_clean): New.
+ (df_analyse_subcfg): Call them.
+
+2003-03-18 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-flow.h (loop_commit_inserts): Declare.
+ * tree-ssa-loop-im.c (commit_inserts): Rename to...
+ (loop_commit_inserts): ... this.
+ * move_computations (move_computations, determine_lsm): Use
+ loop_commit_inserts.
+ * tree-ssa-loop-ivopts.c (AVG_LOOP_NITER): New macro.
+ (struct iv): New field use_id.
+ (struct version_info): New field preserve_biv.
+ (alloc_iv, record_use, free_loop_data): Initialize new fields.
+ (enum use_type): Add USE_OUTER.
+ (dump_use, find_interesting_uses_op, add_derived_ivs_candidates,
+ determine_use_iv_cost, rewrite_use): Handle USE_OUTER.
+ (dump_cand, find_interesting_uses_stmt, add_candidate_1,
+ determine_use_iv_cost_condition, determine_iv_cost, set_cost,
+ create_new_iv, rewrite_use_nonlinear_expr): Handle final value
+ replacement.
+ (find_interesting_uses_outer, add_iv_outer_candidates,
+ may_replace_final_value, determine_use_iv_cost_outer,
+ remove_statement, rewrite_use_outer): New functions.
+ (var_at_use): Replaced by ...
+ (var_at_stmt): ... this.
+ (get_computation_at): Split from ...
+ (get_computation): ... here.
+ (get_computation_cost_at): Split from ...
+ (get_computation_cost): ... here.
+ (iv_value): Split from ...
+ (cand_value_at): ... here.
+ (may_eliminate_iv, rewrite_use_compare): Reflect these changes.
+ (tree_ssa_iv_optimize_loop): Call loop_commit_inserts.
+ * tree-ssanames.c (make_ssa_name): Handle NULL argument.
+
+2003-03-18 Devang Patel <dpatel@apple.com>
+
+ * tree-ssa-live.c (new_tree_live_info): Set num_blocks to
+ last_basic_block instead of n_basic_blocks.
+ (calculate_live_on_entry): Use last_basic_block instead of
+ n_basic_blocks.
+ (calculate_live_on_exit): Same.
+
+2004-03-17 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-cfg.c (thread_jumps): Don't thread jumps over loop headers.
+ * tree-flow.h (rewrite_into_ssa): Declaration changed.
+ (kill_redundant_phi_nodes, tree_loop_optimizer_init): Declare.
+ * tree-optimize.c (execute_todo): Do not free vars_to_rename.
+ (execute_one_pass): Do not allocate vars_to_rename.
+ (tree_rest_of_compilation): Allocate vars_to_rename.
+ * tree-scalar-evolution.c (number_of_iterations_in_loop): Handle
+ loops exited when condition is true.
+ (initialize_scalar_evolutions_analyzer): Use tree_loop_optimizer_init.
+ * tree-ssa-chrec.c (how_far_to_positive): Handle chrec_top correctly.
+ * tree-ssa-dom.c (tree_ssa_dominator_optimize): Changed due to
+ rewrite_into_ssa change.
+ * tree-ssa-loop-im.c (move_computations, determine_lsm): Ditto.
+ * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
+ Use scev analyser.
+ * tree-ssa-loop-manip.c (allocate_new_names): Update name memory
+ tags.
+ * tree-ssa-loop.c (tree_loop_optimizer_init): New.
+ (tree_ssa_loop_opt, copy_loop_headers): Use it.
+ * tree-ssa.c (rewrite_into_ssa): Use argument to decide whether
+ to rename all variables.
+ (rewrite_all_into_ssa): New.
+ (pass_build_ssa): Use it.
+ (kill_redundant_phi_nodes): Export.
+
+2004-03-15 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * tree-ssa-return.c (tree_ssa_return):
+ Move check for NULL return value above check
+ for a modify expr.
+
+2004-03-13 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-scalar-evolution.c (gate_scev_iv_canon): Do not check rtl
+ level flags here.
+ * tree-ssa-loop-ivcanon.c (get_base_for): Verfify that the argument
+ of the phi node is a constant.
+ (loop_niter_by_eval, create_canonical_iv, try_unroll_loop_completely,
+ canonicalize_loop_induction_variables): Handle loops with more than
+ one exit.
+ (find_loop_niter_by_eval): New.
+ (canonicalize_induction_variables): Check rtl level flags here.
+
+2004-03-12 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * tree-ssa-return.c (tree_ssa_return):
+ Only do it when we have a modify expr.
+
+ * tree-ssa-return.c (tree_ssa_return):
+ Add new comments and fix some old ones.
+
+2004-03-12 Falk Hueffner <falk@debian.org>
+
+ * tree-pass.h: Declare pass_return.
+
+2004-03-11 Andrew Pinski <apinski@apple.com>
+
+ PR optimization/14135
+ * tree-ssa-return.c: New file.
+ * Makefile.in (tree-ssa-return.o): Add.
+ * tree-optimize.c (init_tree_optimization_passes): Add
+ pass_return.
+ * timevar.def (TV_TREE_RETURN): New.
+
+2004-03-12 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivcanon.o: New file.
+ * Makefile.in (tree-ssa-loop-ivcanon.o): Add.
+ * flags.h (flag_unroll_loops): Declare.
+ * loop-invariant.c (record_use): Fix.
+ * params.def (PARAM_MAX_COMPLETELY_PEELED_INSNS): Increment.
+ * timevar.def (TV_TREE_LOOP_IVCANON): New.
+ * toplev.h (flag_unroll_loops): Declaration moved to flags.h.
+ * tree-flow.h (enum tree_ann_type): Remove MISC_ANN.
+ (struct tree_ann_common_d): Add aux field.
+ (struct misc_ann_d): Removed.
+ (struct stmt_ann_d): Removed aux field.
+ (union tree_ann_d): Removed misc field.
+ (canonicalize_induction_variables): Declare.
+ * tree-optimize.c (init_tree_optimization_passes): Add
+ pass_scev_iv_canon.
+ * tree-pass.h (pass_scev_iv_canon): Declare.
+ * tree-scalar-evolution.c (scev_iv_canon, gate_scev_iv_canon,
+ pass_scev_iv_canon): New.
+ (scev_done): Run cfg cleanup.
+ * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt,
+ move_computations_stmt, schedule_sm): Use aux field in common
+ part of annotations.
+ * tree-ssa-loop-manip.c (allocate_new_names, rename_op,
+ free_new_names): Use common aux field.
+ (tree_duplicate_loop_to_header_edge): Fix memory leak.
+ * tree-ssa.c (mark_def_sites): Fix.
+ * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Use aux field in
+ common part of annotations.
+ * gcc.dg/tree-ssa/ivcanon-1.c: New test.
+
+2004-03-11 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * Makefile.in (lambda-mat.o, lambda-trans.o, lambda-code.o): Add TM_H
+ dependency.
+
+2004-03-09 Olga Golovonevsky <olga@il.ibm.com>
+ Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-vectorizer.c: (vect_transform_binop): Removed.
+ (vect_transform_op): New function instead of vect_transform_binop,
+ to support both unary and binary operations.
+ (vect_is_supportable_binop): Removed.
+ (vect_is_supportable_op): New function instead of
+ vect_is_supportable_binop to support additional codes.
+ * tree-vectorizer.h: (operation_type): New enum type declared.
+ * config/rs6000/altivec.md: (andvv16qi3, andv8hi3, one_cmplv16qi2,
+ one_cmplv8hi2, one_cmplv4si2, iorv16qi3, iorv8hi3,): New modelling.
+ (*movv4si_internal): Relax condition.
+ (*movv8hi_internal1): Likewise.
+ (*movv16qi_internal1): Likewise.
+ (*movv4sf_internal1): Likewise.
+
+2004-03-09 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * Makefile.in (df.o): Remove FIBHEAP_H dependency.
+ (invariant.o): Add df.h dependency.
+ * df.c: Do not include fibheap.h.
+ (df_bb_table_realloc, df_analyse_subcfg, free_reg_ref_chain,
+ prune_to_subcfg, df_bb_modify, df_find_def, dataflow_set_a_op_b,
+ dataflow_set_copy): New functions.
+ (df_bitmaps_alloc, df_reg_def_chain_create, df_reg_use_chain_create,
+ df_refs_update, df_reg_table_realloc, df_ref_create,
+ df_bb_reg_def_chain_create, df_bb_reg_use_chain_create,
+ df_bb_rd_local_compute, df_bb_ru_local_compute, df_bb_lr_local_compute,
+ df_analyse_1, df_insn_modify): Support analysing only a part of the cfg.
+ (df_rd_transfer_function, df_ru_transfer_function,
+ df_lr_transfer_function): Type of bitmaps changed to void *.
+ (hybrid_search_bitmap, hybrid_search_sbitmap): Merge into ...
+ (hybrid_search): ... new function.
+ (iterative_dataflow_bitmap, iterative_dataflow_sbitmap): Merge into ...
+ (iterative_dataflow): ... new function. Avoid use of fibheaps for
+ a worklist. Do not process basic blocks unnecessarily.
+ * df.h (struct ref): Add data field.
+ (DF_REF_DATA): New macro.
+ (df_analyse_subcfg, df_find_def): Declare.
+ (transfer_function_sbitmap, transfer_function_bitmap): Replaced by ...
+ (transfer_function): ... declare.
+ (iterative_dataflow_sbitmap, iterative_dataflow_bitmap): Replaced by ...
+ (iterative_dataflow): ... declare.
+ (enum set_representation, struct dataflow): New.
+ * loop-invariant.c: Include df.h.
+ (struct loop_data): Remove modified_regs field.
+ (struct def): Remove redundant fields.
+ (struct use): Add insn field.
+ (defs, adef, last_def, m_reg_info, reg_info): Removed.
+ (struct reg): Removed.
+ (record_def, note_insn_stores, find_defs_insn, find_defs_bb,
+ get_current_def, record_dependencies_fer, record_dependencies,
+ move_actual_defs): Removed.
+ (find_defs, find_invariants_insn, create_new_invariant,
+ find_invariants_bb, find_invariants_body, find_invariants,
+ find_invariants_to_move, move_invariant_reg,
+ move_invariants, move_single_loop_invariants,
+ move_loop_invariants): Use df.c.
+ (init_inv_motion_data): Do not initialize removed structures.
+ (free_inv_motion_data, free_loop_data): Do not cleanup removed
+ structures.
+ (check_dependencies, find_invariant_insn, record_uses): New.
+ (record_use): Record the insn.
+ (get_inv_cost): Update comments.
+
+2004-03-09 Andreas Jaeger <aj@suse.de>
+
+ * common.opt: Put tree-loop-linear at right place.
+
+2004-03-09 Daniel Berlin <dberlin@dberlin.org>
+
+ * Makefile.in: Add lambda-mat.o, lambda-code.o, and tree-loop-linear.o.
+ * common.opt: Add -ftree-loop-linear.
+ * flags.h: Add flag_tree_loop_linear.
+ * opts.c: Handle tree-loop-linear option.
+ * timevar.def (TV_TREE_LINEAR_TRANSFORM): New.
+ * tree-flow.h (linear_transform_loops): New prototype.
+ * tree-optimize.c (pass_scev_linear_transform): New.
+ * tree-pass.h (pass_scev_linear_transform): Ditto.
+ * tree-scalar-evolution.c (scev_linear_transform): Ditto.
+ (gate_scev): Add check for flag_tree_loop_linear.
+ (gate_scev_linear_transform): New.
+ * lambda-code.c: New file.
+ * lambda-mat.c: New file.
+ * lambda-trans.c: New file.
+ * lambda.h: New file.
+ * tree-loop-linear.c: New file.
+
+2004-03-09 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * tree-ssa-phiopt.c (conditional_replacement):
+ Initialize new_var to NULL to prevent the
+ uninitialized warning.
+
+ * tree-ssa-phiopt.c (conditional_replacement):
+ Disable the making a new variable for different
+ types.
+
+ * tree-ssa-phiopt.c (conditional_replacement):
+ Disable the use of non-gimple of invert_truthvalue.
+
+2004-03-08 Andrew Pinski <apinski@apple.com>
+
+ * tree-ssa-phiopt.c (make_temp): New function.
+ (tree_ssa_phiopt): Use absolute_replacement
+ and value_replacement.
+ (conditional_replacement): Handle the case
+ the conditional is not a variable and
+ the types do not match.
+ Handle the case where invert_truthvalue
+ would create non-gimple.
+ (absolute_replacement): New function.
+ (value_replacement): New function.
+
+2004-03-08 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * tree-scalar-evolution.c (set_scalar_evolution,
+ set_scalar_evolution_outer_value): Compute the loop number
+ instead of passing it as a parameter.
+
+2004-03-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-live.c (coalesce_tpa_members): Update the root
+ variable of the partition.
+
+2004-03-03 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (enum iv_position): Add IP_ORIGINAL.
+ (struct iv_cand): Add incremented_at.
+ (dump_cand, add_candidate_1, add_candidate, add_old_iv_candidates,
+ var_at_use, get_computation, get_computation_cost,
+ cand_value_at, determine_iv_cost, find_best_candidate,
+ create_new_iv): Handle IP_ORIGINAL.
+ (stmt_after_ip_original_pos, stmt_after_increment): New functions.
+ (find_givs_in_stmt): Cast the values to the result type.
+ (record_invariant): Do not record virtual operands.
+
+2004-03-03 Daniel Berlin <dberlin@dberlin.org>
+
+ * tree-scalar-evolution.c: Use pointers to varray instead of
+ varrays for functions that insert in the scev database.
+
+2004-03-03 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * Makefile.in (OBJS-common): Add tree-elim-check.o.
+ (tree-chrec.o): Add dependence on tree-pass.h.
+ (tree-elim-check.o): New rule.
+ * tree-elim-check.c: New file.
+ * basic-block.h (edge_source, edge_destination): New inlined
+ functions.
+ * cfgloop.h (loop_nb_iterations): Added a comment on the use
+ of this accessor.
+ * common.opt (ftree-elim-checks): New flag.
+ * flags.h (flag_tree_elim_checks): Declared here.
+ * opts.c (decode_options): Set flag_tree_elim_checks to zero.
+ (common_handle_option): Add case OPT_ftree_elim_checks.
+ * timevar.def (TV_TREE_ELIM_CHECKS): Defined.
+ * toplev.c (flag_tree_elim_checks): Defined.
+ * tree-cfg.c (print_pred_bbs, print_succ_bbs, print_loop):
+ Modify the dumping style. Print nb_iterations.
+ * tree-chrec.c, tree-chrec.h, tree-scalar-evolution.c,
+ tree-scalar-evolution.h, tree-data-ref.c: New version of the
+ scalar evolution algorithm. Don't use a schedule for
+ analyzing the scalar variables.
+ * tree-fold-const.c (tree_fold_bezout): Define.
+ * tree-fold-const.h (tree_fold_int_round_div,
+ tree_fold_int_trunc_mod, tree_fold_int_ceil_mod,
+ tree_fold_int_floor_mod, tree_fold_int_round_mod): Removed, because
+ not used for the moment.
+ (chrec_merge_types): New function.
+ * tree-optimize.c (pass_scev_elim_checks): Register the pass.
+ * tree-pass.h (pass_scev_elim_checks): Declare the pass.
+ * tree-pretty-print.c (dump_generic_node): Print
+ PEELED_CHREC. Remove PERIODIC_CHREC.
+ * tree-vectorizer.c: Modify the use of
+ analyze_scalar_evolution.
+ * tree.def (POLYNOMIAL_CHREC, EXPONENTIAL_CHREC): Store the
+ evolution loop in a third leaf instead of in TREE_TYPE.
+ TREE_TYPE is then used in storing the type of the chrec.
+ (PERIODIC_CHREC): Removed since it is not used for the moment.
+ (PEELED_CHREC): New node.
+ * doc/invoke.texi (fdump-tree-scev, fdump-tree-ddall): Correct
+ the name of these flags.
+ (ftree-elim-checks, fdump-tree-elck): Document.
+
+2004-03-02 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (number_of_iterations_cond, cand_value_at):
+ Cast the constants.
+
+2004-03-01 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * Makefile.in (tree-ssa-loop-ivopts.o): Add HASHTAB_H dependency.
+ * tree-ssa-loop-ivopts.c: Include hashtab.h.
+ (old_highest_ssa_version): Rename to version_info_size.
+ (struct tree_niter_desc): Split from ...
+ (struct loop_data): ... here.
+ (relevant): New variable.
+ (tree_ssa_iv_optimize_init, set_iv, find_induction_variables,
+ record_invariant, find_interesting_uses, add_old_ivs_candidates,
+ determine_set_costs, free_loop_data, tree_ssa_iv_optimize_finalize):
+ Use bitmap of relevant ssa names.
+ (var_at_use): New function.
+ (get_computation): Use it.
+ (multiply_by_cost): Cache all results.
+ (mbc_entry_hash, mbc_entry_eq): New functions.
+ (number_of_iterations_cond): Split from ...
+ (determine_number_of_iterations): ... here.
+ (cand_value_at, may_eliminate_iv): New functions.
+ (determine_use_iv_cost_condition, rewrite_use_compare): Implement iv
+ elimination.
+
+2004-03-01 Devang Patel <dpatel@apple.com>
+
+ * tree-dg.c (dg_delete_graph): Reset varrays.
+ (gate_ddg) : Check current loops.
+
+2004-02-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-cfg.c (cleanup_control_expr_graph): Prevent probability from
+ overflowing.
+ * loop-invariant.c (get_current_def): Fix.
+ * tree-ssa-loop-im.c (move_computations): Only call rewrite_into_ssa
+ if vars_to_rename is nonempty.
+ * tree-ssa-loop-ivopts.c (outermost_usage, ivs): Removed.
+ (struct version_info): New.
+ (version_info, max_inv_id): New variables.
+ (struct cost_pair): Added depends_on field.
+ (struct iv_use): Removed fields choices, n_choices, min_cost and
+ min_cost_cand.
+ (enum iv_position, dump_cand, ip_end_pos, add_candidate_1,
+ determine_iv_cost, create_new_iv): IP_START position disabled.
+ (find_optimal_iv_set_1, min_remaining_cost, undo_changes,
+ execute_removal, add_forbidden_ivs, try_candidate): Removed.
+ (dump_use): Do not dump removed fields.
+ (ver_info, name_info, update_outermost_usage, record_invariant,
+ find_invariants_stmt, find_depends, try_improve_iv_set): New functions.
+ (find_outermost_usage): Handle uses in phis.
+ (divide): Update comment.
+ (tree_ssa_iv_optimize_init): Initialize version_info instead of ivs
+ and outermost_usage.
+ (set_iv, get_iv, find_induction_variables, add_old_ivs_candidates):
+ Use version_info instead of ivs.
+ (record_use): Do not initialize removed fields.
+ (find_interesting_uses_op): Call record_use.
+ (find_interesting_uses_stmt): Call find_invariants_stmt.
+ (find_interesting_uses): Scan just the current loop.
+ (set_use_iv_cost): Initialize depends_on field.
+ (get_use_iv_cost): Return depends_on field.
+ (get_computation): Handle special cases.
+ (force_var_cost, split_address_cost, ptr_difference_cost,
+ difference_cost, get_computation_cost, determine_use_iv_cost_generic,
+ determine_use_iv_cost_address, determine_use_iv_cost_condition):
+ Determine depends_on bitmap.
+ (determine_use_iv_costs): Dump depends_on bitmap.
+ (init_set_costs): Use information about invariants.
+ (find_best_candidate, set_cost, get_initial_solution,
+ find_optimal_iv_set): Take depends_on into account.
+ (rewrite_uses): Use use->selected to select candidate.
+ (free_loop_data, tree_ssa_iv_optimize_finalize): Cleanup version_info
+ instead of ivs. Free depends_on bitmaps.
+ (tree_ssa_iv_optimize_loop): Do not pass iv_set to rewrite_uses.
+
+2004-02-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * cfgloopmanip.c (loopify): Fix comment.
+ * loop-iv.c (lowpart_byte, lowpart_subreg_p): Removed.
+ (lowpart_subreg, simple_reg_p, iv_get_reaching_def, get_biv_step_1,
+ iv_analyse_op, iv_analyse, get_iv_value): Use standard subreg
+ manipulation functions.
+ (simplify_using_assignment): Handle hardregs correctly.
+ (canon_condition): Use swap_commutative_operands_p.
+ (iv_number_of_iterations): Avoid overflow.
+ * loop-unroll.c (unroll_loop_runtime_iterations): Pass additional
+ argument to compare_and_jump_seq.
+ * loop-unswitch.c (unswitch_loop, may_unswitch_on,
+ unswitch_single_loop, compare_and_jump_seq): Handle comparisons of
+ ccmode registers.
+ * rtl.h (compare_and_jump_seq): Declaration changed.
+
+2004-02-25 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-vectorizer.h (assignment_vec_info_type): New enum value for
+ stmt_vec_info_type.
+ * tree-vectorizer.c (vect_transform_assignment): New function.
+ Support vectorization of assignment stmts.
+ (vect_transform_stmt): Call vect_transform_assignment.
+ (vect_is_supportable_assignment): New function.
+ (vect_analyze_operations): Call vect_is_supportable_assignment.
+
+ (vect_create_index_for_array_ref): Replace unsigned_intSI_type_node
+ with size_type_node.
+ (vect_transform_loop_bound): Likewise.
+
+ (get_vectype_for_scalar_type): Avoid division by 0.
+
+ (vect_analyze_operations): Apply check for no-out-of-loop-uses also
+ to stmts that are marked irrelevant.
+
+2004-02-25 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-flow.h (for_each_index): Declare.
+ * tree-ssa-loop-im.c (struct lim_aux_data): Add always_executed_in
+ and sm_done fields.
+ (struct use): New.
+ (max_uid): New static variable.
+ (outermost_invariant_loop, commit_inserts, may_move_till,
+ force_move_till, record_use, free_uses, single_reachable_address,
+ rewrite_uses, schedule_sm, determine_lsm_reg,
+ loop_suitable_for_sm, determine_lsm_loop, determine_lsm): New functions.
+ (add_dependency): Use outermost_invariant_loop.
+ (set_level): Add sanity checking.
+ (determine_invariantness_stmt): Set always_executed_in field.
+ (move_computations_stmt): Modified.
+ (move_computations): Use commit_inserts.
+ (fill_always_executed_in): Take possibility of an infinite loop into
+ account.
+ (tree_ssa_lim): Call determine_lsm.
+ * tree-ssa-loop-ivopts.c (for_each_index): Export.
+ (rewrite_use_address): Improve handling of memory tags.
+
+ * tree-ssa-loop.c (do_while_loop_p): Readd.
+ (copy_loop_headers): Readd check for do_while_loop_p.
+ * tree-ssa-operands.c (add_stmt_operand): Modified.
+
+2004-02-21 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ Merge from tree-ssa branch (lno-merge-20040221).
+
+2004-02-20 Devang Patel <dpatel@apple.com>
+
+ * tree-vectorizer.c (vect_analyze_data_ref_dependence): Use
+ ddg_direction_between_stmts ().
+
+2004-02-20 Devang Patel <dpatel@apple.com>
+
+ * tree-data-ref.h (data_dependence_direction): Add new member
+ dir_independent.
+ * tree-dg.h (tree-data-ref.h): Include.
+ (ddg_direction_between_stmts, ddg_distance_between_stmts): New decls.
+ * tree-dg.c (find_ddr_between_stmts, ddg_direction_between_stmts,
+ ddg_distance_between_stmts): New functions.
+
+2004-02-19 Devang Patel <dpatel@apple.com>
+
+ * tree-dg.c (dg_delete_edges, dg_delete_node, dg_delete_graph,
+ dg_delete_edge, gate_delete_ddg): New functions.
+ (pass_delete_ddg): New.
+ * tree-dg.h (dg_delete_graph, dg_delete_edge): New extern decls.
+ * tree-optimize.c (init_tree_optimization_passes): Add new pass
+ pass_delete_ddg.
+ * tree-pass.h (pass_delete_ddg): New extern.
+
+2004-02-19 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-flow.h (create_iv): Declare.
+ * tree-ssa-loop-ivopts.c (create_iv): New function.
+ (create_new_iv): Use create_iv.
+
+2004-02-19 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop.c (do_while_loop_p): New function.
+ (copy_loop_headers): Do not peel do-while loops.
+
+2004-02-19 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * loop-invariant.c: New file.
+ * Makefile.in (loop-invariant.o): New.
+ * cfgloop.h (init_set_costs, global_cost_for_size,
+ move_loop_invariants): Declare.
+ * toplev.c (rest_of_handle_loop2): Call move_loop_invariants.
+ (lang_dependent_init): Call init_set_costs.
+ * tree-ssa-loop-ivopts.c (avail_regs, res_regs, small_cost, pres_cost,
+ spill_cost): Made static.
+ (global_cost_for_size): Export.
+ (ivopts_global_cost_for_size, init_set_costs): New functions.
+ (determine_set_costs): Do not initialize set cost constants.
+ Use ivopts_global_cost_for_size.
+ (try_candidate, find_optimal_iv_set_1, set_cost): Use
+ ivopts_global_cost_for_size.
+
+ * cfgloop.c (fill_sons_in_loop): Fix typo in comment.
+
+2004-02-17 Devang Patel <dpatel@apple.com>
+
+ * tree-vectorize.c (vect_create_data_ref): Set TREE_ADDRESSABLE bit.
+ (vectorize_loops): Reset loop->aux.
+
+2004-02-16 Devang Patel <dpatel@apple.com>
+
+ * Makefile.in (TREE_FLOW_H): Add tree-dg.h
+ (OBJS-common): Add tree-dg.o
+ (gtype-desc.o): Depend on tree-dg.h
+ (tree-dg.o): New rule.
+ (GTFILES): Add tree-data-ref.h, tree-data-ref.h
+ * common.opt (ftree-ddg): Add new option.
+ * flags.h (flag_ddg): New extern.
+ * gengtype.c (open_base_files): Add tree-dg.h and tree-data-ref.h in
+ the list.
+ * opts.c (decode_option): Set flag_ddg to zero.
+ (common_handle_option): Handle OPT_ftree_ddg.
+ * timevar.def (TV_DEP_GRAPH): New.
+ * toplev.c (flag_ddg): New flag.
+ (lang_independent_options): Add entry for -ftree-ddg.
+ * tree-data-ref.c (compute_all_dependences): Make externally visible.
+ * tree-data-ref.h (data_reference, subscript, data_dependence_relation)
+ Add GTY markers.
+ (compute_all_dependences): Make externally visible.
+ * tree-dg.c: New file.
+ * tree-dg.h: New file.
+ * tree-flow-inline.h (dg_node_for_stmt): New function.
+ * tree-flow.h (tree-dg.h): Include.
+ (stmt_ann_d): New member, dg_node.
+ * tree-optimize.c (init_tree_optimization_passes): Add pass_ddg.
+ * tree-pass.h (PROP_scev): Define.
+ (tree_opt_pass pass_ddg): Extern decl.
+ * tree-scalar-evolution.c (pass_scev_anal): Provide PROP_scev property.
+ * varray.c (element[NUM_VARRAY_DATA]): Add new member for dependence
+ graph.
+ * varray.h (varray_data_enum): New member VARRAY_DATA_DG.
+ (varray_data_tag): New member dg.
+ (VARRAY_DG_INIT): New #define.
+ (VARRAY_DG): New #define.
+ (VARRAY_PUSH_DG): New #define.
+
+2004-02-12 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-optimize.c (init_tree_optimization_passes): Move ch after
+ the first dominator optimization pass.
+ * tree-ssa-loop.c (should_duplicate_loop_header_p,
+ copy_loop_headers): Work over ssa.
+ (pass_ch): Require and update ssa form.
+ (mark_defs_for_rewrite, duplicate_blocks): New.
+
+2004-02-10 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (for_each_index, prepare_decl_rtl,
+ peel_address): Handle RESULT_DECL.
+
+2004-02-10 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * loop-doloop.c (doloop_optimize): Use get_simple_loop_desc.
+ * loop-init.c (loop_optimizer_finalize): Free the simple loop
+ descriptions.
+ * loop-unroll.c (unroll_and_peel_loops): Do not free the simple loop
+ descriptions.
+ (decide_peel_once_rolling, decide_peel_completely,
+ decide_unroll_stupid): Test assumptions.
+ decide_unroll_constant_iterations, decide_unroll_runtime_iterations,
+ decide_peel_simple, peel_loop_simple, unroll_loop_stupid): Update
+ number of iterations info.
+ (unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
+ (loop_exit_at_end_p): Use get_simple_loop_desc.
+
+2004-02-08 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * cfgloop.h (struct niter_desc): Add first_special, extend,
+ extend_mode, delta and mult fields.
+ (get_iv_value): Declare.
+ * expr.c (force_operand): Handle subregs of expressions.
+ * loop-doloop.c (doloop_valid_p): Test desc->infinite properly.
+ * loop-iv.c (dump_iv_info): Dump new fields.
+ (lowpart_byte, lowpart_subreg_p, lowpart_subreg,
+ iv_constant, iv_subreg, iv_extend, iv_neg, iv_add, iv_mult,
+ get_biv_step_1, get_biv_step, shorten_into_mode,
+ canonicalize_iv_subregs): New functions.
+ (simple_reg_p, simple_set_p, iv_get_reaching_def, iv_analyse_biv,
+ iv_analyse_op, iv_analyse, iv_number_of_iterations): Handle subregs.
+ * loop-unswitch.c (may_unswitch_on): Handle subregs.
+
+2004-02-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * Makefile.in (tree-ssa-loop-ivopts.o): Add RECOG_H and insn-config.h
+ dependency.
+ * loop-iv.c (iv_analysis_loop_init): Ensure we only care about
+ increments that are done just once each iteration.
+ * timevar.def (TV_TREE_LOOP_IVOPTS, TV_TREE_CH): New.
+ * tree-ssa-loop-ivopts.c: Include insn-config.h and recog.h.
+ (INFTY): Increase.
+ (struct iv_use): Add choices, n_choices, min_cost_cand and selected
+ fields. Rename field best_cost to min_cost.
+ (CONSIDER_ALL_CANDIDATES_BOUND): Decrease.
+ (dump_use): Dump new fields.
+ (dump_uses, cst_and_fits_in_hwi, int_cst_value, build_int_cst,
+ divide, strip_offset, add_cost, multiply_by_cost, get_address_cost,
+ force_var_cost, peel_address, ptr_difference_const,
+ split_address_cost, ptr_difference_cost, difference_cost,
+ get_computation_cost): New functions.
+ (find_induction_variables): Formating changes.
+ (record_use): Initialize new fields.
+ (add_old_ivs_candidates): Do not add invariants.
+ (set_use_iv_cost): Set min_cost.
+ (get_use_iv_cost): Fix.
+ (get_computation): Use less memory.
+ (determine_use_iv_cost_generic, determine_use_iv_cost_address,
+ determine_use_iv_cost_condition, determine_iv_cost): Use
+ new cost estimation functions.
+ (compute_iv_set_cost): Removed.
+ (struct undo_record): New.
+ (use_with_min_choices, min_remaining_cost, undo_changes,
+ execute_removal, add_forbidden_ivs, try_candidate, set_cost,
+ get_initial_solution): New functions.
+ (find_optimal_iv_set_1, find_optimal_iv_set): Made more effective.
+ (create_new_ivs, rewrite_use_nonlinear_expr, rewrite_use_address):
+ Unshare created expressions.
+ (free_loop_data): Free new structures.
+ (tree_ssa_iv_optimize_loop): Remove garbage collection.
+ (tree_ssa_iv_optimize): Use TV_TREE_LOOP_IVOPTS timevar.
+ * tree-ssa-loop.c (pass_ch): Use TV_TREE_CH timevar.
+
+2004-02-02 Steven Bosscher <stevenb@suse.de>
+
+ * common.opt: Re-order some options in ASCII collating order.
+
+2004-01-30 Devang Patel <dpatel@apple.com>
+
+ * cfgloopmanip.c (loopify): Always redirect switch_bb's BRANCH_EDGE,
+ however redirect FALLTHRU_EDGE only if asked.
+ * tree-ssa-loop-manip.c (tree_ssa_loop_version): Update FALLTHRU_EDGE
+ pending stmts.
+
+2004-01-29 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (find_optimal_iv_set_1, compute_iv_set_cost):
+ Fix memory leak, speed up.
+ (tree_ssa_iv_optimize_finalize): Move reseting of DECL_RTL...
+ (free_loop_data): ... here.
+
+2004-01-29 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * basic-block.h (FOR_BB_INSNS, FOR_BB_INSNS_REVERSE): New macros.
+ * cfgloop.c (num_loop_branches): New function.
+ * cfgloop.h (struct loop_desc): Add field strange.
+ (struct loop): Remove fields simple, desc, has_desc.
+ (num_loop_branches, get_simple_loop_desc, free_simple_loop_desc):
+ Declare.
+ (simple_loop_desc): New inline function.
+ * cfgloopanal.c (count_loop_iterations): Set field strange.
+ (simple_loop_exit_p): Initialize postincr properly.
+ * loop-iv.c (assign_luids, mark_sets, simplify_using_initial_values):
+ Use FOR_BB_INSNS/FOR_BB_INSNS_REVERSE.
+ (iv_number_of_iterations): Restrict the number of iterations to the
+ actual mode.
+ (find_simple_exit): Check results with the old simple loop analyser.
+ (get_simple_loop_desc, free_simple_loop_desc): New functions.
+ * loop-unroll.c (loop_exit_at_end_p): New function.
+ (unroll_and_peel_loops, peel_loops_completely,
+ decide_unrolling_and_peeling, decide_peel_once_rolling,
+ decide_peel_completely, peel_loop_completely,
+ decide_unroll_constant_iterations, unroll_loop_constant_iterations,
+ decide_unroll_runtime_iterations, unroll_loop_runtime_iterations,
+ decide_peel_simple, decide_unroll_stupid): Use new iv analysis.
+ * predict.c (predict_loops): Use new iv analysis.
+
+ * tree-ssa-loop.c (copy_loop_headers): Predict entry edge from
+ copied loop header to be taken.
+
+ * tree-cfg.c (tree_find_edge_insert_loc,
+ bsi_insert_on_edge_immediate): Return the newly created block.
+ (bsi_commit_edge_inserts_1): Add parameter to
+ tree_find_edge_insert_loc call.
+ * tree-flow.h (bsi_insert_on_edge_immediate): Declaration changed.
+ * tree-ssa-loop-ivopts.c (create_new_iv): Update loop for newly
+ created block.
+
+ * cfg.c (unlink_block): Clean prev_bb and next_bb fields.
+
+2004-01-29 Devang Patel <dpatel@apple.com>
+
+ * cfglayout.h (loopify): Add new bool parameter.
+ * cfgloopmanip.c (loopify): Support new bool argument.
+ * loop-unswitch.c (unswitch_loop): Supply additional argument 'true'
+ to loopify.
+ * tree-cfg.c (tree_block_label): Make externally visible.
+ * tree-flow.h (tree_block_label, test_loop_versioning, tree_ssa_loop_version): New
+ extern decls.
+ * tree-ssa-loop-manip.c (lv_adjust_loop_entry_edge, lv_udate_pending_stmts,
+ lv_adjust_loop_header_phi, tree_ssa_loop_version): New functions.
+ * tree-ssa-loop.c (tree_ssa_loop_opt): Test loop versioning.
+
+2004-01-29 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-scalar-evolution.c (scev_analyze_inner_loop_phi): Add ;.
+
+2004-01-29 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * Makefile.in (tree-ssa-dom.o): Depends on cfgloop.h.
+ * tree-flow-inline.h (loop_of_stmt): New function.
+ * tree-ssa-dom.c: Include cfgloop.h.
+ (tree_ssa_dominator_optimize): Detect and finalize the natural
+ loops structure.
+ (simplify_rhs_and_lookup_avail_expr): Verify that the folded
+ operations belong to the same loop.
+
+ * cfgloop.h (loop): Rewrite comments for the nb_iterations field.
+ * tree-data-ref.c (analyze_all_data_dependences): Increase the size
+ of the dependence graph when computing all the dependences.
+ * tree-optimize.c (init_tree_optimization_passes): Move the
+ pass_scev after the pass_pre.
+ * tree-scalar-evolution.h: Update comments.
+ * tree-scalar-evolution.c (symbolically_analyze,
+ scev_follow_ssa_edge_same_loop, scev_follow_ssa_edge_inner_loop,
+ loop_is_strictly_included_in, scev_analyze_inner_loop_phi,
+ draw_tree_cfg): New functions.
+ (compute_value_on_exit_of_loop): Removed.
+ (analyze_evolution): Mark phi nodes instead of looking into
+ the already_visited array.
+ (analyze_evolution_in_loop): Use scev_follow_ssa_edge_same_loop,
+ scev_follow_ssa_edge_inner_loop.
+ (scev_analyze_modify_expr): Refine the wrap-around case.
+ (scev_follow_ssa_edge): Handle edges to the current and inner loops
+ separately calling scev_follow_ssa_edge_same_loop or
+ scev_follow_ssa_edge_inner_loop.
+ (merge_branches_of_condition_phi_node): Restructure.
+ (set_nb_iterations_in_loop): Add one to the number of iterations.
+ When the loop copy headers is on, we always exit the loop after
+ having executed once its body.
+ (record_dependences_for_opnd): Do not record dependences on variables
+ that are not in the current loop.
+ (pass_scev_depend): Rename the pass from alldd to ddall.
+ * tree-ssa-loop.c (gate_ch): New function.
+ (pass_ch): Use gate_ch.
+ * doc/invoke.texi (-ftree-ch, -fdump-tree-ch): Document flags.
+ (fdump-tree-scev, fdump-tree-ddall): Update names, and comments.
+
+ * common.opt (ftree-ch): Document.
+ * flags.h (flag_tree_ch): Declare.
+ * opts.c (flag_tree_ch): Set it on by default.
+ (flag_scalar_evolutions, flag_all_data_deps): Turn off by default.
+ (OPT_ftree_ch): Handle this case.
+ * toplev.c (lang_independent_options): Register flag_tree_ch.
+
+2004-01-28 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * cfghooks.c (split_block): Update probabilities.
+
+ * cfgloopmanip.c (loopify): Always redirect branch edge to the new
+ loop.
+ * loop-iv.c (canon_condition, simplify_using_condition): Export.
+ (check_simple_exit): Do not allow cc mode registers.
+ * loop-unroll.c (unroll_loop_runtime_iterations): Use
+ compare_and_jump_seq.
+ * loop-unswitch.c (may_unswitch_on_p): Renamed to may_unswitch_on,
+ returns the condition, use iv_analyse.
+ (compare_and_jump_seq): New function.
+ (unswitch_loops): Call iv_analysis_done.
+ (unswitch_single_loop, unswitch_loop): Handle nontrivial invariants.
+ * rtl.h (compare_and_jump_seq, canon_condition,
+ simplify_using_condition): Declare.
+
+2004-01-28 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * loop-iv.c: New.
+ * loop-doloop.c: New.
+ * Makefile.in (loop-doloop.o, loop-iv.o): Add.
+ * alias.c (init_alias_analysis): Test flag_unroll_loops instead of
+ flag_old_unroll_loops.
+ * cfgloop.h (struct rtx_iv, struct niter_desc): New.
+ (get_loop_level, iv_analysis_loop_init, iv_get_reaching_def,
+ iv_analyse, find_simple_exit, iv_number_of_iterations,
+ iv_analysis_done, doloop_optimize_loops): Declare.
+ * cfgloopanal.c (get_loop_level): New.
+ * common.opt (floop-optimize2): New.
+ (fold-unroll-loops, fold-unroll-all-loops): Remove.
+ * doloop.c (doloop_condition_get): Export.
+ * flags.h (flag_old_unroll_loops, flag_old_unroll_all_loops):
+ Declaration removed.
+ * loop-unswitch.c (reversed_condition): Export.
+ * loop.c (loop_invariant_p): Use flag_unroll_loops instead
+ of flag_old_unroll_loops.
+ * opts.c (common_handle_option): Handle -floop-optimize2,
+ do not handle -fold-unroll-loops and -fold-unroll-all-loops.
+ * params.def (PARAM_MAX_DOLOOP_INSNS): New.
+ * rtl.h (get_mode_bounds, doloop_condition_get,
+ reversed_condition): Declare.
+ * stor-layout.c (get_mode_bounds): New function.
+ * toplev.c (flag_old_unroll_loops, flag_old_unroll_all_loops):
+ Remove.
+ (flag_loop_optimize2): New.
+ (rest_of_handle_loop_optimize): Use flag_unroll_loops instead
+ of flag_old_unroll_loops.
+ (rest_of_handle_loop2): Call doloop_optimize_loops.
+ (rest_of_compilation): Use flag_loop_optimize2.
+ (process_options): Remove flag_old_unroll_loops handling, add
+ flag_loop_optimize2 handling.
+ * toplev.h (flag_loop_optimize2): Declare.
+ * unroll.c (unroll_loop): Use flag_unroll_all_loops instead of
+ flag_old_unroll_all_loops.
+
+2004-01-26 Dorit Naishlos <dorit@il.ibm.com>
+
+ * Makefile.in: (tree-vectorizer.o): Remove dependency on real.h.
+ * tree-vectorizer.c: (real.h): Remove included file.
+ (vect_get_vec_def_for_operand): No need to explicitly use build_int_2
+ and build_real.
+
+ (vect_transform_loop_bound): Create loop IV update at loop exit
+ block, following changes in loop control.
+
+ (vectorize_loops): Remove debug printout.
+
+ * config/rs6000/altivec.md: (*movv4si_internal): More complex
+ condition.
+ (*movv8hi_internal1): Likewise.
+ (*movv16qi_internal1): Likewise.
+ (*movv4sf_internal1): Likewise.
+
+2004-01-25 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c (determine_set_costs): Do not use
+ GENERAL_REGNO_P.
+
+2004-01-25 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-ivopts.c: New file.
+ * Makefile.in (tree-ssa-loop-ivopts.o): Add.
+ * expr.c (expand_expr_1): Handle expand_expr_1.
+ * fold-const.c (invert_tree_comparison, invert_tree_comparison):
+ Export.
+ * tree-cfg.c (stmt_bsi): New function.
+ * tree-flow.h (stmt_bsi, tree_ssa_dce_no_cfg_changes,
+ tree_ssa_iv_optimize): Declare.
+ * tree-simple.c (get_base_symbol): Handle INDIRECT_REF.
+ * tree-ssa-dce.c (tree_ssa_dce_no_cfg_changes): Split from ...
+ (tree_ssa_dce): ... here.
+ * tree-ssa-loop.c (tree_ssa_loop_opt): Call tree_ssa_iv_optimize.
+ * tree-ssanames.c (make_ssa_name): Allow creating ssa name without
+ statement.
+ * tree.h (invert_tree_comparison, swap_tree_comparison): Declare.
+
+2004-01-25 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * doloop.c (doloop_optimize): Test for loop->top instead of
+ loop->scan_start.
+
+2004-01-22 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-alias-common.c (HAVE_BANSHEE): Do not define it.
+ (create_alias_vars): Do not test HAVE_BANSHEE value.
+
+2004-01-22 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-ssa-loop-manip.c: New file.
+ * Makefile.in (tree-ssa-loop-manip.o): Add.
+ * basic-block.h (struct reorder_block_def): New field copy_number.
+ * cfghooks.c (split_block, make_forwarder_block): Update irreducible
+ loop information.
+ * cfgloopmanip.c (duplicate_loop_to_header_edge): Set copy_number.
+ * tree-cfg.c (tree_duplicate_bb): Duplicate also virtual operands.
+ * tree-flow.h (enum tree_ann_type): Add MISC_ANN.
+ (struct misc_ann_d): New.
+ (union tree_ann_d): Add misc field.
+ (test_unrolling_and_peeling, tree_duplicate_loop_to_header_edge):
+ Declare.
+ * tree-ssa-loop.c (tree_ssa_loop_opt): Call
+ test_unrolling_and_peeling.
+ * tree-ssa-operands.c (copy_virtual_operands): New.
+ * tree-ssa-operands.h (copy_virtual_operands): Declare.
+
+ * dominance.c: Fix comment.
+
+ * cfgloopanal.c (mark_irreducible_loops): Rewriten.
+ (struct edge, struct vertex, struct graph): New.
+ (dump_graph, new_graph, add_edge, dfs, check_irred, for_each_edge,
+ free_graph): New functions.
+
+2004-01-21 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-scalar-evolution.c (pass_scev): Don't use a name.
+ (pass_scev_anal): Named this pass "scev".
+
+2004-01-21 Dorit Naishlos <dorit@il.ibm.com>
+
+ * Makefile.in: (tree-vectorizer.o): Add dependency on real.h.
+ * tree-vectorizer.c: (vect_is_simple_use): Allow constants.
+ (real.h): Included to support constants vectorization.
+ (vect_get_vec_def_for_operand): New function.
+ (vect_transform_binop): Use above new function.
+ (vect_transform_store): Likewise.
+ (vect_transform_load): Likewise.
+
+ (vect_get_new_vect_var): Allow more flexibility in naming scheme.
+ (vect_create_index_for_array_ref): Call vect_get_new_vect_var with a
+ name prefix instead of a variable.
+ (vect_create_data_ref): Likewise.
+ (vect_create_destination_var): Likewise.
+
+ (vect_analyze_data_refs): Temporarily restrict vectorizable data refs
+ to ARRYA_RES which base is a VAR_DECL.
+ (vect_create_data_ref): Support only VAR_DECL array base. Mark all
+ vops for renaming.
+
+ (vect_get_array_first_index): New function.
+ (vect_create_index_for_array_ref): Consider array_first_index.
+ (vect_analyze_data_ref_access): Likewise.
+
+ (vect_get_loop_niters): Use number_of_iterations_in_loop.
+ (vect_analyze_loop_form): Don't attempt to vectorize if
+ number_of_iterations == 0.
+
+ (vect_analyze_operations): Fix vectype analysis.
+
+ (vect_create_index_for_array_ref): Fix code insertion in loop prolog.
+ (vect_transform_loop_bound): Likewise.
+
+2004-01-21 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>,
+ Devang Patel <dpatel@apple.com>
+
+ * basic-block.h (struct reorder_block_def): Moved from cfglayout.h.
+ (alloc_rbi_pool, initialize_bb_rbi, free_rbi_pool): Declare.
+ * bb-reorder.c (copy_bb, copy_bb_p): Use duplicate_block hooks.
+ * loop-unswitch.c (unswitch_loop): Ditto.
+ * tracer.c (tail_duplicate): Ditto.
+ * tree-ssa-loop.c (copy_loop_headers): Ditto.
+ * cfg.c (rbi_pool): New.
+ (alloc_rbi_pool, free_rbi_pool, initialize_bb_rbi): New functions.
+ * cfghooks.c (can_duplicate_block_p, duplicate_block): New functions.
+ * cfghooks.h (struct cfg_hooks): Add can_duplicate_block_p and
+ duplicate_block hooks.
+ (can_duplicate_block_p, duplicate_block): Declare.
+ * cfglayout.c (cfg_layout_pool): Removed.
+ (cfg_layout_initialize_rbi): Removed.
+ (fixup_reorder_chain): Use initialize_bb_rbi.
+ (cfg_layout_can_duplicate_bb_p, cfg_layout_duplicate_bb):
+ Ir-independent parts moved to cfghooks.c.
+ (cfg_layout_initialize): Use alloc_rbi_pool and initialize_bb_rbi.
+ (cfg_layout_finalize): Use free_rbi_pool.
+ (can_copy_bbs_p): Use can_duplicate_block_p.
+ (copy_bbs): Use duplicate_block.
+ * cfglayout.h (struct reorder_block_def): Moved to basic-block.h
+ (cfg_layout_can_duplicate_bb_p, cfg_layout_duplicate_bb,
+ cfg_layout_initialize_rbi): Declaration removed.
+ * cfgrtl.c (cfg_layout_create_basic_block): Use initialize_bb_rbi.
+ (cfg_layout_rtl_cfg_hooks): Add cfg_layout_can_duplicate_bb_p and
+ cfg_layout_duplicate_bb.
+ * tree-cfg.c (build_tree_cfg): Call alloc_rbi_pool.
+ (create_bb): Call initialize_bb_rbi.
+ (delete_tree_cfg): Call free_rbi_pool.
+ (tree_duplicate_bb): Ir independent parts moved to cfghooks.c.
+ (tree_cfg_hooks): Add tree_can_duplicate_bb_p and tree_duplicate_bb.
+ * tree-flow.h (tree_duplicate_bb): Declaration removed.
+
+2004-01-21 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-alias-common.c (create_alias_vars): Don't use
+ andersen_alias_ops when we don't HAVE_BANSHEE.
+
+ * tree-ssa-loop.c (pass_ch): Remove TODO_verify_ssa.
+
+2004-01-20 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ Merge from tree-ssa branch (lno-merge-20040120).
+
+2004-01-18 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-scalar-evolution.c: (get_loop_exit_condition): Exposed to
+ external usage.
+ * tree-scalar-evolution.h: (get_loop_exit_condition): Exposed to
+ external usage.
+ * tree-vectorizer.c: (vect_is_simple_iv_evolution): Additional argument
+ to control how strict this function would be.
+ (vect_create_index_for_array_ref): Invoke vect_is_simple_iv_evolution
+ with "strict" set to true.
+ (vect_transform_loop_bound): More general loop bound transformation
+ scheme, independent of the loop exit condition form.
+ (vect_analyze_scalar_cycles): Invoke vect_is_simple_iv_evolution with
+ "strict" set to false.
+ (vect_get_loop_niters): Use monev utilities/precomputed info -
+ loop->nb_iterations and get_loop_exit_condition.
+
+2004-01-17 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-vectorizer.c: (vect_get_name_for_new_var): Removed.
+ (vect_get_new_vect_var): New function. Replaces above function.
+ (vect_create_index_for_array_ref): Call vect_get_new_vect_var
+ instead of vect_get_name_for_new_var.
+ (vect_create_data_ref): Likewise.
+ (vect_create_destination_var): Likewise.
+ * tree-vectorizer.h: (vect_var_kind): New enum type.
+
+2004-01-15 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-chrec.c (remove_initial_condition,
+ add_expr_to_loop_evolution_1, add_expr_to_loop_evolution_2): New functions.
+ (add_expr_to_loop_evolution): Use these functions.
+ (build_polynomial_evolution_in_loop,
+ build_exponential_evolution_in_loop): Move from here...
+ * tree-chrec.h (build_polynomial_evolution_in_loop,
+ build_exponential_evolution_in_loop): Remove declarations.
+ * tree-scalar-evolution.c (build_polynomial_evolution_in_loop,
+ build_exponential_evolution_in_loop): ... to here. Declare
+ these functions static.
+ (select_outer_and_current_evolutions): New function.
+ (matched_an_increment, scev_analyze_modify_expr,
+ compute_overall_effect_of_inner_loop,
+ analyze_scalar_evolution): Use this function.
+ (add_to_evolution, multiply_evolution): Construct canonical
+ chains of recurrences.
+
+2004-01-14 Dorit Naishlos <dorit@il.ibm.com>
+ Sebastian Pop <s.pop@laposte.net>
+
+ * tree-vectorizer.c: (vect_is_simple_iv_evolution): Correctly use
+ APIs of the new monev analyzer. Additional argument (loop_num).
+ (vect_transform_loop_bound): Additional argument to
+ vect_is_simple_iv_evolution.
+ (vect_analyze_scalar_cycles): Likewise.
+ (vect_analyze_data_ref_access): Likewise.
+ (vect_get_loop_niters): Likewise.
+
+2004-01-14 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-optimize.c: (optimize_function_tree): Cleanup.
+
+ * tree-vectorizer.h: (DBG_VECT, DBG_VECT2): Removed.
+ (vec_array_base_name_differ_p): Removed.
+ (vec_analyze_array): Removed.
+ (struct _stmt_vec_info): New field: loop.
+ (STMT_VINFO_LOOP): New access function to above new field.
+ (new_stmt_vec_info): Additional argument.
+
+ * tree-vectorizer.c: (vect_is_simple_use): New function.
+ (vect_is_supportable_binop): Added call to vect_is_simple_use().
+ (vect_is_supportable_store): Added call to vect_is_simple_use().
+ (vect_is_supportable_load): Added call to vect_is_simple_use().
+
+ (vect_create_index_for_array_ref): Correct handling of accesses with
+ an offset (e.g, a[i+OFF]).
+ (vect_create_data_ref): Pass STMT as an argument to
+ vect_create_index_for_array_ref, instead of an operand.
+ (vect_transform_store): Handle accesses with an offset.
+ (vect_transform_load): Handle accesses with an offset.
+
+ (vect_create_data_ref): Set the mem_tag of the pointer used for the
+ vector data-access to reflect correct may-alias info.
+
+ (get_address_calculation_operands): Removed.
+ (exist_non_indexing_operands_for_use_p): New function, in place of
+ get_address_calculation_operands() to correctly handle induction (for
+ now this means to detect and not attempt to vectorize computations
+ like a[i]=i).
+ (vect_analyze_scalar_cycles): call above new function instead of
+ get_address_calculation_operands().
+ (vect_mark_stmts_to_be_vectorized): Likewise.
+
+ (get_vectype_for_scalar_type): Added test of VECTOR_MODE_SUPPORTED_P.
+
+ (new_stmt_vec_info): Takes also LOOP as an argument and initializes
+ new field STMT_VINFO_LOOP.
+ (new_loop_vec_info): Pass additional argument to new_stmt_vec_info.
+
+ (vect_stmt_relevant_p): Use flow_bb_inside_loop_p instead of comparing
+ loop->depth's.
+ (vect_analyze_operations): Likewise.
+
+ (vect_align_data_ref): Removed stderr debug printouts, some of which
+ replaced with code dumping dependending on TDF_DETAILS to dump_file.
+ (vect_create_index_for_array_ref): Likewise.
+ (vect_create_destination_var): Likewise.
+ (vect_create_data_ref): Likewise.
+ (vect_transform_binop): Likewise.
+ (vect_transform_store): Likewise.
+ (vect_transform_load): Likewise.
+ (vect_transform_stmt): Likewise.
+ (vect_transform_loop_bound): Likewise.
+ (vect_transform_loop): Likewise.
+ (vect_analyze_operations): Likewise.
+ (vect_is_simple_iv_evolution): Likewise.
+ (vect_analyze_scalar_cycles): Likewise.
+ (vect_analyze_data_ref_dependences): Likewise.
+ (vect_analyze_data_refs): Likewise.
+ (vect_mark_relevant): Likewise.
+ (vect_stmt_relevant_p): Likewise.
+ (vect_mark_stmts_to_be_vectorized): Likewise.
+ (vect_get_loop_niters): Likewise.
+ (vectorize_loops): Likewise.
+
+2004-01-13 Sebastian Pop <s.pop@laposte.net>
+ Daniel Berlin <dberlin@dberlin.org>
+
+ * tree-fold-const.h (tree_fold_int_plus, tree_fold_int_minus,
+ tree_fold_int_multiply): Remove NON_LVALUE_EXPR from the
+ answers of the folder. Fixes bootstraps for powerpc.
+
+2004-01-12 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-chrec.c (chrec_fold_plus, chrec_fold_multiply): Verify
+ that there is no chrecs nested in the operands before calling
+ the folder.
+ (evolution_function_in_loop_num): When there is no evolution
+ in the loop, return the initial condition.
+ (evolution_part_in_loop_num): When there is no evolution
+ in the loop, return NULL_TREE.
+ (chrec_eval_next_init_cond): Adapt the function for the
+ multivariate case.
+ (tree_contains_chrecs): Avoid the use of double negation.
+ * tree-chrec.h (chrec_eval_next_init_cond): Add a parameter
+ for the dimension in which to evaluate the variation.
+ * tree-scalar-evolution.c (is_ssa_name_a_version_of_variable,
+ expression_contains_variable_p, remove_variable_from_expression,
+ analyze_non_gimple_initial_condition, matched_an_increment,
+ matched_an_exponentiation, matched_a_wrap_around,
+ matched_an_arithmetic_wrap_around,
+ evolution_of_phi_already_analyzed_p): New static functions.
+ (scev_analyze_modify_expr): Use these functions. Refine the
+ cases detected as wrap-around variables.
+ (analyze_initial_condition): Don't erase the evolution in the
+ previous dimensions when computing the initial condition for a
+ new loop.
+ (analyze_evolution_in_loop): Call the scev_analyze_modify_expr
+ on the tree node, not on its evolution.
+ (scev_follow_ssa_edge): In the case of an inner loop-phi-node,
+ when the outer edge is a phi-node follow up the edge.
+ (scev_follow_ssa_edge): Avoid the analysis of the inner loop
+ when it has already been analyzed.
+ (merge_evolutions): Refine the operation for zero, one, and
+ more branches of evolutions.
+
+2004-01-09 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-scalar-evolution.c: New version of the analyzer.
+ * tree-scalar-evolution.h: Same.
+ * tree-chrec.c: Same.
+ * tree-data-ref.c: Same.
+ * tree-chrec.h: Same.
+ * tree-data-ref.h: Same.
+ * tree-fold-const.h: Same.
+
+ * tree-vectorizer.c (vect_transform_loop_bound,
+ vect_analyze_scalar_cycles, vect_analyze_data_ref_access,
+ vect_analyze_data_refs, vect_get_loop_niters): Use the new
+ interface of the analyzer.
+ * tree-optimize.c (optimize_function_tree): Same.
+
+2004-01-08 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * cfgloop.h (loop_is_included_in): Declaration removed.
+ * tree-scalar-evolution.c (stmt_is_in_loop, stmt_is_not_in_loop,
+ loop_is_included_in): Use existing functions to implement
+ them.
+
+2004-01-06 Sebastian Pop <s.pop@laposte.net>
+
+ * cfgloop.h (loop_is_included_in, outer_loop, inner_loop,
+ next_loop, loop_num, loop_depth, loop_header,
+ loop_nb_iterations, loop_num_exits, loop_exit_edges,
+ loop_exit_edge): New inline functions.
+ (loop_is_included_in): Declare here.
+ * tree-flow-inline.h (loop_of_stmt): New inline function.
+ * tree-scalar-evolution.c (loop_is_included_in): Remove declaration.
+ (stmt_is_in_loop, stmt_is_not_in_loop): New functions.
+ (loop_is_included_in, loop_is_included_in_rec): Moved up in the same file.
+
+2004-01-06 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-vectorizer.c: Fix typos.
+
+2004-01-05 Andreas Jaeger <aj@suse.de>
+
+ * tree-vectorizer.h: Follow coding standards, remove extra
+ whitespace.
+ * tree-vectorizer.c: Likewise.
+
+ * tree-vectorizer.c (vectorize_loops): Output statistics to
+ dump_file, fix printf string.
+ (vect_transform_loop): Replace DBG_VECT code with code dumping
+ dependend on TDF_DETAILS to dump_file.
+ (vect_is_supportable_binop): Likewise.
+ (vect_analyze_operations): Likewise.
+ (get_address_calculation_operands): Likewise.
+ (vect_analyze_scalar_cycles): Likewise.
+ (vect_analyze_data_ref_dependence): Likewise.
+ (vect_analyze_data_ref_access): Likewise.
+ (vect_analyze_data_ref_accesses): Likewise.
+ (vect_analyze_data_refs): Likewise.
+ (vect_mark_relevant): Likewise.
+ (vect_get_loop_niters): Likewise.
+ (vect_mark_stmts_to_be_vectorized): Likewise.
+ (vect_analyze_loop_form): Likewise.
+ (vectorize_loops): Likewise.
+
+ * tree-vectorizer.h (DBG_VEC): Remove.
+
+2004-01-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * doloop.c (doloop_optimize): Update number of iterations for the
+ loops entered at bottom.
+
+2004-01-04 Andreas Jaeger <aj@suse.de>
+
+ * common.opt: Re-order some options in ASCII collating orders.
+
+2004-01-03 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * cfghooks.h (struct cfg_hooks): New fields split_block_after_labels
+ and move_block_after, type of cfgh_make_forwarder_block field changed.
+ (HEADER_BLOCK, LATCH_EDGE): Moved to cfgloop.c.
+ (split_block_after_labels, move_block_after): New macros.
+ (make_forwarder_block): Changed.
+ * cfgloop.c (HEADER_BLOCK, LATCH_EDGE): Moved from cfghooks.h.
+ (update_latch_info, mfb_keep_just, mfb_keep_nonlatch,
+ fill_sons_in_loop): New functions.
+ (canonicalize_loop_headers): Changed due to changes in
+ make_forwarder_block.
+ * cfgloopmanip.c (split_loop_bb): Don't update dominators.
+ (create_preheader): Use make_forwarder_block.
+ (mfb_keep_just, mfb_update_loops): New.
+ * cfgrtl.c (rtl_split_block_after_labels): New.
+ (redirect_edge_with_latch_update): Removed.
+ (rtl_make_forwarder_block): New sematics.
+ (rtl_split_block): Update dominators.
+ (rtl_cfg_hooks, cfg_layout_rtl_cfg_hooks):
+ Add rtl_split_block_after_labels.
+ * tree-cfg.c (tree_make_forwarder_block): Changed semantics.
+ (create_blocks_annotations): Removed.
+ (build_tree_cfg): Don't call create_blocks_annotations.
+ (create_bb): Create annotations for a new block.
+ (tree_split_edge): Don't call create_block_annotation.
+ Update irreducible loop information.
+ (tree_loop_optimizer_finalize): Add loop structure check.
+ (tree_redirect_edge_and_branch_1): Return the original edge if
+ no redirecting is neccessary.
+ (tree_split_block): Make the semantics same as for rtl_split_block.
+ (tree_split_block_after_labels, tree_move_block_after): New.
+ (tree_cfg_hooks): Add tree_split_block_after_labels and
+ tree_move_block_after.
+
+ * cfgloopanal.c (mark_irreducible_loops): Fix.
+ * loop-unswitch.c (unswitch_loop): Fix.
+
+ * Makefile.in (tree-ssa-loop.o): Add cfgloop.h and tree-inline.h
+ dependency.
+ * jump.c (next_nonnote_insn_in_loop, duplicate_loop_exit_test,
+ copy_loop_headers): Removed.
+ * rtl.h (copy_loop_headers): Declaration removed.
+ * toplev.c (rest_of_compilation): Do not call loop header copying.
+ * tree-dump.c (dump_files): Add .ch dump.
+ * tree-flow.h (tree_duplicate_bb, copy_loop_headers): Declare.
+ * tree-optimize.c (optimize_function_tree): Add loop header copying
+ pass.
+ * tree-ssa-loop.c: Include cfgloop.h and tree-inline.h.
+ (dump_file, dump_flags): Renamed to loop_dump_file and
+ loop_dump_flags.
+ (call_expr_p, should_duplicate_loop_header_p, copy_loop_headers):
+ New.
+ * tree.h (enum tree_dump_index): Add ch dump.
+ * doc/invoke.texi (-fdump-tree-copy-headers): Document.
+ * testsuite/gcc.dg/tree-ssa/20030711-1.c: Update test outcome.
+ * testsuite/gcc.dg/tree-ssa/20030714-2.c: Ditto.
+ * testsuite/gcc.dg/tree-ssa/copy-headers.c: New test.
+ * tree-cfg.c (tree_duplicate_bb): New function.
+
+ * tree-ssa-loop-im.c: New file.
+ * Makefile.in (tree-ssa-loop-im.o): Add.
+ * params.def (PARAM_LIM_EXPENSIVE): New parameter.
+ * tree-dump.c (dump_files): Move .loop dump.
+ * cfgloop.h (superloop_at_depth, get_loop_body_in_dom_order): Declare.
+ (loop_dump_file, loop_dump_flags): Declare variables.
+ * cfgloop.c (superloop_at_depth, get_loop_body_in_dom_order): New
+ functions.
+ * tree-flow.h (struct stmt_ann_d): Add aux field.
+ (bsi_commit_edge_inserts): Declaration changed.
+ (tree_ssa_lim): Declare.
+ * tree-mudflap.c (mf_xform_derefs_1): Use in_array_bounds_p.
+ * tree-optimize.c (optimize_function_tree): Move loop optimization
+ pass.
+ * tree-sra.c (scalarize_structures): Modified due to
+ bsi_commit_edge_inserts change.
+ * tree-ssa-loop.c (tree_ssa_loop_opt): Call tree_ssa_lim.
+ * tree-ssa.c (rewrite_trees, rewrite_vars_out_of_ssa): Modified due to
+ bsi_commit_edge_inserts change.
+ * tree.c (in_array_bounds_p): New function.
+ * tree.h (in_array_bounds_p): Declare.
+ (enum tree_dump_index): Move loop dump.
+ * tree-cfg.c (bsi_commit_edge_inserts): Don't take update_annotations
+ argument.
+
+ * tree-ssa.c (rewrite_into_ssa, rewrite_out_of_ssa): Ensure that the
+ closed files are not used.
+
+ * tree-tailcall.c (find_tail_calls, eliminate_tail_call): Update
+ phi nodes for vdefs of the eliminated call.
+
+2004-01-03 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-optimize.c (optimize_function_tree): Move the closing brace of
+ DCE2 to the right place.
+
+2004-01-03 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-vectorizer.c (vect_analyze_operations): Test vectorization_factor
+ before computing modulo.
+
+2004-01-02 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-vectorizer.c (vect_is_supportable_binop): Returns false instead
+ of NULL.
+
+2004-01-02 Richard Henderson <rth@redhat.com>
+
+ * config/i386/i386.h (UNITS_PER_SIMD_WORD): New.
+
+2004-01-02 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-data-ref.c (vec_analyze_array, vec_array_base_name_differ_p,
+ array_base_name_differ_p): Removed for fixing the previous patch.
+
+2004-01-02 Richard Henderson <rth@redhat.com>
+
+ * target.h (struct gcc_target): Remove vectype_for_scalar_type.
+ * target-def.h (TARGET_VECTYPE_FOR_SCALAR_TYPE): Remove.
+ * config/rs6000/rs6000.c (rs6000_vectype_for_scalar_type): Remove.
+ (TARGET_VECTYPE_FOR_SCALAR_TYPE): Remove.
+
+ * tree.c (build_vector_type_with_mode): Rename from make_vector,
+ remove unsignedp argument, update callers.
+ (build_vector_type): New.
+ * tree.h (build_vector_type): Declare it.
+ * tree-vectorizer.c (get_vectype_for_scalar_type): Use it.
+
+2004-01-02 Richard Henderson <rth@redhat.com>
+
+ * tree-scalar-evolution.c (finalize_scalar_evolutions_analyzer):
+ Clear dump_file.
+
+2004-01-02 Sebastian Pop <s.pop@laposte.net>
+
+ * tree-data-ref.c (vec_analyze_array): Renamed to analyze_array.
+ (analyze_array): Removed.
+ (find_data_references): Adapted to use the new analyze_array
+ function.
+ (array_base_name_differ_p): Moved to tree-data-ref.h.
+ (vec_array_base_name_differ_p): Removed.
+ * tree-data-ref.h (array_base_name_differ_p): Moved here.
+ * tree-vectorizer.c (vect_analyze_data_ref_dependence): Use
+ array_base_name_differ_p instead of vec_array_base_name_differ_p.
+ (vect_analyze_data_refs): Use analyze_array instead of
+ vec_analyze_array.
+ (vectorize_loops): Remove the initializers and finalizers of the
+ scalar evolution analyzer.
+
+2004-01-01 Dorit Naishlos <dorit@il.ibm.com>
+
+ * tree-vectorizer.c: New file. Implements loop vectorization
+ pass.
+ * tree-vectorizer.h: New file.
+ * Makefile.in: (tree-vectorizer.c,tree-vectorizer.h): New files.
+ * tree-dump.c: (dump_files): New dump file for the new
+ vectorization pass.
+ * tree.h: (TDI_vect): New dump index for the new vectorization
+ pass.
+ * timevar.def (TV_TREE_VECTORIZATION): Support new
+ vectorization pass.
+ * opts.c: (flag_tree_vetorize): New flag to enable/disable the
+ new vectorization pass.
+ * flags.h: Same.
+ * toplev.c: Same.
+ * common.opt: (ftree-vectorize): Same.
+ * doc/invoke.texi: Document above new options.
+ * tree-optimize.c: (optimize_function_tree): Invoke the new
+ vetorization pass.
+ * tree-flow.h: (struct stmt_ann_d): New field (aux) to allow
+ recording information per stmt.
+ * tree-data-ref.c (vec_analyze_array): New function, exposing
+ API to the vectorizer.
+ (vec_array_base_name_differ_p): New function, exposing API to
+ the vectorizer.
+ * tree-data-ref.h: Same.
+ * defaults.h: (UNITS_PER_SIMD_WORD): Define.
+ * config/rs6000/rs6000.h: (UNITS_PER_SIMD_WORD): Same.
+ * target-def.h (TARGET_VECTYPE_FOR_SCALAR_TYPE): Declare a new
+ target hook for vectorization.
+ * target.h (vectype_for_scalar_type): Same.
+ * config/rs6000/rs6000.c: (rs6000_vectype_for_scalar_type):
+ Implement the above new target hook.
+
+2003-12-31 Sebastian Pop <s.pop@laposte.net>
+
+ * version.c (version_string): Change the identifier for the
+ sub-branch.
+
+2003-12-31 Sebastian Pop <s.pop@laposte.net>
+ Daniel Berlin <dberlin@dberlin.org>
+
+ * tree-phinodes.c (create_phi_node): Initialise PHI_MARKED to 0.
+ * tree-scalar-evolution.c (already_visited,
+ node_already_visited_by_ssa_path): Removed.
+ (analyze_evolution): Remove initialisation of already_visited.
+ (construct_schedule): idem.
+ (monev_follow_ssa_edge): use PHI_MARKED for deciding whether
+ to analyze the phi-node.
+ (follow_ssa_edge_and_record_dependences_rec): idem.
+ * tree.h (PHI_MARKED): New macro.
+ (tree_phi_node): Add a field marked.
+
+2003-12-27 Sebastian Pop <s.pop@laposte.net>
+
+ * Makefile.in (OBJS-common): Added tree-chrec.o
+ tree-scalar-evolution.o, tree-data-ref.o, tree-fold-const.o.
+ (tree-optimize.o): Add dependencies on tree-fold-const.h
+ tree-chrec.h tree-scalar-evolution.h tree-data-ref.h
+ (tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o,
+ tree-fold-const.o): New rules.
+ * cfgloop.h (loop): New field nb_iterations.
+ (loop_from_num): New function.
+ * common.opt (fscalar-evolutions, fall-data-deps): Added.
+ * flags.h (flag_scalar_evolutions, flag_all_data_deps): Declared.
+ * opts.c (decode_options, common_handle_option): Initialize
+ flag_scalar_evolutions and flag_all_data_deps.
+ * timevar.def (TV_SCALAR_EVOLUTIONS, TV_ALL_DATA_DEPS): New.
+ * toplev.c (flag_scalar_evolutions, flag_all_data_deps): Defined.
+ (lang_independent_options): Add flag_scalar_evolutions and
+ flag_all_data_deps.
+ * tree-dump.c (scev, alldd): New extensions.
+ * tree.h (tree_dump_index): Added TDI_scev and TDI_alldd.
+ * tree-optimize.c (tree-fold-const.h, tree-chrec.h,
+ tree-scalar-evolution.h, tree-data-ref.h): Included.
+ (optimize_function_tree): Added the entry point for the analysis of
+ scalar evolutions and data dependences.
+ * tree-pretty-print.c (tree-fold-const.h, tree-chrec.h): Included.
+ (dump_generic_node): Added code for dumping POLYNOMIAL_CHREC,
+ EXPONENTIAL_CHREC, PERIODIC_CHREC, and INTERVAL_CHREC.
+ * tree.def (INTERVAL_CHREC, POLYNOMIAL_CHREC, EXPONENTIAL_CHREC,
+ PERIODIC_CHREC): New tree nodes.
+ * varray.h (index_in_varray_tree, tree_is_in_varray_tree_p,
+ index_in_varray_int, int_is_in_varray_int_p): New inlined functions.
+ * tree-chrec.c, tree-chrec.h, tree-data-ref.c, tree-data-ref.h,
+ tree-fold-const.c, tree-fold-const.h, tree-scalar-evolution.c,
+ tree-scalar-evolution.h: New files.
+ * doc/invoke.texi (-fdump-scalar-evolutions, -fdump-all-data-deps):
+ Documented.
+ * testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c : New testcases.
+ * testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c.scev: Expected
+ outputs for the scalar evolution analyzer.
+ * testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-{10, 30, 31, 32, 33, 34,
+ 35, 36}.c.alldd: Expected outputs for the data dependence analyzer.
+ * testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp: New file.
+ * testsuite/lib/scantree.exp (diff-tree-dumps): New procedure.
+ * ChangeLog.lno: New file.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index adc538e9a34..fdc93f74876 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -140,7 +140,7 @@ XCFLAGS =
TCFLAGS =
CFLAGS = -g
STAGE1_CFLAGS = -g @stage1_cflags@
-BOOT_CFLAGS = -g -O2
+BOOT_CFLAGS = -g -O2
# Flags to determine code coverage. When coverage is disabled, this will
# contain the optimization flags, as you normally want code coverage
@@ -163,7 +163,7 @@ coverageexts = .{gcda,gcno}
# -Wno-variadic-macros.
LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
STRICT_WARN = @strict1_warn@
-STRICT2_WARN = -pedantic -Wno-long-long -Wold-style-definition \
+STRICT2_WARN = -pedantic -Wno-long-long -Wno-long-double -Wold-style-definition \
-Wno-variadic-macros @WERROR@
# This is set by --enable-checking. The idea is to catch forgotten
@@ -188,6 +188,16 @@ insn-conditions.o-warn = -Wno-error
# Bison-1.75 output often yields (harmless) -Wtraditional warnings
gengtype-yacc.o-warn = -Wno-error
c-parse.o-warn = -Wno-error
+
+# APPLE LOCAL begin unclean apple code
+darwin-c.o-warn = -Wno-error
+stub-objc.o-warn = -Wno-error
+timevar.o-warn = -Wno-error
+insn-output.o-warn = -Wno-error
+darwin.o-warn = -Wno-error
+insn-emit.o-warn = -Wno-error
+# APPLE LOCAL end unclean apple code
+
# flex output may yield harmless "no previous prototype" warnings
gengtype-lex.o-warn = -Wno-error
# SYSCALLS.c misses prototypes
@@ -508,11 +518,14 @@ INSTALL_LIBGCC = install-libgcc
# Options to use when compiling libgcc2.a.
#
LIBGCC2_DEBUG_CFLAGS = -g
-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@
+# APPLE LOCAL control opt level. ilr
+LIBGCC2_CFLAGS = $(LIBGCC2_OPT) $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@
# Additional options to use when compiling libgcc2.a.
# Some targets override this to -isystem include
LIBGCC2_INCLUDES =
+# APPLE LOCAL control opt level. ilr
+LIBGCC2_OPT = -O2
# Additional target-dependent options for compiling libgcc2.a.
TARGET_LIBGCC2_CFLAGS =
@@ -625,6 +638,24 @@ UNPROTOIZE_INSTALL_NAME := $(shell echo unprotoize|sed '$(program_transform_name
GCOV_INSTALL_NAME := $(shell echo gcov|sed '$(program_transform_name)')
GCCBUG_INSTALL_NAME := $(shell echo gccbug|sed '$(program_transform_name)')
+# APPLE LOCAL begin order files ilr
+# When configure --enable-build_gcc is specified then we know that the
+# makefile was created as a result of using build_gcc. For such builds
+# we want to use the order files in the order-files directory. The
+# makefile will test ORDER_FILES. If it is not null then the appropriate
+# order file is added to the cc1* link.
+#ORDER_FILES = @enable_build_gcc@
+### ORDER FILES ARE CURRENTLY DISABLED. TO ENABLE THEM REMOVE THE LINE ###
+### BELOW AND UNCOMMENT THE LINE ABOVE. ###
+ORDER_FILES =
+ifeq ($(ORDER_FILES),yes)
+CC1_ORDER_FLAGS = `if [ -f $(srcdir)/../order-files/cc1.order ]; then \
+ echo -sectorder __TEXT __text $(srcdir)/../order-files/cc1.order -e start ; fi`
+else
+CC1_ORDER_FLAGS =
+endif
+# APPLE LOCAL end order files ilr
+
# Setup the testing framework, if you have one
EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
echo $${rootme}/../expect/expect ; \
@@ -704,11 +735,13 @@ TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H)
TREE_SIMPLE_H = tree-simple.h tree-iterator.h
TREE_FLOW_H = tree-flow.h tree-flow-inline.h tree-ssa-operands.h \
bitmap.h $(BASIC_BLOCK_H) hard-reg-set.h $(TREE_SIMPLE_H) \
- $(HASHTAB_H)
+ $(HASHTAB_H) tree-dg.h
PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H)
DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H)
C_PRETTY_PRINT_H = $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
+SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h tree-fold-const.h
+
#
# Now figure out from those variables how to compile and link.
@@ -862,10 +895,14 @@ C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \
# Language-specific object files for C.
C_OBJS = c-parse.o c-lang.o stub-objc.o $(C_AND_OBJC_OBJS)
+# APPLE LOCAL debugging
+ # c-idebug.o c-dmp-tree.o
# Language-independent object files.
OBJS-common = \
+ tree-chrec.o tree-scalar-evolution.o tree-data-ref.o tree-fold-const.o \
+ tree-elim-check.o \
tree-cfg.o tree-dfa.o tree-eh.o tree-ssa.o tree-optimize.o tree-simple.o \
tree-alias-type.o gimplify.o tree-pretty-print.o tree-into-ssa.o \
tree-outof-ssa.o tree-alias-common.o tree-ssa-ccp.o tree-browser.o \
@@ -874,12 +911,16 @@ OBJS-common = \
tree-ssa-phiopt.o tree-ssa-forwprop.o tree-nested.o tree-ssa-dse.o \
tree-ssa-dom.o domwalk.o tree-tailcall.o gimple-low.o tree-iterator.o \
tree-phinodes.o tree-ssanames.o tree-sra.o tree-complex.o tree-ssa-loop.o \
+ tree-ssa-loop-unswitch.o \
+ tree-vectorizer.o tree-ssa-loop-im.o tree-ssa-loop-manip.o \
+ tree-ssa-loop-ivopts.o tree-ssa-loop-ivcanon.o tree-dg.o loop-invariant.o \
alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o \
cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfglayout.o cfgloop.o \
- cfgloopanal.o cfgloopmanip.o loop-init.o loop-unswitch.o loop-unroll.o \
+ cfgloopanal.o cfgloopmanip.o loop-iv.o loop-init.o loop-unswitch.o \
+ loop-unroll.o loop-doloop.o tree-ssa-return.o \
cfgrtl.o combine.o conflict.o convert.o coverage.o cse.o cselib.o \
dbxout.o debug.o df.o diagnostic.o dojump.o doloop.o dominance.o \
- dwarf2asm.o dwarf2out.o emit-rtl.o except.o explow.o loop-iv.o \
+ dwarf2asm.o dwarf2out.o emit-rtl.o except.o explow.o \
expmed.o expr.o final.o flow.o fold-const.o function.o gcse.o \
genrtl.o ggc-common.o global.o graph.o gtype-desc.o \
haifa-sched.o hooks.o ifcvt.o insn-attrtab.o insn-emit.o insn-modes.o \
@@ -894,8 +935,9 @@ OBJS-common = \
simplify-rtx.o sreal.o stmt.o stor-layout.o stringpool.o \
targhooks.o timevar.o toplev.o tracer.o tree.o tree-dump.o unroll.o \
varasm.o varray.o version.o vmsdbgout.o xcoffout.o alloc-pool.o \
- et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o passes.o \
- rtl-profile.o tree-profile.o
+ et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o passes.o \
+ lambda-mat.o lambda-trans.o lambda-code.o rtl-profile.o tree-profile.o \
+ tree-loop-linear.o
OBJS-md = $(out_object_file)
OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) hashtable.o tree-inline.o \
@@ -1152,9 +1194,10 @@ $(SPECS): xgcc$(exeext)
gcc-cross: xgcc$(exeext)
cp xgcc$(exeext) gcc-cross$(exeext)
+# APPLE LOCAL order files ilr
cc1$(exeext): $(C_OBJS) $(BACKEND) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1$(exeext) \
- $(C_OBJS) $(BACKEND) $(LIBS)
+ $(C_OBJS) $(BACKEND) $(LIBS) $(CC1_ORDER_FLAGS)
# Build the version of limits.h that we will install.
xlimits.h: glimits.h limitx.h limity.h
@@ -1186,7 +1229,8 @@ libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) $(LIB2ADD_ST) xgcc$(exeext
DPBIT_FUNCS='$(DPBIT_FUNCS)' \
TPBIT='$(TPBIT)' \
TPBIT_FUNCS='$(TPBIT_FUNCS)' \
- MULTILIBS=`$(GCC_FOR_TARGET) --print-multi-lib` \
+ APPLE_LOCAL='APPLE LOCAL libcc_kext' \
+ MULTILIBS=".; static;@static@fno-pic kext;@Dmalloc=kern_os_malloc@Dfree=kern_os_free@DLIBCC_KEXT@static@fno-pic@fno-exceptions$(KEXT_EXTRA_FLAGS)" \
EXTRA_MULTILIB_PARTS='$(EXTRA_MULTILIB_PARTS)' \
SHLIB_LINK='$(SHLIB_LINK)' \
SHLIB_INSTALL='$(SHLIB_INSTALL)' \
@@ -1311,6 +1355,8 @@ c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
c-parse.o : c-parse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(GGC_H) intl.h $(C_TREE_H) input.h flags.h toplev.h output.h $(CPPLIB_H) \
varray.h gt-c-parse.h langhooks.h
+# APPLE LOCAL Objective-C++
+c-parse.o : langhooks.h
srcextra: gcc.srcextra lang.srcextra
@@ -1341,12 +1387,14 @@ c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(
c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(C_TREE_H) $(C_PRETTY_PRINT_H) $(DIAGNOSTIC_H) \
$(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h
-stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(GGC_H) $(C_COMMON_H)
+# APPLE LOCAL Objective-C++
+stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H)
c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) debug.h $(C_TREE_H) $(C_COMMON_H) real.h c-incpath.h cppdefault.h \
c-pragma.h input.h intl.h flags.h toplev.h output.h \
$(CPPLIB_H) $(EXPR_H) $(TM_P_H)
+# APPLE LOCAL AltiVec
+c-lex.o: $(TARGET_H) cpphash.h
c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(C_COMMON_H) $(TREE_H) $(CPPLIB_H) cpphash.h $(TM_P_H) c-pragma.h
c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
@@ -1402,6 +1450,8 @@ c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
c-cppbuiltin.o : c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(C_COMMON_H) c-pragma.h flags.h toplev.h langhooks.h \
output.h except.h real.h $(TM_P_H)
+# APPLE LOCAL pascal strings
+c-cppbuiltin.o : cpplib.h cpphash.h
# A file used by all variants of C and some other languages.
@@ -1503,7 +1553,7 @@ version.o: version.c version.h
gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) varray.h \
$(HASHTAB_H) $(TREE_H) $(RTL_H) function.h insn-config.h $(EXPR_H) $(OPTABS_H) \
libfuncs.h debug.h $(GGC_H) bitmap.h $(BASIC_BLOCK_H) hard-reg-set.h \
- cselib.h insn-addr.h $(TREE_FLOW_H)
+ cselib.h insn-addr.h $(TREE_FLOW_H) tree-data-ref.h tree-dg.h
ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
$(HASHTAB_H) toplev.h $(PARAMS_H) hosthooks.h
@@ -1574,6 +1624,9 @@ tree-ssa-dse.o : tree-ssa-dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
tree-ssa-forwprop.o : tree-ssa-forwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) errors.h $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \
$(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H)
+tree-ssa-return.o : tree-ssa-return.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) errors.h $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \
+ $(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H)
tree-ssa-phiopt.o : tree-ssa-phiopt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) errors.h $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \
$(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H) langhooks.h
@@ -1588,7 +1641,7 @@ tree-ssa-copy.o : tree-ssa-copy.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \
errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
- $(BASIC_BLOCK_H) domwalk.h real.h tree-pass.h flags.h langhooks.h
+ $(BASIC_BLOCK_H) domwalk.h real.h tree-pass.h flags.h langhooks.h cfgloop.h
tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) varray.h $(GGC_H) gt-tree-ssanames.h
tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -1632,9 +1685,29 @@ tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_H) flags.h function.h except.h langhooks.h \
$(GGC_H) tree-pass.h gt-tree-eh.h
tree-ssa-loop.o : tree-ssa-loop.c $(TREE_FLOW_H) $(CONFIG_H) \
+ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) cfgloop.h tree-inline.h \
+ output.h diagnostic.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
+ tree-pass.h flags.h
+tree-ssa-loop-im.o : tree-ssa-loop-im.c $(TREE_FLOW_H) $(CONFIG_H) \
+ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) cfgloop.h domwalk.h $(PARAMS_H)\
+ output.h diagnostic.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
+ tree-pass.h flags.h
+tree-ssa-loop-unswitch.o : tree-ssa-loop-unswitch.c $(TREE_FLOW_H) $(CONFIG_H) \
+ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) cfgloop.h domwalk.h $(PARAMS_H)\
+ output.h diagnostic.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
+ tree-pass.h
+tree-ssa-loop-ivcanon.o : tree-ssa-loop-ivcanon.c $(TREE_FLOW_H) $(CONFIG_H) \
+ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) cfgloop.h $(PARAMS_H) tree-inline.h \
+ output.h diagnostic.h $(TM_H) coretypes.h $(TREE_DUMP_H) flags.h \
+ tree-pass.h $(SCEV_H)
+tree-ssa-loop-ivopts.o : tree-ssa-loop-ivopts.c $(TREE_FLOW_H) $(CONFIG_H) \
+ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) cfgloop.h varray.h $(EXPR_H) \
+ output.h diagnostic.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
+ tree-pass.h $(GGC_H) $(RECOG_H) insn-config.h $(HASHTAB_H) $(SCEV_H)
+tree-ssa-loop-manip.o : tree-ssa-loop-manip.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) cfgloop.h \
output.h diagnostic.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
- tree-pass.h flags.h tree-inline.h
+ tree-pass.h
tree-ssa-alias.o : tree-ssa-alias.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) tree-inline.h flags.h \
function.h $(TIMEVAR_H) tree-alias-common.h convert.h $(TM_H) coretypes.h \
@@ -1660,6 +1733,35 @@ gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) errors.h \
tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) errors.h tree-inline.h diagnostic.h $(HASHTAB_H) \
$(TM_H) coretypes.h
+tree-fold-const.o: tree-fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) errors.h $(GGC_H) $(TREE_H) tree-fold-const.h
+tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ errors.h $(GGC_H) $(TREE_H) tree-chrec.h tree-fold-const.h tree-pass.h
+tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h $(TM_H) errors.h $(GGC_H) $(TREE_H) $(RTL_H) \
+ $(BASIC_BLOCK_H) diagnostic.h $(TREE_FLOW_H) $(TREE_DUMP_H) \
+ $(TIMEVAR_H) cfgloop.h $(SCEV_H) \
+ tree-data-ref.h tree-pass.h tree-vectorizer.h flags.h
+tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ errors.h $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) diagnostic.h \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) cfgloop.h \
+ tree-data-ref.h $(SCEV_H) tree-pass.h
+tree-dg.o: tree-dg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) flags.h \
+ errors.h $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
+ $(TIMEVAR_H) cfgloop.h tree-data-ref.h \
+ tree-pass.h tree-dg.h $(TIMEVAR_H) $(TREE_DUMP_H) diagnostic.h $(SCEV_H)
+tree-elim-check.o: tree-elim-check.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ errors.h $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) diagnostic.h \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) cfgloop.h $(SCEV_H) \
+ tree-pass.h
+tree-vectorizer.o: tree-vectorizer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ errors.h $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) diagnostic.h \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) cfgloop.h tree-pass.h \
+ tree-vectorizer.h tree-data-ref.h $(SCEV_H)
+tree-loop-linear.o: tree-loop-linear.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ errors.h $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) diagnostic.h \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) cfgloop.h tree-pass.h \
+ tree-data-ref.h $(SCEV_H)
c-call-graph.o : c-call-graph.c $(CONFIG_H) $(SYSTEM_H) $(C_TREE_H) \
$(C_COMMON_H) diagnostic.h hard-reg-set.h $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
$(TM_H) coretypes.h
@@ -1835,7 +1937,13 @@ web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
hard-reg-set.h flags.h real.h insn-config.h $(GGC_H) $(RECOG_H) $(EXPR_H) \
$(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) \
- except.h gt-gcse.h $(TREE_H) cselib.h
+ except.h gt-gcse.h $(TREE_H)
+lambda-mat.o : lambda-mat.c lambda.h $(GGC_H) $(SYSTEM_H) $(CONFIG_H) $(TM_H)
+lambda-trans.o: lambda-trans.c lambda.h $(GGC_H) $(SYSTEM_H) $(CONFIG_H) $(TM_H)
+lambda-code.o: lambda-code.c lambda.h $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
+ errors.h $(TM_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) diagnostic.h \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) cfgloop.h \
+ tree-data-ref.h $(SCEV_H)
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) coretypes.h \
$(TM_H) $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \
$(INSN_ATTR_H) except.h $(PARAMS_H) $(TM_P_H)
@@ -1858,7 +1966,7 @@ tree-complex.o : tree-complex.c $(CONFIG_H) system.h $(TREE_H) \
flags.h
df.o : df.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
insn-config.h $(RECOG_H) function.h $(REGS_H) alloc-pool.h hard-reg-set.h \
- $(BASIC_BLOCK_H) df.h $(FIBHEAP_H)
+ $(BASIC_BLOCK_H) df.h
var-tracking.o : var-tracking.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) hard-reg-set.h insn-config.h reload.h flags.h \
$(BASIC_BLOCK_H) output.h sbitmap.h alloc-pool.h $(FIBHEAP_H) $(HASHTAB_H)
@@ -1884,6 +1992,9 @@ loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(L
doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
$(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h \
cfgloop.h
+loop-doloop.o : loop-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(RTL_H) flags.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \
+ toplev.h cfgloop.h output.h $(PARAMS_H)
unroll.o : unroll.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) insn-config.h \
function.h $(INTEGRATE_H) $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) $(LOOP_H) toplev.h \
hard-reg-set.h varray.h $(BASIC_BLOCK_H) $(TM_P_H) $(PREDICT_H) $(PARAMS_H) \
@@ -1913,6 +2024,9 @@ cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \
$(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h flags.h
cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h $(EXPR_H) coretypes.h $(TM_H)
+loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(GGC_H) \
+ $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h $(EXPR_H) coretypes.h $(TM_H) \
+ function.h flags.h df.h
loop-iv.o : loop-iv.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(GGC_H) \
$(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h $(EXPR_H) coretypes.h $(TM_H)
cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
@@ -1995,7 +2109,7 @@ sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H)
$(INSN_ATTR_H) toplev.h $(RECOG_H) except.h cselib.h $(PARAMS_H) $(TM_P_H)
sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
sched-int.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \
- $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(TARGET_H)
+ $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(PARAMS_H) $(TM_P_H) $(TARGET_H)
sched-ebb.o : sched-ebb.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
sched-int.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \
$(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(PARAMS_H)
@@ -2041,6 +2155,23 @@ params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) topl
hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
pretty-print.o: $(CONFIG_H) $(SYSTEM_H) pretty-print.c $(PRETTY_PRINT_H)
+# APPLE LOCAL debugging
+# Suppress all warnings explicitly for the idebug builds since there can be
+# many when, and if, -traditional-cpp is used.
+c-idebug.o : c-idebug.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(TREE_H) $(C_TREE_H) $(RTL_H) flags.h idebug.c
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -Wno-traditional -w $(srcdir)/c-idebug.c -o c-idebug.o
+
+# APPLE LOCAL begin new tree dump
+dmp-tree.o : dmp-tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GGC_H) $(C_COMMON_H) \
+ langhooks.h dmp-tree.h $(TM_H) coretypes.h real.h
+c-dmp-tree.o : c-dmp-tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GGC_H) \
+ $(C_TREE_H) dmp-tree.h $(TM_H) coretypes.h
+# Additional dependencies for existing rules for new tree dump
+c-decl.o : dmp-tree.h
+tree.o : dmp-tree.h
+# APPLE LOCAL end new tree dump
+
$(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) $(GGC_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) libfuncs.h \
@@ -2266,13 +2397,13 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h $(srcdir)/cpplib.h \
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
$(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
$(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
- $(srcdir)/fold-const.c $(srcdir)/function.c \
+ $(srcdir)/fold-const.c $(srcdir)/function.c $(srcdir)/tree-data-ref.h \
$(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \
$(srcdir)/profile.c $(srcdir)/ra-build.c $(srcdir)/regclass.c \
$(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/langhooks.c \
$(srcdir)/sdbout.c $(srcdir)/stmt.c $(srcdir)/stor-layout.c \
$(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
- $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \
+ $(srcdir)/tree-mudflap.c $(srcdir)/tree-dg.h $(srcdir)/tree-flow.h \
$(srcdir)/c-objc-common.c $(srcdir)/c-common.c $(srcdir)/c-parse.in \
$(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c \
$(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
@@ -2848,10 +2979,12 @@ srcinfo: $(INFOFILES)
TEXI_CPP_FILES = cpp.texi fdl.texi cppenv.texi cppopts.texi
+# APPLE LOCAL GPL compliance
TEXI_GCC_FILES = gcc.texi gcc-common.texi frontends.texi standards.texi \
invoke.texi extend.texi md.texi objc.texi gcov.texi trouble.texi \
bugreport.texi service.texi contribute.texi compat.texi funding.texi \
- gnu.texi gpl.texi fdl.texi contrib.texi cppenv.texi cppopts.texi
+ gnu.texi gpl.texi fdl.texi contrib.texi cppenv.texi cppopts.texi \
+ sourcecode.texi
TEXI_GCCINT_FILES = gccint.texi gcc-common.texi contribute.texi makefile.texi \
configterms.texi portability.texi interface.texi passes.texi \
@@ -2868,6 +3001,38 @@ TEXI_CPPINT_FILES = cppinternals.texi
# patterns. To use them, put each of the specific targets with its
# specific dependencies but no build commands.
+# APPLE LOCAL begin html mrs
+htmldir = doc/HTML/gcc-$(version)
+.PHONY: html
+doc: html
+html: $(htmldir)/gcc/index.html $(htmldir)/cpp/index.html
+
+$(htmldir)/cpp/index.html: $(TEXI_CPP_FILES)
+ $(SHELL) ${srcdir}/mkinstalldirs $(htmldir)/cpp
+ $(MAKEINFO) --html -I $(docdir) -I $(docdir)/include \
+ -o $(htmldir)/cpp $(docdir)/cpp.texi
+
+$(htmldir)/gcc/index.html: $(TEXI_GCC_FILES)
+ $(SHELL) ${srcdir}/mkinstalldirs $(htmldir)/gcc
+ $(MAKEINFO) --html -I $(docdir) -I $(docdir)/include \
+ -o $(htmldir)/gcc $(docdir)/gcc.texi
+
+$(htmldir)/gccint/index.html: $(TEXI_GCCINT_FILES)
+ $(SHELL) ${srcdir}/mkinstalldirs $(htmldir)/gccint
+ $(MAKEINFO) --html -I $(docdir) -I $(docdir)/include \
+ -o $(htmldir)/gccint $(docdir)/gccint.texi
+
+$(htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
+ $(SHELL) ${srcdir}/mkinstalldirs $(htmldir)/gccinstall
+ $(MAKEINFO) --html -I $(docdir) -I $(docdir)/include \
+ -o $(htmldir)/gccinstall $(docdir)/install.texi
+
+$(htmldir)/cppinternals/index.html: $(TEXI_CPPINT_FILES)
+ $(SHELL) ${srcdir}/mkinstalldirs $(htmldir)/cppinternals
+ $(MAKEINFO) --html -I $(docdir) -I $(docdir)/include \
+ -o $(htmldir)/cppinternals $(docdir)/cppinternals.texi
+# APPLE LOCAL end html mrs
+
doc/cpp.info: $(TEXI_CPP_FILES)
doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
@@ -2898,15 +3063,16 @@ doc/%.dvi: %.texi
$(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
# Duplicate entry to handle renaming of gccinstall.dvi
+
doc/gccinstall.dvi: $(TEXI_GCCINSTALL_FILES)
$(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 doc/fsf-funding.7
-generated-manpages: man
-
man: $(MANFILES) lang.man @GENINSRC@ srcman lang.srcman
+generated-manpages: man
+
srcman: $(MANFILES)
-cp -p $^ $(srcdir)/doc
diff --git a/gcc/ada/5qsystem.ads b/gcc/ada/5qsystem.ads
deleted file mode 100644
index 4d17cdacde5..00000000000
--- a/gcc/ada/5qsystem.ads
+++ /dev/null
@@ -1,236 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M --
--- --
--- S p e c --
--- (OpenVMS 64bit GCC_ZCX DEC Threads Version) --
--- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
--- --
--- This specification is derived from the Ada Reference Manual for use with --
--- GNAT. The copyright notice above, and the license provisions that follow --
--- apply solely to the contents of the part following the private keyword. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
-package System is
-pragma Pure (System);
--- Note that we take advantage of the implementation permission to
--- make this unit Pure instead of Preelaborable, see RM 13.7(36)
-
- type Name is (SYSTEM_NAME_GNAT);
- System_Name : constant Name := SYSTEM_NAME_GNAT;
-
- -- System-Dependent Named Numbers
-
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
-
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
-
- Max_Base_Digits : constant := Long_Long_Float'Digits;
- Max_Digits : constant := Long_Long_Float'Digits;
-
- Max_Mantissa : constant := 63;
- Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
-
- Tick : constant := 0.01;
-
- -- Storage-related Declarations
-
- type Address is private;
- Null_Address : constant Address;
-
- Storage_Unit : constant := 8;
- Word_Size : constant := 64;
- Memory_Size : constant := 2 ** 64;
-
- -- Address comparison
-
- function "<" (Left, Right : Address) return Boolean;
- function "<=" (Left, Right : Address) return Boolean;
- function ">" (Left, Right : Address) return Boolean;
- function ">=" (Left, Right : Address) return Boolean;
- function "=" (Left, Right : Address) return Boolean;
-
- pragma Import (Intrinsic, "<");
- pragma Import (Intrinsic, "<=");
- pragma Import (Intrinsic, ">");
- pragma Import (Intrinsic, ">=");
- pragma Import (Intrinsic, "=");
-
- -- Other System-Dependent Declarations
-
- type Bit_Order is (High_Order_First, Low_Order_First);
- Default_Bit_Order : constant Bit_Order := Low_Order_First;
-
- -- Priority-related Declarations (RM D.1)
-
- Max_Priority : constant Positive := 30;
- Max_Interrupt_Priority : constant Positive := 31;
-
- subtype Any_Priority is Integer range 0 .. 31;
- subtype Priority is Any_Priority range 0 .. 30;
- subtype Interrupt_Priority is Any_Priority range 31 .. 31;
-
- Default_Priority : constant Priority := 15;
-
-private
-
- type Address is mod Memory_Size;
- Null_Address : constant Address := 0;
-
- --------------------------------------
- -- System Implementation Parameters --
- --------------------------------------
-
- -- These parameters provide information about the target that is used
- -- by the compiler. They are in the private part of System, where they
- -- can be accessed using the special circuitry in the Targparm unit
- -- whose source should be consulted for more detailed descriptions
- -- of the individual switch values.
-
- AAMP : constant Boolean := False;
- Backend_Divide_Checks : constant Boolean := False;
- Backend_Overflow_Checks : constant Boolean := False;
- Command_Line_Args : constant Boolean := True;
- Configurable_Run_Time : constant Boolean := False;
- Denorm : constant Boolean := False;
- Duration_32_Bits : constant Boolean := False;
- Exit_Status_Supported : constant Boolean := True;
- Fractional_Fixed_Ops : constant Boolean := False;
- Frontend_Layout : constant Boolean := False;
- Functions_Return_By_DSP : constant Boolean := False;
- Machine_Overflows : constant Boolean := False;
- Machine_Rounds : constant Boolean := True;
- OpenVMS : constant Boolean := True;
- Signed_Zeros : constant Boolean := True;
- Stack_Check_Default : constant Boolean := True;
- Stack_Check_Probes : constant Boolean := True;
- Support_64_Bit_Divides : constant Boolean := True;
- Support_Aggregates : constant Boolean := True;
- Support_Composite_Assign : constant Boolean := True;
- Support_Composite_Compare : constant Boolean := True;
- Support_Long_Shifts : constant Boolean := True;
- Suppress_Standard_Library : constant Boolean := False;
- Use_Ada_Main_Program_Name : constant Boolean := False;
- ZCX_By_Default : constant Boolean := True;
- GCC_ZCX_Support : constant Boolean := True;
- Front_End_ZCX_Support : constant Boolean := False;
-
- -- Obsolete entries, to be removed eventually (bootstrap issues!)
-
- High_Integrity_Mode : constant Boolean := False;
- Long_Shifts_Inlined : constant Boolean := False;
-
- --------------------------
- -- Underlying Priorities --
- ---------------------------
-
- -- Important note: this section of the file must come AFTER the
- -- definition of the system implementation parameters to ensure
- -- that the value of these parameters is available for analysis
- -- of the declarations here (using Rtsfind at compile time).
-
- -- The underlying priorities table provides a generalized mechanism
- -- for mapping from Ada priorities to system priorities. In some
- -- cases a 1-1 mapping is not the convenient or optimal choice.
-
- -- For DEC Threads OpenVMS, we use the full range of 31 priorities
- -- in the Ada model, but map them by compression onto the more limited
- -- range of priorities available in OpenVMS.
-
- -- To replace the default values of the Underlying_Priorities mapping,
- -- copy this source file into your build directory, edit the file to
- -- reflect your desired behavior, and recompile with the command:
-
- -- $ gcc -c -O3 -gnatpgn system.ads
-
- -- then recompile the run-time parts that depend on this package:
-
- -- $ gnatmake -a -gnatn -O3 <your application>
-
- -- then force rebuilding your application if you need different options:
-
- -- $ gnatmake -f <your options> <your application>
-
- type Priorities_Mapping is array (Any_Priority) of Integer;
- pragma Suppress_Initialization (Priorities_Mapping);
- -- Suppress initialization in case gnat.adc specifies Normalize_Scalars
-
- Underlying_Priorities : constant Priorities_Mapping :=
-
- (Priority'First => 16,
-
- 1 => 17,
- 2 => 18,
- 3 => 18,
- 4 => 18,
- 5 => 18,
- 6 => 19,
- 7 => 19,
- 8 => 19,
- 9 => 20,
- 10 => 20,
- 11 => 21,
- 12 => 21,
- 13 => 22,
- 14 => 23,
-
- Default_Priority => 24,
-
- 16 => 25,
- 17 => 25,
- 18 => 25,
- 19 => 26,
- 20 => 26,
- 21 => 26,
- 22 => 27,
- 23 => 27,
- 24 => 27,
- 25 => 28,
- 26 => 28,
- 27 => 29,
- 28 => 29,
- 29 => 30,
-
- Priority'Last => 30,
-
- Interrupt_Priority => 31);
-
- ----------------------------
- -- Special VMS Interfaces --
- ----------------------------
-
- procedure Lib_Stop (I : in Integer);
- pragma Interface (C, Lib_Stop);
- pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value));
- -- Interface to VMS condition handling. Used by RTSfind and pragma
- -- {Import,Export}_Exception. Put here because this is the only
- -- VMS specific package that doesn't drag in tasking.
-
-end System;
diff --git a/gcc/ada/5xcrtl.ads b/gcc/ada/5xcrtl.ads
deleted file mode 100644
index dd3292e384a..00000000000
--- a/gcc/ada/5xcrtl.ads
+++ /dev/null
@@ -1,159 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M . C R T L --
--- --
--- S p e c --
--- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides the low level interface to the C Run Time Library
--- on 64 bit VMS
-
-with System.Parameters;
-package System.CRTL is
-pragma Preelaborate (CRTL);
-
- subtype chars is System.Address;
- -- Pointer to null-terminated array of characters
-
- subtype FILEs is System.Address;
- -- Corresponds to the C type FILE*
-
- subtype int is Integer;
-
- type long is range -(2 ** (System.Parameters.long_bits - 1))
- .. +(2 ** (System.Parameters.long_bits - 1)) - 1;
-
- subtype off_t is Integer;
-
- type size_t is mod 2 ** Standard'Address_Size;
-
- function atoi (A : System.Address) return Integer;
- pragma Import (C, atoi, "decc$atoi");
-
- procedure clearerr (stream : FILEs);
- pragma Import (C, clearerr, "decc$clearerr");
-
- function fclose (stream : FILEs) return int;
- pragma Import (C, fclose, "decc$fclose");
-
- function fdopen (handle : int; mode : chars) return FILEs;
- pragma Import (C, fdopen, "decc$fdopen");
-
- function fflush (stream : FILEs) return int;
- pragma Import (C, fflush, "decc$fflush");
-
- function fgetc (stream : FILEs) return int;
- pragma Import (C, fgetc, "decc$fgetc");
-
- function fgets (strng : chars; n : int; stream : FILEs) return chars;
- pragma Import (C, fgets, "decc$fgets");
-
- function fopen (filename : chars; Mode : chars) return FILEs;
- pragma Import (C, fopen, "decc$fopen");
-
- function fputc (C : int; stream : FILEs) return int;
- pragma Import (C, fputc, "decc$fputc");
-
- function fputs (Strng : chars; Stream : FILEs) return int;
- pragma Import (C, fputs, "decc$fputs");
-
- procedure free (Ptr : System.Address);
- pragma Import (C, free, "decc$free");
-
- function freopen
- (filename : chars;
- mode : chars;
- stream : FILEs)
- return FILEs;
- pragma Import (C, freopen, "decc$freopen");
-
- function fseek
- (stream : FILEs;
- offset : long;
- origin : int)
- return int;
- pragma Import (C, fseek, "decc$fseek");
-
- function ftell (stream : FILEs) return long;
- pragma Import (C, ftell, "decc$ftell");
-
- function getenv (S : String) return System.Address;
- pragma Import (C, getenv, "decc$getenv");
-
- function isatty (handle : int) return int;
- pragma Import (C, isatty, "decc$isatty");
-
- function lseek (fd : int; offset : off_t; direction : int) return off_t;
- pragma Import (C, lseek, "decc$lseek");
-
- function malloc (Size : size_t) return System.Address;
- pragma Import (C, malloc, "decc$_malloc64");
-
- procedure memcpy (S1 : System.Address; S2 : System.Address; N : size_t);
- pragma Import (C, memcpy, "decc$_memcpy64");
-
- procedure memmove (S1 : System.Address; S2 : System.Address; N : size_t);
- pragma Import (C, memmove, "decc$_memmove64");
-
- procedure mktemp (template : chars);
- pragma Import (C, mktemp, "decc$_mktemp64");
-
- function read (fd : int; buffer : chars; nbytes : int) return int;
- pragma Import (C, read, "decc$read");
-
- function realloc
- (Ptr : System.Address; Size : size_t) return System.Address;
- pragma Import (C, realloc, "decc$_realloc64");
-
- procedure rewind (stream : FILEs);
- pragma Import (C, rewind, "decc$rewind");
-
- function setvbuf
- (stream : FILEs;
- buffer : chars;
- mode : int;
- size : size_t)
- return int;
- pragma Import (C, setvbuf, "decc$setvbuf");
-
- procedure tmpnam (string : chars);
- pragma Import (C, tmpnam, "decc$_tmpnam64");
-
- function tmpfile return FILEs;
- pragma Import (C, tmpfile, "decc$tmpfile");
-
- function ungetc (c : int; stream : FILEs) return int;
- pragma Import (C, ungetc, "decc$ungetc");
-
- function unlink (filename : chars) return int;
- pragma Import (C, unlink, "decc$unlink");
-
- function write (fd : int; buffer : chars; nbytes : int) return int;
- pragma Import (C, write, "decc$write");
-end System.CRTL;
diff --git a/gcc/ada/5zstchop.adb b/gcc/ada/5zstchop.adb
deleted file mode 100644
index b19bb56f274..00000000000
--- a/gcc/ada/5zstchop.adb
+++ /dev/null
@@ -1,255 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
--- --
--- S Y S T E M . S T A C K _ C H E C K I N G . O P E R A T I O N S --
--- --
--- B o d y --
--- --
--- Copyright (C) 1999-2004 Free Software Foundation, Inc. --
--- --
--- GNARL is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNARL; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNARL was developed by the GNARL team at Florida State University. --
--- Extensive contributions were provided by Ada Core Technologies, Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This is the VxWorks version of this package.
--- This file should be kept synchronized with the general implementation
--- provided by s-stchop.adb.
-
-pragma Restrictions (No_Elaboration_Code);
--- We want to guarantee the absence of elaboration code because the
--- binder does not handle references to this package.
-
-with Ada.Exceptions;
-
-with System.Storage_Elements; use System.Storage_Elements;
-with System.Parameters; use System.Parameters;
-with System.Soft_Links;
-with Interfaces.C;
-with System.OS_Interface;
-
-package body System.Stack_Checking.Operations is
-
- -- In order to have stack checking working appropriately on
- -- VxWorks we need to extract the stack size information from the
- -- VxWorks kernel itself. It means that the library for showing
- -- task-related information needs to be linked into the VxWorks
- -- system, when using stack checking. The TaskShow library can be
- -- linked into the VxWorks system by either:
- -- * defining INCLUDE_SHOW_ROUTINES in config.h when using
- -- configuration header files, or
- -- * selecting INCLUDE_TASK_SHOW when using the Tornado project
- -- facility.
-
- function Set_Stack_Info (Stack : access Stack_Access) return Stack_Access;
-
- -- The function Set_Stack_Info is the actual function that updates
- -- the cache containing a pointer to the Stack_Info. It may also
- -- be used for detecting asynchronous abort in combination with
- -- Invalidate_Self_Cache.
-
- -- Set_Stack_Info should do the following things in order:
- -- 1) Get the Stack_Access value for the current task
- -- 2) Set Stack.all to the value obtained in 1)
- -- 3) Optionally Poll to check for asynchronous abort
-
- -- This order is important because if at any time a write to
- -- the stack cache is pending, that write should be followed
- -- by a Poll to prevent loosing signals.
-
- -- Note: This function must be compiled with Polling turned off
-
- -- Note: on systems like VxWorks and OS/2 with real thread-local storage,
- -- Set_Stack_Info should return an access value for such local
- -- storage. In those cases the cache will always be up-to-date.
-
- -- The following constants should be imported from some system-specific
- -- constants package. The constants must be static for performance reasons.
-
- ----------------------------
- -- Invalidate_Stack_Cache --
- ----------------------------
-
- procedure Invalidate_Stack_Cache (Any_Stack : Stack_Access) is
- pragma Warnings (Off, Any_Stack);
- begin
- Cache := Null_Stack;
- end Invalidate_Stack_Cache;
-
- --------------------
- -- Set_Stack_Info --
- --------------------
-
- function Set_Stack_Info
- (Stack : access Stack_Access) return Stack_Access
- is
-
- -- Task descriptor that is handled internally by the VxWorks kernel
- type Task_Descriptor is record
- T_Id : Interfaces.C.int; -- task identifier
- Td_Name : System.Address; -- task name
- Td_Priority : Interfaces.C.int; -- task priority
- Td_Status : Interfaces.C.int; -- task status
- Td_Options : Interfaces.C.int; -- task option bits (see below)
- Td_Entry : System.Address; -- original entry point of task
- Td_Sp : System.Address; -- saved stack pointer
- Td_PStackBase : System.Address; -- the bottom of the stack
- Td_PStackLimit : System.Address; -- the effective end of the stack
- Td_PStackEnd : System.Address; -- the actual end of the stack
- Td_StackSize : Interfaces.C.int; -- size of stack in bytes
- Td_StackCurrent : Interfaces.C.int; -- current stack usage in bytes
- Td_StackHigh : Interfaces.C.int; -- maximum stack usage in bytes
- Td_StackMargin : Interfaces.C.int; -- current stack margin in bytes
- Td_ErrorStatus : Interfaces.C.int; -- most recent task error status
- Td_Delay : Interfaces.C.int; -- delay/timeout ticks
- end record;
-
- -- This VxWorks procedure fills in a specified task descriptor
- -- for a specified task.
- procedure TaskInfoGet (T_Id : System.OS_Interface.t_id;
- Task_Desc : access Task_Descriptor);
- pragma Import (C, TaskInfoGet, "taskInfoGet");
-
- My_Stack : Stack_Access;
- Task_Desc : aliased Task_Descriptor;
-
- begin
- -- The order of steps 1 .. 3 is important, see specification.
-
- -- 1) Get the Stack_Access value for the current task
-
- My_Stack := Soft_Links.Get_Stack_Info.all;
-
- if My_Stack.Base = Null_Address then
-
- -- First invocation. Ask the VxWorks kernel about stack
- -- values.
- TaskInfoGet (System.OS_Interface.taskIdSelf, Task_Desc'Access);
-
- My_Stack.Size := System.Storage_Elements.Storage_Offset
- (Task_Desc.Td_StackSize);
- My_Stack.Base := Task_Desc.Td_PStackBase;
- My_Stack.Limit := Task_Desc.Td_PStackLimit;
-
- end if;
-
- -- 2) Set Stack.all to the value obtained in 1)
-
- Stack.all := My_Stack;
-
- -- 3) Optionally Poll to check for asynchronous abort
-
- if Soft_Links.Check_Abort_Status.all /= 0 then
- raise Standard'Abort_Signal;
- end if;
-
- return My_Stack; -- Never trust the cached value, but return local copy!
- end Set_Stack_Info;
-
- --------------------
- -- Set_Stack_Size --
- --------------------
-
- -- Specify the stack size for the current frame.
-
- procedure Set_Stack_Size
- (Stack_Size : System.Storage_Elements.Storage_Offset)
- is
- My_Stack : Stack_Access;
- Frame_Address : constant System.Address := My_Stack'Address;
-
- begin
- My_Stack := Stack_Check (Frame_Address);
-
- if Stack_Grows_Down then
- My_Stack.Limit := My_Stack.Base - Stack_Size;
- else
- My_Stack.Limit := My_Stack.Base + Stack_Size;
- end if;
- end Set_Stack_Size;
-
- -----------------
- -- Stack_Check --
- -----------------
-
- function Stack_Check
- (Stack_Address : System.Address) return Stack_Access
- is
- type Frame_Marker is null record;
- Marker : Frame_Marker;
- Cached_Stack : constant Stack_Access := Cache;
- Frame_Address : constant System.Address := Marker'Address;
-
- begin
- -- This function first does a "cheap" check which is correct
- -- if it succeeds. In case of failure, the full check is done.
- -- Ideally the cheap check should be done in an optimized manner,
- -- or be inlined.
-
- if (Stack_Grows_Down and then
- (Frame_Address <= Cached_Stack.Base
- and
- Stack_Address > Cached_Stack.Limit))
- or else
- (not Stack_Grows_Down and then
- (Frame_Address >= Cached_Stack.Base
- and
- Stack_Address < Cached_Stack.Limit))
- then
- -- Cached_Stack is valid as it passed the stack check
- return Cached_Stack;
- end if;
-
- Full_Check :
- declare
- My_Stack : constant Stack_Access := Set_Stack_Info (Cache'Access);
- -- At this point Stack.all might already be invalid, so
- -- it is essential to use our local copy of Stack!
-
- begin
- if (Stack_Grows_Down and then
- Stack_Address < My_Stack.Limit)
- or else
- (not Stack_Grows_Down and then
- Stack_Address > My_Stack.Limit)
- then
- Ada.Exceptions.Raise_Exception
- (E => Storage_Error'Identity,
- Message => "stack overflow detected");
- end if;
-
- return My_Stack;
- end Full_Check;
- end Stack_Check;
-
- ------------------------
- -- Update_Stack_Cache --
- ------------------------
-
- procedure Update_Stack_Cache (Stack : Stack_Access) is
- begin
- if not Multi_Processor then
- Cache := Stack;
- end if;
- end Update_Stack_Cache;
-
-end System.Stack_Checking.Operations;
diff --git a/gcc/ada/s-stchop.adb b/gcc/ada/s-stchop.adb
deleted file mode 100644
index 3a1b1e91a07..00000000000
--- a/gcc/ada/s-stchop.adb
+++ /dev/null
@@ -1,273 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
--- --
--- S Y S T E M . S T A C K _ C H E C K I N G . O P E R A T I O N S --
--- --
--- B o d y --
--- --
--- Copyright (C) 1999-2004 Free Software Foundation, Inc. --
--- --
--- GNARL is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNARL; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNARL was developed by the GNARL team at Florida State University. --
--- Extensive contributions were provided by Ada Core Technologies, Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This is the general implementation of this package. There is a VxWorks
--- specific version of this package (5zstchop.adb). This file should
--- be kept synchronized with it.
-
-pragma Restrictions (No_Elaboration_Code);
--- We want to guarantee the absence of elaboration code because the
--- binder does not handle references to this package.
-
-with Ada.Exceptions;
-
-with System.Storage_Elements; use System.Storage_Elements;
-with System.Parameters; use System.Parameters;
-with System.Soft_Links;
-with System.CRTL;
-
-package body System.Stack_Checking.Operations is
-
- Kilobyte : constant := 1024;
-
- function Set_Stack_Info (Stack : access Stack_Access) return Stack_Access;
-
- -- The function Set_Stack_Info is the actual function that updates
- -- the cache containing a pointer to the Stack_Info. It may also
- -- be used for detecting asynchronous abort in combination with
- -- Invalidate_Self_Cache.
-
- -- Set_Stack_Info should do the following things in order:
- -- 1) Get the Stack_Access value for the current task
- -- 2) Set Stack.all to the value obtained in 1)
- -- 3) Optionally Poll to check for asynchronous abort
-
- -- This order is important because if at any time a write to
- -- the stack cache is pending, that write should be followed
- -- by a Poll to prevent loosing signals.
-
- -- Note: This function must be compiled with Polling turned off
-
- -- Note: on systems like VxWorks and OS/2 with real thread-local storage,
- -- Set_Stack_Info should return an access value for such local
- -- storage. In those cases the cache will always be up-to-date.
-
- -- The following constants should be imported from some system-specific
- -- constants package. The constants must be static for performance reasons.
-
- ----------------------------
- -- Invalidate_Stack_Cache --
- ----------------------------
-
- procedure Invalidate_Stack_Cache (Any_Stack : Stack_Access) is
- pragma Warnings (Off, Any_Stack);
- begin
- Cache := Null_Stack;
- end Invalidate_Stack_Cache;
-
- --------------------
- -- Set_Stack_Info --
- --------------------
-
- function Set_Stack_Info
- (Stack : access Stack_Access) return Stack_Access
- is
- type Frame_Mark is null record;
- Frame_Location : Frame_Mark;
- Frame_Address : constant Address := Frame_Location'Address;
-
- My_Stack : Stack_Access;
- Limit_Chars : System.Address;
- Limit : Integer;
-
- begin
- -- The order of steps 1 .. 3 is important, see specification.
-
- -- 1) Get the Stack_Access value for the current task
-
- My_Stack := Soft_Links.Get_Stack_Info.all;
-
- if My_Stack.Base = Null_Address then
-
- -- First invocation, initialize based on the assumption that
- -- there are Environment_Stack_Size bytes available beyond
- -- the current frame address.
-
- if My_Stack.Size = 0 then
- My_Stack.Size := Storage_Offset (Default_Env_Stack_Size);
-
- -- When the environment variable GNAT_STACK_LIMIT is set,
- -- set Environment_Stack_Size to that number of kB.
-
- Limit_Chars := System.CRTL.getenv ("GNAT_STACK_LIMIT" & ASCII.NUL);
-
- if Limit_Chars /= Null_Address then
- Limit := System.CRTL.atoi (Limit_Chars);
-
- if Limit >= 0 then
- My_Stack.Size := Storage_Offset (Limit) * Kilobyte;
- end if;
- end if;
- end if;
-
- My_Stack.Base := Frame_Address;
-
- if Stack_Grows_Down then
-
- -- Prevent wrap-around on too big stack sizes
-
- My_Stack.Limit := My_Stack.Base - My_Stack.Size;
-
- if My_Stack.Limit > My_Stack.Base then
- My_Stack.Limit := Address'First;
- end if;
-
- else
- My_Stack.Limit := My_Stack.Base + My_Stack.Size;
-
- -- Prevent wrap-around on too big stack sizes
-
- if My_Stack.Limit < My_Stack.Base then
- My_Stack.Limit := Address'Last;
- end if;
- end if;
- end if;
-
- -- 2) Set Stack.all to the value obtained in 1)
-
- Stack.all := My_Stack;
-
- -- 3) Optionally Poll to check for asynchronous abort
-
- if Soft_Links.Check_Abort_Status.all /= 0 then
- raise Standard'Abort_Signal;
- end if;
-
- return My_Stack; -- Never trust the cached value, but return local copy!
- end Set_Stack_Info;
-
- --------------------
- -- Set_Stack_Size --
- --------------------
-
- -- Specify the stack size for the current frame.
-
- procedure Set_Stack_Size
- (Stack_Size : System.Storage_Elements.Storage_Offset)
- is
- My_Stack : Stack_Access;
- Frame_Address : constant System.Address := My_Stack'Address;
-
- begin
- My_Stack := Stack_Check (Frame_Address);
-
- if Stack_Grows_Down then
- My_Stack.Limit := My_Stack.Base - Stack_Size;
- else
- My_Stack.Limit := My_Stack.Base + Stack_Size;
- end if;
- end Set_Stack_Size;
-
- -----------------
- -- Stack_Check --
- -----------------
-
- function Stack_Check
- (Stack_Address : System.Address) return Stack_Access
- is
- type Frame_Marker is null record;
- Marker : Frame_Marker;
- Cached_Stack : constant Stack_Access := Cache;
- Frame_Address : constant System.Address := Marker'Address;
-
- begin
- -- This function first does a "cheap" check which is correct
- -- if it succeeds. In case of failure, the full check is done.
- -- Ideally the cheap check should be done in an optimized manner,
- -- or be inlined.
-
- if (Stack_Grows_Down and then
- (Frame_Address <= Cached_Stack.Base
- and
- Stack_Address > Cached_Stack.Limit))
- or else
- (not Stack_Grows_Down and then
- (Frame_Address >= Cached_Stack.Base
- and
- Stack_Address < Cached_Stack.Limit))
- then
- -- Cached_Stack is valid as it passed the stack check
- return Cached_Stack;
- end if;
-
- Full_Check :
- declare
- My_Stack : constant Stack_Access := Set_Stack_Info (Cache'Access);
- -- At this point Stack.all might already be invalid, so
- -- it is essential to use our local copy of Stack!
-
- begin
- if (Stack_Grows_Down and then
- (not (Frame_Address <= My_Stack.Base)))
- or else
- (not Stack_Grows_Down and then
- (not (Frame_Address >= My_Stack.Base)))
- then
- -- The returned Base is lower than the stored one,
- -- so assume that the original one wasn't right and use the
- -- current Frame_Address as new one. This allows initializing
- -- Base with the Frame_Address as approximation.
- -- During initialization the Frame_Address will be close to
- -- the stack base anyway: the difference should be compensated
- -- for in the stack reserve.
-
- My_Stack.Base := Frame_Address;
- end if;
-
- if (Stack_Grows_Down and then
- Stack_Address < My_Stack.Limit)
- or else
- (not Stack_Grows_Down and then
- Stack_Address > My_Stack.Limit)
- then
- Ada.Exceptions.Raise_Exception
- (E => Storage_Error'Identity,
- Message => "stack overflow detected");
- end if;
-
- return My_Stack;
- end Full_Check;
- end Stack_Check;
-
- ------------------------
- -- Update_Stack_Cache --
- ------------------------
-
- procedure Update_Stack_Cache (Stack : Stack_Access) is
- begin
- if not Multi_Processor then
- Cache := Stack;
- end if;
- end Update_Stack_Cache;
-
-end System.Stack_Checking.Operations;
diff --git a/gcc/ada/s-stchop.ads b/gcc/ada/s-stchop.ads
deleted file mode 100644
index 10217204d6f..00000000000
--- a/gcc/ada/s-stchop.ads
+++ /dev/null
@@ -1,74 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
--- --
--- S Y S T E M . S T A C K _ C H E C K I N G . O P E R A T I O N S --
--- --
--- S p e c --
--- --
--- Copyright (C) 1999-2004 Free Software Foundation, Inc. --
--- --
--- GNARL is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNARL; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
--- GNARL was developed by the GNARL team at Florida State University. --
--- Extensive contributions were provided by Ada Core Technologies, Inc. --
--- --
-------------------------------------------------------------------------------
-
--- This package provides a implementation of stack checking operations
--- using comparison with stack base and limit.
-
-pragma Restrictions (No_Elaboration_Code);
--- We want to guarantee the absence of elaboration code because the
--- binder does not handle references to this package.
-
-with System.Storage_Elements;
-
-pragma Polling (Off);
--- Turn off polling, we do not want polling to take place during stack
--- checking operations. It causes infinite loops and other problems.
-
-package System.Stack_Checking.Operations is
- procedure Set_Stack_Size
- (Stack_Size : System.Storage_Elements.Storage_Offset);
- -- Specify the stack size for the current task.
-
- procedure Update_Stack_Cache (Stack : Stack_Access);
- -- Set the stack cache for the current task. Note that this is only
- -- for optimization purposes, nothing can be assumed about the
- -- contents of the cache at any time, see Set_Stack_Info.
-
- procedure Invalidate_Stack_Cache (Any_Stack : Stack_Access);
- -- Invalidate cache entries for the task T that owns Any_Stack.
- -- This causes the Set_Stack_Info function to be called during
- -- the next stack check done by T. This can be used to interrupt
- -- task T asynchronously.
- -- Stack_Check should be called in loops for this to work reliably.
-
- function Stack_Check (Stack_Address : System.Address) return Stack_Access;
- -- This version of Stack_Check should not be inlined.
-
-private
-
- Cache : aliased Stack_Access := Null_Stack;
-
- pragma Export (C, Cache, "_gnat_stack_cache");
- pragma Export (C, Stack_Check, "_gnat_stack_check");
-
-end System.Stack_Checking.Operations;
diff --git a/gcc/alias.c b/gcc/alias.c
index d670a7db19e..99d9c5d458a 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -112,6 +112,11 @@ static bool nonoverlapping_component_refs_p (tree, tree);
static tree decl_for_component_ref (tree);
static rtx adjust_offset_for_component_ref (tree, rtx);
static int nonoverlapping_memrefs_p (rtx, rtx);
+
+/* APPLE LOCAL */
+static int overlapping_memrefs_p (rtx, rtx);
+/* APPLE LOCAL end */
+
static int write_dependence_p (rtx, rtx, int, int);
static int nonlocal_mentioned_p_1 (rtx *, void *);
@@ -2070,6 +2075,65 @@ nonoverlapping_memrefs_p (rtx x, rtx y)
return sizex >= 0 && offsety >= offsetx + sizex;
}
+/* APPLE LOCAL aliasing improvement */
+/* Helper for the following. Return 1 only if we're sure of overlap. */
+
+static int
+overlapping_trees_p (tree exprx, tree expry)
+{
+ /* If no info about either one, can't tell. */
+ if (exprx == 0 || expry == 0)
+ return 0;
+
+ /* Top level code must match. */
+ if (TREE_CODE (exprx) != TREE_CODE (expry))
+ return 0;
+
+ /* Components. */
+ if (TREE_CODE (exprx) == COMPONENT_REF)
+ {
+ /* They must refer to the same field... */
+ if (TREE_OPERAND (exprx, 1) != TREE_OPERAND (expry, 1))
+ return 0;
+ /* ...of the same object. (The object may be null, which
+ will compare as not overlapping.) */
+ return overlapping_trees_p (TREE_OPERAND (exprx, 0),
+ TREE_OPERAND (expry, 0));
+ }
+
+ /* Pointers. */
+ if (TREE_CODE (exprx) == INDIRECT_REF)
+ return overlapping_trees_p (TREE_OPERAND (exprx, 0),
+ TREE_OPERAND (expry, 0));
+
+ if (TREE_CODE (exprx) == VAR_DECL
+ || TREE_CODE (exprx) == PARM_DECL
+ || TREE_CODE (exprx) == CONST_DECL
+ || TREE_CODE (exprx) == FUNCTION_DECL)
+ return exprx == expry;
+
+ return 0;
+}
+
+/* Return 1 if memrefs definitely overlap, 0 otherwise. */
+
+
+static int
+overlapping_memrefs_p (rtx x, rtx y)
+{
+ tree exprx = MEM_EXPR (x), expry = MEM_EXPR (y);
+ rtx offsetx = MEM_OFFSET (x), offsety = MEM_OFFSET (y);
+
+ /* See if offsets collide. Known but different offsets do not
+ overlap. Unknown offsets will if the underlying object is the same. */
+ if (offsetx != 0 && offsety != 0 && !rtx_equal_p (offsetx, offsety))
+ return 0;
+
+ return overlapping_trees_p (exprx, expry);
+}
+/* APPLE LOCAL end aliasing improvement */
+
+
/* True dependence: X is read after store in MEM takes place. */
int
@@ -2120,6 +2184,10 @@ true_dependence (rtx mem, enum machine_mode mem_mode, rtx x,
&& CONSTANT_POOL_ADDRESS_P (base))))
return 0;
+ /* APPLE LOCAL */
+ if (overlapping_memrefs_p (mem, x))
+ return 1;
+
if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
return 0;
@@ -2187,6 +2255,10 @@ canon_true_dependence (rtx mem, enum machine_mode mem_mode, rtx mem_addr,
x_addr = get_addr (XEXP (x, 0));
+ /* APPLE LOCAL */
+ if (overlapping_memrefs_p (mem, x))
+ return 1;
+
if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
return 0;
@@ -2233,6 +2305,19 @@ write_dependence_p (rtx mem, rtx x, int writep, int constp)
if (GET_MODE (mem) == BLKmode && GET_CODE (XEXP (mem, 0)) == SCRATCH)
return 1;
+ /* APPLE LOCAL begin make SPEC gcc work with strict aliasing */
+ x_addr = get_addr (XEXP (x, 0));
+ mem_addr = get_addr (XEXP (mem, 0));
+
+ /* If two addresses are "the same" they conflict, even if type
+ checking says they don't. This is a bit too conservative
+ since there's no guarantee identical registers will have the
+ same values in both addresses. This is required to build
+ the (nonstandard) version of gcc found in SPEC. */
+ if (rtx_equal_p (x_addr, mem_addr))
+ return 1;
+ /* APPLE LOCAL end make SPEC gcc work with strict aliasing */
+
if (DIFFERENT_ALIAS_SETS_P (x, mem))
return 0;
@@ -2752,7 +2837,7 @@ init_alias_analysis (void)
new_reg_base_value = xmalloc (maxreg * sizeof (rtx));
reg_seen = xmalloc (maxreg);
- if (! reload_completed && flag_old_unroll_loops)
+ if (! reload_completed && flag_unroll_loops)
{
/* ??? Why are we realloc'ing if we're just going to zero it? */
alias_invariant = xrealloc (alias_invariant,
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 1465d9ed2d6..e5ffed4646c 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -146,6 +146,10 @@ struct edge_def GTY((chain_next ("%h.pred_next")))
int probability; /* biased by REG_BR_PROB_BASE */
gcov_type count; /* Expected number of executions calculated
in profile.c */
+ /* APPLE LOCAL begin hot/cold partitioning */
+ bool crossing_edge; /* Crosses between hot and cold sections, when
+ we do partitioning. */
+ /* APPLE LOCAL end hot/cold partitioning */
};
typedef struct edge_def *edge;
@@ -173,6 +177,22 @@ typedef struct edge_def *edge;
#define EDGE_COMPLEX (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)
+/* Returns the block at the beginning of the edge. */
+
+static inline struct basic_block_def *
+edge_source (edge e)
+{
+ return e->src;
+}
+
+/* Returns the block at the end of the edge. */
+
+static inline struct basic_block_def *
+edge_destination (edge e)
+{
+ return e->dest;
+}
+
/* Counter summary from the last set of coverage counts read by
profile.c. */
extern const struct gcov_ctr_summary *profile_info;
@@ -268,6 +288,12 @@ struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb")
/* Various flags. See BB_* below. */
int flags;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* Which section block belongs in, when partitioning basic blocks. */
+ int partition;
+
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* The data used by basic block copying and reordering functions. */
struct reorder_block_def * GTY ((skip (""))) rbi;
@@ -289,6 +315,7 @@ typedef struct reorder_block_def
/* Used by loop copying. */
basic_block copy;
int duplicated;
+ int copy_number;
/* These fields are used by bb-reorder pass. */
int visited;
@@ -304,6 +331,14 @@ typedef struct reorder_block_def
#define BB_IRREDUCIBLE_LOOP 16
#define BB_SUPERBLOCK 32
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Partitions, to be used when partitioning hot and cold basic blocks into
+ separate sections. */
+#define UNPARTITIONED 0
+#define HOT_PARTITION 1
+#define COLD_PARTITION 2
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Number of basic blocks in the current function. */
extern int n_basic_blocks;
@@ -664,6 +699,14 @@ extern bool control_flow_insn_p (rtx);
/* In bb-reorder.c */
extern void reorder_basic_blocks (void);
+/* APPLE LOCAL begin hot/cold partitioning */
+extern void partition_hot_cold_basic_blocks (void);
+/* APPLE LOCAL end hot/cold partitioning */
+
+/* In cfg.c */
+extern void alloc_rbi_pool (void);
+extern void initialize_bb_rbi (basic_block bb);
+extern void free_rbi_pool (void);
/* In cfg.c */
extern void alloc_rbi_pool (void);
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 90ef75cc7d0..55d4cf4933b 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -77,15 +77,29 @@
#include "cfglayout.h"
#include "fibheap.h"
#include "target.h"
-
-/* The number of rounds. */
-#define N_ROUNDS 4
+/* APPLE LOCAL begin hot/cold partitioning */
+#include "function.h"
+#include "obstack.h"
+#include "expr.h"
+#include "regs.h"
+#include "tm_p.h"
+
+#ifndef HAVE_return
+#define HAVE_return 0
+#define gen_return () NULL_RTX
+#endif
+
+/* The number of rounds. In most cases there will only be 4 rounds, but
+ when partitioning hot and cold basic blocks into separate sections of
+ the .o file there will be an extra round.*/
+#define N_ROUNDS 5
/* Branch thresholds in thousandths (per mille) of the REG_BR_PROB_BASE. */
-static int branch_threshold[N_ROUNDS] = {400, 200, 100, 0};
+static int branch_threshold[N_ROUNDS] = {400, 200, 100, 0, 0};
/* Exec thresholds in thousandths (per mille) of the frequency of bb 0. */
-static int exec_threshold[N_ROUNDS] = {500, 200, 50, 0};
+static int exec_threshold[N_ROUNDS] = {500, 200, 50, 0, 0};
+/* APPLE LOCAL end hot/cold partitioning */
/* If edge frequency is lower than DUPLICATION_THRESHOLD per mille of entry
block the edge destination is not duplicated while connecting traces. */
@@ -145,14 +159,66 @@ gcov_type max_entry_count;
static void find_traces (int *, struct trace *);
static basic_block rotate_loop (edge, struct trace *, int);
static void mark_bb_visited (basic_block, int);
+/* APPLE LOCAL begin hot/cold partitioning */
static void find_traces_1_round (int, int, gcov_type, struct trace *, int *,
- int, fibheap_t *);
+ int, fibheap_t *, int);
static basic_block copy_bb (basic_block, edge, basic_block, int);
static fibheapkey_t bb_to_key (basic_block);
-static bool better_edge_p (basic_block, edge, int, int, int, int);
+static bool better_edge_p (basic_block, edge, int, int, int, int, edge);
+/* APPLE LOCAL end hot/cold partitioning */
static void connect_traces (int, struct trace *);
static bool copy_bb_p (basic_block, int);
static int get_uncond_jump_length (void);
+/* APPLE LOCAL begin hot/cold partitioning */
+static bool push_to_next_round_p (basic_block, int, int, int, gcov_type);
+static void add_unlikely_executed_notes (void);
+static void find_rarely_executed_basic_blocks_and_crossing_edges (edge *,
+ int *,
+ int *);
+static void mark_bb_for_unlikely_executed_section (basic_block);
+static void add_labels_and_missing_jumps (edge *, int);
+static void add_reg_crossing_jump_notes (void);
+static void fix_up_fall_thru_edges (void);
+static void fix_edges_for_rarely_executed_code (edge *, int);
+static void fix_crossing_conditional_branches (void);
+static void fix_crossing_unconditional_branches (void);
+
+/* Check to see if bb should be pushed into the next round of trace
+ collections or not. Reasons for pushing the block forward are 1).
+ If the block is cold, we are doing partitioning, and there will be
+ another round (cold partition blocks are not supposed to be
+ collected into traces until the very last round); or 2). There will
+ be another round, and the basic block is not "hot enough" for the
+ current round of trace collection. */
+
+static bool
+push_to_next_round_p (basic_block bb, int round, int number_of_rounds,
+ int exec_th, gcov_type count_th)
+{
+ bool next_round_is_last;
+ bool there_exists_another_round;
+ bool block_not_hot_enough;
+
+ there_exists_another_round = round < number_of_rounds - 1;
+
+ next_round_is_last = round + 1 == number_of_rounds - 1;
+
+ block_not_hot_enough = (bb->frequency < exec_th
+ || bb->count < count_th
+ || probably_never_executed_bb_p (bb));
+
+ /* When partitioning, save last round for cold blocks only. */
+
+ if (flag_reorder_blocks_and_partition
+ && next_round_is_last
+ && bb->partition != COLD_PARTITION)
+ return false;
+ else if (there_exists_another_round && block_not_hot_enough)
+ return true;
+ else
+ return false;
+}
+/* APPLE LOCAL end hot/cold partitioning */
/* Find the traces for Software Trace Cache. Chain each trace through
RBI()->next. Store the number of traces to N_TRACES and description of
@@ -164,6 +230,18 @@ find_traces (int *n_traces, struct trace *traces)
int i;
edge e;
fibheap_t heap;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ int number_of_rounds;
+
+ /* Add one extra round of trace collection when partitioning hot/cold
+ basic blocks into separate sections. The last round is for all the
+ cold blocks (and ONLY the cold blocks). */
+
+ number_of_rounds = N_ROUNDS - 1;
+ if (flag_reorder_blocks_and_partition)
+ number_of_rounds = N_ROUNDS;
+
+ /* APPLE LOCAL end hot/cold partitioning */
/* Insert entry points of function into heap. */
heap = fibheap_new ();
@@ -173,7 +251,7 @@ find_traces (int *n_traces, struct trace *traces)
{
bbd[e->dest->index].heap = heap;
bbd[e->dest->index].node = fibheap_insert (heap, bb_to_key (e->dest),
- e->dest);
+ e->dest);
if (e->dest->frequency > max_entry_frequency)
max_entry_frequency = e->dest->frequency;
if (e->dest->count > max_entry_count)
@@ -181,7 +259,9 @@ find_traces (int *n_traces, struct trace *traces)
}
/* Find the traces. */
- for (i = 0; i < N_ROUNDS; i++)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ for (i = 0; i < number_of_rounds; i++)
+ /* APPLE LOCAL end hot/cold partitioning */
{
gcov_type count_threshold;
@@ -193,9 +273,12 @@ find_traces (int *n_traces, struct trace *traces)
else
count_threshold = max_entry_count / 1000 * exec_threshold[i];
+ /* APPLE LOCAL begin hot/cold partitioning */
find_traces_1_round (REG_BR_PROB_BASE * branch_threshold[i] / 1000,
max_entry_frequency * exec_threshold[i] / 1000,
- count_threshold, traces, n_traces, i, &heap);
+ count_threshold, traces, n_traces, i, &heap,
+ number_of_rounds);
+ /* APPLE LOCAL end hot/cold partitioning */
}
fibheap_delete (heap);
@@ -354,8 +437,16 @@ mark_bb_visited (basic_block bb, int trace)
static void
find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
struct trace *traces, int *n_traces, int round,
- fibheap_t *heap)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ fibheap_t *heap, int number_of_rounds)
{
+ /* The following variable refers to the last round in which non-"cold"
+ blocks may be collected into a trace. */
+
+ int last_round = N_ROUNDS - 1;
+
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* Heap for discarded basic blocks which are possible starting points for
the next round. */
fibheap_t new_heap = fibheap_new ();
@@ -374,10 +465,15 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
if (dump_file)
fprintf (dump_file, "Getting bb %d\n", bb->index);
- /* If the BB's frequency is too low send BB to the next round. */
- if (round < N_ROUNDS - 1
- && (bb->frequency < exec_th || bb->count < count_th
- || probably_never_executed_bb_p (bb)))
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If the BB's frequency is too low send BB to the next round. When
+ partitioning hot/cold blocks into separate sections, make sure all
+ the cold blocks (and ONLY the cold blocks) go into the (extra) final
+ round. */
+
+ if (push_to_next_round_p (bb, round, number_of_rounds, exec_th,
+ count_th))
+ /* APPLE LOCAL end hot/cold partitioning */
{
int key = bb_to_key (bb);
bbd[bb->index].heap = new_heap;
@@ -427,6 +523,14 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
&& e->dest->rbi->visited != *n_traces)
continue;
+ /* APPLE LOCAL begin hot/cold partitioning */
+
+ if (e->dest->partition == COLD_PARTITION
+ && round < last_round)
+ continue;
+
+ /* APPLE LOCAL end hot/cold partitioning */
+
prob = e->probability;
freq = EDGE_FREQUENCY (e);
@@ -436,7 +540,13 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
|| prob < branch_th || freq < exec_th || e->count < count_th)
continue;
- if (better_edge_p (bb, e, prob, freq, best_prob, best_freq))
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If partitioning hot/cold basic blocks, don't consider edges
+ that cross section boundaries. */
+
+ if (better_edge_p (bb, e, prob, freq, best_prob, best_freq,
+ best_edge))
+ /* APPLE LOCAL end hot/cold partitioning */
{
best_edge = e;
best_prob = prob;
@@ -490,7 +600,15 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
|| prob < branch_th || freq < exec_th
|| e->count < count_th)
{
- if (round < N_ROUNDS - 1)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* When partitioning hot/cold basic blocks, make sure
+ the cold blocks (and only the cold blocks) all get
+ pushed to the last round of trace collection. */
+
+ if (push_to_next_round_p (e->dest, round,
+ number_of_rounds,
+ exec_th, count_th))
+ /* APPLE LOCAL end hot/cold partitioning */
which_heap = new_heap;
}
@@ -588,6 +706,9 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
&& !(e->flags & EDGE_COMPLEX)
&& !e->dest->rbi->visited
&& !e->dest->pred->pred_next
+ /* APPLE LOCAL begin hot/cold partitioning */
+ && !e->crossing_edge
+ /* APPLE LOCAL end hot/cold partitioning */
&& e->dest->succ
&& (e->dest->succ->flags & EDGE_CAN_FALLTHRU)
&& !(e->dest->succ->flags & EDGE_COMPLEX)
@@ -707,7 +828,9 @@ bb_to_key (basic_block bb)
int priority = 0;
/* Do not start in probably never executed blocks. */
- if (probably_never_executed_bb_p (bb))
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (bb->partition == COLD_PARTITION || probably_never_executed_bb_p (bb))
+ /* APPLE LOCAL end hot/cold partitioning */
return BB_FREQ_MAX;
/* Prefer blocks whose predecessor is an end of some trace
@@ -739,7 +862,9 @@ bb_to_key (basic_block bb)
static bool
better_edge_p (basic_block bb, edge e, int prob, int freq, int best_prob,
- int best_freq)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ int best_freq, edge cur_best_edge)
+ /* APPLE LOCAL end hot/cold partitioning */
{
bool is_better_edge;
@@ -769,6 +894,18 @@ better_edge_p (basic_block bb, edge e, int prob, int freq, int best_prob,
is_better_edge = true;
else
is_better_edge = false;
+
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are doing hot/cold partitioning, make sure that we always favor
+ non-crossing edges over crossing edges. */
+
+ if (!is_better_edge
+ && flag_reorder_blocks_and_partition
+ && cur_best_edge
+ && cur_best_edge->crossing_edge
+ && !e->crossing_edge)
+ is_better_edge = true;
+ /* APPLE LOCAL end hot/cold partitioning */
return is_better_edge;
}
@@ -783,6 +920,11 @@ connect_traces (int n_traces, struct trace *traces)
int last_trace;
int freq_threshold;
gcov_type count_threshold;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ int unconnected_hot_trace_count = 0;
+ bool cold_connected = true;
+ bool *cold_traces;
+ /* APPLE LOCAL end hot/cold partitioning */
freq_threshold = max_entry_frequency * DUPLICATION_THRESHOLD / 1000;
if (max_entry_count < INT_MAX / 1000)
@@ -792,17 +934,68 @@ connect_traces (int n_traces, struct trace *traces)
connected = xcalloc (n_traces, sizeof (bool));
last_trace = -1;
- for (i = 0; i < n_traces; i++)
+
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, mark the cold
+ traces as already connnected, to remove them from consideration
+ for connection to the hot traces. After the hot traces have all
+ been connected (determined by "unconnected_hot_trace_count"), we
+ will go back and connect the cold traces. */
+
+ cold_traces = xcalloc (n_traces, sizeof (bool));
+
+ if (flag_reorder_blocks_and_partition)
+ for (i = 0; i < n_traces; i++)
+ {
+ if (traces[i].first->partition == COLD_PARTITION)
+ {
+ connected[i] = true;
+ cold_traces[i] = true;
+ cold_connected = false;
+ }
+ else
+ unconnected_hot_trace_count++;
+ }
+
+ for (i = 0; i < n_traces || !cold_connected ; i++)
{
int t = i;
int t2;
edge e, best;
int best_len;
+ /* If we are partitioning hot/cold basic blocks, check to see
+ if all the hot traces have been connected. If so, go back
+ and mark the cold traces as unconnected so we can connect
+ them up too. Re-set "i" to the first (unconnected) cold
+ trace. Use flag "cold_connected" to make sure we don't do
+ this step more than once. */
+
+ if (flag_reorder_blocks_and_partition
+ && (i >= n_traces || unconnected_hot_trace_count <= 0)
+ && !cold_connected)
+ {
+ int j;
+ int first_cold_trace = -1;
+
+ for (j = 0; j < n_traces; j++)
+ if (cold_traces[j])
+ {
+ connected[j] = false;
+ if (first_cold_trace == -1)
+ first_cold_trace = j;
+ }
+ i = t = first_cold_trace;
+ cold_connected = true;
+ }
+
if (connected[t])
continue;
connected[t] = true;
+ if (unconnected_hot_trace_count > 0)
+ unconnected_hot_trace_count--;
+ /* APPLE LOCAL end hot/cold partitioning */
/* Find the predecessor traces. */
for (t2 = t; t2 > 0;)
@@ -832,6 +1025,10 @@ connect_traces (int n_traces, struct trace *traces)
best->src->rbi->next = best->dest;
t2 = bbd[best->src->index].end_of_trace;
connected[t2] = true;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (unconnected_hot_trace_count > 0)
+ unconnected_hot_trace_count--;
+ /* APPLE LOCAL end hot/cold partitioning */
if (dump_file)
{
fprintf (dump_file, "Connection: %d %d\n",
@@ -881,6 +1078,10 @@ connect_traces (int n_traces, struct trace *traces)
t = bbd[best->dest->index].start_of_trace;
traces[last_trace].last->rbi->next = traces[t].first;
connected[t] = true;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (unconnected_hot_trace_count > 0)
+ unconnected_hot_trace_count--;
+ /* APPLE LOCAL end hot/cold partitioning */
last_trace = t;
}
else
@@ -940,6 +1141,11 @@ connect_traces (int n_traces, struct trace *traces)
}
}
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (flag_reorder_blocks_and_partition)
+ try_copy = false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* Copy tiny blocks always; copy larger blocks only when the
edge is traversed frequently enough. */
if (try_copy
@@ -969,6 +1175,10 @@ connect_traces (int n_traces, struct trace *traces)
t = bbd[next_bb->index].start_of_trace;
traces[last_trace].last->rbi->next = traces[t].first;
connected[t] = true;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (unconnected_hot_trace_count > 0)
+ unconnected_hot_trace_count--;
+ /* APPLE LOCAL end hot/cold partitioning */
last_trace = t;
}
else
@@ -1063,6 +1273,715 @@ get_uncond_jump_length (void)
return length;
}
+/* APPLE LOCAL begin hot/cold partitioning */
+static void
+add_unlikely_executed_notes (void)
+{
+ basic_block bb;
+
+ FOR_EACH_BB (bb)
+ if (bb->partition == COLD_PARTITION)
+ mark_bb_for_unlikely_executed_section (bb);
+}
+
+/* Find the basic blocks that are rarely executed and need to be moved to
+ a separate section of the .o file (to cut down on paging and improve
+ cache locality). */
+
+static void
+find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
+ int *n_crossing_edges,
+ int *max_idx)
+{
+ basic_block bb;
+ bool has_hot_blocks;
+ edge e;
+ int i;
+
+ /* Mark which partition (hot/cold) each basic block belongs in. */
+
+ FOR_EACH_BB (bb)
+ {
+ if (probably_never_executed_bb_p (bb))
+ bb->partition = COLD_PARTITION;
+ else
+ {
+ bb->partition = HOT_PARTITION;
+ has_hot_blocks = true;
+ }
+ }
+
+ /* Since all "hot" basic blocks will eventually be scheduled before all
+ cold basic blocks, make *sure* the real function entry block is in
+ the hot partition. */
+
+ if (has_hot_blocks)
+ for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
+ if (e->dest->index >= 0)
+ {
+ e->dest->partition = HOT_PARTITION;
+ break;
+ }
+
+ /* Mark every edge that crosses between sections. */
+
+ i = 0;
+ if (targetm.have_named_sections)
+ {
+ FOR_EACH_BB (bb)
+ for (e = bb->succ; e; e = e->succ_next)
+ {
+ if (e->src != ENTRY_BLOCK_PTR
+ && e->dest != EXIT_BLOCK_PTR
+ && e->src->partition != e->dest->partition)
+ {
+ e->crossing_edge = true;
+ if (i == *max_idx)
+ {
+ *max_idx *= 2;
+ crossing_edges = xrealloc (crossing_edges,
+ (*max_idx) * sizeof (edge));
+ }
+ crossing_edges[i++] = e;
+ }
+ else
+ e->crossing_edge = false;
+ }
+
+ }
+ *n_crossing_edges = i;
+}
+
+/* Add NOTE_INSN_UNLIKELY_EXECUTED_CODE to top of basic block. This note
+ is later used to mark the basic block to be put in the
+ unlikely-to-be-executed section of the .o file. */
+
+static void
+mark_bb_for_unlikely_executed_section (basic_block bb)
+{
+ rtx cur_insn;
+ rtx insert_insn = NULL;
+ rtx new_note;
+
+ /* Find first non-note instruction and insert new NOTE before it (as
+ long as new NOTE is not first instruction in basic block). */
+
+ for (cur_insn = BB_HEAD (bb); cur_insn != NEXT_INSN (BB_END (bb));
+ cur_insn = NEXT_INSN (cur_insn))
+ if (GET_CODE (cur_insn) != NOTE
+ && GET_CODE (cur_insn) != CODE_LABEL)
+ {
+ insert_insn = cur_insn;
+ break;
+ }
+
+ /* Insert note and assign basic block number to it. */
+
+ if (insert_insn)
+ {
+ new_note = emit_note_before (NOTE_INSN_UNLIKELY_EXECUTED_CODE,
+ insert_insn);
+ NOTE_BASIC_BLOCK (new_note) = bb;
+ }
+ else
+ {
+ new_note = emit_note_after (NOTE_INSN_UNLIKELY_EXECUTED_CODE,
+ BB_END (bb));
+ NOTE_BASIC_BLOCK (new_note) = bb;
+ }
+}
+
+/* If any destination of a crossing edge does not have a label, add label;
+ Convert any fall-through crossing edges (for blocks that do not contain
+ a jump) to unconditional jumps. */
+
+static void
+add_labels_and_missing_jumps (edge *crossing_edges, int n_crossing_edges)
+{
+ int i;
+ basic_block src;
+ basic_block dest;
+ rtx label;
+ rtx barrier;
+ rtx new_jump;
+
+ for (i=0; i < n_crossing_edges; i++)
+ {
+ if (crossing_edges[i])
+ {
+ src = crossing_edges[i]->src;
+ dest = crossing_edges[i]->dest;
+
+ /* Make sure dest has a label. */
+
+ if (dest && (dest != EXIT_BLOCK_PTR))
+ {
+ label = block_label (dest);
+
+ /* Make sure source block ends with a jump. */
+
+ if (src && (src != ENTRY_BLOCK_PTR))
+ {
+ if (GET_CODE (BB_END (src)) != JUMP_INSN)
+ /* bb just falls through. */
+ {
+ /* make sure there's only one successor */
+ if (src->succ && (src->succ->succ_next == NULL))
+ {
+ /* Find label in dest block. */
+ label = block_label (dest);
+
+ new_jump = emit_jump_insn_after (gen_jump (label),
+ BB_END (src));
+ barrier = emit_barrier_after (new_jump);
+ JUMP_LABEL (new_jump) = label;
+ LABEL_NUSES (label) += 1;
+ src->rbi->footer = unlink_insn_chain (barrier,
+ barrier);
+ /* Mark edge as non-fallthru. */
+ crossing_edges[i]->flags &= ~EDGE_FALLTHRU;
+ }
+ else
+ {
+ /* Basic block has two successors, but
+ doesn't end in a jump; something is wrong
+ here! */
+ abort();
+ }
+ } /* end: 'if (GET_CODE ... ' */
+ } /* end: 'if (src && src->index...' */
+ } /* end: 'if (dest && dest->index...' */
+ } /* end: 'if (crossing_edges[i]...' */
+ } /* end for loop */
+}
+
+/* Find any bb's where the fall-through edge is a crossing edge (note that
+ these bb's must also contain a conditional jump; we've already
+ dealt with fall-through edges for blocks that didn't have a
+ conditional jump in the call to add_labels_and_missing_jumps).
+ Convert the fall-through edge to non-crossing edge by inserting a
+ new bb to fall-through into. The new bb will contain an
+ unconditional jump (crossing edge) to the original fall through
+ destination. */
+
+static void
+fix_up_fall_thru_edges (void)
+{
+ basic_block cur_bb;
+ basic_block new_bb;
+ edge succ1;
+ edge succ2;
+ edge fall_thru;
+ edge cond_jump;
+ edge e;
+ bool cond_jump_crosses;
+ int invert_worked;
+ rtx old_jump;
+ rtx fall_thru_label;
+ rtx barrier;
+
+ FOR_EACH_BB (cur_bb)
+ {
+ fall_thru = NULL;
+ succ1 = cur_bb->succ;
+ if (succ1)
+ succ2 = succ1->succ_next;
+ else
+ succ2 = NULL;
+
+ /* Find the fall-through edge. */
+
+ if (succ1
+ && (succ1->flags & EDGE_FALLTHRU))
+ {
+ fall_thru = succ1;
+ cond_jump = succ2;
+ }
+ else if (succ2
+ && (succ2->flags & EDGE_FALLTHRU))
+ {
+ fall_thru = succ2;
+ cond_jump = succ1;
+ }
+
+ if (fall_thru && (fall_thru->dest != EXIT_BLOCK_PTR))
+ {
+ /* Check to see if the fall-thru edge is a crossing edge. */
+
+ if (fall_thru->crossing_edge)
+ {
+ /* The fall_thru edge crosses; now check the cond jump edge, if
+ it exists. */
+
+ cond_jump_crosses = true;
+ invert_worked = 0;
+ old_jump = BB_END (cur_bb);
+
+ /* Find the jump instruction, if there is one. */
+
+ if (cond_jump)
+ {
+ if (!cond_jump->crossing_edge)
+ cond_jump_crosses = false;
+
+ /* We know the fall-thru edge crosses; if the cond
+ jump edge does NOT cross, and its destination is the
+ next block in the bb order, invert the jump
+ (i.e. fix it so the fall thru does not cross and
+ the cond jump does). */
+
+ if (!cond_jump_crosses
+ && cur_bb->rbi->next == cond_jump->dest)
+ {
+ /* Find label in fall_thru block. We've already added
+ any missing labels, so there must be one. */
+
+ fall_thru_label = block_label (fall_thru->dest);
+
+ if (old_jump && fall_thru_label)
+ invert_worked = invert_jump (old_jump,
+ fall_thru_label,0);
+ if (invert_worked)
+ {
+ fall_thru->flags &= ~EDGE_FALLTHRU;
+ cond_jump->flags |= EDGE_FALLTHRU;
+ update_br_prob_note (cur_bb);
+ e = fall_thru;
+ fall_thru = cond_jump;
+ cond_jump = e;
+ cond_jump->crossing_edge = true;
+ fall_thru->crossing_edge = false;
+ }
+ }
+ }
+
+ if (cond_jump_crosses || !invert_worked)
+ {
+ /* This is the case where both edges out of the basic
+ block are crossing edges. Here we will fix up the
+ fall through edge. The jump edge will be taken care
+ of later. */
+
+ new_bb = force_nonfallthru (fall_thru);
+
+ if (new_bb)
+ {
+ new_bb->rbi->next = cur_bb->rbi->next;
+ cur_bb->rbi->next = new_bb;
+
+ /* Make sure new fall-through bb is in same
+ partition as bb it's falling through from. */
+
+ new_bb->partition = cur_bb->partition;
+ new_bb->succ->crossing_edge = true;
+ }
+
+ /* Add barrier after new jump */
+
+ if (new_bb)
+ {
+ barrier = emit_barrier_after (BB_END (new_bb));
+ new_bb->rbi->footer = unlink_insn_chain (barrier,
+ barrier);
+ }
+ else
+ {
+ barrier = emit_barrier_after (BB_END (cur_bb));
+ cur_bb->rbi->footer = unlink_insn_chain (barrier,
+ barrier);
+ }
+ }
+ }
+ }
+ }
+}
+
+/* This function checks the destination blockof a "crossing jump" to
+ see if it has any crossing predecessors that begin with a code label
+ and end with an unconditional jump. If so, it returns that predecessor
+ block. (This is to avoid creating lots of new basic blocks that all
+ contain unconditional jumps to the same destination). */
+
+static basic_block
+find_jump_block (basic_block jump_dest)
+{
+ basic_block source_bb = NULL;
+ edge e;
+ rtx insn;
+
+ for (e = jump_dest->pred; e; e = e->pred_next)
+ if (e->crossing_edge)
+ {
+ basic_block src = e->src;
+
+ /* Check each predecessor to see if it has a label, and contains
+ only one executable instruction, which is an unconditional jump.
+ If so, we can use it. */
+
+ if (GET_CODE (BB_HEAD (src)) == CODE_LABEL)
+ for (insn = BB_HEAD (src);
+ !INSN_P (insn) && insn != NEXT_INSN (BB_END (src));
+ insn = NEXT_INSN (insn))
+ {
+ if (INSN_P (insn)
+ && insn == BB_END (src)
+ && GET_CODE (insn) == JUMP_INSN
+ && !any_condjump_p (insn))
+ {
+ source_bb = src;
+ break;
+ }
+ }
+
+ if (source_bb)
+ break;
+ }
+
+ return source_bb;
+}
+
+/* Find all BB's with conditional jumps that are crossing edges;
+ insert a new bb and make the conditional jump branch to the new
+ bb instead (make the new bb same color so conditional branch won't
+ be a 'crossing' edge). Insert an unconditional jump from the
+ new bb to the original destination of the conditional jump. */
+
+static void
+fix_crossing_conditional_branches (void)
+{
+ basic_block cur_bb;
+ basic_block new_bb;
+ basic_block last_bb;
+ basic_block dest;
+ basic_block prev_bb;
+ edge succ1;
+ edge succ2;
+ edge crossing_edge;
+ edge new_edge;
+ rtx old_jump;
+ rtx set_src;
+ rtx old_label = NULL_RTX;
+ rtx new_label;
+ rtx new_jump;
+ rtx barrier;
+
+ last_bb = EXIT_BLOCK_PTR->prev_bb;
+
+ FOR_EACH_BB (cur_bb)
+ {
+ crossing_edge = NULL;
+ succ1 = cur_bb->succ;
+ if (succ1)
+ succ2 = succ1->succ_next;
+ else
+ succ2 = NULL;
+
+ /* We already took care of fall-through edges, so only one successor
+ can be a crossing edge. */
+
+ if (succ1 && succ1->crossing_edge)
+ crossing_edge = succ1;
+ else if (succ2 && succ2->crossing_edge)
+ crossing_edge = succ2;
+
+ if (crossing_edge)
+ {
+ old_jump = BB_END (cur_bb);
+
+ /* Check to make sure the jump instruction is a
+ conditional jump. */
+
+ set_src = NULL_RTX;
+
+ if (any_condjump_p (old_jump))
+ {
+ if (GET_CODE (PATTERN (old_jump)) == SET)
+ set_src = SET_SRC (PATTERN (old_jump));
+ else if (GET_CODE (PATTERN (old_jump)) == PARALLEL)
+ {
+ set_src = XVECEXP (PATTERN (old_jump), 0,0);
+ if (GET_CODE (set_src) == SET)
+ set_src = SET_SRC (set_src);
+ else
+ set_src = NULL_RTX;
+ }
+ }
+
+ if (set_src && (GET_CODE (set_src) == IF_THEN_ELSE))
+ {
+ if (GET_CODE (XEXP (set_src, 1)) == PC)
+ old_label = XEXP (set_src, 2);
+ else if (GET_CODE (XEXP (set_src, 2)) == PC)
+ old_label = XEXP (set_src, 1);
+
+ /* Check to see if new bb for jumping to that dest has
+ already been created; if so, use it; if not, create
+ a new one. */
+
+ new_bb = find_jump_block (crossing_edge->dest);
+
+ if (new_bb)
+ new_label = block_label (new_bb);
+ else
+ {
+ /* Create new basic block to be dest for
+ conditional jump. */
+
+ new_bb = create_basic_block (NULL, NULL, last_bb);
+ new_bb->rbi->next = last_bb->rbi->next;
+ last_bb->rbi->next = new_bb;
+ prev_bb = last_bb;
+ last_bb = new_bb;
+
+ /* Update register liveness information. */
+
+ new_bb->global_live_at_start =
+ OBSTACK_ALLOC_REG_SET (&flow_obstack);
+ new_bb->global_live_at_end =
+ OBSTACK_ALLOC_REG_SET (&flow_obstack);
+ COPY_REG_SET (new_bb->global_live_at_end,
+ prev_bb->global_live_at_end);
+ COPY_REG_SET (new_bb->global_live_at_start,
+ prev_bb->global_live_at_end);
+
+ /* Put appropriate instructions in new bb. */
+
+ new_label = gen_label_rtx ();
+ emit_label_before (new_label, BB_HEAD (new_bb));
+ BB_HEAD (new_bb) = new_label;
+
+ if (GET_CODE (old_label) == LABEL_REF)
+ {
+ old_label = JUMP_LABEL (old_jump);
+ new_jump = emit_jump_insn_after (gen_jump
+ (old_label),
+ BB_END (new_bb));
+ }
+ else if (HAVE_return
+ && GET_CODE (old_label) == RETURN)
+ new_jump = emit_jump_insn_after (gen_return (),
+ BB_END (new_bb));
+ else
+ abort ();
+
+ barrier = emit_barrier_after (new_jump);
+ JUMP_LABEL (new_jump) = old_label;
+ new_bb->rbi->footer = unlink_insn_chain (barrier,
+ barrier);
+
+ /* Make sure new bb is in same partition as source
+ of conditional branch. */
+
+ new_bb->partition = cur_bb->partition;
+ }
+
+ /* Make old jump branch to new bb. */
+
+ redirect_jump (old_jump, new_label, 0);
+
+ /* Remove crossing_edge as predecessor of 'dest'. */
+
+ dest = crossing_edge->dest;
+
+ redirect_edge_succ (crossing_edge, new_bb);
+
+ /* Make a new edge from new_bb to old dest; new edge
+ will be a successor for new_bb and a predecessor
+ for 'dest'. */
+
+ if (!new_bb->succ)
+ new_edge = make_edge (new_bb, dest, 0);
+ else
+ new_edge = new_bb->succ;
+
+ crossing_edge->crossing_edge = false;
+ new_edge->crossing_edge = true;
+ }
+ }
+ }
+}
+
+/* Find any unconditional branches that cross between hot and cold
+ sections. Convert them into indirect jumps instead. */
+
+static void
+fix_crossing_unconditional_branches (void)
+{
+ basic_block cur_bb;
+ rtx last_insn;
+ rtx label;
+ rtx label_addr;
+ rtx indirect_jump_sequence;
+ rtx jump_insn = NULL_RTX;
+ rtx new_reg;
+ rtx cur_insn;
+ edge succ;
+
+ FOR_EACH_BB (cur_bb)
+ {
+ last_insn = BB_END (cur_bb);
+ succ = cur_bb->succ;
+
+ /* Check to see if bb ends in a crossing (unconditional) jump. At
+ this point, no crossing jumps should be conditional. */
+
+ if (GET_CODE (last_insn) == JUMP_INSN
+ && succ->crossing_edge)
+ {
+ rtx label2, table;
+
+ if (any_condjump_p (last_insn))
+ abort ();
+
+ /* Make sure the jump is not already an indirect or table jump. */
+
+ else if (!computed_jump_p (last_insn)
+ && !tablejump_p (last_insn, &label2, &table))
+ {
+ /* We have found a "crossing" unconditional branch. Now
+ we must convert it to an indirect jump. First create
+ reference of label, as target for jump. */
+
+ label = JUMP_LABEL (last_insn);
+ label_addr = gen_rtx_LABEL_REF (Pmode, label);
+ LABEL_NUSES (label) += 1;
+
+ /* Get a register to use for the indirect jump. */
+
+ new_reg = gen_reg_rtx (Pmode);
+
+ /* Generate indirect the jump sequence. */
+
+ start_sequence ();
+ emit_move_insn (new_reg, label_addr);
+ emit_indirect_jump (new_reg);
+ indirect_jump_sequence = get_insns ();
+ end_sequence ();
+
+ /* Make sure every instruction in the new jump sequence has
+ its basic block set to be cur_bb. */
+
+ for (cur_insn = indirect_jump_sequence; cur_insn;
+ cur_insn = NEXT_INSN (cur_insn))
+ {
+ BLOCK_FOR_INSN (cur_insn) = cur_bb;
+ if (GET_CODE (cur_insn) == JUMP_INSN)
+ jump_insn = cur_insn;
+ }
+
+ /* Insert the new (indirect) jump sequence immediately before
+ the unconditional jump, then delete the unconditional jump. */
+
+ emit_insn_before (indirect_jump_sequence, last_insn);
+ delete_insn (last_insn);
+
+ /* Make BB_END for cur_bb be the jump instruction (NOT the
+ barrier instruction at the end of the sequence...). */
+
+ BB_END (cur_bb) = jump_insn;
+ }
+ }
+ }
+}
+
+/* Add REG_CROSSING_JUMP note to all crossing jump insns. */
+
+static void
+add_reg_crossing_jump_notes (void)
+{
+ basic_block bb;
+ edge e;
+
+ FOR_EACH_BB (bb)
+ for (e = bb->succ; e; e = e->succ_next)
+ if (e->crossing_edge
+ && GET_CODE (BB_END (e->src)) == JUMP_INSN)
+ REG_NOTES (BB_END (e->src)) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
+ NULL_RTX,
+ REG_NOTES (BB_END
+ (e->src)));
+}
+
+/* Basic blocks containing NOTE_INSN_UNLIKELY_EXECUTED_CODE will be
+ put in a separate section of the .o file, to reduce paging and
+ improve cache performance (hopefully). This can result in bits of
+ code from the same function being widely separated in the .o file.
+ However this is not obvious to the current bb structure. Therefore
+ we must take care to ensure that: 1). There are no fall_thru edges
+ that cross between sections; 2). For those architectures which
+ have "short" conditional branches, all conditional branches that
+ attempt to cross between sections are converted to unconditional
+ branches; and, 3). For those architectures which have "short"
+ unconditional branches, all unconditional branches that attempt
+ to cross between sections are converted to indirect jumps.
+
+ The code for fixing up fall_thru edges that cross between hot and
+ cold basic blocks does so by creating new basic blocks containing
+ unconditional branches to the appropriate label in the "other"
+ section. The new basic block is then put in the same (hot or cold)
+ section as the original conditional branch, and the fall_thru edge
+ is modified to fall into the new basic block instead. By adding
+ this level of indirection we end up with only unconditional branches
+ crossing between hot and cold sections.
+
+ Conditional branches are dealt with by adding a level of indirection.
+ A new basic block is added in the same (hot/cold) section as the
+ conditional branch, and the conditional branch is retargeted to the
+ new basic block. The new basic block contains an unconditional branch
+ to the original target of the conditional branch (in the other section).
+
+ Unconditional branches are dealt with by converting them into
+ indirect jumps. */
+
+static void
+fix_edges_for_rarely_executed_code (edge *crossing_edges,
+ int n_crossing_edges)
+{
+ /* Make sure the source of any crossing edge ends in a jump and the
+ destination of any crossing edge has a label. */
+
+ add_labels_and_missing_jumps (crossing_edges, n_crossing_edges);
+
+ /* Convert all crossing fall_thru edges to non-crossing fall
+ thrus to unconditional jumps (that jump to the original fall
+ thru dest). */
+
+ fix_up_fall_thru_edges ();
+
+ /* Only do the parts necessary for writing separate sections if
+ the target architecture has the ability to write separate sections
+ (i.e. it has named sections). Otherwise, the hot/cold partitioning
+ information will be used when reordering blocks to try to put all
+ the hot blocks together, then all the cold blocks, but no actual
+ section partitioning will be done. */
+
+ if (targetm.have_named_sections)
+ {
+ /* If the architecture does not have conditional branches that can
+ span all of memory, convert crossing conditional branches into
+ crossing unconditional branches. */
+
+ if (!HAS_LONG_COND_BRANCH)
+ fix_crossing_conditional_branches ();
+
+ /* If the architecture does not have unconditional branches that
+ can span all of memory, convert crossing unconditional branches
+ into indirect jumps. Since adding an indirect jump also adds
+ a new register usage, update the register usage information as
+ well. */
+
+ if (!HAS_LONG_UNCOND_BRANCH)
+ {
+ fix_crossing_unconditional_branches ();
+ reg_scan (get_insns(), max_reg_num (), 1);
+ }
+
+ add_reg_crossing_jump_notes ();
+ }
+}
+
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Reorder basic blocks. The main entry point to this file. */
void
@@ -1075,7 +1994,7 @@ reorder_basic_blocks (void)
if (n_basic_blocks <= 1)
return;
- if ((* targetm.cannot_modify_jumps_p) ())
+ if (targetm.cannot_modify_jumps_p ())
return;
timevar_push (TV_REORDER_BLOCKS);
@@ -1111,7 +2030,69 @@ reorder_basic_blocks (void)
if (dump_file)
dump_flow_info (dump_file);
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (flag_reorder_blocks_and_partition
+ && targetm.have_named_sections)
+ add_unlikely_executed_notes ();
+ /* APPLE LOCAL end hot/cold partitioning */
+
cfg_layout_finalize ();
timevar_pop (TV_REORDER_BLOCKS);
}
+
+/* APPLE LOCAL begin hot/cold partitioning */
+/* This function is the main 'entrance' for the optimization that
+ partitions hot and cold basic blocks into separate sections of the
+ .o file (to improve performance and cache locality). Ideally it
+ would be called after all optimizations that rearrange the CFG have
+ been called. However part of this optimization may introduce new
+ register usage, so it must be called before register allocation has
+ occurred. This means that this optimization is actually called
+ well before the optimization that reorders basic blocks (see function
+ above).
+
+ This optimization checks the feedback information to determine
+ which basic blocks are hot/cold and adds
+ NOTE_INSN_UNLIKELY_EXECUTED_CODE to non-hot basic blocks. The
+ presence or absence of this note is later used for writing out
+ sections in the .o file. This optimization must also modify the
+ CFG to make sure there are no fallthru edges between hot & cold
+ blocks, as those blocks will not necessarily be contiguous in the
+ .o (or assembly) file; and in those cases where the architecture
+ requires it, conditional and unconditional branches that cross
+ between sections are converted into unconditional or indirect
+ jumps, depending on what is appropriate. */
+
+void
+partition_hot_cold_basic_blocks (void)
+{
+ basic_block cur_bb;
+ edge *crossing_edges;
+ int n_crossing_edges;
+ int max_edges = 2 * last_basic_block;
+
+ if (n_basic_blocks <= 1)
+ return;
+
+ crossing_edges = xcalloc (max_edges, sizeof (edge));
+
+ cfg_layout_initialize ();
+
+ FOR_EACH_BB (cur_bb)
+ if (cur_bb->index >= 0
+ && cur_bb->next_bb->index >= 0)
+ cur_bb->rbi->next = cur_bb->next_bb;
+
+ find_rarely_executed_basic_blocks_and_crossing_edges (crossing_edges,
+ &n_crossing_edges,
+ &max_edges);
+
+ if (n_crossing_edges > 0)
+ fix_edges_for_rarely_executed_code (crossing_edges, n_crossing_edges);
+
+ free (crossing_edges);
+
+ cfg_layout_finalize();
+}
+/* APPLE LOCAL end hot/cold partitioning */
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 6b6440f0c58..73ca653d8c3 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -174,7 +174,6 @@ static void simplify_builtin_next_arg (tree);
static void simplify_builtin_va_start (tree);
static tree simplify_builtin_sprintf (tree, int);
-
/* Return the alignment in bits of EXP, a pointer valued expression.
But don't return more than MAX_ALIGN no matter what.
The alignment returned is, by default, the alignment of the thing that
diff --git a/gcc/c-common.c b/gcc/c-common.c
index d23a5bc5d0e..8aa8dbb4acc 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -38,6 +38,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "obstack.h"
#include "cpplib.h"
#include "target.h"
+/* APPLE LOCAL Symbol Separation */
+#include "debug.h"
#include "langhooks.h"
#include "tree-inline.h"
#include "c-tree.h"
@@ -151,6 +153,13 @@ cpp_reader *parse_in; /* Declared in c-pragma.h. */
tree char_array_type_node;
+ ** APPLE LOCAL begin pascal strings **
+ Type `unsigned char[SOMENUMBER]'.
+ Used for pascal-type strings ("\pstring").
+
+ tree pascal_string_type_node;
+ ** APPLE LOCAL end pascal strings **
+
Type `int[SOMENUMBER]' or something like it.
Used when an array of int needed and the size is irrelevant.
@@ -449,6 +458,13 @@ int warn_implicit_int;
int warn_nonnull;
+/* BEGIN APPLE LOCAL disable_typechecking_for_spec_flag */
+/* This makes type conflicts a warning, instead of an error,
+ to work around some problems with SPEC. */
+
+int disable_typechecking_for_spec_flag;
+/* END APPLE LOCAL disable_typechecking_for_spec_flag */
+
/* Warn about old-style parameter declaration. */
int warn_old_style_definition;
@@ -601,6 +617,43 @@ int flag_permissive;
int flag_enforce_eh_specs = 1;
+/* APPLE LOCAL begin -findirect-virtual-calls 2001-10-30 sts */
+/* Nonzero if all calls to virtual functions should cause indirection
+ through a vtable. */
+int flag_indirect_virtual_calls;
+/* APPLE LOCAL end -findirect-virtual-calls 2001-10-30 sts */
+
+/* APPLE LOCAL begin terminated-vtables */
+/* Nonzero means append a zero word to vtables. Used by darwin kernel
+ driver dynamic-loader to find the ends of vtables for patching. */
+int flag_terminated_vtables = 0;
+/* APPLE LOCAL end terminated-vtables */
+
+/* APPLE LOCAL begin private extern Radar 2872481 ilr */
+/* Nonzero if -fpreproceessed specified. This is needed by
+ init_reswords() so that it can make __private_extern__ have the
+ same rid code as extern when -fpreprocessed is specified. Normally
+ there is a -D on the command line for this. But if -fpreprocessed
+ was specified then macros aren't expanded. So we fake the token
+ value out using the rid code. */
+int flag_preprocessed = 0;
+/* APPLE LOCAL end private extern Radar 2872481 ilr */
+
+/* APPLE LOCAL begin apple-kext Radar #2849864 ilr */
+/* Nonzero if we're compiling in a gcc2.95-compatibility mode.
+ Implies -fterminated-vtables and -findirect-virtual-calls,
+ only-deleting-destructor support, 2.95 ptmfs, vptr initialisation,
+ constructors-returning-this... */
+int flag_apple_kext = 0;
+/* APPLE LOCAL end apple-kext ilr */
+
+/* APPLE LOCAL begin structor thunks */
+/* Nonzero if we prefer to clone con/de/structors. Alternative is to
+ gen multiple tiny thunk-esque things that call/jump to a unified
+ con/de/structor. This is a classic size/speed tradeoff. */
+int flag_clone_structors = 0;
+/* APPLE LOCAL end structor thunks */
+
/* Nonzero means warn about things that will change when compiling
with an ABI-compliant compiler. */
@@ -696,6 +749,15 @@ void (*lang_expand_function_end) (void);
This is a count, since unevaluated expressions can nest. */
int skip_evaluation;
+/* APPLE LOCAL begin -Wlong-double */
+/* Nonzero means warn about usage of long double. */
+#ifdef CONFIG_DARWIN_H
+int warn_long_double = 1;
+#else
+int warn_long_double = 0;
+#endif
+/* APPLE LOCAL end -Wlong-double */
+
/* Information about how a function name is generated. */
struct fname_var_t
{
@@ -771,6 +833,12 @@ static tree handle_no_limit_stack_attribute (tree *, tree, tree, int,
static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
static tree handle_deprecated_attribute (tree *, tree, tree, int,
bool *);
+/* APPLE LOCAL begin unavailable (Radar 2809697) ilr */
+static tree handle_unavailable_attribute (tree *, tree, tree, int, bool *);
+/* APPLE LOCAL end unavailable ilr */
+/* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+static tree handle_weak_import_attribute (tree *, tree, tree, int, bool *);
+/* APPLE LOCAL end weak_import ilr */
static tree handle_vector_size_attribute (tree *, tree, tree, int,
bool *);
static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
@@ -841,6 +909,14 @@ const struct attribute_spec c_common_attribute_table[] =
handle_pure_attribute },
{ "deprecated", 0, 0, false, false, false,
handle_deprecated_attribute },
+ /* APPLE LOCAL begin unavailable (Radar 2809697) ilr */
+ { "unavailable", 0, 0, false, false, false,
+ handle_unavailable_attribute },
+ /* APPLE LOCAL end unavailable ilr */
+ /* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+ { "weak_import", 0, 0, true, false, false,
+ handle_weak_import_attribute },
+ /* APPLE LOCAL end weak_import ilr */
{ "vector_size", 1, 1, false, true, false,
handle_vector_size_attribute },
{ "visibility", 1, 1, true, false, false,
@@ -1160,6 +1236,13 @@ fix_string_type (tree value)
{
const int wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT;
const int wide_flag = TREE_TYPE (value) == wchar_array_type_node;
+ /* APPLE LOCAL begin pascal strings */
+ const int pascal_flag = TREE_TYPE (value) == pascal_string_type_node;
+ tree base_type
+ = wide_flag ? wchar_type_node
+ : pascal_flag ? unsigned_char_type_node
+ : char_type_node;
+ /* APPLE LOCAL end pascal strings */
const int nchars_max = flag_isoc99 ? 4095 : 509;
int length = TREE_STRING_LENGTH (value);
int nchars;
@@ -1177,16 +1260,16 @@ fix_string_type (tree value)
For C++, this is the standard behavior. */
if (flag_const_strings)
{
- tree elements
- = build_type_variant (wide_flag ? wchar_type_node : char_type_node,
- 1, 0);
+ /* APPLE LOCAL pascal strings */
+ tree elements = build_type_variant (base_type, 1, 0);
TREE_TYPE (value)
= build_array_type (elements,
build_index_type (build_int_2 (nchars - 1, 0)));
}
else
TREE_TYPE (value)
- = build_array_type (wide_flag ? wchar_type_node : char_type_node,
+ /* APPLE LOCAL pascal strings */
+ = build_array_type (base_type,
build_index_type (build_int_2 (nchars - 1, 0)));
TREE_CONSTANT (value) = 1;
@@ -1285,6 +1368,16 @@ constant_fits_type_p (tree c, tree type)
return !TREE_OVERFLOW (c);
}
+/* Nonzero if vector types T1 and T2 can be converted to each other
+ without an explicit cast. */
+int
+vector_types_compatible_p (tree t1, tree t2)
+{
+ return targetm.vector_opaque_p (t1)
+ || targetm.vector_opaque_p (t2)
+ || TYPE_MODE (t1) == TYPE_MODE (t2);
+}
+
/* Convert EXPR to TYPE, warning about conversion problems with constants.
Invoke this function on every expression that is converted implicitly,
i.e. because of language rules and not because of an explicit cast. */
@@ -1886,38 +1979,12 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp)
if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
return unsignedp ? make_unsigned_type (mode) : make_signed_type (mode);
- switch (mode)
- {
- case V16QImode:
- return unsignedp ? unsigned_V16QI_type_node : V16QI_type_node;
- case V8HImode:
- return unsignedp ? unsigned_V8HI_type_node : V8HI_type_node;
- case V4SImode:
- return unsignedp ? unsigned_V4SI_type_node : V4SI_type_node;
- case V2DImode:
- return unsignedp ? unsigned_V2DI_type_node : V2DI_type_node;
- case V2SImode:
- return unsignedp ? unsigned_V2SI_type_node : V2SI_type_node;
- case V2HImode:
- return unsignedp ? unsigned_V2HI_type_node : V2HI_type_node;
- case V4HImode:
- return unsignedp ? unsigned_V4HI_type_node : V4HI_type_node;
- case V8QImode:
- return unsignedp ? unsigned_V8QI_type_node : V8QI_type_node;
- case V1DImode:
- return unsignedp ? unsigned_V1DI_type_node : V1DI_type_node;
- case V16SFmode:
- return V16SF_type_node;
- case V4SFmode:
- return V4SF_type_node;
- case V2SFmode:
- return V2SF_type_node;
- case V2DFmode:
- return V2DF_type_node;
- case V4DFmode:
- return V4DF_type_node;
- default:
- break;
+ if (VECTOR_MODE_P (mode))
+ {
+ enum machine_mode inner_mode = GET_MODE_INNER (mode);
+ tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);
+ if (inner_type != NULL_TREE)
+ return build_vector_type_for_mode (inner_type, mode);
}
for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
@@ -2267,7 +2334,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
TREE_TYPE (primop0));
/* In C, if TYPE is an enumeration, then we need to get its
- min/max values from it's underlying integral type, not the
+ min/max values from its underlying integral type, not the
enumerated type itself. In C++, TYPE_MAX_VALUE and
TYPE_MIN_VALUE have already been set correctly on the
enumeration type. */
@@ -3341,6 +3408,10 @@ c_common_nodes_and_builtins (void)
array type. */
char_array_type_node
= build_array_type (char_type_node, array_domain_type);
+ /* APPLE LOCAL begin pascal strings */
+ pascal_string_type_node
+ = build_array_type (unsigned_char_type_node, array_domain_type);
+ /* APPLE LOCAL end pascal strings */
/* Likewise for arrays of ints. */
int_array_type_node
@@ -3850,7 +3921,8 @@ expand_tree_builtin (tree function, tree params, tree coerced_params)
return expand_unordered_cmp (function, params, UNORDERED_EXPR, NOP_EXPR);
default:
- break;
+ /* APPLE LOCAL constant cfstrings */
+ return (*targetm.expand_tree_builtin) (function, params, coerced_params);
}
return NULL_TREE;
@@ -5253,6 +5325,97 @@ handle_deprecated_attribute (tree *node, tree name,
return NULL_TREE;
}
+/* APPLE LOCAL begin unavailable (Radar 2809697) ilr */
+/* Handle a "unavailable" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_unavailable_attribute (tree *node, tree name,
+ tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED,
+ bool *no_add_attrs)
+{
+ tree type = NULL_TREE;
+ int warn = 0;
+ const char *what = NULL;
+
+ if (DECL_P (*node))
+ {
+ tree decl = *node;
+ type = TREE_TYPE (decl);
+
+ if (TREE_CODE (decl) == TYPE_DECL
+ || TREE_CODE (decl) == PARM_DECL
+ || TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == FUNCTION_DECL
+ || TREE_CODE (decl) == FIELD_DECL)
+ {
+ TREE_DEPRECATED (decl) = 1;
+ TREE_UNAVAILABLE (decl) = 1;
+ }
+ else
+ warn = 1;
+ }
+ else if (TYPE_P (*node))
+ {
+ if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
+ *node = build_type_copy (*node);
+ TREE_DEPRECATED (*node) = 1;
+ TREE_UNAVAILABLE (*node) = 1;
+ type = *node;
+ }
+ else
+ warn = 1;
+
+ if (warn)
+ {
+ *no_add_attrs = true;
+ if (type && TYPE_NAME (type))
+ {
+ if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+ what = IDENTIFIER_POINTER (TYPE_NAME (*node));
+ else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (type)))
+ what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ }
+ if (what)
+ warning ("`%s' attribute ignored for `%s'",
+ IDENTIFIER_POINTER (name), what);
+ else
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ }
+
+ return NULL_TREE;
+}
+/* APPLE LOCAL end unavailable ilr */
+
+/* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+/* Handle a "weak_import" attribute; arguments as in
+ struct attribute_spec.handler. If FLAGS contains
+ ATTR_FLAG_FUNCTION_DEF then the attribute is on a
+ function definition which is not allowed. Only
+ function prototypes and extern data definitions
+ are allowed. */
+
+static tree
+handle_weak_import_attribute (tree *node, tree name,
+ tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED,
+ bool *no_add_attrs)
+{
+ /* See FIXME comment in c_common_attribute_table. */
+ if ((flags & (int) ATTR_FLAG_FUNCTION_DEF) == 0 && DECL_EXTERNAL (*node))
+ DECL_WEAK_IMPORT (*node) = 1;
+ else
+ {
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+/* APPLE LOCAL end weak_import ilr */
+
/* Keep a list of vector type nodes we created in handle_vector_size_attribute,
to prevent us from duplicating type nodes unnecessarily.
The normal mechanism to prevent duplicates is to use type_hash_canon, but
@@ -5270,19 +5433,24 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
{
unsigned HOST_WIDE_INT vecsize, nunits;
enum machine_mode mode, orig_mode, new_mode;
- tree type = *node, new_type = NULL_TREE;
- tree type_list_node;
+ tree type = *node, new_type, size;
*no_add_attrs = true;
- if (! host_integerp (TREE_VALUE (args), 1))
+ /* Stripping NON_LVALUE_EXPR allows declarations such as
+ typedef short v4si __attribute__((vector_size (4 * sizeof(short)))). */
+ size = TREE_VALUE (args);
+ if (TREE_CODE (size) == NON_LVALUE_EXPR)
+ size = TREE_OPERAND (size, 0);
+
+ if (! host_integerp (size, 1))
{
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
return NULL_TREE;
}
/* Get the vector size (in bytes). */
- vecsize = tree_low_cst (TREE_VALUE (args), 1);
+ vecsize = tree_low_cst (size, 1);
/* We need to provide for vector pointers, vector arrays, and
functions returning vectors. For example:
@@ -5328,73 +5496,13 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
break;
}
- if (new_mode == VOIDmode)
+ if (new_mode == VOIDmode)
{
error ("no vector mode with the size and type specified could be found");
return NULL_TREE;
}
- for (type_list_node = vector_type_node_list; type_list_node;
- type_list_node = TREE_CHAIN (type_list_node))
- {
- tree other_type = TREE_VALUE (type_list_node);
- tree record = TYPE_DEBUG_REPRESENTATION_TYPE (other_type);
- tree fields = TYPE_FIELDS (record);
- tree field_type = TREE_TYPE (fields);
- tree array_type = TREE_TYPE (field_type);
- if (TREE_CODE (fields) != FIELD_DECL
- || TREE_CODE (field_type) != ARRAY_TYPE)
- abort ();
-
- if (TYPE_MODE (other_type) == mode && type == array_type)
- {
- new_type = other_type;
- break;
- }
- }
-
- if (new_type == NULL_TREE)
- {
- tree index, array, rt, list_node;
-
- new_type = (*lang_hooks.types.type_for_mode) (new_mode,
- TREE_UNSIGNED (type));
-
- if (!new_type)
- {
- error ("no vector mode with the size and type specified could be found");
- return NULL_TREE;
- }
-
- new_type = build_type_copy (new_type);
-
- /* If this is a vector, make sure we either have hardware
- support, or we can emulate it. */
- if ((GET_MODE_CLASS (mode) == MODE_VECTOR_INT
- || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT)
- && !vector_mode_valid_p (mode))
- {
- error ("unable to emulate '%s'", GET_MODE_NAME (mode));
- return NULL_TREE;
- }
-
- /* Set the debug information here, because this is the only
- place where we know the underlying type for a vector made
- with vector_size. For debugging purposes we pretend a vector
- is an array within a structure. */
- index = build_int_2 (TYPE_VECTOR_SUBPARTS (new_type) - 1, 0);
- array = build_array_type (type, build_index_type (index));
- rt = make_node (RECORD_TYPE);
-
- TYPE_FIELDS (rt) = build_decl (FIELD_DECL, get_identifier ("f"), array);
- DECL_CONTEXT (TYPE_FIELDS (rt)) = rt;
- layout_type (rt);
- TYPE_DEBUG_REPRESENTATION_TYPE (new_type) = rt;
-
- list_node = build_tree_list (NULL, new_type);
- TREE_CHAIN (list_node) = vector_type_node_list;
- vector_type_node_list = list_node;
- }
+ new_type = build_vector_type_for_mode (type, new_mode);
/* Build back pointers if needed. */
*node = reconstruct_complex_type (*node, new_type);
@@ -5746,6 +5854,82 @@ check_function_arguments_recurse (void (*callback)
(*callback) (ctx, param, param_num);
}
+/* APPLE LOCAL begin -Wlong-double dpatel */
+void
+warn_about_long_double (void)
+{
+ /* Nonzero means we already warned about long doubles. */
+ static int warned_about_long_double = 0;
+
+ if (warn_long_double
+ && ! warned_about_long_double
+ /* Oh, the fromage of it all... For hysterical reasons, the
+ preprocessor does not recognize things in the system
+ frameworks as "system headers", which confuses some types
+ of warnings. So instead of hacking the preprocessors in
+ obscure ways, test for and ignore system headers here. */
+ && ! in_system_header
+ && ! strstr (input_filename, "/System/Library/Frameworks/")
+ && ! strstr (input_filename, "/usr/include/"))
+ {
+ warning ("use of `long double' type; its size may change in a future release");
+ warning ("(Long double usage is reported only once for each file.");
+ warning ("To disable this warning, use -Wno-long-double.)");
+ warned_about_long_double = 1;
+ }
+}
+/* APPLE LOCAL end -Wlong-double dpatel */
+
+/* APPLE LOCAL begin Symbol Separation */
+/* Call debugger hooks to restore state of debugging symbol generation.
+ This is called at the end of header processing whose symbol repository was
+ available and valid. */
+void
+cb_restore_write_symbols (void)
+{
+ (*debug_hooks->restore_write_symbols) ();
+}
+
+/* Call debugger hooks to clear state of debugging symbol generation.
+ This is called to stop generation of debugging info. for a header whose
+ valid context information is available. */
+void
+cb_clear_write_symbols (const char *filename, unsigned long checksum)
+{
+ (*debug_hooks->clear_write_symbols) (filename, checksum);
+}
+
+/* Call debugger hooks to mark start of symbol repository.
+ Similar to start_source_file. Only difference is that checksum is added
+ with BINCL stabs. */
+void
+cb_start_symbol_repository (unsigned int lineno, const char *filename,
+ unsigned long checksum)
+{
+ (*debug_hooks->start_symbol_repository) (lineno, filename, checksum);
+}
+
+/* Call debugger hoooks to makr end of symbol repository.
+ Identical to end_source_file. */
+void
+cb_end_symbol_repository (unsigned int lineno)
+{
+ (*debug_hooks->end_symbol_repository) (lineno);
+}
+
+/* Decide if hashnode points to a tree used for builtin identifier.
+ This is used during context info writing to avoid collecting information
+ about builtins in cinfo files. */
+int
+cb_is_builtin_identifier (cpp_hashnode *p)
+{
+ if (DECL_BUILT_IN_CLASS (HT_IDENT_TO_GCC_IDENT (HT_NODE (p))))
+ return 1;
+ else
+ return 0;
+}
+/* APPLE LOCAL end Symbol Separation */
+
/* C implementation of lang_hooks.tree_inlining.walk_subtrees. Tracks the
line number from STMT_LINENO and handles DECL_STMT specially. */
@@ -6096,4 +6280,58 @@ c_warn_unused_result (tree *top_p)
}
}
+/* APPLE LOCAL begin AltiVec */
+/* Convert the incoming expression EXPR into a vector constructor of
+ type VECTOR_TYPE, casting the individual vector elements as appropriate. */
+
+tree
+vector_constructor_from_expr (tree expr, tree vector_type)
+{
+ tree list = NULL_TREE, elttype = TREE_TYPE (vector_type);
+ int index, max_index = TYPE_VECTOR_SUBPARTS (vector_type);
+ int all_constant = TREE_CONSTANT (expr);
+ bool cxx = (c_dialect_cxx () != 0); /* Impedance matching. */
+
+ /* If we already have a vector expression, then the user probably
+ wants to convert it to another. */
+ if (TREE_CODE (TREE_TYPE (expr)) == VECTOR_TYPE)
+ return convert (vector_type, expr);
+
+ /* Walk through the compound expression, gathering initializers. */
+ for (index = 0; index < max_index; ++index)
+ {
+ tree elem;
+
+ if (TREE_CODE (expr) == COMPOUND_EXPR)
+ {
+ elem
+ = (cxx ? TREE_OPERAND (expr, 1) : TREE_OPERAND (expr, 0));
+ expr = (cxx ? TREE_OPERAND (expr, 0) : TREE_OPERAND (expr, 1));
+ }
+ else
+ elem = expr;
+
+ while (TREE_CODE (elem) == COMPOUND_EXPR && TREE_CONSTANT (elem))
+ elem = TREE_OPERAND (elem, 1);
+ while (TREE_CODE (elem) == CONVERT_EXPR)
+ elem = TREE_OPERAND (elem, 0);
+
+ list = chainon (list,
+ build_tree_list (NULL_TREE,
+ convert (elttype, elem)));
+ }
+
+ if (cxx)
+ list = nreverse (list);
+
+ list = build_constructor (vector_type, list);
+ if (cxx)
+ TREE_LANG_FLAG_4 (list) = 1; /* TREE_HAS_CONSTRUCTOR */
+ else
+ TREE_CONSTANT (list) = all_constant;
+
+ return list;
+}
+/* APPLE LOCAL end AltiVec */
+
#include "gt-c-common.h"
diff --git a/gcc/c-common.h b/gcc/c-common.h
index d874f8bc711..bdb4f15ea15 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -61,6 +61,9 @@ enum rid
/* C extensions */
RID_COMPLEX, RID_THREAD,
+ /* APPLE LOCAL private extern */
+ RID_PRIVATE_EXTERN,
+
/* C++ */
RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
@@ -144,6 +147,8 @@ enum c_tree_index
CTI_WIDEST_UINT_LIT_TYPE,
CTI_CHAR_ARRAY_TYPE,
+ /* APPLE LOCAL Pascal strings 2001-07-05 zll */
+ CTI_PASCAL_STRING_TYPE, /* for Pascal strings */
CTI_WCHAR_ARRAY_TYPE,
CTI_INT_ARRAY_TYPE,
CTI_STRING_TYPE,
@@ -198,6 +203,8 @@ struct c_common_identifier GTY(())
#define truthvalue_false_node c_global_trees[CTI_TRUTHVALUE_FALSE]
#define char_array_type_node c_global_trees[CTI_CHAR_ARRAY_TYPE]
+/* APPLE LOCAL pascal strings */
+#define pascal_string_type_node c_global_trees[CTI_PASCAL_STRING_TYPE]
#define wchar_array_type_node c_global_trees[CTI_WCHAR_ARRAY_TYPE]
#define int_array_type_node c_global_trees[CTI_INT_ARRAY_TYPE]
#define string_type_node c_global_trees[CTI_STRING_TYPE]
@@ -374,6 +381,13 @@ extern int flag_replace_objc_classes;
/* Nonzero means don't output line number information. */
+/* APPLE LOCAL begin Symbol Separation */
+/* The directory name where separate debug repository and context
+ available. NULL if Symbol Separation is not used. */
+extern const char *dbg_dir;
+
+/* APPLE LOCAL end Symbol Separation */
+
extern char flag_no_line_commands;
/* Nonzero causes -E output not to be done, but directives such as
@@ -475,6 +489,12 @@ extern int warn_sign_compare;
extern int warn_long_long;
+/* APPLE LOCAL begin -Wlong-double */
+/* Nonzero means warn about usage of long double. */
+
+extern int warn_long_double;
+/* APPLE LOCAL end -Wlong-double */
+
/* Nonzero means warn about deprecated conversion from string constant to
`char *'. */
@@ -527,6 +547,13 @@ extern int warn_format_nonliteral;
extern int warn_format_security;
+/* BEGIN APPLE LOCAL disable_typechecking_for_spec_flag */
+/* This makes type conflicts a warning, instead of an error,
+ to work around some problems with SPEC. */
+
+extern int disable_typechecking_for_spec_flag;
+/* END APPLE LOCAL disable_typechecking_for_spec_flag */
+
/* C/ObjC language option variables. */
@@ -758,6 +785,68 @@ extern int flag_permissive;
extern int flag_enforce_eh_specs;
+/* The version of the C++ ABI in use. The following values are
+ allowed:
+
+ APPLE LOCAL begin 10.2 C++ abi compat mrs
+ -2: 2.95.2 Apple uses for kernel extensions.
+
+ -1: gcc 3.1 20020420. Apple uses for gcc3 compatible 10.2.
+
+ APPLE LOCAL end 10.2 C++ abi compat mrs
+ 0: The version of the ABI believed most conformant with the
+ C++ ABI specification. This ABI may change as bugs are
+ discovered and fixed. Therefore, 0 will not necessarily
+ indicate the same ABI in different versions of G++.
+
+ 1: The version of the ABI first used in G++ 3.2.
+
+ Additional positive integers will be assigned as new versions of
+ the ABI become the default version of the ABI. */
+
+extern int flag_abi_version;
+
+/* APPLE LOCAL begin -findirect-virtual-calls 2001-10-30 sts */
+/* Nonzero if all calls to virtual functions should cause indirection
+ through a vtable. */
+
+extern int flag_indirect_virtual_calls;
+/* APPLE LOCAL end -findirect-virtual-calls 2001-10-30 sts */
+
+/* APPLE LOCAL begin -fterminated-vtables */
+/* Nonzero to terminate vtables with a unique value, currently zero.
+ Used by the darwin kernel to find ends of vtables for patching
+ when loading drivers dynamically. */
+
+extern int flag_terminated_vtables;
+/* APPLE LOCAL end -fterminated-vtables */
+
+/* APPLE LOCAL begin 2.95-compatibility stuff turly */
+/* Nonzero if we're compiling in a gcc2.95-compatibility mode.
+ Implies -fterminated-vtables and -findirect-virtual-calls,
+ only-deleting-destructor support, 2.95 ptmfs, vptr initialisation,
+ constructors-returning-this... */
+
+extern int flag_apple_kext;
+/* APPLE LOCAL end 2.95-compatibility stuff turly */
+
+/* APPLE LOCAL begin structor thunks */
+/* Nonzero if we prefer to clone con/de/structors.
+ Alternative is to gen multiple tiny thunk-esque things that
+ call/jump to a unified con/de/structor. This is a classic
+ size/speed tradeoff. */
+extern int flag_clone_structors;
+/* APPLE LOCAL begin structor thunks */
+
+/* APPLE LOCAL begin private extern Radar 2872481 ilr */
+/* Nonzero if -fpreprocessed specified. This is needed by init_reswords()
+ so that it can make __private_extern__ have the same rid code as extern
+ when -fpreprocessed is specified. Normally there is a -D on the command
+ line for this. But if -fpreprocessed was specified then macros aren't
+ expanded. So we fake the token value out using the rid code. */
+extern int flag_preprocessed;
+/* APPLE LOCAL end private extern Radar 2872481 ilr */
+
/* Nonzero means warn about things that will change when compiling
with an ABI-compliant compiler. */
@@ -1199,6 +1288,8 @@ extern tree finish_label_address_expr (tree);
different implementations. Used in c-common.c. */
extern tree lookup_label (tree);
+extern int vector_types_compatible_p (tree t1, tree t2);
+
extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
extern int c_safe_from_p (rtx, tree);
@@ -1229,6 +1320,36 @@ extern void dump_time_statistics (void);
extern bool c_dump_tree (void *, tree);
+/* APPLE LOCAL begin Objective-C++ */
+/* The following have been moved here from c-tree.h, since they're needed
+ in the ObjC++ world, too. */
+extern tree lookup_interface (tree);
+extern tree is_class_name (tree);
+extern tree is_id (tree);
+extern void objc_check_decl (tree);
+extern int objc_comptypes (tree, tree, int);
+extern tree objc_message_selector (void);
+extern int recognize_objc_keyword (void);
+extern tree lookup_objc_ivar (tree);
+/* APPLE LOCAL end Objective-C++ */
+
+/* APPLE LOCAL -Wlong-double */
+extern void warn_about_long_double (void);
+
+/* APPLE LOCAL begin Symbol Separation */
+extern void dbg_ss_init (void);
+extern void c_common_write_context (void);
+extern void cb_clear_write_symbols (const char *, unsigned long);
+extern void cb_restore_write_symbols (void);
+extern void cb_start_symbol_repository (unsigned int,
+ const char *,
+ unsigned long);
+extern void cb_end_symbol_repository (unsigned int);
+extern int c_valid_cinfo (cpp_reader *,
+ const char *);
+extern int cb_is_builtin_identifier (cpp_hashnode *);
+/* APPLE LOCAL end Symbol Separation */
+
extern int c_gimplify_expr (tree *, tree *, tree *);
extern tree c_walk_subtrees (tree*, int*, walk_tree_fn, void*, void*);
extern int c_tree_chain_matters_p (tree);
@@ -1265,6 +1386,12 @@ extern tree lookup_objc_ivar (tree);
extern void *get_current_scope (void);
extern void objc_mark_locals_volatile (void *);
+/* APPLE LOCAL begin AltiVec */
+/* The following function will convert expressions into
+ vector initializers. */
+extern tree vector_constructor_from_expr (tree, tree);
+/* APPLE LOCAL end AltiVec */
+
/* In c-ppoutput.c */
extern void init_pp_output (FILE *);
extern void preprocess_file (cpp_reader *);
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index 20d2e466fe3..39eb63ecd4e 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -33,6 +33,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "flags.h"
#include "convert.h"
#include "c-common.h"
+/* APPLE LOCAL begin IMA aggregate types */
+#include "c-tree.h"
+/* APPLE LOCAL end IMA aggregate types */
#include "langhooks.h"
#include "toplev.h"
@@ -114,6 +117,15 @@ convert (tree type, tree expr)
return fold (convert_to_complex (type, e));
if (code == VECTOR_TYPE)
return fold (convert_to_vector (type, e));
+ /* APPLE LOCAL begin IMA aggregate types */
+ if (code == RECORD_TYPE || code == ENUMERAL_TYPE || code == UNION_TYPE)
+ {
+ tree t2 = TREE_TYPE (expr);
+ if (code == TREE_CODE (t2)
+ && !same_translation_unit_p (type, t2) && tagged_types_tu_compatible_p (type, t2, 0))
+ return e;
+ }
+ /* APPLE LOCAL end IMA aggregate types */
error ("conversion to non-scalar type requested");
return error_mark_node;
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index 8573b8c5a46..39a37059f93 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -31,6 +31,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
#include "toplev.h"
#include "tm_p.h" /* Target prototypes. */
+/* APPLE LOCAL begin pascal strings */
+#include "cpplib.h"
+#include "cpphash.h"
+/* APPLE LOCAL end pascal strings */
#ifndef TARGET_OS_CPP_BUILTINS
# define TARGET_OS_CPP_BUILTINS()
@@ -289,6 +293,32 @@ define__GNUC__ (void)
if (*v && *v != ' ' && *v != '-')
abort ();
+
+ /* APPLE LOCAL begin Apple version */
+ {
+ /* This chunk of code defines __APPLE_CC__ from the version
+ string. It expects to see a substring of the version string of
+ the form "build NNNN)", where each N is a digit, and the first
+ N is nonzero (there can be 4 or 5 digits). It will abort() if
+ these conditions are not met, since that usually means that
+ someone's broken the version string. */
+ const char *vt;
+
+ vt = strstr (version_string, "build ");
+ if (vt == NULL)
+ abort ();
+ vt += strlen ("build ");
+ if (! ISDIGIT (*vt))
+ abort ();
+ for (q = vt; *q != 0 && ISDIGIT (*q); q++)
+ ;
+ if (q == vt || *q != ')')
+ abort ();
+ if ((q - vt != 4 && q - vt != 5) || *vt == '0')
+ abort ();
+ builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt);
+ }
+ /* APPLE LOCAL end Apple version */
}
/* Hook that registers front end and target-specific built-ins. */
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 21c5939c916..2d7f41b061c 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -60,6 +60,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "except.h"
#include "langhooks-def.h"
+/* APPLE LOCAL begin new tree dump */
+#include "dmp-tree.h"
+extern int c_dump_tree_p (FILE *, const char *, tree, int);
+extern lang_dump_tree_p_t c_prev_lang_dump_tree_p;
+/* APPLE LOCAL end new tree dump */
+
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
enum decl_context
{ NORMAL, /* Ordinary declaration */
@@ -327,15 +333,33 @@ static void clone_underlying_type (tree);
static bool flexible_array_type_p (tree);
static hashval_t link_hash_hash (const void *);
static int link_hash_eq (const void *, const void *);
+/* APPLE LOCAL loop transpose */
+static void loop_transpose (tree);
+static tree perform_loop_transpose (tree *, int *, void *);
+static tree tree_contains_1 (tree *, int *, void *);
+static bool tree_contains (tree, tree);
+static tree should_transpose_for_loops_1 (tree *, int *, void *);
+static bool should_transpose_for_loops (tree, tree, tree, tree*);
+static tree find_tree_with_code_1 (tree *, int *, void *);
+static tree find_tree_with_code (tree, enum tree_code);
+static tree find_pointer (tree);
+
/* States indicating how grokdeclarator() should handle declspecs marked
with __attribute__((deprecated)). An object declared as
__attribute__((deprecated)) suppresses warnings of uses of other
deprecated items. */
+/* APPLE LOCAL begin unavailable */
+/* Also add an __attribute__((unavailable)). An object declared as
+ __attribute__((unavailable)) suppresses any reports of being
+ declared with unavailable or deprecated items. */
+/* APPLE LOCAL end unavailable */
enum deprecated_states {
DEPRECATED_NORMAL,
DEPRECATED_SUPPRESS
+ /* APPLE LOCAL unavailable */
+ , DEPRECATED_UNAVAILABLE_SUPPRESS
};
static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
@@ -938,6 +962,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
/* Two different categories of symbol altogether. This is an error
unless OLDDECL is a builtin. OLDDECL will be discarded in any case. */
+
if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
{
if (TREE_CODE (olddecl) != FUNCTION_DECL
@@ -1004,6 +1029,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
}
else
{
+ /* BEGIN APPLE LOCAL disable_typechecking_for_spec_flag */
+ if (disable_typechecking_for_spec_flag)
+ {
+ warning ("%Jconflicting types for `%D'", newdecl, newdecl);
+ warning ("%Jprevious declaration of `%D'", olddecl, olddecl);
+ return 0;
+ }
+ /* END APPLE LOCAL disable_typechecking_for_spec_flag */
error ("%Jconflicting types for '%D'", newdecl, newdecl);
diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype);
locate_old_decl (olddecl, error);
@@ -1478,16 +1511,23 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
}
}
+ /* APPLE LOCAL begin peserve invisible flag for gap */
/* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
- But preserve OLDDECL's DECL_UID. */
+ But preserve OLDDECL's DECL_UID, C_DECL_INVISIBLE, and
+ DUPLICATE_DECL. */
{
unsigned olddecl_uid = DECL_UID (olddecl);
+ unsigned olddecl_c_decl_invisible = C_DECL_INVISIBLE (olddecl);
+ unsigned olddecl_duplicate_decl = DECL_DUPLICATE_DECL (olddecl);
memcpy ((char *) olddecl + sizeof (struct tree_common),
(char *) newdecl + sizeof (struct tree_common),
sizeof (struct tree_decl) - sizeof (struct tree_common));
DECL_UID (olddecl) = olddecl_uid;
+ C_DECL_INVISIBLE (olddecl) = olddecl_c_decl_invisible;
+ DECL_DUPLICATE_DECL (olddecl) = olddecl_duplicate_decl;
}
+ /* APPLE LOCAL end peserve invisible flag for gap */
/* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl
so that encode_section_info has a chance to look at the new decl
@@ -1723,8 +1763,17 @@ pushdecl (tree x)
tree ext = any_external_decl (name);
if (ext)
{
+ /* APPLE LOCAL begin peserve invisible flag for gap */
+ unsigned old_decl_external = DECL_EXTERNAL(ext);
if (duplicate_decls (x, ext))
+ {
x = copy_node (ext);
+ /* invisible declaration must remain external in case current decl
+ is public static. Otherwise, we get duplicate definition. */
+ if (C_DECL_INVISIBLE (ext) && TREE_CODE (ext) == VAR_DECL)
+ DECL_EXTERNAL(ext) = old_decl_external;
+ }
+ /* APPLE LOCAL end peserve invisible flag for gap */
}
else
record_external_decl (x);
@@ -2233,6 +2282,15 @@ c_init_decl_processing (void)
make_fname_decl = c_make_fname_decl;
start_fname_decls ();
+ /* APPLE LOCAL begin new tree dump */
+#if 0
+ /* MERGE FIXME: 3468690 */
+ /* For condensed tree dumps with debugger. */
+ c_prev_lang_dump_tree_p = set_dump_tree_p (c_dump_tree_p);
+ SET_MAX_DMP_TREE_CODE(LAST_C_TREE_CODE);
+#endif
+ /* APPLE LOCAL end new tree dump */
+
first_builtin_decl = global_scope->names;
last_builtin_decl = global_scope->names_last;
}
@@ -2316,6 +2374,7 @@ builtin_function (const char *name, tree type, int function_code,
return decl;
}
+
/* Called when a declaration is seen that contains no names to declare.
If its type is a reference to a structure, union or enum inherited
@@ -2505,8 +2564,37 @@ start_decl (tree declarator, tree declspecs, int initialized, tree attributes)
/* An object declared as __attribute__((deprecated)) suppresses
warnings of uses of other deprecated items. */
+
+ /* APPLE LOCAL begin unavailable */
+ /* An object declared as __attribute__((unavailable)) suppresses
+ any reports of being declared with unavailable or deprecated
+ items. An object declared as __attribute__((deprecated))
+ suppresses warnings of uses of other deprecated items. */
+#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */
if (lookup_attribute ("deprecated", attributes))
deprecated_state = DEPRECATED_SUPPRESS;
+ else if (lookup_attribute ("unavailable", attributes))
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+#else /* a more efficient way doing what lookup_attribute would do */
+ tree a;
+
+ for (a = attributes; a; a = TREE_CHAIN (a))
+ {
+ tree name = TREE_PURPOSE (a);
+ if (TREE_CODE (name) == IDENTIFIER_NODE)
+ if (is_attribute_p ("deprecated", name))
+ {
+ deprecated_state = DEPRECATED_SUPPRESS;
+ break;
+ }
+ if (is_attribute_p ("unavailable", name))
+ {
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+ break;
+ }
+ }
+#endif
+ /* APPLE LOCAL end unavailable */
decl = grokdeclarator (declarator, declspecs,
NORMAL, initialized, NULL);
@@ -3343,13 +3431,26 @@ grokdeclarator (tree declarator, tree declspecs,
{
tree id = TREE_VALUE (spec);
- /* If the entire declaration is itself tagged as deprecated then
- suppress reports of deprecated items. */
+ /* APPLE LOCAL begin unavailable */
+ /* If the entire declaration is itself tagged as unavailable then
+ suppress reports of unavailable/deprecated items. If the
+ entire declaration is tagged as only deprecated we still
+ report unavailable uses. */
if (id && TREE_DEPRECATED (id))
{
- if (deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (id);
+ if (TREE_UNAVAILABLE (id))
+ {
+ if (deprecated_state != DEPRECATED_UNAVAILABLE_SUPPRESS)
+ warn_unavailable_use (id);
+ }
+ else
+ {
+ if (deprecated_state != DEPRECATED_SUPPRESS
+ && deprecated_state != DEPRECATED_UNAVAILABLE_SUPPRESS)
+ warn_deprecated_use (id);
+ }
}
+ /* APPLE LOCAL end unavailable */
if (id == ridpointers[(int) RID_INT])
explicit_int = 1;
@@ -3478,6 +3579,8 @@ grokdeclarator (tree declarator, tree declspecs,
{
specbits &= ~(1 << (int) RID_LONG);
type = long_double_type_node;
+ /* APPLE LOCAL -Wlong-double dpatel */
+ warn_about_long_double ();
}
/* Check all other uses of type modifiers. */
@@ -3662,6 +3765,8 @@ grokdeclarator (tree declarator, tree declspecs,
| 1 << (int) RID_STATIC
| 1 << (int) RID_EXTERN)) == (1 << (int) RID_THREAD))
nclasses++;
+ /* APPLE LOCAL private extern */
+ if (specbits & 1 << (int) RID_PRIVATE_EXTERN) nclasses++;
/* Warn about storage classes that are invalid for certain
kinds of declarations (parameters, typenames, etc.). */
@@ -4366,6 +4471,13 @@ grokdeclarator (tree declarator, tree declspecs,
if (defaulted_int)
C_FUNCTION_IMPLICIT_INT (decl) = 1;
+ /* APPLE LOCAL begin private extern */
+ DECL_VISIBILITY (decl)
+ = ((specbits & (1 << (int) RID_PRIVATE_EXTERN)) != 0)
+ ? VISIBILITY_HIDDEN
+ : VISIBILITY_DEFAULT;
+ /* APPLE LOCAL end private extern */
+
/* Record presence of `inline', if it is reasonable. */
if (MAIN_NAME_P (declarator))
{
@@ -4398,7 +4510,9 @@ grokdeclarator (tree declarator, tree declspecs,
{
/* It's a variable. */
/* An uninitialized decl with `extern' is a reference. */
- int extern_ref = !initialized && (specbits & (1 << (int) RID_EXTERN));
+ /* APPLE LOCAL private extern */
+ int extern_ref = !initialized && (specbits & ((1 << (int) RID_EXTERN)
+ | (1 << (int) RID_PRIVATE_EXTERN)));
/* Move type qualifiers down to element of an array. */
if (TREE_CODE (type) == ARRAY_TYPE && type_quals)
@@ -4437,6 +4551,12 @@ grokdeclarator (tree declarator, tree declspecs,
DECL_EXTERNAL (decl) = extern_ref;
+ /* APPLE LOCAL private extern */
+ DECL_VISIBILITY (decl)
+ = ((specbits & (1 << (int) RID_PRIVATE_EXTERN)) != 0)
+ ? VISIBILITY_HIDDEN
+ : VISIBILITY_DEFAULT;
+
/* At file scope, the presence of a `static' or `register' storage
class specifier, or the absence of all storage class specifiers
makes this declaration a definition (perhaps tentative). Also,
@@ -5434,7 +5554,9 @@ start_function (tree declspecs, tree declarator, tree attributes)
return 0;
}
- decl_attributes (&decl1, attributes, 0);
+ /* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+ decl_attributes (&decl1, attributes, (int)ATTR_FLAG_FUNCTION_DEF);
+ /* APPLE LOCAL end weak_import ilr */
if (DECL_DECLARED_INLINE_P (decl1)
&& DECL_UNINLINABLE (decl1)
@@ -6143,6 +6265,13 @@ finish_function (void)
&& current_function_returns_null)
warning ("this function may return with or without a value");
+ /* APPLE LOCAL begin loop transposition */
+ /* Perform loop tranformations before doing inlining, but do not
+ do it if syntax only is requested. */
+ if (!flag_syntax_only && flag_loop_transpose)
+ loop_transpose(fndecl);
+ /* APPLE LOCAL end loop transposition */
+
/* Store the end of the function, so that we get good line number
info for the epilogue. */
cfun->function_end_locus = input_location;
@@ -6544,7 +6673,37 @@ link_hash_eq (const void *x1_p, const void *x2_p)
/* Propagate information between definitions and uses between multiple
translation units in TU_LIST based on linkage rules. */
+/* APPLE LOCAL rewritten to support -fno-common, no unit-at-a-time.
+ The general idea is to identify the unique definition, and mark
+ all the other declarations that refer to the same object as duplicates.
+ varasm emits only non-duplicates. I think some of the problems are actually
+ connected with unit-at-a-time rather than no-common, now that you mention it.
+ The following used to fail and now work:
+
+file1:
+int i2 = 2; // optionally add 'extern'
+
+file 2:
+extern int i2; // optionally elide 'extern'
+
+cc file1.c file2.c
+FATAL: Symbol _i2 already defined.
+
+This is independent of -fno-common. The order of the files may be interchanged.
+(With -fno-common, the variant where you omit 'extern' in file 2 is of course an
+error, which was and still is detected correctly at compile time.)
+
+file 1:
+int i1;
+
+file 2:
+extern int i1;
+
+cc file1.c file2.c
+6: Ignoring attempt to redefine symbol.
+This used to fail with -fno-common, in either order.
+*/
void
merge_translation_unit_decls (void)
{
@@ -6567,23 +6726,43 @@ merge_translation_unit_decls (void)
link_hash_table = htab_create (1021, link_hash_hash, link_hash_eq, NULL);
- /* Enter any actual definitions into the hash table. */
+ /* Enter any actual definitions into the hash table.
+ For functions, ignore declarations. For variables, declarations
+ are kept in the table until a definition is found; duplicate
+ declarations are so marked, so that varasm will emit only one
+ of them. */
for (tu = tu_list; tu; tu = TREE_CHAIN (tu))
for (decl = BLOCK_VARS (DECL_INITIAL (tu)); decl; decl = TREE_CHAIN (decl))
- if (TREE_PUBLIC (decl) && ! DECL_EXTERNAL (decl))
+ if (TREE_PUBLIC (decl) &&
+ (TREE_CODE (decl) == VAR_DECL || !DECL_EXTERNAL (decl)))
{
PTR *slot;
+ tree old_decl;
+
+ /* Insert in table. Declarations go in. */
slot = htab_find_slot (link_hash_table, decl, INSERT);
+ old_decl = *slot;
- /* If we've already got a definition, work out which one is
- the real one, put it into the hash table, and make the
- other one DECL_EXTERNAL. This is important to avoid
- putting out two definitions of the same symbol in the
- assembly output. */
- if (*slot != NULL)
+ if (old_decl == NULL)
{
- tree old_decl = (tree) *slot;
-
+ /* New definition or declaration. */
+ *slot = decl;
+ }
+ else if (old_decl == decl)
+ /* This currently gets called once per file (seems like
+ potentially a big time sink, but doesn't show up as
+ such), so this can happen. */
+ ;
+ /* If this is a definition and we've already got a definition,
+ work out which one is the real one, put it into the hash
+ table, and make the other one DECL_EXTERNAL. This is
+ important to avoid putting out two definitions of the
+ same symbol in the assembly output. */
+ else if (!DECL_EXTERNAL (old_decl) && !DECL_EXTERNAL (decl))
+ {
+ /* Should be from different files. */
+ if (DECL_CONTEXT (old_decl) == DECL_CONTEXT (decl))
+ abort ();
/* If this is weak or common or whatever, suppress it
in favor of the other definition. */
if (DECL_WEAK (decl))
@@ -6601,6 +6780,7 @@ merge_translation_unit_decls (void)
DECL_COMMON (decl) = 0;
DECL_ONE_ONLY (decl) = 0;
DECL_WEAK (decl) = 0;
+ DECL_DUPLICATE_DECL (decl) = 1;
}
else if (DECL_EXTERNAL (old_decl))
{
@@ -6608,6 +6788,7 @@ merge_translation_unit_decls (void)
DECL_COMMON (old_decl) = 0;
DECL_ONE_ONLY (old_decl) = 0;
DECL_WEAK (old_decl) = 0;
+ DECL_DUPLICATE_DECL (old_decl) = 1;
*slot = decl;
}
else
@@ -6616,8 +6797,20 @@ merge_translation_unit_decls (void)
error ("%J'%D' previously defined here", old_decl, old_decl);
}
}
+ else if (DECL_EXTERNAL (old_decl))
+ {
+ /* Old entry is a declaration. Mark it duplicate and
+ replace with new decl (whether declaration or
+ definition). */
+ DECL_DUPLICATE_DECL (old_decl) = 1;
+ *slot = decl;
+ }
else
- *slot = decl;
+ {
+ /* Old entry is definition, new one declaration.
+ Mark the declaration as a dup. */
+ DECL_DUPLICATE_DECL (decl) = 1;
+ }
}
/* Now insert the desired information from all the definitions
@@ -6632,6 +6825,13 @@ merge_translation_unit_decls (void)
if (! global_decl)
continue;
+ /* APPLE LOCAL begin */
+ /* For global VARs, make sure DECL_RTL is set; it must be propagated
+ to all the copies, or aliasing won't work. */
+ if (TREE_CODE (global_decl) == VAR_DECL && !DECL_RTL_SET_P (global_decl))
+ make_decl_rtl (global_decl, 0);
+ /* APPLE LOCAL end */
+
/* Print any appropriate error messages, and partially merge
the decls. */
(void) duplicate_decls (decl, global_decl);
@@ -6639,6 +6839,7 @@ merge_translation_unit_decls (void)
htab_delete (link_hash_table);
}
+/* APPLE LOCAL end rewrite */
/* Perform final processing on file-scope data. */
@@ -6698,4 +6899,579 @@ c_reset_state (void)
pushdecl (copy_node (link));
}
+/* APPLE LOCAL begin loop transposition (currently unsafe) */
+/* This pass on trees is to transpose loops so that memory systems will
+ not be overtaxed.
+ So it changes:
+ for(i=0;i<size0;i++)
+ for(j=0;j<size1;j++)
+ a = a + pointer[j][i];
+ into
+ for(j=0;j<size1;j++)
+ for(i=0;i<size0;i++)
+ a = a + pointer[j][i];
+
+ and
+ for(i=0;i<size0;i++)
+ {
+ for(j=0;j<size1;j++)
+ {
+ a = a + pointer[j][i];
+ }
+ pointer[i][i] = b * pointer[i][i];
+ }
+ into
+ for(j=0;j<size1;j++)
+ {
+ for(i=0;i<size0;i++)
+ {
+ a = a + pointer[j][i];
+ }
+ }
+ for(j=0;j<size1;j++)
+ {
+ pointer[i][i] = b * pointer[i][i];
+ }
+
+ Note this is experimental because it does not always get it right,
+ but works on SPEC 2000 and the bootstrap of gcc.
+ Here is a case it miscompiles:
+
+ struct {
+ double unew[1782225];
+ } COMMON;
+
+ double swimneg_1()
+ {
+ double ucheck = 0;
+ int i, j;
+ for(i = 1; i <= 1334;i++) {
+ for(j = 1;j <= 1334;j++) {
+ ucheck += COMMON.unew[(i-1) + 1335*(j-1) ];
+ }
+ COMMON.unew[i + 1335*(i)] *= 2;
+ }
+ return ucheck;
+ }
+
+ The loops are incorrectly transposed because it does not know
+ that the modification of
+ COMMON.unew_[icheck_ + 1335*icheck_] (in the outer loop)
+ needs to be done right after the inner loop. */
+
+static tree
+find_tree_with_code_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data)
+{
+ if (*tp == NULL_TREE)
+ return NULL_TREE;
+ if (TREE_CODE (*tp) == *((enum tree_code *)data))
+ return *tp;
+ return NULL_TREE;
+}
+
+static tree find_tree_with_code (tree body, enum tree_code code)
+{
+ enum tree_code temp = code;
+ return walk_tree_without_duplicates (&body, find_tree_with_code_1, (void *)&temp);
+}
+
+static tree
+find_pointer (tree t)
+{
+ tree temp2 = find_tree_with_code (t, ARRAY_REF);
+ if (temp2)
+ return TREE_OPERAND (temp2, 0);
+ temp2 = find_tree_with_code (t, INDIRECT_REF);
+ if (temp2)
+ {
+ temp2 = TREE_OPERAND (temp2, 0);
+ if (TREE_CODE (temp2) == PLUS_EXPR)
+ {
+ temp2 = TREE_OPERAND (temp2, 0);
+ if (TREE_CODE (temp2) == PARM_DECL || TREE_CODE (temp2) == VAR_DECL)
+ return temp2;
+ return find_pointer (temp2);
+ }
+ }
+ return NULL_TREE;
+}
+
+typedef struct should_transpose_for_loops_t
+{
+ tree inner_var;
+ tree outer_var;
+ bool doit;
+ tree already_modified;
+} should_transpose_for_loops_t;
+
+/* If the transposition should be done, set data->doit to true and
+ return NULL. If it should not, set data->doit to false and
+ return *tp. */
+
+static tree
+should_transpose_for_loops_1 (tree *tp, int *walk_subtrees, void *data)
+{
+ tree assignment_to = *tp;
+ should_transpose_for_loops_t *temp = (should_transpose_for_loops_t*)data;
+ tree inner_var = temp->inner_var;
+ tree outer_var = temp->outer_var;
+ if (*tp == NULL_TREE)
+ return NULL_TREE;
+ /* We cannot do the transposition if any of these are in the loop. */
+ if (TREE_CODE (*tp) == LABEL_DECL || TREE_CODE (*tp) == GOTO_STMT
+ || TREE_CODE (*tp) == FOR_STMT || TREE_CODE (*tp) == DO_STMT
+ || TREE_CODE (*tp) == WHILE_STMT || TREE_CODE (*tp) == IF_STMT
+ || TREE_CODE (*tp) == BREAK_STMT || TREE_CODE (*tp) == CONTINUE_STMT
+ || TREE_CODE (*tp) == RETURN_EXPR)
+ {
+ temp->doit = false;
+ return *tp;
+ }
+ if (TREE_CODE (assignment_to) == MODIFY_EXPR)
+ {
+ tree temp1;
+ tree temp2 = find_pointer (TREE_OPERAND (assignment_to, 0));
+ /* We cannot do the transposition because the pointer temp2 is modified
+ with a value dependent on itself.
+ (Note this could be better if it is only dependent on a non-forward
+ loop dependent). */
+ if (temp2 != NULL_TREE
+ && tree_contains (TREE_OPERAND (assignment_to, 1), temp2))
+ {
+ temp->doit = false;
+ return *tp;
+ }
+ for (temp1 = temp->already_modified;
+ temp1 != NULL_TREE;
+ temp1 = TREE_CHAIN (temp1))
+ {
+ tree temp3 = TREE_VALUE(temp1);
+ tree temp4 = TREE_OPERAND (assignment_to, 1);
+ /* We cannot do the transposition because the pointer temp3 is
+ modified with a value dependent on itself or already has
+ been modified. */
+ if (tree_contains (temp4, temp3)
+ || (temp2 != NULL_TREE && temp3 == temp2))
+ {
+ temp->doit = false;
+ return *tp;
+ }
+ }
+ /* If it is non-null, add temp2 to the list of already modified
+ pointers. */
+ if(temp2 != NULL_TREE)
+ temp->already_modified =
+ tree_cons(NULL_TREE, temp2, temp->already_modified);
+ }
+ /* Check for pointer[inner][outer], pointer[inner*outersize+outer] and
+ array[inner][outer]. */
+ if ((TREE_CODE (assignment_to) == INDIRECT_REF
+ && TREE_CODE (TREE_OPERAND (assignment_to, 0)) == PLUS_EXPR)
+ || (TREE_CODE (assignment_to) == ARRAY_REF
+ && TREE_CODE (TREE_OPERAND (assignment_to, 1)) == PLUS_EXPR))
+ {
+ tree plus1_expr_assignment = TREE_OPERAND (assignment_to,
+ TREE_CODE (assignment_to) == ARRAY_REF ? 1 : 0);
+ tree side0 = TREE_OPERAND (plus1_expr_assignment, 0);
+ tree side1 = TREE_OPERAND (plus1_expr_assignment, 1);
+ STRIP_NOPS (side0);
+ STRIP_NOPS (side1);
+ /* This handles a[inner][outer]. */
+ if ((TREE_CODE (side0) == INDIRECT_REF
+ && tree_contains (side0, inner_var)
+ && !tree_contains (side0, outer_var)
+ && tree_contains (side1, outer_var)
+ && !tree_contains (side1, inner_var))
+ || (TREE_CODE (side1) == INDIRECT_REF
+ && tree_contains (side1, inner_var)
+ && !tree_contains (side1, outer_var)
+ && tree_contains (side0, outer_var)
+ && !tree_contains (side0, inner_var)))
+ {
+ *walk_subtrees = 0; /* already walked them */
+ temp->doit = true;
+ return NULL_TREE;
+ }
+ else
+ {
+ tree side = NULL_TREE;
+ /* Handle array[inner*size+outer+offset] and pointer[inner*size+outer]
+ (FIXME need to handle array[inner*size+outer]
+ (and pointer[inner*size+outer+offset]?) )*/
+ if (tree_contains (side0, inner_var)
+ && tree_contains (side0, outer_var))
+ side = side0;
+ else if (tree_contains (side1, inner_var)
+ && tree_contains (side1, outer_var))
+ side = side1;
+ if (side && (TREE_CODE (side) == MULT_EXPR))
+ {
+ tree temp0 = TREE_OPERAND (side, 0);
+ tree temp1 = TREE_OPERAND (side, 1);
+ STRIP_NOPS (temp0);
+ STRIP_NOPS (temp1);
+ if (tree_contains (temp0, inner_var)
+ && tree_contains (temp0, outer_var))
+ side = temp0;
+ else if (tree_contains (temp1, inner_var)
+ && tree_contains (temp1, outer_var))
+ side = temp1;
+ else
+ side = NULL_TREE;
+ }
+ if (side && (TREE_CODE (side) == PLUS_EXPR))
+ {
+ tree side10 = TREE_OPERAND (side, 0);
+ tree side11 = TREE_OPERAND (side, 1);
+ STRIP_NOPS (side10);
+ STRIP_NOPS (side11);
+ if ((TREE_CODE (side10) == MULT_EXPR
+ && tree_contains (side10, inner_var)
+ && !tree_contains (side10, outer_var)
+ && tree_contains (side11, outer_var)
+ && !tree_contains (side11, inner_var))
+ || (TREE_CODE (side11) == MULT_EXPR
+ && tree_contains (side11, inner_var)
+ && !tree_contains (side11, outer_var)
+ && tree_contains (side10, outer_var)
+ && !tree_contains (side10, inner_var)))
+ {
+ *walk_subtrees = 0; /* already walked them */
+ temp->doit = true;
+ return NULL;
+ }
+ else
+ {
+ temp->doit = false;
+ return *tp;
+ }
+ }
+ }
+ }
+ /* We cannot do the transposition if there is an assignment to the
+ outer_var or inner_var. */
+ if (TREE_CODE (assignment_to) == MODIFY_EXPR)
+ {
+ tree side1 = TREE_OPERAND (assignment_to, 1);
+ STRIP_NOPS (side1);
+ if (side1 == outer_var || side1 == inner_var)
+ {
+ temp->doit = false;
+ return *tp;
+ }
+ }
+ return NULL_TREE;
+}
+
+/* Return true if the loops should be interchanged based on body, inner
+ variable and outer variable, and also set already_modified to the pointers
+ that are modified during the loop. */
+
+static bool
+should_transpose_for_loops (tree body, tree inner_var, tree outer_var,
+ tree *already_modified)
+{
+ should_transpose_for_loops_t temp;
+ temp.inner_var = inner_var;
+ temp.outer_var = outer_var;
+ temp.already_modified = *already_modified;
+ temp.doit = false;
+ if (walk_tree (&body, should_transpose_for_loops_1, &temp, NULL))
+ return false;
+ *already_modified = temp.already_modified;
+ return temp.doit;
+}
+
+static tree
+tree_contains_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, void *data)
+{
+ if (*tp == data)
+ return data;
+ return NULL_TREE;
+}
+
+static bool
+tree_contains (tree body, tree x)
+{
+ return walk_tree_without_duplicates (&body, tree_contains_1, (void *)x)
+ != NULL_TREE;
+}
+
+/* Look for two nested loops and transpose them if this is a good idea.
+ Currently limited to FOR statements in C. */
+
+static tree
+perform_loop_transpose (tree *tp, int *walk_subtrees,
+ void *data ATTRIBUTE_UNUSED)
+{
+ tree already_modified = NULL_TREE;
+ if (*tp == NULL_TREE)
+ return NULL_TREE;
+ if (TREE_CODE (*tp) == FOR_STMT)
+ {
+ tree outer_loop = *tp;
+ tree inner_loop = TREE_OPERAND (outer_loop, 3);
+ tree before_inner_loop = NULL_TREE;
+ tree right_before_inner_loop = NULL_TREE;
+ /* If the loops contains a call or an if statement or is empty,
+ do not do the transposition. */
+ if (inner_loop == NULL_TREE
+ || find_tree_with_code (inner_loop, CALL_EXPR) != NULL_TREE
+ || find_tree_with_code (inner_loop, IF_STMT) != NULL_TREE)
+ return NULL_TREE;
+ /* A compound stmt after the outer for loop. */
+ if (TREE_CODE (inner_loop) == COMPOUND_STMT
+ && TREE_OPERAND (inner_loop, 0) != NULL_TREE
+ && TREE_CODE (TREE_OPERAND (inner_loop, 0)) == SCOPE_STMT)
+ {
+ tree previous = NULL_TREE;
+ before_inner_loop = TREE_OPERAND (inner_loop, 0);
+
+ /* If the outer loop contains variable definitions, do not
+ do the transposition. FIXME: if the only definition is
+ the inner loop variable we could do it. */
+ if (TREE_OPERAND (before_inner_loop, 0) != NULL_TREE)
+ return NULL_TREE;
+
+ /* Find the inner loop if there is any.
+ FIXME: will not work if the inner loop is another compound loop. */
+ for (inner_loop = before_inner_loop;
+ inner_loop != NULL_TREE && TREE_CODE (inner_loop) != FOR_STMT;
+ inner_loop = TREE_CHAIN (inner_loop))
+ previous = inner_loop;
+
+ /* If there is no inner loop do not do anything. */
+ if (inner_loop == NULL_TREE)
+ return NULL_TREE;
+
+ /* If the inner_loop is equal to the start of the compound
+ statement set the start to NULL. */
+ if (inner_loop == before_inner_loop)
+ before_inner_loop = NULL_TREE;
+
+ right_before_inner_loop = previous;
+ }
+ /* We found the inner loop. */
+ if (inner_loop != NULL_TREE && TREE_CODE (inner_loop) == FOR_STMT)
+ {
+ tree outer_init = TREE_OPERAND (outer_loop, 0);
+ tree inner_init = TREE_OPERAND (inner_loop, 0);
+ /* FIXME: does not handle C99/C++ style for init statements */
+ if (outer_init != NULL_TREE && inner_init != NULL_TREE
+ && TREE_CODE (outer_init) == EXPR_STMT
+ && TREE_CODE (inner_init) == EXPR_STMT)
+ {
+ tree outer_init_expr = TREE_OPERAND (outer_init, 0);
+ tree inner_init_expr = TREE_OPERAND (inner_init, 0);
+ if (outer_init_expr != NULL_TREE && inner_init_expr != NULL_TREE
+ && TREE_CODE (inner_init_expr) == MODIFY_EXPR
+ && TREE_CODE (outer_init_expr) == MODIFY_EXPR)
+ {
+ tree outer_var = TREE_OPERAND (outer_init_expr, 0);
+ tree inner_var = TREE_OPERAND (inner_init_expr, 0);
+ /* The inner_var should be independent of outer_var */
+ if (!tree_contains (TREE_OPERAND (inner_init_expr, 1),
+ outer_var)
+ && !tree_contains (TREE_OPERAND (inner_loop, 1),
+ outer_var)
+ && !tree_contains (TREE_OPERAND (inner_loop, 2),
+ outer_var)
+ /* The outer loop variable should be independent of
+ inner_var also. */
+ && !tree_contains (TREE_OPERAND (outer_loop, 1),
+ inner_var)
+ && !tree_contains (TREE_OPERAND (outer_loop, 2),
+ inner_var))
+ {
+ tree inner_loop_body = TREE_OPERAND (inner_loop, 3);
+ if (should_transpose_for_loops (inner_loop_body,
+ inner_var, outer_var, &already_modified))
+ {
+ tree newouter;
+ tree newinner;
+ /* Is the outter loop's body a compound statement? */
+ if (TREE_CODE (TREE_OPERAND (outer_loop, 3))
+ == COMPOUND_STMT)
+ {
+ tree after_loop = TREE_CHAIN (inner_loop);
+ tree find;
+ tree allloops_stmt;
+ tree outloopafter;
+ tree outloopbefore;
+ allloops_stmt = build_stmt (COMPOUND_STMT,
+ NULL_TREE);
+ outloopbefore = build_stmt (FOR_STMT, outer_init,
+ TREE_OPERAND (outer_loop, 1),
+ TREE_OPERAND (outer_loop, 2),
+ NULL_TREE);
+ /* Use copies of the loop test
+ expression (TREE_OPERAND #1) for
+ these, lest the tree-profiler mix the
+ execution counts of two different
+ loops. */
+ outloopafter = build_stmt (FOR_STMT, outer_init,
+ copy_node (TREE_OPERAND (outer_loop, 1)),
+ TREE_OPERAND (outer_loop, 2),
+ NULL_TREE);
+ newinner = build_stmt (FOR_STMT, outer_init,
+ copy_node (TREE_OPERAND (outer_loop, 1)),
+ TREE_OPERAND (outer_loop, 2),
+ inner_loop_body);
+ newouter = build_stmt (FOR_STMT, inner_init,
+ TREE_OPERAND (inner_loop, 1),
+ TREE_OPERAND (inner_loop, 2),
+ newinner);
+ /* This new compound statement has no scope. */
+ COMPOUND_STMT_NO_SCOPE (allloops_stmt) = 1;
+ /* Move to the next statement in the chain of
+ before_inner_loop if it is a scope statement */
+ if (before_inner_loop != NULL_TREE
+ && TREE_CODE (before_inner_loop)
+ == SCOPE_STMT)
+ {
+ if (right_before_inner_loop != NULL_TREE)
+ TREE_CHAIN (right_before_inner_loop)
+ = NULL_TREE;
+ before_inner_loop
+ = TREE_CHAIN (before_inner_loop);
+ }
+ /* Are there statements before the inner loop? */
+ if (before_inner_loop != NULL_TREE)
+ {
+ tree beforeloopbody
+ = build_stmt (COMPOUND_STMT, NULL_TREE);
+ COMPOUND_STMT_NO_SCOPE (beforeloopbody) = 1;
+ beforeloopbody
+ = build_stmt (COMPOUND_STMT, NULL_TREE);
+ COMPOUND_BODY (beforeloopbody)
+ = before_inner_loop;
+ FOR_BODY (outloopbefore) = beforeloopbody;
+ /* If the outer loop body depends on the inner
+ variable we can't do the transposition. */
+ if (tree_contains (outloopbefore, inner_var))
+ return NULL_TREE;
+
+ for (find = already_modified;
+ find != NULL_TREE;
+ find = TREE_CHAIN (find))
+ {
+ tree temp3 = TREE_VALUE(find);
+ if (tree_contains(outloopbefore, temp3))
+ /* We cannot do the transposition
+ because there is a reference to
+ something modified in the outer loop. */
+ return NULL_TREE;
+ }
+ /* If the new before loop body is independent
+ of the outer variable, remove the loop
+ and make the body the first statement in
+ the chain of all the statements. */
+ if (!tree_contains (beforeloopbody,
+ outer_var))
+ {
+ COMPOUND_BODY (allloops_stmt)
+ = beforeloopbody;
+ TREE_CHAIN (beforeloopbody) = newouter;
+ }
+ else
+ {
+ COMPOUND_BODY (allloops_stmt)
+ = outloopbefore;
+ TREE_CHAIN (outloopbefore) = newouter;
+ }
+ }
+ else
+ {
+ COMPOUND_BODY (allloops_stmt) = newouter;
+ outloopbefore = NULL_TREE;
+ }
+ if (after_loop != NULL_TREE
+ && TREE_CHAIN (after_loop) == NULL_TREE)
+ {
+ if (TREE_CODE (after_loop) != SCOPE_STMT)
+ FOR_BODY (outloopafter) = after_loop;
+ else
+ outloopafter = NULL_TREE;
+ }
+ else
+ {
+ tree afterloopbody
+ = build_stmt (COMPOUND_STMT, NULL_TREE);
+ tree temp5;
+ COMPOUND_STMT_NO_SCOPE (afterloopbody) = 1;
+ COMPOUND_BODY (afterloopbody) = after_loop;
+ FOR_BODY (outloopafter) = afterloopbody;
+ for (temp5 = after_loop;
+ temp5 != NULL_TREE;
+ temp5 = TREE_CHAIN (temp5))
+ if (TREE_CODE (TREE_CHAIN (temp5))
+ == SCOPE_STMT)
+ TREE_CHAIN (temp5) = NULL_TREE;
+ /* If the outer loop body depends on the inner
+ variable, we cannot do the transposition. */
+ if (tree_contains (afterloopbody, inner_var))
+ return NULL_TREE;
+ /* FIXME: need to check for the afterloopbody
+ containing a pointer that gets modified
+ before the inner loop has a chance to
+ read it. */
+ for (find = already_modified;
+ find != NULL_TREE;
+ find = TREE_CHAIN (find))
+ {
+ tree temp3 = TREE_VALUE(find);
+ /* If something references something that
+ is stored into we cannot do the
+ transposition. */
+ if (tree_contains(afterloopbody, temp3))
+ return NULL_TREE;
+ }
+ /* If the stuff after the inner_loop is not
+ dependent on the loop variable pull it
+ out of the loop. */
+ if (!tree_contains (afterloopbody, outer_var))
+ outloopafter = afterloopbody;
+ }
+ TREE_CHAIN (newouter) = outloopafter;
+ if (outloopafter == NULL_TREE
+ && outloopbefore == NULL_TREE)
+ allloops_stmt = newouter;
+ TREE_CHAIN (allloops_stmt)
+ = TREE_CHAIN (outer_loop);
+ *walk_subtrees = 0;
+ *tp = allloops_stmt;
+ return NULL_TREE;
+ }
+ /* Do the transposition. */
+ newinner = build_stmt (FOR_STMT, outer_init,
+ TREE_OPERAND (outer_loop, 1),
+ TREE_OPERAND (outer_loop, 2),
+ inner_loop_body);
+ newouter = build_stmt (FOR_STMT, inner_init,
+ TREE_OPERAND (inner_loop, 1),
+ TREE_OPERAND (inner_loop, 2),
+ newinner);
+ TREE_CHAIN (newouter) = TREE_CHAIN (outer_loop);
+ *tp = newouter;
+ *walk_subtrees = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ return NULL_TREE;
+}
+
+/* The main entry point for the transposition. */
+void
+loop_transpose (tree fn)
+{
+ /*timevar_push (TV_LOOP_TRANSPOSE);*/
+ walk_tree (&DECL_SAVED_TREE (fn), perform_loop_transpose, NULL, NULL);
+ /*timevar_pop (TV_LOOP_TRANSPOSE);*/
+}
+/* APPLE LOCAL end loop transposition */
+
#include "gt-c-decl.h"
diff --git a/gcc/c-dmp-tree.c b/gcc/c-dmp-tree.c
new file mode 100644
index 00000000000..ef1d1e8723b
--- /dev/null
+++ b/gcc/c-dmp-tree.c
@@ -0,0 +1,520 @@
+/* APPLE LOCAL new tree dump */
+/* Common condensed tree display routines specific for C.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include "config.h"
+
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "c-common.h"
+#include <string.h>
+#include <ctype.h>
+
+#define DMP_TREE
+#include "dmp-tree.h"
+
+int c_dump_tree_p (FILE *, const char *, tree, int);
+lang_dump_tree_p_t c_prev_lang_dump_tree_p = NULL;
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+static void print_ ## SYM (FILE *file, const char *annotation, tree node, int indent);
+#include "c-common.def"
+#undef DEFTREECODE
+
+/*-------------------------------------------------------------------*/
+
+/* If CP_DMP_TREE is defined then this file is being #include'ed from
+ cp/cp-dmp-tree.c. It needs to handle both C and C++ nodes. The C++
+ nodes are handled from cp/cp-dmp-tree.c and it use c-dmp-tree.c to
+ handle the C nodes. */
+
+#ifndef CP_DMP_TREE
+#include "c-tree.h"
+
+/* Called twice for dmp_tree() for an IDENTIFIER_NODE. The first call
+ is after the common info for the node is generated but before
+ displaying the identifier (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an indent_to() call or a recursive call to
+ dump_tree() for nodes which are language specific operands to a
+ IDENTIFIER_NODE. */
+
+void
+c_dump_identifier (file, node, indent, after_id)
+ FILE *file;
+ tree node;
+ int indent;
+ int after_id;
+{
+ if (!after_id)
+ {
+ if (C_IS_RESERVED_WORD (node))
+ {
+ tree rid = ridpointers[C_RID_CODE (node)];
+ fprintf (file, " rid=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE((void *)rid));
+ fprintf (file, "(%s)", IDENTIFIER_POINTER (rid));
+ }
+ if (IDENTIFIER_LABEL_VALUE (node))
+ {
+ fprintf (file, " lbl=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_LABEL_VALUE (node));
+ }
+ }
+ else
+ {
+ dump_tree (file, "(lbl)", IDENTIFIER_LABEL_VALUE (node), indent + INDENT);
+ }
+}
+
+/* Called twice for dmp_tree() for a ..._DECL node. The first call
+ after the common info for the node is generated but before
+ displaying the identifer (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an indent_to() call or a recursive call to
+ dump_tree() for nodes which are language specific operands to a
+ a ..._DECL node. */
+
+void
+c_dump_decl (file, node, indent, after_id)
+ FILE *file ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+ int after_id ATTRIBUTE_UNUSED;
+{
+}
+
+/* Called twice for dmp_tree() for a ..._TYPE node. The first call
+ after the common info for the node is generated but before
+ displaying the identifier (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an indent_to() call or a recursive call to
+ dump_tree() for nodes which are language specific operands to a
+ a ..._TYPE node. */
+
+void
+c_dump_type (file, node, indent, after_id)
+ FILE *file ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+ int after_id ATTRIBUTE_UNUSED;
+{
+}
+
+/* Normally a blank line is inserted before each statement node (a
+ statement node is determined by calling statement_code_p()). This
+ makes the display easier to read by keeping each statement grouped
+ like a paragraph. There may, however, be some kinds of statements
+ where a blank line isn't desired (e.g., a begin SCOPE_STMT in C).
+ Thus dump_lang_blank_line() is called to ask if a particular
+ statement should be preceded by a blank line dependent upon the
+ node that preceded it.
+
+ dump_lang_blank_line_p() is called for each statement passing the
+ previous node (not necessarily a statement) and current node (a
+ statement node by definition). It should return 1 if a blank
+ line is to be inserted and 0 otherwise. */
+
+int
+c_dump_blank_line_p (previous_node, current_node)
+ tree previous_node;
+ tree current_node;
+{
+ return (TREE_CODE (current_node) != SCOPE_STMT
+ && !(TREE_CODE (previous_node) == SCOPE_STMT
+ && SCOPE_BEGIN_P (previous_node)));
+}
+
+/* This is called for each node to display file and/or line number
+ information for those nodes that have such information. If it
+ is displayed the function should return 1. If not, 0.
+
+ The function generally does not have to handle ..._DECL nodes
+ unless there some special handling is reequired. They are
+ handled by print_lineno() (dump_lang_lineno_p()'s caller).
+ It is defined to not repeat the filename if it does not
+ change from what's in dump_tree_state.curr_file and then
+ it only displays the basename (using lbasename()). The
+ format of the display is " line=nbr(basename)" where the
+ leading space is included as usual in these displays and
+ the parenthesized basename omitted if not needed or is
+ the same as before. */
+
+int
+c_dump_lineno_p (file, node)
+ FILE *file ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+{
+ return 0;
+}
+
+/* Called only by tree-dump.c when doing a full compilation tree dump
+ under one of the -fdmp-xxxx options. This makes tree_dump.c, which
+ is common to all languages, independent of dmp_tree, which currently
+ only supports the c languages. */
+int
+c_dmp_tree3 (file, node, flags)
+ FILE *file;
+ tree node;
+ int flags;
+{
+ dmp_tree3 (file, node, flags);
+ return 1;
+}
+
+#endif /* !CP_DMP_TREE */
+
+/*-------------------------------------------------------------------*/
+
+static void
+print_SIZEOF_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ARROW_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ALIGNOF_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EXPR_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_COMPOUND_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, FALSE, NULL);
+
+ for (node = COMPOUND_BODY (node); node; node = TREE_CHAIN (node))
+ {
+ if (TREE_CODE (node) == SCOPE_STMT && SCOPE_END_P (node) && indent >= INDENT)
+ indent -= INDENT;
+
+ dump_tree (file, NULL, node, indent + INDENT);
+
+ if (TREE_CODE (node) == SCOPE_STMT && SCOPE_BEGIN_P (node))
+ indent += INDENT;
+ }
+}
+
+static void
+print_DECL_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ tree type;
+
+ fprintf (file, " %s=", tree_code_name[(int) TREE_CODE (DECL_STMT_DECL (node))]);
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (DECL_STMT_DECL (node)));
+
+ type = TREE_TYPE (DECL_STMT_DECL (node));
+ if (type && TREE_CODE_CLASS (TREE_CODE (type)) == 't')
+ {
+ if (TYPE_NAME (type))
+ {
+ if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+ fprintf (file, " {%s}", IDENTIFIER_POINTER (TYPE_NAME (type)));
+ else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (type)))
+ fprintf (file, " {%s}",
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
+ }
+ else
+ fprintf (file, " {%s}", tree_code_name[(int) TREE_CODE (type)]);
+ }
+
+ if (DECL_NAME ( DECL_STMT_DECL (node)))
+ fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME ( DECL_STMT_DECL (node))));
+
+ if (!node_seen (DECL_STMT_DECL (node), FALSE)
+ || TREE_CODE (DECL_STMT_DECL (node)) != VAR_DECL)
+ dump_tree (file, NULL, DECL_STMT_DECL (node), indent + INDENT);
+}
+
+static void
+print_IF_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(if)", "(then)", "(else)", NULL);
+}
+
+static void
+print_FOR_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ if (NEW_FOR_SCOPE_P (node))
+ fputs (" new-scope", file);
+
+ print_operands (file, node, indent, TRUE, "(init)", "(cond)",
+ "(expr)", "(body)", NULL);
+}
+
+static void
+print_WHILE_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(cond)", "(body)", NULL);
+}
+
+static void
+print_DO_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(cond)", "(body)", NULL);
+}
+
+static void
+print_RETURN_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BREAK_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CONTINUE_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_SWITCH_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(cond)", "(body)", NULL);
+}
+
+static void
+print_GOTO_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LABEL_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ASM_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ if (ASM_VOLATILE_P (node))
+ fputs (" volatile", file);
+
+ print_operands (file, node, indent, TRUE, "(cv-qual)", "(string)",
+ "(outputs)", "(inputs)", "(clobbers)", NULL);
+}
+
+static void
+print_SCOPE_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ if (SCOPE_BEGIN_P (node))
+ fputs (" BEGIN", file);
+ if (SCOPE_END_P (node))
+ fputs (" END", file);
+ if (SCOPE_NULLIFIED_P (node))
+ fputs (" no-vars", file);
+ if (SCOPE_NO_CLEANUPS_P (node))
+ fputs (" no-cleanups", file);
+ if (SCOPE_PARTIAL_P (node))
+ fputs (" partial", file);
+ fprintf (file, " block=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (SCOPE_STMT_BLOCK (node)));
+
+ if (SCOPE_BEGIN_P (node) || !node_seen (SCOPE_STMT_BLOCK (node), FALSE))
+ dump_tree (file, NULL, SCOPE_STMT_BLOCK (node), indent + INDENT);
+
+ (void)node_seen (node, TRUE);
+
+ for (node = TREE_CHAIN (node); node; node = TREE_CHAIN (node))
+ dump_tree (file, annotation, node, indent + INDENT);
+}
+
+static void
+print_FILE_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CASE_LABEL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(lo)", "(hi)", "(lbl)", NULL);
+}
+
+static void
+print_STMT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_COMPOUND_LITERAL_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CLEANUP_STMT (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(decl)", "(expr)", NULL);
+}
+
+/*-------------------------------------------------------------------*/
+
+/* Return 1 if tree node is a C++ specific tree node from cp-tree.def
+ or a tree node specific to whatever cp_prev_lang_dump_tree_p
+ calls. Otherwise return 0.
+*/
+
+int
+c_dump_tree_p (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ switch (TREE_CODE (node))
+ {
+# define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+ case SYM: print_ ## SYM (file, annotation, node, indent); break;
+# include "c-common.def"
+# undef DEFTREECODE
+ default:
+ return c_prev_lang_dump_tree_p (file, annotation, node, indent);
+ }
+
+ return 1;
+}
+
+
diff --git a/gcc/c-idebug.c b/gcc/c-idebug.c
new file mode 100644
index 00000000000..7b10fc29a0a
--- /dev/null
+++ b/gcc/c-idebug.c
@@ -0,0 +1,57 @@
+/* APPLE LOCAL file debugging */
+/* C-specific tree accessors defined as functions for use in a debugger.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* What we do here is to instantiate each macro as a function *BY
+ THE SAME NAME*. Depends on the macro not being expanded when
+ it is surrounded by parens.
+
+ Note that this file includes idebug.c so that only debugging
+ macros for c-tree.h are actually defined here. For C only
+ this file is included in the link while for C only idebug.c
+ is built and included in the link. */
+
+#include "idebug.c"
+
+#ifdef ENABLE_IDEBUG
+
+#include "c-tree.h"
+
+/* Macros from c-tree.h */
+
+fn_1( IDENTIFIER_GLOBAL_VALUE, tree, tree )
+fn_1( IDENTIFIER_LOCAL_VALUE, tree, tree )
+fn_1( IDENTIFIER_LABEL_VALUE, tree, tree )
+fn_1( IDENTIFIER_LIMBO_VALUE, tree, tree )
+fn_1( IDENTIFIER_IMPLICIT_DECL, tree, tree )
+fn_1( IDENTIFIER_ERROR_LOCUS, tree, tree )
+fn_1( C_TYPE_FIELDS_READONLY, int, tree )
+fn_1( C_TYPE_FIELDS_VOLATILE, int, tree )
+fn_1( C_TYPE_BEING_DEFINED, int, tree )
+fn_1( C_IS_RESERVED_WORD, int, tree )
+fn_1( C_TYPE_VARIABLE_SIZE, int, tree )
+fn_1( C_DECL_VARIABLE_SIZE, int, tree )
+fn_2( C_SET_EXP_ORIGINAL_CODE, int, tree, tree )
+fn_1( C_TYPEDEF_EXPLICITLY_SIGNED, int, tree )
+fn_1( C_DECL_ANTICIPATED, int, tree )
+fn_1( TYPE_ACTUAL_ARG_TYPES, tree, tree )
+
+#endif /* ENABLE_IDEBUG */
diff --git a/gcc/c-incpath.c b/gcc/c-incpath.c
index 7f6cbdf63f0..b1e04e72c0d 100644
--- a/gcc/c-incpath.c
+++ b/gcc/c-incpath.c
@@ -171,6 +171,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, int cxx_stdinc)
JOIN, unless it duplicates JOIN in which case the last path is
removed. Return the head of the resulting chain. Any of HEAD,
JOIN and SYSTEM can be NULL. */
+
static struct cpp_dir *
remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
struct cpp_dir *system, struct cpp_dir *join,
@@ -243,9 +244,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
We can't just merge the lists and then uniquify them because then
we may lose directories from the <> search path that should be
- there; consider -Ifoo -Ibar -I- -Ifoo -Iquux. It is however safe
- to treat -Ibar -Ifoo -I- -Ifoo -Iquux as if written -Ibar -I- -Ifoo
- -Iquux. */
+ there; consider -iquote foo -iquote bar -Ifoo -Iquux. It is
+ however safe to treat -iquote bar -iquote foo -Ifoo -Iquux as if
+ written -iquote bar -Ifoo -Iquux. */
+
static void
merge_include_chains (cpp_reader *pfile, int verbose)
{
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index ec3bde3f1fb..934511b97d3 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -46,6 +46,10 @@ enum c_language_kind c_language = clk_c;
#define LANG_HOOKS_INIT c_objc_common_init
#undef LANG_HOOKS_FINISH
#define LANG_HOOKS_FINISH c_common_finish
+/* APPLE LOCAL begin Objective-C++ */
+#undef LANG_HOOKS_FINISH_FILE
+#define LANG_HOOKS_FINISH_FILE c_objc_common_finish_file
+/* APPLE LOCAL end Objective-C++ */
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
#undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
@@ -143,6 +147,24 @@ enum c_language_kind c_language = clk_c;
#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
#define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
+/* APPLE LOCAL begin new tree dump */
+#if 0
+/* MERGE FIXME 3468690 */
+#undef LANG_HOOKS_DUMP_DECL
+#define LANG_HOOKS_DUMP_DECL c_dump_decl
+#undef LANG_HOOKS_DUMP_TYPE
+#define LANG_HOOKS_DUMP_TYPE c_dump_type
+#undef LANG_HOOKS_DUMP_IDENTIFIER
+#define LANG_HOOKS_DUMP_IDENTIFIER c_dump_identifier
+#undef LANG_HOOKS_DUMP_BLANK_LINE_P
+#define LANG_HOOKS_DUMP_BLANK_LINE_P c_dump_blank_line_p
+#undef LANG_HOOKS_DUMP_LINENO_P
+#define LANG_HOOKS_DUMP_LINENO_P c_dump_lineno_p
+#undef LANG_HOOKS_DMP_TREE3
+#define LANG_HOOKS_DMP_TREE3 c_dmp_tree3
+#endif
+/* APPLE LOCAL end new tree dump */
+
#undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 3986b2771bb..f2309353096 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -41,6 +41,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tm_p.h"
#include "splay-tree.h"
#include "debug.h"
+/* APPLE LOCAL begin AltiVec */
+#include "target.h"
+#include "cpphash.h"
+/* APPLE LOCAL end AltiVec */
/* We may keep statistics about how long which files took to compile. */
static int header_time, body_time;
@@ -106,6 +110,24 @@ init_c_lex (void)
cb->define = cb_define;
cb->undef = cb_undef;
}
+
+ /* APPLE LOCAL begin Symbol Separation */
+ /* Set up call back routines. These routines are used when separate symbol
+ repositories are used. */
+ if (write_symbols != NO_DEBUG)
+ {
+ cb->restore_write_symbols = cb_restore_write_symbols;
+ cb->clear_write_symbols = cb_clear_write_symbols;
+ cb->is_builtin_identifier = cb_is_builtin_identifier;
+ cb->start_symbol_repository = cb_start_symbol_repository;
+ cb->end_symbol_repository = cb_end_symbol_repository;
+ if (flag_grepository)
+ {
+ cpp_options *options = cpp_get_options (parse_in);
+ options->use_ss = 1;
+ }
+ }
+ /* APPLE LOCAL end Symbol Separation */
}
struct c_fileinfo *
@@ -177,7 +199,8 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED,
{
/* Convert escapes in the string. */
cpp_string cstr = { 0, 0 };
- if (cpp_interpret_string (pfile, str, 1, &cstr, false))
+ /* APPLE LOCAL pascal strings */
+ if (cpp_interpret_string (pfile, str, 1, &cstr, false, false))
{
ASM_OUTPUT_IDENT (asm_out_file, (const char *) cstr.text);
free ((void *)cstr.text);
@@ -298,19 +321,72 @@ cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location loc,
(const char *) NODE_NAME (node));
}
+/* APPLE LOCAL begin AltiVec */
+/* We need a small circular buffer for lookaheads (and lookbacks). */
+
+#define C_LEX_BUFCAPACITY 16
+#define C_LEX_OFFS_BOUND(OFFS) \
+ ((OFFS) >= 0 \
+ ? (OFFS) % C_LEX_BUFCAPACITY \
+ : (OFFS) + C_LEX_BUFCAPACITY)
+
+static int c_lex_buf_beg = 0, c_lex_buf_end = 0;
+static const cpp_token *c_lex_buf[C_LEX_BUFCAPACITY];
+
static inline const cpp_token *
-get_nonpadding_token (void)
+get_nonpadding_token (int from_buffer)
{
const cpp_token *tok;
+
timevar_push (TV_CPP);
- do
- tok = cpp_get_token (parse_in);
- while (tok->type == CPP_PADDING);
+ if (from_buffer && c_lex_buf_beg != c_lex_buf_end)
+ {
+ tok = c_lex_buf[c_lex_buf_beg++];
+ c_lex_buf_beg = C_LEX_OFFS_BOUND (c_lex_buf_beg);
+ }
+ else
+ {
+ do
+ tok = cpp_get_token (parse_in);
+ while (tok->type == CPP_PADDING);
+ c_lex_buf[c_lex_buf_end++] = tok;
+ c_lex_buf_end = C_LEX_OFFS_BOUND (c_lex_buf_end);
+ if (from_buffer)
+ c_lex_buf_beg = c_lex_buf_end;
+ }
timevar_pop (TV_CPP);
+ return tok;
+}
+
+const cpp_token *
+c_lex_peek (int offset)
+{
+ const cpp_token *tok;
+
+ if (offset >= 0)
+ {
+ while (C_LEX_OFFS_BOUND (c_lex_buf_end - c_lex_buf_beg) < offset + 1)
+ get_nonpadding_token (0);
+ tok = c_lex_buf[C_LEX_OFFS_BOUND (c_lex_buf_beg + offset)];
+ }
+ else
+ tok = c_lex_buf[C_LEX_OFFS_BOUND (c_lex_buf_end + offset)];
return tok;
}
+void
+c_lex_prepend (const cpp_token *tok_array, int size)
+{
+ while (size--)
+ {
+ --c_lex_buf_beg;
+ c_lex_buf_beg = C_LEX_OFFS_BOUND (c_lex_buf_beg);
+ c_lex_buf[c_lex_buf_beg] = &tok_array[size];
+ }
+}
+/* APPLE LOCAL end AltiVec */
+
int
c_lex_with_flags (tree *value, unsigned char *cpp_flags)
{
@@ -319,12 +395,24 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
static bool no_more_pch;
retry:
- tok = get_nonpadding_token ();
+ tok = get_nonpadding_token (1);
retry_after_at:
switch (tok->type)
{
case CPP_NAME:
+ /* APPLE LOCAL begin AltiVec */
+ /* Conditional macros are expanded whenever a call-back predicate
+ says they should be. */
+ if ((tok->val.node->flags & NODE_DISABLED)
+ && (*targetm.expand_macro_p) (tok))
+ {
+ c_lex_prepend (tok->val.node->value.macro->exp.tokens,
+ tok->val.node->value.macro->count);
+ goto retry;
+ }
+ /* APPLE LOCAL end AltiVec */
+
*value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node));
break;
@@ -356,7 +444,8 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
case CPP_ATSIGN:
/* An @ may give the next token special significance in Objective-C. */
atloc = input_location;
- tok = get_nonpadding_token ();
+ /* APPLE LOCAL AltiVec */
+ tok = get_nonpadding_token (1);
if (c_dialect_objc ())
{
tree val;
@@ -646,7 +735,8 @@ static enum cpp_ttype
lex_string (const cpp_token *tok, tree *valp, bool objc_string)
{
tree value;
- bool wide = false;
+ /* APPLE LOCAL pascal strings */
+ bool wide = false, pascal_p = false;
size_t count = 1;
struct obstack str_ob;
cpp_string istr;
@@ -658,12 +748,18 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
if (tok->type == CPP_WSTRING)
wide = true;
+ /* APPLE LOCAL begin pascal strings */
+ else if (CPP_OPTION (parse_in, pascal_strings)
+ && str.text[1] == '\\' && str.text[2] == 'p')
+ pascal_p = true;
+ /* APPLE LOCAL AltiVec */
- tok = get_nonpadding_token ();
+ tok = get_nonpadding_token (1);
if (c_dialect_objc () && tok->type == CPP_ATSIGN)
{
objc_string = true;
- tok = get_nonpadding_token ();
+ /* APPLE LOCAL AltiVec */
+ tok = get_nonpadding_token (1);
}
if (tok->type == CPP_STRING || tok->type == CPP_WSTRING)
{
@@ -677,11 +773,13 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
wide = true;
obstack_grow (&str_ob, &tok->val.str, sizeof (cpp_string));
- tok = get_nonpadding_token ();
+ /* APPLE LOCAL ALtiVec */
+ tok = get_nonpadding_token (1);
if (c_dialect_objc () && tok->type == CPP_ATSIGN)
{
objc_string = true;
- tok = get_nonpadding_token ();
+ /* APPLE LOCAL AltiVec */
+ tok = get_nonpadding_token (1);
}
}
while (tok->type == CPP_STRING || tok->type == CPP_WSTRING);
@@ -691,12 +789,18 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
/* We have read one more token than we want. */
_cpp_backup_tokens (parse_in, 1);
+ /* APPLE LOCAL begin pascal strings */
+ if (wide || objc_string)
+ pascal_p = false;
+ /* APPLE LOCAL end pascal strings */
+
if (count > 1 && !objc_string && warn_traditional && !in_system_header)
warning ("traditional C rejects string constant concatenation");
if ((c_lex_string_translate
? cpp_interpret_string : cpp_interpret_string_notranslate)
- (parse_in, strs, count, &istr, wide))
+ /* APPLE LOCAL pascal strings */
+ (parse_in, strs, count, &istr, wide, pascal_p))
{
value = build_string (istr.len, (char *)istr.text);
free ((void *)istr.text);
@@ -715,7 +819,11 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
value = build_string (1, "");
}
- TREE_TYPE (value) = wide ? wchar_array_type_node : char_array_type_node;
+ /* APPLE LOCAL begin pascal strings */
+ TREE_TYPE (value) = wide ? wchar_array_type_node
+ : pascal_p ? pascal_string_type_node
+ : char_array_type_node;
+ /* APPLE LOCAL end pascal strings */
*valp = fix_string_type (value);
if (strs != &str)
@@ -755,3 +863,17 @@ lex_charconst (const cpp_token *token)
TREE_TYPE (value) = type;
return value;
}
+
+/* APPLE LOCAL begin Symbol Separation */
+
+/* Write context information in .cinfo file.
+ Use PCH routines directly. But set and restore cinfo_state before using them. */
+void
+c_common_write_context (void)
+{
+ /* MERGE FIXME: This used to say 'lineno', not '0', but now we don't
+ have a 'lineno' variable (and it was probably always wrong). */
+ (*debug_hooks->end_symbol_repository) (0);
+ cpp_write_symbol_deps (parse_in);
+}
+/* APPLE LOCAL end Symbol Separation */
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index c2c1eeefdf5..562a60cdbfe 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -62,8 +62,9 @@ c_disregard_inline_limits (tree fn)
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL)
return 1;
+ /* APPLE LOCAL obey inline */
return (!flag_really_no_inline && DECL_DECLARED_INLINE_P (fn)
- && DECL_EXTERNAL (fn));
+ && (DECL_EXTERNAL (fn) || flag_obey_inline));
}
int
@@ -182,6 +183,13 @@ c_objc_common_init (void)
mesg_implicit_function_declaration = 0;
}
+/* APPLE LOCAL gdb only used symbols */
+#ifdef DBX_ONLY_USED_SYMBOLS
+ /* By default we want to use -gused for C and Objective-C. */
+ if (flag_debug_only_used_symbols == -1)
+ flag_debug_only_used_symbols = 1;
+#endif
+
return true;
}
@@ -232,6 +240,11 @@ finish_cdtor (tree body)
void
c_objc_common_finish_file (void)
{
+ /* APPLE LOCAL Symbol Separation */
+ /* Write context information. */
+ if (dbg_dir)
+ c_common_write_context ();
+
if (pch_file)
c_common_write_pch ();
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 4c0c1fc4423..604fd1fc833 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -58,6 +58,10 @@ static cpp_options *cpp_opts;
/* Input filename. */
static const char *this_input_filename;
+/* APPLE LOCAL begin read-from-stdin */
+static const char *stdin_filename;
+/* APPLE LOCAL end read-from-stdin */
+
/* Filename and stream for preprocessed output. */
static const char *out_fname;
static FILE *out_stream;
@@ -83,6 +87,10 @@ static const char *sysroot = TARGET_SYSTEM_ROOT;
/* Zero disables all standard directories for headers. */
static bool std_inc = true;
+/* APPLE LOCAL begin Symbol Separation */
+const char *dbg_dir;
+/* APPLE LOCAL end Symbol Separation */
+
/* Zero disables the C++-specific standard directories for headers. */
static bool std_cxx_inc = true;
@@ -162,6 +170,7 @@ c_common_missing_argument (const char *opt, size_t code)
case OPT_idirafter:
case OPT_isysroot:
case OPT_isystem:
+ case OPT_iquote:
error ("missing path after \"%s\"", opt);
break;
@@ -222,6 +231,13 @@ c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED)
before passing on command-line options to cpplib. */
cpp_opts->warn_dollars = 0;
+#ifdef WARN_FOUR_CHAR_CONSTANTS
+ /* APPLE LOCAL begin -Wfour-char-constants */
+ /* Warn about 4-char constants everywhere except on Macs. */
+ cpp_opts->warn_four_char_constants = WARN_FOUR_CHAR_CONSTANTS;
+ /* APPLE LOCAL end -Wfour-char-constants */
+#endif
+
flag_const_strings = c_dialect_cxx ();
flag_exceptions = c_dialect_cxx ();
warn_pointer_arith = c_dialect_cxx ();
@@ -262,9 +278,18 @@ c_common_handle_option (size_t scode, const char *arg, int value)
break;
case OPT__output_pch_:
+ /* APPLE LOCAL Symbol Separation */
+ cpp_opts->making_pch = value;
pch_file = arg;
break;
+ /* APPLE LOCAL begin Symbol Separation */
+ case OPT_fsave_repository_:
+ dbg_dir = arg;
+ cpp_opts->making_ss = value;
+ break;
+ /* APPLE LOCAL end Symbol Separation */
+
case OPT_A:
defer_opt (code, arg);
break;
@@ -303,6 +328,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
error ("-I- specified twice");
quote_chain_split = true;
split_quote_chain ();
+ inform ("obsolete option -I- used, please use -iquote instead");
}
break;
@@ -348,6 +374,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_no_line_commands = 1;
break;
+ /* APPLE LOCAL begin -Wno-#warnings */
+ case OPT_W_warnings:
+ cpp_opts->no_pound_warnings = !value;
+ break;
+ /* APPLE LOCAL end -Wno-#warnings */
+
case OPT_fworking_directory:
flag_working_directory = value;
break;
@@ -361,12 +393,17 @@ c_common_handle_option (size_t scode, const char *arg, int value)
break;
case OPT_Wall:
+ /* APPLE LOCAL -Wmost */
+ case OPT_Wmost:
set_Wunused (value);
set_Wformat (value);
set_Wimplicit (value);
warn_char_subscripts = value;
warn_missing_braces = value;
- warn_parentheses = value;
+ /* APPLE LOCAL begin -Wmost dpatel */
+ if (code != OPT_Wmost)
+ warn_parentheses = value;
+ /* APPLE LOCAL end -Wmost dpatel */
warn_return_type = value;
warn_sequence_point = value; /* Was C only. */
if (c_dialect_cxx ())
@@ -449,8 +486,22 @@ c_common_handle_option (size_t scode, const char *arg, int value)
break;
case OPT_Werror:
- cpp_opts->warnings_are_errors = value;
+ /* APPLE LOCAL begin -Werror 2002-21-01 dpatel */
+ if (getenv ("QA_DISABLE_WERROR"))
+ {
+ warning ("-Werror ignored because QA_DISABLE_WERROR is set.");
+ warning ("Warnings will not be treated as errors.");
+ }
+ else
+ cpp_opts->warnings_are_errors = value;
+ /* APPLE LOCAL end -Werror 2002-21-01 dpatel */
+ break;
+
+ /* APPLE LOCAL begin -Wextra-tokens */
+ case OPT_Wextra_tokens:
+ cpp_opts->warn_extra_tokens = value;
break;
+ /* APPLE LOCAL end -Wextra-tokens */
case OPT_Werror_implicit_function_declaration:
mesg_implicit_function_declaration = 2;
@@ -488,6 +539,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
warn_format_zero_length = value;
break;
+ /* APPLE LOCAL begin -Wfour-char-constants */
+ case OPT_Wfour_char_constants:
+ cpp_opts->warn_four_char_constants = value;
+ break;
+ /* APPLE LOCAL end -Wfour-char-constants */
+
case OPT_Winit_self:
warn_init_self = value;
break;
@@ -508,6 +565,18 @@ c_common_handle_option (size_t scode, const char *arg, int value)
/* Silently ignore for now. */
break;
+ /* APPLE LOCAL begin -Wlong-double */
+ case OPT_Wlong_double:
+ warn_long_double = value;
+ break;
+ /* APPLE LOCAL end -Wlong-double */
+
+ /* APPLE LOCAL begin Symbol Separation */
+ case OPT_Winvalid_sr:
+ cpp_opts->warn_invalid_sr = value;
+ break;
+ /* APPLE LOCAL end Symbol Separation */
+
case OPT_Winvalid_offsetof:
warn_invalid_offsetof = value;
break;
@@ -551,6 +620,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
warn_nested_externs = value;
break;
+ /* APPLE LOCAL begin -Wnewline-eof */
+ case OPT_Wnewline_eof:
+ cpp_opts->warn_newline_at_eof = value;
+ break;
+ /* APPLE LOCAL end -Wnewline-eof */
+
case OPT_Wnon_template_friend:
warn_nontemplate_friend = value;
break;
@@ -676,6 +751,11 @@ c_common_handle_option (size_t scode, const char *arg, int value)
set_std_cxx98 (true);
break;
+ /* APPLE LOCAL begin fat builds */
+ case OPT_arch:
+ break;
+ /* APPLE LOCAL end fat builds */
+
case OPT_d:
handle_OPT_d (arg);
break;
@@ -712,6 +792,14 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_access_control = value;
break;
+ /* APPLE LOCAL begin -fapple-kext */
+ case OPT_fapple_kext:
+ flag_apple_kext = value;
+ flag_indirect_virtual_calls = 1;
+ flag_terminated_vtables = 1;
+ break;
+ /* APPLE LOCAL end -fapple-kext */
+
case OPT_fasm:
flag_no_asm = !value;
break;
@@ -727,6 +815,13 @@ c_common_handle_option (size_t scode, const char *arg, int value)
disable_builtin_function (arg);
break;
+ /* BEGIN APPLE LOCAL disable_typechecking_for_spec_flag */
+ case OPT_fdisable_typechecking_for_spec:
+ disable_typechecking_for_spec_flag = value;
+ break;
+ /* END APPLE LOCAL disable_typechecking_for_spec_flag */
+
+
case OPT_fdollars_in_identifiers:
cpp_opts->dollars_in_ident = value;
break;
@@ -772,6 +867,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_signed_char = !value;
break;
+ /* APPLE LOCAL begin structor decloning */
+ case OPT_fclone_structors:
+ flag_clone_structors = value;
+ break;
+ /* APPLE LOCAL end structor decloning */
+
case OPT_fcheck_new:
flag_check_new = value;
break;
@@ -836,6 +937,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_implicit_templates = value;
break;
+ /* APPLE LOCAL begin -findirect-virtual-calls */
+ case OPT_findirect_virtual_calls:
+ flag_indirect_virtual_calls = value;
+ break;
+ /* APPLE LOCAL end -findirect-virtual-calls */
+
case OPT_fms_extensions:
flag_ms_extensions = value;
break;
@@ -868,12 +975,21 @@ c_common_handle_option (size_t scode, const char *arg, int value)
cpp_opts->restore_pch_deps = value;
break;
+ /* APPLE LOCAL BEGIN pch distcc mrs */
+ case OPT_fpch_preprocess:
+ flag_pch_preprocess = value;
+ cpp_opts->pch_preprocess = value;
+ break;
+ /* APPLE LOCAL END pch distcc mrs */
+
case OPT_fpermissive:
flag_permissive = value;
break;
case OPT_fpreprocessed:
cpp_opts->preprocessed = value;
+ /* APPLE LOCAL private extern Radar 2872481 ilr */
+ flag_preprocessed = value;
break;
case OPT_freplace_objc_classes:
@@ -908,6 +1024,12 @@ c_common_handle_option (size_t scode, const char *arg, int value)
cpp_opts->narrow_charset = arg;
break;
+ /* APPLE LOCAL begin -fterminated-vtables */
+ case OPT_fterminated_vtables:
+ flag_terminated_vtables = value;
+ break;
+ /* APPLE LOCAL end -fterminated-vtables */
+
case OPT_fwide_exec_charset_:
cpp_opts->wide_charset = arg;
break;
@@ -936,6 +1058,18 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_gen_declaration = 1;
break;
+ /* APPLE LOCAL begin -header-mapfile */
+ case OPT_header_mapfile:
+ if (cpp_opts->header_map != NULL)
+ error ("more than one `-header-mapfile' option specified; "
+ "only one is allowed");
+#if 0
+ else
+ cpp_opts->header_map = hmap_load_header_map (arg);
+#endif
+ break;
+ /* APPLE LOCAL end -header-mapfile */
+
case OPT_idirafter:
add_path (xstrdup (arg), AFTER, 0);
break;
@@ -949,6 +1083,10 @@ c_common_handle_option (size_t scode, const char *arg, int value)
iprefix = arg;
break;
+ case OPT_iquote:
+ add_path (xstrdup (arg), QUOTE, 0);
+ break;
+
case OPT_isysroot:
sysroot = arg;
break;
@@ -1000,6 +1138,11 @@ c_common_handle_option (size_t scode, const char *arg, int value)
cpp_opts->warn_endif_labels = 1;
break;
+ /* APPLE LOCAL begin -precomp-trustfile */
+ case OPT_precomp_trustfile:
+ break;
+ /* APPLE LOCAL end -precomp-trustfile */
+
case OPT_print_objc_runtime_info:
print_struct_values = 1;
break;
@@ -1054,6 +1197,13 @@ c_common_handle_option (size_t scode, const char *arg, int value)
case OPT_v:
verbose = true;
break;
+
+ /* APPLE LOCAL begin -fast, -fastf, -fastcp option */
+ case OPT_fast:
+ case OPT_fastcp:
+ case OPT_fastf:
+ break;
+ /* APPLE LOCAL end -fast, -fastf, -fastcp option */
}
return result;
@@ -1070,6 +1220,10 @@ c_common_post_options (const char **pfilename)
{
in_fnames = xmalloc (sizeof (in_fnames[0]));
in_fnames[0] = "";
+ /* APPLE LOCAL begin read-from-stdin */
+ if (stdin_filename != NULL)
+ set_stdin_option(parse_in, stdin_filename);
+ /* APPLE LOCAL end read-from-stdin */
}
else if (strcmp (in_fnames[0], "-") == 0)
in_fnames[0] = "";
@@ -1193,6 +1347,18 @@ c_common_init (void)
if (flag_preprocess_only)
{
+ /* APPLE LOCAL BEGIN pch distcc mrs */
+ if (flag_pch_preprocess)
+ {
+ struct cpp_callbacks *cb;
+ cb = cpp_get_callbacks (parse_in);
+
+ /* In this case, we want the pch file to be read in. */
+ cb->valid_pch = c_common_valid_pch;
+ cb->read_pch = c_common_read_pch;
+ }
+ /* APPLE LOCAL END pch distcc mrs */
+
finish_options ();
preprocess_file (parse_in);
return false;
@@ -1235,13 +1401,29 @@ c_common_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
}
finish_options ();
if (file_index == 0)
- pch_init();
+ /* APPLE LOCAL begin Symbol Separation */
+ {
+ pch_init();
+
+ /* Initialize Symbol Sepration. Create .cinfo file and save
+ current cpp state. */
+ dbg_dir = cpp_symbol_separation_init (parse_in, dbg_dir,
+ input_filename);
+ if (dbg_dir)
+ (*debug_hooks->start_symbol_repository)
+ /* MERGE FIXME: This used to have 'lineno' rather than '0',
+ but that variable no longer exists and was almost certainly
+ wrong to use in the first place. */
+ (0, input_filename, cpp_get_stabs_checksum ());
+ }
+ /* APPLE LOCAL end Symbol Separation */
c_parse_file ();
file_index++;
} while (file_index < num_in_fnames);
- finish_file ();
+ /* APPLE LOCAL Objective-C++ */
+ (*lang_hooks.finish_file) ();
}
/* Common finish hook for the C, ObjC and C++ front ends. */
@@ -1514,7 +1696,11 @@ cb_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
static void
set_std_c89 (int c94, int iso)
{
- cpp_set_lang (parse_in, c94 ? CLK_STDC94: iso ? CLK_STDC89: CLK_GNUC89);
+ /* APPLE LOCAL begin 3191171 */
+ /* Do not override CLK_ASM if set */
+ if (cpp_opts->lang != CLK_ASM)
+ /* APPLE LOCAL end 3191171 */
+ cpp_set_lang (parse_in, c94 ? CLK_STDC94: iso ? CLK_STDC89: CLK_GNUC89);
flag_iso = iso;
flag_no_asm = iso;
flag_no_gnu_keywords = iso;
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index b8637e6b1d3..d6a44c75ded 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -50,6 +50,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "output.h"
#include "toplev.h"
#include "ggc.h"
+/* APPLE LOCAL Objective-C++ */
+#include "langhooks.h"
@@ifobjc
#include "objc-act.h"
@@ -3339,6 +3341,8 @@ static const struct resword reswords[] =
{ "__inline", RID_INLINE, 0 },
{ "__inline__", RID_INLINE, 0 },
{ "__label__", RID_LABEL, 0 },
+ /* APPLE LOCAL private extern */
+ { "__private_extern__", RID_PRIVATE_EXTERN, 0 },
{ "__ptrbase", RID_PTRBASE, 0 },
{ "__ptrbase__", RID_PTRBASE, 0 },
{ "__ptrextent", RID_PTREXTENT, 0 },
@@ -3426,9 +3430,11 @@ static const struct resword reswords[] =
};
#define N_reswords (sizeof reswords / sizeof (struct resword))
+/* APPLE LOCAL keep tables in sync comment */
/* Table mapping from RID_* constants to yacc token numbers.
Unfortunately we have to have entries for all the keywords in all
- three languages. */
+ three languages (AND THEY MUST BE KEPT IN PARALLEL - see also
+ cp/lex.c). */
static const short rid_to_yy[RID_MAX] =
{
/* RID_STATIC */ STATIC,
@@ -3448,6 +3454,8 @@ static const short rid_to_yy[RID_MAX] =
/* C extensions */
/* RID_COMPLEX */ TYPESPEC,
/* RID_THREAD */ SCSPEC,
+ /* APPLE LOCAL private extern */
+ /* RID_PRIVATE_EXTERN */ SCSPEC,
/* C++ */
/* RID_FRIEND */ 0,
@@ -3569,7 +3577,7 @@ init_reswords (void)
if (!c_dialect_objc ())
mask |= D_OBJC;
-
+
ridpointers = ggc_calloc ((int) RID_MAX, sizeof (tree));
for (i = 0; i < N_reswords; i++)
{
diff --git a/gcc/c-pch.c b/gcc/c-pch.c
index 157061f9177..c586f49674a 100644
--- a/gcc/c-pch.c
+++ b/gcc/c-pch.c
@@ -35,6 +35,11 @@ Boston, MA 02111-1307, USA. */
#include "hosthooks.h"
#include "target.h"
+/* APPLE LOCAL BEGIN pch distcc mrs */
+#include "flags.h"
+#include "cpphash.h"
+/* APPLE LOCAL END pch distcc mrs */
+
/* This structure is read very early when validating the PCH, and
might be read for a PCH which is for a completely different compiler
for a different operating system. Thus, it should really only contain
@@ -355,6 +360,25 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
unsigned long written;
struct save_macro_data *smd;
+ /* APPLE LOCAL BEGIN pch distcc mrs */
+#if 0
+ /* MERGE FIXME: There is no 'print', and no 'outf'. */
+ if (flag_pch_preprocess
+ && flag_preprocess_only)
+ {
+ fprintf (pfile->print.outf, "#include_pch \"%s\"\n", name);
+ pfile->print.line++;
+ pfile->print.printed = 0;
+ }
+
+ if (! flag_preprocess_only)
+ /* Before we wrote the file, we started a source file, so we have to start
+ one here to match. */
+ /* MERGE FIXME: And there's no 'lineno'. */
+ (*debug_hooks->start_source_file) (lineno, orig_name);
+ /* APPLE LOCAL END pch distcc mrs */
+#endif
+
f = fdopen (fd, "rb");
if (f == NULL)
{
@@ -376,9 +400,13 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
long size = h.asm_size - written;
if (size > 16384)
size = 16384;
- if (fread (buf, size, 1, f) != 1
- || fwrite (buf, size, 1, asm_out_file) != 1)
- cpp_errno (pfile, CPP_DL_ERROR, "reading");
+ /* APPLE LOCAL BEGIN pch distcc mrs */
+ if (fread (buf, size, 1, f) != 1)
+ cpp_errno (pfile, CPP_DL_ERROR, "reading");
+ else if (!flag_preprocess_only
+ && fwrite (buf, size, 1, asm_out_file) != 1)
+ cpp_errno (pfile, CPP_DL_ERROR, "writing");
+ /* APPLE LOCAL END pch distcc mrs */
written += size;
}
free (buf);
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index aa85deea6f3..46956395077 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -48,6 +48,9 @@ typedef struct align_stack GTY(())
static GTY(()) struct align_stack * alignment_stack;
+/* APPLE LOCAL Macintosh alignment */
+/* Cut out all of this so the compiler doesn't complain. */
+#if 0
#ifdef HANDLE_PRAGMA_PACK
static void handle_pragma_pack (cpp_reader *);
@@ -253,6 +256,8 @@ handle_pragma_pack (cpp_reader *dummy ATTRIBUTE_UNUSED)
}
}
#endif /* HANDLE_PRAGMA_PACK */
+/* APPLE LOCAL Macintosh alignment */
+#endif /* 0 */
static GTY(()) tree pending_weaks;
@@ -491,9 +496,16 @@ c_register_pragma (const char *space, const char *name,
void
init_pragma (void)
{
+/* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */
+#if 0
+/* We disable the handling of pragma pack here because it is handled
+ in config/darwin-c.c. */
+/* APPLE LOCAL end Macintosh alignment 2002-1-22 ff */
#ifdef HANDLE_PRAGMA_PACK
c_register_pragma (0, "pack", handle_pragma_pack);
#endif
+/* APPLE LOCAL Macintosh alignment 2002-1-22 ff */
+#endif /* 0 */
#ifdef HANDLE_PRAGMA_WEAK
c_register_pragma (0, "weak", handle_pragma_weak);
#endif
@@ -507,6 +519,12 @@ init_pragma (void)
c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
#endif
+ /* APPLE LOCAL begin OS pragma hook */
+ /* Allow registration of OS-specific but arch-independent pragmas. */
+#ifdef REGISTER_OS_PRAGMAS
+ REGISTER_OS_PRAGMAS (parse_in);
+#endif
+ /* APPLE LOCAL end OS pragma hook */
#ifdef REGISTER_TARGET_PRAGMAS
REGISTER_TARGET_PRAGMAS ();
#endif
diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h
index 397b02d6840..7f1265f2725 100644
--- a/gcc/c-pragma.h
+++ b/gcc/c-pragma.h
@@ -55,6 +55,10 @@ extern tree maybe_apply_renaming_pragma (tree, tree);
extern void add_to_renaming_pragma_list (tree, tree);
extern int c_lex (tree *);
+/* APPLE LOCAL begin AltiVec */
+extern const struct cpp_token *c_lex_peek (int);
+extern void c_lex_prepend (const struct cpp_token *, int);
+/* APPLE LOCAL end AltiVec */
extern int c_lex_with_flags (tree *, unsigned char *);
/* If true, then lex strings into the execution character set.
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 5eda48e7513..c67620eb2b8 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -40,6 +40,9 @@ struct lang_identifier GTY(())
tree symbol_value;
tree tag_value;
tree label_value;
+ /* APPLE LOCAL objc speedup dpatel */
+ /* For Objective-C Only */
+ tree interface_value;
};
/* The resulting tree type. */
@@ -246,6 +249,8 @@ extern void merge_translation_unit_decls (void);
extern int c_disregard_inline_limits (tree);
extern int c_cannot_inline_tree_fn (tree *);
extern bool c_objc_common_init (void);
+/* APPLE LOCAL Objective-C++ */
+extern void finish_file (void);
extern bool c_missing_noreturn_ok_p (tree);
extern tree c_objc_common_truthvalue_conversion (tree expr);
extern void c_objc_common_finish_file (void);
@@ -259,6 +264,16 @@ extern bool c_warn_unused_global_decl (tree);
#define c_sizeof_nowarn(T) c_sizeof_or_alignof_type (T, SIZEOF_EXPR, 0)
+/* APPLE LOCAL begin new tree dump */
+/* in c-dmp-tree.c */
+extern void c_dump_identifier PARAMS ((FILE *, tree, int, int));
+extern void c_dump_decl PARAMS ((FILE *, tree, int, int));
+extern void c_dump_type PARAMS ((FILE *, tree, int, int));
+extern int c_dump_blank_line_p PARAMS ((tree, tree));
+extern int c_dump_lineno_p PARAMS ((FILE *, tree));
+extern int c_dmp_tree3 PARAMS ((FILE *, tree, int));
+/* APPLE LOCAL end new tree dump */
+
/* in c-typeck.c */
/* For use with comptypes. */
@@ -266,6 +281,10 @@ enum {
COMPARE_STRICT = 0
};
+/* APPLE LOCAL begin IMA aggregate types */
+extern int same_translation_unit_p (tree, tree);
+extern int tagged_types_tu_compatible_p (tree, tree, int);
+/* APPLE LOCAL end IMA aggregate types */
extern tree require_complete_type (tree);
extern int comptypes (tree, tree, int);
extern tree c_size_in_bytes (tree);
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 7dd495b7e59..d84fde9b2b9 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -51,8 +51,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static int missing_braces_mentioned;
static tree qualify_type (tree, tree);
-static int same_translation_unit_p (tree, tree);
-static int tagged_types_tu_compatible_p (tree, tree, int);
static int comp_target_types (tree, tree, int);
static int function_types_compatible_p (tree, tree, int);
static int type_lists_compatible_p (tree, tree, int);
@@ -576,9 +574,14 @@ comptypes (tree type1, tree type2, int flags)
break;
case VECTOR_TYPE:
- /* The target might allow certain vector types to be compatible. */
- val = (*targetm.vector_opaque_p) (t1)
- || (*targetm.vector_opaque_p) (t2);
+ /* This is a comparison of types. If both of them are opaque,
+ the types are identical as long as their size is equal; else
+ check if the underlying types are identical as well. */
+ val = TYPE_VECTOR_SUBPARTS (t1) == TYPE_VECTOR_SUBPARTS (t2)
+ && (targetm.vector_opaque_p (t1)
+ ? targetm.vector_opaque_p (t2)
+ : !targetm.vector_opaque_p (t2)
+ && comptypes (TREE_TYPE (t1), TREE_TYPE (t2), 0));
break;
default:
@@ -617,7 +620,7 @@ comp_target_types (tree ttl, tree ttr, int reflexive)
If the CONTEXT chain ends in a null, that type's context is still
being parsed, so if two types have context chains ending in null,
they're in the same translation unit. */
-static int
+int
same_translation_unit_p (tree t1, tree t2)
{
while (t1 && TREE_CODE (t1) != TRANSLATION_UNIT_DECL)
@@ -632,7 +635,7 @@ same_translation_unit_p (tree t1, tree t2)
while (t2 && TREE_CODE (t2) != TRANSLATION_UNIT_DECL)
switch (TREE_CODE_CLASS (TREE_CODE (t2)))
{
- case 'd': t2 = DECL_CONTEXT (t1); break;
+ case 'd': t2 = DECL_CONTEXT (t2); break;
case 't': t2 = TYPE_CONTEXT (t2); break;
case 'b': t2 = BLOCK_SUPERCONTEXT (t2); break;
default: abort ();
@@ -650,6 +653,10 @@ struct tagged_tu_seen {
const struct tagged_tu_seen * next;
tree t1;
tree t2;
+/* APPLE LOCAL begin IMA speed up */
+ int isEnum;
+ int enumMatched;
+/* APPLE LOCAL end IMA speed up */
};
/* Can they be compatible with each other? We choose to break the
@@ -663,7 +670,7 @@ static const struct tagged_tu_seen * tagged_tu_seen_base;
units are being compiled. See C99 6.2.7 paragraph 1 for the exact
rules. */
-static int
+int
tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
{
tree s1, s2;
@@ -698,45 +705,73 @@ tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
const struct tagged_tu_seen * tts_i;
for (tts_i = tagged_tu_seen_base; tts_i != NULL; tts_i = tts_i->next)
if (tts_i->t1 == t1 && tts_i->t2 == t2)
- return 1;
+/* APPLE LOCAL begin IMA speed up */
+ return tts_i->isEnum ? tts_i->enumMatched : 1;
+/* APPLE LOCAL end IMA speed up */
}
switch (TREE_CODE (t1))
{
case ENUMERAL_TYPE:
{
-
- /* Speed up the case where the type values are in the same order. */
- tree tv1 = TYPE_VALUES (t1);
- tree tv2 = TYPE_VALUES (t2);
-
- if (tv1 == tv2)
- return 1;
-
+ struct tagged_tu_seen *tts;
+/* APPLE LOCAL begin IMA speed up */
+ int res;
+ bool done;
+ /* Speed up the case where the type values are in the same order. */
+ tree tv1 = TYPE_VALUES (t1);
+ tree tv2 = TYPE_VALUES (t2);
+ if (tv1 == tv2)
+ return 1;
+
+ res = 0;
+ done = false;
for (;tv1 && tv2; tv1 = TREE_CHAIN (tv1), tv2 = TREE_CHAIN (tv2))
{
if (TREE_PURPOSE (tv1) != TREE_PURPOSE (tv2))
break;
if (simple_cst_equal (TREE_VALUE (tv1), TREE_VALUE (tv2)) != 1)
- return 0;
+ {
+ res = 0;
+ done = true;
+ break;
+ }
}
-
- if (tv1 == NULL_TREE && tv2 == NULL_TREE)
- return 1;
- if (tv1 == NULL_TREE || tv2 == NULL_TREE)
- return 0;
-
- if (list_length (TYPE_VALUES (t1)) != list_length (TYPE_VALUES (t2)))
- return 0;
-
- for (s1 = TYPE_VALUES (t1); s1; s1 = TREE_CHAIN (s1))
+
+ if (!done)
+ {
+ if (tv1 == NULL_TREE && tv2 == NULL_TREE)
+ res = 1, done = true;
+ else if (tv1 == NULL_TREE || tv2 == NULL_TREE)
+ res = 0, done = true;
+ }
+
+ if (!done && list_length (TYPE_VALUES (t1)) == list_length (TYPE_VALUES (t2)))
+ {
+ res = 1;
+ for (s1 = TYPE_VALUES (t1); s1; s1 = TREE_CHAIN (s1))
{
s2 = purpose_member (TREE_PURPOSE (s1), TYPE_VALUES (t2));
if (s2 == NULL
|| simple_cst_equal (TREE_VALUE (s1), TREE_VALUE (s2)) != 1)
- return 0;
+ {
+ res = 0;
+ break;
+ }
}
- return 1;
+ }
+ if (tagged_tu_seen_base)
+ {
+ tts = xmalloc(sizeof (struct tagged_tu_seen));
+ tts->next = tagged_tu_seen_base;
+ tts->t1 = t1;
+ tts->t2 = t2;
+ tts->isEnum = 1;
+ tts->enumMatched = res;
+ tagged_tu_seen_base = tts;
+ }
+ return res;
+/* APPLE LOCAL end IMA speed up */
}
case UNION_TYPE:
@@ -748,10 +783,14 @@ tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
{
bool ok = false;
struct tagged_tu_seen tts;
+ const struct tagged_tu_seen * tts_i;
tts.next = tagged_tu_seen_base;
tts.t1 = t1;
tts.t2 = t2;
+/* APPLE LOCAL begin IMA speed up */
+ tts.isEnum = 0;
+/* APPLE LOCAL end IMA speed up */
tagged_tu_seen_base = &tts;
if (DECL_NAME (s1) != NULL)
@@ -773,6 +812,15 @@ tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
ok = true;
break;
}
+ tts_i = tagged_tu_seen_base;
+/* APPLE LOCAL begin IMA speed up */
+ while (tts_i->isEnum)
+ {
+ const struct tagged_tu_seen* p = tts_i->next;
+ free((struct tagged_tu_seen*)tts_i);
+ tts_i = p;
+ }
+/* APPLE LOCAL end IMA speed up */
tagged_tu_seen_base = tts.next;
if (! ok)
return 0;
@@ -783,12 +831,16 @@ tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
case RECORD_TYPE:
{
struct tagged_tu_seen tts;
+ const struct tagged_tu_seen * tts_i;
tts.next = tagged_tu_seen_base;
tts.t1 = t1;
tts.t2 = t2;
+/* APPLE LOCAL begin IMA speed up */
+ tts.isEnum = 0;
+/* APPLE LOCAL end IMA speed up */
tagged_tu_seen_base = &tts;
-
+
for (s1 = TYPE_FIELDS (t1), s2 = TYPE_FIELDS (t2);
s1 && s2;
s1 = TREE_CHAIN (s1), s2 = TREE_CHAIN (s2))
@@ -798,6 +850,7 @@ tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
|| DECL_NAME (s1) != DECL_NAME (s2))
break;
result = comptypes (TREE_TYPE (s1), TREE_TYPE (s2), flags);
+
if (result == 0)
break;
if (result == 2)
@@ -808,6 +861,16 @@ tagged_types_tu_compatible_p (tree t1, tree t2, int flags)
DECL_FIELD_BIT_OFFSET (s2)) != 1)
break;
}
+
+ tts_i = tagged_tu_seen_base;
+/* APPLE LOCAL begin IMA speed up */
+ while (tts_i->isEnum)
+ {
+ const struct tagged_tu_seen* p = tts_i->next;
+ free((struct tagged_tu_seen*)tts_i);
+ tts_i = p;
+ }
+/* APPLE LOCAL end IMA speed up */
tagged_tu_seen_base = tts.next;
if (s1 && s2)
return 0;
@@ -2832,24 +2895,29 @@ internal_build_compound_expr (tree list, int first_p)
rest = internal_build_compound_expr (TREE_CHAIN (list), FALSE);
- if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
+ /* APPLE LOCAL begin AltiVec */
+ if (!targetm.cast_expr_as_vector_init)
{
- /* The left-hand operand of a comma expression is like an expression
- statement: with -Wextra or -Wunused, we should warn if it doesn't have
- any side-effects, unless it was explicitly cast to (void). */
- if (warn_unused_value
- && ! (TREE_CODE (TREE_VALUE (list)) == CONVERT_EXPR
- && VOID_TYPE_P (TREE_TYPE (TREE_VALUE (list)))))
- warning ("left-hand operand of comma expression has no effect");
- }
-
- /* With -Wunused, we should also warn if the left-hand operand does have
- side-effects, but computes a value which is not used. For example, in
- `foo() + bar(), baz()' the result of the `+' operator is not used,
- so we should issue a warning. */
- else if (warn_unused_value)
- warn_if_unused_value (TREE_VALUE (list));
+ if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
+ {
+ /* The left-hand operand of a comma expression is like an expression
+ statement: with -Wextra or -Wunused, we should warn if it doesn't have
+ any side-effects, unless it was explicitly cast to (void). */
+ if (warn_unused_value
+ && ! (TREE_CODE (TREE_VALUE (list)) == CONVERT_EXPR
+ && VOID_TYPE_P (TREE_TYPE (TREE_VALUE (list)))))
+ warning ("left-hand operand of comma expression has no effect");
+ }
+ /* With -Wunused, we should also warn if the left-hand operand does have
+ side-effects, but computes a value which is not used. For example, in
+ `foo() + bar(), baz()' the result of the `+' operator is not used,
+ so we should issue a warning. */
+ else if (warn_unused_value)
+ warn_if_unused_value (TREE_VALUE (list));
+ }
+ /* APPLE LOCAL end AltiVec */
+
return build (COMPOUND_EXPR, TREE_TYPE (rest), TREE_VALUE (list), rest);
}
@@ -2863,6 +2931,13 @@ build_c_cast (tree type, tree expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
+ /* APPLE LOCAL begin AltiVec */
+ /* If we are casting to a vector type, treat the expression as a vector
+ initializer if this target supports it. */
+ if (TREE_CODE (type) == VECTOR_TYPE && targetm.cast_expr_as_vector_init)
+ return vector_constructor_from_expr (expr, type);
+ /* APPLE LOCAL end AltiVec */
+
/* The ObjC front-end uses TYPE_MAIN_VARIANT to tie together types differing
only in <protocol> qualifications. But when constructing cast expressions,
the protocols do matter and must be kept around. */
@@ -3045,6 +3120,13 @@ build_c_cast (tree type, tree expr)
/* Replace a nonvolatile const static variable with its value. */
if (optimize && TREE_CODE (value) == VAR_DECL)
value = decl_constant_value (value);
+ /* APPLE LOCAL begin don't sign-extend pointers cast to integers */
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TREE_CODE (otype) == POINTER_TYPE
+ && TYPE_PRECISION (type) > TYPE_PRECISION (otype)
+ && TREE_UNSIGNED (type))
+ value = convert (c_common_type_for_size (POINTER_SIZE, 1), value);
+ /* APPLE LOCAL end don't sign-extend pointers cast to integers */
value = convert (type, value);
/* Ignore any integer overflow caused by the cast. */
@@ -3259,9 +3341,8 @@ convert_for_assignment (tree type, tree rhs, const char *errtype,
return rhs;
}
/* Some types can interconvert without explicit casts. */
- else if (codel == VECTOR_TYPE && coder == VECTOR_TYPE
- && ((*targetm.vector_opaque_p) (type)
- || (*targetm.vector_opaque_p) (rhstype)))
+ else if (codel == VECTOR_TYPE
+ && vector_types_compatible_p (type, TREE_TYPE (rhs)))
return convert (type, rhs);
/* Arithmetic types all interconvert, and enum is treated like int. */
else if ((codel == INTEGER_TYPE || codel == REAL_TYPE
@@ -3869,13 +3950,21 @@ digest_init (tree type, tree init, int require_constant)
if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
!= char_type_node)
+ /* APPLE LOCAL begin pascal strings */
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
+ != unsigned_char_type_node)
+ /* APPLE LOCAL end pascal strings */
&& TYPE_PRECISION (typ1) == TYPE_PRECISION (char_type_node))
{
error_init ("char-array initialized from wide string");
return error_mark_node;
}
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
- == char_type_node)
+ /* APPLE LOCAL begin pascal strings */
+ if (((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
+ == char_type_node)
+ || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
+ == unsigned_char_type_node))
+ /* APPLE LOCAL end pascal strings */
&& TYPE_PRECISION (typ1) != TYPE_PRECISION (char_type_node))
{
error_init ("int-array initialized from non-wide string");
@@ -3906,11 +3995,11 @@ digest_init (tree type, tree init, int require_constant)
vector constructor is not constant (e.g. {1,2,3,foo()}) then punt
below and handle as a constructor. */
if (code == VECTOR_TYPE
- && comptypes (TREE_TYPE (inside_init), type, COMPARE_STRICT)
+ && vector_types_compatible_p (TREE_TYPE (inside_init), type)
&& TREE_CONSTANT (inside_init))
{
if (TREE_CODE (inside_init) == VECTOR_CST
- && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
+ && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
TYPE_MAIN_VARIANT (type),
COMPARE_STRICT))
return inside_init;
@@ -4011,7 +4100,8 @@ digest_init (tree type, tree init, int require_constant)
/* Handle scalar types, including conversions. */
if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE
- || code == ENUMERAL_TYPE || code == BOOLEAN_TYPE || code == COMPLEX_TYPE)
+ || code == ENUMERAL_TYPE || code == BOOLEAN_TYPE || code == COMPLEX_TYPE
+ || code == VECTOR_TYPE)
{
/* Note that convert_for_assignment calls default_conversion
for arrays and functions. We must not call it in the
diff --git a/gcc/c.opt b/gcc/c.opt
index 4855ee2b03e..2b86c8643a5 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -103,7 +103,7 @@ Print the name of header files as they are used
I
C ObjC C++ ObjC++ Joined Separate
--I <dir> Add <dir> to the end of the main include path. -I- gives more include path control; see info documentation
+-I <dir> Add <dir> to the end of the main include path
M
C ObjC C++ ObjC++
@@ -149,6 +149,11 @@ U
C ObjC C++ ObjC++ Joined Separate
-U<macro> Undefine <macro>
+; APPLE LOCAL -Wno-#warnings
+W#warnings
+C ObjC C++ ObjC++
+Enable #warning
+
Wabi
C++ ObjC++
@@ -212,6 +217,11 @@ Werror-implicit-function-declaration
C ObjC RejectNegative
Make implicit function declarations an error
+; APPLE LOCAL -Wextra-tokens
+Wextra-tokens
+C Objc C++ ObjC++
+Warn about extra tokens at the end of prepreprocessor directives
+
Wfloat-equal
C ObjC C++ ObjC++
Warn if testing floating point numbers for equality
@@ -242,6 +252,11 @@ C ObjC
Wformat=
C ObjC C++ ObjC++ Joined
+; APPLE LOCAL -Wfour-char-constants
+Wfour-char-constants
+C ObjC C++ ObjC++
+Warn about multicharacter constants containing exactly four characters
+
Winit-self
C ObjC C++ ObjC++
Warn about variables which are initialized to themselves.
@@ -269,6 +284,16 @@ Winvalid-pch
C ObjC C++ ObjC++
Warn about PCH files that are found but not used
+; APPLE LOCAL Symbol Separation
+Winvalid-sr
+C ObjC C++ ObjC++
+Warn about symbol files that are found but not used
+
+; APPLE LOCAL -Wlong-double
+Wlong-double
+C ObjC C++ ObjC++
+Warn about \"long double\"
+
Wlong-long
C ObjC C++ ObjC++
Do not warn about using \"long long\" when -pedantic
@@ -293,6 +318,11 @@ Wmissing-prototypes
C ObjC
Warn about global functions without prototypes
+; APPLE LOCAL -Wmost
+Wmost
+C ObjC C++ ObjC++
+Like -Wall but without -Wparentheses
+
Wmultichar
C ObjC C++ ObjC++
Warn about use of multi-character character constants
@@ -301,6 +331,11 @@ Wnested-externs
C ObjC
Warn about \"extern\" declarations not at file scope
+; APPLE LOCAL -Wnewline-eof
+Wnewline-eof
+C ObjC C++ ObjC++
+Warn about files missing a newline at the end of the file
+
Wnon-template-friend
C++ ObjC++
Warn when non-templatized friend functions are declared within a template
@@ -415,6 +450,11 @@ ansi
C ObjC C++ ObjC++
A synonym for -std=c89. In a future version of GCC it will become synonymous with -std=c99 instead
+; APPLE LOCAL fat builds
+arch
+C ObjC C++ ObjC++ Separate
+The architecture to build for.
+
d
C ObjC C++ ObjC++ Joined
; Documented in common.opt. FIXME - what about -dI, -dD, -dN and -dD?
@@ -430,10 +470,28 @@ falt-external-templates
C++ ObjC++
Change when template instances are emitted
+; APPLE LOCAL -fapple-kext
+fapple-kext
+C++
+Used for building Darwin kernel extensions
+
fasm
C ObjC C++ ObjC++
Recognize the \"asm\" keyword
+; APPLE LOCAL fast, fastf, fastcp
+fast
+C
+Used for c optimization
+
+fastcp
+C++
+Used when C++ specific optimization is needed
+
+fastf
+C
+Used when c is generated from NAG fortran
+
fbuiltin
C ObjC C++ ObjC++
Recognize built-in functions
@@ -445,6 +503,11 @@ fcheck-new
C++ ObjC++
Check the return value of new
+; APPLE LOCAL structor decloning
+fclone-structors
+C++ ObjC++
+Factor out certain duplicate code in constructors and destructors
+
fcond-mismatch
C ObjC C++ ObjC++
Allow the arguments of the '?' operator to have different types
@@ -465,6 +528,10 @@ fdefault-inline
C++ ObjC++
Inline member functions by default
+fdisable-typechecking-for-spec
+C C++
+Make crossfile type mismatches warnings not errors (for SPEC)
+
fdollars-in-identifiers
C ObjC C++ ObjC++
Permit '$' as an identifier character
@@ -542,6 +609,11 @@ fimplicit-templates
C++ ObjC++
Emit implicit instantiations of templates
+; APPLE LOCAL -findirect-virtual-calls
+findirect-virtual-calls
+C++ ObjC++
+Always use the vtable to make direct calls to virtual functions
+
flabels-ok
C++ ObjC++
@@ -584,6 +656,11 @@ Enable optional diagnostics
fpch-deps
C ObjC C++ ObjC++
+; APPLE LOCAL pch distcc mrs
+fpch-preprocess
+C ObjC C++ ObjC++
+Enable PCH processing even when -E or -save-temps is used
+
fpermissive
C++ ObjC++
Downgrade conformance errors to warnings
@@ -604,6 +681,11 @@ frtti
C++ ObjC++
Generate run time type descriptor information
+; APPLE LOCAL Symbol Separation
+fsave-repository=
+C ObjC C++ ObjC++ Joined Separate
+Creates separate symbol repository
+
fshort-double
C ObjC C++ ObjC++
Use the same size for double as for float
@@ -645,6 +727,11 @@ ftemplate-depth-
C++ ObjC++ Joined RejectNegative UInteger
-ftemplate-depth-<number> Specify maximum template instantiation depth
+; APPLE LOCAL -fterminated-vtables
+fterminated-vtables
+C++ ObjC++
+Put zero word at the end of every vtable
+
fthis-is-variable
C++ ObjC++
@@ -692,6 +779,11 @@ gen-decls
ObjC ObjC++
Dump declarations to a .decl file
+; APPLE LOCAL -header-mapfile
+header-mapfile
+C ObjC C++ ObjC++ Separate
+
+
idirafter
C ObjC C++ ObjC++ Joined Separate
-idirafter <dir> Add <dir> to the end of the system include path
@@ -704,6 +796,7 @@ include
C ObjC C++ ObjC++ Joined Separate
-include <file> Include the contents of <file> before other files
+
iprefix
C ObjC C++ ObjC++ Joined Separate
-iprefix <path> Specify <path> as a prefix for next two options
@@ -716,6 +809,10 @@ isystem
C ObjC C++ ObjC++ Joined Separate
-isystem <dir> Add <dir> to the start of the system include path
+iquote
+C ObjC C++ ObjC++ Joined Separate
+-iquote <dir> Add <dir> to the end of the quote include path
+
iwithprefix
C ObjC C++ ObjC++ Joined Separate
-iwithprefix <dir> Add <dir> to the end of the system include path
diff --git a/gcc/calls.c b/gcc/calls.c
index d83b353c0ee..1a96762aecb 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -134,7 +134,7 @@ static void initialize_argument_information (int, struct arg_data *,
struct args_size *, int, tree,
tree, CUMULATIVE_ARGS *, int,
rtx *, int *, int *, int *,
- bool *, bool);
+ bool *, bool, tree);
static void compute_argument_addresses (struct arg_data *, rtx, int);
static rtx rtx_for_function_call (tree, tree);
static void load_register_parameters (struct arg_data *, int, rtx *, int,
@@ -381,7 +381,14 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
and we don't want to load it into a register as an optimization,
because prepare_call_address already did it if it should be done. */
if (GET_CODE (funexp) != SYMBOL_REF)
+/* APPLE LOCAL use R12 as register for indirect calls. This improves
+ codegen (computation of value will be into R12) and makes
+ indirect sibcalls possible by ensuring a volatile reg is used. */
+#ifdef MAGIC_INDIRECT_CALL_REG
+ funexp = gen_rtx_REG (SImode, MAGIC_INDIRECT_CALL_REG);
+#else
funexp = memory_address (FUNCTION_MODE, funexp);
+#endif
#if defined (HAVE_sibcall_pop) && defined (HAVE_sibcall_value_pop)
if ((ecf_flags & ECF_SIBCALL)
@@ -1046,7 +1053,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
int reg_parm_stack_space,
rtx *old_stack_level, int *old_pending_adj,
int *must_preallocate, int *ecf_flags,
- bool *may_tailcall, bool call_from_thunk_p)
+ bool *may_tailcall, bool call_from_thunk_p,
+ tree type_arg_types)
{
/* 1 if scanning parms front to back, -1 if scanning back to front. */
int inc;
@@ -1057,6 +1065,12 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
int i;
tree p;
+ /* APPLE LOCAL begin Altivec */
+ int pass, last_pass;
+ int save_i, save_inc;
+ int stdarg;
+ /* APPLE LOCAL end Altivec */
+
args_size->constant = 0;
args_size->var = 0;
@@ -1075,13 +1089,31 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
i = 0, inc = 1;
}
- /* I counts args in order (to be) pushed; ARGPOS counts in order written. */
- for (p = actparms, argpos = 0; p; p = TREE_CHAIN (p), i += inc, argpos++)
+ /* APPLE LOCAL begin Altivec */
+ stdarg = (type_arg_types != 0
+ && TREE_VALUE (tree_last (type_arg_types)) != void_type_node);
+ last_pass = 1;
+ save_i = i;
+ save_inc = inc;
+ for (pass = 1; pass <= last_pass; pass++)
+ {
+ i = save_i;
+ inc = save_inc;
+ /* APPLE LOCAL end Altivec */
+ /* I counts args in order (to be) pushed; ARGPOS counts in order written. */
+ for (p = actparms, argpos = 0; p; p = TREE_CHAIN (p), i += inc, argpos++)
{
tree type = TREE_TYPE (TREE_VALUE (p));
int unsignedp;
enum machine_mode mode;
+ /* APPLE LOCAL begin Altivec */
+ /* In 1st iteration over actual arguments, only consider non-vectors.
+ During 2nd iteration, finish off with vector parameters. */
+ if (!stdarg && targetm.calls.skip_vec_args (type, pass, &last_pass))
+ continue;
+ /* APPLE LOCAL end Altivec */
+
args[i].tree_value = TREE_VALUE (p);
/* Replace erroneous argument with constant zero. */
@@ -1256,8 +1288,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
/* Compute the stack-size of this argument. */
if (args[i].reg == 0 || args[i].partial != 0
- || reg_parm_stack_space > 0
- || args[i].pass_on_stack)
+ || reg_parm_stack_space > 0
+ || args[i].pass_on_stack)
locate_and_pad_parm (mode, type,
#ifdef STACK_PARMS_IN_REG_PARM_AREA
1,
@@ -1287,6 +1319,9 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
FUNCTION_ARG_ADVANCE (*args_so_far, TYPE_MODE (type), type,
argpos < n_named_args);
}
+ /* APPLE LOCAL begin Altivec */
+ }
+ /* APPLE LOCAL end Altivec */
}
/* Update ARGS_SIZE to contain the total size for the argument block.
@@ -2014,12 +2049,18 @@ expand_call (tree exp, rtx target, int ignore)
tree actparms = TREE_OPERAND (exp, 1);
/* RTX for the function to be called. */
rtx funexp;
+ /* APPLE LOCAL use r12 for indirect calls */
+ /* A single rtx to be shared among multiple chains for indirect sibcalls */
+ rtx funexp_keep = NULL_RTX;
/* Sequence of insns to perform a normal "call". */
rtx normal_call_insns = NULL_RTX;
/* Sequence of insns to perform a tail "call". */
rtx tail_call_insns = NULL_RTX;
/* Data type of the function. */
tree funtype;
+ /* APPLE LOCAL objc stret methods */
+ /* Return type of the function. */
+ tree saved_return_type;
tree type_arg_types;
/* Declaration of the function being called,
or 0 if the function is computed (not known by name). */
@@ -2238,6 +2279,16 @@ expand_call (tree exp, rtx target, int ignore)
abort ();
funtype = TREE_TYPE (funtype);
+ /* APPLE LOCAL objc stret methods */
+ /* Set the return type of the function to the type of the call expression,
+ in case that's different from the function declaration.
+ (This is the case when calling _objc_msgSend_stret, for example,
+ which is declared to return id, but actually returns a struct.)
+ But save the original return type first, so it can be restored later
+ in case it's needed. */
+ saved_return_type = TREE_TYPE (funtype);
+ TREE_TYPE (funtype) = TREE_TYPE (exp);
+
/* Munge the tree to split complex arguments into their imaginary
and real parts. */
if (SPLIT_COMPLEX_ARGS)
@@ -2330,7 +2381,8 @@ expand_call (tree exp, rtx target, int ignore)
&args_so_far, reg_parm_stack_space,
&old_stack_level, &old_pending_adj,
&must_preallocate, &flags,
- &try_tail_call, CALL_FROM_THUNK_P (exp));
+ &try_tail_call, CALL_FROM_THUNK_P (exp),
+ type_arg_types);
if (args_size.var)
{
@@ -2396,6 +2448,20 @@ expand_call (tree exp, rtx target, int ignore)
It does not seem worth the effort since few optimizable
sibling calls will return a structure. */
|| structure_value_addr != NULL_RTX
+/* APPLE LOCAL begin indirect sibcalls */
+#ifndef MAGIC_INDIRECT_CALL_REG
+/* The register holding the address is now always R12, so
+ we can consider indirect calls as sibcall candidates on ppc. */
+ /* If the register holding the address is a callee saved
+ register, then we lose. We have no way to prevent that,
+ so we only allow calls to named functions. */
+ /* ??? This could be done by having the insn constraints
+ use a register class that is all call-clobbered. Any
+ reload insns generated to fix things up would appear
+ before the sibcall_epilogue. */
+ || fndecl == NULL_TREE
+#endif
+/* APPLE LOCAL end indirect sibcalls */
/* Check whether the target is able to optimize the call
into a sibcall. */
|| !(*targetm.function_ok_for_sibcall) (fndecl, exp)
@@ -2490,6 +2556,14 @@ expand_call (tree exp, rtx target, int ignore)
function_call_count++;
+ /* APPLE LOCAL indirect sibcalls */
+ /* Do this before creating the chains, to avoid a branch within them.
+ The paired chains both branch to the same label, but only one
+ chain has a definition of that label, because of the way the
+ infrastructure works. */
+ if ( !fndecl )
+ funexp_keep = rtx_for_function_call (fndecl, addr);
+
/* We want to make two insn chains; one for a sibling call, the other
for a normal call. We will select one of the two chains after
initial RTL generation is complete. */
@@ -2812,7 +2886,11 @@ expand_call (tree exp, rtx target, int ignore)
be deferred during the evaluation of the arguments. */
NO_DEFER_POP;
- funexp = rtx_for_function_call (fndecl, addr);
+ /* APPLE LOCAL indirect sibcalls */
+ if ( !fndecl )
+ funexp = funexp_keep;
+ else
+ funexp = rtx_for_function_call (fndecl, addr);
/* Figure out the register where the value, if any, will come back. */
valreg = 0;
@@ -2950,6 +3028,24 @@ expand_call (tree exp, rtx target, int ignore)
next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode,
void_type_node, 1);
+ /* APPLE LOCAL begin indirect calls in R12 */
+#ifdef MAGIC_INDIRECT_CALL_REG
+ /* For indirect calls, put the callee address in R12. This is necessary
+ for ObjC methods. This could be handled by patterns in rs6000.md,
+ as in 2.95, but it is better to put this copy in the RTL so the
+ optimizer can see it, and sometimes get rid of it, and the scheduler
+ can move it around. Right now none of these good things seems to
+ happen, but this should be fixable. (But note FSF won't like
+ putting it here.) */
+ if (!fndecl)
+ {
+ rtx magic_reg = gen_rtx_REG (SImode, MAGIC_INDIRECT_CALL_REG);
+ emit_move_insn (magic_reg, funexp);
+ use_reg (&call_fusage, magic_reg);
+ }
+#endif
+ /* APPLE LOCAL end indirect calls in R12 */
+
/* All arguments and registers used for the call must be set up by
now! */
@@ -2963,6 +3059,11 @@ expand_call (tree exp, rtx target, int ignore)
next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,
flags, & args_so_far);
+ /* APPLE LOCAL objc stret methods */
+ /* Restore the function's original return type
+ in case it's needed later on. */
+ TREE_TYPE (funtype) = saved_return_type;
+
/* If call is cse'able, make appropriate pair of reg-notes around it.
Test valreg so we don't crash; may safely ignore `const'
if return type is void. Disable for PARALLEL return values, because
@@ -3323,6 +3424,24 @@ expand_call (tree exp, rtx target, int ignore)
abort ();
}
+ /* APPLE LOCAL begin sibcall 3007352 */
+ /* GCC for PPC on Darwin has always rounded 'current_function_args_size' up to a multiple of 16.
+ CodeWarrior doesn't.
+ A father() that passes, say, 40 bytes of parameters to daughter() will have eight bytes of
+ padding if compiled with GCC, and zero bytes of padding if compiled with CW.
+ If a GCC-compiled daughter() in turn sibcalls to granddaughter() with, say, 44 bytes of parameters,
+ GCC will generate a store of that extra parameter into padding of the father() parameter area.
+ Alas, if father() was compild by CW, father() will not have the parameter area padding,
+ and something in the father() stackframe will be stomped.
+ Parameter areas are guaranteed to be a minimum of 32 bytes. See Radar 3007352. */
+ if ( ( ! sibcall_failure)
+ && args_size.constant > 32
+ && args_size.constant > cfun->unrounded_args_size)
+ {
+ sibcall_failure = 1;
+ }
+ /* APPLE LOCAL end sibcall 3007352 */
+
/* If something prevents making this a sibling call,
zero out the sequence. */
if (sibcall_failure)
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 601fcd44cee..f44b764c55a 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -271,6 +271,14 @@ make_edges (rtx label_value_list, basic_block min, basic_block max, int update_p
/* Assume no computed jump; revise as we create edges. */
current_function_has_computed_jump = 0;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot and cold basic blocks into separate
+ sections, we cannot assume there is no computed jump. */
+
+ if (flag_reorder_blocks_and_partition)
+ current_function_has_computed_jump = 1;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* Heavy use of computed goto in machine-generated code can lead to
nearly fully-connected CFGs. In that case we spend a significant
amount of time searching the edge lists for duplicates. */
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index e5d775cf497..33f41fef3a2 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -50,6 +50,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "target.h"
#include "regs.h"
#include "expr.h"
+/* APPLE LOCAL begin hot/cold partitioning */
+#include "cfglayout.h"
+/* APPLE LOCAL end hot/cold partitioning */
/* cleanup_cfg maintains following flags for each basic block. */
@@ -150,6 +153,17 @@ try_simplify_condjump (basic_block cbranch_block)
return false;
jump_dest_block = jump_block->succ->dest;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && (jump_block->partition != jump_dest_block->partition
+ || cbranch_jump_edge->crossing_edge))
+ return false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* The conditional branch must target the block after the
unconditional branch. */
cbranch_dest_block = cbranch_jump_edge->dest;
@@ -428,6 +442,16 @@ try_forward_edges (int mode, basic_block b)
bool changed = false;
edge e, next, *threaded_edges = NULL;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX))
+ return false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
for (e = b->succ; e; e = next)
{
basic_block target, first;
@@ -675,6 +699,17 @@ merge_blocks_move_predecessor_nojumps (basic_block a, basic_block b)
{
rtx barrier;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && (a->partition != b->partition
+ || find_reg_note (BB_END (a), REG_CROSSING_JUMP, NULL_RTX)))
+ return;
+ /* APPLE LOCAL end hot/cold partitioning */
+
barrier = next_nonnote_insn (BB_END (a));
if (GET_CODE (barrier) != BARRIER)
abort ();
@@ -718,6 +753,17 @@ merge_blocks_move_successor_nojumps (basic_block a, basic_block b)
rtx barrier, real_b_end;
rtx label, table;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && (find_reg_note (BB_END (a), REG_CROSSING_JUMP, NULL_RTX)
+ || a->partition != b->partition))
+ return;
+ /* APPLE LOCAL end hot/cold partitioning */
+
real_b_end = BB_END (b);
/* If there is a jump table following block B temporarily add the jump table
@@ -782,6 +828,18 @@ merge_blocks_move (edge e, basic_block b, basic_block c, int mode)
&& tail_recursion_label_p (BB_HEAD (c)))
return NULL;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && (find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
+ || find_reg_note (BB_END (c), REG_CROSSING_JUMP, NULL_RTX)
+ || b->partition != c->partition))
+ return NULL;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* If B has a fallthru edge to C, no need to move anything. */
if (e->flags & EDGE_FALLTHRU)
{
@@ -1453,6 +1511,14 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
rtx newpos1, newpos2;
edge s;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we have partitioned hot/cold basic blocks, it is a bad idea
+ to try this optimization. */
+
+ if (flag_reorder_blocks_and_partition && no_new_pseudos)
+ return false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
newpos1 = newpos2 = NULL_RTX;
/* Search backward through forwarder blocks. We don't need to worry
@@ -1641,6 +1707,17 @@ try_crossjump_bb (int mode, basic_block bb)
if (!bb->pred || !bb->pred->pred_next)
return false;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && (bb->pred->src->partition != bb->pred->pred_next->src->partition
+ || bb->pred->crossing_edge))
+ return false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* It is always cheapest to redirect a block that ends in a branch to
a block that falls through into BB, as that adds no branches to the
program. We'll try that combination first. */
@@ -1897,6 +1974,9 @@ try_optimize_cfg (int mode)
&& ! b->succ->succ_next
&& b->succ->dest != EXIT_BLOCK_PTR
&& onlyjump_p (BB_END (b))
+ /* APPLE LOCAL begin hot/cold partitioning */
+ && !find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
+ /* APPLE LOCAL end hot/cold partitioning */
&& try_redirect_by_replacing_jump (b->succ, b->succ->dest,
(mode & CLEANUP_CFGLAYOUT) != 0))
{
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index ac37d3adb16..6a93ecae7ae 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -630,7 +630,10 @@ tidy_fallthru_edges (void)
if ((s = b->succ) != NULL
&& ! (s->flags & EDGE_COMPLEX)
&& s->succ_next == NULL
- && s->dest == c)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ && s->dest == c
+ && !find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX))
+ /* APPLE LOCAL end hot/cold partitioning */
tidy_fallthru_edge (s);
}
}
@@ -771,3 +774,4 @@ flow_call_edges_add (sbitmap blocks)
return (cfg_hooks->flow_call_edges_add) (blocks);
}
+
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 73012c28dd5..e68c850466a 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -35,6 +35,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "target.h"
#include "ggc.h"
#include "alloc-pool.h"
+/* APPLE LOCAL begin hot/cold partitioning */
+#include "flags.h"
+/* APPLE LOCAL end hot/cold partitioning */
/* The contents of the current function definition are allocated
in this obstack, and all are freed at the end of the function. */
@@ -55,6 +58,9 @@ void verify_insn_chain (void);
static void fixup_fallthru_exit_predecessor (void);
static rtx duplicate_insn_chain (rtx, rtx);
static tree insn_scope (rtx);
+/* APPLE LOCAL begin hot/cold partitioning */
+static void update_unlikely_executed_notes (basic_block);
+/* APPLE LOCAL end hot/cold partitioning */
rtx
unlink_insn_chain (rtx first, rtx last)
@@ -643,6 +649,9 @@ fixup_reorder_chain (void)
edge e_fall, e_taken, e;
rtx bb_end_insn;
basic_block nb;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ basic_block old_bb;
+ /* APPLE LOCAL end hot/cold partitioning */
if (bb->succ == NULL)
continue;
@@ -719,6 +728,13 @@ fixup_reorder_chain (void)
}
}
+ /* APPLE LOCAL end hot/cold partitioning */
+ /* If the "jumping" edge is a crossing edge, and the fall
+ through edge is non-crossing, leave things as they are. */
+ else if (e_taken->crossing_edge && !e_fall->crossing_edge)
+ continue;
+ /* APPLE LOCAL begin hot/cold partitioning */
+
/* Otherwise we can try to invert the jump. This will
basically never fail, however, keep up the pretense. */
else if (invert_jump (bb_end_insn,
@@ -776,7 +792,37 @@ fixup_reorder_chain (void)
nb->rbi->next = bb->rbi->next;
bb->rbi->next = nb;
/* Don't process this new block. */
- bb = nb;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ old_bb = bb;
+ bb = nb;
+
+ /* Make sure new bb is tagged for correct section (same as
+ fall-thru source). */
+ e_fall->src->partition = bb->pred->src->partition;
+ if (flag_reorder_blocks_and_partition
+ && targetm.have_named_sections)
+ {
+ if (bb->pred->src->partition == COLD_PARTITION)
+ {
+ rtx new_note;
+ rtx note = BB_HEAD (e_fall->src);
+
+ while (!INSN_P (note)
+ && note != BB_END (e_fall->src))
+ note = NEXT_INSN (note);
+
+ new_note = emit_note_before
+ (NOTE_INSN_UNLIKELY_EXECUTED_CODE,
+ note);
+ NOTE_BASIC_BLOCK (new_note) = bb;
+ }
+ if (GET_CODE (BB_END (bb)) == JUMP_INSN
+ && !any_condjump_p (BB_END (bb))
+ && bb->succ->crossing_edge )
+ REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
+ (REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
}
}
@@ -811,6 +857,10 @@ fixup_reorder_chain (void)
bb->index = index;
BASIC_BLOCK (index) = bb;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ update_unlikely_executed_notes (bb);
+ /* APPLE LOCAL end hot/cold partitioning */
+
bb->prev_bb = prev_bb;
prev_bb->next_bb = bb;
}
@@ -827,6 +877,23 @@ fixup_reorder_chain (void)
force_nonfallthru (e);
}
}
+/* APPLE LOCAL begin hot/cold partitioning */
+
+/* Update the basic block number information in any
+ NOTE_INSN_UNLIKELY_EXECUTED_CODE notes within the basic block. */
+
+static void
+update_unlikely_executed_notes (basic_block bb)
+{
+ rtx cur_insn;
+
+ for (cur_insn = BB_HEAD (bb); cur_insn != BB_END (bb);
+ cur_insn = NEXT_INSN (cur_insn))
+ if (GET_CODE (cur_insn) == NOTE
+ && NOTE_LINE_NUMBER (cur_insn) == NOTE_INSN_UNLIKELY_EXECUTED_CODE)
+ NOTE_BASIC_BLOCK (cur_insn) = bb;
+}
+/* APPLE LOCAL end hot/cold partitioning */
/* Perform sanity checks on the insn chain.
1. Check that next/prev pointers are consistent in both the forward and
@@ -993,6 +1060,9 @@ duplicate_insn_chain (rtx from, rtx to)
abort ();
break;
case NOTE_INSN_REPEATED_LINE_NUMBER:
+ /* APPLE LOCAL begin hot/cold partitioning */
+ case NOTE_INSN_UNLIKELY_EXECUTED_CODE:
+ /* APPLE LOCAL end hot/cold partitioning */
emit_note_copy (insn);
break;
@@ -1020,6 +1090,7 @@ duplicate_insn_chain (rtx from, rtx to)
code. */
extern basic_block cfg_layout_duplicate_bb (basic_block);
+extern basic_block cfg_layout_duplicate_bb (basic_block);
basic_block
cfg_layout_duplicate_bb (basic_block bb)
{
diff --git a/gcc/cfglayout.h b/gcc/cfglayout.h
index ad73e713e9a..9b848a7bcdb 100644
--- a/gcc/cfglayout.h
+++ b/gcc/cfglayout.h
@@ -27,3 +27,7 @@ extern void reemit_insn_block_notes (void);
extern bool can_copy_bbs_p (basic_block *, unsigned);
extern void copy_bbs (basic_block *, unsigned, basic_block *,
edge *, unsigned, edge *, struct loop *);
+/* APPLE LOCAL begin hot/cold partitioning */
+extern bool scan_ahead_for_unlikely_executed_note (rtx);
+/* APPLE LOCAL end hot/cold partitioning */
+
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 3d13386ba4e..851f80d63bb 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -101,6 +101,20 @@ flow_loop_nested_p (const struct loop *outer, const struct loop *loop)
&& loop->pred[outer->depth] == outer;
}
+/* Returns superloop of LOOP at given DEPTH. */
+
+struct loop *
+superloop_at_depth (struct loop *loop, unsigned depth)
+{
+ if (depth > (unsigned) loop->depth)
+ abort ();
+
+ if (depth == (unsigned) loop->depth)
+ return loop;
+
+ return loop->pred[depth];
+}
+
/* Dump the loop information specified by LOOP to the stream FILE
using auxiliary dump callback function LOOP_DUMP_AUX if non null. */
@@ -928,6 +942,7 @@ glb_enum_p (basic_block bb, void *glb_header)
/* Gets basic blocks of a LOOP. Header is the 0-th block, rest is in dfs
order against direction of edges from latch. Specially, if
header != latch, latch is the 1-st block. */
+
basic_block *
get_loop_body (const struct loop *loop)
{
@@ -992,7 +1007,7 @@ fill_sons_in_loop (const struct loop *loop, basic_block bb,
/* Gets body of a LOOP (that must be different from the outermost loop)
sorted by dominance relation. Additionally, if a basic block s dominates
- the latch, then only blocks dominated by s are be after it. */
+ the latch, then only blocks dominated by s are after it. */
basic_block *
get_loop_body_in_dom_order (const struct loop *loop)
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index e79d39afef1..b00295a91c3 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -168,6 +168,12 @@ struct loop
/* The number of LABEL_REFs on exit_labels for this loop and all
loops nested inside it. */
int exit_count;
+
+ /* The probable number of times the loop is executed at runtime.
+ This is either an INTERVAL_CHREC or an INTEGER_CST. Don't access
+ this field directly: number_of_iterations_in_loop computes and
+ caches the computed information in this field. */
+ tree nb_iterations;
};
/* Flags for state of loop structure. */
@@ -246,8 +252,10 @@ extern bool flow_loop_outside_edge_p (const struct loop *, edge);
extern bool flow_loop_nested_p (const struct loop *, const struct loop *);
extern bool flow_bb_inside_loop_p (const struct loop *, const basic_block);
extern struct loop * find_common_loop (struct loop *, struct loop *);
+struct loop *superloop_at_depth (struct loop *, unsigned);
extern int num_loop_insns (struct loop *);
extern int average_num_loop_insns (struct loop *);
+extern unsigned get_loop_level (const struct loop *);
/* Loops & cfg manipulation. */
extern basic_block *get_loop_body (const struct loop *);
@@ -290,7 +298,7 @@ extern bool can_duplicate_loop_p (struct loop *loop);
extern int duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
unsigned, sbitmap, edge, edge *,
unsigned *, int);
-extern struct loop *loopify (struct loops *, edge, edge, basic_block);
+extern struct loop *loopify (struct loops *, edge, edge, basic_block, bool);
extern void unloop (struct loops *, struct loop *);
extern bool remove_path (struct loops *, edge);
extern edge split_loop_bb (basic_block, rtx);
@@ -403,6 +411,11 @@ simple_loop_desc (struct loop *loop)
return loop->aux;
}
+/* Register pressure estimation for induction variable optimizations & loop
+ invariant motion. */
+extern void init_set_costs (void);
+extern unsigned global_cost_for_size (unsigned, unsigned, unsigned);
+
/* Loop optimizer initialization. */
extern struct loops *loop_optimizer_init (FILE *);
extern void loop_optimizer_finalize (struct loops *, FILE *);
@@ -418,3 +431,107 @@ enum
};
extern void unroll_and_peel_loops (struct loops *, int);
+extern void doloop_optimize_loops (struct loops *);
+extern void move_loop_invariants (struct loops *);
+
+static inline struct loop *loop_from_num (struct loops *, unsigned);
+static inline struct loop *outer_loop (struct loop *);
+static inline struct loop *inner_loop (struct loop *);
+static inline struct loop *next_loop (struct loop *);
+static inline unsigned loop_num (struct loop *);
+static inline unsigned loop_depth (struct loop *);
+static inline basic_block loop_header (struct loop *);
+static inline tree loop_nb_iterations (struct loop *);
+static inline unsigned loop_num_exits (struct loop *);
+static inline edge *loop_exit_edges (struct loop *);
+static inline edge loop_exit_edge (struct loop *, unsigned);
+
+static inline struct loop *
+loop_from_num (struct loops *loops,
+ unsigned num)
+{
+ return loops->parray[num];
+}
+
+/* Returns the outer loop. */
+
+static inline struct loop *
+outer_loop (struct loop *loop)
+{
+ return loop->outer;
+}
+
+/* Returns the inner loop. */
+
+static inline struct loop *
+inner_loop (struct loop *loop)
+{
+ return loop->inner;
+}
+
+/* Returns the next loop. */
+
+static inline struct loop *
+next_loop (struct loop *loop)
+{
+ return loop->next;
+}
+
+/* Returns the number of a loop. */
+
+static inline unsigned
+loop_num (struct loop *loop)
+{
+ return loop->num;
+}
+
+/* Returns the depth of a loop. */
+
+static inline unsigned
+loop_depth (struct loop *loop)
+{
+ return loop->depth;
+}
+
+/* Returns the header basic block of the loop. */
+
+static inline basic_block
+loop_header (struct loop *loop)
+{
+ return loop->header;
+}
+
+/* Returns the number of iterations in the loop. Use
+ number_of_iterations_in_loop () instead of accessing directly this
+ field. */
+
+static inline tree
+loop_nb_iterations (struct loop *loop)
+{
+ return loop->nb_iterations;
+}
+
+/* Returns the number of exit edges of the loop. */
+
+static inline unsigned
+loop_num_exits (struct loop *loop)
+{
+ return loop->num_exits;
+}
+
+/* Returns the exit edges of the loop. */
+
+static inline edge *
+loop_exit_edges (struct loop *loop)
+{
+ return loop->exit_edges;
+}
+
+/* Returns the n-th exit edge of the loop. */
+
+static inline edge
+loop_exit_edge (struct loop *loop, unsigned n)
+{
+ return loop->exit_edges[n];
+}
+
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 9b3ffa0c8ae..63d6f4121b0 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -457,3 +457,20 @@ expected_loop_iterations (const struct loop *loop)
return (freq_latch + freq_in - 1) / freq_in;
}
}
+
+/* Returns the maximum level of nesting of subloops of LOOP. */
+
+unsigned
+get_loop_level (const struct loop *loop)
+{
+ const struct loop *ploop;
+ unsigned mx = 0, l;
+
+ for (ploop = loop->inner; ploop; ploop = ploop->next)
+ {
+ l = get_loop_level (ploop);
+ if (l >= mx)
+ mx = l + 1;
+ }
+ return mx;
+}
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 282515db97c..3753c048f8b 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -486,7 +486,7 @@ scale_loop_frequencies (struct loop *loop, int num, int den)
struct loop *
loopify (struct loops *loops, edge latch_edge, edge header_edge,
- basic_block switch_bb)
+ basic_block switch_bb, bool redirect_all_edges)
{
basic_block succ_bb = latch_edge->dest;
basic_block pred_bb = header_edge->src;
@@ -513,12 +513,17 @@ loopify (struct loops *loops, edge latch_edge, edge header_edge,
loop_redirect_edge (latch_edge, loop->header);
loop_redirect_edge (BRANCH_EDGE (switch_bb), succ_bb);
- loop_redirect_edge (header_edge, switch_bb);
- loop_redirect_edge (FALLTHRU_EDGE (switch_bb), loop->header);
-
- /* Update dominators. */
- set_immediate_dominator (CDI_DOMINATORS, switch_bb, pred_bb);
- set_immediate_dominator (CDI_DOMINATORS, loop->header, switch_bb);
+ /* During loop versioning, one of the switch_bb edge is already properly
+ set. Do not redirect it again unless redirect_all_edges is true. */
+ if (redirect_all_edges)
+ {
+ loop_redirect_edge (header_edge, switch_bb);
+ loop_redirect_edge (FALLTHRU_EDGE (switch_bb), loop->header);
+
+ /* Update dominators. */
+ set_immediate_dominator (CDI_DOMINATORS, switch_bb, pred_bb);
+ set_immediate_dominator (CDI_DOMINATORS, loop->header, switch_bb);
+ }
set_immediate_dominator (CDI_DOMINATORS, succ_bb, switch_bb);
@@ -971,6 +976,9 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
/* Copy bbs. */
copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop);
+ for (i = 0; i < n; i++)
+ new_bbs[i]->rbi->copy_number = j + 1;
+
/* Note whether the blocks and edges belong to an irreducible loop. */
if (add_irreducible_flag)
{
@@ -1049,6 +1057,8 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
int n_dom_bbs,j;
bb = bbs[i];
+ bb->rbi->copy_number = 0;
+
n_dom_bbs = get_dominated_by (CDI_DOMINATORS, bb, &dom_bbs);
for (j = 0; j < n_dom_bbs; j++)
{
@@ -1156,8 +1166,7 @@ create_preheader (struct loop *loop, int flags)
}
if (dump_file)
- fprintf (dump_file, "Created preheader block for loop %i\n",
- loop->num);
+ fprintf (dump_file, "Created preheader block for loop %i\n", loop->num);
return dummy;
}
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 341167dd684..dcb155e0322 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -56,6 +56,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "insn-config.h"
#include "cfglayout.h"
#include "expr.h"
+#include "target.h"
/* Stubs in case we don't have a return insn. */
#ifndef HAVE_return
@@ -99,6 +100,9 @@ can_delete_note_p (rtx note)
{
return (NOTE_LINE_NUMBER (note) == NOTE_INSN_DELETED
|| NOTE_LINE_NUMBER (note) == NOTE_INSN_BASIC_BLOCK
+ /* APPLE LOCAL begin hot/cold partitioning */
+ || NOTE_LINE_NUMBER (note) == NOTE_INSN_UNLIKELY_EXECUTED_CODE
+ /* APPLE LOCAL end hot/cold partitioning */
|| NOTE_LINE_NUMBER (note) == NOTE_INSN_PREDICTION);
}
@@ -318,6 +322,9 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
link_block (bb, after);
BASIC_BLOCK (bb->index) = bb;
update_bb_for_insn (bb);
+ /* APPLE LOCAL begin hot/cold partitioning */
+ bb->partition = UNPARTITIONED;
+ /* APPLE LOCAL end hot/cold partitioning */
/* Tag the block so that we know it has been used when considering
other basic block notes. */
@@ -613,11 +620,28 @@ rtl_merge_blocks (basic_block a, basic_block b)
static bool
rtl_can_merge_blocks (basic_block a,basic_block b)
{
+ /* APPLE LOCAL begin hot/cold partitioning */
+ bool partitions_ok = true;
+
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && (find_reg_note (BB_END (a), REG_CROSSING_JUMP, NULL_RTX)
+ || find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
+ || a->partition != b->partition))
+ partitions_ok = false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* There must be exactly one edge in between the blocks. */
return (a->succ && !a->succ->succ_next && a->succ->dest == b
&& !b->pred->pred_next && a != b
/* Must be simple edge. */
&& !(a->succ->flags & EDGE_COMPLEX)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ && partitions_ok
+ /* APPLE LOCAL end hot/cold partitioning */
&& a->next_bb == b
&& a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR
/* If the jump insn has side effects,
@@ -658,6 +682,16 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
rtx set;
int fallthru = 0;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX))
+ return false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* Verify that all targets will be TARGET. */
for (tmp = src->succ; tmp; tmp = tmp->succ_next)
if (tmp->dest != target && tmp != e)
@@ -1063,6 +1097,36 @@ force_nonfallthru_and_redirect (edge e, basic_block target)
target->global_live_at_start);
}
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* Make sure new block ends up in correct hot/cold section. */
+
+ jump_block->partition = e->src->partition;
+ if (flag_reorder_blocks_and_partition
+ && targetm.have_named_sections)
+ {
+ if (e->src->partition == COLD_PARTITION)
+ {
+ rtx bb_note, new_note;
+ for (bb_note = BB_HEAD (jump_block);
+ bb_note && bb_note != NEXT_INSN (BB_END (jump_block));
+ bb_note = NEXT_INSN (bb_note))
+ if (GET_CODE (bb_note) == NOTE
+ && NOTE_LINE_NUMBER (bb_note) == NOTE_INSN_BASIC_BLOCK)
+ break;
+ new_note = emit_note_after (NOTE_INSN_UNLIKELY_EXECUTED_CODE,
+ bb_note);
+ NOTE_BASIC_BLOCK (new_note) = jump_block;
+ jump_block->partition = COLD_PARTITION;
+ }
+ if (GET_CODE (BB_END (jump_block)) == JUMP_INSN
+ && !any_condjump_p (BB_END (jump_block))
+ && jump_block->succ->crossing_edge )
+ REG_NOTES (BB_END (jump_block)) = gen_rtx_EXPR_LIST
+ (REG_CROSSING_JUMP, NULL_RTX,
+ REG_NOTES (BB_END (jump_block)));
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* Wire edge in. */
new_edge = make_edge (e->src, jump_block, EDGE_FALLTHRU);
new_edge->probability = e->probability;
@@ -1477,6 +1541,12 @@ commit_one_edge_insertion (edge e, int watch_calls)
tmp = NEXT_INSN (tmp);
if (NOTE_INSN_BASIC_BLOCK_P (tmp))
tmp = NEXT_INSN (tmp);
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (tmp
+ && GET_CODE (tmp) == NOTE
+ && NOTE_LINE_NUMBER (tmp) == NOTE_INSN_UNLIKELY_EXECUTED_CODE)
+ tmp = NEXT_INSN (tmp);
+ /* APPLE LOCAL end hot/cold partitioning */
if (tmp == BB_HEAD (bb))
before = tmp;
else if (tmp)
@@ -1519,6 +1589,41 @@ commit_one_edge_insertion (edge e, int watch_calls)
{
bb = split_edge (e);
after = BB_END (bb);
+
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we must make sure
+ that the new basic block ends up in the correct section. */
+
+ bb->partition = e->src->partition;
+ if (flag_reorder_blocks_and_partition
+ && targetm.have_named_sections
+ && e->src != ENTRY_BLOCK_PTR
+ && e->src->partition == COLD_PARTITION)
+ {
+ rtx bb_note, new_note, cur_insn;
+
+ bb_note = NULL_RTX;
+ for (cur_insn = BB_HEAD (bb); cur_insn != NEXT_INSN (BB_END (bb));
+ cur_insn = NEXT_INSN (cur_insn))
+ if (GET_CODE (cur_insn) == NOTE
+ && NOTE_LINE_NUMBER (cur_insn) == NOTE_INSN_BASIC_BLOCK)
+ {
+ bb_note = cur_insn;
+ break;
+ }
+
+ new_note = emit_note_after (NOTE_INSN_UNLIKELY_EXECUTED_CODE,
+ bb_note);
+ NOTE_BASIC_BLOCK (new_note) = bb;
+ if (GET_CODE (BB_END (bb)) == JUMP_INSN
+ && !any_condjump_p (BB_END (bb))
+ && bb->succ->crossing_edge )
+ REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
+ (REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
+ if (after == bb_note)
+ after = new_note;
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
}
}
@@ -1788,6 +1893,9 @@ update_br_prob_note (basic_block bb)
- tails of basic blocks (ensure that boundary is necessary)
- scans body of the basic block for JUMP_INSN, CODE_LABEL
and NOTE_INSN_BASIC_BLOCK
+ ** APPLE LOCAL begin hot/cold partitioning **
+ - verify that no fall_thru edge crosses hot/cold partition boundaries
+ ** APPLE LOCAL end hot/cold partitioning **
In future it can be extended check a lot of other stuff as well
(reachability of basic blocks, life information, etc. etc.). */
@@ -1875,7 +1983,17 @@ rtl_verify_flow_info_1 (void)
for (e = bb->succ; e; e = e->succ_next)
{
if (e->flags & EDGE_FALLTHRU)
- n_fallthru++, fallthru = e;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ {
+ n_fallthru++, fallthru = e;
+ if (e->crossing_edge)
+ {
+ error ("Fallthru edge crosses section boundary (bb %i)",
+ e->src->index);
+ err = 1;
+ }
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
if ((e->flags & ~(EDGE_DFS_BACK
| EDGE_CAN_FALLTHRU
@@ -2161,10 +2279,19 @@ purge_dead_edges (basic_block bb)
for (e = bb->succ; e; e = next)
{
next = e->succ_next;
+
if (e->flags & EDGE_EH)
{
if (can_throw_internal (BB_END (bb)))
- continue;
+ {
+ /* If the call was removed/moved somewhere else, cleanup the
+ EDGE_ABNORMAL_CALL flag. */
+ if ((e->flags & EDGE_ABNORMAL_CALL)
+ && GET_CODE (BB_END (bb)) != CALL_INSN)
+ e->flags &= ~EDGE_ABNORMAL_CALL;
+
+ continue;
+ }
}
else if (e->flags & EDGE_ABNORMAL_CALL)
{
@@ -2547,11 +2674,28 @@ cfg_layout_delete_block (basic_block bb)
static bool
cfg_layout_can_merge_blocks_p (basic_block a, basic_block b)
{
+ /* APPLE LOCAL begin hot/cold partitioning */
+ bool partitions_ok = true;
+
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && (find_reg_note (BB_END (a), REG_CROSSING_JUMP, NULL_RTX)
+ || find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
+ || a->partition != b->partition))
+ partitions_ok = false;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* There must be exactly one edge in between the blocks. */
return (a->succ && !a->succ->succ_next && a->succ->dest == b
&& !b->pred->pred_next && a != b
/* Must be simple edge. */
&& !(a->succ->flags & EDGE_COMPLEX)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ && partitions_ok
+ /* APPLE LOCAL end hot/cold partitioning */
&& a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR
/* If the jump insn has side effects,
we can't kill the edge. */
diff --git a/gcc/combine.c b/gcc/combine.c
index 5b0b6ac01ce..bb946fb47f8 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -407,6 +407,8 @@ static int insn_cuid (rtx);
static void record_promoted_value (rtx, rtx);
static rtx reversed_comparison (rtx, enum machine_mode, rtx, rtx);
static enum rtx_code combine_reversed_comparison_code (rtx);
+static int unmentioned_reg_p_1 (rtx *, void *);
+static bool unmentioned_reg_p (rtx, rtx);
/* Substitute NEWVAL, an rtx expression, into INTO, a place in some
insn. The substitution can be undone by undo_all. If INTO is already
@@ -720,6 +722,31 @@ combine_instructions (rtx f, unsigned int nregs)
&new_direct_jump_p)) != 0)
goto retry;
+ /* Try this insn with each REG_EQUAL note it links back to. */
+ for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
+ {
+ rtx set, note;
+ rtx temp = XEXP (links, 0);
+ if ((set = single_set (temp)) != 0
+ && (note = find_reg_equal_equiv_note (temp)) != 0
+ && GET_CODE (XEXP (note, 0)) != EXPR_LIST
+ /* Avoid using a register that may already been marked
+ dead by an earlier instruction. */
+ && ! unmentioned_reg_p (XEXP (note, 0), SET_SRC (set)))
+ {
+ /* Temporarily replace the set's source with the
+ contents of the REG_EQUAL note. The insn will
+ be deleted or recognized by try_combine. */
+ rtx orig = SET_SRC (set);
+ SET_SRC (set) = XEXP (note, 0);
+ next = try_combine (insn, temp, NULL_RTX,
+ &new_direct_jump_p);
+ if (next)
+ goto retry;
+ SET_SRC (set) = orig;
+ }
+ }
+
if (GET_CODE (insn) != NOTE)
record_dead_and_set_regs (insn);
@@ -12982,6 +13009,33 @@ distribute_links (rtx links)
}
}
+/* Subroutine of unmentioned_reg_p and callback from for_each_rtx.
+ Check whether the expression pointer to by LOC is a register or
+ memory, and if so return 1 if it isn't mentioned in the rtx EXPR.
+ Otherwise return zero. */
+
+static int
+unmentioned_reg_p_1 (rtx *loc, void *expr)
+{
+ rtx x = *loc;
+
+ if (x != NULL_RTX
+ && (GET_CODE (x) == REG || GET_CODE (x) == MEM)
+ && ! reg_mentioned_p (x, (rtx) expr))
+ return 1;
+ return 0;
+}
+
+/* Check for any register or memory mentioned in EQUIV that is not
+ mentioned in EXPR. This is used to restrict EQUIV to "specializations"
+ of EXPR where some registers may have been replaced by constants. */
+
+static bool
+unmentioned_reg_p (rtx equiv, rtx expr)
+{
+ return for_each_rtx (&equiv, unmentioned_reg_p_1, expr);
+}
+
/* Compute INSN_CUID for INSN, which is an insn made by combine. */
static int
diff --git a/gcc/common.opt b/gcc/common.opt
index 325ad1e4511..e04584894e4 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -152,6 +152,12 @@ Wunused-variable
Common
Warn when a variable is unused
+; APPLE LOCAL begin fat builds
+arch
+Common Separate
+
+; APPLE LOCAL end fat builds
+
aux-info
Common Separate
-aux-info <file> Emit declaration information into <file>
@@ -210,6 +216,14 @@ Align the start of loops
falign-loops=
Common RejectNegative Joined UInteger
+fall-data-deps
+Common
+Analyze all the data dependences
+
+ftree-ddg
+Common
+Enable data dependence graph
+
fargument-alias
Common
Specify that arguments may alias each other and globals
@@ -262,6 +276,16 @@ fcaller-saves
Common
Save registers around function calls
+; APPLE LOCAL begin coalescing turly
+fcoalesce
+Common
+Coalesce duplicate C++ functions and data
+
+fcoalesce-templates
+Common
+Coalesce duplicate C++ templates
+; APPLE LOCAL end coalescing turly
+
fcommon
Common
Do not put uninitialized globals in the common section
@@ -330,6 +354,12 @@ fexpensive-optimizations
Common
Perform a number of minor, expensive optimizations
+; APPLE LOCAL begin coalescing turly
+fexport-coalesced
+Common
+EXPERIMENTAL: Export coalesced symbols from dylibs
+; APPLE LOCAL end coalescing turly
+
ffast-math
Common
@@ -438,6 +468,14 @@ floop-optimize
Common
Perform loop optimizations
+floop-transpose
+Common
+Interchange loops to improve cache locality
+
+floop-optimize2
+Common
+Perform loop optimizations, new passes
+
fmath-errno
Common
Set errno after built-in math functions
@@ -482,6 +520,12 @@ fnon-call-exceptions
Common
Support synchronous non-call exceptions
+; APPLE LOCAL begin -fobey-inline
+fobey-inline
+Common
+Obey 'inline' keyword and always inline, regardless of size
+; APPLE LOCAL end -fobey-inline
+
fold-unroll-loops
Common
Perform loop unrolling when iteration count is known
@@ -506,6 +550,12 @@ fpack-struct
Common
Pack structure members together without holes
+; APPLE LOCAL begin Pascal strings 2001-07-05 zll
+fpascal-strings
+Common
+Allow Pascal-style string literals
+; APPLE LOCAL end Pascal strings 2001-07-05 zll
+
fpcc-struct-return
Common
Return small aggregates in memory, not registers
@@ -530,6 +580,12 @@ fpie
Common
Generate position-independent code for executables if possible
+; APPLE LOCAL begin -ffppc 2001-08-01 sts
+fppc
+Common
+Perform floating-point precision-control pass
+; APPLE LOCAL end -ffppc 2001-08-01 sts
+
fprefetch-loop-arrays
Common
Generate prefetch instructions, if available, for arrays in loops
@@ -581,6 +637,10 @@ freorder-blocks
Common
Reorder basic blocks to improve code placement
+freorder-blocks-and-partition
+Common
+Reorder basic blocks and partition into hot and cold sections
+
freorder-functions
Common
Reorder functions to improve code placement
@@ -597,6 +657,10 @@ frounding-math
Common
Disable optimizations that assume default FP rounding behavior
+fscalar-evolutions
+Common
+Enable the analysis of scalar evolutions on trees
+
fsched-interblock
Common
Enable scheduling across basic blocks
@@ -748,6 +812,14 @@ ftree-dse
Common
Enable dead store elimination
+ftree-elim-checks
+Common
+Eliminate checks based on scalar evolution informations
+
+ftree-loop-linear
+Common
+Enable linear loop transforms on trees
+
ftree-loop-optimize
Common
Enable loop optimizations on trees
@@ -767,6 +839,10 @@ ftree-ter
Common
Replace temporary expressions in the SSA->normal pass
+ftree-vectorize
+Common
+Enable loop vectorization on trees
+
funit-at-a-time
Common
Compile whole compilation unit at a time
@@ -803,6 +879,12 @@ fvpt
Common
Use expression value profiles in optimizations
+; APPLE LOCAL begin coalescing turly
+fweak-coalesced
+Common
+Use the OS X 10.2 'weak_definitions' attribute when coalescing
+; APPLE LOCAL end coalescing turly
+
fweb
Common
Construct webs and split unrelated uses of single variable
@@ -851,6 +933,12 @@ gxcoff+
Common JoinedOrMissing
Generate debug information in extended XCOFF format
+; APPLE LOCAL begin -header-mapfile
+header-mapfile
+Common Separate
+
+; APPLE LOCAL end -header-mapfile
+
m
Common Joined
@@ -870,6 +958,12 @@ pedantic-errors
Common
Like -pedantic but issue them as errors
+; APPLE LOCAL begin -precomp-trustfile
+precomp-trustfile
+Common Separate
+
+; APPLE LOCAL end -precomp-trustfile
+
quiet
Common
Do not display functions compiled or elapsed time
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index a4c6d8bd1da..51cc2ffc49c 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -34,37 +34,75 @@ Boston, MA 02111-1307, USA. */
/* Pragmas. */
#define BAD(msgid) do { warning (msgid); return; } while (0)
+#define BAD2(msgid, arg) do { warning (msgid, arg); return; } while (0)
static bool using_frameworks = false;
+/* APPLE LOCAL CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 turly */
+static void directive_with_named_function (const char *, void (*sec_f)(void));
+
/* Maintain a small stack of alignments. This is similar to pragma
pack's stack, but simpler. */
-static void push_field_alignment (int);
+/* APPLE LOCAL begin Macintosh alignment 2001-12-17 ff */
+static void push_field_alignment (int, int, int);
+/* APPLE LOCAL end Macintosh alignment 2001-12-17 ff */
static void pop_field_alignment (void);
static const char *find_subframework_file (const char *, const char *);
static void add_system_framework_path (char *);
-static const char *find_subframework_header (cpp_reader *pfile, const char *header);
-
+static const char *find_subframework_header (cpp_reader *pfile, const char *header,
+ cpp_dir **dirp);
+
+/* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */
+/* There are four alignment modes supported on the Apple Macintosh
+ platform: power, mac68k, natural, and packed. These modes are
+ identified as follows:
+ if maximum_field_alignment != 0
+ mode = packed
+ else if TARGET_ALIGN_NATURAL
+ mode = natural
+ else if TARGET_ALIGN_MAC68K
+ mode
+ else
+ mode = power
+ These modes are saved on the alignment stack by saving the values
+ of maximum_field_alignment, TARGET_ALIGN_MAC68K, and
+ TARGET_ALIGN_NATURAL. */
typedef struct align_stack
{
int alignment;
+ unsigned long mac68k;
+ unsigned long natural;
struct align_stack * prev;
} align_stack;
+/* APPLE LOCAL end Macintosh alignment 2002-1-22 ff */
static struct align_stack * field_align_stack = NULL;
+/* APPLE LOCAL begin Macintosh alignment 2001-12-17 ff */
static void
-push_field_alignment (int bit_alignment)
+push_field_alignment (int bit_alignment,
+ int mac68k_alignment, int natural_alignment)
{
align_stack *entry = (align_stack *) xmalloc (sizeof (align_stack));
entry->alignment = maximum_field_alignment;
+ entry->mac68k = TARGET_ALIGN_MAC68K;
+ entry->natural = TARGET_ALIGN_NATURAL;
entry->prev = field_align_stack;
field_align_stack = entry;
maximum_field_alignment = bit_alignment;
+ if (mac68k_alignment)
+ rs6000_alignment_flags |= MASK_ALIGN_MAC68K;
+ else
+ rs6000_alignment_flags &= ~MASK_ALIGN_MAC68K;
+ if (natural_alignment)
+ rs6000_alignment_flags |= MASK_ALIGN_NATURAL;
+ else
+ rs6000_alignment_flags &= ~MASK_ALIGN_NATURAL;
}
+/* APPLE LOCAL end Macintosh alignment 2001-12-17 ff */
static void
pop_field_alignment (void)
@@ -74,6 +112,16 @@ pop_field_alignment (void)
align_stack *entry = field_align_stack;
maximum_field_alignment = entry->alignment;
+/* APPLE LOCAL begin Macintosh alignment 2001-12-17 ff */
+ if (entry->mac68k)
+ rs6000_alignment_flags |= MASK_ALIGN_MAC68K;
+ else
+ rs6000_alignment_flags &= ~MASK_ALIGN_MAC68K;
+ if (entry->natural)
+ rs6000_alignment_flags |= MASK_ALIGN_NATURAL;
+ else
+ rs6000_alignment_flags &= ~MASK_ALIGN_NATURAL;
+/* APPLE LOCAL end Macintosh alignment 2001-12-17 ff */
field_align_stack = entry->prev;
free (entry);
}
@@ -111,16 +159,85 @@ darwin_pragma_options (cpp_reader *pfile ATTRIBUTE_UNUSED)
warning ("junk at end of '#pragma options'");
arg = IDENTIFIER_POINTER (t);
+/* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */
if (!strcmp (arg, "mac68k"))
- push_field_alignment (16);
+ push_field_alignment (0, 1, 0);
+ else if (!strcmp (arg, "native")) /* equivalent to power on PowerPC */
+ push_field_alignment (0, 0, 0);
+ else if (!strcmp (arg, "natural"))
+ push_field_alignment (0, 0, 1);
+ else if (!strcmp (arg, "packed"))
+ push_field_alignment (8, 0, 0);
else if (!strcmp (arg, "power"))
- push_field_alignment (0);
+ push_field_alignment (0, 0, 0);
else if (!strcmp (arg, "reset"))
pop_field_alignment ();
else
- warning ("malformed '#pragma options align={mac68k|power|reset}', ignoring");
+ warning ("malformed '#pragma options align={mac68k|power|natural|reset}', ignoring");
+/* APPLE LOCAL end Macintosh alignment 2002-1-22 ff */
}
+/* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */
+/* #pragma pack ()
+ #pragma pack (N)
+
+ We have a problem handling the semantics of these directives since,
+ to play well with the Macintosh alignment directives, we want the
+ usual pack(N) form to do a push of the previous alignment state.
+ Do we want pack() to do another push or a pop? */
+
+void
+darwin_pragma_pack (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ tree x;
+ int align = -1;
+ enum cpp_ttype token;
+ enum { set, push, pop } action;
+
+ if (c_lex (&x) != CPP_OPEN_PAREN)
+ BAD ("missing '(' after '#pragma pack' - ignored");
+ token = c_lex (&x);
+ if (token == CPP_CLOSE_PAREN)
+ {
+ action = pop; /* or "set" ??? */
+ align = 0;
+ }
+ else if (token == CPP_NUMBER)
+ {
+ align = TREE_INT_CST_LOW (x);
+ action = push;
+ if (c_lex (&x) != CPP_CLOSE_PAREN)
+ BAD ("malformed '#pragma pack' - ignored");
+ }
+ else
+ BAD ("malformed '#pragma pack' - ignored");
+
+ if (c_lex (&x) != CPP_EOF)
+ warning ("junk at end of '#pragma pack'");
+
+ switch (align)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 16:
+ align *= BITS_PER_UNIT;
+ break;
+ default:
+ BAD2 ("alignment must be a small power of two, not %d", align);
+ }
+
+ switch (action)
+ {
+ case pop: pop_field_alignment (); break;
+ case push: push_field_alignment (align, 0, 0); break;
+ case set: break;
+ }
+}
+/* APPLE LOCAL end Macintosh alignment 2002-1-22 ff */
+
/* #pragma unused ([var {, var}*]) */
void
@@ -166,11 +283,13 @@ static int max_frameworks = 0;
/* Remember which frameworks have been seen, so that we can ensure
that all uses of that framework come from the same framework. DIR
is the place where the named framework NAME, which is of length
- LEN, was found. */
+ LEN, was found. We copy the directory name from NAME, as it will be
+ freed by others. */
static void
add_framework (const char *name, size_t len, cpp_dir *dir)
{
+ char *dir_name;
int i;
for (i = 0; i < num_frameworks; ++i)
{
@@ -183,10 +302,14 @@ add_framework (const char *name, size_t len, cpp_dir *dir)
if (i >= max_frameworks)
{
max_frameworks = i*2;
+ max_frameworks += i == 0;
frameworks_in_use = xrealloc (frameworks_in_use,
max_frameworks*sizeof(*frameworks_in_use));
}
- frameworks_in_use[num_frameworks].name = name;
+ dir_name = xmalloc (len + 1);
+ memcpy (dir_name, name, len);
+ dir_name[len] = '\0';
+ frameworks_in_use[num_frameworks].name = dir_name;
frameworks_in_use[num_frameworks].len = len;
frameworks_in_use[num_frameworks].dir = dir;
++num_frameworks;
@@ -272,7 +395,8 @@ framework_construct_pathname (const char *fname, cpp_dir *dir)
if (stat (frname, &st) == 0)
{
- add_framework (fname, fname_len, dir);
+ if (fast_dir == 0)
+ add_framework (fname, fname_len, dir);
return frname;
}
}
@@ -445,7 +569,7 @@ darwin_register_frameworks (int stdinc)
returns non-zero. */
static const char*
-find_subframework_header (cpp_reader *pfile, const char *header)
+find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp)
{
const char *fname = header;
struct cpp_buffer *b;
@@ -457,10 +581,105 @@ find_subframework_header (cpp_reader *pfile, const char *header)
{
n = find_subframework_file (fname, cpp_get_path (cpp_get_file (b)));
if (n)
- return n;
+ {
+ /* Logically, the place where we found the subframework is
+ the place where we found the Framework that contains the
+ subframework. This is useful for tracking wether or not
+ we are in a system header. */
+ *dirp = cpp_get_dir (cpp_get_file (b));
+ return n;
+ }
}
return 0;
}
struct target_c_incpath_s target_c_incpath = C_INCPATH_INIT;
+
+/* APPLE LOCAL begin CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 turly */
+extern void mod_init_section (void), mod_term_section (void);
+/* Grab the function name from the pragma line and output it to the
+ assembly output file with the parameter DIRECTIVE. Called by the
+ pragma CALL_ON_LOAD and CALL_ON_UNLOAD handlers below.
+ So: "#pragma CALL_ON_LOAD foo" will output ".mod_init_func _foo". */
+
+static void directive_with_named_function (const char *pragma_name,
+ void (*section_function) (void))
+{
+ tree decl;
+ int tok;
+
+ tok = c_lex (&decl);
+ if (tok == CPP_NAME && decl)
+ {
+ extern FILE *asm_out_file;
+
+ section_function ();
+ fprintf (asm_out_file, "\t.long _%s\n", IDENTIFIER_POINTER (decl));
+
+ if (c_lex (&decl) != CPP_EOF)
+ warning ("junk at end of #pragma %s <function_name>\n", pragma_name);
+ }
+ else
+ warning ("function name expected after #pragma %s\n", pragma_name);
+}
+void
+darwin_pragma_call_on_load (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ directive_with_named_function ("CALL_ON_LOAD", mod_init_section);
+}
+void
+darwin_pragma_call_on_unload (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ directive_with_named_function ("CALL_ON_UNLOAD", mod_term_section);
+}
+/* APPLE LOCAL end CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 turly */
+
+/* APPLE LOCAL begin CALL_ON_MODULE_BIND deprecated 2002-4-10 ff */
+void
+darwin_pragma_call_on_module_bind (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ warning ("#pragma CALL_ON_MODULE_BIND is no longer supported, ignoring. "
+ "Use CALL_ON_LOAD instead.");
+}
+/* APPLE LOCAL end CALL_ON_MODULE_BIND deprecated 2002-4-10 ff */
+
+/* APPLE LOCAL begin temporary pragmas 2001-07-05 sts */
+/* These need to live only long enough to get their uses flushed out
+ of the system. */
+void
+darwin_pragma_cc_no_mach_text_sections (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ warning ("#pragma CC_NO_MACH_TEXT_SECTIONS is no longer supported, ignoring");
+}
+
+void
+darwin_pragma_cc_opt_off (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ warning ("#pragma CC_OPT_OFF is no longer supported, ignoring");
+}
+
+void
+darwin_pragma_cc_opt_on (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ warning ("#pragma CC_OPT_ON is no longer supported, ignoring");
+}
+
+void
+darwin_pragma_cc_opt_restore (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ warning ("#pragma CC_OPT_RESTORE is no longer supported, ignoring");
+}
+
+void
+darwin_pragma_cc_writable_strings (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ warning ("#pragma CC_WRITABLE_STRINGS is no longer supported, ignoring");
+}
+
+void
+darwin_pragma_cc_non_writable_strings (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ warning ("#pragma CC_NON_WRITABLE_STRINGS is no longer supported, ignoring");
+}
+/* APPLE LOCAL end temporary pragmas 2001-07-05 sts */
diff --git a/gcc/config/darwin-crt2.c b/gcc/config/darwin-crt2.c
index 1ea2413c809..5cbcdef747c 100644
--- a/gcc/config/darwin-crt2.c
+++ b/gcc/config/darwin-crt2.c
@@ -1,5 +1,5 @@
/* KeyMgr backwards-compatibility support for Darwin.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -34,6 +34,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tconfig.h"
#include "tsystem.h"
+/* This file doesn't do anything useful on non-powerpc targets, since they
+ don't have backwards compatibility anyway. */
+
+/* APPLE LOCAL IN FSF 2004-04-27 */
+#ifdef __ppc__
+
/* Homemade decls substituting for getsect.h and dyld.h, so cross
compilation works. */
struct mach_header;
@@ -149,3 +155,6 @@ __darwin_gcc3_preregister_frame_info (void)
_dyld_register_func_for_add_image (darwin_unwind_dyld_add_image_hook);
_dyld_register_func_for_remove_image (darwin_unwind_dyld_remove_image_hook);
}
+
+/* APPLE LOCAL IN FSF 2004-04-27 */
+#endif /* __ppc__ */
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
new file mode 100644
index 00000000000..cc74b314c5e
--- /dev/null
+++ b/gcc/config/darwin-driver.c
@@ -0,0 +1,989 @@
+/* Darwin driver program that handles -arch commands and invokes
+ appropriate compiler driver.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <mach-o/arch.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include "libiberty.h"
+#include "filenames.h"
+
+/* Hack!.
+ Pay the price for including darwin.h. */
+typedef int tree;
+
+/* Include darwin.h for SWITCH_TAKES_ARG and
+ WORD_SWIATCH_TAKES_ARG. */
+
+#include "darwin.h"
+
+/* Include gcc.h for DEFAULT_SWITCH_TAKES_ARG and
+ DEFAULT_WORD_SWIATCH_TAKES_ARG. */
+
+#include "gcc.h"
+
+/* This program name. */
+const char *progname;
+
+/* driver prefix. */
+const char *driver_exec_prefix;
+
+/* driver prefix length. */
+int prefix_len;
+
+/* current working directory. */
+char *curr_dir;
+
+/* Use if -o flag is absent. */
+const char *final_output = "a.out";
+
+/* Variabless to track presence and/or absence of important command
+ line options. */
+int compile_only_request = 0;
+int asm_output_request = 0;
+int preprocessed_output_request = 0;
+int ima_is_used = 0;
+int dash_dynamiclib_seen = 0;
+
+/* Support at the max 10 arch. at a time. This is historical limit. */
+#define MAX_ARCHES 10
+
+/* Name of user supplied architectures. */
+const char *arches[MAX_ARCHES];
+
+/* -arch counter. */
+static int num_arches;
+
+/* Input filenames. */
+struct input_filename
+{
+ const char *name;
+ int index;
+ struct input_filename *next;
+};
+struct input_filename *in_files;
+struct input_filename *last_infile;
+
+static int num_infiles;
+
+/* User specified output file name. */
+const char *output_filename = NULL;
+
+/* Output file names used for arch specific driver invocation. These
+ are input file names for 'lipo'. */
+const char **out_files;
+static int num_outfiles;
+
+/* Architecture names used by config.guess does not match the names
+ used by NXGet... Use this hand coded mapping to connect them. */
+struct arch_config_guess_map
+{
+ const char *arch_name;
+ const char *config_string;
+};
+
+struct arch_config_guess_map arch_config_map [] =
+{
+ {"i386", "i686"},
+ {"ppc", "powerpc"},
+ {NULL, NULL}
+};
+
+/* List of interpreted command line flags. Supply this to gcc driver. */
+const char **new_argv;
+int new_argc;
+
+/* Argument list for 'lipo'. */
+const char **lipo_argv;
+
+/* Info about the sub process. Need one subprocess for each arch plus
+ additional one for 'lipo'. */
+struct command
+{
+ const char *prog;
+ const char **argv;
+ int pid;
+} commands[MAX_ARCHES+1];
+
+/* total number of argc. */
+static int total_argc;
+
+static int greatest_status = 0;
+static int signal_count = 0;
+
+#ifndef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) DEFAULT_SWITCH_TAKES_ARG(CHAR)
+#endif
+
+#ifndef WORD_SWITCH_TAKES_ARG
+#define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
+#endif
+
+
+/* Local function prototypes. */
+static const char * get_arch_name (const char *);
+static char * get_driver_name (const char *);
+static void delete_out_files (void);
+static char * strip_path_and_suffix (const char *, const char *);
+static void initialize (void);
+static void final_cleanup (void);
+static int do_wait (int, const char *);
+static int do_lipo (int, const char *);
+static int do_compile (const char **, int);
+static int do_compile_separately (void);
+static int do_lipo_separately (void);
+static int add_arch_options (int, const char **, int);
+static int remove_arch_options (const char**, int);
+
+/* Find arch name for the given input string. If input name is NULL then local
+ arch name is used. */
+
+static const char *
+get_arch_name (const char *name)
+{
+ const NXArchInfo * a_info;
+ const NXArchInfo * all_info;
+ cpu_type_t cputype;
+
+ /* Find cputype associated with the given name. */
+ if (!name)
+ a_info = NXGetLocalArchInfo ();
+ else
+ a_info = NXGetArchInfoFromName (name);
+
+ if (!a_info)
+ abort ();
+
+ cputype = a_info->cputype;
+
+ /* Now collect ALL supported arch info. */
+ all_info = NXGetAllArchInfos ();
+
+ if (!all_info)
+ abort ();
+
+ /* Find first arch. that matches cputype. */
+ while (all_info->name)
+ {
+ if (all_info->cputype == cputype)
+ break;
+ else
+ all_info++;
+ }
+
+ return all_info->name;
+}
+
+/* Find driver name based on input arch name. */
+
+static char *
+get_driver_name (const char *arch_name)
+{
+ char *driver_name;
+ const char *config_name;
+ int len;
+ int index;
+ struct arch_config_guess_map *map;
+
+ /* find config name based on arch name. */
+ config_name = NULL;
+ map = arch_config_map;
+ while (map->arch_name)
+ {
+ if (!strcmp (map->arch_name, arch_name))
+ {
+ config_name = map->config_string;
+ break;
+ }
+ else map++;
+ }
+
+ if (!config_name)
+ abort ();
+
+ len = strlen (config_name) + strlen (PDN) + prefix_len + 1;
+ driver_name = (char *) malloc (sizeof (char) * len);
+
+ if (driver_exec_prefix)
+ strcpy (driver_name, driver_exec_prefix);
+ strcat (driver_name, config_name);
+ strcat (driver_name, PDN);
+
+ return driver_name;
+}
+
+/* Delete out_files. */
+
+static void
+delete_out_files (void)
+{
+ const char *temp;
+ struct stat st;
+ int i = 0;
+
+ for (i = 0, temp = out_files[i];
+ temp && i < total_argc * MAX_ARCHES;
+ temp = out_files[++i])
+ if (stat (temp, &st) >= 0 && S_ISREG (st.st_mode))
+ unlink (temp);
+
+}
+
+/* Put fatal error message on stderr and exit. */
+
+void
+fatal (const char *msgid, ...)
+{
+ va_list ap;
+
+ va_start (ap, msgid);
+
+ fprintf (stderr, "%s: ", progname);
+ vfprintf (stderr, msgid, ap);
+ va_end (ap);
+ fprintf (stderr, "\n");
+ delete_out_files ();
+ exit (1);
+}
+
+/* Print error message and exit. */
+
+static void
+pfatal_pexecute (const char *errmsg_fmt, const char *errmsg_arg)
+{
+ if (errmsg_arg)
+ {
+ int save_errno = errno;
+
+ /* Space for trailing '\0' is in %s. */
+ char *msg = (char *) malloc (strlen (errmsg_fmt) + strlen (errmsg_arg));
+ sprintf (msg, errmsg_fmt, errmsg_arg);
+ errmsg_fmt = msg;
+
+ errno = save_errno;
+ }
+
+ fprintf (stderr,"%s: %s: %s", progname, errmsg_fmt, xstrerror (errno));
+ delete_out_files ();
+ exit (1);
+}
+
+#ifdef DEBUG
+static void
+debug_command_line (const char **debug_argv, int debug_argc)
+{
+ int i;
+
+ fprintf (stderr,"%s: debug_command_line\n", progname);
+ fprintf (stderr,"%s: arg count = %d\n", progname, debug_argc);
+
+ for (i = 0; debug_argv[i]; i++)
+ fprintf (stderr,"%s: arg [%d] %s\n", progname, i, debug_argv[i]);
+}
+#endif
+
+/* Strip directory name from the input file name and replace file name
+ suffix with new. */
+
+static char *
+strip_path_and_suffix (const char *full_name, const char *new_suffix)
+{
+ char *name;
+ char *p;
+
+ if (!full_name || !new_suffix)
+ return NULL;
+
+ /* Strip path name. */
+ p = (char *)full_name + strlen (full_name);
+ while (p != full_name && !IS_DIR_SEPARATOR (p[-1]))
+ --p;
+
+ /* Now 'p' is a file name with suffix. */
+ name = (char *) malloc (strlen (p) + 1 + strlen (new_suffix));
+
+ name = p;
+
+ p = name + strlen (name);
+ while (p != name && *p != '.')
+ --p;
+
+ /* If did not reach at the beginning of name then '.' is found.
+ Replace '.' with NULL. */
+ if (p != name)
+ *p = '\0';
+
+ strcat (name, new_suffix);
+ return name;
+}
+
+/* Initialization */
+
+static void
+initialize (void)
+{
+
+ int i;
+
+ /* Let's count, how many additional arguments driver driver will supply
+ to compiler driver:
+
+ Each "-arch" "<blah>" is replaced by approriate "-mcpu=<blah>".
+ That leaves one additional arg space available.
+
+ Note that only one -m* is supplied to each compiler driver. Which
+ means, extra "-arch" "<blah>" are removed from the original command
+ line. But lets not count how many additional slots are available.
+
+ Driver driver may need to specify temp. output file name, say
+ "-o" "foobar". That needs two extra argments.
+
+ Sometimes linker wants one additional "-Wl,-arch_multiple".
+
+ Sometimes linker wants to see "-final_output" "outputname".
+
+ In the end, We need FOUR extra argument. */
+
+ new_argv = (const char **) malloc ((total_argc + 4) * sizeof (const char *));
+ if (!new_argv)
+ abort ();
+
+ /* First slot, new_argv[0] is reserved for the driver name. */
+ new_argc = 1;
+
+ /* For each -arch, three arguments are needed.
+ For example, "-arch" "ppc" "file". Additional slots are for
+ "lipo" "-create" "-o" and "outputfilename". */
+ lipo_argv = (const char **) malloc ((total_argc * 3 + 5) * sizeof (const char *));
+ if (!lipo_argv)
+ abort ();
+
+ /* Need separate out_files for each arch, max is MAX_ARCHES.
+ Need separate out_files for each input file. */
+
+ out_files = (const char **) malloc ((total_argc * MAX_ARCHES) * sizeof (const char *));
+ if (!out_files)
+ abort ();
+
+ num_arches = 0;
+ num_infiles = 0;
+
+ in_files = NULL;
+ last_infile = NULL;
+
+ for (i = 0; i < (MAX_ARCHES + 1); i++)
+ {
+ commands[i].prog = NULL;
+ commands[i].argv = NULL;
+ commands[i].pid = 0;
+ }
+}
+
+/* Cleanup. */
+
+static void
+final_cleanup (void)
+{
+ int i;
+ struct input_filename *next;
+ delete_out_files ();
+ free (new_argv);
+ free (lipo_argv);
+ free (out_files);
+
+ for (i = 0, next = in_files;
+ i < num_infiles && next;
+ i++)
+ {
+ next = in_files->next;
+ free (in_files);
+ in_files = next;
+ }
+}
+
+/* Wait for the process pid and return appropriate code. */
+
+static int
+do_wait (int pid, const char *prog)
+{
+ int status = 0;
+ int ret = 0;
+
+ pid = pwait (pid, &status, 0);
+
+ if (WIFSIGNALED (status))
+ {
+ if (!signal_count &&
+ WEXITSTATUS (status) > greatest_status)
+ greatest_status = WEXITSTATUS (status);
+ ret = -1;
+ }
+ else if (WIFEXITED (status)
+ && WEXITSTATUS (status) >= 1)
+ {
+ if (WEXITSTATUS (status) > greatest_status)
+ greatest_status = WEXITSTATUS (status);
+ signal_count++;
+ ret = -1;
+ }
+ return ret;
+}
+
+/* Invoke 'lipo' and combine and all output files. */
+
+static int
+do_lipo (int start_outfile_index, const char *out_file)
+{
+ int i, j, pid;
+ char *errmsg_fmt, *errmsg_arg;
+
+ /* Populate lipo arguments. */
+ lipo_argv[0] = "lipo";
+ lipo_argv[1] = "-create";
+ lipo_argv[2] = "-o";
+ lipo_argv[3] = out_file;
+
+ /* Already 4 lipo arguments are set. Now add all lipo inputs. */
+ j = 4;
+ for (i = 0; i < num_arches; i++)
+ {
+ lipo_argv[j++] = "-arch";
+ lipo_argv[j++] = arches[i];
+ lipo_argv[j++] = out_files[start_outfile_index + i];
+ }
+
+#ifdef DEBUG
+ debug_command_line (lipo_argv, j);
+#endif
+
+ pid = pexecute (lipo_argv[0], (char *const *)lipo_argv, progname, NULL, &errmsg_fmt,
+ &errmsg_arg, PEXECUTE_SEARCH | PEXECUTE_LAST);
+
+ if (pid == -1)
+ pfatal_pexecute (errmsg_fmt, errmsg_arg);
+
+ return do_wait (pid, lipo_argv[0]);
+}
+
+/* Invoke compiler for all architectures. */
+
+static int
+do_compile (const char **current_argv, int current_argc)
+{
+ char *errmsg_fmt, *errmsg_arg;
+ int index = 0;
+ int ret = 0;
+
+ int dash_o_index = current_argc;
+ int of_index = current_argc + 1;
+ int argc_count = current_argc + 2;
+
+ while (index < num_arches)
+ {
+ int additional_arch_options = 0;
+
+ current_argv[0] = get_driver_name (get_arch_name (arches[index]));
+
+ /* setup output file. */
+ out_files[num_outfiles] = make_temp_file (".out");
+ current_argv[dash_o_index] = "-o";
+ current_argv[of_index] = out_files [num_outfiles];
+ num_outfiles++;
+
+ /* Add arch option as the last option. Do not add any other option
+ before removing this option. */
+ additional_arch_options = add_arch_options (index, current_argv, argc_count);
+
+ commands[index].prog = current_argv[0];
+ commands[index].argv = current_argv;
+
+#ifdef DEBUG
+ debug_command_line (current_argv, of_index);
+#endif
+ commands[index].pid = pexecute (current_argv[0],
+ (char *const *)current_argv,
+ progname, NULL,
+ &errmsg_fmt,
+ &errmsg_arg,
+ PEXECUTE_SEARCH | PEXECUTE_LAST);
+
+ if (commands[index].pid == -1)
+ pfatal_pexecute (errmsg_fmt, errmsg_arg);
+
+ /* Remove the last arch option added in the current_argv list. */
+ if (additional_arch_options)
+ remove_arch_options (current_argv, argc_count);
+ index++;
+ }
+
+ index = 0;
+ while (index < num_arches)
+ {
+ ret = do_wait (commands[index].pid, commands[index].prog);
+ fflush (stdout);
+ index++;
+ }
+ return ret;
+}
+
+/* Invoke compiler for each input file separately.
+ Construct command line for each invocation with one input file. */
+
+static int
+do_compile_separately (void)
+{
+ const char **new_new_argv;
+ int i, new_new_argc;
+ struct input_filename *current_ifn;
+
+ if (num_infiles == 1 || ima_is_used)
+ abort ();
+
+ /* Total number of arguments in separate compiler invocation is :
+ total number of original arguments - total no input files + one input
+ file + "-o" + output file . */
+ new_new_argv = (const char **) malloc ((new_argc - num_infiles + 4) * sizeof (const char *));
+ if (!new_new_argv)
+ abort ();
+
+ for (current_ifn = in_files; current_ifn && current_ifn->name;
+ current_ifn = current_ifn->next)
+ {
+ struct input_filename *ifn = in_files;
+ int go_back = 0;
+ new_new_argc = 1;
+
+ for (i = 1; i < new_argc; i++)
+ {
+
+ if (ifn && ifn->name && !strcmp (new_argv[i], ifn->name))
+ {
+ /* This argument is one of the input file. */
+
+ if (!strcmp (new_argv[i], current_ifn->name))
+ {
+ /* If it is current input file name then add it in the new
+ list. */
+ new_new_argv[new_new_argc++] = new_argv[i];
+ }
+ /* This input file can not appear in
+ again on the command line so next time look for next input
+ file. */
+ ifn = ifn->next;
+ }
+ else
+ {
+ /* This argument is not a input file name. Add it into new
+ list. */
+ new_new_argv[new_new_argc++] = new_argv[i];
+ }
+ }
+
+ /* OK now we have only one input file and all other arguments. */
+ do_compile (new_new_argv, new_new_argc);
+ }
+}
+
+/* Invoke 'lipo' on set of output files and create multile FAT binaries. */
+
+static int
+do_lipo_separately (void)
+{
+ int ifn_index;
+ struct input_filename *ifn;
+ for (ifn_index = 0, ifn = in_files;
+ ifn_index < num_infiles && ifn && ifn->name;
+ ifn_index++, ifn = ifn->next)
+ do_lipo (ifn_index * num_arches,
+ strip_path_and_suffix (ifn->name, ".o"));
+}
+
+/* Replace -arch <blah> options with appropriate "-mcpu=<blah>" OR
+ "-march=<blah>". INDEX is the index in arches[] table. */
+
+static int
+add_arch_options (int index, const char **current_argv, int arch_index)
+{
+
+ int count;
+
+ /* We are adding 1 argument for selected arches. */
+ count = 1;
+
+#ifdef DEBUG
+ fprintf (stderr, "%s: add_arch_options\n", progname);
+#endif
+
+ if (!strcmp (arches[index], "ppc601"))
+ current_argv[arch_index] = "-mcpu=601";
+ else if (!strcmp (arches[index], "ppc603"))
+ current_argv[arch_index] = "-mcpu=603";
+ else if (!strcmp (arches[index], "ppc604"))
+ current_argv[arch_index] = "-mcpu=604";
+ else if (!strcmp (arches[index], "ppc604e"))
+ current_argv[arch_index] = "-mcpu=604e";
+ else if (!strcmp (arches[index], "ppc750"))
+ current_argv[arch_index] = "-mcpu=750";
+ else if (!strcmp (arches[index], "ppc7400"))
+ current_argv[arch_index] = "-mcpu=7400";
+ else if (!strcmp (arches[index], "ppc7450"))
+ current_argv[arch_index] = "-mcpu=7450";
+ else if (!strcmp (arches[index], "ppc970"))
+ current_argv[arch_index] = "-mcpu=970";
+ else if (!strcmp (arches[index], "i386"))
+ current_argv[arch_index] = "-march=i386";
+ else if (!strcmp (arches[index], "i486"))
+ current_argv[arch_index] = "-march=i486";
+ else if (!strcmp (arches[index], "i586"))
+ current_argv[arch_index] = "-march=i586";
+ else if (!strcmp (arches[index], "i686"))
+ current_argv[arch_index] = "-march=i686";
+ else if (!strcmp (arches[index], "pentium"))
+ current_argv[arch_index] = "-march=pentium";
+ else if (!strcmp (arches[index], "pentpro"))
+ current_argv[arch_index] = "-march=pentiumpro";
+ else if (!strcmp (arches[index], "pentIIm3"))
+ current_argv[arch_index] = "-march=pentium3";
+ else
+ count = 0;
+
+ return count;
+}
+
+/* Remove the last option, which is arch option, added by
+ add_arch_options. Return how count of arguments removed. */
+static int
+remove_arch_options (const char **current_argv, int arch_index)
+{
+#ifdef DEBUG
+ fprintf (stderr, "%s: Removing argument no %d\n", progname, arch_index);
+#endif
+
+ current_argv[arch_index] = '\0';
+
+#ifdef DEBUG
+ debug_command_line (current_argv, arch_index);
+#endif
+
+ return 1;
+}
+
+/* Main entry point. This is gcc driver driver!
+ Interpret -arch flag from the list of input arguments. Invoke appropriate
+ compiler driver. 'lipo' the results if more than one -arch is supplied. */
+int
+main (int argc, const char **argv)
+{
+ size_t i;
+ int l, pid, ret, argv_0_len, prog_len;
+ char *errmsg_fmt, *errmsg_arg;
+
+ total_argc = argc;
+ argv_0_len = strlen (argv[0]);
+ prog_len = 0;
+
+ /* Get the progname, required by pexecute () and program location. */
+ progname = argv[0] + argv_0_len;
+ while (progname != argv[0] && !IS_DIR_SEPARATOR (progname[-1]))
+ {
+ prog_len++;
+ --progname;
+ }
+
+ /* Setup driver prefix. */
+ prefix_len = argv_0_len - prog_len;
+ curr_dir = (char *) malloc (sizeof (char) * (prefix_len + 1));
+ strncpy (curr_dir, argv[0], prefix_len);
+ curr_dir[prefix_len] = '\0';
+ driver_exec_prefix = (argv[0], "/usr/bin", curr_dir);
+
+#ifdef DEBUG
+ fprintf (stderr,"%s: full progname = %s\n", progname, argv[0]);
+ fprintf (stderr,"%s: progname = %s\n", progname, progname);
+ fprintf (stderr,"%s: driver_exec_prefix = %s\n", progname, driver_exec_prefix);
+#endif
+
+ initialize ();
+
+ /* Process arguments. Take appropriate actions when
+ -arch, -c, -S, -E, -o is encountered. Find input file name. */
+ for (i = 1; i < argc; i++)
+ {
+ if (!strcmp (argv[i], "-arch"))
+ {
+ if (i + 1 >= argc)
+ abort ();
+
+ /* arches[num_arches] = get_arch_name (argv[i+1]);*/
+ arches[num_arches] = argv[i+1];
+
+ num_arches++;
+ i++;
+ }
+ else if (!strcmp (argv[i], "-c"))
+ {
+ new_argv[new_argc++] = argv[i];
+ compile_only_request = 1;
+ }
+ else if (!strcmp (argv[i], "-S"))
+ {
+ new_argv[new_argc++] = argv[i];
+ asm_output_request = 1;
+ }
+ else if (!strcmp (argv[i], "-E"))
+ {
+ new_argv[new_argc++] = argv[i];
+ preprocessed_output_request = 1;
+ }
+ else if (!strcmp (argv[i], "-dynamiclib"))
+ {
+ new_argv[new_argc++] = argv[i];
+ dash_dynamiclib_seen = 1;
+ }
+
+ else if (!strcmp (argv[i], "-o"))
+ {
+ if (i + 1 >= argc)
+ abort ();
+
+ output_filename = argv[i+1];
+ i++;
+ }
+ else if ((! strcmp (argv[i], "-pass-exit-codes"))
+ || (! strcmp (argv[i], "-print-search-dirs"))
+ || (! strcmp (argv[i], "-print-libgcc-file-name"))
+ || (! strncmp (argv[i], "-print-file-name=", 17))
+ || (! strncmp (argv[i], "-print-prog-name=", 17))
+ || (! strcmp (argv[i], "-print-multi-lib"))
+ || (! strcmp (argv[i], "-print-multi-directory"))
+ || (! strcmp (argv[i], "-print-multi-os-directory"))
+ || (! strcmp (argv[i], "-ftarget-help"))
+ || (! strcmp (argv[i], "-fhelp"))
+ || (! strcmp (argv[i], "+e"))
+ || (! strncmp (argv[i], "-Wa,",4))
+ || (! strncmp (argv[i], "-Wp,",4))
+ || (! strncmp (argv[i], "-Wl,",4))
+ || (! strncmp (argv[i], "-l", 2))
+ || (! strncmp (argv[i], "-weak-l", 7))
+ || (! strncmp (argv[i], "-specs=", 7))
+ || (! strcmp (argv[i], "-ObjC"))
+ || (! strcmp (argv[i], "-fobjC"))
+ || (! strcmp (argv[i], "-ObjC++"))
+ || (! strcmp (argv[i], "-time"))
+ || (! strcmp (argv[i], "-###"))
+ || (! strcmp (argv[i], "-fconstant-cfstrings"))
+ || (! strcmp (argv[i], "-fno-constant-cfstrings"))
+ || (! strcmp (argv[i], "-save-temps"))
+ || (! strcmp (argv[i], "-static-libgcc"))
+ || (! strcmp (argv[i], "-shared-libgcc"))
+ || (! strcmp (argv[i], "-pipe"))
+ )
+ {
+ new_argv[new_argc++] = argv[i];
+ }
+ else if ((! strcmp (argv[i], "-Xlinker"))
+ || (! strcmp (argv[i], "-Xassembler"))
+ || (! strcmp (argv[i], "-Xpreprocessor"))
+ || (! strcmp (argv[i], "-l"))
+ || (! strcmp (argv[i], "-weak_library"))
+ || (! strcmp (argv[i], "-weak_framework"))
+ || (! strcmp (argv[i], "-specs"))
+ || (! strcmp (argv[i], "-framework"))
+ )
+ {
+ new_argv[new_argc++] = argv[i];
+ i++;
+ new_argv[new_argc++] = argv[i];
+ }
+ else if (argv[i][0] == '-' && argv[i][1] != 0)
+ {
+ const char *p = &argv[i][1];
+ int c = *p;
+
+ /* First copy this flag itself. */
+ new_argv[new_argc++] = argv[i];
+
+ /* Now copy this flag's arguments, if any, appropriately. */
+ if (c == 'x')
+ {
+ if (p[1] == 0 && i + 1 == argc)
+ fatal ("argument to `-x` is missing");
+
+ if (p[1] == 0)
+ {
+ i++;
+ new_argv[new_argc++] = argv[i];
+ }
+ }
+
+ if ((SWITCH_TAKES_ARG (c) > (p[1] != 0))
+ || WORD_SWITCH_TAKES_ARG (p))
+ {
+ int j = 0;
+ int n_args = WORD_SWITCH_TAKES_ARG (p);
+ if (n_args == 0)
+ {
+ /* Count only the option arguments in separate argv elements. */
+ n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
+ }
+ if (i + n_args >= argc)
+ fatal ("argument to `-%s' is missing", p);
+
+
+ while ( j < n_args)
+ {
+ i++;
+ new_argv[new_argc++] = argv[i];
+ j++;
+ }
+ }
+
+ }
+ else
+ {
+ struct input_filename *ifn;
+ new_argv[new_argc++] = argv[i];
+ ifn = (struct input_filename *) malloc (sizeof (struct input_filename));
+ ifn->name = argv[i];
+ ifn->index = i;
+ num_infiles++;
+
+ if (last_infile)
+ last_infile->next = ifn;
+ else
+ in_files = ifn;
+
+ last_infile = ifn;
+ }
+ }
+
+#if 0
+ if (num_infiles == 0)
+ fatal ("no input files");
+#endif
+
+ if (preprocessed_output_request && asm_output_request && num_infiles > 1)
+ fatal ("-E and -S are not allowed with multiple -arch flags");
+
+ /* If -arch is not present OR Only one -arch <blah> is specified.
+ Invoke appropriate compiler driver. FAT build is not required in this
+ case. */
+
+ if (num_arches == 0 || num_arches == 1)
+ {
+
+ /* If no -arch is specified than use host compiler driver. */
+ if (num_arches == 0)
+ new_argv[0] = get_driver_name (get_arch_name (NULL));
+ else if (num_arches == 1)
+ {
+ /* Find compiler driver based on -arch <foo> and add approriate
+ -m* argument. */
+ new_argv[0] = get_driver_name (get_arch_name (arches[0]));
+ new_argc = new_argc + add_arch_options (0, new_argv, new_argc);
+ }
+
+
+#ifdef DEBUG
+ printf ("%s: invoking single driver name = %s\n", progname, new_argv[0]);
+#endif
+
+ /* Re insert output file name. */
+ if (!compile_only_request || output_filename)
+ {
+ new_argv[new_argc++] = "-o";
+ new_argv[new_argc++] = (output_filename ?
+ output_filename : final_output);
+ }
+
+#ifdef DEBUG
+ debug_command_line (new_argv, new_argc);
+#endif
+
+ pid = pexecute (new_argv[0], (char *const *)new_argv, progname, NULL,
+ &errmsg_fmt, &errmsg_arg, PEXECUTE_SEARCH | PEXECUTE_LAST);
+
+ if (pid == -1)
+ pfatal_pexecute (errmsg_fmt, errmsg_arg);
+
+ ret = do_wait (pid, new_argv[0]);
+ }
+ else
+ {
+ /* Handle multiple -arch <blah>. */
+
+ /* If more than one input files are supplied but only one output filename
+ is pressent then IMA will be used. */
+ if (num_infiles > 1 && output_filename)
+ ima_is_used = 1;
+
+ /* Linker wants to know this in case of multiple -arch. */
+ if (!compile_only_request && !dash_dynamiclib_seen)
+ new_argv[new_argc++] = "-Wl,-arch_multiple";
+
+
+ /* If only one input file is specified OR IMA is used then expected output
+ is one FAT binary. */
+ if (num_infiles == 1 || ima_is_used)
+ {
+ const char *out_file;
+
+ /* Create output file name based on
+ input filename, if required. */
+ if (compile_only_request && !output_filename && num_infiles == 1)
+ out_file = strip_path_and_suffix (in_files->name, ".o");
+ else
+ out_file = (output_filename ? output_filename : final_output);
+
+
+ /* Linker wants to know name of output file using one extra arg. */
+ if (!compile_only_request)
+ {
+ new_argv[new_argc++] = "-final_output";
+ new_argv[new_argc++] = out_file;
+ }
+
+ /* Compile file(s) for each arch and lipo 'em together. */
+ ret = do_compile (new_argv, new_argc);
+
+ /* Make FAT binary by combining individual output files for each
+ architecture, using 'lipo'. */
+ ret = do_lipo (0, out_file);
+ }
+ else
+ {
+ /* Multiple input files are present and IMA is not used.
+ Which means need to generate multiple FAT files. */
+ ret = do_compile_separately ();
+ ret = do_lipo_separately ();
+ }
+ }
+
+ final_cleanup ();
+ free (curr_dir);
+ return greatest_status;
+}
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 28660339488..cfe0a326eb7 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -25,6 +25,8 @@ extern void machopic_validate_stub_or_non_lazy_ptr (const char *, int);
extern const char *machopic_function_base_name (void);
extern void machopic_output_function_base_name (FILE *);
extern const char *machopic_stub_name (const char*);
+/* APPLE LOCAL coalescing */
+extern int machopic_var_referred_to_p (const char*);
extern void machopic_picsymbol_stub_section (void);
extern void machopic_picsymbol_stub1_section (void);
@@ -75,6 +77,34 @@ extern void darwin_pragma_ignore (struct cpp_reader *);
extern void darwin_pragma_options (struct cpp_reader *);
extern void darwin_pragma_unused (struct cpp_reader *);
+/* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */
+extern void darwin_pragma_pack (struct cpp_reader *);
+/* APPLE LOCAL end Macintosh alignment 2002-1-22 ff */
+/* APPLE LOCAL begin CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 turly */
+extern void darwin_pragma_call_on_load (struct cpp_reader *);
+extern void darwin_pragma_call_on_unload (struct cpp_reader *);
+/* APPLE LOCAL end CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 turly */
+/* APPLE LOCAL begin CALL_ON_MODULE_BIND deprecated 2002-4-10 ff */
+extern void darwin_pragma_call_on_module_bind (struct cpp_reader *);
+/* APPLE LOCAL end CALL_ON_MODULE_BIND deprecated 2002-4-10 ff */
+/* APPLE LOCAL begin temporary pragmas 2001-07-05 sts */
+extern void darwin_pragma_cc_no_mach_text_sections (struct cpp_reader *);
+extern void darwin_pragma_cc_opt_off (struct cpp_reader *);
+extern void darwin_pragma_cc_opt_on (struct cpp_reader *);
+extern void darwin_pragma_cc_opt_restore (struct cpp_reader *);
+extern void darwin_pragma_cc_writable_strings (struct cpp_reader *);
+extern void darwin_pragma_cc_non_writable_strings (struct cpp_reader *);
+/* APPLE LOCAL end temporary pragmas 2001-07-05 sts */
+
+/* APPLE LOCAL begin coalescing */
+extern void darwin_asm_named_section (const char *, unsigned int);
+extern unsigned int darwin_section_type_flags (tree, const char *, int);
+extern int darwin_set_section_for_var_p (tree, int, int);
+/* APPLE LOCAL end coalescing */
+
+/* APPLE LOCAL double destructor */
+extern tree darwin_handle_odd_attribute (tree *, tree, tree, int, bool *);
+
extern void darwin_file_end (void);
/* Expanded by EXTRA_SECTION_FUNCTIONS into varasm.o. */
@@ -108,6 +138,8 @@ extern void objc_class_names_section (void);
extern void objc_meth_var_names_section (void);
extern void objc_meth_var_types_section (void);
extern void objc_cls_refs_section (void);
+/* APPLE LOCAL constant cfstrings */
+extern void cfstring_constant_object_section (void);
extern void machopic_lazy_symbol_ptr_section (void);
extern void machopic_nl_symbol_ptr_section (void);
extern void machopic_symbol_stub_section (void);
@@ -119,3 +151,11 @@ extern void darwin_globalize_label (FILE *, const char *);
extern void darwin_assemble_visibility (tree, int);
extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *,
const char *);
+/* APPLE LOCAL C++ EH */
+extern void darwin_non_lazy_pcrel (FILE *file, rtx addr);
+
+/* APPLE LOCAL begin constant cfstrings */
+extern void darwin_init_cfstring_builtins (void);
+extern tree darwin_expand_tree_builtin (tree, tree, tree);
+extern tree darwin_construct_objc_string (tree);
+/* APPLE LOCAL end constant cfstrings */
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 858d150d45e..00e393182f9 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -42,11 +42,66 @@ Boston, MA 02111-1307, USA. */
#include "langhooks.h"
#include "tm_p.h"
#include "errors.h"
+/* APPLE LOCAL begin constant cfstrings */
+#include "hashtab.h"
+#include "toplev.h"
+
+static tree darwin_build_constant_cfstring (tree);
+/* APPLE LOCAL end constant cfstrings */
static int machopic_data_defined_p (const char *);
static void update_non_lazy_ptrs (const char *);
static void update_stubs (const char *);
-static const char *machopic_non_lazy_ptr_name (const char*);
+const char *machopic_non_lazy_ptr_name (const char*);
+
+/* APPLE LOCAL prototypes */
+static tree machopic_non_lazy_ptr_list_entry PARAMS ((const char*, int));
+static tree machopic_stub_list_entry PARAMS ((const char *));
+
+/* APPLE LOCAL begin coalescing */
+void
+make_decl_coalesced (tree decl, int private_extern_p)
+ /* 0 for global, 1 for private extern */
+{
+ int no_toc_p = 1; /* Don't add to table of contents */
+#if 0
+ const char *decl_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+#endif
+ static const char *const names[4] = {
+ "__TEXT,__textcoal,coalesced",
+ "__TEXT,__textcoal_nt,coalesced,no_toc",
+ "__DATA,__datacoal,coalesced",
+ "__DATA,__datacoal_nt,coalesced,no_toc",
+ };
+ const char *sec;
+ int idx;
+
+ /* Do nothing if coalescing is disabled. */
+ if (!COALESCING_ENABLED_P())
+ return;
+
+ /* We *do* need to mark these *INTERNAL* functions coalesced: though
+ these pseudo-functions themselves will never appear, their cloned
+ descendants need to be marked coalesced too. */
+#if 0
+ /* Don't touch anything with " *INTERNAL" in its name. */
+ if (strstr (decl_name, " *INTERNAL") != NULL)
+ return;
+#endif
+
+ DECL_COALESCED (decl) = 1;
+ if (private_extern_p)
+ DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
+ TREE_PUBLIC (decl) = 1;
+
+ idx = 0;
+ if (TREE_CODE (decl) != FUNCTION_DECL)
+ idx = 2;
+ sec = names[idx + (no_toc_p ? 1 : 0)];
+
+ DECL_SECTION_NAME (decl) = build_string (strlen (sec), sec);
+}
+/* APPLE LOCAL end coalescing */
int
name_needs_quotes (const char *name)
@@ -187,6 +242,14 @@ machopic_ident_defined_p (tree ident)
static int
machopic_data_defined_p (const char *name)
{
+ /* APPLE LOCAL BEGIN fix-and-continue mrs */
+#ifndef TARGET_INDIRECT_ALL_DATA
+#define TARGET_INDIRECT_ALL_DATA 0
+#endif
+ if (TARGET_INDIRECT_ALL_DATA)
+ return 0;
+ /* APPLE LOCAL END fix-and-continue mrs */
+
switch (machopic_classify_ident (get_identifier (name)))
{
case MACHOPIC_DEFINED_DATA:
@@ -264,18 +327,19 @@ static GTY(()) tree machopic_non_lazy_pointers;
either by finding it in our list of pointer names, or by generating
a new one. */
-static const char *
-machopic_non_lazy_ptr_name (const char *name)
+/* APPLE LOCAL weak import */
+/* machopic_non_lazy_ptr_list_entry separated from machopic_non_lazy_ptr_name */
+static tree
+machopic_non_lazy_ptr_list_entry (const char *name, int create_p)
{
- const char *temp_name;
- tree temp, ident = get_identifier (name);
-
+ tree temp, ident = (create_p) ? get_identifier (name) : NULL;
+
for (temp = machopic_non_lazy_pointers;
temp != NULL_TREE;
temp = TREE_CHAIN (temp))
{
if (ident == TREE_VALUE (temp))
- return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
+ return temp;
}
name = darwin_strip_name_encoding (name);
@@ -287,14 +351,14 @@ machopic_non_lazy_ptr_name (const char *name)
{
if (TREE_VALUE (temp))
{
- temp_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
+ const char *temp_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
temp_name = darwin_strip_name_encoding (temp_name);
if (strcmp (name, temp_name) == 0)
- return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
+ return temp;
}
}
- {
+ if (create_p) {
char *buffer;
int namelen = strlen (name);
int bufferlen = 0;
@@ -325,17 +389,39 @@ machopic_non_lazy_ptr_name (const char *name)
TREE_USED (machopic_non_lazy_pointers) = 0;
- return IDENTIFIER_POINTER (ptr_name);
+ return machopic_non_lazy_pointers;
}
+
+ return NULL;
+}
+
+/* APPLE LOCAL begin coalescing */
+/* Was the variable NAME ever referenced? */
+int
+machopic_var_referred_to_p (const char *name)
+{
+ return (machopic_non_lazy_ptr_list_entry (name, /*create:*/ 0) != NULL);
}
+/* APPLE LOCAL end coalescing */
+
+/* APPLE LOCAL begin weak import */
+const char *
+machopic_non_lazy_ptr_name (const char *name)
+{
+ return IDENTIFIER_POINTER (TREE_PURPOSE
+ (machopic_non_lazy_ptr_list_entry (name, /*create:*/ 1)));
+}
+/* APPLE LOCAL end weak import */
static GTY(()) tree machopic_stubs;
/* Return the name of the stub corresponding to the given name,
generating a new stub name if necessary. */
-const char *
-machopic_stub_name (const char *name)
+/* APPLE LOCAL begin weak import */
+/* machopic_stub_list_entry separated from machopic_stub_name */
+static tree
+machopic_stub_list_entry (const char *name)
{
tree temp, ident = get_identifier (name);
const char *tname;
@@ -345,16 +431,22 @@ machopic_stub_name (const char *name)
temp = TREE_CHAIN (temp))
{
if (ident == TREE_VALUE (temp))
- return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
+ return temp;
tname = IDENTIFIER_POINTER (TREE_VALUE (temp));
if (strcmp (name, tname) == 0)
- return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
+ return temp;
+
+ /* APPLE LOCAL Stripped encodings ('!T_' and '!t_') should match. */
+ if (name [0] == '!' && tname[0] == '!'
+ && strcmp (name + 4, tname + 4) == 0)
+ return temp;
+
/* A library call name might not be section-encoded yet, so try
it against a stripped name. */
if (name[0] != '!'
&& tname[0] == '!'
&& strcmp (name, tname + 4) == 0)
- return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
+ return temp;
}
name = darwin_strip_name_encoding (name);
@@ -406,10 +498,17 @@ machopic_stub_name (const char *name)
machopic_stubs = tree_cons (ptr_name, ident, machopic_stubs);
TREE_USED (machopic_stubs) = 0;
- return IDENTIFIER_POINTER (ptr_name);
+ return machopic_stubs;
}
}
+const char *
+machopic_stub_name (const char *name)
+{
+ return IDENTIFIER_POINTER (TREE_PURPOSE (machopic_stub_list_entry (name)));
+}
+/* APPLE LOCAL end weak import */
+
void
machopic_validate_stub_or_non_lazy_ptr (const char *name, int validate_stub)
{
@@ -448,6 +547,8 @@ machopic_indirect_data_reference (rtx orig, rtx reg)
if (GET_CODE (orig) == SYMBOL_REF)
{
const char *name = XSTR (orig, 0);
+ /* APPLE LOCAL weak import */
+ tree sym;
int defined = machopic_data_defined_p (name);
if (defined && MACHO_DYNAMIC_NO_PIC_P)
@@ -499,8 +600,14 @@ machopic_indirect_data_reference (rtx orig, rtx reg)
return orig;
}
+ /* APPLE LOCAL weak import */
+ sym = machopic_non_lazy_ptr_list_entry (name, /*create:*/ 1);
+ IDENTIFIER_WEAK_IMPORT (TREE_PURPOSE (sym)) =
+ IDENTIFIER_WEAK_IMPORT (TREE_VALUE (sym)) =
+ SYMBOL_REF_WEAK_IMPORT (orig);
+
ptr_ref = gen_rtx_SYMBOL_REF (Pmode,
- machopic_non_lazy_ptr_name (name));
+ IDENTIFIER_POINTER (TREE_PURPOSE (sym)));
ptr_ref = gen_rtx_MEM (Pmode, ptr_ref);
RTX_UNCHANGING_P (ptr_ref) = 1;
@@ -585,9 +692,14 @@ machopic_indirect_call_target (rtx target)
if (!machopic_name_defined_p (name))
{
- const char *stub_name = machopic_stub_name (name);
-
- XEXP (target, 0) = gen_rtx_SYMBOL_REF (mode, stub_name);
+ /* APPLE LOCAL weak import */
+ tree stub = machopic_stub_list_entry (name);
+ IDENTIFIER_WEAK_IMPORT (TREE_PURPOSE (stub)) =
+ IDENTIFIER_WEAK_IMPORT (TREE_VALUE (stub)) =
+ SYMBOL_REF_WEAK_IMPORT (XEXP (target, 0));
+
+ XEXP (target, 0) = gen_rtx_SYMBOL_REF (mode,
+ IDENTIFIER_POINTER (TREE_PURPOSE (stub)));
RTX_UNCHANGING_P (target) = 1;
}
}
@@ -855,6 +967,43 @@ machopic_legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
if (RTX_UNCHANGING_P (base) && RTX_UNCHANGING_P (orig))
RTX_UNCHANGING_P (pic_ref) = 1;
+ /* APPLE LOCAL begin gen ADD */
+#ifdef MASK_80387
+ {
+ rtx mem, other;
+
+ if (GET_CODE (orig) == MEM) {
+ mem = orig; other = base;
+ /* Swap the kids only if there is only one MEM, and it's on the right. */
+ if (GET_CODE (base) != MEM) {
+ XEXP (pic_ref, 0) = orig;
+ XEXP (pic_ref, 1) = base;
+ }
+ }
+ else if (GET_CODE (base) == MEM) {
+ mem = base; other = orig;
+ } else
+ mem = other = NULL_RTX;
+
+ /* Both kids are MEMs. */
+ if (other && GET_CODE (other) == MEM)
+ other = force_reg (GET_MODE (other), other);
+
+ /* The x86 can't post-index a MEM; emit an ADD instruction to handle this. */
+ if (mem && GET_CODE (mem) == MEM) {
+ if ( ! reload_in_progress) {
+ rtx set = gen_rtx_SET (VOIDmode, reg, pic_ref);
+ rtx clobber_cc = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
+ pic_ref = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber_cc));
+ emit_insn (pic_ref);
+ pic_ref = reg;
+ is_complex = 0;
+ }
+ }
+ }
+#endif
+ /* APPLE LOCAL end gen ADD */
+
if (reg && is_complex)
{
emit_move_insn (reg, pic_ref);
@@ -871,7 +1020,12 @@ machopic_legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
else if (GET_CODE (orig) == MEM
&& GET_CODE (XEXP (orig, 0)) == SYMBOL_REF)
{
- rtx addr = machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg);
+ /* APPLE LOCAL use new pseudo for temp; reusing reg confuses PRE */
+ rtx tempreg = reg;
+ rtx addr;
+ if ( !no_new_pseudos )
+ tempreg = gen_reg_rtx (Pmode);
+ addr = machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, tempreg);
addr = gen_rtx_MEM (GET_MODE (orig), addr);
RTX_UNCHANGING_P (addr) = RTX_UNCHANGING_P (orig);
@@ -916,6 +1070,14 @@ machopic_finish (FILE *asm_out_file)
else
stub[0] = '_', strcpy (stub + 1, stub_name);
+ /* APPLE LOCAL weak import */
+ if ( IDENTIFIER_WEAK_IMPORT (TREE_VALUE (temp)))
+ {
+ fprintf (asm_out_file, "\t.weak_reference ");
+ assemble_name (asm_out_file, sym_name);
+ fprintf (asm_out_file, "\n");
+ }
+
machopic_output_stub (asm_out_file, sym, stub);
}
@@ -929,7 +1091,11 @@ machopic_finish (FILE *asm_out_file)
if (! TREE_USED (temp))
continue;
- if (machopic_ident_defined_p (TREE_VALUE (temp)))
+ /* APPLE LOCAL fix-and-continue mrs */
+ if (! TARGET_INDIRECT_ALL_DATA
+ && (machopic_ident_defined_p (TREE_VALUE (temp))
+ /* APPLE LOCAL private extern */
+ || (sym_name[0] == '!' && sym_name[2] == 'p')))
{
data_section ();
assemble_align (GET_MODE_ALIGNMENT (Pmode));
@@ -940,6 +1106,17 @@ machopic_finish (FILE *asm_out_file)
}
else
{
+ /* APPLE LOCAL fix-and-continue mrs */
+ rtx init = const0_rtx;
+
+ /* APPLE LOCAL weak import */
+ if ( IDENTIFIER_WEAK_IMPORT (TREE_VALUE (temp)))
+ {
+ fprintf (asm_out_file, "\t.weak_reference ");
+ assemble_name (asm_out_file, sym_name);
+ fprintf (asm_out_file, "\n");
+ }
+
machopic_nl_symbol_ptr_section ();
assemble_name (asm_out_file, lazy_name);
fprintf (asm_out_file, ":\n");
@@ -948,8 +1125,14 @@ machopic_finish (FILE *asm_out_file)
assemble_name (asm_out_file, sym_name);
fprintf (asm_out_file, "\n");
- assemble_integer (const0_rtx, GET_MODE_SIZE (Pmode),
+ /* APPLE LOCAL BEGIN fix-and-continue mrs */
+ if (sym_name[3] == 's'
+ && machopic_ident_defined_p (TREE_VALUE (temp)))
+ init = gen_rtx_SYMBOL_REF (Pmode, sym_name);
+
+ assemble_integer (init, GET_MODE_SIZE (Pmode),
GET_MODE_ALIGNMENT (Pmode), 1);
+ /* APPLE LOCAL END fix-and-continue mrs */
}
}
}
@@ -1004,11 +1187,28 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
if ((TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == VAR_DECL)
&& !DECL_EXTERNAL (decl)
+ /* APPLE LOCAL coalescing */
+#ifdef DECL_IS_COALESCED_OR_WEAK
+ && ! DECL_IS_COALESCED_OR_WEAK (decl)
+#endif
&& ((TREE_STATIC (decl)
&& (!DECL_COMMON (decl) || !TREE_PUBLIC (decl)))
|| (DECL_INITIAL (decl)
&& DECL_INITIAL (decl) != error_mark_node)))
defined = 1;
+ /* APPLE LOCAL fix OBJC codegen */
+ if (TREE_CODE (decl) == VAR_DECL)
+ {
+ sym_ref = XEXP (DECL_RTL (decl), 0);
+ orig_str = XSTR (sym_ref, 0);
+ if ( orig_str[0] == '_'
+ && orig_str[1] == 'O'
+ && orig_str[2] == 'B'
+ && orig_str[3] == 'J'
+ && orig_str[4] == 'C'
+ && orig_str[5] == '_')
+ defined = 1;
+ }
if (TREE_CODE (decl) == FUNCTION_DECL)
code = (defined ? 'T' : 't');
@@ -1041,7 +1241,15 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
new_str[0] = '!';
new_str[1] = code;
new_str[2] = '_';
+ /* APPLE LOCAL private extern */
+ if (DECL_VISIBILITY (decl) == VISIBILITY_HIDDEN)
+ new_str[2] = 'p';
new_str[3] = '_';
+ /* APPLE LOCAL BEGIN fix-and-continue mrs */
+ if (TARGET_INDIRECT_ALL_DATA
+ && TREE_CODE (decl) == VAR_DECL && ! TREE_PUBLIC (decl))
+ new_str[3] = 's';
+ /* APPLE LOCAL END fix-and-continue mrs */
memcpy (new_str + 4, orig_str, len);
XSTR (sym_ref, 0) = ggc_alloc_string (new_str, new_len);
}
@@ -1161,9 +1369,24 @@ machopic_select_section (tree exp, int reloc,
&& TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
&& TYPE_NAME (TREE_TYPE (exp)))
{
+ /* APPLE LOCAL begin constant strings */
+ extern int flag_next_runtime;
+ extern const char *constant_string_class_name;
+ /* APPLE LOCAL end constant strings */
tree name = TYPE_NAME (TREE_TYPE (exp));
if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);
+ /* APPLE LOCAL begin constant strings */
+ if (constant_string_class_name
+ && !strcmp (IDENTIFIER_POINTER (name),
+ constant_string_class_name))
+ {
+ if (flag_next_runtime)
+ objc_constant_string_object_section ();
+ else
+ objc_string_object_section ();
+ }
+ /* APPLE LOCAL end constant strings */
if (!strcmp (IDENTIFIER_POINTER (name), "NSConstantString"))
objc_constant_string_object_section ();
else if (!strcmp (IDENTIFIER_POINTER (name), "NXConstantString"))
@@ -1171,6 +1394,26 @@ machopic_select_section (tree exp, int reloc,
else
base_function ();
}
+ /* APPLE LOCAL begin constant cfstrings */
+ else if (TREE_CODE (exp) == CONSTRUCTOR
+ && TREE_TYPE (exp)
+ && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
+ && TREE_OPERAND (exp, 0))
+ {
+ tree name = TREE_OPERAND (exp, 0);
+ if (TREE_CODE (name) == TREE_LIST && TREE_VALUE (name)
+ && TREE_CODE (TREE_VALUE (name)) == NOP_EXPR
+ && TREE_OPERAND (TREE_VALUE (name), 0)
+ && TREE_OPERAND (TREE_OPERAND (TREE_VALUE (name), 0), 0))
+ name = TREE_OPERAND (TREE_OPERAND (TREE_VALUE (name), 0), 0);
+ if (TREE_CODE (name) == VAR_DECL
+ && !strcmp (IDENTIFIER_POINTER (DECL_NAME (name)),
+ "__CFConstantStringClassReference"))
+ cfstring_constant_object_section ();
+ else
+ base_function ();
+ }
+ /* APPLE LOCAL end constant cfstrings */
else if (TREE_CODE (exp) == VAR_DECL &&
DECL_NAME (exp) &&
TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE &&
@@ -1228,6 +1471,10 @@ machopic_select_section (tree exp, int reloc,
else
base_function ();
}
+ /* APPLE LOCAL begin darwin_set_section_for_var_p */
+ else if (darwin_set_section_for_var_p (exp, reloc, align))
+ ;
+ /* APPLE LOCAL end darwin_set_section_for_var_p */
else
base_function ();
}
@@ -1289,6 +1536,175 @@ darwin_globalize_label (FILE *stream, const char *name)
default_globalize_label (stream, name);
}
+/* APPLE LOCAL begin assembly "abort" directive */
+/* This can be called instead of EXIT. It will emit a '.abort' directive
+ into any existing assembly file, causing assembly to immediately abort,
+ thus preventing the assembler from spewing out numerous, irrelevant
+ error messages. */
+
+void
+abort_assembly_and_exit (int status)
+{
+ /* If we're aborting, get the assembler to abort, too. */
+ if (status == FATAL_EXIT_CODE && asm_out_file != 0)
+ fprintf (asm_out_file, "\n.abort\n");
+
+ exit (status);
+}
+/* APPLE LOCAL end assembly "abort" directive */
+
+/* APPLE LOCAL coalescing */
+void
+darwin_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED)
+{
+ fprintf (asm_out_file, ".section %s\n", name);
+}
+
+unsigned int
+darwin_section_type_flags (tree decl, const char *name, int reloc)
+{
+ unsigned int flags = default_section_type_flags (decl, name, reloc);
+
+ /* Weak or coalesced variables live in a writable section. */
+ if (decl != 0 && TREE_CODE (decl) != FUNCTION_DECL
+ && DECL_IS_COALESCED_OR_WEAK (decl))
+ flags |= SECTION_WRITE;
+
+ return flags;
+}
+/* APPLE LOCAL end coalescing */
+
+/* APPLE LOCAL begin double destructor turly 20020214 */
+#include "c-common.h"
+
+/* Handle __attribute__ ((apple_kext_compatibility)).
+ This only applies to darwin kexts for 295 compatibility -- it shrinks the
+ vtable for classes with this attribute (and their descendants) by not
+ outputting the new 3.0 nondeleting destructor. This means that such
+ objects CANNOT be allocated on the stack or as globals UNLESS they have
+ a completely empty `operator delete'.
+ Luckily, this fits in with the Darwin kext model.
+
+ This attribute also disables gcc3's potential overlaying of derived
+ class data members on the padding at the end of the base class. */
+
+tree
+darwin_handle_odd_attribute (tree *node, tree name, tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+{
+ if (! POSSIBLY_COMPILING_APPLE_KEXT_P ())
+ {
+ warning ("`%s' 2.95 vtable-compatability attribute applies "
+ "only when compiling a kext", IDENTIFIER_POINTER (name));
+
+ *no_add_attrs = true;
+ }
+ else if (TREE_CODE (*node) != RECORD_TYPE)
+ {
+ warning ("`%s' 2.95 vtable-compatability attribute applies "
+ "only to C++ classes", IDENTIFIER_POINTER (name));
+
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+/* APPLE LOCAL end double destructor turly 20020214 */
+
+/* APPLE LOCAL begin darwin_set_section_for_var_p turly 20020226 */
+
+/* This is specifically for any initialised static class constants
+ which may be output by the C++ front end at the end of compilation.
+ SELECT_SECTION () macro won't do because these are VAR_DECLs, not
+ STRING_CSTs or INTEGER_CSTs. And by putting 'em in appropriate
+ sections, we save space. */
+
+extern void cstring_section (void),
+ literal4_section (void), literal8_section (void);
+int
+darwin_set_section_for_var_p (tree exp, int reloc, int align)
+{
+ if (!reloc && TREE_CODE (exp) == VAR_DECL
+ && DECL_ALIGN (exp) == align
+ && TREE_READONLY (exp) && DECL_INITIAL (exp))
+ {
+ /* Put constant string vars in ".cstring" section. */
+
+ if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (exp))) == INTEGER_TYPE
+ && integer_onep (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (exp))))
+ && TREE_CODE (DECL_INITIAL (exp)) == STRING_CST)
+ {
+
+ /* Compare string length with actual number of characters
+ the compiler will write out (which is not necessarily
+ TREE_STRING_LENGTH, in the case of a constant array of
+ characters that is not null-terminated). Select appropriate
+ section accordingly. */
+
+ if (MIN ( TREE_STRING_LENGTH (DECL_INITIAL(exp)),
+ int_size_in_bytes (TREE_TYPE (exp)))
+ == (long) strlen (TREE_STRING_POINTER (DECL_INITIAL (exp))) + 1)
+ {
+ cstring_section ();
+ return 1;
+ }
+ else
+ {
+ const_section ();
+ return 1;
+ }
+ }
+ else
+ if (TREE_READONLY (TREE_TYPE (exp))
+ && ((TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
+ && TREE_CODE (DECL_INITIAL (exp)) == INTEGER_CST)
+ || (TREE_CODE (TREE_TYPE (exp)) == REAL_TYPE
+ && TREE_CODE (DECL_INITIAL (exp)) == REAL_CST))
+ && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (DECL_INITIAL (exp))))
+ == INTEGER_CST)
+ {
+ tree size = TYPE_SIZE_UNIT (TREE_TYPE (DECL_INITIAL (exp)));
+ if (TREE_INT_CST_HIGH (size) != 0)
+ return 0;
+
+ /* Put integer and float consts in the literal4|8 sections. */
+
+ if (TREE_INT_CST_LOW (size) == 4)
+ {
+ literal4_section ();
+ return 1;
+ }
+ else if (TREE_INT_CST_LOW (size) == 8)
+ {
+ literal8_section ();
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+/* APPLE LOCAL end darwin_set_section_for_var_p turly 20020226 */
+
+/* APPLE LOCAL begin C++ EH */
+/* Generate a PC-relative reference to a Mach-O non-lazy-symbol. */
+void
+darwin_non_lazy_pcrel (FILE *file, rtx addr)
+{
+ const char *str;
+ const char *nlp_name;
+
+ if (GET_CODE (addr) != SYMBOL_REF)
+ abort ();
+
+ str = darwin_strip_name_encoding (XSTR (addr, 0));
+ nlp_name = machopic_non_lazy_ptr_name (str);
+ fputs ("\t.long\t", file);
+ ASM_OUTPUT_LABELREF (file, nlp_name);
+ fputs ("-.", file);
+}
+/* APPLE LOCAL end C++ EH */
+
/* Emit an assembler directive to set visibility for a symbol. The
only supported visibilities are VISIBILITY_DEFAULT and
VISIBILITY_HIDDEN; the latter corresponds to Darwin's "private
@@ -1343,7 +1759,8 @@ void
darwin_file_end (void)
{
machopic_finish (asm_out_file);
- if (strcmp (lang_hooks.name, "GNU C++") == 0)
+ /* APPLE LOCAL constant cfstrings */
+ if (darwin_running_cxx)
{
constructor_section ();
destructor_section ();
@@ -1351,4 +1768,233 @@ darwin_file_end (void)
}
}
+/* APPLE LOCAL begin constant cfstrings */
+int darwin_constant_cfstrings = 0;
+const char *darwin_constant_cfstrings_switch;
+int darwin_warn_nonportable_cfstrings = 1; /* on by default. */
+const char *darwin_warn_nonportable_cfstrings_switch;
+int darwin_pascal_strings = 0;
+const char *darwin_pascal_strings_switch;
+int darwin_running_cxx;
+
+static GTY(()) tree cfstring_class_reference = NULL_TREE;
+static GTY(()) tree cfstring_type_node = NULL_TREE;
+static GTY(()) tree ccfstring_type_node = NULL_TREE;
+static GTY(()) tree pccfstring_type_node = NULL_TREE;
+static GTY(()) tree pcint_type_node = NULL_TREE;
+static GTY(()) tree pcchar_type_node = NULL_TREE;
+
+/* Store all constructed constant CFStrings in a hash table so that
+ they get uniqued properly. */
+
+struct cfstring_descriptor GTY(())
+{
+ /* The literal argument . */
+ tree literal;
+
+ /* The resulting constant CFString. */
+ tree constructor;
+};
+
+static GTY((param_is (struct cfstring_descriptor))) htab_t cfstring_htab;
+
+static hashval_t cfstring_hash (const void *);
+static int cfstring_eq (const void *, const void *);
+
+void
+darwin_init_cfstring_builtins (void)
+{
+ tree field, fields, pccfstring_ftype_pcchar;
+
+ /* struct __builtin_CFString {
+ const int *isa; (will point at
+ int flags; __CFConstantStringClassReference)
+ const char *str;
+ int length;
+ }; */
+
+ pcint_type_node
+ = build_pointer_type (build_qualified_type (integer_type_node,
+ TYPE_QUAL_CONST));
+ pcchar_type_node
+ = build_pointer_type (build_qualified_type (char_type_node,
+ TYPE_QUAL_CONST));
+ cfstring_type_node = (*lang_hooks.types.make_type) (RECORD_TYPE);
+ fields = build_decl (FIELD_DECL, NULL_TREE, pcint_type_node);
+ field = build_decl (FIELD_DECL, NULL_TREE, integer_type_node);
+ TREE_CHAIN (field) = fields; fields = field;
+ field = build_decl (FIELD_DECL, NULL_TREE, pcchar_type_node);
+ TREE_CHAIN (field) = fields; fields = field;
+ field = build_decl (FIELD_DECL, NULL_TREE, integer_type_node);
+ TREE_CHAIN (field) = fields; fields = field;
+ /* NB: The finish_builtin_struct() routine expects FIELD_DECLs in
+ reverse order! */
+ finish_builtin_struct (cfstring_type_node, "__builtin_CFString",
+ fields, NULL_TREE);
+
+ /* const struct __builtin_CFstring *
+ __builtin___CFStringMakeConstantString (const char *); */
+
+ ccfstring_type_node
+ = build_qualified_type (cfstring_type_node, TYPE_QUAL_CONST);
+ pccfstring_type_node
+ = build_pointer_type (ccfstring_type_node);
+ pccfstring_ftype_pcchar
+ = build_function_type_list (pccfstring_type_node,
+ pcchar_type_node, NULL_TREE);
+ builtin_function ("__builtin___CFStringMakeConstantString",
+ pccfstring_ftype_pcchar,
+ DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING,
+ BUILT_IN_NORMAL, NULL, NULL_TREE);
+
+ /* extern int __CFConstantStringClassReference[]; */
+ cfstring_class_reference
+ = build_decl (VAR_DECL,
+ get_identifier ("__CFConstantStringClassReference"),
+ build_array_type (integer_type_node, NULL_TREE));
+ DECL_EXTERNAL (cfstring_class_reference) = 1;
+ TREE_PUBLIC (cfstring_class_reference) = 1;
+ TREE_USED (cfstring_class_reference) = 1;
+ DECL_ARTIFICIAL (cfstring_class_reference) = 1;
+ (*lang_hooks.decls.pushdecl) (cfstring_class_reference);
+ rest_of_decl_compilation (cfstring_class_reference, 0, 0, 0);
+
+ /* Initialize the hash table used to hold the constant CFString objects. */
+ cfstring_htab = htab_create_ggc (31, cfstring_hash,
+ cfstring_eq, NULL);
+}
+
+tree
+darwin_expand_tree_builtin (tree function, tree params,
+ tree coerced_params ATTRIBUTE_UNUSED)
+{
+ unsigned int fcode = DECL_FUNCTION_CODE (function);
+
+ switch (fcode)
+ {
+ case DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING:
+ if (!darwin_constant_cfstrings)
+ {
+ error ("built-in function `%s' requires `-fconstant-cfstrings' flag",
+ IDENTIFIER_POINTER (DECL_NAME (function)));
+ return error_mark_node;
+ }
+
+ return darwin_build_constant_cfstring (TREE_VALUE (params));
+ default:
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+static hashval_t
+cfstring_hash (const void *ptr)
+{
+ tree str = ((struct cfstring_descriptor *)ptr)->literal;
+ const unsigned char *p = (const unsigned char *) TREE_STRING_POINTER (str);
+ int i, len = TREE_STRING_LENGTH (str);
+ hashval_t h = len;
+
+ for (i = 0; i < len; i++)
+ h = ((h * 613) + p[i]);
+
+ return h;
+}
+
+static int
+cfstring_eq (const void *ptr1, const void *ptr2)
+{
+ tree str1 = ((struct cfstring_descriptor *)ptr1)->literal;
+ tree str2 = ((struct cfstring_descriptor *)ptr2)->literal;
+ int len1 = TREE_STRING_LENGTH (str1);
+
+ return (len1 == TREE_STRING_LENGTH (str2)
+ && !memcmp (TREE_STRING_POINTER (str1), TREE_STRING_POINTER (str2),
+ len1));
+}
+
+tree
+darwin_construct_objc_string (tree str)
+{
+ if (!darwin_constant_cfstrings)
+ return NULL_TREE; /* Fall back to NSConstantString. */
+
+ return darwin_build_constant_cfstring (str);
+}
+
+static tree
+darwin_build_constant_cfstring (tree str)
+{
+ struct cfstring_descriptor *desc, key;
+ void **loc;
+
+ if (!str || TREE_CODE (str) != STRING_CST)
+ {
+ error ("CFString literal expression is not constant");
+ return error_mark_node;
+ }
+
+ /* Perhaps we already constructed a constant CFString just like this one? */
+ key.literal = str;
+ loc = htab_find_slot (cfstring_htab, &key, INSERT);
+ desc = *loc;
+
+ if (!desc)
+ {
+ tree initlist, constructor, field = TYPE_FIELDS (ccfstring_type_node);
+ int length = TREE_STRING_LENGTH (str) - 1;
+
+ if (darwin_warn_nonportable_cfstrings)
+ {
+ extern int isascii (int);
+ const char *s = TREE_STRING_POINTER (str);
+ int l = 0;
+
+ for (l = 0; l < length; l++)
+ if (!s[l] || !isascii (s[l]))
+ {
+ warning ("%s in CFString literal",
+ s[l] ? "non-ASCII character" : "embedded NUL");
+ break;
+ }
+ }
+
+ *loc = desc = ggc_alloc (sizeof (*desc));
+ desc->literal = str;
+
+ initlist = build_tree_list
+ (field, build1 (ADDR_EXPR, pcint_type_node,
+ cfstring_class_reference));
+ field = TREE_CHAIN (field);
+ initlist = tree_cons (field, build_int_2 (0x000007c8, 0),
+ initlist);
+ field = TREE_CHAIN (field);
+ initlist = tree_cons (field,
+ build1 (ADDR_EXPR, pcchar_type_node,
+ str), initlist);
+ field = TREE_CHAIN (field);
+ initlist = tree_cons (field, build_int_2 (length, 0),
+ initlist);
+
+ constructor = build_constructor (ccfstring_type_node,
+ nreverse (initlist));
+ TREE_READONLY (constructor) = 1;
+ TREE_CONSTANT (constructor) = 1;
+ TREE_STATIC (constructor) = 1;
+
+ /* Fromage: The C++ flavor of 'build_unary_op' expects constructor nodes
+ to have the TREE_HAS_CONSTRUCTOR (...) bit set. However, this file is
+ being built without any knowledge of C++ tree accessors; hence, we shall
+ use the generic accessor that TREE_HAS_CONSTRUCTOR actually maps to! */
+ if (darwin_running_cxx)
+ TREE_LANG_FLAG_4 (constructor) = 1; /* TREE_HAS_CONSTRUCTOR */
+
+ desc->constructor = constructor;
+ }
+
+ return build1 (ADDR_EXPR, pccfstring_type_node, desc->constructor);
+}
+/* APPLE LOCAL end constant cfstrings */
+
#include "gt-darwin.h"
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index b5dae39e967..2065646a04d 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -82,6 +82,16 @@ Boston, MA 02111-1307, USA. */
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
+/* APPLE LOCAL framework headers */
+/* Need to look for framework headers. */
+#define FRAMEWORK_HEADERS
+
+/* APPLE LOCAL begin -Wfour-char-constants */
+/* Don't warn about MacOS-style 'APPL' four-char-constants. */
+#undef WARN_FOUR_CHAR_CONSTANTS
+#define WARN_FOUR_CHAR_CONSTANTS 0
+/* APPLE LOCAL end -Wfour-char-constants */
+
/* This table intercepts weirdo options whose names would interfere
with normal driver conventions, and either translates them into
standardly-named options, or adds a 'Z' so that they can get to
@@ -132,8 +142,107 @@ Boston, MA 02111-1307, USA. */
{ "-static", "-static -Wa,-static" }, \
{ "-single_module", "-Zsingle_module" }, \
{ "-unexported_symbols_list", "-Zunexported_symbols_list" }, \
+ /* APPLE LOCAL begin constant cfstrings */ \
+ { "-fconstant-cfstrings", "-mconstant-cfstrings" }, \
+ { "-fno-constant-cfstrings", "-mno-constant-cfstrings" }, \
+ { "-Wnonportable-cfstrings", "-mwarn-nonportable-cfstrings" }, \
+ { "-Wno-nonportable-cfstrings", "-mno-warn-nonportable-cfstrings" }, \
+ { "-fpascal-strings", "-mpascal-strings" }, \
+ { "-fno-pascal-strings", "-mno-pascal-strings" }, \
+ /* APPLE LOCAL end constant cfstrings */ \
SUBTARGET_OPTION_TRANSLATE_TABLE
-
+
+/* APPLE LOCAL begin constant cfstrings */
+extern int darwin_constant_cfstrings;
+extern const char *darwin_constant_cfstrings_switch;
+extern int darwin_warn_nonportable_cfstrings;
+extern const char *darwin_warn_nonportable_cfstrings_switch;
+extern int darwin_pascal_strings;
+extern const char *darwin_pascal_strings_switch;
+extern int darwin_running_cxx;
+
+#undef SUBTARGET_OPTIONS
+#define SUBTARGET_OPTIONS \
+ {"constant-cfstrings", &darwin_constant_cfstrings_switch, \
+ N_("Generate compile-time CFString objects"), 0}, \
+ {"no-constant-cfstrings", &darwin_constant_cfstrings_switch, "", 0}, \
+ {"pascal-strings", &darwin_pascal_strings_switch, \
+ N_("Allow use of Pascal strings"), 0}, \
+ {"no-pascal-strings", &darwin_pascal_strings_switch, "", 0}, \
+ {"warn-nonportable-cfstrings", &darwin_warn_nonportable_cfstrings_switch, \
+ N_("Warn if constant CFString objects contain non-portable characters"), 0}, \
+ {"no-warn-nonportable-cfstrings", &darwin_warn_nonportable_cfstrings_switch, "", 0}
+
+#define SUBTARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__MACH__"); \
+ builtin_define ("__APPLE__"); \
+ if (darwin_constant_cfstrings) \
+ builtin_define ("__CONSTANT_CFSTRINGS__"); \
+ /* APPLE LOCAL begin pascal strings */ \
+ if (darwin_pascal_strings) \
+ { \
+ builtin_define ("__PASCAL_STRINGS__"); \
+ CPP_OPTION (pfile, pascal_strings) = 1; \
+ } \
+ /* APPLE LOCAL end pascal strings */ \
+ } \
+ while (0)
+
+#define SUBSUBTARGET_OVERRIDE_OPTIONS \
+do { \
+ if (darwin_constant_cfstrings_switch) \
+ { \
+ const char *base = darwin_constant_cfstrings_switch; \
+ while (base[-1] != 'm') base--; \
+ \
+ if (*darwin_constant_cfstrings_switch != '\0') \
+ error ("invalid option `%s'", base); \
+ darwin_constant_cfstrings = (base[0] != 'n'); \
+ } \
+ if (darwin_warn_nonportable_cfstrings_switch) \
+ { \
+ const char *base = darwin_warn_nonportable_cfstrings_switch; \
+ while (base[-1] != 'm') base--; \
+ \
+ if (*darwin_warn_nonportable_cfstrings_switch != '\0') \
+ error ("invalid option `%s'", base); \
+ darwin_warn_nonportable_cfstrings = (base[0] != 'n'); \
+ } \
+ if (darwin_pascal_strings_switch) \
+ { \
+ const char *base = darwin_pascal_strings_switch; \
+ while (base[-1] != 'm') base--; \
+ \
+ if (*darwin_pascal_strings_switch != '\0') \
+ error ("invalid option `%s'", base); \
+ darwin_pascal_strings = (base[0] != 'n'); \
+ } \
+ /* The c_dialect...() macros are not available to us here. */ \
+ darwin_running_cxx = (strstr (lang_hooks.name, "C++") != 0); \
+} while(0)
+
+enum darwin_builtins
+{
+ DARWIN_BUILTIN_MIN = (int)TARGET_BUILTIN_MAX,
+
+ DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING,
+ DARWIN_BUILTIN_MAX
+};
+
+#define SUBTARGET_INIT_BUILTINS \
+do { \
+ darwin_init_cfstring_builtins (); \
+} while(0)
+
+#undef TARGET_EXPAND_TREE_BUILTIN
+#define TARGET_EXPAND_TREE_BUILTIN darwin_expand_tree_builtin
+#undef TARGET_CONSTRUCT_OBJC_STRING
+#define TARGET_CONSTRUCT_OBJC_STRING darwin_construct_objc_string
+
+/* APPLE LOCAL end constant cfstrings */
+
/* These compiler options take n arguments. */
#undef WORD_SWITCH_TAKES_ARG
@@ -181,9 +290,16 @@ Boston, MA 02111-1307, USA. */
isn't. */
#undef CPP_SPEC
-#define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__}\
- -D__APPLE_CC__=1"
+/* APPLE LOCAL -precomp-trustfile, -arch */
+/* APPLE LOCAL __APPLE__ setting, don't set __APPLE__ here, as we do it someplace else */
+#define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__} \
+ %{precomp-trustfile} %{arch}"
+/* APPLE LOCAL cc1plus spec */
+#undef CC1PLUS_SPEC
+#define CC1PLUS_SPEC "-D__private_extern__=extern"
+
+/* APPLE LOCAL begin fat builds */
/* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus
precomp, libtool, and fat build additions. Also we
don't specify a second %G after %L because libSystem is
@@ -193,10 +309,9 @@ Boston, MA 02111-1307, USA. */
specifying the handling of options understood by generic Unix
linkers, and for positional arguments like libraries. */
#define LINK_COMMAND_SPEC "\
-%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+%{!foutput-dbg*:%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
- %{!Zdynamiclib:-arch %(darwin_arch)} \
- %{Zdynamiclib:-arch_only %(darwin_arch)} \
+ %(darwin_arch_ld_spec) \
%l %X %{d} %{s} %{t} %{Z} \
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
@@ -204,7 +319,15 @@ Boston, MA 02111-1307, USA. */
%{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov} \
%{!nostdlib:%{!nodefaultlibs:%G %L}} \
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} \
- %{!--help:%{!no-c++filt|c++filt:| c++filt3 }} }}}}}}}}"
+ %{!--help:%{!no-c++filt|c++filt:| c++filt3 }} }}}}}}}}}"
+
+/* Note that the linker
+ output is always piped through c++filt (unless -no-c++filt is
+ specified) to ensure error messages have demangled C++ names.
+ We do this even for C. */
+/* nice idea, needs some work
+ "%{!no-c++filt|c++filt:| " STANDARD_BINDIR_PREFIX cppfilt " }}}}}}}}" */
+/* APPLE LOCAL end fat builds */
/* Please keep the random linker options in alphabetical order (modulo
'Z' and 'no' prefixes). Options that can only go to one of libtool
@@ -234,7 +357,6 @@ Boston, MA 02111-1307, USA. */
%{client_name*:%e-client_name not allowed with -dynamiclib} \
%{compatibility_version*} \
%{current_version*} \
- %{Zforce_cpusubtype_ALL:%e-force_cpusubtype_ALL not allowed with -dynamiclib} \
%{Zforce_flat_namespace:%e-force_flat_namespace not allowed with -dynamiclib} \
%{Zinstall_name*:-install_name %*} \
%{keep_private_externs:%e-keep_private_externs not allowed with -dynamiclib} \
@@ -271,7 +393,7 @@ Boston, MA 02111-1307, USA. */
%{pagezero_size*} %{segs_read_*} %{seglinkedit} %{noseglinkedit} \
%{sectalign*} %{sectobjectsymbols*} %{segcreate*} %{whyload} \
%{whatsloaded} %{dylinker_install_name*} \
- %{dylinker} %{Mach} "
+ %{dylinker} %{Mach} "
/* Machine dependent libraries. */
@@ -279,19 +401,30 @@ Boston, MA 02111-1307, USA. */
#undef LIB_SPEC
#define LIB_SPEC "%{!static:-lSystem}"
+/* APPLE LOCAL begin radar 3554191 and 3127145 */
+#undef LIBGCC_SPEC
+#undef REAL_LIBGCC_SPEC
+#define REAL_LIBGCC_SPEC \
+ "%{static:-lgcc_static} \
+ %{!static:%{static-libgcc:-lgcc -lgcc_eh} \
+ %{!static-libgcc:%{shared-libgcc:-lgcc_s%M -lgcc} \
+ %{!shared-libgcc:-lgcc -lgcc_eh}}}"
+/* APPLE LOCAL end radar 3554191 and 3127145 */
+
/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
+/* APPLE LOCAL IN FSF 2004-04-27 */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"%{!Zdynamiclib:%{Zbundle:%{!static:-lbundle1.o}} \
%{!Zbundle:%{pg:%{static:-lgcrt0.o} \
%{!static:%{object:-lgcrt0.o} \
%{!object:%{preload:-lgcrt0.o} \
- %{!preload:-lgcrt1.o -lcrt2.o}}}} \
+ %{!preload:-lgcrt1.o crt2.o%s}}}} \
%{!pg:%{static:-lcrt0.o} \
%{!static:%{object:-lcrt0.o} \
%{!object:%{preload:-lcrt0.o} \
- %{!preload:-lcrt1.o -lcrt2.o}}}}}}"
+ %{!preload:-lcrt1.o crt2.o%s}}}}}}"
/* The native Darwin linker doesn't necessarily place files in the order
that they're specified on the link line. Thus, it is pointless
@@ -302,6 +435,29 @@ Boston, MA 02111-1307, USA. */
#define DBX_DEBUGGING_INFO 1
+/* APPLE LOCAL dwarf */
+/* Also enable Dwarf 2 as an option. */
+#define DWARF2_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+
+#define DEBUG_FRAME_SECTION "__DWARFXA,__debug_frame"
+#define DEBUG_INFO_SECTION "__DWARFXA,__debug_info"
+#define DEBUG_ABBREV_SECTION "__DWARFXA,__debug_abbrev"
+#define DEBUG_ARANGES_SECTION "__DWARFXA,__debug_aranges"
+#define DEBUG_MACINFO_SECTION "__DWARFXA,__debug_macinfo"
+#define DEBUG_LINE_SECTION "__DWARFXA,__debug_line"
+#define DEBUG_LOC_SECTION "__DWARFXA,__debug_loc"
+#define DEBUG_PUBNAMES_SECTION "__DWARFXA,__debug_pubnames"
+#define DEBUG_STR_SECTION "__DWARFXA,__debug_str"
+#define DEBUG_RANGES_SECTION "__DWARFXA,__debug_ranges"
+/* APPLE LOCAL end dwarf */
+
+/* APPLE LOCAL begin gdb only used symbols */
+/* Support option to generate stabs for only used symbols. */
+
+#define DBX_ONLY_USED_SYMBOLS
+/* APPLE LOCAL end gdb only used symbols */
+
/* When generating stabs debugging, use N_BINCL entries. */
#define DBX_USE_BINCL
@@ -326,6 +482,9 @@ do { text_section (); \
#undef INIT_SECTION_ASM_OP
#define INIT_SECTION_ASM_OP
+/* APPLE LOCAL static structors in __StaticInit section */
+#define STATIC_INIT_SECTION "__TEXT,__StaticInit,regular,pure_instructions"
+
#undef INVOKE__main
#define TARGET_ASM_CONSTRUCTOR machopic_asm_out_constructor
@@ -374,9 +533,11 @@ do { text_section (); \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL)) \
machopic_define_name (xname); \
- if ((TREE_STATIC (DECL) \
- && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
- || DECL_INITIAL (DECL)) \
+ /* APPLE LOCAL coalescing */ \
+ if (! DECL_IS_COALESCED_OR_WEAK (DECL) \
+ && ((TREE_STATIC (DECL) \
+ && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
+ || DECL_INITIAL (DECL))) \
(* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false); \
ASM_OUTPUT_LABEL (FILE, xname); \
/* Darwin doesn't support zero-size objects, so give them a \
@@ -390,7 +551,9 @@ do { text_section (); \
const char *xname = NAME; \
if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF) \
xname = IDENTIFIER_POINTER (DECL_NAME (DECL)); \
- if ((TREE_STATIC (DECL) \
+ /* APPLE LOCAL coalescing */ \
+ if (! DECL_IS_COALESCED_OR_WEAK (DECL)) \
+ if ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL)) \
machopic_define_name (xname); \
@@ -428,7 +591,12 @@ do { text_section (); \
machopic_validate_stub_or_non_lazy_ptr (xname, 1); \
else if (len > 14 && !strcmp ("$non_lazy_ptr", xname + len - 13)) \
machopic_validate_stub_or_non_lazy_ptr (xname, 0); \
- fputs (&xname[1], FILE); \
+ /* APPLE LOCAL begin Objective-C++ */ \
+ if (xname[1] != '"' && name_needs_quotes (&xname[1])) \
+ fprintf (FILE, "\"%s\"", &xname[1]); \
+ else \
+ fputs (&xname[1], FILE); \
+ /* APPLE LOCAL end Objective-C++ */ \
} \
else if (xname[0] == '+' || xname[0] == '-') \
fprintf (FILE, "\"%s\"", xname); \
@@ -436,6 +604,10 @@ do { text_section (); \
fprintf (FILE, "L%s", xname); \
else if (!strncmp (xname, ".objc_class_name_", 17)) \
fprintf (FILE, "%s", xname); \
+ /* APPLE LOCAL begin Objective-C++ */ \
+ else if (xname[0] != '"' && name_needs_quotes (xname)) \
+ fprintf (FILE, "\"%s\"", xname); \
+ /* APPLE LOCAL end Objective-C++ */ \
else \
fprintf (FILE, "_%s", xname); \
} while (0)
@@ -516,6 +688,8 @@ FUNCTION (void) \
in_objc_symbols, in_objc_module_info, \
in_objc_protocol, in_objc_string_object, \
in_objc_constant_string_object, \
+ /* APPLE LOCAL constant cfstrings */ \
+ in_cfstring_constant_object, \
in_objc_image_info, \
in_objc_class_names, in_objc_meth_var_names, \
in_objc_meth_var_types, in_objc_cls_refs, \
@@ -606,6 +780,14 @@ SECTION_FUNCTION (objc_string_object_section, \
SECTION_FUNCTION (objc_constant_string_object_section, \
in_objc_constant_string_object, \
".section __OBJC, __cstring_object", 1) \
+/* APPLE LOCAL begin constant cfstrings */ \
+/* Unlike constant NSStrings, constant CFStrings do not live */\
+/* in the __OBJC segment since they may also occur in pure C */\
+/* or C++ programs. */\
+SECTION_FUNCTION (cfstring_constant_object_section, \
+ in_cfstring_constant_object, \
+ ".section __DATA, __cfstring", 0) \
+/* APPLE LOCAL end constant cfstrings */ \
/* Fix-and-Continue image marker. */ \
SECTION_FUNCTION (objc_image_info_section, \
in_objc_image_info, \
@@ -646,7 +828,8 @@ SECTION_FUNCTION (darwin_exception_section, \
".section __DATA,__gcc_except_tab", 0) \
SECTION_FUNCTION (darwin_eh_frame_section, \
in_darwin_eh_frame, \
- ".section __TEXT,__eh_frame", 0) \
+ /* APPLE LOCAL eh in data segment */ \
+ ".section " EH_FRAME_SECTION_NAME ",__eh_frame" EH_FRAME_SECTION_ATTR, 0) \
\
static void \
objc_section_init (void) \
@@ -714,6 +897,13 @@ objc_section_init (void) \
#define GLOBAL_ASM_OP ".globl "
#define TARGET_ASM_GLOBALIZE_LABEL darwin_globalize_label
+/* APPLE LOCAL begin weak definition */
+#define ASM_WEAK_DEFINITIONIZE_LABEL(FILE, NAME) \
+ do { const char* _x = (NAME); if (!!strncmp (_x, "_OBJC_", 6)) { \
+ fputs (".weak_definition ", FILE); assemble_name (FILE, _x); \
+ fputs ("\n", FILE); }} while (0)
+/* APPLE LOCAL end weak definition */
+
/* Emit an assembler directive to set visibility for a symbol. Used
to support visibility attribute and Darwin's private extern
feature. */
@@ -754,6 +944,11 @@ enum machopic_addr_class {
#undef TARGET_STRIP_NAME_ENCODING
#define TARGET_STRIP_NAME_ENCODING darwin_strip_name_encoding
+/* APPLE LOCAL what is this for? */
+/* Be conservative and always redo the encoding. */
+
+#define REDO_SECTION_INFO_P(DECL) (1)
+
#define GEN_BINDER_NAME_FOR_STUB(BUF,STUB,STUB_LENGTH) \
do { \
const char *const stub_ = (STUB); \
@@ -823,21 +1018,235 @@ enum machopic_addr_class {
#define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2) \
darwin_asm_output_dwarf_delta (FILE, SIZE, LABEL1, LABEL2)
-#define TARGET_TERMINATE_DW2_EH_FRAME_INFO false
+/* APPLE LOCAL begin coalescing */
+/* The __eh_frame section attributes: a "normal" section by default. */
+#define EH_FRAME_SECTION_ATTR /*nothing*/
+
+/* The only EH item we can't do PC-relative is the reference to
+ __gxx_personality_v0. So we cheat, since moving the __eh_frame section
+ to the DATA segment is expensive.
+ We output a 4-byte encoding - including the last 2 chars of the
+ personality function name: {0, 'g', 'v', '0', 0xff}
+ (The first zero byte coincides with the "absolute" encoding.)
+ This means we can now use DW_EH_PE_pcrel for everything. And there
+ was much rejoicing. */
-#define DARWIN_REGISTER_TARGET_PRAGMAS() \
+#define EH_FRAME_SECTION_NAME "__TEXT"
+
+#define COALESCED_UNWIND_INFO
+
+#ifdef COALESCED_UNWIND_INFO
+#undef EH_FRAME_SECTION_ATTR
+#define EH_FRAME_SECTION_ATTR ",coalesced,no_toc+strip_static_syms"
+
+
+/* Implicit or explicit template instantiations' EH info are GLOBAL
+ symbols. ("Implicit" here implies "coalesced".)
+ Note that .weak_definition is commented out until 'as' supports it. */
+
+
+#define APPLE_ASM_WEAK_DEF_FMT_STRING(LAB) \
+ (name_needs_quotes(LAB) ? ".weak_definition \"%s.eh\"\n" : ".weak_definition %s.eh\n")
+
+#define ASM_OUTPUT_COAL_UNWIND_LABEL(FILE, LAB, COAL, PUBLIC, PRIVATE_EXTERN) \
+ do { \
+ if ((COAL) || (PUBLIC) || (PRIVATE_EXTERN)) \
+ fprintf ((FILE), \
+ (name_needs_quotes(LAB) ? "%s \"%s.eh\"\n" : "%s %s.eh\n"), \
+ ((PUBLIC) ? ".globl" : ".private_extern"), \
+ (LAB)); \
+ if (COAL) \
+ fprintf ((FILE), \
+ APPLE_ASM_WEAK_DEF_FMT_STRING(LAB), \
+ (LAB)); \
+ fprintf ((FILE), \
+ (name_needs_quotes(LAB) ? "\"%s.eh\":\n" : "%s.eh:\n"), \
+ (LAB)); \
+ } while (0)
+
+#endif /* COALESCED_UNWIND_INFO */
+
+#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(ASM_OUT_FILE, ENCODING, SIZE, ADDR, DONE) \
+ if (ENCODING == ASM_PREFERRED_EH_DATA_FORMAT (2, 1)) { \
+ darwin_non_lazy_pcrel (ASM_OUT_FILE, ADDR); \
+ goto DONE; \
+ }
+/* APPLE LOCAL end coalescing */
+
+/* APPLE LOCAL OS pragma hook */
+#define REGISTER_OS_PRAGMAS(PFILE) \
do { \
c_register_pragma (0, "mark", darwin_pragma_ignore); \
c_register_pragma (0, "options", darwin_pragma_options); \
c_register_pragma (0, "segment", darwin_pragma_ignore); \
c_register_pragma (0, "unused", darwin_pragma_unused); \
+ /* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */ \
+ cpp_register_pragma (PFILE, 0, "pack", darwin_pragma_pack); \
+ /* APPLE LOCAL end Macintosh alignment 2002-1-22 ff */ \
+ /* APPLE LOCAL begin CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 turly */ \
+ cpp_register_pragma (PFILE, 0, "CALL_ON_LOAD", \
+ darwin_pragma_call_on_load); \
+ cpp_register_pragma (PFILE, 0, "CALL_ON_UNLOAD", \
+ darwin_pragma_call_on_unload); \
+ /* APPLE LOCAL end CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 turly */ \
+ /* APPLE LOCAL begin CALL_ON_MODULE_BIND deprecated 2002-4-10 ff */ \
+ cpp_register_pragma (PFILE, 0, "CALL_ON_MODULE_BIND", darwin_pragma_call_on_module_bind); \
+ /* APPLE LOCAL end CALL_ON_MODULE_BIND deprecated 2002-4-10 ff */ \
+ /* APPLE LOCAL begin temporary pragmas 2001-07-05 sts */ \
+ cpp_register_pragma (PFILE, 0, "CC_NO_MACH_TEXT_SECTIONS", darwin_pragma_cc_no_mach_text_sections); \
+ cpp_register_pragma (PFILE, 0, "CC_OPT_OFF", darwin_pragma_cc_opt_off); \
+ cpp_register_pragma (PFILE, 0, "CC_OPT_ON", darwin_pragma_cc_opt_on); \
+ cpp_register_pragma (PFILE, 0, "CC_OPT_RESTORE", darwin_pragma_cc_opt_restore); \
+ cpp_register_pragma (PFILE, 0, "CC_WRITABLE_STRINGS", darwin_pragma_cc_writable_strings); \
+ cpp_register_pragma (PFILE, 0, "CC_NON_WRITABLE_STRINGS", darwin_pragma_cc_non_writable_strings); \
+ /* APPLE LOCAL end temporary pragmas 2001-07-05 sts */ \
+ } while (0)
+
+/* APPLE LOCAL coalescing */
+extern void make_decl_coalesced (tree, int private_extern_p);
+
+/* Coalesced symbols are private extern by default. This behavior can
+ be changed with the EXPERIMENTAL export-coalesced flag. There is
+ not (yet?) any means for coalesced symbols to be selectively exported. */
+
+#define MAKE_DECL_COALESCED(DECL) \
+ make_decl_coalesced (DECL, !flag_export_coalesced)
+
+#define COALESCE_STATIC_THUNK(DECL, PUBLIC) \
+ make_decl_coalesced (DECL, !PUBLIC)
+
+extern int flag_coalescing_enabled,
+ flag_coalesce_templates, flag_weak_coalesced_definitions;
+
+/* Coalesced symbols are private extern by default. This EXPERIMENTAL
+ flag will make them global instead. */
+extern int flag_export_coalesced;
+
+#define COALESCING_ENABLED_P() (flag_coalescing_enabled && MACHOPIC_INDIRECT)
+
+#define COALESCING_TEMPLATES_P(DECL) \
+ (COALESCING_ENABLED_P () && flag_coalesce_templates)
+
+#define TARGET_TERMINATE_DW2_EH_FRAME_INFO false
+
+#define MARK_TEMPLATE_COALESCED(DECL) \
+ do { \
+ if (COALESCING_TEMPLATES_P (DECL)) { \
+ int explicit = TREE_PUBLIC (DECL) \
+ && (DECL_EXPLICIT_INSTANTIATION (DECL) \
+ /* Or an explicitly instantiated function. */ \
+ || (TREE_CODE (DECL) == FUNCTION_DECL \
+ && DECL_INTERFACE_KNOWN (DECL) \
+ && DECL_NOT_REALLY_EXTERN (DECL)) \
+ /* Or a non-common VAR_DECL. */ \
+ || (TREE_CODE (DECL) == VAR_DECL && ! DECL_COMMON (DECL))); \
+ if (!explicit \
+ || /*it IS explicit, but*/ !flag_weak_coalesced_definitions) \
+ MAKE_DECL_COALESCED (DECL); \
+ } \
} while (0)
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION darwin_asm_named_section
+#undef TARGET_SECTION_TYPE_FLAGS
+#define TARGET_SECTION_TYPE_FLAGS darwin_section_type_flags
+
+#define DECL_IS_COALESCED_OR_WEAK(DECL) \
+ (DECL_COALESCED (DECL) || DECL_WEAK (DECL))
+
+extern int machopic_var_referred_to_p PARAMS ((const char*));
+#define MACHOPIC_VAR_REFERRED_TO_P(NAME) machopic_var_referred_to_p (NAME)
+/* APPLE LOCAL end coalescing */
+
+/* APPLE LOCAL insert assembly ".abort" directive on fatal error */
+#define EXIT_FROM_FATAL_DIAGNOSTIC(status) abort_assembly_and_exit (status)
+extern void abort_assembly_and_exit (int status) ATTRIBUTE_NORETURN;
+
+/* APPLE LOCAL begin Macintosh alignment 2002-2-13 ff */
+#ifdef RS6000_VECTOR_ALIGNMENT
+/* When adjusting (lowering) the alignment of fields when in the
+ mac68k alignment mode, the 128-bit alignment of vectors *MUST*
+ be preserved. */
+#define PEG_ALIGN_FOR_MAC68K(DESIRED) \
+ ((TARGET_ALTIVEC && (DESIRED) == RS6000_VECTOR_ALIGNMENT) \
+ ? RS6000_VECTOR_ALIGNMENT \
+ : MIN ((DESIRED), 16))
+#else
+#define PEG_ALIGN_FOR_MAC68K(DESIRED) MIN ((DESIRED), 16)
+#endif
+/* APPLE LOCAL end Macintosh alignment 2002-2-13 ff */
+
+/* APPLE LOCAL begin double destructor turly 20020214 */
+/* Handle __attribute__((apple_kext_compatibility)). This shrinks the
+ vtable for all classes with this attribute (and their descendants)
+ back to 2.95 dimensions. It causes only the deleting destructor to
+ be emitted, which means that such objects CANNOT be allocated on
+ the stack or as globals. Luckily, this fits in with the Darwin
+ kext model. */
+#define SUBTARGET_ATTRIBUTE_TABLE \
+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ \
+ { "apple_kext_compatibility", 0, 0, 0, 1, 0, darwin_handle_odd_attribute },
+
+/* APPLE KEXT stuff -- only applies with pure static C++ code. */
+/* NB: Can't use flag_apple_kext as it's in the C++ FE, and this macro
+ is used in the back end for the above __attribute__ handler. */
+#define POSSIBLY_COMPILING_APPLE_KEXT_P() \
+ (! MACHOPIC_INDIRECT && c_dialect_cxx())
+
+/* Need a mechanism to tell whether a C++ operator delete is empty so
+ we overload TREE_SIDE_EFFECTS here (it is unused for FUNCTION_DECLS.)
+ Fromage, c'est moi! */
+#define CHECK_TRIVIAL_FUNCTION(DECL) \
+ do { \
+ const char *_name = IDENTIFIER_POINTER (DECL_NAME (DECL)); \
+ if (POSSIBLY_COMPILING_APPLE_KEXT_P () && DECL_SAVED_TREE (DECL) \
+ && strstr (_name, "operator delete") \
+ && TREE_CODE (DECL_SAVED_TREE (DECL)) == COMPOUND_STMT \
+ && compound_body_is_empty_p ( \
+ COMPOUND_BODY (DECL_SAVED_TREE (DECL))))\
+ TREE_SIDE_EFFECTS (DECL) = 1; \
+ } while (0)
+
+/* gcc3 initialises the vptr field of all objects so that it points at the
+ first virtual function slot, NOT the base address of the vtable proper.
+ This is different from gcc2.95 which always initialised the vptr to
+ point at the base address of the vtable. The difference here is 8 bytes.
+ So, for 2.95 compatibility, we need to:
+
+ (1) subtract 8 from the vptr initialiser, and
+ (2) add 2 to every vfunc index. (2 * 4 == 8.)
+
+ This is getting ever cheesier. */
+
+#define VPTR_INITIALIZER_ADJUSTMENT 8
+#define ADJUST_VTABLE_INDEX(IDX, VTBL) \
+ do { \
+ if (POSSIBLY_COMPILING_APPLE_KEXT_P () && flag_apple_kext) \
+ (IDX) = fold (build (PLUS_EXPR, TREE_TYPE (IDX), IDX, size_int (2))); \
+ } while (0)
+/* APPLE LOCAL end double destructor turly 20020214 */
+
+/* APPLE LOCAL begin zerofill turly 20020218 */
+/* This keeps uninitialized data from bloating the data when -fno-common.
+ Radar 2863107. */
+#define ASM_OUTPUT_ZEROFILL(FILE, NAME, SIZE, ALIGNMENT) \
+ do { \
+ fputs (".zerofill __DATA, __common, ", (FILE)); \
+ assemble_name ((FILE), (NAME)); \
+ fprintf ((FILE), ", " HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (SIZE)); \
+ fprintf ((FILE), ", " HOST_WIDE_INT_PRINT_DEC "\n", \
+ (HOST_WIDE_INT) (ALIGNMENT)); \
+ in_section = no_section; \
+ } while (0)
+/* APPLE LOCAL end zerofill turly 20020218 */
+
#undef ASM_APP_ON
#define ASM_APP_ON ""
#undef ASM_APP_OFF
#define ASM_APP_OFF ""
+extern const char *machopic_non_lazy_ptr_name PARAMS ((const char *));
+
void darwin_register_frameworks (int);
#define TARGET_EXTRA_INCLUDES darwin_register_frameworks
diff --git a/gcc/config/h8300/t-rtems b/gcc/config/h8300/t-rtems
deleted file mode 100644
index 104ee2366f1..00000000000
--- a/gcc/config/h8300/t-rtems
+++ /dev/null
@@ -1,7 +0,0 @@
-# Custom multilibs for RTEMS
-
-# -mn is not applicable to RTEMS (-mn implies 16bit void*)
-
-MULTILIB_OPTIONS = mh/ms mint32
-MULTILIB_DIRNAMES = h8300h h8300s int32
-MULTILIB_EXCEPTIONS = mint32
diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
deleted file mode 100644
index 7302d381dbe..00000000000
--- a/gcc/config/host-linux.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Linux host-specific hook definitions.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
- This file is part of GCC.
-
- GCC is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
- option) any later version.
-
- GCC is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GCC; see the file COPYING. If not, write to the
- Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include <sys/mman.h>
-#include "hosthooks.h"
-#include "hosthooks-def.h"
-
-
-/* Linux has a feature called exec-shield-randomize that perturbs the
- address of non-fixed mapped segments by a (relatively) small amount.
- The feature is intended to make it harder to attack the system with
- buffer overflow attacks, since every invocation of a program will
- have its libraries and data segments at slightly different addresses.
-
- This feature causes us problems with PCH because it makes it that
- much harder to acquire a stable location at which to map our PCH
- data file.
-
- [ The feature causes other points of non-determinism within the
- compiler as well, so we'd *really* like to be able to have the
- driver disable exec-shield-randomize for the process group, but
- that isn't possible at present. ]
-
- We're going to try several things:
-
- * Select an architecture specific address as "likely" and see
- if that's free. For our 64-bit hosts, we can easily choose
- an address in Never Never Land.
-
- * If exec-shield-randomize is disabled, then just use the
- address chosen by mmap in step one.
-
- * If exec-shield-randomize is enabled, then temporarily allocate
- 32M of memory as a buffer, then allocate PCH memory, then
- free the buffer. The theory here is that the perturbation is
- no more than 16M, and so by allocating our buffer larger than
- that we make it considerably more likely that the address will
- be free when we want to load the data back.
-*/
-
-#undef HOST_HOOKS_GT_PCH_GET_ADDRESS
-#define HOST_HOOKS_GT_PCH_GET_ADDRESS linux_gt_pch_get_address
-
-/* For various ports, try to guess a fixed spot in the vm space
- that's probably free. */
-#if defined(__alpha)
-# define TRY_EMPTY_VM_SPACE 0x10000000000
-#elif defined(__ia64)
-# define TRY_EMPTY_VM_SPACE 0x2000000100000000
-#elif defined(__x86_64)
-# define TRY_EMPTY_VM_SPACE 0x1000000000
-#elif defined(__i386)
-# define TRY_EMPTY_VM_SPACE 0x60000000
-#else
-# define TRY_EMPTY_VM_SPACE 0
-#endif
-
-/* Determine a location where we might be able to reliably allocate SIZE
- bytes. FD is the PCH file, though we should return with the file
- unmapped. */
-
-static void *
-linux_gt_pch_get_address (size_t size, int fd)
-{
- size_t buffer_size = 32 * 1024 * 1024;
- void *addr, *buffer;
- FILE *f;
- bool randomize_on;
-
- addr = mmap ((void *)TRY_EMPTY_VM_SPACE, size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE, fd, 0);
-
- /* If we failed the map, that means there's *no* free space. */
- if (addr == (void *) MAP_FAILED)
- return NULL;
- /* Unmap the area before returning. */
- munmap (addr, size);
-
- /* If we got the exact area we requested, then that's great. */
- if (TRY_EMPTY_VM_SPACE && addr == (void *) TRY_EMPTY_VM_SPACE)
- return addr;
-
- /* If we didn't, then we need to look to see if randomization is on. */
- f = fopen ("/proc/sys/kernel/exec-shield-randomize", "r");
- randomize_on = false;
- if (f != NULL)
- {
- char buf[100];
- size_t c;
-
- c = fread (buf, 1, sizeof buf - 1, f);
- if (c > 0)
- {
- buf[c] = '\0';
- randomize_on = (atoi (buf) > 0);
- }
- fclose (f);
- }
-
- /* If it isn't, then accept the address that mmap selected as fine. */
- if (!randomize_on)
- return addr;
-
- /* Otherwise, we need to try again with buffer space. */
- buffer = mmap (0, buffer_size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
- addr = mmap (0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
- if (buffer != (void *) MAP_FAILED)
- munmap (buffer, buffer_size);
- if (addr == (void *) MAP_FAILED)
- return NULL;
- munmap (addr, size);
-
- return addr;
-}
-
-
-const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
diff --git a/gcc/config/host-solaris.c b/gcc/config/host-solaris.c
deleted file mode 100644
index 4fa7a5b1ad0..00000000000
--- a/gcc/config/host-solaris.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Solaris host-specific hook definitions.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
- This file is part of GCC.
-
- GCC is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
- option) any later version.
-
- GCC is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GCC; see the file COPYING. If not, write to the
- Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include <sys/mman.h>
-#include "hosthooks.h"
-#include "hosthooks-def.h"
-
-
-#undef HOST_HOOKS_GT_PCH_USE_ADDRESS
-#define HOST_HOOKS_GT_PCH_USE_ADDRESS sol_gt_pch_use_address
-
-/* Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at
- mapping the data at BASE, -1 if we couldn't. */
-
-static int
-sol_gt_pch_use_address (void *base, size_t size, int fd, size_t offset)
-{
- void *addr;
-
- /* We're called with size == 0 if we're not planning to load a PCH
- file at all. This allows the hook to free any static space that
- we might have allocated at link time. */
- if (size == 0)
- return -1;
-
- addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
- fd, offset);
-
- /* Solaris isn't good about honoring the mmap START parameter
- without MAP_FIXED set. Before we give up, search the desired
- address space with mincore to see if the space is really free. */
- if (addr != base)
- {
- size_t page_size = getpagesize();
- char one_byte;
- size_t i;
-
- if (addr != (void *) MAP_FAILED)
- munmap (addr, size);
-
- errno = 0;
- for (i = 0; i < size; i += page_size)
- if (mincore ((char *)base + i, page_size, (void *)&one_byte) == -1
- && errno == ENOMEM)
- continue; /* The page is not mapped. */
- else
- break;
-
- if (i >= size)
- addr = mmap (base, size,
- PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED,
- fd, offset);
- }
-
- return addr == base ? 1 : -1;
-}
-
-
-const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index accffeee90c..f20c9d896b5 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -23,15 +23,21 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_MACHO
#define TARGET_MACHO 1
-#define TARGET_VERSION fprintf (stderr, " (i686 Darwin)");
+/* APPLE LOCAL begin default to ppro */
+/* Default to -mcpu=pentiumpro instead of i386 (radar 2730299) ilr */
+#undef TARGET_CPU_DEFAULT
+#define TARGET_CPU_DEFAULT 4
+/* APPLE LOCAL end default to ppro */
+
+#define TARGET_VERSION fprintf (stderr, " (i386 Darwin)");
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__i386__"); \
builtin_define ("__LITTLE_ENDIAN__"); \
- builtin_define ("__MACH__"); \
- builtin_define ("__APPLE__"); \
+ /* APPLE LOCAL constant cfstrings */ \
+ SUBTARGET_OS_CPP_BUILTINS (); \
} \
while (0)
@@ -39,19 +45,51 @@ Boston, MA 02111-1307, USA. */
the kernel or some such. */
#undef CC1_SPEC
-#define CC1_SPEC "%{!static:-fPIC}"
+/* APPLE LOCAL dynamic-no-pic */
+/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */
+/* When -mdynamic-no-pic finally works, remove the "xx" below. FIXME!! */
+#define CC1_SPEC "%{!static:%{!mxxdynamic-no-pic:-fPIC}} %<faltivec %<mlong-branch %<mlongcall %<mcpu=G4 %<mcpu=G5"
+
+/* APPLE LOCAL AltiVec */
+#define CPP_ALTIVEC_SPEC "%<faltivec"
+
+/* APPLE LOCAL begin 3492132 */
-#define ASM_SPEC "-arch i686 \
+#define ASM_SPEC "%(darwin_arch_asm_spec)\
-force_cpusubtype_ALL \
%{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
%{!Zforce_cpusubtype_ALL:%{mmmx:-force_cpusubtype_ALL}\
%{msse:-force_cpusubtype_ALL}\
%{msse2:-force_cpusubtype_ALL}}"
+#define DARWIN_ARCH_LD_SPEC \
+"%{march=i386: %{!Zdynamiclib:-arch i386} %{Zdynamiclib:-arch_only i386}} \
+ %{march=i486: %{!Zdynamiclib:-arch i486} %{Zdynamiclib:-arch_only i486}} \
+ %{march=i586: %{!Zdynamiclib:-arch i586} %{Zdynamiclib:-arch_only i586}} \
+ %{march=pentium: %{!Zdynamiclib:-arch pentium} %{Zdynamiclib:-arch_only pentium}} \
+ %{march=pentiumpro: %{!Zdynamiclib:-arch pentpro} %{Zdynamiclib:-arch_only pentpro}} \
+ %{march=i686: %{!Zdynamiclib:-arch i686} %{Zdynamiclib:-arch_only i686}} \
+ %{march=pentium3: %{!Zdynamiclib:-arch pentIIm3} %{Zdynamiclib:-arch_only pentIIm3}} \
+ %{!mcpu*:%{!march*:%{!Zdynamiclib:-arch i686} %{Zdynamiclib:-arch_only i686}}} "
+
+#define DARWIN_ARCH_ASM_SPEC \
+"%{march=i386: -arch i386} \
+ %{march=i486: -arch i486} \
+ %{march=i586: -arch i586} \
+ %{march=pentium: -arch pentium} \
+ %{march=pentiumpro: -arch pentpro} \
+ %{march=i686: -arch i686} \
+ %{march=pentium3: -arch pentIIm3} \
+ %{!mcpu*:%{!march*: -arch i686}} "
+
#undef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
+#define SUBTARGET_EXTRA_SPECS \
+ { "darwin_arch_asm_spec", DARWIN_ARCH_ASM_SPEC }, \
+ { "darwin_arch_ld_spec", DARWIN_ARCH_LD_SPEC }, \
{ "darwin_arch", "i686" },
+/* APPLE LOCAL end 3492132 */
+
/* Use the following macro for any Darwin/x86-specific command-line option
translation. */
#define SUBTARGET_OPTION_TRANSLATE_TABLE \
@@ -104,7 +142,12 @@ Boston, MA 02111-1307, USA. */
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
do { if ((LOG) != 0) \
{ \
- if (in_text_section ()) \
+ /* APPLE LOCAL coalescing */ \
+ if (in_text_section () \
+ || in_unlikely_text_section () \
+ || darwin_named_section_is ("__TEXT,__textcoal,coalesced") \
+ || darwin_named_section_is ("__TEXT,__textcoal_nt,coalesced,no_toc") \
+ || darwin_named_section_is (STATIC_INIT_SECTION)) \
fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \
else \
fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \
@@ -127,6 +170,27 @@ Boston, MA 02111-1307, USA. */
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (ROUNDED)))
+
+/* APPLE LOCAL begin Macintosh alignment 2002-2-19 ff */
+#define MASK_ALIGN_NATURAL 0x40000000
+#define TARGET_ALIGN_NATURAL (target_flags & MASK_ALIGN_NATURAL)
+#define rs6000_alignment_flags target_flags
+#define MASK_ALIGN_MAC68K 0x20000000
+#define TARGET_ALIGN_MAC68K (target_flags & MASK_ALIGN_MAC68K)
+
+#undef SUBTARGET_SWITCHES
+#define SUBTARGET_SWITCHES \
+ {"align-mac68k", MASK_ALIGN_MAC68K, \
+ N_("Align structs and unions according to mac68k rules")}, \
+ {"align-power", - (MASK_ALIGN_MAC68K | MASK_ALIGN_NATURAL), \
+ N_("Align structs and unions according to PowerPC rules")}, \
+ {"align-natural", MASK_ALIGN_NATURAL, \
+ N_("Align structs and unions according to natural rules")}, \
+ {"dynamic-no-pic", MASK_MACHO_DYNAMIC_NO_PIC, \
+ N_("Generate code suitable for executables (NOT shared libs)")},\
+ {"no-dynamic-no-pic", -MASK_MACHO_DYNAMIC_NO_PIC, ""},
+/* APPLE LOCAL end Macintosh alignment 2002-2-19 ff */
+
/* Darwin profiling -- call mcount. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
@@ -139,3 +203,14 @@ Boston, MA 02111-1307, USA. */
} \
else fprintf (FILE, "\tcall mcount\n"); \
} while (0)
+
+/* APPLE LOCAL SSE stack alignment */
+#define BASIC_STACK_BOUNDARY (128)
+
+#undef SUBTARGET_OVERRIDE_OPTIONS
+/* Force Darwin/x86 to default as "-march=i686 -mcpu=pentium4". */
+#define SUBTARGET_OVERRIDE_OPTIONS \
+ do { \
+ if (!ix86_arch_string) ix86_arch_string = "pentiumpro"; \
+ if (!ix86_tune_string) ix86_tune_string = "pentium4"; \
+ } while (0)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 58e26333a5c..ceeecb7ebd1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -459,6 +459,34 @@ struct processor_costs pentium4_cost = {
const struct processor_costs *ix86_cost = &pentium_cost;
+/* APPLE LOCAL begin Altivec */
+/* vector types */
+static GTY(()) tree unsigned_V16QI_type_node;
+static GTY(()) tree unsigned_V4SI_type_node;
+static GTY(()) tree unsigned_V8QI_type_node;
+static GTY(()) tree unsigned_V8HI_type_node;
+static GTY(()) tree unsigned_V4HI_type_node;
+static GTY(()) tree unsigned_V2HI_type_node;
+static GTY(()) tree unsigned_V2SI_type_node;
+static GTY(()) tree unsigned_V2DI_type_node;
+static GTY(()) tree unsigned_V1DI_type_node;
+
+static GTY(()) tree V16QI_type_node;
+static GTY(()) tree V4SF_type_node;
+static GTY(()) tree V4SI_type_node;
+static GTY(()) tree V8QI_type_node;
+static GTY(()) tree V8HI_type_node;
+static GTY(()) tree V4HI_type_node;
+static GTY(()) tree V2HI_type_node;
+static GTY(()) tree V2SI_type_node;
+static GTY(()) tree V2SF_type_node;
+static GTY(()) tree V2DI_type_node;
+static GTY(()) tree V2DF_type_node;
+static GTY(()) tree V16SF_type_node;
+static GTY(()) tree V1DI_type_node;
+static GTY(()) tree V4DF_type_node;
+/* APPLE LOCAL end Altivec */
+
/* Processor feature/optimization bitmasks. */
#define m_386 (1<<PROCESSOR_I386)
#define m_486 (1<<PROCESSOR_I486)
@@ -1004,6 +1032,12 @@ static void init_ext_80387_constants (void);
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST ix86_address_cost
+/* APPLE LOCAL begin SSE stack alignment */
+#ifndef BASIC_STACK_BOUNDARY
+#define BASIC_STACK_BOUNDARY (32)
+#endif
+/* APPLE LOCAL end SSE stack alignment */
+
#undef TARGET_FIXED_CONDITION_CODE_REGS
#define TARGET_FIXED_CONDITION_CODE_REGS ix86_fixed_condition_code_regs
#undef TARGET_CC_MODES_COMPATIBLE
@@ -1165,6 +1199,12 @@ override_options (void)
SUBTARGET_OVERRIDE_OPTIONS;
#endif
+ /* APPLE LOCAL begin constant cfstrings */
+#ifdef SUBSUBTARGET_OVERRIDE_OPTIONS
+ SUBSUBTARGET_OVERRIDE_OPTIONS;
+#endif
+ /* APPLE LOCAL end constant cfstrings */
+
if (!ix86_tune_string && ix86_arch_string)
ix86_tune_string = ix86_arch_string;
if (!ix86_tune_string)
@@ -1345,9 +1385,11 @@ override_options (void)
The default of 128 bits is for Pentium III's SSE __m128, but we
don't want additional code to keep the stack aligned when
optimizing for code size. */
+ /* APPLE LOCAL begin SSE stack alignment */
ix86_preferred_stack_boundary = (optimize_size
- ? TARGET_64BIT ? 128 : 32
+ ? TARGET_64BIT ? 128 : BASIC_STACK_BOUNDARY
: 128);
+ /* APPLE LOCAL end SSE stack alignment */
if (ix86_preferred_stack_boundary_string)
{
i = atoi (ix86_preferred_stack_boundary_string);
@@ -1485,11 +1527,24 @@ override_options (void)
internal_label_prefix_len = p - internal_label_prefix;
*p = '\0';
}
+
+ /* APPLE LOCAL begin dynamic-no-pic */
+ if (flag_pic == 1)
+ {
+ /* Darwin doesn't support -fpic. */
+ warning ("-fpic is not supported; -fPIC assumed");
+ flag_pic = 2;
+ }
+ /* APPLE LOCAL end dynamic-no-pic */
}
void
optimization_options (int level, int size ATTRIBUTE_UNUSED)
{
+ /* APPLE LOCAL disable strict aliasing; breaks too much existing code. */
+#if TARGET_MACHO
+ flag_strict_aliasing = 0;
+#endif
/* For -O2 and beyond, turn off -fschedule-insns by default. It tends to
make the problem with not enough registers even worse. */
#ifdef INSN_SCHEDULING
@@ -1529,6 +1584,11 @@ const struct attribute_spec ix86_attribute_table[] =
#endif
{ "ms_struct", 0, 0, false, false, false, ix86_handle_struct_attribute },
{ "gcc_struct", 0, 0, false, false, false, ix86_handle_struct_attribute },
+ /* APPLE LOCAL begin double destructor */
+#ifdef SUBTARGET_ATTRIBUTE_TABLE
+ SUBTARGET_ATTRIBUTE_TABLE
+#endif
+ /* APPLE LOCAL end double destructor */
{ NULL, 0, 0, false, false, false, NULL }
};
@@ -12914,6 +12974,12 @@ ix86_init_builtins (void)
{
if (TARGET_MMX)
ix86_init_mmx_sse_builtins ();
+
+ /* APPLE LOCAL begin constant cfstrings */
+#ifdef SUBTARGET_INIT_BUILTINS
+ SUBTARGET_INIT_BUILTINS;
+#endif
+ /* APPLE LOCAL end constant cfstrings */
}
/* Set up all the MMX/SSE builtins. This is not called if TARGET_MMX
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index b90f590b98a..009ef8fae57 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -34,6 +34,9 @@ Boston, MA 02111-1307, USA. */
ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many
that start with ASM_ or end in ASM_OP. */
+/* APPLE LOCAL fat builds */
+#define DEFAULT_TARGET_ARCH "i386"
+
/* Define the specific costs for a given cpu */
struct processor_costs {
@@ -207,6 +210,11 @@ extern int target_flags;
#endif
#endif
+/* APPLE LOCAL begin hot/cold partitioning */
+#define HAS_LONG_COND_BRANCH 1
+#define HAS_LONG_UNCOND_BRANCH 1
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Avoid adding %gs:0 in TLS references; use %gs:address directly. */
#define TARGET_TLS_DIRECT_SEG_REFS (target_flags & MASK_TLS_DIRECT_SEG_REFS)
@@ -774,7 +782,8 @@ extern int x86_prefetch_sse;
#define PARM_BOUNDARY BITS_PER_WORD
/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY BITS_PER_WORD
+/* APPLE LOCAL 3232990 - compiler should obey -mpreferred-stack-boundary */
+#define STACK_BOUNDARY ((ix86_preferred_stack_boundary > 128) ? 128 : ix86_preferred_stack_boundary)
/* Boundary (in *bits*) on which the stack pointer prefers to be
aligned; the compiler cannot rely on having this alignment. */
@@ -825,7 +834,8 @@ extern int x86_prefetch_sse;
#define BIGGEST_FIELD_ALIGNMENT 32
#endif
#else
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
+/* APPLE LOCAL Macintosh alignment */
+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED, FIRST_FIELD_P) \
x86_field_alignment (FIELD, COMPUTED)
#endif
@@ -1069,6 +1079,10 @@ do { \
: VALID_MMX_REG_MODE (MODE) && TARGET_MMX ? 1 \
: VALID_MMX_REG_MODE_3DNOW (MODE) && TARGET_3DNOW ? 1 : 0)
+/* ??? Shouldn't be needed... */
+#define UNITS_PER_SIMD_WORD \
+ (TARGET_SSE ? 16 : TARGET_MMX || TARGET_3DNOW ? 8 : 0)
+
#define VALID_FP_MODE_P(MODE) \
((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \
|| (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \
@@ -2485,7 +2499,10 @@ enum ix86_builtins
IX86_BUILTIN_MONITOR,
IX86_BUILTIN_MWAIT,
- IX86_BUILTIN_MAX
+ /* APPLE LOCAL begin constant cfstrings */
+ IX86_BUILTIN_MAX,
+ TARGET_BUILTIN_MAX = IX86_BUILTIN_MAX
+ /* APPLE LOCAL end constant cfstrings */
};
/* Max number of args passed in registers. If this is more than 3, we will
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index 2ae567ef3d4..07278e95789 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -36,10 +36,11 @@
#error Use the "-maltivec" flag to enable PowerPC AltiVec support
#endif
-/* You are allowed to undef these for C++ compatibility. */
-#define vector __vector
-#define pixel __pixel
-#define bool __bool
+/* APPLE LOCAL begin AltiVec */
+/* The keywords 'vector', 'pixel' and 'bool' are now implemented as
+ context-sensitive macros, and hence should not be defined
+ unconditionally. */
+/* APPLE LOCAL end AltiVec */
/* Condition register codes for AltiVec predicates. */
@@ -117,7 +118,7 @@ inline void vec_dst (const vector unsigned int *, int, const int) __attribute__
inline void vec_dst (const vector signed int *, int, const int) __attribute__ ((always_inline));
inline void vec_dst (const vector bool int *, int, const int) __attribute__ ((always_inline));
inline void vec_dst (const vector float *, int, const int) __attribute__ ((always_inline));
-inline void vec_dst (const int *, int, const int) __attribute__ ((always_inline));
+inline void vec_dst (const unsigned char *, int, const int) __attribute__ ((always_inline));
inline void vec_dst (const signed char *, int, const int) __attribute__ ((always_inline));
inline void vec_dst (const unsigned short *, int, const int) __attribute__ ((always_inline));
inline void vec_dst (const short *, int, const int) __attribute__ ((always_inline));
@@ -138,7 +139,7 @@ inline void vec_dstst (const vector unsigned int *, int, const int) __attribute_
inline void vec_dstst (const vector signed int *, int, const int) __attribute__ ((always_inline));
inline void vec_dstst (const vector bool int *, int, const int) __attribute__ ((always_inline));
inline void vec_dstst (const vector float *, int, const int) __attribute__ ((always_inline));
-inline void vec_dstst (const int *, int, const int) __attribute__ ((always_inline));
+inline void vec_dstst (const unsigned char *, int, const int) __attribute__ ((always_inline));
inline void vec_dstst (const signed char *, int, const int) __attribute__ ((always_inline));
inline void vec_dstst (const unsigned short *, int, const int) __attribute__ ((always_inline));
inline void vec_dstst (const short *, int, const int) __attribute__ ((always_inline));
@@ -159,7 +160,7 @@ inline void vec_dststt (const vector unsigned int *, int, const int) __attribute
inline void vec_dststt (const vector signed int *, int, const int) __attribute__ ((always_inline));
inline void vec_dststt (const vector bool int *, int, const int) __attribute__ ((always_inline));
inline void vec_dststt (const vector float *, int, const int) __attribute__ ((always_inline));
-inline void vec_dststt (const int *, int, const int) __attribute__ ((always_inline));
+inline void vec_dststt (const unsigned char *, int, const int) __attribute__ ((always_inline));
inline void vec_dststt (const signed char *, int, const int) __attribute__ ((always_inline));
inline void vec_dststt (const unsigned short *, int, const int) __attribute__ ((always_inline));
inline void vec_dststt (const short *, int, const int) __attribute__ ((always_inline));
@@ -180,7 +181,7 @@ inline void vec_dstt (const vector unsigned int *, int, const int) __attribute__
inline void vec_dstt (const vector signed int *, int, const int) __attribute__ ((always_inline));
inline void vec_dstt (const vector bool int *, int, const int) __attribute__ ((always_inline));
inline void vec_dstt (const vector float *, int, const int) __attribute__ ((always_inline));
-inline void vec_dstt (const int *, int, const int) __attribute__ ((always_inline));
+inline void vec_dstt (const unsigned char *, int, const int) __attribute__ ((always_inline));
inline void vec_dstt (const signed char *, int, const int) __attribute__ ((always_inline));
inline void vec_dstt (const unsigned short *, int, const int) __attribute__ ((always_inline));
inline void vec_dstt (const short *, int, const int) __attribute__ ((always_inline));
@@ -195,15 +196,20 @@ inline vector signed int vec_sld (vector signed int, vector signed int, const in
inline vector unsigned int vec_sld (vector unsigned int, vector unsigned int, const int) __attribute__ ((always_inline));
inline vector signed short vec_sld (vector signed short, vector signed short, const int) __attribute__ ((always_inline));
inline vector unsigned short vec_sld (vector unsigned short, vector unsigned short, const int) __attribute__ ((always_inline));
+inline vector pixel vec_sld (vector pixel, vector pixel, const int) __attribute__ ((always_inline));
inline vector signed char vec_sld (vector signed char, vector signed char, const int) __attribute__ ((always_inline));
inline vector unsigned char vec_sld (vector unsigned char, vector unsigned char, const int) __attribute__ ((always_inline));
inline vector signed char vec_splat (vector signed char, const int) __attribute__ ((always_inline));
inline vector unsigned char vec_splat (vector unsigned char, const int) __attribute__ ((always_inline));
+inline vector bool char vec_splat (vector bool char, const int) __attribute__ ((always_inline));
inline vector signed short vec_splat (vector signed short, const int) __attribute__ ((always_inline));
inline vector unsigned short vec_splat (vector unsigned short, const int) __attribute__ ((always_inline));
+inline vector bool short vec_splat (vector bool short, const int) __attribute__ ((always_inline));
+inline vector pixel vec_splat (vector pixel, const int) __attribute__ ((always_inline));
inline vector float vec_splat (vector float, const int) __attribute__ ((always_inline));
inline vector signed int vec_splat (vector signed int, const int) __attribute__ ((always_inline));
inline vector unsigned int vec_splat (vector unsigned int, const int) __attribute__ ((always_inline));
+inline vector bool int vec_splat (vector bool int, const int) __attribute__ ((always_inline));
inline vector signed char vec_splat_s8 (const int) __attribute__ ((always_inline));
inline vector signed short vec_splat_s16 (const int) __attribute__ ((always_inline));
inline vector signed int vec_splat_s32 (const int) __attribute__ ((always_inline));
@@ -8897,7 +8903,7 @@ __ch (__bin_args_eq (vector unsigned int, (a1), vector unsigned int, (a2)), \
((vector unsigned int) __builtin_altivec_vmrghw ((vector signed int) (a1), (vector signed int) (a2))), \
__ch (__bin_args_eq (vector bool int, (a1), vector bool int, (a2)), \
((vector bool int) __builtin_altivec_vmrghw ((vector signed int) (a1), (vector signed int) (a2))), \
- __builtin_altivec_compiletime_error ("vec_mergeh")))))))))))
+ __builtin_altivec_compiletime_error ("vec_mergeh"))))))))))))
#define vec_vmrghw(a1, a2) \
__ch (__bin_args_eq (vector float, (a1), vector float, (a2)), \
@@ -8945,7 +8951,7 @@ __ch (__bin_args_eq (vector unsigned int, (a1), vector unsigned int, (a2)), \
((vector unsigned int) __builtin_altivec_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
__ch (__bin_args_eq (vector bool int, (a1), vector bool int, (a2)), \
((vector bool int) __builtin_altivec_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
- __builtin_altivec_compiletime_error ("vec_mergel"))))))))
+ __builtin_altivec_compiletime_error ("vec_mergel"))))))))))))
#define vec_vmrglw(a1, a2) \
__ch (__bin_args_eq (vector float, (a1), vector float, (a2)), \
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 2ede79d9f5c..6a46328fb24 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -388,6 +388,22 @@
"vaddsws %0,%1,%2"
[(set_attr "type" "vecsimple")])
+(define_insn "andv16qi3"
+ [(set (match_operand:V16QI 0 "register_operand" "=v")
+ (and:V16QI (match_operand:V16QI 1 "register_operand" "v")
+ (match_operand:V16QI 2 "register_operand" "v")))]
+ "TARGET_ALTIVEC"
+ "vand %0,%1,%2"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "andv8hi3"
+ [(set (match_operand:V8HI 0 "register_operand" "=v")
+ (and:V8HI (match_operand:V8HI 1 "register_operand" "v")
+ (match_operand:V8HI 2 "register_operand" "v")))]
+ "TARGET_ALTIVEC"
+ "vand %0,%1,%2"
+ [(set_attr "type" "vecsimple")])
+
(define_insn "andv4si3"
[(set (match_operand:V4SI 0 "register_operand" "=v")
(and:V4SI (match_operand:V4SI 1 "register_operand" "v")
@@ -976,6 +992,43 @@
"vnor %0,%1,%2"
[(set_attr "type" "vecsimple")])
+(define_insn "one_cmplv16qi2"
+ [(set (match_operand:V16QI 0 "register_operand" "=v")
+ (not:V16QI (match_operand:V16QI 1 "register_operand" "v")))]
+ "TARGET_ALTIVEC"
+ "vnot %0,%1"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "one_cmplv8hi2"
+ [(set (match_operand:V8HI 0 "register_operand" "=v")
+ (not:V8HI (match_operand:V8HI 1 "register_operand" "v")))]
+ "TARGET_ALTIVEC"
+ "vnot %0,%1"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "one_cmplv4si2"
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
+ (not:V4SI (match_operand:V4SI 1 "register_operand" "v")))]
+ "TARGET_ALTIVEC"
+ "vnot %0,%1"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "iorv16qi3"
+ [(set (match_operand:V16QI 0 "register_operand" "=v")
+ (ior:V16QI (match_operand:V16QI 1 "register_operand" "v")
+ (match_operand:V16QI 2 "register_operand" "v")))]
+ "TARGET_ALTIVEC"
+ "vor %0,%1,%2"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "iorv8hi3"
+ [(set (match_operand:V8HI 0 "register_operand" "=v")
+ (ior:V8HI (match_operand:V8HI 1 "register_operand" "v")
+ (match_operand:V8HI 2 "register_operand" "v")))]
+ "TARGET_ALTIVEC"
+ "vor %0,%1,%2"
+ [(set_attr "type" "vecsimple")])
+
(define_insn "iorv4si3"
[(set (match_operand:V4SI 0 "register_operand" "=v")
(ior:V4SI (match_operand:V4SI 1 "register_operand" "v")
diff --git a/gcc/config/rs6000/builtin.ops b/gcc/config/rs6000/builtin.ops
new file mode 100644
index 00000000000..a28e35654fc
--- /dev/null
+++ b/gcc/config/rs6000/builtin.ops
@@ -0,0 +1,297 @@
+# APPLE LOCAL file AltiVec
+# ops-to-gp -gcc vec.ops builtin.ops
+# @ betype betype-code type-spelling
+@ @ float BETYPE_R4 float
+@ @ ushort BETYPE_U4 unsigned=short
+@ @ uint BETYPE_U4 unsigned=int
+@ @ ulong BETYPE_U4 unsigned=long
+@ @ immed_u2 U2 0..3
+@ @ immed_u4 U4 0..15
+@ @ immed_s5 I5 -16..15
+@ @ immed_u5 U5 0..31
+@ @ int BETYPE_I4 int
+@ @ long BETYPE_I4 long
+@ @ ptr PTR void=*
+@ @ v16 BETYPE_V16 vec_type
+@ @ void BETYPE_I4 void
+# fetype betype [code [spelling]]
+@ float_ptr ptr i float=*
+@ const_float_ptr ptr i float=*
+@ const_volatile_float_ptr ptr i float=*
+@ int int i
+@ int_ptr ptr i int=*
+@ long_ptr ptr i long=*
+@ const_int_ptr ptr i int=*
+@ const_long_ptr ptr i long=*
+@ const_volatile_int_ptr ptr i int=*
+@ const_volatile_long_ptr ptr i long=*
+@ immed_s5 immed_s5 A
+@ immed_u5 immed_u5 B
+@ immed_u4 immed_u4 C
+@ immed_u2 immed_u2 D
+@ cc24f int j=24=f
+@ cc24fd int j=24=f=d
+@ cc24fr int j=24=f=r
+@ cc24t int j=24=t
+@ cc24td int j=24=t=d
+@ cc24tr int j=24=t=r
+@ cc26f int j=26=f
+@ cc26fd int j=26=f=d
+@ cc26fr int j=26=f=r
+@ cc26t int j=26=t
+@ cc26td int j=26=t=d
+@ cc26tr int j=26=t=r
+@ short_ptr ptr i short=*
+@ signed_char_ptr ptr i signed=char=*
+@ unsigned_char_ptr ptr i unsigned=char=*
+@ unsigned_short_ptr ptr i unsigned=short=*
+@ unsigned_int_ptr ptr i unsigned=int=*
+@ unsigned_long_ptr ptr i unsigned=long=*
+@ const_short_ptr ptr i short=*
+@ const_signed_char_ptr ptr i signed=char=*
+@ const_unsigned_char_ptr ptr i unsigned=char=*
+@ const_unsigned_short_ptr ptr i unsigned=short=*
+@ const_unsigned_int_ptr ptr i unsigned=int=*
+@ const_unsigned_long_ptr ptr i unsigned=long=*
+@ const_volatile_short_ptr ptr i short=*
+@ const_volatile_signed_char_ptr ptr i signed=char=*
+@ const_volatile_unsigned_char_ptr ptr i unsigned=char=*
+@ const_volatile_unsigned_short_ptr ptr i unsigned=short=*
+@ const_volatile_unsigned_int_ptr ptr i unsigned=int=*
+@ const_volatile_unsigned_long_ptr ptr i unsigned=long=*
+@ vec_b16 v16 x vec_b16
+@ vec_b16_load_op v16 xl vec_b16
+@ vec_b16_ptr ptr i vec_b16=*
+@ const_vec_b16_ptr ptr i vec_b16=*
+@ vec_b32 v16 x vec_b32
+@ vec_b32_load_op v16 xl vec_b32
+@ vec_b32_ptr ptr i vec_b32=*
+@ const_vec_b32_ptr ptr i vec_b32=*
+@ vec_b8 v16 x vec_b8
+@ vec_b8_load_op v16 xl vec_b8
+@ vec_b8_ptr ptr i vec_b8=*
+@ const_vec_b8_ptr ptr i vec_b8=*
+@ vec_f32 v16 x vec_f32
+@ vec_f32_load_op v16 xl vec_f32
+@ vec_f32_ptr ptr i vec_f32=*
+@ const_vec_f32_ptr ptr i vec_f32=*
+@ vec_p16 v16 x vec_p16
+@ vec_p16_load_op v16 xl vec_p16
+@ vec_p16_ptr ptr i vec_p16=*
+@ const_vec_p16_ptr ptr i vec_p16=*
+@ vec_s16 v16 x vec_s16
+@ vec_s16_load_op v16 xl vec_s16
+@ vec_s16_ptr ptr i vec_s16=*
+@ const_vec_s16_ptr ptr i vec_s16=*
+@ vec_s32 v16 x vec_s32
+@ vec_s32_load_op v16 xl vec_s32
+@ vec_s32_ptr ptr i vec_s32=*
+@ const_vec_s32_ptr ptr i vec_s32=*
+@ vec_s8 v16 x vec_s8
+@ vec_s8_load_op v16 xl vec_s8
+@ vec_s8_ptr ptr i vec_s8=*
+@ const_vec_s8_ptr ptr i vec_s8=*
+@ vec_u16 v16 x vec_u16
+@ vec_u16_load_op v16 xl vec_u16
+@ vec_u16_ptr ptr i vec_u16=*
+@ const_vec_u16_ptr ptr i vec_u16=*
+@ vec_u32 v16 x vec_u32
+@ vec_u32_load_op v16 xl vec_u32
+@ vec_u32_ptr ptr i vec_u32=*
+@ const_vec_u32_ptr ptr i vec_u32=*
+@ vec_u8 v16 x vec_u8
+@ vec_u8_load_op v16 xl vec_u8
+@ vec_u8_ptr ptr i vec_u8=*
+@ const_vec_u8_ptr ptr i vec_u8=*
+@ void_store_op void s
+@ volatile_void void v
+@ volatile_void_load_op void vl
+@ volatile_void_store_op void vs
+@ volatile_vec_u16 v16 vx vec_u16
+@ char_ptr ptr i char=*
+@ const_char_ptr ptr i char=*
+# @ @ instruction type
+@ @ @ MOP_mfvscr fxu
+@ @ @ MOP_mtvscr fxu
+@ @ @ MOP_dss load
+@ @ @ MOP_dssall load
+@ @ @ MOP_dst load
+@ @ @ MOP_dstst load
+@ @ @ MOP_dststt load
+@ @ @ MOP_dstt load
+@ @ @ MOP_lvebx load
+@ @ @ MOP_lvehx load
+@ @ @ MOP_lvewx load
+@ @ @ MOP_lvsl load
+@ @ @ MOP_lvsr load
+@ @ @ MOP_lvx load
+@ @ @ MOP_lvxl load
+@ @ @ MOP_stvebx store
+@ @ @ MOP_stvehx store
+@ @ @ MOP_stvewx store
+@ @ @ MOP_stvx store
+@ @ @ MOP_stvxl store
+@ @ @ MOP_vaddcuw simple
+@ @ @ MOP_vaddfp fp
+@ @ @ MOP_vaddsbs simple
+@ @ @ MOP_vaddshs simple
+@ @ @ MOP_vaddsws simple
+@ @ @ MOP_vaddubm simple
+@ @ @ MOP_vaddubs simple
+@ @ @ MOP_vadduhm simple
+@ @ @ MOP_vadduhs simple
+@ @ @ MOP_vadduwm simple
+@ @ @ MOP_vadduws simple
+@ @ @ MOP_vand simple
+@ @ @ MOP_vandc simple
+@ @ @ MOP_vavgsb simple
+@ @ @ MOP_vavgsh simple
+@ @ @ MOP_vavgsw simple
+@ @ @ MOP_vavgub simple
+@ @ @ MOP_vavguh simple
+@ @ @ MOP_vavguw simple
+@ @ @ MOP_vcfsx fp
+@ @ @ MOP_vcfux fp
+@ @ @ MOP_vcmpbfp simple
+@ @ @ MOP_vcmpbfpD simple
+@ @ @ MOP_vcmpeqfp simple
+@ @ @ MOP_vcmpeqfpD simple
+@ @ @ MOP_vcmpequb simple
+@ @ @ MOP_vcmpequbD simple
+@ @ @ MOP_vcmpequh simple
+@ @ @ MOP_vcmpequhD simple
+@ @ @ MOP_vcmpequw simple
+@ @ @ MOP_vcmpequwD simple
+@ @ @ MOP_vcmpgefp simple
+@ @ @ MOP_vcmpgefpD simple
+@ @ @ MOP_vcmpgtfp simple
+@ @ @ MOP_vcmpgtfpD simple
+@ @ @ MOP_vcmpgtsb simple
+@ @ @ MOP_vcmpgtsbD simple
+@ @ @ MOP_vcmpgtsh simple
+@ @ @ MOP_vcmpgtshD simple
+@ @ @ MOP_vcmpgtsw simple
+@ @ @ MOP_vcmpgtswD simple
+@ @ @ MOP_vcmpgtub simple
+@ @ @ MOP_vcmpgtubD simple
+@ @ @ MOP_vcmpgtuh simple
+@ @ @ MOP_vcmpgtuhD simple
+@ @ @ MOP_vcmpgtuw simple
+@ @ @ MOP_vcmpgtuwD simple
+@ @ @ MOP_vctsxs fp
+@ @ @ MOP_vctuxs fp
+@ @ @ MOP_vexptefp fp
+@ @ @ MOP_vlogefp fp
+@ @ @ MOP_vmaddfp fp
+@ @ @ MOP_vmaxfp simple
+@ @ @ MOP_vmaxsb simple
+@ @ @ MOP_vmaxsh simple
+@ @ @ MOP_vmaxsw simple
+@ @ @ MOP_vmaxub simple
+@ @ @ MOP_vmaxuh simple
+@ @ @ MOP_vmaxuw simple
+@ @ @ MOP_vmhaddshs complex
+@ @ @ MOP_vmhraddshs complex
+@ @ @ MOP_vminfp simple
+@ @ @ MOP_vminsb simple
+@ @ @ MOP_vminsh simple
+@ @ @ MOP_vminsw simple
+@ @ @ MOP_vminub simple
+@ @ @ MOP_vminuh simple
+@ @ @ MOP_vminuw simple
+@ @ @ MOP_vmladduhm complex
+@ @ @ MOP_vmrghb perm
+@ @ @ MOP_vmrghh perm
+@ @ @ MOP_vmrghw perm
+@ @ @ MOP_vmrglb perm
+@ @ @ MOP_vmrglh perm
+@ @ @ MOP_vmrglw perm
+@ @ @ MOP_vmsummbm complex
+@ @ @ MOP_vmsumshm complex
+@ @ @ MOP_vmsumshs complex
+@ @ @ MOP_vmsumubm complex
+@ @ @ MOP_vmsumuhm complex
+@ @ @ MOP_vmsumuhs complex
+@ @ @ MOP_vmulesb complex
+@ @ @ MOP_vmulesh complex
+@ @ @ MOP_vmuleub complex
+@ @ @ MOP_vmuleuh complex
+@ @ @ MOP_vmulosb complex
+@ @ @ MOP_vmulosh complex
+@ @ @ MOP_vmuloub complex
+@ @ @ MOP_vmulouh complex
+@ @ @ MOP_vnmsubfp fp
+@ @ @ MOP_vnor simple
+@ @ @ MOP_vor simple
+@ @ @ MOP_vperm perm
+@ @ @ MOP_vpkpx perm
+@ @ @ MOP_vpkshss perm
+@ @ @ MOP_vpkshus perm
+@ @ @ MOP_vpkswss perm
+@ @ @ MOP_vpkswus perm
+@ @ @ MOP_vpkuhum perm
+@ @ @ MOP_vpkuhus perm
+@ @ @ MOP_vpkuwum perm
+@ @ @ MOP_vpkuwus perm
+@ @ @ MOP_vrefp fp
+@ @ @ MOP_vrfim fp
+@ @ @ MOP_vrfin fp
+@ @ @ MOP_vrfip fp
+@ @ @ MOP_vrfiz fp
+@ @ @ MOP_vrlb simple
+@ @ @ MOP_vrlh simple
+@ @ @ MOP_vrlw simple
+@ @ @ MOP_vrsqrtefp fp
+@ @ @ MOP_vsel simple
+@ @ @ MOP_vsl simple
+@ @ @ MOP_vslb simple
+@ @ @ MOP_vsldoi perm
+@ @ @ MOP_vslh simple
+@ @ @ MOP_vslo perm_bug
+@ @ @ MOP_vslw simple
+@ @ @ MOP_vspltb perm
+@ @ @ MOP_vsplth perm
+@ @ @ MOP_vspltisb perm
+@ @ @ MOP_vspltish perm
+@ @ @ MOP_vspltisw perm
+@ @ @ MOP_vspltw perm
+@ @ @ MOP_vsr simple
+@ @ @ MOP_vsrab simple
+@ @ @ MOP_vsrah simple
+@ @ @ MOP_vsraw simple
+@ @ @ MOP_vsrb simple
+@ @ @ MOP_vsrh simple
+@ @ @ MOP_vsro perm_bug
+@ @ @ MOP_vsrw simple
+@ @ @ MOP_vsubcuw simple
+@ @ @ MOP_vsubfp fp
+@ @ @ MOP_vsubsbs simple
+@ @ @ MOP_vsubshs simple
+@ @ @ MOP_vsubsws simple
+@ @ @ MOP_vsububm simple
+@ @ @ MOP_vsububs simple
+@ @ @ MOP_vsubuhm simple
+@ @ @ MOP_vsubuhs simple
+@ @ @ MOP_vsubuwm simple
+@ @ @ MOP_vsubuws simple
+@ @ @ MOP_vsum2sws complex
+@ @ @ MOP_vsum4sbs complex
+@ @ @ MOP_vsum4shs complex
+@ @ @ MOP_vsum4ubs complex
+@ @ @ MOP_vsumsws complex
+@ @ @ MOP_vupkhpx perm
+@ @ @ MOP_vupkhsb perm
+@ @ @ MOP_vupkhsh perm
+@ @ @ MOP_vupklpx perm
+@ @ @ MOP_vupklsb perm
+@ @ @ MOP_vupklsh perm
+@ @ @ MOP_vxor simple
+# The vec_abs and vec_abss operations identify their variants with insn_name.
+# Map these into a valid insn code (xfx_perm).
+@ @ @ 1 perm
+@ @ @ 2 perm
+@ @ @ 3 perm
+@ @ @ 4 perm
+@ @ @ 5 perm
+@ @ @ 6 perm
+@ @ @ 7 perm
diff --git a/gcc/config/rs6000/darwin-fpsave.asm b/gcc/config/rs6000/darwin-fpsave.asm
new file mode 100644
index 00000000000..d25a1141c45
--- /dev/null
+++ b/gcc/config/rs6000/darwin-fpsave.asm
@@ -0,0 +1,69 @@
+/* APPLE LOCAL file performance improvement */
+/* This file contains the floating-point save and restore routines.
+
+ THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE
+ ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31,
+ for example. For FP reg saves/restores, it takes one instruction
+ (4 bytes) to do the operation; for Vector regs, 2 instructions are
+ required (8 bytes.)
+
+ MORAL: DO NOT MESS AROUND WITH THESE FUNCTIONS! */
+
+.text
+ .align 2
+
+/* saveFP saves R0 -- assumed to be the callers LR -- to 8(R1). */
+
+.private_extern saveFP
+saveFP:
+ stfd f14,-144(r1)
+ stfd f15,-136(r1)
+ stfd f16,-128(r1)
+ stfd f17,-120(r1)
+ stfd f18,-112(r1)
+ stfd f19,-104(r1)
+ stfd f20,-96(r1)
+ stfd f21,-88(r1)
+ stfd f22,-80(r1)
+ stfd f23,-72(r1)
+ stfd f24,-64(r1)
+ stfd f25,-56(r1)
+ stfd f26,-48(r1)
+ stfd f27,-40(r1)
+ stfd f28,-32(r1)
+ stfd f29,-24(r1)
+ stfd f30,-16(r1)
+ stfd f31,-8(r1)
+ stw r0,8(r1)
+ blr
+
+/* restFP restores the caller`s LR from 8(R1). Note that the code for
+ this starts at the offset of F30 restoration, so calling this
+ routine in an attempt to restore only F31 WILL NOT WORK (it would
+ be a stupid thing to do, anyway.) */
+
+.private_extern restFP
+restFP:
+ lfd f14,-144(r1)
+ lfd f15,-136(r1)
+ lfd f16,-128(r1)
+ lfd f17,-120(r1)
+ lfd f18,-112(r1)
+ lfd f19,-104(r1)
+ lfd f20,-96(r1)
+ lfd f21,-88(r1)
+ lfd f22,-80(r1)
+ lfd f23,-72(r1)
+ lfd f24,-64(r1)
+ lfd f25,-56(r1)
+ lfd f26,-48(r1)
+ lfd f27,-40(r1)
+ lfd f28,-32(r1)
+ lfd f29,-24(r1)
+ /* <OFFSET OF F30 RESTORE> restore callers LR */
+ lwz r0,8(r1)
+ lfd f30,-16(r1)
+ /* and prepare for return to caller */
+ mtlr r0
+ lfd f31,-8(r1)
+ blr
diff --git a/gcc/config/rs6000/darwin-vecsave.asm b/gcc/config/rs6000/darwin-vecsave.asm
new file mode 100644
index 00000000000..8c5352ee709
--- /dev/null
+++ b/gcc/config/rs6000/darwin-vecsave.asm
@@ -0,0 +1,133 @@
+/* APPLE LOCAL file AltiVec */
+/* Vector save/restore routines for Darwin. Note that each vector
+ save/restore requires 2 instructions (8 bytes.)
+
+ THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE
+ ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31,
+ for example. For FP reg saves/restores, it takes one instruction
+ (4 bytes) to do the operation; for Vector regs, 2 instructions are
+ required (8 bytes.)
+
+ MORAL: DO NOT MESS AROUND WITH THESE FUNCTIONS! */
+
+.text
+ .align 2
+
+.private_extern saveVEC
+saveVEC:
+ li r11,-192
+ stvx v20,r11,r0
+ li r11,-176
+ stvx v21,r11,r0
+ li r11,-160
+ stvx v22,r11,r0
+ li r11,-144
+ stvx v23,r11,r0
+ li r11,-128
+ stvx v24,r11,r0
+ li r11,-112
+ stvx v25,r11,r0
+ li r11,-96
+ stvx v26,r11,r0
+ li r11,-80
+ stvx v27,r11,r0
+ li r11,-64
+ stvx v28,r11,r0
+ li r11,-48
+ stvx v29,r11,r0
+ li r11,-32
+ stvx v30,r11,r0
+ li r11,-16
+ stvx v31,r11,r0
+ blr
+
+.private_extern restVEC
+restVEC:
+ li r11,-192
+ lvx v20,r11,r0
+ li r11,-176
+ lvx v21,r11,r0
+ li r11,-160
+ lvx v22,r11,r0
+ li r11,-144
+ lvx v23,r11,r0
+ li r11,-128
+ lvx v24,r11,r0
+ li r11,-112
+ lvx v25,r11,r0
+ li r11,-96
+ lvx v26,r11,r0
+ li r11,-80
+ lvx v27,r11,r0
+ li r11,-64
+ lvx v28,r11,r0
+ li r11,-48
+ lvx v29,r11,r0
+ li r11,-32
+ lvx v30,r11,r0
+ li r11,-16
+ lvx v31,r11,r0
+ blr
+
+/* saveVEC_vr11 -- as saveVEC but VRsave is returned in R11. */
+
+.private_extern saveVEC_vr11
+saveVEC_vr11:
+ li r11,-192
+ stvx v20,r11,r0
+ li r11,-176
+ stvx v21,r11,r0
+ li r11,-160
+ stvx v22,r11,r0
+ li r11,-144
+ stvx v23,r11,r0
+ li r11,-128
+ stvx v24,r11,r0
+ li r11,-112
+ stvx v25,r11,r0
+ li r11,-96
+ stvx v26,r11,r0
+ li r11,-80
+ stvx v27,r11,r0
+ li r11,-64
+ stvx v28,r11,r0
+ li r11,-48
+ stvx v29,r11,r0
+ li r11,-32
+ stvx v30,r11,r0
+ li r11,-16
+ stvx v31,r11,r0
+ mfspr r11,VRsave
+ blr
+
+/* As restVec, but the original VRsave value passed in R10. */
+
+.private_extern restVEC_vr10
+restVEC_vr10:
+ li r11,-192
+ lvx v20,r11,r0
+ li r11,-176
+ lvx v21,r11,r0
+ li r11,-160
+ lvx v22,r11,r0
+ li r11,-144
+ lvx v23,r11,r0
+ li r11,-128
+ lvx v24,r11,r0
+ li r11,-112
+ lvx v25,r11,r0
+ li r11,-96
+ lvx v26,r11,r0
+ li r11,-80
+ lvx v27,r11,r0
+ li r11,-64
+ lvx v28,r11,r0
+ li r11,-48
+ lvx v29,r11,r0
+ li r11,-32
+ lvx v30,r11,r0
+ li r11,-16
+ lvx v31,r11,r0
+ /* restore VRsave from R10. */
+ mtspr VRsave,r10
+ blr
diff --git a/gcc/config/rs6000/darwin-worldsave.asm b/gcc/config/rs6000/darwin-worldsave.asm
new file mode 100644
index 00000000000..2d43f61adde
--- /dev/null
+++ b/gcc/config/rs6000/darwin-worldsave.asm
@@ -0,0 +1,233 @@
+/* APPLE LOCAL file world save/restore */
+/* This file contains the exception-handling save_world and
+ restore_world routines, which need to do a run-time check to see if
+ they should save and restore the vector regs. */
+
+.data
+ .align 2
+
+#ifdef __DYNAMIC__
+
+.non_lazy_symbol_pointer
+L_has_vec$non_lazy_ptr:
+ .indirect_symbol __cpu_has_altivec
+ .long 0
+
+#else
+
+/* For static, "pretend" we have a non-lazy-pointer. */
+
+L_has_vec$non_lazy_ptr:
+ .long __cpu_has_altivec
+
+#endif
+
+
+.text
+ .align 2
+
+/* save_world and rest_world save/restore F14-F31 and possibly V20-V31
+ (assuming you have a CPU with vector registers; we use a global var
+ provided by the System Framework to determine this.)
+
+ SAVE_WORLD takes R0 (the caller`s caller`s return address) and R11
+ (the stack frame size) as parameters. It returns VRsave in R0 if
+ we`re on a CPU with vector regs.
+
+ With gcc3, we now need to save and restore CR as well, since gcc3's
+ scheduled prologs can cause comparisons to be moved before calls to
+ save_world!
+
+ USES: R0 R11 R12 */
+
+.private_extern save_world
+save_world:
+ stw r0,8(r1)
+ mflr r0
+ bcl 20,31,Ls$pb
+Ls$pb: mflr r12
+ addis r12,r12,ha16(L_has_vec$non_lazy_ptr-Ls$pb)
+ lwz r12,lo16(L_has_vec$non_lazy_ptr-Ls$pb)(r12)
+ mtlr r0
+ lwz r12,0(r12)
+ /* grab CR */
+ mfcr r0
+ /* test HAS_VEC */
+ cmpwi r12,0
+ stfd f14,-144(r1)
+ stfd f15,-136(r1)
+ stfd f16,-128(r1)
+ stfd f17,-120(r1)
+ stfd f18,-112(r1)
+ stfd f19,-104(r1)
+ stfd f20,-96(r1)
+ stfd f21,-88(r1)
+ stfd f22,-80(r1)
+ stfd f23,-72(r1)
+ stfd f24,-64(r1)
+ stfd f25,-56(r1)
+ stfd f26,-48(r1)
+ stfd f27,-40(r1)
+ stfd f28,-32(r1)
+ stfd f29,-24(r1)
+ stfd f30,-16(r1)
+ stfd f31,-8(r1)
+ stmw r13,-220(r1)
+ /* stash CR */
+ stw r0,4(r1)
+ /* set R12 pointing at Vector Reg save area */
+ addi r12,r1,-224
+ /* allocate stack frame */
+ stwux r1,r1,r11
+ /* ...but return if HAS_VEC is zero */
+ bne+ L$saveVMX
+ /* Not forgetting to restore CR. */
+ mtcr r0
+ blr
+
+L$saveVMX:
+ /* We're saving Vector regs too. */
+ /* Restore CR from R0. No More Branches! */
+ mtcr r0
+
+ /* We should really use VRSAVE to figure out which vector regs
+ we actually need to save and restore. Some other time :-/ */
+
+ li r11,-192
+ stvx v20,r11,r12
+ li r11,-176
+ stvx v21,r11,r12
+ li r11,-160
+ stvx v22,r11,r12
+ li r11,-144
+ stvx v23,r11,r12
+ li r11,-128
+ stvx v24,r11,r12
+ li r11,-112
+ stvx v25,r11,r12
+ li r11,-96
+ stvx v26,r11,r12
+ li r11,-80
+ stvx v27,r11,r12
+ li r11,-64
+ stvx v28,r11,r12
+ li r11,-48
+ stvx v29,r11,r12
+ li r11,-32
+ stvx v30,r11,r12
+ mfspr r0,VRsave
+ li r11,-16
+ stvx v31,r11,r12
+ /* VRsave lives at -224(R1) */
+ stw r0,0(r12)
+ blr
+
+
+/* eh_rest_world_r10 is jumped to, not called, so no need to worry about LR.
+ R10 is the C++ EH stack adjust parameter, we return to the caller`s caller.
+
+ USES: R0 R10 R11 R12 and R7 R8
+ RETURNS: C++ EH Data registers (R3 - R6.)
+
+ We now set up R7/R8 and jump to rest_world_eh_r7r8.
+
+ rest_world doesn't use the R10 stack adjust parameter, nor does it
+ pick up the R3-R6 exception handling stuff. */
+
+.private_extern rest_world
+rest_world:
+ /* Pickup previous SP */
+ lwz r11, 0(r1)
+ li r7, 0
+ lwz r8, 8(r11)
+ li r10, 0
+ b rest_world_eh_r7r8
+
+.private_extern eh_rest_world_r10
+eh_rest_world_r10:
+ /* Pickup previous SP */
+ lwz r11, 0(r1)
+ mr r7,r10
+ lwz r8, 8(r11)
+ /* pickup the C++ EH data regs (R3 - R6.) */
+ lwz r6,-420(r11)
+ lwz r5,-424(r11)
+ lwz r4,-428(r11)
+ lwz r3,-432(r11)
+
+ b rest_world_eh_r7r8
+
+/* rest_world_eh_r7r8 is jumped to -- not called! -- when we're doing
+ the exception-handling epilog. R7 contains the offset to add to
+ the SP, and R8 contains the 'real' return address.
+
+ USES: R0 R11 R12 [R7/R8]
+ RETURNS: C++ EH Data registers (R3 - R6.) */
+
+rest_world_eh_r7r8:
+ bcl 20,31,Lr7r8$pb
+Lr7r8$pb: mflr r12
+ lwz r11,0(r1)
+ /* R11 := previous SP */
+ addis r12,r12,ha16(L_has_vec$non_lazy_ptr-Lr7r8$pb)
+ lwz r12,lo16(L_has_vec$non_lazy_ptr-Lr7r8$pb)(r12)
+ lwz r0,4(r11)
+ /* R0 := old CR */
+ lwz r12,0(r12)
+ /* R12 := HAS_VEC */
+ mtcr r0
+ cmpwi r12,0
+ lmw r13,-220(r11)
+ beq L.rest_world_fp_eh
+ /* restore VRsave and V20..V31 */
+ lwz r0,-224(r11)
+ li r12,-416
+ mtspr VRsave,r0
+ lvx v20,r11,r12
+ li r12,-400
+ lvx v21,r11,r12
+ li r12,-384
+ lvx v22,r11,r12
+ li r12,-368
+ lvx v23,r11,r12
+ li r12,-352
+ lvx v24,r11,r12
+ li r12,-336
+ lvx v25,r11,r12
+ li r12,-320
+ lvx v26,r11,r12
+ li r12,-304
+ lvx v27,r11,r12
+ li r12,-288
+ lvx v28,r11,r12
+ li r12,-272
+ lvx v29,r11,r12
+ li r12,-256
+ lvx v30,r11,r12
+ li r12,-240
+ lvx v31,r11,r12
+
+L.rest_world_fp_eh:
+ lfd f14,-144(r11)
+ lfd f15,-136(r11)
+ lfd f16,-128(r11)
+ lfd f17,-120(r11)
+ lfd f18,-112(r11)
+ lfd f19,-104(r11)
+ lfd f20,-96(r11)
+ lfd f21,-88(r11)
+ lfd f22,-80(r11)
+ lfd f23,-72(r11)
+ lfd f24,-64(r11)
+ lfd f25,-56(r11)
+ lfd f26,-48(r11)
+ lfd f27,-40(r11)
+ lfd f28,-32(r11)
+ lfd f29,-24(r11)
+ lfd f30,-16(r11)
+ /* R8 is the exception-handler's address */
+ mtctr r8
+ lfd f31,-8(r11)
+ /* set SP to original value + R7 offset */
+ add r1,r11,r7
+ bctr
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 6f193f739c3..5009464abb8 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -44,15 +44,14 @@
/* Handle #pragma weak and #pragma pack. */
#define HANDLE_SYSV_PRAGMA 1
-
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ppc__"); \
builtin_define ("__POWERPC__"); \
builtin_define ("__NATURAL_ALIGNMENT__"); \
- builtin_define ("__MACH__"); \
- builtin_define ("__APPLE__"); \
+ /* APPLE LOCAL constant cfstrings */ \
+ SUBTARGET_OS_CPP_BUILTINS (); \
} \
while (0)
@@ -96,21 +95,51 @@ do { \
#define CC1_SPEC "\
%{gused: -feliminate-unused-debug-symbols %<gused }\
%{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
-%{!static:%{!mdynamic-no-pic:-fPIC}}"
+%{!static:%{!fast:%{!fastf:%{!fastcp:%{!mdynamic-no-pic:-fPIC}}}}}"
+
+/* APPLE LOCAL begin 3492132 */
/* It's virtually impossible to predict all the possible combinations
of -mcpu and -maltivec and whatnot, so just supply
-force_cpusubtype_ALL if any are seen. Radar 3492132 against the
assembler is asking for a .machine directive so we could get this
really right. */
-#define ASM_SPEC "-arch ppc \
+#define ASM_SPEC " %(darwin_arch_asm_spec)\
%{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
- %{!Zforce_cpusubtype_ALL:%{maltivec|mcpu=*|mpowerpc64:-force_cpusubtype_ALL}}"
+ %{!Zforce_cpusubtype_ALL:%{maltivec|faltivec:-force_cpusubtype_ALL}}"
+
+#define DARWIN_ARCH_LD_SPEC \
+"%{mcpu=601: %{!Zdynamiclib:-arch ppc601} %{Zdynamiclib:-arch_only ppc601}} \
+ %{mcpu=603: %{!Zdynamiclib:-arch ppc603} %{Zdynamiclib:-arch_only ppc603}} \
+ %{mcpu=604: %{!Zdynamiclib:-arch ppc604} %{Zdynamiclib:-arch_only ppc604}} \
+ %{mcpu=604e: %{!Zdynamiclib:-arch ppc604e} %{Zdynamiclib:-arch_only ppc604}} \
+ %{mcpu=750: %{!Zdynamiclib:-arch ppc750} %{Zdynamiclib:-arch_only ppc750}} \
+ %{mcpu=7400: %{!Zdynamiclib:-arch ppc7400} %{Zdynamiclib:-arch_only ppc7400}} \
+ %{mcpu=7450: %{!Zdynamiclib:-arch ppc7450} %{Zdynamiclib:-arch_only ppc7450}} \
+ %{mcpu=970: %{!Zdynamiclib:-arch ppc970} %{Zdynamiclib:-arch_only ppc970}} \
+ %{mcpu=G5: %{!Zdynamiclib:-arch ppc970} %{Zdynamiclib:-arch_only ppc970}} \
+ %{!mcpu*:%{!march*:%{!Zdynamiclib:-arch ppc} %{Zdynamiclib:-arch_only ppc}}} "
+
+#define DARWIN_ARCH_ASM_SPEC \
+"%{mcpu=601: -arch ppc601} \
+ %{mcpu=603: -arch ppc603} \
+ %{mcpu=604: -arch ppc604} \
+ %{mcpu=604e: -arch ppc604e} \
+ %{mcpu=750: -arch ppc750} \
+ %{mcpu=7400: -arch ppc7400} \
+ %{mcpu=7450: -arch ppc7450} \
+ %{mcpu=970: -arch ppc970} \
+ %{mcpu=G5: -arch ppc970} \
+ %{!mcpu*:%{!march*: -arch ppc}} "
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
+ { "darwin_arch_asm_spec", DARWIN_ARCH_ASM_SPEC }, \
+ { "darwin_arch_ld_spec", DARWIN_ARCH_LD_SPEC }, \
{ "darwin_arch", "ppc" },
+/* APPLE LOCAL end 3492132 */
+
/* The "-faltivec" option should have been called "-maltivec" all along. */
#define SUBTARGET_OPTION_TRANSLATE_TABLE \
{ "-faltivec", "-maltivec -include altivec.h" }, \
@@ -130,6 +159,24 @@ do { \
#undef RS6000_PIC_OFFSET_TABLE_REGNUM
#define RS6000_PIC_OFFSET_TABLE_REGNUM 31
+/* APPLE LOCAL begin -pg fix */
+/* -pg has a problem which is normally concealed by -fPIC;
+ either -mdynamic-no-pic or -static exposes the -pg problem, causing the
+ crash. FSF gcc for Darwin also has this bug. The problem is that -pg
+ causes several int registers to be saved and restored although they may
+ not actually be used (config/rs6000/rs6000.c:first_reg_to_save()). In the
+ rare case where none of them is actually used, a consistency check fails
+ (correctly). This cannot happen with -fPIC because the PIC register (R31)
+ is always "used" in the sense checked by the consistency check. The
+ easy fix, here, is therefore to mark R31 always "used" whenever -pg is on.
+ A better, but harder, fix would be to improve -pg's register-use
+ logic along the lines suggested by comments in the function listed above. */
+#undef PIC_OFFSET_TABLE_REGNUM
+#define PIC_OFFSET_TABLE_REGNUM ((flag_pic || profile_flag) \
+ ? RS6000_PIC_OFFSET_TABLE_REGNUM \
+ : INVALID_REGNUM)
+/* APPLE LOCAL end -pg fix */
+
/* Pad the outgoing args area to 16 bytes instead of the usual 8. */
#undef STARTING_FRAME_OFFSET
@@ -145,14 +192,30 @@ do { \
/* These are used by -fbranch-probabilities */
#define HOT_TEXT_SECTION_NAME "__TEXT,__text,regular,pure_instructions"
+/* APPLE LOCAL begin hot/cold partitioning */
#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME \
- "__TEXT,__text2,regular,pure_instructions"
+ "__TEXT,__unlikely,regular,pure_instructions"
+/* APPLE LOCAL end hot/cold partitioning */
+/* APPLE LOCAL begin long branch */
/* Define cutoff for using external functions to save floating point.
- Currently on Darwin, always use inline stores. */
+ For Darwin, use the function for more than a few registers. */
-#undef FP_SAVE_INLINE
-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
+/* APPLE LOCAL begin 3414605 */
+#undef FP_SAVE_INLINE
+#define FP_SAVE_INLINE(FIRST_REG) \
+(optimize >= 3 \
+|| ((FIRST_REG) > 60 && (FIRST_REG) < 64) \
+|| TARGET_LONG_BRANCH)
+/* APPLE LOCAL end 3414605 */
+
+/* Define cutoff for using external functions to save vector registers. */
+
+#undef VECTOR_SAVE_INLINE
+#define VECTOR_SAVE_INLINE(FIRST_REG) \
+ (((FIRST_REG) >= LAST_ALTIVEC_REGNO - 1 && (FIRST_REG) <= LAST_ALTIVEC_REGNO) \
+ || TARGET_LONG_BRANCH)
+/* APPLE LOCAL end long branch */
/* The assembler wants the alternate register names, but without
leading percent sign. */
@@ -212,11 +275,7 @@ do { \
#undef ASM_COMMENT_START
#define ASM_COMMENT_START ";"
-/* FP save and restore routines. */
-#define SAVE_FP_PREFIX "._savef"
-#define SAVE_FP_SUFFIX ""
-#define RESTORE_FP_PREFIX "._restf"
-#define RESTORE_FP_SUFFIX ""
+/* APPLE LOCAL don't define SAVE_FP_PREFIX and friends */
/* This is how to output an assembler line that says to advance
the location counter to a multiple of 2**LOG bytes using the
@@ -288,38 +347,64 @@ do { \
? GENERAL_REGS \
: (CLASS))
-/* Fix for emit_group_load (): force large constants to be pushed via regs. */
-#define ALWAYS_PUSH_CONSTS_USING_REGS_P 1
-
-/* This now supports a natural alignment mode */
-/* Darwin word-aligns FP doubles but doubleword-aligns 64-bit ints. */
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
- (TARGET_ALIGN_NATURAL ? (COMPUTED) : \
- (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
- ? get_inner_array_type (FIELD) \
- : TREE_TYPE (FIELD)) == DFmode \
- ? MIN ((COMPUTED), 32) : (COMPUTED)))
-
-/* Darwin increases natural record alignment to doubleword if the first
- field is an FP double while the FP fields remain word aligned. */
-#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
- ((TREE_CODE (STRUCT) == RECORD_TYPE \
- || TREE_CODE (STRUCT) == UNION_TYPE \
- || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
- && TARGET_ALIGN_NATURAL == 0 \
- ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
- : (TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \
- ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \
- : MAX ((COMPUTED), (SPECIFIED)))
+/* APPLE LOCAL begin Macintosh alignment 2002-2-26 ff */
+/* This now supports the Macintosh power, mac68k, and natural
+ alignment modes. It now has one more parameter than the standard
+ version of the ADJUST_FIELD_ALIGN macro.
+
+ The macro works as follows: We use the computed alignment of the
+ field if we are in the natural alignment mode or if the field is
+ a vector. Otherwise, if we are in the mac68k alignment mode, we
+ use the minimum of the computed alignment and 16 (pegging at
+ 2-byte alignment). If we are in the power mode, we peg at 32
+ (word alignment) unless it is the first field of the struct, in
+ which case we use the computed alignment. */
+#undef ADJUST_FIELD_ALIGN
+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED, FIRST_FIELD_P) \
+ (TARGET_ALIGN_NATURAL ? (COMPUTED) : \
+ (((COMPUTED) == RS6000_VECTOR_ALIGNMENT) \
+ ? RS6000_VECTOR_ALIGNMENT \
+ : (MIN ((COMPUTED), \
+ (TARGET_ALIGN_MAC68K ? 16 \
+ : ((FIRST_FIELD_P) ? (COMPUTED) \
+ : 32))))))
+
+#undef ROUND_TYPE_ALIGN
+/* Macintosh alignment modes require more complicated handling
+ of alignment, so we replace the macro with a call to a
+ out-of-line function. */
+union tree_node;
+extern unsigned round_type_align (union tree_node*, unsigned, unsigned); /* rs6000.c */
+#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
+ round_type_align(STRUCT, COMPUTED, SPECIFIED)
+/* APPLE LOCAL end Macintosh alignment 2002-2-26 ff */
+
+/* APPLE LOCAL begin alignment */
+/* Make sure local alignments come from the type node, not the mode;
+ mode-based alignments are wrong for vectors. */
+#undef LOCAL_ALIGNMENT
+#define LOCAL_ALIGNMENT(TYPE, ALIGN) (MAX ((unsigned) ALIGN, \
+ TYPE_ALIGN (TYPE)))
+/* APPLE LOCAL end alignment */
/* XXX: Darwin supports neither .quad, or .llong, but it also doesn't
support 64 bit PowerPC either, so this just keeps things happy. */
#define DOUBLE_INT_ASM_OP "\t.quad\t"
+/* APPLE LOCAL begin branch cost */
+#undef BRANCH_COST
+/* Better code is generated by saying conditional branches take 1 tick. */
+#define BRANCH_COST 1
+/* APPLE LOCAL end branch cost */
+
+/* APPLE LOCAL indirect calls in R12 */
+/* Address of indirect call must be computed here */
+#define MAGIC_INDIRECT_CALL_REG 12
+
/* For binary compatibility with 2.95; Darwin C APIs use bool from
stdbool.h, which was an int-sized enum in 2.95. */
#define BOOL_TYPE_SIZE INT_TYPE_SIZE
-#undef REGISTER_TARGET_PRAGMAS
-#define REGISTER_TARGET_PRAGMAS DARWIN_REGISTER_TARGET_PRAGMAS
+/* APPLE LOCAL OS pragma hook */
+/* Register generic Darwin pragmas as "OS" pragmas. */
diff --git a/gcc/config/rs6000/ops-to-gp b/gcc/config/rs6000/ops-to-gp
new file mode 100755
index 00000000000..becb406749b
--- /dev/null
+++ b/gcc/config/rs6000/ops-to-gp
@@ -0,0 +1,620 @@
+#!/bin/sh
+# APPLE LOCAL file AltiVec
+# ops-to-gp -gcc vec.ops builtin.ops
+# Creates vec.h used by rs6000.c
+
+arg0=`basename $0`
+err() {
+ echo "$arg0: $*" 1>&2
+ exit 2
+}
+
+if [ $# -eq 0 ] ; then
+ echo "Usage: $arg0 [ -mcc | -gcc ] builtin-ops ..." 1>&2
+ exit 1
+fi
+
+MCC=1
+GCC=0
+suffix="gp"
+if [ "$1" = "-mcc" ] ; then
+ shift;
+elif [ "$1" = "-gcc" ] ; then
+ GCC=1
+ MCC=0
+ suffix="h"
+ shift;
+fi
+
+output=`basename $1 .ops`
+gperf="gperf -G -a -o -k1-15 -p -t -D -T -N Is_Builtin_Function $output.gp";
+
+# Lines in the ops file have the form
+# @ @ betype betype-code type-spelling
+# @ fetype betype [code]
+# @ @ @ instruction type
+# generic op1 op2 ... opn = result specific when configure [addressible
+# [instruction [const_ptr_ok [volatile_ptr_ok [transform [predicate]]]]]]
+
+# Sort the ops file to put it in a canonical order.
+sort -u $* | \
+
+# Add specific function uid's, make generic functions from specific
+# functions, validate the types used, compute default parameters, and
+# compute parts of the default transform and predicate functions.
+awk 'BEGIN {
+ i = 0
+ EQ = i++
+ RESULT = i++
+ SPECIFIC = i++
+ WHEN = i++
+ CONFIGURED = i++
+ ADDRESSIBLE = i++
+ INSTRUCTION = i++
+ CONST_PTR_OK = i++
+ VOLATILE_PTR_OK = i++
+ TRANSFORM = i++
+ PREDICATE = i++
+ n_lines = 1;
+ tree[3] = "Make_Folded_4tree";
+ tree[2] = "Make_Folded_3tree";
+ tree[1] = "Make_Folded_Btree";
+ tree[0] = "Make_Utree";
+ optimize["vec_sub"] = 1;
+ optimize["vec_subs"] = 1;
+ optimize["vec_xor"] = 1;
+ optimize["vec_andc"] = 1;
+ optimize["vec_avg"] = 2;
+ optimize["vec_or"] = 2;
+ optimize["vec_and"] = 2;
+ optimize["vec_max"] = 2;
+ optimize["vec_min"] = 2;
+ optimize["vec_sld"] = 3;
+ optimize["vec_splat_s8"] = 4;
+ optimize["vec_splat_s16"] = 5;
+ optimize["vec_splat_s32"] = 6;
+ optimize["vec_splat_u8"] = 4;
+ optimize["vec_splat_u16"] = 5;
+ optimize["vec_splat_u32"] = 6;
+ optimize["vec_cmpeq"] = 7;
+ optimize["vec_lvsl"] = 8;
+ optimize["vec_lvsr"] = 9;
+ # These operations need additional transformation. Key off the
+ # optimize attribute to identify them.
+ optimize["vec_cmplt"] = 10;
+ optimize["vec_cmple"] = 10;
+ optimize["vec_abs"] = 11;
+ optimize["vec_abss"] = 11;
+ }
+ function no_type(t) {
+ printf "%% Error: type %s not declared.\n", t;
+ status = 1;
+ exit;
+ }
+ # Record the type.
+ $1 == "@" {
+ if ($2 == "@") {
+ if ($3 == "@") {
+ # Definition of an instruction.
+ insn_type[$4] = $5; # type
+ } else {
+ # Definition of a betype.
+ becode[$3] = $4; # betype-code
+ bespell[$3] = $5; # type-spelling
+ gsub(/\=/, " ", bespell[$3]);
+ }
+ } else {
+ # Definition of a fetype.
+ print $0;
+ if (!becode[$3]) no_type($3); # Must have defined the betype.
+ betype[$2] = $3; # betype;
+ if (NF == 3)
+ code[$2] = "";
+ else
+ code[$2] = $4; # code
+ }
+ }
+ function no_equal(i,l) {
+ printf "%% Syntax error %d: %s\n", i, l;
+ status = 1;
+ exit;
+ }
+ function error(f,a) {
+ printf( ("%% error: " f), a);
+ status = 1;
+ exit;
+ }
+ # Ignore comment lines.
+ $1 != "#" && $1 != "@" {
+ # Generate the signature of the specific function, the predicate,
+ # the transform, the arguments to the transform function, the
+ # arguments to the predicate function, and the spelling of the
+ # function type.
+ signature = "";
+ predicate = "";
+ transform = "";
+ insn_code = "";
+ transform_args = "";
+ predicate_args = "";
+ function_type = "";
+ # First, consider the parameter types.
+ for (i = 2; $i != "=" && i < NF; i++) {
+ if ($i != "...") {
+ if (!betype[$i]) no_type($i);
+ signature = (signature " " $i);
+ predicate = (predicate "_" betype[$i]);
+ transform = (transform code[$i]);
+ transform_args = (transform_args ", ND_kid(t," i-1 ")");
+ predicate_args = (predicate_args " " becode[betype[$i]]);
+ if (function_type)
+ function_type = (function_type ", " bespell[betype[$i]]);
+ else
+ function_type = bespell[betype[$i]];
+ }
+ }
+ constraints = (transform "@");
+ # Check the syntax of the ops file.
+ if ($i != "=" || NF > i+PREDICATE || NF < i+CONFIGURE) no_equal(i,$0);
+ if (!betype[$(i+RESULT)]) no_type($(i+RESULT));
+ # Incorporate the result type.
+ if (i == 2) {
+ predicate = "_void";
+ function_type = "void";
+ }
+ signature = ($(i+SPECIFIC) signature);
+ predicate = sprintf("is_%s_func%s", betype[$(i+RESULT)], predicate);
+ predicate_args = (becode[betype[$(i+RESULT)]] predicate_args);
+ function_type = sprintf("(%s (*)(%s))", bespell[betype[$(i+RESULT)]], \
+ function_type);
+ if (substr(code[$(i+RESULT)], 1, 1) == "j") {
+ # Handle a jump asm. The code is expedted to be
+ # j={cc-bit-num}={cc-bit-value}[={r|d}]. The operation must have
+ # one operand if the code d is used and two operands otherwise.
+ # The transform function can implement the r code by reversing the
+ # two operands. In all cases, the first operand is a computed
+ # constant encoding both the bit number and the test.
+ n = split(code[$(i+RESULT)], jmp, "=");
+ if (jmp[n] == "d" && i != 3) error("%d operands", i-2);
+ if (jmp[n] != "d" && i != 4) error("%d operands", i-2);
+ if (jmp[n] == "r")
+ transform_args = ", ND_kid(t,2), ND_kid(t,1)";
+ transform_args = sprintf("%s(OP_VCMP%s%s", tree[i-2], \
+ toupper(jmp[3]), transform_args);
+ if (jmp[n] == "r")
+ transform = ("r" transform);
+ insn_code = sprintf("CODE_FOR_j_%d_%s_f%s", jmp[2], jmp[3], \
+ transform);
+ transform = sprintf("transform_j_%d_%s_f%s", jmp[2], jmp[3], \
+ transform);
+ } else {
+ transform_args = sprintf("%s(OP_%sASM%s%s", tree[i-2], \
+ toupper(code[$(i+RESULT)]), \
+ toupper(transform), transform_args);
+ insn_code = sprintf("CODE_FOR_%sf%s", code[$(i+RESULT)], transform);
+ transform = sprintf("transform_%sf%s", code[$(i+RESULT)], transform);
+ }
+ # Give a unique id to the signature
+ if (count[signature] == 0)
+ count[signature] = ++uid[$(i+SPECIFIC)];
+
+ # Compute the default instruction name
+ nf = split($(i+SPECIFIC), part, "_");
+ instruction = ("MOP_" part[nf]);
+
+ # Compute the insn_code, but use the instruction override if given.
+ if (NF >= i+INSTRUCTION)
+ instruction = $(i+INSTRUCTION);
+ if (insn_type[instruction])
+ insn_code = (insn_code "_" insn_type[instruction]);
+
+ # Allow the user to override the addressibility, instruction,
+ # const_ptr_ok, volatile_ptr_ok, transform, and predicate.
+ if (NF >= i+ADDRESSIBLE)
+ addressible = "";
+ else
+ addressible = "FALSE";
+
+ if (NF >= i+INSTRUCTION)
+ instruction = "";
+ else if (substr($1, 1, 4) == "vec_")
+ print "@ @3", instruction;
+
+ if (NF >= i+CONST_PTR_OK)
+ const_ptr_ok = "";
+ else
+ const_ptr_ok = "FALSE";
+
+ if (NF >= i+VOLATILE_PTR_OK)
+ volatile_ptr_ok = "";
+ else
+ volatile_ptr_ok = "FALSE";
+
+ if (NF >= i+TRANSFORM)
+ transform = "";
+ else
+ print "@ @1", transform, transform_args;
+
+ if (NF >= i+PREDICATE)
+ predicate = "";
+ else
+ print "@ @2", i-2, predicate, predicate_args, function_type;
+
+ if (optimize[$1])
+ optimize_method = optimize[$1];
+ else
+ optimize_method = "0";
+
+ # Record the line, addressibility, instruction, transform,
+ # predicate, and unique id.
+ line[n_lines++] = ($0 " " addressible " " instruction " " \
+ const_ptr_ok " " volatile_ptr_ok " " transform " " \
+ predicate " " insn_code " " constraints " " \
+ optimize_method " " count[signature]);
+ }
+ END {
+ if (status) exit;
+ # generic op1 op2 ... opn = result specific when configured
+ # addressable instruction const_ptr_ok volatile_ptr_ok
+ # transform predicate insn_code constraints optimize uid
+ SPECIFIC = 12
+ for (i = 1; i < n_lines; i++) {
+ nf = split(line[i], part);
+ specific = part[nf-SPECIFIC];
+
+ # Print the generic form.
+ printf "%s", part[1];
+ for (j = 2; j <= nf-SPECIFIC; j++) printf " %s", part[j];
+ if (uid[specific] > 1) printf ":%d", part[nf];
+ while (j < nf) printf " %s", part[j++];
+ printf "\n";
+
+ # Print the specific form.
+ printf "%s", specific;
+ for (j = 2; j <= nf-SPECIFIC; j++) printf " %s", part[j];
+ if (uid[specific] > 1) printf ":%d", part[nf];
+ while (j < nf) printf " %s", part[j++];
+ printf "\n";
+ }
+ }' | \
+
+# Strip out load and store qualifiers.
+sed -e 's/_load_op//g' -e 's/_store_op//g' | \
+
+# Sort the processed file and eliminate duplicates.
+sort -u | \
+
+# Append the count of each generic function to each line.
+awk 'function push() {
+ if (num)
+ for (i = 0; i < num; i++)
+ print line[i], num;
+ num = 0;
+ }
+ $1 == "@" {
+ print $0;
+ }
+ $1 != "@" {
+ if (last != $1)
+ push();
+ last = $1;
+ line[num++] = $0;
+ }
+ END {
+ push();
+ }' | \
+
+# Now compute the gperf input file.
+# Lines now have a fixed format
+# generic op1 ... opn = result specific instruction when configured
+# addressible const_ptr_ok volatile_ptr_ok transform predicate
+# insn_code constraints optimize count
+awk 'BEGIN {
+ MCC = '$MCC'
+ GCC = '$GCC'
+ i = 0;
+ COUNT = i++
+ OPTIMIZE = i++
+ CONSTRAINTS = i++
+ INSN_CODE = i++
+ PREDICATE = i++
+ TRANSFORM = i++
+ VOLATILE_PTR_OK = i++
+ CONST_PTR_OK = i++
+ INSTRUCTION = i++
+ ADDRESSIBLE = i++
+ CONFIGURED = i++
+ WHEN = i++
+ SPECIFIC = i++
+ RESULT = i++
+ EQ = i++
+ OPN = i++
+ NARGS = i++
+ if (MCC) {
+ print "%{";
+ print "/* Command-line: '"$gperf"' */";
+ MAXARGS = 5
+ }
+ if (GCC)
+ MAXARGS = 3
+ }
+ function write_test(tree, type, num) {
+ if (type == "PTR") {
+ printf "\n && TY_kind(%s) == KIND_POINTER", tree;
+ } else if (type == "I5") {
+ printf "\n && is_integer_type(%s)", tree;
+ printf "\n && Is_Const(ND_kid0(ND_kid(t,%d)), &tc)", num;
+ printf "\n && ((UINT32)Targ_To_Host(tc) + 16) < 32";
+ } else if (type == "U5") {
+ printf "\n && is_integer_type(%s)", tree;
+ printf "\n && Is_Const(ND_kid0(ND_kid(t,%d)), &tc)", num;
+ printf "\n && (UINT32)Targ_To_Host(tc) < 32";
+ } else if (type == "U4") {
+ printf "\n && is_integer_type(%s)", tree;
+ printf "\n && Is_Const(ND_kid0(ND_kid(t,%d)), &tc)", num;
+ printf "\n && (UINT32)Targ_To_Host(tc) < 16";
+ } else if (type == "U2") {
+ printf "\n && is_integer_type(%s)", tree;
+ printf "\n && Is_Const(ND_kid0(ND_kid(t,%d)), &tc)", num;
+ printf "\n && (UINT32)Targ_To_Host(tc) < 4";
+ } else if (type == "BETYPE_U4" || type == "BETYPE_I4") {
+ printf "\n && is_integer_type(%s)", tree;
+ } else {
+ printf "\n && Similar_Types(%s,", tree;
+ printf "\n\t\t Be_Type_Tbl(%s), IGNORE_QUALIFIERS)", type;
+ }
+ }
+ $1 == "@" {
+ if (MCC) {
+ if ($2 == "@1") {
+ # Write the predicate function from the given parameters.
+ # The format is:
+ # @ @1 transform_ifii Make_3tree(OP_IASMII, ND_kid(t,1), ND_kid(t,2)
+ print "";
+ print "/*ARGSUSED*/";
+ print "static void";
+ print $3 "(ND *func, ND *parent, ND *t, struct builtin *self)";
+ print "{";
+ printf " *t = *%s", $4;
+ for (i = 5; i <= NF; i++) printf " %s", $i;
+ print ",";
+ if (split($3,jmp,"_") == 5 && jmp[2] == "j")
+ printf "\t\t MK_I4CONST_ND((self->data << 5) + %d));\n", \
+ jmp[3];
+ else
+ print "\t\t MK_I4CONST_ND(self->data));";
+
+ print " Is_True(self->data > 0, (\"No implementation for %s\", self->name));";
+ print "}";
+ } else if ($2 == "@2") {
+ # Write the transform function from the given parameters.
+ # The format is:
+ # @ @2 2 is_int_func_int_int BETYPE_I4 BETYPE_I4 BETYPE_I4
+ # (int (*)(int, int))
+ print "";
+ print "/*ARGSUSED*/";
+ print "static BOOL";
+ print $4 "(ND *func, ND *parent, ND *t, struct builtin *self)";
+ print "{";
+ print " TCON tc;";
+ printf " if (ND_nkids(t) == %d", $3+1;
+ write_test("ST_type(ND_dec(func))", $5, "");
+ for (i = 1; i <= $3; i++) {
+ printf "\n && ND_name(ND_kid(t,%d)) == TO_VAL", i;
+ write_test(sprintf("The_Tree_Type(ND_kid(t,%d))", i), $(i+5), i);
+ }
+ print ")";
+ print " return TRUE;";
+ print " Error_Prt_Line (ND_linenum(t), ec_builtin_function_type, self->name,";
+ i = $3+6;
+ printf "\t\t \"%s", $i;
+ while (++i <= NF) printf " %s", $i;
+ print "\");";
+ print " return FALSE;";
+ print "}";
+ } else if ($2 == "@3") {
+ if (once++ == 0) printf "\n#ifndef HAVE_ALTIVEC\n";
+ printf "#define %s -1\n", $3;
+ } else {
+ if (once && twice++ == 0) printf "#endif /* HAVE_ALTIVEC */\n\n";
+ printf "extern struct a_type *T_%s;\n", $2;
+ }
+ }
+ next;
+ }
+ $1 == "%" {
+ print $0;
+ status = 1;
+ exit;
+ }
+ {
+ # Compute the signature of the generic function.
+ signature=$1;
+ for (i = 2; i <= NF-OPN; i++) {
+ if ($i != "...")
+ signature=(signature " " $i);
+ }
+
+ # Ensure that the signature is unique.
+ if (signature_line[signature]) {
+ print "Ambiguous signatures:";
+ print $0;
+ print line[signature_line[signature]];
+ }
+ signature_line[signature] = n_lines;
+
+ # Require that overloaded functions have the same attributes:
+ # number of arguments, when, configured, and addressible.
+ if (same_arg_count[$1] && same_arg_count[$1] != NF)
+ printf "%% number of arguments for %s varies: %d and %d\n", \
+ $1, NF-NARGS, same_arg_count[$1]-NARGS;
+ same_arg_count[$1] = NF;
+
+ if (same_when[$1] && same_when[$1] != $(NF-WHEN))
+ printf "%% when for %s varies: %s and %s\n", \
+ $1, $(NF-WHEN), same_when[$1];
+ same_when[$1] = $(NF-WHEN);
+
+ if (same_configured[$1] && same_configured[$1] != $(NF-CONFIGURED))
+ printf "%% configured for %s varies: %s and %s\n", \
+ $1, $(NF-CONFIGURED), same_configured[$1];
+ same_configured[$1] = $(NF-CONFIGURED);
+
+ if (same_addressible[$1] && same_addressible[$1] != $(NF-ADDRESSIBLE))
+ printf "%% addressible for %s varies: %s and %s\n", \
+ $1, $(NF-ADDRESSIBLE), same_addressible[$1];
+ else if (same_addressible[$1] && same_addressible[$1] != "FALSE")
+ printf "%% Overloaded function %s is addressible\n", $1
+ same_addressible[$1] = $(NF-ADDRESSIBLE);
+
+ # Record the line.
+ line[n_lines++] = $0;
+ }
+ function push(fcn, n) {
+ if (last) printf "};\n";
+ # Gcc3: declare as arrays of const pointers
+ if (fcn) printf "static const struct builtin *const O_%s[%d] = {\n", fcn, n;
+ last = fcn;
+ }
+ function mangle(name) {
+ if (split(name, names, ":") == 1)
+ return ("B_" names[1]);
+ return ("B" names[2] "_" names[1]);
+ }
+ END {
+ if (status) exit;
+
+ # Gcc3: Mark file as Apple local
+ printf "/* APPLE LOCAL file AltiVec */\n";
+ printf "/* This file is generated by ops-to-gp. Do not edit. */\n\n";
+ printf "/* To regenerate execute:\n";
+ printf " ops-to-gp -gcc vec.ops builtin.ops\n";
+ printf " with the current directory being gcc/config/rs6000. */\n\n";
+
+ # Output the description of each specific function.
+ uid = 0;
+ if (MCC) print "";
+ for (i = 0; i < n_lines; i++) {
+ nf = split(line[i], part);
+ fcn = part[nf-SPECIFIC];
+ if (!done[fcn]) {
+ printf "static const struct builtin %s = {", mangle(fcn);
+ if (GCC) printf " {";
+ ellipsis = 1;
+ for (j = 2; j <= nf-OPN; j++)
+ if (part[j] != "...") {
+ printf " &T_%s,", part[j];
+ } else {
+ ellipsis = -1;
+ printf " NULL,";
+ }
+ while (j++ <= MAXARGS+1)
+ printf " NULL,";
+ instruction = part[nf-INSTRUCTION];
+ if (substr(instruction, 1, 4) == "MOP_")
+ instruction = substr(instruction, 5);
+ if (substr(instruction, length(instruction)) == "D")
+ instruction = (substr(instruction, 1, length(instruction) - 1) ".");
+ # Gcc3: Prefix each specific instruction with a "*"
+ if (match (instruction, "^[a-zA-Z]") > 0)
+ instruction = "*" instruction;
+ if (GCC) printf " },";
+ if (GCC) printf " \"%s\",", substr(part[nf-CONSTRAINTS], 1, length(part[nf-CONSTRAINTS]) - 1);
+ printf " &T_%s,", part[nf-RESULT];
+ if (MCC) printf " \"%s\",", part[nf-SPECIFIC];
+ printf " %d,", ellipsis * (nf - NARGS);
+ if (MCC) {
+ printf " %s,", part[nf-WHEN];
+ printf " %s,", part[nf-ADDRESSIBLE];
+ printf " %s,", part[nf-CONST_PTR_OK];
+ printf " %s,", part[nf-VOLATILE_PTR_OK];
+ printf " %s,", part[nf-CONFIGURED];
+ printf " %s,", part[nf-INSTRUCTION];
+ printf " %s,", part[nf-TRANSFORM];
+ printf " %s", part[nf-PREDICATE];
+ } else if (GCC) {
+ printf " %s,", part[nf-CONST_PTR_OK];
+ printf " %s,", part[nf-VOLATILE_PTR_OK];
+ printf " %s,", part[nf-OPTIMIZE];
+ printf " \"%s\",", part[nf-SPECIFIC];
+ printf " \"%s\",", instruction;
+ printf " %s,", part[nf-INSN_CODE];
+ printf " B_UID(%d)", uid++;
+ }
+ printf " };\n";
+ }
+ done[fcn] = 1;
+ }
+
+ if (GCC) printf "#define LAST_B_UID B_UID(%d)\n", uid;
+
+ if (GCC) {
+ # Output the description of each specific function.
+ print "";
+ uid = 0;
+ for (i in done)
+ done[i] = "";
+ print "const struct builtin * const Builtin[] = {"
+ for (i = 0; i < n_lines; i++) {
+ nf = split(line[i], part);
+ fcn = part[nf-SPECIFIC];
+ if (!done[fcn]) {
+ printf " &%s,\n", mangle(fcn);
+ }
+ done[fcn] = 1;
+ }
+ print "};"
+ }
+
+ # Output the overload tables for each generic function.
+ print "";
+ for (i = 0; i < n_lines; i++) {
+ nf = split(line[i], part);
+ fcn = part[1];
+ if (last != fcn)
+ push(fcn, part[nf]);
+ printf " &%s,\n", mangle(part[nf-SPECIFIC]);
+ }
+ push("", 0);
+
+ # Output the builtin function structure.
+ print "";
+ if (MCC) {
+ print "%}";
+ print "struct overloadx {";
+ print " char *name;";
+ print " int fcns;";
+ print " int args;";
+ print " struct builtin **functions;";
+ print "};";
+ print "%%";
+ } else if (GCC) {
+ print "const struct overloadx Overload[] = {";
+ }
+
+ # Output the builtin function list and data.
+ uid = 0;
+ for (i = 0; i < n_lines; i++) {
+ nf = split(line[i], part);
+ fcn = part[1];
+ args = nf - NARGS;
+ if (part[nf-OPN] == "...") args = -args;
+ if (last != fcn) {
+ if (MCC) printf "%s, %d, %d, O_%s\n", fcn, part[nf], args, fcn;
+ if (GCC) printf " { \"%s\", %d, %d, O_%s, O_UID(%d) },\n", \
+ fcn, part[nf], args, fcn, uid++;
+ }
+ last = fcn;
+ }
+
+ if (GCC) {
+ print " { NULL, 0, 0, NULL, 0 }"
+ print "};";
+
+ printf "#define LAST_O_UID O_UID(%d)\n", uid;
+ }
+
+ }' > $output.$suffix
+
+if [ "$MCC" = "1" ] ; then
+ $gperf > $output.h
+fi
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 5d36d5d28b3..04c3121662c 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -30,6 +30,11 @@
#include "c-pragma.h"
#include "errors.h"
#include "tm_p.h"
+/* APPLE LOCAL begin AltiVec */
+#include "c-common.h"
+#include "cpplib.h"
+#include "target.h"
+/* APPLE LOCAL end AltiVec */
/* Handle the machine specific pragma longcall. Its syntax is
@@ -78,6 +83,98 @@ rs6000_pragma_longcall (cpp_reader *pfile ATTRIBUTE_UNUSED)
#define builtin_define(TXT) cpp_define (pfile, TXT)
#define builtin_assert(TXT) cpp_assert (pfile, TXT)
+/* APPLE LOCAL begin AltiVec */
+/* Keep the AltiVec keywords handy for fast comparisons. */
+static GTY(()) cpp_hashnode *__vector_keyword;
+static GTY(()) cpp_hashnode *vector_keyword;
+static GTY(()) cpp_hashnode *__pixel_keyword;
+static GTY(()) cpp_hashnode *pixel_keyword;
+static GTY(()) cpp_hashnode *__bool_keyword;
+static GTY(()) cpp_hashnode *bool_keyword;
+static GTY(()) cpp_hashnode *_Bool_keyword;
+
+/* Called to decide whether a conditional macro should be expanded. */
+
+bool
+rs6000_expand_macro_p (const cpp_token *tok)
+{
+ static bool expand_bool_pixel = 0;
+ bool expand_this = 0;
+ const cpp_hashnode *ident = tok->val.node;
+
+ if (ident == vector_keyword)
+ {
+ tok = c_lex_peek (0);
+ if (tok->type == CPP_NAME)
+ {
+ ident = tok->val.node;
+ if (ident == pixel_keyword || ident == __pixel_keyword
+ || ident == bool_keyword || ident == __bool_keyword
+ || ident == _Bool_keyword)
+ expand_this = expand_bool_pixel = 1;
+ else
+ {
+ enum rid rid_code = (enum rid)(ident->rid_code);
+
+ if (rid_code == RID_UNSIGNED || rid_code == RID_LONG
+ || rid_code == RID_SHORT || rid_code == RID_SIGNED
+ || rid_code == RID_INT || rid_code == RID_CHAR
+ || rid_code == RID_FLOAT)
+ {
+ expand_this = 1;
+ /* If the next keyword is bool or pixel, it
+ will need to be expanded as well. */
+ tok = c_lex_peek (1);
+ if (tok->type == CPP_NAME)
+ {
+ ident = tok->val.node;
+ if (ident == pixel_keyword || ident == __pixel_keyword
+ || ident == bool_keyword || ident == __bool_keyword
+ || ident == _Bool_keyword)
+ expand_bool_pixel = 1;
+ }
+ }
+ }
+ }
+ }
+ else if (ident == pixel_keyword || ident == bool_keyword
+ || ident == _Bool_keyword)
+ {
+ if (expand_bool_pixel)
+ {
+ expand_this = 1;
+ expand_bool_pixel = 0;
+ }
+ }
+
+ return expand_this;
+}
+
+static void
+cb_define_conditional_macro (cpp_reader *pfile ATTRIBUTE_UNUSED,
+ unsigned int n ATTRIBUTE_UNUSED,
+ cpp_hashnode *node) {
+ const unsigned char *name = node->ident.str;
+ bool underscore = (name[1] == '_');
+ char kwd = (underscore ? name[2] : name[0]);
+ cpp_hashnode **kwd_node = 0;
+
+ if (!underscore) /* macros without two leading underscores */
+ node->flags |= NODE_DISABLED; /* shall be conditional */
+
+ switch (kwd)
+ {
+ case 'v': kwd_node = (underscore ? &__vector_keyword : &vector_keyword); break;
+ case 'p': kwd_node = (underscore ? &__pixel_keyword : &pixel_keyword); break;
+ case 'b': kwd_node = (underscore ? &__bool_keyword : &bool_keyword); break;
+ case '_': kwd_node = &_Bool_keyword; break;
+ default: abort ();
+ }
+ *kwd_node = node;
+}
+
+/* APPLE LOCAL end AltiVec */
+
void
rs6000_cpu_cpp_builtins (cpp_reader *pfile)
{
@@ -93,13 +190,39 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("_ARCH_COM");
if (TARGET_ALTIVEC)
{
+ /* APPLE LOCAL begin AltiVec */
+ struct cpp_callbacks *cb = cpp_get_callbacks (pfile);
+ void (*old_cb_define) (cpp_reader *, unsigned int, cpp_hashnode *)
+ = cb->define;
+ /* APPLE LOCAL end AltiVec */
+
builtin_define ("__ALTIVEC__");
builtin_define ("__VEC__=10206");
/* Define the AltiVec syntactic elements. */
+
+ /* APPLE LOCAL AltiVec */
+ cb->define = cb_define_conditional_macro;
+
builtin_define ("__vector=__attribute__((altivec(vector__)))");
builtin_define ("__pixel=__attribute__((altivec(pixel__))) unsigned short");
builtin_define ("__bool=__attribute__((altivec(bool__))) unsigned");
+
+ /* APPLE LOCAL begin AltiVec */
+ /* Keywords without two leading underscores are context-sensitive, and hence
+ implemented as conditional macros, controlled by the rs6000_expand_macro_p()
+ predicate above. */
+ builtin_define ("vector=__attribute__((altivec(vector__)))");
+ builtin_define ("pixel=__attribute__((altivec(pixel__))) unsigned short");
+ builtin_define ("bool=__attribute__((altivec(bool__))) unsigned");
+ builtin_define ("_Bool=__attribute__((altivec(bool__))) unsigned");
+ cb->define = old_cb_define;
+
+ /* Enable context-sensitive macros. */
+ targetm.expand_macro_p = rs6000_expand_macro_p;
+ /* Enable '(vector signed int)(a, b, c, d)' vector literal notation. */
+ targetm.cast_expr_as_vector_init = true;
+ /* APPLE LOCAL end AltiVec */
}
if (TARGET_SPE)
builtin_define ("__SPE__");
@@ -131,3 +254,4 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
break;
}
}
+
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 1121e309db9..b1675edc7b9 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -127,10 +127,13 @@ extern int mfcr_operation (rtx, enum machine_mode);
extern int mtcrf_operation (rtx, enum machine_mode);
extern int lmw_operation (rtx, enum machine_mode);
extern struct rtx_def *create_TOC_reference (rtx);
+/* APPLE LOCAL RTX_COST for multiply */
+extern int rs6000_rtx_mult_cost (rtx);
extern void rs6000_split_multireg_move (rtx, rtx);
extern void rs6000_emit_move (rtx, rtx, enum machine_mode);
extern rtx rs6000_legitimize_address (rtx, rtx, enum machine_mode);
-extern rtx rs6000_legitimize_reload_address (rtx, enum machine_mode,
+/* APPLE LOCAL pass reload addr by address */
+extern rtx rs6000_legitimize_reload_address (rtx *, enum machine_mode,
int, int, int, int *);
extern int rs6000_legitimate_address (enum machine_mode, rtx, int);
extern bool rs6000_mode_dependent_address (rtx);
@@ -204,8 +207,13 @@ extern int rs6000_tls_symbol_ref (rtx, enum machine_mode);
extern void rs6000_pragma_longcall (struct cpp_reader *);
extern void rs6000_cpu_cpp_builtins (struct cpp_reader *);
+/* APPLE LOCAL AltiVec */
+extern bool rs6000_expand_macro_p (const struct cpp_token *);
+
#if TARGET_MACHO
-char *output_call (rtx, rtx *, int, int);
+void add_compiler_stub PARAMS ((tree, tree, int));
+void output_compiler_stub PARAMS ((void));
+extern char* output_call PARAMS ((rtx, rtx *, int, int));
#endif
#endif /* rs6000-protos.h */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 73b912cf930..5f5361a8d4d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -50,12 +50,20 @@
#include "target-def.h"
#include "langhooks.h"
#include "reload.h"
+/* APPLE LOCAL why is this needed? */
+#include "insn-addr.h"
#include "cfglayout.h"
#include "sched-int.h"
#if TARGET_XCOFF
#include "xcoffout.h" /* get declarations of xcoff_*_section_name */
#endif
+/* APPLE LOCAL begin Macintosh alignment */
+#ifndef TARGET_ALIGN_MAC68K
+#define TARGET_ALIGN_MAC68K 0
+#endif
+/* APPLE LOCAL end Macintosh alignment */
+
#ifndef TARGET_NO_PROTOTYPE
#define TARGET_NO_PROTOTYPE 0
#endif
@@ -216,9 +224,16 @@ int rs6000_debug_arg; /* debug argument handling */
static GTY(()) tree opaque_V2SI_type_node;
static GTY(()) tree opaque_V2SF_type_node;
static GTY(()) tree opaque_p_V2SI_type_node;
-
-/* AltiVec requires a few more basic types in addition to the vector
- types already defined in tree.c. */
+static GTY(()) tree V16QI_type_node;
+static GTY(()) tree V2SI_type_node;
+static GTY(()) tree V2SF_type_node;
+static GTY(()) tree V4HI_type_node;
+static GTY(()) tree V4SI_type_node;
+static GTY(()) tree V4SF_type_node;
+static GTY(()) tree V8HI_type_node;
+static GTY(()) tree unsigned_V16QI_type_node;
+static GTY(()) tree unsigned_V8HI_type_node;
+static GTY(()) tree unsigned_V4SI_type_node;
static GTY(()) tree bool_char_type_node; /* __bool char */
static GTY(()) tree bool_short_type_node; /* __bool short */
static GTY(()) tree bool_int_type_node; /* __bool int */
@@ -302,6 +317,7 @@ static void rs6000_assemble_visibility (tree, int);
static int rs6000_ra_ever_killed (void);
static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);
static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);
+static const char *rs6000_mangle_fundamental_type (tree);
extern const struct attribute_spec rs6000_attribute_table[];
static void rs6000_set_default_type_attributes (tree);
static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT);
@@ -410,15 +426,18 @@ static rtx rs6000_spe_function_arg (CUMULATIVE_ARGS *,
enum machine_mode, tree);
static rtx rs6000_mixed_function_arg (CUMULATIVE_ARGS *,
enum machine_mode, tree, int);
-static void rs6000_move_block_from_reg(int regno, rtx x, int nregs);
+static void rs6000_move_block_from_reg (int regno, rtx x, int nregs);
static void setup_incoming_varargs (CUMULATIVE_ARGS *,
enum machine_mode, tree,
int *, int);
+/* APPLE LOCAL begin Altivec */
+static bool skip_vec_args (tree, int, int*);
+/* APPLE LOCAL begin Altivec */
#if TARGET_MACHO
static void macho_branch_islands (void);
static void add_compiler_branch_island (tree, tree, int);
-static int no_previous_def (tree function_name);
-static tree get_prev_label (tree function_name);
+static int no_previous_def (tree);
+static tree get_prev_label (tree);
#endif
static tree rs6000_build_builtin_va_list (void);
@@ -575,6 +594,9 @@ static const char alt_reg_names[][8] =
#undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN rs6000_expand_builtin
+#undef TARGET_MANGLE_FUNDAMENTAL_TYPE
+#define TARGET_MANGLE_FUNDAMENTAL_TYPE rs6000_mangle_fundamental_type
+
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS rs6000_init_libfuncs
@@ -616,6 +638,11 @@ static const char alt_reg_names[][8] =
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS setup_incoming_varargs
+/* APPLE LOCAL begin Altivec */
+#undef TARGET_SKIP_VEC_ARGS
+#define TARGET_SKIP_VEC_ARGS skip_vec_args
+/* APPLE LOCAL end Altivec */
+
/* Always strict argument naming on rs6000. */
#undef TARGET_STRICT_ARGUMENT_NAMING
#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
@@ -636,6 +663,9 @@ rs6000_override_options (const char *default_cpu)
size_t i, j;
struct rs6000_cpu_select *ptr;
int set_masks;
+/* APPLE LOCAL begin -fast */
+ enum processor_type mcpu_cpu;
+/* APPLE LOCAL end -fast */
/* Simplifications for entries below. */
@@ -746,6 +776,20 @@ rs6000_override_options (const char *default_cpu)
rs6000_select[0].string = default_cpu;
rs6000_cpu = TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT;
+ /* APPLE LOCAL begin -fast */
+ if (flag_fast || flag_fastf || flag_fastcp)
+ {
+ mcpu_cpu = PROCESSOR_POWER4;
+ if (rs6000_select[1].string == (char *)0 && rs6000_select[2].string == (char *)0)
+ {
+ /* -mcpu and -mtune unspecified. Assume both are G5 */
+ set_target_switch ("tune=G5");
+ set_target_switch ("cpu=G5");
+ }
+ }
+ /* APPLE LOCAL end -fast */
+
+
for (i = 0; i < ARRAY_SIZE (rs6000_select); i++)
{
ptr = &rs6000_select[i];
@@ -762,6 +806,9 @@ rs6000_override_options (const char *default_cpu)
target_flags &= ~set_masks;
target_flags |= (processor_target_table[j].target_enable
& set_masks);
+ /* APPLE LOCAL begin -fast */
+ mcpu_cpu = processor_target_table[j].processor;
+ /* APPLE LOCAL end -fast */
}
break;
}
@@ -771,6 +818,48 @@ rs6000_override_options (const char *default_cpu)
}
}
+ /* APPLE LOCAL begin -fast */
+ if (flag_fast || flag_fastf || flag_fastcp)
+ {
+ flag_gcse_sm = 1;
+ flag_loop_transpose = 1;
+ rs6000_sched_insert_nops = sched_finish_regroup_exact;
+ flag_unroll_loops = 1;
+ flag_strict_aliasing = 1;
+ flag_schedule_interblock = 1;
+ align_jumps_max_skip = 15;
+ align_loops_max_skip = 15;
+ align_functions = 16;
+ align_loops = 16;
+ align_jumps = 16;
+ set_fast_math_flags (1);
+ flag_reorder_blocks = 1;
+#if 0
+ if (flag_branch_probabilities && !flag_exceptions)
+ flag_reorder_blocks_and_partition = 1;
+#endif
+ if (!flag_pic)
+ set_target_switch ("dynamic-no-pic");
+
+ if (mcpu_cpu == PROCESSOR_POWER4)
+ {
+ set_target_switch ("powerpc-gpopt");
+ set_target_switch ("powerpc64");
+ }
+ if (flag_fast || flag_fastcp)
+ /* This doesn't work with NAG Fortran output. The gcc 3.5 C++ libraries
+ have been adjusted so that it now works with them. */
+ set_target_switch ("align-natural");
+ if (flag_fastf)
+ /* This applies Fortran argument semantics; for NAG Fortran output only. */
+ flag_argument_noalias = 2;
+ /* IMI flags */
+ disable_typechecking_for_spec_flag = 1;
+ flag_unit_at_a_time = 1;
+ }
+ /* APPLE LOCAL end -fast */
+
+
if (TARGET_E500)
rs6000_isel = 1;
@@ -1070,6 +1159,10 @@ rs6000_parse_alignment_option (void)
{
if (rs6000_alignment_string == 0)
return;
+/* APPLE LOCAL begin Macintosh alignment 2002-2-26 ff */
+ else if (! strcmp (rs6000_alignment_string, "mac68k"))
+ rs6000_alignment_flags = MASK_ALIGN_MAC68K;
+/* APPLE LOCAL end Macintosh alignment 2002-2-26 ff */
else if (! strcmp (rs6000_alignment_string, "power"))
rs6000_alignment_flags = MASK_ALIGN_POWER;
else if (! strcmp (rs6000_alignment_string, "natural"))
@@ -1099,6 +1192,22 @@ rs6000_parse_tls_size_option (void)
void
optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
{
+ /* APPLE LOCAL begin tweak default optimizations */
+ if (DEFAULT_ABI == ABI_DARWIN)
+ {
+ /* Turn these on only if specifically requested, not with -O* */
+ /* Strict aliasing breaks too much existing code */
+ flag_strict_aliasing = 0;
+ /* Block reordering causes code bloat, and very little speedup */
+ flag_reorder_blocks = 0;
+ /* Multi-basic-block scheduling loses badly when the compiler
+ misguesses which blocks are going to be executed, more than
+ it gains when it guesses correctly. Its guesses for cases
+ where interblock scheduling occurs (if-then-else's) are
+ little better than random, so disable this unless requested. */
+ flag_schedule_interblock = 0;
+ }
+ /* APPLE LOCAL end tweak default optimizations */
}
/* Do anything needed at the start of the asm file. */
@@ -2271,6 +2380,11 @@ call_operand (rtx op, enum machine_mode mode)
return 0;
return (GET_CODE (op) == SYMBOL_REF
+ /* APPLE LOCAL begin accept hard R12 as target reg */
+#ifdef MAGIC_INDIRECT_CALL_REG
+ || (GET_CODE (op) == REG && REGNO (op) == MAGIC_INDIRECT_CALL_REG)
+#endif
+ /* APPLE LOCAL end accept hard R12 as target reg */
|| (GET_CODE (op) == REG
&& (REGNO (op) == LINK_REGISTER_REGNUM
|| REGNO (op) == COUNT_REGISTER_REGNUM
@@ -2356,7 +2470,7 @@ rs6000_special_round_type_align (tree type, int computed, int specified)
tree field = TYPE_FIELDS (type);
/* Skip all the static variables only if ABI is greater than
- 1 or equal to 0. */
+ 1 or equal to 0. */
while (field != NULL && TREE_CODE (field) == VAR_DECL)
field = TREE_CHAIN (field);
@@ -3050,9 +3164,12 @@ rs6000_tls_symbol_ref_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
The Darwin code is inside #if TARGET_MACHO because only then is
machopic_function_base_name() defined. */
rtx
-rs6000_legitimize_reload_address (rtx x, enum machine_mode mode,
+/* APPLE LOCAL pass reload addr by address */
+rs6000_legitimize_reload_address (rtx *addr_x, enum machine_mode mode,
int opnum, int type, int ind_levels ATTRIBUTE_UNUSED, int *win)
{
+ /* APPLE LOCAL pass reload addr by address */
+ rtx x = *addr_x;
/* We must recognize output that we have already generated ourselves. */
if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 0)) == PLUS
@@ -3408,6 +3525,57 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c1, HOST_WIDE_INT c2)
return dest;
}
+/* APPLE LOCAL begin RTX_COST for multiply */
+int
+rs6000_rtx_mult_cost (rtx x)
+{
+ switch (rs6000_cpu)
+ {
+ case PROCESSOR_RIOS1:
+ case PROCESSOR_PPC405:
+ return (GET_CODE (XEXP (x, 1)) != CONST_INT
+ ? COSTS_N_INSNS (5)
+ : INTVAL (XEXP (x, 1)) >= -256 && INTVAL (XEXP (x, 1)) <= 255
+ ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4));
+ case PROCESSOR_RS64A:
+ return (GET_CODE (XEXP (x, 1)) != CONST_INT
+ ? GET_MODE (XEXP (x, 1)) != DImode
+ ? COSTS_N_INSNS (20) : COSTS_N_INSNS (34)
+ : INTVAL (XEXP (x, 1)) >= -256 && INTVAL (XEXP (x, 1)) <= 255
+ ? COSTS_N_INSNS (8) : COSTS_N_INSNS (12));
+ case PROCESSOR_RIOS2:
+ case PROCESSOR_MPCCORE:
+ case PROCESSOR_PPC604e:
+ return COSTS_N_INSNS (2);
+ case PROCESSOR_PPC601:
+ return COSTS_N_INSNS (5);
+ case PROCESSOR_PPC603:
+ case PROCESSOR_PPC7400:
+ case PROCESSOR_PPC750:
+ return (GET_CODE (XEXP (x, 1)) != CONST_INT
+ ? COSTS_N_INSNS (5)
+ : INTVAL (XEXP (x, 1)) >= -256 && INTVAL (XEXP (x, 1)) <= 255
+ ? COSTS_N_INSNS (2) : COSTS_N_INSNS (3));
+ case PROCESSOR_PPC7450:
+ return (GET_CODE (XEXP (x, 1)) != CONST_INT
+ ? COSTS_N_INSNS (4)
+ : COSTS_N_INSNS (3));
+ case PROCESSOR_PPC403:
+ case PROCESSOR_PPC604:
+ return COSTS_N_INSNS (4);
+ case PROCESSOR_PPC620:
+ case PROCESSOR_PPC630:
+ return (GET_CODE (XEXP (x, 1)) != CONST_INT
+ ? GET_MODE (XEXP (x, 1)) != DImode
+ ? COSTS_N_INSNS (5) : COSTS_N_INSNS (7)
+ : INTVAL (XEXP (x, 1)) >= -256 && INTVAL (XEXP (x, 1)) <= 255
+ ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4));
+ default:
+ abort ();
+ }
+}
+/* APPLE LOCAL end RTX_COST for multiply */
+
/* Emit a move from SOURCE to DEST in mode MODE. */
void
rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
@@ -3845,6 +4013,8 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
/* Check for a longcall attribute. */
if (fntype
+ /* APPLE LOCAL long-branch */
+ && TARGET_LONG_BRANCH
&& lookup_attribute ("longcall", TYPE_ATTRIBUTES (fntype))
&& !lookup_attribute ("shortcall", TYPE_ATTRIBUTES (fntype)))
cum->call_cookie = CALL_LONG;
@@ -3953,6 +4123,7 @@ function_arg_boundary (enum machine_mode mode, tree type ATTRIBUTE_UNUSED)
else
return PARM_BOUNDARY;
}
+
/* Update the data in CUM to advance over an argument
of mode MODE and data type TYPE.
@@ -4224,7 +4395,49 @@ rs6000_mixed_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
k == 0 ? const0_rtx : GEN_INT (k*4));
return gen_rtx_PARALLEL (BLKmode, gen_rtvec_v (k, rtlvec));
- }
+ }
+ else if (ALTIVEC_VECTOR_MODE(mode) && align_words <= (GP_ARG_NUM_REG - 1))
+ {
+ /* Varargs vector regs must be saved in R5-R8 or R9-R10. */
+ if (align_words == GP_ARG_NUM_REG - 2)
+ {
+ /* R9-R10 */
+ return gen_rtx_PARALLEL (mode,
+ gen_rtvec (3,
+ gen_rtx_EXPR_LIST (VOIDmode,
+ NULL_RTX, const0_rtx),
+ gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_REG (SImode,
+ GP_ARG_MIN_REG
+ + align_words),
+ const0_rtx),
+ gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_REG (SImode,
+ GP_ARG_MIN_REG
+ + align_words+1),
+ GEN_INT(4))));
+ }
+ else
+ {
+ /* R5-R8 */
+ int k;
+ int size = int_size_in_bytes (type);
+ int no_units = ((size - 1) / 4) + 1;
+ int max_no_words = GP_ARG_NUM_REG - align_words;
+ int rtlvec_len = no_units < max_no_words ? no_units : max_no_words;
+ rtx *rtlvec = (rtx *) alloca (rtlvec_len * sizeof (rtx));
+ memset ((char *) rtlvec, 0, rtlvec_len * sizeof (rtx));
+
+ for (k=0; k < rtlvec_len; k++)
+ rtlvec[k] = gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_REG (SImode,
+ GP_ARG_MIN_REG
+ + align_words + k),
+ k == 0 ? const0_rtx : GEN_INT (k*4));
+
+ return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rtlvec));
+ }
+ }
return NULL_RTX;
}
@@ -4343,7 +4556,11 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
is either wholly in GPRs or half in GPRs and half not. */
part_mode = DImode;
- return gen_rtx_REG (part_mode, GP_ARG_MIN_REG + align_words);
+ if (TARGET_32BIT
+ && (TARGET_POWERPC64 || (align_words == GP_ARG_NUM_REG - 2)))
+ return rs6000_mixed_function_arg (cum, part_mode, type, align_words);
+ else
+ return gen_rtx_REG (part_mode, GP_ARG_MIN_REG + align_words);
}
}
else if (TARGET_SPE_ABI && TARGET_SPE && SPE_VECTOR_MODE (mode))
@@ -4619,6 +4836,33 @@ setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
}
}
+/* APPLE LOCAL begin Altivec */
+
+/* This routine determins if an extra pass over argument list is needed
+ for vector aruments. It returns true, if current argument need be
+ skipped. This depends on if we are in the first iteration (to skip
+ vectors), or 2nd iteration (to skip non-vectors).
+*/
+
+static
+bool skip_vec_args(tree arg_type, int pass, int *last_pass)
+{
+ if (DEFAULT_ABI != ABI_DARWIN)
+ return false;
+
+ if (TREE_CODE (arg_type) == VECTOR_TYPE)
+ {
+ *last_pass = 2;
+ if (pass == 1)
+ return true;
+ }
+ else if (pass == 2)
+ return true;
+ return false;
+}
+/* APPLE LOCAL end Altivec */
+
+
/* Create the va_list data type. */
static tree
@@ -5885,6 +6129,7 @@ altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|| arg2 == error_mark_node)
return const0_rtx;
+ *expandedp = true;
STRIP_NOPS (arg2);
if (TREE_CODE (arg2) != INTEGER_CST
|| TREE_INT_CST_LOW (arg2) & ~0x3)
@@ -5902,7 +6147,6 @@ altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
if (pat != 0)
emit_insn (pat);
- *expandedp = true;
return NULL_RTX;
}
@@ -6456,6 +6700,18 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
static void
rs6000_init_builtins (void)
{
+ V2SI_type_node = build_vector_type (intSI_type_node, 2);
+ V2SF_type_node = build_vector_type (float_type_node, 2);
+ V4HI_type_node = build_vector_type (intHI_type_node, 4);
+ V4SI_type_node = build_vector_type (intSI_type_node, 4);
+ V4SF_type_node = build_vector_type (float_type_node, 4);
+ V8HI_type_node = build_vector_type (intHI_type_node, 8);
+ V16QI_type_node = build_vector_type (intQI_type_node, 16);
+
+ unsigned_V16QI_type_node = build_vector_type (unsigned_intQI_type_node, 16);
+ unsigned_V8HI_type_node = build_vector_type (unsigned_intHI_type_node, 8);
+ unsigned_V4SI_type_node = build_vector_type (unsigned_intSI_type_node, 4);
+
opaque_V2SI_type_node = copy_node (V2SI_type_node);
opaque_V2SF_type_node = copy_node (V2SF_type_node);
opaque_p_V2SI_type_node = build_pointer_type (opaque_V2SI_type_node);
@@ -6486,10 +6742,10 @@ rs6000_init_builtins (void)
get_identifier ("__pixel"),
pixel_type_node));
- bool_V16QI_type_node = make_vector (V16QImode, bool_char_type_node, 1);
- bool_V8HI_type_node = make_vector (V8HImode, bool_short_type_node, 1);
- bool_V4SI_type_node = make_vector (V4SImode, bool_int_type_node, 1);
- pixel_V8HI_type_node = make_vector (V8HImode, pixel_type_node, 1);
+ bool_V16QI_type_node = build_vector_type (bool_char_type_node, 16);
+ bool_V8HI_type_node = build_vector_type (bool_short_type_node, 8);
+ bool_V4SI_type_node = build_vector_type (bool_int_type_node, 4);
+ pixel_V8HI_type_node = build_vector_type (pixel_type_node, 8);
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("__vector unsigned char"),
@@ -6534,6 +6790,12 @@ rs6000_init_builtins (void)
altivec_init_builtins ();
if (TARGET_ALTIVEC || TARGET_SPE)
rs6000_common_init_builtins ();
+
+ /* APPLE LOCAL begin constant cfstrings */
+#ifdef SUBTARGET_INIT_BUILTINS
+ SUBTARGET_INIT_BUILTINS;
+#endif
+ /* APPLE LOCAL end constant cfstrings */
}
/* Search through a set of builtins and enable the mask bits.
@@ -8648,7 +8910,11 @@ rs6000_got_register (rtx value ATTRIBUTE_UNUSED)
static struct machine_function *
rs6000_init_machine_status (void)
{
- return ggc_alloc_cleared (sizeof (machine_function));
+ /* APPLE LOCAL begin volatile pic base reg in leaves */
+ machine_function *mf = (machine_function *) ggc_alloc_cleared (sizeof (machine_function));
+ mf->substitute_pic_base_reg = -1;
+ return mf;
+ /* APPLE LOCAL end volatile pic base reg in leaves */
}
/* These macros test for integers and extract the low-order bits. */
@@ -9478,6 +9744,47 @@ print_operand_address (FILE *file, rtx x)
abort ();
}
+/* APPLE LOCAL begin weak import */
+static void
+find_weak_imports (rtx x)
+{
+ /* Patterns accepted here follow output_addr_const in final.c. */
+ switch ( GET_CODE (x))
+ {
+ case CONST:
+ case ZERO_EXTEND:
+ case SIGN_EXTEND:
+ case SUBREG:
+ find_weak_imports (XEXP (x, 0));
+ break;
+
+ case CONST_INT:
+ case CONST_DOUBLE:
+ case CODE_LABEL:
+ case LABEL_REF:
+ default:
+ break;
+
+ case PLUS:
+ case MINUS:
+ find_weak_imports (XEXP (x, 0));
+ find_weak_imports (XEXP (x, 1));
+ break;
+
+ case SYMBOL_REF:
+ if ( SYMBOL_REF_WEAK_IMPORT (x))
+ {
+ fprintf (asm_out_file, "\t.weak_reference ");
+ assemble_name (asm_out_file, XSTR (x, 0));
+ fprintf (asm_out_file, "\n");
+ /* Attempt to prevent multiple weak_reference directives. */
+ SYMBOL_REF_WEAK_IMPORT (x) = 0;
+ }
+ break;
+ }
+}
+/* APPLE LOCAL end weak import */
+
/* Target hook for assembling integer objects. The PowerPC version has
to handle fixup entries for relocatable code if RELOCATABLE_NEEDS_FIXUP
is defined. It also needs to handle DI-mode objects on 64-bit
@@ -9498,6 +9805,9 @@ rs6000_assemble_integer (rtx x, unsigned int size, int aligned_p)
if (TARGET_RELOCATABLE
&& !in_toc_section ()
&& !in_text_section ()
+ /* APPLE LOCAL begin hot/cold partitioning */
+ && !in_text_unlikely_section ()
+ /* APPLE LOCAL end hot/cold partitioning */
&& !recurse
&& GET_CODE (x) != CONST_INT
&& GET_CODE (x) != CONST_DOUBLE
@@ -9536,6 +9846,9 @@ rs6000_assemble_integer (rtx x, unsigned int size, int aligned_p)
}
}
#endif /* RELOCATABLE_NEEDS_FIXUP */
+ /* APPLE LOCAL weak import */
+ if (DEFAULT_ABI == ABI_DARWIN)
+ find_weak_imports (x);
return default_assemble_integer (x, size, aligned_p);
}
@@ -10352,6 +10665,8 @@ first_reg_to_save (void)
#if TARGET_MACHO
if (flag_pic
&& current_function_uses_pic_offset_table
+ /* APPLE LOCAL volatile pic base reg in leaves */
+ && cfun->machine->substitute_pic_base_reg == -1
&& first_reg > RS6000_PIC_OFFSET_TABLE_REGNUM)
return RS6000_PIC_OFFSET_TABLE_REGNUM;
#endif
@@ -10540,7 +10855,7 @@ rs6000_stack_info (void)
{
static rs6000_stack_t info, zero_info;
rs6000_stack_t *info_ptr = &info;
- int reg_size = TARGET_POWERPC64 ? 8 : 4;
+ int reg_size = TARGET_32BIT ? 4 : 8;
int ehrd_size;
HOST_WIDE_INT total_raw_size;
@@ -10652,7 +10967,7 @@ rs6000_stack_info (void)
info_ptr->varargs_size = RS6000_VARARGS_AREA;
info_ptr->vars_size = RS6000_ALIGN (get_frame_size (), 8);
info_ptr->parm_size = RS6000_ALIGN (current_function_outgoing_args_size,
- 8);
+ TARGET_ALTIVEC ? 16 : 8);
if (TARGET_SPE_ABI && info_ptr->spe_64bit_regs_used != 0)
info_ptr->spe_gp_size = 8 * (32 - info_ptr->first_gp_reg_save);
@@ -10689,7 +11004,7 @@ rs6000_stack_info (void)
/* Align stack so vector save area is on a quadword boundary. */
if (info_ptr->altivec_size != 0)
info_ptr->altivec_padding_size
- = 16 - (-info_ptr->vrsave_save_offset % 16);
+ = (16 - (-info_ptr->vrsave_save_offset % 16)) % 16;
else
info_ptr->altivec_padding_size = 0;
@@ -10768,10 +11083,10 @@ rs6000_stack_info (void)
+ ehrd_size
+ info_ptr->cr_size
+ info_ptr->lr_size
- + info_ptr->vrsave_size
+ /* APPLE LOCAL fix redundant add? */
+ info_ptr->toc_size,
- (TARGET_ALTIVEC_ABI || ABI_DARWIN)
- ? 16 : 8);
+ /* APPLE LOCAL darwin native */
+ (TARGET_ALTIVEC_ABI ? 16 : 8));
total_raw_size = (info_ptr->vars_size
+ info_ptr->parm_size
@@ -11055,6 +11370,9 @@ static bool
rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
{
tree type;
+ /* APPLE LOCAL -mlong-branch */
+ if (TARGET_LONG_BRANCH)
+ return 0;
if (decl)
{
if (TARGET_ALTIVEC_VRSAVE)
@@ -11669,6 +11987,131 @@ generate_set_vrsave (rtx reg, rs6000_stack_t *info, int epiloguep)
return insn;
}
+/* APPLE LOCAL begin special ObjC method use of R12 */
+static int objc_method_using_pic = 0;
+
+/* Determine whether a name is an ObjC method. */
+static int name_encodes_objc_method_p (const char *piclabel_name)
+{
+ return (piclabel_name[0] == '*' && piclabel_name[1] == '"'
+ ? (piclabel_name[2] == 'L'
+ && (piclabel_name[3] == '+' || piclabel_name[3] == '-'))
+ : (piclabel_name[1] == 'L'
+ && (piclabel_name[2] == '+' || piclabel_name[2] == '-')));
+}
+/* APPLE LOCAL end special ObjC method use of R12 */
+
+/* APPLE LOCAL begin recompute PIC register use */
+/* Sometimes a function has references that require the PIC register,
+ but optimization removes them all. To catch this case
+ recompute current_function_uses_pic_offset_table here.
+ This may allow us to eliminate the prologue and epilogue. */
+
+static int
+recompute_PIC_register_use (void)
+{
+ if (DEFAULT_ABI == ABI_DARWIN
+ && flag_pic && current_function_uses_pic_offset_table
+ && !cfun->machine->ra_needs_full_frame)
+ {
+ rtx insn;
+ current_function_uses_pic_offset_table = 0;
+ push_topmost_sequence ();
+ for (insn = get_insns (); insn != NULL; insn = NEXT_INSN (insn))
+ if ( reg_mentioned_p (pic_offset_table_rtx, insn))
+ {
+ current_function_uses_pic_offset_table = 1;
+ break;
+ }
+ pop_topmost_sequence ();
+ }
+ return 0;
+}
+/* APPLE LOCAL end recompute PIC register use */
+
+/* APPLE LOCAL begin volatile pic base reg in leaves */
+/* If this is a leaf function and we used any pic-based references,
+ see if there is an unused volatile reg we can use instead of R31.
+ If so set substitute_pic_base_reg to this reg, set its reg_ever_used
+ bit (to avoid confusing later calls to alloc_volatile_reg), and
+ make a pass through the existing RTL, substituting the new reg for
+ the old one wherever it appears.
+ Logically this is a void function; it is int so it can be used to
+ initialize a dummy variable, thus getting executed ahead of other
+ initializations. Technicolour yawn. */
+
+/* ALLOC_VOLATILE_REG allocates a volatile register AFTER all gcc
+ register allocations have been done; we use it to reserve an
+ unused reg for holding VRsave. Returns -1 in case of failure (all
+ volatile regs are in use.) */
+/* Note, this is called from both the prologue and epilogue code,
+ with the assumption that it will return the same result both
+ times! Since the register arrays are not changed in between
+ this is valid, if a bit fragile. */
+/* In future we may also use this to grab an unused volatile reg to
+ hold the PIC base reg in the event that the current function makes
+ no procedure calls; this was done in 2.95. */
+static int
+alloc_volatile_reg (void)
+{
+ if (current_function_is_leaf
+ && reload_completed
+ && !cfun->machine->ra_needs_full_frame)
+ {
+ int r;
+ for (r = 10; r >= 2; --r)
+ if (! fixed_regs[r] && ! regs_ever_live[r])
+ return r;
+ }
+
+ return -1; /* fail */
+}
+
+static int
+try_leaf_pic_optimization (void)
+{
+ if ( DEFAULT_ABI==ABI_DARWIN
+ && flag_pic && current_function_uses_pic_offset_table
+ && current_function_is_leaf
+ && !cfun->machine->ra_needs_full_frame )
+ {
+ int reg = alloc_volatile_reg ();
+ if ( reg != -1 )
+ {
+ /* Run through the insns, changing references to the original
+ PIC_OFFSET_TABLE_REGNUM to our new one. */
+ rtx insn;
+ const int nregs = PIC_OFFSET_TABLE_REGNUM + 1;
+ rtx *reg_map = (rtx *) xmalloc (nregs * sizeof (rtx));
+ memset (reg_map, 0, nregs * sizeof (rtx));
+ reg_map[PIC_OFFSET_TABLE_REGNUM] = gen_rtx_REG (SImode, reg);
+
+ push_topmost_sequence ();
+ for (insn = get_insns (); insn != NULL; insn = NEXT_INSN (insn))
+ {
+ if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
+ {
+ replace_regs (PATTERN (insn), reg_map, nregs, 1);
+ replace_regs (REG_NOTES (insn), reg_map, nregs, 1);
+ }
+ else if (GET_CODE (insn) == CALL_INSN)
+ {
+ if ( !SIBLING_CALL_P (insn))
+ abort ();
+ }
+ }
+ pop_topmost_sequence ();
+ free (reg_map);
+
+ regs_ever_live[reg] = 1;
+ regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 0;
+ cfun->machine->substitute_pic_base_reg = reg;
+ }
+ }
+ return 0;
+}
+/* APPLE LOCAL end volatile pic base reg in leaves */
+
/* Save a register into the frame, and emit RTX_FRAME_RELATED_P notes.
Save REGNO into [FRAME_REG + OFFSET] in mode MODE. */
@@ -11738,9 +12181,13 @@ gen_frame_mem_offset (enum machine_mode mode, rtx reg, int offset)
void
rs6000_emit_prologue (void)
{
+ /* APPLE LOCAL recompute PIC register use */
+ int dummy ATTRIBUTE_UNUSED = recompute_PIC_register_use ();
+ /* APPLE LOCAL volatile pic base reg in leaves */
+ int ignored ATTRIBUTE_UNUSED = try_leaf_pic_optimization ();
rs6000_stack_t *info = rs6000_stack_info ();
enum machine_mode reg_mode = Pmode;
- int reg_size = UNITS_PER_WORD;
+ int reg_size = TARGET_32BIT ? 4 : 8;
rtx sp_reg_rtx = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
rtx frame_ptr_rtx = gen_rtx_REG (Pmode, 12);
rtx frame_reg_rtx = sp_reg_rtx;
@@ -11749,7 +12196,24 @@ rs6000_emit_prologue (void)
int saving_FPRs_inline;
int using_store_multiple;
HOST_WIDE_INT sp_offset = 0;
+ /* APPLE LOCAL: callers_lr_already_saved */
+ int callers_lr_already_saved = 0;
+#if TARGET_MACHO
+ int lr_already_set_up_for_pic = 0;
+#endif
+ /* APPLE LOCAL special ObjC method use of R12 */
+ objc_method_using_pic = 0;
+ /* APPLE LOCAL BEGIN fix-and-continue mrs */
+ if (TARGET_FIX_AND_CONTINUE)
+ {
+ emit_insn (gen_nop ());
+ emit_insn (gen_nop ());
+ emit_insn (gen_nop ());
+ emit_insn (gen_nop ());
+ }
+ /* APPLE LOCAL END fix-and-continue mrs */
+
if (TARGET_SPE_ABI && info->spe_64bit_regs_used != 0)
{
reg_mode = V2SImode;
@@ -11785,6 +12249,31 @@ rs6000_emit_prologue (void)
rs6000_emit_stack_tie ();
}
+ /* APPLE LOCAL begin special ObjC method use of R12 */
+#if TARGET_MACHO
+ if (DEFAULT_ABI == ABI_DARWIN
+ && current_function_uses_pic_offset_table && flag_pic)
+ {
+ const char *piclabel_name = machopic_function_base_name ();
+
+ if (name_encodes_objc_method_p (piclabel_name)
+ /* If we're saving vector or FP regs via a function call,
+ then don't bother with this ObjC R12 optimization.
+ This test also eliminates world_save. */
+ && (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
+ || VECTOR_SAVE_INLINE (info->first_altivec_reg_save))
+ && (info->first_fp_reg_save == 64
+ || FP_SAVE_INLINE (info->first_fp_reg_save)))
+ {
+ /* We cannot output the label now; there seems to be no
+ way to prevent cfgcleanup from deleting it. It is done
+ in rs6000_output_function_prologue with fprintf! */
+ objc_method_using_pic = 1;
+ }
+ }
+#endif /* TARGET_MACHO */
+ /* APPLE LOCAL end special ObjC method use of R12 */
+
/* Save AltiVec registers if needed. */
if (TARGET_ALTIVEC_ABI && info->altivec_size != 0)
{
@@ -11862,7 +12351,12 @@ rs6000_emit_prologue (void)
/* If we need to save CR, put it into r12. */
if (info->cr_save_p && frame_reg_rtx != frame_ptr_rtx)
{
- cr_save_rtx = gen_rtx_REG (SImode, 12);
+ /* APPLE LOCAL begin special ObjC method use of R12 */
+ /* For Darwin, use R2, so we don't clobber the special ObjC
+ method use of R12. R11 has a special meaning for Ada, so we
+ can't use that. */
+ cr_save_rtx = gen_rtx_REG (SImode, DEFAULT_ABI == ABI_DARWIN ? 2 : 12);
+ /* APPLE LOCAL end special ObjC method use of R12 */
emit_insn (gen_movesi_from_cr (cr_save_rtx));
}
@@ -11885,17 +12379,57 @@ rs6000_emit_prologue (void)
char rname[30];
const char *alloc_rname;
rtvec p;
- p = rtvec_alloc (2 + 64 - info->first_fp_reg_save);
+
+ /* APPLE LOCAL begin Reduce code size / improve performance */
+ int gen_following_label = 0;
+ int count = 0;
+
+ if (current_function_uses_pic_offset_table && flag_pic
+#ifdef INSN_SCHEDULING
+ /* Prevent the compiler from crashing
+ while scheduling insns after global_alloc! */
+ && (optimize == 0 || !flag_schedule_insns_after_reload)
+#endif
+ /* If this is the last CALL in the prolog, then we've got our PC.
+ If we're saving AltiVec regs via a function, we're not last. */
+ && (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
+ || VECTOR_SAVE_INLINE (info->first_altivec_reg_save)))
+ gen_following_label = lr_already_set_up_for_pic = 1;
+
+ /* APPLE LOCAL: +2 (could be conditionalized) */
+ p = rtvec_alloc (2 + 64 - info->first_fp_reg_save + 2
+ + gen_following_label);
- RTVEC_ELT (p, 0) = gen_rtx_CLOBBER (VOIDmode,
+ RTVEC_ELT (p, count++) = gen_rtx_CLOBBER (VOIDmode,
gen_rtx_REG (Pmode,
LINK_REGISTER_REGNUM));
+ /* APPLE LOCAL begin reduce code size */
+#if TARGET_MACHO
+ /* We have to calculate the offset into saveFP to where we must
+ call (!!) SAVEFP also saves the caller's LR -- placed into
+ R0 above -- into 8(R1). SAVEFP/RESTOREFP should never be
+ called to save or restore only F31. */
+
+ if (info->lr_save_offset != 8 || info->first_fp_reg_save == 63)
+ abort ();
+
+ sprintf (rname, "*saveFP%s%.0d ; save f%d-f31",
+ (info->first_fp_reg_save - 32 == 14 ? "" : "+"),
+ (info->first_fp_reg_save - 46) * 4,
+ info->first_fp_reg_save - 32);
+#else
+ /* APPLE LOCAL end reduce code size */
sprintf (rname, "%s%d%s", SAVE_FP_PREFIX,
info->first_fp_reg_save - 32, SAVE_FP_SUFFIX);
+ /* APPLE LOCAL reduce code size */
+#endif /* TARGET_MACHO */
alloc_rname = ggc_strdup (rname);
- RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode,
+ RTVEC_ELT (p, count++) = gen_rtx_USE (VOIDmode,
gen_rtx_SYMBOL_REF (Pmode,
alloc_rname));
+ /* APPLE LOCAL reduce code size */
+ if ( gen_following_label )
+ RTVEC_ELT (p, count++) = gen_rtx_USE (VOIDmode, const0_rtx);
for (i = 0; i < 64 - info->first_fp_reg_save; i++)
{
rtx addr, reg, mem;
@@ -11906,11 +12440,31 @@ rs6000_emit_prologue (void)
mem = gen_rtx_MEM (DFmode, addr);
set_mem_alias_set (mem, rs6000_sr_alias_set);
- RTVEC_ELT (p, i + 2) = gen_rtx_SET (VOIDmode, mem, reg);
+ RTVEC_ELT (p, count++) = gen_rtx_SET (VOIDmode, mem, reg);
+ }
+ /* APPLE LOCAL begin fix 2866661 */
+#if TARGET_MACHO
+ /* Darwin version of these functions stores R0. */
+ RTVEC_ELT (p, count++) = gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 0));
+
+ /* If we saved LR, *tell* people about it! */
+ if (info->lr_save_p)
+ {
+ rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
+ GEN_INT (info->lr_save_offset + sp_offset));
+ rtx mem = gen_rtx_MEM (Pmode, addr);
+ /* This should not be of rs6000_sr_alias_set, because of
+ __builtin_return_address. */
+ RTVEC_ELT (p, count++) = gen_rtx_SET (Pmode, mem,
+ gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM));
}
+#endif
+ /* APPLE LOCAL end fix 2866661 */
insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
rs6000_frame_related (insn, frame_ptr_rtx, info->total_size,
NULL_RTX, NULL_RTX);
+ /* APPLE LOCAL: callers_lr_already_saved */
+ callers_lr_already_saved = 1;
}
/* Save GPRs. This is done as a PARALLEL if we are using
@@ -11945,7 +12499,11 @@ rs6000_emit_prologue (void)
&& ! call_used_regs[info->first_gp_reg_save+i])
|| (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM
&& ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
- || (DEFAULT_ABI == ABI_DARWIN && flag_pic))))
+ /* APPLE LOCAL begin volatile pic base reg in leaves */
+ || (DEFAULT_ABI == ABI_DARWIN && flag_pic
+ && current_function_uses_pic_offset_table
+ && cfun->machine->substitute_pic_base_reg == -1))))
+ /* APPLE LOCAL end volatile pic base reg in leaves */
{
rtx addr, reg, mem;
reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i);
@@ -12027,8 +12585,18 @@ rs6000_emit_prologue (void)
}
}
+ /* APPLE LOCAL special ObjC method use of R12 */
+ if (objc_method_using_pic)
+ rs6000_maybe_dead (
+ emit_move_insn (gen_rtx_REG (Pmode,
+ cfun->machine->substitute_pic_base_reg == -1
+ ? PIC_OFFSET_TABLE_REGNUM
+ : cfun->machine->substitute_pic_base_reg),
+ gen_rtx_REG (Pmode, 12)));
+
/* Save lr if we used it. */
- if (info->lr_save_p)
+ /* APPLE LOCAL: callers_lr_already_saved */
+ if (info->lr_save_p && !callers_lr_already_saved)
{
rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
GEN_INT (info->lr_save_offset + sp_offset));
@@ -12111,17 +12679,38 @@ rs6000_emit_prologue (void)
#if TARGET_MACHO
if (DEFAULT_ABI == ABI_DARWIN
+ /* APPLE LOCAL special ObjC method use of R12 */
+ && !objc_method_using_pic
&& flag_pic && current_function_uses_pic_offset_table)
{
rtx dest = gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM);
const char *picbase = machopic_function_base_name ();
rtx src = gen_rtx_SYMBOL_REF (Pmode, picbase);
- rs6000_maybe_dead (emit_insn (gen_load_macho_picbase (dest, src)));
+ /* APPLE LOCAL begin save and restore LR */
+ /* Save and restore LR locally around this call (in R0). */
+ if (!info->lr_save_p)
+ rs6000_maybe_dead (emit_move_insn (gen_rtx_REG (Pmode, 0), dest));
+ /* APPLE LOCAL end save and restore LR */
+ /* APPLE LOCAL begin performance enhancement */
+#if TARGET_MACHO
+ if (!lr_already_set_up_for_pic)
+ rs6000_maybe_dead (emit_insn (gen_load_macho_picbase (dest, src)));
+#endif
+ /* APPLE LOCAL end performance enhancement */
+
+ /* APPLE LOCAL begin volatile pic base reg in leaves */
rs6000_maybe_dead (
- emit_move_insn (gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM),
- gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)));
+ emit_move_insn (
+ gen_rtx_REG (Pmode,
+ cfun->machine->substitute_pic_base_reg == -1
+ ? RS6000_PIC_OFFSET_TABLE_REGNUM
+ : cfun->machine->substitute_pic_base_reg),
+ dest));
+ if (!info->lr_save_p)
+ rs6000_maybe_dead (emit_move_insn (dest, gen_rtx_REG (Pmode, 0)));
+ /* APPLE LOCAL end */
}
#endif
}
@@ -12137,6 +12726,8 @@ rs6000_output_function_prologue (FILE *file,
if (TARGET_DEBUG_STACK)
debug_stack_info (info);
+ /* APPLE LOCAL do not extern fp save/restore */
+#if !TARGET_MACHO
/* Write .extern for any function we will call to save and restore
fp values. */
if (info->first_fp_reg_save < 64
@@ -12145,6 +12736,8 @@ rs6000_output_function_prologue (FILE *file,
SAVE_FP_PREFIX, info->first_fp_reg_save - 32, SAVE_FP_SUFFIX,
RESTORE_FP_PREFIX, info->first_fp_reg_save - 32,
RESTORE_FP_SUFFIX);
+ /* APPLE LOCAL do not extern fp save/restore */
+#endif /* !TARGET_MACHO */
/* Write .extern for AIX common mode routines, if needed. */
if (! TARGET_POWER && ! TARGET_POWERPC && ! common_mode_defined)
@@ -12158,6 +12751,16 @@ rs6000_output_function_prologue (FILE *file,
common_mode_defined = 1;
}
+ /* APPLE LOCAL special ObjC method use of R12 */
+#if TARGET_MACHO
+ if ( HAVE_prologue && DEFAULT_ABI == ABI_DARWIN && objc_method_using_pic )
+ {
+ /* APPLE FIXME isn't there an asm macro to do all this? */
+ const char* piclabel = machopic_function_base_name ();
+ fprintf(file, "%s:\n", (*piclabel == '*') ? piclabel + 1 : piclabel);
+ }
+#endif
+
if (! HAVE_prologue)
{
start_sequence ();
@@ -12207,7 +12810,7 @@ rs6000_emit_epilogue (int sibcall)
rtx sp_reg_rtx = gen_rtx_REG (Pmode, 1);
rtx frame_reg_rtx = sp_reg_rtx;
enum machine_mode reg_mode = Pmode;
- int reg_size = UNITS_PER_WORD;
+ int reg_size = TARGET_32BIT ? 4 : 8;
int i;
info = rs6000_stack_info ();
@@ -12232,6 +12835,8 @@ rs6000_emit_epilogue (int sibcall)
using_mfcr_multiple = (rs6000_cpu == PROCESSOR_PPC601
|| rs6000_cpu == PROCESSOR_PPC603
|| rs6000_cpu == PROCESSOR_PPC750
+ /* APPLE LOCAL ? */
+ || rs6000_cpu == PROCESSOR_PPC7400
|| optimize_size);
/* If we have a frame pointer, a call to alloca, or a large stack
@@ -12324,7 +12929,9 @@ rs6000_emit_epilogue (int sibcall)
set_mem_alias_set (mem, rs6000_sr_alias_set);
- emit_move_insn (gen_rtx_REG (SImode, 12), mem);
+ /* APPLE LOCAL use R11 because of ObjC use of R12 in sibcall to CTR */
+ emit_move_insn (gen_rtx_REG (SImode,
+ DEFAULT_ABI == ABI_DARWIN ? 11 : 12), mem);
}
/* Set LR here to try to overlap restores below. */
@@ -12394,7 +13001,11 @@ rs6000_emit_epilogue (int sibcall)
&& ! call_used_regs[info->first_gp_reg_save+i])
|| (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM
&& ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
- || (DEFAULT_ABI == ABI_DARWIN && flag_pic))))
+ /* APPLE LOCAL begin darwin native */
+ || (DEFAULT_ABI == ABI_DARWIN && flag_pic
+ && current_function_uses_pic_offset_table
+ && cfun->machine->substitute_pic_base_reg == -1))))
+ /* APPLE LOCAL end darwin native */
{
rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
GEN_INT (info->gp_save_offset
@@ -12448,7 +13059,9 @@ rs6000_emit_epilogue (int sibcall)
/* If we saved cr, restore it here. Just those that were used. */
if (info->cr_save_p)
{
- rtx r12_rtx = gen_rtx_REG (SImode, 12);
+ /* APPLE LOCAL use R11 because of ObjC use of R12 in sibcall to CTR */
+ /* APPLE LOCAL silly name retained to minimize deviation from FSF */
+ rtx r12_rtx = gen_rtx_REG (SImode, DEFAULT_ABI == ABI_DARWIN ? 11 : 12);
int count = 0;
if (using_mfcr_multiple)
@@ -12548,8 +13161,25 @@ rs6000_emit_epilogue (int sibcall)
char rname[30];
const char *alloc_rname;
+ /* APPLE LOCAL begin code size reduction / performance enhancement */
+#if TARGET_MACHO
+ /* We have to calculate the offset into RESTFP to where we must
+ call (!!) RESTFP also restores the caller's LR from 8(R1).
+ RESTFP should *never* be called to restore only F31. */
+
+ if (info->lr_save_offset != 8 || info->first_fp_reg_save == 63)
+ abort ();
+
+ sprintf (rname, "*restFP%s%.0d ; restore f%d-f31",
+ (info->first_fp_reg_save - 32 == 14 ? "" : "+"),
+ (info->first_fp_reg_save - 46) * 4,
+ info->first_fp_reg_save - 32);
+#else
+ /* APPLE LOCAL end code size reduction / performance enhancement */
sprintf (rname, "%s%d%s", RESTORE_FP_PREFIX,
info->first_fp_reg_save - 32, RESTORE_FP_SUFFIX);
+ /* APPLE LOCAL code size reduction / performance enhancement */
+#endif /* TARGET_MACHO */
alloc_rname = ggc_strdup (rname);
RTVEC_ELT (p, 2) = gen_rtx_USE (VOIDmode,
gen_rtx_SYMBOL_REF (Pmode,
@@ -14663,6 +15293,11 @@ rs6000_initialize_trampoline (rtx addr, rtx fnaddr, rtx cxt)
const struct attribute_spec rs6000_attribute_table[] =
{
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+ /* APPLE LOCAL begin double destructor */
+#ifdef SUBTARGET_ATTRIBUTE_TABLE
+ SUBTARGET_ATTRIBUTE_TABLE
+#endif
+ /* APPLE LOCAL end double destructor */
{ "altivec", 1, 1, false, true, false, rs6000_handle_altivec_attribute },
{ "longcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
{ "shortcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
@@ -14756,6 +15391,21 @@ rs6000_handle_altivec_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
+/* AltiVec defines four built-in scalar types that serve as vector
+ elements; we must teach the compiler how to mangle them. */
+
+static const char *
+rs6000_mangle_fundamental_type (tree type)
+{
+ if (type == bool_char_type_node) return "U6__boolc";
+ if (type == bool_short_type_node) return "U6__bools";
+ if (type == pixel_type_node) return "u7__pixel";
+ if (type == bool_int_type_node) return "U6__booli";
+
+ /* For all other types, use normal C++ mangling. */
+ return NULL;
+}
+
/* Handle a "longcall" or "shortcall" attribute; arguments as in
struct attribute_spec.handler. */
@@ -14998,6 +15648,7 @@ symbolic_operand (rtx op)
#if TARGET_MACHO
static tree branch_island_list = 0;
+static int local_label_unique_number = 0;
/* Remember to generate a branch island for far calls to the given
function. */
@@ -15027,17 +15678,20 @@ macho_branch_islands (void)
{
char tmp_buf[512];
tree branch_island;
+ const char *name;
+ const char *label;
+ char name_buf[512];
+ char *local_label_0;
+ const char *non_lazy_pointer_name, *unencoded_non_lazy_pointer_name;
+ int length;
for (branch_island = branch_island_list;
branch_island;
branch_island = TREE_CHAIN (branch_island))
{
- const char *label =
- IDENTIFIER_POINTER (BRANCH_ISLAND_LABEL_NAME (branch_island));
- const char *name =
- darwin_strip_name_encoding (
- IDENTIFIER_POINTER (BRANCH_ISLAND_FUNCTION_NAME (branch_island)));
- char name_buf[512];
+ label = IDENTIFIER_POINTER (BRANCH_ISLAND_LABEL_NAME (branch_island));
+ name = darwin_strip_name_encoding (
+ IDENTIFIER_POINTER (BRANCH_ISLAND_FUNCTION_NAME (branch_island)));
/* Cheap copy of the details from the Darwin ASM_OUTPUT_LABELREF(). */
if (name[0] == '*' || name[0] == '&')
strcpy (name_buf, name+1);
@@ -15053,15 +15707,66 @@ macho_branch_islands (void)
fprintf (asm_out_file, "\t.stabd 68,0," HOST_WIDE_INT_PRINT_UNSIGNED "\n",
BRANCH_ISLAND_LINE_NUMBER(branch_island));
#endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
- if (flag_pic)
+ /* If PIC and the callee has no stub, do an indirect call through a
+ non-lazy-pointer. 'save_world' expects a parameter in R11;
+ theh dyld_stub_binding_helper (part of the Mach-O stub
+ interface) expects a different parameter in R11. This is
+ effectively a "non-lazy stub." By-the-way, a
+ "non-lazy-pointer" is a .long that gets coalesced with others
+ of the same value, so one NLP suffices for an entire
+ application. */
+ if (flag_pic && (machopic_classify_ident (get_identifier (name)) == MACHOPIC_UNDEFINED))
+ {
+ /* This is the address of the non-lazy pointer; load from it
+ to get the address we want. */
+ non_lazy_pointer_name = machopic_non_lazy_ptr_name (name);
+ machopic_validate_stub_or_non_lazy_ptr (non_lazy_pointer_name,
+ /* non-lazy-pointer */0);
+ unencoded_non_lazy_pointer_name =
+ (*targetm.strip_name_encoding) (non_lazy_pointer_name);
+ length = strlen (name);
+ local_label_0 = alloca (length + 32);
+ /* Cheap copy of the details from the Darwin ASM_OUTPUT_LABELREF(). */
+ if (name[0] == '*' || name[0] == '&')
+ strcpy (name_buf, name+1);
+ else
+ {
+ name_buf[0] = '_';
+ strcpy (name_buf+1, name);
+ }
+
+ sprintf (local_label_0, "%s_%d_pic", name_buf, local_label_unique_number);
+ local_label_unique_number++;
+ strcpy (tmp_buf, "\n");
+ strcat (tmp_buf, label);
+ strcat (tmp_buf, "\tmflr r0\n");
+ strcat (tmp_buf, "\tbcl 20,31,");
+ strcat (tmp_buf, "\tbcl 20,31,%s\n");
+ strcat (tmp_buf, local_label_0);
+ strcat (tmp_buf, ":\n");
+ strcat (tmp_buf, "\tmflr r12\n");
+ strcat (tmp_buf, "\taddis r12,r12,ha16(");
+ strcat (tmp_buf, non_lazy_pointer_name);
+ strcat (tmp_buf, "-");
+ strcat (tmp_buf, local_label_0);
+ strcat (tmp_buf, ")\n\tlwz r12,lo16(");
+ strcat (tmp_buf, non_lazy_pointer_name);
+ strcat (tmp_buf, "-");
+ strcat (tmp_buf, local_label_0);
+ strcat (tmp_buf, ")(r12)\n");
+ strcat (tmp_buf, "\tmtlr r0\n");
+ strcat (tmp_buf, "\tmtctr r12\n");
+ strcat (tmp_buf, "\tbctr\n");
+ }
+ else if (flag_pic)
{
strcat (tmp_buf, ":\n\tmflr r0\n\tbcl 20,31,");
strcat (tmp_buf, label);
strcat (tmp_buf, "_pic\n");
strcat (tmp_buf, label);
- strcat (tmp_buf, "_pic:\n\tmflr r11\n");
+ strcat (tmp_buf, "_pic:\n\tmflr r12\n");
- strcat (tmp_buf, "\taddis r11,r11,ha16(");
+ strcat (tmp_buf, "\taddis r12,r12,ha16(");
strcat (tmp_buf, name_buf);
strcat (tmp_buf, " - ");
strcat (tmp_buf, label);
@@ -15069,7 +15774,7 @@ macho_branch_islands (void)
strcat (tmp_buf, "\tmtlr r0\n");
- strcat (tmp_buf, "\taddi r12,r11,lo16(");
+ strcat (tmp_buf, "\taddi r12,r12,lo16(");
strcat (tmp_buf, name_buf);
strcat (tmp_buf, " - ");
strcat (tmp_buf, label);
@@ -15135,12 +15840,55 @@ char *
output_call (rtx insn, rtx *operands, int dest_operand_number, int cookie_operand_number)
{
static char buf[256];
+ const char *far_call_instr_str=NULL, *near_call_instr_str=NULL;
+ rtx pattern;
+
+ switch (GET_CODE (insn))
+ {
+ case CALL_INSN:
+ far_call_instr_str = "jbsr";
+ near_call_instr_str = "bl";
+ pattern = NULL_RTX;
+ break;
+ case JUMP_INSN:
+ far_call_instr_str = "jmp";
+ near_call_instr_str = "b";
+ pattern = NULL_RTX;
+ break;
+ case INSN:
+ pattern = PATTERN (insn);
+ break;
+ default:
+ abort();
+ break;
+ }
+
if (GET_CODE (operands[dest_operand_number]) == SYMBOL_REF
&& (INTVAL (operands[cookie_operand_number]) & CALL_LONG))
{
tree labelname;
tree funname = get_identifier (XSTR (operands[dest_operand_number], 0));
+ /* This insn represents a prologue or epilogue. */
+ if ((pattern != NULL_RTX) && GET_CODE (pattern) == PARALLEL)
+ {
+ rtx parallel_first_op = XVECEXP (pattern, 0, 0);
+ switch (GET_CODE (parallel_first_op))
+ {
+ case CLOBBER: /* Prologue: a call to save_world. */
+ far_call_instr_str = "jbsr";
+ near_call_instr_str = "bl";
+ break;
+ case RETURN: /* Epilogue: a call to rest_world. */
+ far_call_instr_str = "jmp";
+ near_call_instr_str = "b";
+ break;
+ default:
+ abort();
+ break;
+ }
+ }
+
if (no_previous_def (funname))
{
int line_number = 0;
@@ -15303,6 +16051,129 @@ toc_section (void)
#endif /* TARGET_MACHO */
+/* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */
+/* Return the alignment of a struct based on the Macintosh PowerPC
+ alignment rules. In general the alignment of a struct is
+ determined by the greatest alignment of its elements. However, the
+ PowerPC rules cause the alignment of a struct to peg at word
+ alignment except when the first field has greater than word
+ (32-bit) alignment, in which case the alignment is determined by
+ the alignment of the first field. */
+
+unsigned
+round_type_align (tree the_struct, unsigned computed, unsigned specified)
+{
+ if (TARGET_ALTIVEC && TREE_CODE (the_struct) == VECTOR_TYPE)
+ {
+ /* All vectors are (at least) 16-byte aligned. A struct or
+ union with a vector element is also 16-byte aligned. */
+ return MAX (RS6000_VECTOR_ALIGNMENT, MAX (computed, specified));
+ }
+
+ if (TREE_CODE (the_struct) == RECORD_TYPE
+ || TREE_CODE (the_struct) == UNION_TYPE
+ || TREE_CODE (the_struct) == QUAL_UNION_TYPE)
+ {
+ tree first_field = TYPE_FIELDS (the_struct);
+
+ /* Skip past static fields, enums, and constant fields that are
+ not really a part of the record layout. */
+ while ((first_field != 0)
+ && (TREE_CODE (first_field) != FIELD_DECL))
+ first_field = TREE_CHAIN (first_field);
+
+ if (first_field != 0)
+ {
+ /* If other-than-default alignment (which includes mac68k
+ mode) is in effect, then no adjustments to the alignment
+ should be necessary. Ditto if the struct has the
+ __packed__ attribute. */
+ if (TYPE_PACKED (the_struct) || TARGET_ALIGN_MAC68K
+ || TARGET_ALIGN_NATURAL || maximum_field_alignment != 0)
+ /* Do nothing */ ;
+ else
+ {
+ /* The following code handles Macintosh PowerPC
+ alignment. The implementation is complicated by the
+ fact that BIGGEST_ALIGNMENT is 128 when AltiVec is
+ enabled and 32 when it is not. So when AltiVec is
+ not enabled, alignment is generally limited to word
+ alignment. Consequently, the alignment of unions has
+ to be recalculated if AltiVec is not enabled.
+
+ Below we explicitly test for fields with greater than
+ word alignment: doubles, long longs, and structs and
+ arrays with greater than word alignment. */
+ unsigned val;
+ tree field_type;
+
+ val = MAX (computed, specified);
+
+ if (TREE_CODE (the_struct) == UNION_TYPE && !TARGET_ALTIVEC)
+ {
+ tree field = first_field;
+
+ while (field != 0)
+ {
+ /* Don't consider statics, enums and constant fields
+ which are not really a part of the record. */
+ if (TREE_CODE (field) != FIELD_DECL)
+ {
+ field = TREE_CHAIN (field);
+ continue;
+ }
+ field_type = TREE_TYPE(field);
+ if (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE)
+ field_type = get_inner_array_type (field);
+ else
+ field_type = TREE_TYPE (field);
+ val = MAX (TYPE_ALIGN (field_type), val);
+ if (FLOAT_TYPE_P (field_type)
+ && TYPE_MODE (field_type) == DFmode)
+ val = MAX (RS6000_DOUBLE_ALIGNMENT, val);
+ else if (INTEGRAL_TYPE_P (field_type)
+ && TYPE_MODE (field_type) == DImode)
+ val = MAX (RS6000_LONGLONG_ALIGNMENT, val);
+ field = TREE_CHAIN (field);
+ }
+ }
+ else
+ {
+ if (TREE_CODE (TREE_TYPE (first_field)) == ARRAY_TYPE)
+ field_type = get_inner_array_type (first_field);
+ else
+ field_type = TREE_TYPE (first_field);
+
+ if (field_type == error_mark_node)
+ return val;
+ val = MAX (TYPE_ALIGN (field_type), val);
+
+ if (FLOAT_TYPE_P (field_type)
+ && TYPE_MODE (field_type) == DFmode)
+ val = MAX (RS6000_DOUBLE_ALIGNMENT, val);
+ else if (INTEGRAL_TYPE_P (field_type)
+ && TYPE_MODE (field_type) == DImode)
+ val = MAX (RS6000_LONGLONG_ALIGNMENT, val);
+ }
+
+ return val;
+ }
+ } /* first_field != 0 */
+
+ /* Ensure all MAC68K structs are at least 16-bit aligned.
+ Unless the struct has __attribute__ ((packed)). */
+
+ if (TARGET_ALIGN_MAC68K && ! TYPE_PACKED (the_struct))
+ {
+ if (computed < 16)
+ computed = 16;
+ }
+ } /* RECORD_TYPE, etc */
+
+ return (MAX (computed, specified));
+}
+/* APPLE LOCAL end Macintosh alignment 2002-1-22 ff */
+
#if TARGET_ELF
static unsigned int
rs6000_elf_section_type_flags (tree decl, const char *name, int reloc)
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 641e4bbb8af..a570993fcae 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -23,6 +23,9 @@
/* Note that some other tm.h files include this one and then override
many of the definitions. */
+/* APPLE LOCAL fat builds */
+#define DEFAULT_TARGET_ARCH "ppc"
+
/* Definitions for the object file format. These are set at
compile-time. */
@@ -109,8 +112,10 @@
program.
Do not define this macro if it does not need to do anything. */
-
+
+#ifndef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS
+#endif
#define EXTRA_SPECS \
{ "cpp_default", CPP_DEFAULT_SPEC }, \
@@ -197,6 +202,15 @@ extern int target_flags;
0x00100000, and sysv4.h uses 0x00800000 -> 0x40000000.
0x80000000 is not available because target_flags is signed. */
+/* APPLE LOCAL long-branch */
+/* gen call addr in register for >64M range */
+#define MASK_LONG_BRANCH 0x02000000
+
+/* APPLE LOCAL BEGIN fix-and-continue mrs */
+#define MASK_FIX_AND_CONTINUE 0x04000000
+#define MASK_INDIRECT_ALL_DATA 0x08000000
+/* APPLE LOCAL END fix-and-continue mrs */
+
#define TARGET_POWER (target_flags & MASK_POWER)
#define TARGET_POWER2 (target_flags & MASK_POWER2)
#define TARGET_POWERPC (target_flags & MASK_POWERPC)
@@ -215,6 +229,8 @@ extern int target_flags;
#define TARGET_SCHED_PROLOG (target_flags & MASK_SCHED_PROLOG)
#define TARGET_ALTIVEC (target_flags & MASK_ALTIVEC)
#define TARGET_AIX_STRUCT_RET (target_flags & MASK_AIX_STRUCT_RET)
+/* APPLE LOCAL long-branch */
+#define TARGET_LONG_BRANCH (target_flags & MASK_LONG_BRANCH)
/* Define TARGET_MFCRF if the target assembler supports the optional
field operand for mfcr and the target processor supports the
@@ -226,7 +242,6 @@ extern int target_flags;
#define TARGET_MFCRF 0
#endif
-
#define TARGET_32BIT (! TARGET_64BIT)
#define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
#define TARGET_UPDATE (! TARGET_NO_UPDATE)
@@ -248,6 +263,10 @@ extern int target_flags;
#endif
#define TARGET_XL_CALL 0
+/* APPLE LOCAL BEGIN fix-and-continue mrs */
+#define TARGET_FIX_AND_CONTINUE (target_flags & MASK_FIX_AND_CONTINUE)
+#define TARGET_INDIRECT_ALL_DATA (target_flags & MASK_INDIRECT_ALL_DATA)
+/* APPLE LOCAL END fix-and-continue mrs */
/* Run-time compilation parameters selecting different hardware subsets.
@@ -346,6 +365,23 @@ extern int target_flags;
""}, \
{"no-svr4-struct-return", MASK_AIX_STRUCT_RET, \
""}, \
+ /* APPLE LOCAL long-branch */ \
+ {"long-branch", MASK_LONG_BRANCH, \
+ N_("Generate 32-bit call addresses (range > 64M)")}, \
+ {"no-long-branch", -MASK_LONG_BRANCH, ""}, \
+ {"longcall", MASK_LONG_BRANCH, \
+ N_("Generate 32-bit call addresses (range > 64M)")}, \
+ {"no-longcall", -MASK_LONG_BRANCH, ""}, \
+ /* APPLE LOCAL BEGIN fix-and-continue mrs */ \
+ {"fix-and-continue", MASK_FIX_AND_CONTINUE, \
+ N_("Generate code suitable for fast turn around debugging")}, \
+ {"no-fix-and-continue", -MASK_FIX_AND_CONTINUE, \
+ N_("Don't generate code suitable for fast turn around debugging")},\
+ {"indirect-data", MASK_INDIRECT_ALL_DATA, \
+ N_("Generate code suitable for fast turn around debugging")}, \
+ {"no-indirect-data", -MASK_INDIRECT_ALL_DATA, \
+ N_("Don't generate code suitable for fast turn around debugging")},\
+ /* APPLE LOCAL END fix-and-continue mrs */ \
{"mfcrf", MASK_MFCRF, \
N_("Generate single field mfcr instruction")}, \
{"no-mfcrf", - MASK_MFCRF, \
@@ -539,6 +575,10 @@ extern const char *rs6000_warn_altivec_long_switch;
#define MASK_ALIGN_POWER 0x00000000
#define MASK_ALIGN_NATURAL 0x00000001
#define TARGET_ALIGN_NATURAL (rs6000_alignment_flags & MASK_ALIGN_NATURAL)
+/* APPLE LOCAL begin Macintosh alignment 2002-2-26 ff */
+#define MASK_ALIGN_MAC68K 0x00000002
+#define TARGET_ALIGN_MAC68K (rs6000_alignment_flags & MASK_ALIGN_MAC68K)
+/* APPLE LOCAL end Macintosh alignment 2002-2-26 ff */
#else
#define TARGET_ALIGN_NATURAL 0
#endif
@@ -728,6 +768,13 @@ extern const char *rs6000_warn_altivec_long_switch;
/* Allocation boundary (in *bits*) for the code of a function. */
#define FUNCTION_BOUNDARY 32
+/* Constants for alignment macros below. */
+/* APPLE LOCAL begin Macintosh alignment */
+#define RS6000_DOUBLE_ALIGNMENT 64
+#define RS6000_LONGLONG_ALIGNMENT 64
+#define RS6000_VECTOR_ALIGNMENT 128
+/* APPLE LOCAL end Macintosh alignment */
+
/* No data type wants to be aligned rounder than this. */
#define BIGGEST_ALIGNMENT 128
@@ -1047,6 +1094,9 @@ extern const char *rs6000_warn_altivec_long_switch;
((TARGET_SPE && SPE_VECTOR_MODE (MODE)) \
|| (TARGET_ALTIVEC && ALTIVEC_VECTOR_MODE (MODE)))
+#define UNITS_PER_SIMD_WORD \
+ (TARGET_ALTIVEC ? 16 : (TARGET_SPE ? 8 : 0) )
+
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
For POWER and PowerPC, the GPRs can hold any mode, but values bigger
than one register cannot go past R31. The float
@@ -1162,8 +1212,7 @@ extern const char *rs6000_warn_altivec_long_switch;
= call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1; \
if (DEFAULT_ABI == ABI_DARWIN \
&& PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
- global_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
- = fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
+ fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
= call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
= call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1; \
if (TARGET_ALTIVEC) \
@@ -1528,6 +1577,9 @@ extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */
makes the stack pointer a smaller address. */
#define STACK_GROWS_DOWNWARD
+/* Offsets recorded in opcodes are a multiple of this alignment factor. */
+#define DWARF_CIE_DATA_ALIGNMENT (-((int) (TARGET_32BIT ? 4 : 8)))
+
/* Define this if the nominal address of the stack frame
is at the high-address end of the local variables;
that is, each additional local variable allocated
@@ -1717,6 +1769,9 @@ typedef struct machine_function GTY(())
int sysv_varargs_p;
/* Flags if __builtin_return_address (n) with n >= 1 was used. */
int ra_needs_full_frame;
+ /* APPLE LOCAL volatile pic base reg in leaves */
+ /* Substitute PIC register in leaf functions */
+ int substitute_pic_base_reg;
/* Some local-dynamic symbol. */
const char *some_ld_name;
/* Whether the instruction chain has been scanned already. */
@@ -2015,7 +2070,6 @@ typedef struct rs6000_args
On the RS/6000, all integer constants are acceptable, most won't be valid
for particular insns, though. Only easy FP constants are
acceptable. */
-
#define LEGITIMATE_CONSTANT_P(X) \
(((GET_CODE (X) != CONST_DOUBLE \
&& GET_CODE (X) != CONST_VECTOR) \
@@ -2126,7 +2180,8 @@ typedef struct rs6000_args
#define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \
do { \
int win; \
- (X) = rs6000_legitimize_reload_address ((X), (MODE), (OPNUM), \
+ /* APPLE LOCAL pass reload addr by address */ \
+ (X) = rs6000_legitimize_reload_address (&(X), (MODE), (OPNUM), \
(int)(TYPE), (IND_LEVELS), &win); \
if ( win ) \
goto WIN; \
@@ -3153,5 +3208,10 @@ enum rs6000_builtins
SPE_BUILTIN_EVMWHGUMIAN,
SPE_BUILTIN_MTSPEFSCR,
SPE_BUILTIN_MFSPEFSCR,
- SPE_BUILTIN_BRINC
+ /* APPLE LOCAL begin constant cfstrings */
+ SPE_BUILTIN_BRINC,
+
+ RS6000_BUILTIN_MAX,
+ TARGET_BUILTIN_MAX = RS6000_BUILTIN_MAX
+ /* APPLE LOCAL end constant cfstrings */
};
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 29b36d6e4e5..b2b8e967cd9 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -67,7 +67,7 @@
(const_string "integer"))
;; Length (in bytes).
-; '(pc)' in the following doesn't include the instruction itself; it is
+; '(pc)' in the following doesn't include the instruction itself; it is
; calculated as if the instruction had zero size.
(define_attr "length" ""
(if_then_else (eq_attr "type" "branch")
@@ -1632,7 +1632,7 @@
operands[3] = gen_reg_rtx (SImode);
operands[4] = gen_reg_rtx (SImode);
})
-
+
(define_expand "ffssi2"
[(set (match_dup 2)
(neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
@@ -1648,7 +1648,7 @@
operands[3] = gen_reg_rtx (SImode);
operands[4] = gen_reg_rtx (SImode);
})
-
+
(define_expand "mulsi3"
[(use (match_operand:SI 0 "gpc_reg_operand" ""))
(use (match_operand:SI 1 "gpc_reg_operand" ""))
@@ -1672,10 +1672,10 @@
"@
{muls|mullw} %0,%1,%2
{muli|mulli} %0,%1,%2"
- [(set (attr "type")
+ [(set (attr "type")
(cond [(match_operand:SI 2 "s8bit_cint_operand" "")
(const_string "imul3")
- (match_operand:SI 2 "short_cint_operand" "")
+ (match_operand:SI 2 "short_cint_operand" "")
(const_string "imul2")]
(const_string "imul")))])
@@ -1687,10 +1687,10 @@
"@
{muls|mullw} %0,%1,%2
{muli|mulli} %0,%1,%2"
- [(set (attr "type")
+ [(set (attr "type")
(cond [(match_operand:SI 2 "s8bit_cint_operand" "")
(const_string "imul3")
- (match_operand:SI 2 "short_cint_operand" "")
+ (match_operand:SI 2 "short_cint_operand" "")
(const_string "imul2")]
(const_string "imul")))])
@@ -2568,7 +2568,7 @@
(const_int 0)))]
"")
-;; Split a logical operation that we can't do in one insn into two insns,
+;; Split a logical operation that we can't do in one insn into two insns,
;; each of which does one 16-bit part. This is used by combine.
(define_split
@@ -4686,7 +4686,7 @@
"TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
[(const_int 0)]
"
-{ rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
+{ rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
operands[1], operands[2]);
DONE;
}")
@@ -4879,7 +4879,7 @@
(minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
(mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
(match_operand:DF 2 "gpc_reg_operand" "f"))))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
&& ! HONOR_SIGNED_ZEROS (DFmode)"
"{fnms|fnmsub} %0,%1,%2,%3"
[(set_attr "type" "dmul")])
@@ -4892,7 +4892,7 @@
[(set_attr "type" "dsqrt")])
;; The conditional move instructions allow us to perform max and min
-;; operations even when
+;; operations even when
(define_expand "maxdf3"
[(set (match_operand:DF 0 "gpc_reg_operand" "")
@@ -4920,7 +4920,7 @@
"TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
[(const_int 0)]
"
-{ rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
+{ rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
operands[1], operands[2]);
DONE;
}")
@@ -4991,7 +4991,11 @@
{
if (TARGET_POWERPC64)
{
- rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
+ /* APPLE LOCAL assign_stack_local_with_alias is used instead of
+ assign_stack_temp to get better scheduling, at the cost of some
+ stack space. */
+ rtx mem = assign_stack_local_with_alias (DImode, GET_MODE_SIZE (DImode),
+ GET_MODE_ALIGNMENT (DImode));
rtx t1 = gen_reg_rtx (DImode);
rtx t2 = gen_reg_rtx (DImode);
emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
@@ -5000,7 +5004,11 @@
operands[2] = force_reg (SImode, GEN_INT (0x43300000));
operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
- operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
+ /* APPLE LOCAL assign_stack_local_with_alias is used instead of
+ assign_stack_temp to get better scheduling, at the cost of some
+ stack space. */
+ operands[4] = assign_stack_local_with_alias (DFmode, GET_MODE_SIZE (DFmode),
+ GET_MODE_ALIGNMENT (DFmode));
operands[5] = gen_reg_rtx (DFmode);
operands[6] = gen_reg_rtx (SImode);
}")
@@ -5046,7 +5054,7 @@
tmp = highword; highword = lowword; lowword = tmp;
}
- emit_insn (gen_xorsi3 (operands[6], operands[1],
+ emit_insn (gen_xorsi3 (operands[6], operands[1],
GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
@@ -5073,7 +5081,11 @@
{
if (TARGET_POWERPC64)
{
- rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
+ /* APPLE LOCAL assign_stack_local_with_alias is used instead of
+ assign_stack_temp to get better scheduling, at the cost of some
+ stack space. */
+ rtx mem = assign_stack_local_with_alias (DImode, GET_MODE_SIZE (DImode),
+ GET_MODE_ALIGNMENT (DImode));
rtx t1 = gen_reg_rtx (DImode);
rtx t2 = gen_reg_rtx (DImode);
emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
@@ -5083,7 +5095,11 @@
operands[2] = force_reg (SImode, GEN_INT (0x43300000));
operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
- operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
+ /* APPLE LOCAL assign_stack_local_with_alias is used instead of
+ assign_stack_temp to get better scheduling, at the cost of some
+ stack space. */
+ operands[4] = assign_stack_local_with_alias (DFmode, GET_MODE_SIZE (DFmode),
+ GET_MODE_ALIGNMENT (DFmode));
operands[5] = gen_reg_rtx (DFmode);
}")
@@ -5141,7 +5157,11 @@
"
{
operands[2] = gen_reg_rtx (DImode);
- operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
+ /* APPLE LOCAL assign_stack_local_with_alias is used instead of
+ assign_stack_temp to get better scheduling, at the cost of some
+ stack space. */
+ operands[3] = assign_stack_local_with_alias (DImode, GET_MODE_SIZE (DImode),
+ GET_MODE_ALIGNMENT (DImode));
}")
(define_insn "*fix_truncdfsi2_internal"
@@ -5642,7 +5662,7 @@
(define_insn "*ashrdisi3_noppc64"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
+ (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
(const_int 32)) 4))]
"TARGET_32BIT && !TARGET_POWERPC64"
"*
@@ -5652,7 +5672,7 @@
else
return \"mr %0,%1\";
}"
- [(set_attr "length" "4")])
+ [(set_attr "length" "4")])
;; PowerPC64 DImode operations.
@@ -6032,15 +6052,15 @@
(define_expand "ctzdi2"
[(set (match_dup 2)
(neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
- (parallel [(set (match_dup 3) (and:DI (match_dup 1)
- (match_dup 2)))
+ (parallel [(set (match_dup 3) (and:DI (match_dup 1)
+ (match_dup 2)))
(clobber (scratch:CC))])
(set (match_dup 4) (clz:DI (match_dup 3)))
(set (match_operand:DI 0 "gpc_reg_operand" "=r")
(minus:DI (const_int 63) (match_dup 4)))]
"TARGET_POWERPC64"
{
- operands[2] = gen_reg_rtx (DImode);
+ operands[2] = gen_reg_rtx (DImode);
operands[3] = gen_reg_rtx (DImode);
operands[4] = gen_reg_rtx (DImode);
})
@@ -6048,15 +6068,15 @@
(define_expand "ffsdi2"
[(set (match_dup 2)
(neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
- (parallel [(set (match_dup 3) (and:DI (match_dup 1)
- (match_dup 2)))
+ (parallel [(set (match_dup 3) (and:DI (match_dup 1)
+ (match_dup 2)))
(clobber (scratch:CC))])
(set (match_dup 4) (clz:DI (match_dup 3)))
(set (match_operand:DI 0 "gpc_reg_operand" "=r")
(minus:DI (const_int 64) (match_dup 4)))]
"TARGET_POWERPC64"
{
- operands[2] = gen_reg_rtx (DImode);
+ operands[2] = gen_reg_rtx (DImode);
operands[3] = gen_reg_rtx (DImode);
operands[4] = gen_reg_rtx (DImode);
})
@@ -6656,7 +6676,7 @@
"TARGET_POWERPC64"
"sld%I2 %0,%1,%H2"
[(set_attr "length" "8")])
-
+
(define_insn "*ashldi3_internal2"
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
(compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
@@ -6669,7 +6689,7 @@
#"
[(set_attr "type" "delayed_compare")
(set_attr "length" "4,8")])
-
+
(define_split
[(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
(compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
@@ -7335,7 +7355,7 @@
(const_int 0)))]
"")
-;; Split a logical operation that we can't do in one insn into two insns,
+;; Split a logical operation that we can't do in one insn into two insns,
;; each of which does one 16-bit part. This is used by combine.
(define_split
@@ -7349,7 +7369,7 @@
"
{
rtx i3,i4;
-
+
if (GET_CODE (operands[2]) == CONST_DOUBLE)
{
HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
@@ -7577,7 +7597,7 @@
;; Used by sched, shorten_branches and final when the GOT pseudo reg
;; didn't get allocated to a hard register.
-(define_split
+(define_split
[(set (match_operand:SI 0 "gpc_reg_operand" "")
(unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
(match_operand:SI 2 "memory_operand" "")]
@@ -7640,12 +7660,16 @@
return \"ld %0,lo16(%2)(%1)\";
else
{
- operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
+ /* APPLE LOCAL volatile pic base reg in leaves */
+ operands2[3] = gen_rtx_REG (SImode,
+ (cfun->machine->substitute_pic_base_reg == -1
+ ? RS6000_PIC_OFFSET_TABLE_REGNUM
+ : cfun->machine->substitute_pic_base_reg));
output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
#if TARGET_MACHO
if (MACHO_DYNAMIC_NO_PIC_P)
output_asm_insn (\"{liu|lis} %L0,ha16(%2+4)\", operands);
- else
+ else
/* We cannot rely on ha16(low half)==ha16(high half), alas,
although in practice it almost always is. */
output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
@@ -8474,7 +8498,7 @@
(define_split
[(set (match_operand:DI 0 "nonimmediate_operand" "")
(match_operand:DI 1 "input_operand" ""))]
- "reload_completed && !TARGET_POWERPC64
+ "reload_completed && !TARGET_POWERPC64
&& gpr_or_gpr_p (operands[0], operands[1])"
[(pc)]
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
@@ -8634,7 +8658,7 @@
[(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
(match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
(clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
- "TARGET_POWER && ! TARGET_POWERPC64
+ "TARGET_POWER && ! TARGET_POWERPC64
&& (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
"*
{
@@ -8682,7 +8706,7 @@
case 3:
/* If the address is not used in the output, we can use lsi. Otherwise,
fall through to generating four loads. */
- if (TARGET_STRING
+ if (TARGET_STRING
&& ! reg_overlap_mentioned_p (operands[0], operands[1]))
return \"{lsi|lswi} %0,%P1,16\";
/* ... fall through ... */
@@ -8698,8 +8722,8 @@
"TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
|| gpc_reg_operand (operands[1], TImode))"
"@
- #
- #
+ #
+ #
#"
[(set_attr "type" "*,load,store")])
@@ -9831,7 +9855,7 @@
if (current_function_limit_stack)
{
rtx available;
- available = expand_binop (Pmode, sub_optab,
+ available = expand_binop (Pmode, sub_optab,
stack_pointer_rtx, stack_limit_rtx,
NULL_RTX, 1, OPTAB_WIDEN);
emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
@@ -10277,6 +10301,12 @@
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
output_asm_insn (\"creqv 6,6,6\", operands);
+/* APPLE LOCAL -mlongcall */
+#ifdef RS6000_LONG_BRANCH
+ if (!flag_pic)
+ return output_call(insn, operands, 0, 0);
+ else
+#endif
return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
}"
[(set_attr "type" "branch")
@@ -10392,7 +10422,7 @@
(match_operand 1 "" "g"))
(use (match_operand:SI 2 "immediate_operand" "O"))
(clobber (match_scratch:SI 3 "=l"))]
- "TARGET_64BIT
+ "TARGET_64BIT
&& DEFAULT_ABI == ABI_AIX
&& (INTVAL (operands[2]) & CALL_LONG) == 0"
"bl %z0\;%."
@@ -10446,7 +10476,7 @@
(match_operand 2 "" "g")))
(use (match_operand:SI 3 "immediate_operand" "O"))
(clobber (match_scratch:SI 4 "=l"))]
- "TARGET_64BIT
+ "TARGET_64BIT
&& DEFAULT_ABI == ABI_AIX
&& (INTVAL (operands[3]) & CALL_LONG) == 0"
"bl %z1\;%."
@@ -10459,11 +10489,12 @@
;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
;; which indicates how to set cr1
+;; APPLE LOCAL separate cl into c,*l; switch and attr's expanded to match
(define_insn "*call_indirect_nonlocal_sysv"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
- (match_operand 1 "" "g,g"))
- (use (match_operand:SI 2 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 3 "=l,l"))]
+ [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
+ (match_operand 1 "" "g,g,g,g"))
+ (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
+ (clobber (match_scratch:SI 3 "=l,l,l,l"))]
"DEFAULT_ABI == ABI_V4
|| DEFAULT_ABI == ABI_DARWIN"
{
@@ -10475,8 +10506,8 @@
return "b%T0l";
}
- [(set_attr "type" "jmpreg,jmpreg")
- (set_attr "length" "4,8")])
+ [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
+ (set_attr "length" "4,4,8,8")])
(define_insn "*call_nonlocal_sysv"
[(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
@@ -10502,12 +10533,13 @@
[(set_attr "type" "branch,branch")
(set_attr "length" "4,8")])
+;; APPLE LOCAL separate cl into c,*l; switch and attr's expanded to match
(define_insn "*call_value_indirect_nonlocal_sysv"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
- (match_operand 2 "" "g,g")))
- (use (match_operand:SI 3 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 4 "=l,l"))]
+ (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
+ (match_operand 2 "" "g,g,g,g")))
+ (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
+ (clobber (match_scratch:SI 4 "=l,l,l,l"))]
"DEFAULT_ABI == ABI_V4
|| DEFAULT_ABI == ABI_DARWIN"
{
@@ -10519,8 +10551,8 @@
return "b%T1l";
}
- [(set_attr "type" "jmpreg,jmpreg")
- (set_attr "length" "4,8")])
+ [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
+ (set_attr "length" "4,4,8,8")])
(define_insn "*call_value_nonlocal_sysv"
[(set (match_operand 0 "" "")
@@ -10575,6 +10607,52 @@
DONE;
}")
+;; APPLE LOCAL sibcall patterns
+;; APPLE MERGE modify FSF patterns below instead?
+;; this and similar patterns must be marked as using LR, otherwise
+;; dataflow will try to delete the store into it. This is true
+;; even when the actual reg to jump to is in CTR, when LR was
+;; saved and restored around the PIC-setting BCL.
+(define_insn "*sibcall_symbolic"
+ [(call (mem:SI (match_operand:SI 0 "call_operand" "s,c"))
+ (match_operand 1 "" ""))
+ (use (match_operand 2 "" ""))
+ (use (match_scratch:SI 3 "=l,l"))
+ (return)]
+ "! TARGET_64BIT && DEFAULT_ABI == ABI_DARWIN"
+ "*
+{
+ switch (which_alternative)
+ {
+ case 0: return \"b %z0\";
+ case 1: return \"b%T0\";
+ default: abort();
+ }
+}"
+ [(set_attr "type" "branch")
+ (set_attr "length" "4")])
+
+(define_insn "*sibcall_value_symbolic"
+ [(set (match_operand 0 "" "")
+ (call (mem:SI (match_operand:SI 1 "call_operand" "s,c"))
+ (match_operand 2 "" "")))
+ (use (match_operand:SI 3 "" ""))
+ (use (match_scratch:SI 4 "=l,l"))
+ (return)]
+ "! TARGET_64BIT && DEFAULT_ABI == ABI_DARWIN"
+ "*
+{
+ switch (which_alternative)
+ {
+ case 0: return \"b %z1\";
+ case 1: return \"b%T1\";
+ default: abort();
+ }
+}"
+ [(set_attr "type" "branch")
+ (set_attr "length" "4")])
+;; APPLE LOCAL end sibcall patterns
+
;; sibling call patterns
(define_expand "sibcall"
[(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
@@ -10704,7 +10782,7 @@
(use (match_operand:SI 2 "immediate_operand" "O"))
(use (match_operand:SI 3 "register_operand" "l"))
(return)]
- "TARGET_64BIT
+ "TARGET_64BIT
&& DEFAULT_ABI == ABI_AIX
&& (INTVAL (operands[2]) & CALL_LONG) == 0"
"b %z0"
@@ -10732,7 +10810,7 @@
(use (match_operand:SI 3 "immediate_operand" "O"))
(use (match_operand:SI 4 "register_operand" "l"))
(return)]
- "TARGET_64BIT
+ "TARGET_64BIT
&& DEFAULT_ABI == ABI_AIX
&& (INTVAL (operands[3]) & CALL_LONG) == 0"
"b %z1"
@@ -11009,11 +11087,11 @@
[(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
""
"
-{
+{
if (! rs6000_compare_fp_p)
FAIL;
- rs6000_emit_sCOND (NE, operands[0]);
+ rs6000_emit_sCOND (NE, operands[0]);
DONE;
}")
@@ -11041,7 +11119,7 @@
&& (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
FAIL;
- rs6000_emit_sCOND (GT, operands[0]);
+ rs6000_emit_sCOND (GT, operands[0]);
DONE;
}")
@@ -11055,7 +11133,7 @@
&& (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
FAIL;
- rs6000_emit_sCOND (LE, operands[0]);
+ rs6000_emit_sCOND (LE, operands[0]);
DONE;
}")
@@ -11065,11 +11143,11 @@
""
"
{
- if (! rs6000_compare_fp_p
+ if (! rs6000_compare_fp_p
&& (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
FAIL;
- rs6000_emit_sCOND (LT, operands[0]);
+ rs6000_emit_sCOND (LT, operands[0]);
DONE;
}")
@@ -13791,7 +13869,7 @@
}")
(define_expand "tablejumpdi"
- [(set (match_dup 4)
+ [(set (match_dup 4)
(sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
(set (match_dup 3)
(plus:DI (match_dup 4)
@@ -13900,7 +13978,7 @@
(const_int 1))
(label_ref (match_operand 0 "" ""))
(pc)))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
+ (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
(plus:SI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -13924,7 +14002,7 @@
(const_int 1))
(pc)
(label_ref (match_operand 0 "" ""))))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
+ (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
(plus:SI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -13948,7 +14026,7 @@
(const_int 1))
(label_ref (match_operand 0 "" ""))
(pc)))
- (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
+ (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
(plus:DI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -13972,7 +14050,7 @@
(const_int 1))
(pc)
(label_ref (match_operand 0 "" ""))))
- (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
+ (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
(plus:DI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -13998,7 +14076,7 @@
(const_int 0))
(label_ref (match_operand 0 "" ""))
(pc)))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
+ (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
(plus:SI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14022,7 +14100,7 @@
(const_int 0))
(pc)
(label_ref (match_operand 0 "" ""))))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
+ (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
(plus:SI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14046,7 +14124,7 @@
(const_int 0))
(label_ref (match_operand 0 "" ""))
(pc)))
- (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
+ (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
(plus:DI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14070,7 +14148,7 @@
(const_int 0))
(pc)
(label_ref (match_operand 0 "" ""))))
- (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
+ (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
(plus:DI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14096,7 +14174,7 @@
(const_int 1))
(label_ref (match_operand 0 "" ""))
(pc)))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
+ (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
(plus:SI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14120,7 +14198,7 @@
(const_int 1))
(pc)
(label_ref (match_operand 0 "" ""))))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
+ (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
(plus:SI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14144,7 +14222,7 @@
(const_int 1))
(label_ref (match_operand 0 "" ""))
(pc)))
- (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
+ (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
(plus:DI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14168,7 +14246,7 @@
(const_int 1))
(pc)
(label_ref (match_operand 0 "" ""))))
- (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
+ (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
(plus:DI (match_dup 1)
(const_int -1)))
(clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -14363,7 +14441,7 @@
(define_insn "movesi_from_cr"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
+ (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
(reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
UNSPEC_MOVESI_FROM_CR))]
""
@@ -14376,7 +14454,7 @@
(match_operand:SI 2 "gpc_reg_operand" "r"))])]
"TARGET_MULTIPLE"
"{stm|stmw} %2,%1")
-
+
(define_insn "*save_fpregs_si"
[(match_parallel 0 "any_operand"
[(clobber (match_operand:SI 1 "register_operand" "=l"))
@@ -14388,6 +14466,35 @@
[(set_attr "type" "branch")
(set_attr "length" "4")])
+/* APPLE LOCAL begin unnamed*/
+(define_insn "*save_fpregs_with_label_si"
+ [(match_parallel 0 "any_operand"
+ [(clobber (match_operand:SI 1 "register_operand" "=l"))
+ (use (match_operand:SI 2 "call_operand" "s"))
+ (use (match_operand:SI 3 "" ""))
+ (set (match_operand:DF 4 "memory_operand" "=m")
+ (match_operand:DF 5 "gpc_reg_operand" "f"))])]
+ "TARGET_32BIT"
+ "*
+#if TARGET_MACHO
+ const char *picbase = machopic_function_base_name ();
+ char *tmp;
+ operands[3] = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1));
+ if (TARGET_LONG_BRANCH)
+ {
+ tmp = ggc_alloc (strlen (XSTR (operands[2], 0)) + strlen (XSTR (operands[3], 0)) + 2);
+ strcpy (tmp, output_call(insn, operands, 2, 2));
+ strcat (tmp, \"\\n%3:\");
+ return tmp;
+ }
+ else
+#endif
+ return \"bl %z2\\n%3:\";
+"
+ [(set_attr "type" "branch")
+ (set_attr "length" "4")])
+/* APPLE LOCAL end unnamed */
+
(define_insn "*save_fpregs_di"
[(match_parallel 0 "any_operand"
[(clobber (match_operand:DI 1 "register_operand" "=l"))
@@ -14452,7 +14559,7 @@
(unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
(match_operand 2 "immediate_operand" "n")]
UNSPEC_MOVESI_TO_CR))]
- "GET_CODE (operands[0]) == REG
+ "GET_CODE (operands[0]) == REG
&& CR_REGNO_P (REGNO (operands[0]))
&& GET_CODE (operands[2]) == CONST_INT
&& INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
@@ -14469,7 +14576,7 @@
(match_operand:SI 2 "memory_operand" "m"))])]
"TARGET_MULTIPLE"
"{lm|lmw} %1,%2")
-
+
(define_insn "*return_internal_si"
[(return)
(use (match_operand:SI 0 "register_operand" "lc"))]
@@ -14495,7 +14602,14 @@
(set (match_operand:DF 3 "gpc_reg_operand" "=f")
(match_operand:DF 4 "memory_operand" "m"))])]
"TARGET_32BIT"
- "b %z2")
+ {
+#if TARGET_MACHO
+ if (TARGET_LONG_BRANCH)
+ return output_call(insn, operands, 2, 2);
+ else
+#endif
+ return "b %z2";
+ })
(define_insn "*return_and_restore_fpregs_di"
[(match_parallel 0 "any_operand"
@@ -14505,7 +14619,14 @@
(set (match_operand:DF 3 "gpc_reg_operand" "=f")
(match_operand:DF 4 "memory_operand" "m"))])]
"TARGET_64BIT"
- "b %z2")
+ {
+#if TARGET_MACHO
+ if (TARGET_LONG_BRANCH)
+ return output_call(insn, operands, 2, 2);
+ else
+#endif
+ return "b %z2";
+ })
; This is used in compiling the unwind routines.
(define_expand "eh_return"
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 1e0ac3707f6..88bf8196b17 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -434,6 +434,13 @@ do { \
#define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
+/* APPLE LOCAL begin hot/cold partitioning */
+#define HOT_TEXT_SECTION_NAME ".text"
+#define NORMAL_TEXT_SECTION_NAME ".text"
+#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME ".text.unlikely"
+#define SECTION_FORMAT_STRING ".section\t\"%s\"\n\t.align 2\n"
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Override elfos.h definition. */
#undef INIT_SECTION_ASM_OP
#define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
index 185bb00eed2..af710ed7cef 100644
--- a/gcc/config/rs6000/t-darwin
+++ b/gcc/config/rs6000/t-darwin
@@ -1,7 +1,11 @@
+# APPLE LOCAL begin AltiVec
# Add trampoline and long double support to libgcc.
LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/darwin-tramp.asm \
- $(srcdir)/config/rs6000/darwin-ldouble.c
+ $(srcdir)/config/rs6000/darwin-fpsave.asm \
+ $(srcdir)/config/rs6000/darwin-ldouble.c
+# Enable AltiVec instructions when assembling the aforementioned .asm files.
# For libgcc, we always want 128-bit long double, since a libgcc built with
# that will work without it.
-TARGET_LIBGCC2_CFLAGS = -mlong-double-128
+TARGET_LIBGCC2_CFLAGS = -mlong-double-128 -Wa,-force_cpusubtype_ALL
+# APPLE LOCAL end AltiVec
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index 0e86f5f26ff..e8389a0d995 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -37,5 +37,9 @@ fp-bit32.c: $(srcdir)/config/fp-bit.c
mklibgcc: bispecs
bispecs: specs
- sed -e '/cc1_options/{ n; s/$$/ %{!m32:-mlong-double-128}/; }' < specs > $@
+ if [ x`$(GCC_FOR_TARGET) -print-multi-os-directory` = x../lib ]; then \
+ sed -e '/cc1_options/{ n; s/$$/ %{m64:-mlong-double-128}/; }' < specs > $@; \
+ else \
+ sed -e '/cc1_options/{ n; s/$$/ %{!m32:-mlong-double-128}/; }' < specs > $@; \
+ fi
diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
index 9546461e57d..9cc60036c00 100644
--- a/gcc/config/rs6000/t-rs6000
+++ b/gcc/config/rs6000/t-rs6000
@@ -18,6 +18,7 @@ rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \
# The rs6000 backend doesn't cause warnings in these files.
insn-conditions.o-warn =
+
# The files below trigger warnings in tree-ssa because of the gimplifier
# emitting code that confuse the compiler into thinking that some variables
# are used uninitialized.
diff --git a/gcc/config/rs6000/t-rtems b/gcc/config/rs6000/t-rtems
deleted file mode 100644
index 364a22d2278..00000000000
--- a/gcc/config/rs6000/t-rtems
+++ /dev/null
@@ -1,86 +0,0 @@
-# Multilibs for powerpc RTEMS targets.
-
-MULTILIB_OPTIONS = \
-mcpu=403/mcpu=505/mcpu=601/mcpu=602/mcpu=603/mcpu=603e/mcpu=604/mcpu=750/mcpu=821/mcpu=860 \
-Dmpc509/Dmpc8260 \
-D_OLD_EXCEPTIONS \
-msoft-float
-
-MULTILIB_DIRNAMES = \
-m403 m505 m601 m602 m603 m603e m604 m750 m821 m860 \
-mpc509 \
-mpc8260 \
-roe \
-nof
-
-MULTILIB_EXTRA_OPTS = mrelocatable-lib mno-eabi mstrict-align
-
-# MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT}
-MULTILIB_MATCHES = ${MULTILIB_MATCHES_ENDIAN} \
- ${MULTILIB_MATCHES_SYSV} \
- mcpu?505/Dmpc505=mcpu?505/Dmpc509
-
-#
-# RTEMS old/new-exceptions handling
-#
-# old-exception processing is depredicated, therefore
-#
-# * Cpu-variants supporting new exception processing are build
-# with new exception processing only
-# * Cpu-variants not having been ported to new exception processing are
-# build with old and new exception processing
-#
-
-# Cpu-variants supporting new exception processing only
-MULTILIB_NEW_EXCEPTIONS_ONLY = \
-*mcpu=604*/*D_OLD_EXCEPTIONS* \
-*mcpu=750*/*D_OLD_EXCEPTIONS* \
-*mcpu=821*/*D_OLD_EXCEPTIONS* \
-*Dmpc8260*/*D_OLD_EXCEPTIONS* \
-*mcpu=860*/*D_OLD_EXCEPTIONS*
-
-# Soft-float only, default implies msoft-float
-# NOTE: Must match with MULTILIB_MATCHES_FLOAT and MULTILIB_MATCHES
-MULTILIB_SOFTFLOAT_ONLY = \
-mcpu=403/*msoft-float* \
-mcpu=821/*msoft-float* \
-mcpu=860/*msoft-float*
-
-# Hard-float only, take out msoft-float
-MULTILIB_HARDFLOAT_ONLY = \
-mcpu=505/*msoft-float*
-
-MULTILIB_EXCEPTIONS =
-
-# Disallow -D_OLD_EXCEPTIONS without other options
-MULTILIB_EXCEPTIONS += D_OLD_EXCEPTIONS*
-
-# Disallow -Dppc and -Dmpc without other options
-MULTILIB_EXCEPTIONS += Dppc* Dmpc*
-
-MULTILIB_EXCEPTIONS += \
-${MULTILIB_NEW_EXCEPTIONS_ONLY} \
-${MULTILIB_SOFTFLOAT_ONLY} \
-${MULTILIB_HARDFLOAT_ONLY}
-
-# Special rules
-# Take out all variants we don't want
-MULTILIB_EXCEPTIONS += mcpu=403/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=403/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=505/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=505/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=601/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=601/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=602/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=602/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=603/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=603/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=603e/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=604/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=604/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=750/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=750/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=821/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=821/Dmpc8260*
-MULTILIB_EXCEPTIONS += mcpu=860/Dmpc509*
-MULTILIB_EXCEPTIONS += mcpu=860/Dmpc8260*
diff --git a/gcc/config/rs6000/vec.h b/gcc/config/rs6000/vec.h
new file mode 100644
index 00000000000..56e8786f25b
--- /dev/null
+++ b/gcc/config/rs6000/vec.h
@@ -0,0 +1,4515 @@
+/* APPLE LOCAL file AltiVec */
+/* This file is generated by ops-to-gp. Do not edit. */
+
+/* To regenerate execute:
+ ops-to-gp -gcc vec.ops builtin.ops
+ with the current directory being gcc/config/rs6000. */
+
+static const struct builtin B1_vec_abs = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 11, "vec_abs:1", "4", CODE_FOR_xfx_perm, B_UID(0) };
+static const struct builtin B2_vec_abs = { { &T_vec_s16, NULL, NULL, }, "x", &T_vec_s16, 1, FALSE, FALSE, 11, "vec_abs:2", "2", CODE_FOR_xfx_perm, B_UID(1) };
+static const struct builtin B3_vec_abs = { { &T_vec_s32, NULL, NULL, }, "x", &T_vec_s32, 1, FALSE, FALSE, 11, "vec_abs:3", "3", CODE_FOR_xfx_perm, B_UID(2) };
+static const struct builtin B4_vec_abs = { { &T_vec_s8, NULL, NULL, }, "x", &T_vec_s8, 1, FALSE, FALSE, 11, "vec_abs:4", "1", CODE_FOR_xfx_perm, B_UID(3) };
+static const struct builtin B1_vec_abss = { { &T_vec_s16, NULL, NULL, }, "x", &T_vec_s16, 1, FALSE, FALSE, 11, "vec_abss:1", "6", CODE_FOR_xfx_perm, B_UID(4) };
+static const struct builtin B2_vec_abss = { { &T_vec_s32, NULL, NULL, }, "x", &T_vec_s32, 1, FALSE, FALSE, 11, "vec_abss:2", "7", CODE_FOR_xfx_perm, B_UID(5) };
+static const struct builtin B3_vec_abss = { { &T_vec_s8, NULL, NULL, }, "x", &T_vec_s8, 1, FALSE, FALSE, 11, "vec_abss:3", "5", CODE_FOR_xfx_perm, B_UID(6) };
+static const struct builtin B1_vec_vadduhm = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vadduhm:1", "*vadduhm", CODE_FOR_xfxx_simple, B_UID(7) };
+static const struct builtin B2_vec_vadduhm = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vadduhm:2", "*vadduhm", CODE_FOR_xfxx_simple, B_UID(8) };
+static const struct builtin B1_vec_vadduwm = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vadduwm:1", "*vadduwm", CODE_FOR_xfxx_simple, B_UID(9) };
+static const struct builtin B2_vec_vadduwm = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vadduwm:2", "*vadduwm", CODE_FOR_xfxx_simple, B_UID(10) };
+static const struct builtin B1_vec_vaddubm = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vaddubm:1", "*vaddubm", CODE_FOR_xfxx_simple, B_UID(11) };
+static const struct builtin B2_vec_vaddubm = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vaddubm:2", "*vaddubm", CODE_FOR_xfxx_simple, B_UID(12) };
+static const struct builtin B_vec_vaddfp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vaddfp", "*vaddfp", CODE_FOR_xfxx_fp, B_UID(13) };
+static const struct builtin B3_vec_vadduhm = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vadduhm:3", "*vadduhm", CODE_FOR_xfxx_simple, B_UID(14) };
+static const struct builtin B4_vec_vadduhm = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vadduhm:4", "*vadduhm", CODE_FOR_xfxx_simple, B_UID(15) };
+static const struct builtin B3_vec_vadduwm = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vadduwm:3", "*vadduwm", CODE_FOR_xfxx_simple, B_UID(16) };
+static const struct builtin B4_vec_vadduwm = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vadduwm:4", "*vadduwm", CODE_FOR_xfxx_simple, B_UID(17) };
+static const struct builtin B3_vec_vaddubm = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vaddubm:3", "*vaddubm", CODE_FOR_xfxx_simple, B_UID(18) };
+static const struct builtin B4_vec_vaddubm = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vaddubm:4", "*vaddubm", CODE_FOR_xfxx_simple, B_UID(19) };
+static const struct builtin B5_vec_vadduhm = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vadduhm:5", "*vadduhm", CODE_FOR_xfxx_simple, B_UID(20) };
+static const struct builtin B6_vec_vadduhm = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vadduhm:6", "*vadduhm", CODE_FOR_xfxx_simple, B_UID(21) };
+static const struct builtin B5_vec_vadduwm = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vadduwm:5", "*vadduwm", CODE_FOR_xfxx_simple, B_UID(22) };
+static const struct builtin B6_vec_vadduwm = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vadduwm:6", "*vadduwm", CODE_FOR_xfxx_simple, B_UID(23) };
+static const struct builtin B5_vec_vaddubm = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vaddubm:5", "*vaddubm", CODE_FOR_xfxx_simple, B_UID(24) };
+static const struct builtin B6_vec_vaddubm = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vaddubm:6", "*vaddubm", CODE_FOR_xfxx_simple, B_UID(25) };
+static const struct builtin B_vec_vaddcuw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vaddcuw", "*vaddcuw", CODE_FOR_xfxx_simple, B_UID(26) };
+static const struct builtin B1_vec_vaddshs = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vaddshs:1", "*vaddshs", CODE_FOR_xfxx_simple, B_UID(27) };
+static const struct builtin B1_vec_vadduhs = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vadduhs:1", "*vadduhs", CODE_FOR_xfxx_simple, B_UID(28) };
+static const struct builtin B1_vec_vaddsws = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vaddsws:1", "*vaddsws", CODE_FOR_xfxx_simple, B_UID(29) };
+static const struct builtin B1_vec_vadduws = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vadduws:1", "*vadduws", CODE_FOR_xfxx_simple, B_UID(30) };
+static const struct builtin B1_vec_vaddsbs = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vaddsbs:1", "*vaddsbs", CODE_FOR_xfxx_simple, B_UID(31) };
+static const struct builtin B1_vec_vaddubs = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vaddubs:1", "*vaddubs", CODE_FOR_xfxx_simple, B_UID(32) };
+static const struct builtin B2_vec_vaddshs = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vaddshs:2", "*vaddshs", CODE_FOR_xfxx_simple, B_UID(33) };
+static const struct builtin B3_vec_vaddshs = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vaddshs:3", "*vaddshs", CODE_FOR_xfxx_simple, B_UID(34) };
+static const struct builtin B2_vec_vaddsws = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vaddsws:2", "*vaddsws", CODE_FOR_xfxx_simple, B_UID(35) };
+static const struct builtin B3_vec_vaddsws = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vaddsws:3", "*vaddsws", CODE_FOR_xfxx_simple, B_UID(36) };
+static const struct builtin B2_vec_vaddsbs = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vaddsbs:2", "*vaddsbs", CODE_FOR_xfxx_simple, B_UID(37) };
+static const struct builtin B3_vec_vaddsbs = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vaddsbs:3", "*vaddsbs", CODE_FOR_xfxx_simple, B_UID(38) };
+static const struct builtin B2_vec_vadduhs = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vadduhs:2", "*vadduhs", CODE_FOR_xfxx_simple, B_UID(39) };
+static const struct builtin B3_vec_vadduhs = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vadduhs:3", "*vadduhs", CODE_FOR_xfxx_simple, B_UID(40) };
+static const struct builtin B2_vec_vadduws = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vadduws:2", "*vadduws", CODE_FOR_xfxx_simple, B_UID(41) };
+static const struct builtin B3_vec_vadduws = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vadduws:3", "*vadduws", CODE_FOR_xfxx_simple, B_UID(42) };
+static const struct builtin B2_vec_vaddubs = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vaddubs:2", "*vaddubs", CODE_FOR_xfxx_simple, B_UID(43) };
+static const struct builtin B3_vec_vaddubs = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vaddubs:3", "*vaddubs", CODE_FOR_xfxx_simple, B_UID(44) };
+static const struct builtin B1_vec_all_eq = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:1", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(45) };
+static const struct builtin B2_vec_all_eq = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:2", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(46) };
+static const struct builtin B3_vec_all_eq = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:3", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(47) };
+static const struct builtin B4_vec_all_eq = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:4", "*vcmpequw.", CODE_FOR_j_24_t_fxx_simple, B_UID(48) };
+static const struct builtin B5_vec_all_eq = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:5", "*vcmpequw.", CODE_FOR_j_24_t_fxx_simple, B_UID(49) };
+static const struct builtin B6_vec_all_eq = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:6", "*vcmpequw.", CODE_FOR_j_24_t_fxx_simple, B_UID(50) };
+static const struct builtin B7_vec_all_eq = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:7", "*vcmpequb.", CODE_FOR_j_24_t_fxx_simple, B_UID(51) };
+static const struct builtin B8_vec_all_eq = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:8", "*vcmpequb.", CODE_FOR_j_24_t_fxx_simple, B_UID(52) };
+static const struct builtin B9_vec_all_eq = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:9", "*vcmpequb.", CODE_FOR_j_24_t_fxx_simple, B_UID(53) };
+static const struct builtin B10_vec_all_eq = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:10", "*vcmpeqfp.", CODE_FOR_j_24_t_fxx_simple, B_UID(54) };
+static const struct builtin B11_vec_all_eq = { { &T_vec_p16, &T_vec_p16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:11", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(55) };
+static const struct builtin B12_vec_all_eq = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:12", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(56) };
+static const struct builtin B13_vec_all_eq = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:13", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(57) };
+static const struct builtin B14_vec_all_eq = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:14", "*vcmpequw.", CODE_FOR_j_24_t_fxx_simple, B_UID(58) };
+static const struct builtin B15_vec_all_eq = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:15", "*vcmpequw.", CODE_FOR_j_24_t_fxx_simple, B_UID(59) };
+static const struct builtin B16_vec_all_eq = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:16", "*vcmpequb.", CODE_FOR_j_24_t_fxx_simple, B_UID(60) };
+static const struct builtin B17_vec_all_eq = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:17", "*vcmpequb.", CODE_FOR_j_24_t_fxx_simple, B_UID(61) };
+static const struct builtin B18_vec_all_eq = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:18", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(62) };
+static const struct builtin B19_vec_all_eq = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:19", "*vcmpequh.", CODE_FOR_j_24_t_fxx_simple, B_UID(63) };
+static const struct builtin B20_vec_all_eq = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:20", "*vcmpequw.", CODE_FOR_j_24_t_fxx_simple, B_UID(64) };
+static const struct builtin B21_vec_all_eq = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:21", "*vcmpequw.", CODE_FOR_j_24_t_fxx_simple, B_UID(65) };
+static const struct builtin B22_vec_all_eq = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:22", "*vcmpequb.", CODE_FOR_j_24_t_fxx_simple, B_UID(66) };
+static const struct builtin B23_vec_all_eq = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_eq:23", "*vcmpequb.", CODE_FOR_j_24_t_fxx_simple, B_UID(67) };
+static const struct builtin B1_vec_all_ge = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:1", "*vcmpgtsh.", CODE_FOR_j_26_t_frxx_simple, B_UID(68) };
+static const struct builtin B2_vec_all_ge = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:2", "*vcmpgtuh.", CODE_FOR_j_26_t_frxx_simple, B_UID(69) };
+static const struct builtin B3_vec_all_ge = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:3", "*vcmpgtsw.", CODE_FOR_j_26_t_frxx_simple, B_UID(70) };
+static const struct builtin B4_vec_all_ge = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:4", "*vcmpgtuw.", CODE_FOR_j_26_t_frxx_simple, B_UID(71) };
+static const struct builtin B5_vec_all_ge = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:5", "*vcmpgtsb.", CODE_FOR_j_26_t_frxx_simple, B_UID(72) };
+static const struct builtin B6_vec_all_ge = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:6", "*vcmpgtub.", CODE_FOR_j_26_t_frxx_simple, B_UID(73) };
+static const struct builtin B7_vec_all_ge = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_ge:7", "*vcmpgefp.", CODE_FOR_j_24_t_fxx_simple, B_UID(74) };
+static const struct builtin B8_vec_all_ge = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:8", "*vcmpgtsh.", CODE_FOR_j_26_t_frxx_simple, B_UID(75) };
+static const struct builtin B9_vec_all_ge = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:9", "*vcmpgtsh.", CODE_FOR_j_26_t_frxx_simple, B_UID(76) };
+static const struct builtin B10_vec_all_ge = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:10", "*vcmpgtsw.", CODE_FOR_j_26_t_frxx_simple, B_UID(77) };
+static const struct builtin B11_vec_all_ge = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:11", "*vcmpgtsw.", CODE_FOR_j_26_t_frxx_simple, B_UID(78) };
+static const struct builtin B12_vec_all_ge = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:12", "*vcmpgtsb.", CODE_FOR_j_26_t_frxx_simple, B_UID(79) };
+static const struct builtin B13_vec_all_ge = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:13", "*vcmpgtsb.", CODE_FOR_j_26_t_frxx_simple, B_UID(80) };
+static const struct builtin B14_vec_all_ge = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:14", "*vcmpgtuh.", CODE_FOR_j_26_t_frxx_simple, B_UID(81) };
+static const struct builtin B15_vec_all_ge = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:15", "*vcmpgtuh.", CODE_FOR_j_26_t_frxx_simple, B_UID(82) };
+static const struct builtin B16_vec_all_ge = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:16", "*vcmpgtuw.", CODE_FOR_j_26_t_frxx_simple, B_UID(83) };
+static const struct builtin B17_vec_all_ge = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:17", "*vcmpgtuw.", CODE_FOR_j_26_t_frxx_simple, B_UID(84) };
+static const struct builtin B18_vec_all_ge = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:18", "*vcmpgtub.", CODE_FOR_j_26_t_frxx_simple, B_UID(85) };
+static const struct builtin B19_vec_all_ge = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_ge:19", "*vcmpgtub.", CODE_FOR_j_26_t_frxx_simple, B_UID(86) };
+static const struct builtin B1_vec_all_gt = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:1", "*vcmpgtsh.", CODE_FOR_j_24_t_fxx_simple, B_UID(87) };
+static const struct builtin B2_vec_all_gt = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:2", "*vcmpgtuh.", CODE_FOR_j_24_t_fxx_simple, B_UID(88) };
+static const struct builtin B3_vec_all_gt = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:3", "*vcmpgtsw.", CODE_FOR_j_24_t_fxx_simple, B_UID(89) };
+static const struct builtin B4_vec_all_gt = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:4", "*vcmpgtuw.", CODE_FOR_j_24_t_fxx_simple, B_UID(90) };
+static const struct builtin B5_vec_all_gt = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:5", "*vcmpgtsb.", CODE_FOR_j_24_t_fxx_simple, B_UID(91) };
+static const struct builtin B6_vec_all_gt = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:6", "*vcmpgtub.", CODE_FOR_j_24_t_fxx_simple, B_UID(92) };
+static const struct builtin B7_vec_all_gt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:7", "*vcmpgtfp.", CODE_FOR_j_24_t_fxx_simple, B_UID(93) };
+static const struct builtin B8_vec_all_gt = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:8", "*vcmpgtsh.", CODE_FOR_j_24_t_fxx_simple, B_UID(94) };
+static const struct builtin B9_vec_all_gt = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:9", "*vcmpgtsh.", CODE_FOR_j_24_t_fxx_simple, B_UID(95) };
+static const struct builtin B10_vec_all_gt = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:10", "*vcmpgtsw.", CODE_FOR_j_24_t_fxx_simple, B_UID(96) };
+static const struct builtin B11_vec_all_gt = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:11", "*vcmpgtsw.", CODE_FOR_j_24_t_fxx_simple, B_UID(97) };
+static const struct builtin B12_vec_all_gt = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:12", "*vcmpgtsb.", CODE_FOR_j_24_t_fxx_simple, B_UID(98) };
+static const struct builtin B13_vec_all_gt = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:13", "*vcmpgtsb.", CODE_FOR_j_24_t_fxx_simple, B_UID(99) };
+static const struct builtin B14_vec_all_gt = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:14", "*vcmpgtuh.", CODE_FOR_j_24_t_fxx_simple, B_UID(100) };
+static const struct builtin B15_vec_all_gt = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:15", "*vcmpgtuh.", CODE_FOR_j_24_t_fxx_simple, B_UID(101) };
+static const struct builtin B16_vec_all_gt = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:16", "*vcmpgtuw.", CODE_FOR_j_24_t_fxx_simple, B_UID(102) };
+static const struct builtin B17_vec_all_gt = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:17", "*vcmpgtuw.", CODE_FOR_j_24_t_fxx_simple, B_UID(103) };
+static const struct builtin B18_vec_all_gt = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:18", "*vcmpgtub.", CODE_FOR_j_24_t_fxx_simple, B_UID(104) };
+static const struct builtin B19_vec_all_gt = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc24t, 2, FALSE, FALSE, 0, "vec_all_gt:19", "*vcmpgtub.", CODE_FOR_j_24_t_fxx_simple, B_UID(105) };
+static const struct builtin B_vec_all_in = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_in", "*vcmpbfp.", CODE_FOR_j_26_t_fxx_simple, B_UID(106) };
+static const struct builtin B1_vec_all_le = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:1", "*vcmpgtsh.", CODE_FOR_j_26_t_fxx_simple, B_UID(107) };
+static const struct builtin B2_vec_all_le = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:2", "*vcmpgtuh.", CODE_FOR_j_26_t_fxx_simple, B_UID(108) };
+static const struct builtin B3_vec_all_le = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:3", "*vcmpgtsw.", CODE_FOR_j_26_t_fxx_simple, B_UID(109) };
+static const struct builtin B4_vec_all_le = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:4", "*vcmpgtuw.", CODE_FOR_j_26_t_fxx_simple, B_UID(110) };
+static const struct builtin B5_vec_all_le = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:5", "*vcmpgtsb.", CODE_FOR_j_26_t_fxx_simple, B_UID(111) };
+static const struct builtin B6_vec_all_le = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:6", "*vcmpgtub.", CODE_FOR_j_26_t_fxx_simple, B_UID(112) };
+static const struct builtin B7_vec_all_le = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_le:7", "*vcmpgefp.", CODE_FOR_j_24_t_frxx_simple, B_UID(113) };
+static const struct builtin B8_vec_all_le = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:8", "*vcmpgtsh.", CODE_FOR_j_26_t_fxx_simple, B_UID(114) };
+static const struct builtin B9_vec_all_le = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:9", "*vcmpgtsh.", CODE_FOR_j_26_t_fxx_simple, B_UID(115) };
+static const struct builtin B10_vec_all_le = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:10", "*vcmpgtsw.", CODE_FOR_j_26_t_fxx_simple, B_UID(116) };
+static const struct builtin B11_vec_all_le = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:11", "*vcmpgtsw.", CODE_FOR_j_26_t_fxx_simple, B_UID(117) };
+static const struct builtin B12_vec_all_le = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:12", "*vcmpgtsb.", CODE_FOR_j_26_t_fxx_simple, B_UID(118) };
+static const struct builtin B13_vec_all_le = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:13", "*vcmpgtsb.", CODE_FOR_j_26_t_fxx_simple, B_UID(119) };
+static const struct builtin B14_vec_all_le = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:14", "*vcmpgtuh.", CODE_FOR_j_26_t_fxx_simple, B_UID(120) };
+static const struct builtin B15_vec_all_le = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:15", "*vcmpgtuh.", CODE_FOR_j_26_t_fxx_simple, B_UID(121) };
+static const struct builtin B16_vec_all_le = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:16", "*vcmpgtuw.", CODE_FOR_j_26_t_fxx_simple, B_UID(122) };
+static const struct builtin B17_vec_all_le = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:17", "*vcmpgtuw.", CODE_FOR_j_26_t_fxx_simple, B_UID(123) };
+static const struct builtin B18_vec_all_le = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:18", "*vcmpgtub.", CODE_FOR_j_26_t_fxx_simple, B_UID(124) };
+static const struct builtin B19_vec_all_le = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_le:19", "*vcmpgtub.", CODE_FOR_j_26_t_fxx_simple, B_UID(125) };
+static const struct builtin B1_vec_all_lt = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:1", "*vcmpgtsh.", CODE_FOR_j_24_t_frxx_simple, B_UID(126) };
+static const struct builtin B2_vec_all_lt = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:2", "*vcmpgtuh.", CODE_FOR_j_24_t_frxx_simple, B_UID(127) };
+static const struct builtin B3_vec_all_lt = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:3", "*vcmpgtsw.", CODE_FOR_j_24_t_frxx_simple, B_UID(128) };
+static const struct builtin B4_vec_all_lt = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:4", "*vcmpgtuw.", CODE_FOR_j_24_t_frxx_simple, B_UID(129) };
+static const struct builtin B5_vec_all_lt = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:5", "*vcmpgtsb.", CODE_FOR_j_24_t_frxx_simple, B_UID(130) };
+static const struct builtin B6_vec_all_lt = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:6", "*vcmpgtub.", CODE_FOR_j_24_t_frxx_simple, B_UID(131) };
+static const struct builtin B7_vec_all_lt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:7", "*vcmpgtfp.", CODE_FOR_j_24_t_frxx_simple, B_UID(132) };
+static const struct builtin B8_vec_all_lt = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:8", "*vcmpgtsh.", CODE_FOR_j_24_t_frxx_simple, B_UID(133) };
+static const struct builtin B9_vec_all_lt = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:9", "*vcmpgtsh.", CODE_FOR_j_24_t_frxx_simple, B_UID(134) };
+static const struct builtin B10_vec_all_lt = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:10", "*vcmpgtsw.", CODE_FOR_j_24_t_frxx_simple, B_UID(135) };
+static const struct builtin B11_vec_all_lt = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:11", "*vcmpgtsw.", CODE_FOR_j_24_t_frxx_simple, B_UID(136) };
+static const struct builtin B12_vec_all_lt = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:12", "*vcmpgtsb.", CODE_FOR_j_24_t_frxx_simple, B_UID(137) };
+static const struct builtin B13_vec_all_lt = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:13", "*vcmpgtsb.", CODE_FOR_j_24_t_frxx_simple, B_UID(138) };
+static const struct builtin B14_vec_all_lt = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:14", "*vcmpgtuh.", CODE_FOR_j_24_t_frxx_simple, B_UID(139) };
+static const struct builtin B15_vec_all_lt = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:15", "*vcmpgtuh.", CODE_FOR_j_24_t_frxx_simple, B_UID(140) };
+static const struct builtin B16_vec_all_lt = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:16", "*vcmpgtuw.", CODE_FOR_j_24_t_frxx_simple, B_UID(141) };
+static const struct builtin B17_vec_all_lt = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:17", "*vcmpgtuw.", CODE_FOR_j_24_t_frxx_simple, B_UID(142) };
+static const struct builtin B18_vec_all_lt = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:18", "*vcmpgtub.", CODE_FOR_j_24_t_frxx_simple, B_UID(143) };
+static const struct builtin B19_vec_all_lt = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc24tr, 2, FALSE, FALSE, 0, "vec_all_lt:19", "*vcmpgtub.", CODE_FOR_j_24_t_frxx_simple, B_UID(144) };
+static const struct builtin B_vec_all_nan = { { &T_vec_f32, NULL, NULL, }, "x", &T_cc26td, 1, FALSE, FALSE, 0, "vec_all_nan", "*vcmpeqfp.", CODE_FOR_j_26_t_fx_simple, B_UID(145) };
+static const struct builtin B1_vec_all_ne = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:1", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(146) };
+static const struct builtin B2_vec_all_ne = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:2", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(147) };
+static const struct builtin B3_vec_all_ne = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:3", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(148) };
+static const struct builtin B4_vec_all_ne = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:4", "*vcmpequw.", CODE_FOR_j_26_t_fxx_simple, B_UID(149) };
+static const struct builtin B5_vec_all_ne = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:5", "*vcmpequw.", CODE_FOR_j_26_t_fxx_simple, B_UID(150) };
+static const struct builtin B6_vec_all_ne = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:6", "*vcmpequw.", CODE_FOR_j_26_t_fxx_simple, B_UID(151) };
+static const struct builtin B7_vec_all_ne = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:7", "*vcmpequb.", CODE_FOR_j_26_t_fxx_simple, B_UID(152) };
+static const struct builtin B8_vec_all_ne = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:8", "*vcmpequb.", CODE_FOR_j_26_t_fxx_simple, B_UID(153) };
+static const struct builtin B9_vec_all_ne = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:9", "*vcmpequb.", CODE_FOR_j_26_t_fxx_simple, B_UID(154) };
+static const struct builtin B10_vec_all_ne = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:10", "*vcmpeqfp.", CODE_FOR_j_26_t_fxx_simple, B_UID(155) };
+static const struct builtin B11_vec_all_ne = { { &T_vec_p16, &T_vec_p16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:11", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(156) };
+static const struct builtin B12_vec_all_ne = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:12", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(157) };
+static const struct builtin B13_vec_all_ne = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:13", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(158) };
+static const struct builtin B14_vec_all_ne = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:14", "*vcmpequw.", CODE_FOR_j_26_t_fxx_simple, B_UID(159) };
+static const struct builtin B15_vec_all_ne = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:15", "*vcmpequw.", CODE_FOR_j_26_t_fxx_simple, B_UID(160) };
+static const struct builtin B16_vec_all_ne = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:16", "*vcmpequb.", CODE_FOR_j_26_t_fxx_simple, B_UID(161) };
+static const struct builtin B17_vec_all_ne = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:17", "*vcmpequb.", CODE_FOR_j_26_t_fxx_simple, B_UID(162) };
+static const struct builtin B18_vec_all_ne = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:18", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(163) };
+static const struct builtin B19_vec_all_ne = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:19", "*vcmpequh.", CODE_FOR_j_26_t_fxx_simple, B_UID(164) };
+static const struct builtin B20_vec_all_ne = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:20", "*vcmpequw.", CODE_FOR_j_26_t_fxx_simple, B_UID(165) };
+static const struct builtin B21_vec_all_ne = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:21", "*vcmpequw.", CODE_FOR_j_26_t_fxx_simple, B_UID(166) };
+static const struct builtin B22_vec_all_ne = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:22", "*vcmpequb.", CODE_FOR_j_26_t_fxx_simple, B_UID(167) };
+static const struct builtin B23_vec_all_ne = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ne:23", "*vcmpequb.", CODE_FOR_j_26_t_fxx_simple, B_UID(168) };
+static const struct builtin B_vec_all_nge = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_nge", "*vcmpgefp.", CODE_FOR_j_26_t_fxx_simple, B_UID(169) };
+static const struct builtin B_vec_all_ngt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26t, 2, FALSE, FALSE, 0, "vec_all_ngt", "*vcmpgtfp.", CODE_FOR_j_26_t_fxx_simple, B_UID(170) };
+static const struct builtin B_vec_all_nle = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_nle", "*vcmpgefp.", CODE_FOR_j_26_t_frxx_simple, B_UID(171) };
+static const struct builtin B_vec_all_nlt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26tr, 2, FALSE, FALSE, 0, "vec_all_nlt", "*vcmpgtfp.", CODE_FOR_j_26_t_frxx_simple, B_UID(172) };
+static const struct builtin B_vec_all_numeric = { { &T_vec_f32, NULL, NULL, }, "x", &T_cc24td, 1, FALSE, FALSE, 0, "vec_all_numeric", "*vcmpeqfp.", CODE_FOR_j_24_t_fx_simple, B_UID(173) };
+static const struct builtin B1_vec_vand = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 2, "vec_vand:1", "*vand", CODE_FOR_xfxx_simple, B_UID(174) };
+static const struct builtin B2_vec_vand = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vand:2", "*vand", CODE_FOR_xfxx_simple, B_UID(175) };
+static const struct builtin B3_vec_vand = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vand:3", "*vand", CODE_FOR_xfxx_simple, B_UID(176) };
+static const struct builtin B4_vec_vand = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 2, "vec_vand:4", "*vand", CODE_FOR_xfxx_simple, B_UID(177) };
+static const struct builtin B5_vec_vand = { { &T_vec_b32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vand:5", "*vand", CODE_FOR_xfxx_simple, B_UID(178) };
+static const struct builtin B6_vec_vand = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vand:6", "*vand", CODE_FOR_xfxx_simple, B_UID(179) };
+static const struct builtin B7_vec_vand = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vand:7", "*vand", CODE_FOR_xfxx_simple, B_UID(180) };
+static const struct builtin B8_vec_vand = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 2, "vec_vand:8", "*vand", CODE_FOR_xfxx_simple, B_UID(181) };
+static const struct builtin B9_vec_vand = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vand:9", "*vand", CODE_FOR_xfxx_simple, B_UID(182) };
+static const struct builtin B10_vec_vand = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vand:10", "*vand", CODE_FOR_xfxx_simple, B_UID(183) };
+static const struct builtin B11_vec_vand = { { &T_vec_f32, &T_vec_b32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vand:11", "*vand", CODE_FOR_xfxx_simple, B_UID(184) };
+static const struct builtin B12_vec_vand = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vand:12", "*vand", CODE_FOR_xfxx_simple, B_UID(185) };
+static const struct builtin B13_vec_vand = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vand:13", "*vand", CODE_FOR_xfxx_simple, B_UID(186) };
+static const struct builtin B14_vec_vand = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vand:14", "*vand", CODE_FOR_xfxx_simple, B_UID(187) };
+static const struct builtin B15_vec_vand = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vand:15", "*vand", CODE_FOR_xfxx_simple, B_UID(188) };
+static const struct builtin B16_vec_vand = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vand:16", "*vand", CODE_FOR_xfxx_simple, B_UID(189) };
+static const struct builtin B17_vec_vand = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vand:17", "*vand", CODE_FOR_xfxx_simple, B_UID(190) };
+static const struct builtin B18_vec_vand = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vand:18", "*vand", CODE_FOR_xfxx_simple, B_UID(191) };
+static const struct builtin B19_vec_vand = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vand:19", "*vand", CODE_FOR_xfxx_simple, B_UID(192) };
+static const struct builtin B20_vec_vand = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vand:20", "*vand", CODE_FOR_xfxx_simple, B_UID(193) };
+static const struct builtin B21_vec_vand = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vand:21", "*vand", CODE_FOR_xfxx_simple, B_UID(194) };
+static const struct builtin B22_vec_vand = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vand:22", "*vand", CODE_FOR_xfxx_simple, B_UID(195) };
+static const struct builtin B23_vec_vand = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vand:23", "*vand", CODE_FOR_xfxx_simple, B_UID(196) };
+static const struct builtin B24_vec_vand = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vand:24", "*vand", CODE_FOR_xfxx_simple, B_UID(197) };
+static const struct builtin B1_vec_vandc = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 1, "vec_vandc:1", "*vandc", CODE_FOR_xfxx_simple, B_UID(198) };
+static const struct builtin B2_vec_vandc = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vandc:2", "*vandc", CODE_FOR_xfxx_simple, B_UID(199) };
+static const struct builtin B3_vec_vandc = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vandc:3", "*vandc", CODE_FOR_xfxx_simple, B_UID(200) };
+static const struct builtin B4_vec_vandc = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 1, "vec_vandc:4", "*vandc", CODE_FOR_xfxx_simple, B_UID(201) };
+static const struct builtin B5_vec_vandc = { { &T_vec_b32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 1, "vec_vandc:5", "*vandc", CODE_FOR_xfxx_simple, B_UID(202) };
+static const struct builtin B6_vec_vandc = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vandc:6", "*vandc", CODE_FOR_xfxx_simple, B_UID(203) };
+static const struct builtin B7_vec_vandc = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vandc:7", "*vandc", CODE_FOR_xfxx_simple, B_UID(204) };
+static const struct builtin B8_vec_vandc = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 1, "vec_vandc:8", "*vandc", CODE_FOR_xfxx_simple, B_UID(205) };
+static const struct builtin B9_vec_vandc = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vandc:9", "*vandc", CODE_FOR_xfxx_simple, B_UID(206) };
+static const struct builtin B10_vec_vandc = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vandc:10", "*vandc", CODE_FOR_xfxx_simple, B_UID(207) };
+static const struct builtin B11_vec_vandc = { { &T_vec_f32, &T_vec_b32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 1, "vec_vandc:11", "*vandc", CODE_FOR_xfxx_simple, B_UID(208) };
+static const struct builtin B12_vec_vandc = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 1, "vec_vandc:12", "*vandc", CODE_FOR_xfxx_simple, B_UID(209) };
+static const struct builtin B13_vec_vandc = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vandc:13", "*vandc", CODE_FOR_xfxx_simple, B_UID(210) };
+static const struct builtin B14_vec_vandc = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vandc:14", "*vandc", CODE_FOR_xfxx_simple, B_UID(211) };
+static const struct builtin B15_vec_vandc = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vandc:15", "*vandc", CODE_FOR_xfxx_simple, B_UID(212) };
+static const struct builtin B16_vec_vandc = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vandc:16", "*vandc", CODE_FOR_xfxx_simple, B_UID(213) };
+static const struct builtin B17_vec_vandc = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vandc:17", "*vandc", CODE_FOR_xfxx_simple, B_UID(214) };
+static const struct builtin B18_vec_vandc = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vandc:18", "*vandc", CODE_FOR_xfxx_simple, B_UID(215) };
+static const struct builtin B19_vec_vandc = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vandc:19", "*vandc", CODE_FOR_xfxx_simple, B_UID(216) };
+static const struct builtin B20_vec_vandc = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vandc:20", "*vandc", CODE_FOR_xfxx_simple, B_UID(217) };
+static const struct builtin B21_vec_vandc = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vandc:21", "*vandc", CODE_FOR_xfxx_simple, B_UID(218) };
+static const struct builtin B22_vec_vandc = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vandc:22", "*vandc", CODE_FOR_xfxx_simple, B_UID(219) };
+static const struct builtin B23_vec_vandc = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vandc:23", "*vandc", CODE_FOR_xfxx_simple, B_UID(220) };
+static const struct builtin B24_vec_vandc = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vandc:24", "*vandc", CODE_FOR_xfxx_simple, B_UID(221) };
+static const struct builtin B1_vec_any_eq = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:1", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(222) };
+static const struct builtin B2_vec_any_eq = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:2", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(223) };
+static const struct builtin B3_vec_any_eq = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:3", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(224) };
+static const struct builtin B4_vec_any_eq = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:4", "*vcmpequw.", CODE_FOR_j_26_f_fxx_simple, B_UID(225) };
+static const struct builtin B5_vec_any_eq = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:5", "*vcmpequw.", CODE_FOR_j_26_f_fxx_simple, B_UID(226) };
+static const struct builtin B6_vec_any_eq = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:6", "*vcmpequw.", CODE_FOR_j_26_f_fxx_simple, B_UID(227) };
+static const struct builtin B7_vec_any_eq = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:7", "*vcmpequb.", CODE_FOR_j_26_f_fxx_simple, B_UID(228) };
+static const struct builtin B8_vec_any_eq = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:8", "*vcmpequb.", CODE_FOR_j_26_f_fxx_simple, B_UID(229) };
+static const struct builtin B9_vec_any_eq = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:9", "*vcmpequb.", CODE_FOR_j_26_f_fxx_simple, B_UID(230) };
+static const struct builtin B10_vec_any_eq = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:10", "*vcmpeqfp.", CODE_FOR_j_26_f_fxx_simple, B_UID(231) };
+static const struct builtin B11_vec_any_eq = { { &T_vec_p16, &T_vec_p16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:11", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(232) };
+static const struct builtin B12_vec_any_eq = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:12", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(233) };
+static const struct builtin B13_vec_any_eq = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:13", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(234) };
+static const struct builtin B14_vec_any_eq = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:14", "*vcmpequw.", CODE_FOR_j_26_f_fxx_simple, B_UID(235) };
+static const struct builtin B15_vec_any_eq = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:15", "*vcmpequw.", CODE_FOR_j_26_f_fxx_simple, B_UID(236) };
+static const struct builtin B16_vec_any_eq = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:16", "*vcmpequb.", CODE_FOR_j_26_f_fxx_simple, B_UID(237) };
+static const struct builtin B17_vec_any_eq = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:17", "*vcmpequb.", CODE_FOR_j_26_f_fxx_simple, B_UID(238) };
+static const struct builtin B18_vec_any_eq = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:18", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(239) };
+static const struct builtin B19_vec_any_eq = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:19", "*vcmpequh.", CODE_FOR_j_26_f_fxx_simple, B_UID(240) };
+static const struct builtin B20_vec_any_eq = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:20", "*vcmpequw.", CODE_FOR_j_26_f_fxx_simple, B_UID(241) };
+static const struct builtin B21_vec_any_eq = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:21", "*vcmpequw.", CODE_FOR_j_26_f_fxx_simple, B_UID(242) };
+static const struct builtin B22_vec_any_eq = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:22", "*vcmpequb.", CODE_FOR_j_26_f_fxx_simple, B_UID(243) };
+static const struct builtin B23_vec_any_eq = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_eq:23", "*vcmpequb.", CODE_FOR_j_26_f_fxx_simple, B_UID(244) };
+static const struct builtin B1_vec_any_ge = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:1", "*vcmpgtsh.", CODE_FOR_j_24_f_frxx_simple, B_UID(245) };
+static const struct builtin B2_vec_any_ge = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:2", "*vcmpgtuh.", CODE_FOR_j_24_f_frxx_simple, B_UID(246) };
+static const struct builtin B3_vec_any_ge = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:3", "*vcmpgtsw.", CODE_FOR_j_24_f_frxx_simple, B_UID(247) };
+static const struct builtin B4_vec_any_ge = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:4", "*vcmpgtuw.", CODE_FOR_j_24_f_frxx_simple, B_UID(248) };
+static const struct builtin B5_vec_any_ge = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:5", "*vcmpgtsb.", CODE_FOR_j_24_f_frxx_simple, B_UID(249) };
+static const struct builtin B6_vec_any_ge = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:6", "*vcmpgtub.", CODE_FOR_j_24_f_frxx_simple, B_UID(250) };
+static const struct builtin B7_vec_any_ge = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_ge:7", "*vcmpgefp.", CODE_FOR_j_26_f_fxx_simple, B_UID(251) };
+static const struct builtin B8_vec_any_ge = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:8", "*vcmpgtsh.", CODE_FOR_j_24_f_frxx_simple, B_UID(252) };
+static const struct builtin B9_vec_any_ge = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:9", "*vcmpgtsh.", CODE_FOR_j_24_f_frxx_simple, B_UID(253) };
+static const struct builtin B10_vec_any_ge = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:10", "*vcmpgtsw.", CODE_FOR_j_24_f_frxx_simple, B_UID(254) };
+static const struct builtin B11_vec_any_ge = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:11", "*vcmpgtsw.", CODE_FOR_j_24_f_frxx_simple, B_UID(255) };
+static const struct builtin B12_vec_any_ge = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:12", "*vcmpgtsb.", CODE_FOR_j_24_f_frxx_simple, B_UID(256) };
+static const struct builtin B13_vec_any_ge = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:13", "*vcmpgtsb.", CODE_FOR_j_24_f_frxx_simple, B_UID(257) };
+static const struct builtin B14_vec_any_ge = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:14", "*vcmpgtuh.", CODE_FOR_j_24_f_frxx_simple, B_UID(258) };
+static const struct builtin B15_vec_any_ge = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:15", "*vcmpgtuh.", CODE_FOR_j_24_f_frxx_simple, B_UID(259) };
+static const struct builtin B16_vec_any_ge = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:16", "*vcmpgtuw.", CODE_FOR_j_24_f_frxx_simple, B_UID(260) };
+static const struct builtin B17_vec_any_ge = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:17", "*vcmpgtuw.", CODE_FOR_j_24_f_frxx_simple, B_UID(261) };
+static const struct builtin B18_vec_any_ge = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:18", "*vcmpgtub.", CODE_FOR_j_24_f_frxx_simple, B_UID(262) };
+static const struct builtin B19_vec_any_ge = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_ge:19", "*vcmpgtub.", CODE_FOR_j_24_f_frxx_simple, B_UID(263) };
+static const struct builtin B1_vec_any_gt = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:1", "*vcmpgtsh.", CODE_FOR_j_26_f_fxx_simple, B_UID(264) };
+static const struct builtin B2_vec_any_gt = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:2", "*vcmpgtuh.", CODE_FOR_j_26_f_fxx_simple, B_UID(265) };
+static const struct builtin B3_vec_any_gt = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:3", "*vcmpgtsw.", CODE_FOR_j_26_f_fxx_simple, B_UID(266) };
+static const struct builtin B4_vec_any_gt = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:4", "*vcmpgtuw.", CODE_FOR_j_26_f_fxx_simple, B_UID(267) };
+static const struct builtin B5_vec_any_gt = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:5", "*vcmpgtsb.", CODE_FOR_j_26_f_fxx_simple, B_UID(268) };
+static const struct builtin B6_vec_any_gt = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:6", "*vcmpgtub.", CODE_FOR_j_26_f_fxx_simple, B_UID(269) };
+static const struct builtin B7_vec_any_gt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:7", "*vcmpgtfp.", CODE_FOR_j_26_f_fxx_simple, B_UID(270) };
+static const struct builtin B8_vec_any_gt = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:8", "*vcmpgtsh.", CODE_FOR_j_26_f_fxx_simple, B_UID(271) };
+static const struct builtin B9_vec_any_gt = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:9", "*vcmpgtsh.", CODE_FOR_j_26_f_fxx_simple, B_UID(272) };
+static const struct builtin B10_vec_any_gt = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:10", "*vcmpgtsw.", CODE_FOR_j_26_f_fxx_simple, B_UID(273) };
+static const struct builtin B11_vec_any_gt = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:11", "*vcmpgtsw.", CODE_FOR_j_26_f_fxx_simple, B_UID(274) };
+static const struct builtin B12_vec_any_gt = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:12", "*vcmpgtsb.", CODE_FOR_j_26_f_fxx_simple, B_UID(275) };
+static const struct builtin B13_vec_any_gt = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:13", "*vcmpgtsb.", CODE_FOR_j_26_f_fxx_simple, B_UID(276) };
+static const struct builtin B14_vec_any_gt = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:14", "*vcmpgtuh.", CODE_FOR_j_26_f_fxx_simple, B_UID(277) };
+static const struct builtin B15_vec_any_gt = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:15", "*vcmpgtuh.", CODE_FOR_j_26_f_fxx_simple, B_UID(278) };
+static const struct builtin B16_vec_any_gt = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:16", "*vcmpgtuw.", CODE_FOR_j_26_f_fxx_simple, B_UID(279) };
+static const struct builtin B17_vec_any_gt = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:17", "*vcmpgtuw.", CODE_FOR_j_26_f_fxx_simple, B_UID(280) };
+static const struct builtin B18_vec_any_gt = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:18", "*vcmpgtub.", CODE_FOR_j_26_f_fxx_simple, B_UID(281) };
+static const struct builtin B19_vec_any_gt = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_gt:19", "*vcmpgtub.", CODE_FOR_j_26_f_fxx_simple, B_UID(282) };
+static const struct builtin B1_vec_any_le = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:1", "*vcmpgtsh.", CODE_FOR_j_24_f_fxx_simple, B_UID(283) };
+static const struct builtin B2_vec_any_le = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:2", "*vcmpgtuh.", CODE_FOR_j_24_f_fxx_simple, B_UID(284) };
+static const struct builtin B3_vec_any_le = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:3", "*vcmpgtsw.", CODE_FOR_j_24_f_fxx_simple, B_UID(285) };
+static const struct builtin B4_vec_any_le = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:4", "*vcmpgtuw.", CODE_FOR_j_24_f_fxx_simple, B_UID(286) };
+static const struct builtin B5_vec_any_le = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:5", "*vcmpgtsb.", CODE_FOR_j_24_f_fxx_simple, B_UID(287) };
+static const struct builtin B6_vec_any_le = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:6", "*vcmpgtub.", CODE_FOR_j_24_f_fxx_simple, B_UID(288) };
+static const struct builtin B7_vec_any_le = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_le:7", "*vcmpgefp.", CODE_FOR_j_26_f_frxx_simple, B_UID(289) };
+static const struct builtin B8_vec_any_le = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:8", "*vcmpgtsh.", CODE_FOR_j_24_f_fxx_simple, B_UID(290) };
+static const struct builtin B9_vec_any_le = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:9", "*vcmpgtsh.", CODE_FOR_j_24_f_fxx_simple, B_UID(291) };
+static const struct builtin B10_vec_any_le = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:10", "*vcmpgtsw.", CODE_FOR_j_24_f_fxx_simple, B_UID(292) };
+static const struct builtin B11_vec_any_le = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:11", "*vcmpgtsw.", CODE_FOR_j_24_f_fxx_simple, B_UID(293) };
+static const struct builtin B12_vec_any_le = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:12", "*vcmpgtsb.", CODE_FOR_j_24_f_fxx_simple, B_UID(294) };
+static const struct builtin B13_vec_any_le = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:13", "*vcmpgtsb.", CODE_FOR_j_24_f_fxx_simple, B_UID(295) };
+static const struct builtin B14_vec_any_le = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:14", "*vcmpgtuh.", CODE_FOR_j_24_f_fxx_simple, B_UID(296) };
+static const struct builtin B15_vec_any_le = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:15", "*vcmpgtuh.", CODE_FOR_j_24_f_fxx_simple, B_UID(297) };
+static const struct builtin B16_vec_any_le = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:16", "*vcmpgtuw.", CODE_FOR_j_24_f_fxx_simple, B_UID(298) };
+static const struct builtin B17_vec_any_le = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:17", "*vcmpgtuw.", CODE_FOR_j_24_f_fxx_simple, B_UID(299) };
+static const struct builtin B18_vec_any_le = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:18", "*vcmpgtub.", CODE_FOR_j_24_f_fxx_simple, B_UID(300) };
+static const struct builtin B19_vec_any_le = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_le:19", "*vcmpgtub.", CODE_FOR_j_24_f_fxx_simple, B_UID(301) };
+static const struct builtin B1_vec_any_lt = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:1", "*vcmpgtsh.", CODE_FOR_j_26_f_frxx_simple, B_UID(302) };
+static const struct builtin B2_vec_any_lt = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:2", "*vcmpgtuh.", CODE_FOR_j_26_f_frxx_simple, B_UID(303) };
+static const struct builtin B3_vec_any_lt = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:3", "*vcmpgtsw.", CODE_FOR_j_26_f_frxx_simple, B_UID(304) };
+static const struct builtin B4_vec_any_lt = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:4", "*vcmpgtuw.", CODE_FOR_j_26_f_frxx_simple, B_UID(305) };
+static const struct builtin B5_vec_any_lt = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:5", "*vcmpgtsb.", CODE_FOR_j_26_f_frxx_simple, B_UID(306) };
+static const struct builtin B6_vec_any_lt = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:6", "*vcmpgtub.", CODE_FOR_j_26_f_frxx_simple, B_UID(307) };
+static const struct builtin B7_vec_any_lt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:7", "*vcmpgtfp.", CODE_FOR_j_26_f_frxx_simple, B_UID(308) };
+static const struct builtin B8_vec_any_lt = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:8", "*vcmpgtsh.", CODE_FOR_j_26_f_frxx_simple, B_UID(309) };
+static const struct builtin B9_vec_any_lt = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:9", "*vcmpgtsh.", CODE_FOR_j_26_f_frxx_simple, B_UID(310) };
+static const struct builtin B10_vec_any_lt = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:10", "*vcmpgtsw.", CODE_FOR_j_26_f_frxx_simple, B_UID(311) };
+static const struct builtin B11_vec_any_lt = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:11", "*vcmpgtsw.", CODE_FOR_j_26_f_frxx_simple, B_UID(312) };
+static const struct builtin B12_vec_any_lt = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:12", "*vcmpgtsb.", CODE_FOR_j_26_f_frxx_simple, B_UID(313) };
+static const struct builtin B13_vec_any_lt = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:13", "*vcmpgtsb.", CODE_FOR_j_26_f_frxx_simple, B_UID(314) };
+static const struct builtin B14_vec_any_lt = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:14", "*vcmpgtuh.", CODE_FOR_j_26_f_frxx_simple, B_UID(315) };
+static const struct builtin B15_vec_any_lt = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:15", "*vcmpgtuh.", CODE_FOR_j_26_f_frxx_simple, B_UID(316) };
+static const struct builtin B16_vec_any_lt = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:16", "*vcmpgtuw.", CODE_FOR_j_26_f_frxx_simple, B_UID(317) };
+static const struct builtin B17_vec_any_lt = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:17", "*vcmpgtuw.", CODE_FOR_j_26_f_frxx_simple, B_UID(318) };
+static const struct builtin B18_vec_any_lt = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:18", "*vcmpgtub.", CODE_FOR_j_26_f_frxx_simple, B_UID(319) };
+static const struct builtin B19_vec_any_lt = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc26fr, 2, FALSE, FALSE, 0, "vec_any_lt:19", "*vcmpgtub.", CODE_FOR_j_26_f_frxx_simple, B_UID(320) };
+static const struct builtin B_vec_any_nan = { { &T_vec_f32, NULL, NULL, }, "x", &T_cc24fd, 1, FALSE, FALSE, 0, "vec_any_nan", "*vcmpeqfp.", CODE_FOR_j_24_f_fx_simple, B_UID(321) };
+static const struct builtin B1_vec_any_ne = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:1", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(322) };
+static const struct builtin B2_vec_any_ne = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:2", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(323) };
+static const struct builtin B3_vec_any_ne = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:3", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(324) };
+static const struct builtin B4_vec_any_ne = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:4", "*vcmpequw.", CODE_FOR_j_24_f_fxx_simple, B_UID(325) };
+static const struct builtin B5_vec_any_ne = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:5", "*vcmpequw.", CODE_FOR_j_24_f_fxx_simple, B_UID(326) };
+static const struct builtin B6_vec_any_ne = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:6", "*vcmpequw.", CODE_FOR_j_24_f_fxx_simple, B_UID(327) };
+static const struct builtin B7_vec_any_ne = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:7", "*vcmpequb.", CODE_FOR_j_24_f_fxx_simple, B_UID(328) };
+static const struct builtin B8_vec_any_ne = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:8", "*vcmpequb.", CODE_FOR_j_24_f_fxx_simple, B_UID(329) };
+static const struct builtin B9_vec_any_ne = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:9", "*vcmpequb.", CODE_FOR_j_24_f_fxx_simple, B_UID(330) };
+static const struct builtin B10_vec_any_ne = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:10", "*vcmpeqfp.", CODE_FOR_j_24_f_fxx_simple, B_UID(331) };
+static const struct builtin B11_vec_any_ne = { { &T_vec_p16, &T_vec_p16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:11", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(332) };
+static const struct builtin B12_vec_any_ne = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:12", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(333) };
+static const struct builtin B13_vec_any_ne = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:13", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(334) };
+static const struct builtin B14_vec_any_ne = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:14", "*vcmpequw.", CODE_FOR_j_24_f_fxx_simple, B_UID(335) };
+static const struct builtin B15_vec_any_ne = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:15", "*vcmpequw.", CODE_FOR_j_24_f_fxx_simple, B_UID(336) };
+static const struct builtin B16_vec_any_ne = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:16", "*vcmpequb.", CODE_FOR_j_24_f_fxx_simple, B_UID(337) };
+static const struct builtin B17_vec_any_ne = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:17", "*vcmpequb.", CODE_FOR_j_24_f_fxx_simple, B_UID(338) };
+static const struct builtin B18_vec_any_ne = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:18", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(339) };
+static const struct builtin B19_vec_any_ne = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:19", "*vcmpequh.", CODE_FOR_j_24_f_fxx_simple, B_UID(340) };
+static const struct builtin B20_vec_any_ne = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:20", "*vcmpequw.", CODE_FOR_j_24_f_fxx_simple, B_UID(341) };
+static const struct builtin B21_vec_any_ne = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:21", "*vcmpequw.", CODE_FOR_j_24_f_fxx_simple, B_UID(342) };
+static const struct builtin B22_vec_any_ne = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:22", "*vcmpequb.", CODE_FOR_j_24_f_fxx_simple, B_UID(343) };
+static const struct builtin B23_vec_any_ne = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ne:23", "*vcmpequb.", CODE_FOR_j_24_f_fxx_simple, B_UID(344) };
+static const struct builtin B_vec_any_nge = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_nge", "*vcmpgefp.", CODE_FOR_j_24_f_fxx_simple, B_UID(345) };
+static const struct builtin B_vec_any_ngt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24f, 2, FALSE, FALSE, 0, "vec_any_ngt", "*vcmpgtfp.", CODE_FOR_j_24_f_fxx_simple, B_UID(346) };
+static const struct builtin B_vec_any_nle = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_nle", "*vcmpgefp.", CODE_FOR_j_24_f_frxx_simple, B_UID(347) };
+static const struct builtin B_vec_any_nlt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc24fr, 2, FALSE, FALSE, 0, "vec_any_nlt", "*vcmpgtfp.", CODE_FOR_j_24_f_frxx_simple, B_UID(348) };
+static const struct builtin B_vec_any_numeric = { { &T_vec_f32, NULL, NULL, }, "x", &T_cc26fd, 1, FALSE, FALSE, 0, "vec_any_numeric", "*vcmpeqfp.", CODE_FOR_j_26_f_fx_simple, B_UID(349) };
+static const struct builtin B_vec_any_out = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_cc26f, 2, FALSE, FALSE, 0, "vec_any_out", "*vcmpbfp.", CODE_FOR_j_26_f_fxx_simple, B_UID(350) };
+static const struct builtin B_vec_vavgsh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vavgsh", "*vavgsh", CODE_FOR_xfxx_simple, B_UID(351) };
+static const struct builtin B_vec_vavgsw = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vavgsw", "*vavgsw", CODE_FOR_xfxx_simple, B_UID(352) };
+static const struct builtin B_vec_vavgsb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vavgsb", "*vavgsb", CODE_FOR_xfxx_simple, B_UID(353) };
+static const struct builtin B_vec_vavguh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vavguh", "*vavguh", CODE_FOR_xfxx_simple, B_UID(354) };
+static const struct builtin B_vec_vavguw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vavguw", "*vavguw", CODE_FOR_xfxx_simple, B_UID(355) };
+static const struct builtin B_vec_vavgub = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vavgub", "*vavgub", CODE_FOR_xfxx_simple, B_UID(356) };
+static const struct builtin B_vec_vrfip = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vrfip", "*vrfip", CODE_FOR_xfx_fp, B_UID(357) };
+static const struct builtin B_vec_vcmpbfp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vcmpbfp", "*vcmpbfp", CODE_FOR_xfxx_simple, B_UID(358) };
+static const struct builtin B_vec_vcmpeqfp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 7, "vec_vcmpeqfp", "*vcmpeqfp", CODE_FOR_xfxx_simple, B_UID(359) };
+static const struct builtin B1_vec_vcmpequh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 7, "vec_vcmpequh:1", "*vcmpequh", CODE_FOR_xfxx_simple, B_UID(360) };
+static const struct builtin B1_vec_vcmpequw = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 7, "vec_vcmpequw:1", "*vcmpequw", CODE_FOR_xfxx_simple, B_UID(361) };
+static const struct builtin B1_vec_vcmpequb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 7, "vec_vcmpequb:1", "*vcmpequb", CODE_FOR_xfxx_simple, B_UID(362) };
+static const struct builtin B2_vec_vcmpequh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 7, "vec_vcmpequh:2", "*vcmpequh", CODE_FOR_xfxx_simple, B_UID(363) };
+static const struct builtin B2_vec_vcmpequw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 7, "vec_vcmpequw:2", "*vcmpequw", CODE_FOR_xfxx_simple, B_UID(364) };
+static const struct builtin B2_vec_vcmpequb = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 7, "vec_vcmpequb:2", "*vcmpequb", CODE_FOR_xfxx_simple, B_UID(365) };
+static const struct builtin B_vec_vcmpgefp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vcmpgefp", "*vcmpgefp", CODE_FOR_xfxx_simple, B_UID(366) };
+static const struct builtin B_vec_vcmpgtfp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vcmpgtfp", "*vcmpgtfp", CODE_FOR_xfxx_simple, B_UID(367) };
+static const struct builtin B_vec_vcmpgtsh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vcmpgtsh", "*vcmpgtsh", CODE_FOR_xfxx_simple, B_UID(368) };
+static const struct builtin B_vec_vcmpgtsw = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vcmpgtsw", "*vcmpgtsw", CODE_FOR_xfxx_simple, B_UID(369) };
+static const struct builtin B_vec_vcmpgtsb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vcmpgtsb", "*vcmpgtsb", CODE_FOR_xfxx_simple, B_UID(370) };
+static const struct builtin B_vec_vcmpgtuh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vcmpgtuh", "*vcmpgtuh", CODE_FOR_xfxx_simple, B_UID(371) };
+static const struct builtin B_vec_vcmpgtuw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vcmpgtuw", "*vcmpgtuw", CODE_FOR_xfxx_simple, B_UID(372) };
+static const struct builtin B_vec_vcmpgtub = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vcmpgtub", "*vcmpgtub", CODE_FOR_xfxx_simple, B_UID(373) };
+static const struct builtin B_vec_cmple = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 10, "vec_cmple", "*vcmpgefp", CODE_FOR_xfxx_simple, B_UID(374) };
+static const struct builtin B1_vec_cmplt = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 10, "vec_cmplt:1", "*vcmpgtfp", CODE_FOR_xfxx_simple, B_UID(375) };
+static const struct builtin B2_vec_cmplt = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 10, "vec_cmplt:2", "*vcmpgtsh", CODE_FOR_xfxx_simple, B_UID(376) };
+static const struct builtin B3_vec_cmplt = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 10, "vec_cmplt:3", "*vcmpgtsw", CODE_FOR_xfxx_simple, B_UID(377) };
+static const struct builtin B4_vec_cmplt = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 10, "vec_cmplt:4", "*vcmpgtsb", CODE_FOR_xfxx_simple, B_UID(378) };
+static const struct builtin B5_vec_cmplt = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 10, "vec_cmplt:5", "*vcmpgtuh", CODE_FOR_xfxx_simple, B_UID(379) };
+static const struct builtin B6_vec_cmplt = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 10, "vec_cmplt:6", "*vcmpgtuw", CODE_FOR_xfxx_simple, B_UID(380) };
+static const struct builtin B7_vec_cmplt = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 10, "vec_cmplt:7", "*vcmpgtub", CODE_FOR_xfxx_simple, B_UID(381) };
+static const struct builtin B_vec_vcfsx = { { &T_vec_s32, &T_immed_u5, NULL, }, "xB", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vcfsx", "*vcfsx", CODE_FOR_xfxB_fp, B_UID(382) };
+static const struct builtin B_vec_vcfux = { { &T_vec_u32, &T_immed_u5, NULL, }, "xB", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vcfux", "*vcfux", CODE_FOR_xfxB_fp, B_UID(383) };
+static const struct builtin B_vec_vctsxs = { { &T_vec_f32, &T_immed_u5, NULL, }, "xB", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vctsxs", "*vctsxs", CODE_FOR_xfxB_fp, B_UID(384) };
+static const struct builtin B_vec_vctuxs = { { &T_vec_f32, &T_immed_u5, NULL, }, "xB", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vctuxs", "*vctuxs", CODE_FOR_xfxB_fp, B_UID(385) };
+static const struct builtin B_vec_dss = { { &T_immed_u2, NULL, NULL, }, "D", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_dss", "*dss", CODE_FOR_vlfD_load, B_UID(386) };
+static const struct builtin B_vec_dssall = { { NULL, NULL, NULL, }, "", &T_volatile_void, 0, FALSE, FALSE, 0, "vec_dssall", "*dssall", CODE_FOR_vlf_load, B_UID(387) };
+static const struct builtin B1_vec_dst = { { &T_const_float_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:1", "*dst", CODE_FOR_vlfiiD_load, B_UID(388) };
+static const struct builtin B2_vec_dst = { { &T_const_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:2", "*dst", CODE_FOR_vlfiiD_load, B_UID(389) };
+static const struct builtin B3_vec_dst = { { &T_const_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:3", "*dst", CODE_FOR_vlfiiD_load, B_UID(390) };
+static const struct builtin B4_vec_dst = { { &T_const_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:4", "*dst", CODE_FOR_vlfiiD_load, B_UID(391) };
+static const struct builtin B5_vec_dst = { { &T_const_signed_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:5", "*dst", CODE_FOR_vlfiiD_load, B_UID(392) };
+static const struct builtin B6_vec_dst = { { &T_const_unsigned_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:6", "*dst", CODE_FOR_vlfiiD_load, B_UID(393) };
+static const struct builtin B7_vec_dst = { { &T_const_unsigned_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:7", "*dst", CODE_FOR_vlfiiD_load, B_UID(394) };
+static const struct builtin B8_vec_dst = { { &T_const_unsigned_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:8", "*dst", CODE_FOR_vlfiiD_load, B_UID(395) };
+static const struct builtin B9_vec_dst = { { &T_const_unsigned_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:9", "*dst", CODE_FOR_vlfiiD_load, B_UID(396) };
+static const struct builtin B10_vec_dst = { { &T_const_vec_b16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:10", "*dst", CODE_FOR_vlfiiD_load, B_UID(397) };
+static const struct builtin B11_vec_dst = { { &T_const_vec_b32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:11", "*dst", CODE_FOR_vlfiiD_load, B_UID(398) };
+static const struct builtin B12_vec_dst = { { &T_const_vec_b8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:12", "*dst", CODE_FOR_vlfiiD_load, B_UID(399) };
+static const struct builtin B13_vec_dst = { { &T_const_vec_f32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:13", "*dst", CODE_FOR_vlfiiD_load, B_UID(400) };
+static const struct builtin B14_vec_dst = { { &T_const_vec_p16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:14", "*dst", CODE_FOR_vlfiiD_load, B_UID(401) };
+static const struct builtin B15_vec_dst = { { &T_const_vec_s16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:15", "*dst", CODE_FOR_vlfiiD_load, B_UID(402) };
+static const struct builtin B16_vec_dst = { { &T_const_vec_s32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:16", "*dst", CODE_FOR_vlfiiD_load, B_UID(403) };
+static const struct builtin B17_vec_dst = { { &T_const_vec_s8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:17", "*dst", CODE_FOR_vlfiiD_load, B_UID(404) };
+static const struct builtin B18_vec_dst = { { &T_const_vec_u16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:18", "*dst", CODE_FOR_vlfiiD_load, B_UID(405) };
+static const struct builtin B19_vec_dst = { { &T_const_vec_u32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:19", "*dst", CODE_FOR_vlfiiD_load, B_UID(406) };
+static const struct builtin B20_vec_dst = { { &T_const_vec_u8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dst:20", "*dst", CODE_FOR_vlfiiD_load, B_UID(407) };
+static const struct builtin B1_vec_dstst = { { &T_const_float_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:1", "*dstst", CODE_FOR_vlfiiD_load, B_UID(408) };
+static const struct builtin B2_vec_dstst = { { &T_const_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:2", "*dstst", CODE_FOR_vlfiiD_load, B_UID(409) };
+static const struct builtin B3_vec_dstst = { { &T_const_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:3", "*dstst", CODE_FOR_vlfiiD_load, B_UID(410) };
+static const struct builtin B4_vec_dstst = { { &T_const_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:4", "*dstst", CODE_FOR_vlfiiD_load, B_UID(411) };
+static const struct builtin B5_vec_dstst = { { &T_const_signed_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:5", "*dstst", CODE_FOR_vlfiiD_load, B_UID(412) };
+static const struct builtin B6_vec_dstst = { { &T_const_unsigned_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:6", "*dstst", CODE_FOR_vlfiiD_load, B_UID(413) };
+static const struct builtin B7_vec_dstst = { { &T_const_unsigned_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:7", "*dstst", CODE_FOR_vlfiiD_load, B_UID(414) };
+static const struct builtin B8_vec_dstst = { { &T_const_unsigned_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:8", "*dstst", CODE_FOR_vlfiiD_load, B_UID(415) };
+static const struct builtin B9_vec_dstst = { { &T_const_unsigned_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:9", "*dstst", CODE_FOR_vlfiiD_load, B_UID(416) };
+static const struct builtin B10_vec_dstst = { { &T_const_vec_b16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:10", "*dstst", CODE_FOR_vlfiiD_load, B_UID(417) };
+static const struct builtin B11_vec_dstst = { { &T_const_vec_b32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:11", "*dstst", CODE_FOR_vlfiiD_load, B_UID(418) };
+static const struct builtin B12_vec_dstst = { { &T_const_vec_b8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:12", "*dstst", CODE_FOR_vlfiiD_load, B_UID(419) };
+static const struct builtin B13_vec_dstst = { { &T_const_vec_f32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:13", "*dstst", CODE_FOR_vlfiiD_load, B_UID(420) };
+static const struct builtin B14_vec_dstst = { { &T_const_vec_p16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:14", "*dstst", CODE_FOR_vlfiiD_load, B_UID(421) };
+static const struct builtin B15_vec_dstst = { { &T_const_vec_s16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:15", "*dstst", CODE_FOR_vlfiiD_load, B_UID(422) };
+static const struct builtin B16_vec_dstst = { { &T_const_vec_s32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:16", "*dstst", CODE_FOR_vlfiiD_load, B_UID(423) };
+static const struct builtin B17_vec_dstst = { { &T_const_vec_s8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:17", "*dstst", CODE_FOR_vlfiiD_load, B_UID(424) };
+static const struct builtin B18_vec_dstst = { { &T_const_vec_u16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:18", "*dstst", CODE_FOR_vlfiiD_load, B_UID(425) };
+static const struct builtin B19_vec_dstst = { { &T_const_vec_u32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:19", "*dstst", CODE_FOR_vlfiiD_load, B_UID(426) };
+static const struct builtin B20_vec_dstst = { { &T_const_vec_u8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstst:20", "*dstst", CODE_FOR_vlfiiD_load, B_UID(427) };
+static const struct builtin B1_vec_dststt = { { &T_const_float_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:1", "*dststt", CODE_FOR_vlfiiD_load, B_UID(428) };
+static const struct builtin B2_vec_dststt = { { &T_const_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:2", "*dststt", CODE_FOR_vlfiiD_load, B_UID(429) };
+static const struct builtin B3_vec_dststt = { { &T_const_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:3", "*dststt", CODE_FOR_vlfiiD_load, B_UID(430) };
+static const struct builtin B4_vec_dststt = { { &T_const_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:4", "*dststt", CODE_FOR_vlfiiD_load, B_UID(431) };
+static const struct builtin B5_vec_dststt = { { &T_const_signed_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:5", "*dststt", CODE_FOR_vlfiiD_load, B_UID(432) };
+static const struct builtin B6_vec_dststt = { { &T_const_unsigned_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:6", "*dststt", CODE_FOR_vlfiiD_load, B_UID(433) };
+static const struct builtin B7_vec_dststt = { { &T_const_unsigned_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:7", "*dststt", CODE_FOR_vlfiiD_load, B_UID(434) };
+static const struct builtin B8_vec_dststt = { { &T_const_unsigned_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:8", "*dststt", CODE_FOR_vlfiiD_load, B_UID(435) };
+static const struct builtin B9_vec_dststt = { { &T_const_unsigned_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:9", "*dststt", CODE_FOR_vlfiiD_load, B_UID(436) };
+static const struct builtin B10_vec_dststt = { { &T_const_vec_b16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:10", "*dststt", CODE_FOR_vlfiiD_load, B_UID(437) };
+static const struct builtin B11_vec_dststt = { { &T_const_vec_b32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:11", "*dststt", CODE_FOR_vlfiiD_load, B_UID(438) };
+static const struct builtin B12_vec_dststt = { { &T_const_vec_b8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:12", "*dststt", CODE_FOR_vlfiiD_load, B_UID(439) };
+static const struct builtin B13_vec_dststt = { { &T_const_vec_f32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:13", "*dststt", CODE_FOR_vlfiiD_load, B_UID(440) };
+static const struct builtin B14_vec_dststt = { { &T_const_vec_p16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:14", "*dststt", CODE_FOR_vlfiiD_load, B_UID(441) };
+static const struct builtin B15_vec_dststt = { { &T_const_vec_s16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:15", "*dststt", CODE_FOR_vlfiiD_load, B_UID(442) };
+static const struct builtin B16_vec_dststt = { { &T_const_vec_s32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:16", "*dststt", CODE_FOR_vlfiiD_load, B_UID(443) };
+static const struct builtin B17_vec_dststt = { { &T_const_vec_s8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:17", "*dststt", CODE_FOR_vlfiiD_load, B_UID(444) };
+static const struct builtin B18_vec_dststt = { { &T_const_vec_u16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:18", "*dststt", CODE_FOR_vlfiiD_load, B_UID(445) };
+static const struct builtin B19_vec_dststt = { { &T_const_vec_u32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:19", "*dststt", CODE_FOR_vlfiiD_load, B_UID(446) };
+static const struct builtin B20_vec_dststt = { { &T_const_vec_u8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dststt:20", "*dststt", CODE_FOR_vlfiiD_load, B_UID(447) };
+static const struct builtin B1_vec_dstt = { { &T_const_float_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:1", "*dstt", CODE_FOR_vlfiiD_load, B_UID(448) };
+static const struct builtin B2_vec_dstt = { { &T_const_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:2", "*dstt", CODE_FOR_vlfiiD_load, B_UID(449) };
+static const struct builtin B3_vec_dstt = { { &T_const_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:3", "*dstt", CODE_FOR_vlfiiD_load, B_UID(450) };
+static const struct builtin B4_vec_dstt = { { &T_const_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:4", "*dstt", CODE_FOR_vlfiiD_load, B_UID(451) };
+static const struct builtin B5_vec_dstt = { { &T_const_signed_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:5", "*dstt", CODE_FOR_vlfiiD_load, B_UID(452) };
+static const struct builtin B6_vec_dstt = { { &T_const_unsigned_char_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:6", "*dstt", CODE_FOR_vlfiiD_load, B_UID(453) };
+static const struct builtin B7_vec_dstt = { { &T_const_unsigned_int_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:7", "*dstt", CODE_FOR_vlfiiD_load, B_UID(454) };
+static const struct builtin B8_vec_dstt = { { &T_const_unsigned_long_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:8", "*dstt", CODE_FOR_vlfiiD_load, B_UID(455) };
+static const struct builtin B9_vec_dstt = { { &T_const_unsigned_short_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:9", "*dstt", CODE_FOR_vlfiiD_load, B_UID(456) };
+static const struct builtin B10_vec_dstt = { { &T_const_vec_b16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:10", "*dstt", CODE_FOR_vlfiiD_load, B_UID(457) };
+static const struct builtin B11_vec_dstt = { { &T_const_vec_b32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:11", "*dstt", CODE_FOR_vlfiiD_load, B_UID(458) };
+static const struct builtin B12_vec_dstt = { { &T_const_vec_b8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:12", "*dstt", CODE_FOR_vlfiiD_load, B_UID(459) };
+static const struct builtin B13_vec_dstt = { { &T_const_vec_f32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:13", "*dstt", CODE_FOR_vlfiiD_load, B_UID(460) };
+static const struct builtin B14_vec_dstt = { { &T_const_vec_p16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:14", "*dstt", CODE_FOR_vlfiiD_load, B_UID(461) };
+static const struct builtin B15_vec_dstt = { { &T_const_vec_s16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:15", "*dstt", CODE_FOR_vlfiiD_load, B_UID(462) };
+static const struct builtin B16_vec_dstt = { { &T_const_vec_s32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:16", "*dstt", CODE_FOR_vlfiiD_load, B_UID(463) };
+static const struct builtin B17_vec_dstt = { { &T_const_vec_s8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:17", "*dstt", CODE_FOR_vlfiiD_load, B_UID(464) };
+static const struct builtin B18_vec_dstt = { { &T_const_vec_u16_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:18", "*dstt", CODE_FOR_vlfiiD_load, B_UID(465) };
+static const struct builtin B19_vec_dstt = { { &T_const_vec_u32_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:19", "*dstt", CODE_FOR_vlfiiD_load, B_UID(466) };
+static const struct builtin B20_vec_dstt = { { &T_const_vec_u8_ptr, &T_int, &T_immed_u2, }, "iiD", &T_volatile_void, 3, TRUE, FALSE, 0, "vec_dstt:20", "*dstt", CODE_FOR_vlfiiD_load, B_UID(467) };
+static const struct builtin B_vec_vexptefp = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vexptefp", "*vexptefp", CODE_FOR_xfx_fp, B_UID(468) };
+static const struct builtin B_vec_vrfim = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vrfim", "*vrfim", CODE_FOR_xfx_fp, B_UID(469) };
+static const struct builtin B1_vec_lvx = { { &T_int, &T_const_float_ptr, NULL, }, "ii", &T_vec_f32, 2, TRUE, FALSE, 0, "vec_lvx:1", "*lvx", CODE_FOR_xlfii_load, B_UID(470) };
+static const struct builtin B2_vec_lvx = { { &T_int, &T_const_int_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvx:2", "*lvx", CODE_FOR_xlfii_load, B_UID(471) };
+static const struct builtin B3_vec_lvx = { { &T_int, &T_const_long_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvx:3", "*lvx", CODE_FOR_xlfii_load, B_UID(472) };
+static const struct builtin B4_vec_lvx = { { &T_int, &T_const_short_ptr, NULL, }, "ii", &T_vec_s16, 2, TRUE, FALSE, 0, "vec_lvx:4", "*lvx", CODE_FOR_xlfii_load, B_UID(473) };
+static const struct builtin B5_vec_lvx = { { &T_int, &T_const_signed_char_ptr, NULL, }, "ii", &T_vec_s8, 2, TRUE, FALSE, 0, "vec_lvx:5", "*lvx", CODE_FOR_xlfii_load, B_UID(474) };
+static const struct builtin B6_vec_lvx = { { &T_int, &T_const_unsigned_char_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, FALSE, 0, "vec_lvx:6", "*lvx", CODE_FOR_xlfii_load, B_UID(475) };
+static const struct builtin B7_vec_lvx = { { &T_int, &T_const_unsigned_int_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvx:7", "*lvx", CODE_FOR_xlfii_load, B_UID(476) };
+static const struct builtin B8_vec_lvx = { { &T_int, &T_const_unsigned_long_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvx:8", "*lvx", CODE_FOR_xlfii_load, B_UID(477) };
+static const struct builtin B9_vec_lvx = { { &T_int, &T_const_unsigned_short_ptr, NULL, }, "ii", &T_vec_u16, 2, TRUE, FALSE, 0, "vec_lvx:9", "*lvx", CODE_FOR_xlfii_load, B_UID(478) };
+static const struct builtin B10_vec_lvx = { { &T_int, &T_const_vec_b16_ptr, NULL, }, "ii", &T_vec_b16, 2, TRUE, FALSE, 0, "vec_lvx:10", "*lvx", CODE_FOR_xlfii_load, B_UID(479) };
+static const struct builtin B11_vec_lvx = { { &T_int, &T_const_vec_b32_ptr, NULL, }, "ii", &T_vec_b32, 2, TRUE, FALSE, 0, "vec_lvx:11", "*lvx", CODE_FOR_xlfii_load, B_UID(480) };
+static const struct builtin B12_vec_lvx = { { &T_int, &T_const_vec_b8_ptr, NULL, }, "ii", &T_vec_b8, 2, TRUE, FALSE, 0, "vec_lvx:12", "*lvx", CODE_FOR_xlfii_load, B_UID(481) };
+static const struct builtin B13_vec_lvx = { { &T_int, &T_const_vec_f32_ptr, NULL, }, "ii", &T_vec_f32, 2, TRUE, FALSE, 0, "vec_lvx:13", "*lvx", CODE_FOR_xlfii_load, B_UID(482) };
+static const struct builtin B14_vec_lvx = { { &T_int, &T_const_vec_p16_ptr, NULL, }, "ii", &T_vec_p16, 2, TRUE, FALSE, 0, "vec_lvx:14", "*lvx", CODE_FOR_xlfii_load, B_UID(483) };
+static const struct builtin B15_vec_lvx = { { &T_int, &T_const_vec_s16_ptr, NULL, }, "ii", &T_vec_s16, 2, TRUE, FALSE, 0, "vec_lvx:15", "*lvx", CODE_FOR_xlfii_load, B_UID(484) };
+static const struct builtin B16_vec_lvx = { { &T_int, &T_const_vec_s32_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvx:16", "*lvx", CODE_FOR_xlfii_load, B_UID(485) };
+static const struct builtin B17_vec_lvx = { { &T_int, &T_const_vec_s8_ptr, NULL, }, "ii", &T_vec_s8, 2, TRUE, FALSE, 0, "vec_lvx:17", "*lvx", CODE_FOR_xlfii_load, B_UID(486) };
+static const struct builtin B18_vec_lvx = { { &T_int, &T_const_vec_u16_ptr, NULL, }, "ii", &T_vec_u16, 2, TRUE, FALSE, 0, "vec_lvx:18", "*lvx", CODE_FOR_xlfii_load, B_UID(487) };
+static const struct builtin B19_vec_lvx = { { &T_int, &T_const_vec_u32_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvx:19", "*lvx", CODE_FOR_xlfii_load, B_UID(488) };
+static const struct builtin B20_vec_lvx = { { &T_int, &T_const_vec_u8_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, FALSE, 0, "vec_lvx:20", "*lvx", CODE_FOR_xlfii_load, B_UID(489) };
+static const struct builtin B1_vec_lvewx = { { &T_int, &T_const_float_ptr, NULL, }, "ii", &T_vec_f32, 2, TRUE, FALSE, 0, "vec_lvewx:1", "*lvewx", CODE_FOR_xlfii_load, B_UID(490) };
+static const struct builtin B2_vec_lvewx = { { &T_int, &T_const_int_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvewx:2", "*lvewx", CODE_FOR_xlfii_load, B_UID(491) };
+static const struct builtin B3_vec_lvewx = { { &T_int, &T_const_long_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvewx:3", "*lvewx", CODE_FOR_xlfii_load, B_UID(492) };
+static const struct builtin B1_vec_lvehx = { { &T_int, &T_const_short_ptr, NULL, }, "ii", &T_vec_s16, 2, TRUE, FALSE, 0, "vec_lvehx:1", "*lvehx", CODE_FOR_xlfii_load, B_UID(493) };
+static const struct builtin B1_vec_lvebx = { { &T_int, &T_const_signed_char_ptr, NULL, }, "ii", &T_vec_s8, 2, TRUE, FALSE, 0, "vec_lvebx:1", "*lvebx", CODE_FOR_xlfii_load, B_UID(494) };
+static const struct builtin B2_vec_lvebx = { { &T_int, &T_const_unsigned_char_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, FALSE, 0, "vec_lvebx:2", "*lvebx", CODE_FOR_xlfii_load, B_UID(495) };
+static const struct builtin B4_vec_lvewx = { { &T_int, &T_const_unsigned_int_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvewx:4", "*lvewx", CODE_FOR_xlfii_load, B_UID(496) };
+static const struct builtin B5_vec_lvewx = { { &T_int, &T_const_unsigned_long_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvewx:5", "*lvewx", CODE_FOR_xlfii_load, B_UID(497) };
+static const struct builtin B2_vec_lvehx = { { &T_int, &T_const_unsigned_short_ptr, NULL, }, "ii", &T_vec_u16, 2, TRUE, FALSE, 0, "vec_lvehx:2", "*lvehx", CODE_FOR_xlfii_load, B_UID(498) };
+static const struct builtin B1_vec_lvxl = { { &T_int, &T_const_float_ptr, NULL, }, "ii", &T_vec_f32, 2, TRUE, FALSE, 0, "vec_lvxl:1", "*lvxl", CODE_FOR_xlfii_load, B_UID(499) };
+static const struct builtin B2_vec_lvxl = { { &T_int, &T_const_int_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvxl:2", "*lvxl", CODE_FOR_xlfii_load, B_UID(500) };
+static const struct builtin B3_vec_lvxl = { { &T_int, &T_const_long_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvxl:3", "*lvxl", CODE_FOR_xlfii_load, B_UID(501) };
+static const struct builtin B4_vec_lvxl = { { &T_int, &T_const_short_ptr, NULL, }, "ii", &T_vec_s16, 2, TRUE, FALSE, 0, "vec_lvxl:4", "*lvxl", CODE_FOR_xlfii_load, B_UID(502) };
+static const struct builtin B5_vec_lvxl = { { &T_int, &T_const_signed_char_ptr, NULL, }, "ii", &T_vec_s8, 2, TRUE, FALSE, 0, "vec_lvxl:5", "*lvxl", CODE_FOR_xlfii_load, B_UID(503) };
+static const struct builtin B6_vec_lvxl = { { &T_int, &T_const_unsigned_char_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, FALSE, 0, "vec_lvxl:6", "*lvxl", CODE_FOR_xlfii_load, B_UID(504) };
+static const struct builtin B7_vec_lvxl = { { &T_int, &T_const_unsigned_int_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvxl:7", "*lvxl", CODE_FOR_xlfii_load, B_UID(505) };
+static const struct builtin B8_vec_lvxl = { { &T_int, &T_const_unsigned_long_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvxl:8", "*lvxl", CODE_FOR_xlfii_load, B_UID(506) };
+static const struct builtin B9_vec_lvxl = { { &T_int, &T_const_unsigned_short_ptr, NULL, }, "ii", &T_vec_u16, 2, TRUE, FALSE, 0, "vec_lvxl:9", "*lvxl", CODE_FOR_xlfii_load, B_UID(507) };
+static const struct builtin B10_vec_lvxl = { { &T_int, &T_const_vec_b16_ptr, NULL, }, "ii", &T_vec_b16, 2, TRUE, FALSE, 0, "vec_lvxl:10", "*lvxl", CODE_FOR_xlfii_load, B_UID(508) };
+static const struct builtin B11_vec_lvxl = { { &T_int, &T_const_vec_b32_ptr, NULL, }, "ii", &T_vec_b32, 2, TRUE, FALSE, 0, "vec_lvxl:11", "*lvxl", CODE_FOR_xlfii_load, B_UID(509) };
+static const struct builtin B12_vec_lvxl = { { &T_int, &T_const_vec_b8_ptr, NULL, }, "ii", &T_vec_b8, 2, TRUE, FALSE, 0, "vec_lvxl:12", "*lvxl", CODE_FOR_xlfii_load, B_UID(510) };
+static const struct builtin B13_vec_lvxl = { { &T_int, &T_const_vec_f32_ptr, NULL, }, "ii", &T_vec_f32, 2, TRUE, FALSE, 0, "vec_lvxl:13", "*lvxl", CODE_FOR_xlfii_load, B_UID(511) };
+static const struct builtin B14_vec_lvxl = { { &T_int, &T_const_vec_p16_ptr, NULL, }, "ii", &T_vec_p16, 2, TRUE, FALSE, 0, "vec_lvxl:14", "*lvxl", CODE_FOR_xlfii_load, B_UID(512) };
+static const struct builtin B15_vec_lvxl = { { &T_int, &T_const_vec_s16_ptr, NULL, }, "ii", &T_vec_s16, 2, TRUE, FALSE, 0, "vec_lvxl:15", "*lvxl", CODE_FOR_xlfii_load, B_UID(513) };
+static const struct builtin B16_vec_lvxl = { { &T_int, &T_const_vec_s32_ptr, NULL, }, "ii", &T_vec_s32, 2, TRUE, FALSE, 0, "vec_lvxl:16", "*lvxl", CODE_FOR_xlfii_load, B_UID(514) };
+static const struct builtin B17_vec_lvxl = { { &T_int, &T_const_vec_s8_ptr, NULL, }, "ii", &T_vec_s8, 2, TRUE, FALSE, 0, "vec_lvxl:17", "*lvxl", CODE_FOR_xlfii_load, B_UID(515) };
+static const struct builtin B18_vec_lvxl = { { &T_int, &T_const_vec_u16_ptr, NULL, }, "ii", &T_vec_u16, 2, TRUE, FALSE, 0, "vec_lvxl:18", "*lvxl", CODE_FOR_xlfii_load, B_UID(516) };
+static const struct builtin B19_vec_lvxl = { { &T_int, &T_const_vec_u32_ptr, NULL, }, "ii", &T_vec_u32, 2, TRUE, FALSE, 0, "vec_lvxl:19", "*lvxl", CODE_FOR_xlfii_load, B_UID(517) };
+static const struct builtin B20_vec_lvxl = { { &T_int, &T_const_vec_u8_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, FALSE, 0, "vec_lvxl:20", "*lvxl", CODE_FOR_xlfii_load, B_UID(518) };
+static const struct builtin B_vec_vlogefp = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vlogefp", "*vlogefp", CODE_FOR_xfx_fp, B_UID(519) };
+static const struct builtin B1_vec_lvsl = { { &T_int, &T_const_volatile_float_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:1", "*lvsl", CODE_FOR_xfii_load, B_UID(520) };
+static const struct builtin B2_vec_lvsl = { { &T_int, &T_const_volatile_int_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:2", "*lvsl", CODE_FOR_xfii_load, B_UID(521) };
+static const struct builtin B3_vec_lvsl = { { &T_int, &T_const_volatile_long_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:3", "*lvsl", CODE_FOR_xfii_load, B_UID(522) };
+static const struct builtin B4_vec_lvsl = { { &T_int, &T_const_volatile_short_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:4", "*lvsl", CODE_FOR_xfii_load, B_UID(523) };
+static const struct builtin B5_vec_lvsl = { { &T_int, &T_const_volatile_signed_char_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:5", "*lvsl", CODE_FOR_xfii_load, B_UID(524) };
+static const struct builtin B6_vec_lvsl = { { &T_int, &T_const_volatile_unsigned_char_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:6", "*lvsl", CODE_FOR_xfii_load, B_UID(525) };
+static const struct builtin B7_vec_lvsl = { { &T_int, &T_const_volatile_unsigned_int_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:7", "*lvsl", CODE_FOR_xfii_load, B_UID(526) };
+static const struct builtin B8_vec_lvsl = { { &T_int, &T_const_volatile_unsigned_long_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:8", "*lvsl", CODE_FOR_xfii_load, B_UID(527) };
+static const struct builtin B9_vec_lvsl = { { &T_int, &T_const_volatile_unsigned_short_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 8, "vec_lvsl:9", "*lvsl", CODE_FOR_xfii_load, B_UID(528) };
+static const struct builtin B1_vec_lvsr = { { &T_int, &T_const_volatile_float_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:1", "*lvsr", CODE_FOR_xfii_load, B_UID(529) };
+static const struct builtin B2_vec_lvsr = { { &T_int, &T_const_volatile_int_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:2", "*lvsr", CODE_FOR_xfii_load, B_UID(530) };
+static const struct builtin B3_vec_lvsr = { { &T_int, &T_const_volatile_long_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:3", "*lvsr", CODE_FOR_xfii_load, B_UID(531) };
+static const struct builtin B4_vec_lvsr = { { &T_int, &T_const_volatile_short_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:4", "*lvsr", CODE_FOR_xfii_load, B_UID(532) };
+static const struct builtin B5_vec_lvsr = { { &T_int, &T_const_volatile_signed_char_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:5", "*lvsr", CODE_FOR_xfii_load, B_UID(533) };
+static const struct builtin B6_vec_lvsr = { { &T_int, &T_const_volatile_unsigned_char_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:6", "*lvsr", CODE_FOR_xfii_load, B_UID(534) };
+static const struct builtin B7_vec_lvsr = { { &T_int, &T_const_volatile_unsigned_int_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:7", "*lvsr", CODE_FOR_xfii_load, B_UID(535) };
+static const struct builtin B8_vec_lvsr = { { &T_int, &T_const_volatile_unsigned_long_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:8", "*lvsr", CODE_FOR_xfii_load, B_UID(536) };
+static const struct builtin B9_vec_lvsr = { { &T_int, &T_const_volatile_unsigned_short_ptr, NULL, }, "ii", &T_vec_u8, 2, TRUE, TRUE, 9, "vec_lvsr:9", "*lvsr", CODE_FOR_xfii_load, B_UID(537) };
+static const struct builtin B_vec_vmaddfp = { { &T_vec_f32, &T_vec_f32, &T_vec_f32, }, "xxx", &T_vec_f32, 3, FALSE, FALSE, 0, "vec_vmaddfp", "*vmaddfp", CODE_FOR_xfxxx_fp, B_UID(538) };
+static const struct builtin B_vec_vmhaddshs = { { &T_vec_s16, &T_vec_s16, &T_vec_s16, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vmhaddshs", "*vmhaddshs", CODE_FOR_xfxxx_complex, B_UID(539) };
+static const struct builtin B1_vec_vmaxsh = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vmaxsh:1", "*vmaxsh", CODE_FOR_xfxx_simple, B_UID(540) };
+static const struct builtin B1_vec_vmaxuh = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vmaxuh:1", "*vmaxuh", CODE_FOR_xfxx_simple, B_UID(541) };
+static const struct builtin B1_vec_vmaxsw = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vmaxsw:1", "*vmaxsw", CODE_FOR_xfxx_simple, B_UID(542) };
+static const struct builtin B1_vec_vmaxuw = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vmaxuw:1", "*vmaxuw", CODE_FOR_xfxx_simple, B_UID(543) };
+static const struct builtin B1_vec_vmaxsb = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vmaxsb:1", "*vmaxsb", CODE_FOR_xfxx_simple, B_UID(544) };
+static const struct builtin B1_vec_vmaxub = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vmaxub:1", "*vmaxub", CODE_FOR_xfxx_simple, B_UID(545) };
+static const struct builtin B_vec_vmaxfp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vmaxfp", "*vmaxfp", CODE_FOR_xfxx_simple, B_UID(546) };
+static const struct builtin B2_vec_vmaxsh = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vmaxsh:2", "*vmaxsh", CODE_FOR_xfxx_simple, B_UID(547) };
+static const struct builtin B3_vec_vmaxsh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vmaxsh:3", "*vmaxsh", CODE_FOR_xfxx_simple, B_UID(548) };
+static const struct builtin B2_vec_vmaxsw = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vmaxsw:2", "*vmaxsw", CODE_FOR_xfxx_simple, B_UID(549) };
+static const struct builtin B3_vec_vmaxsw = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vmaxsw:3", "*vmaxsw", CODE_FOR_xfxx_simple, B_UID(550) };
+static const struct builtin B2_vec_vmaxsb = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vmaxsb:2", "*vmaxsb", CODE_FOR_xfxx_simple, B_UID(551) };
+static const struct builtin B3_vec_vmaxsb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vmaxsb:3", "*vmaxsb", CODE_FOR_xfxx_simple, B_UID(552) };
+static const struct builtin B2_vec_vmaxuh = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vmaxuh:2", "*vmaxuh", CODE_FOR_xfxx_simple, B_UID(553) };
+static const struct builtin B3_vec_vmaxuh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vmaxuh:3", "*vmaxuh", CODE_FOR_xfxx_simple, B_UID(554) };
+static const struct builtin B2_vec_vmaxuw = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vmaxuw:2", "*vmaxuw", CODE_FOR_xfxx_simple, B_UID(555) };
+static const struct builtin B3_vec_vmaxuw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vmaxuw:3", "*vmaxuw", CODE_FOR_xfxx_simple, B_UID(556) };
+static const struct builtin B2_vec_vmaxub = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vmaxub:2", "*vmaxub", CODE_FOR_xfxx_simple, B_UID(557) };
+static const struct builtin B3_vec_vmaxub = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vmaxub:3", "*vmaxub", CODE_FOR_xfxx_simple, B_UID(558) };
+static const struct builtin B1_vec_vmrghh = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vmrghh:1", "*vmrghh", CODE_FOR_xfxx_perm, B_UID(559) };
+static const struct builtin B1_vec_vmrghw = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vmrghw:1", "*vmrghw", CODE_FOR_xfxx_perm, B_UID(560) };
+static const struct builtin B1_vec_vmrghb = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vmrghb:1", "*vmrghb", CODE_FOR_xfxx_perm, B_UID(561) };
+static const struct builtin B2_vec_vmrghw = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vmrghw:2", "*vmrghw", CODE_FOR_xfxx_perm, B_UID(562) };
+static const struct builtin B2_vec_vmrghh = { { &T_vec_p16, &T_vec_p16, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vmrghh:2", "*vmrghh", CODE_FOR_xfxx_perm, B_UID(563) };
+static const struct builtin B3_vec_vmrghh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vmrghh:3", "*vmrghh", CODE_FOR_xfxx_perm, B_UID(564) };
+static const struct builtin B3_vec_vmrghw = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vmrghw:3", "*vmrghw", CODE_FOR_xfxx_perm, B_UID(565) };
+static const struct builtin B2_vec_vmrghb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vmrghb:2", "*vmrghb", CODE_FOR_xfxx_perm, B_UID(566) };
+static const struct builtin B4_vec_vmrghh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vmrghh:4", "*vmrghh", CODE_FOR_xfxx_perm, B_UID(567) };
+static const struct builtin B4_vec_vmrghw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vmrghw:4", "*vmrghw", CODE_FOR_xfxx_perm, B_UID(568) };
+static const struct builtin B3_vec_vmrghb = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vmrghb:3", "*vmrghb", CODE_FOR_xfxx_perm, B_UID(569) };
+static const struct builtin B1_vec_vmrglh = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vmrglh:1", "*vmrglh", CODE_FOR_xfxx_perm, B_UID(570) };
+static const struct builtin B1_vec_vmrglw = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vmrglw:1", "*vmrglw", CODE_FOR_xfxx_perm, B_UID(571) };
+static const struct builtin B1_vec_vmrglb = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vmrglb:1", "*vmrglb", CODE_FOR_xfxx_perm, B_UID(572) };
+static const struct builtin B2_vec_vmrglw = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vmrglw:2", "*vmrglw", CODE_FOR_xfxx_perm, B_UID(573) };
+static const struct builtin B2_vec_vmrglh = { { &T_vec_p16, &T_vec_p16, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vmrglh:2", "*vmrglh", CODE_FOR_xfxx_perm, B_UID(574) };
+static const struct builtin B3_vec_vmrglh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vmrglh:3", "*vmrglh", CODE_FOR_xfxx_perm, B_UID(575) };
+static const struct builtin B3_vec_vmrglw = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vmrglw:3", "*vmrglw", CODE_FOR_xfxx_perm, B_UID(576) };
+static const struct builtin B2_vec_vmrglb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vmrglb:2", "*vmrglb", CODE_FOR_xfxx_perm, B_UID(577) };
+static const struct builtin B4_vec_vmrglh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vmrglh:4", "*vmrglh", CODE_FOR_xfxx_perm, B_UID(578) };
+static const struct builtin B4_vec_vmrglw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vmrglw:4", "*vmrglw", CODE_FOR_xfxx_perm, B_UID(579) };
+static const struct builtin B3_vec_vmrglb = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vmrglb:3", "*vmrglb", CODE_FOR_xfxx_perm, B_UID(580) };
+static const struct builtin B_vec_mfvscr = { { NULL, NULL, NULL, }, "", &T_volatile_vec_u16, 0, FALSE, FALSE, 0, "vec_mfvscr", "*mfvscr", CODE_FOR_vxf_fxu, B_UID(581) };
+static const struct builtin B1_vec_vminsh = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vminsh:1", "*vminsh", CODE_FOR_xfxx_simple, B_UID(582) };
+static const struct builtin B1_vec_vminuh = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vminuh:1", "*vminuh", CODE_FOR_xfxx_simple, B_UID(583) };
+static const struct builtin B1_vec_vminsw = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vminsw:1", "*vminsw", CODE_FOR_xfxx_simple, B_UID(584) };
+static const struct builtin B1_vec_vminuw = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vminuw:1", "*vminuw", CODE_FOR_xfxx_simple, B_UID(585) };
+static const struct builtin B1_vec_vminsb = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vminsb:1", "*vminsb", CODE_FOR_xfxx_simple, B_UID(586) };
+static const struct builtin B1_vec_vminub = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vminub:1", "*vminub", CODE_FOR_xfxx_simple, B_UID(587) };
+static const struct builtin B_vec_vminfp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vminfp", "*vminfp", CODE_FOR_xfxx_simple, B_UID(588) };
+static const struct builtin B2_vec_vminsh = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vminsh:2", "*vminsh", CODE_FOR_xfxx_simple, B_UID(589) };
+static const struct builtin B3_vec_vminsh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vminsh:3", "*vminsh", CODE_FOR_xfxx_simple, B_UID(590) };
+static const struct builtin B2_vec_vminsw = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vminsw:2", "*vminsw", CODE_FOR_xfxx_simple, B_UID(591) };
+static const struct builtin B3_vec_vminsw = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vminsw:3", "*vminsw", CODE_FOR_xfxx_simple, B_UID(592) };
+static const struct builtin B2_vec_vminsb = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vminsb:2", "*vminsb", CODE_FOR_xfxx_simple, B_UID(593) };
+static const struct builtin B3_vec_vminsb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vminsb:3", "*vminsb", CODE_FOR_xfxx_simple, B_UID(594) };
+static const struct builtin B2_vec_vminuh = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vminuh:2", "*vminuh", CODE_FOR_xfxx_simple, B_UID(595) };
+static const struct builtin B3_vec_vminuh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vminuh:3", "*vminuh", CODE_FOR_xfxx_simple, B_UID(596) };
+static const struct builtin B2_vec_vminuw = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vminuw:2", "*vminuw", CODE_FOR_xfxx_simple, B_UID(597) };
+static const struct builtin B3_vec_vminuw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vminuw:3", "*vminuw", CODE_FOR_xfxx_simple, B_UID(598) };
+static const struct builtin B2_vec_vminub = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vminub:2", "*vminub", CODE_FOR_xfxx_simple, B_UID(599) };
+static const struct builtin B3_vec_vminub = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vminub:3", "*vminub", CODE_FOR_xfxx_simple, B_UID(600) };
+static const struct builtin B1_vec_vmladduhm = { { &T_vec_s16, &T_vec_s16, &T_vec_s16, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vmladduhm:1", "*vmladduhm", CODE_FOR_xfxxx_complex, B_UID(601) };
+static const struct builtin B2_vec_vmladduhm = { { &T_vec_s16, &T_vec_u16, &T_vec_u16, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vmladduhm:2", "*vmladduhm", CODE_FOR_xfxxx_complex, B_UID(602) };
+static const struct builtin B3_vec_vmladduhm = { { &T_vec_u16, &T_vec_s16, &T_vec_s16, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vmladduhm:3", "*vmladduhm", CODE_FOR_xfxxx_complex, B_UID(603) };
+static const struct builtin B4_vec_vmladduhm = { { &T_vec_u16, &T_vec_u16, &T_vec_u16, }, "xxx", &T_vec_u16, 3, FALSE, FALSE, 0, "vec_vmladduhm:4", "*vmladduhm", CODE_FOR_xfxxx_complex, B_UID(604) };
+static const struct builtin B_vec_vmhraddshs = { { &T_vec_s16, &T_vec_s16, &T_vec_s16, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vmhraddshs", "*vmhraddshs", CODE_FOR_xfxxx_complex, B_UID(605) };
+static const struct builtin B_vec_vmsumshm = { { &T_vec_s16, &T_vec_s16, &T_vec_s32, }, "xxx", &T_vec_s32, 3, FALSE, FALSE, 0, "vec_vmsumshm", "*vmsumshm", CODE_FOR_xfxxx_complex, B_UID(606) };
+static const struct builtin B_vec_vmsummbm = { { &T_vec_s8, &T_vec_u8, &T_vec_s32, }, "xxx", &T_vec_s32, 3, FALSE, FALSE, 0, "vec_vmsummbm", "*vmsummbm", CODE_FOR_xfxxx_complex, B_UID(607) };
+static const struct builtin B_vec_vmsumuhm = { { &T_vec_u16, &T_vec_u16, &T_vec_u32, }, "xxx", &T_vec_u32, 3, FALSE, FALSE, 0, "vec_vmsumuhm", "*vmsumuhm", CODE_FOR_xfxxx_complex, B_UID(608) };
+static const struct builtin B_vec_vmsumubm = { { &T_vec_u8, &T_vec_u8, &T_vec_u32, }, "xxx", &T_vec_u32, 3, FALSE, FALSE, 0, "vec_vmsumubm", "*vmsumubm", CODE_FOR_xfxxx_complex, B_UID(609) };
+static const struct builtin B_vec_vmsumshs = { { &T_vec_s16, &T_vec_s16, &T_vec_s32, }, "xxx", &T_vec_s32, 3, FALSE, FALSE, 0, "vec_vmsumshs", "*vmsumshs", CODE_FOR_xfxxx_complex, B_UID(610) };
+static const struct builtin B_vec_vmsumuhs = { { &T_vec_u16, &T_vec_u16, &T_vec_u32, }, "xxx", &T_vec_u32, 3, FALSE, FALSE, 0, "vec_vmsumuhs", "*vmsumuhs", CODE_FOR_xfxxx_complex, B_UID(611) };
+static const struct builtin B1_vec_mtvscr = { { &T_vec_b16, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:1", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(612) };
+static const struct builtin B2_vec_mtvscr = { { &T_vec_b32, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:2", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(613) };
+static const struct builtin B3_vec_mtvscr = { { &T_vec_b8, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:3", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(614) };
+static const struct builtin B4_vec_mtvscr = { { &T_vec_p16, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:4", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(615) };
+static const struct builtin B5_vec_mtvscr = { { &T_vec_s16, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:5", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(616) };
+static const struct builtin B6_vec_mtvscr = { { &T_vec_s32, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:6", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(617) };
+static const struct builtin B7_vec_mtvscr = { { &T_vec_s8, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:7", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(618) };
+static const struct builtin B8_vec_mtvscr = { { &T_vec_u16, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:8", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(619) };
+static const struct builtin B9_vec_mtvscr = { { &T_vec_u32, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:9", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(620) };
+static const struct builtin B10_vec_mtvscr = { { &T_vec_u8, NULL, NULL, }, "x", &T_volatile_void, 1, FALSE, FALSE, 0, "vec_mtvscr:10", "*mtvscr", CODE_FOR_vfx_fxu, B_UID(621) };
+static const struct builtin B_vec_vmulesh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vmulesh", "*vmulesh", CODE_FOR_xfxx_complex, B_UID(622) };
+static const struct builtin B_vec_vmulesb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vmulesb", "*vmulesb", CODE_FOR_xfxx_complex, B_UID(623) };
+static const struct builtin B_vec_vmuleuh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vmuleuh", "*vmuleuh", CODE_FOR_xfxx_complex, B_UID(624) };
+static const struct builtin B_vec_vmuleub = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vmuleub", "*vmuleub", CODE_FOR_xfxx_complex, B_UID(625) };
+static const struct builtin B_vec_vmulosh = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vmulosh", "*vmulosh", CODE_FOR_xfxx_complex, B_UID(626) };
+static const struct builtin B_vec_vmulosb = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vmulosb", "*vmulosb", CODE_FOR_xfxx_complex, B_UID(627) };
+static const struct builtin B_vec_vmulouh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vmulouh", "*vmulouh", CODE_FOR_xfxx_complex, B_UID(628) };
+static const struct builtin B_vec_vmuloub = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vmuloub", "*vmuloub", CODE_FOR_xfxx_complex, B_UID(629) };
+static const struct builtin B_vec_vnmsubfp = { { &T_vec_f32, &T_vec_f32, &T_vec_f32, }, "xxx", &T_vec_f32, 3, FALSE, FALSE, 0, "vec_vnmsubfp", "*vnmsubfp", CODE_FOR_xfxxx_fp, B_UID(630) };
+static const struct builtin B1_vec_vnor = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vnor:1", "*vnor", CODE_FOR_xfxx_simple, B_UID(631) };
+static const struct builtin B2_vec_vnor = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vnor:2", "*vnor", CODE_FOR_xfxx_simple, B_UID(632) };
+static const struct builtin B3_vec_vnor = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vnor:3", "*vnor", CODE_FOR_xfxx_simple, B_UID(633) };
+static const struct builtin B4_vec_vnor = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vnor:4", "*vnor", CODE_FOR_xfxx_simple, B_UID(634) };
+static const struct builtin B5_vec_vnor = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vnor:5", "*vnor", CODE_FOR_xfxx_simple, B_UID(635) };
+static const struct builtin B6_vec_vnor = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vnor:6", "*vnor", CODE_FOR_xfxx_simple, B_UID(636) };
+static const struct builtin B7_vec_vnor = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vnor:7", "*vnor", CODE_FOR_xfxx_simple, B_UID(637) };
+static const struct builtin B8_vec_vnor = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vnor:8", "*vnor", CODE_FOR_xfxx_simple, B_UID(638) };
+static const struct builtin B9_vec_vnor = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vnor:9", "*vnor", CODE_FOR_xfxx_simple, B_UID(639) };
+static const struct builtin B10_vec_vnor = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vnor:10", "*vnor", CODE_FOR_xfxx_simple, B_UID(640) };
+static const struct builtin B1_vec_vor = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 2, "vec_vor:1", "*vor", CODE_FOR_xfxx_simple, B_UID(641) };
+static const struct builtin B2_vec_vor = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vor:2", "*vor", CODE_FOR_xfxx_simple, B_UID(642) };
+static const struct builtin B3_vec_vor = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vor:3", "*vor", CODE_FOR_xfxx_simple, B_UID(643) };
+static const struct builtin B4_vec_vor = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 2, "vec_vor:4", "*vor", CODE_FOR_xfxx_simple, B_UID(644) };
+static const struct builtin B5_vec_vor = { { &T_vec_b32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vor:5", "*vor", CODE_FOR_xfxx_simple, B_UID(645) };
+static const struct builtin B6_vec_vor = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vor:6", "*vor", CODE_FOR_xfxx_simple, B_UID(646) };
+static const struct builtin B7_vec_vor = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vor:7", "*vor", CODE_FOR_xfxx_simple, B_UID(647) };
+static const struct builtin B8_vec_vor = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 2, "vec_vor:8", "*vor", CODE_FOR_xfxx_simple, B_UID(648) };
+static const struct builtin B9_vec_vor = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vor:9", "*vor", CODE_FOR_xfxx_simple, B_UID(649) };
+static const struct builtin B10_vec_vor = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vor:10", "*vor", CODE_FOR_xfxx_simple, B_UID(650) };
+static const struct builtin B11_vec_vor = { { &T_vec_f32, &T_vec_b32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vor:11", "*vor", CODE_FOR_xfxx_simple, B_UID(651) };
+static const struct builtin B12_vec_vor = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 2, "vec_vor:12", "*vor", CODE_FOR_xfxx_simple, B_UID(652) };
+static const struct builtin B13_vec_vor = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vor:13", "*vor", CODE_FOR_xfxx_simple, B_UID(653) };
+static const struct builtin B14_vec_vor = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 2, "vec_vor:14", "*vor", CODE_FOR_xfxx_simple, B_UID(654) };
+static const struct builtin B15_vec_vor = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vor:15", "*vor", CODE_FOR_xfxx_simple, B_UID(655) };
+static const struct builtin B16_vec_vor = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 2, "vec_vor:16", "*vor", CODE_FOR_xfxx_simple, B_UID(656) };
+static const struct builtin B17_vec_vor = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vor:17", "*vor", CODE_FOR_xfxx_simple, B_UID(657) };
+static const struct builtin B18_vec_vor = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 2, "vec_vor:18", "*vor", CODE_FOR_xfxx_simple, B_UID(658) };
+static const struct builtin B19_vec_vor = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vor:19", "*vor", CODE_FOR_xfxx_simple, B_UID(659) };
+static const struct builtin B20_vec_vor = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 2, "vec_vor:20", "*vor", CODE_FOR_xfxx_simple, B_UID(660) };
+static const struct builtin B21_vec_vor = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vor:21", "*vor", CODE_FOR_xfxx_simple, B_UID(661) };
+static const struct builtin B22_vec_vor = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 2, "vec_vor:22", "*vor", CODE_FOR_xfxx_simple, B_UID(662) };
+static const struct builtin B23_vec_vor = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vor:23", "*vor", CODE_FOR_xfxx_simple, B_UID(663) };
+static const struct builtin B24_vec_vor = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 2, "vec_vor:24", "*vor", CODE_FOR_xfxx_simple, B_UID(664) };
+static const struct builtin B1_vec_vpkuhum = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vpkuhum:1", "*vpkuhum", CODE_FOR_xfxx_perm, B_UID(665) };
+static const struct builtin B1_vec_vpkuwum = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vpkuwum:1", "*vpkuwum", CODE_FOR_xfxx_perm, B_UID(666) };
+static const struct builtin B2_vec_vpkuhum = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vpkuhum:2", "*vpkuhum", CODE_FOR_xfxx_perm, B_UID(667) };
+static const struct builtin B2_vec_vpkuwum = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vpkuwum:2", "*vpkuwum", CODE_FOR_xfxx_perm, B_UID(668) };
+static const struct builtin B3_vec_vpkuhum = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vpkuhum:3", "*vpkuhum", CODE_FOR_xfxx_perm, B_UID(669) };
+static const struct builtin B3_vec_vpkuwum = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vpkuwum:3", "*vpkuwum", CODE_FOR_xfxx_perm, B_UID(670) };
+static const struct builtin B_vec_vpkpx = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vpkpx", "*vpkpx", CODE_FOR_xfxx_perm, B_UID(671) };
+static const struct builtin B_vec_vpkshss = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vpkshss", "*vpkshss", CODE_FOR_xfxx_perm, B_UID(672) };
+static const struct builtin B_vec_vpkswss = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vpkswss", "*vpkswss", CODE_FOR_xfxx_perm, B_UID(673) };
+static const struct builtin B_vec_vpkuhus = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vpkuhus", "*vpkuhus", CODE_FOR_xfxx_perm, B_UID(674) };
+static const struct builtin B_vec_vpkuwus = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vpkuwus", "*vpkuwus", CODE_FOR_xfxx_perm, B_UID(675) };
+static const struct builtin B_vec_vpkshus = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vpkshus", "*vpkshus", CODE_FOR_xfxx_perm, B_UID(676) };
+static const struct builtin B_vec_vpkswus = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vpkswus", "*vpkswus", CODE_FOR_xfxx_perm, B_UID(677) };
+static const struct builtin B1_vec_vperm = { { &T_vec_b16, &T_vec_b16, &T_vec_u8, }, "xxx", &T_vec_b16, 3, FALSE, FALSE, 0, "vec_vperm:1", "*vperm", CODE_FOR_xfxxx_perm, B_UID(678) };
+static const struct builtin B2_vec_vperm = { { &T_vec_b32, &T_vec_b32, &T_vec_u8, }, "xxx", &T_vec_b32, 3, FALSE, FALSE, 0, "vec_vperm:2", "*vperm", CODE_FOR_xfxxx_perm, B_UID(679) };
+static const struct builtin B3_vec_vperm = { { &T_vec_b8, &T_vec_b8, &T_vec_u8, }, "xxx", &T_vec_b8, 3, FALSE, FALSE, 0, "vec_vperm:3", "*vperm", CODE_FOR_xfxxx_perm, B_UID(680) };
+static const struct builtin B4_vec_vperm = { { &T_vec_f32, &T_vec_f32, &T_vec_u8, }, "xxx", &T_vec_f32, 3, FALSE, FALSE, 0, "vec_vperm:4", "*vperm", CODE_FOR_xfxxx_perm, B_UID(681) };
+static const struct builtin B5_vec_vperm = { { &T_vec_p16, &T_vec_p16, &T_vec_u8, }, "xxx", &T_vec_p16, 3, FALSE, FALSE, 0, "vec_vperm:5", "*vperm", CODE_FOR_xfxxx_perm, B_UID(682) };
+static const struct builtin B6_vec_vperm = { { &T_vec_s16, &T_vec_s16, &T_vec_u8, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vperm:6", "*vperm", CODE_FOR_xfxxx_perm, B_UID(683) };
+static const struct builtin B7_vec_vperm = { { &T_vec_s32, &T_vec_s32, &T_vec_u8, }, "xxx", &T_vec_s32, 3, FALSE, FALSE, 0, "vec_vperm:7", "*vperm", CODE_FOR_xfxxx_perm, B_UID(684) };
+static const struct builtin B8_vec_vperm = { { &T_vec_s8, &T_vec_s8, &T_vec_u8, }, "xxx", &T_vec_s8, 3, FALSE, FALSE, 0, "vec_vperm:8", "*vperm", CODE_FOR_xfxxx_perm, B_UID(685) };
+static const struct builtin B9_vec_vperm = { { &T_vec_u16, &T_vec_u16, &T_vec_u8, }, "xxx", &T_vec_u16, 3, FALSE, FALSE, 0, "vec_vperm:9", "*vperm", CODE_FOR_xfxxx_perm, B_UID(686) };
+static const struct builtin B10_vec_vperm = { { &T_vec_u32, &T_vec_u32, &T_vec_u8, }, "xxx", &T_vec_u32, 3, FALSE, FALSE, 0, "vec_vperm:10", "*vperm", CODE_FOR_xfxxx_perm, B_UID(687) };
+static const struct builtin B11_vec_vperm = { { &T_vec_u8, &T_vec_u8, &T_vec_u8, }, "xxx", &T_vec_u8, 3, FALSE, FALSE, 0, "vec_vperm:11", "*vperm", CODE_FOR_xfxxx_perm, B_UID(688) };
+static const struct builtin B_vec_vrefp = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vrefp", "*vrefp", CODE_FOR_xfx_fp, B_UID(689) };
+static const struct builtin B1_vec_vrlh = { { &T_vec_s16, &T_vec_u16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vrlh:1", "*vrlh", CODE_FOR_xfxx_simple, B_UID(690) };
+static const struct builtin B1_vec_vrlw = { { &T_vec_s32, &T_vec_u32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vrlw:1", "*vrlw", CODE_FOR_xfxx_simple, B_UID(691) };
+static const struct builtin B1_vec_vrlb = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vrlb:1", "*vrlb", CODE_FOR_xfxx_simple, B_UID(692) };
+static const struct builtin B2_vec_vrlh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vrlh:2", "*vrlh", CODE_FOR_xfxx_simple, B_UID(693) };
+static const struct builtin B2_vec_vrlw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vrlw:2", "*vrlw", CODE_FOR_xfxx_simple, B_UID(694) };
+static const struct builtin B2_vec_vrlb = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vrlb:2", "*vrlb", CODE_FOR_xfxx_simple, B_UID(695) };
+static const struct builtin B_vec_vrfin = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vrfin", "*vrfin", CODE_FOR_xfx_fp, B_UID(696) };
+static const struct builtin B_vec_vrsqrtefp = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vrsqrtefp", "*vrsqrtefp", CODE_FOR_xfx_fp, B_UID(697) };
+static const struct builtin B1_vec_vsel = { { &T_vec_b16, &T_vec_b16, &T_vec_b16, }, "xxx", &T_vec_b16, 3, FALSE, FALSE, 0, "vec_vsel:1", "*vsel", CODE_FOR_xfxxx_simple, B_UID(698) };
+static const struct builtin B2_vec_vsel = { { &T_vec_b16, &T_vec_b16, &T_vec_u16, }, "xxx", &T_vec_b16, 3, FALSE, FALSE, 0, "vec_vsel:2", "*vsel", CODE_FOR_xfxxx_simple, B_UID(699) };
+static const struct builtin B3_vec_vsel = { { &T_vec_b32, &T_vec_b32, &T_vec_b32, }, "xxx", &T_vec_b32, 3, FALSE, FALSE, 0, "vec_vsel:3", "*vsel", CODE_FOR_xfxxx_simple, B_UID(700) };
+static const struct builtin B4_vec_vsel = { { &T_vec_b32, &T_vec_b32, &T_vec_u32, }, "xxx", &T_vec_b32, 3, FALSE, FALSE, 0, "vec_vsel:4", "*vsel", CODE_FOR_xfxxx_simple, B_UID(701) };
+static const struct builtin B5_vec_vsel = { { &T_vec_b8, &T_vec_b8, &T_vec_b8, }, "xxx", &T_vec_b8, 3, FALSE, FALSE, 0, "vec_vsel:5", "*vsel", CODE_FOR_xfxxx_simple, B_UID(702) };
+static const struct builtin B6_vec_vsel = { { &T_vec_b8, &T_vec_b8, &T_vec_u8, }, "xxx", &T_vec_b8, 3, FALSE, FALSE, 0, "vec_vsel:6", "*vsel", CODE_FOR_xfxxx_simple, B_UID(703) };
+static const struct builtin B7_vec_vsel = { { &T_vec_f32, &T_vec_f32, &T_vec_b32, }, "xxx", &T_vec_f32, 3, FALSE, FALSE, 0, "vec_vsel:7", "*vsel", CODE_FOR_xfxxx_simple, B_UID(704) };
+static const struct builtin B8_vec_vsel = { { &T_vec_f32, &T_vec_f32, &T_vec_u32, }, "xxx", &T_vec_f32, 3, FALSE, FALSE, 0, "vec_vsel:8", "*vsel", CODE_FOR_xfxxx_simple, B_UID(705) };
+static const struct builtin B9_vec_vsel = { { &T_vec_s16, &T_vec_s16, &T_vec_b16, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vsel:9", "*vsel", CODE_FOR_xfxxx_simple, B_UID(706) };
+static const struct builtin B10_vec_vsel = { { &T_vec_s16, &T_vec_s16, &T_vec_u16, }, "xxx", &T_vec_s16, 3, FALSE, FALSE, 0, "vec_vsel:10", "*vsel", CODE_FOR_xfxxx_simple, B_UID(707) };
+static const struct builtin B11_vec_vsel = { { &T_vec_s32, &T_vec_s32, &T_vec_b32, }, "xxx", &T_vec_s32, 3, FALSE, FALSE, 0, "vec_vsel:11", "*vsel", CODE_FOR_xfxxx_simple, B_UID(708) };
+static const struct builtin B12_vec_vsel = { { &T_vec_s32, &T_vec_s32, &T_vec_u32, }, "xxx", &T_vec_s32, 3, FALSE, FALSE, 0, "vec_vsel:12", "*vsel", CODE_FOR_xfxxx_simple, B_UID(709) };
+static const struct builtin B13_vec_vsel = { { &T_vec_s8, &T_vec_s8, &T_vec_b8, }, "xxx", &T_vec_s8, 3, FALSE, FALSE, 0, "vec_vsel:13", "*vsel", CODE_FOR_xfxxx_simple, B_UID(710) };
+static const struct builtin B14_vec_vsel = { { &T_vec_s8, &T_vec_s8, &T_vec_u8, }, "xxx", &T_vec_s8, 3, FALSE, FALSE, 0, "vec_vsel:14", "*vsel", CODE_FOR_xfxxx_simple, B_UID(711) };
+static const struct builtin B15_vec_vsel = { { &T_vec_u16, &T_vec_u16, &T_vec_b16, }, "xxx", &T_vec_u16, 3, FALSE, FALSE, 0, "vec_vsel:15", "*vsel", CODE_FOR_xfxxx_simple, B_UID(712) };
+static const struct builtin B16_vec_vsel = { { &T_vec_u16, &T_vec_u16, &T_vec_u16, }, "xxx", &T_vec_u16, 3, FALSE, FALSE, 0, "vec_vsel:16", "*vsel", CODE_FOR_xfxxx_simple, B_UID(713) };
+static const struct builtin B17_vec_vsel = { { &T_vec_u32, &T_vec_u32, &T_vec_b32, }, "xxx", &T_vec_u32, 3, FALSE, FALSE, 0, "vec_vsel:17", "*vsel", CODE_FOR_xfxxx_simple, B_UID(714) };
+static const struct builtin B18_vec_vsel = { { &T_vec_u32, &T_vec_u32, &T_vec_u32, }, "xxx", &T_vec_u32, 3, FALSE, FALSE, 0, "vec_vsel:18", "*vsel", CODE_FOR_xfxxx_simple, B_UID(715) };
+static const struct builtin B19_vec_vsel = { { &T_vec_u8, &T_vec_u8, &T_vec_b8, }, "xxx", &T_vec_u8, 3, FALSE, FALSE, 0, "vec_vsel:19", "*vsel", CODE_FOR_xfxxx_simple, B_UID(716) };
+static const struct builtin B20_vec_vsel = { { &T_vec_u8, &T_vec_u8, &T_vec_u8, }, "xxx", &T_vec_u8, 3, FALSE, FALSE, 0, "vec_vsel:20", "*vsel", CODE_FOR_xfxxx_simple, B_UID(717) };
+static const struct builtin B1_vec_vslh = { { &T_vec_s16, &T_vec_u16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vslh:1", "*vslh", CODE_FOR_xfxx_simple, B_UID(718) };
+static const struct builtin B1_vec_vslw = { { &T_vec_s32, &T_vec_u32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vslw:1", "*vslw", CODE_FOR_xfxx_simple, B_UID(719) };
+static const struct builtin B1_vec_vslb = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vslb:1", "*vslb", CODE_FOR_xfxx_simple, B_UID(720) };
+static const struct builtin B2_vec_vslh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vslh:2", "*vslh", CODE_FOR_xfxx_simple, B_UID(721) };
+static const struct builtin B2_vec_vslw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vslw:2", "*vslw", CODE_FOR_xfxx_simple, B_UID(722) };
+static const struct builtin B2_vec_vslb = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vslb:2", "*vslb", CODE_FOR_xfxx_simple, B_UID(723) };
+static const struct builtin B1_vec_vsldoi = { { &T_vec_b16, &T_vec_b16, &T_immed_u4, }, "xxC", &T_vec_b16, 3, FALSE, FALSE, 3, "vec_vsldoi:1", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(724) };
+static const struct builtin B2_vec_vsldoi = { { &T_vec_b32, &T_vec_b32, &T_immed_u4, }, "xxC", &T_vec_b32, 3, FALSE, FALSE, 3, "vec_vsldoi:2", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(725) };
+static const struct builtin B3_vec_vsldoi = { { &T_vec_b8, &T_vec_b8, &T_immed_u4, }, "xxC", &T_vec_b8, 3, FALSE, FALSE, 3, "vec_vsldoi:3", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(726) };
+static const struct builtin B4_vec_vsldoi = { { &T_vec_f32, &T_vec_f32, &T_immed_u4, }, "xxC", &T_vec_f32, 3, FALSE, FALSE, 3, "vec_vsldoi:4", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(727) };
+static const struct builtin B5_vec_vsldoi = { { &T_vec_p16, &T_vec_p16, &T_immed_u4, }, "xxC", &T_vec_p16, 3, FALSE, FALSE, 3, "vec_vsldoi:5", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(728) };
+static const struct builtin B6_vec_vsldoi = { { &T_vec_s16, &T_vec_s16, &T_immed_u4, }, "xxC", &T_vec_s16, 3, FALSE, FALSE, 3, "vec_vsldoi:6", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(729) };
+static const struct builtin B7_vec_vsldoi = { { &T_vec_s32, &T_vec_s32, &T_immed_u4, }, "xxC", &T_vec_s32, 3, FALSE, FALSE, 3, "vec_vsldoi:7", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(730) };
+static const struct builtin B8_vec_vsldoi = { { &T_vec_s8, &T_vec_s8, &T_immed_u4, }, "xxC", &T_vec_s8, 3, FALSE, FALSE, 3, "vec_vsldoi:8", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(731) };
+static const struct builtin B9_vec_vsldoi = { { &T_vec_u16, &T_vec_u16, &T_immed_u4, }, "xxC", &T_vec_u16, 3, FALSE, FALSE, 3, "vec_vsldoi:9", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(732) };
+static const struct builtin B10_vec_vsldoi = { { &T_vec_u32, &T_vec_u32, &T_immed_u4, }, "xxC", &T_vec_u32, 3, FALSE, FALSE, 3, "vec_vsldoi:10", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(733) };
+static const struct builtin B11_vec_vsldoi = { { &T_vec_u8, &T_vec_u8, &T_immed_u4, }, "xxC", &T_vec_u8, 3, FALSE, FALSE, 3, "vec_vsldoi:11", "*vsldoi", CODE_FOR_xfxxC_perm, B_UID(734) };
+static const struct builtin B1_vec_vsl = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vsl:1", "*vsl", CODE_FOR_xfxx_simple, B_UID(735) };
+static const struct builtin B2_vec_vsl = { { &T_vec_b16, &T_vec_u32, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vsl:2", "*vsl", CODE_FOR_xfxx_simple, B_UID(736) };
+static const struct builtin B3_vec_vsl = { { &T_vec_b16, &T_vec_u8, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vsl:3", "*vsl", CODE_FOR_xfxx_simple, B_UID(737) };
+static const struct builtin B4_vec_vsl = { { &T_vec_b32, &T_vec_u16, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vsl:4", "*vsl", CODE_FOR_xfxx_simple, B_UID(738) };
+static const struct builtin B5_vec_vsl = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vsl:5", "*vsl", CODE_FOR_xfxx_simple, B_UID(739) };
+static const struct builtin B6_vec_vsl = { { &T_vec_b32, &T_vec_u8, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vsl:6", "*vsl", CODE_FOR_xfxx_simple, B_UID(740) };
+static const struct builtin B7_vec_vsl = { { &T_vec_b8, &T_vec_u16, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vsl:7", "*vsl", CODE_FOR_xfxx_simple, B_UID(741) };
+static const struct builtin B8_vec_vsl = { { &T_vec_b8, &T_vec_u32, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vsl:8", "*vsl", CODE_FOR_xfxx_simple, B_UID(742) };
+static const struct builtin B9_vec_vsl = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vsl:9", "*vsl", CODE_FOR_xfxx_simple, B_UID(743) };
+static const struct builtin B10_vec_vsl = { { &T_vec_p16, &T_vec_u16, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsl:10", "*vsl", CODE_FOR_xfxx_simple, B_UID(744) };
+static const struct builtin B11_vec_vsl = { { &T_vec_p16, &T_vec_u32, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsl:11", "*vsl", CODE_FOR_xfxx_simple, B_UID(745) };
+static const struct builtin B12_vec_vsl = { { &T_vec_p16, &T_vec_u8, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsl:12", "*vsl", CODE_FOR_xfxx_simple, B_UID(746) };
+static const struct builtin B13_vec_vsl = { { &T_vec_s16, &T_vec_u16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsl:13", "*vsl", CODE_FOR_xfxx_simple, B_UID(747) };
+static const struct builtin B14_vec_vsl = { { &T_vec_s16, &T_vec_u32, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsl:14", "*vsl", CODE_FOR_xfxx_simple, B_UID(748) };
+static const struct builtin B15_vec_vsl = { { &T_vec_s16, &T_vec_u8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsl:15", "*vsl", CODE_FOR_xfxx_simple, B_UID(749) };
+static const struct builtin B16_vec_vsl = { { &T_vec_s32, &T_vec_u16, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsl:16", "*vsl", CODE_FOR_xfxx_simple, B_UID(750) };
+static const struct builtin B17_vec_vsl = { { &T_vec_s32, &T_vec_u32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsl:17", "*vsl", CODE_FOR_xfxx_simple, B_UID(751) };
+static const struct builtin B18_vec_vsl = { { &T_vec_s32, &T_vec_u8, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsl:18", "*vsl", CODE_FOR_xfxx_simple, B_UID(752) };
+static const struct builtin B19_vec_vsl = { { &T_vec_s8, &T_vec_u16, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsl:19", "*vsl", CODE_FOR_xfxx_simple, B_UID(753) };
+static const struct builtin B20_vec_vsl = { { &T_vec_s8, &T_vec_u32, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsl:20", "*vsl", CODE_FOR_xfxx_simple, B_UID(754) };
+static const struct builtin B21_vec_vsl = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsl:21", "*vsl", CODE_FOR_xfxx_simple, B_UID(755) };
+static const struct builtin B22_vec_vsl = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsl:22", "*vsl", CODE_FOR_xfxx_simple, B_UID(756) };
+static const struct builtin B23_vec_vsl = { { &T_vec_u16, &T_vec_u32, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsl:23", "*vsl", CODE_FOR_xfxx_simple, B_UID(757) };
+static const struct builtin B24_vec_vsl = { { &T_vec_u16, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsl:24", "*vsl", CODE_FOR_xfxx_simple, B_UID(758) };
+static const struct builtin B25_vec_vsl = { { &T_vec_u32, &T_vec_u16, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsl:25", "*vsl", CODE_FOR_xfxx_simple, B_UID(759) };
+static const struct builtin B26_vec_vsl = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsl:26", "*vsl", CODE_FOR_xfxx_simple, B_UID(760) };
+static const struct builtin B27_vec_vsl = { { &T_vec_u32, &T_vec_u8, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsl:27", "*vsl", CODE_FOR_xfxx_simple, B_UID(761) };
+static const struct builtin B28_vec_vsl = { { &T_vec_u8, &T_vec_u16, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsl:28", "*vsl", CODE_FOR_xfxx_simple, B_UID(762) };
+static const struct builtin B29_vec_vsl = { { &T_vec_u8, &T_vec_u32, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsl:29", "*vsl", CODE_FOR_xfxx_simple, B_UID(763) };
+static const struct builtin B30_vec_vsl = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsl:30", "*vsl", CODE_FOR_xfxx_simple, B_UID(764) };
+static const struct builtin B1_vec_vslo = { { &T_vec_f32, &T_vec_s8, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vslo:1", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(765) };
+static const struct builtin B2_vec_vslo = { { &T_vec_f32, &T_vec_u8, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vslo:2", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(766) };
+static const struct builtin B3_vec_vslo = { { &T_vec_p16, &T_vec_s8, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vslo:3", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(767) };
+static const struct builtin B4_vec_vslo = { { &T_vec_p16, &T_vec_u8, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vslo:4", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(768) };
+static const struct builtin B5_vec_vslo = { { &T_vec_s16, &T_vec_s8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vslo:5", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(769) };
+static const struct builtin B6_vec_vslo = { { &T_vec_s16, &T_vec_u8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vslo:6", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(770) };
+static const struct builtin B7_vec_vslo = { { &T_vec_s32, &T_vec_s8, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vslo:7", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(771) };
+static const struct builtin B8_vec_vslo = { { &T_vec_s32, &T_vec_u8, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vslo:8", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(772) };
+static const struct builtin B9_vec_vslo = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vslo:9", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(773) };
+static const struct builtin B10_vec_vslo = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vslo:10", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(774) };
+static const struct builtin B11_vec_vslo = { { &T_vec_u16, &T_vec_s8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vslo:11", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(775) };
+static const struct builtin B12_vec_vslo = { { &T_vec_u16, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vslo:12", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(776) };
+static const struct builtin B13_vec_vslo = { { &T_vec_u32, &T_vec_s8, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vslo:13", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(777) };
+static const struct builtin B14_vec_vslo = { { &T_vec_u32, &T_vec_u8, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vslo:14", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(778) };
+static const struct builtin B15_vec_vslo = { { &T_vec_u8, &T_vec_s8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vslo:15", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(779) };
+static const struct builtin B16_vec_vslo = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vslo:16", "*vslo", CODE_FOR_xfxx_perm_bug, B_UID(780) };
+static const struct builtin B1_vec_vsplth = { { &T_vec_b16, &T_immed_u5, NULL, }, "xB", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vsplth:1", "*vsplth", CODE_FOR_xfxB_perm, B_UID(781) };
+static const struct builtin B1_vec_vspltw = { { &T_vec_b32, &T_immed_u5, NULL, }, "xB", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vspltw:1", "*vspltw", CODE_FOR_xfxB_perm, B_UID(782) };
+static const struct builtin B1_vec_vspltb = { { &T_vec_b8, &T_immed_u5, NULL, }, "xB", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vspltb:1", "*vspltb", CODE_FOR_xfxB_perm, B_UID(783) };
+static const struct builtin B2_vec_vspltw = { { &T_vec_f32, &T_immed_u5, NULL, }, "xB", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vspltw:2", "*vspltw", CODE_FOR_xfxB_perm, B_UID(784) };
+static const struct builtin B2_vec_vsplth = { { &T_vec_p16, &T_immed_u5, NULL, }, "xB", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsplth:2", "*vsplth", CODE_FOR_xfxB_perm, B_UID(785) };
+static const struct builtin B3_vec_vsplth = { { &T_vec_s16, &T_immed_u5, NULL, }, "xB", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsplth:3", "*vsplth", CODE_FOR_xfxB_perm, B_UID(786) };
+static const struct builtin B3_vec_vspltw = { { &T_vec_s32, &T_immed_u5, NULL, }, "xB", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vspltw:3", "*vspltw", CODE_FOR_xfxB_perm, B_UID(787) };
+static const struct builtin B2_vec_vspltb = { { &T_vec_s8, &T_immed_u5, NULL, }, "xB", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vspltb:2", "*vspltb", CODE_FOR_xfxB_perm, B_UID(788) };
+static const struct builtin B4_vec_vsplth = { { &T_vec_u16, &T_immed_u5, NULL, }, "xB", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsplth:4", "*vsplth", CODE_FOR_xfxB_perm, B_UID(789) };
+static const struct builtin B4_vec_vspltw = { { &T_vec_u32, &T_immed_u5, NULL, }, "xB", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vspltw:4", "*vspltw", CODE_FOR_xfxB_perm, B_UID(790) };
+static const struct builtin B3_vec_vspltb = { { &T_vec_u8, &T_immed_u5, NULL, }, "xB", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vspltb:3", "*vspltb", CODE_FOR_xfxB_perm, B_UID(791) };
+static const struct builtin B_vec_vspltish = { { &T_immed_s5, NULL, NULL, }, "A", &T_vec_s16, 1, FALSE, FALSE, 5, "vec_vspltish", "*vspltish", CODE_FOR_xfA_perm, B_UID(792) };
+static const struct builtin B_vec_vspltisw = { { &T_immed_s5, NULL, NULL, }, "A", &T_vec_s32, 1, FALSE, FALSE, 6, "vec_vspltisw", "*vspltisw", CODE_FOR_xfA_perm, B_UID(793) };
+static const struct builtin B_vec_vspltisb = { { &T_immed_s5, NULL, NULL, }, "A", &T_vec_s8, 1, FALSE, FALSE, 4, "vec_vspltisb", "*vspltisb", CODE_FOR_xfA_perm, B_UID(794) };
+static const struct builtin B_vec_splat_u16 = { { &T_immed_s5, NULL, NULL, }, "A", &T_vec_u16, 1, FALSE, FALSE, 5, "vec_splat_u16", "*vspltish", CODE_FOR_xfA_perm, B_UID(795) };
+static const struct builtin B_vec_splat_u32 = { { &T_immed_s5, NULL, NULL, }, "A", &T_vec_u32, 1, FALSE, FALSE, 6, "vec_splat_u32", "*vspltisw", CODE_FOR_xfA_perm, B_UID(796) };
+static const struct builtin B_vec_splat_u8 = { { &T_immed_s5, NULL, NULL, }, "A", &T_vec_u8, 1, FALSE, FALSE, 4, "vec_splat_u8", "*vspltisb", CODE_FOR_xfA_perm, B_UID(797) };
+static const struct builtin B1_vec_vsrh = { { &T_vec_s16, &T_vec_u16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsrh:1", "*vsrh", CODE_FOR_xfxx_simple, B_UID(798) };
+static const struct builtin B1_vec_vsrw = { { &T_vec_s32, &T_vec_u32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsrw:1", "*vsrw", CODE_FOR_xfxx_simple, B_UID(799) };
+static const struct builtin B1_vec_vsrb = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsrb:1", "*vsrb", CODE_FOR_xfxx_simple, B_UID(800) };
+static const struct builtin B2_vec_vsrh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsrh:2", "*vsrh", CODE_FOR_xfxx_simple, B_UID(801) };
+static const struct builtin B2_vec_vsrw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsrw:2", "*vsrw", CODE_FOR_xfxx_simple, B_UID(802) };
+static const struct builtin B2_vec_vsrb = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsrb:2", "*vsrb", CODE_FOR_xfxx_simple, B_UID(803) };
+static const struct builtin B1_vec_vsrah = { { &T_vec_s16, &T_vec_u16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsrah:1", "*vsrah", CODE_FOR_xfxx_simple, B_UID(804) };
+static const struct builtin B1_vec_vsraw = { { &T_vec_s32, &T_vec_u32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsraw:1", "*vsraw", CODE_FOR_xfxx_simple, B_UID(805) };
+static const struct builtin B1_vec_vsrab = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsrab:1", "*vsrab", CODE_FOR_xfxx_simple, B_UID(806) };
+static const struct builtin B2_vec_vsrah = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsrah:2", "*vsrah", CODE_FOR_xfxx_simple, B_UID(807) };
+static const struct builtin B2_vec_vsraw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsraw:2", "*vsraw", CODE_FOR_xfxx_simple, B_UID(808) };
+static const struct builtin B2_vec_vsrab = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsrab:2", "*vsrab", CODE_FOR_xfxx_simple, B_UID(809) };
+static const struct builtin B1_vec_vsr = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vsr:1", "*vsr", CODE_FOR_xfxx_simple, B_UID(810) };
+static const struct builtin B2_vec_vsr = { { &T_vec_b16, &T_vec_u32, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vsr:2", "*vsr", CODE_FOR_xfxx_simple, B_UID(811) };
+static const struct builtin B3_vec_vsr = { { &T_vec_b16, &T_vec_u8, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 0, "vec_vsr:3", "*vsr", CODE_FOR_xfxx_simple, B_UID(812) };
+static const struct builtin B4_vec_vsr = { { &T_vec_b32, &T_vec_u16, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vsr:4", "*vsr", CODE_FOR_xfxx_simple, B_UID(813) };
+static const struct builtin B5_vec_vsr = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vsr:5", "*vsr", CODE_FOR_xfxx_simple, B_UID(814) };
+static const struct builtin B6_vec_vsr = { { &T_vec_b32, &T_vec_u8, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 0, "vec_vsr:6", "*vsr", CODE_FOR_xfxx_simple, B_UID(815) };
+static const struct builtin B7_vec_vsr = { { &T_vec_b8, &T_vec_u16, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vsr:7", "*vsr", CODE_FOR_xfxx_simple, B_UID(816) };
+static const struct builtin B8_vec_vsr = { { &T_vec_b8, &T_vec_u32, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vsr:8", "*vsr", CODE_FOR_xfxx_simple, B_UID(817) };
+static const struct builtin B9_vec_vsr = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 0, "vec_vsr:9", "*vsr", CODE_FOR_xfxx_simple, B_UID(818) };
+static const struct builtin B10_vec_vsr = { { &T_vec_p16, &T_vec_u16, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsr:10", "*vsr", CODE_FOR_xfxx_simple, B_UID(819) };
+static const struct builtin B11_vec_vsr = { { &T_vec_p16, &T_vec_u32, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsr:11", "*vsr", CODE_FOR_xfxx_simple, B_UID(820) };
+static const struct builtin B12_vec_vsr = { { &T_vec_p16, &T_vec_u8, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsr:12", "*vsr", CODE_FOR_xfxx_simple, B_UID(821) };
+static const struct builtin B13_vec_vsr = { { &T_vec_s16, &T_vec_u16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsr:13", "*vsr", CODE_FOR_xfxx_simple, B_UID(822) };
+static const struct builtin B14_vec_vsr = { { &T_vec_s16, &T_vec_u32, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsr:14", "*vsr", CODE_FOR_xfxx_simple, B_UID(823) };
+static const struct builtin B15_vec_vsr = { { &T_vec_s16, &T_vec_u8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsr:15", "*vsr", CODE_FOR_xfxx_simple, B_UID(824) };
+static const struct builtin B16_vec_vsr = { { &T_vec_s32, &T_vec_u16, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsr:16", "*vsr", CODE_FOR_xfxx_simple, B_UID(825) };
+static const struct builtin B17_vec_vsr = { { &T_vec_s32, &T_vec_u32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsr:17", "*vsr", CODE_FOR_xfxx_simple, B_UID(826) };
+static const struct builtin B18_vec_vsr = { { &T_vec_s32, &T_vec_u8, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsr:18", "*vsr", CODE_FOR_xfxx_simple, B_UID(827) };
+static const struct builtin B19_vec_vsr = { { &T_vec_s8, &T_vec_u16, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsr:19", "*vsr", CODE_FOR_xfxx_simple, B_UID(828) };
+static const struct builtin B20_vec_vsr = { { &T_vec_s8, &T_vec_u32, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsr:20", "*vsr", CODE_FOR_xfxx_simple, B_UID(829) };
+static const struct builtin B21_vec_vsr = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsr:21", "*vsr", CODE_FOR_xfxx_simple, B_UID(830) };
+static const struct builtin B22_vec_vsr = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsr:22", "*vsr", CODE_FOR_xfxx_simple, B_UID(831) };
+static const struct builtin B23_vec_vsr = { { &T_vec_u16, &T_vec_u32, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsr:23", "*vsr", CODE_FOR_xfxx_simple, B_UID(832) };
+static const struct builtin B24_vec_vsr = { { &T_vec_u16, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsr:24", "*vsr", CODE_FOR_xfxx_simple, B_UID(833) };
+static const struct builtin B25_vec_vsr = { { &T_vec_u32, &T_vec_u16, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsr:25", "*vsr", CODE_FOR_xfxx_simple, B_UID(834) };
+static const struct builtin B26_vec_vsr = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsr:26", "*vsr", CODE_FOR_xfxx_simple, B_UID(835) };
+static const struct builtin B27_vec_vsr = { { &T_vec_u32, &T_vec_u8, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsr:27", "*vsr", CODE_FOR_xfxx_simple, B_UID(836) };
+static const struct builtin B28_vec_vsr = { { &T_vec_u8, &T_vec_u16, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsr:28", "*vsr", CODE_FOR_xfxx_simple, B_UID(837) };
+static const struct builtin B29_vec_vsr = { { &T_vec_u8, &T_vec_u32, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsr:29", "*vsr", CODE_FOR_xfxx_simple, B_UID(838) };
+static const struct builtin B30_vec_vsr = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsr:30", "*vsr", CODE_FOR_xfxx_simple, B_UID(839) };
+static const struct builtin B1_vec_vsro = { { &T_vec_f32, &T_vec_s8, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vsro:1", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(840) };
+static const struct builtin B2_vec_vsro = { { &T_vec_f32, &T_vec_u8, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 0, "vec_vsro:2", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(841) };
+static const struct builtin B3_vec_vsro = { { &T_vec_p16, &T_vec_s8, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsro:3", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(842) };
+static const struct builtin B4_vec_vsro = { { &T_vec_p16, &T_vec_u8, NULL, }, "xx", &T_vec_p16, 2, FALSE, FALSE, 0, "vec_vsro:4", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(843) };
+static const struct builtin B5_vec_vsro = { { &T_vec_s16, &T_vec_s8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsro:5", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(844) };
+static const struct builtin B6_vec_vsro = { { &T_vec_s16, &T_vec_u8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_vsro:6", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(845) };
+static const struct builtin B7_vec_vsro = { { &T_vec_s32, &T_vec_s8, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsro:7", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(846) };
+static const struct builtin B8_vec_vsro = { { &T_vec_s32, &T_vec_u8, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsro:8", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(847) };
+static const struct builtin B9_vec_vsro = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsro:9", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(848) };
+static const struct builtin B10_vec_vsro = { { &T_vec_s8, &T_vec_u8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 0, "vec_vsro:10", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(849) };
+static const struct builtin B11_vec_vsro = { { &T_vec_u16, &T_vec_s8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsro:11", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(850) };
+static const struct builtin B12_vec_vsro = { { &T_vec_u16, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_vsro:12", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(851) };
+static const struct builtin B13_vec_vsro = { { &T_vec_u32, &T_vec_s8, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsro:13", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(852) };
+static const struct builtin B14_vec_vsro = { { &T_vec_u32, &T_vec_u8, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsro:14", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(853) };
+static const struct builtin B15_vec_vsro = { { &T_vec_u8, &T_vec_s8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsro:15", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(854) };
+static const struct builtin B16_vec_vsro = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 0, "vec_vsro:16", "*vsro", CODE_FOR_xfxx_perm_bug, B_UID(855) };
+static const struct builtin B1_vec_stvx = { { &T_vec_b16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:1", "*stvx", CODE_FOR_sfxii_store, B_UID(856) };
+static const struct builtin B2_vec_stvx = { { &T_vec_b16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:2", "*stvx", CODE_FOR_sfxii_store, B_UID(857) };
+static const struct builtin B3_vec_stvx = { { &T_vec_b16, &T_int, &T_vec_b16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:3", "*stvx", CODE_FOR_sfxii_store, B_UID(858) };
+static const struct builtin B4_vec_stvx = { { &T_vec_b32, &T_int, &T_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:4", "*stvx", CODE_FOR_sfxii_store, B_UID(859) };
+static const struct builtin B5_vec_stvx = { { &T_vec_b32, &T_int, &T_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:5", "*stvx", CODE_FOR_sfxii_store, B_UID(860) };
+static const struct builtin B6_vec_stvx = { { &T_vec_b32, &T_int, &T_unsigned_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:6", "*stvx", CODE_FOR_sfxii_store, B_UID(861) };
+static const struct builtin B7_vec_stvx = { { &T_vec_b32, &T_int, &T_unsigned_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:7", "*stvx", CODE_FOR_sfxii_store, B_UID(862) };
+static const struct builtin B8_vec_stvx = { { &T_vec_b32, &T_int, &T_vec_b32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:8", "*stvx", CODE_FOR_sfxii_store, B_UID(863) };
+static const struct builtin B9_vec_stvx = { { &T_vec_b8, &T_int, &T_signed_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:9", "*stvx", CODE_FOR_sfxii_store, B_UID(864) };
+static const struct builtin B10_vec_stvx = { { &T_vec_b8, &T_int, &T_unsigned_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:10", "*stvx", CODE_FOR_sfxii_store, B_UID(865) };
+static const struct builtin B11_vec_stvx = { { &T_vec_b8, &T_int, &T_vec_b8_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:11", "*stvx", CODE_FOR_sfxii_store, B_UID(866) };
+static const struct builtin B12_vec_stvx = { { &T_vec_f32, &T_int, &T_float_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:12", "*stvx", CODE_FOR_sfxii_store, B_UID(867) };
+static const struct builtin B13_vec_stvx = { { &T_vec_f32, &T_int, &T_vec_f32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:13", "*stvx", CODE_FOR_sfxii_store, B_UID(868) };
+static const struct builtin B14_vec_stvx = { { &T_vec_p16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:14", "*stvx", CODE_FOR_sfxii_store, B_UID(869) };
+static const struct builtin B15_vec_stvx = { { &T_vec_p16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:15", "*stvx", CODE_FOR_sfxii_store, B_UID(870) };
+static const struct builtin B16_vec_stvx = { { &T_vec_p16, &T_int, &T_vec_p16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:16", "*stvx", CODE_FOR_sfxii_store, B_UID(871) };
+static const struct builtin B17_vec_stvx = { { &T_vec_s16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:17", "*stvx", CODE_FOR_sfxii_store, B_UID(872) };
+static const struct builtin B18_vec_stvx = { { &T_vec_s16, &T_int, &T_vec_s16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:18", "*stvx", CODE_FOR_sfxii_store, B_UID(873) };
+static const struct builtin B19_vec_stvx = { { &T_vec_s32, &T_int, &T_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:19", "*stvx", CODE_FOR_sfxii_store, B_UID(874) };
+static const struct builtin B20_vec_stvx = { { &T_vec_s32, &T_int, &T_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:20", "*stvx", CODE_FOR_sfxii_store, B_UID(875) };
+static const struct builtin B21_vec_stvx = { { &T_vec_s32, &T_int, &T_vec_s32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:21", "*stvx", CODE_FOR_sfxii_store, B_UID(876) };
+static const struct builtin B22_vec_stvx = { { &T_vec_s8, &T_int, &T_signed_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:22", "*stvx", CODE_FOR_sfxii_store, B_UID(877) };
+static const struct builtin B23_vec_stvx = { { &T_vec_s8, &T_int, &T_vec_s8_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:23", "*stvx", CODE_FOR_sfxii_store, B_UID(878) };
+static const struct builtin B24_vec_stvx = { { &T_vec_u16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:24", "*stvx", CODE_FOR_sfxii_store, B_UID(879) };
+static const struct builtin B25_vec_stvx = { { &T_vec_u16, &T_int, &T_vec_u16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:25", "*stvx", CODE_FOR_sfxii_store, B_UID(880) };
+static const struct builtin B26_vec_stvx = { { &T_vec_u32, &T_int, &T_unsigned_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:26", "*stvx", CODE_FOR_sfxii_store, B_UID(881) };
+static const struct builtin B27_vec_stvx = { { &T_vec_u32, &T_int, &T_unsigned_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:27", "*stvx", CODE_FOR_sfxii_store, B_UID(882) };
+static const struct builtin B28_vec_stvx = { { &T_vec_u32, &T_int, &T_vec_u32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:28", "*stvx", CODE_FOR_sfxii_store, B_UID(883) };
+static const struct builtin B29_vec_stvx = { { &T_vec_u8, &T_int, &T_unsigned_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:29", "*stvx", CODE_FOR_sfxii_store, B_UID(884) };
+static const struct builtin B30_vec_stvx = { { &T_vec_u8, &T_int, &T_vec_u8_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvx:30", "*stvx", CODE_FOR_sfxii_store, B_UID(885) };
+static const struct builtin B1_vec_stvebx = { { &T_vec_b16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvebx:1", "*stvebx", CODE_FOR_sfxii_store, B_UID(886) };
+static const struct builtin B2_vec_stvebx = { { &T_vec_b16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvebx:2", "*stvebx", CODE_FOR_sfxii_store, B_UID(887) };
+static const struct builtin B1_vec_stvewx = { { &T_vec_b32, &T_int, &T_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:1", "*stvewx", CODE_FOR_sfxii_store, B_UID(888) };
+static const struct builtin B2_vec_stvewx = { { &T_vec_b32, &T_int, &T_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:2", "*stvewx", CODE_FOR_sfxii_store, B_UID(889) };
+static const struct builtin B3_vec_stvewx = { { &T_vec_b32, &T_int, &T_unsigned_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:3", "*stvewx", CODE_FOR_sfxii_store, B_UID(890) };
+static const struct builtin B4_vec_stvewx = { { &T_vec_b32, &T_int, &T_unsigned_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:4", "*stvewx", CODE_FOR_sfxii_store, B_UID(891) };
+static const struct builtin B3_vec_stvebx = { { &T_vec_b8, &T_int, &T_signed_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvebx:3", "*stvebx", CODE_FOR_sfxii_store, B_UID(892) };
+static const struct builtin B4_vec_stvebx = { { &T_vec_b8, &T_int, &T_unsigned_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvebx:4", "*stvebx", CODE_FOR_sfxii_store, B_UID(893) };
+static const struct builtin B5_vec_stvewx = { { &T_vec_f32, &T_int, &T_float_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:5", "*stvewx", CODE_FOR_sfxii_store, B_UID(894) };
+static const struct builtin B1_vec_stvehx = { { &T_vec_p16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvehx:1", "*stvehx", CODE_FOR_sfxii_store, B_UID(895) };
+static const struct builtin B2_vec_stvehx = { { &T_vec_p16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvehx:2", "*stvehx", CODE_FOR_sfxii_store, B_UID(896) };
+static const struct builtin B3_vec_stvehx = { { &T_vec_s16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvehx:3", "*stvehx", CODE_FOR_sfxii_store, B_UID(897) };
+static const struct builtin B6_vec_stvewx = { { &T_vec_s32, &T_int, &T_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:6", "*stvewx", CODE_FOR_sfxii_store, B_UID(898) };
+static const struct builtin B7_vec_stvewx = { { &T_vec_s32, &T_int, &T_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:7", "*stvewx", CODE_FOR_sfxii_store, B_UID(899) };
+static const struct builtin B5_vec_stvebx = { { &T_vec_s8, &T_int, &T_signed_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvebx:5", "*stvebx", CODE_FOR_sfxii_store, B_UID(900) };
+static const struct builtin B4_vec_stvehx = { { &T_vec_u16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvehx:4", "*stvehx", CODE_FOR_sfxii_store, B_UID(901) };
+static const struct builtin B8_vec_stvewx = { { &T_vec_u32, &T_int, &T_unsigned_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:8", "*stvewx", CODE_FOR_sfxii_store, B_UID(902) };
+static const struct builtin B9_vec_stvewx = { { &T_vec_u32, &T_int, &T_unsigned_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvewx:9", "*stvewx", CODE_FOR_sfxii_store, B_UID(903) };
+static const struct builtin B6_vec_stvebx = { { &T_vec_u8, &T_int, &T_unsigned_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvebx:6", "*stvebx", CODE_FOR_sfxii_store, B_UID(904) };
+static const struct builtin B1_vec_stvxl = { { &T_vec_b16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:1", "*stvxl", CODE_FOR_sfxii_store, B_UID(905) };
+static const struct builtin B2_vec_stvxl = { { &T_vec_b16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:2", "*stvxl", CODE_FOR_sfxii_store, B_UID(906) };
+static const struct builtin B3_vec_stvxl = { { &T_vec_b16, &T_int, &T_vec_b16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:3", "*stvxl", CODE_FOR_sfxii_store, B_UID(907) };
+static const struct builtin B4_vec_stvxl = { { &T_vec_b32, &T_int, &T_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:4", "*stvxl", CODE_FOR_sfxii_store, B_UID(908) };
+static const struct builtin B5_vec_stvxl = { { &T_vec_b32, &T_int, &T_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:5", "*stvxl", CODE_FOR_sfxii_store, B_UID(909) };
+static const struct builtin B6_vec_stvxl = { { &T_vec_b32, &T_int, &T_unsigned_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:6", "*stvxl", CODE_FOR_sfxii_store, B_UID(910) };
+static const struct builtin B7_vec_stvxl = { { &T_vec_b32, &T_int, &T_unsigned_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:7", "*stvxl", CODE_FOR_sfxii_store, B_UID(911) };
+static const struct builtin B8_vec_stvxl = { { &T_vec_b32, &T_int, &T_vec_b32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:8", "*stvxl", CODE_FOR_sfxii_store, B_UID(912) };
+static const struct builtin B9_vec_stvxl = { { &T_vec_b8, &T_int, &T_signed_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:9", "*stvxl", CODE_FOR_sfxii_store, B_UID(913) };
+static const struct builtin B10_vec_stvxl = { { &T_vec_b8, &T_int, &T_unsigned_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:10", "*stvxl", CODE_FOR_sfxii_store, B_UID(914) };
+static const struct builtin B11_vec_stvxl = { { &T_vec_b8, &T_int, &T_vec_b8_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:11", "*stvxl", CODE_FOR_sfxii_store, B_UID(915) };
+static const struct builtin B12_vec_stvxl = { { &T_vec_f32, &T_int, &T_float_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:12", "*stvxl", CODE_FOR_sfxii_store, B_UID(916) };
+static const struct builtin B13_vec_stvxl = { { &T_vec_f32, &T_int, &T_vec_f32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:13", "*stvxl", CODE_FOR_sfxii_store, B_UID(917) };
+static const struct builtin B14_vec_stvxl = { { &T_vec_p16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:14", "*stvxl", CODE_FOR_sfxii_store, B_UID(918) };
+static const struct builtin B15_vec_stvxl = { { &T_vec_p16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:15", "*stvxl", CODE_FOR_sfxii_store, B_UID(919) };
+static const struct builtin B16_vec_stvxl = { { &T_vec_p16, &T_int, &T_vec_p16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:16", "*stvxl", CODE_FOR_sfxii_store, B_UID(920) };
+static const struct builtin B17_vec_stvxl = { { &T_vec_s16, &T_int, &T_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:17", "*stvxl", CODE_FOR_sfxii_store, B_UID(921) };
+static const struct builtin B18_vec_stvxl = { { &T_vec_s16, &T_int, &T_vec_s16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:18", "*stvxl", CODE_FOR_sfxii_store, B_UID(922) };
+static const struct builtin B19_vec_stvxl = { { &T_vec_s32, &T_int, &T_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:19", "*stvxl", CODE_FOR_sfxii_store, B_UID(923) };
+static const struct builtin B20_vec_stvxl = { { &T_vec_s32, &T_int, &T_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:20", "*stvxl", CODE_FOR_sfxii_store, B_UID(924) };
+static const struct builtin B21_vec_stvxl = { { &T_vec_s32, &T_int, &T_vec_s32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:21", "*stvxl", CODE_FOR_sfxii_store, B_UID(925) };
+static const struct builtin B22_vec_stvxl = { { &T_vec_s8, &T_int, &T_signed_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:22", "*stvxl", CODE_FOR_sfxii_store, B_UID(926) };
+static const struct builtin B23_vec_stvxl = { { &T_vec_s8, &T_int, &T_vec_s8_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:23", "*stvxl", CODE_FOR_sfxii_store, B_UID(927) };
+static const struct builtin B24_vec_stvxl = { { &T_vec_u16, &T_int, &T_unsigned_short_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:24", "*stvxl", CODE_FOR_sfxii_store, B_UID(928) };
+static const struct builtin B25_vec_stvxl = { { &T_vec_u16, &T_int, &T_vec_u16_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:25", "*stvxl", CODE_FOR_sfxii_store, B_UID(929) };
+static const struct builtin B26_vec_stvxl = { { &T_vec_u32, &T_int, &T_unsigned_int_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:26", "*stvxl", CODE_FOR_sfxii_store, B_UID(930) };
+static const struct builtin B27_vec_stvxl = { { &T_vec_u32, &T_int, &T_unsigned_long_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:27", "*stvxl", CODE_FOR_sfxii_store, B_UID(931) };
+static const struct builtin B28_vec_stvxl = { { &T_vec_u32, &T_int, &T_vec_u32_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:28", "*stvxl", CODE_FOR_sfxii_store, B_UID(932) };
+static const struct builtin B29_vec_stvxl = { { &T_vec_u8, &T_int, &T_unsigned_char_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:29", "*stvxl", CODE_FOR_sfxii_store, B_UID(933) };
+static const struct builtin B30_vec_stvxl = { { &T_vec_u8, &T_int, &T_vec_u8_ptr, }, "xii", &T_void, 3, FALSE, FALSE, 0, "vec_stvxl:30", "*stvxl", CODE_FOR_sfxii_store, B_UID(934) };
+static const struct builtin B1_vec_vsubuhm = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vsubuhm:1", "*vsubuhm", CODE_FOR_xfxx_simple, B_UID(935) };
+static const struct builtin B2_vec_vsubuhm = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vsubuhm:2", "*vsubuhm", CODE_FOR_xfxx_simple, B_UID(936) };
+static const struct builtin B1_vec_vsubuwm = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vsubuwm:1", "*vsubuwm", CODE_FOR_xfxx_simple, B_UID(937) };
+static const struct builtin B2_vec_vsubuwm = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vsubuwm:2", "*vsubuwm", CODE_FOR_xfxx_simple, B_UID(938) };
+static const struct builtin B1_vec_vsububm = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vsububm:1", "*vsububm", CODE_FOR_xfxx_simple, B_UID(939) };
+static const struct builtin B2_vec_vsububm = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vsububm:2", "*vsububm", CODE_FOR_xfxx_simple, B_UID(940) };
+static const struct builtin B_vec_vsubfp = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 1, "vec_vsubfp", "*vsubfp", CODE_FOR_xfxx_fp, B_UID(941) };
+static const struct builtin B3_vec_vsubuhm = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vsubuhm:3", "*vsubuhm", CODE_FOR_xfxx_simple, B_UID(942) };
+static const struct builtin B4_vec_vsubuhm = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vsubuhm:4", "*vsubuhm", CODE_FOR_xfxx_simple, B_UID(943) };
+static const struct builtin B3_vec_vsubuwm = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vsubuwm:3", "*vsubuwm", CODE_FOR_xfxx_simple, B_UID(944) };
+static const struct builtin B4_vec_vsubuwm = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vsubuwm:4", "*vsubuwm", CODE_FOR_xfxx_simple, B_UID(945) };
+static const struct builtin B3_vec_vsububm = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vsububm:3", "*vsububm", CODE_FOR_xfxx_simple, B_UID(946) };
+static const struct builtin B4_vec_vsububm = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vsububm:4", "*vsububm", CODE_FOR_xfxx_simple, B_UID(947) };
+static const struct builtin B5_vec_vsubuhm = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vsubuhm:5", "*vsubuhm", CODE_FOR_xfxx_simple, B_UID(948) };
+static const struct builtin B6_vec_vsubuhm = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vsubuhm:6", "*vsubuhm", CODE_FOR_xfxx_simple, B_UID(949) };
+static const struct builtin B5_vec_vsubuwm = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vsubuwm:5", "*vsubuwm", CODE_FOR_xfxx_simple, B_UID(950) };
+static const struct builtin B6_vec_vsubuwm = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vsubuwm:6", "*vsubuwm", CODE_FOR_xfxx_simple, B_UID(951) };
+static const struct builtin B5_vec_vsububm = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vsububm:5", "*vsububm", CODE_FOR_xfxx_simple, B_UID(952) };
+static const struct builtin B6_vec_vsububm = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vsububm:6", "*vsububm", CODE_FOR_xfxx_simple, B_UID(953) };
+static const struct builtin B_vec_vsubcuw = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsubcuw", "*vsubcuw", CODE_FOR_xfxx_simple, B_UID(954) };
+static const struct builtin B1_vec_vsubshs = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vsubshs:1", "*vsubshs", CODE_FOR_xfxx_simple, B_UID(955) };
+static const struct builtin B1_vec_vsubuhs = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vsubuhs:1", "*vsubuhs", CODE_FOR_xfxx_simple, B_UID(956) };
+static const struct builtin B1_vec_vsubsws = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vsubsws:1", "*vsubsws", CODE_FOR_xfxx_simple, B_UID(957) };
+static const struct builtin B1_vec_vsubuws = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vsubuws:1", "*vsubuws", CODE_FOR_xfxx_simple, B_UID(958) };
+static const struct builtin B1_vec_vsubsbs = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vsubsbs:1", "*vsubsbs", CODE_FOR_xfxx_simple, B_UID(959) };
+static const struct builtin B1_vec_vsububs = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vsububs:1", "*vsububs", CODE_FOR_xfxx_simple, B_UID(960) };
+static const struct builtin B2_vec_vsubshs = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vsubshs:2", "*vsubshs", CODE_FOR_xfxx_simple, B_UID(961) };
+static const struct builtin B3_vec_vsubshs = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vsubshs:3", "*vsubshs", CODE_FOR_xfxx_simple, B_UID(962) };
+static const struct builtin B2_vec_vsubsws = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vsubsws:2", "*vsubsws", CODE_FOR_xfxx_simple, B_UID(963) };
+static const struct builtin B3_vec_vsubsws = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vsubsws:3", "*vsubsws", CODE_FOR_xfxx_simple, B_UID(964) };
+static const struct builtin B2_vec_vsubsbs = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vsubsbs:2", "*vsubsbs", CODE_FOR_xfxx_simple, B_UID(965) };
+static const struct builtin B3_vec_vsubsbs = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vsubsbs:3", "*vsubsbs", CODE_FOR_xfxx_simple, B_UID(966) };
+static const struct builtin B2_vec_vsubuhs = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vsubuhs:2", "*vsubuhs", CODE_FOR_xfxx_simple, B_UID(967) };
+static const struct builtin B3_vec_vsubuhs = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vsubuhs:3", "*vsubuhs", CODE_FOR_xfxx_simple, B_UID(968) };
+static const struct builtin B2_vec_vsubuws = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vsubuws:2", "*vsubuws", CODE_FOR_xfxx_simple, B_UID(969) };
+static const struct builtin B3_vec_vsubuws = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vsubuws:3", "*vsubuws", CODE_FOR_xfxx_simple, B_UID(970) };
+static const struct builtin B2_vec_vsububs = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vsububs:2", "*vsububs", CODE_FOR_xfxx_simple, B_UID(971) };
+static const struct builtin B3_vec_vsububs = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vsububs:3", "*vsububs", CODE_FOR_xfxx_simple, B_UID(972) };
+static const struct builtin B_vec_vsum2sws = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsum2sws", "*vsum2sws", CODE_FOR_xfxx_complex, B_UID(973) };
+static const struct builtin B_vec_vsum4shs = { { &T_vec_s16, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsum4shs", "*vsum4shs", CODE_FOR_xfxx_complex, B_UID(974) };
+static const struct builtin B_vec_vsum4sbs = { { &T_vec_s8, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsum4sbs", "*vsum4sbs", CODE_FOR_xfxx_complex, B_UID(975) };
+static const struct builtin B_vec_vsum4ubs = { { &T_vec_u8, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_vsum4ubs", "*vsum4ubs", CODE_FOR_xfxx_complex, B_UID(976) };
+static const struct builtin B_vec_vsumsws = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_vsumsws", "*vsumsws", CODE_FOR_xfxx_complex, B_UID(977) };
+static const struct builtin B_vec_vrfiz = { { &T_vec_f32, NULL, NULL, }, "x", &T_vec_f32, 1, FALSE, FALSE, 0, "vec_vrfiz", "*vrfiz", CODE_FOR_xfx_fp, B_UID(978) };
+static const struct builtin B1_vec_unpack2sh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_unpack2sh:1", "*vmrghh", CODE_FOR_xfxx_perm, B_UID(979) };
+static const struct builtin B2_vec_unpack2sh = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_unpack2sh:2", "*vmrghb", CODE_FOR_xfxx_perm, B_UID(980) };
+static const struct builtin B1_vec_unpack2sl = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 0, "vec_unpack2sl:1", "*vmrglh", CODE_FOR_xfxx_perm, B_UID(981) };
+static const struct builtin B2_vec_unpack2sl = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 0, "vec_unpack2sl:2", "*vmrglb", CODE_FOR_xfxx_perm, B_UID(982) };
+static const struct builtin B1_vec_unpack2uh = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_unpack2uh:1", "*vmrghh", CODE_FOR_xfxx_perm, B_UID(983) };
+static const struct builtin B2_vec_unpack2uh = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_unpack2uh:2", "*vmrghb", CODE_FOR_xfxx_perm, B_UID(984) };
+static const struct builtin B1_vec_unpack2ul = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 0, "vec_unpack2ul:1", "*vmrglh", CODE_FOR_xfxx_perm, B_UID(985) };
+static const struct builtin B2_vec_unpack2ul = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 0, "vec_unpack2ul:2", "*vmrglb", CODE_FOR_xfxx_perm, B_UID(986) };
+static const struct builtin B1_vec_vupkhsh = { { &T_vec_b16, NULL, NULL, }, "x", &T_vec_b32, 1, FALSE, FALSE, 0, "vec_vupkhsh:1", "*vupkhsh", CODE_FOR_xfx_perm, B_UID(987) };
+static const struct builtin B1_vec_vupkhsb = { { &T_vec_b8, NULL, NULL, }, "x", &T_vec_b16, 1, FALSE, FALSE, 0, "vec_vupkhsb:1", "*vupkhsb", CODE_FOR_xfx_perm, B_UID(988) };
+static const struct builtin B_vec_vupkhpx = { { &T_vec_p16, NULL, NULL, }, "x", &T_vec_u32, 1, FALSE, FALSE, 0, "vec_vupkhpx", "*vupkhpx", CODE_FOR_xfx_perm, B_UID(989) };
+static const struct builtin B2_vec_vupkhsh = { { &T_vec_s16, NULL, NULL, }, "x", &T_vec_s32, 1, FALSE, FALSE, 0, "vec_vupkhsh:2", "*vupkhsh", CODE_FOR_xfx_perm, B_UID(990) };
+static const struct builtin B2_vec_vupkhsb = { { &T_vec_s8, NULL, NULL, }, "x", &T_vec_s16, 1, FALSE, FALSE, 0, "vec_vupkhsb:2", "*vupkhsb", CODE_FOR_xfx_perm, B_UID(991) };
+static const struct builtin B1_vec_vupklsh = { { &T_vec_b16, NULL, NULL, }, "x", &T_vec_b32, 1, FALSE, FALSE, 0, "vec_vupklsh:1", "*vupklsh", CODE_FOR_xfx_perm, B_UID(992) };
+static const struct builtin B1_vec_vupklsb = { { &T_vec_b8, NULL, NULL, }, "x", &T_vec_b16, 1, FALSE, FALSE, 0, "vec_vupklsb:1", "*vupklsb", CODE_FOR_xfx_perm, B_UID(993) };
+static const struct builtin B_vec_vupklpx = { { &T_vec_p16, NULL, NULL, }, "x", &T_vec_u32, 1, FALSE, FALSE, 0, "vec_vupklpx", "*vupklpx", CODE_FOR_xfx_perm, B_UID(994) };
+static const struct builtin B2_vec_vupklsh = { { &T_vec_s16, NULL, NULL, }, "x", &T_vec_s32, 1, FALSE, FALSE, 0, "vec_vupklsh:2", "*vupklsh", CODE_FOR_xfx_perm, B_UID(995) };
+static const struct builtin B2_vec_vupklsb = { { &T_vec_s8, NULL, NULL, }, "x", &T_vec_s16, 1, FALSE, FALSE, 0, "vec_vupklsb:2", "*vupklsb", CODE_FOR_xfx_perm, B_UID(996) };
+static const struct builtin B1_vec_vxor = { { &T_vec_b16, &T_vec_b16, NULL, }, "xx", &T_vec_b16, 2, FALSE, FALSE, 1, "vec_vxor:1", "*vxor", CODE_FOR_xfxx_simple, B_UID(997) };
+static const struct builtin B2_vec_vxor = { { &T_vec_b16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vxor:2", "*vxor", CODE_FOR_xfxx_simple, B_UID(998) };
+static const struct builtin B3_vec_vxor = { { &T_vec_b16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vxor:3", "*vxor", CODE_FOR_xfxx_simple, B_UID(999) };
+static const struct builtin B4_vec_vxor = { { &T_vec_b32, &T_vec_b32, NULL, }, "xx", &T_vec_b32, 2, FALSE, FALSE, 1, "vec_vxor:4", "*vxor", CODE_FOR_xfxx_simple, B_UID(1000) };
+static const struct builtin B5_vec_vxor = { { &T_vec_b32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 1, "vec_vxor:5", "*vxor", CODE_FOR_xfxx_simple, B_UID(1001) };
+static const struct builtin B6_vec_vxor = { { &T_vec_b32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vxor:6", "*vxor", CODE_FOR_xfxx_simple, B_UID(1002) };
+static const struct builtin B7_vec_vxor = { { &T_vec_b32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vxor:7", "*vxor", CODE_FOR_xfxx_simple, B_UID(1003) };
+static const struct builtin B8_vec_vxor = { { &T_vec_b8, &T_vec_b8, NULL, }, "xx", &T_vec_b8, 2, FALSE, FALSE, 1, "vec_vxor:8", "*vxor", CODE_FOR_xfxx_simple, B_UID(1004) };
+static const struct builtin B9_vec_vxor = { { &T_vec_b8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vxor:9", "*vxor", CODE_FOR_xfxx_simple, B_UID(1005) };
+static const struct builtin B10_vec_vxor = { { &T_vec_b8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vxor:10", "*vxor", CODE_FOR_xfxx_simple, B_UID(1006) };
+static const struct builtin B11_vec_vxor = { { &T_vec_f32, &T_vec_b32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 1, "vec_vxor:11", "*vxor", CODE_FOR_xfxx_simple, B_UID(1007) };
+static const struct builtin B12_vec_vxor = { { &T_vec_f32, &T_vec_f32, NULL, }, "xx", &T_vec_f32, 2, FALSE, FALSE, 1, "vec_vxor:12", "*vxor", CODE_FOR_xfxx_simple, B_UID(1008) };
+static const struct builtin B13_vec_vxor = { { &T_vec_s16, &T_vec_b16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vxor:13", "*vxor", CODE_FOR_xfxx_simple, B_UID(1009) };
+static const struct builtin B14_vec_vxor = { { &T_vec_s16, &T_vec_s16, NULL, }, "xx", &T_vec_s16, 2, FALSE, FALSE, 1, "vec_vxor:14", "*vxor", CODE_FOR_xfxx_simple, B_UID(1010) };
+static const struct builtin B15_vec_vxor = { { &T_vec_s32, &T_vec_b32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vxor:15", "*vxor", CODE_FOR_xfxx_simple, B_UID(1011) };
+static const struct builtin B16_vec_vxor = { { &T_vec_s32, &T_vec_s32, NULL, }, "xx", &T_vec_s32, 2, FALSE, FALSE, 1, "vec_vxor:16", "*vxor", CODE_FOR_xfxx_simple, B_UID(1012) };
+static const struct builtin B17_vec_vxor = { { &T_vec_s8, &T_vec_b8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vxor:17", "*vxor", CODE_FOR_xfxx_simple, B_UID(1013) };
+static const struct builtin B18_vec_vxor = { { &T_vec_s8, &T_vec_s8, NULL, }, "xx", &T_vec_s8, 2, FALSE, FALSE, 1, "vec_vxor:18", "*vxor", CODE_FOR_xfxx_simple, B_UID(1014) };
+static const struct builtin B19_vec_vxor = { { &T_vec_u16, &T_vec_b16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vxor:19", "*vxor", CODE_FOR_xfxx_simple, B_UID(1015) };
+static const struct builtin B20_vec_vxor = { { &T_vec_u16, &T_vec_u16, NULL, }, "xx", &T_vec_u16, 2, FALSE, FALSE, 1, "vec_vxor:20", "*vxor", CODE_FOR_xfxx_simple, B_UID(1016) };
+static const struct builtin B21_vec_vxor = { { &T_vec_u32, &T_vec_b32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vxor:21", "*vxor", CODE_FOR_xfxx_simple, B_UID(1017) };
+static const struct builtin B22_vec_vxor = { { &T_vec_u32, &T_vec_u32, NULL, }, "xx", &T_vec_u32, 2, FALSE, FALSE, 1, "vec_vxor:22", "*vxor", CODE_FOR_xfxx_simple, B_UID(1018) };
+static const struct builtin B23_vec_vxor = { { &T_vec_u8, &T_vec_b8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vxor:23", "*vxor", CODE_FOR_xfxx_simple, B_UID(1019) };
+static const struct builtin B24_vec_vxor = { { &T_vec_u8, &T_vec_u8, NULL, }, "xx", &T_vec_u8, 2, FALSE, FALSE, 1, "vec_vxor:24", "*vxor", CODE_FOR_xfxx_simple, B_UID(1020) };
+#define LAST_B_UID B_UID(1021)
+
+const struct builtin * const Builtin[] = {
+ &B1_vec_abs,
+ &B2_vec_abs,
+ &B3_vec_abs,
+ &B4_vec_abs,
+ &B1_vec_abss,
+ &B2_vec_abss,
+ &B3_vec_abss,
+ &B1_vec_vadduhm,
+ &B2_vec_vadduhm,
+ &B1_vec_vadduwm,
+ &B2_vec_vadduwm,
+ &B1_vec_vaddubm,
+ &B2_vec_vaddubm,
+ &B_vec_vaddfp,
+ &B3_vec_vadduhm,
+ &B4_vec_vadduhm,
+ &B3_vec_vadduwm,
+ &B4_vec_vadduwm,
+ &B3_vec_vaddubm,
+ &B4_vec_vaddubm,
+ &B5_vec_vadduhm,
+ &B6_vec_vadduhm,
+ &B5_vec_vadduwm,
+ &B6_vec_vadduwm,
+ &B5_vec_vaddubm,
+ &B6_vec_vaddubm,
+ &B_vec_vaddcuw,
+ &B1_vec_vaddshs,
+ &B1_vec_vadduhs,
+ &B1_vec_vaddsws,
+ &B1_vec_vadduws,
+ &B1_vec_vaddsbs,
+ &B1_vec_vaddubs,
+ &B2_vec_vaddshs,
+ &B3_vec_vaddshs,
+ &B2_vec_vaddsws,
+ &B3_vec_vaddsws,
+ &B2_vec_vaddsbs,
+ &B3_vec_vaddsbs,
+ &B2_vec_vadduhs,
+ &B3_vec_vadduhs,
+ &B2_vec_vadduws,
+ &B3_vec_vadduws,
+ &B2_vec_vaddubs,
+ &B3_vec_vaddubs,
+ &B1_vec_all_eq,
+ &B2_vec_all_eq,
+ &B3_vec_all_eq,
+ &B4_vec_all_eq,
+ &B5_vec_all_eq,
+ &B6_vec_all_eq,
+ &B7_vec_all_eq,
+ &B8_vec_all_eq,
+ &B9_vec_all_eq,
+ &B10_vec_all_eq,
+ &B11_vec_all_eq,
+ &B12_vec_all_eq,
+ &B13_vec_all_eq,
+ &B14_vec_all_eq,
+ &B15_vec_all_eq,
+ &B16_vec_all_eq,
+ &B17_vec_all_eq,
+ &B18_vec_all_eq,
+ &B19_vec_all_eq,
+ &B20_vec_all_eq,
+ &B21_vec_all_eq,
+ &B22_vec_all_eq,
+ &B23_vec_all_eq,
+ &B1_vec_all_ge,
+ &B2_vec_all_ge,
+ &B3_vec_all_ge,
+ &B4_vec_all_ge,
+ &B5_vec_all_ge,
+ &B6_vec_all_ge,
+ &B7_vec_all_ge,
+ &B8_vec_all_ge,
+ &B9_vec_all_ge,
+ &B10_vec_all_ge,
+ &B11_vec_all_ge,
+ &B12_vec_all_ge,
+ &B13_vec_all_ge,
+ &B14_vec_all_ge,
+ &B15_vec_all_ge,
+ &B16_vec_all_ge,
+ &B17_vec_all_ge,
+ &B18_vec_all_ge,
+ &B19_vec_all_ge,
+ &B1_vec_all_gt,
+ &B2_vec_all_gt,
+ &B3_vec_all_gt,
+ &B4_vec_all_gt,
+ &B5_vec_all_gt,
+ &B6_vec_all_gt,
+ &B7_vec_all_gt,
+ &B8_vec_all_gt,
+ &B9_vec_all_gt,
+ &B10_vec_all_gt,
+ &B11_vec_all_gt,
+ &B12_vec_all_gt,
+ &B13_vec_all_gt,
+ &B14_vec_all_gt,
+ &B15_vec_all_gt,
+ &B16_vec_all_gt,
+ &B17_vec_all_gt,
+ &B18_vec_all_gt,
+ &B19_vec_all_gt,
+ &B_vec_all_in,
+ &B1_vec_all_le,
+ &B2_vec_all_le,
+ &B3_vec_all_le,
+ &B4_vec_all_le,
+ &B5_vec_all_le,
+ &B6_vec_all_le,
+ &B7_vec_all_le,
+ &B8_vec_all_le,
+ &B9_vec_all_le,
+ &B10_vec_all_le,
+ &B11_vec_all_le,
+ &B12_vec_all_le,
+ &B13_vec_all_le,
+ &B14_vec_all_le,
+ &B15_vec_all_le,
+ &B16_vec_all_le,
+ &B17_vec_all_le,
+ &B18_vec_all_le,
+ &B19_vec_all_le,
+ &B1_vec_all_lt,
+ &B2_vec_all_lt,
+ &B3_vec_all_lt,
+ &B4_vec_all_lt,
+ &B5_vec_all_lt,
+ &B6_vec_all_lt,
+ &B7_vec_all_lt,
+ &B8_vec_all_lt,
+ &B9_vec_all_lt,
+ &B10_vec_all_lt,
+ &B11_vec_all_lt,
+ &B12_vec_all_lt,
+ &B13_vec_all_lt,
+ &B14_vec_all_lt,
+ &B15_vec_all_lt,
+ &B16_vec_all_lt,
+ &B17_vec_all_lt,
+ &B18_vec_all_lt,
+ &B19_vec_all_lt,
+ &B_vec_all_nan,
+ &B1_vec_all_ne,
+ &B2_vec_all_ne,
+ &B3_vec_all_ne,
+ &B4_vec_all_ne,
+ &B5_vec_all_ne,
+ &B6_vec_all_ne,
+ &B7_vec_all_ne,
+ &B8_vec_all_ne,
+ &B9_vec_all_ne,
+ &B10_vec_all_ne,
+ &B11_vec_all_ne,
+ &B12_vec_all_ne,
+ &B13_vec_all_ne,
+ &B14_vec_all_ne,
+ &B15_vec_all_ne,
+ &B16_vec_all_ne,
+ &B17_vec_all_ne,
+ &B18_vec_all_ne,
+ &B19_vec_all_ne,
+ &B20_vec_all_ne,
+ &B21_vec_all_ne,
+ &B22_vec_all_ne,
+ &B23_vec_all_ne,
+ &B_vec_all_nge,
+ &B_vec_all_ngt,
+ &B_vec_all_nle,
+ &B_vec_all_nlt,
+ &B_vec_all_numeric,
+ &B1_vec_vand,
+ &B2_vec_vand,
+ &B3_vec_vand,
+ &B4_vec_vand,
+ &B5_vec_vand,
+ &B6_vec_vand,
+ &B7_vec_vand,
+ &B8_vec_vand,
+ &B9_vec_vand,
+ &B10_vec_vand,
+ &B11_vec_vand,
+ &B12_vec_vand,
+ &B13_vec_vand,
+ &B14_vec_vand,
+ &B15_vec_vand,
+ &B16_vec_vand,
+ &B17_vec_vand,
+ &B18_vec_vand,
+ &B19_vec_vand,
+ &B20_vec_vand,
+ &B21_vec_vand,
+ &B22_vec_vand,
+ &B23_vec_vand,
+ &B24_vec_vand,
+ &B1_vec_vandc,
+ &B2_vec_vandc,
+ &B3_vec_vandc,
+ &B4_vec_vandc,
+ &B5_vec_vandc,
+ &B6_vec_vandc,
+ &B7_vec_vandc,
+ &B8_vec_vandc,
+ &B9_vec_vandc,
+ &B10_vec_vandc,
+ &B11_vec_vandc,
+ &B12_vec_vandc,
+ &B13_vec_vandc,
+ &B14_vec_vandc,
+ &B15_vec_vandc,
+ &B16_vec_vandc,
+ &B17_vec_vandc,
+ &B18_vec_vandc,
+ &B19_vec_vandc,
+ &B20_vec_vandc,
+ &B21_vec_vandc,
+ &B22_vec_vandc,
+ &B23_vec_vandc,
+ &B24_vec_vandc,
+ &B1_vec_any_eq,
+ &B2_vec_any_eq,
+ &B3_vec_any_eq,
+ &B4_vec_any_eq,
+ &B5_vec_any_eq,
+ &B6_vec_any_eq,
+ &B7_vec_any_eq,
+ &B8_vec_any_eq,
+ &B9_vec_any_eq,
+ &B10_vec_any_eq,
+ &B11_vec_any_eq,
+ &B12_vec_any_eq,
+ &B13_vec_any_eq,
+ &B14_vec_any_eq,
+ &B15_vec_any_eq,
+ &B16_vec_any_eq,
+ &B17_vec_any_eq,
+ &B18_vec_any_eq,
+ &B19_vec_any_eq,
+ &B20_vec_any_eq,
+ &B21_vec_any_eq,
+ &B22_vec_any_eq,
+ &B23_vec_any_eq,
+ &B1_vec_any_ge,
+ &B2_vec_any_ge,
+ &B3_vec_any_ge,
+ &B4_vec_any_ge,
+ &B5_vec_any_ge,
+ &B6_vec_any_ge,
+ &B7_vec_any_ge,
+ &B8_vec_any_ge,
+ &B9_vec_any_ge,
+ &B10_vec_any_ge,
+ &B11_vec_any_ge,
+ &B12_vec_any_ge,
+ &B13_vec_any_ge,
+ &B14_vec_any_ge,
+ &B15_vec_any_ge,
+ &B16_vec_any_ge,
+ &B17_vec_any_ge,
+ &B18_vec_any_ge,
+ &B19_vec_any_ge,
+ &B1_vec_any_gt,
+ &B2_vec_any_gt,
+ &B3_vec_any_gt,
+ &B4_vec_any_gt,
+ &B5_vec_any_gt,
+ &B6_vec_any_gt,
+ &B7_vec_any_gt,
+ &B8_vec_any_gt,
+ &B9_vec_any_gt,
+ &B10_vec_any_gt,
+ &B11_vec_any_gt,
+ &B12_vec_any_gt,
+ &B13_vec_any_gt,
+ &B14_vec_any_gt,
+ &B15_vec_any_gt,
+ &B16_vec_any_gt,
+ &B17_vec_any_gt,
+ &B18_vec_any_gt,
+ &B19_vec_any_gt,
+ &B1_vec_any_le,
+ &B2_vec_any_le,
+ &B3_vec_any_le,
+ &B4_vec_any_le,
+ &B5_vec_any_le,
+ &B6_vec_any_le,
+ &B7_vec_any_le,
+ &B8_vec_any_le,
+ &B9_vec_any_le,
+ &B10_vec_any_le,
+ &B11_vec_any_le,
+ &B12_vec_any_le,
+ &B13_vec_any_le,
+ &B14_vec_any_le,
+ &B15_vec_any_le,
+ &B16_vec_any_le,
+ &B17_vec_any_le,
+ &B18_vec_any_le,
+ &B19_vec_any_le,
+ &B1_vec_any_lt,
+ &B2_vec_any_lt,
+ &B3_vec_any_lt,
+ &B4_vec_any_lt,
+ &B5_vec_any_lt,
+ &B6_vec_any_lt,
+ &B7_vec_any_lt,
+ &B8_vec_any_lt,
+ &B9_vec_any_lt,
+ &B10_vec_any_lt,
+ &B11_vec_any_lt,
+ &B12_vec_any_lt,
+ &B13_vec_any_lt,
+ &B14_vec_any_lt,
+ &B15_vec_any_lt,
+ &B16_vec_any_lt,
+ &B17_vec_any_lt,
+ &B18_vec_any_lt,
+ &B19_vec_any_lt,
+ &B_vec_any_nan,
+ &B1_vec_any_ne,
+ &B2_vec_any_ne,
+ &B3_vec_any_ne,
+ &B4_vec_any_ne,
+ &B5_vec_any_ne,
+ &B6_vec_any_ne,
+ &B7_vec_any_ne,
+ &B8_vec_any_ne,
+ &B9_vec_any_ne,
+ &B10_vec_any_ne,
+ &B11_vec_any_ne,
+ &B12_vec_any_ne,
+ &B13_vec_any_ne,
+ &B14_vec_any_ne,
+ &B15_vec_any_ne,
+ &B16_vec_any_ne,
+ &B17_vec_any_ne,
+ &B18_vec_any_ne,
+ &B19_vec_any_ne,
+ &B20_vec_any_ne,
+ &B21_vec_any_ne,
+ &B22_vec_any_ne,
+ &B23_vec_any_ne,
+ &B_vec_any_nge,
+ &B_vec_any_ngt,
+ &B_vec_any_nle,
+ &B_vec_any_nlt,
+ &B_vec_any_numeric,
+ &B_vec_any_out,
+ &B_vec_vavgsh,
+ &B_vec_vavgsw,
+ &B_vec_vavgsb,
+ &B_vec_vavguh,
+ &B_vec_vavguw,
+ &B_vec_vavgub,
+ &B_vec_vrfip,
+ &B_vec_vcmpbfp,
+ &B_vec_vcmpeqfp,
+ &B1_vec_vcmpequh,
+ &B1_vec_vcmpequw,
+ &B1_vec_vcmpequb,
+ &B2_vec_vcmpequh,
+ &B2_vec_vcmpequw,
+ &B2_vec_vcmpequb,
+ &B_vec_vcmpgefp,
+ &B_vec_vcmpgtfp,
+ &B_vec_vcmpgtsh,
+ &B_vec_vcmpgtsw,
+ &B_vec_vcmpgtsb,
+ &B_vec_vcmpgtuh,
+ &B_vec_vcmpgtuw,
+ &B_vec_vcmpgtub,
+ &B_vec_cmple,
+ &B1_vec_cmplt,
+ &B2_vec_cmplt,
+ &B3_vec_cmplt,
+ &B4_vec_cmplt,
+ &B5_vec_cmplt,
+ &B6_vec_cmplt,
+ &B7_vec_cmplt,
+ &B_vec_vcfsx,
+ &B_vec_vcfux,
+ &B_vec_vctsxs,
+ &B_vec_vctuxs,
+ &B_vec_dss,
+ &B_vec_dssall,
+ &B1_vec_dst,
+ &B2_vec_dst,
+ &B3_vec_dst,
+ &B4_vec_dst,
+ &B5_vec_dst,
+ &B6_vec_dst,
+ &B7_vec_dst,
+ &B8_vec_dst,
+ &B9_vec_dst,
+ &B10_vec_dst,
+ &B11_vec_dst,
+ &B12_vec_dst,
+ &B13_vec_dst,
+ &B14_vec_dst,
+ &B15_vec_dst,
+ &B16_vec_dst,
+ &B17_vec_dst,
+ &B18_vec_dst,
+ &B19_vec_dst,
+ &B20_vec_dst,
+ &B1_vec_dstst,
+ &B2_vec_dstst,
+ &B3_vec_dstst,
+ &B4_vec_dstst,
+ &B5_vec_dstst,
+ &B6_vec_dstst,
+ &B7_vec_dstst,
+ &B8_vec_dstst,
+ &B9_vec_dstst,
+ &B10_vec_dstst,
+ &B11_vec_dstst,
+ &B12_vec_dstst,
+ &B13_vec_dstst,
+ &B14_vec_dstst,
+ &B15_vec_dstst,
+ &B16_vec_dstst,
+ &B17_vec_dstst,
+ &B18_vec_dstst,
+ &B19_vec_dstst,
+ &B20_vec_dstst,
+ &B1_vec_dststt,
+ &B2_vec_dststt,
+ &B3_vec_dststt,
+ &B4_vec_dststt,
+ &B5_vec_dststt,
+ &B6_vec_dststt,
+ &B7_vec_dststt,
+ &B8_vec_dststt,
+ &B9_vec_dststt,
+ &B10_vec_dststt,
+ &B11_vec_dststt,
+ &B12_vec_dststt,
+ &B13_vec_dststt,
+ &B14_vec_dststt,
+ &B15_vec_dststt,
+ &B16_vec_dststt,
+ &B17_vec_dststt,
+ &B18_vec_dststt,
+ &B19_vec_dststt,
+ &B20_vec_dststt,
+ &B1_vec_dstt,
+ &B2_vec_dstt,
+ &B3_vec_dstt,
+ &B4_vec_dstt,
+ &B5_vec_dstt,
+ &B6_vec_dstt,
+ &B7_vec_dstt,
+ &B8_vec_dstt,
+ &B9_vec_dstt,
+ &B10_vec_dstt,
+ &B11_vec_dstt,
+ &B12_vec_dstt,
+ &B13_vec_dstt,
+ &B14_vec_dstt,
+ &B15_vec_dstt,
+ &B16_vec_dstt,
+ &B17_vec_dstt,
+ &B18_vec_dstt,
+ &B19_vec_dstt,
+ &B20_vec_dstt,
+ &B_vec_vexptefp,
+ &B_vec_vrfim,
+ &B1_vec_lvx,
+ &B2_vec_lvx,
+ &B3_vec_lvx,
+ &B4_vec_lvx,
+ &B5_vec_lvx,
+ &B6_vec_lvx,
+ &B7_vec_lvx,
+ &B8_vec_lvx,
+ &B9_vec_lvx,
+ &B10_vec_lvx,
+ &B11_vec_lvx,
+ &B12_vec_lvx,
+ &B13_vec_lvx,
+ &B14_vec_lvx,
+ &B15_vec_lvx,
+ &B16_vec_lvx,
+ &B17_vec_lvx,
+ &B18_vec_lvx,
+ &B19_vec_lvx,
+ &B20_vec_lvx,
+ &B1_vec_lvewx,
+ &B2_vec_lvewx,
+ &B3_vec_lvewx,
+ &B1_vec_lvehx,
+ &B1_vec_lvebx,
+ &B2_vec_lvebx,
+ &B4_vec_lvewx,
+ &B5_vec_lvewx,
+ &B2_vec_lvehx,
+ &B1_vec_lvxl,
+ &B2_vec_lvxl,
+ &B3_vec_lvxl,
+ &B4_vec_lvxl,
+ &B5_vec_lvxl,
+ &B6_vec_lvxl,
+ &B7_vec_lvxl,
+ &B8_vec_lvxl,
+ &B9_vec_lvxl,
+ &B10_vec_lvxl,
+ &B11_vec_lvxl,
+ &B12_vec_lvxl,
+ &B13_vec_lvxl,
+ &B14_vec_lvxl,
+ &B15_vec_lvxl,
+ &B16_vec_lvxl,
+ &B17_vec_lvxl,
+ &B18_vec_lvxl,
+ &B19_vec_lvxl,
+ &B20_vec_lvxl,
+ &B_vec_vlogefp,
+ &B1_vec_lvsl,
+ &B2_vec_lvsl,
+ &B3_vec_lvsl,
+ &B4_vec_lvsl,
+ &B5_vec_lvsl,
+ &B6_vec_lvsl,
+ &B7_vec_lvsl,
+ &B8_vec_lvsl,
+ &B9_vec_lvsl,
+ &B1_vec_lvsr,
+ &B2_vec_lvsr,
+ &B3_vec_lvsr,
+ &B4_vec_lvsr,
+ &B5_vec_lvsr,
+ &B6_vec_lvsr,
+ &B7_vec_lvsr,
+ &B8_vec_lvsr,
+ &B9_vec_lvsr,
+ &B_vec_vmaddfp,
+ &B_vec_vmhaddshs,
+ &B1_vec_vmaxsh,
+ &B1_vec_vmaxuh,
+ &B1_vec_vmaxsw,
+ &B1_vec_vmaxuw,
+ &B1_vec_vmaxsb,
+ &B1_vec_vmaxub,
+ &B_vec_vmaxfp,
+ &B2_vec_vmaxsh,
+ &B3_vec_vmaxsh,
+ &B2_vec_vmaxsw,
+ &B3_vec_vmaxsw,
+ &B2_vec_vmaxsb,
+ &B3_vec_vmaxsb,
+ &B2_vec_vmaxuh,
+ &B3_vec_vmaxuh,
+ &B2_vec_vmaxuw,
+ &B3_vec_vmaxuw,
+ &B2_vec_vmaxub,
+ &B3_vec_vmaxub,
+ &B1_vec_vmrghh,
+ &B1_vec_vmrghw,
+ &B1_vec_vmrghb,
+ &B2_vec_vmrghw,
+ &B2_vec_vmrghh,
+ &B3_vec_vmrghh,
+ &B3_vec_vmrghw,
+ &B2_vec_vmrghb,
+ &B4_vec_vmrghh,
+ &B4_vec_vmrghw,
+ &B3_vec_vmrghb,
+ &B1_vec_vmrglh,
+ &B1_vec_vmrglw,
+ &B1_vec_vmrglb,
+ &B2_vec_vmrglw,
+ &B2_vec_vmrglh,
+ &B3_vec_vmrglh,
+ &B3_vec_vmrglw,
+ &B2_vec_vmrglb,
+ &B4_vec_vmrglh,
+ &B4_vec_vmrglw,
+ &B3_vec_vmrglb,
+ &B_vec_mfvscr,
+ &B1_vec_vminsh,
+ &B1_vec_vminuh,
+ &B1_vec_vminsw,
+ &B1_vec_vminuw,
+ &B1_vec_vminsb,
+ &B1_vec_vminub,
+ &B_vec_vminfp,
+ &B2_vec_vminsh,
+ &B3_vec_vminsh,
+ &B2_vec_vminsw,
+ &B3_vec_vminsw,
+ &B2_vec_vminsb,
+ &B3_vec_vminsb,
+ &B2_vec_vminuh,
+ &B3_vec_vminuh,
+ &B2_vec_vminuw,
+ &B3_vec_vminuw,
+ &B2_vec_vminub,
+ &B3_vec_vminub,
+ &B1_vec_vmladduhm,
+ &B2_vec_vmladduhm,
+ &B3_vec_vmladduhm,
+ &B4_vec_vmladduhm,
+ &B_vec_vmhraddshs,
+ &B_vec_vmsumshm,
+ &B_vec_vmsummbm,
+ &B_vec_vmsumuhm,
+ &B_vec_vmsumubm,
+ &B_vec_vmsumshs,
+ &B_vec_vmsumuhs,
+ &B1_vec_mtvscr,
+ &B2_vec_mtvscr,
+ &B3_vec_mtvscr,
+ &B4_vec_mtvscr,
+ &B5_vec_mtvscr,
+ &B6_vec_mtvscr,
+ &B7_vec_mtvscr,
+ &B8_vec_mtvscr,
+ &B9_vec_mtvscr,
+ &B10_vec_mtvscr,
+ &B_vec_vmulesh,
+ &B_vec_vmulesb,
+ &B_vec_vmuleuh,
+ &B_vec_vmuleub,
+ &B_vec_vmulosh,
+ &B_vec_vmulosb,
+ &B_vec_vmulouh,
+ &B_vec_vmuloub,
+ &B_vec_vnmsubfp,
+ &B1_vec_vnor,
+ &B2_vec_vnor,
+ &B3_vec_vnor,
+ &B4_vec_vnor,
+ &B5_vec_vnor,
+ &B6_vec_vnor,
+ &B7_vec_vnor,
+ &B8_vec_vnor,
+ &B9_vec_vnor,
+ &B10_vec_vnor,
+ &B1_vec_vor,
+ &B2_vec_vor,
+ &B3_vec_vor,
+ &B4_vec_vor,
+ &B5_vec_vor,
+ &B6_vec_vor,
+ &B7_vec_vor,
+ &B8_vec_vor,
+ &B9_vec_vor,
+ &B10_vec_vor,
+ &B11_vec_vor,
+ &B12_vec_vor,
+ &B13_vec_vor,
+ &B14_vec_vor,
+ &B15_vec_vor,
+ &B16_vec_vor,
+ &B17_vec_vor,
+ &B18_vec_vor,
+ &B19_vec_vor,
+ &B20_vec_vor,
+ &B21_vec_vor,
+ &B22_vec_vor,
+ &B23_vec_vor,
+ &B24_vec_vor,
+ &B1_vec_vpkuhum,
+ &B1_vec_vpkuwum,
+ &B2_vec_vpkuhum,
+ &B2_vec_vpkuwum,
+ &B3_vec_vpkuhum,
+ &B3_vec_vpkuwum,
+ &B_vec_vpkpx,
+ &B_vec_vpkshss,
+ &B_vec_vpkswss,
+ &B_vec_vpkuhus,
+ &B_vec_vpkuwus,
+ &B_vec_vpkshus,
+ &B_vec_vpkswus,
+ &B1_vec_vperm,
+ &B2_vec_vperm,
+ &B3_vec_vperm,
+ &B4_vec_vperm,
+ &B5_vec_vperm,
+ &B6_vec_vperm,
+ &B7_vec_vperm,
+ &B8_vec_vperm,
+ &B9_vec_vperm,
+ &B10_vec_vperm,
+ &B11_vec_vperm,
+ &B_vec_vrefp,
+ &B1_vec_vrlh,
+ &B1_vec_vrlw,
+ &B1_vec_vrlb,
+ &B2_vec_vrlh,
+ &B2_vec_vrlw,
+ &B2_vec_vrlb,
+ &B_vec_vrfin,
+ &B_vec_vrsqrtefp,
+ &B1_vec_vsel,
+ &B2_vec_vsel,
+ &B3_vec_vsel,
+ &B4_vec_vsel,
+ &B5_vec_vsel,
+ &B6_vec_vsel,
+ &B7_vec_vsel,
+ &B8_vec_vsel,
+ &B9_vec_vsel,
+ &B10_vec_vsel,
+ &B11_vec_vsel,
+ &B12_vec_vsel,
+ &B13_vec_vsel,
+ &B14_vec_vsel,
+ &B15_vec_vsel,
+ &B16_vec_vsel,
+ &B17_vec_vsel,
+ &B18_vec_vsel,
+ &B19_vec_vsel,
+ &B20_vec_vsel,
+ &B1_vec_vslh,
+ &B1_vec_vslw,
+ &B1_vec_vslb,
+ &B2_vec_vslh,
+ &B2_vec_vslw,
+ &B2_vec_vslb,
+ &B1_vec_vsldoi,
+ &B2_vec_vsldoi,
+ &B3_vec_vsldoi,
+ &B4_vec_vsldoi,
+ &B5_vec_vsldoi,
+ &B6_vec_vsldoi,
+ &B7_vec_vsldoi,
+ &B8_vec_vsldoi,
+ &B9_vec_vsldoi,
+ &B10_vec_vsldoi,
+ &B11_vec_vsldoi,
+ &B1_vec_vsl,
+ &B2_vec_vsl,
+ &B3_vec_vsl,
+ &B4_vec_vsl,
+ &B5_vec_vsl,
+ &B6_vec_vsl,
+ &B7_vec_vsl,
+ &B8_vec_vsl,
+ &B9_vec_vsl,
+ &B10_vec_vsl,
+ &B11_vec_vsl,
+ &B12_vec_vsl,
+ &B13_vec_vsl,
+ &B14_vec_vsl,
+ &B15_vec_vsl,
+ &B16_vec_vsl,
+ &B17_vec_vsl,
+ &B18_vec_vsl,
+ &B19_vec_vsl,
+ &B20_vec_vsl,
+ &B21_vec_vsl,
+ &B22_vec_vsl,
+ &B23_vec_vsl,
+ &B24_vec_vsl,
+ &B25_vec_vsl,
+ &B26_vec_vsl,
+ &B27_vec_vsl,
+ &B28_vec_vsl,
+ &B29_vec_vsl,
+ &B30_vec_vsl,
+ &B1_vec_vslo,
+ &B2_vec_vslo,
+ &B3_vec_vslo,
+ &B4_vec_vslo,
+ &B5_vec_vslo,
+ &B6_vec_vslo,
+ &B7_vec_vslo,
+ &B8_vec_vslo,
+ &B9_vec_vslo,
+ &B10_vec_vslo,
+ &B11_vec_vslo,
+ &B12_vec_vslo,
+ &B13_vec_vslo,
+ &B14_vec_vslo,
+ &B15_vec_vslo,
+ &B16_vec_vslo,
+ &B1_vec_vsplth,
+ &B1_vec_vspltw,
+ &B1_vec_vspltb,
+ &B2_vec_vspltw,
+ &B2_vec_vsplth,
+ &B3_vec_vsplth,
+ &B3_vec_vspltw,
+ &B2_vec_vspltb,
+ &B4_vec_vsplth,
+ &B4_vec_vspltw,
+ &B3_vec_vspltb,
+ &B_vec_vspltish,
+ &B_vec_vspltisw,
+ &B_vec_vspltisb,
+ &B_vec_splat_u16,
+ &B_vec_splat_u32,
+ &B_vec_splat_u8,
+ &B1_vec_vsrh,
+ &B1_vec_vsrw,
+ &B1_vec_vsrb,
+ &B2_vec_vsrh,
+ &B2_vec_vsrw,
+ &B2_vec_vsrb,
+ &B1_vec_vsrah,
+ &B1_vec_vsraw,
+ &B1_vec_vsrab,
+ &B2_vec_vsrah,
+ &B2_vec_vsraw,
+ &B2_vec_vsrab,
+ &B1_vec_vsr,
+ &B2_vec_vsr,
+ &B3_vec_vsr,
+ &B4_vec_vsr,
+ &B5_vec_vsr,
+ &B6_vec_vsr,
+ &B7_vec_vsr,
+ &B8_vec_vsr,
+ &B9_vec_vsr,
+ &B10_vec_vsr,
+ &B11_vec_vsr,
+ &B12_vec_vsr,
+ &B13_vec_vsr,
+ &B14_vec_vsr,
+ &B15_vec_vsr,
+ &B16_vec_vsr,
+ &B17_vec_vsr,
+ &B18_vec_vsr,
+ &B19_vec_vsr,
+ &B20_vec_vsr,
+ &B21_vec_vsr,
+ &B22_vec_vsr,
+ &B23_vec_vsr,
+ &B24_vec_vsr,
+ &B25_vec_vsr,
+ &B26_vec_vsr,
+ &B27_vec_vsr,
+ &B28_vec_vsr,
+ &B29_vec_vsr,
+ &B30_vec_vsr,
+ &B1_vec_vsro,
+ &B2_vec_vsro,
+ &B3_vec_vsro,
+ &B4_vec_vsro,
+ &B5_vec_vsro,
+ &B6_vec_vsro,
+ &B7_vec_vsro,
+ &B8_vec_vsro,
+ &B9_vec_vsro,
+ &B10_vec_vsro,
+ &B11_vec_vsro,
+ &B12_vec_vsro,
+ &B13_vec_vsro,
+ &B14_vec_vsro,
+ &B15_vec_vsro,
+ &B16_vec_vsro,
+ &B1_vec_stvx,
+ &B2_vec_stvx,
+ &B3_vec_stvx,
+ &B4_vec_stvx,
+ &B5_vec_stvx,
+ &B6_vec_stvx,
+ &B7_vec_stvx,
+ &B8_vec_stvx,
+ &B9_vec_stvx,
+ &B10_vec_stvx,
+ &B11_vec_stvx,
+ &B12_vec_stvx,
+ &B13_vec_stvx,
+ &B14_vec_stvx,
+ &B15_vec_stvx,
+ &B16_vec_stvx,
+ &B17_vec_stvx,
+ &B18_vec_stvx,
+ &B19_vec_stvx,
+ &B20_vec_stvx,
+ &B21_vec_stvx,
+ &B22_vec_stvx,
+ &B23_vec_stvx,
+ &B24_vec_stvx,
+ &B25_vec_stvx,
+ &B26_vec_stvx,
+ &B27_vec_stvx,
+ &B28_vec_stvx,
+ &B29_vec_stvx,
+ &B30_vec_stvx,
+ &B1_vec_stvebx,
+ &B2_vec_stvebx,
+ &B1_vec_stvewx,
+ &B2_vec_stvewx,
+ &B3_vec_stvewx,
+ &B4_vec_stvewx,
+ &B3_vec_stvebx,
+ &B4_vec_stvebx,
+ &B5_vec_stvewx,
+ &B1_vec_stvehx,
+ &B2_vec_stvehx,
+ &B3_vec_stvehx,
+ &B6_vec_stvewx,
+ &B7_vec_stvewx,
+ &B5_vec_stvebx,
+ &B4_vec_stvehx,
+ &B8_vec_stvewx,
+ &B9_vec_stvewx,
+ &B6_vec_stvebx,
+ &B1_vec_stvxl,
+ &B2_vec_stvxl,
+ &B3_vec_stvxl,
+ &B4_vec_stvxl,
+ &B5_vec_stvxl,
+ &B6_vec_stvxl,
+ &B7_vec_stvxl,
+ &B8_vec_stvxl,
+ &B9_vec_stvxl,
+ &B10_vec_stvxl,
+ &B11_vec_stvxl,
+ &B12_vec_stvxl,
+ &B13_vec_stvxl,
+ &B14_vec_stvxl,
+ &B15_vec_stvxl,
+ &B16_vec_stvxl,
+ &B17_vec_stvxl,
+ &B18_vec_stvxl,
+ &B19_vec_stvxl,
+ &B20_vec_stvxl,
+ &B21_vec_stvxl,
+ &B22_vec_stvxl,
+ &B23_vec_stvxl,
+ &B24_vec_stvxl,
+ &B25_vec_stvxl,
+ &B26_vec_stvxl,
+ &B27_vec_stvxl,
+ &B28_vec_stvxl,
+ &B29_vec_stvxl,
+ &B30_vec_stvxl,
+ &B1_vec_vsubuhm,
+ &B2_vec_vsubuhm,
+ &B1_vec_vsubuwm,
+ &B2_vec_vsubuwm,
+ &B1_vec_vsububm,
+ &B2_vec_vsububm,
+ &B_vec_vsubfp,
+ &B3_vec_vsubuhm,
+ &B4_vec_vsubuhm,
+ &B3_vec_vsubuwm,
+ &B4_vec_vsubuwm,
+ &B3_vec_vsububm,
+ &B4_vec_vsububm,
+ &B5_vec_vsubuhm,
+ &B6_vec_vsubuhm,
+ &B5_vec_vsubuwm,
+ &B6_vec_vsubuwm,
+ &B5_vec_vsububm,
+ &B6_vec_vsububm,
+ &B_vec_vsubcuw,
+ &B1_vec_vsubshs,
+ &B1_vec_vsubuhs,
+ &B1_vec_vsubsws,
+ &B1_vec_vsubuws,
+ &B1_vec_vsubsbs,
+ &B1_vec_vsububs,
+ &B2_vec_vsubshs,
+ &B3_vec_vsubshs,
+ &B2_vec_vsubsws,
+ &B3_vec_vsubsws,
+ &B2_vec_vsubsbs,
+ &B3_vec_vsubsbs,
+ &B2_vec_vsubuhs,
+ &B3_vec_vsubuhs,
+ &B2_vec_vsubuws,
+ &B3_vec_vsubuws,
+ &B2_vec_vsububs,
+ &B3_vec_vsububs,
+ &B_vec_vsum2sws,
+ &B_vec_vsum4shs,
+ &B_vec_vsum4sbs,
+ &B_vec_vsum4ubs,
+ &B_vec_vsumsws,
+ &B_vec_vrfiz,
+ &B1_vec_unpack2sh,
+ &B2_vec_unpack2sh,
+ &B1_vec_unpack2sl,
+ &B2_vec_unpack2sl,
+ &B1_vec_unpack2uh,
+ &B2_vec_unpack2uh,
+ &B1_vec_unpack2ul,
+ &B2_vec_unpack2ul,
+ &B1_vec_vupkhsh,
+ &B1_vec_vupkhsb,
+ &B_vec_vupkhpx,
+ &B2_vec_vupkhsh,
+ &B2_vec_vupkhsb,
+ &B1_vec_vupklsh,
+ &B1_vec_vupklsb,
+ &B_vec_vupklpx,
+ &B2_vec_vupklsh,
+ &B2_vec_vupklsb,
+ &B1_vec_vxor,
+ &B2_vec_vxor,
+ &B3_vec_vxor,
+ &B4_vec_vxor,
+ &B5_vec_vxor,
+ &B6_vec_vxor,
+ &B7_vec_vxor,
+ &B8_vec_vxor,
+ &B9_vec_vxor,
+ &B10_vec_vxor,
+ &B11_vec_vxor,
+ &B12_vec_vxor,
+ &B13_vec_vxor,
+ &B14_vec_vxor,
+ &B15_vec_vxor,
+ &B16_vec_vxor,
+ &B17_vec_vxor,
+ &B18_vec_vxor,
+ &B19_vec_vxor,
+ &B20_vec_vxor,
+ &B21_vec_vxor,
+ &B22_vec_vxor,
+ &B23_vec_vxor,
+ &B24_vec_vxor,
+};
+
+static const struct builtin *const O_vec_abs[4] = {
+ &B1_vec_abs,
+ &B2_vec_abs,
+ &B3_vec_abs,
+ &B4_vec_abs,
+};
+static const struct builtin *const O_vec_abss[3] = {
+ &B1_vec_abss,
+ &B2_vec_abss,
+ &B3_vec_abss,
+};
+static const struct builtin *const O_vec_add[19] = {
+ &B1_vec_vadduhm,
+ &B2_vec_vadduhm,
+ &B1_vec_vadduwm,
+ &B2_vec_vadduwm,
+ &B1_vec_vaddubm,
+ &B2_vec_vaddubm,
+ &B_vec_vaddfp,
+ &B3_vec_vadduhm,
+ &B4_vec_vadduhm,
+ &B3_vec_vadduwm,
+ &B4_vec_vadduwm,
+ &B3_vec_vaddubm,
+ &B4_vec_vaddubm,
+ &B5_vec_vadduhm,
+ &B6_vec_vadduhm,
+ &B5_vec_vadduwm,
+ &B6_vec_vadduwm,
+ &B5_vec_vaddubm,
+ &B6_vec_vaddubm,
+};
+static const struct builtin *const O_vec_addc[1] = {
+ &B_vec_vaddcuw,
+};
+static const struct builtin *const O_vec_adds[18] = {
+ &B1_vec_vaddshs,
+ &B1_vec_vadduhs,
+ &B1_vec_vaddsws,
+ &B1_vec_vadduws,
+ &B1_vec_vaddsbs,
+ &B1_vec_vaddubs,
+ &B2_vec_vaddshs,
+ &B3_vec_vaddshs,
+ &B2_vec_vaddsws,
+ &B3_vec_vaddsws,
+ &B2_vec_vaddsbs,
+ &B3_vec_vaddsbs,
+ &B2_vec_vadduhs,
+ &B3_vec_vadduhs,
+ &B2_vec_vadduws,
+ &B3_vec_vadduws,
+ &B2_vec_vaddubs,
+ &B3_vec_vaddubs,
+};
+static const struct builtin *const O_vec_all_eq[23] = {
+ &B1_vec_all_eq,
+ &B2_vec_all_eq,
+ &B3_vec_all_eq,
+ &B4_vec_all_eq,
+ &B5_vec_all_eq,
+ &B6_vec_all_eq,
+ &B7_vec_all_eq,
+ &B8_vec_all_eq,
+ &B9_vec_all_eq,
+ &B10_vec_all_eq,
+ &B11_vec_all_eq,
+ &B12_vec_all_eq,
+ &B13_vec_all_eq,
+ &B14_vec_all_eq,
+ &B15_vec_all_eq,
+ &B16_vec_all_eq,
+ &B17_vec_all_eq,
+ &B18_vec_all_eq,
+ &B19_vec_all_eq,
+ &B20_vec_all_eq,
+ &B21_vec_all_eq,
+ &B22_vec_all_eq,
+ &B23_vec_all_eq,
+};
+static const struct builtin *const O_vec_all_ge[19] = {
+ &B1_vec_all_ge,
+ &B2_vec_all_ge,
+ &B3_vec_all_ge,
+ &B4_vec_all_ge,
+ &B5_vec_all_ge,
+ &B6_vec_all_ge,
+ &B7_vec_all_ge,
+ &B8_vec_all_ge,
+ &B9_vec_all_ge,
+ &B10_vec_all_ge,
+ &B11_vec_all_ge,
+ &B12_vec_all_ge,
+ &B13_vec_all_ge,
+ &B14_vec_all_ge,
+ &B15_vec_all_ge,
+ &B16_vec_all_ge,
+ &B17_vec_all_ge,
+ &B18_vec_all_ge,
+ &B19_vec_all_ge,
+};
+static const struct builtin *const O_vec_all_gt[19] = {
+ &B1_vec_all_gt,
+ &B2_vec_all_gt,
+ &B3_vec_all_gt,
+ &B4_vec_all_gt,
+ &B5_vec_all_gt,
+ &B6_vec_all_gt,
+ &B7_vec_all_gt,
+ &B8_vec_all_gt,
+ &B9_vec_all_gt,
+ &B10_vec_all_gt,
+ &B11_vec_all_gt,
+ &B12_vec_all_gt,
+ &B13_vec_all_gt,
+ &B14_vec_all_gt,
+ &B15_vec_all_gt,
+ &B16_vec_all_gt,
+ &B17_vec_all_gt,
+ &B18_vec_all_gt,
+ &B19_vec_all_gt,
+};
+static const struct builtin *const O_vec_all_in[1] = {
+ &B_vec_all_in,
+};
+static const struct builtin *const O_vec_all_le[19] = {
+ &B1_vec_all_le,
+ &B2_vec_all_le,
+ &B3_vec_all_le,
+ &B4_vec_all_le,
+ &B5_vec_all_le,
+ &B6_vec_all_le,
+ &B7_vec_all_le,
+ &B8_vec_all_le,
+ &B9_vec_all_le,
+ &B10_vec_all_le,
+ &B11_vec_all_le,
+ &B12_vec_all_le,
+ &B13_vec_all_le,
+ &B14_vec_all_le,
+ &B15_vec_all_le,
+ &B16_vec_all_le,
+ &B17_vec_all_le,
+ &B18_vec_all_le,
+ &B19_vec_all_le,
+};
+static const struct builtin *const O_vec_all_lt[19] = {
+ &B1_vec_all_lt,
+ &B2_vec_all_lt,
+ &B3_vec_all_lt,
+ &B4_vec_all_lt,
+ &B5_vec_all_lt,
+ &B6_vec_all_lt,
+ &B7_vec_all_lt,
+ &B8_vec_all_lt,
+ &B9_vec_all_lt,
+ &B10_vec_all_lt,
+ &B11_vec_all_lt,
+ &B12_vec_all_lt,
+ &B13_vec_all_lt,
+ &B14_vec_all_lt,
+ &B15_vec_all_lt,
+ &B16_vec_all_lt,
+ &B17_vec_all_lt,
+ &B18_vec_all_lt,
+ &B19_vec_all_lt,
+};
+static const struct builtin *const O_vec_all_nan[1] = {
+ &B_vec_all_nan,
+};
+static const struct builtin *const O_vec_all_ne[23] = {
+ &B1_vec_all_ne,
+ &B2_vec_all_ne,
+ &B3_vec_all_ne,
+ &B4_vec_all_ne,
+ &B5_vec_all_ne,
+ &B6_vec_all_ne,
+ &B7_vec_all_ne,
+ &B8_vec_all_ne,
+ &B9_vec_all_ne,
+ &B10_vec_all_ne,
+ &B11_vec_all_ne,
+ &B12_vec_all_ne,
+ &B13_vec_all_ne,
+ &B14_vec_all_ne,
+ &B15_vec_all_ne,
+ &B16_vec_all_ne,
+ &B17_vec_all_ne,
+ &B18_vec_all_ne,
+ &B19_vec_all_ne,
+ &B20_vec_all_ne,
+ &B21_vec_all_ne,
+ &B22_vec_all_ne,
+ &B23_vec_all_ne,
+};
+static const struct builtin *const O_vec_all_nge[1] = {
+ &B_vec_all_nge,
+};
+static const struct builtin *const O_vec_all_ngt[1] = {
+ &B_vec_all_ngt,
+};
+static const struct builtin *const O_vec_all_nle[1] = {
+ &B_vec_all_nle,
+};
+static const struct builtin *const O_vec_all_nlt[1] = {
+ &B_vec_all_nlt,
+};
+static const struct builtin *const O_vec_all_numeric[1] = {
+ &B_vec_all_numeric,
+};
+static const struct builtin *const O_vec_and[24] = {
+ &B1_vec_vand,
+ &B2_vec_vand,
+ &B3_vec_vand,
+ &B4_vec_vand,
+ &B5_vec_vand,
+ &B6_vec_vand,
+ &B7_vec_vand,
+ &B8_vec_vand,
+ &B9_vec_vand,
+ &B10_vec_vand,
+ &B11_vec_vand,
+ &B12_vec_vand,
+ &B13_vec_vand,
+ &B14_vec_vand,
+ &B15_vec_vand,
+ &B16_vec_vand,
+ &B17_vec_vand,
+ &B18_vec_vand,
+ &B19_vec_vand,
+ &B20_vec_vand,
+ &B21_vec_vand,
+ &B22_vec_vand,
+ &B23_vec_vand,
+ &B24_vec_vand,
+};
+static const struct builtin *const O_vec_andc[24] = {
+ &B1_vec_vandc,
+ &B2_vec_vandc,
+ &B3_vec_vandc,
+ &B4_vec_vandc,
+ &B5_vec_vandc,
+ &B6_vec_vandc,
+ &B7_vec_vandc,
+ &B8_vec_vandc,
+ &B9_vec_vandc,
+ &B10_vec_vandc,
+ &B11_vec_vandc,
+ &B12_vec_vandc,
+ &B13_vec_vandc,
+ &B14_vec_vandc,
+ &B15_vec_vandc,
+ &B16_vec_vandc,
+ &B17_vec_vandc,
+ &B18_vec_vandc,
+ &B19_vec_vandc,
+ &B20_vec_vandc,
+ &B21_vec_vandc,
+ &B22_vec_vandc,
+ &B23_vec_vandc,
+ &B24_vec_vandc,
+};
+static const struct builtin *const O_vec_any_eq[23] = {
+ &B1_vec_any_eq,
+ &B2_vec_any_eq,
+ &B3_vec_any_eq,
+ &B4_vec_any_eq,
+ &B5_vec_any_eq,
+ &B6_vec_any_eq,
+ &B7_vec_any_eq,
+ &B8_vec_any_eq,
+ &B9_vec_any_eq,
+ &B10_vec_any_eq,
+ &B11_vec_any_eq,
+ &B12_vec_any_eq,
+ &B13_vec_any_eq,
+ &B14_vec_any_eq,
+ &B15_vec_any_eq,
+ &B16_vec_any_eq,
+ &B17_vec_any_eq,
+ &B18_vec_any_eq,
+ &B19_vec_any_eq,
+ &B20_vec_any_eq,
+ &B21_vec_any_eq,
+ &B22_vec_any_eq,
+ &B23_vec_any_eq,
+};
+static const struct builtin *const O_vec_any_ge[19] = {
+ &B1_vec_any_ge,
+ &B2_vec_any_ge,
+ &B3_vec_any_ge,
+ &B4_vec_any_ge,
+ &B5_vec_any_ge,
+ &B6_vec_any_ge,
+ &B7_vec_any_ge,
+ &B8_vec_any_ge,
+ &B9_vec_any_ge,
+ &B10_vec_any_ge,
+ &B11_vec_any_ge,
+ &B12_vec_any_ge,
+ &B13_vec_any_ge,
+ &B14_vec_any_ge,
+ &B15_vec_any_ge,
+ &B16_vec_any_ge,
+ &B17_vec_any_ge,
+ &B18_vec_any_ge,
+ &B19_vec_any_ge,
+};
+static const struct builtin *const O_vec_any_gt[19] = {
+ &B1_vec_any_gt,
+ &B2_vec_any_gt,
+ &B3_vec_any_gt,
+ &B4_vec_any_gt,
+ &B5_vec_any_gt,
+ &B6_vec_any_gt,
+ &B7_vec_any_gt,
+ &B8_vec_any_gt,
+ &B9_vec_any_gt,
+ &B10_vec_any_gt,
+ &B11_vec_any_gt,
+ &B12_vec_any_gt,
+ &B13_vec_any_gt,
+ &B14_vec_any_gt,
+ &B15_vec_any_gt,
+ &B16_vec_any_gt,
+ &B17_vec_any_gt,
+ &B18_vec_any_gt,
+ &B19_vec_any_gt,
+};
+static const struct builtin *const O_vec_any_le[19] = {
+ &B1_vec_any_le,
+ &B2_vec_any_le,
+ &B3_vec_any_le,
+ &B4_vec_any_le,
+ &B5_vec_any_le,
+ &B6_vec_any_le,
+ &B7_vec_any_le,
+ &B8_vec_any_le,
+ &B9_vec_any_le,
+ &B10_vec_any_le,
+ &B11_vec_any_le,
+ &B12_vec_any_le,
+ &B13_vec_any_le,
+ &B14_vec_any_le,
+ &B15_vec_any_le,
+ &B16_vec_any_le,
+ &B17_vec_any_le,
+ &B18_vec_any_le,
+ &B19_vec_any_le,
+};
+static const struct builtin *const O_vec_any_lt[19] = {
+ &B1_vec_any_lt,
+ &B2_vec_any_lt,
+ &B3_vec_any_lt,
+ &B4_vec_any_lt,
+ &B5_vec_any_lt,
+ &B6_vec_any_lt,
+ &B7_vec_any_lt,
+ &B8_vec_any_lt,
+ &B9_vec_any_lt,
+ &B10_vec_any_lt,
+ &B11_vec_any_lt,
+ &B12_vec_any_lt,
+ &B13_vec_any_lt,
+ &B14_vec_any_lt,
+ &B15_vec_any_lt,
+ &B16_vec_any_lt,
+ &B17_vec_any_lt,
+ &B18_vec_any_lt,
+ &B19_vec_any_lt,
+};
+static const struct builtin *const O_vec_any_nan[1] = {
+ &B_vec_any_nan,
+};
+static const struct builtin *const O_vec_any_ne[23] = {
+ &B1_vec_any_ne,
+ &B2_vec_any_ne,
+ &B3_vec_any_ne,
+ &B4_vec_any_ne,
+ &B5_vec_any_ne,
+ &B6_vec_any_ne,
+ &B7_vec_any_ne,
+ &B8_vec_any_ne,
+ &B9_vec_any_ne,
+ &B10_vec_any_ne,
+ &B11_vec_any_ne,
+ &B12_vec_any_ne,
+ &B13_vec_any_ne,
+ &B14_vec_any_ne,
+ &B15_vec_any_ne,
+ &B16_vec_any_ne,
+ &B17_vec_any_ne,
+ &B18_vec_any_ne,
+ &B19_vec_any_ne,
+ &B20_vec_any_ne,
+ &B21_vec_any_ne,
+ &B22_vec_any_ne,
+ &B23_vec_any_ne,
+};
+static const struct builtin *const O_vec_any_nge[1] = {
+ &B_vec_any_nge,
+};
+static const struct builtin *const O_vec_any_ngt[1] = {
+ &B_vec_any_ngt,
+};
+static const struct builtin *const O_vec_any_nle[1] = {
+ &B_vec_any_nle,
+};
+static const struct builtin *const O_vec_any_nlt[1] = {
+ &B_vec_any_nlt,
+};
+static const struct builtin *const O_vec_any_numeric[1] = {
+ &B_vec_any_numeric,
+};
+static const struct builtin *const O_vec_any_out[1] = {
+ &B_vec_any_out,
+};
+static const struct builtin *const O_vec_avg[6] = {
+ &B_vec_vavgsh,
+ &B_vec_vavgsw,
+ &B_vec_vavgsb,
+ &B_vec_vavguh,
+ &B_vec_vavguw,
+ &B_vec_vavgub,
+};
+static const struct builtin *const O_vec_ceil[1] = {
+ &B_vec_vrfip,
+};
+static const struct builtin *const O_vec_cmpb[1] = {
+ &B_vec_vcmpbfp,
+};
+static const struct builtin *const O_vec_cmpeq[7] = {
+ &B_vec_vcmpeqfp,
+ &B1_vec_vcmpequh,
+ &B1_vec_vcmpequw,
+ &B1_vec_vcmpequb,
+ &B2_vec_vcmpequh,
+ &B2_vec_vcmpequw,
+ &B2_vec_vcmpequb,
+};
+static const struct builtin *const O_vec_cmpge[1] = {
+ &B_vec_vcmpgefp,
+};
+static const struct builtin *const O_vec_cmpgt[7] = {
+ &B_vec_vcmpgtfp,
+ &B_vec_vcmpgtsh,
+ &B_vec_vcmpgtsw,
+ &B_vec_vcmpgtsb,
+ &B_vec_vcmpgtuh,
+ &B_vec_vcmpgtuw,
+ &B_vec_vcmpgtub,
+};
+static const struct builtin *const O_vec_cmple[1] = {
+ &B_vec_cmple,
+};
+static const struct builtin *const O_vec_cmplt[7] = {
+ &B1_vec_cmplt,
+ &B2_vec_cmplt,
+ &B3_vec_cmplt,
+ &B4_vec_cmplt,
+ &B5_vec_cmplt,
+ &B6_vec_cmplt,
+ &B7_vec_cmplt,
+};
+static const struct builtin *const O_vec_ctf[2] = {
+ &B_vec_vcfsx,
+ &B_vec_vcfux,
+};
+static const struct builtin *const O_vec_cts[1] = {
+ &B_vec_vctsxs,
+};
+static const struct builtin *const O_vec_ctu[1] = {
+ &B_vec_vctuxs,
+};
+static const struct builtin *const O_vec_dss[1] = {
+ &B_vec_dss,
+};
+static const struct builtin *const O_vec_dssall[1] = {
+ &B_vec_dssall,
+};
+static const struct builtin *const O_vec_dst[20] = {
+ &B1_vec_dst,
+ &B2_vec_dst,
+ &B3_vec_dst,
+ &B4_vec_dst,
+ &B5_vec_dst,
+ &B6_vec_dst,
+ &B7_vec_dst,
+ &B8_vec_dst,
+ &B9_vec_dst,
+ &B10_vec_dst,
+ &B11_vec_dst,
+ &B12_vec_dst,
+ &B13_vec_dst,
+ &B14_vec_dst,
+ &B15_vec_dst,
+ &B16_vec_dst,
+ &B17_vec_dst,
+ &B18_vec_dst,
+ &B19_vec_dst,
+ &B20_vec_dst,
+};
+static const struct builtin *const O_vec_dstst[20] = {
+ &B1_vec_dstst,
+ &B2_vec_dstst,
+ &B3_vec_dstst,
+ &B4_vec_dstst,
+ &B5_vec_dstst,
+ &B6_vec_dstst,
+ &B7_vec_dstst,
+ &B8_vec_dstst,
+ &B9_vec_dstst,
+ &B10_vec_dstst,
+ &B11_vec_dstst,
+ &B12_vec_dstst,
+ &B13_vec_dstst,
+ &B14_vec_dstst,
+ &B15_vec_dstst,
+ &B16_vec_dstst,
+ &B17_vec_dstst,
+ &B18_vec_dstst,
+ &B19_vec_dstst,
+ &B20_vec_dstst,
+};
+static const struct builtin *const O_vec_dststt[20] = {
+ &B1_vec_dststt,
+ &B2_vec_dststt,
+ &B3_vec_dststt,
+ &B4_vec_dststt,
+ &B5_vec_dststt,
+ &B6_vec_dststt,
+ &B7_vec_dststt,
+ &B8_vec_dststt,
+ &B9_vec_dststt,
+ &B10_vec_dststt,
+ &B11_vec_dststt,
+ &B12_vec_dststt,
+ &B13_vec_dststt,
+ &B14_vec_dststt,
+ &B15_vec_dststt,
+ &B16_vec_dststt,
+ &B17_vec_dststt,
+ &B18_vec_dststt,
+ &B19_vec_dststt,
+ &B20_vec_dststt,
+};
+static const struct builtin *const O_vec_dstt[20] = {
+ &B1_vec_dstt,
+ &B2_vec_dstt,
+ &B3_vec_dstt,
+ &B4_vec_dstt,
+ &B5_vec_dstt,
+ &B6_vec_dstt,
+ &B7_vec_dstt,
+ &B8_vec_dstt,
+ &B9_vec_dstt,
+ &B10_vec_dstt,
+ &B11_vec_dstt,
+ &B12_vec_dstt,
+ &B13_vec_dstt,
+ &B14_vec_dstt,
+ &B15_vec_dstt,
+ &B16_vec_dstt,
+ &B17_vec_dstt,
+ &B18_vec_dstt,
+ &B19_vec_dstt,
+ &B20_vec_dstt,
+};
+static const struct builtin *const O_vec_expte[1] = {
+ &B_vec_vexptefp,
+};
+static const struct builtin *const O_vec_floor[1] = {
+ &B_vec_vrfim,
+};
+static const struct builtin *const O_vec_ld[20] = {
+ &B1_vec_lvx,
+ &B2_vec_lvx,
+ &B3_vec_lvx,
+ &B4_vec_lvx,
+ &B5_vec_lvx,
+ &B6_vec_lvx,
+ &B7_vec_lvx,
+ &B8_vec_lvx,
+ &B9_vec_lvx,
+ &B10_vec_lvx,
+ &B11_vec_lvx,
+ &B12_vec_lvx,
+ &B13_vec_lvx,
+ &B14_vec_lvx,
+ &B15_vec_lvx,
+ &B16_vec_lvx,
+ &B17_vec_lvx,
+ &B18_vec_lvx,
+ &B19_vec_lvx,
+ &B20_vec_lvx,
+};
+static const struct builtin *const O_vec_lde[9] = {
+ &B1_vec_lvewx,
+ &B2_vec_lvewx,
+ &B3_vec_lvewx,
+ &B1_vec_lvehx,
+ &B1_vec_lvebx,
+ &B2_vec_lvebx,
+ &B4_vec_lvewx,
+ &B5_vec_lvewx,
+ &B2_vec_lvehx,
+};
+static const struct builtin *const O_vec_ldl[20] = {
+ &B1_vec_lvxl,
+ &B2_vec_lvxl,
+ &B3_vec_lvxl,
+ &B4_vec_lvxl,
+ &B5_vec_lvxl,
+ &B6_vec_lvxl,
+ &B7_vec_lvxl,
+ &B8_vec_lvxl,
+ &B9_vec_lvxl,
+ &B10_vec_lvxl,
+ &B11_vec_lvxl,
+ &B12_vec_lvxl,
+ &B13_vec_lvxl,
+ &B14_vec_lvxl,
+ &B15_vec_lvxl,
+ &B16_vec_lvxl,
+ &B17_vec_lvxl,
+ &B18_vec_lvxl,
+ &B19_vec_lvxl,
+ &B20_vec_lvxl,
+};
+static const struct builtin *const O_vec_loge[1] = {
+ &B_vec_vlogefp,
+};
+static const struct builtin *const O_vec_lvebx[2] = {
+ &B1_vec_lvebx,
+ &B2_vec_lvebx,
+};
+static const struct builtin *const O_vec_lvehx[2] = {
+ &B1_vec_lvehx,
+ &B2_vec_lvehx,
+};
+static const struct builtin *const O_vec_lvewx[5] = {
+ &B1_vec_lvewx,
+ &B2_vec_lvewx,
+ &B3_vec_lvewx,
+ &B4_vec_lvewx,
+ &B5_vec_lvewx,
+};
+static const struct builtin *const O_vec_lvsl[9] = {
+ &B1_vec_lvsl,
+ &B2_vec_lvsl,
+ &B3_vec_lvsl,
+ &B4_vec_lvsl,
+ &B5_vec_lvsl,
+ &B6_vec_lvsl,
+ &B7_vec_lvsl,
+ &B8_vec_lvsl,
+ &B9_vec_lvsl,
+};
+static const struct builtin *const O_vec_lvsr[9] = {
+ &B1_vec_lvsr,
+ &B2_vec_lvsr,
+ &B3_vec_lvsr,
+ &B4_vec_lvsr,
+ &B5_vec_lvsr,
+ &B6_vec_lvsr,
+ &B7_vec_lvsr,
+ &B8_vec_lvsr,
+ &B9_vec_lvsr,
+};
+static const struct builtin *const O_vec_lvx[20] = {
+ &B1_vec_lvx,
+ &B2_vec_lvx,
+ &B3_vec_lvx,
+ &B4_vec_lvx,
+ &B5_vec_lvx,
+ &B6_vec_lvx,
+ &B7_vec_lvx,
+ &B8_vec_lvx,
+ &B9_vec_lvx,
+ &B10_vec_lvx,
+ &B11_vec_lvx,
+ &B12_vec_lvx,
+ &B13_vec_lvx,
+ &B14_vec_lvx,
+ &B15_vec_lvx,
+ &B16_vec_lvx,
+ &B17_vec_lvx,
+ &B18_vec_lvx,
+ &B19_vec_lvx,
+ &B20_vec_lvx,
+};
+static const struct builtin *const O_vec_lvxl[20] = {
+ &B1_vec_lvxl,
+ &B2_vec_lvxl,
+ &B3_vec_lvxl,
+ &B4_vec_lvxl,
+ &B5_vec_lvxl,
+ &B6_vec_lvxl,
+ &B7_vec_lvxl,
+ &B8_vec_lvxl,
+ &B9_vec_lvxl,
+ &B10_vec_lvxl,
+ &B11_vec_lvxl,
+ &B12_vec_lvxl,
+ &B13_vec_lvxl,
+ &B14_vec_lvxl,
+ &B15_vec_lvxl,
+ &B16_vec_lvxl,
+ &B17_vec_lvxl,
+ &B18_vec_lvxl,
+ &B19_vec_lvxl,
+ &B20_vec_lvxl,
+};
+static const struct builtin *const O_vec_madd[1] = {
+ &B_vec_vmaddfp,
+};
+static const struct builtin *const O_vec_madds[1] = {
+ &B_vec_vmhaddshs,
+};
+static const struct builtin *const O_vec_max[19] = {
+ &B1_vec_vmaxsh,
+ &B1_vec_vmaxuh,
+ &B1_vec_vmaxsw,
+ &B1_vec_vmaxuw,
+ &B1_vec_vmaxsb,
+ &B1_vec_vmaxub,
+ &B_vec_vmaxfp,
+ &B2_vec_vmaxsh,
+ &B3_vec_vmaxsh,
+ &B2_vec_vmaxsw,
+ &B3_vec_vmaxsw,
+ &B2_vec_vmaxsb,
+ &B3_vec_vmaxsb,
+ &B2_vec_vmaxuh,
+ &B3_vec_vmaxuh,
+ &B2_vec_vmaxuw,
+ &B3_vec_vmaxuw,
+ &B2_vec_vmaxub,
+ &B3_vec_vmaxub,
+};
+static const struct builtin *const O_vec_mergeh[11] = {
+ &B1_vec_vmrghh,
+ &B1_vec_vmrghw,
+ &B1_vec_vmrghb,
+ &B2_vec_vmrghw,
+ &B2_vec_vmrghh,
+ &B3_vec_vmrghh,
+ &B3_vec_vmrghw,
+ &B2_vec_vmrghb,
+ &B4_vec_vmrghh,
+ &B4_vec_vmrghw,
+ &B3_vec_vmrghb,
+};
+static const struct builtin *const O_vec_mergel[11] = {
+ &B1_vec_vmrglh,
+ &B1_vec_vmrglw,
+ &B1_vec_vmrglb,
+ &B2_vec_vmrglw,
+ &B2_vec_vmrglh,
+ &B3_vec_vmrglh,
+ &B3_vec_vmrglw,
+ &B2_vec_vmrglb,
+ &B4_vec_vmrglh,
+ &B4_vec_vmrglw,
+ &B3_vec_vmrglb,
+};
+static const struct builtin *const O_vec_mfvscr[1] = {
+ &B_vec_mfvscr,
+};
+static const struct builtin *const O_vec_min[19] = {
+ &B1_vec_vminsh,
+ &B1_vec_vminuh,
+ &B1_vec_vminsw,
+ &B1_vec_vminuw,
+ &B1_vec_vminsb,
+ &B1_vec_vminub,
+ &B_vec_vminfp,
+ &B2_vec_vminsh,
+ &B3_vec_vminsh,
+ &B2_vec_vminsw,
+ &B3_vec_vminsw,
+ &B2_vec_vminsb,
+ &B3_vec_vminsb,
+ &B2_vec_vminuh,
+ &B3_vec_vminuh,
+ &B2_vec_vminuw,
+ &B3_vec_vminuw,
+ &B2_vec_vminub,
+ &B3_vec_vminub,
+};
+static const struct builtin *const O_vec_mladd[4] = {
+ &B1_vec_vmladduhm,
+ &B2_vec_vmladduhm,
+ &B3_vec_vmladduhm,
+ &B4_vec_vmladduhm,
+};
+static const struct builtin *const O_vec_mradds[1] = {
+ &B_vec_vmhraddshs,
+};
+static const struct builtin *const O_vec_msum[4] = {
+ &B_vec_vmsumshm,
+ &B_vec_vmsummbm,
+ &B_vec_vmsumuhm,
+ &B_vec_vmsumubm,
+};
+static const struct builtin *const O_vec_msums[2] = {
+ &B_vec_vmsumshs,
+ &B_vec_vmsumuhs,
+};
+static const struct builtin *const O_vec_mtvscr[10] = {
+ &B1_vec_mtvscr,
+ &B2_vec_mtvscr,
+ &B3_vec_mtvscr,
+ &B4_vec_mtvscr,
+ &B5_vec_mtvscr,
+ &B6_vec_mtvscr,
+ &B7_vec_mtvscr,
+ &B8_vec_mtvscr,
+ &B9_vec_mtvscr,
+ &B10_vec_mtvscr,
+};
+static const struct builtin *const O_vec_mule[4] = {
+ &B_vec_vmulesh,
+ &B_vec_vmulesb,
+ &B_vec_vmuleuh,
+ &B_vec_vmuleub,
+};
+static const struct builtin *const O_vec_mulo[4] = {
+ &B_vec_vmulosh,
+ &B_vec_vmulosb,
+ &B_vec_vmulouh,
+ &B_vec_vmuloub,
+};
+static const struct builtin *const O_vec_nmsub[1] = {
+ &B_vec_vnmsubfp,
+};
+static const struct builtin *const O_vec_nor[10] = {
+ &B1_vec_vnor,
+ &B2_vec_vnor,
+ &B3_vec_vnor,
+ &B4_vec_vnor,
+ &B5_vec_vnor,
+ &B6_vec_vnor,
+ &B7_vec_vnor,
+ &B8_vec_vnor,
+ &B9_vec_vnor,
+ &B10_vec_vnor,
+};
+static const struct builtin *const O_vec_or[24] = {
+ &B1_vec_vor,
+ &B2_vec_vor,
+ &B3_vec_vor,
+ &B4_vec_vor,
+ &B5_vec_vor,
+ &B6_vec_vor,
+ &B7_vec_vor,
+ &B8_vec_vor,
+ &B9_vec_vor,
+ &B10_vec_vor,
+ &B11_vec_vor,
+ &B12_vec_vor,
+ &B13_vec_vor,
+ &B14_vec_vor,
+ &B15_vec_vor,
+ &B16_vec_vor,
+ &B17_vec_vor,
+ &B18_vec_vor,
+ &B19_vec_vor,
+ &B20_vec_vor,
+ &B21_vec_vor,
+ &B22_vec_vor,
+ &B23_vec_vor,
+ &B24_vec_vor,
+};
+static const struct builtin *const O_vec_pack[6] = {
+ &B1_vec_vpkuhum,
+ &B1_vec_vpkuwum,
+ &B2_vec_vpkuhum,
+ &B2_vec_vpkuwum,
+ &B3_vec_vpkuhum,
+ &B3_vec_vpkuwum,
+};
+static const struct builtin *const O_vec_packpx[1] = {
+ &B_vec_vpkpx,
+};
+static const struct builtin *const O_vec_packs[4] = {
+ &B_vec_vpkshss,
+ &B_vec_vpkswss,
+ &B_vec_vpkuhus,
+ &B_vec_vpkuwus,
+};
+static const struct builtin *const O_vec_packsu[4] = {
+ &B_vec_vpkshus,
+ &B_vec_vpkswus,
+ &B_vec_vpkuhus,
+ &B_vec_vpkuwus,
+};
+static const struct builtin *const O_vec_perm[11] = {
+ &B1_vec_vperm,
+ &B2_vec_vperm,
+ &B3_vec_vperm,
+ &B4_vec_vperm,
+ &B5_vec_vperm,
+ &B6_vec_vperm,
+ &B7_vec_vperm,
+ &B8_vec_vperm,
+ &B9_vec_vperm,
+ &B10_vec_vperm,
+ &B11_vec_vperm,
+};
+static const struct builtin *const O_vec_re[1] = {
+ &B_vec_vrefp,
+};
+static const struct builtin *const O_vec_rl[6] = {
+ &B1_vec_vrlh,
+ &B1_vec_vrlw,
+ &B1_vec_vrlb,
+ &B2_vec_vrlh,
+ &B2_vec_vrlw,
+ &B2_vec_vrlb,
+};
+static const struct builtin *const O_vec_round[1] = {
+ &B_vec_vrfin,
+};
+static const struct builtin *const O_vec_rsqrte[1] = {
+ &B_vec_vrsqrtefp,
+};
+static const struct builtin *const O_vec_sel[20] = {
+ &B1_vec_vsel,
+ &B2_vec_vsel,
+ &B3_vec_vsel,
+ &B4_vec_vsel,
+ &B5_vec_vsel,
+ &B6_vec_vsel,
+ &B7_vec_vsel,
+ &B8_vec_vsel,
+ &B9_vec_vsel,
+ &B10_vec_vsel,
+ &B11_vec_vsel,
+ &B12_vec_vsel,
+ &B13_vec_vsel,
+ &B14_vec_vsel,
+ &B15_vec_vsel,
+ &B16_vec_vsel,
+ &B17_vec_vsel,
+ &B18_vec_vsel,
+ &B19_vec_vsel,
+ &B20_vec_vsel,
+};
+static const struct builtin *const O_vec_sl[6] = {
+ &B1_vec_vslh,
+ &B1_vec_vslw,
+ &B1_vec_vslb,
+ &B2_vec_vslh,
+ &B2_vec_vslw,
+ &B2_vec_vslb,
+};
+static const struct builtin *const O_vec_sld[11] = {
+ &B1_vec_vsldoi,
+ &B2_vec_vsldoi,
+ &B3_vec_vsldoi,
+ &B4_vec_vsldoi,
+ &B5_vec_vsldoi,
+ &B6_vec_vsldoi,
+ &B7_vec_vsldoi,
+ &B8_vec_vsldoi,
+ &B9_vec_vsldoi,
+ &B10_vec_vsldoi,
+ &B11_vec_vsldoi,
+};
+static const struct builtin *const O_vec_sll[30] = {
+ &B1_vec_vsl,
+ &B2_vec_vsl,
+ &B3_vec_vsl,
+ &B4_vec_vsl,
+ &B5_vec_vsl,
+ &B6_vec_vsl,
+ &B7_vec_vsl,
+ &B8_vec_vsl,
+ &B9_vec_vsl,
+ &B10_vec_vsl,
+ &B11_vec_vsl,
+ &B12_vec_vsl,
+ &B13_vec_vsl,
+ &B14_vec_vsl,
+ &B15_vec_vsl,
+ &B16_vec_vsl,
+ &B17_vec_vsl,
+ &B18_vec_vsl,
+ &B19_vec_vsl,
+ &B20_vec_vsl,
+ &B21_vec_vsl,
+ &B22_vec_vsl,
+ &B23_vec_vsl,
+ &B24_vec_vsl,
+ &B25_vec_vsl,
+ &B26_vec_vsl,
+ &B27_vec_vsl,
+ &B28_vec_vsl,
+ &B29_vec_vsl,
+ &B30_vec_vsl,
+};
+static const struct builtin *const O_vec_slo[16] = {
+ &B1_vec_vslo,
+ &B2_vec_vslo,
+ &B3_vec_vslo,
+ &B4_vec_vslo,
+ &B5_vec_vslo,
+ &B6_vec_vslo,
+ &B7_vec_vslo,
+ &B8_vec_vslo,
+ &B9_vec_vslo,
+ &B10_vec_vslo,
+ &B11_vec_vslo,
+ &B12_vec_vslo,
+ &B13_vec_vslo,
+ &B14_vec_vslo,
+ &B15_vec_vslo,
+ &B16_vec_vslo,
+};
+static const struct builtin *const O_vec_splat[11] = {
+ &B1_vec_vsplth,
+ &B1_vec_vspltw,
+ &B1_vec_vspltb,
+ &B2_vec_vspltw,
+ &B2_vec_vsplth,
+ &B3_vec_vsplth,
+ &B3_vec_vspltw,
+ &B2_vec_vspltb,
+ &B4_vec_vsplth,
+ &B4_vec_vspltw,
+ &B3_vec_vspltb,
+};
+static const struct builtin *const O_vec_splat_s16[1] = {
+ &B_vec_vspltish,
+};
+static const struct builtin *const O_vec_splat_s32[1] = {
+ &B_vec_vspltisw,
+};
+static const struct builtin *const O_vec_splat_s8[1] = {
+ &B_vec_vspltisb,
+};
+static const struct builtin *const O_vec_splat_u16[1] = {
+ &B_vec_splat_u16,
+};
+static const struct builtin *const O_vec_splat_u32[1] = {
+ &B_vec_splat_u32,
+};
+static const struct builtin *const O_vec_splat_u8[1] = {
+ &B_vec_splat_u8,
+};
+static const struct builtin *const O_vec_sr[6] = {
+ &B1_vec_vsrh,
+ &B1_vec_vsrw,
+ &B1_vec_vsrb,
+ &B2_vec_vsrh,
+ &B2_vec_vsrw,
+ &B2_vec_vsrb,
+};
+static const struct builtin *const O_vec_sra[6] = {
+ &B1_vec_vsrah,
+ &B1_vec_vsraw,
+ &B1_vec_vsrab,
+ &B2_vec_vsrah,
+ &B2_vec_vsraw,
+ &B2_vec_vsrab,
+};
+static const struct builtin *const O_vec_srl[30] = {
+ &B1_vec_vsr,
+ &B2_vec_vsr,
+ &B3_vec_vsr,
+ &B4_vec_vsr,
+ &B5_vec_vsr,
+ &B6_vec_vsr,
+ &B7_vec_vsr,
+ &B8_vec_vsr,
+ &B9_vec_vsr,
+ &B10_vec_vsr,
+ &B11_vec_vsr,
+ &B12_vec_vsr,
+ &B13_vec_vsr,
+ &B14_vec_vsr,
+ &B15_vec_vsr,
+ &B16_vec_vsr,
+ &B17_vec_vsr,
+ &B18_vec_vsr,
+ &B19_vec_vsr,
+ &B20_vec_vsr,
+ &B21_vec_vsr,
+ &B22_vec_vsr,
+ &B23_vec_vsr,
+ &B24_vec_vsr,
+ &B25_vec_vsr,
+ &B26_vec_vsr,
+ &B27_vec_vsr,
+ &B28_vec_vsr,
+ &B29_vec_vsr,
+ &B30_vec_vsr,
+};
+static const struct builtin *const O_vec_sro[16] = {
+ &B1_vec_vsro,
+ &B2_vec_vsro,
+ &B3_vec_vsro,
+ &B4_vec_vsro,
+ &B5_vec_vsro,
+ &B6_vec_vsro,
+ &B7_vec_vsro,
+ &B8_vec_vsro,
+ &B9_vec_vsro,
+ &B10_vec_vsro,
+ &B11_vec_vsro,
+ &B12_vec_vsro,
+ &B13_vec_vsro,
+ &B14_vec_vsro,
+ &B15_vec_vsro,
+ &B16_vec_vsro,
+};
+static const struct builtin *const O_vec_st[30] = {
+ &B1_vec_stvx,
+ &B2_vec_stvx,
+ &B3_vec_stvx,
+ &B4_vec_stvx,
+ &B5_vec_stvx,
+ &B6_vec_stvx,
+ &B7_vec_stvx,
+ &B8_vec_stvx,
+ &B9_vec_stvx,
+ &B10_vec_stvx,
+ &B11_vec_stvx,
+ &B12_vec_stvx,
+ &B13_vec_stvx,
+ &B14_vec_stvx,
+ &B15_vec_stvx,
+ &B16_vec_stvx,
+ &B17_vec_stvx,
+ &B18_vec_stvx,
+ &B19_vec_stvx,
+ &B20_vec_stvx,
+ &B21_vec_stvx,
+ &B22_vec_stvx,
+ &B23_vec_stvx,
+ &B24_vec_stvx,
+ &B25_vec_stvx,
+ &B26_vec_stvx,
+ &B27_vec_stvx,
+ &B28_vec_stvx,
+ &B29_vec_stvx,
+ &B30_vec_stvx,
+};
+static const struct builtin *const O_vec_ste[19] = {
+ &B1_vec_stvebx,
+ &B2_vec_stvebx,
+ &B1_vec_stvewx,
+ &B2_vec_stvewx,
+ &B3_vec_stvewx,
+ &B4_vec_stvewx,
+ &B3_vec_stvebx,
+ &B4_vec_stvebx,
+ &B5_vec_stvewx,
+ &B1_vec_stvehx,
+ &B2_vec_stvehx,
+ &B3_vec_stvehx,
+ &B6_vec_stvewx,
+ &B7_vec_stvewx,
+ &B5_vec_stvebx,
+ &B4_vec_stvehx,
+ &B8_vec_stvewx,
+ &B9_vec_stvewx,
+ &B6_vec_stvebx,
+};
+static const struct builtin *const O_vec_stl[30] = {
+ &B1_vec_stvxl,
+ &B2_vec_stvxl,
+ &B3_vec_stvxl,
+ &B4_vec_stvxl,
+ &B5_vec_stvxl,
+ &B6_vec_stvxl,
+ &B7_vec_stvxl,
+ &B8_vec_stvxl,
+ &B9_vec_stvxl,
+ &B10_vec_stvxl,
+ &B11_vec_stvxl,
+ &B12_vec_stvxl,
+ &B13_vec_stvxl,
+ &B14_vec_stvxl,
+ &B15_vec_stvxl,
+ &B16_vec_stvxl,
+ &B17_vec_stvxl,
+ &B18_vec_stvxl,
+ &B19_vec_stvxl,
+ &B20_vec_stvxl,
+ &B21_vec_stvxl,
+ &B22_vec_stvxl,
+ &B23_vec_stvxl,
+ &B24_vec_stvxl,
+ &B25_vec_stvxl,
+ &B26_vec_stvxl,
+ &B27_vec_stvxl,
+ &B28_vec_stvxl,
+ &B29_vec_stvxl,
+ &B30_vec_stvxl,
+};
+static const struct builtin *const O_vec_stvebx[6] = {
+ &B1_vec_stvebx,
+ &B2_vec_stvebx,
+ &B3_vec_stvebx,
+ &B4_vec_stvebx,
+ &B5_vec_stvebx,
+ &B6_vec_stvebx,
+};
+static const struct builtin *const O_vec_stvehx[4] = {
+ &B1_vec_stvehx,
+ &B2_vec_stvehx,
+ &B3_vec_stvehx,
+ &B4_vec_stvehx,
+};
+static const struct builtin *const O_vec_stvewx[9] = {
+ &B1_vec_stvewx,
+ &B2_vec_stvewx,
+ &B3_vec_stvewx,
+ &B4_vec_stvewx,
+ &B5_vec_stvewx,
+ &B6_vec_stvewx,
+ &B7_vec_stvewx,
+ &B8_vec_stvewx,
+ &B9_vec_stvewx,
+};
+static const struct builtin *const O_vec_stvx[30] = {
+ &B1_vec_stvx,
+ &B2_vec_stvx,
+ &B3_vec_stvx,
+ &B4_vec_stvx,
+ &B5_vec_stvx,
+ &B6_vec_stvx,
+ &B7_vec_stvx,
+ &B8_vec_stvx,
+ &B9_vec_stvx,
+ &B10_vec_stvx,
+ &B11_vec_stvx,
+ &B12_vec_stvx,
+ &B13_vec_stvx,
+ &B14_vec_stvx,
+ &B15_vec_stvx,
+ &B16_vec_stvx,
+ &B17_vec_stvx,
+ &B18_vec_stvx,
+ &B19_vec_stvx,
+ &B20_vec_stvx,
+ &B21_vec_stvx,
+ &B22_vec_stvx,
+ &B23_vec_stvx,
+ &B24_vec_stvx,
+ &B25_vec_stvx,
+ &B26_vec_stvx,
+ &B27_vec_stvx,
+ &B28_vec_stvx,
+ &B29_vec_stvx,
+ &B30_vec_stvx,
+};
+static const struct builtin *const O_vec_stvxl[30] = {
+ &B1_vec_stvxl,
+ &B2_vec_stvxl,
+ &B3_vec_stvxl,
+ &B4_vec_stvxl,
+ &B5_vec_stvxl,
+ &B6_vec_stvxl,
+ &B7_vec_stvxl,
+ &B8_vec_stvxl,
+ &B9_vec_stvxl,
+ &B10_vec_stvxl,
+ &B11_vec_stvxl,
+ &B12_vec_stvxl,
+ &B13_vec_stvxl,
+ &B14_vec_stvxl,
+ &B15_vec_stvxl,
+ &B16_vec_stvxl,
+ &B17_vec_stvxl,
+ &B18_vec_stvxl,
+ &B19_vec_stvxl,
+ &B20_vec_stvxl,
+ &B21_vec_stvxl,
+ &B22_vec_stvxl,
+ &B23_vec_stvxl,
+ &B24_vec_stvxl,
+ &B25_vec_stvxl,
+ &B26_vec_stvxl,
+ &B27_vec_stvxl,
+ &B28_vec_stvxl,
+ &B29_vec_stvxl,
+ &B30_vec_stvxl,
+};
+static const struct builtin *const O_vec_sub[19] = {
+ &B1_vec_vsubuhm,
+ &B2_vec_vsubuhm,
+ &B1_vec_vsubuwm,
+ &B2_vec_vsubuwm,
+ &B1_vec_vsububm,
+ &B2_vec_vsububm,
+ &B_vec_vsubfp,
+ &B3_vec_vsubuhm,
+ &B4_vec_vsubuhm,
+ &B3_vec_vsubuwm,
+ &B4_vec_vsubuwm,
+ &B3_vec_vsububm,
+ &B4_vec_vsububm,
+ &B5_vec_vsubuhm,
+ &B6_vec_vsubuhm,
+ &B5_vec_vsubuwm,
+ &B6_vec_vsubuwm,
+ &B5_vec_vsububm,
+ &B6_vec_vsububm,
+};
+static const struct builtin *const O_vec_subc[1] = {
+ &B_vec_vsubcuw,
+};
+static const struct builtin *const O_vec_subs[18] = {
+ &B1_vec_vsubshs,
+ &B1_vec_vsubuhs,
+ &B1_vec_vsubsws,
+ &B1_vec_vsubuws,
+ &B1_vec_vsubsbs,
+ &B1_vec_vsububs,
+ &B2_vec_vsubshs,
+ &B3_vec_vsubshs,
+ &B2_vec_vsubsws,
+ &B3_vec_vsubsws,
+ &B2_vec_vsubsbs,
+ &B3_vec_vsubsbs,
+ &B2_vec_vsubuhs,
+ &B3_vec_vsubuhs,
+ &B2_vec_vsubuws,
+ &B3_vec_vsubuws,
+ &B2_vec_vsububs,
+ &B3_vec_vsububs,
+};
+static const struct builtin *const O_vec_sum2s[1] = {
+ &B_vec_vsum2sws,
+};
+static const struct builtin *const O_vec_sum4s[3] = {
+ &B_vec_vsum4shs,
+ &B_vec_vsum4sbs,
+ &B_vec_vsum4ubs,
+};
+static const struct builtin *const O_vec_sums[1] = {
+ &B_vec_vsumsws,
+};
+static const struct builtin *const O_vec_trunc[1] = {
+ &B_vec_vrfiz,
+};
+static const struct builtin *const O_vec_unpack2sh[2] = {
+ &B1_vec_unpack2sh,
+ &B2_vec_unpack2sh,
+};
+static const struct builtin *const O_vec_unpack2sl[2] = {
+ &B1_vec_unpack2sl,
+ &B2_vec_unpack2sl,
+};
+static const struct builtin *const O_vec_unpack2uh[2] = {
+ &B1_vec_unpack2uh,
+ &B2_vec_unpack2uh,
+};
+static const struct builtin *const O_vec_unpack2ul[2] = {
+ &B1_vec_unpack2ul,
+ &B2_vec_unpack2ul,
+};
+static const struct builtin *const O_vec_unpackh[5] = {
+ &B1_vec_vupkhsh,
+ &B1_vec_vupkhsb,
+ &B_vec_vupkhpx,
+ &B2_vec_vupkhsh,
+ &B2_vec_vupkhsb,
+};
+static const struct builtin *const O_vec_unpackl[5] = {
+ &B1_vec_vupklsh,
+ &B1_vec_vupklsb,
+ &B_vec_vupklpx,
+ &B2_vec_vupklsh,
+ &B2_vec_vupklsb,
+};
+static const struct builtin *const O_vec_vaddcuw[1] = {
+ &B_vec_vaddcuw,
+};
+static const struct builtin *const O_vec_vaddfp[1] = {
+ &B_vec_vaddfp,
+};
+static const struct builtin *const O_vec_vaddsbs[3] = {
+ &B1_vec_vaddsbs,
+ &B2_vec_vaddsbs,
+ &B3_vec_vaddsbs,
+};
+static const struct builtin *const O_vec_vaddshs[3] = {
+ &B1_vec_vaddshs,
+ &B2_vec_vaddshs,
+ &B3_vec_vaddshs,
+};
+static const struct builtin *const O_vec_vaddsws[3] = {
+ &B1_vec_vaddsws,
+ &B2_vec_vaddsws,
+ &B3_vec_vaddsws,
+};
+static const struct builtin *const O_vec_vaddubm[6] = {
+ &B1_vec_vaddubm,
+ &B2_vec_vaddubm,
+ &B3_vec_vaddubm,
+ &B4_vec_vaddubm,
+ &B5_vec_vaddubm,
+ &B6_vec_vaddubm,
+};
+static const struct builtin *const O_vec_vaddubs[3] = {
+ &B1_vec_vaddubs,
+ &B2_vec_vaddubs,
+ &B3_vec_vaddubs,
+};
+static const struct builtin *const O_vec_vadduhm[6] = {
+ &B1_vec_vadduhm,
+ &B2_vec_vadduhm,
+ &B3_vec_vadduhm,
+ &B4_vec_vadduhm,
+ &B5_vec_vadduhm,
+ &B6_vec_vadduhm,
+};
+static const struct builtin *const O_vec_vadduhs[3] = {
+ &B1_vec_vadduhs,
+ &B2_vec_vadduhs,
+ &B3_vec_vadduhs,
+};
+static const struct builtin *const O_vec_vadduwm[6] = {
+ &B1_vec_vadduwm,
+ &B2_vec_vadduwm,
+ &B3_vec_vadduwm,
+ &B4_vec_vadduwm,
+ &B5_vec_vadduwm,
+ &B6_vec_vadduwm,
+};
+static const struct builtin *const O_vec_vadduws[3] = {
+ &B1_vec_vadduws,
+ &B2_vec_vadduws,
+ &B3_vec_vadduws,
+};
+static const struct builtin *const O_vec_vand[24] = {
+ &B1_vec_vand,
+ &B2_vec_vand,
+ &B3_vec_vand,
+ &B4_vec_vand,
+ &B5_vec_vand,
+ &B6_vec_vand,
+ &B7_vec_vand,
+ &B8_vec_vand,
+ &B9_vec_vand,
+ &B10_vec_vand,
+ &B11_vec_vand,
+ &B12_vec_vand,
+ &B13_vec_vand,
+ &B14_vec_vand,
+ &B15_vec_vand,
+ &B16_vec_vand,
+ &B17_vec_vand,
+ &B18_vec_vand,
+ &B19_vec_vand,
+ &B20_vec_vand,
+ &B21_vec_vand,
+ &B22_vec_vand,
+ &B23_vec_vand,
+ &B24_vec_vand,
+};
+static const struct builtin *const O_vec_vandc[24] = {
+ &B1_vec_vandc,
+ &B2_vec_vandc,
+ &B3_vec_vandc,
+ &B4_vec_vandc,
+ &B5_vec_vandc,
+ &B6_vec_vandc,
+ &B7_vec_vandc,
+ &B8_vec_vandc,
+ &B9_vec_vandc,
+ &B10_vec_vandc,
+ &B11_vec_vandc,
+ &B12_vec_vandc,
+ &B13_vec_vandc,
+ &B14_vec_vandc,
+ &B15_vec_vandc,
+ &B16_vec_vandc,
+ &B17_vec_vandc,
+ &B18_vec_vandc,
+ &B19_vec_vandc,
+ &B20_vec_vandc,
+ &B21_vec_vandc,
+ &B22_vec_vandc,
+ &B23_vec_vandc,
+ &B24_vec_vandc,
+};
+static const struct builtin *const O_vec_vavgsb[1] = {
+ &B_vec_vavgsb,
+};
+static const struct builtin *const O_vec_vavgsh[1] = {
+ &B_vec_vavgsh,
+};
+static const struct builtin *const O_vec_vavgsw[1] = {
+ &B_vec_vavgsw,
+};
+static const struct builtin *const O_vec_vavgub[1] = {
+ &B_vec_vavgub,
+};
+static const struct builtin *const O_vec_vavguh[1] = {
+ &B_vec_vavguh,
+};
+static const struct builtin *const O_vec_vavguw[1] = {
+ &B_vec_vavguw,
+};
+static const struct builtin *const O_vec_vcfsx[1] = {
+ &B_vec_vcfsx,
+};
+static const struct builtin *const O_vec_vcfux[1] = {
+ &B_vec_vcfux,
+};
+static const struct builtin *const O_vec_vcmpbfp[1] = {
+ &B_vec_vcmpbfp,
+};
+static const struct builtin *const O_vec_vcmpeqfp[1] = {
+ &B_vec_vcmpeqfp,
+};
+static const struct builtin *const O_vec_vcmpequb[2] = {
+ &B1_vec_vcmpequb,
+ &B2_vec_vcmpequb,
+};
+static const struct builtin *const O_vec_vcmpequh[2] = {
+ &B1_vec_vcmpequh,
+ &B2_vec_vcmpequh,
+};
+static const struct builtin *const O_vec_vcmpequw[2] = {
+ &B1_vec_vcmpequw,
+ &B2_vec_vcmpequw,
+};
+static const struct builtin *const O_vec_vcmpgefp[1] = {
+ &B_vec_vcmpgefp,
+};
+static const struct builtin *const O_vec_vcmpgtfp[1] = {
+ &B_vec_vcmpgtfp,
+};
+static const struct builtin *const O_vec_vcmpgtsb[1] = {
+ &B_vec_vcmpgtsb,
+};
+static const struct builtin *const O_vec_vcmpgtsh[1] = {
+ &B_vec_vcmpgtsh,
+};
+static const struct builtin *const O_vec_vcmpgtsw[1] = {
+ &B_vec_vcmpgtsw,
+};
+static const struct builtin *const O_vec_vcmpgtub[1] = {
+ &B_vec_vcmpgtub,
+};
+static const struct builtin *const O_vec_vcmpgtuh[1] = {
+ &B_vec_vcmpgtuh,
+};
+static const struct builtin *const O_vec_vcmpgtuw[1] = {
+ &B_vec_vcmpgtuw,
+};
+static const struct builtin *const O_vec_vctsxs[1] = {
+ &B_vec_vctsxs,
+};
+static const struct builtin *const O_vec_vctuxs[1] = {
+ &B_vec_vctuxs,
+};
+static const struct builtin *const O_vec_vexptefp[1] = {
+ &B_vec_vexptefp,
+};
+static const struct builtin *const O_vec_vlogefp[1] = {
+ &B_vec_vlogefp,
+};
+static const struct builtin *const O_vec_vmaddfp[1] = {
+ &B_vec_vmaddfp,
+};
+static const struct builtin *const O_vec_vmaxfp[1] = {
+ &B_vec_vmaxfp,
+};
+static const struct builtin *const O_vec_vmaxsb[3] = {
+ &B1_vec_vmaxsb,
+ &B2_vec_vmaxsb,
+ &B3_vec_vmaxsb,
+};
+static const struct builtin *const O_vec_vmaxsh[3] = {
+ &B1_vec_vmaxsh,
+ &B2_vec_vmaxsh,
+ &B3_vec_vmaxsh,
+};
+static const struct builtin *const O_vec_vmaxsw[3] = {
+ &B1_vec_vmaxsw,
+ &B2_vec_vmaxsw,
+ &B3_vec_vmaxsw,
+};
+static const struct builtin *const O_vec_vmaxub[3] = {
+ &B1_vec_vmaxub,
+ &B2_vec_vmaxub,
+ &B3_vec_vmaxub,
+};
+static const struct builtin *const O_vec_vmaxuh[3] = {
+ &B1_vec_vmaxuh,
+ &B2_vec_vmaxuh,
+ &B3_vec_vmaxuh,
+};
+static const struct builtin *const O_vec_vmaxuw[3] = {
+ &B1_vec_vmaxuw,
+ &B2_vec_vmaxuw,
+ &B3_vec_vmaxuw,
+};
+static const struct builtin *const O_vec_vmhaddshs[1] = {
+ &B_vec_vmhaddshs,
+};
+static const struct builtin *const O_vec_vmhraddshs[1] = {
+ &B_vec_vmhraddshs,
+};
+static const struct builtin *const O_vec_vminfp[1] = {
+ &B_vec_vminfp,
+};
+static const struct builtin *const O_vec_vminsb[3] = {
+ &B1_vec_vminsb,
+ &B2_vec_vminsb,
+ &B3_vec_vminsb,
+};
+static const struct builtin *const O_vec_vminsh[3] = {
+ &B1_vec_vminsh,
+ &B2_vec_vminsh,
+ &B3_vec_vminsh,
+};
+static const struct builtin *const O_vec_vminsw[3] = {
+ &B1_vec_vminsw,
+ &B2_vec_vminsw,
+ &B3_vec_vminsw,
+};
+static const struct builtin *const O_vec_vminub[3] = {
+ &B1_vec_vminub,
+ &B2_vec_vminub,
+ &B3_vec_vminub,
+};
+static const struct builtin *const O_vec_vminuh[3] = {
+ &B1_vec_vminuh,
+ &B2_vec_vminuh,
+ &B3_vec_vminuh,
+};
+static const struct builtin *const O_vec_vminuw[3] = {
+ &B1_vec_vminuw,
+ &B2_vec_vminuw,
+ &B3_vec_vminuw,
+};
+static const struct builtin *const O_vec_vmladduhm[4] = {
+ &B1_vec_vmladduhm,
+ &B2_vec_vmladduhm,
+ &B3_vec_vmladduhm,
+ &B4_vec_vmladduhm,
+};
+static const struct builtin *const O_vec_vmrghb[3] = {
+ &B1_vec_vmrghb,
+ &B2_vec_vmrghb,
+ &B3_vec_vmrghb,
+};
+static const struct builtin *const O_vec_vmrghh[4] = {
+ &B1_vec_vmrghh,
+ &B2_vec_vmrghh,
+ &B3_vec_vmrghh,
+ &B4_vec_vmrghh,
+};
+static const struct builtin *const O_vec_vmrghw[4] = {
+ &B1_vec_vmrghw,
+ &B2_vec_vmrghw,
+ &B3_vec_vmrghw,
+ &B4_vec_vmrghw,
+};
+static const struct builtin *const O_vec_vmrglb[3] = {
+ &B1_vec_vmrglb,
+ &B2_vec_vmrglb,
+ &B3_vec_vmrglb,
+};
+static const struct builtin *const O_vec_vmrglh[4] = {
+ &B1_vec_vmrglh,
+ &B2_vec_vmrglh,
+ &B3_vec_vmrglh,
+ &B4_vec_vmrglh,
+};
+static const struct builtin *const O_vec_vmrglw[4] = {
+ &B1_vec_vmrglw,
+ &B2_vec_vmrglw,
+ &B3_vec_vmrglw,
+ &B4_vec_vmrglw,
+};
+static const struct builtin *const O_vec_vmsummbm[1] = {
+ &B_vec_vmsummbm,
+};
+static const struct builtin *const O_vec_vmsumshm[1] = {
+ &B_vec_vmsumshm,
+};
+static const struct builtin *const O_vec_vmsumshs[1] = {
+ &B_vec_vmsumshs,
+};
+static const struct builtin *const O_vec_vmsumubm[1] = {
+ &B_vec_vmsumubm,
+};
+static const struct builtin *const O_vec_vmsumuhm[1] = {
+ &B_vec_vmsumuhm,
+};
+static const struct builtin *const O_vec_vmsumuhs[1] = {
+ &B_vec_vmsumuhs,
+};
+static const struct builtin *const O_vec_vmulesb[1] = {
+ &B_vec_vmulesb,
+};
+static const struct builtin *const O_vec_vmulesh[1] = {
+ &B_vec_vmulesh,
+};
+static const struct builtin *const O_vec_vmuleub[1] = {
+ &B_vec_vmuleub,
+};
+static const struct builtin *const O_vec_vmuleuh[1] = {
+ &B_vec_vmuleuh,
+};
+static const struct builtin *const O_vec_vmulosb[1] = {
+ &B_vec_vmulosb,
+};
+static const struct builtin *const O_vec_vmulosh[1] = {
+ &B_vec_vmulosh,
+};
+static const struct builtin *const O_vec_vmuloub[1] = {
+ &B_vec_vmuloub,
+};
+static const struct builtin *const O_vec_vmulouh[1] = {
+ &B_vec_vmulouh,
+};
+static const struct builtin *const O_vec_vnmsubfp[1] = {
+ &B_vec_vnmsubfp,
+};
+static const struct builtin *const O_vec_vnor[10] = {
+ &B1_vec_vnor,
+ &B2_vec_vnor,
+ &B3_vec_vnor,
+ &B4_vec_vnor,
+ &B5_vec_vnor,
+ &B6_vec_vnor,
+ &B7_vec_vnor,
+ &B8_vec_vnor,
+ &B9_vec_vnor,
+ &B10_vec_vnor,
+};
+static const struct builtin *const O_vec_vor[24] = {
+ &B1_vec_vor,
+ &B2_vec_vor,
+ &B3_vec_vor,
+ &B4_vec_vor,
+ &B5_vec_vor,
+ &B6_vec_vor,
+ &B7_vec_vor,
+ &B8_vec_vor,
+ &B9_vec_vor,
+ &B10_vec_vor,
+ &B11_vec_vor,
+ &B12_vec_vor,
+ &B13_vec_vor,
+ &B14_vec_vor,
+ &B15_vec_vor,
+ &B16_vec_vor,
+ &B17_vec_vor,
+ &B18_vec_vor,
+ &B19_vec_vor,
+ &B20_vec_vor,
+ &B21_vec_vor,
+ &B22_vec_vor,
+ &B23_vec_vor,
+ &B24_vec_vor,
+};
+static const struct builtin *const O_vec_vperm[11] = {
+ &B1_vec_vperm,
+ &B2_vec_vperm,
+ &B3_vec_vperm,
+ &B4_vec_vperm,
+ &B5_vec_vperm,
+ &B6_vec_vperm,
+ &B7_vec_vperm,
+ &B8_vec_vperm,
+ &B9_vec_vperm,
+ &B10_vec_vperm,
+ &B11_vec_vperm,
+};
+static const struct builtin *const O_vec_vpkpx[1] = {
+ &B_vec_vpkpx,
+};
+static const struct builtin *const O_vec_vpkshss[1] = {
+ &B_vec_vpkshss,
+};
+static const struct builtin *const O_vec_vpkshus[1] = {
+ &B_vec_vpkshus,
+};
+static const struct builtin *const O_vec_vpkswss[1] = {
+ &B_vec_vpkswss,
+};
+static const struct builtin *const O_vec_vpkswus[1] = {
+ &B_vec_vpkswus,
+};
+static const struct builtin *const O_vec_vpkuhum[3] = {
+ &B1_vec_vpkuhum,
+ &B2_vec_vpkuhum,
+ &B3_vec_vpkuhum,
+};
+static const struct builtin *const O_vec_vpkuhus[1] = {
+ &B_vec_vpkuhus,
+};
+static const struct builtin *const O_vec_vpkuwum[3] = {
+ &B1_vec_vpkuwum,
+ &B2_vec_vpkuwum,
+ &B3_vec_vpkuwum,
+};
+static const struct builtin *const O_vec_vpkuwus[1] = {
+ &B_vec_vpkuwus,
+};
+static const struct builtin *const O_vec_vrefp[1] = {
+ &B_vec_vrefp,
+};
+static const struct builtin *const O_vec_vrfim[1] = {
+ &B_vec_vrfim,
+};
+static const struct builtin *const O_vec_vrfin[1] = {
+ &B_vec_vrfin,
+};
+static const struct builtin *const O_vec_vrfip[1] = {
+ &B_vec_vrfip,
+};
+static const struct builtin *const O_vec_vrfiz[1] = {
+ &B_vec_vrfiz,
+};
+static const struct builtin *const O_vec_vrlb[2] = {
+ &B1_vec_vrlb,
+ &B2_vec_vrlb,
+};
+static const struct builtin *const O_vec_vrlh[2] = {
+ &B1_vec_vrlh,
+ &B2_vec_vrlh,
+};
+static const struct builtin *const O_vec_vrlw[2] = {
+ &B1_vec_vrlw,
+ &B2_vec_vrlw,
+};
+static const struct builtin *const O_vec_vrsqrtefp[1] = {
+ &B_vec_vrsqrtefp,
+};
+static const struct builtin *const O_vec_vsel[20] = {
+ &B1_vec_vsel,
+ &B2_vec_vsel,
+ &B3_vec_vsel,
+ &B4_vec_vsel,
+ &B5_vec_vsel,
+ &B6_vec_vsel,
+ &B7_vec_vsel,
+ &B8_vec_vsel,
+ &B9_vec_vsel,
+ &B10_vec_vsel,
+ &B11_vec_vsel,
+ &B12_vec_vsel,
+ &B13_vec_vsel,
+ &B14_vec_vsel,
+ &B15_vec_vsel,
+ &B16_vec_vsel,
+ &B17_vec_vsel,
+ &B18_vec_vsel,
+ &B19_vec_vsel,
+ &B20_vec_vsel,
+};
+static const struct builtin *const O_vec_vsl[30] = {
+ &B1_vec_vsl,
+ &B2_vec_vsl,
+ &B3_vec_vsl,
+ &B4_vec_vsl,
+ &B5_vec_vsl,
+ &B6_vec_vsl,
+ &B7_vec_vsl,
+ &B8_vec_vsl,
+ &B9_vec_vsl,
+ &B10_vec_vsl,
+ &B11_vec_vsl,
+ &B12_vec_vsl,
+ &B13_vec_vsl,
+ &B14_vec_vsl,
+ &B15_vec_vsl,
+ &B16_vec_vsl,
+ &B17_vec_vsl,
+ &B18_vec_vsl,
+ &B19_vec_vsl,
+ &B20_vec_vsl,
+ &B21_vec_vsl,
+ &B22_vec_vsl,
+ &B23_vec_vsl,
+ &B24_vec_vsl,
+ &B25_vec_vsl,
+ &B26_vec_vsl,
+ &B27_vec_vsl,
+ &B28_vec_vsl,
+ &B29_vec_vsl,
+ &B30_vec_vsl,
+};
+static const struct builtin *const O_vec_vslb[2] = {
+ &B1_vec_vslb,
+ &B2_vec_vslb,
+};
+static const struct builtin *const O_vec_vsldoi[11] = {
+ &B1_vec_vsldoi,
+ &B2_vec_vsldoi,
+ &B3_vec_vsldoi,
+ &B4_vec_vsldoi,
+ &B5_vec_vsldoi,
+ &B6_vec_vsldoi,
+ &B7_vec_vsldoi,
+ &B8_vec_vsldoi,
+ &B9_vec_vsldoi,
+ &B10_vec_vsldoi,
+ &B11_vec_vsldoi,
+};
+static const struct builtin *const O_vec_vslh[2] = {
+ &B1_vec_vslh,
+ &B2_vec_vslh,
+};
+static const struct builtin *const O_vec_vslo[16] = {
+ &B1_vec_vslo,
+ &B2_vec_vslo,
+ &B3_vec_vslo,
+ &B4_vec_vslo,
+ &B5_vec_vslo,
+ &B6_vec_vslo,
+ &B7_vec_vslo,
+ &B8_vec_vslo,
+ &B9_vec_vslo,
+ &B10_vec_vslo,
+ &B11_vec_vslo,
+ &B12_vec_vslo,
+ &B13_vec_vslo,
+ &B14_vec_vslo,
+ &B15_vec_vslo,
+ &B16_vec_vslo,
+};
+static const struct builtin *const O_vec_vslw[2] = {
+ &B1_vec_vslw,
+ &B2_vec_vslw,
+};
+static const struct builtin *const O_vec_vspltb[3] = {
+ &B1_vec_vspltb,
+ &B2_vec_vspltb,
+ &B3_vec_vspltb,
+};
+static const struct builtin *const O_vec_vsplth[4] = {
+ &B1_vec_vsplth,
+ &B2_vec_vsplth,
+ &B3_vec_vsplth,
+ &B4_vec_vsplth,
+};
+static const struct builtin *const O_vec_vspltisb[1] = {
+ &B_vec_vspltisb,
+};
+static const struct builtin *const O_vec_vspltish[1] = {
+ &B_vec_vspltish,
+};
+static const struct builtin *const O_vec_vspltisw[1] = {
+ &B_vec_vspltisw,
+};
+static const struct builtin *const O_vec_vspltw[4] = {
+ &B1_vec_vspltw,
+ &B2_vec_vspltw,
+ &B3_vec_vspltw,
+ &B4_vec_vspltw,
+};
+static const struct builtin *const O_vec_vsr[30] = {
+ &B1_vec_vsr,
+ &B2_vec_vsr,
+ &B3_vec_vsr,
+ &B4_vec_vsr,
+ &B5_vec_vsr,
+ &B6_vec_vsr,
+ &B7_vec_vsr,
+ &B8_vec_vsr,
+ &B9_vec_vsr,
+ &B10_vec_vsr,
+ &B11_vec_vsr,
+ &B12_vec_vsr,
+ &B13_vec_vsr,
+ &B14_vec_vsr,
+ &B15_vec_vsr,
+ &B16_vec_vsr,
+ &B17_vec_vsr,
+ &B18_vec_vsr,
+ &B19_vec_vsr,
+ &B20_vec_vsr,
+ &B21_vec_vsr,
+ &B22_vec_vsr,
+ &B23_vec_vsr,
+ &B24_vec_vsr,
+ &B25_vec_vsr,
+ &B26_vec_vsr,
+ &B27_vec_vsr,
+ &B28_vec_vsr,
+ &B29_vec_vsr,
+ &B30_vec_vsr,
+};
+static const struct builtin *const O_vec_vsrab[2] = {
+ &B1_vec_vsrab,
+ &B2_vec_vsrab,
+};
+static const struct builtin *const O_vec_vsrah[2] = {
+ &B1_vec_vsrah,
+ &B2_vec_vsrah,
+};
+static const struct builtin *const O_vec_vsraw[2] = {
+ &B1_vec_vsraw,
+ &B2_vec_vsraw,
+};
+static const struct builtin *const O_vec_vsrb[2] = {
+ &B1_vec_vsrb,
+ &B2_vec_vsrb,
+};
+static const struct builtin *const O_vec_vsrh[2] = {
+ &B1_vec_vsrh,
+ &B2_vec_vsrh,
+};
+static const struct builtin *const O_vec_vsro[16] = {
+ &B1_vec_vsro,
+ &B2_vec_vsro,
+ &B3_vec_vsro,
+ &B4_vec_vsro,
+ &B5_vec_vsro,
+ &B6_vec_vsro,
+ &B7_vec_vsro,
+ &B8_vec_vsro,
+ &B9_vec_vsro,
+ &B10_vec_vsro,
+ &B11_vec_vsro,
+ &B12_vec_vsro,
+ &B13_vec_vsro,
+ &B14_vec_vsro,
+ &B15_vec_vsro,
+ &B16_vec_vsro,
+};
+static const struct builtin *const O_vec_vsrw[2] = {
+ &B1_vec_vsrw,
+ &B2_vec_vsrw,
+};
+static const struct builtin *const O_vec_vsubcuw[1] = {
+ &B_vec_vsubcuw,
+};
+static const struct builtin *const O_vec_vsubfp[1] = {
+ &B_vec_vsubfp,
+};
+static const struct builtin *const O_vec_vsubsbs[3] = {
+ &B1_vec_vsubsbs,
+ &B2_vec_vsubsbs,
+ &B3_vec_vsubsbs,
+};
+static const struct builtin *const O_vec_vsubshs[3] = {
+ &B1_vec_vsubshs,
+ &B2_vec_vsubshs,
+ &B3_vec_vsubshs,
+};
+static const struct builtin *const O_vec_vsubsws[3] = {
+ &B1_vec_vsubsws,
+ &B2_vec_vsubsws,
+ &B3_vec_vsubsws,
+};
+static const struct builtin *const O_vec_vsububm[6] = {
+ &B1_vec_vsububm,
+ &B2_vec_vsububm,
+ &B3_vec_vsububm,
+ &B4_vec_vsububm,
+ &B5_vec_vsububm,
+ &B6_vec_vsububm,
+};
+static const struct builtin *const O_vec_vsububs[3] = {
+ &B1_vec_vsububs,
+ &B2_vec_vsububs,
+ &B3_vec_vsububs,
+};
+static const struct builtin *const O_vec_vsubuhm[6] = {
+ &B1_vec_vsubuhm,
+ &B2_vec_vsubuhm,
+ &B3_vec_vsubuhm,
+ &B4_vec_vsubuhm,
+ &B5_vec_vsubuhm,
+ &B6_vec_vsubuhm,
+};
+static const struct builtin *const O_vec_vsubuhs[3] = {
+ &B1_vec_vsubuhs,
+ &B2_vec_vsubuhs,
+ &B3_vec_vsubuhs,
+};
+static const struct builtin *const O_vec_vsubuwm[6] = {
+ &B1_vec_vsubuwm,
+ &B2_vec_vsubuwm,
+ &B3_vec_vsubuwm,
+ &B4_vec_vsubuwm,
+ &B5_vec_vsubuwm,
+ &B6_vec_vsubuwm,
+};
+static const struct builtin *const O_vec_vsubuws[3] = {
+ &B1_vec_vsubuws,
+ &B2_vec_vsubuws,
+ &B3_vec_vsubuws,
+};
+static const struct builtin *const O_vec_vsum2sws[1] = {
+ &B_vec_vsum2sws,
+};
+static const struct builtin *const O_vec_vsum4sbs[1] = {
+ &B_vec_vsum4sbs,
+};
+static const struct builtin *const O_vec_vsum4shs[1] = {
+ &B_vec_vsum4shs,
+};
+static const struct builtin *const O_vec_vsum4ubs[1] = {
+ &B_vec_vsum4ubs,
+};
+static const struct builtin *const O_vec_vsumsws[1] = {
+ &B_vec_vsumsws,
+};
+static const struct builtin *const O_vec_vupkhpx[1] = {
+ &B_vec_vupkhpx,
+};
+static const struct builtin *const O_vec_vupkhsb[2] = {
+ &B1_vec_vupkhsb,
+ &B2_vec_vupkhsb,
+};
+static const struct builtin *const O_vec_vupkhsh[2] = {
+ &B1_vec_vupkhsh,
+ &B2_vec_vupkhsh,
+};
+static const struct builtin *const O_vec_vupklpx[1] = {
+ &B_vec_vupklpx,
+};
+static const struct builtin *const O_vec_vupklsb[2] = {
+ &B1_vec_vupklsb,
+ &B2_vec_vupklsb,
+};
+static const struct builtin *const O_vec_vupklsh[2] = {
+ &B1_vec_vupklsh,
+ &B2_vec_vupklsh,
+};
+static const struct builtin *const O_vec_vxor[24] = {
+ &B1_vec_vxor,
+ &B2_vec_vxor,
+ &B3_vec_vxor,
+ &B4_vec_vxor,
+ &B5_vec_vxor,
+ &B6_vec_vxor,
+ &B7_vec_vxor,
+ &B8_vec_vxor,
+ &B9_vec_vxor,
+ &B10_vec_vxor,
+ &B11_vec_vxor,
+ &B12_vec_vxor,
+ &B13_vec_vxor,
+ &B14_vec_vxor,
+ &B15_vec_vxor,
+ &B16_vec_vxor,
+ &B17_vec_vxor,
+ &B18_vec_vxor,
+ &B19_vec_vxor,
+ &B20_vec_vxor,
+ &B21_vec_vxor,
+ &B22_vec_vxor,
+ &B23_vec_vxor,
+ &B24_vec_vxor,
+};
+static const struct builtin *const O_vec_xor[24] = {
+ &B1_vec_vxor,
+ &B2_vec_vxor,
+ &B3_vec_vxor,
+ &B4_vec_vxor,
+ &B5_vec_vxor,
+ &B6_vec_vxor,
+ &B7_vec_vxor,
+ &B8_vec_vxor,
+ &B9_vec_vxor,
+ &B10_vec_vxor,
+ &B11_vec_vxor,
+ &B12_vec_vxor,
+ &B13_vec_vxor,
+ &B14_vec_vxor,
+ &B15_vec_vxor,
+ &B16_vec_vxor,
+ &B17_vec_vxor,
+ &B18_vec_vxor,
+ &B19_vec_vxor,
+ &B20_vec_vxor,
+ &B21_vec_vxor,
+ &B22_vec_vxor,
+ &B23_vec_vxor,
+ &B24_vec_vxor,
+};
+
+const struct overloadx Overload[] = {
+ { "vec_abs", 4, 1, O_vec_abs, O_UID(0) },
+ { "vec_abss", 3, 1, O_vec_abss, O_UID(1) },
+ { "vec_add", 19, 2, O_vec_add, O_UID(2) },
+ { "vec_addc", 1, 2, O_vec_addc, O_UID(3) },
+ { "vec_adds", 18, 2, O_vec_adds, O_UID(4) },
+ { "vec_all_eq", 23, 2, O_vec_all_eq, O_UID(5) },
+ { "vec_all_ge", 19, 2, O_vec_all_ge, O_UID(6) },
+ { "vec_all_gt", 19, 2, O_vec_all_gt, O_UID(7) },
+ { "vec_all_in", 1, 2, O_vec_all_in, O_UID(8) },
+ { "vec_all_le", 19, 2, O_vec_all_le, O_UID(9) },
+ { "vec_all_lt", 19, 2, O_vec_all_lt, O_UID(10) },
+ { "vec_all_nan", 1, 1, O_vec_all_nan, O_UID(11) },
+ { "vec_all_ne", 23, 2, O_vec_all_ne, O_UID(12) },
+ { "vec_all_nge", 1, 2, O_vec_all_nge, O_UID(13) },
+ { "vec_all_ngt", 1, 2, O_vec_all_ngt, O_UID(14) },
+ { "vec_all_nle", 1, 2, O_vec_all_nle, O_UID(15) },
+ { "vec_all_nlt", 1, 2, O_vec_all_nlt, O_UID(16) },
+ { "vec_all_numeric", 1, 1, O_vec_all_numeric, O_UID(17) },
+ { "vec_and", 24, 2, O_vec_and, O_UID(18) },
+ { "vec_andc", 24, 2, O_vec_andc, O_UID(19) },
+ { "vec_any_eq", 23, 2, O_vec_any_eq, O_UID(20) },
+ { "vec_any_ge", 19, 2, O_vec_any_ge, O_UID(21) },
+ { "vec_any_gt", 19, 2, O_vec_any_gt, O_UID(22) },
+ { "vec_any_le", 19, 2, O_vec_any_le, O_UID(23) },
+ { "vec_any_lt", 19, 2, O_vec_any_lt, O_UID(24) },
+ { "vec_any_nan", 1, 1, O_vec_any_nan, O_UID(25) },
+ { "vec_any_ne", 23, 2, O_vec_any_ne, O_UID(26) },
+ { "vec_any_nge", 1, 2, O_vec_any_nge, O_UID(27) },
+ { "vec_any_ngt", 1, 2, O_vec_any_ngt, O_UID(28) },
+ { "vec_any_nle", 1, 2, O_vec_any_nle, O_UID(29) },
+ { "vec_any_nlt", 1, 2, O_vec_any_nlt, O_UID(30) },
+ { "vec_any_numeric", 1, 1, O_vec_any_numeric, O_UID(31) },
+ { "vec_any_out", 1, 2, O_vec_any_out, O_UID(32) },
+ { "vec_avg", 6, 2, O_vec_avg, O_UID(33) },
+ { "vec_ceil", 1, 1, O_vec_ceil, O_UID(34) },
+ { "vec_cmpb", 1, 2, O_vec_cmpb, O_UID(35) },
+ { "vec_cmpeq", 7, 2, O_vec_cmpeq, O_UID(36) },
+ { "vec_cmpge", 1, 2, O_vec_cmpge, O_UID(37) },
+ { "vec_cmpgt", 7, 2, O_vec_cmpgt, O_UID(38) },
+ { "vec_cmple", 1, 2, O_vec_cmple, O_UID(39) },
+ { "vec_cmplt", 7, 2, O_vec_cmplt, O_UID(40) },
+ { "vec_ctf", 2, 2, O_vec_ctf, O_UID(41) },
+ { "vec_cts", 1, 2, O_vec_cts, O_UID(42) },
+ { "vec_ctu", 1, 2, O_vec_ctu, O_UID(43) },
+ { "vec_dss", 1, 1, O_vec_dss, O_UID(44) },
+ { "vec_dssall", 1, 0, O_vec_dssall, O_UID(45) },
+ { "vec_dst", 20, 3, O_vec_dst, O_UID(46) },
+ { "vec_dstst", 20, 3, O_vec_dstst, O_UID(47) },
+ { "vec_dststt", 20, 3, O_vec_dststt, O_UID(48) },
+ { "vec_dstt", 20, 3, O_vec_dstt, O_UID(49) },
+ { "vec_expte", 1, 1, O_vec_expte, O_UID(50) },
+ { "vec_floor", 1, 1, O_vec_floor, O_UID(51) },
+ { "vec_ld", 20, 2, O_vec_ld, O_UID(52) },
+ { "vec_lde", 9, 2, O_vec_lde, O_UID(53) },
+ { "vec_ldl", 20, 2, O_vec_ldl, O_UID(54) },
+ { "vec_loge", 1, 1, O_vec_loge, O_UID(55) },
+ { "vec_lvebx", 2, 2, O_vec_lvebx, O_UID(56) },
+ { "vec_lvehx", 2, 2, O_vec_lvehx, O_UID(57) },
+ { "vec_lvewx", 5, 2, O_vec_lvewx, O_UID(58) },
+ { "vec_lvsl", 9, 2, O_vec_lvsl, O_UID(59) },
+ { "vec_lvsr", 9, 2, O_vec_lvsr, O_UID(60) },
+ { "vec_lvx", 20, 2, O_vec_lvx, O_UID(61) },
+ { "vec_lvxl", 20, 2, O_vec_lvxl, O_UID(62) },
+ { "vec_madd", 1, 3, O_vec_madd, O_UID(63) },
+ { "vec_madds", 1, 3, O_vec_madds, O_UID(64) },
+ { "vec_max", 19, 2, O_vec_max, O_UID(65) },
+ { "vec_mergeh", 11, 2, O_vec_mergeh, O_UID(66) },
+ { "vec_mergel", 11, 2, O_vec_mergel, O_UID(67) },
+ { "vec_mfvscr", 1, 0, O_vec_mfvscr, O_UID(68) },
+ { "vec_min", 19, 2, O_vec_min, O_UID(69) },
+ { "vec_mladd", 4, 3, O_vec_mladd, O_UID(70) },
+ { "vec_mradds", 1, 3, O_vec_mradds, O_UID(71) },
+ { "vec_msum", 4, 3, O_vec_msum, O_UID(72) },
+ { "vec_msums", 2, 3, O_vec_msums, O_UID(73) },
+ { "vec_mtvscr", 10, 1, O_vec_mtvscr, O_UID(74) },
+ { "vec_mule", 4, 2, O_vec_mule, O_UID(75) },
+ { "vec_mulo", 4, 2, O_vec_mulo, O_UID(76) },
+ { "vec_nmsub", 1, 3, O_vec_nmsub, O_UID(77) },
+ { "vec_nor", 10, 2, O_vec_nor, O_UID(78) },
+ { "vec_or", 24, 2, O_vec_or, O_UID(79) },
+ { "vec_pack", 6, 2, O_vec_pack, O_UID(80) },
+ { "vec_packpx", 1, 2, O_vec_packpx, O_UID(81) },
+ { "vec_packs", 4, 2, O_vec_packs, O_UID(82) },
+ { "vec_packsu", 4, 2, O_vec_packsu, O_UID(83) },
+ { "vec_perm", 11, 3, O_vec_perm, O_UID(84) },
+ { "vec_re", 1, 1, O_vec_re, O_UID(85) },
+ { "vec_rl", 6, 2, O_vec_rl, O_UID(86) },
+ { "vec_round", 1, 1, O_vec_round, O_UID(87) },
+ { "vec_rsqrte", 1, 1, O_vec_rsqrte, O_UID(88) },
+ { "vec_sel", 20, 3, O_vec_sel, O_UID(89) },
+ { "vec_sl", 6, 2, O_vec_sl, O_UID(90) },
+ { "vec_sld", 11, 3, O_vec_sld, O_UID(91) },
+ { "vec_sll", 30, 2, O_vec_sll, O_UID(92) },
+ { "vec_slo", 16, 2, O_vec_slo, O_UID(93) },
+ { "vec_splat", 11, 2, O_vec_splat, O_UID(94) },
+ { "vec_splat_s16", 1, 1, O_vec_splat_s16, O_UID(95) },
+ { "vec_splat_s32", 1, 1, O_vec_splat_s32, O_UID(96) },
+ { "vec_splat_s8", 1, 1, O_vec_splat_s8, O_UID(97) },
+ { "vec_splat_u16", 1, 1, O_vec_splat_u16, O_UID(98) },
+ { "vec_splat_u32", 1, 1, O_vec_splat_u32, O_UID(99) },
+ { "vec_splat_u8", 1, 1, O_vec_splat_u8, O_UID(100) },
+ { "vec_sr", 6, 2, O_vec_sr, O_UID(101) },
+ { "vec_sra", 6, 2, O_vec_sra, O_UID(102) },
+ { "vec_srl", 30, 2, O_vec_srl, O_UID(103) },
+ { "vec_sro", 16, 2, O_vec_sro, O_UID(104) },
+ { "vec_st", 30, 3, O_vec_st, O_UID(105) },
+ { "vec_ste", 19, 3, O_vec_ste, O_UID(106) },
+ { "vec_stl", 30, 3, O_vec_stl, O_UID(107) },
+ { "vec_stvebx", 6, 3, O_vec_stvebx, O_UID(108) },
+ { "vec_stvehx", 4, 3, O_vec_stvehx, O_UID(109) },
+ { "vec_stvewx", 9, 3, O_vec_stvewx, O_UID(110) },
+ { "vec_stvx", 30, 3, O_vec_stvx, O_UID(111) },
+ { "vec_stvxl", 30, 3, O_vec_stvxl, O_UID(112) },
+ { "vec_sub", 19, 2, O_vec_sub, O_UID(113) },
+ { "vec_subc", 1, 2, O_vec_subc, O_UID(114) },
+ { "vec_subs", 18, 2, O_vec_subs, O_UID(115) },
+ { "vec_sum2s", 1, 2, O_vec_sum2s, O_UID(116) },
+ { "vec_sum4s", 3, 2, O_vec_sum4s, O_UID(117) },
+ { "vec_sums", 1, 2, O_vec_sums, O_UID(118) },
+ { "vec_trunc", 1, 1, O_vec_trunc, O_UID(119) },
+ { "vec_unpack2sh", 2, 2, O_vec_unpack2sh, O_UID(120) },
+ { "vec_unpack2sl", 2, 2, O_vec_unpack2sl, O_UID(121) },
+ { "vec_unpack2uh", 2, 2, O_vec_unpack2uh, O_UID(122) },
+ { "vec_unpack2ul", 2, 2, O_vec_unpack2ul, O_UID(123) },
+ { "vec_unpackh", 5, 1, O_vec_unpackh, O_UID(124) },
+ { "vec_unpackl", 5, 1, O_vec_unpackl, O_UID(125) },
+ { "vec_vaddcuw", 1, 2, O_vec_vaddcuw, O_UID(126) },
+ { "vec_vaddfp", 1, 2, O_vec_vaddfp, O_UID(127) },
+ { "vec_vaddsbs", 3, 2, O_vec_vaddsbs, O_UID(128) },
+ { "vec_vaddshs", 3, 2, O_vec_vaddshs, O_UID(129) },
+ { "vec_vaddsws", 3, 2, O_vec_vaddsws, O_UID(130) },
+ { "vec_vaddubm", 6, 2, O_vec_vaddubm, O_UID(131) },
+ { "vec_vaddubs", 3, 2, O_vec_vaddubs, O_UID(132) },
+ { "vec_vadduhm", 6, 2, O_vec_vadduhm, O_UID(133) },
+ { "vec_vadduhs", 3, 2, O_vec_vadduhs, O_UID(134) },
+ { "vec_vadduwm", 6, 2, O_vec_vadduwm, O_UID(135) },
+ { "vec_vadduws", 3, 2, O_vec_vadduws, O_UID(136) },
+ { "vec_vand", 24, 2, O_vec_vand, O_UID(137) },
+ { "vec_vandc", 24, 2, O_vec_vandc, O_UID(138) },
+ { "vec_vavgsb", 1, 2, O_vec_vavgsb, O_UID(139) },
+ { "vec_vavgsh", 1, 2, O_vec_vavgsh, O_UID(140) },
+ { "vec_vavgsw", 1, 2, O_vec_vavgsw, O_UID(141) },
+ { "vec_vavgub", 1, 2, O_vec_vavgub, O_UID(142) },
+ { "vec_vavguh", 1, 2, O_vec_vavguh, O_UID(143) },
+ { "vec_vavguw", 1, 2, O_vec_vavguw, O_UID(144) },
+ { "vec_vcfsx", 1, 2, O_vec_vcfsx, O_UID(145) },
+ { "vec_vcfux", 1, 2, O_vec_vcfux, O_UID(146) },
+ { "vec_vcmpbfp", 1, 2, O_vec_vcmpbfp, O_UID(147) },
+ { "vec_vcmpeqfp", 1, 2, O_vec_vcmpeqfp, O_UID(148) },
+ { "vec_vcmpequb", 2, 2, O_vec_vcmpequb, O_UID(149) },
+ { "vec_vcmpequh", 2, 2, O_vec_vcmpequh, O_UID(150) },
+ { "vec_vcmpequw", 2, 2, O_vec_vcmpequw, O_UID(151) },
+ { "vec_vcmpgefp", 1, 2, O_vec_vcmpgefp, O_UID(152) },
+ { "vec_vcmpgtfp", 1, 2, O_vec_vcmpgtfp, O_UID(153) },
+ { "vec_vcmpgtsb", 1, 2, O_vec_vcmpgtsb, O_UID(154) },
+ { "vec_vcmpgtsh", 1, 2, O_vec_vcmpgtsh, O_UID(155) },
+ { "vec_vcmpgtsw", 1, 2, O_vec_vcmpgtsw, O_UID(156) },
+ { "vec_vcmpgtub", 1, 2, O_vec_vcmpgtub, O_UID(157) },
+ { "vec_vcmpgtuh", 1, 2, O_vec_vcmpgtuh, O_UID(158) },
+ { "vec_vcmpgtuw", 1, 2, O_vec_vcmpgtuw, O_UID(159) },
+ { "vec_vctsxs", 1, 2, O_vec_vctsxs, O_UID(160) },
+ { "vec_vctuxs", 1, 2, O_vec_vctuxs, O_UID(161) },
+ { "vec_vexptefp", 1, 1, O_vec_vexptefp, O_UID(162) },
+ { "vec_vlogefp", 1, 1, O_vec_vlogefp, O_UID(163) },
+ { "vec_vmaddfp", 1, 3, O_vec_vmaddfp, O_UID(164) },
+ { "vec_vmaxfp", 1, 2, O_vec_vmaxfp, O_UID(165) },
+ { "vec_vmaxsb", 3, 2, O_vec_vmaxsb, O_UID(166) },
+ { "vec_vmaxsh", 3, 2, O_vec_vmaxsh, O_UID(167) },
+ { "vec_vmaxsw", 3, 2, O_vec_vmaxsw, O_UID(168) },
+ { "vec_vmaxub", 3, 2, O_vec_vmaxub, O_UID(169) },
+ { "vec_vmaxuh", 3, 2, O_vec_vmaxuh, O_UID(170) },
+ { "vec_vmaxuw", 3, 2, O_vec_vmaxuw, O_UID(171) },
+ { "vec_vmhaddshs", 1, 3, O_vec_vmhaddshs, O_UID(172) },
+ { "vec_vmhraddshs", 1, 3, O_vec_vmhraddshs, O_UID(173) },
+ { "vec_vminfp", 1, 2, O_vec_vminfp, O_UID(174) },
+ { "vec_vminsb", 3, 2, O_vec_vminsb, O_UID(175) },
+ { "vec_vminsh", 3, 2, O_vec_vminsh, O_UID(176) },
+ { "vec_vminsw", 3, 2, O_vec_vminsw, O_UID(177) },
+ { "vec_vminub", 3, 2, O_vec_vminub, O_UID(178) },
+ { "vec_vminuh", 3, 2, O_vec_vminuh, O_UID(179) },
+ { "vec_vminuw", 3, 2, O_vec_vminuw, O_UID(180) },
+ { "vec_vmladduhm", 4, 3, O_vec_vmladduhm, O_UID(181) },
+ { "vec_vmrghb", 3, 2, O_vec_vmrghb, O_UID(182) },
+ { "vec_vmrghh", 4, 2, O_vec_vmrghh, O_UID(183) },
+ { "vec_vmrghw", 4, 2, O_vec_vmrghw, O_UID(184) },
+ { "vec_vmrglb", 3, 2, O_vec_vmrglb, O_UID(185) },
+ { "vec_vmrglh", 4, 2, O_vec_vmrglh, O_UID(186) },
+ { "vec_vmrglw", 4, 2, O_vec_vmrglw, O_UID(187) },
+ { "vec_vmsummbm", 1, 3, O_vec_vmsummbm, O_UID(188) },
+ { "vec_vmsumshm", 1, 3, O_vec_vmsumshm, O_UID(189) },
+ { "vec_vmsumshs", 1, 3, O_vec_vmsumshs, O_UID(190) },
+ { "vec_vmsumubm", 1, 3, O_vec_vmsumubm, O_UID(191) },
+ { "vec_vmsumuhm", 1, 3, O_vec_vmsumuhm, O_UID(192) },
+ { "vec_vmsumuhs", 1, 3, O_vec_vmsumuhs, O_UID(193) },
+ { "vec_vmulesb", 1, 2, O_vec_vmulesb, O_UID(194) },
+ { "vec_vmulesh", 1, 2, O_vec_vmulesh, O_UID(195) },
+ { "vec_vmuleub", 1, 2, O_vec_vmuleub, O_UID(196) },
+ { "vec_vmuleuh", 1, 2, O_vec_vmuleuh, O_UID(197) },
+ { "vec_vmulosb", 1, 2, O_vec_vmulosb, O_UID(198) },
+ { "vec_vmulosh", 1, 2, O_vec_vmulosh, O_UID(199) },
+ { "vec_vmuloub", 1, 2, O_vec_vmuloub, O_UID(200) },
+ { "vec_vmulouh", 1, 2, O_vec_vmulouh, O_UID(201) },
+ { "vec_vnmsubfp", 1, 3, O_vec_vnmsubfp, O_UID(202) },
+ { "vec_vnor", 10, 2, O_vec_vnor, O_UID(203) },
+ { "vec_vor", 24, 2, O_vec_vor, O_UID(204) },
+ { "vec_vperm", 11, 3, O_vec_vperm, O_UID(205) },
+ { "vec_vpkpx", 1, 2, O_vec_vpkpx, O_UID(206) },
+ { "vec_vpkshss", 1, 2, O_vec_vpkshss, O_UID(207) },
+ { "vec_vpkshus", 1, 2, O_vec_vpkshus, O_UID(208) },
+ { "vec_vpkswss", 1, 2, O_vec_vpkswss, O_UID(209) },
+ { "vec_vpkswus", 1, 2, O_vec_vpkswus, O_UID(210) },
+ { "vec_vpkuhum", 3, 2, O_vec_vpkuhum, O_UID(211) },
+ { "vec_vpkuhus", 1, 2, O_vec_vpkuhus, O_UID(212) },
+ { "vec_vpkuwum", 3, 2, O_vec_vpkuwum, O_UID(213) },
+ { "vec_vpkuwus", 1, 2, O_vec_vpkuwus, O_UID(214) },
+ { "vec_vrefp", 1, 1, O_vec_vrefp, O_UID(215) },
+ { "vec_vrfim", 1, 1, O_vec_vrfim, O_UID(216) },
+ { "vec_vrfin", 1, 1, O_vec_vrfin, O_UID(217) },
+ { "vec_vrfip", 1, 1, O_vec_vrfip, O_UID(218) },
+ { "vec_vrfiz", 1, 1, O_vec_vrfiz, O_UID(219) },
+ { "vec_vrlb", 2, 2, O_vec_vrlb, O_UID(220) },
+ { "vec_vrlh", 2, 2, O_vec_vrlh, O_UID(221) },
+ { "vec_vrlw", 2, 2, O_vec_vrlw, O_UID(222) },
+ { "vec_vrsqrtefp", 1, 1, O_vec_vrsqrtefp, O_UID(223) },
+ { "vec_vsel", 20, 3, O_vec_vsel, O_UID(224) },
+ { "vec_vsl", 30, 2, O_vec_vsl, O_UID(225) },
+ { "vec_vslb", 2, 2, O_vec_vslb, O_UID(226) },
+ { "vec_vsldoi", 11, 3, O_vec_vsldoi, O_UID(227) },
+ { "vec_vslh", 2, 2, O_vec_vslh, O_UID(228) },
+ { "vec_vslo", 16, 2, O_vec_vslo, O_UID(229) },
+ { "vec_vslw", 2, 2, O_vec_vslw, O_UID(230) },
+ { "vec_vspltb", 3, 2, O_vec_vspltb, O_UID(231) },
+ { "vec_vsplth", 4, 2, O_vec_vsplth, O_UID(232) },
+ { "vec_vspltisb", 1, 1, O_vec_vspltisb, O_UID(233) },
+ { "vec_vspltish", 1, 1, O_vec_vspltish, O_UID(234) },
+ { "vec_vspltisw", 1, 1, O_vec_vspltisw, O_UID(235) },
+ { "vec_vspltw", 4, 2, O_vec_vspltw, O_UID(236) },
+ { "vec_vsr", 30, 2, O_vec_vsr, O_UID(237) },
+ { "vec_vsrab", 2, 2, O_vec_vsrab, O_UID(238) },
+ { "vec_vsrah", 2, 2, O_vec_vsrah, O_UID(239) },
+ { "vec_vsraw", 2, 2, O_vec_vsraw, O_UID(240) },
+ { "vec_vsrb", 2, 2, O_vec_vsrb, O_UID(241) },
+ { "vec_vsrh", 2, 2, O_vec_vsrh, O_UID(242) },
+ { "vec_vsro", 16, 2, O_vec_vsro, O_UID(243) },
+ { "vec_vsrw", 2, 2, O_vec_vsrw, O_UID(244) },
+ { "vec_vsubcuw", 1, 2, O_vec_vsubcuw, O_UID(245) },
+ { "vec_vsubfp", 1, 2, O_vec_vsubfp, O_UID(246) },
+ { "vec_vsubsbs", 3, 2, O_vec_vsubsbs, O_UID(247) },
+ { "vec_vsubshs", 3, 2, O_vec_vsubshs, O_UID(248) },
+ { "vec_vsubsws", 3, 2, O_vec_vsubsws, O_UID(249) },
+ { "vec_vsububm", 6, 2, O_vec_vsububm, O_UID(250) },
+ { "vec_vsububs", 3, 2, O_vec_vsububs, O_UID(251) },
+ { "vec_vsubuhm", 6, 2, O_vec_vsubuhm, O_UID(252) },
+ { "vec_vsubuhs", 3, 2, O_vec_vsubuhs, O_UID(253) },
+ { "vec_vsubuwm", 6, 2, O_vec_vsubuwm, O_UID(254) },
+ { "vec_vsubuws", 3, 2, O_vec_vsubuws, O_UID(255) },
+ { "vec_vsum2sws", 1, 2, O_vec_vsum2sws, O_UID(256) },
+ { "vec_vsum4sbs", 1, 2, O_vec_vsum4sbs, O_UID(257) },
+ { "vec_vsum4shs", 1, 2, O_vec_vsum4shs, O_UID(258) },
+ { "vec_vsum4ubs", 1, 2, O_vec_vsum4ubs, O_UID(259) },
+ { "vec_vsumsws", 1, 2, O_vec_vsumsws, O_UID(260) },
+ { "vec_vupkhpx", 1, 1, O_vec_vupkhpx, O_UID(261) },
+ { "vec_vupkhsb", 2, 1, O_vec_vupkhsb, O_UID(262) },
+ { "vec_vupkhsh", 2, 1, O_vec_vupkhsh, O_UID(263) },
+ { "vec_vupklpx", 1, 1, O_vec_vupklpx, O_UID(264) },
+ { "vec_vupklsb", 2, 1, O_vec_vupklsb, O_UID(265) },
+ { "vec_vupklsh", 2, 1, O_vec_vupklsh, O_UID(266) },
+ { "vec_vxor", 24, 2, O_vec_vxor, O_UID(267) },
+ { "vec_xor", 24, 2, O_vec_xor, O_UID(268) },
+ { NULL, 0, 0, NULL, 0 }
+};
+#define LAST_O_UID O_UID(269)
diff --git a/gcc/config/rs6000/vec.ops b/gcc/config/rs6000/vec.ops
new file mode 100644
index 00000000000..5ef80a2d6b8
--- /dev/null
+++ b/gcc/config/rs6000/vec.ops
@@ -0,0 +1,1025 @@
+# APPLE LOCAL file AltiVec
+# ops-to-gp -gcc vec.ops builtin.ops
+vec_abs vec_s8 = vec_s8 vec_abs BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE 1 FALSE FALSE transform_vec_abs
+vec_abs vec_s16 = vec_s16 vec_abs BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE 2 FALSE FALSE transform_vec_abs
+vec_abs vec_s32 = vec_s32 vec_abs BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE 3 FALSE FALSE transform_vec_abs
+vec_abs vec_f32 = vec_f32 vec_abs BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE 4 FALSE FALSE transform_vec_abs
+vec_abss vec_s8 = vec_s8 vec_abss BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE 5 FALSE FALSE transform_vec_abs
+vec_abss vec_s16 = vec_s16 vec_abss BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE 6 FALSE FALSE transform_vec_abs
+vec_abss vec_s32 = vec_s32 vec_abss BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE 7 FALSE FALSE transform_vec_abs
+vec_cmplt vec_u8 vec_u8 = vec_b8 vec_cmplt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtub FALSE FALSE transform_vec_cmp_reverse
+vec_cmplt vec_u16 vec_u16 = vec_b16 vec_cmplt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuh FALSE FALSE transform_vec_cmp_reverse
+vec_cmplt vec_u32 vec_u32 = vec_b32 vec_cmplt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuw FALSE FALSE transform_vec_cmp_reverse
+vec_cmplt vec_s8 vec_s8 = vec_b8 vec_cmplt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsb FALSE FALSE transform_vec_cmp_reverse
+vec_cmplt vec_s16 vec_s16 = vec_b16 vec_cmplt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsh FALSE FALSE transform_vec_cmp_reverse
+vec_cmplt vec_s32 vec_s32 = vec_b32 vec_cmplt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsw FALSE FALSE transform_vec_cmp_reverse
+vec_cmplt vec_f32 vec_f32 = vec_b32 vec_cmplt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfp FALSE FALSE transform_vec_cmp_reverse
+vec_cmple vec_f32 vec_f32 = vec_b32 vec_cmple BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefp FALSE FALSE transform_vec_cmp_reverse
+vec_add vec_s8 vec_s8 = vec_s8 vec_vaddubm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_s8 vec_b8 = vec_s8 vec_vaddubm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_b8 vec_s8 = vec_s8 vec_vaddubm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_s16 vec_s16 = vec_s16 vec_vadduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_s16 vec_b16 = vec_s16 vec_vadduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_b16 vec_s16 = vec_s16 vec_vadduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_s32 vec_s32 = vec_s32 vec_vadduwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_s32 vec_b32 = vec_s32 vec_vadduwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_b32 vec_s32 = vec_s32 vec_vadduwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_u8 vec_u8 = vec_u8 vec_vaddubm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_u8 vec_b8 = vec_u8 vec_vaddubm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_b8 vec_u8 = vec_u8 vec_vaddubm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_u16 vec_u16 = vec_u16 vec_vadduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_u16 vec_b16 = vec_u16 vec_vadduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_b16 vec_u16 = vec_u16 vec_vadduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_u32 vec_u32 = vec_u32 vec_vadduwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_u32 vec_b32 = vec_u32 vec_vadduwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_b32 vec_u32 = vec_u32 vec_vadduwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_s8 vec_s8 = vec_s8 vec_vaddsbs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_s8 vec_b8 = vec_s8 vec_vaddsbs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_b8 vec_s8 = vec_s8 vec_vaddsbs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_s16 vec_s16 = vec_s16 vec_vaddshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_s16 vec_b16 = vec_s16 vec_vaddshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_b16 vec_s16 = vec_s16 vec_vaddshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_s32 vec_s32 = vec_s32 vec_vaddsws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_s32 vec_b32 = vec_s32 vec_vaddsws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_b32 vec_s32 = vec_s32 vec_vaddsws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_u8 vec_u8 = vec_u8 vec_vaddubs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_u8 vec_b8 = vec_u8 vec_vaddubs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_b8 vec_u8 = vec_u8 vec_vaddubs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_u16 vec_u16 = vec_u16 vec_vadduhs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_u16 vec_b16 = vec_u16 vec_vadduhs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_b16 vec_u16 = vec_u16 vec_vadduhs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_u32 vec_u32 = vec_u32 vec_vadduws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_u32 vec_b32 = vec_u32 vec_vadduws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_adds vec_b32 vec_u32 = vec_u32 vec_vadduws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_s8 vec_s8 = vec_s8 vec_vsububm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_s8 vec_b8 = vec_s8 vec_vsububm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_b8 vec_s8 = vec_s8 vec_vsububm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_s16 vec_s16 = vec_s16 vec_vsubuhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_s16 vec_b16 = vec_s16 vec_vsubuhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_b16 vec_s16 = vec_s16 vec_vsubuhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_s32 vec_s32 = vec_s32 vec_vsubuwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_s32 vec_b32 = vec_s32 vec_vsubuwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_b32 vec_s32 = vec_s32 vec_vsubuwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_u8 vec_u8 = vec_u8 vec_vsububm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_u8 vec_b8 = vec_u8 vec_vsububm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_b8 vec_u8 = vec_u8 vec_vsububm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_u16 vec_u16 = vec_u16 vec_vsubuhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_u16 vec_b16 = vec_u16 vec_vsubuhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_b16 vec_u16 = vec_u16 vec_vsubuhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_u32 vec_u32 = vec_u32 vec_vsubuwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_u32 vec_b32 = vec_u32 vec_vsubuwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_b32 vec_u32 = vec_u32 vec_vsubuwm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_s8 vec_s8 = vec_s8 vec_vsubsbs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_s8 vec_b8 = vec_s8 vec_vsubsbs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_b8 vec_s8 = vec_s8 vec_vsubsbs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_s16 vec_s16 = vec_s16 vec_vsubshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_s16 vec_b16 = vec_s16 vec_vsubshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_b16 vec_s16 = vec_s16 vec_vsubshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_s32 vec_s32 = vec_s32 vec_vsubsws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_s32 vec_b32 = vec_s32 vec_vsubsws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_b32 vec_s32 = vec_s32 vec_vsubsws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_u8 vec_u8 = vec_u8 vec_vsububs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_u8 vec_b8 = vec_u8 vec_vsububs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_b8 vec_u8 = vec_u8 vec_vsububs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_u16 vec_u16 = vec_u16 vec_vsubuhs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_u16 vec_b16 = vec_u16 vec_vsubuhs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_b16 vec_u16 = vec_u16 vec_vsubuhs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_u32 vec_u32 = vec_u32 vec_vsubuws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_u32 vec_b32 = vec_u32 vec_vsubuws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subs vec_b32 vec_u32 = vec_u32 vec_vsubuws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_addc vec_u32 vec_u32 = vec_u32 vec_vaddcuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_subc vec_u32 vec_u32 = vec_u32 vec_vsubcuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mulo vec_u8 vec_u8 = vec_u16 vec_vmuloub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mulo vec_u16 vec_u16 = vec_u32 vec_vmulouh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mulo vec_s8 vec_s8 = vec_s16 vec_vmulosb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mulo vec_s16 vec_s16 = vec_s32 vec_vmulosh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mule vec_u8 vec_u8 = vec_u16 vec_vmuleub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mule vec_u16 vec_u16 = vec_u32 vec_vmuleuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mule vec_s8 vec_s8 = vec_s16 vec_vmulesb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mule vec_s16 vec_s16 = vec_s32 vec_vmulesh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mladd vec_s16 vec_s16 vec_s16 = vec_s16 vec_vmladduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mladd vec_u16 vec_u16 vec_u16 = vec_u16 vec_vmladduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mladd vec_s16 vec_u16 vec_u16 = vec_s16 vec_vmladduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mladd vec_u16 vec_s16 vec_s16 = vec_s16 vec_vmladduhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_madds vec_s16 vec_s16 vec_s16 = vec_s16 vec_vmhaddshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mradds vec_s16 vec_s16 vec_s16 = vec_s16 vec_vmhraddshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_msum vec_s8 vec_u8 vec_s32 = vec_s32 vec_vmsummbm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_msum vec_u8 vec_u8 vec_u32 = vec_u32 vec_vmsumubm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_msum vec_s16 vec_s16 vec_s32 = vec_s32 vec_vmsumshm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_msum vec_u16 vec_u16 vec_u32 = vec_u32 vec_vmsumuhm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_msums vec_s16 vec_s16 vec_s32 = vec_s32 vec_vmsumshs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_msums vec_u16 vec_u16 vec_u32 = vec_u32 vec_vmsumuhs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sums vec_s32 vec_s32 = vec_s32 vec_vsumsws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sum2s vec_s32 vec_s32 = vec_s32 vec_vsum2sws BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sum4s vec_s8 vec_s32 = vec_s32 vec_vsum4sbs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sum4s vec_u8 vec_u32 = vec_u32 vec_vsum4ubs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sum4s vec_s16 vec_s32 = vec_s32 vec_vsum4shs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_avg vec_s8 vec_s8 = vec_s8 vec_vavgsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_avg vec_s16 vec_s16 = vec_s16 vec_vavgsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_avg vec_u8 vec_u8 = vec_u8 vec_vavgub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_avg vec_u16 vec_u16 = vec_u16 vec_vavguh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_avg vec_s32 vec_s32 = vec_s32 vec_vavgsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_avg vec_u32 vec_u32 = vec_u32 vec_vavguw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_s8 vec_s8 = vec_s8 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_s8 vec_b8 = vec_s8 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b8 vec_s8 = vec_s8 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_u8 vec_u8 = vec_u8 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b8 vec_u8 = vec_u8 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_u8 vec_b8 = vec_u8 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b8 vec_b8 = vec_b8 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_s16 vec_s16 = vec_s16 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_s16 vec_b16 = vec_s16 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b16 vec_s16 = vec_s16 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_u16 vec_u16 = vec_u16 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b16 vec_u16 = vec_u16 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_u16 vec_b16 = vec_u16 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b16 vec_b16 = vec_b16 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_s32 vec_s32 = vec_s32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_s32 vec_b32 = vec_s32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b32 vec_s32 = vec_s32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_u32 vec_u32 = vec_u32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b32 vec_u32 = vec_u32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_u32 vec_b32 = vec_u32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b32 vec_b32 = vec_b32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_f32 vec_f32 = vec_f32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_f32 vec_b32 = vec_f32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_and vec_b32 vec_f32 = vec_f32 vec_vand BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_s8 vec_s8 = vec_s8 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_s8 vec_b8 = vec_s8 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b8 vec_s8 = vec_s8 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_u8 vec_u8 = vec_u8 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b8 vec_u8 = vec_u8 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_u8 vec_b8 = vec_u8 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b8 vec_b8 = vec_b8 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_s16 vec_s16 = vec_s16 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_s16 vec_b16 = vec_s16 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b16 vec_s16 = vec_s16 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_u16 vec_u16 = vec_u16 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b16 vec_u16 = vec_u16 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_u16 vec_b16 = vec_u16 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b16 vec_b16 = vec_b16 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_s32 vec_s32 = vec_s32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_s32 vec_b32 = vec_s32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b32 vec_s32 = vec_s32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_u32 vec_u32 = vec_u32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b32 vec_u32 = vec_u32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_u32 vec_b32 = vec_u32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b32 vec_b32 = vec_b32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_f32 vec_f32 = vec_f32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_f32 vec_b32 = vec_f32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_or vec_b32 vec_f32 = vec_f32 vec_vor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_s8 vec_s8 = vec_s8 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_s8 vec_b8 = vec_s8 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b8 vec_s8 = vec_s8 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_u8 vec_u8 = vec_u8 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b8 vec_u8 = vec_u8 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_u8 vec_b8 = vec_u8 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b8 vec_b8 = vec_b8 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_s16 vec_s16 = vec_s16 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_s16 vec_b16 = vec_s16 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b16 vec_s16 = vec_s16 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_u16 vec_u16 = vec_u16 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b16 vec_u16 = vec_u16 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_u16 vec_b16 = vec_u16 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b16 vec_b16 = vec_b16 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_s32 vec_s32 = vec_s32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_s32 vec_b32 = vec_s32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b32 vec_s32 = vec_s32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_u32 vec_u32 = vec_u32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b32 vec_u32 = vec_u32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_u32 vec_b32 = vec_u32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b32 vec_b32 = vec_b32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_f32 vec_f32 = vec_f32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_f32 vec_b32 = vec_f32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_xor vec_b32 vec_f32 = vec_f32 vec_vxor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_s8 vec_s8 = vec_s8 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_s8 vec_b8 = vec_s8 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b8 vec_s8 = vec_s8 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_u8 vec_u8 = vec_u8 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b8 vec_u8 = vec_u8 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_u8 vec_b8 = vec_u8 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b8 vec_b8 = vec_b8 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_s16 vec_s16 = vec_s16 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_s16 vec_b16 = vec_s16 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b16 vec_s16 = vec_s16 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_u16 vec_u16 = vec_u16 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b16 vec_u16 = vec_u16 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_u16 vec_b16 = vec_u16 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b16 vec_b16 = vec_b16 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_s32 vec_s32 = vec_s32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_s32 vec_b32 = vec_s32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b32 vec_s32 = vec_s32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_u32 vec_u32 = vec_u32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b32 vec_u32 = vec_u32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_u32 vec_b32 = vec_u32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b32 vec_b32 = vec_b32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_f32 vec_f32 = vec_f32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_f32 vec_b32 = vec_f32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_andc vec_b32 vec_f32 = vec_f32 vec_vandc BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_u8 vec_u8 = vec_u8 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_s8 vec_s8 = vec_s8 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_b8 vec_b8 = vec_b8 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_u16 vec_u16 = vec_u16 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_s16 vec_s16 = vec_s16 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_b16 vec_b16 = vec_b16 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_u32 vec_u32 = vec_u32 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_s32 vec_s32 = vec_s32 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_b32 vec_b32 = vec_b32 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nor vec_f32 vec_f32 = vec_f32 vec_vnor BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_rl vec_u8 vec_u8 = vec_u8 vec_vrlb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_rl vec_u16 vec_u16 = vec_u16 vec_vrlh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_rl vec_u32 vec_u32 = vec_u32 vec_vrlw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_rl vec_s8 vec_u8 = vec_s8 vec_vrlb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_rl vec_s16 vec_u16 = vec_s16 vec_vrlh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_rl vec_s32 vec_u32 = vec_s32 vec_vrlw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sl vec_u8 vec_u8 = vec_u8 vec_vslb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sl vec_u16 vec_u16 = vec_u16 vec_vslh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sl vec_u32 vec_u32 = vec_u32 vec_vslw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sl vec_s8 vec_u8 = vec_s8 vec_vslb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sl vec_s16 vec_u16 = vec_s16 vec_vslh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sl vec_s32 vec_u32 = vec_s32 vec_vslw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u8 vec_u8 = vec_u8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u16 vec_u8 = vec_u16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u32 vec_u8 = vec_u32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s8 vec_u8 = vec_s8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s16 vec_u8 = vec_s16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s32 vec_u8 = vec_s32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b8 vec_u8 = vec_b8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b16 vec_u8 = vec_b16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b32 vec_u8 = vec_b32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_p16 vec_u8 = vec_p16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u8 vec_u16 = vec_u8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u16 vec_u16 = vec_u16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u32 vec_u16 = vec_u32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s8 vec_u16 = vec_s8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s16 vec_u16 = vec_s16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s32 vec_u16 = vec_s32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b8 vec_u16 = vec_b8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b16 vec_u16 = vec_b16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b32 vec_u16 = vec_b32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_p16 vec_u16 = vec_p16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u8 vec_u32 = vec_u8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u16 vec_u32 = vec_u16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_u32 vec_u32 = vec_u32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s8 vec_u32 = vec_s8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s16 vec_u32 = vec_s16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_s32 vec_u32 = vec_s32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b8 vec_u32 = vec_b8 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b16 vec_u32 = vec_b16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_b32 vec_u32 = vec_b32 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sll vec_p16 vec_u32 = vec_p16 vec_vsl BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sr vec_u8 vec_u8 = vec_u8 vec_vsrb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sr vec_u16 vec_u16 = vec_u16 vec_vsrh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sr vec_u32 vec_u32 = vec_u32 vec_vsrw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sr vec_s8 vec_u8 = vec_s8 vec_vsrb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sr vec_s16 vec_u16 = vec_s16 vec_vsrh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sr vec_s32 vec_u32 = vec_s32 vec_vsrw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sra vec_u8 vec_u8 = vec_u8 vec_vsrab BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sra vec_u16 vec_u16 = vec_u16 vec_vsrah BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sra vec_u32 vec_u32 = vec_u32 vec_vsraw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sra vec_s8 vec_u8 = vec_s8 vec_vsrab BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sra vec_s16 vec_u16 = vec_s16 vec_vsrah BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sra vec_s32 vec_u32 = vec_s32 vec_vsraw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u8 vec_u8 = vec_u8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u16 vec_u8 = vec_u16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u32 vec_u8 = vec_u32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s8 vec_u8 = vec_s8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s16 vec_u8 = vec_s16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s32 vec_u8 = vec_s32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b8 vec_u8 = vec_b8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b16 vec_u8 = vec_b16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b32 vec_u8 = vec_b32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_p16 vec_u8 = vec_p16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u8 vec_u16 = vec_u8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u16 vec_u16 = vec_u16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u32 vec_u16 = vec_u32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s8 vec_u16 = vec_s8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s16 vec_u16 = vec_s16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s32 vec_u16 = vec_s32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b8 vec_u16 = vec_b8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b16 vec_u16 = vec_b16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b32 vec_u16 = vec_b32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_p16 vec_u16 = vec_p16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u8 vec_u32 = vec_u8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u16 vec_u32 = vec_u16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_u32 vec_u32 = vec_u32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s8 vec_u32 = vec_s8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s16 vec_u32 = vec_s16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_s32 vec_u32 = vec_s32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b8 vec_u32 = vec_b8 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b16 vec_u32 = vec_b16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_b32 vec_u32 = vec_b32 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_srl vec_p16 vec_u32 = vec_p16 vec_vsr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpgt vec_u8 vec_u8 = vec_b8 vec_vcmpgtub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpgt vec_u16 vec_u16 = vec_b16 vec_vcmpgtuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpgt vec_u32 vec_u32 = vec_b32 vec_vcmpgtuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpgt vec_s8 vec_s8 = vec_b8 vec_vcmpgtsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpgt vec_s16 vec_s16 = vec_b16 vec_vcmpgtsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpgt vec_s32 vec_s32 = vec_b32 vec_vcmpgtsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpeq vec_u8 vec_u8 = vec_b8 vec_vcmpequb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpeq vec_u16 vec_u16 = vec_b16 vec_vcmpequh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpeq vec_u32 vec_u32 = vec_b32 vec_vcmpequw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpeq vec_s8 vec_s8 = vec_b8 vec_vcmpequb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpeq vec_s16 vec_s16 = vec_b16 vec_vcmpequh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpeq vec_s32 vec_s32 = vec_b32 vec_vcmpequw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_b8 vec_b8 vec_b8 = vec_b8 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_b8 vec_b8 vec_u8 = vec_b8 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_u8 vec_u8 vec_u8 = vec_u8 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_u8 vec_u8 vec_b8 = vec_u8 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_s8 vec_s8 vec_u8 = vec_s8 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_s8 vec_s8 vec_b8 = vec_s8 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_b16 vec_b16 vec_b16 = vec_b16 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_b16 vec_b16 vec_u16 = vec_b16 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_u16 vec_u16 vec_u16 = vec_u16 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_u16 vec_u16 vec_b16 = vec_u16 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_s16 vec_s16 vec_u16 = vec_s16 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_s16 vec_s16 vec_b16 = vec_s16 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_b32 vec_b32 vec_b32 = vec_b32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_b32 vec_b32 vec_u32 = vec_b32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_u32 vec_u32 vec_u32 = vec_u32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_u32 vec_u32 vec_b32 = vec_u32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_s32 vec_s32 vec_u32 = vec_s32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_s32 vec_s32 vec_b32 = vec_s32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_f32 vec_f32 vec_b32 = vec_f32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sel vec_f32 vec_f32 vec_u32 = vec_f32 vec_vsel BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_pack vec_u16 vec_u16 = vec_u8 vec_vpkuhum BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_pack vec_u32 vec_u32 = vec_u16 vec_vpkuwum BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_pack vec_s16 vec_s16 = vec_s8 vec_vpkuhum BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_pack vec_s32 vec_s32 = vec_s16 vec_vpkuwum BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_pack vec_b16 vec_b16 = vec_b8 vec_vpkuhum BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_pack vec_b32 vec_b32 = vec_b16 vec_vpkuwum BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packs vec_u16 vec_u16 = vec_u8 vec_vpkuhus BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packs vec_u32 vec_u32 = vec_u16 vec_vpkuwus BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packsu vec_u16 vec_u16 = vec_u8 vec_vpkuhus BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packsu vec_u32 vec_u32 = vec_u16 vec_vpkuwus BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packs vec_s16 vec_s16 = vec_s8 vec_vpkshss BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packs vec_s32 vec_s32 = vec_s16 vec_vpkswss BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packsu vec_s16 vec_s16 = vec_u8 vec_vpkshus BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packsu vec_s32 vec_s32 = vec_u16 vec_vpkswus BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_packpx vec_u32 vec_u32 = vec_p16 vec_vpkpx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackh vec_s8 = vec_s16 vec_vupkhsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackh vec_s16 = vec_s32 vec_vupkhsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackh vec_b8 = vec_b16 vec_vupkhsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackh vec_b16 = vec_b32 vec_vupkhsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackh vec_p16 = vec_u32 vec_vupkhpx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackl vec_s8 = vec_s16 vec_vupklsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackl vec_s16 = vec_s32 vec_vupklsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackl vec_b8 = vec_b16 vec_vupklsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackl vec_b16 = vec_b32 vec_vupklsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpackl vec_p16 = vec_u32 vec_vupklpx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_u8 vec_u8 = vec_u8 vec_vmrghb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_u16 vec_u16 = vec_u16 vec_vmrghh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_u32 vec_u32 = vec_u32 vec_vmrghw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_s8 vec_s8 = vec_s8 vec_vmrghb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_s16 vec_s16 = vec_s16 vec_vmrghh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_s32 vec_s32 = vec_s32 vec_vmrghw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_f32 vec_f32 = vec_f32 vec_vmrghw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_p16 vec_p16 = vec_p16 vec_vmrghh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_b8 vec_b8 = vec_b8 vec_vmrghb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_b16 vec_b16 = vec_b16 vec_vmrghh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergeh vec_b32 vec_b32 = vec_b32 vec_vmrghw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpack2uh vec_u8 vec_u8 = vec_u16 vec_unpack2uh BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrghb
+vec_unpack2uh vec_u16 vec_u16 = vec_u32 vec_unpack2uh BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrghh
+vec_unpack2sh vec_u8 vec_u8 = vec_s16 vec_unpack2sh BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrghb
+vec_unpack2sh vec_u16 vec_u16 = vec_s32 vec_unpack2sh BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrghh
+vec_mergel vec_u8 vec_u8 = vec_u8 vec_vmrglb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_u16 vec_u16 = vec_u16 vec_vmrglh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_u32 vec_u32 = vec_u32 vec_vmrglw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_s8 vec_s8 = vec_s8 vec_vmrglb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_s16 vec_s16 = vec_s16 vec_vmrglh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_s32 vec_s32 = vec_s32 vec_vmrglw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_f32 vec_f32 = vec_f32 vec_vmrglw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_p16 vec_p16 = vec_p16 vec_vmrglh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_b8 vec_b8 = vec_b8 vec_vmrglb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_b16 vec_b16 = vec_b16 vec_vmrglh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mergel vec_b32 vec_b32 = vec_b32 vec_vmrglw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_unpack2ul vec_u8 vec_u8 = vec_u16 vec_unpack2ul BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrglb
+vec_unpack2ul vec_u16 vec_u16 = vec_u32 vec_unpack2ul BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrglh
+vec_unpack2sl vec_u8 vec_u8 = vec_s16 vec_unpack2sl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrglb
+vec_unpack2sl vec_u16 vec_u16 = vec_s32 vec_unpack2sl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vmrglh
+vec_splat vec_u8 immed_u5 = vec_u8 vec_vspltb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_u16 immed_u5 = vec_u16 vec_vsplth BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_u32 immed_u5 = vec_u32 vec_vspltw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_s8 immed_u5 = vec_s8 vec_vspltb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_s16 immed_u5 = vec_s16 vec_vsplth BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_s32 immed_u5 = vec_s32 vec_vspltw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_b8 immed_u5 = vec_b8 vec_vspltb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_b16 immed_u5 = vec_b16 vec_vsplth BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_b32 immed_u5 = vec_b32 vec_vspltw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_p16 immed_u5 = vec_p16 vec_vsplth BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat vec_f32 immed_u5 = vec_f32 vec_vspltw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat_s8 immed_s5 = vec_s8 vec_vspltisb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat_s16 immed_s5 = vec_s16 vec_vspltish BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat_s32 immed_s5 = vec_s32 vec_vspltisw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_splat_u8 immed_s5 = vec_u8 vec_splat_u8 BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vspltisb
+vec_splat_u16 immed_s5 = vec_u16 vec_splat_u16 BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vspltish
+vec_splat_u32 immed_s5 = vec_u32 vec_splat_u32 BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vspltisw
+vec_perm vec_u8 vec_u8 vec_u8 = vec_u8 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_u16 vec_u16 vec_u8 = vec_u16 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_u32 vec_u32 vec_u8 = vec_u32 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_s8 vec_s8 vec_u8 = vec_s8 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_s16 vec_s16 vec_u8 = vec_s16 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_s32 vec_s32 vec_u8 = vec_s32 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_b8 vec_b8 vec_u8 = vec_b8 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_b16 vec_b16 vec_u8 = vec_b16 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_b32 vec_b32 vec_u8 = vec_b32 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_p16 vec_p16 vec_u8 = vec_p16 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_perm vec_f32 vec_f32 vec_u8 = vec_f32 vec_vperm BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_u8 vec_u8 immed_u4 = vec_u8 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_u16 vec_u16 immed_u4 = vec_u16 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_u32 vec_u32 immed_u4 = vec_u32 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_s8 vec_s8 immed_u4 = vec_s8 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_s16 vec_s16 immed_u4 = vec_s16 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_s32 vec_s32 immed_u4 = vec_s32 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_p16 vec_p16 immed_u4 = vec_p16 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_f32 vec_f32 immed_u4 = vec_f32 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_b8 vec_b8 immed_u4 = vec_b8 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_b16 vec_b16 immed_u4 = vec_b16 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sld vec_b32 vec_b32 immed_u4 = vec_b32 vec_vsldoi BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_u8 vec_u8 = vec_u8 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_u16 vec_u8 = vec_u16 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_u32 vec_u8 = vec_u32 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_s8 vec_u8 = vec_s8 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_s16 vec_u8 = vec_s16 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_s32 vec_u8 = vec_s32 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_p16 vec_u8 = vec_p16 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_u8 vec_s8 = vec_u8 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_u16 vec_s8 = vec_u16 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_u32 vec_s8 = vec_u32 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_s8 vec_s8 = vec_s8 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_s16 vec_s8 = vec_s16 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_s32 vec_s8 = vec_s32 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_p16 vec_s8 = vec_p16 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_f32 vec_u8 = vec_f32 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_slo vec_f32 vec_s8 = vec_f32 vec_vslo BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_u8 vec_u8 = vec_u8 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_u16 vec_u8 = vec_u16 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_u32 vec_u8 = vec_u32 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_s8 vec_u8 = vec_s8 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_s16 vec_u8 = vec_s16 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_s32 vec_u8 = vec_s32 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_p16 vec_u8 = vec_p16 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_u8 vec_s8 = vec_u8 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_u16 vec_s8 = vec_u16 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_u32 vec_s8 = vec_u32 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_s8 vec_s8 = vec_s8 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_s16 vec_s8 = vec_s16 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_s32 vec_s8 = vec_s32 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_p16 vec_s8 = vec_p16 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_f32 vec_u8 = vec_f32 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sro vec_f32 vec_s8 = vec_f32 vec_vsro BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_u8 vec_u8 = vec_u8 vec_vmaxub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_u8 vec_b8 = vec_u8 vec_vmaxub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_b8 vec_u8 = vec_u8 vec_vmaxub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_s8 vec_s8 = vec_s8 vec_vmaxsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_s8 vec_b8 = vec_s8 vec_vmaxsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_b8 vec_s8 = vec_s8 vec_vmaxsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_u16 vec_u16 = vec_u16 vec_vmaxuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_u16 vec_b16 = vec_u16 vec_vmaxuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_b16 vec_u16 = vec_u16 vec_vmaxuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_s16 vec_s16 = vec_s16 vec_vmaxsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_s16 vec_b16 = vec_s16 vec_vmaxsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_b16 vec_s16 = vec_s16 vec_vmaxsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_u32 vec_u32 = vec_u32 vec_vmaxuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_u32 vec_b32 = vec_u32 vec_vmaxuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_b32 vec_u32 = vec_u32 vec_vmaxuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_s32 vec_s32 = vec_s32 vec_vmaxsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_s32 vec_b32 = vec_s32 vec_vmaxsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_b32 vec_s32 = vec_s32 vec_vmaxsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_u8 vec_u8 = vec_u8 vec_vminub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_u8 vec_b8 = vec_u8 vec_vminub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_b8 vec_u8 = vec_u8 vec_vminub BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_s8 vec_s8 = vec_s8 vec_vminsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_s8 vec_b8 = vec_s8 vec_vminsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_b8 vec_s8 = vec_s8 vec_vminsb BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_u16 vec_u16 = vec_u16 vec_vminuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_u16 vec_b16 = vec_u16 vec_vminuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_b16 vec_u16 = vec_u16 vec_vminuh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_s16 vec_s16 = vec_s16 vec_vminsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_s16 vec_b16 = vec_s16 vec_vminsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_b16 vec_s16 = vec_s16 vec_vminsh BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_u32 vec_u32 = vec_u32 vec_vminuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_u32 vec_b32 = vec_u32 vec_vminuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_b32 vec_u32 = vec_u32 vec_vminuw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_s32 vec_s32 = vec_s32 vec_vminsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_s32 vec_b32 = vec_s32 vec_vminsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_b32 vec_s32 = vec_s32 vec_vminsw BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_lde int const_unsigned_char_ptr = vec_u8_load_op vec_lvebx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvebx TRUE FALSE
+vec_lde int const_unsigned_short_ptr = vec_u16_load_op vec_lvehx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvehx TRUE FALSE
+vec_lde int const_unsigned_int_ptr = vec_u32_load_op vec_lvewx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvewx TRUE FALSE
+vec_lde int const_unsigned_long_ptr = vec_u32_load_op vec_lvewx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvewx TRUE FALSE
+vec_lde int const_signed_char_ptr = vec_s8_load_op vec_lvebx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvebx TRUE FALSE
+vec_lde int const_short_ptr = vec_s16_load_op vec_lvehx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvehx TRUE FALSE
+vec_lde int const_int_ptr = vec_s32_load_op vec_lvewx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvewx TRUE FALSE
+vec_lde int const_long_ptr = vec_s32_load_op vec_lvewx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvewx TRUE FALSE
+vec_lde int const_float_ptr = vec_f32_load_op vec_lvewx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvewx TRUE FALSE
+vec_ld int const_unsigned_char_ptr = vec_u8_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_unsigned_short_ptr = vec_u16_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_unsigned_int_ptr = vec_u32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_unsigned_long_ptr = vec_u32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_signed_char_ptr = vec_s8_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_short_ptr = vec_s16_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_int_ptr = vec_s32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_long_ptr = vec_s32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_float_ptr = vec_f32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ldl int const_unsigned_char_ptr = vec_u8_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_unsigned_short_ptr = vec_u16_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_unsigned_int_ptr = vec_u32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_unsigned_long_ptr = vec_u32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_signed_char_ptr = vec_s8_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_short_ptr = vec_s16_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_int_ptr = vec_s32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_long_ptr = vec_s32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_float_ptr = vec_f32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ld int const_vec_u8_ptr = vec_u8_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_u16_ptr = vec_u16_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_u32_ptr = vec_u32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_s8_ptr = vec_s8_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_s16_ptr = vec_s16_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_s32_ptr = vec_s32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_p16_ptr = vec_p16_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_b8_ptr = vec_b8_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_b16_ptr = vec_b16_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_b32_ptr = vec_b32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ld int const_vec_f32_ptr = vec_f32_load_op vec_lvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvx TRUE FALSE transform_lvx
+vec_ldl int const_vec_u8_ptr = vec_u8_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_u16_ptr = vec_u16_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_u32_ptr = vec_u32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_s8_ptr = vec_s8_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_s16_ptr = vec_s16_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_s32_ptr = vec_s32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_p16_ptr = vec_p16_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_b8_ptr = vec_b8_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_b16_ptr = vec_b16_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_b32_ptr = vec_b32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ldl int const_vec_f32_ptr = vec_f32_load_op vec_lvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvxl TRUE FALSE transform_lvx
+vec_ste vec_u8 int unsigned_char_ptr = void_store_op vec_stvebx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_u16 int unsigned_short_ptr = void_store_op vec_stvehx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_u32 int unsigned_int_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_u32 int unsigned_long_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_s8 int signed_char_ptr = void_store_op vec_stvebx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_s16 int short_ptr = void_store_op vec_stvehx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_s32 int int_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_s32 int long_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_f32 int float_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_p16 int short_ptr = void_store_op vec_stvehx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_p16 int unsigned_short_ptr = void_store_op vec_stvehx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b8 int unsigned_char_ptr = void_store_op vec_stvebx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b8 int signed_char_ptr = void_store_op vec_stvebx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b16 int unsigned_short_ptr = void_store_op vec_stvebx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b16 int short_ptr = void_store_op vec_stvebx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b32 int unsigned_int_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b32 int unsigned_long_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b32 int int_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ste vec_b32 int long_ptr = void_store_op vec_stvewx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_st vec_u8 int unsigned_char_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_u16 int unsigned_short_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_u32 int unsigned_int_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_u32 int unsigned_long_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_s8 int signed_char_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_s16 int short_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_s32 int int_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_s32 int long_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_f32 int float_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_p16 int short_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_p16 int unsigned_short_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b8 int unsigned_char_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b8 int signed_char_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b16 int unsigned_short_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b16 int short_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b32 int unsigned_int_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b32 int unsigned_long_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b32 int int_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b32 int long_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_stl vec_u8 int unsigned_char_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_u16 int unsigned_short_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_u32 int unsigned_int_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_u32 int unsigned_long_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_s8 int signed_char_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_s16 int short_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_s32 int int_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_s32 int long_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_f32 int float_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_p16 int short_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_p16 int unsigned_short_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b8 int unsigned_char_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b8 int signed_char_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b16 int unsigned_short_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b16 int short_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b32 int unsigned_int_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b32 int unsigned_long_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b32 int int_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b32 int long_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_st vec_u8 int vec_u8_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_u16 int vec_u16_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_u32 int vec_u32_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_s8 int vec_s8_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_s16 int vec_s16_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_s32 int vec_s32_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b8 int vec_b8_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b16 int vec_b16_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_b32 int vec_b32_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_p16 int vec_p16_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_st vec_f32 int vec_f32_ptr = void_store_op vec_stvx BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvx FALSE FALSE transform_stvx
+vec_stl vec_u8 int vec_u8_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_u16 int vec_u16_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_u32 int vec_u32_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_s8 int vec_s8_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_s16 int vec_s16_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_s32 int vec_s32_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b8 int vec_b8_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b16 int vec_b16_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_b32 int vec_b32_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_p16 int vec_p16_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_stl vec_f32 int vec_f32_ptr = void_store_op vec_stvxl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_stvxl FALSE FALSE transform_stvx
+vec_lvsl int const_volatile_unsigned_char_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_unsigned_short_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_unsigned_int_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_unsigned_long_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_signed_char_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_short_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_int_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_long_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsl int const_volatile_float_ptr = vec_u8 vec_lvsl BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsl TRUE TRUE
+vec_lvsr int const_volatile_unsigned_char_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_unsigned_short_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_unsigned_int_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_unsigned_long_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_signed_char_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_short_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_int_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_long_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_lvsr int const_volatile_float_ptr = vec_u8 vec_lvsr BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_lvsr TRUE TRUE
+vec_mfvscr = volatile_vec_u16 vec_mfvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_u8 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_u16 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_u32 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_s8 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_s16 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_s32 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_b8 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_b16 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_b32 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_mtvscr vec_p16 = volatile_void vec_mtvscr BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_dst const_unsigned_char_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_unsigned_short_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_unsigned_int_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_unsigned_long_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_signed_char_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_short_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_int_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_long_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_float_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dstt const_unsigned_char_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_unsigned_short_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_unsigned_int_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_unsigned_long_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_signed_char_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_short_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_int_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_long_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_float_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstst const_unsigned_char_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_unsigned_short_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_unsigned_int_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_unsigned_long_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_signed_char_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_short_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_int_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_long_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_float_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dststt const_unsigned_char_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_unsigned_short_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_unsigned_int_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_unsigned_long_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_signed_char_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_short_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_int_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_long_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_float_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dst const_vec_u8_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_u16_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_u32_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_s8_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_s16_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_s32_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_b8_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_b16_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_b32_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_p16_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dst const_vec_f32_ptr int immed_u2 = volatile_void_load_op vec_dst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dst TRUE FALSE
+vec_dstt const_vec_u8_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_u16_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_u32_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_s8_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_s16_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_s32_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_b8_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_b16_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_b32_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_p16_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstt const_vec_f32_ptr int immed_u2 = volatile_void_load_op vec_dstt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstt TRUE FALSE
+vec_dstst const_vec_u8_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_u16_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_u32_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_s8_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_s16_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_s32_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_b8_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_b16_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_b32_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_p16_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dstst const_vec_f32_ptr int immed_u2 = volatile_void_load_op vec_dstst BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dstst TRUE FALSE
+vec_dststt const_vec_u8_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_u16_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_u32_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_s8_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_s16_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_s32_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_b8_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_b16_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_b32_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_p16_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dststt const_vec_f32_ptr int immed_u2 = volatile_void_load_op vec_dststt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_dststt TRUE FALSE
+vec_dss immed_u2 = volatile_void_load_op vec_dss BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_dssall = volatile_void_load_op vec_dssall BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_add vec_f32 vec_f32 = vec_f32 vec_vaddfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_sub vec_f32 vec_f32 = vec_f32 vec_vsubfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_madd vec_f32 vec_f32 vec_f32 = vec_f32 vec_vmaddfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_nmsub vec_f32 vec_f32 vec_f32 = vec_f32 vec_vnmsubfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpgt vec_f32 vec_f32 = vec_b32 vec_vcmpgtfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpge vec_f32 vec_f32 = vec_b32 vec_vcmpgefp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpeq vec_f32 vec_f32 = vec_b32 vec_vcmpeqfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cmpb vec_f32 vec_f32 = vec_s32 vec_vcmpbfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_max vec_f32 vec_f32 = vec_f32 vec_vmaxfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_min vec_f32 vec_f32 = vec_f32 vec_vminfp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_re vec_f32 = vec_f32 vec_vrefp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_rsqrte vec_f32 = vec_f32 vec_vrsqrtefp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_loge vec_f32 = vec_f32 vec_vlogefp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_expte vec_f32 = vec_f32 vec_vexptefp BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_trunc vec_f32 = vec_f32 vec_vrfiz BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_round vec_f32 = vec_f32 vec_vrfin BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ceil vec_f32 = vec_f32 vec_vrfip BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_floor vec_f32 = vec_f32 vec_vrfim BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ctf vec_u32 immed_u5 = vec_f32 vec_vcfux BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ctf vec_s32 immed_u5 = vec_f32 vec_vcfsx BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_ctu vec_f32 immed_u5 = vec_u32 vec_vctuxs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_cts vec_f32 immed_u5 = vec_s32 vec_vctsxs BUILTIN_AFTER_TRAVERSE CFG_VEC
+vec_all_gt vec_u8 vec_u8 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_gt vec_u8 vec_b8 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_gt vec_b8 vec_u8 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_le vec_u8 vec_u8 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_le vec_u8 vec_b8 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_le vec_b8 vec_u8 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_gt vec_u8 vec_u8 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_gt vec_u8 vec_b8 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_gt vec_b8 vec_u8 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_le vec_u8 vec_u8 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_le vec_u8 vec_b8 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_le vec_b8 vec_u8 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_gt vec_s8 vec_s8 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_gt vec_s8 vec_b8 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_gt vec_b8 vec_s8 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_le vec_s8 vec_s8 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_le vec_s8 vec_b8 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_le vec_b8 vec_s8 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_gt vec_s8 vec_s8 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_gt vec_s8 vec_b8 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_gt vec_b8 vec_s8 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_le vec_s8 vec_s8 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_le vec_s8 vec_b8 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_le vec_b8 vec_s8 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_lt vec_u8 vec_u8 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_lt vec_u8 vec_b8 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_lt vec_b8 vec_u8 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_ge vec_u8 vec_u8 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_ge vec_u8 vec_b8 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_ge vec_b8 vec_u8 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_lt vec_u8 vec_u8 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_lt vec_u8 vec_b8 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_lt vec_b8 vec_u8 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_ge vec_u8 vec_u8 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_ge vec_u8 vec_b8 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_any_ge vec_b8 vec_u8 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtubD
+vec_all_lt vec_s8 vec_s8 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_lt vec_s8 vec_b8 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_lt vec_b8 vec_s8 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_ge vec_s8 vec_s8 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_ge vec_s8 vec_b8 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_ge vec_b8 vec_s8 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_lt vec_s8 vec_s8 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_lt vec_s8 vec_b8 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_lt vec_b8 vec_s8 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_ge vec_s8 vec_s8 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_ge vec_s8 vec_b8 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_any_ge vec_b8 vec_s8 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtsbD
+vec_all_gt vec_u16 vec_u16 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_gt vec_u16 vec_b16 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_gt vec_b16 vec_u16 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_le vec_u16 vec_u16 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_le vec_u16 vec_b16 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_le vec_b16 vec_u16 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_gt vec_u16 vec_u16 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_gt vec_u16 vec_b16 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_gt vec_b16 vec_u16 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_le vec_u16 vec_u16 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_le vec_u16 vec_b16 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_le vec_b16 vec_u16 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_gt vec_s16 vec_s16 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_gt vec_s16 vec_b16 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_gt vec_b16 vec_s16 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_le vec_s16 vec_s16 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_le vec_s16 vec_b16 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_le vec_b16 vec_s16 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_gt vec_s16 vec_s16 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_gt vec_s16 vec_b16 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_gt vec_b16 vec_s16 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_le vec_s16 vec_s16 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_le vec_s16 vec_b16 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_le vec_b16 vec_s16 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_lt vec_u16 vec_u16 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_lt vec_u16 vec_b16 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_lt vec_b16 vec_u16 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_ge vec_u16 vec_u16 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_ge vec_u16 vec_b16 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_ge vec_b16 vec_u16 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_lt vec_u16 vec_u16 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_lt vec_u16 vec_b16 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_lt vec_b16 vec_u16 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_ge vec_u16 vec_u16 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_ge vec_u16 vec_b16 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_any_ge vec_b16 vec_u16 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuhD
+vec_all_lt vec_s16 vec_s16 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_lt vec_s16 vec_b16 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_lt vec_b16 vec_s16 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_ge vec_s16 vec_s16 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_ge vec_s16 vec_b16 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_ge vec_b16 vec_s16 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_lt vec_s16 vec_s16 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_lt vec_s16 vec_b16 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_lt vec_b16 vec_s16 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_ge vec_s16 vec_s16 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_ge vec_s16 vec_b16 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_any_ge vec_b16 vec_s16 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtshD
+vec_all_gt vec_u32 vec_u32 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_gt vec_u32 vec_b32 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_gt vec_b32 vec_u32 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_le vec_u32 vec_u32 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_le vec_u32 vec_b32 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_le vec_b32 vec_u32 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_gt vec_u32 vec_u32 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_gt vec_u32 vec_b32 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_gt vec_b32 vec_u32 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_le vec_u32 vec_u32 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_le vec_u32 vec_b32 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_le vec_b32 vec_u32 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_gt vec_s32 vec_s32 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_gt vec_s32 vec_b32 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_gt vec_b32 vec_s32 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_le vec_s32 vec_s32 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_le vec_s32 vec_b32 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_le vec_b32 vec_s32 = cc26t vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_gt vec_s32 vec_s32 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_gt vec_s32 vec_b32 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_gt vec_b32 vec_s32 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_le vec_s32 vec_s32 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_le vec_s32 vec_b32 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_le vec_b32 vec_s32 = cc24f vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_lt vec_u32 vec_u32 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_lt vec_u32 vec_b32 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_lt vec_b32 vec_u32 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_ge vec_u32 vec_u32 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_ge vec_u32 vec_b32 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_ge vec_b32 vec_u32 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_lt vec_u32 vec_u32 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_lt vec_u32 vec_b32 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_lt vec_b32 vec_u32 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_ge vec_u32 vec_u32 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_ge vec_u32 vec_b32 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_any_ge vec_b32 vec_u32 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtuwD
+vec_all_lt vec_s32 vec_s32 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_lt vec_s32 vec_b32 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_lt vec_b32 vec_s32 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_ge vec_s32 vec_s32 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_ge vec_s32 vec_b32 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_ge vec_b32 vec_s32 = cc26tr vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_lt vec_s32 vec_s32 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_lt vec_s32 vec_b32 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_lt vec_b32 vec_s32 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_ge vec_s32 vec_s32 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_ge vec_s32 vec_b32 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_any_ge vec_b32 vec_s32 = cc24fr vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtswD
+vec_all_eq vec_u8 vec_u8 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_eq vec_u8 vec_b8 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_eq vec_b8 vec_u8 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_eq vec_b8 vec_b8 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_ne vec_u8 vec_u8 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_ne vec_u8 vec_b8 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_ne vec_b8 vec_u8 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_ne vec_b8 vec_b8 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_eq vec_u8 vec_u8 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_eq vec_u8 vec_b8 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_eq vec_b8 vec_u8 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_eq vec_b8 vec_b8 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_ne vec_u8 vec_u8 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_ne vec_u8 vec_b8 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_ne vec_b8 vec_u8 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_ne vec_b8 vec_b8 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_eq vec_s8 vec_s8 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_eq vec_s8 vec_b8 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_eq vec_b8 vec_s8 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_ne vec_s8 vec_s8 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_ne vec_s8 vec_b8 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_ne vec_b8 vec_s8 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_eq vec_s8 vec_s8 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_eq vec_s8 vec_b8 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_eq vec_b8 vec_s8 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_ne vec_s8 vec_s8 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_ne vec_s8 vec_b8 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_any_ne vec_b8 vec_s8 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequbD
+vec_all_eq vec_u16 vec_u16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_u16 vec_b16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_b16 vec_u16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_b16 vec_b16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_p16 vec_p16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_u16 vec_u16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_u16 vec_b16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_b16 vec_u16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_b16 vec_b16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_p16 vec_p16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_u16 vec_u16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_u16 vec_b16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_b16 vec_u16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_b16 vec_b16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_p16 vec_p16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_u16 vec_u16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_u16 vec_b16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_b16 vec_u16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_b16 vec_b16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_p16 vec_p16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_s16 vec_s16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_s16 vec_b16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_b16 vec_s16 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_s16 vec_s16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_s16 vec_b16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_ne vec_b16 vec_s16 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_s16 vec_s16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_s16 vec_b16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_eq vec_b16 vec_s16 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_s16 vec_s16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_s16 vec_b16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_any_ne vec_b16 vec_s16 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequhD
+vec_all_eq vec_u32 vec_u32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_eq vec_u32 vec_b32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_eq vec_b32 vec_u32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_eq vec_b32 vec_b32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_ne vec_u32 vec_u32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_ne vec_u32 vec_b32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_ne vec_b32 vec_u32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_ne vec_b32 vec_b32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_eq vec_u32 vec_u32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_eq vec_u32 vec_b32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_eq vec_b32 vec_u32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_eq vec_b32 vec_b32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_ne vec_u32 vec_u32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_ne vec_u32 vec_b32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_ne vec_b32 vec_u32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_ne vec_b32 vec_b32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_eq vec_s32 vec_s32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_eq vec_s32 vec_b32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_eq vec_b32 vec_s32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_ne vec_s32 vec_s32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_ne vec_s32 vec_b32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_ne vec_b32 vec_s32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_eq vec_s32 vec_s32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_eq vec_s32 vec_b32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_eq vec_b32 vec_s32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_ne vec_s32 vec_s32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_ne vec_s32 vec_b32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_any_ne vec_b32 vec_s32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpequwD
+vec_all_gt vec_f32 vec_f32 = cc24t vec_all_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_all_ngt vec_f32 vec_f32 = cc26t vec_all_ngt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_any_ngt vec_f32 vec_f32 = cc24f vec_any_ngt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_any_gt vec_f32 vec_f32 = cc26f vec_any_gt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_all_lt vec_f32 vec_f32 = cc24tr vec_all_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_all_nlt vec_f32 vec_f32 = cc26tr vec_all_nlt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_any_nlt vec_f32 vec_f32 = cc24fr vec_any_nlt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_any_lt vec_f32 vec_f32 = cc26fr vec_any_lt BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgtfpD
+vec_all_ge vec_f32 vec_f32 = cc24t vec_all_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_all_nge vec_f32 vec_f32 = cc26t vec_all_nge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_any_nge vec_f32 vec_f32 = cc24f vec_any_nge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_any_ge vec_f32 vec_f32 = cc26f vec_any_ge BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_all_le vec_f32 vec_f32 = cc24tr vec_all_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_all_nle vec_f32 vec_f32 = cc26tr vec_all_nle BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_any_nle vec_f32 vec_f32 = cc24fr vec_any_nle BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_any_le vec_f32 vec_f32 = cc26fr vec_any_le BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpgefpD
+vec_all_eq vec_f32 vec_f32 = cc24t vec_all_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_all_ne vec_f32 vec_f32 = cc26t vec_all_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_any_ne vec_f32 vec_f32 = cc24f vec_any_ne BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_any_eq vec_f32 vec_f32 = cc26f vec_any_eq BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_all_numeric vec_f32 = cc24td vec_all_numeric BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_all_nan vec_f32 = cc26td vec_all_nan BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_any_nan vec_f32 = cc24fd vec_any_nan BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_any_numeric vec_f32 = cc26fd vec_any_numeric BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpeqfpD
+vec_all_in vec_f32 vec_f32 = cc26t vec_all_in BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpbfpD
+vec_any_out vec_f32 vec_f32 = cc26f vec_any_out BUILTIN_AFTER_TRAVERSE CFG_VEC FALSE MOP_vcmpbfpD
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index f5af52eb2e4..85b2882a802 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -3,6 +3,8 @@ darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
conditions.h insn-flags.h output.h insn-attr.h flags.h $(TREE_H) expr.h \
reload.h function.h $(GGC_H) langhooks.h $(TM_P_H) gt-darwin.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/darwin.c
+# APPLE LOCAL constant CFStrings
+darwin.o: $(HASHTAB_H) toplev.h
darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CPPLIB_H) tree.h c-pragma.h $(C_TREE_H) toplev.h $(TM_P_H) \
@@ -14,7 +16,7 @@ gt-darwin.h : s-gtype ; @true
# Explain how to build crt2.o
$(T)crt2$(objext): $(srcdir)/config/darwin-crt2.c $(GCC_PASSES) \
$(TCONFIG_H) stmp-int-hdrs tsystem.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -mlongcall \
-c $(srcdir)/config/darwin-crt2.c -o $(T)crt2$(objext)
# Use unwind-dw2-fde-darwin
diff --git a/gcc/config/t-slibgcc-darwin b/gcc/config/t-slibgcc-darwin
index 34cb0d4160f..0120cf53cb9 100644
--- a/gcc/config/t-slibgcc-darwin
+++ b/gcc/config/t-slibgcc-darwin
@@ -28,3 +28,6 @@ SHLIB_INSTALL = \
$$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk
SHLIB_MAPFILES = $(srcdir)/libgcc-darwin.ver
+
+# APPLE LOCAL libcc_kext
+SHLIB_MULTILIB=.
diff --git a/gcc/config/x-linux b/gcc/config/x-linux
deleted file mode 100644
index d14586b0b36..00000000000
--- a/gcc/config/x-linux
+++ /dev/null
@@ -1,4 +0,0 @@
-host-linux.o : $(srcdir)/config/host-linux.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h hosthooks.h hosthooks-def.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/host-linux.c
diff --git a/gcc/config/x-solaris b/gcc/config/x-solaris
deleted file mode 100644
index 782f4a36802..00000000000
--- a/gcc/config/x-solaris
+++ /dev/null
@@ -1,4 +0,0 @@
-host-solaris.o : $(srcdir)/config/host-solaris.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h hosthooks.h hosthooks-def.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/host-solaris.c
diff --git a/gcc/configure b/gcc/configure
index 392dddf83e3..74797cae044 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -4884,6 +4884,150 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+# APPLE LOCAL Mach time
+
+for ac_header in mach/mach_time.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
# See if cmp has --ignore-initial.
echo "$as_me:$LINENO: checking for cmp's capabilities" >&5
echo $ECHO_N "checking for cmp's capabilities... $ECHO_C" >&6
@@ -5009,7 +5153,7 @@ if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then
else
ac_prog_version=`$MAKEINFO --version 2>&1 |
sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
- echo "configure:5012: version of makeinfo is $ac_prog_version" >&5
+ echo "configure:5147: version of makeinfo is $ac_prog_version" >&5
case $ac_prog_version in
'') gcc_cv_prog_makeinfo_modern=no;;
4.[2-9]*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 39d6b8e3674..5684d1dff6a 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -282,6 +282,14 @@ AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
ac_cv_prog_cc_no_long_long=no)
CFLAGS="$save_CFLAGS"])
+AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-double,
+ac_cv_prog_cc_no_long_double,
+[save_CFLAGS="$CFLAGS"
+CFLAGS="-Wno-long-double"
+AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_double=yes,
+ ac_cv_prog_cc_no_long_double=no)
+CFLAGS="$save_CFLAGS"])
+
AC_PROG_CPP
AC_C_INLINE
@@ -315,6 +323,11 @@ strict1_warn=
if test $ac_cv_prog_cc_no_long_long = yes ; then
strict1_warn="-pedantic -Wno-long-long"
fi
+
+if test $ac_cv_prog_cc_no_long_double = yes ; then
+ strict1_warn="$strict1_warn -Wno-long-double"
+fi
+
AC_SUBST(strict1_warn)
# If the native compiler is GCC, we can enable warnings even in stage1.
@@ -632,6 +645,9 @@ gcc_AC_PROG_LN_S
AC_PROG_RANLIB
gcc_AC_PROG_INSTALL
+# APPLE LOCAL Mach time
+AC_CHECK_HEADERS(mach/mach_time.h)
+
# See if cmp has --ignore-initial.
gcc_AC_PROG_CMP_IGNORE_INITIAL
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index e800d004252..bf6c20a0710 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -49,6 +49,8 @@ typedef union tree_node *tree;
Note that the cpp_reader typedef remains part of cpplib.h. */
struct cpp_reader;
+/* APPLE LOCAL AltiVec */
+struct cpp_token;
#else
diff --git a/gcc/cp/ChangeLog.apple-ppc b/gcc/cp/ChangeLog.apple-ppc
new file mode 100644
index 00000000000..775d813b0ae
--- /dev/null
+++ b/gcc/cp/ChangeLog.apple-ppc
@@ -0,0 +1,5 @@
+2004-04-02 Ziemowit Laski <zlaski@apple.com>
+
+ Remove APPLE LOCAL AltiVec code whenever possible; merge in
+ AltiVec/VECTOR_TYPE-handling code from mainline.
+
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index eb87c256dd5..f67b2500993 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -69,6 +69,15 @@ g++-cross$(exeext): g++$(exeext)
-rm -f g++-cross$(exeext)
cp g++$(exeext) g++-cross$(exeext)
+# APPLE LOCAL begin order files ilr
+ifeq ($(ORDER_FILES),yes)
+CC1PLUS_ORDER_FLAGS = `if [ -f $(srcdir)/../order-files/cc1plus.order ]; then \
+ echo -sectorder __TEXT __text $(srcdir)/../order-files/cc1plus.order -e start ; fi`
+else
+CC1PLUS_ORDER_FLAGS =
+endif
+# APPLE LOCAL end order files ilr
+
# The compiler itself.
# Shared with C front end:
CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
@@ -77,20 +86,29 @@ CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
c-simplify.o tree-inline.o
# Language-specific object files.
-CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
+# APPLE LOCAL Objective-C++
+CXX_AND_OBJCP_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \
cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \
- cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/cxx-pretty-print.o \
+ cp/mangle.o cp/name-lookup.o cp/cxx-pretty-print.o \
cp/cp-simplify.o tree-mudflap.o cp/cp-mudflap.o
+# APPLE LOCAL begin Objective-C++
+# APPLE LOCAL debugging
+CXX_OBJS = $(CXX_AND_OBJCP_OBJS) cp/cp-lang.o cp/cp-idebug.o \
+ stub-objc.o # cp/cp-dmp-tree.o
+# APPLE LOCAL end Objective-C++
+
# Use strict warnings for this front end.
cp-warn = $(STRICT_WARN) $(WERROR)
+# APPLE LOCAL order files ilr
cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
libcpp.a $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS)
+ $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS) \
+ $(CC1PLUS_ORDER_FLAGS)
# Special build rules.
$(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
@@ -260,7 +278,19 @@ cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h
cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) tree-dump.h
cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h integrate.h insn-config.h \
input.h $(PARAMS_H) debug.h tree-inline.h tree-simple.h
-cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h gt-cp-mangle.h $(TM_P_H)
+cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h gt-cp-mangle.h \
+ $(TARGET_H) $(TM_P_H)
+
+# APPLE LOCAL debugging
+# Suppress all warnings explicitly for the idebug builds since there can be
+# many when, and if, -traditional-cpp is used.
+cp/cp-idebug.o: cp/cp-idebug.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h idebug.c
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
+ -w -Wno-traditional $(srcdir)/cp/cp-idebug.c -o cp/cp-idebug.o
+
+# APPLE LOCAL new tree dump
+cp/cp-dmp-tree.o: cp/cp-dmp-tree.c $(CXX_TREE_H) $(SYSTEM_H) $(TM_H) coretypes.h \
+ dmp-tree.h c-dmp-tree.c
cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h \
output.h
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index b8d72f4f348..2ab061426da 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4061,6 +4061,36 @@ enforce_access (tree basetype_path, tree decl)
return true;
}
+/* APPLE LOCAL begin direct-binding-refs turly 20020224 */
+
+/* Should we *really* call a constructor for the object whose reference type
+ we want? If we have a user conversion function which returns the ref
+ type directly, there's no need to call the object's constructor as we
+ can bind directly (dcl.init.ref.)
+
+ These must be exactly the same types. */
+
+static int really_call_constructor_p (tree, tree, tree);
+static int
+really_call_constructor_p (tree expr, tree convfn, tree totype)
+{
+ /* TEMPORARILY DISABLING THIS "FIX" NOW WE HAVE A SOURCE WORKAROUND. */
+ /* However, we'll leave the code here pending input from the FSF
+ on this issue. */
+
+ if (0 /* && ! NEED_TEMPORARY_P (convfn) Watch out! this macro is undefined */
+ && TREE_CODE (expr) == INDIRECT_REF
+ && TREE_CODE (TREE_TYPE (convfn)) == METHOD_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (convfn))) == REFERENCE_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_TYPE (convfn)))) == RECORD_TYPE
+ && TREE_TYPE (TREE_TYPE (TREE_TYPE (convfn))) == totype
+ && TREE_TYPE (expr) == totype)
+ return 0;
+
+ return 1;
+}
+/* APPLE LOCAL end direct-binding-refs turly 20020224 */
+
/* Initialize a temporary of type TYPE with EXPR. The FLAGS are a
bitwise or of LOOKUP_* values. If any errors are warnings are
generated, set *DIAGNOSTIC_FN to "error" or "warning",
@@ -4172,6 +4202,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
If the target is a class, that means call a ctor. */
if (IS_AGGR_TYPE (totype)
+ /* APPLE LOCAL direct-binding-refs turly 20020224 */
+ && really_call_constructor_p (expr, convfn, totype)
&& (inner >= 0 || !lvalue_p (expr)))
{
expr = (build_temp
@@ -4812,7 +4844,11 @@ build_over_call (struct z_candidate *cand, int flags)
mark_used (fn);
- if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)
+ /* APPLE LOCAL begin -findirect-virtual-calls 2001-10-30 sts */
+ if (DECL_VINDEX (fn)
+ && (flag_indirect_virtual_calls
+ || (flags & LOOKUP_NONVIRTUAL) == 0))
+ /* APPLE LOCAL end -findirect-virtual-calls 2001-10-30 sts */
{
tree t, *p = &TREE_VALUE (converted_args);
tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (*p)),
@@ -4826,6 +4862,33 @@ build_over_call (struct z_candidate *cand, int flags)
t = build_pointer_type (TREE_TYPE (fn));
if (DECL_CONTEXT (fn) && TYPE_JAVA_INTERFACE (DECL_CONTEXT (fn)))
fn = build_java_interface_fn_ref (fn, *p);
+ /* APPLE LOCAL begin -findirect-virtual-calls 2001-10-30 sts */
+ /* If this is not really supposed to be a virtual call, find the
+ vtable corresponding to the correct type, and use it. */
+ else if (flags & LOOKUP_NONVIRTUAL) {
+ tree call_site_type = TREE_TYPE (cand->access_path);
+ tree fn_class_type = DECL_CLASS_CONTEXT (fn);
+
+ my_friendly_assert (call_site_type != NULL &&
+ fn_class_type != NULL &&
+ AGGREGATE_TYPE_P (call_site_type) &&
+ AGGREGATE_TYPE_P (fn_class_type),
+ 20020717);
+ my_friendly_assert(lookup_base(TYPE_MAIN_VARIANT (call_site_type),
+ TYPE_MAIN_VARIANT (fn_class_type),
+ ba_any | ba_quiet,
+ NULL) != NULL,
+ 20020719);
+
+ if (TYPE_USES_MULTIPLE_INHERITANCE (call_site_type)
+ || TYPE_USES_VIRTUAL_BASECLASSES (call_site_type))
+ error ("indirect virtual calls are invalid for a type that uses multiple or virtual inheritance");
+
+ fn = (build_vfn_ref_using_vtable
+ (BINFO_VTABLE (TYPE_BINFO (call_site_type)),
+ DECL_VINDEX (fn)));
+ }
+ /* APPLE LOCAL end -findirect-virtual-calls 2001-10-30 sts */
else
fn = build_vfn_ref (build_indirect_ref (*p, 0), DECL_VINDEX (fn));
TREE_TYPE (fn) = t;
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index dca5fe90363..a53548dab62 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -228,6 +228,9 @@ int n_compute_conversion_costs = 0;
int n_inner_fields_searched = 0;
#endif
+/* APPLE LOCAL Macintosh alignment 2002-5-24 ff */
+extern int darwin_align_is_first_member_of_class;
+
/* Convert to or from a base subobject. EXPR is an expression of type
`A' or `A*', an expression of type `B' or `B*' is returned. To
convert A to a base B, CODE is PLUS_EXPR and BINFO is the binfo for
@@ -452,6 +455,11 @@ build_vtbl_ref_1 (tree instance, tree idx)
assemble_external (vtbl);
+ /* APPLE LOCAL double destructor turly 20020301 */
+#ifdef ADJUST_VTABLE_INDEX
+ ADJUST_VTABLE_INDEX (idx, vtbl);
+#endif
+
aref = build_array_ref (vtbl, idx);
TREE_CONSTANT (aref) |= TREE_CONSTANT (vtbl) && TREE_CONSTANT (idx);
TREE_INVARIANT (aref) = TREE_CONSTANT (aref);
@@ -484,6 +492,30 @@ build_vfn_ref (tree instance, tree idx)
return aref;
}
+/* APPLE LOCAL begin -findirect-virtual-calls 2001-10-30 sts */
+/* Given a VTBL and an IDX, return an expression for the function
+ pointer located at the indicated index. BASETYPE is the static
+ type of the object containing the vtable. */
+
+tree
+build_vfn_ref_using_vtable (tree vtbl, tree idx)
+{
+ tree aref;
+
+ assemble_external (vtbl);
+
+ /* APPLE LOCAL double destructor turly 20020301 */
+#ifdef ADJUST_VTABLE_INDEX
+ ADJUST_VTABLE_INDEX (idx, vtbl);
+#endif
+
+ aref = build_array_ref (vtbl, idx);
+ TREE_CONSTANT (aref) = 1;
+
+ return aref;
+}
+/* APPLE LOCAL end -findirect-virtual-calls 2001-10-30 sts */
+
/* Return the name of the virtual function table (as an IDENTIFIER_NODE)
for the given TYPE. */
@@ -1778,9 +1810,27 @@ layout_vtable_decl (tree binfo, int n)
{
tree atype;
tree vtable;
+ /* APPLE LOCAL begin terminated-vtables */
+ int n_entries;
+
+ n_entries = n;
+
+ /* Enlarge suggested vtable size by one entry; it will be filled
+ with a zero word. Darwin kernel dynamic-driver loader looks
+ for this value to find vtable ends for patching.
+
+ Kludge: IOKit project all use -findirect_virtual_calls, and all
+ will need the newly-created -fterminated_vtables flag when built
+ with GCC3, so as a short-term hack to avoid updating
+ eighty-odd IOKit projects, enable both when we see the one currently
+ used by all IOKit projects. */
+ if (flag_terminated_vtables || flag_indirect_virtual_calls)
+ n_entries += 1;
+ /* APPLE LOCAL end terminated-vtables */
atype = build_cplus_array_type (vtable_entry_type,
- build_index_type (size_int (n - 1)));
+ /* APPLE LOCAL terminated-vtables */
+ build_index_type (size_int (n_entries - 1)));
layout_type (atype);
/* We may have to grow the vtable. */
@@ -3830,6 +3880,104 @@ build_clone (tree fn, tree name)
return clone;
}
+/* APPLE LOCAL begin double destructor turly 20020212 */
+
+/* Return whether CLASS or any of its ancestors have the
+ "apple_kext_compatibility" attribute, in which case the non-deleting
+ destructor is not emitted.
+
+ Note that this only works for single inheritance. */
+int
+has_apple_kext_compatibility_attr_p (tree class)
+{
+ while (class != NULL)
+ {
+ if (TYPE_USES_MULTIPLE_INHERITANCE (class))
+ return 0;
+
+ if (lookup_attribute ("apple_kext_compatibility",
+ TYPE_ATTRIBUTES (class)))
+ return 1;
+
+ /* Multiple inheritance here? Just say no. */
+ if (CLASSTYPE_N_BASECLASSES (class) == 1)
+ class = TYPE_BINFO_BASETYPE (class, 0);
+ else
+ break;
+ }
+
+ return 0;
+}
+
+/* TRUE if we have an operator delete which is empty (i.e., NO CODE!) */
+int
+has_empty_operator_delete_p (tree class)
+{
+ if (class != NULL)
+ {
+ if (TYPE_USES_MULTIPLE_INHERITANCE (class))
+ return 0;
+
+ if (TYPE_GETS_DELETE (class))
+ {
+ tree f = lookup_fnfields (TYPE_BINFO (class),
+ ansi_opname (DELETE_EXPR), 0);
+
+ if (f == error_mark_node)
+ return 0;
+
+ if (BASELINK_P (f))
+ f = TREE_VALUE (f);
+
+ if (OVL_CURRENT (f))
+ {
+ f = OVL_CURRENT (f);
+
+ /* We've overridden TREE_SIDE_EFFECTS for C++ operator deletes
+ to mean that the function is empty. */
+ if (TREE_SIDE_EFFECTS (f))
+ return 1;
+
+ /* Otherwise, it could be an inline but empty function. */
+ if (DECL_SAVED_TREE (f)
+ && TREE_CODE (DECL_SAVED_TREE (f)) == COMPOUND_STMT
+ && COMPOUND_BODY (DECL_SAVED_TREE (f)))
+ return compound_body_is_empty_p (COMPOUND_BODY
+ (DECL_SAVED_TREE (f)));
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* Walk through a COMPOUND_STMT and return true if nothing in there would
+ cause us to generate code. */
+int
+compound_body_is_empty_p (tree t)
+{
+ while (t && t != error_mark_node)
+ {
+ enum tree_code tc = TREE_CODE (t);
+ if (tc == COMPOUND_STMT)
+ {
+ if (compound_body_is_empty_p (COMPOUND_BODY (t)))
+ t = TREE_CHAIN (t);
+ else
+ return 0;
+ }
+ else
+ if (tc == SCOPE_STMT)
+ t = TREE_CHAIN (t);
+ else
+ return 0;
+ }
+ /* We hit the end of the body function without seeing anything. */
+ return 1;
+}
+
+/* APPLE LOCAL end double destructor turly 20020212 */
+
/* Produce declarations for all appropriate clones of FN. If
UPDATE_METHOD_VEC_P is nonzero, the clones are added to the
CLASTYPE_METHOD_VEC as well. */
@@ -3874,9 +4022,17 @@ clone_function_decl (tree fn, int update_method_vec_p)
if (update_method_vec_p)
add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
}
- clone = build_clone (fn, complete_dtor_identifier);
- if (update_method_vec_p)
- add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
+
+ /* APPLE LOCAL double destructor turly 20020212 */
+ /* Don't use the complete dtor. */
+ if (! flag_apple_kext
+ || ! has_apple_kext_compatibility_attr_p (DECL_CONTEXT (fn)))
+ {
+ clone = build_clone (fn, complete_dtor_identifier);
+ if (update_method_vec_p)
+ add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
+ }
+
clone = build_clone (fn, base_dtor_identifier);
if (update_method_vec_p)
add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
@@ -4593,6 +4749,13 @@ layout_class_type (tree t, tree *virtuals_p)
NULL, NULL);
build_base_fields (rli, empty_base_offsets, next_field);
+ /* APPLE LOCAL begin Macintosh alignment 2002-5-24 ff */
+ /* Turn on this flag until the first real member of the class is
+ laid out. (Enums and such things declared in the class do not
+ count.) */
+ darwin_align_is_first_member_of_class = 1;
+ /* APPLE LOCAL end Macintosh alignment 2002-5-24 ff */
+
/* Layout the non-static data members. */
for (field = non_static_data_members; field; field = TREE_CHAIN (field))
{
@@ -4705,6 +4868,12 @@ layout_class_type (tree t, tree *virtuals_p)
layout_nonempty_base_or_field (rli, field, NULL_TREE,
empty_base_offsets);
+ /* APPLE LOCAL begin Macintosh alignment 2002-5-24 ff */
+ /* When we reach here we have laid out the first real member of
+ the class. */
+ darwin_align_is_first_member_of_class = 0;
+ /* APPLE LOCAL end Macintosh alignment 2002-5-24 ff */
+
/* Remember the location of any empty classes in FIELD. */
if (abi_version_at_least (2))
record_subobject_offsets (TREE_TYPE (field),
@@ -4756,6 +4925,12 @@ layout_class_type (tree t, tree *virtuals_p)
last_field_was_bitfield = DECL_C_BIT_FIELD (field);
}
+ /* APPLE LOCAL begin Macintosh alignment 2002-5-24 ff */
+ /* Make sure the flag is turned off in cases where there were no
+ real members in the class. */
+ darwin_align_is_first_member_of_class = 0;
+
+ /* APPLE LOCAL end Macintosh alignment 2002-5-24 ff */
if (abi_version_at_least (2) && !integer_zerop (rli->bitpos))
{
/* Make sure that we are on a byte boundary so that the size of
@@ -5609,6 +5784,15 @@ push_lang_context (tree name)
{
current_lang_name = name;
}
+ /* APPLE LOCAL begin Objective-C++ */
+ else if (name == lang_name_objc)
+ {
+ /* Suppress the warning for now, make it informative. */
+ inform ("`extern \"Objective-C\"' is deprecated; "
+ "use `extern \"C\"' instead");
+ current_lang_name = lang_name_c;
+ }
+ /* APPLE LOCAL end Objective-C++ */
else
error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name));
}
@@ -7203,6 +7387,19 @@ dfs_accumulate_vtbl_inits (tree binfo,
index = size_binop (MULT_EXPR,
TYPE_SIZE_UNIT (vtable_entry_type),
index);
+ /* APPLE LOCAL begin double destructor turly 20020301 */
+#ifdef VPTR_INITIALIZER_ADJUSTMENT
+ /* Subtract VPTR_INITIALIZER_ADJUSTMENT from INDEX. */
+ if (flag_apple_kext && !ctor_vtbl_p && ! BINFO_PRIMARY_P (binfo)
+ && TREE_CODE (index) == INTEGER_CST
+ && TREE_INT_CST_LOW (index) >= VPTR_INITIALIZER_ADJUSTMENT
+ && TREE_INT_CST_HIGH (index) == 0)
+ index = fold (build (MINUS_EXPR,
+ TREE_TYPE (index), index,
+ size_int (VPTR_INITIALIZER_ADJUSTMENT)));
+#endif
+ /* APPLE LOCAL end double destructor turly 20020301 */
+
vtbl = build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index);
}
diff --git a/gcc/cp/cp-dmp-tree.c b/gcc/cp/cp-dmp-tree.c
new file mode 100644
index 00000000000..3827e3d7fbd
--- /dev/null
+++ b/gcc/cp/cp-dmp-tree.c
@@ -0,0 +1,1326 @@
+/* APPLE LOCAL file new tree dump */
+/* Common condensed c++ tree display routines. Based on dmp-tree.c
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Devang Patel (dpatel@apple.com)
+ and Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* Both C and C++ node handling is required for C++. The C handling is
+ done in c-dmp-tree.c. But that is a C language specific file, i.e.,
+ only built for C. Thus we need to #include it here to get the stuff
+ we need defined. But we need to tell c-dmp-tree.c that we are doing
+ this so it doesn't define stuff we don't want defined. That's the
+ purpose of the CP_DMP_TREE switch.
+
+ Note that c-dmp-tree.c does all the main #includes so we don't need
+ them here. */
+
+#define CP_DMP_TREE
+#include "c-dmp-tree.c"
+
+#include "cp-tree.h"
+
+int cp_dump_tree_p (FILE *, const char *, tree, int);
+lang_dump_tree_p_t cp_prev_lang_dump_tree_p = NULL;
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+static void print_ ## SYM (FILE *file, const char *annotation, tree node, int indent);
+#include "cp-tree.def"
+#undef DEFTREECODE
+
+static void print_RECORD_TYPE (FILE *, const char *, tree, int);
+static void print_NAMESPACE_DECL (FILE *, const char *, tree, int);
+static void print_ADDR_EXPR (FILE *, const char *, tree, int);
+
+/*-------------------------------------------------------------------*/
+
+/* Called twice for dmp-tree() for an IDENTIFIER_NODE. The first call
+ is after the common info for the node is generated but before
+ displaying the identifer (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an newline_and_indent() call or a recursive
+ call to dump_tree() for nodes which are language specific operands
+ to a IDENTIFIER_NODE. */
+
+void
+cxx_dump_identifier (FILE *file,
+ tree node,
+ int indent ATTRIBUTE_UNUSED,
+ int after_id)
+{
+ if (!after_id)
+ {
+ if (C_IS_RESERVED_WORD (node))
+ fputs (" reserved", file);
+ if (IDENTIFIER_CTOR_OR_DTOR_P (node))
+ fputs (" ctor/dtor", file);
+ if (IDENTIFIER_NAMESPACE_BINDINGS (node))
+ {
+ fprintf (file, " ns-bindings=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_NAMESPACE_BINDINGS (node));
+ }
+ if (IDENTIFIER_CLASS_VALUE (node))
+ {
+ fprintf (file, " binding=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_CLASS_VALUE (node));
+ }
+ if (IDENTIFIER_BINDING (node))
+ {
+ fprintf (file, " lcl-bindings=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_BINDING (node));
+ }
+ if (IDENTIFIER_LABEL_VALUE (node))
+ {
+ fprintf (file, " gbl=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_LABEL_VALUE (node));
+ }
+ if (IDENTIFIER_TEMPLATE (node))
+ {
+ fprintf (file, " tmpl=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_TEMPLATE (node));
+ }
+ if (IDENTIFIER_IMPLICIT_DECL (node))
+ {
+ fprintf (file, " impl=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_IMPLICIT_DECL (node));
+ }
+ if (IDENTIFIER_ERROR_LOCUS (node))
+ {
+ fprintf (file, " err-locus=");
+ fprintf (file, HOST_PTR_PRINTF, IDENTIFIER_ERROR_LOCUS (node));
+ }
+ }
+ else
+ {
+#if 0
+ dump_binding (file, "(bindings)", IDENTIFIER_NAMESPACE_BINDINGS (node), indent + INDENT);
+#endif
+ dump_tree (file, "(class)", IDENTIFIER_CLASS_VALUE (node), indent + INDENT);
+#if 0
+ dump_binding (file, "(lcl-bindings)", IDENTIFIER_BINDING (node), indent + INDENT);
+#endif
+ dump_tree (file, "(lbl)", IDENTIFIER_LABEL_VALUE (node), indent + INDENT);
+ dump_tree (file, "(tmpl)", IDENTIFIER_TEMPLATE (node), indent + INDENT);
+ dump_tree (file, "(impl)", IDENTIFIER_IMPLICIT_DECL (node), indent + INDENT);
+ dump_tree (file, "(err-locus)", IDENTIFIER_ERROR_LOCUS (node), indent + INDENT);
+ }
+}
+
+/* Called twice for dmp_tree() for a ..._DECL node. The first call
+ after the common info for the node is generated but before
+ displaying the identifier (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an newline_and_indent() call or a recursive
+ call to dump_tree() for nodes which are language specific operands
+ to a ..._DECL node. */
+
+void
+cxx_dump_decl (FILE *file, tree node, int indent ATTRIBUTE_UNUSED, int after_id)
+{
+ switch (TREE_CODE (node))
+ {
+ case FUNCTION_DECL:
+ if (!after_id)
+ {
+ if (DECL_STATIC_FUNCTION_P (node))
+ fputs (" static", file);
+ if (DECL_FRIEND_P (node))
+ fputs (" frnd", file);
+ if (DECL_CONSTRUCTOR_P (node))
+ fprintf (file, " %sctor",
+ DECL_COPY_CONSTRUCTOR_P (node) ? "cpy-" : "");
+ if (DECL_DESTRUCTOR_P (node))
+ fputs (" dtor", file);
+ if (DECL_PURE_VIRTUAL_P (node))
+ fputs (" pure-virt", file);
+ if (DECL_CONST_MEMFUNC_P (node))
+ fputs (" const", file);
+ if (DECL_VOLATILE_MEMFUNC_P (node))
+ fputs (" volatile", file);
+ if (DECL_MUTABLE_P (node))
+ fputs (" mutable", file);
+ if (DECL_THUNK_P (node))
+ fputs (" thnk", file);
+ if (DECL_LANG_SPECIFIC (node))
+ {
+ if (DECL_PENDING_INLINE_INFO (node))
+ {
+ fprintf (file, " pending-inline-info=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_PENDING_INLINE_INFO (node)));
+ }
+ if (DECL_TEMPLATE_INFO (node))
+ {
+ fprintf (file, " tmpl-info=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_TEMPLATE_INFO (node)));
+ }
+ }
+ }
+ break;
+
+ case FIELD_DECL:
+ if (!after_id)
+ {
+ if (DECL_MUTABLE_P (node))
+ fputs (" mutable", file);
+ }
+ break;
+
+ case TYPE_DECL:
+ if (!after_id)
+ {
+ if (DECL_LANG_SPECIFIC (node))
+ {
+ if (DECL_TEMPLATE_INFO (node))
+ {
+ fprintf (file, " tmpl-info=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_TEMPLATE_INFO (node)));
+ }
+ if (DECL_SORTED_FIELDS (node))
+ {
+ fprintf (file, " sorted-fields=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_SORTED_FIELDS (node)));
+ }
+ }
+ }
+ break;
+
+ case VAR_DECL:
+ if (!after_id)
+ {
+ if (DECL_LANG_SPECIFIC (node))
+ {
+ if (DECL_TEMPLATE_INFO (node))
+ {
+ fprintf (file, " tmpl-info=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_TEMPLATE_INFO (node)));
+ }
+ }
+ if (DECL_SHADOWED_FOR_VAR (node))
+ fputs (" shadowed", file);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/* Called twice for dmp_tree() for a ..._TYPE node. The first call
+ after the common info for the node is generated but before
+ displaying the identifier (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an newline_and_indent() call or a recursive
+ call to dump_tree() for nodes which are language specific operands
+ to a ..._TYPE node. */
+
+void
+cxx_dump_type (FILE *file, tree node, int indent, int after_id)
+{
+ if (!after_id)
+ {
+ if (CLASS_TYPE_P (node)) /* RECORD_TYPE, UNION_TYPE only */
+ {
+ if (TYPE_NEEDS_CONSTRUCTING (node))
+ fputs (" needs-ctor", file);
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (node))
+ fputs (" needs-dtor", file);
+ if (TYPE_HAS_DESTRUCTOR (node))
+ fputs (" ~X()", file);
+ if (TYPE_HAS_DEFAULT_CONSTRUCTOR (node))
+ fputs (" X()", file);
+ if (TYPE_HAS_CONVERSION (node))
+ fputs (" has-conv", file);
+ if (TYPE_HAS_INIT_REF (node))
+ {
+ if (TYPE_HAS_CONST_INIT_REF (node))
+ fputs (" X(constX&)", file);
+ else
+ fputs (" X(X&)", file);
+ }
+ if (TYPE_HAS_NEW_OPERATOR (node))
+ fputs (" new", file);
+ if (TYPE_HAS_ARRAY_NEW_OPERATOR (node))
+ fputs (" new[]", file);
+ if (TYPE_GETS_DELETE (node) & 1)
+ fputs (" delete", file);
+ if (TYPE_GETS_DELETE (node) & 2)
+ fputs (" delete[]", file);
+ if (TYPE_HAS_ASSIGN_REF (node))
+ fputs (" this=(X&)", file);
+ if (TYPE_USES_MULTIPLE_INHERITANCE (node))
+ fputs (" uses-mult-inh", file);
+ }
+ }
+
+ switch (TREE_CODE (node))
+ {
+ case FUNCTION_TYPE:
+ case METHOD_TYPE:
+ if (!after_id)
+ {
+ if (TYPE_RAISES_EXCEPTIONS (node))
+ {
+ fprintf (file, " throws=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_RAISES_EXCEPTIONS (node)));
+ }
+ }
+ else
+ {
+ if (TYPE_RAISES_EXCEPTIONS (node))
+ dump_tree (file, "(throws)", TYPE_RAISES_EXCEPTIONS (node),
+ indent + INDENT);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/* Normally a blank line is inserted before each statement node (a
+ statement node is determined by calling statement_code_p()). This
+ makes the display easier to read by keeping each statement grouped
+ like a paragraph. There may, however, be some kinds of statements
+ where a blank line isn't desired (e.g., a begin SCOPE_STMT in C).
+ Thus dump_lang_blank_line() is called to ask if a particular
+ statement should be preceded by a blank line dependent upon the
+ node that preceded it.
+
+ dump_lang_blank_line_p() is called for each statement passing the
+ previous node (not necessarily a statement) and current node (a
+ statement node by definition). It should return 1 if a blank
+ line is to be inserted and 0 otherwise. */
+
+int
+cxx_dump_blank_line_p (tree previous_node ATTRIBUTE_UNUSED,
+ tree current_node ATTRIBUTE_UNUSED)
+{
+ return 1;
+}
+
+/* This is called for each node to display file and/or line number
+ information for those nodes that have such information. If it
+ is displayed the function should return 1. If not, 0.
+
+ The function generally does not have to handle ..._DECL nodes
+ unless there some special handling is reequired. They are
+ handled by print_lineno() (dump_lang_lineno_p()'s caller).
+ It is defined to not repeat the filename if it does not
+ change from what's in dump_tree_state.curr_file and then
+ it only displays the basename (using lbasename()). The
+ format of the display is " line=nbr(basename)" where the
+ leading space is included as usual in these displays and
+ the parenthesized basename omitted if not needed or is
+ the same as before. */
+
+int
+cxx_dump_lineno_p (FILE *file ATTRIBUTE_UNUSED, tree node ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+/* Called only by tree-dump.c when doing a full compilation tree dump
+ under one of the -fdmp-xxxx options. This makes tree_dump.c, which
+ is common to all languages, independent of dmp_tree, which currently
+ only supports the c languages. */
+int
+cxx_dmp_tree3 (file, node, flags)
+ FILE *file;
+ tree node;
+ int flags;
+{
+ dmp_tree3 (file, node, flags);
+ return 1;
+}
+
+/*-------------------------------------------------------------------*/
+
+static void
+print_OFFSET_REF (FILE *file, const char *annotation, tree node, int indent)
+{
+ if (PTRMEM_OK_P (node))
+ fputs (" ptr-to-mbr-ok", file);
+ print_ref (file, annotation, node, indent);
+
+ print_operands (file, node, indent, TRUE, "(obj)", "(offset)", NULL);
+}
+
+static void
+print_NON_DEPENDENT_EXPR (FILE *file, const char *annotation, tree node,
+ int indent)
+{
+}
+
+static void
+print_PTRMEM_CST (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent ATTRIBUTE_UNUSED)
+{
+ fprintf (file, " rec-type::mbr-decl=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (PTRMEM_CST_CLASS (node)));
+ fprintf (file, "::");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (PTRMEM_CST_MEMBER (node)));
+ /* not sure I want to follow these nodes here */
+}
+
+static void
+print_NEW_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ if (NEW_EXPR_USE_GLOBAL (node))
+ fputs ("use-glbl", file);
+
+ print_operands (file, node, indent, TRUE, "(placement)", "(new)", "(init)", NULL);
+}
+
+static void
+print_VEC_NEW_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(placement)", "(new)", "(init)", NULL);
+}
+
+static void
+print_DELETE_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ if (DELETE_EXPR_USE_GLOBAL (node))
+ fputs ("use-glbl", file);
+ if (DELETE_EXPR_USE_VEC (node))
+ fputs ("use-vec", file);
+
+ print_operands (file, node, indent, TRUE, "(store)", "(how)", NULL);
+}
+
+static void
+print_VEC_DELETE_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(store)", "(how)", NULL);
+}
+
+static void
+print_SCOPE_REF (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_ref (file, annotation, node, indent);
+ fprintf (file, " complexity=%d", TREE_COMPLEXITY (node));
+
+ print_operands (file, node, indent, TRUE, "(class)", "(field)", NULL);
+}
+
+static void
+print_MEMBER_REF (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_ref (file, annotation, node, indent);
+
+ print_operands (file, node, indent, FALSE, "(obj)", "(mbr)", NULL);
+ /* not sure I want to follow these nodes here */
+}
+
+static void
+print_TYPE_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ fprintf (file, " type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_TYPE (node)));
+
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_AGGR_INIT_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ if (AGGR_INIT_VIA_CTOR_P(node))
+ fputs (" ctor", file);
+
+ print_operands (file, node, indent, TRUE, "(init-funct)", "(args)", "(slot)", NULL);
+}
+
+static void
+print_THROW_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EMPTY_CLASS_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent ATTRIBUTE_UNUSED)
+{
+ if (TREE_TYPE (node))
+ {
+ fprintf (file, "class=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_TYPE (node)));
+ }
+}
+
+static void
+print_BASELINK (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TEMPLATE_DECL (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ dump_tree_state.line_cnt = 0;
+
+ fprintf (file, " args=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_ARGUMENTS (node)));
+ if (DECL_LANG_SPECIFIC (node) && DECL_TEMPLATE_INFO (node))
+ {
+ fprintf (file, " tmpl-info=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_TEMPLATE_INFO (node)));
+ }
+ if (DECL_VINDEX (node))
+ {
+ fprintf (file, " inst=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_VINDEX (node)));
+ }
+ if (TREE_TYPE (node))
+ {
+ fprintf (file, " obj-type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_TYPE (node)));
+ }
+ if (DECL_TEMPLATE_RESULT (node))
+ {
+ fprintf (file, " obj-decl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_TEMPLATE_RESULT (node)));
+ }
+ if (DECL_INITIAL (node))
+ {
+ fprintf (file, " assoc-tmpls=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_INITIAL (node)));
+ }
+ print_decl (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ if (DECL_ARGUMENTS (node))
+ {
+ if (dump_tree_state.line_cnt > 1)
+ newline_and_indent (file, 0);
+ dump_tree (file, "(args)", DECL_ARGUMENTS (node), indent + INDENT);
+ }
+
+ if (DECL_VINDEX (node))
+ {
+ if (dump_tree_state.line_cnt > 1)
+ newline_and_indent (file, 0);
+ dump_tree (file, "(inst)", DECL_VINDEX (node), indent + INDENT);
+ }
+
+ /* tsubst_decl() in cp/pt.c looks interesting */
+ if (TREE_TYPE (node))
+ {
+ if (dump_tree_state.line_cnt > 1)
+ newline_and_indent (file, 0);
+ dump_tree (file, "(obj-type)", TREE_TYPE (node), indent + INDENT);
+ }
+
+ if (DECL_TEMPLATE_RESULT (node))
+ {
+ if (dump_tree_state.line_cnt > 1)
+ newline_and_indent (file, 0);
+ dump_tree (file, "(obj-decl)", DECL_TEMPLATE_RESULT (node), indent + INDENT);
+ }
+
+ if (DECL_INITIAL (node))
+ {
+ if (dump_tree_state.line_cnt > 1)
+ newline_and_indent (file, 0);
+ dump_tree (file, "(assoc-tmpl)", DECL_INITIAL (node), indent + INDENT);
+ }
+}
+
+static void
+print_TEMPLATE_PARM_INDEX (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ fprintf (file, " idx/lvl=("HOST_WIDE_INT_PRINT_DEC","HOST_WIDE_INT_PRINT_DEC")"
+ " orig-lvl="HOST_WIDE_INT_PRINT_DEC
+ " dcndnts=",
+ TEMPLATE_PARM_IDX (node), TEMPLATE_PARM_LEVEL(node),
+ TEMPLATE_PARM_ORIG_LEVEL (node));
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (TEMPLATE_PARM_DESCENDANTS (node)));
+
+
+ print_decl (file, annotation, TEMPLATE_PARM_DECL(node), indent + INDENT);
+ dump_tree (file, "(dcndnt)", TEMPLATE_PARM_DESCENDANTS (node), indent + INDENT);
+}
+
+static void
+print_TEMPLATE_TYPE_PARM (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ fprintf (file, " parms=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (TEMPLATE_TYPE_IDX (node)));
+ fprintf (file, " idx/lvl=("HOST_WIDE_INT_PRINT_DEC","HOST_WIDE_INT_PRINT_DEC")"
+ " orig-lvl="HOST_WIDE_INT_PRINT_DEC,
+ TEMPLATE_TYPE_IDX (node), TEMPLATE_TYPE_LEVEL (node),
+ TEMPLATE_TYPE_ORIG_LEVEL (node));
+ print_type (file, annotation, node, indent);
+
+ dump_tree (file, "(parm)", TEMPLATE_TYPE_PARM_INDEX (node), indent + INDENT);
+}
+
+static void
+print_TEMPLATE_TEMPLATE_PARM (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ fprintf (file, " tmpl-decl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_NAME (node)));
+
+ print_TEMPLATE_TYPE_PARM (file, annotation, node, indent);
+
+ dump_tree (file, "(tmpl-decl)", TYPE_NAME (node), indent + INDENT);
+}
+
+static void
+print_BOUND_TEMPLATE_TEMPLATE_PARM (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ fprintf (file, " name=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (node)));
+ fprintf (file, " type-decl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_NAME (node)));
+ fprintf (file, " tmpl-decl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_TI_TEMPLATE (node)));
+
+ print_TEMPLATE_TYPE_PARM (file, annotation, node, indent);
+
+ dump_tree (file, "(name)", TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (node), indent + INDENT);
+ dump_tree (file, "(type-decl)", TYPE_NAME (node), indent + INDENT);
+ dump_tree (file, "(tmpl-decl)", TYPE_TI_TEMPLATE (node), indent + INDENT);
+}
+
+static void
+print_TYPENAME_TYPE (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ fprintf (file, " cntxt::id=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_CONTEXT (node)));
+ fprintf (file, "::");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_NAME (node)));
+
+ if (TYPENAME_TYPE_FULLNAME (node))
+ {
+ fprintf (file, " fullname=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPENAME_TYPE_FULLNAME (node)));
+ }
+ if (TREE_TYPE (node))
+ {
+ fprintf (file, " impl-type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_TYPE (node)));
+ }
+ print_type (file, annotation, node, indent);
+
+ dump_tree (file, "(cntxt)", TYPE_CONTEXT (node), indent + INDENT);
+ dump_tree (file, "(id)", TYPE_NAME (node), indent + INDENT);
+ dump_tree (file, "(fullname)", TYPENAME_TYPE_FULLNAME (node), indent + INDENT);
+ dump_tree (file, "(impl-type)", TREE_TYPE (node), indent + INDENT);
+}
+
+static void
+print_UNBOUND_CLASS_TEMPLATE (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ fprintf (file, " cntxt::id=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_CONTEXT (node)));
+ fprintf (file, "::");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_NAME (node)));
+ print_type (file, annotation, node, indent);
+
+ dump_tree (file, "(cntxt)", TYPE_CONTEXT (node), indent + INDENT);
+ dump_tree (file, "(id)", TYPE_NAME (node), indent + INDENT);
+}
+
+static void
+print_TYPEOF_TYPE (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ fprintf (file, " ");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_FIELDS (node)));
+ print_type (file, annotation, node, indent);
+
+ dump_tree (file, NULL, TYPE_FIELDS (node), indent + INDENT);
+}
+
+static void
+print_USING_DECL (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ fprintf (file, " scope=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_INITIAL (node)));
+ print_decl (file, annotation, node, indent);
+
+ dump_tree (file, "(scope)", DECL_INITIAL (node), indent + INDENT);
+}
+
+static void
+print_USING_STMT (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(using)", NULL);
+}
+
+static void
+print_DEFAULT_ARG (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent ATTRIBUTE_UNUSED)
+{
+#if 0
+ /* TO DO */
+ fprintf (file, " def-arg=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DEFARG_POINTER (node)));
+#endif
+ fprintf (file, " (struct unparsed_text * in cp/spew.c)");
+
+ if (TREE_PURPOSE (node))
+ {
+ fprintf (file, " purpose=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_PURPOSE (node)));
+ dump_tree (file, "(purpose)", TREE_PURPOSE (node), indent + INDENT);
+ }
+}
+
+static void
+print_TEMPLATE_ID_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(tmpl)", "(args)", NULL);
+}
+
+#if 0
+
+static void
+print_CPLUS_BINDING (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ tree n;
+
+ #define BINDING_LEVEL(NODE) \
+ (((struct tree_binding*)NODE)->scope.level)
+
+ if (LOCAL_BINDING_P (node))
+ fputs (" local", file);
+ if (INHERITED_VALUE_BINDING_P (node))
+ fputs (" inherited", file);
+
+ fprintf (file, " value=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (BINDING_VALUE (node)));
+
+ if (BINDING_HAS_LEVEL_P (node))
+ {
+ fprintf (file, " level=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE ( (node)));
+ fprintf (file, " (struct binding_level * in cp/decl.c)");
+ }
+ else
+ {
+ fprintf (file, " scope=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (BINDING_LEVEL (node)));
+ }
+
+ if (TREE_CHAIN (node))
+ {
+ fprintf (file, " chain=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_CHAIN (node)));
+ }
+
+ dump_tree (file, "(value)", BINDING_VALUE (node), indent + INDENT);
+ if (!BINDING_HAS_LEVEL_P (node))
+ dump_tree (file, "(scope)", BINDING_SCOPE (node), indent + INDENT);
+
+ for (n = TREE_CHAIN (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, "(chain)", n, indent + INDENT);
+}
+
+#endif
+
+static void
+print_OVERLOAD (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ tree n;
+
+ if (OVL_FUNCTION (node))
+ {
+ fprintf (file, " ovld=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (OVL_FUNCTION (node)));
+ }
+ if (OVL_CHAIN (node))
+ {
+ fprintf (file, " next-ovld=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (OVL_CHAIN (node)));
+ }
+
+ if ((TREE_CODE (OVL_FUNCTION (node)) == FUNCTION_DECL
+ || TREE_CODE (OVL_FUNCTION (node)) == TEMPLATE_DECL)
+ && DECL_NAME (OVL_FUNCTION (node)))
+ fprintf (file, " %s",
+ IDENTIFIER_POINTER (DECL_NAME (OVL_FUNCTION (node))));
+
+ if (DECL_CONSTRUCTOR_P (OVL_FUNCTION (node)))
+ dump_tree (file, NULL, OVL_FUNCTION (node), indent + INDENT);
+ else
+ dump_tree (file, "(ovld)", OVL_FUNCTION (node), indent + INDENT);
+
+ for (n = OVL_CHAIN (node); n; n = OVL_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+}
+
+static void
+print_WRAPPER (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent ATTRIBUTE_UNUSED)
+{
+ /* TODO: Print out tree_common. */
+ fprintf (file, " ptr=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (WRAPPER_ZC (node)));
+}
+
+static void
+print_MODOP_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(lhs)", "(modifycode)", "(rhs)", NULL);
+}
+
+static void
+print_CAST_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_REINTERPRET_CAST_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CONST_CAST_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_STATIC_CAST_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_DYNAMIC_CAST_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node ATTRIBUTE_UNUSED,
+ int indent ATTRIBUTE_UNUSED)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_DOTSTAR_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(datum)", "(cmpnt)", NULL);
+}
+
+static void
+print_TYPEID_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_PSEUDO_DTOR_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(obj)", "(scope)", "(dtor)", NULL);
+}
+
+static void
+print_CTOR_INITIALIZER (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(mbr-init)", "(base-init)", NULL);
+}
+
+#if 0
+static void
+print_RETURN_INIT (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(id)", "(init)", NULL);
+}
+#endif
+
+static void
+print_TRY_BLOCK (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ if (FN_TRY_BLOCK_P (node))
+ fputs (" func-try-blk", file);
+ if (CLEANUP_P (node))
+ fputs (" clnup", file);
+
+ print_operands (file, node, indent, TRUE, "(body)", "(hndlrs)", NULL);
+}
+
+static void
+print_EH_SPEC_BLOCK (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, "(body)", "(raises)", NULL);
+}
+
+static void
+print_HANDLER (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ fprintf (file, " hdnlr-type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (HANDLER_TYPE (node)));
+
+ print_operands (file, node, indent, TRUE, "(parms)", "(body)", NULL);
+}
+
+static void
+print_MUST_NOT_THROW_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TAG_DEFN (FILE *file ATTRIBUTE_UNUSED,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node ATTRIBUTE_UNUSED,
+ int indent ATTRIBUTE_UNUSED)
+{
+}
+
+static void
+print_IDENTITY_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LVALUE_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_QUAL_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_STD_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_PTR_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_PMEM_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BASE_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_REF_BIND (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_USER_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ fprintf (file, " from=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 0)));
+ fprintf (file, " cand=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 1)));
+
+ print_operands (file, node, indent, TRUE, "(from)", "(cand)", NULL);
+}
+
+static void
+print_AMBIG_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_RVALUE_CONV (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+/*-------------------------------------------------------------------*/
+
+/* Override to routine in dmp-tree.c print Method vector Record Type. */
+static void
+print_RECORD_TYPE (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ tree n;
+
+ fprintf (file, " fields=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_FIELDS (node)));
+ fprintf (file, " mbrs=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (CLASSTYPE_METHOD_VEC (node)));
+ if (TYPE_NO_FORCE_BLK (node))
+ fputs (" no-force-blk", file);
+ fprintf (file, " #parents=%d", CLASSTYPE_N_BASECLASSES (node));
+ if (CLASSTYPE_USE_TEMPLATE (node))
+ fprintf (file, " use-tmpl=%d", CLASSTYPE_USE_TEMPLATE (node));
+ if (TYPE_PTRMEMFUNC_P (node))
+ {
+ fprintf (file, " ptrmemfunc-fn-type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_PTRMEMFUNC_FN_TYPE (node)));
+ }
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ for (n = TYPE_FIELDS (node); n; n = TREE_CHAIN (n))
+ {
+ if (TREE_CODE (n) == TYPE_DECL
+ && TREE_TYPE (n) == DECL_CONTEXT (n)
+ && TREE_TYPE (n) == node)
+ dump_tree (file, "(self-reference)", n, indent + INDENT);
+ else
+ dump_tree (file, NULL, n, indent + INDENT);
+ }
+
+ dump_tree (file, "(mbrs)", CLASSTYPE_METHOD_VEC (node), indent + INDENT);
+
+ if (TYPE_PTRMEMFUNC_P (node))
+ {
+ newline_and_indent (file, 0);
+ dump_tree (file, "(ptrmemfunc-fn-type)",
+ TYPE_PTRMEMFUNC_FN_TYPE (node), indent + INDENT);
+ }
+}
+
+/* Override to routine in dmp-tree.c to print namespace. */
+static void
+print_NAMESPACE_DECL (FILE *file,
+ const char *annotation,
+ tree node,
+ int indent)
+{
+ if (NAMESPACE_LEVEL (node))
+ {
+ fprintf (file, " binding_lvl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (NAMESPACE_LEVEL (node)));
+ }
+ if (DECL_NAMESPACE_ALIAS (node))
+ {
+ fprintf (file, " alias=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_NAMESPACE_ALIAS (node)));
+ }
+ if (DECL_NAMESPACE_USING (node))
+ {
+ fprintf (file, " using=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_NAMESPACE_USING (node)));
+ }
+ if (DECL_NAMESPACE_USERS (node))
+ {
+ fprintf (file, " usrs=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_NAMESPACE_USERS (node)));
+ }
+
+ print_decl (file, annotation, node, indent);
+
+ dump_tree (file, "(alias)", DECL_NAMESPACE_ALIAS (node), indent + INDENT);
+ dump_tree (file, "(using)", DECL_NAMESPACE_USING (node), indent + INDENT);
+ dump_tree (file, "(usrs)", DECL_NAMESPACE_USERS (node), indent + INDENT);
+
+ if (dump_tree_state.visit_only_once == DMP_TREE_VISIT_ONCE2)
+ {
+ for (node = cp_namespace_decls (node); node; node = TREE_CHAIN (node))
+ dump_tree (file, NULL, node, indent + INDENT);
+ }
+}
+
+static void
+print_ADDR_EXPR (FILE *file,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node,
+ int indent)
+{
+ if (PTRMEM_OK_P (node))
+ fputs (" ptr-to-mbr-ok", file);
+
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ALIAS_DECL (FILE *file ATTRIBUTE_UNUSED,
+ const char *annotation ATTRIBUTE_UNUSED,
+ tree node ATTRIBUTE_UNUSED,
+ int indent ATTRIBUTE_UNUSED)
+{
+ /* TO DO */
+}
+
+/*-------------------------------------------------------------------*/
+
+/* Return 1 if tree node is a C++ specific tree node from cp-tree.def
+ or a tree node specific to whatever cp_prev_lang_dump_tree_p
+ calls. Otherwise return 0.
+*/
+
+int
+cp_dump_tree_p (FILE *file, const char *annotation, tree node, int indent)
+{
+ switch (TREE_CODE (node))
+ {
+ #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+ case SYM: print_ ## SYM (file, annotation, node, indent); break;
+ #include "cp-tree.def"
+ #undef DEFTREECODE
+
+ case RECORD_TYPE:
+ print_RECORD_TYPE (file, annotation, node, indent);
+ break;
+
+ case NAMESPACE_DECL:
+ print_NAMESPACE_DECL (file, annotation, node, indent);
+ break;
+
+ case ADDR_EXPR:
+ print_ADDR_EXPR (file, annotation, node, indent);
+ break;
+
+ default:
+ return cp_prev_lang_dump_tree_p (file, annotation, node, indent);
+ break;
+ }
+
+ return 1;
+}
+
+/*-------------------------------------------------------------------*/
+
+#if 0
+
+cd $gcc3/gcc; \
+cc -no-cpp-precomp -c -DIN_GCC -g \
+ -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+ -DHAVE_CONFIG_H \
+ -I$gcc3obj \
+ -Icp \
+ -I. \
+ -Iconfig \
+ -I../include \
+ cp/cp-dmp-tree.c -o ~/tmp.o -w
+
+#endif
diff --git a/gcc/cp/cp-idebug.c b/gcc/cp/cp-idebug.c
new file mode 100644
index 00000000000..1ed38930881
--- /dev/null
+++ b/gcc/cp/cp-idebug.c
@@ -0,0 +1,463 @@
+/* APPLE LOCAL file debugging */
+/* C++ tree & rtl accessors defined as functions for use in a debugger.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* What we do here is to instantiate each macro as a function *BY
+ THE SAME NAME*. Depends on the macro not being expanded when
+ it is surrounded by parens.
+
+ Note that this file includes idebug.c so that only debugging
+ macros for cp-tree.h are actually defined here. For C++ only
+ this file is included in the link while for C only c-idebug.c
+ is built and included in the link. */
+
+#include "idebug.c"
+
+#ifdef ENABLE_IDEBUG
+
+#include "cp/cp-tree.h"
+
+/* C++ tree debugging macro functions. From cp-tree.h.
+ I made special-case meta-macros for the most common
+ one-parameter ones, that take a node and return either
+ a node or an int. */
+
+#define fn_noden( m ) fn_1(m, tree, tree)
+#define fn_nodei( m ) fn_1(m, int, tree)
+
+/* Macros from cp-tree.h */
+
+fn_nodei( C_IS_RESERVED_WORD )
+fn_1( C_RID_CODE, enum rid, struct lang_identifier * )
+fn_1( LANG_IDENTIFIER_CAST, struct lang_identifier *, tree )
+fn_noden( BINDING_SCOPE )
+fn_nodei( BINDING_HAS_LEVEL_P )
+fn_noden( BINDING_VALUE )
+fn_noden( BINDING_TYPE )
+fn_noden( IDENTIFIER_GLOBAL_VALUE )
+fn_noden( IDENTIFIER_NAMESPACE_VALUE )
+fn_nodei( CLEANUP_P )
+fn_noden( CLEANUP_DECL )
+fn_noden( CLEANUP_EXPR )
+fn_2( same_type_p, int, tree, tree )
+fn_2( same_type_ignoring_top_level_qualifiers_p, int, tree, tree )
+fn_nodei( DECL_MAIN_P )
+fn_noden( OVL_FUNCTION )
+fn_noden( OVL_CHAIN )
+fn_noden( OVL_CURRENT )
+fn_noden( OVL_NEXT )
+fn_nodei( OVL_USED )
+fn_nodei( BASELINK_P )
+fn_nodei( SET_BASELINK_P )
+fn_1( SRCLOC_FILE, const char *, tree )
+fn_nodei( SRCLOC_LINE )
+fn_noden( IDENTIFIER_NAMESPACE_BINDINGS )
+fn_noden( IDENTIFIER_TEMPLATE )
+fn_noden( IDENTIFIER_BINDING )
+fn_noden( IDENTIFIER_VALUE )
+fn_noden( IDENTIFIER_CLASS_VALUE )
+fn_noden( IDENTIFIER_TYPE_VALUE )
+fn_noden( REAL_IDENTIFIER_TYPE_VALUE )
+fn_nodei( IDENTIFIER_HAS_TYPE_VALUE )
+fn_noden( IDENTIFIER_LABEL_VALUE )
+fn_noden( IDENTIFIER_IMPLICIT_DECL )
+fn_noden( IDENTIFIER_ERROR_LOCUS )
+fn_nodei( IDENTIFIER_VIRTUAL_P )
+fn_nodei( IDENTIFIER_OPNAME_P )
+fn_nodei( IDENTIFIER_TYPENAME_P )
+fn_nodei( IDENTIFIER_CTOR_OR_DTOR_P )
+fn_nodei( C_TYPE_FIELDS_READONLY )
+/*fn_nodei( C_EXP_ORIGINAL_CODE ) already declared in c-common.h */
+fn_2( C_SET_EXP_ORIGINAL_CODE, int, tree, tree )
+fn_1( ansi_opname, tree, int )
+fn_1( ansi_assopname, tree, int )
+fn_noden( TYPE_IDENTIFIER )
+fn_1( TYPE_NAME_STRING, char*, tree )
+fn_nodei( TYPE_NAME_LENGTH )
+fn_1( TYPE_ASSEMBLER_NAME_STRING, char*, tree )
+fn_nodei( TYPE_ASSEMBLER_NAME_LENGTH )
+fn_noden( TYPE_MAIN_DECL )
+fn_nodei( IS_AGGR_TYPE )
+fn_nodei( CLASS_TYPE_P )
+fn_1( IS_AGGR_TYPE_CODE, int, int )
+fn_2( IS_AGGR_TYPE_2, int, tree, tree )
+fn_nodei( IS_OVERLOAD_TYPE )
+fn_nodei( TYPE_BUILT_IN )
+fn_nodei( TYPE_FOR_JAVA )
+fn_nodei( CP_TYPE_QUALS )
+fn_nodei( CP_TYPE_CONST_P )
+fn_nodei( CP_TYPE_VOLATILE_P )
+fn_nodei( CP_TYPE_RESTRICT_P )
+fn_nodei( CP_TYPE_CONST_NON_VOLATILE_P )
+fn_noden( FNADDR_FROM_VTABLE_ENTRY )
+fn_noden( FUNCTION_ARG_CHAIN )
+fn_noden( FUNCTION_FIRST_USER_PARMTYPE )
+fn_noden( FUNCTION_FIRST_USER_PARM )
+fn_2( PROMOTES_TO_AGGR_TYPE, int, tree, unsigned )
+fn_2( UNIQUELY_DERIVED_FROM_P, int, tree, tree )
+fn_2( ACCESSIBLY_DERIVED_FROM_P, int, tree, tree )
+fn_2( ACCESSIBLY_UNIQUELY_DERIVED_P, int, tree, tree )
+fn_2( PUBLICLY_UNIQUELY_DERIVED_P, int, tree, tree )
+fn_2( DERIVED_FROM_P, int, tree, tree )
+fn_nodei( CLASSTYPE_USE_TEMPLATE )
+fn_noden( CLASSTYPE_INLINE_FRIENDS )
+fn_nodei( TYPE_GETS_DELETE )
+fn_nodei( TYPE_GETS_REG_DELETE )
+fn_nodei( TYPE_VEC_DELETE_TAKES_SIZE )
+fn_nodei( TYPE_VEC_NEW_USES_COOKIE )
+fn_nodei( TYPE_HAS_CONVERSION )
+fn_nodei( TYPE_HAS_ASSIGN_REF )
+fn_nodei( TYPE_HAS_CONST_ASSIGN_REF )
+fn_nodei( TYPE_HAS_INIT_REF )
+fn_nodei( TYPE_HAS_CONST_INIT_REF )
+fn_nodei( TYPE_HAS_NEW_OPERATOR )
+fn_nodei( TYPE_HAS_ARRAY_NEW_OPERATOR )
+fn_nodei( TYPE_BEING_DEFINED )
+fn_nodei( TYPE_REDEFINED )
+fn_noden( CLASSTYPE_RTTI )
+fn_nodei( TYPE_OVERLOADS_CALL_EXPR )
+fn_nodei( TYPE_OVERLOADS_ARRAY_REF )
+fn_nodei( TYPE_OVERLOADS_ARROW )
+fn_nodei( TYPE_USES_MULTIPLE_INHERITANCE )
+fn_nodei( TYPE_USES_VIRTUAL_BASECLASSES )
+fn_noden( CLASSTYPE_METHOD_VEC )
+fn_noden( CLASSTYPE_CONSTRUCTORS )
+fn_noden( CLASSTYPE_DESTRUCTORS )
+fn_2( CLASSTYPE_MARKED_N, int, tree, int )
+fn_nodei( CLASSTYPE_MARKED )
+fn_nodei( CLASSTYPE_MARKED2 )
+fn_nodei( CLASSTYPE_MARKED3 )
+fn_nodei( CLASSTYPE_MARKED4 )
+fn_nodei( CLASSTYPE_MARKED5 )
+fn_nodei( CLASSTYPE_MARKED6 )
+fn_noden( CLASSTYPE_TAGS )
+fn_nodei( CLASSTYPE_HAS_PRIMARY_BASE_P )
+fn_noden( CLASSTYPE_PRIMARY_BINFO )
+fn_nodei( CLASSTYPE_VSIZE )
+fn_noden( CLASSTYPE_VBASECLASSES )
+fn_2( CANONICAL_BINFO, tree, tree, tree )
+fn_nodei( CLASSTYPE_N_BASECLASSES )
+fn_noden( CLASSTYPE_SIZE )
+fn_noden( CLASSTYPE_SIZE_UNIT )
+fn_nodei( CLASSTYPE_ALIGN )
+fn_nodei( CLASSTYPE_USER_ALIGN )
+fn_nodei( CLASSTYPE_ALIGN_UNIT )
+fn_nodei( TYPE_JAVA_INTERFACE )
+fn_noden( CLASSTYPE_PURE_VIRTUALS )
+fn_nodei( CLASSTYPE_GOT_SEMICOLON )
+fn_nodei( CLASSTYPE_NEEDS_VIRTUAL_REINIT )
+fn_nodei( TYPE_HAS_DEFAULT_CONSTRUCTOR )
+fn_nodei( CLASSTYPE_HAS_MUTABLE )
+fn_nodei( TYPE_HAS_MUTABLE_P )
+fn_nodei( CLASSTYPE_NON_POD_P )
+fn_nodei( CLASSTYPE_NEARLY_EMPTY_P )
+fn_nodei( CLASSTYPE_COM_INTERFACE )
+fn_noden( CLASSTYPE_FRIEND_CLASSES )
+fn_noden( CLASSTYPE_BEFRIENDING_CLASSES )
+fn_nodei( CLASSTYPE_DECLARED_CLASS )
+fn_nodei( CLASSTYPE_READONLY_FIELDS_NEED_INIT )
+fn_nodei( CLASSTYPE_REF_FIELDS_NEED_INIT )
+fn_nodei( CLASSTYPE_INTERFACE_ONLY )
+fn_nodei( CLASSTYPE_INTERFACE_KNOWN )
+fn_nodei( CLASSTYPE_INTERFACE_UNKNOWN )
+fn_2( SET_CLASSTYPE_INTERFACE_UNKNOWN_X, int, tree, int )
+fn_nodei( SET_CLASSTYPE_INTERFACE_UNKNOWN )
+fn_nodei( SET_CLASSTYPE_INTERFACE_KNOWN )
+fn_nodei( CLASSTYPE_DEBUG_REQUESTED )
+fn_nodei( BINFO_MARKED )
+fn_nodei( BINFO_VTABLE_PATH_MARKED )
+fn_nodei( BINFO_NEW_VTABLE_MARKED )
+fn_nodei( BINFO_PUSHDECLS_MARKED )
+fn_nodei( BINFO_PRIMARY_P )
+fn_noden( BINFO_SUBVTT_INDEX )
+fn_noden( BINFO_VPTR_INDEX )
+fn_noden( BINFO_PRIMARY_BASE_OF )
+fn_nodei( BINFO_LOST_PRIMARY_P )
+fn_nodei( BINFO_INDIRECT_PRIMARY_P )
+fn_nodei( IDENTIFIER_MARKED )
+fn_noden( CLASSTYPE_VFIELDS )
+fn_noden( VF_BINFO_VALUE )
+fn_noden( VF_BASETYPE_VALUE )
+fn_noden( VF_DERIVED_VALUE )
+fn_noden( BV_DELTA )
+fn_noden( BV_VCALL_INDEX )
+fn_noden( BV_FN )
+fn_nodei( BV_USE_VCALL_INDEX_P )
+fn_nodei( BV_GENERATE_THUNK_WITH_VTABLE_P )
+fn_nodei( TREE_PARMLIST )
+fn_nodei( PARMLIST_ELLIPSIS_P )
+fn_noden( TYPE_RAISES_EXCEPTIONS )
+fn_nodei( TYPE_NOTHROW_P )
+fn_1( NAMESPACE_LEVEL, struct binding_level*, tree )
+fn_nodei( CAN_HAVE_FULL_LANG_DECL_P )
+fn_1( DEFARG_POINTER, const unsigned char *, tree )
+fn_nodei( DECL_NEEDED_P )
+fn_nodei( DECL_IN_MEMORY_P )
+fn_nodei( DECL_LANGUAGE )
+fn_nodei( DECL_CONSTRUCTOR_P )
+fn_nodei( DECL_COMPLETE_CONSTRUCTOR_P )
+fn_nodei( DECL_BASE_CONSTRUCTOR_P )
+fn_nodei( DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P )
+fn_nodei( DECL_COPY_CONSTRUCTOR_P )
+fn_nodei( DECL_DESTRUCTOR_P )
+fn_nodei( DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P )
+fn_nodei( DECL_COMPLETE_DESTRUCTOR_P )
+fn_nodei( DECL_BASE_DESTRUCTOR_P )
+fn_nodei( DECL_DELETING_DESTRUCTOR_P )
+fn_nodei( DECL_CLONED_FUNCTION_P )
+fn_noden( DECL_CLONED_FUNCTION )
+fn_nodei( DECL_DISCRIMINATOR_P )
+fn_nodei( DECL_DISCRIMINATOR )
+fn_nodei( DECL_HAS_VTT_PARM_P )
+fn_nodei( DECL_NEEDS_VTT_PARM_P )
+fn_nodei( DECL_CONV_FN_P )
+fn_2( SET_OVERLOADED_OPERATOR_CODE, enum tree_code, tree, enum tree_code )
+fn_nodei( DECL_OVERLOADED_OPERATOR_P )
+fn_nodei( DECL_ASSIGNMENT_OPERATOR_P )
+fn_nodei( DECL_HAS_IN_CHARGE_PARM_P )
+fn_nodei( DECL_ARRAY_DELETE_OPERATOR_P )
+fn_nodei( DECL_IN_AGGR_P )
+fn_nodei( DECL_INITIALIZED_IN_CLASS_P )
+fn_nodei( DECL_FRIEND_P )
+fn_noden( DECL_BEFRIENDING_CLASSES )
+fn_nodei( DECL_STATIC_FUNCTION_P )
+fn_nodei( DECL_NONSTATIC_MEMBER_FUNCTION_P )
+fn_nodei( DECL_FUNCTION_MEMBER_P )
+fn_nodei( DECL_CONST_MEMFUNC_P )
+fn_nodei( DECL_VOLATILE_MEMFUNC_P )
+fn_nodei( DECL_NONSTATIC_MEMBER_P )
+fn_nodei( DECL_MUTABLE_P )
+fn_nodei( DECL_NONCONVERTING_P )
+fn_nodei( DECL_PURE_VIRTUAL_P )
+fn_nodei( DECL_NEEDS_FINAL_OVERRIDER_P )
+fn_nodei( DECL_THUNK_P )
+fn_nodei( DECL_NON_THUNK_FUNCTION_P )
+fn_nodei( DECL_EXTERN_C_P )
+fn_nodei( DECL_EXTERN_C_FUNCTION_P )
+fn_2 ( SET_DECL_THUNK_P, tree, tree, tree )
+fn_nodei( DECL_PRETTY_FUNCTION_P )
+fn_noden( DECL_CLASS_CONTEXT )
+fn_noden( DECL_FRIEND_CONTEXT )
+fn_2( SET_DECL_FRIEND_CONTEXT, tree, tree, tree )
+fn_noden( CP_DECL_CONTEXT )
+fn_noden( FROB_CONTEXT )
+fn_noden( DECL_VIRTUAL_CONTEXT )
+fn_nodei( DECL_NAMESPACE_SCOPE_P )
+fn_nodei( DECL_CLASS_SCOPE_P )
+fn_nodei( DECL_FUNCTION_SCOPE_P )
+fn_nodei( LOCAL_CLASS_P )
+fn_noden( DECL_NAMESPACE_USING )
+fn_noden( DECL_NAMESPACE_USERS )
+fn_noden( DECL_NAMESPACE_ALIAS )
+fn_noden( ORIGINAL_NAMESPACE )
+fn_nodei( DECL_NAMESPACE_STD_P )
+fn_nodei( DECL_INIT_PRIORITY )
+fn_nodei( TREE_INDIRECT_USING )
+fn_noden( DECL_SHADOWED_FOR_VAR )
+fn_nodei( DECL_PENDING_INLINE_P )
+fn_1( DECL_PENDING_INLINE_INFO, struct unparsed_text *, tree )
+fn_noden( DECL_SORTED_FIELDS )
+fn_nodei( DECL_DEFERRED_FN )
+fn_noden( DECL_TEMPLATE_INFO )
+fn_noden( CLASSTYPE_TEMPLATE_INFO )
+fn_noden( ENUM_TEMPLATE_INFO )
+fn_noden( TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO )
+fn_noden( TYPE_TEMPLATE_INFO )
+fn_2( SET_TYPE_TEMPLATE_INFO, tree, tree, tree )
+fn_noden( TI_TEMPLATE )
+fn_noden( TI_ARGS )
+fn_nodei( TI_PENDING_TEMPLATE_FLAG )
+fn_nodei( TMPL_ARGS_HAVE_MULTIPLE_LEVELS )
+fn_nodei( TMPL_ARGS_DEPTH )
+fn_2( TMPL_ARGS_LEVEL, tree, tree, int )
+fn_3( SET_TMPL_ARGS_LEVEL, tree, tree, int, tree )
+fn_3( TMPL_ARG, tree, tree, int, int )
+fn_4( SET_TMPL_ARG, tree, tree, int, int, tree )
+fn_nodei( NUM_TMPL_ARGS )
+fn_noden( INNERMOST_TEMPLATE_ARGS )
+fn_1( TMPL_PARMS_DEPTH, unsigned HOST_WIDE_INT, tree )
+fn_noden( DECL_TI_TEMPLATE )
+fn_noden( DECL_TI_ARGS )
+fn_noden( CLASSTYPE_TI_TEMPLATE )
+fn_noden( CLASSTYPE_TI_ARGS )
+fn_noden( ENUM_TI_TEMPLATE )
+fn_noden( ENUM_TI_ARGS )
+fn_noden( TYPE_TI_TEMPLATE )
+fn_noden( TYPE_TI_ARGS)
+fn_noden( INNERMOST_TEMPLATE_PARMS )
+fn_nodei( TEMPLATE_PARMS_FOR_INLINE )
+fn_1( DECL_SAVED_FUNCTION_DATA, struct cp_language_function *, tree )
+fn_nodei( NEW_EXPR_USE_GLOBAL )
+fn_nodei( DELETE_EXPR_USE_GLOBAL )
+fn_nodei( DELETE_EXPR_USE_VEC )
+fn_nodei( LOOKUP_EXPR_GLOBAL )
+fn_nodei( AGGR_INIT_VIA_CTOR_P )
+fn_nodei( CLASSTYPE_IS_TEMPLATE )
+fn_noden( TYPENAME_TYPE_FULLNAME )
+fn_nodei( IMPLICIT_TYPENAME_P )
+fn_nodei( IMPLICIT_TYPENAME_TYPE_DECL_P )
+fn_nodei( TREE_NEGATED_INT )
+fn_nodei( TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P )
+fn_nodei( TYPE_POLYMORPHIC_P )
+fn_nodei( TYPE_CONTAINS_VPTR_P )
+fn_nodei( DECL_DEAD_FOR_LOCAL )
+fn_nodei( DECL_ERROR_REPORTED )
+fn_nodei( DECL_LOCAL_FUNCTION_P )
+fn_nodei( DECL_ANTICIPATED )
+fn_nodei( C_TYPEDEF_EXPLICITLY_SIGNED )
+fn_nodei( DECL_EXTERNAL_LINKAGE_P )
+fn_1( INTEGRAL_CODE_P, int, int )
+fn_nodei( CP_INTEGRAL_TYPE_P )
+fn_nodei( ARITHMETIC_TYPE_P )
+fn_nodei( TYPE_HAS_CONSTRUCTOR )
+fn_nodei( TREE_HAS_CONSTRUCTOR )
+fn_nodei( EMPTY_CONSTRUCTOR_P )
+fn_nodei( TYPE_HAS_DESTRUCTOR )
+fn_nodei( CLASSTYPE_NON_AGGREGATE )
+fn_nodei( TYPE_NON_AGGREGATE_CLASS )
+fn_nodei( TYPE_HAS_REAL_ASSIGN_REF )
+fn_nodei( TYPE_HAS_COMPLEX_ASSIGN_REF )
+fn_nodei( TYPE_HAS_ABSTRACT_ASSIGN_REF )
+fn_nodei( TYPE_HAS_COMPLEX_INIT_REF )
+fn_nodei( TYPE_HAS_TRIVIAL_DESTRUCTOR1 )
+fn_nodei( TYPE_HAS_NONTRIVIAL_DESTRUCTOR )
+fn_nodei( TYPE_HAS_TRIVIAL_INIT_REF )
+fn_nodei( TYPE_HAS_TRIVIAL_ASSIGN_REF )
+fn_nodei( TYPE_PTRMEM_P )
+fn_nodei( TYPE_PTR_P )
+fn_nodei( TYPE_PTROB_P )
+fn_nodei( TYPE_PTROBV_P )
+fn_nodei( TYPE_PTRFN_P )
+fn_nodei( TYPE_PTRMEMFUNC_P )
+fn_nodei( TYPE_PTRMEMFUNC_FLAG )
+fn_nodei( PTRMEM_OK_P )
+fn_noden( TYPE_PTRMEMFUNC_FN_TYPE )
+fn_noden( TYPE_PTRMEMFUNC_OBJECT_TYPE )
+fn_noden( TYPE_GET_PTRMEMFUNC_TYPE )
+#if 0 /* this one doesn't have a return value */
+fn_2( TYPE_SET_PTRMEMFUNC_TYPE, struct lang_type *, tree, struct lang_type*)
+#endif
+fn_noden( DELTA2_FROM_PTRMEMFUNC )
+fn_noden( PFN_FROM_PTRMEMFUNC )
+fn_noden( TYPE_PTRMEM_CLASS_TYPE )
+fn_noden( TYPE_PTRMEM_POINTED_TO_TYPE )
+fn_noden( PTRMEM_CST_CLASS )
+fn_noden( PTRMEM_CST_MEMBER )
+fn_nodei( DECL_THIS_EXTERN )
+fn_nodei( DECL_THIS_STATIC )
+fn_nodei( ANON_AGGR_TYPE_P )
+fn_nodei( SET_ANON_AGGR_TYPE_P )
+fn_nodei( ANON_UNION_TYPE_P )
+fn_nodei( TYPE_WAS_ANONYMOUS )
+fn_noden( DECL_FRIENDLIST )
+fn_noden( FRIEND_NAME )
+fn_noden( FRIEND_DECLS )
+fn_noden( DECL_ACCESS )
+fn_nodei( DECL_GLOBAL_CTOR_P )
+fn_nodei( DECL_GLOBAL_DTOR_P )
+fn_nodei( GLOBAL_INIT_PRIORITY )
+fn_noden( DECL_TEMPLATE_PARMS )
+fn_noden( DECL_INNERMOST_TEMPLATE_PARMS )
+fn_nodei( DECL_NTPARMS )
+fn_noden( DECL_TEMPLATE_RESULT )
+fn_noden( DECL_TEMPLATE_INSTANTIATIONS )
+fn_noden( DECL_TEMPLATE_SPECIALIZATIONS )
+fn_nodei( DECL_TEMPLATE_PARM_P )
+fn_nodei( SET_DECL_TEMPLATE_PARM_P )
+fn_nodei( DECL_TEMPLATE_TEMPLATE_PARM_P )
+fn_nodei( DECL_FUNCTION_TEMPLATE_P )
+fn_nodei( DECL_CLASS_TEMPLATE_P )
+fn_nodei( DECL_DECLARES_TYPE_P )
+fn_nodei( DECL_IMPLICIT_TYPEDEF_P )
+fn_nodei( SET_DECL_IMPLICIT_TYPEDEF_P )
+fn_noden( DECL_PRIMARY_TEMPLATE )
+fn_nodei( PRIMARY_TEMPLATE_P )
+fn_nodei( CLASSTYPE_TEMPLATE_LEVEL )
+fn_nodei( DECL_USE_TEMPLATE )
+fn_nodei( DECL_TEMPLATE_INSTANTIATION )
+fn_nodei( CLASSTYPE_TEMPLATE_INSTANTIATION )
+fn_nodei( DECL_TEMPLATE_SPECIALIZATION )
+fn_nodei( SET_DECL_TEMPLATE_SPECIALIZATION )
+fn_nodei( CLASSTYPE_TEMPLATE_SPECIALIZATION )
+fn_nodei( SET_CLASSTYPE_TEMPLATE_SPECIALIZATION )
+fn_nodei( DECL_IMPLICIT_INSTANTIATION )
+fn_nodei( SET_DECL_IMPLICIT_INSTANTIATIO )
+fn_nodei( CLASSTYPE_IMPLICIT_INSTANTIATION )
+fn_nodei( SET_CLASSTYPE_IMPLICIT_INSTANTIATION )
+fn_nodei( DECL_EXPLICIT_INSTANTIATION )
+fn_nodei( SET_DECL_EXPLICIT_INSTANTIATION )
+fn_nodei( CLASSTYPE_EXPLICIT_INSTANTIATION )
+fn_nodei( SET_CLASSTYPE_EXPLICIT_INSTANTIATION )
+fn_nodei( DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION )
+fn_nodei( PARTIAL_INSTANTIATION_P )
+fn_0( PROCESSING_REAL_TEMPLATE_DECL_P, int )
+fn_nodei( DECL_MAYBE_TEMPLATE )
+fn_nodei( DECL_TEMPLATE_INSTANTIATED )
+fn_nodei( DECL_INTERFACE_KNOWN )
+fn_nodei( DECL_DECLARED_INLINE_P )
+fn_nodei( DECL_NOT_REALLY_EXTERN )
+fn_nodei( DECL_REALLY_EXTERN )
+fn_nodei( THUNK_DELTA )
+fn_noden( THUNK_VCALL_OFFSET )
+fn_nodei( THUNK_GENERATE_WITH_VTABLE_P )
+fn_noden( TRY_STMTS )
+fn_noden( TRY_HANDLERS )
+fn_noden( EH_SPEC_STMTS )
+fn_noden( EH_SPEC_RAISES )
+fn_nodei( FN_TRY_BLOCK_P )
+fn_noden( HANDLER_PARMS )
+fn_noden( HANDLER_BODY )
+fn_noden( SUBOBJECT_CLEANUP )
+fn_noden( START_CATCH_TYPE )
+fn_nodei( CTOR_BEGIN_P )
+fn_nodei( CTOR_END_P )
+fn_noden( CALL_DECLARATOR_PARMS )
+fn_noden( CALL_DECLARATOR_QUALS )
+fn_noden( CALL_DECLARATOR_EXCEPTION_SPEC )
+fn_noden( TINST_DECL )
+fn_nodei( TINST_LINE )
+fn_1( TINST_FILE, char*, tree )
+fn_nodei( THIS_NAME_P )
+fn_nodei( VPTR_NAME_P )
+fn_nodei( DESTRUCTOR_NAME_P )
+fn_nodei( VTABLE_NAME_P )
+fn_nodei( VBASE_NAME_P )
+fn_nodei( TEMP_NAME_P )
+fn_nodei( VFIELD_NAME_P )
+fn_nodei( ANON_AGGRNAME_P )
+fn_nodei( ANON_PARMNAME_P )
+fn_2( same_or_base_type_p, int, tree, tree )
+fn_1( TEMPLATE_PARM_INDEX_CAST, template_parm_index*, tree )
+fn_nodei( TEMPLATE_PARM_IDX )
+fn_nodei( TEMPLATE_PARM_LEVEL )
+fn_noden( TEMPLATE_PARM_DESCENDANTS )
+fn_nodei( TEMPLATE_PARM_ORIG_LEVEL )
+fn_noden( TEMPLATE_PARM_DECL )
+fn_noden( TEMPLATE_TYPE_PARM_INDEX )
+fn_nodei( TEMPLATE_TYPE_IDX )
+fn_nodei( TEMPLATE_TYPE_LEVEL )
+fn_nodei( TEMPLATE_TYPE_ORIG_LEVEL )
+fn_noden( TEMPLATE_TYPE_DECL )
+fn_noden( TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL )
+fn_2( cp_build_qualified_type, tree, tree, int )
+fn_3( cp_build_binary_op, tree, enum tree_code, tree, tree )
+
+#endif /* ENABLE_IDEBUG */
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index fb5b2389131..8af09e9c3f4 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -53,6 +53,8 @@ static void cxx_initialize_diagnostics (diagnostic_context *);
#define LANG_HOOKS_FINISH cxx_finish
#undef LANG_HOOKS_CLEAR_BINDING_STACK
#define LANG_HOOKS_CLEAR_BINDING_STACK pop_everything
+#undef LANG_HOOKS_FINISH_FILE
+#define LANG_HOOKS_FINISH_FILE finish_file
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
#undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
@@ -189,6 +191,22 @@ static void cxx_initialize_diagnostics (diagnostic_context *);
#undef LANG_HOOKS_GIMPLIFY_EXPR
#define LANG_HOOKS_GIMPLIFY_EXPR cp_gimplify_expr
+/* APPLE LOCAL begin Objective-C++ */
+/* Redefine the hooks that need to be different for ObjC++. */
+#ifdef OBJCPLUS
+static void objcplus_init_options PARAMS ((void));
+#include "objc/objc-act.h"
+#undef LANG_HOOKS_NAME
+#define LANG_HOOKS_NAME "GNU Objective-C++"
+#undef LANG_HOOKS_INIT
+#define LANG_HOOKS_INIT objc_init
+#undef LANG_HOOKS_FINISH_FILE
+#define LANG_HOOKS_FINISH_FILE objc_finish_file
+#undef LANG_HOOKS_INIT_OPTIONS
+#define LANG_HOOKS_INIT_OPTIONS objcplus_init_options
+#endif /* OBJCPLUS */
+/* APPLE LOCAL end Objective-C++ */
+
/* Each front end provides its own hooks, for toplev.c. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -202,6 +220,12 @@ const char tree_code_type[] = {
#include "c-common.def"
'x',
#include "cp-tree.def"
+/* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ 'x',
+#include "objc-tree.def"
+#endif
+/* APPLE LOCAL end Objective-C++ */
};
#undef DEFTREECODE
@@ -217,6 +241,12 @@ const unsigned char tree_code_length[] = {
#include "c-common.def"
0,
#include "cp-tree.def"
+/* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ 0,
+#include "objc-tree.def"
+#endif
+/* APPLE LOCAL end Objective-C++ */
};
#undef DEFTREECODE
@@ -230,6 +260,12 @@ const char *const tree_code_name[] = {
#include "c-common.def"
"@@dummy",
#include "cp-tree.def"
+/* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ "@@dummy",
+#include "objc-tree.def"
+#endif
+/* APPLE LOCAL end Objective-C++ */
};
#undef DEFTREECODE
@@ -269,6 +305,16 @@ cxx_warn_unused_global_decl (tree decl)
return true;
}
+/* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+static void
+objcplus_init_options (void)
+{
+ flag_objc = 1;
+ cxx_init_options ();
+}
+#endif
+
/* Langhook for expr_size: Tell the backend that the value of an expression
of non-POD class type does not include any tail padding; a derived class
might have allocated something there. */
@@ -386,3 +432,20 @@ cxx_initialize_diagnostics (diagnostic_context *context)
/* It is safe to free this object because it was previously malloc()'d. */
free (base);
}
+
+/* APPLE LOCAL Objective-C++ */
+/* Include the GC roots here instead of in cp/decl.c, so we can
+ conditionalize on OBJCPLUS. */
+#include "decl.h"
+#include "debug.h"
+#include "lex.h"
+#include "gt-cp-cp-tree-h.h"
+#include "gt-cp-decl-h.h"
+#ifdef OBJCPLUS
+tree objcp_dummy = 0;
+#include "gtype-objcp.h"
+#else
+tree cp_dummy = 0;
+#include "gtype-cp.h"
+#endif
+/* APPLE LOCAL end Objective-C++ */
diff --git a/gcc/cp/cp-root.h b/gcc/cp/cp-root.h
new file mode 100644
index 00000000000..3bb87980f0d
--- /dev/null
+++ b/gcc/cp/cp-root.h
@@ -0,0 +1,4 @@
+/* APPLE LOCAL file Objective-C++ */
+/* Empty file to be the base for gtype-cp.h. */
+
+extern GTY(()) tree cp_dummy;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index f6282105daf..69596bc635c 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -223,6 +223,9 @@ struct lang_identifier GTY(())
cxx_binding *bindings;
tree class_value;
tree class_template_info;
+ /* APPLE begin LOCAL objc speedup dpatel */
+ tree interface_value;
+ /* APPLE end LOCAL objc speedup dpatel */
tree label_value;
tree implicit_decl;
tree error_locus;
@@ -536,6 +539,8 @@ enum cp_tree_index
CPTI_LANG_NAME_C,
CPTI_LANG_NAME_CPLUSPLUS,
CPTI_LANG_NAME_JAVA,
+ /* APPLE LOCAL Objective-C++ */
+ CPTI_LANG_NAME_OBJC,
CPTI_EMPTY_EXCEPT_SPEC,
CPTI_NULL,
@@ -548,6 +553,12 @@ enum cp_tree_index
CPTI_KEYED_CLASSES,
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
+ CPTI_DELTA2_IDENTIFIER,
+ CPTI_INDEX_IDENTIFIER,
+ CPTI_PFN_OR_DELTA2_IDENTIFIER,
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
+
CPTI_MAX
};
@@ -619,6 +630,12 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
#define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
#define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
+#define delta2_identifier cp_global_trees[CPTI_DELTA2_IDENTIFIER]
+#define index_identifier cp_global_trees[CPTI_INDEX_IDENTIFIER]
+#define pfn_or_delta2_identifier cp_global_trees[CPTI_PFN_OR_DELTA2_IDENTIFIER]
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
+
/* The name of the parameter that contains a pointer to the VTT to use
for this subobject constructor or destructor. */
#define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
@@ -631,6 +648,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
#define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA]
+/* APPLE LOCAL Objective-C++ */
+#define lang_name_objc cp_global_trees[CPTI_LANG_NAME_OBJC]
/* Exception specifier used for throw(). */
#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
@@ -879,7 +898,8 @@ enum cplus_tree_code {
CTOR_INITIALIZER, TRY_BLOCK, HANDLER, \
EH_SPEC_BLOCK, USING_STMT, TAG_DEFN
-enum languages { lang_c, lang_cplusplus, lang_java };
+/* APPLE LOCAL Objective-C++ */
+enum languages { lang_c, lang_cplusplus, lang_java, lang_objc };
/* Macros to make error reporting functions' lives easier. */
#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
@@ -2504,8 +2524,13 @@ struct lang_decl GTY(())
/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
before using this macro. */
-#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
- (TREE_TYPE (TYPE_FIELDS (NODE)))
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */ \
+#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
+ *((flag_apple_kext) ? \
+ &(TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN ( \
+ TREE_CHAIN (TYPE_FIELDS (NODE))))))) : \
+ &(TREE_TYPE (TYPE_FIELDS (NODE)))) \
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
/* Returns `A' for a type like `int (A::*)(double)' */
#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
@@ -3567,6 +3592,8 @@ extern void note_name_declared_in_class (tree, tree);
extern tree get_vtbl_decl_for_binfo (tree);
extern tree get_vtt_name (tree);
extern tree get_primary_binfo (tree);
+/* APPLE LOCAL -findirect-virtual-calls 2001-10-30 sts */
+extern tree build_vfn_ref_using_vtable (tree, tree);
extern void debug_class (tree);
extern void debug_thunks (tree);
@@ -3587,6 +3614,12 @@ extern void clone_function_decl (tree, int);
extern void adjust_clone_args (tree);
/* decl.c */
+/* APPLE LOCAL msg send super */
+extern struct cp_binding_level *get_current_binding_level (void);
+/* APPLE LOCAL begin Objective-C++ */
+extern tree grokparms (tree);
+extern void store_parm_decls (tree);
+/* APPLE LOCAL end Objective-C++ */
extern void insert_block (tree);
extern void set_block (tree);
extern tree pushdecl (tree);
@@ -4265,6 +4298,22 @@ extern tree mangle_ref_init_variable (tree);
/* in dump.c */
extern bool cp_dump_tree (void *, tree);
+/* APPLE LOCAL begin ddtor double destructor turly 20020215 */
+extern int has_apple_kext_compatibility_attr_p PARAMS ((tree));
+extern int has_empty_operator_delete_p PARAMS ((tree));
+extern int compound_body_is_empty_p PARAMS ((tree));
+/* APPLE LOCAL end ddtor double destructor turly 20020215 */
+
+/* APPLE LOCAL begin new tree dump */
+/* in cp-dmp-tree.c */
+extern void cxx_dump_identifier PARAMS ((FILE *, tree, int, int));
+extern void cxx_dump_decl PARAMS ((FILE *, tree, int, int));
+extern void cxx_dump_type PARAMS ((FILE *, tree, int, int));
+extern int cxx_dump_blank_line_p PARAMS ((tree, tree));
+extern int cxx_dump_lineno_p PARAMS ((FILE *, tree));
+extern int cxx_dmp_tree3 PARAMS ((FILE *, tree, int));
+/* APPLE LOCAL end new tree dump */
+
/* in cp-simplify.c */
extern int cp_gimplify_expr (tree *, tree *, tree *);
extern int cp_gimplify_stmt (tree *, tree *);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8e7eded6047..cbe66991aa5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -53,7 +53,9 @@ Boston, MA 02111-1307, USA. */
#include "timevar.h"
#include "tree-flow.h"
-static tree grokparms (tree);
+/* APPLE LOCAL Objective-C++ */
+/* 'grokparms' is now extern, prototype moved to cp-tree.h. */
+
static const char *redeclaration_error_message (tree, tree);
static int decl_jump_unsafe (tree);
@@ -114,7 +116,8 @@ static tree check_special_function_return_type
(special_function_kind, tree, tree);
static tree push_cp_library_fn (enum tree_code, tree);
static tree build_cp_library_fn (tree, enum tree_code, tree);
-static void store_parm_decls (tree);
+/* APPLE LOCAL Objective-C++ */
+/* 'store_parm_decls' is now extern, prototype moved to cp-tree.h. */
static void initialize_local_var (tree, tree);
static void expand_static_init (tree, tree);
static tree next_initializable_field (tree);
@@ -237,10 +240,17 @@ int function_depth;
with __attribute__((deprecated)). An object declared as
__attribute__((deprecated)) suppresses warnings of uses of other
deprecated items. */
+/* APPLE LOCAL begin unavailable */
+/* An object declared as __attribute__((unavailable)) suppresses
+ any reports of being declared with unavailable or deprecated
+ items. */
+/* APPLE LOCAL end unavailable */
enum deprecated_states {
DEPRECATED_NORMAL,
DEPRECATED_SUPPRESS
+ /* APPLE LOCAL unavailable */
+ , DEPRECATED_UNAVAILABLE_SUPPRESS
};
static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
@@ -2859,6 +2869,8 @@ initialize_predefined_identifiers (void)
static const predefined_identifier predefined_identifiers[] = {
{ "C++", &lang_name_cplusplus, 0 },
{ "C", &lang_name_c, 0 },
+ /* APPLE LOCAL Objective-C++ */
+ { "Objective-C", &lang_name_objc, 0 }, /* this is DEPRECATED */
{ "Java", &lang_name_java, 0 },
{ CTOR_NAME, &ctor_identifier, 1 },
{ "__base_ctor", &base_ctor_identifier, 1 },
@@ -2885,6 +2897,45 @@ initialize_predefined_identifiers (void)
if (pid->ctor_or_dtor_p)
IDENTIFIER_CTOR_OR_DTOR_P (*pid->node) = 1;
}
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
+ if (flag_apple_kext)
+ {
+ /* This is snarfed from the 2.95 cp-tree.h. The mechanism is
+ completely different from gcc3 (see cp-tree.h, and read the
+ comment just above 'enum ptrmemfunc_vbit_where_t'. Sigh.
+
+ A 2.95 pointer-to-function member type looks like:
+
+ struct {
+ short __delta;
+ short __index;
+ union {
+ P __pfn;
+ short __delta2;
+ } __pfn_or_delta2;
+ };
+
+ where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
+ pointer to member. The fields are used as follows:
+
+ If __INDEX is -1, then the function to call is non-virtual, and
+ is located at the address given by __PFN.
+
+ If __INDEX is zero, then this a NULL pointer-to-member.
+
+ Otherwise, the function to call is virtual. Then, __DELTA2 gives
+ the offset from an instance of the object to the virtual function
+ table, and __INDEX - 1 is the index into the vtable to use to
+ find the function.
+
+ The value to use for the THIS parameter is the address of the
+ object plus __DELTA. */
+
+ delta2_identifier = get_identifier ("__delta2");
+ index_identifier = get_identifier ("__index");
+ pfn_or_delta2_identifier = get_identifier ("__pfn_or_delta2");
+ }
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
}
/* Create the predefined scalar types of C,
@@ -2974,6 +3025,11 @@ cxx_init_decl_processing (void)
record_builtin_type (RID_MAX, NULL, string_type_node);
#endif
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
+ if (flag_apple_kext)
+ delta_type_node = short_integer_type_node;
+ else
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
delta_type_node = ptrdiff_type_node;
vtable_index_type = ptrdiff_type_node;
@@ -3231,7 +3287,10 @@ builtin_function (const char* name,
{
/* All builtins that don't begin with an '_' should additionally
go in the 'std' namespace. */
- if (name[0] != '_')
+ /* APPLE LOCAL begin alloca not in std */
+ /* Don't use `std' namespace for alloca. */
+ if (name[0] != '_' && strcmp (name, "alloca"))
+ /* APPLE LOCAL end alloca not in std */
{
push_namespace (std_identifier);
builtin_function_1 (name, type, std_node, code, class, libname, attrs);
@@ -3344,6 +3403,7 @@ push_throw_library_fn (tree name, tree type)
TREE_NOTHROW (fn) = 0;
return fn;
}
+
/* When we call finish_struct for an anonymous union, we create
default copy constructors and such. But, an anonymous union
@@ -3623,6 +3683,8 @@ start_decl (tree declarator,
tree decl;
tree type, tem;
tree context;
+ /* APPLE LOCAL unavailable */
+ tree a;
/* This should only be done once on the top most decl. */
if (have_extern_spec)
@@ -3632,10 +3694,34 @@ start_decl (tree declarator,
have_extern_spec = false;
}
- /* An object declared as __attribute__((deprecated)) suppresses
- warnings of uses of other deprecated items. */
+ /* APPLE LOCAL begin unavailable */
+ /* An object declared as __attribute__((unavailable)) suppresses
+ any reports of being declared with unavailable or deprecated
+ items. An object declared as __attribute__((deprecated))
+ suppresses warnings of uses of other deprecated items. */
+#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */
if (lookup_attribute ("deprecated", attributes))
deprecated_state = DEPRECATED_SUPPRESS;
+ else if (lookup_attribute ("unavailable", attributes))
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+#else /* a more efficient way doing what lookup_attribute would do */
+ for (a = attributes; a; a = TREE_CHAIN (a))
+ {
+ tree name = TREE_PURPOSE (a);
+ if (TREE_CODE (name) == IDENTIFIER_NODE)
+ if (is_attribute_p ("deprecated", name))
+ {
+ deprecated_state = DEPRECATED_SUPPRESS;
+ break;
+ }
+ if (is_attribute_p ("unavailable", name))
+ {
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+ break;
+ }
+ }
+#endif
+ /* APPLE LOCAL end unavailable */
attributes = chainon (attributes, prefix_attributes);
@@ -4070,6 +4156,14 @@ maybe_commonize_var (tree decl)
}
else
{
+ /* APPLE LOCAL begin coalescing */
+#ifdef MAKE_DECL_COALESCED
+ if (DECL_INTERFACE_KNOWN (current_function_decl))
+ DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
+ TREE_PUBLIC (decl) = 1;
+ MAKE_DECL_COALESCED (decl);
+#else
+ /* APPLE LOCAL end coalescing */
if (DECL_INITIAL (decl) == NULL_TREE
|| DECL_INITIAL (decl) == error_mark_node)
{
@@ -4089,6 +4183,8 @@ maybe_commonize_var (tree decl)
warning ("%J you can work around this by removing the initializer",
decl);
}
+/* APPLE LOCAL coalescing */
+#endif
}
}
else if (DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
@@ -4587,6 +4683,17 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
isn't stored in the tree, yet) */
if (defer_p && asmspec)
make_decl_rtl (decl, asmspec);
+ /* APPLE LOCAL begin static const members turly 20020110 */
+ /* Static const members which require runtime initialisation should
+ not be placed in readonly memory. Avoid this by temporarily
+ whacking the TREE_READONLY bit. */
+ else if (!defer_p && init != NULL_TREE && TREE_READONLY (decl) && toplev)
+ {
+ TREE_READONLY (decl) = 0;
+ rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
+ TREE_READONLY (decl) = 1;
+ }
+ /* APPLE LOCAL end static const members turly 20020110 */
/* If we're not deferring, go ahead and assemble the variable. */
else if (!defer_p)
rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
@@ -5905,12 +6012,48 @@ build_ptrmemfunc_type (tree type)
unqualified_variant
= build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
+ if (flag_apple_kext)
+ {
+ abort ();
+#if 0
+ /* MERGE FIXME */
+ tree u = make_aggr_type (UNION_TYPE);
+ SET_IS_AGGR_TYPE (u, 0);
+ fields = build_decl (FIELD_DECL, pfn_identifier, type);
+ TREE_CHAIN (fields)
+ = build_decl (FIELD_DECL, delta2_identifier, delta_type_node);
+ finish_builtin_type (u, "__ptrmemfunc_type", fields, 1, ptr_type_node);
+ TYPE_NAME (u) = NULL_TREE;
+
+ t = make_aggr_type (RECORD_TYPE);
+
+ /* Let the front-end know this is a pointer to member function... */
+ TYPE_PTRMEMFUNC_FLAG (t) = 1;
+ /* ... and not really an aggregate. */
+ SET_IS_AGGR_TYPE (t, 0);
+
+ fields = build_decl (FIELD_DECL, delta_identifier, delta_type_node);
+ TREE_CHAIN (fields) =
+ build_decl (FIELD_DECL, index_identifier, delta_type_node);
+ TREE_CHAIN (TREE_CHAIN (fields)) =
+ build_decl (FIELD_DECL, pfn_or_delta2_identifier, u);
+ finish_builtin_type (t, "__ptrmemfunc_type", fields, 2, ptr_type_node);
+#endif
+ }
+ else
+ {
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
+
t = make_aggr_type (RECORD_TYPE);
/* Let the front-end know this is a pointer to member function... */
TYPE_PTRMEMFUNC_FLAG (t) = 1;
/* ... and not really an aggregate. */
SET_IS_AGGR_TYPE (t, 0);
+ /* APPLE LOCAL 2.95-ptmf-compatibility turly 20020313 */
+ }
+
field = build_decl (FIELD_DECL, pfn_identifier, type);
fields = field;
@@ -6707,11 +6850,38 @@ grokdeclarator (tree declarator,
/* If the entire declaration is itself tagged as deprecated then
suppress reports of deprecated items. */
+ /* APPLE LOCAL begin unavailable */
+ /* If the entire declaration is itself tagged as unavailable then
+ suppress reports of unavailable/deprecated items. If the
+ entire declaration is tagged as only deprecated we still
+ report unavailable uses. */
if (!adding_implicit_members && id && TREE_DEPRECATED (id))
{
- if (deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (id);
+ if (TREE_UNAVAILABLE (id))
+ {
+ if (deprecated_state != DEPRECATED_UNAVAILABLE_SUPPRESS)
+ warn_deprecated_use (id);
+ #if 0
+ returned_attrs
+ = chainon (returned_attrs,
+ build_tree_list (get_identifier ("unavailable"),
+ NULL_TREE));
+ #endif
+ }
+ else
+ {
+ if (deprecated_state != DEPRECATED_SUPPRESS
+ && deprecated_state != DEPRECATED_UNAVAILABLE_SUPPRESS)
+ warn_deprecated_use (id);
+ #if 0
+ returned_attrs
+ = chainon (returned_attrs,
+ build_tree_list (get_identifier ("deprecated"),
+ NULL_TREE));
+ #endif
+ }
}
+ /* APPLE LOCAL end unavailable */
if (TREE_CODE (id) == IDENTIFIER_NODE)
{
@@ -6880,6 +7050,8 @@ grokdeclarator (tree declarator,
RIDBIT_RESET (RID_LONG, specbits);
type = build_qualified_type (long_double_type_node,
cp_type_quals (type));
+ /* APPLE LOCAL -Wlong-double dpatel */
+ warn_about_long_double ();
}
/* Check all other uses of type modifiers. */
@@ -8580,7 +8752,8 @@ check_default_argument (tree decl, tree arg)
Also set last_function_parms to the chain of PARM_DECLs. */
-static tree
+/* APPLE LOCAL Objective-C++ */
+tree
grokparms (tree first_parm)
{
tree result = NULL_TREE;
@@ -9684,8 +9857,9 @@ start_enum (tree name)
/* If this is the real definition for a previous forward reference,
fill in the contents in the same object that used to be the
forward reference. */
-
- if (name != NULL_TREE)
+ /* APPLE LOCAL do not forward reference anonymous enum */
+ /* Note that an anonymous enum cannot be forward-referenced. */
+ if (name != NULL_TREE && !ANON_AGGRNAME_P (name))
enumtype = lookup_tag (ENUMERAL_TYPE, name, b, 1);
if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)
@@ -10388,6 +10562,9 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
begin_scope (sk_function_parms, decl1);
+ /* APPLE LOCAL weak_import (Radar 2809704) ilr */
+ cplus_decl_attributes (&decl1, attrs, (int)ATTR_FLAG_FUNCTION_DEF);
+
++function_depth;
if (DECL_DESTRUCTOR_P (decl1))
@@ -10409,7 +10586,8 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
Also install to binding contour return value identifier, if any. */
-static void
+/* APPLE LOCAL Objective-C++ */
+/* static */ void /* 'store_parm_decls' is extern for Obj-C++ */
store_parm_decls (tree current_function_parms)
{
tree fndecl = current_function_decl;
@@ -11099,6 +11277,26 @@ cxx_maybe_build_cleanup (tree decl)
{
int flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR;
tree rval;
+ /* APPLE LOCAL begin double destructor turly 20020214 */
+ special_function_kind dtor = sfk_complete_destructor;
+ if (flag_apple_kext
+ && has_apple_kext_compatibility_attr_p (type))
+ {
+ /* If we have a trivial operator delete (), we can go ahead and
+ just use the deleting destructor, sfk_deleting_destructor. */
+
+ if (! has_empty_operator_delete_p (type) || pedantic)
+ {
+ cp_warning_at ("'%D' is an instance of a class which does "
+ "not allow global or stack-based objects; it "
+ "does not have an empty `operator delete', and "
+ "so it will ** NOT ** be destructed.", decl);
+ return 0;
+ }
+ dtor = sfk_deleting_destructor;
+ }
+ /* APPLE LOCAL end double destructor turly 20020214 */
+
if (TREE_CODE (type) == ARRAY_TYPE)
rval = decl;
@@ -11114,7 +11312,8 @@ cxx_maybe_build_cleanup (tree decl)
flags |= LOOKUP_NONVIRTUAL;
rval = build_delete (TREE_TYPE (rval), rval,
- sfk_complete_destructor, flags, 0);
+ /* APPLE LOCAL double destructor */
+ dtor, flags, 0);
if (TYPE_USES_VIRTUAL_BASECLASSES (type)
&& ! TYPE_HAS_DESTRUCTOR (type))
@@ -11244,4 +11443,5 @@ cp_missing_noreturn_ok_p (tree decl)
}
#include "gt-cp-decl.h"
-#include "gtype-cp.h"
+/* APPLE LOCAL Objective-C++ */
+/* Move gtype-cp.h to cp-lang.c. */
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a802fd4bab1..b783ea990c6 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -968,6 +968,8 @@ grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree,
cp_finish_decl (value, init, NULL_TREE, flags);
DECL_INITIAL (value) = init;
DECL_IN_AGGR_P (value) = 1;
+ /* APPLE LOCAL Objective-C++ */
+ objc_check_decl (value);
return value;
}
if (TREE_CODE (value) == FUNCTION_DECL)
@@ -1049,6 +1051,10 @@ grokbitfield (tree declarator, tree declspecs, tree width)
}
DECL_IN_AGGR_P (value) = 1;
+
+ /* APPLE LOCAL Objective-C++ */
+ objc_check_decl (value);
+
return value;
}
@@ -1555,6 +1561,9 @@ maybe_emit_vtables (tree ctype)
{
tree vtbl;
tree primary_vtbl;
+ /* APPLE LOCAL begin coalescing radar 2997605 */
+ int coalesce_vtables;
+ /* APPLE LOCAL end coalescing radar 2997605 */
bool needed = false;
/* If the vtables for this class have already been emitted there is
@@ -1586,6 +1595,22 @@ maybe_emit_vtables (tree ctype)
else if (TREE_PUBLIC (vtbl) && !DECL_COMDAT (vtbl))
needed = true;
+ /* APPLE LOCAL begin coalescing radar 2997605 */
+ /* Check if we're going to coalesce these vtables. On other systems
+ vtables are always weak. We can't do that on OS X because
+ coalescing implies private extern, and making all vtables private
+ extern would break code that defines classes in dylibs. So
+ instead we'll only coalesce vtables that would get emitted in
+ multiple translation units: implicit class template
+ instantiations, classes with no key methods, and classes whose
+ key methods weren't inline in the class definition but turned out
+ to be inline later. */
+ if (CLASSTYPE_USE_TEMPLATE (ctype))
+ coalesce_vtables = CLASSTYPE_IMPLICIT_INSTANTIATION (ctype);
+ else
+ coalesce_vtables = !CLASSTYPE_KEY_METHOD (ctype)
+ || DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (ctype));
+ /* APPLE LOCAL end coalescing radar 2997605 */
/* The ABI requires that we emit all of the vtables if we emit any
of them. */
@@ -1636,6 +1661,13 @@ maybe_emit_vtables (tree ctype)
if (flag_weak)
comdat_linkage (vtbl);
+ /* APPLE LOCAL begin coalescing radar 2997605 */
+#ifdef MAKE_DECL_COALESCED
+ if (coalesce_vtables)
+ MAKE_DECL_COALESCED (vtbl);
+#endif /* MAKE_DECL_COALESCED */
+ /* APPLE LOCAL end coalescing radar 2997605 */
+
rest_of_decl_compilation (vtbl, NULL, 1, 1);
/* Because we're only doing syntax-checking, we'll never end up
@@ -1710,9 +1742,25 @@ import_export_decl (tree decl)
}
else
comdat_linkage (decl);
+ /* APPLE LOCAL begin coalescing */
+ /* coalesce inline member functions */
+#ifdef MAKE_DECL_COALESCED
+ if (DECL_DECLARED_INLINE_P (decl))
+ {
+ MAKE_DECL_COALESCED (decl);
+ }
+#endif /* MAKE_DECL_COALESCED */
+ /* APPLE LOCAL end coalescing */
}
+ /* APPLE LOCAL begin coalesce inline functions */
else
- comdat_linkage (decl);
+ {
+ comdat_linkage (decl);
+#ifdef MAKE_DECL_COALESCED
+ MAKE_DECL_COALESCED(decl);
+#endif /* MAKE_DECL_COALESCED */
+ }
+ /* APPLE LOCAL end coalesce inline functions */
DECL_INTERFACE_KNOWN (decl) = 1;
}
@@ -1735,7 +1783,9 @@ import_export_tinfo (tree decl, tree type, bool is_in_library)
/* If -fno-rtti, we're not necessarily emitting this stuff with
the class, so go ahead and emit it now. This can happen when
a class is used in exception handling. */
- && flag_rtti)
+ && flag_rtti
+ /* APPLE LOCAL Jaguar C++ abi compat mrs */
+ && abi_version_at_least (1))
{
DECL_NOT_REALLY_EXTERN (decl) = !CLASSTYPE_INTERFACE_ONLY (type);
DECL_COMDAT (decl) = 0;
@@ -1744,6 +1794,12 @@ import_export_tinfo (tree decl, tree type, bool is_in_library)
{
DECL_NOT_REALLY_EXTERN (decl) = 1;
DECL_COMDAT (decl) = 1;
+ /* APPLE LOCAL coalescing */
+#ifdef MAKE_DECL_COALESCED
+ TREE_PUBLIC (decl) = 1;
+ if (! is_in_library)
+ MAKE_DECL_COALESCED (decl);
+#endif /* MAKE_DECL_COALESCED */
}
/* Now override some cases. */
@@ -1814,6 +1870,11 @@ get_guard (tree decl)
if (TREE_PUBLIC (decl))
DECL_WEAK (guard) = DECL_WEAK (decl);
+ /* APPLE LOCAL coalescing */
+#ifdef MAKE_DECL_COALESCED
+ if (TREE_PUBLIC (decl) || DECL_COALESCED (decl))
+ MAKE_DECL_COALESCED (guard);
+#endif
DECL_ARTIFICIAL (guard) = 1;
TREE_USED (guard) = 1;
pushdecl_top_level_and_finish (guard, NULL_TREE);
@@ -1920,6 +1981,14 @@ start_objects (int method_type, int initp)
DECL_GLOBAL_DTOR_P (current_function_decl) = 1;
DECL_LANG_SPECIFIC (current_function_decl)->decl_flags.u2sel = 1;
+ /* APPLE LOCAL begin static structors in __StaticInit section */
+#ifdef STATIC_INIT_SECTION
+ if ( ! flag_apple_kext)
+ DECL_SECTION_NAME (current_function_decl) =
+ build_string (strlen (STATIC_INIT_SECTION), STATIC_INIT_SECTION);
+#endif
+ /* APPLE LOCAL end static structors in __StaticInit section */
+
body = begin_compound_stmt (/*has_no_scope=*/false);
/* We cannot allow these functions to be elided, even if they do not
@@ -2026,6 +2095,14 @@ start_static_storage_duration_function (unsigned count)
TREE_PUBLIC (ssdf_decl) = 0;
DECL_ARTIFICIAL (ssdf_decl) = 1;
+ /* APPLE LOCAL begin static structors in __StaticInit section */
+#ifdef STATIC_INIT_SECTION
+ if ( ! flag_apple_kext)
+ DECL_SECTION_NAME (ssdf_decl) = build_string (strlen (STATIC_INIT_SECTION),
+ STATIC_INIT_SECTION);
+#endif
+ /* APPLE LOCAL end static structors in __StaticInit section */
+
/* Put this function in the list of functions to be called from the
static constructors and destructors. */
if (!ssdf_decls)
@@ -2538,6 +2615,11 @@ finish_file (void)
if (pch_file)
c_common_write_pch ();
+ /* APPLE LOCAL Symbol Separation */
+ /* Write context information. */
+ if (dbg_dir)
+ c_common_write_context ();
+
/* Otherwise, GDB can get confused, because in only knows
about source for LINENO-1 lines. */
input_line -= 1;
@@ -2783,6 +2865,22 @@ finish_file (void)
import_export_decl (decl);
if (DECL_NOT_REALLY_EXTERN (decl) && ! DECL_IN_AGGR_P (decl))
DECL_EXTERNAL (decl) = 0;
+ /* APPLE LOCAL begin write used class statics turly 20020226 */
+#ifdef MACHOPIC_VAR_REFERRED_TO_P
+ else
+ if (TREE_USED (decl) && DECL_INITIAL (decl) != 0
+ && DECL_INITIAL (decl) != error_mark_node
+ && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR
+ && DECL_EXTERNAL (decl)
+ && MACHOPIC_VAR_REFERRED_TO_P (IDENTIFIER_POINTER (
+ DECL_ASSEMBLER_NAME (decl))))
+ {
+ /* Force a local copy of this decl to be written. */
+ DECL_EXTERNAL (decl) = 0;
+ TREE_PUBLIC (decl) = 0;
+ }
+#endif
+ /* APPLE LOCAL end write used class statics turly 20020226 */
}
if (pending_statics
&& wrapup_global_declarations (&VARRAY_TREE (pending_statics, 0),
diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
index e6c9ee6892a..a73db2a4352 100644
--- a/gcc/cp/g++spec.c
+++ b/gcc/cp/g++spec.c
@@ -46,6 +46,10 @@ Boston, MA 02111-1307, USA. */
#define LIBSTDCXX_PROFILE "-lstdc++"
#endif
+/* APPLE LOCAL begin radar 3554191 */
+extern unsigned int macosx_version_min_required; /* defined in gcc.c */
+/* APPLE LOCAL end radar 3554191 */
+
void
lang_specific_driver (int *in_argc, const char *const **in_argv,
int *in_added_libraries)
@@ -241,6 +245,13 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
shared_libgcc = 0;
#endif
+ /* APPLE LOCAL begin radar 3554191 */
+ {
+ if (macosx_version_min_required && macosx_version_min_required < 1040)
+ shared_libgcc = 0;
+ }
+ /* APPLE LOCAL end radar 3554191 */
+
/* Make sure to have room for the trailing NULL argument. */
num_args = argc + added + need_math + shared_libgcc + (library > 0) + 1;
arglist = xmalloc (num_args * sizeof (char *));
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 04e70bcc89d..f246a613eac 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2978,6 +2978,16 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
build_op_delete_call (DELETE_EXPR, addr, cxx_sizeof_nowarn (type),
/*global_p=*/false, NULL_TREE);
}
+ /* APPLE LOCAL begin double destructor matt 20020501 */
+ /* If we're compiling a class in kext compatibility mode we
+ don't have a non-deleting destructor, so we unconditionally
+ generate a reference to the deleting variety. */
+ if (flag_apple_kext && has_apple_kext_compatibility_attr_p (type))
+ {
+ my_friendly_assert (auto_delete != sfk_base_destructor, 20020501);
+ auto_delete = sfk_deleting_destructor;
+ }
+ /* APPLE LOCAL end double destructor matt 20020501 */
expr = build_dtor_call (build_indirect_ref (addr, NULL),
auto_delete, flags);
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index 5815ea57896..732ac2ed0c9 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -43,10 +43,13 @@ Boston, MA 02111-1307, USA. */
cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\
%{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
%(cc1_options) %2 %{+e1*}\
- -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+ "/* APPLE LOCAL symbol separation */" \
+ %(dbg_ss) %(pch)}}}",
CPLUSPLUS_CPP_SPEC},
{"@c++",
"%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}\
+ "/* APPLE LOCAL prohibit -arch with -E and -S */"\
+ %{E|S:%{@:%e-E and -S are not allowed with multiple -arch flags}}\
%{!E:%{!M:%{!MM:\
%{save-temps|no-integrated-cpp:cc1plus -E\
%(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 2239c76ca87..4fa16394ba5 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -239,6 +239,8 @@ struct resword
_true_. */
#define D_EXT 0x01 /* GCC extension */
#define D_ASM 0x02 /* in C99, but has a switch to turn it off */
+/* APPLE LOCAL Objective-C++ */
+#define D_OBJC 0x10 /* Objective C only */
CONSTRAINT(ridbits_fit, RID_LAST_MODIFIER < sizeof(unsigned long) * CHAR_BIT);
@@ -266,6 +268,8 @@ static const struct resword reswords[] =
{ "__inline__", RID_INLINE, 0 },
{ "__label__", RID_LABEL, 0 },
{ "__null", RID_NULL, 0 },
+ /* APPLE LOCAL private extern */
+ { "__private_extern__", RID_PRIVATE_EXTERN, 0 },
{ "__offsetof", RID_OFFSETOF, 0 },
{ "__offsetof__", RID_OFFSETOF, 0 },
{ "__real", RID_REALPART, 0 },
@@ -343,7 +347,33 @@ static const struct resword reswords[] =
{ "volatile", RID_VOLATILE, 0 },
{ "wchar_t", RID_WCHAR, 0 },
{ "while", RID_WHILE, 0 },
-
+ /* APPLE LOCAL begin Objective-C++ */
+ { "id", RID_ID, D_OBJC },
+
+ /* These objc keywords are recognized only immediately after
+ an '@'. Note that some of these overlap with existing C++ keywords. */
+/*{ "class", RID_AT_CLASS, D_OBJC }, OVERLAP */
+ { "compatibility_alias", RID_AT_ALIAS, D_OBJC },
+ { "defs", RID_AT_DEFS, D_OBJC },
+ { "encode", RID_AT_ENCODE, D_OBJC },
+ { "end", RID_AT_END, D_OBJC },
+ { "implementation", RID_AT_IMPLEMENTATION, D_OBJC },
+ { "interface", RID_AT_INTERFACE, D_OBJC },
+/*{ "private", RID_AT_PRIVATE, D_OBJC }, OVERLAP */
+/*{ "protected", RID_AT_PROTECTED, D_OBJC }, OVERLAP */
+ { "protocol", RID_AT_PROTOCOL, D_OBJC },
+/*{ "public", RID_AT_PUBLIC, D_OBJC }, OVERLAP */
+ { "selector", RID_AT_SELECTOR, D_OBJC },
+
+ /* These are recognized only in protocol-qualifier context
+ (see above) */
+ { "bycopy", RID_BYCOPY, D_OBJC },
+ { "byref", RID_BYREF, D_OBJC },
+ { "in", RID_IN, D_OBJC },
+ { "inout", RID_INOUT, D_OBJC },
+ { "oneway", RID_ONEWAY, D_OBJC },
+ { "out", RID_OUT, D_OBJC },
+ /* APPLE LOCAL end Objective-C++ */
};
void
@@ -354,6 +384,9 @@ init_reswords (void)
int mask = ((flag_no_asm ? D_ASM : 0)
| (flag_no_gnu_keywords ? D_EXT : 0));
+ /* APPLE LOCAL objc++ */
+ mask |= D_OBJC;
+
ridpointers = ggc_calloc ((int) RID_MAX, sizeof (tree));
for (i = 0; i < ARRAY_SIZE (reswords); i++)
{
@@ -363,6 +396,25 @@ init_reswords (void)
if (! (reswords[i].disable & mask))
C_IS_RESERVED_WORD (id) = 1;
}
+
+ /* APPLE LOCAL begin private extern Radar 2872481 ilr */
+ /* For C++ there is always a -D__private_extern__=extern on the
+ command line. However, if -fpreprocessed was specified then
+ macros are not expanded so the -D is meaningless. But this
+ replacement is required for C++. There for we have to "pretend"
+ that '__private_extern__' is 'extern' and we can do this simply by
+ making the rid code for '__private_extern__' be the same as for
+ extern. Note, we probably could always do this here since
+ '__private_extern__' is always to be treated like 'extern' for
+ c++. But we'll be conservative and only do it when -fpreprocessed
+ is specified and depend on the macro substitution in all other
+ cases. */
+ if (flag_preprocessed)
+ {
+ id = get_identifier ("__private_extern__");
+ C_RID_CODE (id) = RID_EXTERN;
+ }
+ /* APPLE LOCAL end private extern Radar 2872481 ilr */
}
static void
@@ -427,6 +479,14 @@ cxx_init (void)
init_repo (main_input_filename);
pop_srcloc();
+
+ /* APPLE LOCAL gdb only used symbols */
+#ifdef DBX_ONLY_USED_SYMBOLS
+ /* By default we want to use -gused for C++ and Objective-C++. */
+ if (flag_debug_only_used_symbols == -1)
+ flag_debug_only_used_symbols = 1;
+#endif
+
return true;
}
diff --git a/gcc/cp/lex.h b/gcc/cp/lex.h
index 35c3503ea41..0a9c88478d1 100644
--- a/gcc/cp/lex.h
+++ b/gcc/cp/lex.h
@@ -65,4 +65,19 @@ typedef unsigned long RID_BIT_TYPE; /* assumed at least 32 bits */
#define RIDBIT_RESET_ALL(V) do { (V) = 0; } while (0)
#endif
+/* APPLE LOCAL begin Objective-C++ */
+/* Parser/lexer state pertinent to ObjC++. */
+extern int objc_receiver_context;
+extern int objc_declarator_context;
+extern int objc_msg_context;
+extern int objc_public_flag;
+extern int objc_need_raw_identifier;
+extern int objc_pq_context;
+
+#define OBJC_NEED_RAW_IDENTIFIER(VAL) \
+ do { if (flag_objc) objc_need_raw_identifier = VAL; } \
+ while (0)
+
+/* APPLE LOCAL end Objective-C++ */
+
#endif /* ! GCC_CP_LEX_H */
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 2580d39866f..ff5cf531fb0 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -59,6 +59,8 @@
#include "toplev.h"
#include "varray.h"
#include "flags.h"
+/* APPLE LOCAL */
+#include "target.h"
/* Debugging support. */
@@ -1306,10 +1308,8 @@ write_identifier (const char *identifier)
::= C3 # complete object allocating constructor
Currently, allocating constructors are never used.
-
- We also need to provide mangled names for the maybe-in-charge
- constructor, so we treat it here too. mangle_decl_string will
- append *INTERNAL* to that, to make sure we never emit it. */
+ APPLE LOCAL decloning
+*/
static void
write_special_name_constructor (const tree ctor)
@@ -1322,6 +1322,11 @@ write_special_name_constructor (const tree ctor)
write_string ("C1");
else if (DECL_BASE_CONSTRUCTOR_P (ctor))
write_string ("C2");
+ /* APPLE LOCAL begin decloning */
+ /* This is the old-style "[unified]" constructor. */
+ else if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (ctor))
+ write_string ("C4");
+ /* APPLE LOCAL end decloning */
else
abort ();
}
@@ -1350,6 +1355,11 @@ write_special_name_destructor (const tree dtor)
write_string ("D1");
else if (DECL_BASE_DESTRUCTOR_P (dtor))
write_string ("D2");
+ /* APPLE LOCAL begin decloning */
+ else if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (dtor))
+ /* This is the old-style "[unified]" destructor. */
+ write_string ("D4");
+ /* APPLE LOCAL end decloning */
else
abort ();
}
@@ -1501,12 +1511,24 @@ write_type (tree type)
case BOOLEAN_TYPE:
case INTEGER_TYPE: /* Includes wchar_t. */
case REAL_TYPE:
+ {
+ /* Handle any target-specific fundamental types. */
+ const char *target_mangling
+ = targetm.mangle_fundamental_type (type);
+
+ if (target_mangling)
+ {
+ write_string (target_mangling);
+ return;
+ }
+
/* If this is a typedef, TYPE may not be one of
the standard builtin type nodes, but an alias of one. Use
TYPE_MAIN_VARIANT to get to the underlying builtin type. */
write_builtin_type (TYPE_MAIN_VARIANT (type));
++is_builtin_type;
break;
+ }
case COMPLEX_TYPE:
write_char ('C');
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index bb34d822157..1d61c165546 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -397,6 +397,14 @@ use_thunk (tree thunk_fndecl, bool emit_p)
return;
}
+ /* APPLE LOCAL begin coalescing */
+ /* coalesce thunks */
+#if defined(COALESCE_STATIC_THUNK)
+ if (DECL_VISIBILITY (function) == VISIBILITY_HIDDEN || !TREE_PUBLIC (function) || DECL_INLINE (function))
+ COALESCE_STATIC_THUNK (thunk_fndecl, /* public*/ 0);
+#endif /* COALESCE_STATIC_THUNK */
+ /* APPLE LOCAL end coalescing */
+
push_to_top_level ();
#ifdef ASM_OUTPUT_DEF
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 1be4d8afdcc..a327f847a51 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -46,6 +46,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static tree calls_setjmp_r (tree *, int *, void *);
static void update_cloned_parm (tree, tree);
+/* APPLE LOCAL begin structor thunks */
+static int maybe_alias_body (tree fn, tree clone);
+static int maybe_thunk_body (tree fn);
+/* APPLE LOCAL end structor thunks */
/* Called from calls_setjmp_p via walk_tree. */
@@ -96,6 +100,165 @@ update_cloned_parm (tree parm, tree cloned_parm)
DECL_SOURCE_LOCATION (cloned_parm) = DECL_SOURCE_LOCATION (parm);
}
+/* APPLE LOCAL begin structor thunks */
+/* FN is a constructor or destructor, and there are FUNCTION_DECLs cloned from it nearby.
+ If the clone and the original funciton have identical parameter lists,
+ it is a fully-degenerate (does absolutely nothing) thunk.
+ Make the clone an alias for the original function label. */
+static int
+maybe_alias_body (tree fn ATTRIBUTE_UNUSED, tree clone ATTRIBUTE_UNUSED)
+{
+ extern FILE *asm_out_file ATTRIBUTE_UNUSED;
+
+#ifdef ASM_MAYBE_ALIAS_BODY
+ ASM_MAYBE_ALIAS_BODY (asm_out_file, fn, clone);
+#endif
+ return 0;
+}
+
+/* FN is a constructor or destructor, and there are FUNCTION_DECLs
+ cloned from it nearby. Instead of cloning this body, leave it
+ alone and create tiny one-call bodies for the cloned
+ FUNCTION_DECLs. These clones are sibcall candidates, and their
+ resulting code will be very thunk-esque. */
+static int
+maybe_thunk_body (tree fn)
+{
+ tree call, clone, expr_stmt, fn_parm, fn_parm_typelist, last_arg, start;
+ int parmno, vtt_parmno;
+
+ if (flag_apple_kext || flag_clone_structors)
+ return 0;
+
+ /* If we've already seen this structor, avoid re-processing it. */
+ if (TREE_ASM_WRITTEN (fn))
+ return 1;
+
+ /* If function accepts variable arguments, give up. */
+ last_arg = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fn)));
+ if ( ! VOID_TYPE_P (TREE_VALUE (last_arg)))
+ return 0;
+
+ /* If constructor expects vector (AltiVec) arguments, give up. */
+ for (fn_parm = DECL_ARGUMENTS( fn); fn_parm; fn_parm = TREE_CHAIN (fn_parm))
+ if (TREE_CODE (fn_parm) == VECTOR_TYPE)
+ return 0;
+
+ /* If we don't see a clone, nothing to do. */
+ clone = TREE_CHAIN (fn);
+ if (!clone || ! DECL_CLONED_FUNCTION_P (clone))
+ return 0;
+
+ /* This is only a win if there are two or more clones. */
+ if ( ! TREE_CHAIN (clone))
+ return 0;
+
+ /* Only thunk-ify non-trivial structors. */
+ if (DECL_ESTIMATED_INSNS (fn) < 5)
+ return 0;
+
+ /* If we got this far, we've decided to turn the clones into thunks. */
+
+ /* We're going to generate code for fn, so it is no longer "abstract." */
+ /* APPLE LOCAL begin 3271957 and 3262497 */
+ /* Leave 'abstract' bit set for unified constructs and destructors when
+ -gused is used. */
+ if (!(flag_debug_only_used_symbols
+ && DECL_DESTRUCTOR_P (fn)
+ && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
+ && !(flag_debug_only_used_symbols
+ && DECL_CONSTRUCTOR_P (fn)
+ && DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn))
+ )
+ DECL_ABSTRACT (fn) = 0;
+ /* APPLE LOCAL end 3271957 and 3262497 */
+
+ /* Find the vtt_parm, if present. */
+ for (vtt_parmno = -1, parmno = 0, fn_parm = DECL_ARGUMENTS (fn);
+ fn_parm;
+ ++parmno, fn_parm = TREE_CHAIN (fn_parm))
+ {
+ if (DECL_ARTIFICIAL (fn_parm) && DECL_NAME (fn_parm) == vtt_parm_identifier)
+ {
+ vtt_parmno = parmno; /* Compensate for removed in_charge parameter. */
+ break;
+ }
+ }
+
+ /* We know that any clones immediately follow FN in the TYPE_METHODS
+ list. */
+ for (clone = start = TREE_CHAIN (fn);
+ clone && DECL_CLONED_FUNCTION_P (clone);
+ clone = TREE_CHAIN (clone))
+ {
+ tree clone_parm, parmlist;
+
+ /* If the clone and original parmlists are identical, turn the clone into an alias. */
+ if (maybe_alias_body (fn, clone))
+ continue;
+
+ /* If we've already generated a body for this clone, avoid duplicating it.
+ (Is it possible for a clone-list to grow after we first see it?) */
+ if (DECL_SAVED_TREE (clone) || TREE_ASM_WRITTEN (clone))
+ continue;
+
+ /* Start processing the function. */
+ push_to_top_level ();
+ start_function (NULL_TREE, clone, NULL_TREE, SF_PRE_PARSED);
+
+ /* Walk parameter lists together, creating parameter list for call to original function. */
+ for (parmno = 0,
+ parmlist = NULL,
+ fn_parm = DECL_ARGUMENTS (fn),
+ fn_parm_typelist = TYPE_ARG_TYPES (TREE_TYPE (fn)),
+ clone_parm = DECL_ARGUMENTS (clone);
+ fn_parm;
+ ++parmno,
+ fn_parm = TREE_CHAIN (fn_parm))
+ {
+ if (parmno == vtt_parmno && ! DECL_HAS_VTT_PARM_P (clone))
+ {
+ tree typed_null_pointer_node = copy_node (null_pointer_node);
+ my_friendly_assert (fn_parm_typelist, 0);
+ /* Clobber actual parameter with formal parameter type. */
+ TREE_TYPE (typed_null_pointer_node) = TREE_VALUE (fn_parm_typelist);
+ parmlist = tree_cons (NULL, typed_null_pointer_node, parmlist);
+ }
+ else if (parmno == 1 && DECL_HAS_IN_CHARGE_PARM_P (fn))
+ {
+ tree in_charge = copy_node (in_charge_arg_for_name (DECL_NAME (clone)));
+ parmlist = tree_cons (NULL, in_charge, parmlist);
+ }
+ /* Map other parameters to their equivalents in the cloned
+ function. */
+ else
+ {
+ my_friendly_assert (clone_parm, 0);
+ DECL_ABSTRACT_ORIGIN (clone_parm) = NULL;
+ parmlist = tree_cons (NULL, clone_parm, parmlist);
+ clone_parm = TREE_CHAIN (clone_parm);
+ }
+ if (fn_parm_typelist)
+ fn_parm_typelist = TREE_CHAIN (fn_parm_typelist);
+ }
+
+ /* We built this list backwards; fix now. */
+ parmlist = nreverse (parmlist);
+ mark_used (fn);
+ call = build_function_call (fn, parmlist);
+ expr_stmt = build_stmt (EXPR_STMT, call);
+ add_stmt (expr_stmt);
+
+ /* Now, expand this function into RTL, if appropriate. */
+ finish_function (0);
+ DECL_ABSTRACT_ORIGIN (clone) = NULL;
+ expand_body (clone);
+ pop_from_top_level ();
+ }
+ return 1;
+}
+/* APPLE LOCAL end structor thunks */
+
/* FN is a function that has a complete body. Clone the body as
necessary. Returns nonzero if there's no longer any need to
process the main body. */
@@ -121,8 +284,7 @@ maybe_clone_body (tree fn)
{
tree parm;
tree clone_parm;
- int parmno;
- splay_tree decl_map;
+ /* APPLE LOCAL structor thunks */
/* Update CLONE's source position information to match FN's. */
DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
@@ -138,6 +300,8 @@ maybe_clone_body (tree fn)
DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn);
TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
+ /* APPLE LOCAL coalescing */
+ DECL_COALESCED (clone) = DECL_COALESCED (fn);
/* Adjust the parameter names and locations. */
parm = DECL_ARGUMENTS (fn);
@@ -156,6 +320,28 @@ maybe_clone_body (tree fn)
parm = TREE_CHAIN (parm), clone_parm = TREE_CHAIN (clone_parm))
/* Update this parameter. */
update_cloned_parm (parm, clone_parm);
+ /* APPLE LOCAL structor thunks */
+ }
+
+ /* APPLE LOCAL begin structor thunks */
+ /* If we decide to turn clones into thunks, they will branch to fn.
+ Must have original function available to call. */
+ if (maybe_thunk_body (fn))
+ return 0;
+ /* APPLE LOCAL end structor thunks */
+
+ /* APPLE LOCAL begin structor thunks */
+ /* We know that any clones immediately follow FN in the TYPE_METHODS
+ list. */
+ for (clone = TREE_CHAIN (fn);
+ clone && DECL_CLONED_FUNCTION_P (clone);
+ clone = TREE_CHAIN (clone))
+ {
+ tree parm;
+ tree clone_parm;
+ int parmno;
+ splay_tree decl_map;
+ /* APPLE LOCAL end structor thunks */
/* Start processing the function. */
push_to_top_level ();
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 8a51a247289..826edc3f4d6 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11121,6 +11121,12 @@ instantiate_decl (tree d, int defer_ok)
/* Regenerate the declaration in case the template has been modified
by a subsequent redeclaration. */
regenerate_decl_from_template (d, td);
+
+ /* APPLE LOCAL begin coalescing */
+#ifdef MARK_TEMPLATE_COALESCED
+ MARK_TEMPLATE_COALESCED (d);
+#endif
+ /* APPLE LOCAL end coalescing */
/* We already set the file and line above. Reset them now in case
they changed as a result of calling regenerate_decl_from_template. */
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index a2750b220c2..133ebe4fd36 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -760,6 +760,15 @@ tinfo_base_init (tree desc, tree target)
TREE_STATIC (name_decl) = 1;
DECL_EXTERNAL (name_decl) = 0;
TREE_PUBLIC (name_decl) = 1;
+ comdat_linkage (name_decl);
+ /* APPLE LOCAL begin coalescing */
+ /* coalesce typeinfo */
+#ifdef MAKE_DECL_COALESCED
+ if (!typeinfo_in_lib_p (target))
+ MAKE_DECL_COALESCED (name_decl);
+#endif /* MAKE_DECL_COALESCED */
+ /* APPLE LOCAL end coalescing */
+
import_export_tinfo (name_decl, target, typeinfo_in_lib_p (target));
/* External name of the string containing the type's name has a
special name. */
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 2c232f389cb..126b8d20de3 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -35,6 +35,16 @@ Boston, MA 02111-1307, USA. */
#include "tree-inline.h"
#include "target.h"
+/* APPLE LOCAL begin new tree dump */
+#ifdef ENABLE_DMP_TREE
+#include "dmp-tree.h"
+extern int cp_dump_tree_p PARAMS ((FILE *, const char *, tree, int));
+extern lang_dump_tree_p_t cp_prev_lang_dump_tree_p;
+extern int c_dump_tree_p PARAMS ((FILE *, const char *, tree, int));
+extern lang_dump_tree_p_t c_prev_lang_dump_tree_p;
+#endif
+/* APPLE LOCAL end new tree dump */
+
static tree bot_manip (tree *, int *, void *);
static tree bot_replace (tree *, int *, void *);
static tree build_cplus_array_type_1 (tree, tree);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 40988c7c807..ac64d68a18e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1058,6 +1058,17 @@ comptypes (tree t1, tree t2, int strict)
case COMPLEX_TYPE:
return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2));
+ case VECTOR_TYPE:
+ /* This is a comparison of types. If both of them are opaque,
+ the types are identical as long as their size is equal; else
+ check if the underlying types are identical as well. */
+ return TYPE_VECTOR_SUBPARTS (t1) == TYPE_VECTOR_SUBPARTS (t2)
+ && (targetm.vector_opaque_p (t1)
+ ? targetm.vector_opaque_p (t2)
+ : !targetm.vector_opaque_p (t2)
+ && same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)));
+ break;
+
default:
break;
}
@@ -1996,6 +2007,8 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
routine directly because it expects the object to be of class
type. */
ptrmem_type = TREE_TYPE (ptrmem);
+ /* APPLE LOCAL 2.95-ptmf-compatibility */
+ if (!flag_apple_kext)
my_friendly_assert (TYPE_PTRMEMFUNC_P (ptrmem_type), 20020804);
member = lookup_member (ptrmem_type, member_name, /*protect=*/0,
/*want_type=*/false);
@@ -2278,7 +2291,10 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function)))
{
- tree idx, delta, e1, e2, e3, vtbl, basetype;
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility */
+ tree idx, delta, e1, e2, e3, vtbl = vtbl, basetype;
+ /* APPLE LOCAL 2.95-ptmf-compatibility turly 20020314 */
+ tree delta2 = delta2;
tree fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function));
tree instance_ptr = *instance_ptrptr;
@@ -2310,6 +2326,17 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
/* Start by extracting all the information from the PMF itself. */
e3 = PFN_FROM_PTRMEMFUNC (function);
delta = build_ptrmemfunc_access_expr (function, delta_identifier);
+
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020314 */
+ if (flag_apple_kext)
+ {
+ idx = build_ptrmemfunc_access_expr (function, index_identifier);
+ idx = save_expr (default_conversion (idx));
+ e1 = cp_build_binary_op (GE_EXPR, idx, integer_zero_node);
+ }
+ else
+ {
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
idx = build1 (NOP_EXPR, vtable_index_type, e3);
switch (TARGET_PTRMEMFUNC_VBIT_LOCATION)
{
@@ -2327,6 +2354,19 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
abort ();
}
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020314 */
+ }
+ /* DELTA2 is the amount by which to adjust the `this' pointer
+ to find the vtbl. */
+ if (flag_apple_kext)
+ {
+ delta2 = build_ptrmemfunc_access_expr (function,
+ pfn_or_delta2_identifier);
+ delta2 = build_ptrmemfunc_access_expr (delta2,
+ delta2_identifier);
+ }
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
+
/* Convert down to the right base before using the instance. First
use the type... */
basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (fntype));
@@ -2335,6 +2375,14 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
instance_ptr = build_base_path (PLUS_EXPR, instance_ptr, basetype, 1);
if (instance_ptr == error_mark_node)
return error_mark_node;
+
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility */
+ if (flag_apple_kext)
+ /* Next extract the vtable pointer from the object. */
+ vtbl = build (PLUS_EXPR,build_pointer_type (vtbl_ptr_type_node),
+ instance_ptr, cp_convert (ptrdiff_type_node, delta2));
+ /* APPLE LOCAL end 2.95-ptmf-compatibility */
+
/* ...and then the delta in the PMF. */
instance_ptr = build (PLUS_EXPR, TREE_TYPE (instance_ptr),
instance_ptr, delta);
@@ -2342,11 +2390,28 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
/* Hand back the adjusted 'this' argument to our caller. */
*instance_ptrptr = instance_ptr;
+ /* APPLE LOCAL 2.95-ptmf-compatibility */
+ if (!flag_apple_kext)
/* Next extract the vtable pointer from the object. */
vtbl = build1 (NOP_EXPR, build_pointer_type (vtbl_ptr_type_node),
instance_ptr);
vtbl = build_indirect_ref (vtbl, NULL);
+ /* APPLE LOCAL double destructor turly 20020301 */
+#ifdef ADJUST_VTABLE_INDEX
+ /* vptr hack already compensated for! */
+ if (0) ADJUST_VTABLE_INDEX (idx, vtbl);
+#endif
+
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020314 */
+ /* 2.95-style indices are off by one. */
+ if (flag_apple_kext)
+ {
+ idx = cp_build_binary_op (MINUS_EXPR, idx, integer_one_node);
+ idx = cp_build_binary_op (LSHIFT_EXPR, idx, integer_two_node);
+ }
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
+
/* Finally, extract the function pointer from the vtable. */
e2 = fold (build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx));
e2 = build_indirect_ref (e2, NULL);
@@ -3011,6 +3076,13 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
}
else if (TYPE_PTRMEMFUNC_P (type0) && null_ptr_cst_p (op1))
{
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020314 */
+ /* Shouldn't we use INDEX here rather than PFN? This seems to
+ work fine, though... */
+ if (flag_apple_kext)
+ op0 = build_ptrmemfunc_access_expr (op0, index_identifier);
+ else
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
op0 = build_ptrmemfunc_access_expr (op0, pfn_identifier);
op1 = cp_convert (TREE_TYPE (op0), integer_zero_node);
result_type = TREE_TYPE (op0);
@@ -4364,8 +4436,12 @@ tree
build_compound_expr (tree lhs, tree rhs)
{
lhs = decl_constant_value (lhs);
- lhs = convert_to_void (lhs, "left-hand operand of comma");
-
+ /* APPLE LOCAL begin AltiVec */
+ lhs = convert_to_void (lhs, targetm.cast_expr_as_vector_init
+ ? NULL
+ : "left-hand operand of comma");
+ /* APPLE LOCAL end AltiVec */
+
if (lhs == error_mark_node || rhs == error_mark_node)
return error_mark_node;
@@ -4409,6 +4485,13 @@ build_static_cast (tree type, tree expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
+ /* APPLE LOCAL begin AltiVec */
+ /* If we are casting to a vector type, treat the expression as a vector
+ initializer if this target supports it. */
+ if (TREE_CODE (type) == VECTOR_TYPE && targetm.cast_expr_as_vector_init)
+ return vector_constructor_from_expr (expr, type);
+ /* APPLE LOCAL end AltiVec */
+
if (processing_template_decl)
{
expr = build_min (STATIC_CAST_EXPR, type, expr);
@@ -4598,6 +4681,13 @@ build_reinterpret_cast (tree type, tree expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
+ /* APPLE LOCAL begin AltiVec */
+ /* If we are casting to a vector type, treat the expression as a vector
+ initializer if this target supports it. */
+ if (TREE_CODE (type) == VECTOR_TYPE && targetm.cast_expr_as_vector_init)
+ return vector_constructor_from_expr (expr, type);
+ /* APPLE LOCAL end AltiVec */
+
if (processing_template_decl)
{
tree t = build_min (REINTERPRET_CAST_EXPR, type, expr);
@@ -4675,6 +4765,14 @@ build_reinterpret_cast (tree type, tree expr)
intype, type);
return error_mark_node;
}
+
+ /* APPLE LOCAL begin don't sign-extend pointers cast to integers */
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TREE_CODE (intype) == POINTER_TYPE
+ && TYPE_PRECISION (type) > TYPE_PRECISION (intype)
+ && TREE_UNSIGNED (type))
+ expr = cp_convert (c_common_type_for_size (POINTER_SIZE, 1), expr);
+ /* APPLE LOCAL end don't sign-extend pointers cast to integers */
return cp_convert (type, expr);
}
@@ -4760,6 +4858,13 @@ build_c_cast (tree type, tree expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
+ /* APPLE LOCAL begin AltiVec */
+ /* If we are casting to a vector type, treat the expression as a vector
+ initializer if this target supports it. */
+ if (TREE_CODE (type) == VECTOR_TYPE && targetm.cast_expr_as_vector_init)
+ return vector_constructor_from_expr (expr, type);
+ /* APPLE LOCAL end AltiVec */
+
if (processing_template_decl)
{
tree t = build_min (CAST_EXPR, type,
@@ -4876,6 +4981,16 @@ build_c_cast (tree type, tree expr)
value = decl_constant_value (value);
+ /* APPLE LOCAL begin don't sign-extend pointers cast to integers */
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TREE_CODE (otype) == POINTER_TYPE
+ && TYPE_PRECISION (type) > TYPE_PRECISION (otype)
+ && TREE_UNSIGNED (type))
+ value = convert_force (c_common_type_for_size (POINTER_SIZE, 1),
+ value,
+ CONV_C_CAST);
+ /* APPLE LOCAL end don't sign-extend pointers cast to integers */
+
ovalue = value;
value = convert_force (type, value, CONV_C_CAST);
@@ -5292,6 +5407,106 @@ build_ptrmemfunc1 (tree type, tree delta, tree pfn)
tree delta_field;
tree pfn_field;
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
+ if (flag_apple_kext)
+ {
+ /* Ooo-err, Missus. Cons up a 2.95-style ptmf struct given
+ gcc3-style inputs! Recall:
+
+ struct ptmf2 { struct ptmf3 {
+ short __delta; __P __pfn;
+ short __index; ptrdiff_t __delta;
+ union { }
+ __P __pfn;
+ short __delta2;
+ }
+ }
+
+ Won't this be fun. Much of this is snarfed from 2.95.
+ Note that the __delta2 val, if required, will always be __delta. */
+
+ tree subtype, pfn_or_delta2_field, idx, idx_field, delta2_field;
+ tree delta2 = integer_zero_node;
+ int ixval = 0;
+ int allconstant = 0, allsimple = 0;
+
+ delta_field = TYPE_FIELDS (type);
+ idx_field = TREE_CHAIN (delta_field);
+ pfn_or_delta2_field = TREE_CHAIN (idx_field);
+ subtype = TREE_TYPE (pfn_or_delta2_field);
+ pfn_field = TYPE_FIELDS (subtype);
+ delta2_field = TREE_CHAIN (pfn_field);
+
+ if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn)
+ {
+ /* If the low bit of PFN is set, the virtual index is PFN >> 1.
+ Else it's nonvirtual. */
+ allconstant = TREE_CONSTANT (pfn);
+ allsimple = !! initializer_constant_valid_p (pfn, TREE_TYPE (pfn));
+ if (TREE_CODE (pfn) == INTEGER_CST && (TREE_INT_CST_LOW (pfn) & 1))
+ {
+ /* It's a virtual function. PFN is the vt offset + 1. */
+
+ int vt_entry_sz = 4;
+ tree vt_entry_sz_tree = TYPE_SIZE_UNIT (vtable_entry_type);
+ if (TREE_CODE (vt_entry_sz_tree) == INTEGER_CST)
+ vt_entry_sz = TREE_INT_CST_LOW (vt_entry_sz_tree);
+
+ ixval = (TREE_INT_CST_LOW (pfn) - 1);
+ ixval /= vt_entry_sz;
+
+ /* Now add 2 for that spadgey VPTR index hack, plus one because
+ 2.95 indices are offset by 1. */
+ ixval += 2 + 1;
+
+ /* __delta2 is the same as __delta. */
+ u = tree_cons (delta2_field, delta, NULL_TREE);
+ }
+ else
+ if (TREE_CODE (pfn) == INTEGER_CST && TREE_INT_CST_LOW (pfn) == 0)
+ {
+ /* NULL pfn. Just zero out everything. */
+ ixval = 0;
+ pfn = integer_zero_node;
+ delta = integer_zero_node;
+ u = tree_cons (pfn_field, pfn, NULL_TREE);
+ }
+ else
+ {
+ ixval = -1; /* -1 ==> PFN is the pointer */
+ u = tree_cons (pfn_field, pfn, NULL_TREE);
+ }
+ }
+ else /* Low bit of DELTA is set if we're virtual. */
+ {
+ /* Don't know how to do this yet. Much like the above, probably. */
+ abort ();
+ allconstant = TREE_CONSTANT (delta);
+ allsimple = !! initializer_constant_valid_p (delta,
+ TREE_TYPE (delta));
+
+ u = tree_cons (delta2_field, delta2, NULL_TREE);
+ }
+
+ delta = convert_and_check (delta_type_node, delta);
+ idx = convert_and_check (delta_type_node, ssize_int (ixval));
+
+ allconstant = allconstant && TREE_CONSTANT (delta) && TREE_CONSTANT (idx);
+ allsimple = allsimple
+ && initializer_constant_valid_p (delta, TREE_TYPE (delta))
+ && initializer_constant_valid_p (idx, TREE_TYPE (idx));
+
+ u = build (CONSTRUCTOR, subtype, NULL_TREE, u);
+ u = tree_cons (delta_field, delta,
+ tree_cons (idx_field, idx,
+ tree_cons (pfn_or_delta2_field, u, NULL_TREE)));
+ u = build (CONSTRUCTOR, type, NULL_TREE, u);
+ TREE_CONSTANT (u) = allconstant;
+ TREE_STATIC (u) = allconstant && allsimple;
+ return u;
+ }
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
+
/* Pull the FIELD_DECLs out of the type. */
pfn_field = TYPE_FIELDS (type);
delta_field = TREE_CHAIN (pfn_field);
@@ -5475,6 +5690,22 @@ expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn)
tree
pfn_from_ptrmemfunc (tree t)
{
+ /* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
+ if (flag_apple_kext)
+ {
+ if (TREE_CODE (t) == PTRMEM_CST)
+ {
+ tree fn = PTRMEM_CST_MEMBER (t);
+ if (!DECL_VIRTUAL_P (fn))
+ return convert (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)),
+ build_addr_func (fn));
+ }
+
+ t = build_ptrmemfunc_access_expr (t, pfn_or_delta2_identifier);
+ return build_ptrmemfunc_access_expr (t, pfn_identifier);
+ }
+ /* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
+
if (TREE_CODE (t) == PTRMEM_CST)
{
tree delta;
@@ -5562,8 +5793,7 @@ convert_for_assignment (tree type, tree rhs,
coder = TREE_CODE (rhstype);
if (TREE_CODE (type) == VECTOR_TYPE && coder == VECTOR_TYPE
- && ((*targetm.vector_opaque_p) (type)
- || (*targetm.vector_opaque_p) (rhstype)))
+ && vector_types_compatible_p (type, rhstype))
return convert (type, rhs);
if (rhs == error_mark_node || rhstype == error_mark_node)
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index f0717f60884..3edf58313aa 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -555,13 +555,21 @@ digest_init (tree type, tree init, tree* tail)
if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (string)))
!= char_type_node)
+ /* APPLE LOCAL begin Pascal strings 2001-07-05 zll */
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (string)))
+ != unsigned_char_type_node)
+ /* APPLE LOCAL end Pascal strings 2001-07-05 zll */
&& TYPE_PRECISION (typ1) == BITS_PER_UNIT)
{
error ("char-array initialized from wide string");
return error_mark_node;
}
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (string)))
+ /* APPLE LOCAL begin Pascal strings 2001-07-05 zll */
+ if (((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (string)))
== char_type_node)
+ || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (string)))
+ == unsigned_char_type_node))
+ /* APPLE LOCAL end Pascal strings 2001-07-05 zll */
&& TYPE_PRECISION (typ1) != BITS_PER_UNIT)
{
error ("int-array initialized from non-wide string");
diff --git a/gcc/cppcharset.c b/gcc/cppcharset.c
index b46f47a1fe0..aa65a659628 100644
--- a/gcc/cppcharset.c
+++ b/gcc/cppcharset.c
@@ -1132,7 +1132,8 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
false for failure. */
bool
cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
- cpp_string *to, bool wide)
+ /* APPLE LOCAL pascal strings */
+ cpp_string *to, bool wide, bool pascal_p)
{
struct _cpp_strbuf tbuf;
const uchar *p, *base, *limit;
@@ -1142,7 +1143,8 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
tbuf.asize = MAX (OUTBUF_BLOCK_SIZE, from->len);
tbuf.text = xmalloc (tbuf.asize);
- tbuf.len = 0;
+ /* APPLE LOCAL pascal strings */
+ tbuf.len = (pascal_p ? 1 : 0); /* Reserve space for Pascal length byte. */
for (i = 0; i < count; i++)
{
@@ -1151,6 +1153,13 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
p++; /* Skip leading quote. */
limit = from[i].text + from[i].len - 1; /* Skip trailing quote. */
+ /* APPLE LOCAL begin pascal strings */
+ /* Handle narrow literals beginning with "\p..." specially, but only
+ if '-fpascal-strings' has been specified. */
+ if (pascal_p && p[0] == '\\' && p[1] == 'p')
+ p += 2;
+ /* APPLE LOCAL end pascal strings */
+
for (;;)
{
base = p;
@@ -1169,6 +1178,17 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
p = convert_escape (pfile, p + 1, limit, &tbuf, wide);
}
}
+
+ /* APPLE LOCAL begin pascal strings */
+ /* For Pascal strings, compute the length byte. */
+ if (pascal_p)
+ {
+ *tbuf.text = (unsigned char) (tbuf.len - 1);
+ if (tbuf.len > 256)
+ cpp_error (pfile, CPP_DL_ERROR, "Pascal string is too long");
+ }
+ /* APPLE LOCAL end pascal strings */
+
/* NUL-terminate the 'to' buffer and translate it to a cpp_string
structure. */
emit_numeric_escape (pfile, 0, &tbuf, wide);
@@ -1187,7 +1207,10 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
in a string, but do not perform character set conversion. */
bool
cpp_interpret_string_notranslate (cpp_reader *pfile, const cpp_string *from,
- size_t count, cpp_string *to, bool wide)
+ /* APPLE LOCAL begin pascal strings */
+ size_t count, cpp_string *to, bool wide,
+ bool pascal_p)
+ /* APPLE LOCAL end pascal strings */
{
struct cset_converter save_narrow_cset_desc = pfile->narrow_cset_desc;
bool retval;
@@ -1195,7 +1218,8 @@ cpp_interpret_string_notranslate (cpp_reader *pfile, const cpp_string *from,
pfile->narrow_cset_desc.func = convert_no_conversion;
pfile->narrow_cset_desc.cd = (iconv_t) -1;
- retval = cpp_interpret_string (pfile, from, count, to, wide);
+ /* APPLE LOCAL pascal strings */
+ retval = cpp_interpret_string (pfile, from, count, to, wide, pascal_p);
pfile->narrow_cset_desc = save_narrow_cset_desc;
return retval;
@@ -1243,7 +1267,10 @@ narrow_str_to_charconst (cpp_reader *pfile, cpp_string str,
cpp_error (pfile, CPP_DL_WARNING,
"character constant too long for its type");
}
- else if (i > 1 && CPP_OPTION (pfile, warn_multichar))
+ /* APPLE LOCAL begin -Wfour-char-constants */
+ else if ((i == 4 && CPP_OPTION (pfile, warn_four_char_constants))
+ || (i > 1 && i != 4 && CPP_OPTION (pfile, warn_multichar)))
+ /* APPLE LOCAL end -Wfour-char-constants */
cpp_error (pfile, CPP_DL_WARNING, "multi-character character constant");
/* Multichar constants are of type int and therefore signed. */
@@ -1339,7 +1366,8 @@ cpp_interpret_charconst (cpp_reader *pfile, const cpp_token *token,
cpp_error (pfile, CPP_DL_ERROR, "empty character constant");
return 0;
}
- else if (!cpp_interpret_string (pfile, &token->val.str, 1, &str, wide))
+ /* APPLE LOCAL pascal strings */
+ else if (!cpp_interpret_string (pfile, &token->val.str, 1, &str, wide, false))
return 0;
if (wide)
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index d57238069d6..1ceb3457c66 100644
--- a/gcc/cpperror.c
+++ b/gcc/cpperror.c
@@ -29,6 +29,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cpphash.h"
#include "intl.h"
+/* APPLE LOCAL error-colon */
+static int gcc_error_colon = 0;
static void print_location (cpp_reader *, source_location, unsigned int);
/* Print the logical file location (LINE, COL) in preparation for a
@@ -38,6 +40,23 @@ static void print_location (cpp_reader *, source_location, unsigned int);
static void
print_location (cpp_reader *pfile, source_location line, unsigned int col)
{
+ /* APPLE LOCAL begin error-colon */
+ const char *estr;
+ {
+ static int done = 0;
+ if ( ! done)
+ {
+ done = 1; /* Do this only once. */
+ /* Pretend we saw "-w" on commandline. */
+ if (getenv ("GCC_DASH_W"))
+ CPP_OPTION (pfile, inhibit_warnings) = 1; /* referenced by diagnostic.h:diagnostic_report_warnings() */
+ if (getenv ("GCC_ERROR_COLON"))
+ gcc_error_colon = 1;
+ }
+ }
+ estr = (gcc_error_colon) ? "error:" : "" ;
+ /* APPLE LOCAL end error-colon */
+
if (line == 0)
fprintf (stderr, "%s: ", progname);
else
@@ -56,12 +75,14 @@ print_location (cpp_reader *pfile, source_location line, unsigned int col)
col = 1;
}
+ /* APPLE LOCAL begin error-colon */
if (lin == 0)
- fprintf (stderr, "%s:", map->to_file);
+ fprintf (stderr, "%s:%s", map->to_file, estr);
else if (CPP_OPTION (pfile, show_column) == 0)
- fprintf (stderr, "%s:%u:", map->to_file, lin);
+ fprintf (stderr, "%s:%u:%s", map->to_file, lin, estr);
else
- fprintf (stderr, "%s:%u:%u:", map->to_file, lin, col);
+ fprintf (stderr, "%s:%u:%u:%s", map->to_file, lin, col, estr);
+ /* APPLE LOCAL end error-colon */
fputc (' ', stderr);
}
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index d31f61b7aee..ac30d095ebc 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -362,7 +362,7 @@ search_path_exhausted (cpp_reader *pfile, const char *header, _cpp_file *file)
if (func
&& file->dir == NULL)
{
- if ((file->path = func (pfile, header)) != NULL)
+ if ((file->path = func (pfile, header, &file->dir)) != NULL)
{
if (open_file (file))
return true;
@@ -1315,6 +1315,14 @@ cpp_get_path (struct _cpp_file *f)
return f->path;
}
+/* Get the directory associated with the _cpp_file F. */
+
+cpp_dir *
+cpp_get_dir (struct _cpp_file *f)
+{
+ return f->dir;
+}
+
/* Get the cpp_buffer currently associated with the cpp_reader
PFILE. */
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 4e86bf37d5b..337263f8fcc 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -153,7 +153,8 @@ extern unsigned char *_cpp_unaligned_alloc (cpp_reader *, size_t);
#define BUFF_LIMIT(BUFF) ((BUFF)->limit)
/* #include types. */
-enum include_type {IT_INCLUDE, IT_INCLUDE_NEXT, IT_IMPORT, IT_CMDLINE};
+/* APPLE LOCAL pch distcc mrs */
+enum include_type {IT_INCLUDE, IT_INCLUDE_PCH, IT_INCLUDE_NEXT, IT_IMPORT, IT_CMDLINE};
union utoken
{
@@ -328,6 +329,21 @@ struct cpp_buffer
struct cset_converter input_cset_desc;
};
+/* APPLE LOCAL begin Symbol Separation */
+/* Indicate state of context info processing.
+ Context info processing shares code with PCH, but it does not need
+ everything PCH does. Use this context info states to exclude not
+ required stuff. */
+enum cpp_cinfo_state
+ {
+ CINFO_NONE,
+ CINFO_FOUND, /* Context information found */
+ CINFO_VALID, /* Context information is valid */
+ CINFO_READ, /* Reading context information */
+ CINFO_WRITE /* Writing context information */
+ };
+/* APPLE LOCAL end Symbol Separation */
+
/* A cpp_reader encapsulates the "state" of a pre-processor run.
Applying cpp_get_token repeatedly yields a stream of pre-processor
tokens. Usually, there is only one cpp_reader object active. */
@@ -469,6 +485,12 @@ struct cpp_reader
/* Used to save the original line number during traditional
preprocessing. */
unsigned int saved_line;
+ /* APPLE LOCAL begin Symbol Separation */
+ const char *cinfo_candidate_file;
+ const char *cinfo_src_file;
+ /* State of context information read/write operation. */
+ enum cpp_cinfo_state cinfo_state;
+ /* APPLE LOCAL end Symbol Separation */
/* A saved list of the defined macros, for dependency checking
of precompiled headers. */
@@ -504,6 +526,10 @@ extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
/* Macros. */
+/* APPLE LOCAL begin warning in system headers */
+#define CPP_IN_SYSTEM_HEADER(PFILE) ((PFILE)->line_table && (PFILE)->line_table->maps && (PFILE)->line_table->maps->sysp)
+/* APPLE LOCAL end warning in system headers */
+
static inline int cpp_in_system_header (cpp_reader *);
static inline int
cpp_in_system_header (cpp_reader *pfile)
@@ -533,6 +559,10 @@ extern void _cpp_init_hashtable (cpp_reader *, hash_table *);
extern void _cpp_destroy_hashtable (cpp_reader *);
/* In cppfiles.c */
+/* APPLE LOCAL begin Symbol Separation */
+extern void find_include_cinfo (cpp_reader *, const char *);
+/* APPLE LOCAL end Symbol Separation */
+
typedef struct _cpp_file _cpp_file;
extern _cpp_file *_cpp_find_file (cpp_reader *, const char *fname,
cpp_dir *start_dir, bool fake);
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index a6da0b69b6f..564c9c09f02 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -135,6 +135,19 @@ cpp_create_reader (enum c_lang lang, hash_table *table,
pfile = xcalloc (1, sizeof (cpp_reader));
cpp_set_lang (pfile, lang);
+ /* APPLE LOCAL begin -Wextra-tokens 2001-08-01 sts */
+ /* Suppress warnings about extra tokens after #endif etc. */
+ CPP_OPTION (pfile, warn_extra_tokens) = 0;
+ /* APPLE LOCAL end -Wextra-tokens 2001-08-01 sts */
+ /* APPLE LOCAL begin -Wnewline-eof 2001-08-23 sts */
+ /* Suppress warnings about missing newlines at ends of files. */
+ CPP_OPTION (pfile, warn_newline_at_eof) = 0;
+ /* APPLE LOCAL end -Wnewline-eof 2001-08-23 sts */
+ /* APPLE LOCAL begin -Wfour-char-constants */
+ CPP_OPTION (pfile, warn_four_char_constants) = 1;
+ /* APPLE LOCAL end -Wfour-char-constants */
+ /* APPLE LOCAL pascal strings */
+ CPP_OPTION (pfile, pascal_strings) = 0;
CPP_OPTION (pfile, warn_multichar) = 1;
CPP_OPTION (pfile, discard_comments) = 1;
CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1;
@@ -142,8 +155,11 @@ cpp_create_reader (enum c_lang lang, hash_table *table,
CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, operator_names) = 1;
CPP_OPTION (pfile, warn_trigraphs) = 2;
- CPP_OPTION (pfile, warn_endif_labels) = 1;
- CPP_OPTION (pfile, warn_deprecated) = 1;
+ /* APPLE LOCAL begin -Wextra-tokens */
+ /* Suppress warnings about extra tokens after #endif etc. */
+ CPP_OPTION (pfile, warn_endif_labels) = 0;
+ /* APPLE LOCAL suppress useful warnings */
+ CPP_OPTION (pfile, warn_deprecated) = 0;
CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99);
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, warn_dollars) = 1;
@@ -473,6 +489,13 @@ cpp_read_main_file (cpp_reader *pfile, const char *fname)
if (_cpp_find_failed (pfile->main_file))
return false;
+ /* APPLE LOCAL begin Symbol Separation */
+ /* If creating PCH file then main input file is a header and it is a candidate
+ for separate symbol repository. Find one if available. */
+ if (CPP_OPTION (pfile, making_pch) && CPP_OPTION (pfile, use_ss))
+ find_include_cinfo (pfile, fname);
+ /* APPLE LOCAL end Symbol Separation */
+
_cpp_stack_file (pfile, pfile->main_file, false);
/* For foo.i, read the original filename foo.c now, for the benefit
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index f2556b385a0..a5a5a451118 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -71,12 +71,20 @@ struct pragma_entry
means this directive should be handled even if -fpreprocessed is in
effect (these are the directives with callback hooks).
+ APPLE LOCAL BEGIN pch distcc mrs
+ IN_I_PCH means that this directive should be handled even if
+ -fpreprocessed is in effect as long as pch_preprocess is also in
+ effect.
+ APPLE LOCAL BEGIN pch distcc mrs
+
EXPAND is set on directives that are always macro-expanded. */
#define COND (1 << 0)
#define IF_COND (1 << 1)
#define INCL (1 << 2)
#define IN_I (1 << 3)
#define EXPAND (1 << 4)
+/* APPLE LOCAL pch distcc mrs */
+#define IN_I_PCH (1 << 5)
/* Defines one #-directive, including how to handle it. */
typedef void (*directive_handler) (cpp_reader *);
@@ -143,6 +151,8 @@ static void handle_assertion (cpp_reader *, const char *, int);
#define DIRECTIVE_TABLE \
D(define, T_DEFINE = 0, KANDR, IN_I) /* 270554 */ \
D(include, T_INCLUDE, KANDR, INCL | EXPAND) /* 52262 */ \
+/* APPLE LOCAL pch distcc mrs */ \
+D(include_pch, T_INCLUDE_PCH, KANDR, INCL | IN_I_PCH) \
D(endif, T_ENDIF, KANDR, COND) /* 45855 */ \
D(ifdef, T_IFDEF, KANDR, COND | IF_COND) /* 22000 */ \
D(if, T_IF, KANDR, COND | IF_COND | EXPAND) /* 18162 */ \
@@ -214,7 +224,9 @@ skip_rest_of_line (cpp_reader *pfile)
static void
check_eol (cpp_reader *pfile)
{
- if (! SEEN_EOL () && _cpp_lex_token (pfile)->type != CPP_EOF)
+ /* APPLE LOCAL -Wextra-tokens 2001-08-02 sts */
+ if (! SEEN_EOL () && _cpp_lex_token (pfile)->type != CPP_EOF
+ && CPP_OPTION (pfile, warn_extra_tokens))
cpp_error (pfile, CPP_DL_PEDWARN, "extra tokens at end of #%s directive",
pfile->directive->name);
}
@@ -382,7 +394,11 @@ _cpp_handle_directive (cpp_reader *pfile, int indented)
-fpreprocessed mode only if the # is in column 1. cppmacro.c
puts a space in front of any '#' at the start of a macro. */
if (CPP_OPTION (pfile, preprocessed)
- && (indented || !(dir->flags & IN_I)))
+ /* APPLE LOCAL BEGIN pch distcc mrs */
+ && (indented || !(dir->flags & IN_I))
+ && ! (CPP_OPTION (pfile, pch_preprocess)
+ && (dir->flags & IN_I_PCH)))
+ /* APPLE LOCAL END pch distcc mrs */
{
skip = 0;
dir = 0;
@@ -704,6 +720,14 @@ do_include (cpp_reader *pfile)
do_include_common (pfile, IT_INCLUDE);
}
+/* APPLE LOCAL pch distcc mrs */
+static void
+do_include_pch (cpp_reader *pfile)
+{
+ do_include_common (pfile, IT_INCLUDE_PCH);
+}
+/* APPLE LOCAL pch distcc mrs */
+
static void
do_import (cpp_reader *pfile)
{
@@ -805,7 +829,8 @@ do_line (cpp_reader *pfile)
{
cpp_string s = { 0, 0 };
if (cpp_interpret_string_notranslate (pfile, &token->val.str, 1,
- &s, false))
+ /* APPLE LOCAL pascal strings */
+ &s, false, false))
new_file = (const char *)s.text;
check_eol (pfile);
}
@@ -857,7 +882,8 @@ do_linemarker (cpp_reader *pfile)
{
cpp_string s = { 0, 0 };
if (cpp_interpret_string_notranslate (pfile, &token->val.str,
- 1, &s, false))
+ /* APPLE LOCAL pascal strings */
+ 1, &s, false, false))
new_file = (const char *)s.text;
new_sysp = 0;
@@ -941,7 +967,14 @@ static void
do_warning (cpp_reader *pfile)
{
/* We want #warning diagnostics to be emitted in system headers too. */
- do_diagnostic (pfile, CPP_DL_WARNING_SYSHDR, 1);
+ /* APPLE LOCAL begin handle -Wno-system-headers (2910306) ilr */
+ /* Unless explicitly suppressed with -Wno-system-headers or
+ -Wno-#warning. */
+ if (!CPP_OPTION (pfile, no_pound_warnings)
+ && (!CPP_IN_SYSTEM_HEADER (pfile)
+ || CPP_OPTION (pfile, warn_system_headers)))
+ do_diagnostic (pfile, CPP_DL_WARNING_SYSHDR, 1);
+ /* APPLE LOCAL end handle -Wno-system-headers (2910306) ilr */
}
/* Report program identification. */
@@ -1473,7 +1506,9 @@ do_else (cpp_reader *pfile)
ifs->mi_cmacro = 0;
/* Only check EOL if was not originally skipping. */
- if (!ifs->was_skipping && CPP_OPTION (pfile, warn_endif_labels))
+ /* APPLE LOCAL -Wextra-tokens */
+ if (!ifs->was_skipping
+ && (CPP_OPTION (pfile, warn_endif_labels) || CPP_OPTION (pfile, warn_extra_tokens)))
check_eol (pfile);
}
}
@@ -1526,7 +1561,9 @@ do_endif (cpp_reader *pfile)
else
{
/* Only check EOL if was not originally skipping. */
- if (!ifs->was_skipping && CPP_OPTION (pfile, warn_endif_labels))
+ /* APPLE LOCAL -Wextra-tokens */
+ if (!ifs->was_skipping
+ && (CPP_OPTION (pfile, warn_endif_labels) || CPP_OPTION (pfile, warn_extra_tokens)))
check_eol (pfile);
/* If potential control macro, we go back outside again. */
@@ -1902,6 +1939,14 @@ cpp_get_options (cpp_reader *pfile)
return &pfile->opts;
}
+/* APPLE LOCAL begin read-from-stdin */
+void
+set_stdin_option (cpp_reader *pfile, const char *arg)
+{
+ CPP_OPTION (pfile, stdin_diag_filename) = arg;
+}
+/* APPLE LOCAL end read-from-stdin */
+
/* The callbacks structure. */
cpp_callbacks *
cpp_get_callbacks (cpp_reader *pfile)
@@ -1971,6 +2016,19 @@ _cpp_pop_buffer (cpp_reader *pfile)
_cpp_pop_file_buffer (pfile, inc);
_cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
+
+ /* APPLE LOCAL begin Symbol Separation */
+#if 0
+ /* MERGE FIXME inc is not what it used to be */
+ if (suppress_dbg_info (inc))
+ {
+ /* We are not using symbol repository anymore. */
+ pfile->cinfo_state = CINFO_NONE;
+ if (pfile->cb.restore_write_symbols)
+ pfile->cb.restore_write_symbols ();
+ }
+#endif
+ /* APPLE LOCAL end Symbol Separation */
}
}
@@ -1988,3 +2046,29 @@ _cpp_init_directives (cpp_reader *pfile)
node->directive_index = i;
}
}
+
+/* APPLE LOCAL begin Symbol Separation */
+/* MERGE FIXME: These are stub routines. */
+void find_include_cinfo (cpp_reader *pfile ATTRIBUTE_UNUSED,
+ const char *in_name ATTRIBUTE_UNUSED)
+{
+}
+
+const char *
+cpp_symbol_separation_init (struct cpp_reader *pfile ATTRIBUTE_UNUSED,
+ const char * dbg_dir ATTRIBUTE_UNUSED,
+ const char * main_input_filename ATTRIBUTE_UNUSED)
+{
+ return dbg_dir;
+}
+
+void cpp_write_symbol_deps (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+}
+
+unsigned long
+cpp_get_stabs_checksum (void)
+{
+ return 0;
+}
+/* APPLE LOCAL end symbol separation */
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index c53375d4138..9369befb66c 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -134,6 +134,8 @@ struct _cpp_file;
TK(CPP_STRING, SPELL_LITERAL) /* "string" */ \
TK(CPP_WSTRING, SPELL_LITERAL) /* L"string" */ \
TK(CPP_OBJC_STRING, SPELL_LITERAL) /* @"string" - Objective-C */ \
+ /* APPLE LOCAL pascal strings */ \
+ TK(CPP_PASCAL_STRING, SPELL_LITERAL) /* Pascal ("\p...") string */ \
TK(CPP_HEADER_NAME, SPELL_LITERAL) /* <stdio.h> in #include */ \
\
TK(CPP_COMMENT, SPELL_LITERAL) /* Only if output comments. */ \
@@ -213,6 +215,18 @@ struct cpp_options
/* Characters between tab stops. */
unsigned int tabstop;
+ /* APPLE LOCAL begin -header-mapfile */
+ /* The central header translation mapfile, set by the '-header-mapfile'
+ option, or NULL if none. */
+ struct hmap_header_map *header_map;
+ struct search_path *hmap_path;
+ /* APPLE LOCAL end -header-mapfile */
+
+ /* APPLE LOCAL begin read-from-stdin */
+ /* function name that should be used in issung diagnostics when input is read from stdin */
+ const char *stdin_diag_filename;
+ /* APPLE LOCAL end read-from-stdin */
+
/* The language we're preprocessing. */
enum c_lang lang;
@@ -267,6 +281,27 @@ struct cpp_options
/* Nonzero means warn if there are any trigraphs. */
unsigned char warn_trigraphs;
+ /* APPLE LOCAL begin -Wextra-tokens 2001-08-02 sts */
+ /* Nonzero means warn if extra tokens at end of directives. */
+ unsigned char warn_extra_tokens;
+ /* APPLE LOCAL end -Wextra-tokens 2001-08-02 sts */
+ /* APPLE LOCAL begin -Wnewline-eof 2001-08-23 sts */
+ /* Nonzero means warn if no newline at end of file. */
+ unsigned char warn_newline_at_eof;
+ /* APPLE LOCAL end -Wnewline-eof 2001-08-23 sts */
+ /* APPLE LOCAL begin -Wfour-char-constants */
+ /* Warn about four-char literals (e.g., MacOS-style OSTypes: 'APPL'). */
+ unsigned char warn_four_char_constants;
+ /* APPLE LOCAL end -Wfour-char-constants */
+
+ /* APPLE LOCAL begin pascal strings */
+ /* Nonzero means allow "\p...." Pascal string literals, where '\p'
+ is replaced with the length of the remaining string (excluding the
+ terminating NUL). Pascal string literals have type
+ 'const unsigned char *'. */
+ unsigned char pascal_strings;
+ /* APPLE LOCAL end pascal strings */
+
/* Nonzero means warn about multicharacter charconsts. */
unsigned char warn_multichar;
@@ -327,6 +362,10 @@ struct cpp_options
/* Nonzero means handle C++ alternate operator names. */
unsigned char operator_names;
+ /* APPLE LOCAL -Wno-#warnings */
+ /* Nonzero means suppress all #warning messages. (Radar 2796309) */
+ int no_pound_warnings;
+
/* True for traditional preprocessing. */
unsigned char traditional;
@@ -345,6 +384,20 @@ struct cpp_options
/* True if dependencies should be restored from a precompiled header. */
bool restore_pch_deps;
+ /* APPLE LOCAL begin Symbol Separation */
+ unsigned char making_pch;
+ unsigned char making_ss;
+ /* True to warn about symbol repositories we couldn't use. */
+ bool warn_invalid_sr;
+ bool use_ss;
+ /* APPLE LOCAL end Symbol Separation */
+
+ /* APPLE LOCAL BEGIN pch distcc mrs */
+ /* True if PCH should omit from the -E output all lines from PCH files
+ found in PCH files. */
+ unsigned char pch_preprocess;
+ /* APPLE LOCAL END pch distcc mrs */
+
/* Dependency generation. */
struct
{
@@ -385,7 +438,7 @@ struct cpp_options
The return value is the malloced name of a header to try and open,
if any, or NULL otherwise. This callback is called only if the
header is otherwise unfound. */
-typedef const char *(*missing_header_cb)(cpp_reader *, const char *header);
+typedef const char *(*missing_header_cb)(cpp_reader *, const char *header, cpp_dir **);
/* Call backs to cpplib client. */
struct cpp_callbacks
@@ -408,7 +461,18 @@ struct cpp_callbacks
void (*def_pragma) (cpp_reader *, unsigned int);
int (*valid_pch) (cpp_reader *, const char *, int);
void (*read_pch) (cpp_reader *, const char *, int, const char *);
+
missing_header_cb missing_header;
+
+ /* APPLE LOCAL begin Symbol Separation */
+ void (*restore_write_symbols) (void);
+ void (*clear_write_symbols) (const char *, unsigned long);
+ void (*start_symbol_repository) (unsigned int, const char *, unsigned long);
+ void (*end_symbol_repository) (unsigned int);
+ int (*is_builtin_identifier) (cpp_hashnode *);
+ /* APPLE LOCAL end Symbol Separation */
+ /* APPLE LOCAL - PCH distcc debugging mrs */
+ void (*set_working_directory)(const char *);
};
/* Chain of directories to look for include files in. */
@@ -518,6 +582,20 @@ struct cpp_hashnode GTY(())
} GTY ((desc ("0"))) value;
};
+/* APPLE LOCAL begin Symbol Separation */
+struct cpp_stab_checksum GTY(())
+{
+ unsigned long checksum;
+};
+extern void cpp_write_symbol_deps PARAMS ((struct cpp_reader *));
+extern void cpp_read_stabs_checksum PARAMS ((struct cpp_reader *, int));
+extern unsigned long cpp_get_stabs_checksum PARAMS ((void));
+extern void cpp_calculate_stabs_checksum PARAMS ((const char *));
+extern const char * cpp_symbol_separation_init PARAMS ((struct cpp_reader *, const char *,
+ const char *));
+
+/* APPLE LOCAL end Symbol Separation */
+
/* Call this first to get a handle to pass to other functions.
If you want cpplib to manage its own hashtable, pass in a NULL
@@ -600,10 +678,12 @@ extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *,
/* Evaluate a vector of CPP_STRING or CPP_WSTRING tokens. */
extern bool cpp_interpret_string (cpp_reader *,
const cpp_string *, size_t,
- cpp_string *, bool);
+ /* APPLE LOCAL pascal strings */
+ cpp_string *, bool, bool);
extern bool cpp_interpret_string_notranslate (cpp_reader *,
const cpp_string *, size_t,
- cpp_string *, bool);
+ /* APPLE LOCAL pascal strings */
+ cpp_string *, bool, bool);
/* Used to register macros and assertions, perhaps from the command line.
The text is the same as the command line argument. */
@@ -709,6 +789,43 @@ extern void cpp_errno (cpp_reader *, int, const char *msgid);
extern void cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
const char *msgid, ...) ATTRIBUTE_PRINTF_5;
+/* APPLE LOCAL begin -header-mapfile */
+#define HMAP_SAME_ENDIANNESS_MAGIC (((((('h' << 8) | 'm') << 8) | 'a') << 8) | 'p')
+#define HMAP_OPPOSITE_ENDIANNESS_MAGIC (((((('p' << 8) | 'a') << 8) | 'm') << 8) | 'h')
+
+#define HMAP_NOT_A_KEY 0x00000000
+
+#if !defined(uint32)
+typedef unsigned short uint16;
+typedef unsigned long uint32;
+#endif
+
+struct hmap_bucket
+{
+ uint32 key; /* Offset (into strings) of key */
+ struct {
+ uint32 prefix; /* Offset (into strings) of value prefix */
+ uint32 suffix; /* Offset (into strings) of value suffix */
+ } value; /* Value (prefix- and suffix-strings) */
+};
+
+struct hmap_header_map
+{
+ uint32 magic; /* Magic word, also indicates byte order */
+ uint16 version; /* Version number -- currently 1 */
+ uint16 _reserved; /* Reserved for future use -- zero for now */
+ uint32 strings_offset; /* Offset to start of string pool */
+ uint32 count; /* Number of entries in the string table */
+ uint32 capacity; /* Number of buckets (always a power of 2) */
+ uint32 max_value_length; /* Length of longest result path (excl. '\0') */
+ struct hmap_bucket buckets[1]; /* Inline array of 'capacity' maptable buckets */
+ /* Strings follow the buckets, at strings_offset. */
+};
+
+extern struct search_path *hmap_lookup_path PARAMS ((cpp_reader *,
+ const char **));
+/* APPLE LOCAL end -header-mapfile */
+
/* In cpplex.c */
extern int cpp_ideq (const cpp_token *, const char *);
extern void cpp_output_line (cpp_reader *, FILE *);
@@ -744,10 +861,16 @@ extern void cpp_make_system_header (cpp_reader *, int, int);
extern bool cpp_push_include (cpp_reader *, const char *);
extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *);
extern const char *cpp_get_path (struct _cpp_file *);
+extern cpp_dir *cpp_get_dir (struct _cpp_file *);
extern cpp_buffer *cpp_get_buffer (cpp_reader *);
extern struct _cpp_file *cpp_get_file (cpp_buffer *);
extern cpp_buffer *cpp_get_prev (cpp_buffer *);
+/* APPLE LOCAL begin read-from-stdin */
+extern bool read_from_stdin PARAMS ((cpp_reader *));
+extern void set_stdin_option PARAMS ((cpp_reader *, const char*));
+/* APPLE LOCAL end read-from-stdin */
+
/* In cpppch.c */
struct save_macro_data;
extern int cpp_save_state (cpp_reader *, FILE *);
diff --git a/gcc/cpppch.c b/gcc/cpppch.c
index 8cb5bcff87a..a4886ae3457 100644
--- a/gcc/cpppch.c
+++ b/gcc/cpppch.c
@@ -224,6 +224,12 @@ count_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
struct cpp_string news;
void **slot;
+ /* APPLE LOCAL begin Symbol Separation */
+ if (pfile->cinfo_state == CINFO_WRITE && pfile->cb.is_builtin_identifier)
+ if (pfile->cb.is_builtin_identifier (hn))
+ return 1;
+ /* APPLE LOCAL end Symbol Separation */
+
news.len = NODE_LEN (hn);
news.text = NODE_NAME (hn);
slot = htab_find (ss->definedhash, &news);
@@ -263,6 +269,12 @@ write_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
struct cpp_string news;
void **slot;
+ /* APPLE LOCAL begin Symbol Separation */
+ if (pfile->cinfo_state == CINFO_WRITE && pfile->cb.is_builtin_identifier)
+ if (pfile->cb.is_builtin_identifier (hn))
+ return 1;
+ /* APPLE LOCAL end Symbol Separation */
+
news.len = NODE_LEN (hn);
news.text = NODE_NAME (hn);
slot = htab_find (ss->definedhash, &news);
@@ -420,8 +432,9 @@ collect_ht_nodes (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn,
- anything that was not defined then, but is defined now, was not
used by the PCH.
- NAME is used to print warnings if `warn_invalid_pch' is set in the
- reader's flags.
+ APPLE LOCAL Symbol Separation
+ NAME is used to print warnings if `warn_invalid_pch' or `warn_invalid_sr'
+ is set in the reader's flags.
*/
int
@@ -434,7 +447,14 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
struct ht_node_list nl = { 0, 0, 0 };
unsigned char *first, *last;
unsigned int i;
-
+ /* APPLE LOCAL begin pch distcc mrs */
+ int skip_validation;
+
+ /* Skip pch validation if we have just validated it. */
+ skip_validation = CPP_OPTION (r, pch_preprocess)
+ && CPP_OPTION (r, preprocessed);
+ /* APPLE LOCAL end pch distcc mrs */
+
/* Read in the list of identifiers that must be defined
Check that they are defined in the same way. */
for (;;)
@@ -459,12 +479,18 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
!= m.definition_length)
goto error;
+ /* APPLE LOCAL begin pch distcc mrs */
+ if (skip_validation)
+ continue;
+ /* APPLE LOCAL end pch distcc mrs */
+
h = cpp_lookup (r, namebuf, m.name_length);
if (m.flags & NODE_POISONED
|| h->type != NT_MACRO
|| h->flags & NODE_POISONED)
{
- if (CPP_OPTION (r, warn_invalid_pch))
+ /* APPLE LOCAL Symbol Separtion */
+ if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%.*s' not defined",
name, m.name_length, namebuf);
@@ -476,7 +502,8 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
if (m.definition_length != ustrlen (newdefn)
|| memcmp (namebuf, newdefn, m.definition_length) != 0)
{
- if (CPP_OPTION (r, warn_invalid_pch))
+ /* APPLE LOCAL Symbol Separtion */
+ if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%.*s' defined as `%s' not `%.*s'",
name, m.name_length, namebuf, newdefn + m.name_length,
@@ -494,6 +521,14 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
if ((size_t) read (fd, undeftab, m.definition_length) != m.definition_length)
goto error;
+ /* APPLE LOCAL begin pch distcc mrs */
+ if (skip_validation)
+ {
+ free (undeftab);
+ return 0;
+ }
+ /* APPLE LOCAL end pch distcc mrs */
+
/* Collect identifiers from the current hash table. */
nl.n_defs = 0;
nl.asize = 10;
@@ -517,7 +552,8 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
++i;
else
{
- if (CPP_OPTION (r, warn_invalid_pch))
+ /* APPLE LOCAL Symbol Separtion */
+ if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%s' is defined",
name, first);
@@ -619,6 +655,11 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
struct save_macro_item *d;
size_t i, mac_count;
int saved_line = r->line;
+ /* APPLE LOCAL pch distcc mrs */
+ void (*saved_line_change) PARAMS ((cpp_reader *, const cpp_token *, int));
+
+ /* APPLE LOCAL pch distcc mrs */
+ saved_line_change = r->cb.line_change;
/* Restore spec_nodes, which will be full of references to the old
hashtable entries and so will now be invalid. */
@@ -663,6 +704,9 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
r->state.prevent_expansion = 1;
r->state.angled_headers = 0;
+ /* APPLE LOCAL pch distcc mrs */
+ r->cb.line_change = 0;
+
/* Read in the identifiers that must be defined. */
for (;;)
{
@@ -708,6 +752,9 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
r->state = old_state;
r->line = saved_line;
+ /* APPLE LOCAL pch distcc mrs */
+ r->cb.line_change = saved_line_change;
+
free (defn);
defn = NULL;
diff --git a/gcc/cse.c b/gcc/cse.c
index 2c4ab8eb071..5cd73f2035d 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -4811,6 +4811,9 @@ cse_insn (rtx insn, rtx libcall_insn)
rtx src_eqv_here;
rtx src_const = 0;
rtx src_related = 0;
+ /* APPLE LOCAL begin cse of ZERO/SIGN EXTEND */
+ rtx zero_sign_extended_src = NULL_RTX;
+ /* APPLE LOCAL end cse of ZERO/SIGN EXTEND */
struct table_elt *src_const_elt = 0;
int src_cost = MAX_COST;
int src_eqv_cost = MAX_COST;
@@ -4945,7 +4948,35 @@ cse_insn (rtx insn, rtx libcall_insn)
REG_NOTE. */
if (!sets[i].src_volatile)
+ /* APPLE LOCAL begin cse of ZERO/SIGN EXTEND */
+ {
elt = lookup (src, sets[i].src_hash, mode);
+ if (!elt
+ && (GET_CODE(src) == ZERO_EXTEND || GET_CODE(src) == SIGN_EXTEND)
+ && GET_CODE (XEXP (src, 0)) == MEM)
+ {
+ unsigned mem_hash;
+ rtx nsrc = XEXP (src, 0);
+ enum machine_mode nmode = GET_MODE(nsrc);
+ do_not_record = 0;
+ hash_arg_in_memory = 0;
+ mem_hash = HASH (nsrc, nmode);
+ elt = lookup (nsrc, mem_hash, nmode);
+ if (elt)
+ {
+ sets[i].src = nsrc;
+ sets[i].src_hash = mem_hash;
+ sets[i].src_volatile = do_not_record;
+ sets[i].src_in_memory = hash_arg_in_memory;
+ zero_sign_extended_src = src;
+ src = nsrc;
+ mode = GET_MODE (src) == VOIDmode ? GET_MODE (dest) : GET_MODE (src);
+ sets[i].mode = mode;
+ src_folded = fold_rtx (src, insn);
+ }
+ }
+ }
+ /* APPLE LOCAL end cse of ZERO/SIGN EXTEND */
sets[i].src_elt = elt;
@@ -4974,6 +5005,26 @@ cse_insn (rtx insn, rtx libcall_insn)
for (p = elt->first_same_value; p; p = p->next_same_value)
if (p->is_const)
{
+ /* APPLE LOCAL begin cse of ZERO/SIGN EXTEND */
+ /* If we're looking at a MEM under a SIGN/ZERO_EXTEND,
+ constants match only if the high bits match. */
+ if (zero_sign_extended_src)
+ {
+ rtx truncated_const, trial;
+ truncated_const = gen_rtx_TRUNCATE (
+ GET_MODE (XEXP (zero_sign_extended_src, 0)),
+ copy_rtx (p->exp));
+ if (GET_CODE (zero_sign_extended_src) == ZERO_EXTEND)
+ trial = gen_rtx_ZERO_EXTEND (
+ GET_MODE (zero_sign_extended_src), truncated_const);
+ else
+ trial = gen_rtx_SIGN_EXTEND (
+ GET_MODE (zero_sign_extended_src), truncated_const);
+ trial = fold_rtx (trial, NULL_RTX);
+ if (!rtx_equal_p (trial, p->exp))
+ continue;
+ }
+ /* APPLE LOCAL end cse of ZERO/SIGN EXTEND */
src_const = p->exp;
src_const_elt = elt;
break;
@@ -5346,6 +5397,18 @@ cse_insn (rtx insn, rtx libcall_insn)
&& preferable (src_related_cost, src_related_regcost,
src_elt_cost, src_elt_regcost) <= 0)
trial = copy_rtx (src_related), src_related_cost = MAX_COST;
+ /* APPLE LOCAL begin cse of ZERO/SIGN EXTEND */
+ else if (zero_sign_extended_src)
+ {
+ trial = GET_CODE(zero_sign_extended_src) == ZERO_EXTEND
+ ? gen_rtx_ZERO_EXTEND (GET_MODE(zero_sign_extended_src),
+ copy_rtx (elt->exp))
+ : gen_rtx_SIGN_EXTEND (GET_MODE(zero_sign_extended_src),
+ copy_rtx (elt->exp));
+ elt = elt->next_same_value;
+ src_elt_cost = MAX_COST;
+ }
+ /* APPLE LOCAL end cse of ZERO/SIGN EXTEND */
else
{
trial = copy_rtx (elt->exp);
@@ -5426,6 +5489,10 @@ cse_insn (rtx insn, rtx libcall_insn)
}
src = SET_SRC (sets[i].rtl);
+ /* APPLE LOCAL begin cse of ZERO/SIGN EXTEND */
+ if (zero_sign_extended_src)
+ src = XEXP (src, 0);
+ /* APPLE LOCAL end cse of ZERO/SIGN EXTEND */
/* In general, it is good to have a SET with SET_SRC == SET_DEST.
However, there is an important exception: If both are registers
@@ -5502,7 +5569,11 @@ cse_insn (rtx insn, rtx libcall_insn)
&& ! (GET_CODE (src_const) == CONST
&& GET_CODE (XEXP (src_const, 0)) == MINUS
&& GET_CODE (XEXP (XEXP (src_const, 0), 0)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (src_const, 0), 1)) == LABEL_REF))
+ /* APPLE LOCAL begin */
+ && (GET_CODE (XEXP (XEXP (src_const, 0), 1)) == LABEL_REF
+ || rtx_equal_p ((XEXP (XEXP (src_const, 0), 1)),
+ const0_rtx))))
+ /* APPLE LOCAL end */
{
/* We only want a REG_EQUAL note if src_const != src. */
if (! rtx_equal_p (src, src_const))
@@ -5740,6 +5811,18 @@ cse_insn (rtx insn, rtx libcall_insn)
rtx dest = SET_DEST (sets[i].rtl);
enum machine_mode mode
= GET_MODE (src) == VOIDmode ? GET_MODE (dest) : GET_MODE (src);
+ if (!classp)
+ classp = sets[i].src_const_elt;
+
+ /* It's possible that we have a source value known to be
+ constant but don't have a REG_EQUAL note on the insn.
+ Lack of a note will mean src_eqv_elt will be NULL. This
+ can happen where we've generated a SUBREG to access a
+ CONST_INT that is already in a register in a wider mode.
+ Ensure that the source expression is put in the proper
+ constant class. */
+ if (!classp)
+ classp = sets[i].src_const_elt;
/* It's possible that we have a source value known to be
constant but don't have a REG_EQUAL note on the insn.
@@ -6600,10 +6683,6 @@ cse_set_around_loop (rtx x, rtx insn, rtx loop_start)
}
else
{
- if (CONSTANT_P (SET_SRC (set))
- && ! find_reg_equal_equiv_note (insn))
- set_unique_reg_note (insn, REG_EQUAL,
- SET_SRC (set));
if (control_flow_insn_p (p))
/* p can cause a control flow transfer so it
is the last insn of a basic block. We can't
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 39f0d554501..6f34ac92a3d 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -88,6 +88,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "function.h"
#include "target.h"
#include "langhooks.h"
+/* APPLE LOCAL begin Constructors return THIS turly 20020315 */
+/* FIXME: dbxout.c should not need language-specific headers. */
+#include "c-common.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h"
@@ -338,6 +341,13 @@ static void emit_pending_bincls (void);
#endif
static inline void emit_pending_bincls_if_required (void);
+/* APPLE LOCAL begin Symbol Separtion */
+static void dbxout_restore_write_symbols (void);
+static void dbxout_clear_write_symbols (const char *, unsigned long);
+static void dbxout_start_symbol_repository (unsigned int, const char *, unsigned long);
+static void dbxout_end_symbol_repository (unsigned int);
+/* APPLE LOCAL end Symbol Separation */
+
static void dbxout_init (const char *);
static void dbxout_finish (const char *);
static void dbxout_start_source_file (unsigned, const char *);
@@ -408,7 +418,13 @@ const struct gcc_debug_hooks dbx_debug_hooks =
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx, /* label */
- dbxout_handle_pch, /* handle_pch */
+ dbxout_handle_pch, /* handle_pch */
+ /* APPLE LOCAL begin Symbol Separation */
+ dbxout_restore_write_symbols,
+ dbxout_clear_write_symbols,
+ dbxout_start_symbol_repository,
+ dbxout_end_symbol_repository,
+ /* APPLE LOCAL end Symbol Separation */
debug_nothing_rtx /* var_location */
};
#endif /* DBX_DEBUGGING_INFO */
@@ -439,6 +455,12 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx, /* label */
dbxout_handle_pch, /* handle_pch */
+ /* APPLE LOCAL begin Symbol Separtion */
+ debug_nothing_void, /* restore write_symbols */
+ debug_nothing_void, /* clear write_symbols */
+ debug_nothing_void, /* start repository */
+ debug_nothing_void, /* end repository */
+ /* APPLE LOCAL end Symbol Separation */
debug_nothing_rtx /* var_location */
};
#endif /* XCOFF_DEBUGGING_INFO */
@@ -448,6 +470,9 @@ static void
dbxout_function_end (void)
{
char lscope_label_name[100];
+ /* APPLE LOCAL begin hot/cold partitioning */
+ function_section (current_function_decl);
+ /* APPLE LOCAL end hot/cold partitioning */
/* Convert Ltext into the appropriate format for local labels in case
the system doesn't insert underscores in front of user generated
labels. */
@@ -501,9 +526,9 @@ dbxout_init (const char *input_file_name)
#else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
fprintf (asmfile, "%s", ASM_STABS_OP);
output_quoted_string (asmfile, cwd);
- fprintf (asmfile, ",%d,0,0,", N_SO);
- assemble_name (asmfile, ltext_label_name);
- fputc ('\n', asmfile);
+ /* APPLE LOCAL begin 3109828 fix */
+ fprintf (asmfile, ",%d,0,0,0\n", N_SO);
+ /* APPLE LOCAL end 3109828 fix */
#endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
}
}
@@ -516,10 +541,10 @@ dbxout_init (const char *input_file_name)
/* Used to put `Ltext:' before the reference, but that loses on sun 4. */
fprintf (asmfile, "%s", ASM_STABS_OP);
output_quoted_string (asmfile, input_file_name);
- fprintf (asmfile, ",%d,0,0,", N_SO);
- assemble_name (asmfile, ltext_label_name);
- fputc ('\n', asmfile);
+ /* APPLE LOCAL begin 3109828 fix */
+ fprintf (asmfile, ",%d,0,0,0\n", N_SO);
text_section ();
+ /* APPLE LOCAL end 3109828 fix */
(*targetm.asm_out.internal_label) (asmfile, "Ltext", 0);
#endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
@@ -546,6 +571,20 @@ dbxout_init (const char *input_file_name)
current_file->pending_bincl_name = NULL;
#endif
+ /* Make sure that types `int' and `char' have numbers 1 and 2.
+ Definitions of other integer types will refer to those numbers.
+ (Actually it should no longer matter what their numbers are.
+ Also, if any types with tags have been defined, dbxout_symbol
+ will output them first, so the numbers won't be 1 and 2. That
+ happens in C++. So it's a good thing it should no longer matter). */
+
+/* APPLE LOCAL gdb only used symbols */
+#ifndef DBX_ONLY_USED_SYMBOLS
+ dbxout_symbol (TYPE_NAME (integer_type_node), 0);
+ dbxout_symbol (TYPE_NAME (char_type_node), 0);
+/* APPLE LOCAL gdb only used symbols */
+#endif
+
/* Get all permanent types that have typedef names, and output them
all, except for those already output. Some language front ends
put these declarations in the top-level scope; some do not;
@@ -581,6 +620,59 @@ dbxout_typedefs (tree syms)
}
}
+/* APPLE LOCAL begin Symbol Separation */
+/* Restore write_symbols */
+static void
+dbxout_restore_write_symbols (void)
+{
+ if (flag_grepository)
+ write_symbols = orig_write_symbols;
+}
+
+/* Clear write_symbols and emit EXCL stab. */
+static void
+dbxout_clear_write_symbols (const char *filename, unsigned long checksum)
+{
+ if (flag_grepository)
+ {
+ write_symbols = NO_DEBUG;
+ fprintf (asmfile, "%s", ASM_STABS_OP);
+ output_quoted_string (asmfile, filename);
+ fprintf (asmfile, ",%d,0,0,%ld\n", N_EXCL, checksum);
+ }
+}
+
+/* Start symbol repository */
+/* Add checksum with BINCL. */
+static void
+dbxout_start_symbol_repository (unsigned int lineno ATTRIBUTE_UNUSED,
+ const char *filename ATTRIBUTE_UNUSED,
+ unsigned long checksum ATTRIBUTE_UNUSED)
+{
+#ifdef DBX_USE_BINCL
+ struct dbx_file *n = (struct dbx_file *) xmalloc (sizeof *n);
+
+ n->next = current_file;
+ n->file_number = next_file_number++;
+ n->next_type_number = 1;
+ current_file = n;
+ fprintf (asmfile, "%s", ASM_STABS_OP);
+ output_quoted_string (asmfile, filename);
+ fprintf (asmfile, ",%d,0,0,%ld\n", N_BINCL, checksum);
+#endif
+}
+
+/* End symbol repository */
+static void
+dbxout_end_symbol_repository (unsigned int lineno ATTRIBUTE_UNUSED)
+{
+#ifdef DBX_USE_BINCL
+ fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL);
+ current_file = current_file->next;
+#endif
+}
+/* APPLE LOCAL end Symbol Separation */
+
#ifdef DBX_USE_BINCL
/* Emit BINCL stab using given name. */
static void
@@ -648,6 +740,14 @@ dbxout_start_source_file (unsigned int line ATTRIBUTE_UNUSED,
#ifdef DBX_USE_BINCL
struct dbx_file *n = xmalloc (sizeof *n);
+ /* APPLE LOCAL begin Symbol Separation */
+ if (write_symbols == NO_DEBUG)
+ {
+ n = NULL;
+ return;
+ }
+ /* APPLE LOCAL end Symbol Separation */
+
n->next = current_file;
n->next_type_number = 1;
/* Do not assign file number now.
@@ -668,6 +768,11 @@ static void
dbxout_end_source_file (unsigned int line ATTRIBUTE_UNUSED)
{
#ifdef DBX_USE_BINCL
+ /* APPLE LOCAL begin Symbol Separation */
+ if (write_symbols == NO_DEBUG)
+ return;
+ /* APPLE LOCAL end Symbol Separation */
+
/* Emit EINCL stab only if BINCL is not pending. */
if (current_file->bincl_status == BINCL_PROCESSED)
fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL);
@@ -721,14 +826,16 @@ dbxout_source_file (FILE *file, const char *filename)
source_label_number);
fprintf (file, "%s", ASM_STABS_OP);
output_quoted_string (file, filename);
- fprintf (asmfile, ",%d,0,0,", N_SOL);
- assemble_name (asmfile, ltext_label_name);
- fputc ('\n', asmfile);
- if (current_function_decl != NULL_TREE
- && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
+ /* APPLE LOCAL 310928 fix */
+ fprintf (asmfile, ",%d,0,0,0\n", N_SOL);
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if ((current_function_decl != NULL_TREE
+ && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
+ || flag_reorder_blocks_and_partition)
; /* Don't change section amid function. */
else
text_section ();
+ /* APPLE LOCAL end hot/cold partitioning */
(*targetm.asm_out.internal_label) (file, "Ltext", source_label_number);
source_label_number++;
lastfile = filename;
@@ -2218,7 +2325,14 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
int tag_needed = 1;
int did_output = 0;
- if (DECL_NAME (decl))
+ if (DECL_NAME (decl)
+ /* APPLE LOCAL begin gdb only used symbols */
+#ifdef DBX_ONLY_USED_SYMBOLS
+ /* Do not generate a tag for incomplete records */
+ && (COMPLETE_TYPE_P (type) || TREE_CODE (type) == VOID_TYPE)
+#endif
+ /* APPLE LOCAL end gdb only used symbols */
+ )
{
/* Nonzero means we must output a tag as well as a typedef. */
tag_needed = 0;
@@ -3195,6 +3309,15 @@ dbxout_begin_function (tree decl)
dbxout_parms (DECL_ARGUMENTS (decl));
if (DECL_NAME (DECL_RESULT (decl)) != 0)
+ /* APPLE LOCAL begin Constructors return THIS turly 20020315 */
+#ifdef POSSIBLY_COMPILING_APPLE_KEXT_P
+ /* We cheat with kext constructors: DECL_RESULT is "this", but "this"
+ is actually the first parameter, so don't confuse matters by
+ outputting the same parameter twice. */
+ if (!(POSSIBLY_COMPILING_APPLE_KEXT_P ()
+ && DECL_RESULT (decl) == DECL_ARGUMENTS (decl)))
+#endif
+ /* APPLE LOCAL end Constructors return THIS turly 20020315 */
dbxout_symbol (DECL_RESULT (decl), 1);
}
#endif /* DBX_DEBUGGING_INFO */
diff --git a/gcc/debug.c b/gcc/debug.c
index 812920604ba..69654c96184 100644
--- a/gcc/debug.c
+++ b/gcc/debug.c
@@ -47,6 +47,9 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx, /* label */
debug_nothing_int, /* handle_pch */
+ /* APPLE LOCAL begin Symbol Separation */
+ NULL, NULL, NULL, NULL,
+ /* APPLE LOCAL end Symbol Separation */
debug_nothing_rtx /* var_location */
};
diff --git a/gcc/debug.h b/gcc/debug.h
index 547b7f68eab..a38a3598c59 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -117,6 +117,13 @@ struct gcc_debug_hooks
The parameter is 0 if after the start, 1 if before the end. */
void (* handle_pch) (unsigned int);
+ /* APPLE LOCAL begin Symbol Separation */
+ void (* restore_write_symbols) (void);
+ void (* clear_write_symbols) (const char *, unsigned long);
+ void (* start_symbol_repository) (unsigned int, const char *, unsigned long);
+ void (* end_symbol_repository) (unsigned int);
+ /* APPLE LOCAL end Symbol Separation */
+
/* Called from final_scan_insn for any NOTE_INSN_VAR_LOCATION note. */
void (* var_location) (rtx);
};
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 685a2802359..8c006869d00 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -587,10 +587,25 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME "text.unlikely"
#endif
+/* APPLE LOCAL begin hot/cold partitioning */
+
+#ifndef HAS_LONG_COND_BRANCH
+#define HAS_LONG_COND_BRANCH 0
+#endif
+
+#ifndef HAS_LONG_UNCOND_BRANCH
+#define HAS_LONG_UNCOND_BRANCH 0
+#endif
+/* APPLE LOCAL end hot/cold partitioning */
+
#ifndef VECTOR_MODE_SUPPORTED_P
#define VECTOR_MODE_SUPPORTED_P(MODE) 0
#endif
+#ifndef UNITS_PER_SIMD_WORD
+#define UNITS_PER_SIMD_WORD 0
+#endif
+
/* Determine whether __cxa_atexit, rather than atexit, is used to
register C++ destructors for local statics and global objects. */
#ifndef DEFAULT_USE_CXA_ATEXIT
diff --git a/gcc/df.c b/gcc/df.c
index 79dfa099830..f26d3089770 100644
--- a/gcc/df.c
+++ b/gcc/df.c
@@ -187,7 +187,6 @@ and again mark them read/write.
#include "sbitmap.h"
#include "bitmap.h"
#include "df.h"
-#include "fibheap.h"
#define FOR_EACH_BB_IN_BITMAP(BITMAP, MIN, BB, CODE) \
do \
@@ -204,7 +203,8 @@ static struct df *ddf;
static void df_reg_table_realloc (struct df *, int);
static void df_insn_table_realloc (struct df *, unsigned int);
-static void df_bitmaps_alloc (struct df *, int);
+static void df_bb_table_realloc (struct df *, unsigned int);
+static void df_bitmaps_alloc (struct df *, bitmap, int);
static void df_bitmaps_free (struct df *, int);
static void df_free (struct df *);
static void df_alloc (struct df *, int);
@@ -237,9 +237,9 @@ static void df_bb_refs_record (struct df *, basic_block);
static void df_refs_record (struct df *, bitmap);
static void df_bb_reg_def_chain_create (struct df *, basic_block);
-static void df_reg_def_chain_create (struct df *, bitmap);
+static void df_reg_def_chain_create (struct df *, bitmap, bool);
static void df_bb_reg_use_chain_create (struct df *, basic_block);
-static void df_reg_use_chain_create (struct df *, bitmap);
+static void df_reg_use_chain_create (struct df *, bitmap, bool);
static void df_bb_du_chain_create (struct df *, basic_block, bitmap);
static void df_du_chain_create (struct df *, bitmap);
static void df_bb_ud_chain_create (struct df *, basic_block);
@@ -260,7 +260,7 @@ static int df_modified_p (struct df *, bitmap);
static int df_refs_queue (struct df *);
static int df_refs_process (struct df *);
static int df_bb_refs_update (struct df *, basic_block);
-static int df_refs_update (struct df *);
+static int df_refs_update (struct df *, bitmap);
static void df_analyze_1 (struct df *, bitmap, int, int);
static void df_insns_modify (struct df *, basic_block, rtx, rtx);
@@ -283,22 +283,14 @@ static void df_chain_dump (struct df_link *, FILE *file);
static void df_chain_dump_regno (struct df_link *, FILE *file);
static void df_regno_debug (struct df *, unsigned int, FILE *);
static void df_ref_debug (struct df *, struct ref *, FILE *);
-static void df_rd_transfer_function (int, int *, bitmap, bitmap, bitmap,
- bitmap, void *);
-static void df_ru_transfer_function (int, int *, bitmap, bitmap, bitmap,
- bitmap, void *);
-static void df_lr_transfer_function (int, int *, bitmap, bitmap, bitmap,
- bitmap, void *);
-static void hybrid_search_bitmap (basic_block, bitmap *, bitmap *,
- bitmap *, bitmap *, enum df_flow_dir,
- enum df_confluence_op,
- transfer_function_bitmap,
- sbitmap, sbitmap, void *);
-static void hybrid_search_sbitmap (basic_block, sbitmap *, sbitmap *,
- sbitmap *, sbitmap *, enum df_flow_dir,
- enum df_confluence_op,
- transfer_function_sbitmap,
- sbitmap, sbitmap, void *);
+static void df_rd_transfer_function (int, int *, void *, void *, void *,
+ void *, void *);
+static void df_ru_transfer_function (int, int *, void *, void *, void *,
+ void *, void *);
+static void df_lr_transfer_function (int, int *, void *, void *, void *,
+ void *, void *);
+static void hybrid_search (basic_block, struct dataflow *,
+ sbitmap, sbitmap, sbitmap);
/* Local memory allocation/deallocation routines. */
@@ -331,6 +323,26 @@ df_insn_table_realloc (struct df *df, unsigned int size)
}
}
+/* Increase the bb info table to have space for at least SIZE + 1
+ elements. */
+
+static void
+df_bb_table_realloc (struct df *df, unsigned int size)
+{
+ size++;
+ if (size <= df->n_bbs)
+ return;
+
+ /* Make the table a little larger than requested, so we do not need
+ to enlarge it so often. */
+ size += df->n_bbs / 4;
+
+ df->bbs = xrealloc (df->bbs, size * sizeof (struct bb_info));
+
+ memset (df->bbs + df->n_bbs, 0, (size - df->n_bbs) * sizeof (struct bb_info));
+
+ df->n_bbs = size;
+}
/* Increase the reg info table by SIZE more elements. */
static void
@@ -345,6 +357,8 @@ df_reg_table_realloc (struct df *df, int size)
size = max_reg_num ();
df->regs = xrealloc (df->regs, size * sizeof (struct reg_info));
+ df->reg_def_last = xrealloc (df->reg_def_last,
+ size * sizeof (struct ref *));
/* Zero the new entries. */
memset (df->regs + df->reg_size, 0,
@@ -355,67 +369,79 @@ df_reg_table_realloc (struct df *df, int size)
/* Allocate bitmaps for each basic block. */
+
static void
-df_bitmaps_alloc (struct df *df, int flags)
+df_bitmaps_alloc (struct df *df, bitmap blocks, int flags)
{
- int dflags = 0;
basic_block bb;
- /* Free the bitmaps if they need resizing. */
- if ((flags & DF_LR) && df->n_regs < (unsigned int) max_reg_num ())
- dflags |= DF_LR | DF_RU;
- if ((flags & DF_RU) && df->n_uses < df->use_id)
- dflags |= DF_RU;
- if ((flags & DF_RD) && df->n_defs < df->def_id)
- dflags |= DF_RD;
-
- if (dflags)
- df_bitmaps_free (df, dflags);
-
df->n_defs = df->def_id;
df->n_uses = df->use_id;
- FOR_EACH_BB (bb)
+ if (!blocks)
+ blocks = df->all_blocks;
+
+ FOR_EACH_BB_IN_BITMAP (blocks, 0, bb,
{
struct bb_info *bb_info = DF_BB_INFO (df, bb);
- if (flags & DF_RD && ! bb_info->rd_in)
+ if (flags & DF_RD)
{
- /* Allocate bitmaps for reaching definitions. */
- bb_info->rd_kill = BITMAP_XMALLOC ();
- bitmap_zero (bb_info->rd_kill);
- bb_info->rd_gen = BITMAP_XMALLOC ();
- bitmap_zero (bb_info->rd_gen);
- bb_info->rd_in = BITMAP_XMALLOC ();
- bb_info->rd_out = BITMAP_XMALLOC ();
- bb_info->rd_valid = 0;
+ if (!bb_info->rd_in)
+ {
+ /* Allocate bitmaps for reaching definitions. */
+ bb_info->rd_kill = BITMAP_XMALLOC ();
+ bb_info->rd_gen = BITMAP_XMALLOC ();
+ bb_info->rd_in = BITMAP_XMALLOC ();
+ bb_info->rd_out = BITMAP_XMALLOC ();
+ }
+ else
+ {
+ bitmap_clear (bb_info->rd_kill);
+ bitmap_clear (bb_info->rd_gen);
+ bitmap_clear (bb_info->rd_in);
+ bitmap_clear (bb_info->rd_out);
+ }
}
- if (flags & DF_RU && ! bb_info->ru_in)
+ if (flags & DF_RU)
{
- /* Allocate bitmaps for upward exposed uses. */
- bb_info->ru_kill = BITMAP_XMALLOC ();
- bitmap_zero (bb_info->ru_kill);
- /* Note the lack of symmetry. */
- bb_info->ru_gen = BITMAP_XMALLOC ();
- bitmap_zero (bb_info->ru_gen);
- bb_info->ru_in = BITMAP_XMALLOC ();
- bb_info->ru_out = BITMAP_XMALLOC ();
- bb_info->ru_valid = 0;
+ if (!bb_info->ru_in)
+ {
+ /* Allocate bitmaps for upward exposed uses. */
+ bb_info->ru_kill = BITMAP_XMALLOC ();
+ bb_info->ru_gen = BITMAP_XMALLOC ();
+ bb_info->ru_in = BITMAP_XMALLOC ();
+ bb_info->ru_out = BITMAP_XMALLOC ();
+ }
+ else
+ {
+ bitmap_clear (bb_info->ru_kill);
+ bitmap_clear (bb_info->ru_gen);
+ bitmap_clear (bb_info->ru_in);
+ bitmap_clear (bb_info->ru_out);
+ }
}
- if (flags & DF_LR && ! bb_info->lr_in)
+ if (flags & DF_LR)
{
- /* Allocate bitmaps for live variables. */
- bb_info->lr_def = BITMAP_XMALLOC ();
- bitmap_zero (bb_info->lr_def);
- bb_info->lr_use = BITMAP_XMALLOC ();
- bitmap_zero (bb_info->lr_use);
- bb_info->lr_in = BITMAP_XMALLOC ();
- bb_info->lr_out = BITMAP_XMALLOC ();
- bb_info->lr_valid = 0;
+ if (!bb_info->lr_in)
+ {
+ /* Allocate bitmaps for live variables. */
+ bb_info->lr_def = BITMAP_XMALLOC ();
+ bb_info->lr_use = BITMAP_XMALLOC ();
+ bb_info->lr_in = BITMAP_XMALLOC ();
+ bb_info->lr_out = BITMAP_XMALLOC ();
+ }
+ else
+ {
+ bitmap_clear (bb_info->lr_def);
+ bitmap_clear (bb_info->lr_use);
+ bitmap_clear (bb_info->lr_in);
+ bitmap_clear (bb_info->lr_out);
+ }
}
- }
+ });
}
@@ -506,8 +532,6 @@ df_alloc (struct df *df, int n_regs)
df->n_bbs = last_basic_block;
/* Allocate temporary working array used during local dataflow analysis. */
- df->reg_def_last = xmalloc (df->n_regs * sizeof (struct ref *));
-
df_insn_table_realloc (df, n_insns);
df_reg_table_realloc (df, df->n_regs);
@@ -570,7 +594,6 @@ df_free (struct df *df)
free_alloc_pool (df_ref_pool);
free_alloc_pool (df_link_pool);
-
}
/* Local miscellaneous routines. */
@@ -614,6 +637,21 @@ df_link_create (struct ref *ref, struct df_link *next)
return link;
}
+/* Releases members of the CHAIN. */
+
+static void
+free_reg_ref_chain (struct df_link **chain)
+{
+ struct df_link *act, *next;
+
+ for (act = *chain; act; act = next)
+ {
+ next = act->next;
+ pool_free (df_link_pool, act);
+ }
+
+ *chain = NULL;
+}
/* Add REF to chain head pointed to by PHEAD. */
static struct df_link *
@@ -740,6 +778,7 @@ df_ref_create (struct df *df, rtx reg, rtx *loc, rtx insn,
DF_REF_CHAIN (this_ref) = 0;
DF_REF_TYPE (this_ref) = ref_type;
DF_REF_FLAGS (this_ref) = ref_flags;
+ DF_REF_DATA (this_ref) = NULL;
if (ref_type == DF_REF_REG_DEF)
{
@@ -1216,15 +1255,13 @@ df_bb_refs_record (struct df *df, basic_block bb)
rtx insn;
/* Scan the block an insn at a time from beginning to end. */
- for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
+ FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
{
/* Record defs within INSN. */
df_insn_refs_record (df, bb, insn);
}
- if (insn == BB_END (bb))
- break;
}
}
@@ -1243,21 +1280,18 @@ df_refs_record (struct df *df, bitmap blocks)
/* Dataflow analysis routines. */
-
/* Create reg-def chains for basic block BB. These are a list of
definitions for each register. */
+
static void
df_bb_reg_def_chain_create (struct df *df, basic_block bb)
{
rtx insn;
/* Perhaps the defs should be sorted using a depth first search
- of the CFG (or possibly a breadth first search). We currently
- scan the basic blocks in reverse order so that the first defs
- appear at the start of the chain. */
+ of the CFG (or possibly a breadth first search). */
- for (insn = BB_END (bb); insn && insn != PREV_INSN (BB_HEAD (bb));
- insn = PREV_INSN (insn))
+ FOR_BB_INSNS_REVERSE (bb, insn)
{
struct df_link *link;
unsigned int uid = INSN_UID (insn);
@@ -1277,29 +1311,59 @@ df_bb_reg_def_chain_create (struct df *df, basic_block bb)
if (DF_REF_ID (def) < df->def_id_save)
continue;
- df->regs[dregno].defs
- = df_link_create (def, df->regs[dregno].defs);
+ df->regs[dregno].defs = df_link_create (def, df->regs[dregno].defs);
}
}
}
/* Create reg-def chains for each basic block within BLOCKS. These
- are a list of definitions for each register. */
+ are a list of definitions for each register. If REDO is true, add
+ all defs, otherwise just add the new defs. */
+
static void
-df_reg_def_chain_create (struct df *df, bitmap blocks)
+df_reg_def_chain_create (struct df *df, bitmap blocks, bool redo)
{
basic_block bb;
+#ifdef ENABLE_CHECKING
+ unsigned regno;
+#endif
+ unsigned old_def_id_save = df->def_id_save;
+
+ if (redo)
+ {
+#ifdef ENABLE_CHECKING
+ for (regno = 0; regno < df->n_regs; regno++)
+ if (df->regs[regno].defs)
+ abort ();
+#endif
+
+ /* Pretend that all defs are new. */
+ df->def_id_save = 0;
+ }
- FOR_EACH_BB_IN_BITMAP/*_REV*/ (blocks, 0, bb,
+ FOR_EACH_BB_IN_BITMAP (blocks, 0, bb,
{
df_bb_reg_def_chain_create (df, bb);
});
+
+ df->def_id_save = old_def_id_save;
}
+/* Remove all reg-def chains stored in the dataflow object DF. */
+
+static void
+df_reg_def_chain_clean (struct df *df)
+{
+ unsigned regno;
+
+ for (regno = 0; regno < df->n_regs; regno++)
+ free_reg_ref_chain (&df->regs[regno].defs);
+}
/* Create reg-use chains for basic block BB. These are a list of uses
for each register. */
+
static void
df_bb_reg_use_chain_create (struct df *df, basic_block bb)
{
@@ -1308,8 +1372,7 @@ df_bb_reg_use_chain_create (struct df *df, basic_block bb)
/* Scan in forward order so that the last uses appear at the start
of the chain. */
- for (insn = BB_HEAD (bb); insn && insn != NEXT_INSN (BB_END (bb));
- insn = NEXT_INSN (insn))
+ FOR_BB_INSNS (bb, insn)
{
struct df_link *link;
unsigned int uid = INSN_UID (insn);
@@ -1337,18 +1400,48 @@ df_bb_reg_use_chain_create (struct df *df, basic_block bb)
/* Create reg-use chains for each basic block within BLOCKS. These
- are a list of uses for each register. */
+ are a list of uses for each register. If REDO is true, remove the
+ old reg-use chains first, otherwise just add new uses to them. */
+
static void
-df_reg_use_chain_create (struct df *df, bitmap blocks)
+df_reg_use_chain_create (struct df *df, bitmap blocks, bool redo)
{
basic_block bb;
+#ifdef ENABLE_CHECKING
+ unsigned regno;
+#endif
+ unsigned old_use_id_save = df->use_id_save;
+
+ if (redo)
+ {
+#ifdef ENABLE_CHECKING
+ for (regno = 0; regno < df->n_regs; regno++)
+ if (df->regs[regno].uses)
+ abort ();
+#endif
+
+ /* Pretend that all uses are new. */
+ df->use_id_save = 0;
+ }
FOR_EACH_BB_IN_BITMAP (blocks, 0, bb,
{
df_bb_reg_use_chain_create (df, bb);
});
+
+ df->use_id_save = old_use_id_save;
}
+/* Remove all reg-use chains stored in the dataflow object DF. */
+
+static void
+df_reg_use_chain_clean (struct df *df)
+{
+ unsigned regno;
+
+ for (regno = 0; regno < df->n_regs; regno++)
+ free_reg_ref_chain (&df->regs[regno].uses);
+}
/* Create def-use chains from reaching use bitmaps for basic block BB. */
static void
@@ -1361,8 +1454,7 @@ df_bb_du_chain_create (struct df *df, basic_block bb, bitmap ru)
/* For each def in BB create a linked list (chain) of uses
reached from the def. */
- for (insn = BB_END (bb); insn && insn != PREV_INSN (BB_HEAD (bb));
- insn = PREV_INSN (insn))
+ FOR_BB_INSNS_REVERSE (bb, insn)
{
struct df_link *def_link;
struct df_link *use_link;
@@ -1438,8 +1530,7 @@ df_bb_ud_chain_create (struct df *df, basic_block bb)
/* For each use in BB create a linked list (chain) of defs
that reach the use. */
- for (insn = BB_HEAD (bb); insn && insn != NEXT_INSN (BB_END (bb));
- insn = NEXT_INSN (insn))
+ FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);
struct df_link *use_link;
@@ -1515,8 +1606,8 @@ df_ud_chain_create (struct df *df, bitmap blocks)
static void
-df_rd_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, bitmap in,
- bitmap out, bitmap gen, bitmap kill,
+df_rd_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, void *in,
+ void *out, void *gen, void *kill,
void *data ATTRIBUTE_UNUSED)
{
*changed = bitmap_union_of_diff (out, gen, in, kill);
@@ -1524,8 +1615,8 @@ df_rd_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, bitmap in,
static void
-df_ru_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, bitmap in,
- bitmap out, bitmap gen, bitmap kill,
+df_ru_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, void *in,
+ void *out, void *gen, void *kill,
void *data ATTRIBUTE_UNUSED)
{
*changed = bitmap_union_of_diff (in, gen, out, kill);
@@ -1533,8 +1624,8 @@ df_ru_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, bitmap in,
static void
-df_lr_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, bitmap in,
- bitmap out, bitmap use, bitmap def,
+df_lr_transfer_function (int bb ATTRIBUTE_UNUSED, int *changed, void *in,
+ void *out, void *use, void *def,
void *data ATTRIBUTE_UNUSED)
{
*changed = bitmap_union_of_diff (in, use, out, def);
@@ -1548,8 +1639,7 @@ df_bb_rd_local_compute (struct df *df, basic_block bb)
struct bb_info *bb_info = DF_BB_INFO (df, bb);
rtx insn;
- for (insn = BB_HEAD (bb); insn && insn != NEXT_INSN (BB_END (bb));
- insn = NEXT_INSN (insn))
+ FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);
struct df_link *def_link;
@@ -1581,8 +1671,6 @@ df_bb_rd_local_compute (struct df *df, basic_block bb)
bitmap_set_bit (bb_info->rd_gen, DF_REF_ID (def));
}
}
-
- bb_info->rd_valid = 1;
}
@@ -1612,8 +1700,7 @@ df_bb_ru_local_compute (struct df *df, basic_block bb)
rtx insn;
- for (insn = BB_END (bb); insn && insn != PREV_INSN (BB_HEAD (bb));
- insn = PREV_INSN (insn))
+ FOR_BB_INSNS_REVERSE (bb, insn)
{
unsigned int uid = INSN_UID (insn);
struct df_link *def_link;
@@ -1650,7 +1737,6 @@ df_bb_ru_local_compute (struct df *df, basic_block bb)
bitmap_set_bit (bb_info->ru_gen, DF_REF_ID (use));
}
}
- bb_info->ru_valid = 1;
}
@@ -1675,8 +1761,7 @@ df_bb_lr_local_compute (struct df *df, basic_block bb)
struct bb_info *bb_info = DF_BB_INFO (df, bb);
rtx insn;
- for (insn = BB_END (bb); insn && insn != PREV_INSN (BB_HEAD (bb));
- insn = PREV_INSN (insn))
+ FOR_BB_INSNS_REVERSE (bb, insn)
{
unsigned int uid = INSN_UID (insn);
struct df_link *link;
@@ -1702,7 +1787,6 @@ df_bb_lr_local_compute (struct df *df, basic_block bb)
bitmap_set_bit (bb_info->lr_use, DF_REF_REGNO (use));
}
}
- bb_info->lr_valid = 1;
}
@@ -1730,8 +1814,7 @@ df_bb_reg_info_compute (struct df *df, basic_block bb, bitmap live)
bitmap_copy (live, bb_info->lr_out);
- for (insn = BB_END (bb); insn && insn != PREV_INSN (BB_HEAD (bb));
- insn = PREV_INSN (insn))
+ FOR_BB_INSNS_REVERSE (bb, insn)
{
unsigned int uid = INSN_UID (insn);
unsigned int regno;
@@ -1796,14 +1879,11 @@ df_bb_luids_set (struct df *df, basic_block bb)
/* The LUIDs are monotonically increasing for each basic block. */
- for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
+ FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
DF_INSN_LUID (df, insn) = luid++;
DF_INSN_LUID (df, insn) = luid;
-
- if (insn == BB_END (bb))
- break;
}
return luid;
}
@@ -1833,6 +1913,7 @@ df_analyze_1 (struct df *df, bitmap blocks, int flags, int update)
int dflags;
int i;
basic_block bb;
+ struct dataflow dflow;
dflags = 0;
aflags = flags;
@@ -1854,7 +1935,7 @@ df_analyze_1 (struct df *df, bitmap blocks, int flags, int update)
df->flags = flags;
if (update)
{
- df_refs_update (df);
+ df_refs_update (df, NULL);
/* More fine grained incremental dataflow analysis would be
nice. For now recompute the whole shebang for the
modified blocks. */
@@ -1878,7 +1959,7 @@ df_analyze_1 (struct df *df, bitmap blocks, int flags, int update)
/* Allocate the bitmaps now the total number of defs and uses are
known. If the number of defs or uses have changed, then
these bitmaps need to be reallocated. */
- df_bitmaps_alloc (df, aflags);
+ df_bitmaps_alloc (df, NULL, aflags);
/* Set the LUIDs for each specified basic block. */
df_luids_set (df, blocks);
@@ -1889,12 +1970,12 @@ df_analyze_1 (struct df *df, bitmap blocks, int flags, int update)
regs local to a basic block as it speeds up searching. */
if (aflags & DF_RD_CHAIN)
{
- df_reg_def_chain_create (df, blocks);
+ df_reg_def_chain_create (df, blocks, false);
}
if (aflags & DF_RU_CHAIN)
{
- df_reg_use_chain_create (df, blocks);
+ df_reg_use_chain_create (df, blocks, false);
}
df->dfs_order = xmalloc (sizeof (int) * n_basic_blocks);
@@ -1915,27 +1996,33 @@ df_analyze_1 (struct df *df, bitmap blocks, int flags, int update)
if (aflags & DF_RD)
{
/* Compute the sets of gens and kills for the defs of each bb. */
+ dflow.in = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.out = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.gen = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.kill = xmalloc (sizeof (bitmap) * last_basic_block);
+
df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
- {
- bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
- FOR_EACH_BB (bb)
- {
- in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
- out[bb->index] = DF_BB_INFO (df, bb)->rd_out;
- gen[bb->index] = DF_BB_INFO (df, bb)->rd_gen;
- kill[bb->index] = DF_BB_INFO (df, bb)->rd_kill;
- }
- iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
- DF_FORWARD, DF_UNION, df_rd_transfer_function,
- df->inverse_rc_map, NULL);
- free (in);
- free (out);
- free (gen);
- free (kill);
- }
+ FOR_EACH_BB (bb)
+ {
+ dflow.in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
+ dflow.out[bb->index] = DF_BB_INFO (df, bb)->rd_out;
+ dflow.gen[bb->index] = DF_BB_INFO (df, bb)->rd_gen;
+ dflow.kill[bb->index] = DF_BB_INFO (df, bb)->rd_kill;
+ }
+
+ dflow.repr = SR_BITMAP;
+ dflow.dir = DF_FORWARD;
+ dflow.conf_op = DF_UNION;
+ dflow.transfun = df_rd_transfer_function;
+ dflow.n_blocks = n_basic_blocks;
+ dflow.order = df->rc_order;
+ dflow.data = NULL;
+
+ iterative_dataflow (&dflow);
+ free (dflow.in);
+ free (dflow.out);
+ free (dflow.gen);
+ free (dflow.kill);
}
if (aflags & DF_UD_CHAIN)
@@ -1951,27 +2038,34 @@ df_analyze_1 (struct df *df, bitmap blocks, int flags, int update)
{
/* Compute the sets of gens and kills for the upwards exposed
uses in each bb. */
+ dflow.in = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.out = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.gen = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.kill = xmalloc (sizeof (bitmap) * last_basic_block);
+
df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
- {
- bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
- FOR_EACH_BB (bb)
- {
- in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
- out[bb->index] = DF_BB_INFO (df, bb)->ru_out;
- gen[bb->index] = DF_BB_INFO (df, bb)->ru_gen;
- kill[bb->index] = DF_BB_INFO (df, bb)->ru_kill;
- }
- iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
- DF_BACKWARD, DF_UNION, df_ru_transfer_function,
- df->inverse_rts_map, NULL);
- free (in);
- free (out);
- free (gen);
- free (kill);
- }
+
+ FOR_EACH_BB (bb)
+ {
+ dflow.in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
+ dflow.out[bb->index] = DF_BB_INFO (df, bb)->ru_out;
+ dflow.gen[bb->index] = DF_BB_INFO (df, bb)->ru_gen;
+ dflow.kill[bb->index] = DF_BB_INFO (df, bb)->ru_kill;
+ }
+
+ dflow.repr = SR_BITMAP;
+ dflow.dir = DF_BACKWARD;
+ dflow.conf_op = DF_UNION;
+ dflow.transfun = df_ru_transfer_function;
+ dflow.n_blocks = n_basic_blocks;
+ dflow.order = df->rts_order;
+ dflow.data = NULL;
+
+ iterative_dataflow (&dflow);
+ free (dflow.in);
+ free (dflow.out);
+ free (dflow.gen);
+ free (dflow.kill);
}
if (aflags & DF_DU_CHAIN)
@@ -1990,27 +2084,34 @@ df_analyze_1 (struct df *df, bitmap blocks, int flags, int update)
if (aflags & DF_LR)
{
/* Compute the sets of defs and uses of live variables. */
+ dflow.in = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.out = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.gen = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.kill = xmalloc (sizeof (bitmap) * last_basic_block);
+
df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
- {
- bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *use = xmalloc (sizeof (bitmap) * last_basic_block);
- bitmap *def = xmalloc (sizeof (bitmap) * last_basic_block);
- FOR_EACH_BB (bb)
- {
- in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
- out[bb->index] = DF_BB_INFO (df, bb)->lr_out;
- use[bb->index] = DF_BB_INFO (df, bb)->lr_use;
- def[bb->index] = DF_BB_INFO (df, bb)->lr_def;
- }
- iterative_dataflow_bitmap (in, out, use, def, df->all_blocks,
- DF_BACKWARD, DF_UNION, df_lr_transfer_function,
- df->inverse_rts_map, NULL);
- free (in);
- free (out);
- free (use);
- free (def);
- }
+
+ FOR_EACH_BB (bb)
+ {
+ dflow.in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
+ dflow.out[bb->index] = DF_BB_INFO (df, bb)->lr_out;
+ dflow.gen[bb->index] = DF_BB_INFO (df, bb)->lr_use;
+ dflow.kill[bb->index] = DF_BB_INFO (df, bb)->lr_def;
+ }
+
+ dflow.repr = SR_BITMAP;
+ dflow.dir = DF_BACKWARD;
+ dflow.conf_op = DF_UNION;
+ dflow.transfun = df_lr_transfer_function;
+ dflow.n_blocks = n_basic_blocks;
+ dflow.order = df->rts_order;
+ dflow.data = NULL;
+
+ iterative_dataflow (&dflow);
+ free (dflow.in);
+ free (dflow.out);
+ free (dflow.gen);
+ free (dflow.kill);
}
if (aflags & DF_REG_INFO)
@@ -2097,7 +2198,7 @@ df_bb_refs_update (struct df *df, basic_block bb)
a bitmap for insns_modified saves memory and avoids queuing
duplicates. */
- for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
+ FOR_BB_INSNS (bb, insn)
{
unsigned int uid;
@@ -2113,8 +2214,6 @@ df_bb_refs_update (struct df *df, basic_block bb)
count++;
}
- if (insn == BB_END (bb))
- break;
}
return count;
}
@@ -2122,20 +2221,31 @@ df_bb_refs_update (struct df *df, basic_block bb)
/* Process all the modified/deleted insns that were queued. */
static int
-df_refs_update (struct df *df)
+df_refs_update (struct df *df, bitmap blocks)
{
basic_block bb;
- int count = 0;
+ int count = 0, bbno;
- if ((unsigned int) max_reg_num () >= df->reg_size)
+ df->n_regs = max_reg_num ();
+ if (df->n_regs >= df->reg_size)
df_reg_table_realloc (df, 0);
df_refs_queue (df);
- FOR_EACH_BB_IN_BITMAP (df->bbs_modified, 0, bb,
+ if (!blocks)
{
- count += df_bb_refs_update (df, bb);
- });
+ FOR_EACH_BB_IN_BITMAP (df->bbs_modified, 0, bb,
+ {
+ count += df_bb_refs_update (df, bb);
+ });
+ }
+ else
+ {
+ EXECUTE_IF_AND_IN_BITMAP (df->bbs_modified, blocks, 0, bbno,
+ {
+ count += df_bb_refs_update (df, BASIC_BLOCK (bbno));
+ });
+ }
df_refs_process (df);
return count;
@@ -2164,10 +2274,10 @@ df_modified_p (struct df *df, bitmap blocks)
return update;
}
-
/* Analyze dataflow info for the basic blocks specified by the bitmap
BLOCKS, or for the whole CFG if BLOCKS is zero, or just for the
modified blocks if BLOCKS is -1. */
+
int
df_analyze (struct df *df, bitmap blocks, int flags)
{
@@ -2209,6 +2319,218 @@ df_analyze (struct df *df, bitmap blocks, int flags)
return update;
}
+/* Remove the entries not in BLOCKS from the LIST of length LEN, preserving
+ the order of the remaining entries. Returns the length of the resulting
+ list. */
+
+static unsigned
+prune_to_subcfg (int list[], unsigned len, bitmap blocks)
+{
+ unsigned act, last;
+
+ for (act = 0, last = 0; act < len; act++)
+ if (bitmap_bit_p (blocks, list[act]))
+ list[last++] = list[act];
+
+ return last;
+}
+
+/* Alternative entry point to the analysis. Analyse just the part of the cfg
+ graph induced by BLOCKS.
+
+ TODO I am not quite sure how to avoid code duplication with df_analyze_1
+ here, and simultaneously not make even greater chaos in it. We behave
+ slightly differently in some details, especially in handling modified
+ insns. */
+
+void
+df_analyze_subcfg (struct df *df, bitmap blocks, int flags)
+{
+ rtx insn;
+ basic_block bb;
+ struct dataflow dflow;
+ unsigned n_blocks;
+
+ if (flags & DF_UD_CHAIN)
+ flags |= DF_RD | DF_RD_CHAIN;
+ if (flags & DF_DU_CHAIN)
+ flags |= DF_RU;
+ if (flags & DF_RU)
+ flags |= DF_RU_CHAIN;
+ if (flags & DF_REG_INFO)
+ flags |= DF_LR;
+
+ if (!df->n_bbs)
+ {
+ df_alloc (df, max_reg_num ());
+
+ /* Mark all insns as modified. */
+
+ FOR_EACH_BB (bb)
+ {
+ FOR_BB_INSNS (bb, insn)
+ {
+ df_insn_modify (df, bb, insn);
+ }
+ }
+ }
+
+ df_reg_def_chain_clean (df);
+ df_reg_use_chain_clean (df);
+
+ df_refs_update (df, blocks);
+
+ /* Clear the updated stuff from ``modified'' bitmaps. */
+ FOR_EACH_BB_IN_BITMAP (blocks, 0, bb,
+ {
+ if (bitmap_bit_p (df->bbs_modified, bb->index))
+ {
+ FOR_BB_INSNS (bb, insn)
+ {
+ bitmap_clear_bit (df->insns_modified, INSN_UID (insn));
+ }
+
+ bitmap_clear_bit (df->bbs_modified, bb->index);
+ }
+ });
+
+ /* Allocate the bitmaps now the total number of defs and uses are
+ known. If the number of defs or uses have changed, then
+ these bitmaps need to be reallocated. */
+ df_bitmaps_alloc (df, blocks, flags);
+
+ /* Set the LUIDs for each specified basic block. */
+ df_luids_set (df, blocks);
+
+ /* Recreate reg-def and reg-use chains from scratch so that first
+ def is at the head of the reg-def chain and the last use is at
+ the head of the reg-use chain. This is only important for
+ regs local to a basic block as it speeds up searching. */
+ if (flags & DF_RD_CHAIN)
+ {
+ df_reg_def_chain_create (df, blocks, true);
+ }
+
+ if (flags & DF_RU_CHAIN)
+ {
+ df_reg_use_chain_create (df, blocks, true);
+ }
+
+ df->dfs_order = xmalloc (sizeof (int) * n_basic_blocks);
+ df->rc_order = xmalloc (sizeof (int) * n_basic_blocks);
+ df->rts_order = xmalloc (sizeof (int) * n_basic_blocks);
+
+ flow_depth_first_order_compute (df->dfs_order, df->rc_order);
+ flow_reverse_top_sort_order_compute (df->rts_order);
+
+ n_blocks = prune_to_subcfg (df->dfs_order, n_basic_blocks, blocks);
+ prune_to_subcfg (df->rc_order, n_basic_blocks, blocks);
+ prune_to_subcfg (df->rts_order, n_basic_blocks, blocks);
+
+ dflow.in = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.out = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.gen = xmalloc (sizeof (bitmap) * last_basic_block);
+ dflow.kill = xmalloc (sizeof (bitmap) * last_basic_block);
+
+ if (flags & DF_RD)
+ {
+ /* Compute the sets of gens and kills for the defs of each bb. */
+ df_rd_local_compute (df, blocks);
+
+ FOR_EACH_BB_IN_BITMAP (blocks, 0, bb,
+ {
+ dflow.in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
+ dflow.out[bb->index] = DF_BB_INFO (df, bb)->rd_out;
+ dflow.gen[bb->index] = DF_BB_INFO (df, bb)->rd_gen;
+ dflow.kill[bb->index] = DF_BB_INFO (df, bb)->rd_kill;
+ });
+
+ dflow.repr = SR_BITMAP;
+ dflow.dir = DF_FORWARD;
+ dflow.conf_op = DF_UNION;
+ dflow.transfun = df_rd_transfer_function;
+ dflow.n_blocks = n_blocks;
+ dflow.order = df->rc_order;
+ dflow.data = NULL;
+
+ iterative_dataflow (&dflow);
+ }
+
+ if (flags & DF_UD_CHAIN)
+ {
+ /* Create use-def chains. */
+ df_ud_chain_create (df, blocks);
+ }
+
+ if (flags & DF_RU)
+ {
+ /* Compute the sets of gens and kills for the upwards exposed
+ uses in each bb. */
+ df_ru_local_compute (df, blocks);
+
+ FOR_EACH_BB_IN_BITMAP (blocks, 0, bb,
+ {
+ dflow.in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
+ dflow.out[bb->index] = DF_BB_INFO (df, bb)->ru_out;
+ dflow.gen[bb->index] = DF_BB_INFO (df, bb)->ru_gen;
+ dflow.kill[bb->index] = DF_BB_INFO (df, bb)->ru_kill;
+ });
+
+ dflow.repr = SR_BITMAP;
+ dflow.dir = DF_BACKWARD;
+ dflow.conf_op = DF_UNION;
+ dflow.transfun = df_ru_transfer_function;
+ dflow.n_blocks = n_blocks;
+ dflow.order = df->rts_order;
+ dflow.data = NULL;
+
+ iterative_dataflow (&dflow);
+ }
+
+ if (flags & DF_DU_CHAIN)
+ {
+ /* Create def-use chains. */
+ df_du_chain_create (df, blocks);
+ }
+
+ if (flags & DF_LR)
+ {
+ /* Compute the sets of defs and uses of live variables. */
+ df_lr_local_compute (df, blocks);
+
+ FOR_EACH_BB (bb)
+ {
+ dflow.in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
+ dflow.out[bb->index] = DF_BB_INFO (df, bb)->lr_out;
+ dflow.gen[bb->index] = DF_BB_INFO (df, bb)->lr_use;
+ dflow.kill[bb->index] = DF_BB_INFO (df, bb)->lr_def;
+ }
+
+ dflow.repr = SR_BITMAP;
+ dflow.dir = DF_BACKWARD;
+ dflow.conf_op = DF_UNION;
+ dflow.transfun = df_lr_transfer_function;
+ dflow.n_blocks = n_blocks;
+ dflow.order = df->rts_order;
+ dflow.data = NULL;
+
+ iterative_dataflow (&dflow);
+ }
+
+ if (flags & DF_REG_INFO)
+ {
+ df_reg_info_compute (df, blocks);
+ }
+
+ free (dflow.in);
+ free (dflow.out);
+ free (dflow.gen);
+ free (dflow.kill);
+
+ free (df->dfs_order);
+ free (df->rc_order);
+ free (df->rts_order);
+}
/* Free all the dataflow info and the DF structure. */
void
@@ -2218,7 +2540,6 @@ df_finish (struct df *df)
free (df);
}
-
/* Unlink INSN from its reference information. */
static void
df_insn_refs_unlink (struct df *df, basic_block bb ATTRIBUTE_UNUSED, rtx insn)
@@ -2306,6 +2627,16 @@ df_insn_delete (struct df *df, basic_block bb ATTRIBUTE_UNUSED, rtx insn)
return NEXT_INSN (insn);
}
+/* Mark that basic block BB was modified. */
+
+static void
+df_bb_modify (struct df *df, basic_block bb)
+{
+ if ((unsigned) bb->index >= df->n_bbs)
+ df_bb_table_realloc (df, df->n_bbs);
+
+ bitmap_set_bit (df->bbs_modified, bb->index);
+}
/* Mark that INSN within BB may have changed (created/modified/deleted).
This may be called multiple times for the same insn. There is no
@@ -2320,7 +2651,7 @@ df_insn_modify (struct df *df, basic_block bb, rtx insn)
if (uid >= df->insn_size)
df_insn_table_realloc (df, uid);
- bitmap_set_bit (df->bbs_modified, bb->index);
+ df_bb_modify (df, bb);
bitmap_set_bit (df->insns_modified, uid);
/* For incremental updating on the fly, perhaps we could make a copy
@@ -2330,7 +2661,6 @@ df_insn_modify (struct df *df, basic_block bb, rtx insn)
will just get ignored. */
}
-
typedef struct replace_args
{
rtx match;
@@ -2688,6 +3018,20 @@ df_insn_regno_def_p (struct df *df, basic_block bb ATTRIBUTE_UNUSED,
return 0;
}
+/* Finds the reference corresponding to the definition of REG in INSN.
+ DF is the dataflow object. */
+
+struct ref *
+df_find_def (struct df *df, rtx insn, rtx reg)
+{
+ struct df_link *defs;
+
+ for (defs = DF_INSN_DEFS (df, insn); defs; defs = defs->next)
+ if (rtx_equal_p (DF_REF_REG (defs->ref), reg))
+ return defs->ref;
+
+ return NULL;
+}
static int
df_def_dominates_all_uses_p (struct df *df ATTRIBUTE_UNUSED, struct ref *def)
@@ -3344,354 +3688,193 @@ debug_df_chain (struct df_link *link)
}
-/* Hybrid search algorithm from "Implementation Techniques for
- Efficient Data-Flow Analysis of Large Programs". */
static void
-hybrid_search_bitmap (basic_block block, bitmap *in, bitmap *out, bitmap *gen,
- bitmap *kill, enum df_flow_dir dir,
- enum df_confluence_op conf_op,
- transfer_function_bitmap transfun, sbitmap visited,
- sbitmap pending, void *data)
+dataflow_set_a_op_b (enum set_representation repr,
+ enum df_confluence_op op,
+ void *rslt, void *op1, void *op2)
{
- int changed;
- int i = block->index;
- edge e;
- basic_block bb = block;
-
- SET_BIT (visited, block->index);
- if (TEST_BIT (pending, block->index))
+ switch (repr)
{
- if (dir == DF_FORWARD)
- {
- /* Calculate <conf_op> of predecessor_outs. */
- bitmap_zero (in[i]);
- for (e = bb->pred; e != 0; e = e->pred_next)
- {
- if (e->src == ENTRY_BLOCK_PTR)
- continue;
- switch (conf_op)
- {
- case DF_UNION:
- bitmap_a_or_b (in[i], in[i], out[e->src->index]);
- break;
- case DF_INTERSECTION:
- bitmap_a_and_b (in[i], in[i], out[e->src->index]);
- break;
- }
- }
- }
- else
- {
- /* Calculate <conf_op> of successor ins. */
- bitmap_zero (out[i]);
- for (e = bb->succ; e != 0; e = e->succ_next)
- {
- if (e->dest == EXIT_BLOCK_PTR)
- continue;
- switch (conf_op)
- {
- case DF_UNION:
- bitmap_a_or_b (out[i], out[i], in[e->dest->index]);
- break;
- case DF_INTERSECTION:
- bitmap_a_and_b (out[i], out[i], in[e->dest->index]);
- break;
- }
- }
- }
- /* Common part */
- (*transfun)(i, &changed, in[i], out[i], gen[i], kill[i], data);
- RESET_BIT (pending, i);
- if (changed)
+ case SR_SBITMAP:
+ switch (op)
{
- if (dir == DF_FORWARD)
- {
- for (e = bb->succ; e != 0; e = e->succ_next)
- {
- if (e->dest == EXIT_BLOCK_PTR || e->dest->index == i)
- continue;
- SET_BIT (pending, e->dest->index);
- }
- }
- else
- {
- for (e = bb->pred; e != 0; e = e->pred_next)
- {
- if (e->src == ENTRY_BLOCK_PTR || e->dest->index == i)
- continue;
- SET_BIT (pending, e->src->index);
- }
- }
+ case DF_UNION:
+ sbitmap_a_or_b (rslt, op1, op2);
+ break;
+
+ case DF_INTERSECTION:
+ sbitmap_a_and_b (rslt, op1, op2);
+ break;
+
+ default:
+ abort ();
}
- }
- if (dir == DF_FORWARD)
- {
- for (e = bb->succ; e != 0; e = e->succ_next)
+ break;
+
+ case SR_BITMAP:
+ switch (op)
{
- if (e->dest == EXIT_BLOCK_PTR || e->dest->index == i)
- continue;
- if (!TEST_BIT (visited, e->dest->index))
- hybrid_search_bitmap (e->dest, in, out, gen, kill, dir,
- conf_op, transfun, visited, pending,
- data);
+ case DF_UNION:
+ bitmap_a_or_b (rslt, op1, op2);
+ break;
+
+ case DF_INTERSECTION:
+ bitmap_a_and_b (rslt, op1, op2);
+ break;
+
+ default:
+ abort ();
}
+ break;
+
+ default:
+ abort ();
}
- else
+}
+
+static void
+dataflow_set_copy (enum set_representation repr, void *dest, void *src)
+{
+ switch (repr)
{
- for (e = bb->pred; e != 0; e = e->pred_next)
- {
- if (e->src == ENTRY_BLOCK_PTR || e->src->index == i)
- continue;
- if (!TEST_BIT (visited, e->src->index))
- hybrid_search_bitmap (e->src, in, out, gen, kill, dir,
- conf_op, transfun, visited, pending,
- data);
- }
+ case SR_SBITMAP:
+ sbitmap_copy (dest, src);
+ break;
+
+ case SR_BITMAP:
+ bitmap_copy (dest, src);
+ break;
+
+ default:
+ abort ();
}
}
+/* Hybrid search algorithm from "Implementation Techniques for
+ Efficient Data-Flow Analysis of Large Programs". */
-/* Hybrid search for sbitmaps, rather than bitmaps. */
static void
-hybrid_search_sbitmap (basic_block block, sbitmap *in, sbitmap *out,
- sbitmap *gen, sbitmap *kill, enum df_flow_dir dir,
- enum df_confluence_op conf_op,
- transfer_function_sbitmap transfun, sbitmap visited,
- sbitmap pending, void *data)
+hybrid_search (basic_block bb, struct dataflow *dataflow,
+ sbitmap visited, sbitmap pending, sbitmap considered)
{
int changed;
- int i = block->index;
+ int i = bb->index;
edge e;
- basic_block bb = block;
- SET_BIT (visited, block->index);
- if (TEST_BIT (pending, block->index))
- {
- if (dir == DF_FORWARD)
- {
- /* Calculate <conf_op> of predecessor_outs. */
- sbitmap_zero (in[i]);
- for (e = bb->pred; e != 0; e = e->pred_next)
- {
- if (e->src == ENTRY_BLOCK_PTR)
- continue;
- switch (conf_op)
- {
- case DF_UNION:
- sbitmap_a_or_b (in[i], in[i], out[e->src->index]);
- break;
- case DF_INTERSECTION:
- sbitmap_a_and_b (in[i], in[i], out[e->src->index]);
- break;
- }
- }
- }
- else
- {
- /* Calculate <conf_op> of successor ins. */
- sbitmap_zero (out[i]);
- for (e = bb->succ; e != 0; e = e->succ_next)
- {
- if (e->dest == EXIT_BLOCK_PTR)
- continue;
- switch (conf_op)
- {
- case DF_UNION:
- sbitmap_a_or_b (out[i], out[i], in[e->dest->index]);
- break;
- case DF_INTERSECTION:
- sbitmap_a_and_b (out[i], out[i], in[e->dest->index]);
- break;
- }
- }
- }
- /* Common part. */
- (*transfun)(i, &changed, in[i], out[i], gen[i], kill[i], data);
- RESET_BIT (pending, i);
- if (changed)
- {
- if (dir == DF_FORWARD)
- {
- for (e = bb->succ; e != 0; e = e->succ_next)
- {
- if (e->dest == EXIT_BLOCK_PTR || e->dest->index == i)
- continue;
- SET_BIT (pending, e->dest->index);
- }
- }
- else
- {
- for (e = bb->pred; e != 0; e = e->pred_next)
- {
- if (e->src == ENTRY_BLOCK_PTR || e->dest->index == i)
- continue;
- SET_BIT (pending, e->src->index);
- }
- }
- }
- }
- if (dir == DF_FORWARD)
- {
- for (e = bb->succ; e != 0; e = e->succ_next)
- {
- if (e->dest == EXIT_BLOCK_PTR || e->dest->index == i)
- continue;
- if (!TEST_BIT (visited, e->dest->index))
- hybrid_search_sbitmap (e->dest, in, out, gen, kill, dir,
- conf_op, transfun, visited, pending,
- data);
- }
- }
+ SET_BIT (visited, bb->index);
+ if (!TEST_BIT (pending, bb->index))
+ abort ();
+ RESET_BIT (pending, i);
+
+#define HS(E_ANTI, E_ANTI_NEXT, E_ANTI_BB, E_ANTI_START_BB, IN_SET, \
+ E, E_NEXT, E_BB, E_START_BB, OUT_SET) \
+ do \
+ { \
+ /* Calculate <conf_op> of predecessor_outs. */ \
+ bitmap_zero (IN_SET[i]); \
+ for (e = bb->E_ANTI; e; e = e->E_ANTI_NEXT) \
+ { \
+ if (e->E_ANTI_BB == E_ANTI_START_BB) \
+ continue; \
+ if (!TEST_BIT (considered, e->E_ANTI_BB->index)) \
+ continue; \
+ \
+ dataflow_set_a_op_b (dataflow->repr, dataflow->conf_op, \
+ IN_SET[i], IN_SET[i], \
+ OUT_SET[e->E_ANTI_BB->index]); \
+ } \
+ \
+ (*dataflow->transfun)(i, &changed, \
+ dataflow->in[i], dataflow->out[i], \
+ dataflow->gen[i], dataflow->kill[i], \
+ dataflow->data); \
+ \
+ if (!changed) \
+ break; \
+ \
+ for (e = bb->E; e; e = e->E_NEXT) \
+ { \
+ if (e->E_BB == E_START_BB || e->E_BB->index == i) \
+ continue; \
+ \
+ if (!TEST_BIT (considered, e->E_BB->index)) \
+ continue; \
+ \
+ SET_BIT (pending, e->E_BB->index); \
+ } \
+ \
+ for (e = bb->E; e; e = e->E_NEXT) \
+ { \
+ if (e->E_BB == E_START_BB || e->E_BB->index == i) \
+ continue; \
+ \
+ if (!TEST_BIT (considered, e->E_BB->index)) \
+ continue; \
+ \
+ if (!TEST_BIT (visited, e->E_BB->index)) \
+ hybrid_search (e->E_BB, dataflow, visited, pending, considered); \
+ } \
+ } while (0)
+
+ if (dataflow->dir == DF_FORWARD)
+ HS (pred, pred_next, src, ENTRY_BLOCK_PTR, dataflow->in,
+ succ, succ_next, dest, EXIT_BLOCK_PTR, dataflow->out);
else
- {
- for (e = bb->pred; e != 0; e = e->pred_next)
- {
- if (e->src == ENTRY_BLOCK_PTR || e->src->index == i)
- continue;
- if (!TEST_BIT (visited, e->src->index))
- hybrid_search_sbitmap (e->src, in, out, gen, kill, dir,
- conf_op, transfun, visited, pending,
- data);
- }
- }
+ HS (succ, succ_next, dest, EXIT_BLOCK_PTR, dataflow->out,
+ pred, pred_next, src, ENTRY_BLOCK_PTR, dataflow->in);
}
-
-/* gen = GEN set.
- kill = KILL set.
- in, out = Filled in by function.
- blocks = Blocks to analyze.
- dir = Dataflow direction.
- conf_op = Confluence operation.
- transfun = Transfer function.
- order = Order to iterate in. (Should map block numbers -> order)
- data = Whatever you want. It's passed to the transfer function.
-
- This function will perform iterative bitvector dataflow, producing
- the in and out sets. Even if you only want to perform it for a
- small number of blocks, the vectors for in and out must be large
- enough for *all* blocks, because changing one block might affect
- others. However, it'll only put what you say to analyze on the
- initial worklist.
+/* This function will perform iterative bitvector dataflow described by
+ DATAFLOW, producing the in and out sets. Only the part of the cfg
+ induced by blocks in DATAFLOW->order is taken into account.
For forward problems, you probably want to pass in a mapping of
- block number to rc_order (like df->inverse_rc_map).
-*/
+ block number to rc_order (like df->inverse_rc_map). */
+
void
-iterative_dataflow_sbitmap (sbitmap *in, sbitmap *out, sbitmap *gen,
- sbitmap *kill, bitmap blocks,
- enum df_flow_dir dir,
- enum df_confluence_op conf_op,
- transfer_function_sbitmap transfun, int *order,
- void *data)
+iterative_dataflow (struct dataflow *dataflow)
{
- int i;
- fibheap_t worklist;
- basic_block bb;
- sbitmap visited, pending;
+ unsigned i, idx;
+ sbitmap visited, pending, considered;
pending = sbitmap_alloc (last_basic_block);
visited = sbitmap_alloc (last_basic_block);
+ considered = sbitmap_alloc (last_basic_block);
sbitmap_zero (pending);
sbitmap_zero (visited);
- worklist = fibheap_new ();
-
- EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i,
- {
- fibheap_insert (worklist, order[i], (void *) (size_t) i);
- SET_BIT (pending, i);
- if (dir == DF_FORWARD)
- sbitmap_copy (out[i], gen[i]);
- else
- sbitmap_copy (in[i], gen[i]);
- });
+ sbitmap_zero (considered);
- while (sbitmap_first_set_bit (pending) != -1)
+ for (i = 0; i < dataflow->n_blocks; i++)
{
- while (!fibheap_empty (worklist))
- {
- i = (size_t) fibheap_extract_min (worklist);
- bb = BASIC_BLOCK (i);
- if (!TEST_BIT (visited, bb->index))
- hybrid_search_sbitmap (bb, in, out, gen, kill, dir,
- conf_op, transfun, visited, pending, data);
- }
-
- if (sbitmap_first_set_bit (pending) != -1)
- {
- EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i,
- {
- fibheap_insert (worklist, order[i], (void *) (size_t) i);
- });
- sbitmap_zero (visited);
- }
+ idx = dataflow->order[i];
+ SET_BIT (pending, idx);
+ SET_BIT (considered, idx);
+ if (dataflow->dir == DF_FORWARD)
+ dataflow_set_copy (dataflow->repr,
+ dataflow->out[idx], dataflow->gen[idx]);
else
- {
- break;
- }
- }
-
- sbitmap_free (pending);
- sbitmap_free (visited);
- fibheap_delete (worklist);
-}
-
-
-/* Exactly the same as iterative_dataflow_sbitmap, except it works on
- bitmaps instead. */
-void
-iterative_dataflow_bitmap (bitmap *in, bitmap *out, bitmap *gen, bitmap *kill,
- bitmap blocks, enum df_flow_dir dir,
- enum df_confluence_op conf_op,
- transfer_function_bitmap transfun, int *order,
- void *data)
-{
- int i;
- fibheap_t worklist;
- basic_block bb;
- sbitmap visited, pending;
-
- pending = sbitmap_alloc (last_basic_block);
- visited = sbitmap_alloc (last_basic_block);
- sbitmap_zero (pending);
- sbitmap_zero (visited);
- worklist = fibheap_new ();
-
- EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i,
- {
- fibheap_insert (worklist, order[i], (void *) (size_t) i);
- SET_BIT (pending, i);
- if (dir == DF_FORWARD)
- bitmap_copy (out[i], gen[i]);
- else
- bitmap_copy (in[i], gen[i]);
- });
+ dataflow_set_copy (dataflow->repr,
+ dataflow->in[idx], dataflow->gen[idx]);
+ };
- while (sbitmap_first_set_bit (pending) != -1)
+ while (1)
{
- while (!fibheap_empty (worklist))
+ for (i = 0; i < dataflow->n_blocks; i++)
{
- i = (size_t) fibheap_extract_min (worklist);
- bb = BASIC_BLOCK (i);
- if (!TEST_BIT (visited, bb->index))
- hybrid_search_bitmap (bb, in, out, gen, kill, dir,
- conf_op, transfun, visited, pending, data);
- }
+ idx = dataflow->order[i];
- if (sbitmap_first_set_bit (pending) != -1)
- {
- EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i,
- {
- fibheap_insert (worklist, order[i], (void *) (size_t) i);
- });
- sbitmap_zero (visited);
- }
- else
- {
- break;
+ if (TEST_BIT (pending, idx) && !TEST_BIT (visited, idx))
+ hybrid_search (BASIC_BLOCK (idx), dataflow,
+ visited, pending, considered);
}
+
+ if (sbitmap_first_set_bit (pending) == -1)
+ break;
+
+ sbitmap_zero (visited);
}
+
sbitmap_free (pending);
sbitmap_free (visited);
- fibheap_delete (worklist);
+ sbitmap_free (considered);
}
diff --git a/gcc/df.h b/gcc/df.h
index 14aea52a766..3e215177903 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -84,6 +84,7 @@ struct ref
unsigned int id; /* Ref index. */
enum df_ref_type type; /* Type of ref. */
enum df_ref_flags flags; /* Various flags. */
+ void *data; /* The data assigned to it by user. */
};
@@ -196,6 +197,7 @@ struct df_map
#define DF_REF_CHAIN(REF) ((REF)->chain)
#define DF_REF_ID(REF) ((REF)->id)
#define DF_REF_FLAGS(REF) ((REF)->flags)
+#define DF_REF_DATA(REF) ((REF)->data)
/* Macros to determine the reference type. */
@@ -234,6 +236,7 @@ struct df_map
extern struct df *df_init (void);
extern int df_analyze (struct df *, bitmap, int);
+extern void df_analyze_subcfg (struct df *, bitmap, int);
extern void df_finish (struct df *);
@@ -292,6 +295,7 @@ extern int df_bb_regs_lives_compare (struct df *, basic_block, rtx, rtx);
extern rtx df_bb_single_def_use_insn_find (struct df *, basic_block, rtx,
rtx);
+extern struct ref *df_find_def (struct df *, rtx, rtx);
/* Functions for debugging from GDB. */
@@ -330,22 +334,37 @@ enum df_flow_dir
};
-typedef void (*transfer_function_sbitmap) (int, int *, sbitmap, sbitmap,
- sbitmap, sbitmap, void *);
+typedef void (*transfer_function) (int, int *, void *, void *,
+ void *, void *, void *);
-typedef void (*transfer_function_bitmap) (int, int *, bitmap, bitmap,
- bitmap, bitmap, void *);
+/* The description of a dataflow problem to solve. */
-extern void iterative_dataflow_sbitmap (sbitmap *, sbitmap *, sbitmap *,
- sbitmap *, bitmap, enum df_flow_dir,
- enum df_confluence_op,
- transfer_function_sbitmap,
- int *, void *);
+enum set_representation
+{
+ SR_SBITMAP, /* Represent sets by bitmaps. */
+ SR_BITMAP /* Represent sets by sbitmaps. */
+};
+
+struct dataflow
+{
+ enum set_representation repr; /* The way the sets are represented. */
+
+ /* The following arrays are indexed by block indices, so they must always
+ be large enough even if we restrict ourselves just to a subset of cfg. */
+ void **gen, **kill; /* Gen and kill sets. */
+ void **in, **out; /* Results. */
+
+ enum df_flow_dir dir; /* Dataflow direction. */
+ enum df_confluence_op conf_op; /* Confluence operator. */
+ unsigned n_blocks; /* Number of basic blocks in the
+ order. */
+ int *order; /* The list of basic blocks to work
+ with, in the order they should
+ be processed in. */
+ transfer_function transfun; /* The transfer function. */
+ void *data; /* Data used by the transfer
+ function. */
+};
-extern void iterative_dataflow_bitmap (bitmap *, bitmap *, bitmap *,
- bitmap *, bitmap,
- enum df_flow_dir,
- enum df_confluence_op,
- transfer_function_bitmap,
- int *, void *);
+extern void iterative_dataflow (struct dataflow *);
extern bool read_modify_subreg_p (rtx);
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 5350d0c5531..e6ba94d55c7 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -61,12 +61,19 @@ static void real_abort (void) ATTRIBUTE_NORETURN;
static diagnostic_context global_diagnostic_context;
diagnostic_context *global_dc = &global_diagnostic_context;
+/* APPLE LOCAL error-colon */
+static int gcc_error_colon = 0;
+
/* Boilerplate text used in two locations. */
#define bug_report_request \
"Please submit a full bug report,\n\
with preprocessed source if appropriate.\n\
See %s for instructions.\n"
+/* APPLE LOCAL insert assembly ".abort" directive on fatal error */
+#ifdef EXIT_FROM_FATAL_DIAGNOSTIC
+#define exit(status) EXIT_FROM_FATAL_DIAGNOSTIC (status)
+#endif
/* Return a malloc'd string containing MSG formatted a la printf. The
caller is responsible for freeing the memory. */
@@ -87,6 +94,11 @@ build_message_string (const char *msg, ...)
char *
file_name_as_prefix (const char *f)
{
+ /* APPLE LOCAL begin error-colon */
+ if (gcc_error_colon)
+ return build_message_string ("%s: error: ", f);
+ else
+ /* APPLE LOCAL end error-colon */
return build_message_string ("%s: ", f);
}
@@ -190,6 +202,23 @@ diagnostic_count_diagnostic (diagnostic_context *context,
diagnostic_info *diagnostic)
{
diagnostic_t kind = diagnostic->kind;
+
+ /* APPLE LOCAL begin error-colon */
+ /* Here so it gets executed early on. */
+ {
+ static int done = 0;
+ if (!done)
+ {
+ done = 1; /* Do this only once. */
+ /* Pretend we saw "-w" on commandline. */
+ if (getenv ("GCC_DASH_W"))
+ inhibit_warnings = 1; /* referenced by diagnostic.h:diagnostic_report_warnings() */
+ if (getenv ("GCC_ERROR_COLON"))
+ gcc_error_colon = 1;
+ }
+ }
+ /* APPLE LOCAL end error-colon */
+
switch (kind)
{
default:
diff --git a/gcc/dmp-tree.c b/gcc/dmp-tree.c
new file mode 100644
index 00000000000..2d278da9bb7
--- /dev/null
+++ b/gcc/dmp-tree.c
@@ -0,0 +1,3695 @@
+/* APPLE LOCAL new tree dump */
+/* Common condensed tree display routines.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* This dumper is intended for used with the debugger. You call
+ dump_tree(x), where x is the node of interest. The tree display
+ produced here is much more condensed than what is produced by,
+ say, debug_tree(). Here each node is displayed as a single
+ (possibly line wrapped) line. The emphasis here is mainly on
+ the parse (front-end) trees as opposed to RTL-related info.
+
+ Here's an example of some of it's output:
+
+ compound_stmt:0xED4D0C line=74 0xED4D20
+ scope_stmt:0xED4D20 line=75 BEGIN block=0xED0300
+ block:0xED0300 vars=0xECD620 abs-orig=0x0 super=0xED0340 sub=0x0
+ var_decl:0xECD620 t=0xEA5310 {int} initial=0xED0260 line=75 comm
+ cntxt=0xECD3F0 sz=32(4) zzz
+ integer_cst:0xED0260 t=0xEA5310 {int} 0xFFFFFF9C = -100
+
+ decl_stmt:0xED4D84 line=75 var_decl=0xECD620 {int} zzz
+
+ expr_stmt:0xED4E24 line=76 0xED02E0
+ modify_expr:0xED02E0 t=0xEA5310 {int} 0xECD540 0xED4DFC
+ var_decl:0xECD540 t=0xEA5310 {int} cntxt=0xECD3F0 i
+ nop_expr:0xED4DFC t=0xEA5310 {int} 0xED02C0
+ plus_expr:0xED02C0 t=0xEA8540 {long unsigned int} 0xED4DE8 0xED02A0
+ nop_expr:0xED4DE8 t=0xEA8540 {long unsigned int} 0xED0280
+ trunc_div_expr:0xED0280 t=0xEA5310 {int} 0xECD540 0xECD620
+ var_decl:0xECD540 t=0xEA5310 {int} cntxt=0xECD3F0 i
+ var_decl:0xECD620 t=0xEA5310 {int} cntxt=0xECD3F0 zzz
+ call_expr:0xED02A0 t=0xEA8540 {long unsigned int} func=0xED4DAC args=0xED4DD4
+ addr_expr:0xED4DAC (func) t=0xECD690 {pointer_type} 0xEB0850
+ function_decl:0xEB0850 t=0xEABD90 {long unsigned int} BUILT_IN_NORMAL strlen
+ tree_list:0xED4DD4 (args) purpose=0x0 value=0xED4DC0 chain=0x0
+ nop_expr:0xED4DC0 (value) t=0xEAB1C0 {pointer_type} 0xECD4D0
+ var_decl:0xECD4D0 t=0xEA8CB0 {pointer_type} cntxt=0xECD3F0 lcl
+ scope_stmt:0xED4E38 line=77 END block=0xED0300
+
+ Each node is limited to a single line (unless it needs to be wrapped).
+ All nodes at the same nesting level are displayed at the same indenting
+ level. Each node is handled individually with code appropriate to what
+ it needs to display.
+
+ Note that unlike debug_tree() the details of the type info are not shown
+ in these trees when (as in this example) the initial node passed to
+ dmp_tree() is not a type. It is assumed that you are mainly interested
+ in the parse trees and their relationship to one another and don't need
+ the display cluttered up with each node's type info (other than it's
+ kind and address).
+
+ On the other hand you could be interested in the details of a particular
+ type. In that case call dmp_tree() specifying that type's address as
+ the initial node. When that is done a similarly formatted tree is
+ output, but now the details of that type and the types it uses are
+ shown. In the above example, 3 lines up from the bottom, there's a
+ pointer (which happens to be for a char*). Here's what
+ dmp_tree(0xEAB1C0) produces:
+
+ pointer_type:0xEAB1C0 t=0xEAB150 align=32 prec=32 sz=32(4)
+ integer_type:0xEAB150 uns const align=8 *this=0xEAB1C0 prec=8 sz=8(1)
+ min/max=0/255 char
+
+ Note, the type is fully followed (except for *this which is overkill).
+ Also illustrated is how lines are wrapped if too long for the display.
+ Here, it's illustrated assuming about a 72-character wrap point to
+ fit in these comments. In reality, the wrap point is normally the
+ terminal width. But the DMP_TREE_WRAP environment variable can be
+ set to the desired width. If neither the terminal width with nor the
+ environment variable can be accessed, or the value is outside the
+ range 72 to 512, the width is set to 130.
+
+ There are five language-specific routines that which MUST be uniquely
+ defined (via the language hooks) for that language to handle language-
+ specific attributes for certain kinds of tree nodes:
+
+ 1. void dump_identifier(FILE *file, tree node, int indent, int before_id);
+
+ Called twice for dmp_tree() for an IDENTIFIER_NODE. The first
+ call is after the common info for the node is generated but before
+ displaying the identifier (before_id==0) which is always assumed to
+ be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an newline_and_indent() call or a recursive
+ call to dump_tree() for nodes which are language specific operands
+ to a IDENTIFIER_NODE.
+
+ 2. void dump_decl(FILE *file, tree node, int indent, int before_id);
+
+ Called twice for dmp_tree() for a ..._DECL node. The first call
+ after the common info for the node is generated but before
+ displaying the identifier (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an newline_and_indent() call or a recursive
+ call to dump_tree() for nodes which are language specific operands
+ to a ..._DECL node.
+
+ 3. void dump_type(FILE *file, tree node, int indent, int before_id);
+
+ Called twice for dmp_tree() for a ..._TYPE node. The first call
+ after the common info for the node is generated but before
+ displaying the identifier (before_id==0) which is always assumed
+ to be the last thing on the line.
+
+ The second call is done after the id is displayed (before_id!=0).
+ This is for displaying any language-specific node information that
+ should be preceded by an newline_and_indent() call or a recursive
+ call to dump_tree() for nodes which are language specific operands
+ to a ..._TYPE node.
+
+ 4. int dump_blank_line_p(tree previous_node, tree current_node);
+
+ Normally a blank line is inserted before each statement node (a
+ statement node is determined by calling statement_code_p()). This
+ makes the display easier to read by keeping each statement grouped
+ like a paragraph. There may, however, be some kinds of statements
+ where a blank line isn't desired (e.g., a begin SCOPE_STMT in C).
+ Thus dump_blank_line_p() is called to ask if a particular
+ statement should be preceded by a blank line dependent upon the
+ node that preceded it.
+
+ dump_blank_line_p() is called for each statement passing the
+ previous node (not necessarily a statement) and current node (a
+ statement node by definition). It should return 1 if a blank
+ line is to be inserted and 0 otherwise.
+
+ 5. int dump_lineno_p(FILE *file, tree node);
+
+ This is called for each node to display file and/or line number
+ information for those nodes that have such information. If it
+ is displayed the function should return 1. If not, 0.
+
+ The function generally does not have to handle ..._DECL nodes
+ unless there some special handling is reequired. They are
+ handled by print_lineno() (dump_lineno_p()'s caller).
+ It is defined to not repeat the filename if it does not
+ change from what's in dump_tree_state.curr_file and then
+ it only displays the basename (using lbasename()). The
+ format of the display is " line=nbr(basename)" where the
+ leading space is included as usual in these displays and
+ the parenthesized basename omitted if not needed or is
+ the same as before.
+*/
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "real.h"
+#include "c-common.h"
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include "langhooks.h"
+
+/* c-common.h defines a macro called RETURN_EXPR. But we need to use it
+ as the enum defined by tree.def. */
+#undef RETURN_EXPR
+
+#define DMP_TREE
+#include "dmp-tree.h"
+
+#if defined(HAVE_UNISTD_H) && DMP_TREE_WRAPPED_OUTPUT
+#include <sys/ioctl.h>
+#endif
+
+#define MIN_LINE_WRAP 72 /* min wrapping column */
+#define MAX_LINE_WRAP 512 /* max wrapping column */
+#define DEFAULT_LINE_WRAP 130 /* default */
+#define DMP_TREE_LINE_WRAP "DMP_TREE_WRAP" /* environment variable */
+
+/* Notes to myself:
+
+ c-common.c, verify_tree(), c-decl.c, and cp/ptree.c look intersting!
+*/
+
+void dump_tree (FILE *file, const char *annotation, tree node, int indent);
+void dmp_tree (tree node);
+
+#define HASH_SIZE 37
+
+struct bucket
+{
+ tree node;
+ struct bucket *next;
+};
+
+static struct bucket **table;
+
+static tree *type_array = NULL;
+#define TYPE_ARRAY_INITIAL_SIZE 20000
+#define TYPE_ARRAY_INCR 10000
+static int type_array_size = 0;
+static int type_array_next = 0;
+static int type_array_incr = TYPE_ARRAY_INITIAL_SIZE;
+
+#if DMP_TREE_WRAPPED_OUTPUT
+static char curr_line[2 * MAX_LINE_WRAP];
+static int prefix_len;
+static int line_index;
+static int prev_line_was_null;
+static int prev_line_was_wrapped;
+static int wrap_column;
+#ifdef TIOCGWINSZ
+static struct winsize winsize;
+#endif
+#if defined(TIOCGSIZE) && !defined(TIOCGWINSZ)
+static struct ttysize winsize;
+#endif
+#endif /* DMP_TREE_WRAPPED_OUTPUT */
+
+dump_tree_state_t dump_tree_state = {
+ (int)LAST_AND_UNUSED_TREE_CODE, /* c */
+ -1, /* nesting_depth */
+ 0, /* dump_full_type */
+ 0, /* really_follow */
+ 0, /* doing_parm_decl */
+ 0, /* doing_call_expr */
+ NULL, /* curr_file */
+ 0, /* no_new_line */
+ 0, /* line_cnt */
+ 0, /* doing_tree_list */
+ INT_MAX, /* max_depth */
+ DMP_TREE_VISIT_ANY /* visit_only_once */
+};
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+static void print_ ## SYM (FILE *file, const char *annotation, tree node, int indent);
+#include "tree.def"
+#undef DEFTREECODE
+
+static void init_dump_state PARAMS ((tree node));
+static int no_dump_tree_p PARAMS ((FILE *file, const char *annotation, tree node, int indent));
+static void free_hash_table PARAMS ((void));
+
+static lang_dump_tree_p_t lang_dump_tree_p = no_dump_tree_p;
+
+#define CST_VALUE(node, ok) \
+ ((TREE_INT_CST_HIGH (node) == 0) \
+ ? (ok &= 1, TREE_INT_CST_LOW (node)) \
+ : ((TREE_INT_CST_HIGH (node) == -1 && TREE_INT_CST_LOW (node) != 0) \
+ ? (ok &= 1, -TREE_INT_CST_LOW (node)) \
+ : (ok = 0)))
+
+
+
+/*-------------------------------------------------------------------*/
+
+static void
+init_dump_state (node)
+ tree node;
+{
+ dump_tree_state.dump_full_type = TYPE_P (node);
+ /*dump_tree_state.nesting_depth = 0; */
+ dump_tree_state.really_follow = 1;
+ dump_tree_state.doing_parm_decl = 0;
+ dump_tree_state.doing_call_expr = 0;
+ dump_tree_state.no_new_line = 0;
+ dump_tree_state.line_cnt = 0;
+ dump_tree_state.curr_file = NULL;
+ dump_tree_state.doing_tree_list = 0;
+ /*dump_tree_state.max_depth = INT_MAX;*/
+ /*dump_tree_state.visit_only_once = DMP_TREE_VISIT_ANY;*/
+}
+
+/* Always end the current line by writing a '\n'.
+ If column > 0 then output column blanks to the next line.
+ Increment dump_tree_state.line_cnt to allow callers to
+ determine how many lines are output between any pair of
+ points. */
+
+void
+newline_and_indent (file, column)
+ FILE *file;
+ int column;
+{
+ fputc ('\n', file);
+ ++dump_tree_state.line_cnt;
+
+ if (column > 0)
+ fprintf (file, "%*c", column, ' ');
+}
+
+/* Return 1 if node has been previously seen and 0 otherwise.
+ If record_it is non-zero then record that the node was
+ seen. */
+int
+node_seen (node, record_it)
+ tree node;
+ int record_it;
+{
+ int hash;
+ struct bucket *b;
+
+ hash = ((unsigned long) node) % HASH_SIZE;
+
+ /* If node is in the table, just mention its address. */
+
+ for (b = table[hash]; b; b = b->next)
+ if (b->node == node)
+ return 1;
+
+ if (record_it)
+ {
+ b = (struct bucket *) xmalloc (sizeof (struct bucket));
+ b->node = node;
+ b->next = table[hash];
+ table[hash] = b;
+ }
+
+ return 0;
+}
+
+/* Free the hash table used to record visited nodes. */
+static void
+free_hash_table()
+{
+ int hash;
+ struct bucket *b, *next;
+
+ if (!table)
+ return;
+
+ for (hash = 0; hash < HASH_SIZE; ++hash)
+ {
+ b = table[hash];
+ while (b)
+ {
+ next = b->next;
+ free (b);
+ b = next;
+ }
+ }
+
+ free (table);
+ table = NULL;
+}
+
+
+/*-------------------------------------------------------------------*/
+
+void
+print_type (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ int newline = 0;
+
+# define PRINT_TYPE_NAME(node) \
+ if (!newline && TYPE_NAME (node)) \
+ { \
+ if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE) \
+ fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node))); \
+ else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL \
+ && DECL_NAME (TYPE_NAME (node))) \
+ fprintf (file, " %s", \
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)))); \
+ newline = 1; \
+ }
+
+ if (TYPE_CONTEXT (node))
+ {
+ fprintf (file, " cntxt=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_CONTEXT (node)));
+ }
+
+ if (TYPE_NEEDS_CONSTRUCTING (node))
+ fputs (" need-ctor", file);
+ if (TYPE_PACKED (node))
+ fputs (" packed", file);
+ if (TREE_THIS_VOLATILE (node))
+ fputs (" volatile", file);
+ if (TYPE_READONLY (node))
+ fputs (" const", file);
+ if (TYPE_RESTRICT (node))
+ fputs (" restrict", file);
+
+ if (TYPE_LANG_FLAG_0 (node)
+ || TYPE_LANG_FLAG_1 (node)
+ || TYPE_LANG_FLAG_2 (node)
+ || TYPE_LANG_FLAG_3 (node)
+ || TYPE_LANG_FLAG_4 (node)
+ || TYPE_LANG_FLAG_5 (node)
+ || TYPE_LANG_FLAG_6 (node))
+ {
+ fputs (" type-flags=#", file);
+ if (TYPE_LANG_FLAG_0 (node))
+ fputc ('0', file);
+ if (TYPE_LANG_FLAG_1 (node))
+ fputc ('1', file);
+ if (TYPE_LANG_FLAG_2 (node))
+ fputc ('2', file);
+ if (TYPE_LANG_FLAG_3 (node))
+ fputc ('3', file);
+ if (TYPE_LANG_FLAG_4 (node))
+ fputc ('4', file);
+ if (TYPE_LANG_FLAG_5 (node))
+ fputc ('5', file);
+ if (TYPE_LANG_FLAG_6 (node))
+ fputc ('6', file);
+ }
+
+ if (TYPE_USER_ALIGN (node))
+ fprintf (file, " usr-algn");
+
+ fprintf (file, " align=%d", TYPE_ALIGN (node));
+
+ if (TYPE_SYMTAB_ADDRESS (node))
+ fprintf (file, " symtab=%d", TYPE_SYMTAB_ADDRESS (node));
+
+ if (TYPE_ALIAS_SET (node) != -1)
+ {
+ fprintf (file, " alias-set=");
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, TYPE_ALIAS_SET (node));
+ }
+
+ if (TYPE_POINTER_TO (node))
+ {
+ fprintf (file, " *this=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_POINTER_TO (node)));
+ }
+
+ if (TYPE_REFERENCE_TO (node))
+ {
+ fprintf (file, " &this=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_REFERENCE_TO (node)));
+ }
+
+ if (TREE_CODE (node) == ARRAY_TYPE || TREE_CODE (node) == SET_TYPE)
+ {
+ if (TYPE_DOMAIN (node))
+ {
+ fprintf (file, " domain=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_DOMAIN (node)));
+ }
+ }
+ else if (TREE_CODE (node) == ENUMERAL_TYPE)
+ {
+ if (TYPE_VALUES (node))
+ {
+ fprintf (file, " values=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_VALUES (node)));
+ }
+ }
+ else if (TREE_CODE (node) == VECTOR_TYPE)
+ {
+ if (TYPE_DEBUG_REPRESENTATION_TYPE (node))
+ {
+ fprintf (file, " values=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_DEBUG_REPRESENTATION_TYPE (node)));
+ }
+ }
+
+ if (TYPE_ATTRIBUTES (node))
+ {
+ fprintf (file, " attr=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_ATTRIBUTES (node)));
+ }
+
+ if (TYPE_PRECISION (node))
+ fprintf (file, " prec=%d", TYPE_PRECISION (node));
+
+ if (TYPE_MAIN_VARIANT (node) != node)
+ {
+ fprintf (file, " main-variant=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_MAIN_VARIANT (node)));
+ }
+ if (TYPE_NEXT_VARIANT (node))
+ {
+ fprintf (file, " next-variant=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_NEXT_VARIANT (node)));
+ }
+
+ if (TYPE_NAME (node) && TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
+ && DECL_ORIGINAL_TYPE (TYPE_NAME (node)))
+ {
+ fprintf (file, " orig-type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_ORIGINAL_TYPE (TYPE_NAME (node))));
+ }
+
+ (void)node_seen (node, TRUE); /* prevent recursion on this node */
+
+ (*lang_hooks.dump_type) (file, node, indent, 0);
+
+ if (TYPE_SIZE (node)
+ && TREE_CODE (TYPE_SIZE (node)) == INTEGER_CST
+ && TYPE_SIZE_UNIT (node)
+ && TREE_CODE (TYPE_SIZE_UNIT (node)) == INTEGER_CST)
+ {
+ fputs (" sz=", file);
+ print_integer_constant (file, TYPE_SIZE (node), 0);
+ fputs ("(", file);
+ print_integer_constant (file, TYPE_SIZE_UNIT (node), 0);
+ fputs (")", file);
+ }
+ else
+ {
+ PRINT_TYPE_NAME(node);
+ dump_tree (file, "(size)", TYPE_SIZE (node), indent + INDENT);
+ dump_tree (file, "(unit size)", TYPE_SIZE_UNIT (node), indent + INDENT);
+ }
+
+ if (INTEGRAL_TYPE_P (node))
+ {
+ if (!newline &&
+ TREE_CODE (TYPE_MIN_VALUE (node)) == INTEGER_CST
+ && TREE_CODE (TYPE_MAX_VALUE (node)) == INTEGER_CST)
+ {
+ fputs (" min/max=", file);
+ print_integer_constant (file, TYPE_MIN_VALUE (node), 0);
+ fputc ('/', file);
+ print_integer_constant (file, TYPE_MAX_VALUE (node), 0);
+ }
+ else
+ {
+ PRINT_TYPE_NAME(node);
+ dump_tree (file, "(min)", TYPE_MIN_VALUE (node), indent + INDENT);
+ dump_tree (file, "(max)", TYPE_MAX_VALUE (node), indent + INDENT);
+ }
+ }
+
+ PRINT_TYPE_NAME(node);
+
+ if (TYPE_ATTRIBUTES (node))
+ dump_tree (file, NULL, TYPE_ATTRIBUTES (node), indent + INDENT);
+
+ (*lang_hooks.dump_type) (file, node, indent, 1);
+
+ if (TREE_CODE (node) == ARRAY_TYPE || TREE_CODE (node) == SET_TYPE)
+ {
+ if (TYPE_DOMAIN (node))
+ dump_tree (file, "(domain)", TYPE_DOMAIN (node), indent + INDENT);
+ }
+ else if (TREE_CODE (node) == ENUMERAL_TYPE)
+ {
+ if (TYPE_VALUES (node))
+ dump_tree (file, "(values)", TYPE_VALUES (node), indent + INDENT);
+ }
+
+#if 0
+ if (TYPE_MAIN_VARIANT (node) == node)
+ {
+ tree n = TYPE_MAIN_VARIANT (node);
+ dump_tree (file, "(main-variant)", n, indent + INDENT);
+ for (n = TYPE_NEXT_VARIANT (n); n; n = TYPE_NEXT_VARIANT (n))
+ dump_tree (file, "(next-variant)", n, indent + INDENT);
+ }
+#endif
+
+#if 0
+ if (TYPE_POINTER_TO (node))
+ dump_tree (file, "(ptr-to-this)", TYPE_POINTER_TO (node), indent + INDENT);
+
+ if (TYPE_REFERENCE_TO (node))
+ dump_tree (file, "(ref-to-this)", TYPE_REFERENCE_TO (node), indent + INDENT);
+#endif
+
+ if (TREE_TYPE (node))
+ dump_tree (file, NULL, TREE_TYPE (node), indent + INDENT);
+
+ /* I THINK SOME BINFO-RELATED MACROS NEED TO BE INVESTIGATED AND PUT HERE... */
+}
+
+void
+print_decl (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent ATTRIBUTE_UNUSED;
+{
+ int newline = 0;
+
+ if (!node_seen (node, FALSE))
+ {
+ if (TREE_SIDE_EFFECTS (node) || TREE_THIS_VOLATILE (node))
+ fputs (" volatile", file);
+ if (DECL_IGNORED_P (node))
+ fputs (" ignored", file);
+ if (DECL_ABSTRACT (node))
+ fputs (" abst", file);
+ if (DECL_IN_SYSTEM_HEADER (node))
+ fputs (" in-sys-hdr", file);
+ if (DECL_COMMON (node))
+ fputs (" comm", file);
+ if (DECL_NONLOCAL (node))
+ fputs (" nonlcl", file);
+#if 0
+ if (DECL_ARTIFICIAL (node))
+ fputs (" artifical", file);
+#endif
+ if (DECL_WEAK (node))
+ fputs (" weak", file);
+ /* APPLE LOCAL coalescing */
+ if (DECL_COALESCED (node))
+ fputs (" coal", file);
+ /* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+ if (DECL_WEAK_IMPORT (node))
+ fputs (" weak_import", file);
+ /* APPLE LOCAL end weak_import ilr */
+
+ if (DECL_LANG_FLAG_0 (node)
+ || DECL_LANG_FLAG_1 (node)
+ || DECL_LANG_FLAG_2 (node)
+ || DECL_LANG_FLAG_3 (node)
+ || DECL_LANG_FLAG_4 (node)
+ || DECL_LANG_FLAG_5 (node)
+ || DECL_LANG_FLAG_6 (node)
+ || DECL_LANG_FLAG_7 (node))
+ {
+ fputs (" lang-flags=#", file);
+ if (DECL_LANG_FLAG_0 (node))
+ fputc ('0', file);
+ if (DECL_LANG_FLAG_1 (node))
+ fputc ('1', file);
+ if (DECL_LANG_FLAG_2 (node))
+ fputc ('2', file);
+ if (DECL_LANG_FLAG_3 (node))
+ fputc ('3', file);
+ if (DECL_LANG_FLAG_4 (node))
+ fputc ('4', file);
+ if (DECL_LANG_FLAG_5 (node))
+ fputc ('5', file);
+ if (DECL_LANG_FLAG_6 (node))
+ fputc ('6', file);
+ if (DECL_LANG_FLAG_7 (node))
+ fputc ('7', file);
+ }
+ }
+
+ if (DECL_ATTRIBUTES (node))
+ {
+ fprintf (file, " attr=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_ATTRIBUTES (node)));
+ }
+
+ if (DECL_CONTEXT (node))
+ {
+ fprintf (file, " cntxt=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_CONTEXT (node)));
+ }
+
+ if (DECL_RTL_SET_P (node))
+ {
+ fprintf (file, " rtl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_RTL (node)));
+ }
+
+ (*lang_hooks.dump_decl) (file, node, indent, 0);
+
+ if (!node_seen (node, TRUE)) /* mark ..._DECL node seen b4 recursing */
+ {
+ if (TREE_CODE (node) == FIELD_DECL)
+ {
+ if (DECL_BIT_FIELD_TYPE (node))
+ {
+ tree bf_type = DECL_BIT_FIELD_TYPE (node);
+ fprintf (file, " bf-type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (bf_type));
+ if (TYPE_NAME (bf_type))
+ {
+ if (TREE_CODE (TYPE_NAME (bf_type)) == IDENTIFIER_NODE)
+ {
+ if (IDENTIFIER_POINTER (TYPE_NAME (bf_type))
+ && *IDENTIFIER_POINTER (TYPE_NAME (bf_type)))
+ fprintf (file, " {%s}", IDENTIFIER_POINTER (TYPE_NAME (bf_type)));
+ }
+ else if (TREE_CODE (TYPE_NAME (bf_type)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (bf_type))
+ && IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (bf_type)))
+ && *IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (bf_type))))
+ fprintf (file, " {%s}",
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (bf_type))));
+ }
+ else
+ fprintf (file, " {%s}", tree_code_name[(int)TREE_CODE (bf_type)]);
+ }
+
+ if (DECL_FIELD_OFFSET (node) && DECL_FIELD_BIT_OFFSET (node))
+ {
+ if (TREE_CODE (DECL_FIELD_OFFSET (node)) == INTEGER_CST
+ && TREE_CODE (DECL_FIELD_BIT_OFFSET (node)) == INTEGER_CST)
+ {
+ fputs (" off=", file);
+ print_integer_constant (file, DECL_FIELD_BIT_OFFSET (node), 0);
+ fputs ("(", file);
+ print_integer_constant (file, DECL_FIELD_OFFSET (node), 0);
+ fputs (")", file);
+ }
+ else
+ {
+ if (DECL_NAME (node))
+ fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
+ dump_tree (file, "(offset)", DECL_FIELD_OFFSET (node),
+ indent + INDENT);
+ dump_tree (file, "(bit offset)", DECL_FIELD_BIT_OFFSET (node),
+ indent + INDENT);
+ newline = 1;
+ }
+ }
+ else
+ {
+ if (DECL_FIELD_OFFSET (node))
+ {
+ if (TREE_CODE (DECL_FIELD_OFFSET (node)) == INTEGER_CST)
+ {
+ fputs (" off=", file);
+ print_integer_constant (file, DECL_FIELD_BIT_OFFSET (node), 0);
+ }
+ else
+ {
+ if (DECL_NAME (node))
+ fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
+ dump_tree (file, "(offset)", DECL_FIELD_OFFSET (node),
+ indent + INDENT);
+ newline = 1;
+ }
+ }
+ if (DECL_FIELD_BIT_OFFSET (node))
+ {
+ if (!newline
+ && TREE_CODE (DECL_FIELD_BIT_OFFSET (node)) == INTEGER_CST)
+ {
+ fputs (" bit-off=", file);
+ print_integer_constant (file, DECL_FIELD_BIT_OFFSET (node), 0);
+ }
+ else
+ {
+ if (!newline && DECL_NAME (node))
+ fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
+ dump_tree (file, "(bit offset)", DECL_FIELD_BIT_OFFSET (node),
+ indent + INDENT);
+ newline = 1;
+ }
+ }
+ }
+ }
+
+ if (!newline && DECL_SIZE (node) && DECL_SIZE_UNIT (node)
+ && TREE_CODE (DECL_SIZE (node)) == INTEGER_CST
+ && TREE_CODE (DECL_SIZE_UNIT (node)) == INTEGER_CST)
+ {
+ fputs (" sz=", file);
+ print_integer_constant (file, DECL_SIZE (node), 0);
+ fputs ("(", file);
+ print_integer_constant (file, DECL_SIZE_UNIT (node), 0);
+ fputs (")", file);
+ }
+ else
+ {
+ if (!newline && DECL_NAME (node))
+ fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
+ newline = 1;
+ dump_tree (file, "(size)", DECL_SIZE (node), indent + INDENT);
+ dump_tree (file, "(unit size)", DECL_SIZE_UNIT (node), indent + INDENT);
+ }
+ }
+
+ if (!newline && DECL_NAME (node))
+ fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
+
+ (*lang_hooks.dump_decl) (file, node, indent, 1);
+}
+
+void
+print_ref (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent ATTRIBUTE_UNUSED;
+{
+ if (TREE_THIS_VOLATILE (node))
+ fputs (" volatile", file);
+ if (TREE_READONLY (node))
+ fputs (" readonly", file);
+}
+
+#define MAX_COMMENT 50
+
+/* The "..." arguments are a list of zero or more strings with a NULL
+ as the last list item. They are used to annotate each respective
+ operand. The annotation convention is that if an string is not
+ enclosed in parentheses it will annotation it's operand display. If
+ it is enclosed in parentheses it will be appended to the kind:address
+ display. Examples:
+
+ annotation kind:address ....
+ or
+ kind:address (annotation) ....
+*/
+
+void
+print_operands VPARAMS ((FILE *file, tree node, int indent, int follow, ...))
+{
+#ifndef ANSI_PROTOTYPES
+ FILE *file;
+ tree node;
+ int indent, follow;
+#endif
+ int i, first_rtl, len, len1, nomore, maxlen;
+ va_list ap;
+ char *s, temp[MAX_COMMENT + 2];
+
+ VA_START (ap, follow);
+#ifndef ANSI_PROTOTYPES
+ file = va_arg (ap, FILE *);
+ node = va_arg (ap, tree);
+ indent = va_arg (ap, int);
+ follow = va_arg (ap, int);
+#endif
+
+ len = TREE_CODE_LENGTH (TREE_CODE (node));
+ first_rtl = first_rtl_op (TREE_CODE (node));
+
+ for (i = nomore = maxlen = 0; i < len && i < first_rtl; ++i)
+ {
+ s = nomore ? NULL : va_arg (ap, char *);
+ if (s == NULL)
+ {
+ nomore = 1;
+ fprintf (file, " ");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, i)));
+ }
+ else
+ {
+ if (s[0] != '(')
+ {
+ len1 = strlen (s);
+ if (len1 > maxlen)
+ maxlen = len1;
+ }
+ else
+ {
+ s = strcpy (temp, ++s);
+ temp[strlen (temp) - 1] = '\0';
+ }
+ fprintf (file, " %s=", s);
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, i)));
+ }
+ }
+
+ va_end (ap);
+
+ if (first_rtl < len)
+ {
+ for (i = first_rtl; i < len; ++i)
+ if (TREE_OPERAND (node, i))
+ break;
+ if (i < len)
+ {
+ fputs (" [rtl=", file);
+ for (i = first_rtl; i < len; ++i)
+ {
+ if (i > first_rtl)
+ fputc (',', file);
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, i)));
+ }
+ fputc (']', file);
+ }
+ }
+
+ if (follow && dump_tree_state.really_follow)
+ {
+ maxlen = MIN (maxlen, MAX_COMMENT);
+ temp[maxlen] = '\0';
+
+ /* Reusing the arg list -- does this work when !ANSI_PROTOTYPES? */
+ VA_START (ap, follow);
+# ifndef ANSI_PROTOTYPES
+ file = va_arg (ap, FILE *);
+ node = va_arg (ap, tree);
+ indent = va_arg (ap, int);
+# endif
+
+ for (i = nomore = 0; i < len && i < first_rtl; ++i)
+ {
+ s = nomore ? NULL : va_arg (ap, char *);
+ if (s == NULL)
+ {
+ nomore = 1;
+ if (maxlen > 0)
+ s = memset(temp, ' ', maxlen);
+ }
+ else if (s[0] != '(')
+ {
+ len = strlen (s);
+ if (maxlen < len)
+ len = maxlen;
+ if (len < maxlen)
+ {
+ memset(temp, ' ', maxlen);
+ s = memcpy(temp + maxlen - len - 1, s, len);
+ }
+ }
+ dump_tree (file, s, TREE_OPERAND (node, i), indent + INDENT);
+ }
+
+ va_end (ap);
+ }
+}
+
+void
+print_lineno (file, node)
+ FILE *file;
+ tree node;
+{
+ if (!(*lang_hooks.dump_lineno_p) (file, node)
+ && TREE_CODE_CLASS (TREE_CODE (node)) == 'd')
+ {
+ if (TREE_CODE (node) != FUNCTION_DECL || !DECL_BUILT_IN (node))
+ {
+ if (dump_tree_state.curr_file
+ && strcmp(dump_tree_state.curr_file, DECL_SOURCE_FILE (node)) == 0)
+ fprintf (file, " line=%d", DECL_SOURCE_LINE (node));
+ else
+ {
+ dump_tree_state.curr_file = (char *)DECL_SOURCE_FILE (node);
+ fprintf (file, " line=%d(%s)", DECL_SOURCE_LINE (node),
+ lbasename(DECL_SOURCE_FILE (node)));
+ }
+ }
+ }
+}
+
+void
+print_integer_constant (file, node, hex)
+ FILE *file;
+ tree node;
+ int hex;
+{
+ int ok = 1;
+ tree type = TREE_TYPE (node);
+ int size;
+
+ size = (TREE_CODE_CLASS (TREE_CODE (type)) == 't') ?
+ CST_VALUE (TYPE_SIZE_UNIT (type), ok)
+ : 4; /*CST_VALUE (type,ok);*/
+ if (!ok)
+ size = 4;
+
+ if (hex)
+ {
+ if (TREE_INT_CST_HIGH (node) == 0
+ || (TREE_INT_CST_HIGH (node) == -1 && TREE_INT_CST_LOW (node) != 0))
+ {
+ if (size == 1)
+ fprintf (file, "0x%.2lX = ", (unsigned long)(TREE_INT_CST_LOW (node) & 0xFF));
+ else if (size == 2)
+ fprintf (file, "0x%.4lX = ", (unsigned long)(TREE_INT_CST_LOW (node) & 0xFFFF));
+ else if (size == 4)
+ fprintf (file, "0x%.8lX = ", (unsigned long)TREE_INT_CST_LOW (node));
+ else
+ fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+ TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
+ }
+ }
+
+ if (TREE_INT_CST_HIGH (node) == 0)
+ fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node));
+ else if (TREE_INT_CST_HIGH (node) == -1 && TREE_INT_CST_LOW (node) != 0)
+ {
+ fputs ("-", file);
+ fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, -TREE_INT_CST_LOW (node));
+ }
+ else
+ fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+ TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
+}
+
+void
+print_real_constant (file, node)
+ FILE *file;
+ tree node;
+{
+ char string[100];
+ real_to_decimal (string, &TREE_REAL_CST (node), sizeof (string), 0, 1);
+ fputs (string, file);
+}
+
+void
+print_string_constant (file, str, maxlen)
+ FILE *file;
+ const char *str;
+ int maxlen;
+{
+ char c, buf[1024+12+1], *s;
+ int i = 0, len;
+
+ if (!str)
+ {
+ fputs ("(null)", file);
+ return;
+ }
+
+ /* Buffer string so that we write it with a single fputs(). This is
+ required for our line wrapping code to know when it is "inside"
+ a string. */
+
+ len = strlen (str);
+ if (len > 1021)
+ len = 1021;
+
+ s = buf;
+ *s++ = '"';
+
+ while ((c = *str++) != '\0')
+ {
+ if (c == '\b') {
+ *s++ = '\\'; *s++ = 'b'; i += 2;
+ } else if (c == '\f') {
+ *s++ = '\\'; *s++ = 'f'; i += 2;
+ } else if (c == '\v') {
+ *s++ = '\\'; *s++ = 'v'; i += 2;
+ } else if (c == '\r') {
+ *s++ = '\\'; *s++ = 'r'; i += 2;
+ } else if (c == '\n') {
+ *s++ = '\\'; *s++ = 'n'; i += 2;
+ } else if (c == '\t') {
+ *s++ = '\\'; *s++ = 't'; i += 2;
+ } else if (!isprint (c)) {
+ s += sprintf (s, "\\%03o", c); i += 4;
+ } else {
+ *s++ = c; ++i;
+ }
+ if (i > maxlen && len > maxlen + 12)
+ {
+ strcpy (s, "...(more)...");
+ break;
+ }
+ }
+ *s++ = '"';
+ *s = '\0';
+ fputs (buf, file);
+}
+
+void
+print_tree_flags (file, node)
+ FILE *file;
+ tree node;
+{
+ if (TREE_SIDE_EFFECTS (node))
+ fputs ("side-effects", file);
+ if (TREE_CONSTANT (node))
+ fputs (" const", file);
+ if (TREE_ADDRESSABLE (node))
+ fputs (" addressable", file);
+ if (TREE_THIS_VOLATILE (node))
+ fputs (" volatile", file);
+ if (TREE_READONLY (node))
+ fputs (" readonly", file);
+ if (TREE_UNSIGNED (node))
+ fputs (" uns", file);
+ if (TREE_ASM_WRITTEN (node))
+ fputs (" asm-written", file);
+ if (TREE_USED (node))
+ fputs (" used", file);
+ if (TREE_NOTHROW (node))
+ fputs (" nothrow", file);
+ if (TREE_STATIC (node))
+ fputs (" static", file);
+ if (TREE_PUBLIC (node))
+ fputs (" public", file);
+ if (TREE_PRIVATE (node))
+ fputs (" private", file);
+ if (TREE_PROTECTED (node))
+ fputs (" protected", file);
+ if (TREE_BOUNDED (node))
+ fputs (" bounded", file);
+ if (TREE_DEPRECATED (node))
+ fputs (" deprecated", file);
+ /* APPLE LOCAL begin unavailable (Radar 2809697) ilr */
+ if (TREE_UNAVAILABLE (node))
+ fputs (" unavailable", file);
+ /* APPLE LOCAL end unavailable ilr */
+
+ if (TREE_LANG_FLAG_0 (node)
+ || TREE_LANG_FLAG_1 (node)
+ || TREE_LANG_FLAG_2 (node)
+ || TREE_LANG_FLAG_3 (node)
+ || TREE_LANG_FLAG_4 (node)
+ || TREE_LANG_FLAG_5 (node)
+ || TREE_LANG_FLAG_6 (node))
+ {
+ fputs (" tree-flags=#", file);
+ if (TREE_LANG_FLAG_0 (node))
+ fputc ('0', file);
+ if (TREE_LANG_FLAG_1 (node))
+ fputc ('1', file);
+ if (TREE_LANG_FLAG_2 (node))
+ fputc ('2', file);
+ if (TREE_LANG_FLAG_3 (node))
+ fputc ('3', file);
+ if (TREE_LANG_FLAG_4 (node))
+ fputc ('4', file);
+ if (TREE_LANG_FLAG_5 (node))
+ fputc ('5', file);
+ if (TREE_LANG_FLAG_6 (node))
+ fputc ('6', file);
+ }
+}
+
+/*-------------------------------------------------------------------*/
+
+/* Just in case print anything set in the common part of this node. */
+
+static void
+print_ERROR_MARK (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent ATTRIBUTE_UNUSED;
+{
+ if (TREE_CHAIN (node))
+ {
+ fprintf (file, " chain=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_CHAIN (node)));
+ }
+ if (TREE_TYPE (node))
+ {
+ fprintf (file, " type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_TYPE (node)));
+ }
+ print_tree_flags (file, node);
+}
+
+static void
+print_IDENTIFIER_NODE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ if (TREE_PUBLIC (node))
+ fputs (" public", file);
+ if (TREE_ADDRESSABLE (node))
+ fputs (" addressable", file);
+
+ (*lang_hooks.dump_identifier) (file, node, indent, 0);
+ fprintf (file, " len=%d %s",
+ IDENTIFIER_LENGTH (node), IDENTIFIER_POINTER (node));
+ (*lang_hooks.dump_identifier) (file, node, indent, 1);
+}
+
+static void
+print_TREE_LIST (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TREE_VIA_VIRTUAL (node))
+ fputs (" via-virt", file);
+ if (TREE_VIA_PUBLIC (node))
+ fputs (" via-public", file);
+ if (TREE_VIA_PRIVATE (node))
+ fputs (" via-private", file);
+ if (TREE_VIA_PROTECTED (node))
+ fputs (" via-protected", file);
+ fprintf (file, " purpose=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (TREE_PURPOSE (node)));
+ fprintf (file, " value=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (TREE_VALUE (node)));
+ fprintf (file, " chain=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (TREE_CHAIN (node)));
+
+ ++dump_tree_state.doing_tree_list;
+ (void)node_seen (node, TRUE);
+
+ dump_tree (file, "(purpose)", TREE_PURPOSE (node), indent + INDENT);
+ dump_tree (file, "(value)", TREE_VALUE (node), indent + INDENT);
+
+ for (node = TREE_CHAIN (node); node; node = TREE_CHAIN (node))
+ dump_tree (file, annotation, node, indent + 0); /* keep list at same indent */
+
+ --dump_tree_state.doing_tree_list;
+}
+
+static void
+print_TREE_VEC (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ int i, skip_line, len = TREE_VEC_LENGTH (node);
+
+ if (TREE_VIA_VIRTUAL (node))
+ fputs (" via-virt", file);
+ if (TREE_VIA_PUBLIC (node))
+ fputs (" via-public", file);
+ if (TREE_VIA_PRIVATE (node))
+ fputs (" via-private", file);
+ if (TREE_VIA_PROTECTED (node))
+ fputs (" via-protected", file);
+
+ fprintf (file, " len=%d", len);
+
+ for (i = skip_line = 0; i < len; ++i)
+ if (TREE_VEC_ELT (node, i))
+ {
+ char temp[MAX_COMMENT + 20];
+
+ if (skip_line)
+ newline_and_indent (file, 0);
+ skip_line = 1;
+ if (annotation)
+ {
+ temp[0] = '(';
+ if (annotation[0] == '(')
+ {
+ strcpy (temp+1, annotation+1);
+ temp[strlen (temp) - 1] = '\0';
+ }
+ else
+ strcpy (temp+1, annotation);
+ sprintf (temp + strlen (temp), ":%i)", i);
+ }
+ else
+ sprintf (temp, "(%i)", i);
+ dump_tree (file, temp, TREE_VEC_ELT (node, i), indent + INDENT);
+ }
+
+ if (len > 1 && indent > 1)
+ newline_and_indent (file, 0);
+}
+
+static void
+print_BLOCK (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent ATTRIBUTE_UNUSED;
+{
+ tree n;
+
+ fprintf (file, " vars=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (BLOCK_VARS (node)));
+ fprintf (file, " abs-orig=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (BLOCK_ABSTRACT_ORIGIN (node)));
+ fprintf (file, " super=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (BLOCK_SUPERCONTEXT (node)));
+ fprintf (file, " sub=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (BLOCK_SUBBLOCKS (node)));
+ fprintf (file, " frag-origin=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (BLOCK_FRAGMENT_ORIGIN (node)));
+ fprintf (file, " frag-chain=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (BLOCK_FRAGMENT_CHAIN (node)));
+
+ if (BLOCK_HANDLER_BLOCK (node))
+ fputs (" handler_block_flag", file);
+ if (BLOCK_ABSTRACT (node))
+ fputs (" abstract_flag", file);
+
+ for (n = BLOCK_VARS (node); n; n = TREE_CHAIN (n))
+ if (!node_seen (n, FALSE))
+ dump_tree (file, NULL, n, indent + INDENT);
+
+#if 0
+ for (n = BLOCK_SUBBLOCKS (node); n; n = BLOCK_CHAIN (n))
+ if (!node_seen (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+#endif
+
+ /*dump_tree (file, NULL, BLOCK_SUPERCONTEXT (node), indent + INDENT);*/
+
+ if (!node_seen (BLOCK_ABSTRACT_ORIGIN (node), FALSE))
+ dump_tree (file, NULL, BLOCK_ABSTRACT_ORIGIN (node), indent + INDENT);
+}
+
+static void
+print_VOID_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_INTEGER_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TYPE_IS_SIZETYPE (node))
+ fputs (" sizetype", file);
+ if (TREE_UNSIGNED (node))
+ fputs (" uns", file);
+
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_REAL_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_COMPLEX_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_VECTOR_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_ENUMERAL_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TREE_UNSIGNED (node))
+ fputs (" uns", file);
+
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_BOOLEAN_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_CHAR_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_POINTER_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_OFFSET_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ fprintf (file, " basetype=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_OFFSET_BASETYPE (node)));
+
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_REFERENCE_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_METHOD_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ tree n;
+
+ if (TYPE_METHOD_BASETYPE (node))
+ {
+ fprintf (file, " basetype=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_METHOD_BASETYPE (node)));
+ }
+ fprintf (file, " args=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_ARG_TYPES (node)));
+
+ print_type (file, annotation, node, indent);
+
+ for (n = TYPE_ARG_TYPES (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, "(args)", n, indent + INDENT);
+}
+
+static void
+print_FILE_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_ARRAY_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TYPE_STRING_FLAG (node))
+ fputs (" string-flag", file);
+ if (TYPE_NONALIASED_COMPONENT (node))
+ fputs (" nonaliased-component", file);
+
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_SET_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TYPE_STRING_FLAG (node))
+ fputs (" string-flag", file);
+
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_RECORD_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ tree n;
+
+ if (TYPE_NO_FORCE_BLK (node))
+ fputs (" no-force-blk", file);
+ fprintf (file, " fields=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_FIELDS (node)));
+
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ for (n = TYPE_FIELDS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+}
+
+static void
+print_UNION_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TYPE_NO_FORCE_BLK (node))
+ fputs (" no-force-blk", file);
+ if (TYPE_TRANSPARENT_UNION (node))
+ fputs (" transparent-union", file);
+ fprintf (file, " fields=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_FIELDS (node)));
+
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ for (node = TYPE_FIELDS (node); node; node = TREE_CHAIN (node))
+ dump_tree (file, NULL, node, indent + INDENT);
+}
+
+static void
+print_QUAL_UNION_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TYPE_NO_FORCE_BLK (node))
+ fputs (" no-force-blk", file);
+ fprintf (file, " fields=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_FIELDS (node)));
+
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ for (node = TYPE_FIELDS (node); node; node = TREE_CHAIN (node))
+ dump_tree (file, NULL, node, indent + INDENT);
+}
+
+static void
+print_FUNCTION_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ tree n;
+
+ if (TYPE_METHOD_BASETYPE (node))
+ {
+ fprintf (file, " basetype=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_METHOD_BASETYPE (node)));
+ }
+
+ if (TYPE_RETURNS_STACK_DEPRESSED (node))
+ fputs (" ret-stk-depressed", file);
+ if (TYPE_AMBIENT_BOUNDEDNESS (node))
+ fputs (" ambient-boundedness", file);
+ fprintf (file, " args=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TYPE_ARG_TYPES (node)));
+
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ for (n = TYPE_ARG_TYPES (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, "(args)", n, indent + INDENT);
+}
+
+static void
+print_LANG_TYPE (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_type (file, annotation, node, indent);
+}
+
+static void
+print_INTEGER_CST (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_tree_flags (file, node);
+ fputc (' ', file);
+ print_integer_constant (file, node, 1);
+}
+
+static void
+print_REAL_CST (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_tree_flags (file, node);
+ fputc (' ', file);
+ print_real_constant (file, node);
+}
+
+static void
+print_COMPLEX_CST (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_tree_flags (file, node);
+ fprintf (file, " real=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (TREE_REALPART (node)));
+ fprintf (file, " imag=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (TREE_IMAGPART (node)));
+
+ dump_tree (file, "(real)", TREE_REALPART (node), indent + INDENT);
+ dump_tree (file, "(imag)", TREE_IMAGPART (node), indent + INDENT);
+}
+
+static void
+print_VECTOR_CST (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ tree n, type = TREE_TYPE (node);
+ tree t1 = NULL;
+ int i, ok, size = 0;
+ int ok2 = 0;
+ char *fmt = (char *)"this is just to stop compiler warning";
+
+ union {
+ unsigned char uc[16];
+ unsigned short us[8];
+ unsigned long ul[4];
+ } vec_value;
+
+ print_tree_flags (file, node);
+
+ ok = (type && TREE_CODE (type) == VECTOR_TYPE);
+ if (ok)
+ {
+ type = TREE_TYPE (type);
+ n = TYPE_SIZE_UNIT (type);
+ size = CST_VALUE (n, ok);
+ t1 = TREE_VECTOR_CST_ELTS (node);
+
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && (size == 1 || size == 2 || size == 4))
+ {
+ fmt = (char *) (TREE_UNSIGNED (type) ? "%u%s" : "%d%s");
+ if (TREE_CODE (TREE_VALUE (t1)) == INTEGER_CST)
+ {
+ vec_value.ul[0] = CST_VALUE (TREE_VALUE (t1), ok);
+ vec_value.ul[1] = CST_VALUE (TREE_VALUE (TREE_CHAIN (t1)), ok);
+ vec_value.ul[2] = CST_VALUE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (t1))), ok);
+ vec_value.ul[3] = CST_VALUE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t1)))), ok);
+ }
+ ok2 = ok;
+ }
+ else if (TREE_CODE (type) != REAL_TYPE
+ || TREE_CODE (TREE_VALUE (t1)) != REAL_CST
+ || size != 4)
+ ok2 = 0;
+ else
+ ok2 = ok;
+ }
+
+ if (ok2)
+ {
+ fprintf (file, " ");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE(TREE_VALUE (t1)));
+ fprintf (file, " ");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE(TREE_VALUE (TREE_CHAIN (t1))));
+ fprintf (file, " ");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE(TREE_VALUE (TREE_CHAIN (TREE_CHAIN (t1)))));
+ fprintf (file, " ");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE(TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t1))))));
+ newline_and_indent (file, indent + INDENT);
+ fputc ('(', file);
+
+ switch (size)
+ {
+ case 1:
+ for (i = 0; i < 16; ++i)
+ fprintf (file, fmt, vec_value.uc[i], (i < 15) ? "," : "");
+ break;
+
+ case 2:
+ for (i = 0; i < 8; ++i)
+ fprintf (file, fmt, vec_value.us[i], (i < 7) ? "," : "");
+ break;
+
+ case 4:
+ if (TREE_CODE (type) != REAL_TYPE)
+ for (i = 0; i < 4; ++i)
+ fprintf (file, fmt, vec_value.ul[i], (i < 3) ? "," : "");
+ else
+ {
+ print_real_constant (file, TREE_VALUE (t1));
+ fputc (',', file);
+ print_real_constant (file, TREE_VALUE (TREE_CHAIN (t1)));
+ fputc (',', file);
+ print_real_constant (file, TREE_VALUE (TREE_CHAIN (TREE_CHAIN (t1))));
+ fputc (',', file);
+ print_real_constant (file, TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t1)))));
+ }
+ break;
+ }
+
+ fputc (')', file);
+ }
+ else
+ {
+ dump_tree (file, NULL, TREE_VALUE (t1), indent + INDENT);
+ dump_tree (file, NULL, TREE_VALUE (TREE_CHAIN (t1)), indent + INDENT);
+ dump_tree (file, NULL, TREE_VALUE (TREE_CHAIN (TREE_CHAIN (t1))), indent + INDENT);
+ dump_tree (file, NULL, TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t1)))), indent + INDENT);
+ }
+}
+
+static void
+print_STRING_CST (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_tree_flags (file, node);
+ fprintf (file, " ptr=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_STRING_POINTER (node)));
+ fprintf (file, " ");
+ print_string_constant (file, (char *)TREE_STRING_POINTER (node), 30);
+
+ if (TREE_CHAIN (node))
+ {
+ fprintf (file, " chain=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_CHAIN (node)));
+
+ for (node = TREE_CHAIN (node); node; node = TREE_CHAIN (node))
+ dump_tree (file, NULL, node, indent + INDENT);
+ }
+}
+
+static void
+print_FUNCTION_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ tree n;
+
+ if (DECL_BUILT_IN (node))
+ {
+ if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
+ fprintf (file, " BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
+ else
+ fprintf (file, " %s",
+ built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)]);
+ }
+
+ if (DECL_BUILT_IN_NONANSI (node))
+ fputs (" builtin-nonansi", file);
+
+ if (dump_tree_state.doing_call_expr)
+ {
+ print_decl (file, annotation, node, indent);
+ return;
+ }
+
+ if (DECL_EXTERNAL (node))
+ fputs (" ext", file);
+ if (TREE_PUBLIC (node))
+ fputs (" pub", file);
+ if (TREE_PRIVATE (node))
+ fputs (" pvt", file);
+ if (TREE_PROTECTED (node))
+ fputs (" prot", file);
+#if 0
+ if (TREE_STATIC (node))
+ fputs (" def", file);
+ if (TREE_ADDRESSABLE (node))
+ fputs (" addrsable", file);
+#endif
+ if (TREE_ASM_WRITTEN (node))
+ fputs (" asm-wrtn", file);
+ if (TREE_NOTHROW (node))
+ fputs (" nothr", file);
+
+ if (DECL_INLINE (node))
+ fputs (" inline", file);
+ if (DECL_NO_STATIC_CHAIN (node))
+ fputs (" no-static-chain", file);
+ if (DECL_VIRTUAL_P (node))
+ fputs (" virt", file);
+ if (DECL_STATIC_CONSTRUCTOR (node))
+ fputs (" static-ctor", file);
+ if (DECL_STATIC_DESTRUCTOR (node))
+ fputs (" static-dtor", file);
+
+ if (DECL_INITIAL (node))
+ {
+ fprintf (file, " initial=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_INITIAL (node)));
+ }
+
+ if (DECL_SAVED_INSNS (node))
+ {
+ fprintf (file, " saved-insns=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_SAVED_INSNS (node)));
+ }
+
+ if (!DECL_EXTERNAL (node))
+ {
+ fprintf (file, " ");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (DECL_RESULT (node)));
+ fprintf (file, "(");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (DECL_ARGUMENTS (node)));
+ fprintf (file, "){");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_LANG_SPECIFIC(node)
+ ? DECL_SAVED_TREE (node) : 0));
+ fprintf (file, "}");
+ }
+ print_decl (file, annotation, node, indent);
+
+ /*if (DECL_LANG_SPECIFIC(node) && DECL_SAVED_TREE (node)) ?? */
+ if (DECL_RESULT (node))
+ dump_tree (file, NULL, DECL_RESULT (node), indent + INDENT);
+
+ dump_tree_state.doing_parm_decl = 1;
+ for (n = DECL_ARGUMENTS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+ dump_tree_state.doing_parm_decl = 0;
+
+ if (DECL_LANG_SPECIFIC(node)) /* saftey test, used by DECL_SAVED_TREE */
+ for (n = DECL_SAVED_TREE (node); n; n = TREE_CHAIN (n))
+ {
+ if (n == DECL_SAVED_TREE (node)
+ && TREE_CODE (n) == EXPR_STMT
+ && EXPR_STMT_EXPR (n) == void_zero_node)
+ {
+ dump_tree_state.really_follow = 0;
+ dump_tree (file, "(dummy, to be deleted)", n, indent + INDENT);
+ dump_tree_state.really_follow = 1;
+ }
+ else
+ dump_tree (file, NULL, n, indent + INDENT);
+ }
+
+ /* FIXME: DECL_VINDEX ?? */
+}
+
+static void
+print_LABEL_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (TREE_ADDRESSABLE (node))
+ fputs (" seen", file);
+ if (DECL_TOO_LATE (node))
+ fputs (" too-late", file);
+ if (DECL_ERROR_ISSUED (node))
+ fputs (" error-issued", file);
+ print_decl (file, annotation, node, indent);
+}
+
+static void
+print_CONST_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_decl (file, annotation, node, indent);
+}
+
+static void
+print_TYPE_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (DECL_ORIGINAL_TYPE (node))
+ {
+ fprintf (file, " orig_type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_ORIGINAL_TYPE (node)));
+ }
+ if (TYPE_DECL_SUPPRESS_DEBUG (node))
+ fputs (" suppress-debug", file);
+ print_decl (file, annotation, node, indent);
+}
+
+static void
+print_VAR_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (node_seen (node, FALSE))
+ {
+ print_decl (file, annotation, node, indent);
+ return;
+ }
+
+ if (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node))
+ fputs (" static", file);
+ if (TREE_PUBLIC (node))
+ fputs (" pub", file);
+ if (DECL_EXTERNAL (node))
+ fputs (" ext", file);
+ if (DECL_REGISTER (node))
+ fputs (" regdcl", file);
+ if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
+ fputs (" in-txt-sect", file);
+ if (DECL_VIRTUAL_P (node))
+ fputs (" virt", file);
+ if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
+ {
+ fputs (" alias-set=", file);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC,
+ DECL_POINTER_ALIAS_SET (node));
+ }
+
+ if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node))
+ fputs (" transp-union", file);
+
+ if (TREE_CODE (node) != PARM_DECL)
+ {
+ fprintf (file, " initial=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_INITIAL (node)));
+ print_decl (file, annotation, node, indent);
+ dump_tree (file, NULL, DECL_INITIAL (node), indent + INDENT);
+ }
+ else
+ print_decl (file, annotation, node, indent);
+}
+
+static void
+print_PARM_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (dump_tree_state.doing_parm_decl)
+ {
+ if (DECL_ARG_TYPE (node))
+ {
+ fprintf (file, " arg-type=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_ARG_TYPE (node)));
+ }
+ if (DECL_ARG_TYPE_AS_WRITTEN (node))
+ {
+ fprintf (file, " as-written=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_ARG_TYPE_AS_WRITTEN (node)));
+ }
+ if (DECL_INCOMING_RTL (node))
+ {
+ fprintf (file, " incoming-rtl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (DECL_INCOMING_RTL (node)));
+ }
+ }
+ print_VAR_DECL (file, annotation, node, indent);
+}
+
+static void
+print_RESULT_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_decl (file, annotation, node, indent);
+}
+
+static void
+print_FIELD_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ if (node_seen (node, FALSE))
+ {
+ print_decl (file, annotation, node, indent);
+ return;
+ }
+
+ if (TREE_ADDRESSABLE (node))
+ fputs (" addressable", file);
+ if (TREE_READONLY (node))
+ fputs (" readonly", file);
+
+ if (DECL_VIRTUAL_P (node))
+ fputs (" virt", file);
+ if (DECL_PACKED (node))
+ fputs (" packed", file);
+ if (TREE_UNSIGNED (node))
+ fputs (" uns", file);
+ if (DECL_BIT_FIELD (node))
+ fputs (" bitfield", file);
+ if (DECL_NONADDRESSABLE_P (node))
+ fputs (" nonaddr", file);
+ fprintf (file, " off-align=");
+ fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
+ DECL_OFFSET_ALIGN (node));
+ print_decl (file, annotation, node, indent);
+}
+
+static void
+print_NAMESPACE_DECL (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_decl (file, annotation, node, indent);
+}
+
+static void
+print_COMPONENT_REF (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_ref (file, annotation, node, indent);
+ print_operands (file, node, indent, TRUE, "(struct/union)", "(field)", NULL);
+}
+
+static void
+print_BIT_FIELD_REF (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_ref (file, annotation, node, indent);
+ print_operands (file, node, indent, TRUE, "(struct/union)", "(#bits)", "(pos)", NULL);
+}
+
+static void
+print_INDIRECT_REF (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_ref (file, annotation, node, indent);
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BUFFER_REF (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_ref (file, annotation, node, indent);
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ARRAY_REF (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_ref (file, annotation, node, indent);
+ print_operands (file, node, indent, TRUE, "(base)", "(index)", NULL);
+}
+
+static void
+print_ARRAY_RANGE_REF (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_ref (file, annotation, node, indent);
+ print_operands (file, node, indent, TRUE, "(base)", "(index)", NULL);
+}
+
+static void
+print_VTABLE_REF (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ print_ref (file, annotation, node, indent);
+ print_operands (file, node, indent, TRUE, "(base)", "(index)", NULL);
+}
+
+static void
+print_CONSTRUCTOR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ if (TREE_ADDRESSABLE (node))
+ fputs (" must-be-in-mem", file);
+ if (TREE_STATIC (node))
+ fputs (" static", file);
+ if (TREE_CONSTANT (node))
+ fputs (" const", file);
+ if (TREE_BOUNDED (node))
+ fputs (" bounded", file);
+
+ print_operands (file, node, indent, FALSE, NULL);
+
+ for (node = CONSTRUCTOR_ELTS (node); node; node = TREE_CHAIN (node))
+ dump_tree (file, NULL, node, indent + INDENT);
+}
+
+static void
+print_COMPOUND_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ if (TREE_NO_UNUSED_WARNING (node))
+ fputs (" no-unused", file);
+
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_MODIFY_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_INIT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TARGET_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(target)", "(init)",
+ "(cleanup)", "(saved-init)", NULL);
+}
+
+static void
+print_COND_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(cond)", "(?)", "(:)", NULL);
+}
+
+static void
+print_BIND_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(vars)", "(body)", "(block)", NULL);
+}
+
+static void
+print_CALL_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ if (TREE_NOTHROW (node))
+ fputs (" nothrow", file);
+
+ dump_tree_state.doing_call_expr = 1;
+ print_operands (file, node, indent, TRUE, "(func)", "(args)", NULL);
+ dump_tree_state.doing_call_expr = 0;
+}
+
+static void
+print_METHOD_CALL_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(self)", "(args)", NULL);
+}
+
+static void
+print_WITH_CLEANUP_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CLEANUP_POINT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_PLACEHOLDER_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ /*print_operands (file, node, indent, FALSE, NULL);*/
+ /* this is an 'x' node, not an expr node */
+}
+
+static void
+print_WITH_RECORD_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_PLUS_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_MINUS_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_MULT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUNC_DIV_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CEIL_DIV_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FLOOR_DIV_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ROUND_DIV_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUNC_MOD_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CEIL_MOD_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FLOOR_MOD_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ROUND_MOD_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_RDIV_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EXACT_DIV_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FIX_TRUNC_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FIX_CEIL_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FIX_FLOOR_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FIX_ROUND_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FLOAT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_NEGATE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_MIN_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_MAX_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ABS_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FFS_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LSHIFT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_RSHIFT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LROTATE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_RROTATE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BIT_IOR_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BIT_XOR_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BIT_AND_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BIT_ANDTC_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_BIT_NOT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUTH_ANDIF_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUTH_ORIF_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUTH_AND_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUTH_OR_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUTH_XOR_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRUTH_NOT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_GT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_GE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EQ_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_NE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_UNORDERED_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ORDERED_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_UNLT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_UNLE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_UNGT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_UNGE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_UNEQ_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_IN_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_SET_LE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CARD_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_RANGE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CONVERT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_NOP_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_NON_LVALUE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_SAVE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_VIEW_CONVERT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_UNSAVE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_RTL_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ADDR_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_REFERENCE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_ENTRY_VALUE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_FDESC_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_COMPLEX_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CONJ_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_REALPART_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_IMAGPART_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_PREDECREMENT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_PREINCREMENT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_POSTDECREMENT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_POSTINCREMENT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_VA_ARG_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_TRY_CATCH_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, "(try)", "(catch)", NULL);
+}
+
+static void
+print_TRY_FINALLY_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_GOTO_SUBROUTINE_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LABEL_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_GOTO_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_RETURN_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EXIT_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LOOP_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_LABELED_BLOCK_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EXIT_BLOCK_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EXPR_WITH_FILE_LOCATION (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_SWITCH_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_EXC_PTR_EXPR (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ print_operands (file, node, indent, TRUE, NULL);
+}
+
+static void
+print_CLZ_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ /* TO DO */
+}
+static void
+print_CTZ_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ /* TO DO */
+}
+static void
+print_PARITY_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ /* TO DO */
+}
+static void
+print_POPCOUNT_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ /* TO DO */
+}
+
+/*-------------------------------------------------------------------*/
+
+/* Alaways the last lang_dump_tree_p to keep lang_dump_tree_p from being
+ NULL. A return of 0 always forces the tree node switch to go to its
+ default case. */
+
+static int
+no_dump_tree_p (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ return 0;
+}
+
+/* Language-specific initializers call this to add to the chain of language-
+ specific tree node dumpers. It is expected that their default node case
+ will call the function returned from here which was saved during their
+ initialization. */
+
+lang_dump_tree_p_t
+set_dump_tree_p (new_lang_dump_tree_p)
+ lang_dump_tree_p_t new_lang_dump_tree_p;
+{
+ lang_dump_tree_p_t old_lang_dump_tree_p = lang_dump_tree_p;
+ lang_dump_tree_p = new_lang_dump_tree_p;
+ return old_lang_dump_tree_p;
+}
+
+/* Annotations enclosed in parentheses are appended to the initial
+ kind:address display. Otherwise they prefix it. Note that a
+ prefix annotation is expected to have at least a trailing
+ space but a parenthesized annotation should end with it's
+ delimiting right parentheses. */
+
+void
+dump_tree (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation;
+ tree node;
+ int indent;
+{
+ int good_node, no_new_line, plen = 0;
+ static tree previous_node;
+
+ no_new_line = dump_tree_state.no_new_line;
+ dump_tree_state.no_new_line = 0;
+
+ /* prefix_len contains the length of the fixed part of a tree node
+ display line and can be used by tree node dumpers to control
+ line wrapping if the line info for that node gets too long. */
+
+ if (node == NULL)
+ return;
+
+ if (dump_tree_state.nesting_depth < 0)
+ {
+ /* If not called from dmp_tree3() then create hash table to record
+ which nodes we visit. We still also do this for dmp_tree3()
+ but only the first time dmp_tree3() calls this routine. After
+ that it's dmp_tree3() responsibility to free the hash table. */
+ if (dump_tree_state.visit_only_once != DMP_TREE_VISIT_ONCE2)
+ {
+ init_dump_state(node);
+ table = (struct bucket **) xmalloc (HASH_SIZE * sizeof (struct bucket *));
+ memset ((char *) table, 0, HASH_SIZE * sizeof (struct bucket *));
+ if (dump_tree_state.visit_only_once == DMP_TREE_VISIT_ONCE1)
+ dump_tree_state.visit_only_once = DMP_TREE_VISIT_ONCE2;
+ }
+
+ indent = 0;
+ previous_node = NULL_TREE;
+#if DMP_TREE_WRAPPED_OUTPUT
+ {
+ char *wrap_str = getenv(DMP_TREE_LINE_WRAP);
+ line_index = prev_line_was_null = prev_line_was_wrapped = 0;
+ wrap_column = 0;
+ if (wrap_str)
+ wrap_column = strtol (wrap_str, NULL, 10);
+#if defined(TIOCGSIZE) || defined(TIOCGWINSZ)
+ if (wrap_column < MIN_LINE_WRAP || wrap_column > MAX_LINE_WRAP)
+ {
+#ifdef TIOCGWINSZ
+ wrap_column = ioctl (fileno(file), TIOCGWINSZ, &winsize);
+ if (wrap_column >= 0)
+ wrap_column = winsize.ws_col;
+#endif
+#if defined(TIOCGSIZE) && !defined(TIOCGWINSZ)
+ wrap_column = ioctl (fileno(file), TIOCGSIZE, &winsize);
+ if (wrap_column >= 0)
+ wrap_column = winsize.ts_cols;
+#endif
+ }
+ }
+#endif /* TIOCGSIZE || TIOCGWINSZ */
+ if (wrap_column < MIN_LINE_WRAP || wrap_column > MAX_LINE_WRAP)
+ wrap_column = DEFAULT_LINE_WRAP;
+#endif /* DMP_TREE_WRAPPED_OUTPUT */
+ }
+
+ if (dump_tree_state.visit_only_once != DMP_TREE_VISIT_ANY
+ && node_seen (node, TRUE))
+ return;
+
+ if (dump_tree_state.dump_full_type && node_seen (node, FALSE))
+ return;
+
+ if (dump_tree_state.doing_tree_list && node_seen (node, FALSE))
+ return;
+
+ if (dump_tree_state.nesting_depth >= dump_tree_state.max_depth)
+ return;
+
+ if (dump_tree_state.nesting_depth >= 0)
+ {
+ if (!no_new_line)
+ {
+ newline_and_indent (file, 0);
+ if (statement_code_p (TREE_CODE (node))
+ || (TREE_CODE (node) == TREE_VEC && TREE_VEC_LENGTH (node) > 1))
+ {
+ if (previous_node
+ && TREE_CODE (previous_node) != TREE_CODE (node)
+ && (*lang_hooks.dump_blank_line_p) (previous_node, node))
+ newline_and_indent (file, 0);
+ }
+ }
+ previous_node = node;
+ if (indent > 0)
+ fprintf (file, "%*c", indent, ' ');
+ }
+
+ ++dump_tree_state.nesting_depth;
+
+ plen = indent;
+ if (annotation && *annotation && *annotation != '(')
+ plen += fprintf (file, "%s", annotation);
+
+ good_node = ((int) TREE_CODE (node) < dump_tree_state.max_code);
+
+ if (good_node)
+ {
+ plen += fprintf (file, "%s:", tree_code_name[(int) TREE_CODE (node)]);
+ plen += fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (node));
+ }
+ else
+ {
+ plen += fprintf (file, "%d (?):", (int) TREE_CODE (node));
+ plen += fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (node));
+ }
+
+ if (annotation && *annotation == '(')
+ plen += fprintf (file, " %s", annotation);
+
+ if (good_node)
+ {
+ if (TREE_CODE_CLASS (TREE_CODE (node)) != 't'
+ && TREE_TYPE (node)
+ && TREE_CODE_CLASS (TREE_CODE (TREE_TYPE (node))) == 't')
+ {
+ tree type, type0 = TREE_TYPE (node);
+
+ if (dump_tree_state.doing_call_expr
+ && TREE_CODE (node) == FUNCTION_DECL && TREE_TYPE (type0))
+ type = TREE_TYPE (type0);
+ else
+ type = type0;
+
+ fprintf (file, " t=");
+ fprintf (file, HOST_PTR_PRINTF, HOST_PTR_PRINTF_VALUE (type0));
+
+ if (TYPE_NAME (type))
+ {
+ if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+ {
+ if (IDENTIFIER_POINTER (TYPE_NAME (type))
+ && *IDENTIFIER_POINTER (TYPE_NAME (type)))
+ fprintf (file, " {%s}", IDENTIFIER_POINTER (TYPE_NAME (type)));
+ }
+ else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (type))
+ && IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))
+ && *IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))))
+ fprintf (file, " {%s}",
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
+ }
+ else
+ fprintf (file, " {%s}", tree_code_name[(int) TREE_CODE (type)]);
+
+ /* If doing a full program dump we also want to dump the types too.
+ So dmp_tree3() will do it after we dump all the decls's. All
+ we do here is record all the decl's types in an array. We won't
+ worry about dups here. That is taken care of when we process
+ this array. */
+
+ if (dump_tree_state.visit_only_once == DMP_TREE_VISIT_ONCE2
+ && !node_seen (type, FALSE))
+ {
+ if (type_array_next >= type_array_size)
+ {
+ type_array_size += type_array_incr;
+ type_array_incr = TYPE_ARRAY_INCR;
+ type_array = (tree *) xrealloc (type_array,
+ sizeof (tree) * type_array_size);
+ }
+
+ type_array[type_array_next++] = type;
+ }
+ }
+ else if (dump_tree_state.dump_full_type && TREE_TYPE (node))
+ {
+ fprintf (file, " t=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_TYPE (node)));
+ }
+ }
+
+#if DMP_TREE_WRAPPED_OUTPUT
+ prefix_len = plen + 1; /* include blank following prefix */
+ prev_line_was_wrapped = 0;
+#endif
+
+ print_lineno (file, node); /* line nbr info where possible */
+
+ if (! (*lang_dump_tree_p) (file, annotation, node, indent))
+ {
+ switch (TREE_CODE (node))
+ {
+# define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+ case SYM: print_ ## SYM (file, annotation, node, indent); break;
+# include "tree.def"
+# undef DEFTREECODE
+ default:
+ print_ERROR_MARK (file, annotation, node, indent);
+ break;
+ }
+ }
+
+ --dump_tree_state.nesting_depth;
+
+ if (dump_tree_state.nesting_depth < 0)
+ {
+ newline_and_indent (file, 0);
+ if (dump_tree_state.visit_only_once != DMP_TREE_VISIT_ONCE2)
+ free_hash_table ();
+ }
+ else
+ (void)node_seen (node, TRUE);
+
+}
+
+/* Called from debugger to dump the tree for a specific node. */
+void
+dmp_tree (node)
+ tree node;
+{
+ dump_tree_state.max_depth = INT_MAX;
+ dump_tree_state.visit_only_once = DMP_TREE_VISIT_ANY;
+ dump_tree (stderr, NULL, node, 0);
+}
+
+/* Same as dmp_tree() but limit the nesting to specified depth. */
+void
+dmp_tree1 (node, max_depth)
+ tree node;
+ int max_depth;
+{
+ if (max_depth <= 0)
+ max_depth = 1;
+ dump_tree_state.max_depth = max_depth;
+ dump_tree_state.visit_only_once = DMP_TREE_VISIT_ANY;
+ dump_tree (stderr, NULL, node, 0);
+}
+
+/* Same as dmp_tree() but displays never show a referenced node
+ more than once. */
+void
+dmp_tree2 (node)
+ tree node;
+{
+ dump_tree_state.max_depth = INT_MAX;
+ dump_tree_state.visit_only_once = DMP_TREE_VISIT_ONCE;
+ dump_tree (stderr, NULL, node, 0);
+}
+
+/* Called only from tree-dump.c to handle our dmp_tree() types of
+ displays when dumping an entire program to a file by specifying
+ -fdmp-translation-unit. */
+void
+dmp_tree3 (file, node, flags)
+ FILE *file;
+ tree node;
+ int flags ATTRIBUTE_UNUSED;
+{
+ int i;
+
+ dump_tree_state.max_depth = INT_MAX;
+ dump_tree_state.visit_only_once = DMP_TREE_VISIT_ONCE1;
+
+ while (node)
+ {
+ dump_tree (file, NULL, node, 0);
+ node = TREE_CHAIN (node);
+ }
+
+ newline_and_indent (file, 0);
+
+ if (type_array_next > 0)
+ {
+ for (i = 0; i < type_array_next; ++i)
+ dump_tree (file, NULL, type_array[i], 0);
+
+ free (type_array);
+ }
+
+ free_hash_table ();
+}
+
+/*-------------------------------------------------------------------*/
+
+#if DMP_TREE_WRAPPED_OUTPUT
+
+/* The three routines below here are what's actually called when fprintf,
+ fputc, or fputs are used in the tree dumper. These are used to
+ intercept the output to impose an appropriate line wrapping convention
+ on nodes that get too long for the display (lines > wrap_column). The
+ stdio.h names are redefined by macros to call these routines when
+ DMP_TREE_WRAPPED_OUTPUT is set.
+
+ The line wrap convention is to wrap only on blanks between the node's
+ info. Blanks within bracketed or quoted info does not count. The
+ wrapped portion is indented to start wherever the node's indented
+ kind:address portion of the display ends. */
+
+#undef fprintf
+#undef fputc
+#undef fputs
+
+int
+dmp_tree_fprintf VPARAMS ((FILE *file, const char *fmt, ...))
+{
+ int len;
+ va_list ap;
+
+#ifndef ANSI_PROTOTYPES
+ FILE *file;
+ char *fmt;
+#endif
+
+ VA_START (ap, fmt);
+#ifndef ANSI_PROTOTYPES
+ file = va_arg (ap, FILE *);
+ fmt = va_arg (ap, char *);
+#endif
+
+ len = vsprintf (&curr_line[line_index], fmt, ap);
+ line_index += len;
+
+ va_end (ap);
+
+ if (curr_line[line_index-1] == '\n')
+ {
+ if (line_index != 1 || !(prev_line_was_wrapped || prev_line_was_null))
+ {
+ curr_line[line_index] = '\0';
+ fputs (curr_line, file);
+ fflush (file);
+ }
+ prev_line_was_null = (line_index == 1);
+ line_index = 0;
+ }
+ else if (line_index >= wrap_column)
+ {
+ char c, unwritten_part[MAX_LINE_WRAP+2];
+ int i, end, delimiter, nesting;
+
+ prev_line_was_wrapped = 0;
+
+ /* Limit how far to the left we'll search to about wrap_column/2 */
+ end = wrap_column/2;
+ if (end < prefix_len)
+ end = prefix_len;
+
+ /* Search left the the first blank to the left of the wrap point.
+ We assume that bracketed entities (e.g., quoted strings,
+ parenthetical entities, etc.) are written with a single
+ fprintf() so that we know to ignore blanks embedded within
+ pairs of these things. */
+
+ i = line_index - 1;
+ delimiter = nesting = 0;
+ while (i >= end)
+ {
+ c = curr_line[i];
+ if (curr_line[i-1] == '\\')
+ --i;
+ else if (nesting)
+ {
+ if (c == delimiter && --nesting <= 0)
+ delimiter = 0;
+ }
+ else if (c == '"' || c == '\'') {
+ delimiter = c; ++nesting;
+ } else if (c == ')') {
+ delimiter = '('; ++nesting;
+ } else if (c == ']') {
+ delimiter = '['; ++nesting;
+ } else if (c == '>') {
+ delimiter = '<'; ++nesting;
+ } else if (c == '}') {
+ delimiter = '{'; ++nesting;
+ } else if (c == ' ' && i < wrap_column)
+ break;
+ --i;
+ }
+
+ if (i < end)
+ return len;
+
+ /* The wrapped (unwritten) part is everthing to the right of the
+ blank found above. */
+
+ strcpy (unwritten_part, &curr_line[i+1]);
+
+ /* Delete trailing blanks on the left part we are going to print
+ and print it... */
+
+ while (curr_line[i] == ' ' && i >= end)
+ --i;
+ if (i < end)
+ return len;
+
+ curr_line[i+1] = '\n';
+ curr_line[i+2] = '\0';
+ prev_line_was_wrapped = 1;
+ fputs (curr_line, file);
+ fflush (file);
+
+ /* Write the wrapped portion, indented by the current prefix_len... */
+
+ line_index = prefix_len;
+ memset(curr_line, ' ', line_index);
+ curr_line[line_index] = '\0';
+
+ dmp_tree_fprintf (file, "%s", unwritten_part);
+ }
+
+ return len;
+}
+
+int
+dmp_tree_fputc (c, file)
+ int c;
+ FILE *file;
+{
+ dmp_tree_fprintf (file, "%c", c);
+ return c;
+}
+
+int
+dmp_tree_fputs (s, file)
+ const char *s;
+ FILE *file;
+{
+ return dmp_tree_fprintf (file, "%s", s);
+}
+
+#endif /* DMP_TREE_WRAPPED_OUTPUT */
+
+/*-------------------------------------------------------------------*/
+
+/* Special routine called for debugging chains only. This is NOT a
+ tree node type. */
+
+void print_TREE_CHAIN PARAMS ((tree));
+
+void
+print_TREE_CHAIN (node)
+ tree node;
+{
+ while (node)
+ {
+ dump_tree (stderr, NULL, node, 0); /* keep list at same indent */
+ node = TREE_CHAIN (node);
+ }
+}
+
diff --git a/gcc/dmp-tree.h b/gcc/dmp-tree.h
new file mode 100644
index 00000000000..e45beb61e8c
--- /dev/null
+++ b/gcc/dmp-tree.h
@@ -0,0 +1,116 @@
+/* APPLE LOCAL new tree dump */
+/* Common condenced tree display routine definitions.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef GCC_DMP_TREE_H
+#define GCC_DMP_TREE_H
+
+/* Language-specific initialization */
+typedef int (*lang_dump_tree_p_t) PARAMS ((FILE *, const char *, tree, int));
+extern lang_dump_tree_p_t set_dump_tree_p PARAMS ((lang_dump_tree_p_t));
+
+/* Main entry */
+extern void dmp_tree PARAMS ((tree));
+extern void dmp_tree1 PARAMS ((tree, int));
+extern void dmp_tree2 PARAMS ((tree));
+extern void dmp_tree3 PARAMS ((FILE *, tree, int));
+
+/* Recursive entry */
+extern void dump_tree PARAMS ((FILE *, const char *, tree, int));
+
+/* Special purpose node routines */
+extern int node_seen PARAMS ((tree, int));
+extern void newline_and_indent PARAMS ((FILE *, int));
+extern void print_type PARAMS ((FILE *, const char *, tree, int));
+extern void print_decl PARAMS ((FILE *, const char *, tree, int));
+extern void print_ref PARAMS ((FILE *, const char *, tree, int));
+extern void print_operands PARAMS ((FILE *file, tree, int, int, ...));
+extern void print_lineno PARAMS ((FILE *, tree));
+extern void print_integer_constant PARAMS ((FILE *, tree, int));
+extern void print_real_constant PARAMS ((FILE *, tree));
+extern void print_string_constant PARAMS ((FILE *, const char *, int));
+extern void print_tree_flags PARAMS ((FILE *, tree));
+
+/* State switches for dmp_tree() to tell it how to record and handle
+ previously visited nodes. */
+enum dmp_tree_visit_state {
+ DMP_TREE_VISIT_ANY, /* allow display of any node anytime */
+ DMP_TREE_VISIT_ONCE, /* only display once per dmp_tree() */
+ DMP_TREE_VISIT_ONCE1, /* only once, but need to init hash */
+ DMP_TREE_VISIT_ONCE2 /* only once, but do not clear hash */
+};
+
+typedef struct { /* dmp_tree.c state switches... */
+ int max_code; /* max_node_code must be 1st */
+ int nesting_depth;
+ int dump_full_type;
+ int really_follow;
+ int doing_parm_decl;
+ int doing_call_expr;
+ char *curr_file;
+ int no_new_line;
+ int line_cnt;
+ int doing_tree_list;
+ int max_depth;
+ enum dmp_tree_visit_state visit_only_once;
+} dump_tree_state_t;
+
+extern dump_tree_state_t dump_tree_state;
+
+#define SET_MAX_DMP_TREE_CODE(code) \
+ dump_tree_state.max_code = MAX(dump_tree_state.max_code, (int)(code))
+
+/*-------------------------------------------------------------------*/
+
+/* DMP_TREE is ONLY defined by the actual tree dumping code to cause
+ some common definitions that they specifically use. */
+
+#ifdef DMP_TREE
+
+/* The DMP_TREE_WRAPPED_OUTPUT switch is a master contol on wheter we
+ actually use these routines. */
+#define DMP_TREE_WRAPPED_OUTPUT 1
+
+#if DMP_TREE_WRAPPED_OUTPUT
+
+/* The following redefines fprintf, fputs, fputc as calls to our routines
+ which handle line wrapping of long node line displays. It is assumed
+ that this header is the last #include in the tree dump file's include
+ list and that DMP_TREE is defined by those files (e.g., dmp-tree.c)
+ that which to use these output routines. */
+
+extern int dmp_tree_fprintf PARAMS ((FILE *, const char *, ...));
+extern int dmp_tree_fputc PARAMS((int, FILE *));
+extern int dmp_tree_fputs PARAMS((const char *, FILE *));
+
+#define fprintf dmp_tree_fprintf
+#define fputc dmp_tree_fputc
+#define fputs dmp_tree_fputs
+#endif /* DMP_TREE_WRAPPED_OUTPUT */
+
+#define HOST_PTR_PRINTF_VALUE(p) (char *) (p)
+
+#define INDENT 1 /* controls nesting tab value */
+
+#endif /* DMP_TREE */
+
+
+#endif /* GCC_DMP_TREE_H */
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 5d1cb9b3029..399658256d6 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -759,9 +759,11 @@ named @var{file} in a standard list of system directories. You can prepend
directories to this list with the @option{-I} option (@pxref{Invocation}).
@item #include "@var{file}"
-This variant is used for header files of your own program. It searches
-for a file named @var{file} first in the directory containing the
-current file, then in the same directories used for @code{<@var{file}>}.
+This variant is used for header files of your own program. It
+searches for a file named @var{file} first in the directory containing
+the current file, then in the quote directories and then the same
+directories used for @code{<@var{file}>}. You can prepend directories
+to the list of quote directories with the @option{-iquote} option.
@end table
The argument of @samp{#include}, whether delimited with quote marks or
@@ -883,9 +885,10 @@ standard C library facilities, or the standard C library itself.
@option{-nostdinc} is in effect.
GCC looks for headers requested with @code{@w{#include "@var{file}"}}
-first in the directory containing the current file, then in the same
-places it would have looked for a header requested with angle brackets.
-For example, if @file{/usr/include/sys/stat.h} contains
+first in the directory containing the current file, then in the
+directories as specified by @option{-iquote} options, then in the same
+places it would have looked for a header requested with angle
+brackets. For example, if @file{/usr/include/sys/stat.h} contains
@code{@w{#include "types.h"}}, GCC looks for @file{types.h} first in
@file{/usr/include/sys}, then in its usual search path.
@@ -898,7 +901,8 @@ This has two effects. First, directories appearing before the
quote marks. Directories after @option{-I-} are searched for all
headers. Second, the directory containing the current file is not
searched for anything, unless it happens to be one of the directories
-named by an @option{-I} switch.
+named by an @option{-I} switch. @option{-I-} is deprecated, -iquote
+should be used instead.
@option{-I. -I-} is not the same as no @option{-I} options at all, and does
not cause the same behavior for @samp{<>} includes that @samp{""}
@@ -4039,6 +4043,11 @@ they generally represent bugs in the snapshots.
@itemize @bullet
+@item -I- deprecated
+
+This option has been deprecated in 3.5. @option{-iquote} is meant to
+replace the need for this option.
+
@item Order of evaluation of @samp{#} and @samp{##} operators
The standard does not specify the order of evaluation of a chain of
@@ -4131,7 +4140,8 @@ without notice.
@ignore
@c man begin SYNOPSIS
cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
- [@option{-I}@var{dir}@dots{}] [@option{-W}@var{warn}@dots{}]
+ [@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}]
+ [@option{-W}@var{warn}@dots{}]
[@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}]
[@option{-MP}] [@option{-MQ} @var{target}@dots{}]
[@option{-MT} @var{target}@dots{}]
diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index fb8f5c72122..59e6dd6e4b4 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -234,6 +234,12 @@ preprocessed output.
When used with the driver options @option{-MD} or @option{-MMD},
@option{-MF} overrides the default dependency output file.
+@c APPLE LOCAL begin -dependency-file
+@item -dependency-file
+@opindex dependency-file @var{name}
+Like @option{-MF}. (APPLE ONLY)
+@c APPLE LOCAL end -dependency-file
+
@item -MG
@opindex MG
In conjunction with an option such as @option{-M} requesting
@@ -327,13 +333,17 @@ header is used.
@item -x c
@itemx -x c++
@itemx -x objective-c
+@c APPLE LOCAL Objective-C++
+@itemx -x objective-c++
@itemx -x assembler-with-cpp
@opindex x
-Specify the source language: C, C++, Objective-C, or assembly. This has
+@c APPLE LOCAL Objective-C++
+Specify the source language: C, C++, Objective-C, Objective-C++, or assembly. This has
nothing to do with standards conformance or extensions; it merely
selects which base syntax to expect. If you give none of these options,
cpp will deduce the language from the extension of the source file:
-@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common
+@c APPLE LOCAL Objective-C++
+@samp{.c}, @samp{.cc}, @samp{.m}, @samp{.mm}, or @samp{.S}. Some other common
extensions for C++ and assembly are also recognized. If cpp does not
recognize the extension, it will treat the file as C; this is the most
generic mode.
@@ -400,6 +410,7 @@ file directory as the first search directory for @code{@w{#include
@ifset cppmanual
@xref{Search Path}.
@end ifset
+This option has been deprecated.
@item -nostdinc
@opindex nostdinc
@@ -466,6 +477,16 @@ is applied to the standard system directories.
@xref{System Headers}.
@end ifset
+@item -iquote @var{dir}
+@opindex iquote
+Search @var{dir} only for header files requested with
+@code{@w{#include "@var{file}"}}; they are not searched for
+@code{@w{#include <@var{file}>}}, before all directories specified by
+@option{-I} and before the standard system directories.
+@ifset cppmanual
+@xref{Search Path}.
+@end ifset
+
@item -fdollars-in-identifiers
@opindex fdollars-in-identifiers
@anchor{fdollars-in-identifiers}
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index b396227bb84..ebb5e375d22 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -454,6 +454,10 @@ extensions, accepted by GCC in C89 mode and in C++.
* C++ Comments:: C++ comments are recognized.
* Dollar Signs:: Dollar sign is allowed in identifiers.
* Character Escapes:: @samp{\e} stands for the character @key{ESC}.
+@c APPLE LOCAL begin Pascal strings 2001-07-05 zll **
+* Pascal Strings:: Constructing string literals with a Pascal-style
+ length byte.
+@c APPLE LOCAL end Pascal strings 2001-07-05 zll **
* Variable Attributes:: Specifying attributes of variables.
* Type Attributes:: Specifying attributes of types.
* Alignment:: Inquiring about the alignment of a type or variable.
@@ -2389,7 +2393,9 @@ calls are necessary.
@item long_call/short_call
@cindex indirect calls on ARM
This attribute specifies how a particular function is called on
-ARM@. Both attributes override the @option{-mlong-calls} (@pxref{ARM Options})
+@c APPLE LOCAL prune man page
+ARM@. Both attributes override the @option{-mlong-calls}
+@c (@pxref{ARM Options})
command line switch and @code{#pragma long_calls} settings. The
@code{long_call} attribute causes the compiler to always call the
function by first loading its address into a register and then using the
@@ -2965,6 +2971,62 @@ machines, typically because the target assembler does not allow them.
You can use the sequence @samp{\e} in a string or character constant to
stand for the ASCII character @key{ESC}.
+@c APPLE LOCAL begin Pascal strings 2001-07-05 zll **
+@node Pascal Strings
+@section Constructing String Literals with a Pascal-style Length Byte
+@cindex Pascal length byte
+@cindex Pascal strings
+
+Specifying the @w{@option{-fpascal-strings}} option will cause the
+compiler to recognize and construct Pascal-style string literals. This
+functionality is disabled by default; furthermore, its use in new code
+is discouraged.
+
+Pascal string literals take the form @samp{"\pstring"}. The special
+escape sequence @samp{\p} denotes the Pascal length byte for the string,
+and will be replaced at compile time with the number of characters that
+follow. The @samp{\p} may only appear at the beginning of a string
+literal, and may @emph{not} appear in wide string literals or as an
+integral constant.
+
+As is the case with C string literals, Pascal string literals are
+terminated with a NUL character; this character is @emph{not} counted
+when computing the value of the length byte. The maximum @samp{unsigned
+char} value that can be stored in the length byte is also the maximum
+permissible length for the Pascal literal itself. On most target
+platforms, this value is 255 (excluding both the length byte and the
+terminating NUL).
+
+Pascal-style literals are treated by the compiler as being of type
+@samp{const unsigned char []} in C++ and @samp{unsigned char []} (or
+@samp{const unsigned char []}, if the @w{@option{-Wwrite-strings}}
+option is given) in C. Pascal string literals may be used as static
+initializers for @samp{char} arrays (whose elements need not be
+@samp{unsigned} or @samp{const}). They may also be converted to
+@samp{const unsigned char *} and, in the C language to @samp{const char
+*} of any signedness (In C, if the @w{@option{-Wwrite-strings}} is not
+given, then @samp{const} may be omitted as well). For example:
+
+@example
+const unsigned char a[] = "\pHello";
+char b[] = "\pGoodbye";
+const unsigned char *c = "\pHello";
+const signed char *d = "\pHello"; /* error in C++ */
+char *e = "\pHi"; /* error in C++; warning in C with -Wwrite-strings */
+unsigned char *f = "\pHello"; /* error in C++ */
+@end example
+
+@noindent
+In all other respects, Pascal-style string literals behave the same as
+ordinary string literals. For example, if a program attempts to modify
+the conents of a Pascal-style string literal at run-time, the behaviour
+is undefined, unless the @w{@option{-fwritable-strings}} option is used.
+
+Pascal-style literals are useful for calling external routines that
+expect Pascal strings as arguments, as is true with some Apple MacOS
+Toolbox calls.
+@c APPLE LOCAL end Pascal strings 2001-07-05 zll **
+
@node Alignment
@section Inquiring on Alignment of Types or Variables
@cindex alignment
@@ -6422,7 +6484,11 @@ vector unsigned int vec_mulo (vector unsigned short,
vector signed int vec_mulo (vector signed short, vector signed short);
vector float vec_nmsub (vector float, vector float, vector float);
+@c APPLE LOCAL begin fixhtml mrs
+@end smallexample
+@smallexample
+@c APPLE LOCAL end fixhtml mrs
vector float vec_nor (vector float, vector float);
vector signed int vec_nor (vector signed int, vector signed int);
vector unsigned int vec_nor (vector unsigned int, vector unsigned int);
@@ -6988,7 +7054,11 @@ vector signed int vec_any_eq (vector signed char, vector unsigned char);
vector signed int vec_any_eq (vector signed char, vector signed char);
vector signed int vec_any_eq (vector unsigned char, vector signed char);
+@c APPLE LOCAL begin fixhtml mrs
+@end smallexample
+@smallexample
+@c APPLE LOCAL end fixhtml mrs
vector signed int vec_any_eq (vector unsigned char,
vector unsigned char);
vector signed int vec_any_eq (vector signed short,
diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi
index a682ee33822..c1b6d2c22d6 100644
--- a/gcc/doc/gcc.texi
+++ b/gcc/doc/gcc.texi
@@ -153,6 +153,8 @@ Introduction, gccint, GNU Compiler Collection (GCC) Internals}.
* Copying:: GNU General Public License says
how you can copy and share GCC.
+@c APPLE LOCAL GPL compliance
+* Source Code:: How to get the source code for this compiler.
* GNU Free Documentation License:: How you can copy and share this manual.
* Contributors:: People who have contributed to GCC.
@@ -174,6 +176,8 @@ Introduction, gccint, GNU Compiler Collection (GCC) Internals}.
@include funding.texi
@include gnu.texi
+@c APPLE LOCAL GPL compliance
+@include sourcecode.texi
@include gpl.texi
@c ---------------------------------------------------------------------
diff --git a/gcc/doc/include/sourcecode.texi b/gcc/doc/include/sourcecode.texi
new file mode 100644
index 00000000000..f2e867d2db4
--- /dev/null
+++ b/gcc/doc/include/sourcecode.texi
@@ -0,0 +1,35 @@
+@c APPLE LOCAL entire file
+@node Source Code
+@unnumbered Source Code
+
+The source code for Apple's versions of GCC is available using
+anonymous CVS, from
+@samp{:pserver:anonymous@@anoncvs.opensource.apple.com:/cvs/root}
+with password @samp{anonymous}, as module @samp{gcc3}.
+
+For example, you can fetch the latest version by entering:
+
+@smallexample
+$ cvs -d :pserver:anonymous@@anoncvs.opensource.apple.com:/cvs/root login
+Password: anonymous
+$ cvs -d :pserver:anonymous@@anoncvs.opensource.apple.com:/cvs/root -z6 \
+ co gcc3
+@end smallexample
+
+Each version will be tagged based on its build number, which
+you can find by executing @samp{gcc --version}; for instance, if this prints
+
+@smallexample
+gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1402)
+@end smallexample
+
+then the build number is 1402. Some older compilers may require you
+use @samp{gcc -v} to obtain the build number. Most versions are
+tagged like @samp{gcc-1402}; you can find a list of suitable tags with
+a command like @samp{cvs log gcc3/gcc/version.c}. Once you have the
+tag, you can use the @samp{-r} flag to CVS, for instance
+
+@smallexample
+$ cvs -d :pserver:anonymous@@anoncvs.opensource.apple.com:/cvs/root -z6 \
+ co -r gcc-1402 gcc3
+@end smallexample
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ebf7d711d50..ae7e52cb4f8 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -40,6 +40,21 @@ gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
Only the most useful options are listed here; see below for the
remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
+
+@c APPLE LOCAL begin manual
+In Apple's version of GCC, both @samp{cc} and @samp{gcc} are actually
+symbolic links to a compiler named like @samp{gcc-3.4}; which compiler
+is linked to may be changed using the command @samp{gcc_select}.
+Similarly, @samp{c++} and @samp{g++} are links to a compiler named like
+@samp{g++-3.4}.
+
+Note that Apple's GCC includes a number of extensions to standard GCC
+(flagged below with ``APPLE ONLY''), and that not all generic GCC
+options are available or supported on Darwin / Mac OS X. In particular,
+Apple does not currently support the compilation of Fortran, Ada, or
+Java, although there are third parties who have made these work.
+@c APPLE LOCAL begin manual
+
@c man end
@c man begin SEEALSO
gpl(7), gfdl(7), fsf-funding(7),
@@ -48,9 +63,10 @@ and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
@file{ld}, @file{binutils} and @file{gdb}.
@c man end
@c man begin BUGS
-For instructions on reporting bugs, see
-@w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug}
-script to report bugs is recommended.
+@c APPLE LOCAL begin report bugs to Apple
+To report bugs to Apple, see
+@w{@uref{http://developer.apple.com/bugreporter}}.
+@c APPLE LOCAL end report bugs to Apple
@c man end
@c man begin AUTHOR
See the Info entry for @command{gcc}, or
@@ -156,16 +172,40 @@ in the following sections.
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{-c -S -E -o @var{file} -pipe -pass-exit-codes @gol
+@c APPLE LOCAL -ObjC 2001-08-03 sts **
+-ObjC (APPLE ONLY) -ObjC++ (APPLE ONLY) @gol
+@c APPLE LOCAL fat builds
+-arch @var{arch} (APPLE ONLY) @gol
-x @var{language} -v -### --help --target-help --version}
@item C Language Options
@xref{C Dialect Options,,Options Controlling C Dialect}.
@gccoptlist{-ansi -std=@var{standard} -aux-info @var{filename} @gol
+@c APPLE LOCAL AltiVec
+-faltivec (APPLE ONLY) @gol
-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
-fhosted -ffreestanding -fms-extensions @gol
-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
-fallow-single-precision -fcond-mismatch @gol
+@c APPLE LOCAL constant cfstrings mrs
+-fconstant-cfstrings (APPLE ONLY) @gol
+@c APPLE LOCAL pch distcc mrs
+-fpch-preprocess (APPLE ONLY) @gol
-fsigned-bitfields -fsigned-char @gol
+@c APPLE LOCAL Pascal strings 2001-07-05 zll **
+-fpascal-strings (APPLE ONLY) @gol
+@c APPLE LOCAL coalescing 2002-04-11 tur **
+-fcoalesce (APPLE ONLY) -fweak-coalesced (APPLE ONLY) @gol
+@c APPLE LOCAL -Wno-#warnings
+-Wno-#warnings (APPLE ONLY) @gol
+@c APPLE LOCAL -Wextra-tokens 2001-08-02 sts **
+-Wextra-tokens (APPLE ONLY) @gol
+@c APPLE LOCAL -Wpragma-once 2001-08-01 sts **
+-Wpragma-once (APPLE ONLY) @gol
+@c APPLE LOCAL -Wnewline-eof 2001-08-23 sts **
+-Wnewline-eof (APPLE ONLY) @gol
+@c APPLE LOCAL -Wno-altivec-long-deprecated ilr **
+-Wno-altivec-long-deprecated (APPLE ONLY)
-funsigned-bitfields -funsigned-char}
@item C++ Language Options
@@ -177,7 +217,14 @@ in the following sections.
-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
-fno-implicit-templates @gol
-fno-implicit-inline-templates @gol
--fno-implement-inlines -fms-extensions @gol
+-fno-implement-inlines @gol
+@c APPLE LOCAL -findirect-virtual-calls 2001-10-30 sts **
+-findirect-virtual-calls (APPLE ONLY) @gol
+@c APPLE LOCAL -fapple-kext
+-fapple-kext (APPLE ONLY) @gol
+@c APPLE LOCAL coalescing 2002-04-11 tur **
+-fcoalesce-templates (APPLE ONLY) @gol
+-fms-extensions @gol
-fno-nonansi-builtins -fno-operator-names @gol
-fno-optional-diags -fpermissive @gol
-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
@@ -214,15 +261,19 @@ in the following sections.
-Wconversion -Wno-deprecated-declarations @gol
-Wdisabled-optimization -Wno-div-by-zero -Wendif-labels @gol
-Werror -Werror-implicit-function-declaration @gol
--Wfloat-equal -Wformat -Wformat=2 @gol
+-Wfloat-equal -Wfour-char-constants -Wformat -Wformat=2 @gol
-Wno-format-extra-args -Wformat-nonliteral @gol
-Wformat-security -Wformat-y2k @gol
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
-Wimport -Wno-import -Winit-self -Winline @gol
--Wno-invalid-offsetof -Winvalid-pch @gol
+-Wno-invalid-offsetof -Winvalid-pch -Winvalid-sr @gol
-Wlarger-than-@var{len} -Wlong-long @gol
+@c APPLE LOCAL -Wlong-double
+-Wno-long-double (APPLE ONLY) @gol
-Wmain -Wmissing-braces @gol
-Wmissing-format-attribute -Wmissing-noreturn @gol
+@c APPLE LOCAL -Wmost
+-Wmost (APPLE ONLY) @gol
-Wno-multichar -Wnonnull -Wpacked -Wpadded @gol
-Wparentheses -Wpointer-arith -Wredundant-decls @gol
-Wreturn-type -Wsequence-point -Wshadow @gol
@@ -254,6 +305,9 @@ in the following sections.
-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
+-fdump-tree-scev @r{[}-@var{n}@r{]} @gol
+-fdump-tree-ddall @r{[}-@var{n}@r{]}@gol
+-fdump-tree-elck @r{[}-@var{n}@r{]} @gol
-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
@@ -261,6 +315,7 @@ in the following sections.
-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
-fdump-tree-nrv @gol
-fdump-tree-loop@r{[}-@var{n}@r{]} -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
+-fdump-tree-vect@r{[}-@var{n}@r{]}@gol
-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
-feliminate-unused-debug-symbols -fmem-report -fprofile-arcs -ftree-based-profiling @gol
-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
@@ -270,7 +325,9 @@ in the following sections.
-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
-print-multi-directory -print-multi-lib @gol
-print-prog-name=@var{program} -print-search-dirs -Q @gol
--save-temps -time}
+@c APPLE LOCAL Symbol Separation
+@c APPLE LOCAL -fsave-repository and -grepository
+-save-temps -time -fsave-repository=@var{location} -grepository}
@item Optimization Options
@xref{Optimize Options,,Options that Control Optimization}.
@@ -298,7 +355,7 @@ in the following sections.
-foptimize-sibling-calls -fprefetch-loop-arrays @gol
-fprofile-generate -fprofile-use @gol
-freduce-all-givs -fregmove -frename-registers @gol
--freorder-blocks -freorder-functions @gol
+-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
-frerun-cse-after-loop -frerun-loop-opt @gol
-frounding-math -fschedule-insns -fschedule-insns2 @gol
-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol
@@ -313,6 +370,8 @@ in the following sections.
-ftree-pre -ftree-ccp -ftree-dce -ftree-copyprop @gol
-ftree-dominator-opts -ftree-dse -ftree-copyrename @gol
-ftree-ch -ftree-loop-optimize -ftree-sra @gol
+-fscalar-evolutions -fall-data-deps @gol
+-ftree-vectorize @gol
--param @var{name}=@var{value}
-O -O0 -O1 -O2 -O3 -Os}
@@ -338,6 +397,8 @@ in the following sections.
@item Linker Options
@xref{Link Options,,Options for Linking}.
@gccoptlist{@var{object-file-name} -l@var{library} @gol
+@c APPLE LOCAL radar 2466994 - -no-c++filt ilr
+-no-c++filt (APPLE ONLY) @gol
-nostartfiles -nodefaultlibs -nostdlib -pie @gol
-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
-Wl,@var{option} -Xlinker @var{option} @gol
@@ -345,7 +406,7 @@ in the following sections.
@item Directory Options
@xref{Directory Options,,Options for Directory Search}.
-@gccoptlist{-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}}
+@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} -specs=@var{file} -I-}
@item Target Options
@c I wrote this xref this way to avoid overfull hbox. -- rms
@@ -355,6 +416,9 @@ in the following sections.
@item Machine Dependent Options
@xref{Submodel Options,,Hardware Models and Configurations}.
+@c APPLE LOCAL prune man page
+@ignore
+
@emph{M680x0 Options}
@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol
@@ -425,6 +489,9 @@ in the following sections.
-mno-flush-trap -mflush-trap=@var{number} @gol
-G @var{num}}
+@c APPLE LOCAL prune man page
+@end ignore
+
@emph{RS/6000 and PowerPC Options}
@gccoptlist{-mcpu=@var{cpu-type} @gol
-mtune=@var{cpu-type} @gol
@@ -436,7 +503,8 @@ in the following sections.
-mnew-mnemonics -mold-mnemonics @gol
-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
-m64 -m32 -mxl-call -mno-xl-call -mpe @gol
--malign-power -malign-natural @gol
+@c APPLE LOCAL -malign-mac68k
+-malign-mac68k (APPLE ONLY) @gol
-msoft-float -mhard-float -mmultiple -mno-multiple @gol
-mstring -mno-string -mupdate -mno-update @gol
-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
@@ -444,6 +512,8 @@ in the following sections.
-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
-mdynamic-no-pic @gol
+@c APPLE LOCAL long-branch
+-mlong-branch (APPLE ONLY) @gol
-mprioritize-restricted-insns=@var{priority} @gol
-msched-costly-dep=@var{dependence_type} @gol
-minsert-sched-nops=@var{scheme} @gol
@@ -478,7 +548,10 @@ in the following sections.
-single_module -static -sub_library -sub_umbrella @gol
-twolevel_namespace -umbrella -undefined @gol
-unexported_symbols_list -weak_reference_mismatches @gol
--whatsloaded}
+-whatsloaded -F}
+
+@c APPLE LOCAL prune man page
+@ignore
@emph{MIPS Options}
@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
@@ -499,6 +572,9 @@ in the following sections.
-mflush-func=@var{func} -mno-flush-func @gol
-mbranch-likely -mno-branch-likely}
+@c APPLE LOCAL prune man page
+@end ignore
+
@emph{i386 and x86-64 Options}
@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
-mfpmath=@var{unit} @gol
@@ -514,6 +590,9 @@ in the following sections.
-mcmodel=@var{code-model} @gol
-m32 -m64}
+@c APPLE LOCAL prune man page
+@ignore
+
@emph{HPPA Options}
@gccoptlist{-march=@var{architecture-type} @gol
-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
@@ -660,6 +739,8 @@ in the following sections.
-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
-mno-nested-cond-exec -mtomcat-stats @gol
-mcpu=@var{cpu}}
+@c APPLE LOCAL prune man page
+@end ignore
@item Code Generation Options
@xref{Code Gen Options,,Options for Code Generation Conventions}.
@@ -748,6 +829,15 @@ C++ source code which must be preprocessed. Note that in @samp{.cxx},
the last two letters must both be literally @samp{x}. Likewise,
@samp{.C} refers to a literal capital C@.
+@c APPLE LOCAL begin Objective-C++
+@item @var{file}.mm
+@itemx @var{file}.M
+Objective-C++ source code which must be preprocessed. (APPLE ONLY)
+
+@item @var{file}.mii
+Objective-C++ source code which should not be preprocessed. (APPLE ONLY)
+@c APPLE LOCAL end Objective-C++
+
@item @var{file}.hh
@itemx @var{file}.H
C++ header file to be turned into a precompiled header.
@@ -798,7 +888,9 @@ package body). Such files are also called @dfn{bodies}.
@c @var{file}.pas
@item @var{file}.s
-Assembler code.
+@c APPLE LOCAL preprocess .s files
+Assembler code. Apple's version of GCC runs the preprocessor
+on these files as well as those ending in @samp{.S}.
@item @var{file}.S
Assembler code which must be preprocessed.
@@ -821,6 +913,8 @@ the next @option{-x} option. Possible values for @var{language} are:
c c-header cpp-output
c++ c++-header c++-cpp-output
objective-c objective-c-header objc-cpp-output
+@c APPLE LOCAL Objective-C++
+objective-c++ (APPLE ONLY) objective-c++-header (APPLE ONLY)
assembler assembler-with-cpp
ada
f77 f77-cpp-input ratfor
@@ -834,6 +928,27 @@ Turn off any specification of a language, so that subsequent files are
handled according to their file name suffixes (as they are if @option{-x}
has not been used at all).
+@c APPLE LOCAL begin -ObjC 2001-08-03 sts **
+@item -ObjC
+@item -ObjC++
+@opindex ObjC
+@opindex ObjC++
+These are similar in effect to @option{-x objective-c} and @option{-x
+objective-c++}, but affect only the choice of compiler for files already
+identified as source files. (APPLE ONLY)
+@c APPLE LOCAL end -ObjC 2001-08-03 sts **
+
+@c APPLE LOCAL begin fat builds
+@item -arch @var{arch}
+Compile for the specified target architecture @var{arch}. The allowable
+values are @samp{i386} and @samp{ppc}. Multiple options work, and
+direct the compiler to produce ``fat'' binaries including object code
+for each architecture specified with @option{-arch}. This option only
+works if assembler and libraries are available for each architecture
+specified. (APPLE ONLY)
+@opindex arch
+@c APPLE LOCAL end fat builds
+
@item -pass-exit-codes
@opindex pass-exit-codes
Normally the @command{gcc} program will exit with the code of 1 if any
@@ -1088,6 +1203,16 @@ character). In the case of function definitions, a K&R-style list of
arguments followed by their declarations is also provided, inside
comments, after the declaration.
+@c APPLE LOCAL begin AltiVec
+@item -faltivec
+Enable the AltiVec language extensions, as defined in Motorola's AltiVec
+PIM. This includes the recognition of @code{vector} and @code{pixel} as
+(context-dependent) keywords, the definition of built-in functions such
+as @code{vec_add}, and other extensions. Note that unlike the option
+@samp{-maltivec}, the extensions do not require the inclusion of any
+special header files. (APPLE ONLY)
+@c APPLE LOCAL end AltiVec
+
@item -fno-asm
@opindex fno-asm
Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
@@ -1195,6 +1320,12 @@ Allow conditional expressions with mismatched types in the second and
third arguments. The value of such an expression is void. This option
is not supported for C++.
+@c APPLE LOCAL BEGIN pch distcc mrs
+@item -fpch-preprocess
+@opindex fpch-preprocess
+Enable PCH processing even when @option{-E} or @option{-save-temps} is used.
+@c APPLE LOCAL END pch distcc mrs
+
@item -funsigned-char
@opindex funsigned-char
Let the type @code{char} be unsigned, like @code{unsigned char}.
@@ -1234,6 +1365,37 @@ These options control whether a bit-field is signed or unsigned, when the
declaration does not use either @code{signed} or @code{unsigned}. By
default, such a bit-field is signed, because this is consistent: the
basic integer types such as @code{int} are signed types.
+
+@c APPLE LOCAL begin constant cfstrings
+@item -fconstant-cfstrings
+@opindex fconstant-cfstrings
+Enable the automatic creation of a CoreFoundation-type constant string
+whenever a special builtin @code{__builtin__CFStringMakeConstantString}
+is called on a literal string. (APPLE ONLY)
+@c APPLE LOCAL end constant cfstrings
+
+@c APPLE LOCAL begin Pascal strings 2001-07-05 zll **
+@item -fpascal-strings
+Allow Pascal-style string literals to be constructed. (APPLE ONLY)
+
+@xref{Pascal Strings,,Constructing String Literals with a Pascal-style
+Length Byte}, for more information on the syntax and semantics of Pascal
+string literals.
+@c APPLE LOCAL end Pascal strings 2001-07-05 zll **
+
+@c APPLE LOCAL begin coalescing 2002-04-11 turly **
+@item -fcoalesce
+@opindex fcoalesce
+Coalesce duplicated functions and data. The linker will discard all
+but one, saving space. Enabled by default. (APPLE ONLY)
+
+@item -fweak-coalesced
+@opindex fweak-coalesced
+Use the new OS X "weak_definitions" section attribute for coalesced items.
+A single "normal" definition will be chosen by the linker over any number
+of weakly-coalesced ones. (APPLE ONLY)
+@c APPLE LOCAL end coalescing 2002-04-11 turly **
+
@end table
@node C++ Dialect Options
@@ -1365,6 +1527,30 @@ To save space, do not emit out-of-line copies of inline functions
controlled by @samp{#pragma implementation}. This will cause linker
errors if these functions are not inlined everywhere they are called.
+@c APPLE LOCAL begin -findirect-virtual-calls 2001-10-30 sts **
+@item -findirect-virtual-calls
+@opindex findirect-virtual-calls
+Do not make direct calls to virtual functions; instead, always
+go through the vtable. (APPLE ONLY)
+@c APPLE LOCAL end -findirect-virtual-calls 2001-10-30 sts **
+
+@c APPLE LOCAL begin -fapple-kext
+@item -fapple-kext
+@opindex fapple-kext
+Alter vtables, destructors, and other implementation details to more
+closely resemble the GCC 2.95 ABI. This is to make kernel extensions
+loadable by Darwin kernels, and is required to build any Darwin kernel
+extension. @option{-fno-exceptions} and @option{-static} must also be
+used with this flag. (APPLE ONLY)
+@c APPLE LOCAL end -fapple-kext
+
+@c APPLE LOCAL begin coalescing 2002-04-11 turly **
+@item -fcoalesce-templates
+@opindex fcoalesce-templates
+Mark instantiated templates as "coalesced": the linker will discard
+all but one, thus saving space. (APPLE ONLY)
+@c APPLE LOCAL end coalescing 2002-04-11 turly **
+
@item -fms-extensions
@opindex fms-extensions
Disable pedantic warnings about constructs used in MFC, such as implicit
@@ -1428,6 +1614,8 @@ Register destructors for objects with static storage duration with the
This option is required for fully standards-compliant handling of static
destructors, but will only work if your C library supports
@code{__cxa_atexit}.
+@c APPLE LOCAL manual
+This option is not supported on Mac OS X.
@item -fno-weak
@opindex fno-weak
@@ -2060,6 +2248,37 @@ Inhibit all warning messages.
@opindex Wno-import
Inhibit warning messages about the use of @samp{#import}.
+@c APPLE LOCAL begin -Wno-#warnings
+@item -Wno-#warnings
+@opindex Wno-#warnings
+Inhibit warning messages issued by @samp{#warning}.
+@c APPLE LOCAL end -Wno-#warnings
+
+@c APPLE LOCAL begin -Wpragma-once 2001-08-01 sts **
+@item -Wpragma-once
+@opindex Wpragma-once
+Warn about the use of @samp{#pragma once}. (APPLE ONLY)
+@c APPLE LOCAL end -Wpragma-once 2001-08-01 sts **
+
+@c APPLE LOCAL begin -Wextra-tokens 2001-08-02 sts **
+@item -Wextra-tokens
+@opindex Wextra-tokens
+Warn about extra tokens at the end of prepreprocessor directives. (APPLE ONLY)
+@c APPLE LOCAL end -Wextra-tokens 2001-08-02 sts **
+
+@c APPLE LOCAL begin -Wnewline-eof 2001-08-23 sts **
+@item -Wnewline-eof
+@opindex Wnewline-eof
+Warn about files missing a newline at the end of the file. (APPLE ONLY)
+@c APPLE LOCAL end -Wnewline-eof 2001-08-23 sts **
+
+@c APPLE LOCAL begin -Wno-altivec-long-deprecated ilr **
+@item -Wno-altivec-long-deprecated
+@opindex Wno-altivec-long-deprecated
+Do not warn about the use of the deprecated 'long' keyword in
+AltiVec data types. (APPLE ONLY)
+@c APPLE LOCAL end -Wno-altivec-long-deprecated ilr **
+
@item -Wchar-subscripts
@opindex Wchar-subscripts
Warn if an array subscript has type @code{char}. This is a common cause
@@ -2479,6 +2698,11 @@ that are easy to avoid (or modify to prevent the warning), even in
conjunction with macros. This also enables some language-specific
warnings described in @ref{C++ Dialect Options} and
@ref{Objective-C Dialect Options}.
+
+@c APPLE LOCAL -Wmost
+@item -Wmost
+@opindex Wmost
+This is equivalent to -Wall -Wno-parentheses. (APPLE ONLY)
@end table
The following @option{-W@dots{}} options are not implied by @option{-Wall}.
@@ -2635,6 +2859,13 @@ would check to see whether the two values have ranges that overlap; and
this is done with the relational operators, so equality comparisons are
probably mistaken.
+@c APPLE LOCAL begin four char constants
+@item -Wfour-char-constants
+@opindex Wfour-char-constants
+Warn about four char constants, e.g. OSType 'APPL'. This warning is
+disabled by default.
+@c APPLE LOCAL end four char constants
+
@item -Wtraditional @r{(C only)}
@opindex Wtraditional
Warn about certain constructs that behave differently in traditional and
@@ -2861,12 +3092,16 @@ case, and some functions for which @code{format} attributes are
appropriate may not be detected. This option has no effect unless
@option{-Wformat} is enabled (possibly by @option{-Wall}).
+@c APPLE LOCAL Begin -Wfour-char-constants
@item -Wno-multichar
@opindex Wno-multichar
@opindex Wmultichar
Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
Usually they indicate a typo in the user's code, as they have
implementation-defined values, and should not be used in portable code.
+This flag does not control warning for a constant with four character,
+instead -Wfour-char-constants controls it.
+@c APPLE LOCAL End -Wfour-char-constants
@item -Wno-deprecated-declarations
@opindex Wno-deprecated-declarations
@@ -2968,6 +3203,19 @@ of the C++ standard.
Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
the search path but can't be used.
+@c APPLE LOCAL Begin Symbol Separation
+@item -Winvalid-sr
+@opindex Winvalid-sr
+Warn if a symbol repository is found in the search path but can't be
+used.
+@c APPLE LOCAL End Symbol Separation
+
+@c APPLE LOCAL begin -Wlong-double
+@item -Wno-long-double
+@opindex Wno-long-double
+Inhibit warning if the @samp{long double} type is used. (APPLE ONLY)
+@c APPLE LOCAL end -Wlong-double
+
@item -Wlong-long
@opindex Wlong-long
@opindex Wno-long-long
@@ -3017,8 +3265,9 @@ debugging information that only GDB can use; this extra information
makes debugging work better in GDB but will probably make other debuggers
crash or
refuse to read the program. If you want to control for certain whether
-to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
-@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
+@c APPLE LOCAL prune man page
+to generate the extra information, use @option{-gstabs+} or @option{-gstabs}
+(see below).
Unlike most other C compilers, GCC allows you to use @option{-g} with
@option{-O}. The shortcuts taken by optimized code may occasionally
@@ -3061,6 +3310,11 @@ using GNU extensions understood only by the GNU debugger (GDB)@. The
use of these extensions is likely to make other debuggers crash or
refuse to read the program.
+@c APPLE LOCAL prune man page
+(Other debug formats, such as @option{-gcoff}, are not supported in
+Darwin or Mac OS X.)
+@ignore
+
@item -gcoff
@opindex gcoff
Produce debugging information in COFF format (if that is supported).
@@ -3090,12 +3344,19 @@ supported). This is the format used by DBX on IRIX 6.
Produce debugging information in VMS debug format (if that is
supported). This is the format used by DEBUG on VMS systems.
+@c APPLE LOCAL prune man page
+@end ignore
+
@item -g@var{level}
@itemx -ggdb@var{level}
@itemx -gstabs@var{level}
+@c APPLE LOCAL prune man page
+@ignore
@itemx -gcoff@var{level}
@itemx -gxcoff@var{level}
@itemx -gvms@var{level}
+@c APPLE LOCAL prune man page
+@end ignore
Request debugging information and also use @var{level} to specify how
much information. The default level is 2.
@@ -3520,6 +3781,22 @@ appending @file{.dce} to the source file name.
Dump each function after adding mudflap instrumentation. The file name is
made by appending @file{.mudflap} to the source file name.
+@item scev
+@opindex fdump-tree-scev
+Dump the information gathered by the scalar evolution analyzer.
+The file name is made by appending @file{.scev} to the source file name.
+
+@item ddall
+@opindex fdump-tree-ddall
+Dump all the data dependence relations.
+The file name is made by appending @file{.ddall} to the source file name.
+
+@item elck
+@opindex fdump-tree-elck
+Dump each function after performing checks elimination based on scalar
+evolution informations. The file name is made by appending
+@file{.elck} to the source file name.
+
@item sra
@opindex fdump-tree-sra
Dump each function after performing scalar replacement of aggregates. The
@@ -3561,6 +3838,11 @@ file name.
Dump each function after applying tree-level loop optimizations. The file
name is made by appending @file{.loop} to the source file name.
+@item vect
+@opindex fdump-tree-vect
+Dump each function after applying tree-level loop vectorization. The file
+name is made by appending @file{.vect} to the source file name.
+
@item all
@opindex fdump-tree-all
Enable all the available tree dumps with the flags provided in this option.
@@ -3619,6 +3901,19 @@ executing the program itself. The second number is ``system time,''
time spent executing operating system routines on behalf of the program.
Both numbers are in seconds.
+@c APPLE LOCAL begin Symbol Separation
+@item -fsave-repository=@var{location}
+@opindex fsave-repository
+Creates separate symbol repository at @var{location} for given input
+header file. Separate repository contains only debugging symbols in
+stabs format.
+
+@item -grepository
+@opindex grepository
+Instructs compiler to use separate symbol repository with debugging
+symbols. Compiler searches for such repositories in include paths.
+@c APPLE LOCAL end Symbol Separation
+
@item -fvar-tracking
@opindex fvar-tracking
Run variable tracking pass. It computes where variables are stored at each
@@ -3795,6 +4090,12 @@ also turns on the following optimization flags:
Please note the warning under @option{-fgcse} about
invoking @option{-O2} on programs that use computed gotos.
+@c APPLE LOCAL begin optimization
+In Apple's version of GCC, @option{-fstrict-aliasing},
+@option{-freorder-blocks}, and @option{-fsched-interblock}
+are disabled by default when optimizing.
+@c APPLE LOCAL end optimization
+
@item -O3
@opindex O3
Optimize yet more. @option{-O3} turns on all optimizations specified by
@@ -3813,7 +4114,7 @@ optimizations designed to reduce code size.
@option{-Os} disables the following optimization flags:
@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
--falign-labels -freorder-blocks -fprefetch-loop-arrays}
+-falign-labels -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays}
If you use multiple @option{-O} options, with or without level numbers,
the last such option is the one that is effective.
@@ -4337,6 +4638,25 @@ usually increases code size.
Perform loop optimization on trees. This flag is enabled by
default at -O and higher.
+@item -ftree-vectorize
+Perform loop vectorization on trees. This flag is disabled by
+default.
+
+@item -fscalar-evolutions
+Analyzes the scalar variables that determine the exit condition of a
+loop, and try to determine the number of iterations. This pass is
+only used for verifying the correctness of the analyzer, and it is not
+enabled by default.
+
+@item -fall-data-deps
+Perform the data dependence analysis on all the data references. This
+pass is only used for verifying the correctness of the analyzer, and
+it is not enabled by default.
+
+@item -ftree-elim-checks
+Perform elimination of checks based on scalar evolution informations.
+This flag is disabled by default.
+
@item -ftree-sra
Perform scalar replacement of aggregates. This pass replaces structure
references with scalars to prevent committing structures to memory too
@@ -4438,6 +4758,15 @@ taken branches and improve code locality.
Enabled at levels @option{-O2}, @option{-O3}.
+ Enabled at levels @option{-O2}, @option{-O3}.
+
+@item -freorder-blocks-and-partition
+@opindex freorder-blocks-and-partition
+In addition to reordering basic blocks in the compiled function, in order
+to reduce number of taken branches, partitions hot and cold basic blocks
+into separate sections of the assembly and .o files, to improve
+paging and cache locality performance.
+
@item -freorder-functions
@opindex freorder-functions
Reorder basic blocks in the compiled function in order to reduce number of
@@ -5169,6 +5498,14 @@ The @option{reorder-block-duplicate-feedback} is used only when profile
feedback is available and may be set to higher values than
@option{reorder-block-duplicate} since information about the hot spots is more
accurate.
+
+@item max-sched-region-blocks
+The maximum number of blocks in a region to be considered for
+interblock scheduling. The default value is 10.
+
+@item max-sched-region-insns",
+The maximum number of insns in a region to be considered for
+interblock scheduling. The default value is 100.
@end table
@end table
@@ -5241,6 +5578,15 @@ These options come into play when the compiler links object files into
an executable output file. They are meaningless if the compiler is
not doing a link step.
+@c APPLE LOCAL begin linker flags
+In addition to the options listed below, Apple's GCC also accepts and
+passes nearly all of the options defined by the linker @samp{ld} and by
+the library tool @samp{libtool}. Common options include
+@samp{-framework}, @samp{-dynamic}, @samp{-bundle},
+@samp{-flat_namespace}, and so forth. See the ld and libtool man pages
+for further details.
+@c APPLE LOCAL end linker flags
+
@table @gcctabopt
@cindex file names
@item @var{object-file-name}
@@ -5322,6 +5668,12 @@ BSD environments. These entries are usually resolved by entries in
libc. These entry points should be supplied through some other
mechanism when this option is specified.
+@c APPLE LOCAL begin radar 2466994 - -no-c++filt ilr
+@item -no-c++filt
+By default all linker diagnostic output is piped through c++filt.
+This option suppresses that behavior. (APPLE ONLY)
+@c APPLE LOCAL end radar 2466994 - -no-c++filt ilr
+
@cindex @option{-lgcc}, use with @option{-nostdlib}
@cindex @option{-nostdlib} and unresolved references
@cindex unresolved references and @option{-nostdlib}
@@ -5359,6 +5711,12 @@ Remove all symbol table and relocation information from the executable.
On systems that support dynamic linking, this prevents linking with the shared
libraries. On other systems, this option has no effect.
+@c APPLE LOCAL manual
+This option will not work on Mac OS X unless all libraries (including
+@file{libgcc.a}) have also been compiled with @option{-static}. Since
+neither a static version of libSystem.dylib nor crt0.o are provided, this
+option is not useful to most people.
+
@item -shared
@opindex shared
Produce a shared object which can then be linked with other objects to
@@ -5372,6 +5730,9 @@ libraries to link against. Failing to supply the correct flags may lead
to subtle defects. Supplying them in cases where they are not necessary
is innocuous.}
+@c APPLE LOCAL manual
+This option is not supported on Mac OS X.
+
@item -shared-libgcc
@itemx -static-libgcc
@opindex shared-libgcc
@@ -5471,28 +5832,12 @@ the ordering for the include_next directive are not inadvertently changed.
If you really need to change the search order for system directories,
use the @option{-nostdinc} and/or @option{-isystem} options.
-@item -I-
-@opindex I-
-Any directories you specify with @option{-I} options before the @option{-I-}
-option are searched only for the case of @samp{#include "@var{file}"};
-they are not searched for @samp{#include <@var{file}>}.
-
-If additional directories are specified with @option{-I} options after
-the @option{-I-}, these directories are searched for all @samp{#include}
-directives. (Ordinarily @emph{all} @option{-I} directories are used
-this way.)
-
-In addition, the @option{-I-} option inhibits the use of the current
-directory (where the current input file came from) as the first search
-directory for @samp{#include "@var{file}"}. There is no way to
-override this effect of @option{-I-}. With @option{-I.} you can specify
-searching the directory which was current when the compiler was
-invoked. That is not exactly the same as what the preprocessor does
-by default, but it is often satisfactory.
-
-@option{-I-} does not inhibit the use of the standard system directories
-for header files. Thus, @option{-I-} and @option{-nostdinc} are
-independent.
+@item -iquote@var{dir}
+@opindex iquote
+Add the directory @var{dir} to the head of the list of directories to
+be searched for header files only for the case of @samp{#include
+"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
+otherwise just like @option{-I}.
@item -L@var{dir}
@opindex L
@@ -5550,6 +5895,31 @@ program uses when determining what switches to pass to @file{cc1},
@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
@option{-specs=@var{file}} can be specified on the command line, and they
are processed in order, from left to right.
+
+@item -I-
+@opindex I-
+This option has been deprecated. Please use @option{-iquote} instead for
+@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
+Any directories you specify with @option{-I} options before the @option{-I-}
+option are searched only for the case of @samp{#include "@var{file}"};
+they are not searched for @samp{#include <@var{file}>}.
+
+If additional directories are specified with @option{-I} options after
+the @option{-I-}, these directories are searched for all @samp{#include}
+directives. (Ordinarily @emph{all} @option{-I} directories are used
+this way.)
+
+In addition, the @option{-I-} option inhibits the use of the current
+directory (where the current input file came from) as the first search
+directory for @samp{#include "@var{file}"}. There is no way to
+override this effect of @option{-I-}. With @option{-I.} you can specify
+searching the directory which was current when the compiler was
+invoked. That is not exactly the same as what the preprocessor does
+by default, but it is often satisfactory.
+
+@option{-I-} does not inhibit the use of the standard system directories
+for header files. Thus, @option{-I-} and @option{-nostdinc} are
+independent.
@end table
@c man end
@@ -6119,6 +6489,8 @@ machine description. The default for the options is also defined by
that macro, which enables you to change the defaults.
@menu
+@c APPLE LOCAL prune man page
+@ignore
* M680x0 Options::
* M68hc1x Options::
* VAX Options::
@@ -6126,10 +6498,18 @@ that macro, which enables you to change the defaults.
* ARM Options::
* MN10300 Options::
* M32R/D Options::
+@c APPLE LOCAL prune man page
+@end ignore
* RS/6000 and PowerPC Options::
* Darwin Options::
+@c APPLE LOCAL prune man page
+@ignore
* MIPS Options::
+@c APPLE LOCAL prune man page
+@end ignore
* i386 and x86-64 Options::
+@c APPLE LOCAL prune man page
+@ignore
* HPPA Options::
* DEC Alpha Options::
* DEC Alpha/VMS Options::
@@ -6150,8 +6530,12 @@ that macro, which enables you to change the defaults.
* Xstormy16 Options::
* Xtensa Options::
* FRV Options::
+@c APPLE LOCAL prune man page
+@end ignore
@end menu
+@c APPLE LOCAL prune man page
+@ignore
@node M680x0 Options
@subsection M680x0 Options
@cindex M680x0 options
@@ -6622,6 +7006,9 @@ With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
Visual Instruction Set extensions. The default is @option{-mno-vis}.
@end table
+These @samp{-m} switches are supported in addition to the above
+on the SPARCLET processor.
+
These @samp{-m} options are supported in addition to the above
on SPARC-V9 processors in 64-bit environments:
@@ -6712,7 +7099,8 @@ and conforming to the function calling standards for the APCS 32-bit
option. This option replaces the @option{-m6} option of previous releases
of the compiler.
-@ignore
+@c APPLE LOCAL prune man page
+@c @ignore
@c not currently implemented
@item -mapcs-stack-check
@opindex mapcs-stack-check
@@ -6739,7 +7127,8 @@ size if @option{-mapcs-float} is used.
@opindex mapcs-reentrant
Generate reentrant, position independent code. The default is
@option{-mno-apcs-reentrant}.
-@end ignore
+@c APPLE LOCAL prune man page
+@c @end ignore
@item -mthumb-interwork
@opindex mthumb-interwork
@@ -7198,6 +7587,9 @@ Indicates that there is no OS function for flushing the cache.
@end table
+@c APPLE LOCAL prune man page
+@end ignore
+
@node RS/6000 and PowerPC Options
@subsection IBM RS/6000 and PowerPC Options
@cindex RS/6000 and PowerPC Options
@@ -7358,6 +7750,9 @@ allow access to the AltiVec instruction set. You may also need to set
@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
enhancements.
+@c APPLE LOCAL manual
+This option is not supported on Mac OS X; use @option{-faltivec} instead.
+
@item -mabi=spe
@opindex mabi=spe
Extend the current ABI with SPE ABI extensions. This does not change
@@ -7465,6 +7860,14 @@ types, such as floating-point doubles, on their natural size-based boundary.
The option @option{-malign-power} instructs GCC to follow the ABI-specified
alignment rules. GCC defaults to the standard alignment defined in the ABI.
+@c APPLE LOCAL begin -malign-mac68k
+@item -malign-mac68k
+@opindex malign-mac68k
+The option @option{-malign-mac68k} causes structure fields to be aligned
+on 2-byte boundaries, in order to be compatible with m68k compiler
+output. (APPLE ONLY)
+@c APPLE LOCAL end -malign-mac68k
+
@item -msoft-float
@itemx -mhard-float
@opindex msoft-float
@@ -7589,6 +7992,14 @@ relocatable, but that its external references are relocatable. The
resulting code is suitable for applications, but not shared
libraries.
+@c APPLE LOCAL begin long-branch
+@item -mlong-branch
+@opindex mlong-branch
+On Darwin and Mac OS X systems, compile calls to use a 32-bit
+destination address. This is to support kernel extensions, which may
+load anywhere within the kernel address space. (APPLE ONLY)
+@c APPLE LOCAL end long-branch
+
@item -mprioritize-restricted-insns=@var{priority}
@opindex mprioritize-restricted-insns
This option controls the priority that is assigned to
@@ -7672,10 +8083,16 @@ Extend the current ABI with AltiVec ABI extensions. This does not
change the default ABI, instead it adds the AltiVec ABI extensions to
the current ABI@.
+@c APPLE LOCAL manual
+This option is effectively permanently enabled on Mac OS X.
+
@item -mabi=no-altivec
@opindex mabi=no-altivec
Disable AltiVec ABI extensions for the current ABI.
+@c APPLE LOCAL manual
+This option will not work on Mac OS X.
+
@item -mprototype
@itemx -mno-prototype
@opindex mprototype
@@ -7855,6 +8272,34 @@ These options are defined for all architectures running the Darwin operating
system. They are useful for compatibility with other Mac OS compilers.
@table @gcctabopt
+@item -F@var{dir}
+@opindex F
+Add the framework directory @var{dir} to the head of the list of
+directories to be searched for header files. These directories are
+interleaved with those specified by @option{-I} options and are
+scanned in a left-to-right order.
+
+A framework directory is a directory with frameworks in it. A
+framework is a directory with a @samp{"Headers"} and/or
+@samp{"PrivateHeaders"} directory contained directly in it that ends
+in @samp{".framework"}. The name of a framework is the name of this
+directory excluding the @samp{".framework"}. Headers associated with
+the framework are found in one of those two directories, with
+@samp{"Headers"} being searched first. A subframework is a framework
+directory that is in a framework's @samp{"Frameworks"} directory.
+Includes of subframework headers can only appear in a header of a
+framework that contains the subframework, or in a sibling subframework
+header. Two subframeworks are siblings if they occur in the same
+framework. A subframework should not have the same name as a
+framework, a warning will be issued if this is violated. Currently a
+subframework cannot have subframeworks, in the future, the mechanism
+may be extended to support this. The standard frameworks can be found
+in @samp{"/System/Library/Frameworks"}, @samp{"/Library/Frameworks"}
+and @samp{"/Local/Library/Frameworks"}. An example include looks like
+@code{#include <Framework/header.h>}, where @samp{Framework} denotes
+the name of the framework and header.h is found in the
+@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
+
@item -all_load
@opindex all_load
Loads all members of static archive libraries.
@@ -8000,6 +8445,9 @@ describes them in detail.
@end table
+@c APPLE LOCAL prune man page
+@ignore
+
@node MIPS Options
@subsection MIPS Options
@cindex MIPS options
@@ -8382,6 +8830,9 @@ Likely instructions will not be generated by default because the MIPS32
and MIPS64 architectures specifically deprecate their use.
@end table
+@c APPLE LOCAL prune man page
+@end ignore
+
@node i386 and x86-64 Options
@subsection Intel 386 and AMD x86-64 Options
@cindex i386 Options
@@ -8821,6 +9272,9 @@ about addresses and sizes of sections. Currently GCC does not implement
this model.
@end table
+@c APPLE LOCAL prune man page
+@ignore
+
@node HPPA Options
@subsection HPPA Options
@cindex HPPA Options
@@ -9064,6 +9518,120 @@ under HP-UX. This option sets flags for both the preprocessor and
linker.
@end table
+@node Intel 960 Options
+@subsection Intel 960 Options
+
+These @samp{-m} options are defined for the Intel 960 implementations:
+
+@table @gcctabopt
+@item -m@var{cpu-type}
+@opindex mka
+@opindex mkb
+@opindex mmc
+@opindex mca
+@opindex mcf
+@opindex msa
+@opindex msb
+Assume the defaults for the machine type @var{cpu-type} for some of
+the other options, including instruction scheduling, floating point
+support, and addressing modes. The choices for @var{cpu-type} are
+@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
+@samp{sa}, and @samp{sb}.
+The default is
+@samp{kb}.
+
+@item -mnumerics
+@itemx -msoft-float
+@opindex mnumerics
+@opindex msoft-float
+The @option{-mnumerics} option indicates that the processor does support
+floating-point instructions. The @option{-msoft-float} option indicates
+that floating-point support should not be assumed.
+
+@item -mleaf-procedures
+@itemx -mno-leaf-procedures
+@opindex mleaf-procedures
+@opindex mno-leaf-procedures
+Do (or do not) attempt to alter leaf procedures to be callable with the
+@code{bal} instruction as well as @code{call}. This will result in more
+efficient code for explicit calls when the @code{bal} instruction can be
+substituted by the assembler or linker, but less efficient code in other
+cases, such as calls via function pointers, or using a linker that doesn't
+support this optimization.
+
+@item -mtail-call
+@itemx -mno-tail-call
+@opindex mtail-call
+@opindex mno-tail-call
+Do (or do not) make additional attempts (beyond those of the
+machine-independent portions of the compiler) to optimize tail-recursive
+calls into branches. You may not want to do this because the detection of
+cases where this is not valid is not totally complete. The default is
+@option{-mno-tail-call}.
+
+@item -mcomplex-addr
+@itemx -mno-complex-addr
+@opindex mcomplex-addr
+@opindex mno-complex-addr
+Assume (or do not assume) that the use of a complex addressing mode is a
+win on this implementation of the i960. Complex addressing modes may not
+be worthwhile on the K-series, but they definitely are on the C-series.
+The default is currently @option{-mcomplex-addr} for all processors except
+the CB and CC@.
+
+@item -mcode-align
+@itemx -mno-code-align
+@opindex mcode-align
+@opindex mno-code-align
+Align code to 8-byte boundaries for faster fetching (or don't bother).
+Currently turned on by default for C-series implementations only.
+
+@c APPLE LOCAL prune man page
+@c @ignore
+@item -mclean-linkage
+@itemx -mno-clean-linkage
+@opindex mclean-linkage
+@opindex mno-clean-linkage
+These options are not fully implemented.
+@c APPLE LOCAL prune man page
+@c @end ignore
+
+@item -mic-compat
+@itemx -mic2.0-compat
+@itemx -mic3.0-compat
+@opindex mic-compat
+@opindex mic2.0-compat
+@opindex mic3.0-compat
+Enable compatibility with iC960 v2.0 or v3.0.
+
+@item -masm-compat
+@itemx -mintel-asm
+@opindex masm-compat
+@opindex mintel-asm
+Enable compatibility with the iC960 assembler.
+
+@item -mstrict-align
+@itemx -mno-strict-align
+@opindex mstrict-align
+@opindex mno-strict-align
+Do not permit (do permit) unaligned accesses.
+
+@item -mold-align
+@opindex mold-align
+Enable structure-alignment compatibility with Intel's gcc release version
+1.3 (based on gcc 1.37). This option implies @option{-mstrict-align}.
+
+@item -mlong-double-64
+@opindex mlong-double-64
+Implement type @samp{long double} as 64-bit floating point numbers.
+Without the option @samp{long double} is implemented by 80-bit
+floating point numbers. The only reason we have it because there is
+no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it
+is only useful for people using soft-float targets. Otherwise, we
+should recommend against use of it.
+
+@end table
+
@node DEC Alpha Options
@subsection DEC Alpha Options
@@ -9691,9 +10259,11 @@ instruction, it is disabled by default.
@opindex mloop-unsigned
@opindex mno-loop-unsigned
The maximum iteration count when using RPTS and RPTB (and DB on the C40)
-is @math{2^{31} + 1} since these instructions test if the iteration count is
+@c APPLE LOCAL work around a makeinfo complaint
+is @math{2^31 + 1} since these instructions test if the iteration count is
negative to terminate the loop. If the iteration count is unsigned
-there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
+@c APPLE LOCAL work around a makeinfo complaint
+there is a possibility than the @math{2^31 + 1} maximum iteration count may be
exceeded. This switch allows an unsigned iteration count.
@item -mti
@@ -11013,6 +11583,9 @@ instructions. Note that the assembler will use an indirect call for
every cross-file call, not just those that really will be out of range.
@end table
+@c APPLE LOCAL prune man page
+@end ignore
+
@node Code Gen Options
@section Options for Code Generation Conventions
@cindex code generation conventions
@@ -11210,6 +11783,9 @@ only on certain machines. For the 386, GCC supports PIC for System V
but not for the Sun 386i. Code generated for the IBM RS/6000 is always
position-independent.
+@c APPLE LOCAL manual
+@option{-fpic} is not supported on Mac OS X.
+
@item -fPIC
@opindex fPIC
If supported for the target machine, emit position-independent code,
@@ -11220,6 +11796,9 @@ and the SPARC.
Position-independent code requires special support, and therefore works
only on certain machines.
+@c APPLE LOCAL manual
+@option{-fPIC} is the default on Darwin and Mac OS X.
+
@item -fpie
@itemx -fPIE
@opindex fpie
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 533b0b9add5..c5e8d33c15b 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -3285,6 +3285,16 @@ This insn uses @var{op}, a @code{code_label} or a @code{note} of type
be held in a register. The presence of this note allows jump
optimization to be aware that @var{op} is, in fact, being used, and flow
optimization to build an accurate flow graph.
+
+@findex REG_CROSSING_JUMP
+@item REG_CROSSING_JUMP
+This insn is an branching instruction (either an unconditional jump or
+an indirect jump) which crosses between hot and cold sections, which
+could potentially be very far apart in the executable. The presence
+of this note indicates to other optimizations that this this branching
+instruction should not be ``collapsed'' into a simpler branching
+construct. It is used when the optimization to partition basic blocks
+into hot and cold sections is turned on.
@end table
The following notes describe attributes of outputs of an insn:
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index b5f11408dd0..9f5f87f8fe8 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5755,6 +5755,13 @@ frequently executed functions of the program. If not defined, GCC will provide
a default definition if the target supports named sections.
@end defmac
+@defmac NORMAL_TEXT_SECTION_NAME
+If defined, a C string constant for the name of the section containing code
+that does not go into the ``unlikely executed text'' partition. This is used
+as part of the optimization that partitions hot and cold basic blocks into
+separate sections in the .o and executable files.
+@end defmac
+
@defmac UNLIKELY_EXECUTED_TEXT_SECTION_NAME
If defined, a C string constant for the name of the section containing unlikely
executed functions in the program.
@@ -5806,6 +5813,12 @@ finalization code. If not defined, GCC will assume such a section does
not exist.
@end defmac
+@defmac SECTION_FORMAT_STRING
+If defined, format string used by fprintf to write out the
+text section headers for the hot and cold sections of the
+assembly file, when hot and cold partitioning is being performed.
+@end defmac
+
@defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})
If defined, an ASM statement that switches to a different section
via @var{section_op}, calls @var{function}, and switches back to
@@ -8378,6 +8391,24 @@ For each predicate function named in @code{PREDICATE_CODES}, a
declaration will be generated in @file{insn-codes.h}.
@end defmac
+@defmac HAS_LONG_COND_BRANCH
+Define this boolean macro to indicate whether or not your architecture
+has conditional branches that can span all of memory. It is used in
+conjunction with an optimization that partitions hot and cold basic
+blocks into separate sections of the executable. If this macro is
+set to false, gcc will convert any conditional branches that attempt
+to cross between sections into unconditional branches or indirect jumps.
+@end defmac
+
+@defmac HAS_LONG_UNCOND_BRANCH
+Define this boolean macro to indicate whether or not your architecture
+has unconditional branches that can span all of memory. It is used in
+conjunction with an optimization that partitions hot and cold basic
+blocks into separate sections of the executable. If this macro is
+set to false, gcc will convert any unconditional branches that attempt
+to cross between sections into indirect jumps.
+@end defmac
+
@defmac SPECIAL_MODE_PREDICATES
Define this if you have special predicates that know special things
about modes. Genrecog will warn about certain forms of
diff --git a/gcc/doloop.c b/gcc/doloop.c
index ba3137169e7..be436bee11b 100644
--- a/gcc/doloop.c
+++ b/gcc/doloop.c
@@ -60,7 +60,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifdef HAVE_doloop_end
-static rtx doloop_condition_get (rtx);
static unsigned HOST_WIDE_INT doloop_iterations_max (const struct loop_info *,
enum machine_mode, int);
static int doloop_valid_p (const struct loop *, rtx);
@@ -71,7 +70,8 @@ static int doloop_modify_runtime (const struct loop *, rtx, rtx, rtx,
/* Return the loop termination condition for PATTERN or zero
if it is not a decrement and branch jump insn. */
-static rtx
+
+rtx
doloop_condition_get (rtx pattern)
{
rtx cmp;
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 39c5b9f5fa9..6936e26f3f8 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -118,7 +118,7 @@ static void link_roots (struct dom_info *, TBB, TBB);
static void calc_idoms (struct dom_info *, enum cdi_direction);
void debug_dominance_info (enum cdi_direction);
-/* Keeps track of the*/
+/* Keeps track of the numbers of nodes in dominance trees. */
static unsigned n_bbs_in_dom_tree[2];
/* Helper macro for allocating and initializing an array,
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index cdc70258c29..1212d79714b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -248,6 +248,15 @@ typedef struct dw_fde_struct GTY(())
const char *dw_fde_end;
dw_cfi_ref dw_fde_cfi;
unsigned funcdef_number;
+ /* APPLE LOCAL begin coalescing */
+ const char *dw_real_name;
+ /* Is this symbol coalesced? */
+ unsigned coalesced : 1;
+ /* Is this symbol an explicit instantiation? */
+ unsigned explicit : 1;
+ unsigned public : 1;
+ unsigned private_extern : 1;
+ /* APPLE LOCAL end coalescing */
unsigned all_throwers_are_sibcalls : 1;
unsigned nothrow : 1;
unsigned uses_eh_lsda : 1;
@@ -1589,9 +1598,100 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
case PLUS:
case MINUS:
case LO_SUM:
- if (GET_CODE (XEXP (XEXP (dest, 0), 1)) != CONST_INT)
+ /* APPLE LOCAL begin 'reg + index' reg case. */
+ /* MERGE fixme 3537126 */
+ offset = 0x696b6c6c;
+ if (GET_CODE (XEXP (XEXP (dest, 0), 1)) == CONST_INT)
+ offset = INTVAL (XEXP (XEXP (dest, 0), 1));
+#if 1
+ /* If it's a 'reg + index', we need to find out what value
+ the index reg has at this point. (This can happen because
+ some architectures have registers which can only be stored
+ using a "reg + index" mode.)
+ This method of finding out the index value is VERY FRAGILE.
+ Ideally we'd try to add a note to the save insn, but... */
+ else if (GET_CODE (XEXP (XEXP (dest, 0), 1)) == REG)
+ {
+ unsigned the_reg = REGNO (XEXP (XEXP (dest, 0), 1));
+ rtx insn;
+
+ /* The REG_FRAME_RELATED_EXPR can sometimes be out-of-date
+ after the optimiser/inliner has done its stuff. For example,
+
+ (insn: (set (mem:V16QI (plus:SI (reg/f:SI 1 r1)
+ (reg:SI 6 r6)) [0 S16 A8])
+ (reg:V16QI 108 v31))
+ ...
+ (expr_list:REG_FRAME_RELATED_EXPR
+ (set (mem:V16QI (plus:SI (reg/f:SI 1 r1)
+ (reg:SI 0 r0)) [0 S16 A8])
+ (reg:V16QI 108 v31))
+
+ Note that the optimiser has used R6 instead of the original
+ R0 to store the SP offset. Alas, we blindly look for R0
+ here, since DEST is the REG_FRAME_RELATED_EXPR, so we need
+ to check for that.
+
+ This needs a rework from scratch, but it'll do for now. */
+
+ insn = XEXP (XEXP (XEXP (PATTERN (current_output_insn),
+ 0), 0), 1);
+ if (GET_CODE (insn) == REG)
+ the_reg = REGNO (insn);
+
+ insn = PREV_INSN (current_output_insn);
+ for (; insn != NULL; insn = PREV_INSN (insn))
+ {
+ if (GET_CODE (insn) != INSN
+ || PATTERN (insn) == NULL)
+ ;
+ else if (GET_CODE (PATTERN (insn)) == SET)
+ {
+ rtx p = PATTERN (insn);
+ if (SET_DEST (p) != NULL
+ && GET_CODE (SET_DEST (p)) == REG
+ && REGNO (SET_DEST (p)) == the_reg)
+ {
+ if (GET_CODE (SET_SRC (p)) == CONST_INT)
+ {
+ offset = INTVAL (SET_SRC (p));
+ break;
+ }
+ else
+ abort ();
+ }
+ }
+ else
+ /* A label? All bets are off. */
+ if (GET_CODE (PATTERN (insn)) == CODE_LABEL)
+ abort ();
+ }
+
+ /* DEST can also be something like:
+
+ (mem:V16QI (plus:SI (plus:SI (reg/f:SI 1 r1)
+ (const_int 147792 [0x24150]))
+ (reg:SI 0 r0)) [0 S16 A8])
+
+ This is handled here by adjusting the offset appropriately. */
+
+ insn = XEXP (XEXP (dest, 0), 0);
+ if (GET_CODE (insn) == PLUS && GET_CODE (XEXP (insn, 0)) == REG
+ && GET_CODE (XEXP (insn, 1)) == CONST_INT)
+ {
+ offset += INTVAL (XEXP (insn, 1));
+
+ /* Set DEST to be the inner PLUS so that
+ REGNO (XEXP (XEXP (dest, 0), 0) will be sensible. */
+
+ dest = XEXP (dest, 0);
+ }
+ }
+#endif
+ else
abort ();
- offset = INTVAL (XEXP (XEXP (dest, 0), 1));
+ /* APPLE LOCAL end 'reg + index' case. */
+
if (GET_CODE (XEXP (dest, 0)) == MINUS)
offset = -offset;
@@ -1970,6 +2070,14 @@ output_call_frame_info (int for_eh)
else
named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG);
+ /* APPLE LOCAL begin coalescing */
+#ifdef COALESCED_UNWIND_INFO
+ /* We could probably mark the CIE as coalesced as well, since they're
+ all the same (or are they?!) */
+ ASM_OUTPUT_LABEL (asm_out_file, "EH_unwind_info");
+#endif
+ /* APPLE LOCAL end coalescing */
+
ASM_GENERATE_INTERNAL_LABEL (section_start_label, FRAME_BEGIN_LABEL, for_eh);
ASM_OUTPUT_LABEL (asm_out_file, section_start_label);
@@ -2004,7 +2112,11 @@ output_call_frame_info (int for_eh)
P Indicates the presence of an encoding + language
personality routine in the CIE augmentation. */
- fde_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/1, /*global=*/0);
+ /* APPLE LOCAL coalescing */
+ fde_encoding = flag_export_coalesced
+ ? ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2, /*global=*/1)
+ : ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/1, /*global=*/0);
+ /* APPLE LOCAL end coalescing */
per_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2, /*global=*/1);
lsda_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/0);
@@ -2098,6 +2210,18 @@ output_call_frame_info (int for_eh)
&& !fde->uses_eh_lsda)
continue;
+ /* APPLE LOCAL begin coalescing */
+#ifdef COALESCED_UNWIND_INFO
+ ASM_OUTPUT_COAL_UNWIND_LABEL (asm_out_file, fde->dw_real_name,
+ fde->coalesced,
+ fde->public && !fde->private_extern,
+ fde->coalesced
+ || fde->public
+ || fde->private_extern
+ || fde->explicit);
+#endif
+ /* APPLE LOCAL end coalescing */
+
(*targetm.asm_out.internal_label) (asm_out_file, FDE_LABEL, for_eh + i * 2);
ASM_GENERATE_INTERNAL_LABEL (l1, FDE_AFTER_SIZE_LABEL, for_eh + i * 2);
ASM_GENERATE_INTERNAL_LABEL (l2, FDE_END_LABEL, for_eh + i * 2);
@@ -2113,6 +2237,15 @@ output_call_frame_info (int for_eh)
if (for_eh)
{
+ /* APPLE LOCAL begin coalescing */
+#ifdef COALESCED_UNWIND_INFO
+ if (fde->coalesced)
+ dw2_asm_output_encoded_addr_rtx (fde_encoding,
+ gen_rtx_SYMBOL_REF (Pmode, fde->dw_real_name),
+ "FDE initial location");
+ else
+#endif
+ /* APPLE LOCAL end coalescing */
dw2_asm_output_encoded_addr_rtx (fde_encoding,
gen_rtx_SYMBOL_REF (Pmode, fde->dw_fde_begin),
"FDE initial location");
@@ -2257,6 +2390,22 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
fde->uses_eh_lsda = cfun->uses_eh_lsda;
fde->all_throwers_are_sibcalls = cfun->all_throwers_are_sibcalls;
+ /* APPLE LOCAL begin coalescing */
+#ifdef COALESCED_UNWIND_INFO
+ fde->coalesced = DECL_COALESCED (current_function_decl);
+ /* Sorry about this hackery: this is the only way I can figure out
+ whether this is an explicit template instantiation. Ick.
+ DECL_LANG_FLAG_1 is DECL_TEMPLATE_INSTANTIATED in cp-tree.h. */
+ fde->explicit = !fde->coalesced && TREE_PUBLIC (current_function_decl)
+ && (strstr (lang_hooks.name, "C++") != NULL)
+ && DECL_LANG_FLAG_1 (current_function_decl);
+ fde->dw_real_name = xstrdup (IDENTIFIER_POINTER
+ (DECL_ASSEMBLER_NAME (current_function_decl)));
+ fde->public = TREE_PUBLIC(current_function_decl);
+ fde->private_extern = DECL_VISIBILITY(current_function_decl) == VISIBILITY_HIDDEN;
+#endif
+ /* APPLE LOCAL end coalescing */
+
args_size = old_args_size = 0;
/* We only want to output line number information for the genuine dwarf2
@@ -3286,6 +3435,9 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
dwarf2out_abstract_function, /* outlining_inline_function */
debug_nothing_rtx, /* label */
debug_nothing_int, /* handle_pch */
+ /* APPLE LOCAL begin Symbol Separation */
+ NULL, NULL, NULL, NULL,
+ /* APPLE LOCAL end Symbol Separation */
dwarf2out_var_location
};
#endif
@@ -3489,7 +3641,6 @@ struct var_loc_node GTY ((chain_next ("%h.next")))
const char * GTY (()) label;
struct var_loc_node * GTY (()) next;
};
-
/* Variable location list. */
struct var_loc_list_def GTY (())
{
@@ -3504,7 +3655,6 @@ struct var_loc_list_def GTY (())
};
typedef struct var_loc_list_def var_loc_list;
-
/* Table of decl location linked lists. */
static GTY ((param_is (var_loc_list))) htab_t decl_loc_table;
@@ -5314,7 +5464,6 @@ equate_decl_number_to_die (tree decl, dw_die_ref decl_die)
}
/* Add a variable location node to the linked list for DECL. */
-
static void
add_var_loc_to_decl (tree decl, struct var_loc_node *loc)
{
@@ -7997,7 +8146,6 @@ subrange_type_die (tree type, dw_die_ref context_die)
subtype_die = gen_enumeration_type_die (TREE_TYPE (type), context_die);
else
subtype_die = base_type_die (TREE_TYPE (type));
-
subrange_die = new_die (DW_TAG_subrange_type, context_die, type);
if (name != NULL)
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 4158f92b08e..7b133b8705c 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -634,8 +634,15 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
/* Fetch that unit, store the bitfield in it, then store
the unit. */
tempreg = copy_to_reg (op0);
- store_bit_field (tempreg, bitsize, bitpos, fieldmode, value,
- total_size);
+ /* APPLE LOCAL begin do not use float fieldmode */
+ /* If value was float, we munged it to be int above, so it
+ is never appropriate to use a float fieldmode here. */
+ store_bit_field (tempreg, bitsize, bitpos,
+ (GET_MODE_CLASS (fieldmode) != MODE_INT
+ && GET_MODE_CLASS (fieldmode) != MODE_PARTIAL_INT)
+ ? GET_MODE (value) : fieldmode,
+ value, total_size);
+ /* APPLE LOCAL end do not use float fieldmode */
emit_move_insn (op0, tempreg);
return value;
}
diff --git a/gcc/expr.c b/gcc/expr.c
index 789c9a5a5a0..56a5f18df76 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6366,7 +6366,6 @@ expand_operands (tree exp0, tree exp1, rtx target, rtx *op0, rtx *op1,
DECL_RTL of the VAR_DECL. *ALT_RTL is also set if EXP is a
COMPOUND_EXPR whose second argument is such a VAR_DECL, and so on
recursively. */
-
static rtx expand_expr_real_1 (tree, rtx, enum machine_mode,
enum expand_modifier, rtx *);
@@ -6459,6 +6458,15 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
int ignore;
tree context;
+ /* Handle ERROR_MARK before anybody tries to access its type. */
+ if (TREE_CODE (exp) == ERROR_MARK || TREE_CODE (type) == ERROR_MARK)
+ {
+ op0 = CONST0_RTX (tmode);
+ if (op0 != 0)
+ return op0;
+ return const0_rtx;
+ }
+
mode = TYPE_MODE (type);
/* Use subtarget as the target for operand 0 of a binary operation. */
subtarget = get_subtarget (target);
@@ -6552,6 +6560,10 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
return temp;
}
+ case SSA_NAME:
+ return expand_expr_real_1 (SSA_NAME_VAR (exp), target, tmode, modifier,
+ NULL);
+
case PARM_DECL:
if (!DECL_RTL_SET_P (exp))
{
diff --git a/gcc/f/Make-lang.in b/gcc/f/Make-lang.in
index 052adfcaab9..a7d04ee218d 100644
--- a/gcc/f/Make-lang.in
+++ b/gcc/f/Make-lang.in
@@ -92,9 +92,9 @@ F77_OBJS = f/bad.o f/bit.o f/bld.o f/com.o f/data.o f/equiv.o f/expr.o \
# Use loose warnings for this front end.
f-warn = $(WERROR)
-f771$(exeext): $(F77_OBJS) $(BACKEND) $(LIBDEPS)
+f771$(exeext): $(F77_OBJS) $(BACKEND) $(LIBDEPS)
rm -f f771$(exeext)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(F77_OBJS) $(BACKEND) $(LIBS)
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(F77_OBJS) $(BACKEND) $(LIBS)
# Keyword tables.
f/stamp-str: f/str-1t.h f/str-1t.j f/str-2t.h f/str-2t.j \
diff --git a/gcc/f/com.c b/gcc/f/com.c
index ebfce0a5670..5b24ee20caf 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -636,6 +636,37 @@ static GTY(()) tree named_labels;
static GTY(()) tree shadowed_labels;
+/* APPLE LOCAL begin AltiVec */
+/* Placeholders to make linking work, remove when altivec support is correct */
+
+int
+comptypes (type1, type2)
+ tree type1, type2;
+{
+ register tree t1 = type1;
+ register tree t2 = type2;
+ if (t1 == t2 || !t1 || !t2
+ || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK)
+ return 1;
+ return 0;
+}
+
+tree
+default_conversion (exp)
+ tree exp;
+{
+ return exp;
+}
+
+tree
+lang_build_type_variant (type, constp, volatilep)
+ tree type;
+ int constp, volatilep;
+{
+ return type;
+}
+/* APPLE LOCAL end AltiVec */
+
/* Return the subscript expression, modified to do range-checking.
`array' is the array type to be checked against.
diff --git a/gcc/final.c b/gcc/final.c
index f3e793d6643..1e85eebe1ad 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1621,6 +1621,37 @@ output_alternate_entry_point (FILE *file, rtx insn)
}
}
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Return boolean indicating if there is a NOTE_INSN_UNLIKELY_EXECUTED_CODE
+ note in the instruction chain (going forward) between the current
+ instruction, and the next 'executable' instruction. */
+
+bool
+scan_ahead_for_unlikely_executed_note (rtx insn)
+{
+ rtx temp;
+ int bb_note_count = 0;
+
+ for (temp = insn; temp; temp = NEXT_INSN (temp))
+ {
+ if (GET_CODE (temp) == NOTE
+ && NOTE_LINE_NUMBER (temp) == NOTE_INSN_UNLIKELY_EXECUTED_CODE)
+ return true;
+ if (GET_CODE (temp) == NOTE
+ && NOTE_LINE_NUMBER (temp) == NOTE_INSN_BASIC_BLOCK)
+ {
+ bb_note_count++;
+ if (bb_note_count > 1)
+ return false;
+ }
+ if (INSN_P (temp))
+ return false;
+ }
+
+ return false;
+}
+/* APPLE LOCAL end hot/cold partitioning */
+
/* The final scan for one insn, INSN.
Args are same as in `final', except that INSN
is the insn being scanned.
@@ -1670,7 +1701,32 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
case NOTE_INSN_EXPECTED_VALUE:
break;
- case NOTE_INSN_BASIC_BLOCK:
+ /* APPLE LOCAL begin hot/cold partitioning */
+ case NOTE_INSN_UNLIKELY_EXECUTED_CODE:
+
+ /* The presence of this note indicates that this basic block
+ belongs in the "cold" section of the .o file. If we are
+ not already writing to the cold section we need to change
+ to it. */
+
+ unlikely_text_section ();
+ break;
+
+ case NOTE_INSN_BASIC_BLOCK:
+
+ /* If we are performing the optimization that paritions
+ basic blocks into hot & cold sections of the .o file,
+ then at the start of each new basic block, before
+ beginning to write code for the basic block, we need to
+ check to see whether the basic block belongs in the hot
+ or cold section of the .o file, and change the section we
+ are writing to appropriately. */
+
+ if (flag_reorder_blocks_and_partition
+ && !scan_ahead_for_unlikely_executed_note (insn))
+ text_section ();
+ /* APPLE LOCAL end hot/cold partitioning */
+
#ifdef IA64_UNWIND_INFO
IA64_UNWIND_EMIT (asm_out_file, insn);
#endif
@@ -1857,6 +1913,27 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
if (LABEL_NAME (insn))
(*debug_hooks->label) (insn);
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are doing the optimization that partitions hot & cold
+ basic blocks into separate sections of the .o file, we need
+ to ensure the jump table ends up in the correct section... */
+
+ if (flag_reorder_blocks_and_partition
+ && targetm.have_named_sections)
+ {
+ rtx tmp_table, tmp_label;
+ if (GET_CODE (insn) == CODE_LABEL
+ && tablejump_p (NEXT_INSN (insn), &tmp_label, &tmp_table))
+ {
+ /* Do nothing; Do NOT change the current section. */
+ }
+ else if (scan_ahead_for_unlikely_executed_note (insn))
+ unlikely_text_section ();
+ else
+ text_section ();
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
+
if (app_on)
{
fputs (ASM_APP_OFF, file);
diff --git a/gcc/flags.h b/gcc/flags.h
index 29134834502..d4e539118fb 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -39,6 +39,13 @@ enum debug_info_type
/* Specify which kind of debugging info to generate. */
extern enum debug_info_type write_symbols;
+/* APPLE LOCAL begin Symbol Separation */
+extern enum debug_info_type orig_write_symbols;
+
+/* Nonzero means, try to look for separate symbol repositories. */
+extern int flag_grepository;
+/* APPLE LOCAL end Symbol Separation */
+
/* Names of debug_info_type, for error messages. */
extern const char *const debug_type_names[];
@@ -210,6 +217,13 @@ extern int flag_branch_probabilities;
extern int flag_reorder_blocks;
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Nonzero if basic blocks should be partitioned into hot and cold
+ sections of the .o file, in addition to being reordered. */
+
+extern int flag_reorder_blocks_and_partition;
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Nonzero if functions should be reordered. */
extern int flag_reorder_functions;
@@ -239,6 +253,16 @@ extern int flag_print_asm_name;
extern int flag_signed_char;
+/* APPLE LOCAL coalescing */
+extern int flag_export_coalesced;
+
+/* APPLE LOCAL begin Pascal strings 2001-07-05 zll */
+/* Nonzero means initial "\p" in string becomes a length byte and
+ string type becomes _unsigned_ char* . */
+
+extern int flag_pascal_strings;
+/* APPLE LOCAL end Pascal strings 2001-07-05 zll */
+
/* Nonzero means give an enum type only as many bytes as it needs. */
extern int flag_short_enums;
@@ -277,18 +301,6 @@ extern int flag_float_store;
extern int flag_strength_reduce;
-/* Nonzero enables loop unrolling in unroll.c. Only loops for which the
- number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
- UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
- unrolled. */
-
-extern int flag_old_unroll_loops;
-
-/* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
- This is generally not a win. */
-
-extern int flag_old_unroll_all_loops;
-
/* Nonzero forces all invariant computations in loops to be moved
outside the loop. */
@@ -303,6 +315,12 @@ extern int flag_prefetch_loop_arrays;
extern int flag_reduce_all_givs;
+/* Nonzero enables loop unrolling. */
+extern int flag_unroll_loops;
+
+/* Nonzero enables loop unswitching. */
+extern int flag_unswitch_loops;
+
/* Nonzero for -fcse-follow-jumps:
have cse follow jumps to do a more extensive job. */
@@ -378,6 +396,13 @@ extern int flag_rerun_loop_opt;
extern int flag_inline_functions;
+/* APPLE LOCAL begin -fobey-inline */
+/* Nonzero for -fobey-inline: 'inline' keyword must be obeyed, regardless
+ of codesize. */
+
+extern int flag_obey_inline;
+/* APPLE LOCAL end -fobey-inline */
+
/* Nonzero for -fkeep-inline-functions: even if we make a function
go inline everywhere, keep its definition around for debugging
purposes. */
@@ -725,6 +750,24 @@ extern int flag_tree_ccp;
/* Enable SSA-DCE on trees. */
extern int flag_tree_dce;
+/* Enable SSA-CHREC on trees. */
+extern int flag_scalar_evolutions;
+
+/* Enable the analysis of all the data dependences. */
+extern int flag_all_data_deps;
+
+/* Enable linear loop transforms on trees. */
+extern int flag_tree_loop_linear;
+
+/* Enable the elimination of checks on trees. */
+extern int flag_tree_elim_checks;
+
+/* Enable data dependence graph. */
+extern int flag_ddg;
+
+/* Enable loop vectorization on trees */
+extern int flag_tree_vectorize;
+
/* Enable SSA->normal pass memory location coalescing. */
extern int flag_tree_combine_temps;
@@ -826,4 +869,33 @@ extern int flag_abi_version;
#define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
(MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math)
+/* APPLE LOCAL begin -fast or -fastf or -fastcp */
+/* Nonzero if we should perform SPEC oriented optimizations for C. */
+extern int flag_fast;
+/* Nonzero if we should perform SPEC oriented optimizations for C that is
+ produced by the NAG Fortan-to-C translator. */
+extern int flag_fastf;
+/* Nonzero if we should perform SPEC oriented optimizations for C++. */
+extern int flag_fastcp;
+/* APPLE LOCAL end -fast or -fastf -fastcp */
+
+/* APPLE LOCAL gdb only used symbols */
+#ifdef DBX_ONLY_USED_SYMBOLS
+/* Nonzero if generating debugger info for used symbols only. */
+extern int flag_debug_only_used_symbols;
+#endif
+
+/* APPLE LOCAL BEGIN pch distcc mrs */
+/* True if PCH should omit from the -E output all lines from PCH files
+ found in PCH files. */
+extern int flag_pch_preprocess;
+/* APPLE LOCAL END pch distcc mrs */
+
+/* APPLE LOCAL begin loop transpose */
+/* Nonzero if we should perform automatic loop transposition. */
+extern int flag_loop_transpose;
+/* APPLE LOCAL end loop transpose */
+
+extern int disable_typechecking_for_spec_flag;
+
#endif /* ! GCC_FLAGS_H */
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 966a3ae6c26..061e1d4f18f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -70,8 +70,6 @@ static hashval_t size_htab_hash (const void *);
static int size_htab_eq (const void *, const void *);
static tree fold_convert_const (enum tree_code, tree, tree);
static tree fold_convert (tree, tree);
-static enum tree_code invert_tree_comparison (enum tree_code);
-static enum tree_code swap_tree_comparison (enum tree_code);
static int comparison_to_compcode (enum tree_code);
static enum tree_code compcode_to_comparison (int);
static int truth_value_p (enum tree_code);
@@ -1987,7 +1985,7 @@ pedantic_non_lvalue (tree x)
of the given code. It is not safe to do this for floating-point
comparisons, except for NE_EXPR and EQ_EXPR. */
-static enum tree_code
+enum tree_code
invert_tree_comparison (enum tree_code code)
{
switch (code)
@@ -2012,7 +2010,7 @@ invert_tree_comparison (enum tree_code code)
/* Similar, but return the comparison that results if the operands are
swapped. This is safe for floating-point. */
-static enum tree_code
+enum tree_code
swap_tree_comparison (enum tree_code code)
{
switch (code)
@@ -5367,13 +5365,23 @@ fold (tree expr)
tree tem;
tree type = TREE_TYPE (expr);
tree arg0 = NULL_TREE, arg1 = NULL_TREE;
- enum tree_code code = TREE_CODE (t);
- int kind = TREE_CODE_CLASS (code);
-
+ /* APPLE LOCAL begin AltiVec */
+ enum tree_code code;
+ int kind, invert;
+ /* APPLE LOCAL end AltiVec */
/* WINS will be nonzero when the switch is done
if all operands are constant. */
int wins = 1;
+ /* APPLE LOCAL begin AltiVec */
+ /* Fold constant comma expressions. */
+ while (TREE_CODE (t) == COMPOUND_EXPR && TREE_CONSTANT (t))
+ t = TREE_OPERAND (t, 1);
+
+ code = TREE_CODE (t);
+ kind = TREE_CODE_CLASS (code);
+ /* APPLE LOCAL end AltiVec */
+
/* Don't try to process an RTL_EXPR since its operands aren't trees.
Likewise for a SAVE_EXPR that's already been evaluated. */
if (code == RTL_EXPR || (code == SAVE_EXPR && SAVE_EXPR_RTL (t) != 0))
@@ -6063,6 +6071,34 @@ fold (tree expr)
TREE_OPERAND (arg0, 0),
build_real (type, c1)));
}
+ /* Convert a + (b*c + d*e) into (a + b*c) + d*e */
+ if (flag_unsafe_math_optimizations
+ && TREE_CODE (arg1) == PLUS_EXPR
+ && TREE_CODE (arg0) != MULT_EXPR)
+ {
+ tree tree10 = TREE_OPERAND (arg1, 0);
+ tree tree11 = TREE_OPERAND (arg1, 1);
+ if (TREE_CODE (tree11) == MULT_EXPR)
+ {
+ tree tree0;
+ tree0 = fold (build (PLUS_EXPR, type, arg0, tree10));
+ return fold (build (PLUS_EXPR, type, tree0, tree11));
+ }
+ }
+ /* Convert (b*c + d*e) + a into b*c + (d*e +a) */
+ if (flag_unsafe_math_optimizations
+ && TREE_CODE (arg0) == PLUS_EXPR
+ && TREE_CODE (arg1) != MULT_EXPR)
+ {
+ tree tree00 = TREE_OPERAND (arg0, 0);
+ tree tree01 = TREE_OPERAND (arg0, 1);
+ if (TREE_CODE (tree01) == MULT_EXPR)
+ {
+ tree tree0;
+ tree0 = fold (build (PLUS_EXPR, type, tree01, arg1));
+ return fold (build (PLUS_EXPR, type, tree00, tree0));
+ }
+ }
}
bit_rotate:
diff --git a/gcc/function.c b/gcc/function.c
index fd0fb54bfdd..1afeea2132f 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -602,6 +602,23 @@ assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align)
{
return assign_stack_local_1 (mode, size, align, cfun);
}
+
+/* APPLE LOCAL begin new function for rs6000 consumption */
+/* Wrapper around assign_stack_local_1; assign a local stack slot for the
+ current function, then set the mem_alias to a new alias set.
+ This can be used only in situations where the target code can
+ guarantee that the slot is used in a way that cannot conflict
+ with anything else. */
+
+rtx
+assign_stack_local_with_alias (enum machine_mode mode, HOST_WIDE_INT size,
+ int align)
+{
+ rtx mem = assign_stack_local_1 (mode, size, align, cfun);
+ set_mem_alias_set (mem, new_alias_set ());
+ return mem;
+}
+/* APPLE LOCAL end new function for rs6000 consumption */
/* Allocate a temporary stack slot and record it for possible later
reuse.
@@ -4223,6 +4240,10 @@ assign_parms (tree fndecl)
int reg_parm_stack_space ATTRIBUTE_UNUSED = 0;
rtx conversion_insns = 0;
+ /* APPLE LOCAL begin Altivec */
+ int pass, last_pass;
+ /* APPLE LOCAL end Altivec */
+
/* Nonzero if function takes extra anonymous args.
This means the last named arg must be on the stack
right before the anonymous ones. */
@@ -4282,7 +4303,14 @@ assign_parms (tree fndecl)
caller did. */
current_function_pretend_args_size = 0;
- for (parm = fnargs; parm; parm = TREE_CHAIN (parm))
+ /* APPLE LOCAL begin Altivec */
+ /* In first pass over formal arguments, only consider non-vector args.
+ In 2nd pass, if needed, consider all vector args. */
+ last_pass = 1;
+ for (pass = 1; pass <= last_pass; pass++)
+ {
+ /* APPLE LOCAL end Altivec */
+ for (parm = fnargs; parm; parm = TREE_CHAIN (parm))
{
rtx entry_parm;
rtx stack_parm;
@@ -4345,6 +4373,11 @@ assign_parms (tree fndecl)
continue;
}
+ /* APPLE LOCAL begin Altivec */
+ if (!stdarg && targetm.calls.skip_vec_args (passed_type, pass, &last_pass))
+ continue;
+ /* APPLE LOCAL end Altivec */
+
/* If the parm is to be passed as a transparent union, use the
type of the first field for the tests below. We have already
verified that the modes are the same. */
@@ -5140,6 +5173,9 @@ assign_parms (tree fndecl)
SET_DECL_RTL (parm, stack_parm);
}
}
+ /* APPLE LOCAL begin Altivec */
+ }
+ /* APPLE LOCAL end Altivec */
if (SPLIT_COMPLEX_ARGS && fnargs != orig_fnargs)
{
@@ -5205,6 +5241,8 @@ assign_parms (tree fndecl)
/* We have aligned all the args, so add space for the pretend args. */
stack_args_size.constant += extra_pretend_bytes;
current_function_args_size = stack_args_size.constant;
+ /* APPLE LOCAL sibcall 3007352 */
+ cfun->unrounded_args_size = stack_args_size.constant;
/* Adjust function incoming argument size for alignment and
minimum length. */
@@ -6438,7 +6476,6 @@ expand_function_start (tree subr, int parms_have_cleanups)
if (cfun->static_chain_decl)
{
rtx x;
-
expand_var (cfun->static_chain_decl);
x = expand_expr (cfun->static_chain_decl, NULL_RTX,
VOIDmode, EXPAND_WRITE);
diff --git a/gcc/function.h b/gcc/function.h
index eaa7b980da7..63988f20b08 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -398,6 +398,9 @@ struct function GTY(())
final flowgraph size. */
int max_jumptable_ents;
+ /* APPLE LOCAL sibcall 3007352 */
+ int unrounded_args_size;
+
/* UIDs for LABEL_DECLs. */
int last_label_uid;
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 6b487c2ba92..816a59ff25a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -235,6 +235,32 @@ static const char *const spec_version = DEFAULT_TARGET_VERSION;
static const char *spec_machine = DEFAULT_TARGET_MACHINE;
+/* APPLE LOCAL begin constant cfstrings */
+static int use_constant_cfstrings = 0;
+/* The deployment target (i.e., the minimum version of MacOS X that
+ the binary is expected to be used on). */
+static const char *macosx_deployment_target = 0;
+unsigned int macosx_version_min_required = 0;
+
+/* APPLE LOCAL 3313335 */
+static char *cc_print_options = 0;
+static char *cc_print_options_filename;
+/* The following table should be NULL-terminated and kept in
+ lexicographic order. */
+
+static struct macosx_vers {
+ const char *vers_str;
+ unsigned int vers_num;
+} macosx_vers_tbl[] = {
+ { "10.0", 1000 },
+ { "10.1", 1010 },
+ { "10.2", 1020 },
+ { "10.3", 1030 },
+ { "10.4", 1040 },
+ { NULL, 0 }
+};
+/* APPLE LOCAL end constant cfstrings */
+
/* Nonzero if cross-compiling.
When -b is used, the value comes from the `specs' file. */
@@ -319,6 +345,8 @@ static const char *eval_spec_function (const char *, const char *);
static const char *handle_spec_function (const char *);
static char *save_string (const char *, int);
static void set_collect_gcc_options (void);
+/* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
+static const char *check_basename_derived_file (const char *string);
static int do_spec_1 (const char *, int, const char *);
static int do_spec_2 (const char *);
static void do_option_spec (const char *, const char *);
@@ -445,6 +473,10 @@ or with constant text in a single argument.
%I Substitute any of -iprefix (made from GCC_EXEC_PREFIX), -isysroot
(made from TARGET_SYSTEM_ROOT), and -isystem (made from COMPILER_PATH
and -B options) as necessary.
+ APPLE LOCAL framework headers
+ %Q Substitute -iframework default paths.
+ APPLE LOCAL constant cfstrings
+ %yC Emit '-fconstant-cfstrings' option, if needed.
%s current argument is the name of a library or startup file of some sort.
Search for that file in a standard list of directories
and substitute the full name found.
@@ -755,11 +787,22 @@ static const char *sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC;
static const char *trad_capable_cpp =
"cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}";
+/* When making PCH file use this. */
+/* APPLE LOCAL Symbol Separation */
+/* Add fsave-repository constructs for Symbol Separation */
+static const char *pch =
+"%{!fsave-repository*:-o %g.s %{!o*:--output-pch=%i.pch} %W{o*:--output-pch=%*}%V}";
+
+/* APPLE LOCAL Symbol Separation */
+static const char *dbg_ss= "%{fsave-repository*: -gfull %(invoke_as)}";
+
/* We don't wrap .d files in %W{} since a missing .d file, and
therefore no dependency entry, confuses make into thinking a .o
file that happens to exist is up-to-date. */
static const char *cpp_unique_options =
"%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}}\
+"/* APPLE LOCAL framework headers */"\
+ %{!traditional:%{!ftraditional:%{!traditional-cpp:%Q}}} %{F*}\
%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I\
%{MD:-MD %{!o:%b.d}%{o*:%.d%*}}\
%{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
@@ -785,7 +828,17 @@ static const char *cpp_debug_options = "%{d*}";
/* NB: This is shared amongst all front-ends. */
static const char *cc1_options =
+/* APPLE LOCAL constant cfstrings */
+/* APPLE LOCAL Symbol Separation */
+/* Add fsave-repository construct for Symbol Separation */
+"%yC"
+/* APPLE LOCAL begin -fast option */
+"%{fast:-O3}\
+ %{fastf:-O3}\
+ %{fastcp:-O3}"
+/* APPLE LOCAL end -fast option */
"%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
+ %{fsave-repository*:-gfull}\
%1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
%{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi}\
@@ -797,7 +850,15 @@ static const char *cc1_options =
%{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}";
static const char *asm_options =
-"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
+/* APPLE LOCAL -fast */
+/* APPLE LOCAL Symbol Separation */
+/* Add fsave-repository constructs for Symbol Separation */
+"%a %Y \
+ %{fast:-force_cpusubtype_ALL}\
+ %{fastf:-force_cpusubtype_ALL}\
+ %{fastcp:-force_cpusubtype_ALL}\
+ %{c:%W{o*}%{!o*:%{!fsave-repository*:-o %w%b%O} %{fsave-repository*:-o %w%i%O}}}\
+ %{!c:%{!fsave-repository*:-o %d%w%u%O} %{fsave-repository*:%W{o*}%{!o*:-o %w%i%O}}}";
static const char *invoke_as =
#ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT
@@ -924,16 +985,17 @@ static const struct compiler default_compilers[] =
/* cc1 has an integrated ISO C preprocessor. We should invoke the
external preprocessor if -save-temps is given. */
"%{E|M|MM:%(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)}\
+ "/* APPLE LOCAL cpp-precomp compatibility */"\
+ %{precomp:%ecpp-precomp not supported}%{no-cpp-precomp:}%{Wno-precomp:}\
%{!E:%{!M:%{!MM:\
%{traditional|ftraditional:\
%eGNU C no longer supports -traditional without -E}\
%{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
- %(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i} \n\
- cc1 -fpreprocessed %{save-temps:%b.i} %{!save-temps:%g.i} \
- %(cc1_options)}\
+ %(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i}}\
%{!save-temps:%{!traditional-cpp:%{!no-integrated-cpp:\
- cc1 %(cpp_unique_options) %(cc1_options)}}}\
- %{!fsyntax-only:%(invoke_as)}}}}", 0},
+ cc1 %(cpp_unique_options) %(cc1_options)}}\
+ %{!fsyntax-only:\
+ %{!traditional-cpp:%(invoke_as)}}}}}}", 0},
{"-",
"%{!E:%e-E required when input is from standard input}\
%(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)", 0},
@@ -947,16 +1009,23 @@ static const struct compiler default_compilers[] =
%(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i} \n\
cc1 -fpreprocessed %{save-temps:%b.i} %{!save-temps:%g.i} \
%(cc1_options)\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}\
+ "/* APPLE LOCAL symbol separation */"\
+ %(dbg_ss) %(pch)}\
%{!save-temps:%{!traditional-cpp:%{!no-integrated-cpp:\
cc1 %(cpp_unique_options) %(cc1_options)\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}}}}}}", 0},
+ "/* APPLE LOCAL symbol separation */"\
+ %(dbg_ss) %(pch)}}}}}}", 0},
{".i", "@cpp-output", 0},
{"@cpp-output",
"%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0},
- {".s", "@assembler", 0},
+ /* APPLE LOCAL preprocess .s files 2001-07-24 sts */
+ /* This is kind of lame; the purpose of having .s and .S be treated
+ differently is so that we can control whether to run the
+ preprocessor on assembly files. The standard behavior would
+ still work even on HFS filesystems, because they preserve case,
+ but we'd have to get a number of projects to change their files,
+ and of course that's just *too* *hard*. */
+ {".s", "@assembler-with-cpp", 0},
{"@assembler",
"%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0},
{".S", "@assembler-with-cpp", 0},
@@ -983,6 +1052,12 @@ static const struct compiler default_compilers[] =
static const int n_default_compilers = ARRAY_SIZE (default_compilers) - 1;
+/* APPLE LOCAL begin -ObjC 2001-08-03 sts */
+/* -ObjC is not the same as -x objective-c, since it only affects the
+ expectation of the language in files already thought to be source
+ code. */
+static char *default_language;
+/* APPLE LOCAL end -ObjC 2001-08-03 sts */
/* A vector of options to give to the linker.
These options are accumulated by %x,
and substituted into the linker command with %X. */
@@ -1070,6 +1145,8 @@ static const struct option_map option_map[] =
{"--pedantic-errors", "-pedantic-errors", 0},
{"--pie", "-pie", 0},
{"--pipe", "-pipe", 0},
+ /* APPLE LOCAL -precomp-trustfile */
+ {"--precomp-trustfile", "-precomp-trustfile", "a"},
{"--prefix", "-B", "a"},
{"--preprocess", "-E", 0},
{"--print-search-dirs", "-print-search-dirs", 0},
@@ -1085,6 +1162,8 @@ static const struct option_map option_map[] =
{"--quiet", "-q", 0},
{"--resource", "-fcompile-resource=", "aj"},
{"--save-temps", "-save-temps", 0},
+ /* APPLE LOCAL Symbol Separation */
+ {"--save-repository", "-fsave-repository=", "aj"},
{"--shared", "-shared", 0},
{"--silent", "-q", 0},
{"--specs", "-specs=", "aj"},
@@ -1386,6 +1465,13 @@ static struct path_prefix startfile_prefixes = { 0, 0, "startfile" };
static struct path_prefix include_prefixes = { 0, 0, "include" };
+/* APPLE LOCAL begin framework headers */
+#ifdef FRAMEWORK_HEADERS
+/* A vector of the frameworks to search. */
+static struct path_prefix default_framework_paths = {0, 0, "default_frameworks"};
+#endif /* FRAMEWORK_HEADERS */
+/* APPLE LOCAL end framework headers */
+
/* Suffix to attach to directories searched for commands.
This looks like `MACHINE/VERSION/'. */
@@ -1486,6 +1572,9 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("cpp_debug_options", &cpp_debug_options),
INIT_STATIC_SPEC ("cpp_unique_options", &cpp_unique_options),
INIT_STATIC_SPEC ("trad_capable_cpp", &trad_capable_cpp),
+ INIT_STATIC_SPEC ("pch", &pch),
+ /* APPLE LOCAL Symbol Separtion */
+ INIT_STATIC_SPEC ("dbg_ss", &dbg_ss),
INIT_STATIC_SPEC ("cc1", &cc1_spec),
INIT_STATIC_SPEC ("cc1_options", &cc1_options),
INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
@@ -2665,6 +2754,11 @@ execute (void)
X_OK, 0);
if (string)
commands[n_commands].argv[0] = string;
+ /* APPLE LOCAL begin radar 2466994 - pass linker output through c++filt ilr */
+ else if (strcmp (commands[n_commands].prog, "c++filt3") == 0
+ && access ("/usr/bin/c++filt3", X_OK) != 0)
+ continue;
+ /* APPLE LOCAL end radar 2466994 - pass linker output through c++filt ilr */
n_commands++;
}
@@ -2672,7 +2766,8 @@ execute (void)
/* If -v, print what we are about to do, and maybe query. */
- if (verbose_flag)
+ /* APPLE LOCAL 3313335 */
+ if (verbose_flag || cc_print_options)
{
/* For help listings, put a blank line between sub-processes. */
if (print_help_list)
@@ -2683,29 +2778,50 @@ execute (void)
{
const char *const *j;
- if (verbose_only_flag)
+ /* APPLE LOCAL begin 3313335 and 3360444 */
+ FILE *f = stderr;
+ if (cc_print_options)
+ {
+ if (cc_print_options_filename)
+ {
+ f = fopen (cc_print_options_filename, "a");
+ if (!f)
+ {
+ fprintf (stderr, "can not open CC_PRINT_OPTIONS_FILE %s\n",
+ cc_print_options_filename);
+ exit (1);
+ }
+ }
+ fprintf (f, "[Logging gcc options]");
+ }
+
+ if (verbose_only_flag || cc_print_options)
{
for (j = commands[i].argv; *j; j++)
{
const char *p;
- fprintf (stderr, " \"");
+ fprintf (f, " \"");
for (p = *j; *p; ++p)
{
if (*p == '"' || *p == '\\' || *p == '$')
- fputc ('\\', stderr);
- fputc (*p, stderr);
+ fputc ('\\', f);
+ fputc (*p, f);
}
- fputc ('"', stderr);
+ fputc ('"', f);
}
}
else
for (j = commands[i].argv; *j; j++)
- fprintf (stderr, " %s", *j);
+ fprintf (f, " %s", *j);
/* Print a pipe symbol after all but the last command. */
if (i + 1 != n_commands)
- fprintf (stderr, " |");
- fprintf (stderr, "\n");
+ fprintf (f, " |");
+ fprintf (f, "\n");
+
+ if (cc_print_options_filename)
+ fclose (f);
+ /* APPLE LOCAL end 3313335 and 3360444 */
}
fflush (stderr);
if (verbose_only_flag != 0)
@@ -2764,6 +2880,17 @@ execute (void)
char *errmsg_fmt, *errmsg_arg;
const char *string = commands[i].argv[0];
+ /* APPLE LOCAL begin 2920964 */
+ if (verbose_flag && print_help_list
+ && (!strcmp ("/usr/libexec/gcc/darwin/ppc/as", string)
+ || !strcmp ("/usr/libexec/gcc/darwin/i386/as", string)
+ || !strcmp ("ld", string)))
+ {
+ /* Do nothing.
+ as and ld do not entertain --help. */
+ }
+ else
+ /* APPLE LOCAL end 2920964 */
/* For some bizarre reason, the second argument of execvp() is
char *const *, not const char *const *. */
commands[i].pid = pexecute (string, (char *const *) commands[i].argv,
@@ -2803,6 +2930,16 @@ execute (void)
int status;
int pid;
+ /* APPLE LOCAL begin 2920964 */
+ if (verbose_flag && print_help_list
+ && (!strcmp ("as", commands[i].prog)
+ || !strcmp ("ld", commands[i].prog)))
+ {
+ /* as and ld do not entertain --help. */
+ i++;
+ continue;
+ }
+ /* APPLE LOCAL end 2920964 */
pid = pwait (commands[i].pid, &status, 0);
if (pid < 0)
abort ();
@@ -2907,6 +3044,14 @@ struct infile
{
const char *name;
const char *language;
+ /* APPLE LOCAL begin IMI */
+ struct compiler *incompiler;
+
+ /* Use separate temp file for each input file. */
+ const char *temp_filename;
+ bool compiled;
+ bool preprocessed;
+ /* APPLE LOCAL end IMI */
};
/* Also a vector of input files specified. */
@@ -2920,6 +3065,22 @@ int n_infiles;
static bool combine_inputs;
+/* True if input files are assembly files. (.s or .S extension) */
+static bool assembly_input;
+
+/* True if "-c" appears on commandline. */
+static int have_c = 0;
+
+/* True if "-o" appears on commandline. */
+
+static int have_o = 0;
+
+/* True if "-traditional-cpp" appears on commandline. */
+static int traditional_cpp_flag = 0;
+
+/* True if "-E" appears on commandline. */
+static int capital_e_flag = 0;
+
/* This counts the number of libraries added by lang_specific_driver, so that
we can tell if there were any user supplied any files or libraries. */
@@ -3106,8 +3267,6 @@ process_command (int argc, const char **argv)
char *temp1;
const char *spec_lang = 0;
int last_language_n_infiles;
- int have_c = 0;
- int have_o = 0;
int lang_n_infiles = 0;
#ifdef MODIFY_TARGET_NAME
int is_modify_target_name;
@@ -3133,6 +3292,13 @@ process_command (int argc, const char **argv)
}
}
+ /* APPLE LOCAL begin */
+ /* FSF patch pending. Move translate_options() call before -b processing
+ so that -bundle like options can be translated, if required. */
+ /* Convert new-style -- options to old-style. */
+ translate_options (&argc, &argv);
+ /* APPLE LOCAL end */
+
/* If there is a -V or -b option (or both), process it now, before
trying to interpret the rest of the command line. */
if (argc > 1 && argv[1][0] == '-'
@@ -3336,6 +3502,24 @@ process_command (int argc, const char **argv)
}
}
+ /* APPLE LOCAL begin constant cfstrings */
+ /* Retrieve the deployment target from the environment, and then decide
+ whether to enable '-fconstant-cfstrings' by default. */
+ macosx_deployment_target = getenv ("MACOSX_DEPLOYMENT_TARGET");
+ if (macosx_deployment_target)
+ {
+ struct macosx_vers *v = macosx_vers_tbl;
+
+ while (v->vers_str && strcmp (macosx_deployment_target, v->vers_str))
+ v++;
+ if (v->vers_str)
+ {
+ macosx_version_min_required = v->vers_num;
+ use_constant_cfstrings = (macosx_version_min_required >= 1020);
+ }
+ }
+ /* APPLE LOCAL end constant cfstrings */
+
/* Convert new-style -- options to old-style. */
translate_options (&argc, (const char *const **) &argv);
@@ -3391,8 +3575,15 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
/* CPP driver cannot obtain switch from cc1_options. */
if (is_cpp_driver)
add_preprocessor_option ("--help", 6);
+ /* APPLE LOCAL begin 2920964 */
+#if 0
+ /* Our assembler and linkder do not support --help. */
+ /* APPLE LOCAL end 2920964 */
add_assembler_option ("--help", 6);
add_linker_option ("--help", 6);
+ /* APPLE LOCAL begin 2920964 */
+#endif
+ /* APPLE LOCAL end 2920964 */
}
else if (strcmp (argv[i], "-ftarget-help") == 0)
{
@@ -3509,6 +3700,46 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
save_temps_flag = 1;
n_switches++;
}
+ /* APPLE LOCAL begin IMA */
+ else if (strcmp (argv[i], "-traditional-cpp") == 0)
+ {
+ traditional_cpp_flag = 1;
+ n_switches++;
+ }
+ else if (strcmp (argv[i], "-E") == 0)
+ {
+ capital_e_flag = 1;
+ n_switches++;
+ }
+ /* APPLE LOCAL end IMA */
+ /* APPLE LOCAL begin 3235250 */
+ else if (strcmp (argv[i], "-weak_library") == 0)
+ {
+ if (i + 1 == argc)
+ fatal ("argument to `-weak_library' is missing");
+
+ n_infiles += 2;
+ i++;
+ }
+ else if (strcmp (argv[i], "-weak_framework") == 0)
+ {
+ if (i + 1 == argc)
+ fatal ("argument to `-weak_framework' is missing");
+
+ n_infiles += 2;
+ i++;
+ }
+ /* APPLE LOCAL end 3235250 */
+ /* APPLE LOCAL begin Symbol Separation */
+ else if (strcmp (argv[i], "-save-repository") == 0)
+ {
+ if (i + 1 == argc)
+ fatal ("argument to `-save-repository' is missing");
+
+ n_infiles++;
+ i++;
+ }
+ /* APPLE LOCAL end Symbol Separation */
else if (strcmp (argv[i], "-specs") == 0)
{
struct user_specs *user = xmalloc (sizeof (struct user_specs));
@@ -3555,6 +3786,22 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
verbose_only_flag++;
verbose_flag++;
}
+ /* APPLE LOCAL begin constant cfstrings */
+ else if (strcmp (argv[i], "-fconstant-cfstrings") == 0)
+ use_constant_cfstrings = 1;
+ else if (strcmp (argv[i], "-fno-constant-cfstrings") == 0)
+ use_constant_cfstrings = 0;
+ /* APPLE LOCAL end constant cfstrings */
+ /* APPLE LOCAL begin framework */
+ else if (strcmp (argv[i], "-framework") == 0)
+ {
+ if (i + 1 == argc)
+ fatal ("argument to `-framework' is missing");
+
+ n_infiles += 2;
+ i++;
+ }
+ /* APPLE LOCAL end framework */
else if (argv[i][0] == '-' && argv[i][1] != 0)
{
const char *p = &argv[i][1];
@@ -3744,8 +3991,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
}
}
- combine_inputs = (have_c && have_o && lang_n_infiles > 1);
-
if ((save_temps_flag || report_times) && use_pipes)
{
/* -save-temps overrides -pipe, so that temp files are produced */
@@ -3844,6 +4089,30 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
/* More prefixes are enabled in main, after we read the specs file
and determine whether this is cross-compilation or not. */
+ /* APPLE LOCAL begin constant cfstrings */
+ /* Check if '-fconstant-cfstrings' usage is valid, given our deployment
+ target. If not, issue a warning and then suppress the option. */
+ if (use_constant_cfstrings)
+ {
+ if (macosx_version_min_required && macosx_version_min_required < 1020)
+ {
+ error ("warning: `-fconstant-cfstrings' ignored because MACOSX_DEPLOYMENT_TARGET is \"%s\"",
+ macosx_deployment_target);
+ use_constant_cfstrings = 0;
+ }
+ else
+ add_preprocessor_option ("-D__CONSTANT_CFSTRINGS__", 24);
+ }
+ /* Synthesize the deployment target manifest constant. */
+ if (macosx_version_min_required)
+ {
+ char macro_def[40];
+
+ sprintf (macro_def, "-DMAC_OS_X_VERSION_MIN_REQUIRED=%d", macosx_version_min_required);
+ add_preprocessor_option (macro_def, strlen (macro_def));
+ }
+ /* APPLE LOCAL end constant cfstrings */
+
/* Then create the space for the vectors and scan again. */
switches = xmalloc ((n_switches + 1) * sizeof (struct switchstr));
@@ -3950,14 +4219,62 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
infiles[n_infiles].language = "*";
infiles[n_infiles++].name = argv[i];
}
+ /* APPLE LOCAL begin 3235250 */
+ else if (strncmp (argv[i], "-weak-l", 7) == 0)
+ {
+ infiles[n_infiles].language = "*";
+ infiles[n_infiles++].name = argv[i];
+ }
+ else if (strcmp (argv[i], "-weak_library") == 0)
+ {
+ infiles[n_infiles].language = "*";
+ infiles[n_infiles++].name = argv[i];
+ infiles[n_infiles].language = "*";
+ infiles[n_infiles++].name = argv[++i];
+ }
+ else if (strcmp (argv[i], "-weak_framework") == 0)
+ {
+ infiles[n_infiles].language = "*";
+ infiles[n_infiles++].name = argv[i];
+ infiles[n_infiles].language = "*";
+ infiles[n_infiles++].name = argv[++i];
+ }
+ /* APPLE LOCAL end 3235250 */
else if (strcmp (argv[i], "-specs") == 0)
i++;
else if (strncmp (argv[i], "-specs=", 7) == 0)
;
+ /* APPLE LOCAL begin -ObjC 2001-08-03 sts */
+ else if (!strcmp (argv[i], "-ObjC") || !strcmp (argv[i], "-fobjc"))
+ {
+ default_language = "objective-c";
+ add_linker_option ("-ObjC", 5);
+ }
+ else if (strcmp (argv[i], "-ObjC++") == 0)
+ {
+ default_language = "objective-c++";
+ add_linker_option ("-ObjC", 5);
+ }
+ /* APPLE LOCAL end -ObjC 2001-08-03 sts */
else if (strcmp (argv[i], "-time") == 0)
;
else if (strcmp (argv[i], "-###") == 0)
;
+ /* APPLE LOCAL begin constant cfstrings */
+ else if (strcmp (argv[i], "-fconstant-cfstrings") == 0)
+ ;
+ else if (strcmp (argv[i], "-fno-constant-cfstrings") == 0)
+ ;
+ /* APPLE LOCAL end constant cfstrings */
+ /* APPLE LOCAL begin framework */
+ else if (strcmp (argv[i], "-framework") == 0)
+ {
+ infiles[n_infiles].language = "*";
+ infiles[n_infiles++].name = argv[i];
+ infiles[n_infiles].language = "*";
+ infiles[n_infiles++].name = argv[++i];
+ }
+ /* APPLE LOCAL end framework */
else if (argv[i][0] == '-' && argv[i][1] != 0)
{
const char *p = &argv[i][1];
@@ -4185,6 +4502,14 @@ static int delete_this_arg;
is the output file name of this compilation. */
static int this_is_output_file;
+/* APPLE LOCAL begin %b/save-temps can clobber input file (radar 2871891) ilr */
+/* Nonzero if %b or %B has been seen; the next arg to be terminated
+ is a temp file based on the input file's basename. This has
+ the potential to be the same as the input file itself so we
+ need to take precautions if it is. */
+static int this_is_basename_derived_file = 0;
+/* APPLE LOCAL begin %b/save-temps can clobber input file (radar 2871891) ilr */
+
/* Nonzero means %s has been seen; the next arg to be terminated
is the name of a library file and we should try the standard
search dirs for it. */
@@ -4205,6 +4530,9 @@ do_spec (const char *spec)
{
int value;
+ /* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
+ this_is_basename_derived_file = 0;
+
value = do_spec_2 (spec);
/* Force out any unfinished command.
@@ -4223,6 +4551,82 @@ do_spec (const char *spec)
return value;
}
+/* APPLE LOCAL begin %b/save-temps can clobber input file (radar 2871891) ilr */
+/* For %b and %B specs, which create a filename based on the input
+ file's basename, there is a possibility that the resulting file
+ is the same as the input file. Assuming that such names are
+ intended to be used as intermediate (temporary) files there is
+ the risk of clobbering the input file. We check for that here
+ and use a temp file instead if that would happen. */
+
+static const char *
+check_basename_derived_file (string)
+ const char *string;
+{
+ int suffix_length, string_length;
+ const char *suffix;
+
+ static struct base_temp_name {
+ int suffix_length;
+ int filename_length;
+ const char *filename;
+ struct base_temp_name *next;
+ } *t, *base_temp_names = NULL;
+
+ if (strcmp (string, input_filename) != 0)
+ {
+ struct stat st_temp;
+
+ /* Note, set_input() resets input_stat_set to 0. This can also
+ be done buy or for %U, %u, and %g. */
+ if (input_stat_set == 0)
+ {
+ input_stat_set = stat (input_filename, &input_stat);
+ if (input_stat_set >= 0)
+ input_stat_set = 1;
+ }
+
+ if (input_stat_set != 1
+ || stat (string, &st_temp) < 0
+ || input_stat.st_dev != st_temp.st_dev
+ || input_stat.st_ino != st_temp.st_ino)
+ {
+ this_is_basename_derived_file = 0;
+ return string;
+ }
+ }
+
+ string_length = strlen (string);
+ suffix_length = string_length - basename_length;
+ suffix = string + string_length - suffix_length;
+
+ if (suffix_length > 0)
+ {
+ for (t = base_temp_names; t; t = t->next)
+ if (t->suffix_length == suffix_length
+ && strcmp (t->filename + t->filename_length - suffix_length,
+ suffix) == 0)
+ break;
+ }
+ else
+ t = NULL;
+
+ if (!t)
+ {
+ t = (struct base_temp_name *) xmalloc (sizeof (struct base_temp_name));
+ t->next = base_temp_names;
+ base_temp_names = t;
+
+ t->filename = make_temp_file (suffix);
+ t->filename_length = strlen (t->filename);
+ t->suffix_length = suffix_length;
+ }
+
+ delete_this_arg = 1;
+ return t->filename;
+}
+/* APPLE LOCAL end %b/save-temps can clobber input file (radar 2871891) ilr */
+
static int
do_spec_2 (const char *spec)
{
@@ -4375,9 +4779,15 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
- if (this_is_library_file)
+ /* APPLE LOCAL begin %b/save-temps can clobber input file (radar 2871891) ilr */
+ if (this_is_basename_derived_file)
+ string = check_basename_derived_file (string);
+ else if (this_is_library_file)
+ /* APPLE LOCAL end %b/save-temps can clobber input file (radar 2871891) ilr */
string = find_file (string);
- store_arg (string, delete_this_arg, this_is_output_file);
+ /* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
+ store_arg (string, delete_this_arg, this_is_output_file
+ || this_is_basename_derived_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
}
@@ -4410,6 +4820,8 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
arg_going = 0;
delete_this_arg = 0;
this_is_output_file = 0;
+ /* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
+ this_is_basename_derived_file = 0;
this_is_library_file = 0;
input_from_pipe = 0;
break;
@@ -4420,9 +4832,15 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
- if (this_is_library_file)
+ /* APPLE LOCAL begin %b/save-temps can clobber input file (radar 2871891) ilr */
+ if (this_is_basename_derived_file)
+ string = check_basename_derived_file (string);
+ else if (this_is_library_file)
+ /* APPLE LOCAL end %b/save-temps can clobber input file (radar 2871891) ilr */
string = find_file (string);
- store_arg (string, delete_this_arg, this_is_output_file);
+ /* APPLE LOCAL radar 2871891 - %b/%B & -save-temps can clobber input file ilr */
+ store_arg (string, delete_this_arg, this_is_output_file
+ || this_is_basename_derived_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
}
@@ -4439,9 +4857,15 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
- if (this_is_library_file)
+ /* APPLE LOCAL begin %b/save-temps can clobber input file (radar 2871891) ilr */
+ if (this_is_basename_derived_file)
+ string = check_basename_derived_file (string);
+ else if (this_is_library_file)
+ /* APPLE LOCAL end %b/save-temps can clobber input file (radar 2871891) ilr */
string = find_file (string);
- store_arg (string, delete_this_arg, this_is_output_file);
+ /* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
+ store_arg (string, delete_this_arg, this_is_output_file
+ || this_is_basename_derived_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
}
@@ -4449,6 +4873,8 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
arg_going = 0;
delete_this_arg = 0;
this_is_output_file = 0;
+ /* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
+ this_is_basename_derived_file = 0;
this_is_library_file = 0;
break;
@@ -4459,11 +4885,14 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
fatal ("invalid specification! Bug in cc");
case 'b':
+ /* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
+ this_is_basename_derived_file = 1;
obstack_grow (&obstack, input_basename, basename_length);
arg_going = 1;
break;
case 'B':
+ /* APPLE LOCAL %b/save-temps can clobber input file (radar 2871891) ilr */
obstack_grow (&obstack, input_basename, suffixed_basename_length);
arg_going = 1;
break;
@@ -4751,6 +5180,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
suffix. */
for (t = temp_names; t; t = t->next)
if (t->length == suffix_length
+ /* APPLE LOCAL begin IMA */
+ /* Create new temp file for each source file. */
+ && strcmp (suffix, ".i")
+ && strcmp (suffix, ".ii")
+ /* APPLE LOCAL end IMA */
&& strncmp (t->suffix, suffix, suffix_length) == 0
&& t->unique == (c == 'u' || c == 'U' || c == 'j'))
break;
@@ -4778,22 +5212,33 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
temp_filename_length = strlen (temp_filename);
t->filename = temp_filename;
t->filename_length = temp_filename_length;
+ /* APPLE LOCAL begin IMA */
+ infiles[input_file_number].temp_filename = temp_filename;
+ /* APPLE LOCAL end IMA */
}
if (saved_suffix)
free (saved_suffix);
obstack_grow (&obstack, t->filename, t->filename_length);
- delete_this_arg = 1;
+ /* APPLE LOCAL what is this for? */
+ delete_this_arg = (save_temps_flag == 0);
}
arg_going = 1;
break;
case 'i':
+/* APPLE LOCAL begin IMI */
if (combine_inputs)
{
for (i = 0; (int) i < n_infiles; i++)
- store_arg (infiles[i].name, 0, 0);
+ if ((!infiles[i].language) || (infiles[i].language[0] != '*'))
+ if (infiles[i].incompiler == input_file_compiler)
+ {
+ store_arg (infiles[i].name, 0, 0);
+ infiles[i].compiled = TRUE;
+ }
+/* APPLE LOCAL end IMI */
}
else
{
@@ -4838,6 +5283,45 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
}
break;
+ /* APPLE LOCAL begin framework headers */
+ case 'Q':
+#ifdef FRAMEWORK_HEADERS
+ {
+ struct prefix_list *dfpl = default_framework_paths.plist;
+
+ for (; dfpl; dfpl = dfpl->next)
+ {
+ char *tmpstr = xmalloc (strlen (dfpl->prefix) + 5);
+ sprintf (tmpstr, "-F%s", dfpl->prefix);
+ do_spec_1 (tmpstr, 1, NULL);
+ do_spec_1 (" ", 0, NULL); /* fh */
+ free (tmpstr);
+ }
+ }
+#endif /* FRAMEWORK_HEADERS */
+ break;
+ /* APPLE LOCAL end framework headers */
+
+ /* APPLE LOCAL begin constant cfstrings */
+ case 'y':
+ {
+ int c1 = *p++;
+
+ if (c1 == 'C')
+ {
+ if (use_constant_cfstrings)
+ {
+ do_spec_1 (" ", 0, NULL);
+ do_spec_1 ("-fconstant-cfstrings", 1, NULL);
+ do_spec_1 (" ", 0, NULL);
+ }
+ }
+ else
+ abort ();
+ }
+ break;
+ /* APPLE LOCAL end constant cfstrings */
+
case 'o':
{
int max = n_infiles;
@@ -5941,6 +6425,11 @@ main (int argc, const char **argv)
const char *p;
struct user_specs *uptr;
+ /* APPLE LOCAL begin 3313335 */
+ cc_print_options = getenv ("CC_PRINT_OPTIONS");
+ cc_print_options_filename = getenv ("CC_PRINT_OPTIONS_FILE");
+ /* APPLE LOCAL end 3313335 */
+
p = argv[0] + strlen (argv[0]);
while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
--p;
@@ -6330,28 +6819,136 @@ main (int argc, const char **argv)
explicit_link_files = xcalloc (1, n_infiles);
- if (combine_inputs)
+/* APPLE LOCAL begin IMI */
{
int lang_n_infiles = 0;
+ bool singular_input_language = TRUE;
for (i = 0; (int) i < n_infiles; i++)
{
const char *name = infiles[i].name;
- struct compiler *compiler
- = lookup_compiler (name, strlen (name), infiles[i].language);
- if (compiler == NULL)
- error ("%s: linker input file unused because linking not done",
- name);
- else if (lang_n_infiles > 0 && compiler != input_file_compiler)
- fatal ("cannot specify -o with -c or -S and multiple languages");
- else
+ struct compiler *compiler = lookup_compiler (name, strlen (name), infiles[i].language);
+ if (lang_n_infiles > 0 && compiler != input_file_compiler
+ && infiles[i].language && infiles[i].language[0] != '*')
+ {
+ singular_input_language = FALSE;
+ infiles[i].incompiler = compiler;
+ }
+ else if (infiles[i].language && infiles[i].language[0] == '*')
+ {
+ explicit_link_files[i] = 1;
+ infiles[i].incompiler = NULL;
+ }
+ else if (compiler)
{
lang_n_infiles++;
input_file_compiler = compiler;
+ infiles[i].incompiler = compiler;
}
+ else
+ {
+ /* Since there is no compiler for this input file, assume it is a
+ linker file. */
+ explicit_link_files[i] = 1;
+ infiles[i].incompiler = NULL;
+ }
+ infiles[i].compiled = FALSE;
+ infiles[i].preprocessed = FALSE;
}
}
- for (i = 0; (int) i < (combine_inputs ? 1 : n_infiles); i++)
+ if (save_temps_flag || traditional_cpp_flag || capital_e_flag)
+ {
+ /* Must do a separate pre-processing pass for C & Objective-C files, to
+ obtain individual .i files. */
+
+ for (i=0; (int) i < n_infiles; i++)
+ {
+ int this_file_error = 0;
+
+ input_file_number = i;
+ set_input (infiles[i].name);
+ if ((infiles[i].incompiler)
+ && (strcmp(infiles[i].incompiler->suffix, "@c") == 0
+ || strcmp (infiles[i].incompiler->suffix, ".m") == 0
+ || strcmp (infiles[i].incompiler->suffix, ".c") == 0))
+ {
+ input_file_compiler = infiles[i].incompiler;
+ }
+ else
+ continue;
+
+ /* outfiles[i] = input_filename;*/
+
+ if (input_file_compiler)
+ {
+ {
+ value = do_spec (input_file_compiler->spec);
+ infiles[i].preprocessed = TRUE;
+
+ if (infiles[i].preprocessed && !capital_e_flag)
+ {
+ if (save_temps_flag)
+ {
+ char *name = (char *) xmalloc ((strlen(infiles[i].name) + 1)
+ * sizeof (char));
+ char *dot, *p;
+ strcpy (name, infiles[i].name);
+ dot = strrchr (name, '.');
+ dot++;
+ if (*dot == 'c')
+ *dot = 'i';
+ else if (*dot == 'm')
+ {
+ dot++;
+ *dot = 'i';
+ dot++;
+ *dot = '\0';
+ }
+
+ infiles[i].incompiler = lookup_compiler (name,
+ strlen (name),
+ infiles[i].language);
+
+ /* Save temps files are created in current working directory.
+ Extract basename by removing directory names from input
+ file name. */
+ for (p = name; *p; p++)
+ if (IS_DIR_SEPARATOR (*p))
+ name = p + 1;
+ infiles[i].name = name;
+
+ }
+ else if (traditional_cpp_flag)
+ {
+ /* Temp file name is stored in infiles->temp_filename.
+ Use it as input file name. */
+ infiles[i].name = infiles[i].temp_filename;
+ infiles[i].incompiler = lookup_compiler (infiles[i].name,
+ strlen (infiles[i].name),
+ infiles[i].language);
+ }
+ }
+
+ if (value < 0)
+ {
+ this_file_error = 1;
+ break;
+ }
+ }
+
+ }
+
+ if (this_file_error)
+ {
+ delete_failure_queue ();
+ error_count++;
+ }
+ clear_failure_queue ();
+ }
+ }
+/* APPLE LOCAL end IMI */
+
+ for (i = 0; (int) i < n_infiles; i++)
{
int this_file_error = 0;
@@ -6360,16 +6957,49 @@ main (int argc, const char **argv)
input_file_number = i;
set_input (infiles[i].name);
- /* Use the same thing in %o, unless cp->spec says otherwise. */
+/* APPLE LOCAL begin IMI */
- outfiles[i] = input_filename;
+ if (infiles[i].compiled)
+ continue;
+ else
+ {
+ const char *name = infiles[i].name;
+ char *dot = strrchr (name, '.');
+ int len = strlen (name);
+ char *ext = (char *) xmalloc (len*sizeof(char));
+
+ if (dot)
+ strcpy (ext, dot);
+ else
+ ext[0] = '\0';
+
+ /* IMI currently only works for C and Objective-C, so make sure the
+ source file belongs to one of those, or don't attempt IMI. */
- /* Figure out which compiler from the file's suffix. */
+ if ((strcmp (ext, ".m") == 0)
+ || (strcmp (ext, ".c") == 0)
+ || (strcmp (ext, ".i") == 0)
+ || (strcmp (ext, ".s") == 0)
+ || (strcmp (ext, ".S") == 0))
+ combine_inputs = TRUE;
+ else
+ combine_inputs = FALSE;
+
+ if (combine_inputs)
+ {
+ if ((strcmp (ext, ".s") == 0) || strcmp (ext, ".S") == 0)
+ assembly_input = TRUE;
+ else
+ assembly_input = FALSE;
+ }
+ input_file_compiler = infiles[i].incompiler;
+ }
- if (! combine_inputs)
- input_file_compiler
- = lookup_compiler (infiles[i].name, input_filename_length,
- infiles[i].language);
+/* APPLE LOCAL end IMI */
+
+ /* Use the same thing in %o, unless cp->spec says otherwise. */
+
+ outfiles[i] = input_filename;
if (input_file_compiler)
{
@@ -6381,9 +7011,18 @@ main (int argc, const char **argv)
input_filename, &input_file_compiler->spec[1]);
this_file_error = 1;
}
- else
+ /* APPLE LOCAL begin IMA */
+ /* Check if -E is not used on command line OR input file is
+ assembly file. If -E is used then do not invoke compiler
+ again, because preprocessed output is already generated
+ above. However
+ 1) If -E is used with assembly input file then continue.
+ 2) If inputs are not combined then continue. */
+ else if (!capital_e_flag || assembly_input || !combine_inputs)
+ /* APPLE LOCAL end IMA */
{
value = do_spec (input_file_compiler->spec);
+ infiles[i].compiled = true;
if (value < 0)
this_file_error = 1;
}
@@ -6448,7 +7087,8 @@ main (int argc, const char **argv)
value = do_spec (link_command_spec);
if (value < 0)
- error_count = 1;
+ error_count = 1;
+
linker_was_run = (tmp != execution_count);
}
@@ -6536,6 +7176,27 @@ lookup_compiler (const char *name, size_t length, const char *language)
if (cp >= compilers)
{
+ /* APPLE LOCAL begin -ObjC 2001-08-03 sts */
+ /* We found a language, but because we set a default language,
+ override with the default. */
+ if (default_language)
+ {
+ struct compiler *ncomp = lookup_compiler (NULL, 0, default_language);
+#if 0 /* unhelpful without docs to educate users, skip for now -sts 2002-01-01 */
+ if (cp == ncomp
+ || (cp->spec[0] == '@'
+ && ncomp
+ && strcmp (cp->spec, ncomp->suffix) == 0))
+ {
+ if (strcmp (default_language, "objective-c") == 0)
+ error ("Warning: -ObjC/-fobjc option is redundant");
+ if (strcmp (default_language, "objective-c++") == 0)
+ error ("Warning: -ObjC++ option is redundant");
+ }
+#endif
+ return ncomp;
+ }
+ /* APPLE LOCAL end -ObjC 2001-08-03 sts */
if (cp->spec[0] != '@')
/* A non-alias entry: return it. */
return cp;
diff --git a/gcc/gcc.h b/gcc/gcc.h
index 9df9ffd1252..124ac7fecf1 100644
--- a/gcc/gcc.h
+++ b/gcc/gcc.h
@@ -38,18 +38,23 @@ struct spec_function
|| (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
|| (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
|| (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
+ /* APPLE LOCAL framework headers */ \
+ || (CHAR) == 'F' \
|| (CHAR) == 'B' || (CHAR) == 'b')
/* This defines which multi-letter switches take arguments. */
+/* APPLE LOCAL Symbol Separation */
+/* Add save-repository in the list. */
#define DEFAULT_WORD_SWITCH_TAKES_ARG(STR) \
(!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext") \
|| !strcmp (STR, "Tbss") || !strcmp (STR, "include") \
|| !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
|| !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
|| !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
- || !strcmp (STR, "isystem") || !strcmp (STR, "-param") \
- || !strcmp (STR, "specs") \
+ || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
+ || !strcmp (STR, "-param") || !strcmp (STR, "specs") \
+ || !strcmp (STR, "save-repository") \
|| !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ"))
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 69f12fae9e9..7688579c1b3 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -788,6 +788,17 @@ gcse_main (rtx f, FILE *file)
during this pass. */
changed = one_cprop_pass (pass + 1, 0, 0);
+ /* APPLE LOCAL begin div by const */
+ /* div by const optimization can introduce new instructions.
+ All this stuff needs to be recomputed. */
+ free_gcse_mem ();
+ max_gcse_regno = max_reg_num ();
+ alloc_gcse_mem (f);
+ free_reg_set_mem ();
+ alloc_reg_set_mem (max_reg_num ());
+ compute_sets (f);
+ /* APPLE LOCAL end div by const */
+
if (optimize_size)
changed |= one_classic_gcse_pass (pass + 1);
else
@@ -4204,6 +4215,64 @@ cprop_insn (rtx insn, int alter_jumps)
if (INSN_DELETED_P (insn))
return 1;
}
+ /* APPLE LOCAL begin div by const */
+ /* Look for int div by constant and expand if found. */
+ if ( GET_CODE (insn) == INSN
+ && GET_CODE (PATTERN (insn)) == SET
+ && ( GET_CODE (XEXP (PATTERN (insn), 1)) == DIV
+ || GET_CODE (XEXP (PATTERN (insn), 1)) == UDIV)
+ && GET_MODE (XEXP (PATTERN (insn), 1)) == SImode
+ && GET_CODE (XEXP (XEXP (PATTERN (insn), 1), 1)) == CONST_INT )
+ {
+ rtx seq, result, target;
+ target = XEXP (PATTERN (insn), 0);
+ start_sequence ();
+ result = expand_divmod (0, TRUNC_DIV_EXPR, SImode,
+ XEXP (XEXP (PATTERN (insn), 1), 0),
+ XEXP (XEXP (PATTERN (insn), 1), 1),
+ target,
+ GET_CODE (XEXP (PATTERN (insn), 1))==DIV ? 0 : 1);
+ if ( result != target )
+ emit_move_insn (target, result);
+ seq = get_insns ();
+ end_sequence ();
+ emit_insn_after (seq, insn);
+ PUT_CODE (insn, NOTE);
+ NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ NOTE_SOURCE_FILE (insn) = 0;
+ update_bb_for_insn (BLOCK_FOR_INSN (insn));
+ changed = 1;
+ break;
+ }
+ else if ( GET_CODE (insn) == INSN
+ && GET_CODE (PATTERN (insn)) == SET
+ && (note = find_reg_equal_equiv_note (insn))
+ && (GET_CODE (XEXP (note, 0)) == DIV
+ || GET_CODE (XEXP (note, 0)) == UDIV)
+ && GET_MODE (XEXP (note, 0)) == SImode
+ && GET_CODE (XEXP (XEXP (note, 0), 1)) == CONST_INT )
+ {
+ rtx seq, result, target;
+ target = XEXP (PATTERN (insn), 0);
+ start_sequence ();
+ result = expand_divmod (0, TRUNC_DIV_EXPR, SImode,
+ XEXP (XEXP (note, 0), 0),
+ XEXP (XEXP (note, 0), 1),
+ target,
+ GET_CODE (XEXP (note, 0))==DIV ? 0 : 1);
+ if ( result != target )
+ emit_move_insn (target, result);
+ seq = get_insns ();
+ end_sequence ();
+ emit_insn_after (seq, insn);
+ PUT_CODE (insn, NOTE);
+ NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ NOTE_SOURCE_FILE (insn) = 0;
+ update_bb_for_insn (BLOCK_FOR_INSN (insn));
+ changed = 1;
+ break;
+ }
+ /* APPLE LOCAL end div by const */
}
else if (GET_CODE (src) == REG
&& REGNO (src) >= FIRST_PSEUDO_REGISTER
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 73aba41c621..300037abaf3 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1090,7 +1090,7 @@ open_base_files (void)
"function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
"basic-block.h", "cselib.h", "insn-addr.h", "optabs.h",
"libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
- "tree-alias-type.h", "tree-flow.h",
+ "tree-alias-type.h", "tree-flow.h", "tree-data-ref.h", "tree-dg.h",
NULL
};
const char *const *ifp;
@@ -1124,6 +1124,11 @@ get_file_basename (const char *f)
int l1;
int l2;
s1 = basename - strlen (lang_dir_names [i]) - 1;
+ /* APPLE LOCAL begin Objective-C++ */
+ /* Don't confuse "objcp/" with "cp/". */
+ if (s1[-1] != '/')
+ continue;
+ /* APPLE LOCAL end Objective-C++ */
s2 = lang_dir_names [i];
l1 = strlen (s1);
l2 = strlen (s2);
@@ -1150,26 +1155,16 @@ get_file_basename (const char *f)
unsigned
get_base_file_bitmap (const char *input_file)
{
- const char *basename = get_file_basename (input_file);
- const char *slashpos = strchr (basename, '/');
+ /* APPLE LOCAL Objective-C++ */
+ /* Variables were here. */
unsigned j;
unsigned k;
unsigned bitmap;
- if (slashpos)
- {
- size_t i;
- for (i = 1; i < NUM_BASE_FILES; i++)
- if ((size_t)(slashpos - basename) == strlen (lang_dir_names [i])
- && memcmp (basename, lang_dir_names[i], strlen (lang_dir_names[i])) == 0)
- {
- /* It's in a language directory, set that language. */
- bitmap = 1 << i;
- return bitmap;
- }
-
- abort (); /* Should have found the language. */
- }
+ /* APPLE LOCAL begin Objective-C++ */
+ /* Lose the subdirectory-based scanning, it's redundant
+ if the config-lang.in lists are correct. */
+ /* APPLE LOCAL end Objective-C++ */
/* If it's in any config-lang.in, then set for the languages
specified. */
@@ -1235,6 +1230,17 @@ get_output_file_with_visibility (const char *input_file)
output_name = "gt-c-common.h", for_name = "c-common.c";
else if (strcmp (basename, "c-tree.h") == 0)
output_name = "gt-c-decl.h", for_name = "c-decl.c";
+ /* APPLE LOCAL begin Objective-C++ */
+ /* Put all lang-specific header roots in their own .h files. */
+ else if (strcmp (basename, "cp/cp-tree.h") == 0)
+ output_name = "gt-cp-cp-tree-h.h", for_name = "cp/cp-tree.h";
+ else if (strcmp (basename, "cp/decl.h") == 0)
+ output_name = "gt-cp-decl-h.h", for_name = "cp/decl.h";
+ else if (strcmp (basename, "cp/lex.h") == 0)
+ output_name = "gt-cp-lex-h.h", for_name = "cp/lex.h";
+ else if (strcmp (basename, "objc/objc-act.h") == 0)
+ output_name = "gt-objc-objc-act-h.h", for_name = "objc/objc-act.h";
+ /* APPLE LOCAL end Objective-C++ */
else
{
size_t i;
diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h
index f178505e892..203a2174980 100644
--- a/gcc/ginclude/stdarg.h
+++ b/gcc/ginclude/stdarg.h
@@ -28,6 +28,11 @@ Boston, MA 02111-1307, USA. */
* ISO C Standard: 7.15 Variable arguments <stdarg.h>
*/
+/* APPLE LOCAL begin MW compatibility */
+#ifdef __MWERKS__
+#include "mw_stdarg.h"
+#else
+/* APPLE LOCAL end MW compatibility */
#ifndef _STDARG_H
#ifndef _ANSI_STDARG_H_
#ifndef __need___va_list
@@ -131,3 +136,5 @@ typedef __gnuc_va_list va_list;
#endif /* not _ANSI_STDARG_H_ */
#endif /* not _STDARG_H */
+/* APPLE LOCAL MW compatibility */
+#endif /* __MWERKS__ */
diff --git a/gcc/ginclude/varargs.h b/gcc/ginclude/varargs.h
index 4b9803e71ac..a25a3628787 100644
--- a/gcc/ginclude/varargs.h
+++ b/gcc/ginclude/varargs.h
@@ -1,3 +1,9 @@
+/* APPLE LOCAL begin MW compatibility */
+#ifdef __MWERKS__
+#include "mw_varargs.h"
+#else
+/* APPLE LOCAL end MW compatibility */
+
#ifndef _VARARGS_H
#define _VARARGS_H
@@ -5,3 +11,5 @@
#error "Revise your code to use <stdarg.h>."
#endif
+/* APPLE LOCAL MW compatibility */
+#endif /* __MWERKS__ */
diff --git a/gcc/global.c b/gcc/global.c
index 6f84ebffa8b..59cb642f959 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -38,6 +38,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "output.h"
#include "toplev.h"
+/* APPLE LOCAL begin rewrite weight computation */
+/* The rewritten weight computation works fine on Darwin, but causes
+ bootstrap compares to fail on Linux. */
+#ifdef CONFIG_DARWIN_H
+#define REWRITE_WEIGHT_COMPUTATION
+#endif
+/* APPLE LOCAL end rewrite weight computation */
+
/* This pass of the compiler performs global register allocation.
It assigns hard register numbers to all the pseudo registers
that were not handled in local_alloc. Assignments are recorded
@@ -226,6 +234,18 @@ static HARD_REG_SET regs_used_so_far;
static int local_reg_n_refs[FIRST_PSEUDO_REGISTER];
+/* APPLE LOCAL begin rewrite weight computation */
+#ifdef REWRITE_WEIGHT_COMPUTATION
+/* Overall weight of each hard reg, as used by local alloc.
+ This was formerly computed once as
+ SUM(REG_FREQ(i))/SUM(REG_LIVE_LENGTH(i)) where the sums
+ are computed over all uses. But that computation produces very
+ wrong answers when a reg is used both inside and outside a loop.
+ Now it is computed as
+ SUM (REG_FREQ(i)/REG_LIVE_LENGTH(i)) over all uses. */
+
+static double local_reg_weight[FIRST_PSEUDO_REGISTER];
+#else
/* Frequency of uses of given hard reg. */
static int local_reg_freq[FIRST_PSEUDO_REGISTER];
@@ -233,6 +253,8 @@ static int local_reg_freq[FIRST_PSEUDO_REGISTER];
This is actually the sum of the live lengths of the specific regs. */
static int local_reg_live_length[FIRST_PSEUDO_REGISTER];
+#endif /* REWRITE_WEIGHT_COMPUTATION */
+/* APPLE LOCAL end rewrite weight computation */
/* Set to 1 a bit in a vector TABLE of HARD_REG_SETs, for vector
element I, and hard register number J. */
@@ -478,9 +500,17 @@ global_alloc (FILE *file)
/* Calculate amount of usage of each hard reg by pseudos
allocated by local-alloc. This is to see if we want to
override it. */
+ /* APPLE LOCAL begin rewrite weight computation */
+#ifndef REWRITE_WEIGHT_COMPUTATION
memset (local_reg_live_length, 0, sizeof local_reg_live_length);
+#endif /* REWRITE_WEIGHT_COMPUTATION */
memset (local_reg_n_refs, 0, sizeof local_reg_n_refs);
+#ifdef REWRITE_WEIGHT_COMPUTATION
+ memset (local_reg_weight, 0, sizeof local_reg_weight);
+#else
memset (local_reg_freq, 0, sizeof local_reg_freq);
+#endif /* REWRITE_WEIGHT_COMPUTATION */
+ /* APPLE LOCAL end rewrite weight computation */
for (i = FIRST_PSEUDO_REGISTER; i < (size_t) max_regno; i++)
if (reg_renumber[i] >= 0)
{
@@ -491,15 +521,29 @@ global_alloc (FILE *file)
for (j = regno; j < endregno; j++)
{
local_reg_n_refs[j] += REG_N_REFS (i);
+ /* APPLE LOCAL begin rewrite weight computation */
+#ifdef REWRITE_WEIGHT_COMPUTATION
+ if ( REG_LIVE_LENGTH (i) > 0 )
+ local_reg_weight[j] += (double)REG_FREQ (i)
+ / (double) REG_LIVE_LENGTH (i);
+#else
local_reg_freq[j] += REG_FREQ (i);
local_reg_live_length[j] += REG_LIVE_LENGTH (i);
+#endif /* REWRITE_WEIGHT_COMPUTATION */
+ /* APPLE LOCAL end rewrite weight computation */
}
}
/* We can't override local-alloc for a reg used not just by local-alloc. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (regs_ever_live[i])
+ /* APPLE LOCAL begin rewrite weight computation */
+#ifdef REWRITE_WEIGHT_COMPUTATION
+ local_reg_n_refs[i] = 0;
+#else
local_reg_n_refs[i] = 0, local_reg_freq[i] = 0;
+#endif /* REWRITE_WEIGHT_COMPUTATION */
+ /* APPLE LOCAL end rewrite weight computation */
allocno_row_words = (max_allocno + INT_BITS - 1) / INT_BITS;
@@ -1249,6 +1293,15 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
#endif
)
{
+ /* APPLE LOCAL begin rewrite weight computation */
+#ifdef REWRITE_WEIGHT_COMPUTATION
+ /* We explicitly evaluate the divide result into a temporary
+ variable so as to avoid excess precision problems that occur
+ on an i386-unknown-sysv4.2 (unixware) host. */
+ double tmp = ((double) allocno[num].freq
+ / allocno[num].live_length);
+#else
+ /* APPLE LOCAL end rewrite weight computation */
/* We explicitly evaluate the divide results into temporary
variables so as to avoid excess precision problems that occur
on an i386-unknown-sysv4.2 (unixware) host. */
@@ -1257,8 +1310,15 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
/ local_reg_live_length[regno]);
double tmp2 = ((double) allocno[num].freq
/ allocno[num].live_length);
+ /* APPLE LOCAL begin rewrite weight computation */
+#endif /* REWRITE_WEIGHT_COMPUTATION */
+#ifdef REWRITE_WEIGHT_COMPUTATION
+ if (local_reg_weight[regno] < tmp)
+#else
if (tmp1 < tmp2)
+#endif /* REWRITE_WEIGHT_COMPUTATION */
+ /* APPLE LOCAL end rewrite weight computation */
{
/* Hard reg REGNO was used less in total by local regs
than it would be used by this one allocno! */
@@ -1305,7 +1365,11 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
SET_HARD_REG_BIT (regs_used_so_far, j);
/* This is no longer a reg used just by local regs. */
local_reg_n_refs[j] = 0;
+ /* APPLE LOCAL begin rewrite weight computation */
+#ifndef REWRITE_WEIGHT_COMPUTATION
local_reg_freq[j] = 0;
+#endif /* REWRITE_WEIGHT_COMPUTATION */
+ /* APPLE LOCAL end rewrite weight computation */
}
/* For each other pseudo-reg conflicting with this one,
mark it as conflicting with the hard regs this one occupies. */
diff --git a/gcc/hooks.c b/gcc/hooks.c
index cb6efd4bb6a..4ceef674913 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -226,3 +226,37 @@ hook_tree_tree_identity (tree a)
{
return a;
}
+
+/* Generic hook that takes a tree and returns a NULL string. */
+const char *
+hook_constcharptr_tree_null (tree t ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+/* APPLE LOCAL begin AltiVec */
+/* Generic hook that takes a cpp_token pointer and returns false. */
+bool
+hook_bool_constcpp_tokenp_false (const struct cpp_token * tok ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+/* APPLE LOCAL end AltiVec */
+
+/* APPLE LOCAL begin constant cfstrings */
+/* Generic hook that takes a tree and returns NULL. */
+tree
+hook_tree_tree_null (tree a ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+/* Generic hook that takes three trees and returns NULL. */
+tree
+hook_tree_tree_tree_tree_null (tree a ATTRIBUTE_UNUSED,
+ tree b ATTRIBUTE_UNUSED,
+ tree c ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+/* APPLE LOCAL end constant cfstrings */
diff --git a/gcc/hooks.h b/gcc/hooks.h
index a72f6c88013..26373a36cfa 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -60,5 +60,12 @@ extern rtx hook_rtx_tree_int_null (tree, int);
extern void * hook_voidp_size_t_null (size_t);
extern bool hook_bool_voidp_size_t_false (void *, size_t);
extern tree hook_tree_tree_identity (tree a);
+extern const char *hook_constcharptr_tree_null (tree);
+/* APPLE LOCAL AltiVec */
+extern bool hook_bool_constcpp_tokenp_false (const struct cpp_token *);
+/* APPLE LOCAL begin constant cfstrings */
+extern tree hook_tree_tree_null (tree);
+extern tree hook_tree_tree_tree_tree_null (tree, tree, tree);
+/* APPLE LOCAL end constant cfstrings */
#endif
diff --git a/gcc/idebug.c b/gcc/idebug.c
new file mode 100644
index 00000000000..398cc06359a
--- /dev/null
+++ b/gcc/idebug.c
@@ -0,0 +1,639 @@
+/* APPLE LOCAL file debugging */
+/* C tree & rtl accessors defined as functions for use in a debugger.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* What we do here is to instantiate each macro as a function *BY
+ THE SAME NAME*. Depends on the macro not being expanded when
+ it is surrounded by parens.
+
+ Note that this file represents the common accessors for both
+ C and C++. It is included as part of c-idebug.c and also
+ as part of cp/cp-idebug.c where these files are built for
+ their respective compilers and contain the language specific
+ accessors for their language (i.e., c-idebug.c have the
+ accessors for c-tree.h and cp/cp-idebug.c have the accessors
+ for cp-tree.h. */
+
+#include "config.h"
+
+#ifdef ENABLE_IDEBUG
+
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "flags.h"
+#include "c-common.h"
+
+#define fn_0(name,rt) rt (name) (void); \
+ rt (name) (void) { return name(); }
+#define fn_1(name,rt,p1) rt (name)(p1); \
+ rt (name) (p1 a) { return name(a); }
+#define fn_2(name,rt,p1,p2) rt (name)(p1,p2); \
+ rt (name) (p1 a,p2 b) { return name(a,b); }
+#define fn_3(name,rt,p1,p2,p3) rt (name)(p1,p2,p3); \
+ rt (name) (p1 a,p2 b,p3 c) { return name(a,b,c); }
+#define fn_4(name,rt,p1,p2,p3,p4) rt (name) (p1,p2,p3,p4); \
+ rt (name) (p1 a,p2 b,p3 c,p4 d) { return name(a,b,c,d); }
+
+fn_1( RP, tree, tree )
+
+/* Macros from tree.h */
+
+fn_1( TREE_CODE_CLASS, int, int )
+fn_1( IS_EXPR_CODE_CLASS, char, int )
+fn_1( TREE_CODE_LENGTH, int, int )
+fn_1( TREE_CODE, enum tree_code, tree )
+fn_1( TREE_TYPE, tree, tree )
+fn_1( TREE_CHAIN, tree, tree )
+fn_1( INTEGRAL_TYPE_P, int, tree )
+fn_1( FLOAT_TYPE_P, int, tree )
+fn_1( AGGREGATE_TYPE_P, int, tree )
+fn_1( POINTER_TYPE_P, int, tree )
+fn_1( BOUNDED_INDIRECT_TYPE_P, int, tree )
+fn_1( BOUNDED_POINTER_TYPE_P, int, tree )
+fn_1( BOUNDED_REFERENCE_TYPE_P, int, tree )
+fn_1( MAYBE_BOUNDED_INDIRECT_TYPE_P, int, tree )
+fn_1( MAYBE_BOUNDED_POINTER_TYPE_P, int, tree )
+fn_1( MAYBE_BOUNDED_REFERENCE_TYPE_P, int, tree )
+fn_1( COMPLETE_TYPE_P, int, tree )
+fn_1( VOID_TYPE_P, int, tree )
+fn_1( COMPLETE_OR_VOID_TYPE_P, int, tree )
+fn_1( COMPLETE_OR_UNBOUND_ARRAY_TYPE_P, int, tree )
+fn_1( TYPE_P, int, tree )
+fn_1( TREE_ADDRESSABLE, int, tree )
+fn_1( TREE_STATIC, int, tree )
+fn_1( TREE_NO_UNUSED_WARNING, int, tree )
+fn_1( TREE_VIA_VIRTUAL, int, tree )
+fn_1( TREE_CONSTANT_OVERFLOW, int, tree )
+fn_1( TREE_SYMBOL_REFERENCED, int, tree )
+fn_1( TREE_OVERFLOW, int, tree )
+fn_1( TREE_PUBLIC, int, tree )
+fn_1( TREE_VIA_PUBLIC, int, tree )
+fn_1( TREE_VIA_PRIVATE, int, tree )
+fn_1( TREE_VIA_PROTECTED, int, tree )
+fn_1( TREE_SIDE_EFFECTS, int, tree )
+fn_1( TREE_THIS_VOLATILE, int, tree )
+fn_1( TREE_READONLY, int, tree )
+fn_1( TREE_READONLY_DECL_P, int, tree )
+fn_1( TREE_CONSTANT, int, tree )
+fn_1( TREE_UNSIGNED, int, tree )
+fn_1( TYPE_TRAP_SIGNED, int, tree )
+fn_1( TREE_ASM_WRITTEN, int, tree )
+fn_1( TREE_USED, int, tree )
+fn_1( TREE_NOTHROW, int, tree )
+fn_1( TREE_PRIVATE, int, tree )
+fn_1( TREE_PROTECTED, int, tree )
+fn_1( TREE_BOUNDED, int, tree )
+fn_1( TREE_DEPRECATED, int, tree )
+/* APPLE LOCAL unavailable (Radar 2809697) ilr */
+fn_1( TREE_UNAVAILABLE, int, tree )
+fn_1( TREE_LANG_FLAG_0, int, tree )
+fn_1( TREE_LANG_FLAG_1, int, tree )
+fn_1( TREE_LANG_FLAG_2, int, tree )
+fn_1( TREE_LANG_FLAG_3, int, tree )
+fn_1( TREE_LANG_FLAG_4, int, tree )
+fn_1( TREE_LANG_FLAG_5, int, tree )
+fn_1( TREE_LANG_FLAG_6, int, tree )
+fn_1( TREE_INT_CST_LOW, unsigned HOST_WIDE_INT, tree )
+fn_1( TREE_INT_CST_HIGH, HOST_WIDE_INT, tree )
+fn_2( INT_CST_LT, int, tree, tree )
+fn_2( INT_CST_LT_UNSIGNED, int, tree, tree )
+fn_1( TREE_CST_RTL, rtx, tree )
+ /* APPLE FIXME */
+ /* fn_1( TREE_REAL_CST, REAL_VALUE_TYPE, tree ) */
+fn_1( TREE_STRING_LENGTH, int, tree )
+fn_1( TREE_STRING_POINTER, char*, tree )
+fn_1( TREE_REALPART, tree, tree )
+fn_1( TREE_IMAGPART, tree, tree )
+fn_1( IDENTIFIER_LENGTH, int, tree )
+fn_1( IDENTIFIER_POINTER, char*, tree )
+fn_1( TREE_PURPOSE, tree, tree )
+fn_1( TREE_VALUE, tree, tree )
+fn_1( TREE_VEC_LENGTH, int, tree )
+fn_2( TREE_VEC_ELT, tree, tree, int )
+fn_1( SAVE_EXPR_CONTEXT, tree, tree )
+fn_1( SAVE_EXPR_RTL, rtx, tree )
+fn_1( SAVE_EXPR_NOPLACEHOLDER, int, tree )
+fn_1( SAVE_EXPR_PERSISTENT_P, int, tree )
+fn_1( RTL_EXPR_SEQUENCE, rtx, tree )
+fn_1( RTL_EXPR_RTL, rtx, tree )
+fn_1( CONSTRUCTOR_ELTS, tree, tree )
+fn_2( TREE_OPERAND, tree, tree, int )
+fn_1( TREE_COMPLEXITY, int, tree )
+fn_1( LABELED_BLOCK_LABEL, tree, tree )
+fn_1( LABELED_BLOCK_BODY, tree, tree )
+fn_1( EXIT_BLOCK_LABELED_BLOCK, tree, tree )
+fn_1( EXIT_BLOCK_RETURN, tree, tree )
+fn_1( LOOP_EXPR_BODY, tree, tree )
+fn_1( EXPR_WFL_NODE, tree, tree )
+fn_1( EXPR_WFL_FILENAME, char*, tree )
+fn_1( EXPR_WFL_FILENAME_NODE, tree, tree )
+fn_1( EXPR_WFL_LINENO, int, tree )
+fn_1( EXPR_WFL_COLNO, int, tree )
+fn_1( EXPR_WFL_LINECOL, int, tree )
+fn_3( EXPR_WFL_SET_LINECOL, int, tree, int, int )
+fn_1( EXPR_WFL_EMIT_LINE_NOTE, int, tree )
+fn_1( BLOCK_VARS, tree, tree )
+fn_1( BLOCK_SUBBLOCKS, tree, tree )
+fn_1( BLOCK_SUPERCONTEXT, tree, tree )
+fn_1( BLOCK_CHAIN, tree, tree )
+fn_1( BLOCK_ABSTRACT_ORIGIN, tree, tree )
+fn_1( BLOCK_ABSTRACT, int, tree )
+fn_1( BLOCK_HANDLER_BLOCK, int, tree )
+fn_1( BLOCK_NUMBER, int, tree )
+fn_1( TYPE_UID, int, tree )
+fn_1( TYPE_SIZE, tree, tree )
+fn_1( TYPE_SIZE_UNIT, tree, tree )
+fn_1( TYPE_MODE, int, tree )
+fn_1( TYPE_VALUES, tree, tree )
+fn_1( TYPE_DOMAIN, tree, tree )
+fn_1( TYPE_FIELDS, tree, tree )
+fn_1( TYPE_METHODS, tree, tree )
+fn_1( TYPE_VFIELD, tree, tree )
+fn_1( TYPE_ARG_TYPES, tree, tree )
+fn_1( TYPE_METHOD_BASETYPE, tree, tree )
+fn_1( TYPE_OFFSET_BASETYPE, tree, tree )
+fn_1( TYPE_POINTER_TO, tree, tree )
+fn_1( TYPE_REFERENCE_TO, tree, tree )
+fn_1( TYPE_MIN_VALUE, tree, tree )
+fn_1( TYPE_MAX_VALUE, tree, tree )
+fn_1( TYPE_PRECISION, int, tree )
+fn_1( TYPE_SYMTAB_ADDRESS, int, tree )
+fn_1( TYPE_SYMTAB_POINTER, char*, tree )
+fn_1( TYPE_NAME, tree, tree )
+fn_1( TYPE_NEXT_VARIANT, tree, tree )
+fn_1( TYPE_MAIN_VARIANT, tree, tree )
+fn_1( TYPE_CONTEXT, tree, tree )
+fn_1( TYPE_LANG_SPECIFIC, struct lang_type*, tree )
+fn_1( TYPE_DEBUG_REPRESENTATION_TYPE, tree, tree )
+fn_2( TYPE_MAIN_VARIANTS_PHYSICALLY_EQUAL_P, int, tree, tree )
+fn_1( TYPE_MAIN_PHYSICAL_VARIANT, tree, tree )
+fn_1( TYPE_BINFO, tree, tree )
+fn_1( TYPE_ALIAS_SET, int, tree )
+fn_1( TYPE_ALIAS_SET_KNOWN_P, int, tree )
+fn_1( TYPE_ATTRIBUTES, tree, tree )
+fn_1( TYPE_ALIGN, int, tree )
+fn_1( TYPE_USER_ALIGN, int, tree )
+fn_1( TYPE_ALIGN_UNIT, int, tree )
+fn_1( TYPE_STUB_DECL, tree, tree )
+fn_1( TYPE_NO_FORCE_BLK, int, tree )
+fn_1( TYPE_IS_SIZETYPE, int, tree )
+fn_1( TYPE_RETURNS_STACK_DEPRESSED, int, tree )
+fn_1( TYPE_VOLATILE, int, tree )
+fn_1( TYPE_READONLY, int, tree )
+fn_1( TYPE_RESTRICT, int, tree )
+fn_1( TYPE_BOUNDED, int, tree )
+fn_1( TYPE_QUALS, int, tree )
+fn_1( TREE_EXPR_QUALS, int, tree )
+fn_1( TREE_FUNC_QUALS, int, tree )
+fn_1( TYPE_LANG_FLAG_0, int, tree )
+fn_1( TYPE_LANG_FLAG_1, int, tree )
+fn_1( TYPE_LANG_FLAG_2, int, tree )
+fn_1( TYPE_LANG_FLAG_3, int, tree )
+fn_1( TYPE_LANG_FLAG_4, int, tree )
+fn_1( TYPE_LANG_FLAG_5, int, tree )
+fn_1( TYPE_LANG_FLAG_6, int, tree )
+fn_1( TYPE_STRING_FLAG, int, tree )
+fn_1( TYPE_ARRAY_MAX_SIZE, tree, tree )
+fn_1( TYPE_VECTOR_SUBPARTS, int, tree )
+fn_1( TYPE_NEEDS_CONSTRUCTING, int, tree )
+fn_1( TYPE_TRANSPARENT_UNION, int, tree )
+fn_1( TYPE_NONALIASED_COMPONENT, int, tree )
+fn_1( TYPE_PACKED, int, tree )
+fn_1( TYPE_BOUNDED_VALUE, tree, tree )
+fn_1( TYPE_BOUNDED_BASE, tree, tree )
+fn_1( TYPE_BOUNDED_EXTENT, tree, tree )
+fn_1( TYPE_BOUNDED_SUBTYPE, tree, tree )
+fn_1( TYPE_UNBOUNDED_VARIANT, tree, tree )
+fn_1( TYPE_POINTER_DEPTH, int, tree )
+fn_1( TYPE_AMBIENT_BOUNDEDNESS, int, tree )
+fn_1( BINFO_TYPE, tree, tree )
+fn_1( BINFO_OFFSET, tree, tree )
+fn_1( TYPE_BINFO_OFFSET, tree, tree )
+fn_1( BINFO_OFFSET_ZEROP, int, tree )
+fn_1( BINFO_VTABLE, tree, tree )
+fn_1( TYPE_BINFO_VTABLE, tree, tree )
+fn_1( BINFO_VIRTUALS, tree, tree )
+fn_1( TYPE_BINFO_VIRTUALS, tree, tree )
+fn_1( BINFO_BASETYPES, tree, tree )
+fn_1( TYPE_BINFO_BASETYPES, tree, tree )
+fn_1( BINFO_N_BASETYPES, int, tree )
+fn_2( BINFO_BASETYPE, tree, tree, int )
+fn_2( TYPE_BINFO_BASETYPE, tree, tree, int )
+fn_1( BINFO_VPTR_FIELD, tree, tree )
+fn_1( BINFO_SIZE, tree, tree )
+fn_1( BINFO_SIZE_UNIT, tree, tree )
+fn_1( TYPE_BINFO_SIZE, tree, tree )
+fn_1( TYPE_BINFO_SIZE_UNIT, tree, tree )
+fn_1( BINFO_INHERITANCE_CHAIN, tree, tree )
+fn_1( DECL_P, int, tree )
+fn_1( DECL_NAME, tree, tree )
+fn_1( DECL_ASSEMBLER_NAME, tree, tree )
+fn_1( DECL_ASSEMBLER_NAME_SET_P, int, tree )
+fn_1( DECL_SECTION_NAME, tree, tree )
+fn_1( DECL_CONTEXT, tree, tree )
+fn_1( DECL_FIELD_CONTEXT, tree, tree )
+fn_1( DECL_ATTRIBUTES, tree, tree )
+fn_1( DECL_FIELD_OFFSET, tree, tree )
+fn_1( DECL_FIELD_BIT_OFFSET, tree, tree )
+fn_1( DECL_BIT_FIELD_TYPE, tree, tree )
+fn_1( DECL_ARGUMENTS, tree, tree )
+fn_1( DECL_RESULT_FLD, tree, tree )
+fn_1( DECL_RESULT, tree, tree )
+fn_1( DECL_ORIGINAL_TYPE, tree, tree )
+fn_1( DECL_ARG_TYPE_AS_WRITTEN, tree, tree )
+fn_1( DECL_INITIAL, tree, tree )
+fn_1( DECL_ARG_TYPE, tree, tree )
+fn_1( DECL_QUALIFIER, tree, tree )
+fn_1( DECL_SOURCE_FILE, char*, tree )
+fn_1( DECL_SOURCE_LINE, int, tree )
+fn_1( DECL_SIZE, tree, tree )
+fn_1( DECL_SIZE_UNIT, tree, tree )
+fn_1( DECL_ALIGN, int, tree )
+fn_1( DECL_ALIGN_UNIT, int, tree )
+fn_1( DECL_OFFSET_ALIGN, int, tree )
+fn_1( DECL_USER_ALIGN, int, tree )
+fn_1( DECL_MODE, int, tree )
+fn_1( DECL_RTL, rtx, tree )
+fn_1( DECL_RTL_SET_P, int, tree )
+fn_2( COPY_DECL_RTL, rtx, tree, tree )
+fn_1( DECL_RTL_IF_SET, rtx, tree )
+fn_1( DECL_LIVE_RANGE_RTL, rtx, tree )
+fn_1( DECL_INCOMING_RTL, rtx, tree )
+fn_1( DECL_SAVED_INSNS, struct function *, tree )
+fn_1( DECL_FUNCTION_CODE, enum built_in_function, tree )
+fn_1( DECL_VINDEX, tree, tree )
+fn_1( DECL_FCONTEXT, tree, tree )
+fn_1( DECL_UID, int, tree )
+fn_1( DECL_ABSTRACT_ORIGIN, tree, tree )
+fn_1( DECL_ORIGIN, tree,tree )
+fn_1( DECL_FROM_INLINE, int, tree )
+fn_1( DECL_IGNORED_P, int, tree )
+fn_1( DECL_ABSTRACT, int, tree )
+fn_1( DECL_IN_SYSTEM_HEADER, int, tree )
+fn_1( DECL_COMMON, int, tree )
+fn_1( DECL_COALESCED, int, tree )
+fn_1( DECL_LANG_SPECIFIC, struct lang_decl *, tree )
+fn_1( DECL_EXTERNAL, int, tree )
+fn_1( TYPE_DECL_SUPPRESS_DEBUG, int, tree )
+fn_1( DECL_REGISTER, int, tree )
+fn_1( DECL_ERROR_ISSUED, int, tree )
+fn_1( DECL_PACKED, int, tree )
+fn_1( DECL_NO_STATIC_CHAIN, int, tree )
+fn_1( DECL_NONLOCAL, int, tree )
+fn_1( DECL_INLINE, int, tree )
+fn_1( DECL_UNINLINABLE, int, tree )
+fn_1( DECL_BUILT_IN_NONANSI, int, tree )
+fn_1( DECL_IS_MALLOC, int, tree )
+fn_1( DECL_IS_PURE, int, tree )
+fn_1( DECL_BIT_FIELD, int, tree )
+fn_1( DECL_TOO_LATE, int, tree )
+fn_1( DECL_IN_TEXT_SECTION, int, tree )
+fn_1( DECL_BUILT_IN, int, tree )
+fn_1( DECL_BUILT_IN_CLASS, int, tree )
+fn_1( DECL_VIRTUAL_P, int, tree )
+fn_1( DECL_DEFER_OUTPUT, int, tree )
+fn_1( DECL_TRANSPARENT_UNION, int, tree )
+fn_1( DECL_STATIC_CONSTRUCTOR, int, tree )
+fn_1( DECL_STATIC_DESTRUCTOR, int, tree )
+fn_1( DECL_ARTIFICIAL, int, tree )
+fn_1( DECL_WEAK, int, tree )
+/* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+fn_1( DECL_WEAK_IMPORT, int, tree )
+fn_1( DECL_ONE_ONLY, int, tree )
+fn_1( DECL_COMDAT, int, tree )
+fn_1( DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, int, tree )
+fn_1( DECL_NO_CHECK_MEMORY_USAGE, int, tree )
+fn_1( DECL_NO_LIMIT_STACK, int, tree )
+fn_1( DECL_LANG_FLAG_0, int, tree )
+fn_1( DECL_LANG_FLAG_1, int, tree )
+fn_1( DECL_LANG_FLAG_2, int, tree )
+fn_1( DECL_LANG_FLAG_3, int, tree )
+fn_1( DECL_LANG_FLAG_4, int, tree )
+fn_1( DECL_LANG_FLAG_5, int, tree )
+fn_1( DECL_LANG_FLAG_6, int, tree )
+fn_1( DECL_LANG_FLAG_7, int, tree )
+fn_1( DECL_NON_ADDR_CONST_P, int, tree )
+fn_1( DECL_NONADDRESSABLE_P, int, tree )
+fn_1( DECL_POINTER_ALIAS_SET, int, tree )
+fn_1( DECL_POINTER_ALIAS_SET_KNOWN_P, int, tree )
+fn_1( DECL_POINTER_DEPTH, int, tree )
+fn_1( MAIN_NAME_P, int, tree )
+
+/* Macros from rtl.h */
+
+fn_1( GET_RTX_LENGTH, int, rtx )
+fn_1( GET_RTX_NAME, char*, rtx )
+fn_1( GET_RTX_FORMAT, char*, rtx )
+fn_1( GET_RTX_CLASS, char, rtx )
+fn_1( GET_CODE, int, rtx )
+fn_1( GET_MODE, int, rtx )
+fn_1( RTX_INTEGRATED_P, int, rtx )
+fn_1( RTX_UNCHANGING_P, int, rtx )
+fn_1( RTX_FRAME_RELATED_P, int, rtx )
+fn_1( GET_NUM_ELEM, int, rtvec )
+fn_1( REG_P, int, rtx )
+fn_1( LABEL_P, int, rtx )
+fn_1( JUMP_P, int, rtx )
+fn_1( NOTE_P, int, rtx )
+fn_1( BARRIER_P, int, rtx )
+fn_1( JUMP_TABLE_DATA_P, int, rtx )
+fn_1( CONSTANT_P, int, rtx )
+fn_2( RTVEC_ELT, rtx, rtvec, int )
+fn_2( XWINT, HOST_WIDE_INT, rtx, int )
+fn_2( XINT, int, rtx, int )
+fn_2( XSTR, char*, rtx, int )
+fn_2( XEXP, rtx, rtx, int )
+fn_2( XVEC, rtvec, rtx, int )
+fn_2( XMODE, enum machine_mode, rtx, int )
+fn_2( XBITMAP, struct bitmap_head_def *, rtx, int )
+fn_2( XTREE, tree, rtx, int )
+fn_2( XBBDEF, struct basic_block_def *, rtx, int )
+fn_3( XVECEXP, rtx, rtx, int, int )
+fn_2( XVECLEN, int, rtx, int )
+fn_2( X0WINT, HOST_WIDE_INT, rtx, int )
+fn_2( X0INT, int, rtx, int )
+fn_2( X0UINT, unsigned int, rtx, int )
+fn_2( X0STR, char *, rtx, int )
+fn_2( X0EXP, rtx, rtx, int )
+fn_2( X0VEC, rtvec, rtx, int )
+fn_2( X0MODE, enum machine_mode, rtx, int )
+fn_2( X0BITMAP, struct bitmap_head_def *, rtx, int )
+fn_2( X0TREE, tree, rtx, int )
+fn_2( X0BBDEF, struct basic_block_def *, rtx, int )
+fn_2( X0ADVFLAGS, addr_diff_vec_flags, rtx, int )
+fn_2( X0CSELIB, struct cselib_val_struct *, rtx, int )
+fn_2( X0MEMATTR, mem_attrs *, rtx, int)
+fn_3( XCWINT, HOST_WIDE_INT, rtx, int, int )
+fn_3( XCINT, int, rtx, int, int )
+fn_3( XCUINT, unsigned int, rtx, int, int )
+fn_3( XCSTR, char *, rtx, int, int )
+fn_3( XCEXP, rtx, rtx, int, int )
+fn_3( XCVEC, rtvec, rtx, int, int )
+fn_3( XCMODE, enum machine_mode, rtx, int, int )
+fn_3( XCBITMAP, struct bitmap_head_def *, rtx, int, int )
+fn_3( XCTREE, tree, rtx, int, int )
+fn_3( XCBBDEF, struct basic_block_def *, rtx, int, int )
+fn_3( XCADVFLAGS, addr_diff_vec_flags, rtx, int, int )
+fn_3( XCCSELIB, struct cselib_val_struct *, rtx, int, int )
+fn_4( XCVECEXP, rtx, rtx, int, int, int )
+fn_3( XCVECLEN, int, rtx, int, int )
+fn_4( XC2EXP, rtx, rtx, int, int, int )
+fn_1( INSN_P, int, rtx )
+fn_1( INSN_UID, int, rtx )
+fn_1( PREV_INSN, rtx, rtx )
+fn_1( NEXT_INSN, rtx, rtx )
+fn_1( PATTERN, rtx, rtx )
+fn_1( INSN_CODE, int, rtx )
+fn_1( LOG_LINKS, rtx, rtx )
+fn_1( INSN_DELETED_P, int, rtx )
+fn_1( CONST_CALL_P, int, rtx )
+fn_1( SIBLING_CALL_P, int, rtx )
+fn_1( INSN_ANNULLED_BRANCH_P, int, rtx )
+fn_1( INSN_DEAD_CODE_P, int, rtx )
+fn_1( INSN_FROM_TARGET_P, int, rtx )
+fn_1( ADDR_DIFF_VEC_FLAGS, addr_diff_vec_flags, rtx )
+fn_1( CSELIB_VAL_PTR, struct cselib_val_struct *, rtx )
+fn_1( REG_NOTES, rtx, rtx )
+fn_1( REG_NOTE_KIND, enum reg_note, rtx )
+fn_1( GET_REG_NOTE_NAME, char *, rtx )
+fn_1( CALL_INSN_FUNCTION_USAGE, rtx, rtx )
+fn_1( CODE_LABEL_NUMBER, int, rtx )
+fn_1( NOTE_SOURCE_FILE, char *, rtx )
+fn_1( NOTE_BLOCK, tree, rtx )
+fn_1( NOTE_EH_HANDLER, int, rtx )
+fn_1( NOTE_RANGE_INFO, rtx, rtx )
+fn_1( NOTE_LIVE_INFO, rtx, rtx )
+fn_1( NOTE_BASIC_BLOCK, struct basic_block_def *, rtx )
+fn_1( NOTE_EXPECTED_VALUE, rtx, rtx )
+fn_1( NOTE_LINE_NUMBER, int, rtx )
+fn_1( NOTE_INSN_BASIC_BLOCK_P, int, rtx )
+fn_1( GET_NOTE_INSN_NAME, char*, int )
+fn_1( LABEL_NAME, char*, rtx )
+fn_1( LABEL_NUSES, int, rtx )
+fn_1( LABEL_ALTERNATE_NAME, char *, rtx )
+fn_1( ADDRESSOF_REGNO, int, rtx )
+fn_1( ADDRESSOF_DECL, tree, rtx )
+fn_1( JUMP_LABEL, rtx, rtx )
+fn_1( LABEL_REFS, rtx, rtx )
+fn_1( LABEL_NEXTREF, rtx, rtx )
+fn_1( CONTAINING_INSN, rtx, rtx )
+fn_1( REGNO, int, rtx )
+fn_1( ORIGINAL_REGNO, unsigned int, rtx )
+fn_1( REG_FUNCTION_VALUE_P, int, rtx )
+fn_1( REG_USERVAR_P, int, rtx )
+fn_1( REG_POINTER, int, rtx )
+fn_1( HARD_REGISTER_P, int, rtx )
+fn_1( HARD_REGISTER_NUM_P, int, int )
+fn_1( INTVAL, HOST_WIDE_INT, rtx )
+fn_1( CONST_DOUBLE_LOW, HOST_WIDE_INT, rtx )
+fn_1( CONST_DOUBLE_HIGH, HOST_WIDE_INT, rtx )
+fn_1( CONST_DOUBLE_CHAIN, rtx, rtx )
+fn_1( CONST_DOUBLE_MEM, rtx, rtx )
+fn_1( SUBREG_REG, rtx, rtx )
+fn_1( SUBREG_BYTE, unsigned int, rtx )
+fn_1( SUBREG_PROMOTED_VAR_P, int, rtx )
+fn_1( SUBREG_PROMOTED_UNSIGNED_P, int, rtx )
+fn_1( ASM_OPERANDS_TEMPLATE, char *, rtx )
+fn_1( ASM_OPERANDS_OUTPUT_CONSTRAINT, char *, rtx )
+fn_1( ASM_OPERANDS_OUTPUT_IDX, int, rtx )
+fn_1( ASM_OPERANDS_INPUT_VEC, rtvec, rtx )
+fn_1( ASM_OPERANDS_INPUT_CONSTRAINT_VEC, rtvec, rtx )
+fn_2( ASM_OPERANDS_INPUT, rtx, rtx, int )
+fn_1( ASM_OPERANDS_INPUT_LENGTH, int, rtx )
+fn_2( ASM_OPERANDS_INPUT_CONSTRAINT_EXP, rtx, rtx, int )
+fn_2( ASM_OPERANDS_INPUT_CONSTRAINT, char*, rtx, int )
+fn_2( ASM_OPERANDS_INPUT_MODE, int, rtx, int )
+fn_1( ASM_OPERANDS_SOURCE_FILE, char *, rtx )
+fn_1( ASM_OPERANDS_SOURCE_LINE, int, rtx )
+fn_1( MEM_VOLATILE_P, int, rtx )
+fn_1( MEM_IN_STRUCT_P, int, rtx )
+fn_1( MEM_SCALAR_P, int, rtx )
+fn_1( MEM_ATTRS, mem_attrs *, rtx)
+fn_1( MEM_ALIAS_SET, int, rtx )
+fn_1( MEM_DECL, tree, rtx)
+fn_1( MEM_OFFSET, rtx, rtx)
+fn_1( MEM_SIZE, rtx, rtx)
+fn_1( MEM_ALIGN, unsigned int, rtx)
+fn_2( MEM_COPY_ATTRIBUTES, int, rtx, rtx )
+fn_1( LABEL_OUTSIDE_LOOP_P, int, rtx )
+fn_1( LABEL_REF_NONLOCAL_P, int, rtx )
+fn_1( LABEL_PRESERVE_P, int, rtx )
+fn_1( REG_LOOP_TEST_P, int, rtx )
+fn_1( SCHED_GROUP_P, int, rtx )
+fn_1( LINK_COST_ZERO, int, rtx )
+fn_1( LINK_COST_FREE, int, rtx )
+fn_1( SET_DEST, rtx, rtx )
+fn_1( SET_SRC, rtx, rtx )
+fn_1( TRAP_CONDITION, rtx, rtx )
+fn_1( TRAP_CODE, rtx, rtx )
+fn_1( COND_EXEC_TEST, rtx, rtx )
+fn_1( COND_EXEC_CODE, rtx, rtx )
+fn_1( CONSTANT_POOL_ADDRESS_P, int, rtx )
+fn_1( STRING_POOL_ADDRESS_P, int, rtx )
+fn_1( SYMBOL_REF_FLAG, int, rtx )
+fn_1( SYMBOL_REF_USED, int, rtx )
+fn_2( FIND_REG_INC_NOTE, rtx, rtx, rtx )
+fn_1( RANGE_INFO_NOTE_START, rtx, rtx )
+fn_1( RANGE_INFO_NOTE_END, rtx, rtx )
+fn_1( RANGE_INFO_REGS, rtvec, rtx )
+fn_2( RANGE_INFO_REGS_REG, rtx, rtx, int )
+fn_1( RANGE_INFO_NUM_REGS, int, rtx )
+fn_1( RANGE_INFO_NCALLS, int, rtx )
+fn_1( RANGE_INFO_NINSNS, int, rtx )
+fn_1( RANGE_INFO_UNIQUE, int, rtx )
+fn_1( RANGE_INFO_BB_START, int, rtx )
+fn_1( RANGE_INFO_BB_END, int, rtx )
+fn_1( RANGE_INFO_LOOP_DEPTH, int, rtx )
+fn_1( RANGE_INFO_LIVE_START, struct bitmap_head_def *, rtx )
+fn_1( RANGE_INFO_LIVE_END, struct bitmap_head_def *, rtx )
+fn_1( RANGE_INFO_MARKER_START, int, rtx )
+fn_1( RANGE_INFO_MARKER_END, int, rtx )
+fn_2( RANGE_REG_PSEUDO, int, rtx, int )
+fn_2( RANGE_REG_COPY, int, rtx, int )
+fn_2( RANGE_REG_REFS, int, rtx, int )
+fn_2( RANGE_REG_SETS, int, rtx, int )
+fn_2( RANGE_REG_DEATHS, int, rtx, int )
+fn_2( RANGE_REG_COPY_FLAGS, int, rtx, int )
+fn_2( RANGE_REG_LIVE_LENGTH, int, rtx, int )
+fn_2( RANGE_REG_N_CALLS, int, rtx, int )
+fn_2( RANGE_REG_SYMBOL_NODE, tree, rtx, int )
+fn_2( RANGE_REG_BLOCK_NODE, tree, rtx, int )
+fn_1( RANGE_VAR_LIST, rtx, rtx )
+fn_1( RANGE_VAR_BLOCK, tree, rtx )
+fn_1( RANGE_VAR_NUM, int, rtx )
+fn_1( RANGE_LIVE_BITMAP, struct bitmap_head_def *, rtx )
+fn_1( RANGE_LIVE_ORIG_BLOCK, int, rtx )
+fn_1( PHI_NODE_P, int, rtx )
+fn_1( CONST0_RTX, rtx, rtx )
+fn_1( CONST1_RTX, rtx, rtx )
+fn_1( CONST2_RTX, rtx, rtx )
+fn_1( GEN_INT, rtx, int )
+fn_1( COSTS_N_INSNS, int, int )
+
+/* Macros from c-common.h */
+
+fn_1( DECL_SAVED_TREE, tree, tree)
+fn_1( DECL_INLINED_FNS, tree, tree )
+fn_1( DECL_NUM_STMTS, HOST_WIDE_INT, tree)
+fn_1( C_TYPE_OBJECT_P, int, tree)
+fn_1( C_TYPE_INCOMPLETE_P, int, tree)
+fn_1( C_TYPE_FUNCTION_P, int, tree)
+fn_1( C_TYPE_QUALS, int, tree)
+fn_1( C_TYPE_OBJECT_OR_INCOMPLETE_P, int, tree)
+fn_1( C_EXP_ORIGINAL_CODE, enum tree_code, tree)
+fn_1( C_PROMOTING_INTEGER_TYPE_P, int, tree)
+fn_1( STMT_IS_FULL_EXPR_P, int, tree)
+fn_1( IF_COND, tree, tree)
+fn_1( THEN_CLAUSE, tree, tree)
+fn_1( ELSE_CLAUSE, tree, tree)
+fn_1( WHILE_COND, tree, tree)
+fn_1( WHILE_BODY, tree, tree)
+fn_1( DO_COND, tree, tree)
+fn_1( DO_BODY, tree, tree)
+/*fn_1( RETURN_EXPR, tree, tree)*/
+fn_1( EXPR_STMT_EXPR, tree, tree)
+fn_1( FOR_INIT_STMT, tree, tree)
+fn_1( FOR_COND, tree, tree)
+fn_1( FOR_EXPR, tree, tree)
+fn_1( FOR_BODY, tree, tree)
+fn_1( SWITCH_COND, tree, tree)
+fn_1( SWITCH_BODY, tree, tree)
+fn_1( CASE_LOW, tree, tree)
+fn_1( CASE_HIGH, tree, tree)
+fn_1( CASE_LABEL_DECL, tree, tree)
+fn_1( GOTO_DESTINATION, tree, tree)
+fn_1( COMPOUND_BODY, tree, tree)
+fn_1( ASM_CV_QUAL, tree, tree)
+fn_1( ASM_STRING, tree, tree)
+fn_1( ASM_OUTPUTS, tree, tree)
+fn_1( ASM_INPUTS, tree, tree)
+fn_1( ASM_CLOBBERS, tree, tree)
+fn_1( DECL_STMT_DECL, tree, tree)
+fn_1( STMT_EXPR_STMT, tree, tree)
+fn_1( LABEL_STMT_LABEL, tree, tree)
+fn_1( SCOPE_BEGIN_P, int, tree)
+fn_1( SCOPE_END_P, int, tree)
+fn_1( SCOPE_STMT_BLOCK, tree, tree)
+fn_1( SCOPE_NULLIFIED_P, int, tree)
+fn_1( SCOPE_NO_CLEANUPS_P, int, tree)
+fn_1( SCOPE_PARTIAL_P, int, tree)
+fn_1( ASM_VOLATILE_P, int, tree)
+fn_1( STMT_LINENO, int, tree)
+fn_1( STMT_LINENO_FOR_FN_P, int, tree)
+fn_1( NEW_FOR_SCOPE_P, int, tree)
+fn_1( ASM_INPUT_P, int, tree)
+fn_1( DECL_ANON_UNION_ELEMS, tree, tree)
+fn_1( DECL_C_BIT_FIELD, int, tree)
+fn_1( SET_DECL_C_BIT_FIELD, int, tree)
+fn_1( CLEAR_DECL_C_BIT_FIELD, int, tree)
+fn_1( DECL_C_HARD_REGISTER, int, tree)
+fn_1( COMPOUND_STMT_NO_SCOPE, int, tree)
+fn_1( OBJC_IS_AT_KEYWORD, int, enum rid);
+fn_1( OBJC_IS_PQ_KEYWORD, int, enum rid);
+/* APPLE LOCAL begin AltiVec */
+fn_1( ALTIVEC_IS_CONTEXT_KEYWORD, int, enum rid);
+fn_1( ALTIVEC_IS_QUALIFIER, int, enum rid);
+/* APPLE LOCAL end AltiVec */
+
+tree is__test_point PARAMS ((tree));
+
+/* The following is intended to be called only by a debugger or
+ debugging code. The function will always return 0 if the input
+ node is not a decl node for the identifier "__test_point". In that
+ case it returns the node for a constant "1".
+
+ You can use the identifer "__test_point" any place in a test proram
+ where a constant int 1 is allowed. By using the debugger or
+ debugging code to call this routine to conditionally stop or do
+ something when "__test_point" is seen makes it easier to up skip to
+ the point in question if that point is heavly used for stuff you are
+ not interested in.
+
+ The function returns 0 if the node is not an IDENTIFIER_NODE for
+ "__test_point" or not a decl node for "__test_point". If it is
+ a integer_one_node is returned.
+
+ Note, currently it is up to the caller to determine what to do with
+ the returned integer_one_node or 0. */
+
+tree __test_point (node)
+ tree node;
+{
+ if (!node)
+ return 0;
+
+ if (TREE_CODE (node) != IDENTIFIER_NODE
+ || strcmp (IDENTIFIER_POINTER (node), "__test_point") != 0)
+ {
+ if (TREE_CODE_CLASS (TREE_CODE (node)) != 'd'
+ || !DECL_NAME (node)
+ || !IDENTIFIER_POINTER (DECL_NAME (node))
+ || strcmp (IDENTIFIER_POINTER (DECL_NAME (node)), "__test_point") != 0)
+ return 0;
+ }
+
+ return integer_one_node;
+}
+
+#endif /* ENABLE_IDEBUG */
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index ca5221a5821..c8a07e23b40 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2783,6 +2783,20 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge)
edge then_succ = then_bb->succ;
int then_bb_index;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && ((BB_END (then_bb)
+ && find_reg_note (BB_END (then_bb), REG_CROSSING_JUMP, NULL_RTX))
+ || (BB_END (else_bb)
+ && find_reg_note (BB_END (else_bb), REG_CROSSING_JUMP,
+ NULL_RTX))))
+ return FALSE;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* THEN has one successor. */
if (!then_succ || then_succ->succ_next != NULL)
return FALSE;
@@ -2851,6 +2865,20 @@ find_if_case_2 (basic_block test_bb, edge then_edge, edge else_edge)
edge else_succ = else_bb->succ;
rtx note;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* If we are partitioning hot/cold basic blocks, we don't want to
+ mess up unconditional or indirect jumps that cross between hot
+ and cold sections. */
+
+ if (flag_reorder_blocks_and_partition
+ && ((BB_END (then_bb)
+ && find_reg_note (BB_END (then_bb), REG_CROSSING_JUMP, NULL_RTX))
+ || (BB_END (else_bb)
+ && find_reg_note (BB_END (else_bb), REG_CROSSING_JUMP,
+ NULL_RTX))))
+ return FALSE;
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* ELSE has one successor. */
if (!else_succ || else_succ->succ_next != NULL)
return FALSE;
@@ -3195,8 +3223,12 @@ if_convert (int x_life_data_ok)
num_true_changes = 0;
life_data_ok = (x_life_data_ok != 0);
- if (! (* targetm.cannot_modify_jumps_p) ())
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if ((! (* targetm.cannot_modify_jumps_p) ())
+ && (!flag_reorder_blocks_and_partition || !no_new_pseudos
+ || !targetm.have_named_sections))
mark_loop_exit_edges ();
+ /* APPLE LOCAL end hot/cold partitioning */
/* Free up basic_block_for_insn so that we don't have to keep it
up to date, either here or in merge_blocks. */
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index db3ac9d5531..1d4f5926d71 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -123,10 +123,10 @@ java-warn = $(WERROR)
# String length warnings
jvspec.o-warn = -Wno-error
-jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
+jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
rm -f $@
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)
+ $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)
gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS)
rm -f $@
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 495c55719d5..ae8c9f3d6ee 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -490,6 +490,7 @@ java_init_decl_processing (void)
/* Define these next since types below may used them. */
integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
+ long_integer_type_node = java_type_for_size (LONG_TYPE_SIZE, 0);
integer_zero_node = build_int_2 (0, 0);
integer_one_node = build_int_2 (1, 0);
integer_two_node = build_int_2 (2, 0);
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 178f3ecf3bd..4378522b7ff 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -869,6 +869,37 @@ java_unsafe_for_reeval (tree t)
return -1;
}
+/* APPLE LOCAL begin AltiVec */
+/* Placeholders to make linking work, remove when altivec support is correct */
+
+int
+comptypes (type1, type2)
+ tree type1, type2;
+{
+ register tree t1 = type1;
+ register tree t2 = type2;
+ if (t1 == t2 || !t1 || !t2
+ || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK)
+ return 1;
+ return 0;
+}
+
+tree
+default_conversion (exp)
+ tree exp;
+{
+ return exp;
+}
+
+tree
+lang_build_type_variant (type, constp, volatilep)
+ tree type;
+ int constp, volatilep;
+{
+ return type;
+}
+/* APPLE LOCAL end AltiVec */
+
/* Every call to a static constructor has an associated boolean
variable which is in the outermost scope of the calling method.
This variable is used to avoid multiple calls to the static
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
new file mode 100644
index 00000000000..727949cb462
--- /dev/null
+++ b/gcc/lambda-code.c
@@ -0,0 +1,1769 @@
+/* Loop transformation code generation
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Daniel Berlin <dberlin@dberlin.org>
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "target.h"
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-fold-const.h"
+#include "expr.h"
+#include "optabs.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-pass.h"
+#include "tree-scalar-evolution.h"
+#include "varray.h"
+#include "lambda.h"
+
+/* This loop nest code generation is based on non-singular matrix
+ math. */
+
+/* Lattice stuff that is internal to the code generation algorithm. */
+
+typedef struct
+{
+ lambda_matrix base;
+ int dimension;
+ lambda_vector origin;
+ lambda_matrix origin_invariants;
+ int invariants;
+} * lambda_lattice;
+
+#define LATTICE_BASE(T) ((T)->base)
+#define LATTICE_DIMENSION(T) ((T)->dimension)
+#define LATTICE_ORIGIN(T) ((T)->origin)
+#define LATTICE_ORIGIN_INVARIANTS(T) ((T)->origin_invariants)
+#define LATTICE_INVARIANTS(T) ((T)->invariants)
+
+static bool lle_equal (lambda_linear_expression, lambda_linear_expression,
+ int, int);
+static lambda_lattice lambda_lattice_new (int, int);
+static lambda_lattice lambda_lattice_compute_base (lambda_loopnest);
+
+static tree find_induction_var_from_exit_cond (struct loop *);
+
+
+/* Create a new lambda body vector. */
+
+lambda_body_vector
+lambda_body_vector_new (int size)
+{
+ lambda_body_vector ret;
+
+ ret = ggc_alloc (sizeof (*ret));
+ LBV_COEFFICIENTS (ret) = lambda_vector_new (size);
+ LBV_SIZE (ret) = size;
+ LBV_DENOMINATOR (ret) = 1;
+ return ret;
+}
+
+/* Compute the new coefficients for the vector based on the
+ *inverse* of the transformation matrix. */
+
+lambda_body_vector
+lambda_body_vector_compute_new (lambda_trans_matrix transform,
+ lambda_body_vector vect)
+{
+ lambda_body_vector temp;
+ int depth;
+
+ /* Make sure the matrix is square. */
+ if (LTM_ROWSIZE (transform) != LTM_COLSIZE (transform))
+ abort ();
+
+ depth = LTM_ROWSIZE (transform);
+
+ temp = lambda_body_vector_new (depth);
+ LBV_DENOMINATOR (temp) = LBV_DENOMINATOR (vect) * LTM_DENOMINATOR (transform);
+ lambda_vector_matrix_mult (LBV_COEFFICIENTS (vect), depth,
+ LTM_MATRIX (transform),
+ depth, LBV_COEFFICIENTS (temp));
+ LBV_SIZE (temp) = LBV_SIZE (vect);
+ return temp;
+}
+
+/* Print out a lambda body vector. */
+
+void
+print_lambda_body_vector (FILE *outfile, lambda_body_vector body)
+{
+ print_lambda_vector (outfile, LBV_COEFFICIENTS (body), LBV_SIZE (body));
+}
+
+/* Return TRUE if two linear expressions are equal. */
+
+static bool
+lle_equal (lambda_linear_expression lle1, lambda_linear_expression lle2,
+ int depth, int invariants)
+{
+ int i;
+
+ if (lle1 == NULL || lle2 == NULL)
+ return false;
+ if (LLE_CONSTANT (lle1) != LLE_CONSTANT (lle2))
+ return false;
+ if (LLE_DENOMINATOR (lle1) != LLE_DENOMINATOR (lle2))
+ return false;
+ for (i = 0; i < depth; i++)
+ if (LLE_COEFFICIENTS (lle1)[i] != LLE_COEFFICIENTS (lle2)[i])
+ return false;
+ for (i = 0; i < invariants; i++)
+ if (LLE_INVARIANT_COEFFICIENTS (lle1)[i] != LLE_INVARIANT_COEFFICIENTS (lle2)[i])
+ return false;
+ return true;
+}
+/* Create a new linear expression with dimension DIM, and total number
+ of invariants INVARIANTS. */
+
+lambda_linear_expression
+lambda_linear_expression_new (int dim, int invariants)
+{
+ lambda_linear_expression ret;
+
+ ret = ggc_alloc_cleared (sizeof (*ret));
+
+ LLE_COEFFICIENTS (ret) = lambda_vector_new (dim);
+ LLE_CONSTANT (ret) = 0;
+ LLE_INVARIANT_COEFFICIENTS (ret) = lambda_vector_new (invariants);
+ LLE_DENOMINATOR (ret) = 1;
+ LLE_NEXT (ret) = NULL;
+
+ return ret;
+}
+
+static void
+print_linear_expression (FILE *outfile, lambda_vector expr, int size,
+ char start)
+{
+ int i;
+ bool starting = true;
+ for (i = 0; i < size; i++)
+ {
+ if (expr[i] != 0)
+ {
+ if (starting)
+ {
+ if (expr[i] < 0)
+ fprintf (outfile, "-");
+ starting = false;
+ }
+ else if (expr[i] > 0)
+ fprintf (outfile, " + ");
+ else
+ fprintf (outfile, " - ");
+ if (expr[i] == 1 || expr [i] == -1)
+ fprintf (outfile, "%c", start + i);
+ else
+ fprintf (outfile, "%d%c", abs(expr[i]), start + i);
+ }
+ }
+}
+void
+print_lambda_linear_expression (FILE *outfile,
+ lambda_linear_expression expr,
+ int depth, int invariants, char start)
+{
+ fprintf (outfile, "\tLinear expression: ");
+ print_linear_expression (outfile, LLE_COEFFICIENTS (expr),
+ depth, start);
+ fprintf (outfile, " constant: %d ", LLE_CONSTANT (expr));
+ fprintf (outfile, " invariants: ");
+ print_linear_expression (outfile, LLE_INVARIANT_COEFFICIENTS (expr),
+ invariants, 'A');
+ fprintf (outfile, " denominator: %d\n", LLE_DENOMINATOR (expr));
+}
+
+/* Print a loop. */
+
+void
+print_lambda_loop (FILE *outfile, lambda_loop loop, int depth,
+ int invariants, char start)
+{
+ int step;
+ lambda_linear_expression expr;
+
+ if (!loop)
+ abort ();
+
+ expr = LL_LINEAR_OFFSET (loop);
+ step = LL_STEP (loop);
+ fprintf (outfile, " step size = %d \n", step);
+
+ if (expr)
+ {
+ fprintf (outfile, " linear offset: \n");
+ print_lambda_linear_expression (outfile, expr, depth, invariants,
+ start);
+ }
+
+ fprintf (outfile, " lower bound: \n");
+ expr = LL_LOWER_BOUND (loop);
+ for (; expr != NULL; expr = LLE_NEXT (expr))
+ print_lambda_linear_expression (outfile, expr, depth, invariants,
+ start);
+ fprintf (outfile, " upper bound: \n");
+ expr = LL_UPPER_BOUND (loop);
+ for (; expr != NULL; expr = LLE_NEXT (expr))
+ print_lambda_linear_expression (outfile, expr, depth, invariants,
+ start);
+
+
+}
+
+/* Create a new loop nest structure. */
+
+lambda_loopnest
+lambda_loopnest_new (int depth, int invariants)
+{
+ lambda_loopnest ret;
+ ret = ggc_alloc (sizeof (*ret));
+
+ LN_LOOPS (ret) = ggc_alloc_cleared (depth * sizeof (lambda_loop));
+ LN_DEPTH (ret) = depth;
+ LN_INVARIANTS (ret) = invariants;
+
+ return ret;
+}
+
+
+/* Print a lambda loopnest structure. */
+
+void
+print_lambda_loopnest (FILE *outfile, lambda_loopnest nest, char start)
+{
+ int i;
+ for (i = 0; i < LN_DEPTH (nest); i++)
+ {
+ fprintf (outfile, "Loop %c\n", start + i);
+ print_lambda_loop (outfile, LN_LOOPS (nest)[i], LN_DEPTH (nest),
+ LN_INVARIANTS (nest), 'i');
+ fprintf (outfile, "\n");
+ }
+}
+
+/* Allocate a new lattice structure. */
+
+static lambda_lattice
+lambda_lattice_new (int depth, int invariants)
+{
+ lambda_lattice ret;
+ ret = ggc_alloc (sizeof (*ret));
+ LATTICE_BASE (ret) = lambda_matrix_new (depth, depth);
+ LATTICE_ORIGIN (ret) = lambda_vector_new (depth);
+ LATTICE_ORIGIN_INVARIANTS (ret) = lambda_matrix_new (depth, invariants);
+ LATTICE_DIMENSION (ret) = depth;
+ LATTICE_INVARIANTS (ret) = invariants;
+ return ret;
+}
+
+/* Compute the lattice base for a loopnest. */
+
+static lambda_lattice
+lambda_lattice_compute_base (lambda_loopnest nest)
+{
+ lambda_lattice ret;
+ int depth, invariants;
+ lambda_matrix base;
+
+ int i, j, step;
+ lambda_loop loop;
+ lambda_linear_expression expression;
+
+ depth = LN_DEPTH (nest);
+ invariants = LN_INVARIANTS (nest);
+
+ ret = lambda_lattice_new (depth, invariants);
+ base = LATTICE_BASE (ret);
+ for (i = 0; i < depth; i++)
+ {
+ loop = LN_LOOPS(nest)[i];
+ if (!loop)
+ abort ();
+ step = LL_STEP (loop);
+ /* If we have a step of 1, then the base is one, and the
+ origin and invariant coefficients are 0. */
+ if (step == 1)
+ {
+ for (j = 0; j < depth; j++)
+ base[i][j] = 0;
+ base[i][i] = 1;
+ LATTICE_ORIGIN(ret)[i] = 0;
+ for (j = 0; j < invariants; j++)
+ LATTICE_ORIGIN_INVARIANTS(ret)[i][j] = 0;
+ }
+ else
+ {
+ /* Otherwise, we need the lower bound expression (which must
+ be an affine function) to determine the base. */
+ expression = LL_LOWER_BOUND (loop);
+ if (!expression
+ || LLE_NEXT (expression)
+ || LLE_DENOMINATOR (expression) != 1)
+ abort ();
+
+ for (j = 0; j < i; j ++)
+ base[i][j] = LLE_COEFFICIENTS (expression)[j]
+ * LL_STEP (LN_LOOPS(nest)[j]);
+ base[i][i] = step;
+ for (j = i + 1; j < depth; j++)
+ base[i][j] = 0;
+
+ /* Origin for this loop is the constant of the lower bound
+ expression. */
+ LATTICE_ORIGIN (ret)[i] = LLE_CONSTANT (expression);
+
+
+ /* Coefficient for the invariants are equal to the invariant
+ coefficients in the expression. */
+ for (j = 0; j < invariants; j++)
+ LATTICE_ORIGIN_INVARIANTS (ret)[i][j] =
+ LLE_INVARIANT_COEFFICIENTS (expression)[j];
+ }
+ }
+ return ret;
+}
+
+
+/* Compute the greatest common denominator of two numbers using
+ euclid's algorithm. */
+
+static int
+gcd (int a, int b)
+{
+
+ int x, y, z;
+
+ x = (a > 0) ? a : -1 * a;
+ y = (b > 0) ? b : -1 * b;
+
+ while (x>0)
+ {
+ z = y % x;
+ y = x;
+ x = z;
+ }
+
+ return (y);
+}
+
+/* Compute the greatest common denominator of a vector of numbers. */
+
+static int
+gcd_vector (lambda_vector vector, int size)
+{
+ int i;
+ int gcd1 = 0;
+
+
+ if (size > 0)
+ {
+ gcd1 = vector[0];
+ for (i = 1; i < size; i++)
+ gcd1 = gcd (gcd1, vector[i]);
+ }
+ return gcd1;
+}
+
+/* Compute the least common multiple of two numbers. */
+
+static int
+lcm (int a, int b)
+{
+ return (abs (a) * abs (b) / gcd (a, b) );
+}
+
+/* Compute the loop bounds for the auxillary space.
+ Input system is Ax <= b. TRANS is the unimodular transformation
+ matrix. Comments are transcribed from the equations in the paper. */
+
+static lambda_loopnest
+lambda_compute_auxillary_space (lambda_loopnest nest,
+ lambda_trans_matrix trans)
+{
+ lambda_matrix A, B, A1, B1, temp0;
+ lambda_vector a, a1, temp1;
+ lambda_matrix invertedtrans;
+ int determinant, depth, invariants, size, newsize;
+ int i, j, k;
+ lambda_loopnest auxillary_nest;
+ lambda_loop loop;
+ lambda_linear_expression expression;
+ lambda_lattice lattice;
+
+ int multiple, f1, f2;
+
+ depth = LN_DEPTH (nest);
+ invariants = LN_INVARIANTS (nest);
+ A = lambda_matrix_new (128, depth);
+ B = lambda_matrix_new (128, invariants);
+ a = lambda_vector_new (128);
+
+ A1 = lambda_matrix_new (128, depth);
+ B1 = lambda_matrix_new (128, invariants);
+ a1 = lambda_vector_new (128);
+
+ /* Store the bounds in the matrix A, vector a, and invariant matrix
+ B, so that we have Ax <= a + B. */
+ size = 0;
+ for (i = 0; i < depth; i++)
+ {
+ loop = LN_LOOPS(nest)[i];
+
+ /* First we do the lower bound. */
+ if (LL_STEP (loop) > 0)
+ expression = LL_LOWER_BOUND (loop);
+ else
+ expression = LL_UPPER_BOUND (loop);
+
+ for (; expression != NULL; expression = LLE_NEXT (expression))
+ {
+
+ /* Fill in the coefficient. */
+ for (j = 0; j < i; j++)
+ A[size][j] = LLE_COEFFICIENTS (expression)[j];
+
+ /* And the invariant coefficient. */
+ for (j = 0; j < invariants; j++)
+ B[size][j] = LLE_INVARIANT_COEFFICIENTS(expression)[j];
+
+ /* And the constant. */
+ a[size] = LLE_CONSTANT (expression);
+
+ /* Convert (2x+3y+2+b)/4 <= z to 2x+3y-4z <= -2-b. */
+ A[size][i] = -1 * LLE_DENOMINATOR (expression);
+ a[size] *= -1;
+ for (j = 0; j < invariants; j++)
+ B[size][j] *= -1;
+
+ size++;
+ }
+
+ /* Then do the exact same thing for the upper bounds. */
+ if (LL_STEP (loop) > 0)
+ expression = LL_UPPER_BOUND (loop);
+ else
+ expression = LL_LOWER_BOUND (loop);
+
+ for (; expression != NULL; expression = LLE_NEXT (expression))
+ {
+
+ /* Fill in the coefficient. */
+ for (j = 0; j < i; j++)
+ A[size][j] = LLE_COEFFICIENTS (expression)[j];
+
+ /* And the invariant coefficient. */
+ for (j = 0; j < invariants; j++)
+ B[size][j] = LLE_INVARIANT_COEFFICIENTS(expression)[j];
+
+ /* And the constant. */
+ a[size] = LLE_CONSTANT (expression);
+
+ /* Convert z <= (2x+3y+2+b)/4 to -2x-3y+4z <= 2+b. */
+ for (j = 0; j < i; j++)
+ A[size][j] *= -1;
+ A[size][i] = LLE_DENOMINATOR (expression);
+ size++;
+ }
+ }
+
+ /* Compute the lattice base x = base * y + origin, where y is the
+ base space. */
+ lattice = lambda_lattice_compute_base (nest);
+
+
+ /* Ax <= a + B becomes ALy <= a+B - A*origin. L is the lattice base */
+
+ /* A1 = AL */
+ lambda_matrix_mult (A, LATTICE_BASE (lattice), A1, size, depth, depth);
+
+ /* a1 = a - A * origin constant. */
+ lambda_matrix_vector_mult (A, size, depth, LATTICE_ORIGIN (lattice),
+ a1);
+ lambda_vector_add_mc (a, 1, a1, -1, a1, size);
+
+ /* B1 = B - A * origin invariant. */
+ lambda_matrix_mult (A, LATTICE_ORIGIN_INVARIANTS (lattice), B1, size, depth,
+ invariants);
+ lambda_matrix_add_mc (B, 1, B1, -1, B1, size, invariants);
+
+
+ /* Compute the auxillary space.
+ Equations:
+ given A1 * y <= b1 + B1
+ Compute the auxillary space for z1=HUy
+ A1 * y <= a1 + B1.
+ Let z be the target space.
+ z = Tx = T(Ly+origin) = TLy + T*origin
+ z1 = z-T*origin = TLy = HUy. */
+
+ invertedtrans = lambda_matrix_new (depth, depth);
+
+ /* Compute the inverse of U. */
+ determinant = lambda_matrix_inverse (LTM_MATRIX (trans),
+ invertedtrans, depth);
+
+ /* A = A1 inv(U). */
+ lambda_matrix_mult (A1, invertedtrans, A, size, depth, depth);
+
+ /* Perform Fourier-Motzkin on Ax <= a + B. */
+
+ temp0 = B1;
+ B1 = B;
+ B = temp0;
+
+ temp1 = a1;
+ a1 = a;
+ a = temp1;
+
+ auxillary_nest = lambda_loopnest_new (depth, invariants);
+
+ for (i = depth - 1; i >= 0; i--)
+ {
+ loop = lambda_loop_new ();
+ LN_LOOPS(auxillary_nest)[i] = loop;
+ LL_STEP (loop) = 1;
+
+ for (j = 0; j < size; j++)
+ {
+ if (A[j][i] < 0)
+ {
+ /* Lower bound. */
+ expression = lambda_linear_expression_new (depth, invariants);
+
+ for (k = 0; k < i; k++)
+ LLE_COEFFICIENTS(expression)[k] = A[j][k];
+ for (k = 0; k < invariants; k++)
+ LLE_INVARIANT_COEFFICIENTS(expression)[k] = -1 * B[j][k];
+ LLE_DENOMINATOR (expression) = -1 * A[j][i];
+ LLE_CONSTANT (expression) = -1 * a[j];
+ /* Ignore if identical to the existing lower bound. */
+ if (!lle_equal (LL_LOWER_BOUND (loop),
+ expression, depth, invariants))
+ {
+ LLE_NEXT (expression) = LL_LOWER_BOUND (loop);
+ LL_LOWER_BOUND (loop) = expression;
+ }
+
+
+ }
+ else if (A[j][i] > 0)
+ {
+ /* Upper bound. */
+ expression = lambda_linear_expression_new (depth, invariants);
+ for (k = 0; k < i; k++)
+ LLE_COEFFICIENTS (expression)[k] = -1 * A[j][k];
+ LLE_CONSTANT (expression) = a[j];
+
+ for (k = 0; k < invariants; k++)
+ LLE_INVARIANT_COEFFICIENTS (expression)[k] = B[j][k];
+
+ LLE_DENOMINATOR (expression) = A[j][i];
+ /* Ignore if identical to the existing upper bound. */
+ if (!lle_equal (LL_UPPER_BOUND (loop),
+ expression, depth, invariants))
+ {
+ LLE_NEXT (expression) = LL_UPPER_BOUND (loop);
+ LL_UPPER_BOUND (loop) = expression;
+ }
+
+ }
+ }
+ /* creates a new system by deleting the i'th variable. */
+ newsize = 0;
+ for (j = 0; j < size; j++)
+ {
+ if (A[j][i] == 0)
+ {
+ lambda_vector_copy (A[j], A1[newsize], depth);
+ lambda_vector_copy (B[j], B1[newsize], invariants);
+ a1[newsize] = a[j];
+ newsize++;
+ }
+ else if (A[j][i] > 0)
+ {
+ for (k = 0; k < size; k++)
+ {
+ if (A[k][i] < 0)
+ {
+ multiple = lcm (A[j][i], A[k][i]);
+ f1 = multiple / A[j][i];
+ f2 = -1 * multiple / A[k][i];
+
+ lambda_vector_add_mc (A[j], f1, A[k], f2,
+ A1[newsize], depth);
+ lambda_vector_add_mc (B[j], f1, B[k], f2,
+ B1[newsize], invariants);
+ a1[newsize] = f1 * a[j] + f2 * a[k];
+ newsize++;
+ }
+ }
+ }
+ }
+
+ temp0 = A;
+ A = A1;
+ A1 = temp0;
+
+ temp0 = B;
+ B = B1;
+ B1 = temp0;
+
+ temp1 = a;
+ a = a1;
+ a1 = temp1;
+
+ size = newsize;
+ }
+
+ return auxillary_nest;
+}
+
+
+/* Compute the loop bounds for the target space, using the bounds of
+ the auxillary nest.
+ Output a new set of linear bounds and linear offsets. */
+
+static lambda_loopnest
+lambda_compute_target_space (lambda_loopnest auxillary_nest,
+ lambda_trans_matrix H,
+ lambda_vector stepsigns)
+{
+ lambda_matrix inverse, H1;
+ int determinant, i, j;
+ int gcd1, gcd2;
+ int factor;
+
+
+ lambda_loopnest target_nest;
+ int depth, invariants;
+ lambda_matrix target;
+
+ lambda_loop auxillary_loop, target_loop;
+ lambda_linear_expression expression, auxillary_expr, target_expr, tmp_expr;
+
+ depth = LN_DEPTH (auxillary_nest);
+ invariants = LN_INVARIANTS (auxillary_nest);
+
+ inverse = lambda_matrix_new (depth, depth);
+ determinant = lambda_matrix_inverse (LTM_MATRIX (H), inverse, depth);
+
+ /* H1 is H excluding its diagonal. */
+ H1 = lambda_matrix_new (depth, depth);
+ lambda_matrix_copy (LTM_MATRIX (H), H1, depth, depth);
+
+ for (i = 0; i < depth; i++)
+ H1[i][i] = 0;
+
+ /* Computes the linear offsets of the loop bounds. */
+ target = lambda_matrix_new (depth, depth);
+ lambda_matrix_mult (H1, inverse, target, depth, depth, depth);
+
+ target_nest = lambda_loopnest_new (depth, invariants);
+
+ for (i = 0; i < depth; i++)
+ {
+
+ /* Get a new loop structure. */
+ target_loop = lambda_loop_new ();
+ LN_LOOPS(target_nest)[i] = target_loop;
+
+ /* Computes the gcd of the coefficients of the linear part. */
+ gcd1 = gcd_vector (target[i], i);
+
+ /* Include the denominator in the GCD */
+ gcd1 = gcd (gcd1, determinant);
+
+ /* Now divide through by the gcd */
+ for (j = 0; j < i; j++)
+ target[i][j] = target[i][j] / gcd1;
+
+ expression = lambda_linear_expression_new (depth, invariants);
+ lambda_vector_copy (target[i], LLE_COEFFICIENTS(expression), depth);
+ LLE_DENOMINATOR (expression) = determinant / gcd1;
+ LLE_CONSTANT (expression) = 0;
+ lambda_vector_clear (LLE_INVARIANT_COEFFICIENTS (expression), invariants);
+ LL_LINEAR_OFFSET (target_loop) = expression;
+ }
+
+ /* For each loop, compute the new bounds. */
+ for (i = 0; i < depth; i++)
+ {
+ auxillary_loop = LN_LOOPS(auxillary_nest)[i];
+ target_loop = LN_LOOPS(target_nest)[i];
+ LL_STEP (target_loop) = LTM_MATRIX(H)[i][i];
+ factor = LTM_MATRIX(H)[i][i];
+
+ /* First we do the lower bound. */
+ auxillary_expr = LL_LOWER_BOUND (auxillary_loop);
+
+ for (; auxillary_expr != NULL; auxillary_expr = LLE_NEXT (auxillary_expr))
+ {
+ target_expr = lambda_linear_expression_new (depth, invariants);
+ lambda_vector_matrix_mult (LLE_COEFFICIENTS (auxillary_expr),
+ depth, inverse, depth,
+ LLE_COEFFICIENTS (target_expr));
+ lambda_vector_mult_const (LLE_COEFFICIENTS (target_expr),
+ LLE_COEFFICIENTS (target_expr), depth,
+ factor);
+
+ LLE_CONSTANT (target_expr) = LLE_CONSTANT (auxillary_expr) * factor;
+ lambda_vector_copy (LLE_INVARIANT_COEFFICIENTS (auxillary_expr),
+ LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants);
+ lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS (target_expr),
+ LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants, factor);
+ LLE_DENOMINATOR (target_expr) = LLE_DENOMINATOR (auxillary_expr);
+
+ if (!lambda_vector_zerop (LLE_COEFFICIENTS (target_expr), depth))
+ {
+ LLE_CONSTANT (target_expr) = LLE_CONSTANT (target_expr)
+ * determinant;
+ lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS (target_expr),
+ LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants,
+ determinant);
+ LLE_DENOMINATOR (target_expr) = LLE_DENOMINATOR (target_expr)
+ * determinant;
+ }
+ /* Find the gcd and divide by it here, rather than doing it
+ at the tree level. */
+ gcd1 = gcd_vector (LLE_COEFFICIENTS (target_expr), depth);
+ gcd2 = gcd_vector (LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants);
+ gcd1 = gcd (gcd1, gcd2);
+ gcd1 = gcd (gcd1, LLE_CONSTANT (target_expr));
+ gcd1 = gcd (gcd1, LLE_DENOMINATOR (target_expr));
+ for (j = 0; j < depth; j++)
+ LLE_COEFFICIENTS (target_expr)[j] /= gcd1;
+ for (j = 0; j < invariants; j++)
+ LLE_INVARIANT_COEFFICIENTS (target_expr)[j] /= gcd1;
+ LLE_CONSTANT (target_expr) /= gcd1;
+ LLE_DENOMINATOR (target_expr) /= gcd1;
+ /* Ignore if identical to existing bound. */
+ if (!lle_equal (LL_LOWER_BOUND (target_loop), target_expr, depth,
+ invariants))
+ {
+ LLE_NEXT (target_expr) = LL_LOWER_BOUND (target_loop);
+ LL_LOWER_BOUND (target_loop) = target_expr;
+ }
+ }
+ /* Now do the upper bound. */
+ auxillary_expr = LL_UPPER_BOUND (auxillary_loop);
+
+ for (; auxillary_expr != NULL; auxillary_expr = LLE_NEXT (auxillary_expr))
+ {
+ target_expr = lambda_linear_expression_new (depth, invariants);
+ lambda_vector_matrix_mult (LLE_COEFFICIENTS (auxillary_expr),
+ depth, inverse, depth,
+ LLE_COEFFICIENTS (target_expr));
+ lambda_vector_mult_const (LLE_COEFFICIENTS (target_expr),
+ LLE_COEFFICIENTS (target_expr), depth,
+ factor);
+ LLE_CONSTANT (target_expr) = LLE_CONSTANT (auxillary_expr) * factor;
+ lambda_vector_copy (LLE_INVARIANT_COEFFICIENTS (auxillary_expr),
+ LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants);
+ lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS (target_expr),
+ LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants, factor);
+ LLE_DENOMINATOR (target_expr) = LLE_DENOMINATOR (auxillary_expr);
+
+ if (!lambda_vector_zerop (LLE_COEFFICIENTS (target_expr), depth))
+ {
+ LLE_CONSTANT (target_expr) = LLE_CONSTANT (target_expr)
+ * determinant;
+ lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS (target_expr),
+ LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants,
+ determinant);
+ LLE_DENOMINATOR (target_expr) = LLE_DENOMINATOR (target_expr)
+ * determinant;
+ }
+ /* Find the gcd and divide by it here, instead of at the
+ tree level. */
+ gcd1 = gcd_vector (LLE_COEFFICIENTS (target_expr), depth);
+ gcd2 = gcd_vector (LLE_INVARIANT_COEFFICIENTS (target_expr),
+ invariants);
+ gcd1 = gcd (gcd1, gcd2);
+ gcd1 = gcd (gcd1, LLE_CONSTANT (target_expr));
+ gcd1 = gcd (gcd1, LLE_DENOMINATOR (target_expr));
+ for (j = 0; j < depth; j++)
+ LLE_COEFFICIENTS (target_expr)[j] /= gcd1;
+ for (j = 0; j < invariants; j++)
+ LLE_INVARIANT_COEFFICIENTS (target_expr)[j] /= gcd1;
+ LLE_CONSTANT (target_expr) /= gcd1;
+ LLE_DENOMINATOR (target_expr) /= gcd1;
+ /* Ignore if equal to existing bound. */
+ if (!lle_equal (LL_UPPER_BOUND (target_loop), target_expr, depth,
+ invariants))
+ {
+ LLE_NEXT (target_expr) = LL_UPPER_BOUND (target_loop);
+ LL_UPPER_BOUND (target_loop) = target_expr;
+ }
+ }
+ }
+ for (i = 0; i < depth; i++)
+ {
+ target_loop = LN_LOOPS (target_nest)[i];
+ /* If necessary, exchange the upper and lower bounds and negate
+ the step size. */
+ if (stepsigns[i] < 0)
+ {
+ LL_STEP (target_loop) *= -1;
+ tmp_expr = LL_LOWER_BOUND (target_loop);
+ LL_LOWER_BOUND (target_loop) = LL_UPPER_BOUND (target_loop);
+ LL_UPPER_BOUND (target_loop) = tmp_expr;
+ }
+ }
+ return target_nest;
+}
+
+/* Compute the step signs. */
+
+static lambda_vector
+lambda_compute_step_signs (lambda_trans_matrix trans,
+ lambda_vector stepsigns)
+{
+ lambda_matrix matrix, H;
+ int size;
+ lambda_vector newsteps;
+ int i, j, factor, minimum_column;
+ int temp;
+
+ matrix = LTM_MATRIX (trans);
+ size = LTM_ROWSIZE (trans);
+ H = lambda_matrix_new (size, size);
+
+ newsteps = lambda_vector_new (size);
+ lambda_vector_copy (stepsigns, newsteps, size);
+
+ lambda_matrix_copy (matrix, H, size, size);
+
+ for (j = 0; j < size; j++)
+ {
+ lambda_vector row;
+ row = H[j];
+ for (i = j; i < size; i++)
+ if (row[i] < 0)
+ lambda_matrix_col_negate (H, size, i);
+ while (lambda_vector_first_nz (row, size, j + 1) < size)
+ {
+ minimum_column = lambda_vector_min_nz (row, size, j);
+ lambda_matrix_col_exchange (H, size, j, minimum_column);
+
+ temp = newsteps[j];
+ newsteps[j] = newsteps[minimum_column];
+ newsteps[minimum_column] = temp;
+
+ for (i = j + 1; i < size; i++)
+ {
+ factor = row[i] / row[j];
+ lambda_matrix_col_add (H, size, j, i, -1 * factor);
+ }
+ }
+ }
+ return newsteps;
+}
+
+/* Transform NEST according to TRANS, and return the new loop nest. */
+
+lambda_loopnest
+lambda_loopnest_transform (lambda_loopnest nest, lambda_trans_matrix trans)
+{
+ lambda_loopnest auxillary_nest, target_nest;
+
+ int depth, invariants;
+ int i, j;
+ lambda_lattice lattice;
+ lambda_trans_matrix trans1, H, U;
+ lambda_loop loop;
+ lambda_linear_expression expression;
+ lambda_vector origin;
+ lambda_matrix origin_invariants;
+ lambda_vector stepsigns;
+ int f;
+
+ depth = LN_DEPTH (nest);
+ invariants = LN_INVARIANTS (nest);
+
+ /* Keep track of the signs of the loop steps. */
+ stepsigns = lambda_vector_new (depth);
+ for (i = 0; i < depth; i++)
+ {
+ if (LL_STEP (LN_LOOPS(nest)[i]) > 0)
+ stepsigns[i] = 1;
+ else
+ stepsigns[i] = -1;
+ }
+
+ /* Compute the lattice base. */
+ lattice = lambda_lattice_compute_base (nest);
+ trans1 = lambda_trans_matrix_new (depth, depth);
+
+ /* Multiply the transformation matrix by the lattice base. */
+
+ lambda_matrix_mult (LTM_MATRIX (trans), LATTICE_BASE (lattice),
+ LTM_MATRIX (trans1),
+ depth, depth, depth);
+
+ /* Compute the hermite normal form for the new transformation matrix. */
+ H = lambda_trans_matrix_new (depth, depth);
+ U = lambda_trans_matrix_new (depth, depth);
+ lambda_matrix_hermite (LTM_MATRIX (trans1), depth, LTM_MATRIX (H), LTM_MATRIX (U));
+
+ /* Compute the auxillary loop nest's space from the unimodular
+ portion. */
+ auxillary_nest = lambda_compute_auxillary_space (nest, U);
+
+
+ /* Compute the loop step signs from the old step signs and the
+ transformation matrix. */
+ stepsigns = lambda_compute_step_signs (trans1, stepsigns);
+
+ /* Compute the target loop nest space from the auxillary nest and
+ the lower triangular matrix H. */
+ target_nest = lambda_compute_target_space (auxillary_nest, H, stepsigns);
+ origin = lambda_vector_new (depth);
+ origin_invariants = lambda_matrix_new (depth, invariants);
+ lambda_matrix_vector_mult (LTM_MATRIX (trans), depth, depth,
+ LATTICE_ORIGIN (lattice), origin);
+ lambda_matrix_mult (LTM_MATRIX (trans), LATTICE_ORIGIN_INVARIANTS (lattice),
+ origin_invariants, depth, depth, invariants);
+ for (i = 0; i < depth; i++)
+ {
+ loop = LN_LOOPS (target_nest)[i];
+ expression = LL_LINEAR_OFFSET (loop);
+ if (lambda_vector_zerop (LLE_COEFFICIENTS (expression), depth))
+ f = 1;
+ else
+ f = LLE_DENOMINATOR (expression);
+ LLE_CONSTANT (expression) += f * origin[i];
+
+ for (j = 0; j < invariants; j++)
+ LLE_INVARIANT_COEFFICIENTS(expression)[j] += f * origin_invariants[i][j];
+ }
+
+
+ return target_nest;
+
+}
+
+
+/* Convert a gcc tree expression to a linear expression.
+ This is a trivial implementation. */
+
+static lambda_linear_expression
+gcc_tree_to_linear_expression (int depth, tree expr,
+ varray_type outerinductionvars,
+ varray_type invariants,
+ int extra)
+{
+ lambda_linear_expression lle = NULL;
+ switch (TREE_CODE (expr))
+ {
+ case INTEGER_CST:
+ {
+ lle = lambda_linear_expression_new (depth, 2 * depth);
+ LLE_CONSTANT (lle) = TREE_INT_CST_LOW (expr);
+ if (extra != 0)
+ LLE_CONSTANT (lle) = extra;
+
+ LLE_DENOMINATOR (lle) = 1;
+ }
+ break;
+ case SSA_NAME:
+ {
+ size_t i;
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (outerinductionvars); i++)
+ if (VARRAY_TREE (outerinductionvars, i) != NULL)
+ {
+ tree iv = VARRAY_TREE (outerinductionvars, i);
+ if (SSA_NAME_VAR (iv) == SSA_NAME_VAR (expr))
+ {
+ lle = lambda_linear_expression_new (depth, 2 * depth);
+ LLE_COEFFICIENTS (lle)[i] = 1;
+ if (extra != 0)
+ LLE_CONSTANT (lle) = extra;
+
+ LLE_DENOMINATOR (lle) = 1;
+ }
+ }
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
+ if (VARRAY_TREE (invariants, i) != NULL)
+ {
+ tree invar = VARRAY_TREE (invariants, i);
+ if (SSA_NAME_VAR (invar) == SSA_NAME_VAR (expr))
+ {
+ lle = lambda_linear_expression_new (depth, 2 * depth);
+ LLE_INVARIANT_COEFFICIENTS (lle)[i] = 1;
+ if (extra != 0)
+ LLE_CONSTANT (lle) = extra;
+ LLE_DENOMINATOR (lle) = 1;
+ }
+ }
+ }
+ break;
+ default:
+ return NULL;
+ }
+
+ return lle;
+}
+
+/* Return true if OP is invariant in LOOP. */
+static bool
+invariant_in_loop (struct loop *loop, tree op)
+{
+ if (TREE_CODE (op) == SSA_NAME)
+ {
+ if (TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL
+ && IS_EMPTY_STMT (SSA_NAME_DEF_STMT (op)))
+ return true;
+ if (IS_EMPTY_STMT (SSA_NAME_DEF_STMT (op)))
+ return false;
+ return !flow_bb_inside_loop_p (loop,
+ bb_for_stmt (SSA_NAME_DEF_STMT (op)));
+ }
+ return false;
+}
+
+
+
+/* Generate a lambda loop from a gcc loop. */
+
+static lambda_loop
+gcc_loop_to_lambda_loop (struct loop *loop, int depth,
+ varray_type *invariants,
+ tree *ourinductionvar,
+ varray_type outerinductionvars)
+{
+ tree phi;
+ tree exit_cond;
+ tree access_fn, inductionvar;
+ tree step;
+ lambda_loop lloop = NULL;
+ lambda_linear_expression lbound, ubound;
+ tree test;
+ int stepint;
+ int extra = 0;
+#if 0
+ tree ev;
+ tree nb_iter;
+ tree base;
+ tree final;
+#endif
+
+ use_optype uses;
+
+
+ /* Find out induction var and set the pointer so that the caller can
+ append it to the outerinductionvars array later. */
+
+ inductionvar = find_induction_var_from_exit_cond (loop);
+ *ourinductionvar = inductionvar;
+
+ exit_cond = get_loop_exit_condition (loop);
+
+ if (inductionvar == NULL || exit_cond == NULL)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Cannot determine exit condition or induction variable for loop.\n");
+ return NULL;
+ }
+
+
+
+ test = TREE_OPERAND (exit_cond, 0);
+ if (TREE_CODE (test) != LE_EXPR
+ && TREE_CODE (test) != LT_EXPR
+ && TREE_CODE (test) != NE_EXPR)
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Unable to convert loop: Loop exit test uses unhandled test condition:");
+ print_generic_stmt (dump_file, test, 0);
+ fprintf (dump_file, "\n");
+ }
+ return NULL;
+ }
+#if 0
+ ev = analyze_scalar_evolution (loop, inductionvar);
+
+ if (!evolution_function_is_affine_or_constant_p (ev))
+ return NULL;
+
+ nb_iter = number_of_iterations_in_loop (loop);
+ nb_iter = chrec_fold_minus (chrec_type (nb_iter), nb_iter,
+ convert (chrec_type (nb_iter), integer_one_node));
+ base = CHREC_LEFT (ev);
+ step = CHREC_RIGHT (ev);
+ final = chrec_apply (loop->num, ev, nb_iter);
+#endif
+
+ /* XXX - MUST BE BETTER WAY TO GET PHI NODE FOR INDUCTION
+ VARIABLES. */
+ if (SSA_NAME_DEF_STMT (inductionvar) == NULL_TREE)
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Cannot find PHI node for induction variable\n");
+
+ return NULL;
+ }
+
+
+ phi = SSA_NAME_DEF_STMT (inductionvar);
+ if (TREE_CODE (phi) != PHI_NODE)
+ {
+ get_stmt_operands (phi);
+ uses = STMT_USE_OPS (phi);
+
+ if (!uses)
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Cannot find PHI node for induction variable\n");
+
+ return NULL;
+ }
+
+ phi = USE_OP (uses, 0);
+ phi = SSA_NAME_DEF_STMT (phi);
+ if (TREE_CODE (phi) != PHI_NODE)
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Cannot find PHI node for induction variable\n");
+ return NULL;
+ }
+
+ }
+
+ access_fn = instantiate_parameters
+ (loop,
+ analyze_scalar_evolution (loop, PHI_RESULT (phi)));
+ if (!access_fn)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Access function for induction variable phi is NULL\n");
+
+ return NULL;
+ }
+
+ step = evolution_part_in_loop_num (access_fn, loop_num (loop));
+ if (!step)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Cannot determine step of loop.\n");
+
+ return NULL;
+ }
+ if (TREE_CODE (step) != INTEGER_CST)
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Step of loop is not integer.\n");
+ return NULL;
+ }
+
+ stepint = TREE_INT_CST_LOW (step);
+
+ /* Only want phis for induction vars, which will have two
+ arguments. */
+ if (PHI_NUM_ARGS (phi) != 2)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: PHI node for induction variable has >2 arguments\n");
+ return NULL;
+ }
+
+ /* Another induction variable check. One argument's source should be
+ in the loop, one outside the loop. */
+ if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 0)->src)
+ && flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 1)->src))
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: PHI edges both inside loop, or both outside loop.\n");
+
+ return NULL;
+ }
+
+
+
+ if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 0)->src))
+
+ lbound = gcc_tree_to_linear_expression (depth, PHI_ARG_DEF (phi, 1),
+ outerinductionvars, *invariants,
+ 0);
+ else
+ lbound = gcc_tree_to_linear_expression (depth, PHI_ARG_DEF (phi, 0),
+ outerinductionvars, *invariants,
+ 0);
+ if (!lbound)
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Cannot convert lower bound to linear expression\n");
+
+ return NULL;
+ }
+ if (TREE_CODE (TREE_OPERAND (test, 1)) == SSA_NAME)
+ if (invariant_in_loop (loop, TREE_OPERAND (test, 1)))
+ VARRAY_PUSH_TREE (*invariants, TREE_OPERAND (test, 1));
+
+ /* We only size the vectors assuming we have, at max, 2 times as many
+ invariants as we do loops (one for each bound). */
+ if (VARRAY_ACTIVE_SIZE (*invariants) > (unsigned int)(2 * depth))
+ abort ();
+
+ /* We might have some leftover. */
+ if (TREE_CODE (test) == LT_EXPR)
+ extra = -1 * stepint;
+ else if (TREE_CODE (test) == NE_EXPR)
+ extra = -1 * stepint;
+
+ ubound = gcc_tree_to_linear_expression (depth,
+ TREE_OPERAND (test, 1),
+ outerinductionvars,
+ *invariants,
+ extra);
+
+ if (!ubound)
+ {
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to convert loop: Cannot convert upper bound to linear expression\n");
+ return NULL;
+ }
+
+
+ lloop = lambda_loop_new ();
+ LL_STEP (lloop) = stepint;
+ LL_LOWER_BOUND (lloop) = lbound;
+ LL_UPPER_BOUND (lloop) = ubound;
+ return lloop;
+}
+
+/* Given an exit condition, find the induction variable it is testing
+ against. */
+
+static tree
+find_induction_var_from_exit_cond (struct loop *loop)
+{
+ tree expr = get_loop_exit_condition (loop);
+ tree test;
+ if (expr == NULL_TREE)
+ return NULL_TREE;
+ if (TREE_CODE (expr) != COND_EXPR)
+ return NULL_TREE;
+ test = TREE_OPERAND (expr, 0);
+ if (TREE_CODE_CLASS (TREE_CODE (test)) != '<')
+ return NULL_TREE;
+ if (TREE_CODE (TREE_OPERAND (test, 0)) != SSA_NAME)
+ return NULL_TREE;
+ return TREE_OPERAND (test, 0);
+}
+
+/* Generate a lambda loopnest from a gcc loopnest. */
+
+lambda_loopnest
+gcc_loopnest_to_lambda_loopnest (struct loop *loop_nest,
+ varray_type *inductionvars,
+ varray_type *invariants)
+{
+ lambda_loopnest ret;
+ struct loop *temp;
+ int depth = 0;
+ size_t i;
+ varray_type loops;
+ lambda_loop newloop;
+ tree inductionvar = NULL;
+
+
+ temp = loop_nest;
+ while (temp)
+ {
+ depth++;
+ temp = temp->inner;
+ }
+ VARRAY_GENERIC_PTR_INIT (loops, 1, "Loop nest");
+ VARRAY_GENERIC_PTR_INIT (*inductionvars, 1, "induction vars");
+ VARRAY_GENERIC_PTR_INIT (*invariants, 1, "Invariants");
+ temp = loop_nest;
+ while (temp)
+ {
+ newloop = gcc_loop_to_lambda_loop (temp, depth, invariants,
+ &inductionvar, *inductionvars);
+ if (!newloop)
+ return NULL;
+ VARRAY_PUSH_GENERIC_PTR (*inductionvars, inductionvar);
+ VARRAY_PUSH_GENERIC_PTR (loops, newloop);
+ temp = temp->inner;
+ }
+ ret = lambda_loopnest_new (depth, 2 * depth);
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loops); i++)
+ LN_LOOPS(ret)[i] = VARRAY_GENERIC_PTR (loops, i);
+
+
+ return ret;
+
+}
+
+static tree build_int_cst (tree type, unsigned HOST_WIDE_INT val);
+
+/* Builds integer constant of type TYPE and value VAL.
+ Borrowed from tree-ssa-loop-ivopts.c
+ XXX: Move this into tree.c and remove from both files. */
+
+static tree
+build_int_cst (tree type, unsigned HOST_WIDE_INT val)
+{
+ unsigned bits = TYPE_PRECISION (type);
+ bool signed_p = !TREE_UNSIGNED (type);
+ bool negative = ((val >> (bits - 1)) & 1) != 0;
+ tree ival;
+
+ if (signed_p && negative)
+ {
+ val = val | (~(unsigned HOST_WIDE_INT) 0 << (bits - 1) << 1);
+ ival = build_int_2 (val, -1);
+ }
+ else
+ {
+ val = val & ~(~(unsigned HOST_WIDE_INT) 0 << (bits - 1) << 1);
+ ival = build_int_2 (val, 0);
+ }
+
+ return convert (type, ival);
+}
+
+/* Convert a lambda body vector to a gcc tree. */
+
+static tree
+lbv_to_gcc_expression (lambda_body_vector lbv,
+ varray_type induction_vars,
+ tree *stmts_to_insert)
+{
+ tree stmts, stmt, resvar, name;
+ size_t i;
+ tree_stmt_iterator tsi;
+
+ /* Create a statement list and a linear expression temporary. */
+ stmts = alloc_stmt_list ();
+ resvar = create_tmp_var (integer_type_node, "lletmp");
+ add_referenced_tmp_var (resvar);
+
+ /* Start at 0. */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar, integer_zero_node);
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (induction_vars); i++)
+ {
+ if (LBV_COEFFICIENTS (lbv)[i] != 0)
+ {
+ tree newname;
+
+ /* newname = coefficient * induction_variable */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ fold (build (MULT_EXPR, integer_type_node,
+ VARRAY_TREE (induction_vars, i),
+ build_int_cst (integer_type_node,
+ LBV_COEFFICIENTS (lbv)[i]))));
+ newname = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = newname;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ /* name = name + newname */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (PLUS_EXPR, integer_type_node,
+ name, newname));
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+ }
+
+ /* Handle any denominator that occurs. */
+ if (LBV_DENOMINATOR (lbv) != 1)
+ {
+#if 0
+ if (wrap == MAX_EXPR)
+#endif
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (CEIL_DIV_EXPR, integer_type_node,
+ name, build_int_cst (integer_type_node,
+ LBV_DENOMINATOR (lbv))));
+#if 0
+ else if (wrap == MIN_EXPR)
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (FLOOR_DIV_EXPR, integer_type_node,
+ name, build_int_cst (integer_type_node,
+ LBV_DENOMINATOR (lbv))));
+ else
+ abort ();
+#endif
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+ *stmts_to_insert = stmts;
+ return name;
+}
+
+
+/* Convert a linear expression from coefficient and constant form to a
+ gcc tree. This will likely generate trees that are badly in need
+ of constant and copy propagation. */
+
+static tree
+lle_to_gcc_expression (lambda_linear_expression lle,
+ lambda_linear_expression offset,
+ varray_type induction_vars,
+ varray_type invariants,
+ enum tree_code wrap,
+ tree *stmts_to_insert)
+{
+ tree stmts, stmt, resvar, name;
+ size_t i;
+ tree_stmt_iterator tsi;
+ varray_type results;
+
+ name = NULL_TREE;
+ /* Create a statement list and a linear expression temporary. */
+ stmts = alloc_stmt_list ();
+ resvar = create_tmp_var (integer_type_node, "lletmp");
+ add_referenced_tmp_var (resvar);
+ VARRAY_TREE_INIT (results, 1, "Results");
+
+ for (; lle != NULL; lle = LLE_NEXT (lle))
+ {
+ /* Start at 0. */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar, integer_zero_node);
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ /* First do the induction variables.
+ name = name + (coeff * induction variable) */
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (induction_vars); i++)
+ {
+ if (LLE_COEFFICIENTS (lle)[i] != 0)
+ {
+ tree newname;
+ tree mult;
+ tree coeff;
+ coeff = build_int_cst (integer_type_node,
+ LLE_COEFFICIENTS (lle)[i]);
+ mult = fold (build (MULT_EXPR, integer_type_node,
+ VARRAY_TREE (induction_vars, i), coeff));
+ /* newname = coefficient * induction_variable */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar, mult);
+ newname = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = newname;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ /* name = name + newname */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (PLUS_EXPR, integer_type_node,
+ name, newname));
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+ }
+ /* Handle our invariants.
+ name = name + (coeff * invariant). */
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
+ {
+ if (LLE_INVARIANT_COEFFICIENTS (lle)[i] != 0)
+ {
+ tree newname;
+ tree mult;
+ tree coeff;
+ coeff = build_int_cst (integer_type_node,
+ LLE_INVARIANT_COEFFICIENTS (lle)[i]);
+ mult = fold (build (MULT_EXPR, integer_type_node,
+ VARRAY_TREE (invariants, i), coeff));
+ /* newname = coefficient * invariant */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar, mult);
+ newname = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = newname;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ /* name = name + newname */
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (PLUS_EXPR, integer_type_node,
+ name, newname));
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+ }
+
+ /* Now handle the constant.
+ name = name + constant. */
+ if (LLE_CONSTANT (lle) != 0)
+ {
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (PLUS_EXPR, integer_type_node,
+ name, build_int_cst (integer_type_node,
+ LLE_CONSTANT (lle))));
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+
+ /* Now handle the offset.
+ name = name + linear offset. */
+ if (LLE_CONSTANT (offset) != 0)
+ {
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (PLUS_EXPR, integer_type_node,
+ name, build_int_cst (integer_type_node,
+ LLE_CONSTANT (offset))));
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+
+ /* Handle any denominator that occurs. */
+ if (LLE_DENOMINATOR (lle) != 1)
+ {
+ if (wrap == MAX_EXPR)
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (CEIL_DIV_EXPR, integer_type_node,
+ name, build_int_cst (integer_type_node,
+ LLE_DENOMINATOR (lle))));
+ else if (wrap == MIN_EXPR)
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (FLOOR_DIV_EXPR, integer_type_node,
+ name, build_int_cst (integer_type_node,
+ LLE_DENOMINATOR (lle))));
+ else
+ abort ();
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+ VARRAY_PUSH_TREE (results, name);
+ }
+
+ /* Again, out of laziness, we don't handle this case yet. It's not
+ hard, it just hasn't occurred. */
+ if (VARRAY_ACTIVE_SIZE (results) > 2)
+ abort ();
+
+ /* We may need to wrap the results in a MAX_EXPR or MIN_EXPR. */
+ if (VARRAY_ACTIVE_SIZE (results) > 1)
+ {
+ tree op1 = VARRAY_TREE (results, 0);
+ tree op2 = VARRAY_TREE (results, 1);
+ stmt = build (MODIFY_EXPR, void_type_node, resvar,
+ build (wrap, integer_type_node, op1, op2));
+ name = make_ssa_name (resvar, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+ tsi = tsi_last (stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ }
+
+ *stmts_to_insert = stmts;
+ return name;
+}
+
+/* Transform a lambda loopnest back into code. This changes the
+ loops, their induction variables, and their bodies, so that they
+ match the transformed loopnest. */
+void
+lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
+ varray_type old_ivs,
+ varray_type invariants,
+ lambda_loopnest new_loopnest,
+ lambda_trans_matrix transform)
+{
+
+ struct loop *temp;
+ size_t i = 0;
+ size_t depth = 0;
+ varray_type new_ivs;
+ block_stmt_iterator bsi;
+ basic_block *bbs;
+
+ if (dump_file)
+ {
+ transform = lambda_trans_matrix_inverse (transform);
+ fprintf (dump_file, "Inverse of transformation matrix:\n");
+ print_lambda_trans_matrix (dump_file, transform);
+ }
+ temp = old_loopnest;
+ VARRAY_GENERIC_PTR_INIT (new_ivs, 1, "New induction variables");
+ while (temp)
+ {
+ temp = temp->inner;
+ depth++;
+ }
+ temp = old_loopnest;
+
+ while (temp)
+ {
+ lambda_loop newloop;
+ basic_block bb;
+ tree ivvar, ivvarinced, exitcond, stmts;
+ enum tree_code testtype;
+ tree newupperbound, newlowerbound;
+ lambda_linear_expression offset;
+ /* First, build the new induction variable temporary */
+
+ ivvar = create_tmp_var (integer_type_node, "lnivtmp");
+ add_referenced_tmp_var (ivvar);
+
+ VARRAY_PUSH_GENERIC_PTR (new_ivs, ivvar);
+
+ newloop = LN_LOOPS (new_loopnest)[i];
+
+ /* Linear offset is a bit tricky to handle. */
+ offset = LL_LINEAR_OFFSET (newloop);
+
+ if (LLE_DENOMINATOR (offset) != 1
+ || !lambda_vector_zerop (LLE_COEFFICIENTS (offset), depth))
+ abort ();
+
+ /* Now build the new lower bounds, and insert the statements
+ necessary to generate it on the loop preheader. */
+ newlowerbound = lle_to_gcc_expression (LL_LOWER_BOUND (newloop),
+ LL_LINEAR_OFFSET (newloop),
+ new_ivs,
+ invariants,
+ MAX_EXPR, &stmts);
+ bsi_insert_on_edge_immediate (loop_preheader_edge (temp), stmts);
+
+ /* Build the new upper bound and insert its statements in the
+ basic block of the exit condition */
+ newupperbound = lle_to_gcc_expression (LL_UPPER_BOUND (newloop),
+ LL_LINEAR_OFFSET (newloop),
+ new_ivs,
+ invariants,
+ MIN_EXPR, &stmts);
+ /* XXX Is this right, or do we want before the first statement? */
+ exitcond = get_loop_exit_condition (temp);
+ bb = bb_for_stmt (exitcond);
+ bsi = bsi_start (bb);
+ bsi_insert_after (&bsi, stmts, BSI_NEW_STMT);
+
+ /* Create the new iv, and insert it's increment on the latch
+ block. */
+
+ bb = temp->latch->pred->src;
+ bsi = bsi_last (bb);
+ create_iv (newlowerbound,
+ build_int_cst (integer_type_node, LL_STEP (newloop)),
+ ivvar, temp, &bsi, false, &ivvar, &ivvarinced);
+
+ /* Replace the exit condition with the new upper bound
+ comparison. */
+ testtype = LL_STEP (newloop) >= 0 ? LE_EXPR : GE_EXPR;
+ COND_EXPR_COND (exitcond) = build (testtype,
+ boolean_type_node,
+ ivvarinced, newupperbound);
+ modify_stmt (exitcond);
+ VARRAY_GENERIC_PTR (new_ivs, i) = ivvar;
+
+ i++;
+ temp = temp->inner;
+ }
+
+ /* Go through the loop and make iv replacements. */
+ bbs = get_loop_body (old_loopnest);
+ for (i = 0; i < old_loopnest->num_nodes; i++)
+ for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ tree stmt = bsi_stmt (bsi);
+ use_optype uses;
+ size_t j;
+
+ get_stmt_operands (stmt);
+ uses = STMT_USE_OPS (stmt);
+ for (j = 0; j < NUM_USES (uses); j++)
+ {
+ size_t k;
+ tree *use = USE_OP_PTR (uses, j);
+ for (k = 0; k < VARRAY_ACTIVE_SIZE (old_ivs); k++)
+ {
+ tree oldiv = VARRAY_TREE (old_ivs, k);
+ if (SSA_NAME_VAR (*use) == SSA_NAME_VAR (oldiv))
+ {
+ tree newiv, stmts;
+ lambda_body_vector lbv;
+
+ /* Compute the new expression for the induction
+ variable. */
+ depth = VARRAY_ACTIVE_SIZE (new_ivs);
+ lbv = lambda_body_vector_new (depth);
+ LBV_COEFFICIENTS (lbv)[k] = 1;
+ lbv = lambda_body_vector_compute_new (transform, lbv);
+ newiv = lbv_to_gcc_expression (lbv, new_ivs, &stmts);
+
+ /* Insert the statements to build that
+ expression. */
+ bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+
+ /* Replace the use with the result of that
+ expression. */
+ if (dump_file)
+ {
+ fprintf (dump_file,
+ "Replacing induction variable use of ");
+ print_generic_stmt (dump_file, *use, 0);
+ fprintf (dump_file, " with ");
+ print_generic_stmt (dump_file, newiv, 0);
+ fprintf (dump_file, "\n");
+ }
+ *use = newiv;
+ }
+ }
+
+ }
+ }
+}
+
diff --git a/gcc/lambda-mat.c b/gcc/lambda-mat.c
new file mode 100644
index 00000000000..201ab0694f6
--- /dev/null
+++ b/gcc/lambda-mat.c
@@ -0,0 +1,568 @@
+/* Integer matrix math routines
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Daniel Berlin <dberlin@dberlin.org>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "ggc.h"
+#include "varray.h"
+#include "lambda.h"
+
+static void lambda_matrix_get_column (lambda_matrix, int, int,
+ lambda_vector);
+
+/* Allocate a matrix of M rows x N cols. */
+
+lambda_matrix
+lambda_matrix_new (int m, int n)
+{
+ lambda_matrix mat;
+ int i;
+
+ mat = ggc_alloc_cleared (m * sizeof (int));
+
+ for (i = 0; i < m; i++)
+ mat[i] = lambda_vector_new (n);
+
+ return mat;
+}
+
+/* Copy the elements of M x N matrix MAT1 to MAT2. */
+
+void
+lambda_matrix_copy (lambda_matrix mat1, lambda_matrix mat2,
+ int m, int n)
+{
+ int i;
+
+ for (i = 0; i < m; i++)
+ lambda_vector_copy (mat1[i], mat2[i], n);
+}
+
+/* Store the N x N identity matrix in MAT. */
+
+void
+lambda_matrix_id (lambda_matrix mat, int size)
+{
+ int i, j;
+
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ mat[i][j] = (i == j) ? 1 : 0;
+}
+
+/* Negate the elements of the M x N matrix MAT1 and store it in MAT2. */
+
+void
+lambda_matrix_negate (lambda_matrix mat1, lambda_matrix mat2, int m, int n)
+{
+ int i;
+
+ for (i = 0; i < m; i++)
+ lambda_vector_negate (mat1[i], mat2[i], n);
+}
+
+/* Take the transpose of matrix MAT1 and store it in MAT2.
+ MAT1 is an M x N matrix, so MAT2 must be N x M. */
+
+void
+lambda_matrix_transpose (lambda_matrix mat1, lambda_matrix mat2, int m, int n)
+{
+ int i, j;
+
+ for (i = 0; i < n; i++)
+ for (j = 0; j < m; j++)
+ mat2[i][j] = mat1[j][i];
+}
+
+
+/* Add two M x N matrices together: MAT3 = MAT1+MAT2. */
+
+void
+lambda_matrix_add (lambda_matrix mat1, lambda_matrix mat2,
+ lambda_matrix mat3, int m, int n)
+{
+ int i;
+
+ for (i = 0; i < m; i++)
+ lambda_vector_add (mat1[i], mat2[i], mat3[i], n);
+}
+
+/* MAT3 = CONST1 * MAT1 + CONST2 * MAT2. All matrices are M x N. */
+
+void
+lambda_matrix_add_mc (lambda_matrix mat1, int const1,
+ lambda_matrix mat2, int const2,
+ lambda_matrix mat3, int m, int n)
+{
+ int i;
+
+ for (i = 0; i < m; i++)
+ lambda_vector_add_mc (mat1[i], const1, mat2[i], const2, mat3[i], n);
+}
+
+/* Multiply two matrices: MAT3 = MAT1 * MAT2.
+ MAT1 is an M x R matrix, and MAT2 is R x N. The resulting MAT2
+ must therefore be M x N. */
+
+void
+lambda_matrix_mult (lambda_matrix mat1, lambda_matrix mat2,
+ lambda_matrix mat3, int m, int r, int n)
+{
+
+ int i, j, k;
+ lambda_vector row1, row3;
+
+ for (i = 0; i < m; i++)
+ {
+ row3 = mat3[i];
+ for (j = 0; j < n; j++)
+ {
+ row1 = mat1[i];
+ row3[j] = 0;
+ for (k = 0; k < r; k++)
+ row3[j] += row1[k] * mat2[k][j];
+ }
+ }
+}
+
+/* Get column COL from the matrix MAT and store it in VEC. MAT has
+ N rows, so the length of VEC must be N. */
+
+static void
+lambda_matrix_get_column (lambda_matrix mat, int n, int col,
+ lambda_vector vec)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ vec[i] = mat[i][col];
+}
+
+/* Delete rows r1 to r2 (not including r2). TODO */
+
+void
+lambda_matrix_delete_rows (lambda_matrix mat, int rows, int from, int to)
+{
+ int i, d;
+ d = to - from;
+
+ for (i = to; i < rows; i++)
+ mat[i - d] = mat[i];
+
+ for (i = rows - d; i < rows; i++)
+ mat[i] = NULL;
+}
+
+/* Swap rows R1 and R2 in matrix MAT. */
+
+void
+lambda_matrix_row_exchange (lambda_matrix mat, int r1, int r2)
+{
+ lambda_vector row;
+
+ row = mat[r1];
+ mat[r1] = mat[r2];
+ mat[r2] = row;
+}
+
+/* Add a multiple of row R1 of matrix MAT with N columns to row R2:
+ R2 = R2 + CONST1 * R1. */
+
+void
+lambda_matrix_row_add (lambda_matrix mat, int n, int r1, int r2, int const1)
+{
+ int i;
+ lambda_vector row1, row2;
+
+ if (const1 == 0)
+ return;
+
+ row1 = mat[r1];
+ row2 = mat[r2];
+
+ for (i = 0; i < n; i++)
+ row2[i] += const1 * row1[i];
+}
+
+/* Negate row R1 of matrix MAT which has N columns. */
+
+void
+lambda_matrix_row_negate (lambda_matrix mat, int n, int r1)
+{
+ lambda_vector_negate (mat[r1], mat[r1], n);
+}
+
+/* Multiply row R1 of matrix MAT with N columns by CONST1. */
+
+void
+lambda_matrix_row_mc (lambda_matrix mat, int n, int r1, int const1)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ mat[r1][i] *= const1;
+}
+
+/* Exchange COL1 and COL2 in matrix MAT. M is the number of rows. */
+
+void
+lambda_matrix_col_exchange (lambda_matrix mat, int m, int col1, int col2)
+{
+ lambda_vector row;
+ int i;
+ int tmp;
+ for (i = 0; i < m; i++)
+ {
+ row = mat[i];
+ tmp = row[col1];
+ row[col1] = row[col2];
+ row[col2] = tmp;
+ }
+}
+
+/* Add a multiple of column C1 of matrix MAT with M rows to column C2:
+ C2 = C1 + CONST1 * C2. */
+
+void
+lambda_matrix_col_add (lambda_matrix mat, int m, int c1, int c2, int const1)
+{
+ int i;
+
+ if (const1 == 0)
+ return;
+
+ for (i = 0; i < m; i++)
+ mat[i][c2] += const1 * mat[i][c1];
+}
+
+/* Negate column C1 of matrix MAT which has M rows. */
+
+void
+lambda_matrix_col_negate (lambda_matrix mat, int m, int c1)
+{
+ int i;
+
+ for (i = 0; i < m; i++)
+ mat[i][c1] *= -1;
+}
+
+/* Multiply column C1 of matrix MAT with M rows by CONST1. */
+
+void
+lambda_matrix_col_mc (lambda_matrix mat, int m, int c1, int const1)
+{
+ int i;
+
+ for (i = 0; i < m; i++)
+ mat[i][c1] *= const1;
+}
+
+/* Compute the inverse of the N x N matrix MAT and store it in INV.
+
+ We don't _really_ compute the inverse of MAT. Instead we compute
+ det(MAT)*inv(MAT), and we return det(MAT) to the caller as the function
+ result. This is necessary to preserve accuracy, because we are dealing
+ with integer matrices here.
+
+ The algorithm used here is a column based Gauss-Jordan elimination on MAT
+ and the identity matrix in parallel. The inverse is the result of applying
+ the same operations on the identity matrix that reduce MAT to the identity
+ matrix.
+
+ When MAT is a 2 x 2 matrix, we don't go through the whole process, because
+ it is easily inverted by inspection and it is a very common case. */
+
+static int lambda_matrix_inverse_hard (lambda_matrix, lambda_matrix, int);
+
+int
+lambda_matrix_inverse (lambda_matrix mat, lambda_matrix inv, int n)
+{
+ if (n == 2)
+ {
+ int a, b, c, d, det;
+ a = mat[0][0];
+ b = mat[1][0];
+ c = mat[0][1];
+ d = mat[1][1];
+ inv[0][0] = d;
+ inv[0][1] = -c;
+ inv[1][0] = -b;
+ inv[1][1] = a;
+ det = (a * d - b * c);
+ if (det < 0)
+ {
+ det *= -1;
+ inv[0][0] *= -1;
+ inv[1][0] *= -1;
+ inv[0][1] *= -1;
+ inv[1][1] *= -1;
+ }
+ return det;
+ }
+ else
+ return lambda_matrix_inverse_hard (mat, inv, n);
+}
+
+/* If MAT is not a special case, invert it the hard way. */
+
+static int
+lambda_matrix_inverse_hard (lambda_matrix mat, lambda_matrix inv, int n)
+{
+ lambda_vector row;
+ lambda_matrix temp;
+ int i, j;
+ int determinant;
+
+ temp = lambda_matrix_new (n, n);
+ lambda_matrix_copy (mat, temp, n, n);
+ lambda_matrix_id (inv, n);
+
+ /* Reduce TEMP to a lower triangular form, applying the same operations on
+ INV which starts as the identity matrix. N is the number of rows and
+ columns. */
+ for (j = 0; j < n; j++)
+ {
+ row = temp[j];
+
+ /* Make every element in the current row positive. */
+ for (i = j; i < n; i++)
+ if (row[i] < 0)
+ {
+ lambda_matrix_col_negate (temp, n, i);
+ lambda_matrix_col_negate (inv, n, i);
+ }
+
+ /* Sweep the upper triangle. Stop when only the diagonal element in the
+ current row is nonzero. */
+ while (lambda_vector_first_nz (row, n, j + 1) < n)
+ {
+ int min_col = lambda_vector_min_nz (row, n, j);
+ lambda_matrix_col_exchange (temp, n, j, min_col);
+ lambda_matrix_col_exchange (inv, n, j, min_col);
+
+ for (i = j + 1; i < n; i++)
+ {
+ int factor;
+
+ factor = -1 * row[i];
+ if (row[j] != 1)
+ factor /= row[j];
+
+ lambda_matrix_col_add (temp, n, j, i, factor);
+ lambda_matrix_col_add (inv, n, j, i, factor);
+ }
+ }
+ }
+
+ /* Reduce TEMP from a lower triangular to the identity matrix. Also compute
+ the determinant, which now is simply the product of the elements on the
+ diagonal of TEMP. If one of these elements is 0, the matrix has 0 as an
+ eigenvalue so it is singular and hence not invertible. */
+ determinant = 1;
+ for (j = n - 1; j >= 0; j--)
+ {
+ int diagonal;
+
+ row = temp[j];
+ diagonal = row[j];
+
+ /* If the matrix is singular, abort. */
+ if (diagonal == 0)
+ abort ();
+
+ determinant = determinant * diagonal;
+
+ /* If the diagonal is not 1, then multiply the each row by the
+ diagonal so that the middle number is now 1, rather than a
+ rational. */
+ if (diagonal != 1)
+ {
+ for (i = 0; i < j; i++)
+ lambda_matrix_col_mc (inv, n, i, diagonal);
+ for (i = j + 1; i < n; i++)
+ lambda_matrix_col_mc (inv, n, i, diagonal);
+
+ row[j] = diagonal = 1;
+ }
+
+ /* Sweep the lower triangle column wise. */
+ for (i = j - 1; i >= 0; i--)
+ {
+ if (row[i])
+ {
+ int factor = -row[i];
+ lambda_matrix_col_add (temp, n, j, i, factor);
+ lambda_matrix_col_add (inv, n, j, i, factor);
+ }
+
+ }
+ }
+
+ return determinant;
+}
+
+/* Decompose mat to a product of a lower triangular H and a unimodular
+ U matrix. */
+
+void
+lambda_matrix_hermite (lambda_matrix mat, int n,
+ lambda_matrix H, lambda_matrix U)
+{
+ lambda_vector row;
+ int i, j, factor, minimum_col;
+
+ lambda_matrix_copy (mat, H, n, n);
+ lambda_matrix_id (U, n);
+
+ for (j = 0; j < n; j++)
+ {
+ row = H[j];
+
+ /* Make every element of H[j][j..n] positive. */
+ for (i = j; i < n; i++)
+ {
+ if (row[i] < 0)
+ {
+ lambda_matrix_col_negate (H, n, i);
+ lambda_vector_negate (U[i], U[i], n);
+ }
+ }
+
+ /* Stop when only the diagonal element is non-zero. */
+ while (lambda_vector_first_nz (row, n, j + 1) < n)
+ {
+ minimum_col = lambda_vector_min_nz (row, n, j);
+ lambda_matrix_col_exchange (H, n, j, minimum_col);
+ lambda_matrix_row_exchange (U, j, minimum_col);
+
+ for (i = j + 1; i < n; i++)
+ {
+ factor = row[i] / row[j];
+ lambda_matrix_col_add (H, n, j, i, -1 * factor);
+ lambda_matrix_row_add (U, n, i, j, factor);
+ }
+ }
+ }
+}
+
+/* Find the first non-zero vector in mat, if found.
+ return rowsize if not found. */
+
+int
+lambda_matrix_first_nz_vec (lambda_matrix mat, int rowsize, int colsize,
+ int startrow)
+{
+
+ int j;
+ bool found = false;
+
+ for (j = startrow; (j < rowsize) && !found; j++)
+ {
+ if ((mat[j] != NULL)
+ && (lambda_vector_first_nz (mat[j], colsize, startrow) < colsize))
+ found = true;
+ }
+
+ if (found)
+ return j - 1;
+ return rowsize;
+}
+
+/* Calculate the projection of E sub k to the null space of B. */
+
+void
+lambda_matrix_project_to_null (lambda_matrix B, int rowsize,
+ int colsize, int k, lambda_vector x)
+{
+ lambda_matrix M1, M2, M3, I;
+ int determinant;
+
+ /* compute c(I-B^T inv(B B^T) B) e sub k */
+
+ /* M1 is the transpose of B */
+ M1 = lambda_matrix_new (colsize, colsize);
+ lambda_matrix_transpose (B, M1, rowsize, colsize);
+
+ /* M2 = B * B^T */
+ M2 = lambda_matrix_new (colsize, colsize);
+ lambda_matrix_mult (B, M1, M2, rowsize, colsize, rowsize);
+
+ /* M3 = inv(M2) */
+ M3 = lambda_matrix_new (colsize, colsize);
+ determinant = lambda_matrix_inverse (M2, M3, rowsize);
+
+ /* M2 = B^T (inv(B B^T)) */
+ lambda_matrix_mult (M1, M3, M2, colsize, rowsize, rowsize);
+
+ /* M1 = B^T (inv(B B^T)) B */
+ lambda_matrix_mult (M2, B, M1, colsize, rowsize, colsize);
+ lambda_matrix_negate (M1, M1, colsize, colsize);
+
+ I = lambda_matrix_new (colsize, colsize);
+ lambda_matrix_id (I, colsize);
+
+ lambda_matrix_add_mc (I, determinant, M1, 1, M2, colsize, colsize);
+
+ lambda_matrix_get_column (M2, colsize, k - 1, x);
+
+}
+
+/* Multiply a vector VEC by a matrix MAT.
+ MAT is an M*N matrix, and VEC is a vector with length N. The result
+ is stored in DEST which must be a vector of length M. */
+
+void
+lambda_matrix_vector_mult (lambda_matrix matrix, int m, int n,
+ lambda_vector vec, lambda_vector dest)
+{
+ int i, j;
+
+ lambda_vector_clear (dest, m);
+ for (i = 0; i < m; i++)
+ for (j = 0; j < n; j++)
+ dest[i] += matrix[i][j] * vec[j];
+}
+
+/* Print out a vector VEC of length N to OUTFILE. */
+
+void
+print_lambda_vector (FILE * outfile, lambda_vector vector, int n)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ fprintf (outfile, "%3d ", vector[i]);
+ fprintf (outfile, "\n");
+}
+
+/* Print out an M x N matrix MAT to OUTFILE. */
+
+void
+print_lambda_matrix (FILE * outfile, lambda_matrix matrix, int m, int n)
+{
+ int i;
+
+ for (i = 0; i < m; i++)
+ print_lambda_vector (outfile, matrix[i], n);
+ fprintf (outfile, "\n");
+}
+
diff --git a/gcc/lambda-trans.c b/gcc/lambda-trans.c
new file mode 100644
index 00000000000..2539ba6600f
--- /dev/null
+++ b/gcc/lambda-trans.c
@@ -0,0 +1,294 @@
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "target.h"
+#include "varray.h"
+#include "lambda.h"
+
+/* Allocate a new transformation matrix. */
+
+lambda_trans_matrix
+lambda_trans_matrix_new (int colsize, int rowsize)
+{
+ lambda_trans_matrix ret;
+
+ ret = xcalloc (1, sizeof (*ret));
+ LTM_MATRIX (ret) = lambda_matrix_new (rowsize, colsize);
+ LTM_ROWSIZE (ret) = rowsize;
+ LTM_COLSIZE (ret) = colsize;
+ LTM_DENOMINATOR (ret) = 1;
+ return ret;
+}
+
+/* Return true if the transformation matrix is nonsingular. */
+
+bool
+lambda_trans_matrix_is_nonsingular (lambda_trans_matrix t)
+{
+ return lambda_trans_matrix_is_fullrank (t);
+}
+
+
+/* Return true if the transformation matrix is full row rank. */
+
+bool
+lambda_trans_matrix_is_fullrank (lambda_trans_matrix t)
+{
+ return (lambda_trans_matrix_rank (t) == LTM_ROWSIZE (t));
+}
+
+/* Compute the rank of the matrix. */
+
+int
+lambda_trans_matrix_rank (lambda_trans_matrix t)
+{
+ lambda_matrix partial;
+ int rowsize, colsize;
+ int i, j, nextrow;
+
+ lambda_matrix tempmatrix;
+ lambda_vector row;
+ int minimum_column, factor;
+
+ partial = LTM_MATRIX (t);
+ rowsize = LTM_ROWSIZE (t);
+ colsize = LTM_COLSIZE (t);
+
+ tempmatrix = lambda_matrix_new (rowsize, colsize);
+ lambda_matrix_copy (partial, tempmatrix, rowsize, colsize);
+
+ j = 0;
+ while ((j < colsize) && (j < rowsize))
+ {
+ /* Considering the submatrix A[j:m, j:n], search for the first
+ row k >= k such that A[k, j:n] != 0 */
+
+ nextrow = lambda_matrix_first_nz_vec (tempmatrix, rowsize, colsize, j);
+
+ if (nextrow != j)
+ return j;
+
+ /* Delete rows j .. nextrow - 1 */
+
+ lambda_matrix_delete_rows (tempmatrix, rowsize, j, nextrow);
+ lambda_matrix_delete_rows (partial, rowsize, j, nextrow);
+
+ rowsize = rowsize - nextrow + j;
+
+ /* Nextrow becomes row j+1 in the matrix, but not necessary row
+ j + 1 in the array. */
+
+ /* Apply elementary column operations to make the diagonal
+ element non-zero and the others zero. */
+
+ row = tempmatrix[j];
+
+ /* Make every element of tempmatrix[j, j:colsize] positive. */
+
+ for (i = j; i < colsize; i++)
+ if (row[i] < 0)
+ lambda_matrix_col_negate (tempmatrix, rowsize, i);
+
+ /* Stop only when the diagonal element is non-zero. */
+ while (lambda_vector_first_nz (row, colsize, j+1) < colsize)
+ {
+ minimum_column = lambda_vector_min_nz (row, colsize, j);
+ lambda_matrix_col_exchange (tempmatrix, rowsize, j, minimum_column);
+
+ for (i = j + 1; i < colsize; i++)
+ {
+ if (row[i])
+ {
+ factor = row[i] / row[j];
+ /* Add (-1) * factor of column j to column i. */
+ lambda_matrix_col_add (tempmatrix, rowsize,
+ j, i, (-1) * factor);
+ }
+ }
+ }
+ j++;
+ }
+
+ return rowsize;
+}
+
+
+/* Compute the base matrix. */
+
+lambda_trans_matrix
+lambda_trans_matrix_base (lambda_trans_matrix mat)
+{
+ int rowsize, colsize;
+ int i, j, nextrow;
+ lambda_matrix partial, tempmatrix;
+ lambda_vector row;
+ int minimum_column, factor;
+
+ lambda_trans_matrix base;
+
+ rowsize = LTM_ROWSIZE (mat);
+ colsize = LTM_COLSIZE (mat);
+ base = lambda_trans_matrix_new (rowsize, colsize);
+ partial = LTM_MATRIX (base);
+ lambda_matrix_copy (LTM_MATRIX (mat), partial, rowsize, colsize);
+ tempmatrix = lambda_matrix_new (rowsize, colsize);
+ lambda_matrix_copy (partial, tempmatrix, rowsize, colsize);
+
+ j = 0;
+
+ while ((j < colsize)
+ && (nextrow = lambda_matrix_first_nz_vec (tempmatrix,
+ rowsize,
+ colsize, j)) < rowsize)
+ {
+ /* Consider the submatrix A[j:m, j:n].
+ Search for the first row k >= j such that A[k, j:n] != 0. */
+
+ /* Delete rows j .. nextrow - 1. */
+ lambda_matrix_delete_rows (tempmatrix, rowsize, j, nextrow);
+ lambda_matrix_delete_rows (partial, rowsize, j, nextrow);
+
+ /* nextrow becomes row j+1 in the matrix, though not necessarily
+ row j+1 in the array. */
+ /* Apply elementary column oeprations to make the diagonal
+ element nonzero and the others zero. */
+ row = tempmatrix[j];
+
+ /* Make every element of tempmatrix[j, j:colsize] positive. */
+
+ for (i = j; i < colsize; i++)
+ if (row[i] < 0)
+ lambda_matrix_col_negate (tempmatrix, rowsize, i);
+
+ /* Stop when only the diagonal element is nonzero. */
+
+ while (lambda_vector_first_nz (row, colsize, j+1) < colsize)
+ {
+ minimum_column = lambda_vector_min_nz (row, colsize, j);
+ lambda_matrix_col_exchange (tempmatrix, rowsize, j, minimum_column);
+
+ for (i = j + 1; i < colsize; i++)
+ {
+ if (row[i])
+ {
+ factor = row[i] / row[j];
+ /* Add (-1) * factor of column j to column i. */
+ lambda_matrix_col_add (tempmatrix, rowsize,
+ j, i, (-1) * factor);
+ }
+ }
+ }
+ j++;
+ }
+ /* Store the rank. */
+ LTM_ROWSIZE (base) = j;
+ return base;
+}
+
+/* Pad the legal base matrix to an invertable matrix. */
+
+lambda_trans_matrix
+lambda_trans_matrix_padding (lambda_trans_matrix matrix)
+{
+ int i, k;
+ int currrow, minimum_column, factor;
+
+ lambda_matrix tempmatrix, padmatrix;
+ lambda_vector row;
+
+ lambda_trans_matrix padded;
+ lambda_matrix partial;
+ int rowsize, colsize;
+
+ rowsize = LTM_ROWSIZE (matrix);
+ colsize = LTM_COLSIZE (matrix);
+
+ padded = lambda_trans_matrix_new (rowsize, colsize);
+ partial = LTM_MATRIX (padded);
+ lambda_matrix_copy(LTM_MATRIX (matrix), partial, rowsize, colsize);
+
+ /* full rank, no need for padding */
+ if (rowsize==colsize)
+ return(padded);
+
+ tempmatrix = lambda_matrix_new (rowsize, colsize);
+ lambda_matrix_copy (partial, tempmatrix, rowsize, colsize);
+
+ padmatrix = lambda_matrix_new (colsize, colsize);
+ lambda_matrix_id (padmatrix, colsize);
+
+ for(currrow = 0; currrow < rowsize; currrow++)
+ {
+ /* consider the submatrix A[i:m, i:n]. */
+
+ /* apply elementary column operations to make the diag element nonzero
+ and others zero. */
+
+ /* only consider columns from currrow to colsize. */
+
+ row = tempmatrix[currrow];
+
+ /* make every element of tempmatrix[currrow, currrow:colsize]
+ positive. */
+
+ for(i = currrow; i < colsize; i++)
+ if(row[i] < 0)
+ lambda_matrix_col_negate (tempmatrix, rowsize, i);
+
+ /* stop when only the diagonal element is nonzero */
+ while (lambda_vector_first_nz (row, colsize, currrow + 1) < colsize)
+ {
+ minimum_column = lambda_vector_min_nz (row, colsize, currrow);
+
+ lambda_matrix_col_exchange (tempmatrix, rowsize, currrow,
+ minimum_column);
+ lambda_matrix_row_exchange (padmatrix, currrow, minimum_column);
+
+ for (i = currrow + 1; i < colsize; i++)
+ {
+ if(row[i])
+ {
+ factor = row[i] / row[currrow];
+ lambda_matrix_col_add (tempmatrix, rowsize,
+ currrow, i, (-1) * factor);
+ }
+ }
+ }
+ }
+
+
+ for(k = rowsize; k < colsize; k++)
+ partial[k] = padmatrix[k];
+
+ return(padded);
+}
+
+/* Compute the inverse of the transformation. */
+
+lambda_trans_matrix
+lambda_trans_matrix_inverse (lambda_trans_matrix mat)
+{
+ lambda_trans_matrix inverse;
+ int determinant;
+
+ inverse = lambda_trans_matrix_new (LTM_ROWSIZE (mat), LTM_COLSIZE (mat));
+ determinant = lambda_matrix_inverse (LTM_MATRIX (mat), LTM_MATRIX (inverse),
+ LTM_ROWSIZE (mat));
+ LTM_DENOMINATOR (inverse) = determinant;
+ return inverse;
+}
+
+
+/* Print out a transformation matrix. */
+
+void
+print_lambda_trans_matrix (FILE *outfile, lambda_trans_matrix mat)
+{
+ print_lambda_matrix (outfile, LTM_MATRIX (mat), LTM_ROWSIZE (mat),
+ LTM_COLSIZE (mat));
+}
diff --git a/gcc/lambda.h b/gcc/lambda.h
new file mode 100644
index 00000000000..a02814562ed
--- /dev/null
+++ b/gcc/lambda.h
@@ -0,0 +1,303 @@
+#ifndef LAMBDA_H
+#define LAMBDA_H
+
+typedef int *lambda_vector;
+typedef lambda_vector *lambda_matrix;
+
+/* A transformation matrix. */
+typedef struct
+{
+ lambda_matrix matrix;
+ int rowsize;
+ int colsize;
+ int denominator;
+} *lambda_trans_matrix;
+#define LTM_MATRIX(T) ((T)->matrix)
+#define LTM_ROWSIZE(T) ((T)->rowsize)
+#define LTM_COLSIZE(T) ((T)->colsize)
+#define LTM_DENOMINATOR(T) ((T)->denominator)
+
+/* A vector representing a statement in the body of a loop. */
+typedef struct
+{
+ lambda_vector coefficients;
+ int size;
+ int denominator;
+} *lambda_body_vector;
+#define LBV_COEFFICIENTS(T) ((T)->coefficients)
+#define LBV_SIZE(T) ((T)->size)
+#define LBV_DENOMINATOR(T) ((T)->denominator)
+
+/* Piecewise linear expression. */
+typedef struct lambda_linear_expression_s
+{
+ lambda_vector coefficients;
+ int constant;
+ lambda_vector invariant_coefficients;
+ int denominator;
+ struct lambda_linear_expression_s *next;
+} *lambda_linear_expression;
+
+#define LLE_COEFFICIENTS(T) ((T)->coefficients)
+#define LLE_CONSTANT(T) ((T)->constant)
+#define LLE_INVARIANT_COEFFICIENTS(T) ((T)->invariant_coefficients)
+#define LLE_DENOMINATOR(T) ((T)->denominator)
+#define LLE_NEXT(T) ((T)->next)
+
+lambda_linear_expression lambda_linear_expression_new (int, int);
+void print_lambda_linear_expression (FILE *, lambda_linear_expression, int,
+ int, char);
+
+/* Loop structure. */
+typedef struct lambda_loop_s
+{
+ lambda_linear_expression lower_bound;
+ lambda_linear_expression upper_bound;
+ lambda_linear_expression linear_offset;
+ int step;
+} *lambda_loop;
+
+#define LL_LOWER_BOUND(T) ((T)->lower_bound)
+#define LL_UPPER_BOUND(T) ((T)->upper_bound)
+#define LL_LINEAR_OFFSET(T) ((T)->linear_offset)
+#define LL_STEP(T) ((T)->step)
+
+/* Loop nest structure. */
+typedef struct
+{
+ lambda_loop *loops;
+ int depth;
+ int invariants;
+} *lambda_loopnest;
+
+#define LN_LOOPS(T) ((T)->loops)
+#define LN_DEPTH(T) ((T)->depth)
+#define LN_INVARIANTS(T) ((T)->invariants)
+
+lambda_loopnest lambda_loopnest_new (int, int);
+lambda_loopnest lambda_loopnest_transform (lambda_loopnest, lambda_trans_matrix);
+void print_lambda_loopnest (FILE *, lambda_loopnest, char);
+
+#define lambda_loop_new() (lambda_loop) ggc_alloc_cleared (sizeof (struct lambda_loop_s))
+
+void print_lambda_loop (FILE *, lambda_loop, int, int, char);
+
+void print_lambda_vector (FILE *, lambda_vector, int);
+
+lambda_matrix lambda_matrix_new (int, int);
+
+void lambda_matrix_id (lambda_matrix, int);
+void lambda_matrix_copy (lambda_matrix, lambda_matrix, int, int);
+void lambda_matrix_negate (lambda_matrix, lambda_matrix, int, int);
+void lambda_matrix_transpose (lambda_matrix, lambda_matrix, int, int);
+void lambda_matrix_add (lambda_matrix, lambda_matrix, lambda_matrix, int,
+ int);
+void lambda_matrix_add_mc (lambda_matrix, int, lambda_matrix, int,
+ lambda_matrix, int, int);
+void lambda_matrix_mult (lambda_matrix, lambda_matrix, lambda_matrix,
+ int, int, int);
+void lambda_matrix_delete_rows (lambda_matrix, int, int, int);
+void lambda_matrix_row_exchange (lambda_matrix, int, int);
+void lambda_matrix_row_add (lambda_matrix, int, int, int, int);
+void lambda_matrix_row_negate (lambda_matrix mat, int, int);
+void lambda_matrix_row_mc (lambda_matrix, int, int, int);
+void lambda_matrix_col_exchange (lambda_matrix, int, int, int);
+void lambda_matrix_col_add (lambda_matrix, int, int, int, int);
+void lambda_matrix_col_negate (lambda_matrix, int, int);
+void lambda_matrix_col_mc (lambda_matrix, int, int, int);
+int lambda_matrix_inverse (lambda_matrix, lambda_matrix, int);
+void lambda_matrix_hermite (lambda_matrix, int, lambda_matrix, lambda_matrix);
+int lambda_matrix_first_nz_vec (lambda_matrix, int, int, int);
+void lambda_matrix_project_to_null (lambda_matrix, int, int, int,
+ lambda_vector);
+void print_lambda_matrix (FILE *, lambda_matrix, int, int);
+
+lambda_trans_matrix lambda_trans_matrix_new (int, int);
+bool lambda_trans_matrix_is_nonsingular (lambda_trans_matrix);
+bool lambda_trans_matrix_is_fullrank (lambda_trans_matrix);
+int lambda_trans_matrix_rank (lambda_trans_matrix);
+lambda_trans_matrix lambda_trans_matrix_base (lambda_trans_matrix);
+lambda_trans_matrix lambda_trans_matrix_padding (lambda_trans_matrix);
+lambda_trans_matrix lambda_trans_matrix_inverse (lambda_trans_matrix);
+void print_lambda_trans_matrix (FILE *, lambda_trans_matrix);
+void lambda_matrix_vector_mult (lambda_matrix, int, int, lambda_vector,
+ lambda_vector);
+
+lambda_body_vector lambda_body_vector_new (int);
+lambda_body_vector lambda_body_vector_compute_new (lambda_trans_matrix,
+ lambda_body_vector);
+void print_lambda_body_vector (FILE *, lambda_body_vector);
+struct loop;
+lambda_loopnest gcc_loopnest_to_lambda_loopnest (struct loop *,
+ varray_type *,
+ varray_type *);
+void lambda_loopnest_to_gcc_loopnest (struct loop *, varray_type,
+ varray_type,
+ lambda_loopnest,
+ lambda_trans_matrix);
+
+
+static inline void lambda_vector_negate (lambda_vector, lambda_vector, int);
+static inline void lambda_vector_mult_const (lambda_vector, lambda_vector, int, int);
+static inline void lambda_vector_add (lambda_vector, lambda_vector,
+ lambda_vector, int);
+static inline void lambda_vector_add_mc (lambda_vector, int, lambda_vector, int,
+ lambda_vector, int);
+static inline void lambda_vector_copy (lambda_vector, lambda_vector, int);
+static inline bool lambda_vector_zerop (lambda_vector, int);
+static inline void lambda_vector_clear (lambda_vector, int);
+static inline bool lambda_vector_equal (lambda_vector, lambda_vector, int);
+static inline int lambda_vector_min_nz (lambda_vector, int, int);
+static inline int lambda_vector_first_nz (lambda_vector, int, int);
+
+/* Allocate a new vector of given SIZE. */
+
+static inline lambda_vector
+lambda_vector_new (int size)
+{
+ return ggc_alloc_cleared (size * sizeof(int));
+}
+
+/* Negate vector VEC1 with length SIZE and store it in VEC2. */
+
+static inline void
+lambda_vector_negate (lambda_vector vec1, lambda_vector vec2,
+ int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++)
+ if (vec1[i] != 0)
+ vec2[i] = (-1) * vec1[i];
+}
+
+/* Multiply vector VEC1 of length SIZE by a constant CONST1,
+ and store the result in VEC2. */
+
+static inline void
+lambda_vector_mult_const (lambda_vector vec1, lambda_vector vec2,
+ int size, int const1)
+{
+ int i;
+
+ if (const1 == 0)
+ lambda_vector_clear (vec2, size);
+ else
+ for (i = 0; i < size; i++)
+ vec2[i] = const1 * vec1[i];
+}
+
+/* VEC3 = VEC1+VEC2, where all three the vectors are of length SIZE. */
+
+static inline void
+lambda_vector_add (lambda_vector vec1, lambda_vector vec2,
+ lambda_vector vec3, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ vec3[i] = vec1[i] + vec2[i];
+}
+
+/* VEC3 = CONSTANT1*VEC1 + CONSTANT2*VEC2. All vectors have length SIZE. */
+
+static inline void
+lambda_vector_add_mc (lambda_vector vec1, int const1,
+ lambda_vector vec2, int const2,
+ lambda_vector vec3, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ vec3[i] = const1 * vec1[i] + const2 * vec2[i];
+}
+
+/* Copy the elements of vector VEC1 with length SIZE to VEC2. */
+
+static inline void
+lambda_vector_copy (lambda_vector vec1, lambda_vector vec2,
+ int size)
+{
+ memcpy (vec2, vec1, size * sizeof (int));
+}
+
+/* Return true if vector VEC1 of length SIZE is the zero vector. */
+
+static inline bool
+lambda_vector_zerop (lambda_vector vec1, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ if (vec1[i] != 0)
+ return false;
+ return true;
+}
+
+/* Clear out vector VEC1 of length SIZE. */
+
+static inline void
+lambda_vector_clear (lambda_vector vec1, int size)
+{
+ memset (vec1, 0, size * sizeof (int));
+}
+
+/* Return true if two vectors are equal. */
+
+static inline bool
+lambda_vector_equal (lambda_vector vec1, lambda_vector vec2, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ if (vec1[i] != vec2[i])
+ return false;
+ return true;
+}
+
+/* Return the minimum non-zero element in vector VEC1 between START and N.
+ We must have START <= N. */
+
+static inline int
+lambda_vector_min_nz (lambda_vector vec1, int n, int start)
+{
+ int j;
+ int min = -1;
+
+ for (j = start; j < n; j++)
+ {
+ if (vec1[j])
+ if (min < 0 || vec1[j] < vec1[min])
+ min= j;
+ }
+
+ if (min < 0)
+ abort ();
+
+ return min;
+}
+
+/* Return the first nonzero element of vector VEC1 between START and N.
+ We must have START <= N. Returns N if VEC1 is the zero vector. */
+
+static inline int
+lambda_vector_first_nz (lambda_vector vec1, int n, int start)
+{
+ int j;
+ for (j = start; j < n && vec1[j] == 0; j++) /* Nothing. */ ;
+ return j;
+}
+
+
+/* Multiply a vector by a matrix. */
+
+static inline void
+lambda_vector_matrix_mult (lambda_vector vect, int m, lambda_matrix mat,
+ int n, lambda_vector dest)
+{
+ int i, j;
+ memset (dest, 0, n * sizeof (int));
+ for (i = 0; i < n; i++)
+ for (j = 0; j < m; j++)
+ dest[i] += mat[j][i] * vect[j];
+}
+
+
+#endif /* LAMBDA_H */
+
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 746143c4d0b..97e06f8287b 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -54,6 +54,12 @@ extern int lhd_staticp (tree);
extern int lhd_unsafe_for_reeval (tree);
extern void lhd_clear_binding_stack (void);
extern void lhd_print_tree_nothing (FILE *, tree, int);
+/* APPLE LOCAL new tree dump */
+extern void lhd_dump_tree_do_nothing (FILE *, tree, int, int);
+extern int lhd_dump_tree_blank_line_do_nothing (tree, tree);
+extern int lhd_dump_tree_lineno_do_nothing (FILE *, tree);
+extern int lhd_dmp_tree3_do_nothing (FILE *, tree, int);
+/* APPLE LOCAL end new tree dump */
extern const char *lhd_decl_printable_name (tree, int);
extern int lhd_types_compatible_p (tree, tree);
extern rtx lhd_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
@@ -97,6 +103,8 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *);
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
#define LANG_HOOKS_INIT hook_bool_void_false
#define LANG_HOOKS_FINISH lhd_do_nothing
+/* APPLE LOCAL Objective-C++ */
+#define LANG_HOOKS_FINISH_FILE lhd_do_nothing
#define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack
#define LANG_HOOKS_INIT_OPTIONS hook_uint_uint_constcharptrptr_0
@@ -124,6 +132,14 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *);
#define LANG_HOOKS_PRINT_DECL lhd_print_tree_nothing
#define LANG_HOOKS_PRINT_TYPE lhd_print_tree_nothing
#define LANG_HOOKS_PRINT_IDENTIFIER lhd_print_tree_nothing
+/* APPLE LOCAL begin new tree dump */
+#define LANG_HOOKS_DUMP_DECL lhd_dump_tree_do_nothing
+#define LANG_HOOKS_DUMP_TYPE lhd_dump_tree_do_nothing
+#define LANG_HOOKS_DUMP_IDENTIFIER lhd_dump_tree_do_nothing
+#define LANG_HOOKS_DUMP_BLANK_LINE_P lhd_dump_tree_blank_line_do_nothing
+#define LANG_HOOKS_DUMP_LINENO_P lhd_dump_tree_lineno_do_nothing
+#define LANG_HOOKS_DMP_TREE3 lhd_dmp_tree3_do_nothing
+/* APPLE LOCAL end new tree dump */
#define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function
#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
#define LANG_HOOKS_GET_CALLEE_FNDECL lhd_return_null_tree
@@ -286,6 +302,8 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_POST_OPTIONS, \
LANG_HOOKS_INIT, \
LANG_HOOKS_FINISH, \
+ /* APPLE LOCAL Objective-C++ */ \
+ LANG_HOOKS_FINISH_FILE, \
LANG_HOOKS_PARSE_FILE, \
LANG_HOOKS_CLEAR_BINDING_STACK, \
LANG_HOOKS_GET_ALIAS_SET, \
@@ -318,6 +336,14 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_ATTRIBUTE_TABLE, \
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
+/* APPLE LOCAL begin new tree dump */ \
+ LANG_HOOKS_DUMP_DECL, \
+ LANG_HOOKS_DUMP_TYPE, \
+ LANG_HOOKS_DUMP_IDENTIFIER, \
+ LANG_HOOKS_DUMP_BLANK_LINE_P, \
+ LANG_HOOKS_DUMP_LINENO_P, \
+ LANG_HOOKS_DMP_TREE3, \
+/* APPLE LOCAL end new tree dump */ \
LANG_HOOKS_FUNCTION_INITIALIZER, \
LANG_HOOKS_TREE_INLINING_INITIALIZER, \
LANG_HOOKS_CALLGRAPH_INITIALIZER, \
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index d48a0c9033f..d4bfa8f534f 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -420,6 +420,39 @@ lhd_tree_inlining_anon_aggr_type_p (tree t ATTRIBUTE_UNUSED)
return 0;
}
+/* APPLE LOCAL new tree dump */
+/* Do nothing language hooks for dmp_tree(). */
+void
+lhd_dump_tree_do_nothing (FILE *file ATTRIBUTE_UNUSED,
+ tree node ATTRIBUTE_UNUSED,
+ int indent ATTRIBUTE_UNUSED,
+ int after_id ATTRIBUTE_UNUSED)
+{
+}
+
+int
+lhd_dump_tree_blank_line_do_nothing (tree previous_node ATTRIBUTE_UNUSED,
+ tree current_node ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+lhd_dump_tree_lineno_do_nothing (FILE *file ATTRIBUTE_UNUSED,
+ tree node ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+lhd_dmp_tree3_do_nothing (FILE *file ATTRIBUTE_UNUSED,
+ tree node ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+/* APPLE LOCAL end new tree dump */
+
/* lang_hooks.tree_inlining.start_inlining and end_inlining perform any
language-specific bookkeeping necessary for processing
FN. start_inlining returns nonzero if inlining should proceed, zero if
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index e46bbf54613..a184ae3a821 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -265,6 +265,10 @@ struct lang_hooks
/* Called at the end of compilation, as a finalizer. */
void (*finish) (void);
+ /* APPLE LOCAL Objective-C++ */
+ /* Called at the end of the translation unit. */
+ void (*finish_file) PARAMS ((void));
+
/* Parses the entire file. The argument is nonzero to cause bison
parsers to dump debugging information during parsing. */
void (*parse_file) (int);
@@ -408,6 +412,19 @@ struct lang_hooks
const struct attribute_spec *common_attribute_table;
const struct attribute_spec *format_attribute_table;
+ /* APPLE LOCAL begin new tree dump */
+ /* Called to tree dump language-dependent parts of a class 'd',
+ class 't', IDENTIFIER_NODE nodes, conditional blank lines before
+ statements, and statment line numbers. See dmp-tree.c for
+ documentation. */
+ void (*dump_decl) PARAMS ((FILE *, tree, int, int));
+ void (*dump_type) PARAMS ((FILE *, tree, int, int));
+ void (*dump_identifier) PARAMS ((FILE *, tree, int, int));
+ int (*dump_blank_line_p) PARAMS ((tree, tree));
+ int (*dump_lineno_p) PARAMS ((FILE *, tree));
+ int (*dmp_tree3) PARAMS ((FILE *, tree, int));
+ /* APPLE LOCAL end new tree dump */
+
/* Function-related language hooks. */
struct lang_hooks_for_functions function;
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c
index 34171ad9002..d127df16cd0 100644
--- a/gcc/libgcc2.c
+++ b/gcc/libgcc2.c
@@ -47,6 +47,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#undef abort
#endif
+/* APPLE LOCAL begin libcc_kext */
+#ifdef LIBCC_KEXT
+/* Make aborts into panics (kernel panics presumably) */
+#define abort() panic()
+extern void panic (void);
+#endif
+/* APPLE LOCAL end libcc_kext */
+
#ifdef HAVE_GAS_HIDDEN
#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
#else
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
new file mode 100644
index 00000000000..15dba0bd42d
--- /dev/null
+++ b/gcc/loop-doloop.c
@@ -0,0 +1,502 @@
+/* Perform doloop optimizations
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Based on code by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "flags.h"
+#include "expr.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "toplev.h"
+#include "tm_p.h"
+#include "cfgloop.h"
+#include "output.h"
+#include "params.h"
+
+/* This module is used to modify loops with a determinable number of
+ iterations to use special low-overhead looping instructions.
+
+ It first validates whether the loop is well behaved and has a
+ determinable number of iterations (either at compile or run-time).
+ It then modifies the loop to use a low-overhead looping pattern as
+ follows:
+
+ 1. A pseudo register is allocated as the loop iteration counter.
+
+ 2. The number of loop iterations is calculated and is stored
+ in the loop counter.
+
+ 3. At the end of the loop, the jump insn is replaced by the
+ doloop_end pattern. The compare must remain because it might be
+ used elsewhere. If the loop-variable or condition register are
+ used elsewhere, they will be eliminated by flow.
+
+ 4. An optional doloop_begin pattern is inserted at the top of the
+ loop.
+
+ TODO The optimization should only performed when either the biv used for exit
+ condition is unused at all except for the exit test, or if we do not have to
+ change its value, since otherwise we have to add a new induction variable,
+ which usually will not pay up (unless the cost of the doloop pattern is
+ somehow extremely lower than the cost of compare & jump, or unless the bct
+ register cannot be used for anything else but doloop -- ??? detect these
+ cases). */
+
+#ifdef HAVE_doloop_end
+
+/* Return nonzero if the loop specified by LOOP is suitable for
+ the use of special low-overhead looping instructions. DESC
+ describes the number of iterations of the loop. */
+
+static bool
+doloop_valid_p (struct loop *loop, struct niter_desc *desc)
+{
+ basic_block *body = get_loop_body (loop), bb;
+ rtx insn;
+ unsigned i;
+
+ /* Check for loops that may not terminate under special conditions. */
+ if (!desc->simple_p
+ || desc->assumptions
+ || desc->infinite)
+ {
+ /* There are some cases that would require a special attention.
+ For example if the comparison is LEU and the comparison value
+ is UINT_MAX then the loop will not terminate. Similarly, if the
+ comparison code is GEU and the comparison value is 0, the
+ loop will not terminate.
+
+ If the absolute increment is not 1, the loop can be infinite
+ even with LTU/GTU, e.g. for (i = 3; i > 0; i -= 2)
+
+ Note that with LE and GE, the loop behavior is undefined
+ (C++ standard section 5 clause 5) if an overflow occurs, say
+ between INT_MAX and INT_MAX + 1. We thus don't have to worry
+ about these two cases.
+
+ ??? We could compute these conditions at run-time and have a
+ additional jump around the loop to ensure an infinite loop.
+ However, it is very unlikely that this is the intended
+ behavior of the loop and checking for these rare boundary
+ conditions would pessimize all other code.
+
+ If the loop is executed only a few times an extra check to
+ restart the loop could use up most of the benefits of using a
+ count register loop. Note however, that normally, this
+ restart branch would never execute, so it could be predicted
+ well by the CPU. We should generate the pessimistic code by
+ default, and have an option, e.g. -funsafe-loops that would
+ enable count-register loops in this case. */
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: Possible infinite iteration case.\n");
+ return false;
+ }
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ bb = body[i];
+
+ for (insn = BB_HEAD (bb);
+ insn != NEXT_INSN (BB_END (bb));
+ insn = NEXT_INSN (insn))
+ {
+ /* A called function may clobber any special registers required for
+ low-overhead looping. */
+ if (GET_CODE (insn) == CALL_INSN)
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: Function call in loop.\n");
+ return false;
+ }
+
+ /* Some targets (eg, PPC) use the count register for branch on table
+ instructions. ??? This should be a target specific check. */
+ if (GET_CODE (insn) == JUMP_INSN
+ && (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
+ || GET_CODE (PATTERN (insn)) == ADDR_VEC))
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: Computed branch in the loop.\n");
+ return false;
+ }
+ }
+ }
+ free (body);
+
+ return true;
+}
+
+/* Adds test of COND jumping to DEST to the end of BB. */
+
+static void
+add_test (rtx cond, basic_block bb, basic_block dest)
+{
+ rtx seq, jump, label;
+ enum machine_mode mode;
+ rtx op0 = XEXP (cond, 0), op1 = XEXP (cond, 1);
+ enum rtx_code code = GET_CODE (cond);
+
+ mode = GET_MODE (XEXP (cond, 0));
+ if (mode == VOIDmode)
+ mode = GET_MODE (XEXP (cond, 1));
+
+ start_sequence ();
+ op0 = force_operand (op0, NULL_RTX);
+ op1 = force_operand (op1, NULL_RTX);
+ label = block_label (dest);
+ do_compare_rtx_and_jump (op0, op1, code, 0, mode, NULL_RTX, NULL_RTX, label);
+
+ jump = get_last_insn ();
+ JUMP_LABEL (jump) = label;
+
+ /* The jump is supposed to handle an unlikely special case. */
+ REG_NOTES (jump)
+ = gen_rtx_EXPR_LIST (REG_BR_PROB,
+ GEN_INT (0), REG_NOTES (jump));
+
+ LABEL_NUSES (label)++;
+
+ seq = get_insns ();
+ end_sequence ();
+ emit_insn_after (seq, BB_END (bb));
+}
+
+/* Modify the loop to use the low-overhead looping insn where LOOP
+ describes the loop, DESC describes the number of iterations of the
+ loop, and DOLOOP_INSN is the low-overhead looping insn to emit at the
+ end of the loop. CONDITION is the condition separated from the
+ DOLOOP_SEQ. */
+
+static void
+doloop_modify (struct loop *loop, struct niter_desc *desc,
+ rtx doloop_seq, rtx condition)
+{
+ rtx counter_reg;
+ rtx count, tmp, noloop = NULL_RTX;
+ rtx sequence;
+ rtx jump_insn;
+ rtx jump_label;
+ int nonneg = 0, irr;
+ bool increment_count;
+ basic_block loop_end = desc->out_edge->src;
+
+ jump_insn = BB_END (loop_end);
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "Doloop: Inserting doloop pattern (");
+ if (desc->const_iter)
+ fprintf (dump_file, HOST_WIDEST_INT_PRINT_DEC, desc->niter);
+ else
+ fputs ("runtime", dump_file);
+ fputs (" iterations).\n", dump_file);
+ }
+
+ /* Discard original jump to continue loop. The original compare
+ result may still be live, so it cannot be discarded explicitly. */
+ delete_insn (jump_insn);
+
+ counter_reg = XEXP (condition, 0);
+ if (GET_CODE (counter_reg) == PLUS)
+ counter_reg = XEXP (counter_reg, 0);
+
+ count = desc->niter_expr;
+ increment_count = false;
+ switch (GET_CODE (condition))
+ {
+ case NE:
+ /* Currently only NE tests against zero and one are supported. */
+ if (XEXP (condition, 1) == const1_rtx)
+ {
+ increment_count = true;
+ noloop = const1_rtx;
+ }
+ else if (XEXP (condition, 1) == const0_rtx)
+ noloop = const0_rtx;
+ else
+ abort ();
+ break;
+
+ case GE:
+ /* Currently only GE tests against zero are supported. */
+ if (XEXP (condition, 1) != const0_rtx)
+ abort ();
+
+ noloop = constm1_rtx;
+
+ /* The iteration count does not need incrementing for a GE test. */
+ increment_count = false;
+
+ /* Determine if the iteration counter will be non-negative.
+ Note that the maximum value loaded is iterations_max - 1. */
+ if (desc->niter_max
+ <= ((unsigned HOST_WIDEST_INT) 1
+ << (GET_MODE_BITSIZE (GET_MODE (counter_reg)) - 1)))
+ nonneg = 1;
+ break;
+
+ /* Abort if an invalid doloop pattern has been generated. */
+ default:
+ abort ();
+ }
+
+ if (increment_count)
+ count = simplify_gen_binary (PLUS, desc->mode, count, const1_rtx);
+
+ /* Insert initialization of the count register into the loop header. */
+ start_sequence ();
+ tmp = force_operand (count, counter_reg);
+ convert_move (counter_reg, tmp, 1);
+ sequence = get_insns ();
+ end_sequence ();
+ emit_insn_after (sequence, BB_END (loop_preheader_edge (loop)->src));
+
+ if (desc->noloop_assumptions)
+ {
+ rtx ass = desc->noloop_assumptions;
+ basic_block preheader = loop_preheader_edge (loop)->src;
+ basic_block set_zero
+ = loop_split_edge_with (loop_preheader_edge (loop), NULL_RTX);
+ basic_block new_preheader
+ = loop_split_edge_with (loop_preheader_edge (loop), NULL_RTX);
+ basic_block bb;
+ edge te;
+ gcov_type cnt;
+
+ /* Expand the condition testing the assumptions and if it does not pass,
+ reset the count register to 0. */
+ add_test (XEXP (ass, 0), preheader, set_zero);
+ preheader->succ->flags &= ~EDGE_FALLTHRU;
+ cnt = preheader->succ->count;
+ preheader->succ->probability = 0;
+ preheader->succ->count = 0;
+ irr = preheader->succ->flags & EDGE_IRREDUCIBLE_LOOP;
+ te = make_edge (preheader, new_preheader, EDGE_FALLTHRU | irr);
+ te->probability = REG_BR_PROB_BASE;
+ te->count = cnt;
+ set_immediate_dominator (CDI_DOMINATORS, new_preheader, preheader);
+
+ set_zero->count = 0;
+ set_zero->frequency = 0;
+
+ for (ass = XEXP (ass, 1); ass; ass = XEXP (ass, 1))
+ {
+ bb = loop_split_edge_with (te, NULL_RTX);
+ te = bb->succ;
+ add_test (XEXP (ass, 0), bb, set_zero);
+ make_edge (bb, set_zero, irr);
+ }
+
+ start_sequence ();
+ convert_move (counter_reg, noloop, 0);
+ sequence = get_insns ();
+ end_sequence ();
+ emit_insn_after (sequence, BB_END (set_zero));
+ }
+
+ /* Some targets (eg, C4x) need to initialize special looping
+ registers. */
+#ifdef HAVE_doloop_begin
+ {
+ rtx init;
+ unsigned level = get_loop_level (loop) + 1;
+ init = gen_doloop_begin (counter_reg,
+ desc->const_iter ? desc->niter_expr : const0_rtx,
+ desc->niter_max,
+ GEN_INT (level));
+ if (init)
+ {
+ start_sequence ();
+ emit_insn (init);
+ sequence = get_insns ();
+ end_sequence ();
+ emit_insn_after (sequence, BB_END (loop_preheader_edge (loop)->src));
+ }
+ }
+#endif
+
+ /* Insert the new low-overhead looping insn. */
+ emit_jump_insn_after (doloop_seq, BB_END (loop_end));
+ jump_insn = BB_END (loop_end);
+ jump_label = block_label (desc->in_edge->dest);
+ JUMP_LABEL (jump_insn) = jump_label;
+ LABEL_NUSES (jump_label)++;
+
+ /* Ensure the right fallthru edge is marked, for case we have reversed
+ the condition. */
+ desc->in_edge->flags &= ~EDGE_FALLTHRU;
+ desc->out_edge->flags |= EDGE_FALLTHRU;
+
+ /* Add a REG_NONNEG note if the actual or estimated maximum number
+ of iterations is non-negative. */
+ if (nonneg)
+ {
+ REG_NOTES (jump_insn)
+ = gen_rtx_EXPR_LIST (REG_NONNEG, NULL_RTX, REG_NOTES (jump_insn));
+ }
+}
+
+/* Process loop described by LOOP validating that the loop is suitable for
+ conversion to use a low overhead looping instruction, replacing the jump
+ insn where suitable. Returns true if the loop was successfully
+ modified. */
+
+static bool
+doloop_optimize (struct loop *loop)
+{
+ enum machine_mode mode;
+ rtx doloop_seq, doloop_pat, doloop_reg;
+ rtx iterations;
+ rtx iterations_max;
+ rtx start_label;
+ rtx condition;
+ unsigned level, est_niter;
+ struct niter_desc *desc;
+
+ if (dump_file)
+ fprintf (dump_file, "Doloop: Processing loop %d.\n", loop->num);
+
+ /* Ignore large loops. */
+ if (loop->ninsns > (unsigned) PARAM_VALUE (PARAM_MAX_DOLOOP_INSNS))
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: The loop is too large.\n");
+ return false;
+ }
+
+ iv_analysis_loop_init (loop);
+
+ /* Find the simple exit of a LOOP. */
+ desc = get_simple_loop_desc (loop);
+
+ /* Check that loop is a candidate for a low-overhead looping insn. */
+ if (!doloop_valid_p (loop, desc))
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: The loop is not suitable.\n");
+ return false;
+ }
+ mode = desc->mode;
+
+ est_niter = 3;
+ if (desc->const_iter)
+ est_niter = desc->niter;
+ /* If the estimate on number of iterations is reliable (comes from profile
+ feedback), use it. Do not use it normally, since the expected number
+ of iterations of unrolled loop is 2. */
+ if (loop->header->count)
+ est_niter = expected_loop_iterations (loop);
+
+ if (est_niter < 3)
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: Too few iterations (%u) to be profitable.\n",
+ est_niter);
+ return false;
+ }
+
+ iterations = desc->const_iter ? desc->niter_expr : const0_rtx;
+ iterations_max = GEN_INT (desc->niter_max);
+ level = get_loop_level (loop) + 1;
+
+ /* Generate looping insn. If the pattern FAILs then give up trying
+ to modify the loop since there is some aspect the back-end does
+ not like. */
+ start_label = block_label (desc->in_edge->dest);
+ doloop_reg = gen_reg_rtx (mode);
+ doloop_seq = gen_doloop_end (doloop_reg, iterations, iterations_max,
+ GEN_INT (level), start_label);
+ if (! doloop_seq && mode != word_mode)
+ {
+ PUT_MODE (doloop_reg, word_mode);
+ doloop_seq = gen_doloop_end (doloop_reg, iterations, iterations_max,
+ GEN_INT (level), start_label);
+ }
+ if (! doloop_seq)
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: Target unwilling to use doloop pattern!\n");
+ return false;
+ }
+
+ /* If multiple instructions were created, the last must be the
+ jump instruction. Also, a raw define_insn may yield a plain
+ pattern. */
+ doloop_pat = doloop_seq;
+ if (INSN_P (doloop_pat))
+ {
+ while (NEXT_INSN (doloop_pat) != NULL_RTX)
+ doloop_pat = NEXT_INSN (doloop_pat);
+ if (GET_CODE (doloop_pat) == JUMP_INSN)
+ doloop_pat = PATTERN (doloop_pat);
+ else
+ doloop_pat = NULL_RTX;
+ }
+
+ if (! doloop_pat
+ || ! (condition = doloop_condition_get (doloop_pat)))
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Doloop: Unrecognizable doloop pattern!\n");
+ return false;
+ }
+
+ doloop_modify (loop, desc, doloop_seq, condition);
+ return true;
+}
+
+/* This is the main entry point. Process all LOOPS using doloop_optimize. */
+
+void
+doloop_optimize_loops (struct loops *loops)
+{
+ unsigned i;
+ struct loop *loop;
+
+ for (i = 1; i < loops->num; i++)
+ {
+ loop = loops->parray[i];
+ if (!loop)
+ continue;
+
+ doloop_optimize (loop);
+ }
+
+ iv_analysis_done ();
+
+#ifdef ENABLE_CHECKING
+ verify_dominators (CDI_DOMINATORS);
+ verify_loop_structure (loops);
+#endif
+}
+#endif /* HAVE_doloop_end */
+
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
new file mode 100644
index 00000000000..6d3b7cdf14e
--- /dev/null
+++ b/gcc/loop-invariant.c
@@ -0,0 +1,932 @@
+/* Rtl-level loop invariant motion.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* This implements the loop invariant motion pass. It is very simple
+ (no calls, libcalls, etc.). This should be sufficient to cleanup things like
+ address arithmetics -- other more complicated invariants should be
+ eliminated on tree level either in tree-ssa-loop-im.c or in tree-ssa-pre.c.
+
+ We proceed loop by loop -- it is simpler than trying to handle things
+ globally and should not lose much. First we inspect all sets inside loop
+ and create a dependency graph on insns (saying "to move this insn, you must
+ also move the following insns").
+
+ We then need to determine what to move. We estimate the number of registers
+ used and move as many invariants as possible while we still have enough free
+ registers. We prefer the expensive invariants.
+
+ Then we move the selected invariants out of the loop, creating a new
+ temporaries for them if necessary. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "cfgloop.h"
+#include "expr.h"
+#include "output.h"
+#include "function.h"
+#include "flags.h"
+#include "df.h"
+
+/* The data stored for the loop. */
+
+struct loop_data
+{
+ struct loop *outermost_exit; /* The outermost exit of the loop. */
+ bool has_call; /* True if the loop contains a call. */
+};
+
+#define LOOP_DATA(LOOP) ((struct loop_data *) (LOOP)->aux)
+
+/* The description of an use. */
+
+struct use
+{
+ rtx *pos; /* Position of the use. */
+ rtx insn; /* The insn in that the use occurs. */
+
+ struct use *next; /* Next use in the list. */
+};
+
+/* The description of a def. */
+
+struct def
+{
+ struct use *uses; /* The list of uses that are uniquely reached
+ by it. */
+ unsigned n_uses; /* Number of such uses. */
+ unsigned invno; /* The corresponding invariant. */
+};
+
+/* The data stored for each invariant. */
+
+struct invariant
+{
+ /* The number of the invariant. */
+ unsigned invno;
+
+ /* Whether we already processed the invariant. */
+ bool processed;
+
+ /* The definition of the invariant. */
+ struct def *def;
+
+ /* The insn in that it is defined. */
+ rtx insn;
+
+ /* Whether it is always executed. */
+ bool always_executed;
+
+ /* Whether to move the invariant. */
+ bool move;
+
+ /* Cost if the invariant. */
+ unsigned cost;
+
+ /* The invariants it depends on. */
+ bitmap depends_on;
+
+ /* Used for detecting already visited invariants during determining
+ costs of movements. */
+ unsigned stamp;
+};
+
+/* The actual stamp for marking already visited invariants during determining
+ costs of movements. */
+
+static unsigned actual_stamp;
+
+/* The invariants. */
+
+static varray_type invariants;
+
+/* Test for possibility of invariantness of X. */
+
+static bool
+check_maybe_invariant (rtx x)
+{
+ enum rtx_code code = GET_CODE (x);
+ int i, j;
+ const char *fmt;
+
+ switch (code)
+ {
+ case CONST_INT:
+ case CONST_DOUBLE:
+ case SYMBOL_REF:
+ case CONST:
+ case LABEL_REF:
+ return true;
+
+ case PC:
+ case CC0:
+ case UNSPEC_VOLATILE:
+ return false;
+
+ case REG:
+ if (HARD_REGISTER_P (x))
+ {
+ /* TODO -- handling of hard regs. It should not be hard due to usage
+ of df.c, but don't forget to include patches from the rtlopt branch
+ to speed up handling of call clobbered registers. */
+ return false;
+ }
+
+ return true;
+
+ case MEM:
+ /* Load/store motion is done elsewhere. ??? Perhaps also add it here?
+ It should not be hard, and might be faster than "elsewhere". */
+ return false;
+
+ case ASM_OPERANDS:
+ /* Don't mess with insns declared volatile. */
+ if (MEM_VOLATILE_P (x))
+ return false;
+ break;
+
+ default:
+ break;
+ }
+
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ if (fmt[i] == 'e')
+ {
+ if (!check_maybe_invariant (XEXP (x, i)))
+ return false;
+ }
+ else if (fmt[i] == 'E')
+ {
+ for (j = 0; j < XVECLEN (x, i); j++)
+ if (!check_maybe_invariant (XVECEXP (x, i, j)))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/* Determines the basic blocks inside LOOP that are always executed and
+ stores their bitmap to ALWAYS_REACHED. MAY_EXIT is a bitmap of
+ basic blocks that may either exit the loop, or contain the call that
+ does not have to return. BODY is body of the loop obtained by
+ get_loop_body_in_dom_order. */
+
+static void
+compute_always_reached (struct loop *loop, basic_block *body,
+ bitmap may_exit, bitmap always_reached)
+{
+ unsigned i;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ if (dominated_by_p (CDI_DOMINATORS, loop->latch, body[i]))
+ bitmap_set_bit (always_reached, i);
+
+ if (bitmap_bit_p (may_exit, i))
+ return;
+ }
+}
+
+/* Finds exits out of the LOOP with body BODY. Marks blocks in that we may
+ exit the loop by cfg edge to HAS_EXIT and MAY_EXIT. In MAY_EXIT
+ additionally mark blocks that may exit due to a call. */
+
+static void
+find_exits (struct loop *loop, basic_block *body,
+ bitmap may_exit, bitmap has_exit)
+{
+ unsigned i;
+ edge e;
+ struct loop *outermost_exit = loop, *aexit;
+ bool has_call = false;
+ rtx insn;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ if (body[i]->loop_father == loop)
+ {
+ FOR_BB_INSNS (body[i], insn)
+ {
+ if (GET_CODE (insn) == CALL_INSN
+ && !CONST_OR_PURE_CALL_P (insn))
+ {
+ has_call = true;
+ bitmap_set_bit (may_exit, i);
+ break;
+ }
+ }
+
+ for (e = body[i]->succ; e; e = e->succ_next)
+ {
+ if (flow_bb_inside_loop_p (loop, e->dest))
+ continue;
+
+ bitmap_set_bit (may_exit, i);
+ bitmap_set_bit (has_exit, i);
+ outermost_exit = find_common_loop (outermost_exit,
+ e->dest->loop_father);
+ }
+ continue;
+ }
+
+ /* Use the data stored for the subloop to decide whether we may exit
+ through it. It is sufficient to do this for header of the loop,
+ as other basic blocks inside it must be dominated by it. */
+ if (body[i]->loop_father->header != body[i])
+ continue;
+
+ if (LOOP_DATA (body[i]->loop_father)->has_call)
+ {
+ has_call = true;
+ bitmap_set_bit (may_exit, i);
+ }
+ aexit = LOOP_DATA (body[i]->loop_father)->outermost_exit;
+ if (aexit != loop)
+ {
+ bitmap_set_bit (may_exit, i);
+ bitmap_set_bit (has_exit, i);
+
+ if (flow_loop_nested_p (aexit, outermost_exit))
+ outermost_exit = aexit;
+ }
+ }
+
+ loop->aux = xcalloc (1, sizeof (struct loop_data));
+ LOOP_DATA (loop)->outermost_exit = outermost_exit;
+ LOOP_DATA (loop)->has_call = has_call;
+}
+
+/* Check whether we may assign a value to X from a register. */
+
+static bool
+may_assign_reg_p (rtx x ATTRIBUTE_UNUSED)
+{
+#ifdef AVOID_CCMODE_COPIES
+ if (GET_MODE_CLASS (GET_MODE (x)) == MODE_CC)
+ return false;
+#endif
+
+ return true;
+}
+
+/* Finds definitions that may correspond to invariants in LOOP with body BODY.
+ DF is the dataflow object. */
+
+static void
+find_defs (struct loop *loop, basic_block *body, struct df *df)
+{
+ unsigned i;
+ bitmap blocks = BITMAP_XMALLOC ();
+
+ for (i = 0; i < loop->num_nodes; i++)
+ bitmap_set_bit (blocks, body[i]->index);
+
+ df_analyze_subcfg (df, blocks, DF_UD_CHAIN);
+ BITMAP_XFREE (blocks);
+}
+
+/* Creates a new invariant for definition DEF in INSN, depending on invariants
+ in DEPENDS_ON. ALWAYS_EXECUTED is true if the insn is always executed,
+ unless the program ends due to a function call. */
+
+static void
+create_new_invariant (struct def *def, rtx insn, bitmap depends_on,
+ bool always_executed)
+{
+ struct invariant *inv = xmalloc (sizeof (struct invariant));
+ rtx set = single_set (insn);
+
+ inv->def = def;
+ inv->always_executed = always_executed;
+ inv->depends_on = depends_on;
+
+ /* If the set is simple, usually by moving it we move the whole store out of
+ the loop. Otherwise we save only cost of the computation. */
+ if (def)
+ inv->cost = rtx_cost (set, SET);
+ else
+ inv->cost = rtx_cost (SET_SRC (set), SET);
+
+ inv->move = false;
+ inv->processed = false;
+ inv->stamp = 0;
+ inv->insn = insn;
+
+ inv->invno = VARRAY_ACTIVE_SIZE (invariants);
+ if (def)
+ def->invno = inv->invno;
+ VARRAY_PUSH_GENERIC_PTR_NOGC (invariants, inv);
+
+ if (dump_file)
+ {
+ fprintf (dump_file,
+ "Set in insn %d is invariant (%d), cost %d, depends on ",
+ INSN_UID (insn), inv->invno, inv->cost);
+ dump_bitmap (dump_file, inv->depends_on);
+ }
+}
+
+/* Record USE at DEF. */
+
+static void
+record_use (struct def *def, rtx *use, rtx insn)
+{
+ struct use *u = xmalloc (sizeof (struct use));
+
+ if (GET_CODE (*use) == SUBREG)
+ use = &SUBREG_REG (*use);
+ if (!REG_P (*use))
+ abort ();
+
+ u->pos = use;
+ u->insn = insn;
+ u->next = def->uses;
+ def->uses = u;
+ def->n_uses++;
+}
+
+/* Finds the invariants INSN depends on and store them to the DEPENDS_ON
+ bitmap. DF is the dataflow object. */
+
+static bool
+check_dependencies (rtx insn, struct df *df, bitmap depends_on)
+{
+ struct df_link *uses, *defs;
+ struct ref *use, *def;
+ basic_block bb = BLOCK_FOR_INSN (insn), def_bb;
+ struct def *def_data;
+
+ for (uses = DF_INSN_USES (df, insn); uses; uses = uses->next)
+ {
+ use = uses->ref;
+
+ defs = DF_REF_CHAIN (use);
+ if (!defs)
+ continue;
+
+ if (defs->next)
+ return false;
+
+ def = defs->ref;
+ def_data = DF_REF_DATA (def);
+ if (!def_data)
+ return false;
+
+ def_bb = DF_REF_BB (def);
+ if (!dominated_by_p (CDI_DOMINATORS, bb, def_bb))
+ return false;
+
+ bitmap_set_bit (depends_on, def_data->invno);
+ }
+
+ return true;
+}
+
+/* Finds invariant in INSN. ALWAYS_REACHED is true if the insn is always
+ executed. ALWAYS_EXECUTED is true if the insn is always executed,
+ unless the program ends due to a function call. DF is the dataflow
+ object. */
+
+static void
+find_invariant_insn (rtx insn, bool always_reached, bool always_executed,
+ struct df *df)
+{
+ struct ref *ref;
+ struct def *def;
+ bitmap depends_on;
+ rtx set, dest;
+ bool simple = true;
+
+ /* Until we get rid of LIBCALLS. */
+ if (find_reg_note (insn, REG_RETVAL, NULL_RTX)
+ || find_reg_note (insn, REG_LIBCALL, NULL_RTX)
+ || find_reg_note (insn, REG_NO_CONFLICT, NULL_RTX))
+ return;
+
+ set = single_set (insn);
+ if (!set)
+ return;
+ dest = SET_DEST (set);
+
+ if (GET_CODE (dest) != REG
+ || HARD_REGISTER_P (dest))
+ simple = false;
+
+ if (!check_maybe_invariant (SET_SRC (set))
+ || !may_assign_reg_p (SET_DEST (set)))
+ return;
+
+ if (!always_reached
+ && may_trap_p (insn))
+ return;
+
+ depends_on = BITMAP_XMALLOC ();
+ if (!check_dependencies (insn, df, depends_on))
+ {
+ BITMAP_XFREE (depends_on);
+ return;
+ }
+
+ if (simple)
+ {
+ ref = df_find_def (df, insn, dest);
+ def = xcalloc (1, sizeof (struct def));
+ DF_REF_DATA (ref) = def;
+ }
+ else
+ def = NULL;
+
+ create_new_invariant (def, insn, depends_on, always_executed);
+}
+
+/* Record registers used in INSN that have an unique invariant definition.
+ DF is the dataflow object. */
+
+static void
+record_uses (rtx insn, struct df *df)
+{
+ struct df_link *uses, *defs;
+ struct ref *use, *def;
+ basic_block bb = BLOCK_FOR_INSN (insn), def_bb;
+
+ for (uses = DF_INSN_USES (df, insn); uses; uses = uses->next)
+ {
+ use = uses->ref;
+
+ defs = DF_REF_CHAIN (use);
+ if (!defs || defs->next)
+ continue;
+ def = defs->ref;
+ if (!DF_REF_DATA (def))
+ continue;
+
+ def_bb = DF_REF_BB (def);
+ if (!dominated_by_p (CDI_DOMINATORS, bb, def_bb))
+ continue;
+
+ record_use (DF_REF_DATA (def), DF_REF_LOC (use), DF_REF_INSN (use));
+ }
+}
+
+/* Finds invariants in INSN. ALWAYS_REACHED is true if the insn is always
+ executed. ALWAYS_EXECUTED is true if the insn is always executed,
+ unless the program ends due to a function call. DF is the dataflow
+ object. */
+
+static void
+find_invariants_insn (rtx insn, bool always_reached, bool always_executed,
+ struct df *df)
+{
+ find_invariant_insn (insn, always_reached, always_executed, df);
+ record_uses (insn, df);
+}
+
+/* Finds invariants in basic block BB. ALWAYS_REACHED is true if the
+ basic block is always executed. ALWAYS_EXECUTED is true if the basic
+ block is always executed, unless the program ends due to a function
+ call. DF is the dataflow object. */
+
+static void
+find_invariants_bb (basic_block bb, bool always_reached, bool always_executed,
+ struct df *df)
+{
+ rtx insn;
+
+ FOR_BB_INSNS (bb, insn)
+ {
+ if (!INSN_P (insn))
+ continue;
+
+ find_invariants_insn (insn, always_reached, always_executed, df);
+
+ if (always_reached
+ && GET_CODE (insn) == CALL_INSN
+ && !CONST_OR_PURE_CALL_P (insn))
+ always_reached = false;
+ }
+}
+
+/* Finds invariants in LOOP with body BODY. ALWAYS_REACHED is the bitmap of
+ basic blocks in BODY that are always executed. ALWAYS_EXECUTED is the
+ bitmap of basic blocks in BODY that are always executed unless the program
+ ends due to a function call. DF is the dataflow object. */
+
+static void
+find_invariants_body (struct loop *loop, basic_block *body,
+ bitmap always_reached, bitmap always_executed,
+ struct df *df)
+{
+ unsigned i;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ find_invariants_bb (body[i],
+ bitmap_bit_p (always_reached, i),
+ bitmap_bit_p (always_executed, i),
+ df);
+}
+
+/* Finds invariants in LOOP. DF is the dataflow object. */
+
+static void
+find_invariants (struct loop *loop, struct df *df)
+{
+ bitmap may_exit = BITMAP_XMALLOC ();
+ bitmap always_reached = BITMAP_XMALLOC ();
+ bitmap has_exit = BITMAP_XMALLOC ();
+ bitmap always_executed = BITMAP_XMALLOC ();
+ basic_block *body = get_loop_body_in_dom_order (loop);
+
+ find_exits (loop, body, may_exit, has_exit);
+ compute_always_reached (loop, body, may_exit, always_reached);
+ compute_always_reached (loop, body, has_exit, always_executed);
+
+ find_defs (loop, body, df);
+ find_invariants_body (loop, body, always_reached, always_executed, df);
+
+ BITMAP_XFREE (always_reached);
+ BITMAP_XFREE (always_executed);
+ BITMAP_XFREE (may_exit);
+ BITMAP_XFREE (has_exit);
+ free (body);
+}
+
+/* Frees a list of uses USE. */
+
+static void
+free_use_list (struct use *use)
+{
+ struct use *next;
+
+ for (; use; use = next)
+ {
+ next = use->next;
+ free (use);
+ }
+}
+
+/* Calculates cost and number of registers needed for moving invariant INV
+ out of the loop and stores them to *COST and *REGS_NEEDED. */
+
+static void
+get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed)
+{
+ int acomp_cost;
+ unsigned aregs_needed;
+ unsigned depno;
+ struct invariant *dep;
+
+ *comp_cost = 0;
+ *regs_needed = 0;
+ if (inv->move
+ || inv->stamp == actual_stamp)
+ return;
+ inv->stamp = actual_stamp;
+
+ (*regs_needed)++;
+ (*comp_cost) += inv->cost;
+
+ EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, depno,
+ {
+ dep = VARRAY_GENERIC_PTR_NOGC (invariants, depno);
+
+ get_inv_cost (dep, &acomp_cost, &aregs_needed);
+
+ if (aregs_needed
+ /* We need to check always_executed, since if the original value of
+ the invariant may be preserved, we may need to keep it in a
+ separate register. TODO check whether the register has an
+ use outside of the loop. */
+ && dep->always_executed
+ && !dep->def->uses->next)
+ {
+ /* If this is a single use, after moving the dependency we will not
+ need a new register. */
+ aregs_needed--;
+ }
+
+ (*regs_needed) += aregs_needed;
+ (*comp_cost) += acomp_cost;
+ });
+}
+
+/* Calculates gain for eliminating invariant INV. REGS_USED is the number
+ of registers used in the loop, N_INV_USES is the number of uses of
+ invariants, NEW_REGS is the number of new variables already added due to
+ the invariant motion. The number of registers needed for it is stored in
+ *REGS_NEEDED. */
+
+static int
+gain_for_invariant (struct invariant *inv, unsigned *regs_needed,
+ unsigned new_regs, unsigned regs_used, unsigned n_inv_uses)
+{
+ int comp_cost, size_cost;
+
+ get_inv_cost (inv, &comp_cost, regs_needed);
+ actual_stamp++;
+
+ size_cost = (global_cost_for_size (new_regs + *regs_needed,
+ regs_used, n_inv_uses)
+ - global_cost_for_size (new_regs, regs_used, n_inv_uses));
+
+ return comp_cost - size_cost;
+}
+
+/* Finds invariant with best gain for moving. Returns the gain, stores
+ the invariant in *BEST and number of registers needed for it to
+ *REGS_NEEDED. REGS_USED is the number of registers used in
+ the loop, N_INV_USES is the number of uses of invariants. NEW_REGS
+ is the number of new variables already added due to invariant motion. */
+
+static int
+best_gain_for_invariant (struct invariant **best, unsigned *regs_needed,
+ unsigned new_regs, unsigned regs_used,
+ unsigned n_inv_uses)
+{
+ struct invariant *inv;
+ int gain = 0, again;
+ unsigned aregs_needed, invno;
+
+ for (invno = 0; invno < VARRAY_ACTIVE_SIZE (invariants); invno++)
+ {
+ inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno);
+ if (inv->move)
+ continue;
+
+ again = gain_for_invariant (inv, &aregs_needed,
+ new_regs, regs_used, n_inv_uses);
+ if (again > gain)
+ {
+ gain = again;
+ *best = inv;
+ *regs_needed = aregs_needed;
+ }
+ }
+
+ return gain;
+}
+
+/* Marks invariant INVNO and all its dependencies for moving. */
+
+static void
+set_move_mark (unsigned invno)
+{
+ struct invariant *inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno);
+
+ if (inv->move)
+ return;
+ inv->move = true;
+
+ if (dump_file)
+ fprintf (dump_file, "Decided to move invariant %d\n", invno);
+
+ EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, invno, set_move_mark (invno));
+}
+
+/* Determines which invariants to move. DF is the dataflow object. */
+
+static void
+find_invariants_to_move (struct df *df)
+{
+ unsigned i, regs_used, n_inv_uses, regs_needed = 0, new_regs;
+ struct invariant *inv = NULL;
+
+ if (flag_move_all_movables)
+ {
+ /* This is easy & stupid. */
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
+ {
+ inv = VARRAY_GENERIC_PTR_NOGC (invariants, i);
+ inv->move = true;
+ }
+ return;
+ }
+
+ if (!VARRAY_ACTIVE_SIZE (invariants))
+ return;
+
+ /* Now something slightly more involved. First estimate the number of used
+ registers. */
+ n_inv_uses = 0;
+
+ /* We do not really do a good job in this estimation; put some initial bound
+ here to stand for induction variables etc. that we do not detect. */
+ regs_used = 2;
+
+ for (i = 0; i < df->n_regs; i++)
+ {
+ if (!DF_REGNO_FIRST_DEF (df, i) && DF_REGNO_LAST_USE (df, i))
+ {
+ /* This is a value that is used but not changed inside loop. */
+ regs_used++;
+ }
+ }
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
+ {
+ inv = VARRAY_GENERIC_PTR_NOGC (invariants, i);
+ if (inv->def)
+ n_inv_uses += inv->def->n_uses;
+ }
+
+ new_regs = 0;
+ while (best_gain_for_invariant (&inv, &regs_needed,
+ new_regs, regs_used, n_inv_uses) > 0)
+ {
+ set_move_mark (inv->invno);
+ new_regs += regs_needed;
+ }
+}
+
+/* Move invariant INVNO out of the LOOP. DF is the dataflow object. */
+
+static void
+move_invariant_reg (struct loop *loop, unsigned invno, struct df *df)
+{
+ struct invariant *inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno);
+ unsigned i;
+ basic_block preheader = loop_preheader_edge (loop)->src;
+ rtx reg, set;
+ struct use *use;
+
+ if (inv->processed)
+ return;
+ inv->processed = true;
+
+ if (inv->depends_on)
+ {
+ EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, i,
+ {
+ move_invariant_reg (loop, i, df);
+ });
+ }
+
+ /* Move the set out of the loop. If the set is always executed (we could
+ omit this condition if we know that the register is unused outside of the
+ loop, but it does not seem worth finding out) and it has no uses that
+ would not be dominated by it, we may just move it (TODO). Otherwise we
+ need to create a temporary register. */
+ set = single_set (inv->insn);
+ reg = gen_reg_rtx (GET_MODE (SET_DEST (set)));
+ df_pattern_emit_after (df, gen_move_insn (SET_DEST (set), reg),
+ BLOCK_FOR_INSN (inv->insn), inv->insn);
+ SET_DEST (set) = reg;
+ reorder_insns (inv->insn, inv->insn, BB_END (preheader));
+ df_insn_modify (df, preheader, inv->insn);
+
+ /* Replace the uses we know to be dominated. It saves work for copy
+ propagation, and also it is necessary so that dependent invariants
+ are computed right. */
+ if (inv->def)
+ {
+ for (use = inv->def->uses; use; use = use->next)
+ {
+ *use->pos = reg;
+ df_insn_modify (df, BLOCK_FOR_INSN (use->insn), use->insn);
+ }
+ }
+}
+
+/* Move selected invariant out of the LOOP. Newly created regs are marked
+ in TEMPORARY_REGS. DF is the dataflow object. */
+
+static void
+move_invariants (struct loop *loop, struct df *df)
+{
+ struct invariant *inv;
+ unsigned i;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
+ {
+ inv = VARRAY_GENERIC_PTR_NOGC (invariants, i);
+ if (inv->move)
+ move_invariant_reg (loop, i, df);
+ }
+}
+
+/* Initializes invariant motion data. */
+
+static void
+init_inv_motion_data (void)
+{
+ actual_stamp = 1;
+
+ if (!invariants)
+ VARRAY_GENERIC_PTR_NOGC_INIT (invariants, 100, "invariants");
+}
+
+/* Frees the data allocated by invariant motion. DF is the dataflow
+ object. */
+
+static void
+free_inv_motion_data (struct df *df)
+{
+ unsigned i;
+ struct def *def;
+ struct invariant *inv;
+
+ for (i = 0; i < df->n_defs; i++)
+ {
+ if (!df->defs[i])
+ continue;
+
+ def = DF_REF_DATA (df->defs[i]);
+ if (!def)
+ continue;
+
+ free_use_list (def->uses);
+ free (def);
+ DF_REF_DATA (df->defs[i]) = NULL;
+ }
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
+ {
+ inv = VARRAY_GENERIC_PTR_NOGC (invariants, i);
+ BITMAP_XFREE (inv->depends_on);
+ free (inv);
+ }
+ VARRAY_POP_ALL (invariants);
+}
+
+/* Move the invariants out of the LOOP. DF is the dataflow object. */
+
+static void
+move_single_loop_invariants (struct loop *loop, struct df *df)
+{
+ init_inv_motion_data ();
+
+ find_invariants (loop, df);
+ find_invariants_to_move (df);
+ move_invariants (loop, df);
+
+ free_inv_motion_data (df);
+}
+
+/* Releases the auxiliary data for LOOP. */
+
+static void
+free_loop_data (struct loop *loop)
+{
+ struct loop_data *data = LOOP_DATA (loop);
+
+ free (data);
+ loop->aux = NULL;
+}
+
+/* Move the invariants out of the LOOPS. */
+
+void
+move_loop_invariants (struct loops *loops)
+{
+ struct loop *loop;
+ unsigned i;
+ struct df *df = df_init ();
+
+ /* Process the loops, innermost first. */
+ loop = loops->tree_root;
+ while (loop->inner)
+ loop = loop->inner;
+
+ while (loop != loops->tree_root)
+ {
+ move_single_loop_invariants (loop, df);
+
+ if (loop->next)
+ {
+ loop = loop->next;
+ while (loop->inner)
+ loop = loop->inner;
+ }
+ else
+ loop = loop->outer;
+ }
+
+ for (i = 1; i < loops->num; i++)
+ if (loops->parray[i])
+ free_loop_data (loops->parray[i]);
+
+ df_finish (df);
+}
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 97cfdf7c07e..dd9f06ebddb 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -1874,7 +1874,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
enum rtx_code cond;
enum machine_mode mode, comp_mode;
rtx mmin, mmax;
- unsigned HOST_WIDEST_INT s, size, d;
+ unsigned HOST_WIDEST_INT s, size, d, inv;
HOST_WIDEST_INT up, down, inc;
int was_sharp = false;
@@ -2186,8 +2186,9 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
desc->infinite = alloc_EXPR_LIST (0, assumption, desc->infinite);
tmp = simplify_gen_binary (UDIV, mode, tmp1, GEN_INT (d));
- tmp = simplify_gen_binary (MULT, mode,
- tmp, GEN_INT (inverse (s, size)));
+ inv = inverse (s, size);
+ inv = trunc_int_for_mode (inv, mode);
+ tmp = simplify_gen_binary (MULT, mode, tmp, GEN_INT (inv));
desc->niter_expr = simplify_gen_binary (AND, mode, tmp, bound);
}
else
@@ -2281,6 +2282,10 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
simplify_using_initial_values (loop, IOR, &desc->infinite);
simplify_using_initial_values (loop, NIL, &desc->niter_expr);
+ if (desc->noloop_assumptions
+ && XEXP (desc->noloop_assumptions, 0) == const_true_rtx)
+ goto zero_iter;
+
if (GET_CODE (desc->niter_expr) == CONST_INT)
{
unsigned HOST_WIDEST_INT val = INTVAL (desc->niter_expr);
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 74957a76ee4..e4b93a20ed5 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -737,7 +737,7 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags)
"computable number of iterations\n");
/* nunroll = total number of copies of the original loop body in
- unrolled loop (i.e. if it is 2, we have to duplicate loop body once. */
+ unrolled loop (i.e. if it is 2, we have to duplicate loop body once). */
nunroll = PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) / loop->ninsns;
nunroll_by_av = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLED_INSNS) / loop->av_ninsns;
if (nunroll > nunroll_by_av)
@@ -1241,7 +1241,7 @@ decide_unroll_stupid (struct loop *loop, int flags)
loop->lpt_decision.decision = LPT_UNROLL_STUPID;
loop->lpt_decision.times = i - 1;
-
+
if (dump_file)
fprintf (dump_file,
";; Decided to unroll the loop stupidly, %d times.\n",
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index a056841ef8a..93f07334f90 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -370,7 +370,7 @@ unswitch_single_loop (struct loops *loops, struct loop *loop,
/* Unswitch the loop on this condition. */
nloop = unswitch_loop (loops, loop, bbs[i], cond, cinsn);
if (!nloop)
- abort ();
+ abort ();
/* Invoke itself on modified loops. */
unswitch_single_loop (loops, nloop, rconds, num + 1);
@@ -463,7 +463,7 @@ unswitch_loop (struct loops *loops, struct loop *loop, basic_block unswitch_on,
/* Loopify from the copy of LOOP body, constructing the new loop. */
nloop = loopify (loops, latch_edge,
- loop->header->rbi->copy->pred, switch_bb);
+ loop->header->rbi->copy->pred, switch_bb, true);
/* Remove branches that are now unreachable in new loops. */
remove_path (loops, true_edge);
diff --git a/gcc/loop.c b/gcc/loop.c
index 5d458cbabc8..0ac3717bebf 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -154,12 +154,25 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define PREFETCH_CONDITIONAL 1
#endif
+/* APPLE LOCAL begin avoid out-of-bounds refs */
+/* If the first or last uid lies outside the loop, assume the
+ lifetime extends to that end of the loop. */
#define LOOP_REG_LIFETIME(LOOP, REGNO) \
-((REGNO_LAST_LUID (REGNO) - REGNO_FIRST_LUID (REGNO)))
-
+(((REGNO_LAST_UID (REGNO) > max_uid_for_loop) \
+ ? (INSN_LUID ((LOOP)->end)) \
+ : (REGNO_LAST_LUID (REGNO))) \
+ - ((REGNO_FIRST_UID (REGNO) > max_uid_for_loop) \
+ ? (INSN_LUID ((LOOP)->start)) \
+ : (REGNO_FIRST_LUID (REGNO))))
+
+/* uid's that are too big are derived from nested loops and are
+ not referenced outside this loop, hence they are not global. */
#define LOOP_REG_GLOBAL_P(LOOP, REGNO) \
-((REGNO_LAST_LUID (REGNO) > INSN_LUID ((LOOP)->end) \
- || REGNO_FIRST_LUID (REGNO) < INSN_LUID ((LOOP)->start)))
+((REGNO_LAST_UID (REGNO) > max_uid_for_loop) ? 0 : \
+(((REGNO_FIRST_UID (REGNO) > max_uid_for_loop) ? 0 : \
+((((REGNO_LAST_LUID (REGNO) > INSN_LUID ((LOOP)->end) \
+ || REGNO_FIRST_LUID (REGNO) < INSN_LUID ((LOOP)->start))))))))
+/* APPLE LOCAL end avoid out-of-bounds refs */
#define LOOP_REGNO_NREGS(REGNO, SET_DEST) \
((REGNO) < FIRST_PSEUDO_REGISTER \
@@ -1541,6 +1554,8 @@ combine_movables (struct loop_movables *movables, struct loop_regs *regs)
&& GET_MODE_CLASS (GET_MODE (m1->set_dest)) == MODE_INT
&& (GET_MODE_BITSIZE (GET_MODE (m->set_dest))
>= GET_MODE_BITSIZE (GET_MODE (m1->set_dest)))))
+ /* APPLE LOCAL combine hoisted consts */
+ && m1->regno >= FIRST_PSEUDO_REGISTER
/* See if the source of M1 says it matches M. */
&& ((GET_CODE (m1->set_src) == REG
&& matched_regs[REGNO (m1->set_src)])
@@ -3323,7 +3338,7 @@ loop_invariant_p (const struct loop *loop, rtx x)
We don't know the loop bounds here though, so just fail for all
labels. */
- if (flag_old_unroll_loops)
+ if (flag_unroll_loops)
return 0;
else
return 1;
@@ -4699,13 +4714,26 @@ loop_givs_reduce (struct loop *loop, struct iv_class *bl)
this is an address giv, then try to put the increment
immediately after its use, so that flow can create an
auto-increment addressing mode. */
+ /* APPLE LOCAL begin check loop->top */
+ /* Don't do this for loops entered at the bottom, to avoid
+ this invalid transformation:
+ jmp L; -> jmp L;
+ TOP: TOP:
+ use giv use giv
+ L: inc giv
+ inc biv L:
+ test biv test giv
+ cbr TOP cbr TOP
+ */
if (v->giv_type == DEST_ADDR && bl->biv_count == 1
&& bl->biv->always_executed && ! bl->biv->maybe_multiple
/* We don't handle reversed biv's because bl->biv->insn
does not have a valid INSN_LUID. */
&& ! bl->reversed
&& v->always_executed && ! v->maybe_multiple
- && INSN_UID (v->insn) < max_uid_for_loop)
+ && INSN_UID (v->insn) < max_uid_for_loop
+ && !loop->top)
+ /* APPLE LOCAL end check loop->top */
{
/* If other giv's have been combined with this one, then
this will work only if all uses of the other giv's occur
@@ -4986,6 +5014,24 @@ loop_giv_reduce_benefit (struct loop *loop ATTRIBUTE_UNUSED,
determining code size than run-time benefits. */
benefit -= add_cost * bl->biv_count;
+ /* APPLE LOCAL better induction variable selection */
+#ifdef TARGET_POWERPC
+ /* Adjust this computation to allow for the likelihood that the
+ original increment of the biv will be deleted. This permits
+ induction variables to be selected correctly in simple
+ cases like for(i){a[i]=42;} Without this, choice of induction
+ variables is sensitive to whether the relative stack offset of
+ a is 0 or not(!) On x86 it is probably superior to be more
+ conservative, as there aren't enough registers. */
+ if ( v->replaceable && bl->eliminable )
+ {
+ int orig_add_cost = iv_add_mult_cost (bl->biv->add_val,
+ bl->biv->mult_val, test_reg, test_reg);
+ benefit += orig_add_cost * bl->biv_count;
+ }
+#endif
+ /* APPLE LOCAL end better induction variable selection */
+
/* Decide whether to strength-reduce this giv or to leave the code
unchanged (recompute it from the biv each time it is used). This
decision can be made independently for each giv. */
@@ -4998,7 +5044,8 @@ loop_giv_reduce_benefit (struct loop *loop ATTRIBUTE_UNUSED,
/* Increasing the benefit is risky, since this is only a guess.
Avoid increasing register pressure in cases where there would
be no other benefit from reducing this giv. */
- && benefit > 0
+ /* APPLE LOCAL compare >= 0, not > 0. */
+ && benefit >= 0
&& GET_CODE (v->mult_val) == CONST_INT)
{
int size = GET_MODE_SIZE (GET_MODE (v->mem));
@@ -5288,10 +5335,25 @@ strength_reduce (struct loop *loop, int flags)
value, so we don't need another one. We can't calculate the
proper final value for such a biv here anyways. */
if (bl->final_value && ! bl->reversed)
- loop_insn_sink_or_swim (loop,
- gen_load_of_final_value (bl->biv->dest_reg,
- bl->final_value));
-
+ /* APPLE LOCAL begin put this insn after the loop in all cases */
+ /* Putting it before the loop can cause problems in an
+ obscure case. "a" is the variable we're currently
+ looking at:
+ b <- a
+ loop beginning
+ b++; and references
+ a++; no references
+ if we put the final value for a before the loop, then
+ eliminate b in favor of c later on, we'll get this
+ before the loop:
+ b <- a
+ a <- final value
+ c <- a
+ which is no good. */
+ loop_insn_sink (loop, gen_load_of_final_value (bl->biv->dest_reg,
+ bl->final_value));
+ /* APPLE LOCAL end put this insn after the loop in all cases */
+
if (loop_dump_stream)
fprintf (loop_dump_stream, "Reg %d: biv eliminated\n",
bl->regno);
@@ -5352,23 +5414,6 @@ strength_reduce (struct loop *loop, int flags)
&& unrolled_insn_copies <= insn_count))
unroll_loop (loop, insn_count, 1);
-#ifdef HAVE_doloop_end
- if (HAVE_doloop_end && (flags & LOOP_BCT) && flag_branch_on_count_reg)
- doloop_optimize (loop);
-#endif /* HAVE_doloop_end */
-
- /* In case number of iterations is known, drop branch prediction note
- in the branch. Do that only in second loop pass, as loop unrolling
- may change the number of iterations performed. */
- if (flags & LOOP_BCT)
- {
- unsigned HOST_WIDE_INT n
- = loop_info->n_iterations / loop_info->unroll_number;
- if (n > 1)
- predict_insn (prev_nonnote_insn (loop->end), PRED_LOOP_ITERATIONS,
- REG_BR_PROB_BASE - REG_BR_PROB_BASE / n);
- }
-
if (loop_dump_stream)
fprintf (loop_dump_stream, "\n");
diff --git a/gcc/loop.h b/gcc/loop.h
index 2a7f3ec816e..bd88bb8c90e 100644
--- a/gcc/loop.h
+++ b/gcc/loop.h
@@ -26,9 +26,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Flags passed to loop_optimize. */
#define LOOP_UNROLL 1
-#define LOOP_BCT 2
-#define LOOP_PREFETCH 4
-#define LOOP_AUTO_UNROLL 8
+#define LOOP_PREFETCH 2
+#define LOOP_AUTO_UNROLL 4
/* Get the loop info pointer of a loop. */
#define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux)
diff --git a/gcc/mkinstalldirs b/gcc/mkinstalldirs
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/gcc/mkinstalldirs
diff --git a/gcc/move-if-change b/gcc/move-if-change
new file mode 100755
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/gcc/move-if-change
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in
index 12a20569c67..ecb35b19b5f 100644
--- a/gcc/objc/Make-lang.in
+++ b/gcc/objc/Make-lang.in
@@ -49,12 +49,23 @@ objc-warn = $(STRICT_WARN)
# Bison-1.75 output yields (harmless) -Wtraditional warnings
objc/objc-parse.o-warn = -Wno-error
+# APPLE LOCAL begin order files ilr
+ifeq ($(ORDER_FILES),yes)
+CC1OBJ_ORDER_FLAGS = `if [ -f $(srcdir)/../order-files/cc1obj.order ]; then \
+ echo -sectorder __TEXT __text $(srcdir)/../order-files/cc1obj.order -e start ; fi`
+else
+CC1OBJ_ORDER_FLAGS =
+endif
+# APPLE LOCAL end order files ilr
+
# Language-specific object files for Objective C.
OBJC_OBJS = objc/objc-lang.o objc/objc-parse.o objc/objc-act.o
+# APPLE LOCAL order files ilr
cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBS)
+ $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBS) \
+ $(CC1OBJ_ORDER_FLAGS)
# Objective C language specific files.
@@ -83,7 +94,24 @@ objc/objc-parse.y: c-parse.in
echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y
sed -e "/^@@ifc.*/,/^@@end_ifc.*/d" \
-e "/^@@ifobjc.*/d" -e "/^@@end_ifobjc.*/d" < $< >>tmp-objc-prs.y
- $(SHELL) $(srcdir)/../move-if-change tmp-objc-prs.y $@
+ $(SHELL) $(srcdir)/move-if-change tmp-objc-prs.y $@
+
+# APPLE LOCAL debugging
+objc/objc-idebug.o : $(srcdir)/objc/objc-idebug.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \
+ $(RTL_H) $(srcdir)/objc/objc-act.h flags.h c-idebug.c idebug.c
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
+ -c -Wno-traditional -w $(srcdir)/objc/objc-idebug.c $(OUTPUT_OPTION)
+
+# APPLE LOCAL new tree dump
+# APPLE LOCAL separate outputdir
+objc/objc-dmp-tree.o: objc/objc-dmp-tree.c c-dmp-tree.c dmp-tree.c \
+ $(CONFIG_H) $(TREE_H) $(SYSTEM_H) $(srcdir)/c-common.h $(TM_H) coretypes.h \
+ $(srcdir)/objc/objc-act.h \
+ $(srcdir)/c-tree.h \
+ $(srcdir)/dmp-tree.h
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
+ -c $(srcdir)/objc/objc-dmp-tree.c $(OUTPUT_OPTION)
gtype-objc.h : s-gtype ; @true
gt-objc-objc-act.h : s-gtype ; @true
diff --git a/gcc/objc/config-lang.in b/gcc/objc/config-lang.in
index 91b86d8d573..996c914cd86 100644
--- a/gcc/objc/config-lang.in
+++ b/gcc/objc/config-lang.in
@@ -32,6 +32,10 @@ compilers="cc1obj\$(exeext)"
stagestuff="cc1obj\$(exeext)"
-target_libs=target-libobjc
+# APPLE LOCAL begin libobjc
+# We use libobjc4 instead. To build libobjc anyway, add
+# '--enable-libobjc' to the 'configure' command line.
+# target_libs=target-libobjc
+# APPLE LOCAL end libobjc
gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/c-parse.in \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-objc-common.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c \$(srcdir)/objc/objc-act.c"
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 3fe26d3fd87..e300197a18b 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -47,7 +47,14 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "tm_p.h"
#include "expr.h"
+/* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+#include "cp-tree.h"
+#include "lex.h"
+#else
#include "c-tree.h"
+#endif
+/* APPLE LOCAL end Objective-C++ */
#include "c-common.h"
#include "flags.h"
#include "langhooks.h"
@@ -66,6 +73,23 @@ Boston, MA 02111-1307, USA. */
#define OBJC_VOID_AT_END build_tree_list (NULL_TREE, void_type_node)
+/* APPLE LOCAL begin Objective-C++ */
+/* When building Objective-C++, we are not linking against the C front-end
+ and so need to replicate the C tree-construction functions in some way. */
+#ifdef OBJCPLUS
+#define OBJCP_REMAP_FUNCTIONS
+#include "objcp-decl.h"
+#endif /* OBJCPLUS */
+/* APPLE LOCAL end Objective-C++ */
+
+/* APPLE LOCAL new tree dump */
+#ifdef ENABLE_DMP_TREE
+#include "dmp-tree.h"
+extern int c_dump_tree_p PARAMS ((FILE *, const char *, tree, int));
+extern int objc_dump_tree_p PARAMS ((FILE *, const char *, tree, int));
+extern lang_dump_tree_p_t objc_prev_lang_dump_tree_p;
+#endif
+
/* This is the default way of generating a method name. */
/* I am not sure it is really correct.
Perhaps there's a danger that it will make name conflicts
@@ -186,7 +210,8 @@ static void hash_add_attr (hash, tree);
static tree lookup_method (tree, tree);
static tree lookup_method_static (tree, tree, int);
static void add_method_to_hash_list (hash *, tree);
-static tree add_class (tree);
+/* APPLE LOCAL objc speedup dpatel */
+static tree add_class (tree, tree);
static void add_category (tree, tree);
static inline tree lookup_category (tree, tree);
@@ -495,6 +520,19 @@ objc_init (void)
not to be built in. */
input_line = 0;
+/* APPLE LOCAL new tree dump */
+#ifdef ENABLE_DMP_TREE
+ if (!objc_prev_lang_dump_tree_p)
+ objc_prev_lang_dump_tree_p = set_dump_tree_p (objc_dump_tree_p);
+ /* At this point, objc_prev_lang_dump_tree_p should point at the C tree
+ dump routine (which, in the case of Objective-C++, points at the C++
+ tree dump routine in turn). */
+ if (objc_prev_lang_dump_tree_p != &c_dump_tree_p)
+ abort ();
+
+ SET_MAX_DMP_TREE_CODE (LAST_OBJC_TREE_CODE);
+#endif
+
/* If gen_declaration desired, open the output file. */
if (flag_gen_declaration)
{
@@ -1141,6 +1179,12 @@ synth_module_prologue (void)
{
tree temp_type;
+ /* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ push_lang_context (lang_name_c); /* extern "C" */
+#endif
+ /* APPLE LOCAL end Objective-C++ */
+
/* Defined in `objc.h' */
objc_object_id = get_identifier (TAG_OBJECT);
@@ -1320,7 +1364,13 @@ synth_module_prologue (void)
#ifndef OBJCPLUS
/* The C++ front-end does not appear to grok __attribute__((__unused__)). */
unused_list = build_tree_list (get_identifier ("__unused__"), NULL_TREE);
-#endif
+#endif
+
+ /* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ pop_lang_context ();
+#endif
+ /* APPLE LOCAL end Objective-C++ */
}
/* Ensure that the ivar list for NSConstantString/NXConstantString
@@ -1384,6 +1434,15 @@ build_objc_string_object (tree string)
string = fix_string_type (string);
+ /* APPLE LOCAL begin constant cfstrings */
+ /* The target may have different ideas on how to construct an
+ ObjC string literal. On Darwin (Mac OS X), for example,
+ we may wish to obtain a constant CFString reference instead. */
+ constructor = (*targetm.construct_objc_string) (string);
+ if (constructor)
+ return build_c_cast (id_type, constructor);
+ /* APPLE LOCAL end constant cfstrings */
+
constant_string_class = lookup_interface (constant_string_id);
if (!constant_string_class
|| !(constant_string_type
@@ -1804,6 +1863,12 @@ build_module_descriptor (void)
{
tree decl_specs, field_decl, field_decl_chain;
+ /* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ push_lang_context (lang_name_c); /* extern "C" */
+#endif
+ /* APPLE LOCAL end Objective-C++ */
+
objc_module_template
= start_struct (RECORD_TYPE, get_identifier (UTAG_MODULE));
@@ -1914,6 +1979,11 @@ build_module_descriptor (void)
c_expand_expr_stmt (decelerator);
finish_function ();
+ /* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ pop_lang_context ();
+#endif
+ /* APPLE LOCAL end Objective-C++ */
return XEXP (DECL_RTL (init_function_decl), 0);
}
@@ -2586,18 +2656,18 @@ objc_is_object_ptr (tree type)
tree
lookup_interface (tree ident)
{
- tree chain;
+ /* APPLE LOCAL objc speedup dpatel */
+ tree chain ATTRIBUTE_UNUSED;
#ifdef OBJCPLUS
if (ident && TREE_CODE (ident) == TYPE_DECL)
ident = DECL_NAME (ident);
#endif
- for (chain = interface_chain; chain; chain = TREE_CHAIN (chain))
- {
- if (ident == CLASS_NAME (chain))
- return chain;
- }
- return NULL_TREE;
+ /* APPLE LOCAL begin objc speedup dpatel */
+ return (ident && TREE_CODE (ident) == IDENTIFIER_NODE
+ ? IDENTIFIER_INTERFACE_VALUE (ident)
+ : NULL_TREE);
+ /* APPLE LOCAL end objc speedup dpatel */
}
/* Implement @defs (<classname>) within struct bodies. */
@@ -6342,9 +6412,14 @@ objc_add_method (tree class, tree method, int is_class)
return method;
}
+/* APPLE LOCAL begin objc speedup dpatel */
+/* New parameter, name */
static tree
-add_class (tree class)
+add_class (tree class, tree name)
{
+ /* APPLE LOCAL end objc speedup dpatel */
+ IDENTIFIER_INTERFACE_VALUE (name) = class;
+
/* Put interfaces on list in reverse order. */
TREE_CHAIN (class) = interface_chain;
interface_chain = class;
@@ -6815,7 +6890,9 @@ start_class (enum tree_code code, tree class_name, tree super_name,
{
warning ("cannot find interface declaration for `%s'",
IDENTIFIER_POINTER (class_name));
- add_class (implementation_template = objc_implementation_context);
+ /* APPLE LOCAL objc speedup dpatel */
+ /* Add second parameter class_name */
+ add_class (implementation_template = objc_implementation_context, class_name);
}
/* If a super class has been specified in the implementation,
@@ -6848,8 +6925,10 @@ start_class (enum tree_code code, tree class_name, tree super_name,
warning ("duplicate interface declaration for class `%s'",
#endif
IDENTIFIER_POINTER (class_name));
- else
- add_class (class);
+ else
+ /* APPLE LOCAL objc speedup dpatel */
+ /* Add second parameter, class_name */
+ add_class (class, class_name);
if (protocol_list)
CLASS_PROTOCOL_LIST (class)
@@ -6915,6 +6994,12 @@ continue_class (tree class)
/* code generation */
+ /* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ push_lang_context (lang_name_c);
+#endif
+ /* APPLE LOCAL end Objective-C++ */
+
ivar_context = build_private_template (implementation_template);
if (!objc_class_template)
@@ -6937,14 +7022,34 @@ continue_class (tree class)
else
cat_count++;
+ /* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ pop_lang_context ();
+#endif /* OBJCPLUS */
+ /* APPLE LOCAL end Objective-C++ */
+
return ivar_context;
}
else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE)
{
+/* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ push_lang_context (lang_name_c);
+#endif /* OBJCPLUS */
+/* APPLE LOCAL end Objective-C++ */
if (!CLASS_STATIC_TEMPLATE (class))
{
tree record = start_struct (RECORD_TYPE, CLASS_NAME (class));
+
+ /* APPLE LOCAL begin 3261135 */
+ /* FSF Candidate */
+ /* Set the TREE_USED bit for this struct, so that stab generator can emit
+ stabs for this struct type. */
+ if (flag_debug_only_used_symbols && TYPE_STUB_DECL (record))
+ TREE_USED (TYPE_STUB_DECL (record)) = 1;
+ /* APPLE LOCAL end 3261135 */
+
finish_struct (record, get_class_ivars (class, 0), NULL_TREE);
CLASS_STATIC_TEMPLATE (class) = record;
@@ -6952,6 +7057,11 @@ continue_class (tree class)
TREE_STATIC_TEMPLATE (record) = 1;
}
+ /* APPLE LOCAL begin Objective-C++ */
+#ifdef OBJCPLUS
+ pop_lang_context ();
+#endif /* OBJCPLUS */
+ /* APPLE LOCAL end Objective-C++ */
return NULL_TREE;
}
@@ -9086,5 +9196,7 @@ lookup_objc_ivar (tree id)
return 0;
}
+/* APPLE LOCAL objective-C++ */
+#include "gt-objc-objc-act-h.h"
#include "gt-objc-objc-act.h"
#include "gtype-objc.h"
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index abbf6562731..8c19b563691 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -126,6 +126,9 @@ tree build_encode_expr (tree);
? (TYPE)->type.context : NULL_TREE)
#define SET_TYPE_PROTOCOL_LIST(TYPE, P) (TYPE_CHECK (TYPE)->type.context = (P))
+/* APPLE LOCAL objc speedup dpatel */
+#define IDENTIFIER_INTERFACE_VALUE(NODE) (((struct lang_identifier *) (NODE))->interface_value)
+
/* Set by `continue_class' and checked by `is_public'. */
#define TREE_STATIC_TEMPLATE(record_type) (TREE_PUBLIC (record_type))
diff --git a/gcc/objc/objc-dmp-tree.c b/gcc/objc/objc-dmp-tree.c
new file mode 100644
index 00000000000..14d9dabfca1
--- /dev/null
+++ b/gcc/objc/objc-dmp-tree.c
@@ -0,0 +1,285 @@
+/* APPLE LOCAL file new tree dump */
+/* Common condensed tree display routines specific for objc and objc++.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* The Objective-C++ and Objective-C tree dump handling is piggybacked
+ on either C++ or C tree dump handling. */
+
+#ifdef OBJCPLUS
+#include "cp-dmp-tree.c"
+#else
+#include "c-dmp-tree.c"
+#endif
+
+#include "objc-act.h"
+
+int objc_dump_tree_p (FILE *, const char *, tree, int);
+lang_dump_tree_p_t objc_prev_lang_dump_tree_p = NULL;
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+static void print_ ## SYM (FILE *file, const char *annotation, tree node, int indent);
+#include "objc-tree.def"
+#undef DEFTREECODE
+
+/*-------------------------------------------------------------------*/
+
+static void
+print_CLASS_INTERFACE_TYPE (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ tree n;
+
+ if (CLASS_SUPER_NAME (node))
+ fprintf (file, " super-name=%s",
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (node)));
+ /* The ivars for the class are accessible either via
+ CLASS_IVARS(node), or as fields of the
+ underlying C struct (itself accessible via
+ CLASS_STATIC_TEMPLATE(node). */
+ fprintf (file, " ivars=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (CLASS_IVARS (node)));
+ /* zlaski 2001-Jul-26: not sure what the raw ivars are for... */
+ fprintf (file, " raw_ivars=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (CLASS_RAW_IVARS (node)));
+ /* The "own ivars" list contains just the ivars defined by this
+ class (i.e., not inherited). */
+ fprintf (file, " own_ivars=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (CLASS_OWN_IVARS (node)));
+
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ /* print out names of protocols, categories. */
+ for (n = CLASS_PROTOCOL_LIST (node); n; n = TREE_CHAIN (n))
+ print_type (file, NULL, TREE_VALUE (n), indent + INDENT);
+ for (n = CLASS_CATEGORY_LIST (node); n; n = TREE_CHAIN (n))
+ print_type (file, NULL, TREE_VALUE (n), indent + INDENT);
+
+ /* Print the underlying RECORD_TYPE node, with fields. */
+ dump_tree (file, annotation, CLASS_STATIC_TEMPLATE (node),
+ indent + INDENT);
+ /* Print out names of class and instance methods. */
+ for (n = CLASS_CLS_METHODS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+ for (n = CLASS_NST_METHODS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+}
+
+static void
+print_CLASS_IMPLEMENTATION_TYPE (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_CLASS_INTERFACE_TYPE (file, annotation, node, indent);
+}
+
+static void
+print_CATEGORY_INTERFACE_TYPE (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ tree n;
+
+ fprintf (file, " cat-name=%s",
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (node)));
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ for (n = CLASS_PROTOCOL_LIST (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, TREE_VALUE (n), indent + INDENT);
+ /* Print out names of class and instance methods. */
+ for (n = CLASS_CLS_METHODS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+ for (n = CLASS_NST_METHODS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+}
+
+static void
+print_CATEGORY_IMPLEMENTATION_TYPE (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_CATEGORY_INTERFACE_TYPE (file, annotation, node, indent);
+}
+
+static void
+print_PROTOCOL_INTERFACE_TYPE (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ tree n;
+
+ fprintf (file, " fwd-decl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (PROTOCOL_FORWARD_DECL (node)));
+ fprintf (file, " defined=%d", PROTOCOL_DEFINED (node));
+
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+
+ /* print superprotocols, if any. */
+ for (n = PROTOCOL_LIST (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, TREE_VALUE (n), indent + INDENT);
+
+ /* Print out names of class and instance methods. */
+ for (n = PROTOCOL_CLS_METHODS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+ for (n = PROTOCOL_NST_METHODS (node); n; n = TREE_CHAIN (n))
+ dump_tree (file, NULL, n, indent + INDENT);
+}
+
+static void
+print_KEYWORD_DECL (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ fprintf (file, " key=%s",
+ IDENTIFIER_POINTER (KEYWORD_KEY_NAME (node)));
+ fprintf (file, " arg=%s",
+ IDENTIFIER_POINTER (KEYWORD_ARG_NAME (node)));
+
+ print_type (file, annotation, node, indent);
+ (void)node_seen (node, TRUE);
+}
+
+static void
+print_INSTANCE_METHOD_DECL (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ fprintf (file, " args=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (METHOD_SEL_ARGS (node)));
+ fprintf (file, " addl=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (METHOD_ADD_ARGS (node)));
+ if (METHOD_ENCODING (node))
+ fprintf (file, " encode=%s",
+ IDENTIFIER_POINTER (METHOD_ENCODING (node)));
+
+ print_decl (file, annotation, node, indent);
+
+ /* Print the underlying FUNCTION_DECL node. */
+ if (METHOD_DEFINITION (node))
+ dump_tree (file, annotation, METHOD_DEFINITION (node),
+ indent + INDENT);
+
+ (void)node_seen (node, TRUE);
+}
+
+static void
+print_CLASS_METHOD_DECL (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ print_INSTANCE_METHOD_DECL (file, annotation, node, indent);
+}
+
+static void
+print_CLASS_REFERENCE_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ fprintf (file, " ident=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 0)));
+ (void)node_seen (node, TRUE);
+}
+
+static void
+print_MESSAGE_SEND_EXPR (file, annotation, node, indent)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node ATTRIBUTE_UNUSED;
+ int indent ATTRIBUTE_UNUSED;
+{
+ fprintf (file, " receiver=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 0)));
+ fprintf (file, " sel_name=%s",
+ IDENTIFIER_POINTER (TREE_OPERAND (node, 1)));
+ fprintf (file, " args=");
+ fprintf (file, HOST_PTR_PRINTF,
+ HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 2)));
+ (void)node_seen (node, TRUE);
+}
+
+/*-------------------------------------------------------------------*/
+
+int
+objc_dump_tree_p (file, annotation, node, indent)
+ FILE *file;
+ const char *annotation ATTRIBUTE_UNUSED;
+ tree node;
+ int indent;
+{
+ switch (TREE_CODE (node))
+ {
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \
+ case SYM: print_ ## SYM (file, annotation, node, indent); break;
+#include "objc-tree.def"
+#undef DEFTREECODE
+ default:
+ return objc_prev_lang_dump_tree_p (file, annotation, node, indent);
+ }
+
+ return 1;
+}
+
+
+/*-------------------------------------------------------------------*/
+
+#if 0
+
+cd $gcc3/gcc; \
+cc -no-cpp-precomp -c -DIN_GCC -g \
+ -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long \
+ -DHAVE_CONFIG_H \
+ -I$gcc3obj \
+ -I. \
+ -Iobjc \
+ -Iconfig \
+ -I../include \
+ objc/objc-dmp-tree.c -o ~/tmp.o -w
+
+#endif
diff --git a/gcc/objc/objc-idebug.c b/gcc/objc/objc-idebug.c
new file mode 100644
index 00000000000..4bf78cdd18a
--- /dev/null
+++ b/gcc/objc/objc-idebug.c
@@ -0,0 +1,72 @@
+/* APPLE LOCAL file debugging */
+/* ObjC tree & rtl accessors defined as functions for use in a debugger.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Ira L. Ruben (ira@apple.com)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* What we do here is to instantiate each macro as a function *BY
+ THE SAME NAME*. Depends on the macro not being expanded when
+ it is surrounded by parens.
+
+ Note that this file includes idebug.c or cp/cp-idebug.c (depending
+ on weather OBJCPLUS is defined) so that only debugging macros for
+ objc-act.h are actually defined here. For objc only this file is
+ included in the link while for C only idebug.c is built and inlcuded
+ in the link. Similarly, for objc++ this is the only included file
+ and cp-idebug.c is not linked. */
+
+#ifdef OBJCPLUS
+#include "cp/cp-idebug.c"
+#else
+#include "c-idebug.c"
+#endif
+
+#ifdef ENABLE_IDEBUG
+
+#include "objc-act.h"
+
+/* Macros from objc/objc-act.h */
+
+fn_1 ( KEYWORD_KEY_NAME, tree, tree )
+fn_1 ( KEYWORD_ARG_NAME, tree, tree )
+fn_1 ( METHOD_SEL_NAME, tree, tree )
+fn_1 ( METHOD_SEL_ARGS, tree, tree )
+fn_1 ( METHOD_ADD_ARGS, tree, tree )
+fn_1 ( METHOD_DEFINITION, tree, tree )
+fn_1 ( METHOD_ENCODING, tree, tree )
+fn_1 ( CLASS_NAME, tree, tree )
+fn_1 ( CLASS_SUPER_NAME, tree, tree )
+fn_1 ( CLASS_IVARS, tree, tree )
+fn_1 ( CLASS_RAW_IVARS, tree, tree )
+fn_1 ( CLASS_NST_METHODS, tree, tree )
+fn_1 ( CLASS_CLS_METHODS, tree, tree )
+fn_1 ( CLASS_OWN_IVARS, tree, tree )
+fn_1 ( CLASS_STATIC_TEMPLATE, tree, tree )
+fn_1 ( CLASS_CATEGORY_LIST, tree, tree )
+fn_1 ( CLASS_PROTOCOL_LIST, tree, tree )
+fn_1 ( PROTOCOL_NAME, tree, tree )
+fn_1 ( PROTOCOL_LIST, tree, tree )
+fn_1 ( PROTOCOL_NST_METHODS, tree, tree )
+fn_1 ( PROTOCOL_CLS_METHODS, tree, tree )
+fn_1 ( PROTOCOL_FORWARD_DECL, tree, tree )
+fn_1 ( PROTOCOL_DEFINED, tree, tree )
+fn_1 ( TREE_STATIC_TEMPLATE, int, tree )
+fn_1 ( TYPE_PROTOCOL_LIST, tree, tree)
+
+#endif /* ENABLE_IDEBUG */
diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c
index 8f5692cad11..621d006a16b 100644
--- a/gcc/objc/objc-lang.c
+++ b/gcc/objc/objc-lang.c
@@ -39,6 +39,10 @@ enum c_language_kind c_language = clk_objc;
#define LANG_HOOKS_INIT objc_init
#undef LANG_HOOKS_FINISH
#define LANG_HOOKS_FINISH c_common_finish
+/* APPLE LOCAL begin Objective-C++ */
+#undef LANG_HOOKS_FINISH_FILE
+#define LANG_HOOKS_FINISH_FILE finish_file
+/* APPLE LOCAL end Objective-C++ */
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
#undef LANG_HOOKS_HANDLE_OPTION
diff --git a/gcc/objc/objc-root.h b/gcc/objc/objc-root.h
new file mode 100644
index 00000000000..96d86209715
--- /dev/null
+++ b/gcc/objc/objc-root.h
@@ -0,0 +1,4 @@
+/* APPLE LOCAL file Objective-C++ */
+/* Empty file to be the base for gtype-objc.h. */
+
+extern GTY(()) tree objc_dummy;
diff --git a/gcc/objcp/.cvsignore b/gcc/objcp/.cvsignore
new file mode 100644
index 00000000000..69944476744
--- /dev/null
+++ b/gcc/objcp/.cvsignore
@@ -0,0 +1,4 @@
+# APPLE LOCAL entire file
+objcp-parse.h
+objcp-parse.c
+g++int.info*
diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in
new file mode 100644
index 00000000000..74b72211b09
--- /dev/null
+++ b/gcc/objcp/Make-lang.in
@@ -0,0 +1,222 @@
+# APPLE LOCAL Objective-C++
+# Top level makefile fragment for GNU Objective-C++
+# Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+
+#This file is part of GNU CC.
+
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING. If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
+# This file provides the language dependent support in the main Makefile.
+# Each language makefile fragment must provide the following targets:
+#
+# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
+# foo.info, foo.dvi,
+# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
+# foo.uninstall,
+# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
+# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
+#
+# where `foo' is the name of the language.
+#
+# It should also provide rules for:
+#
+# - making any compiler driver (eg: g++)
+# - the compiler proper (eg: cc1plus)
+# - define the names for selecting the language in LANGUAGES.
+
+#
+# Define the names for selecting Objective-C++ in LANGUAGES.
+OBJC++ objc++: cc1objplus$(exeext)
+OBJECTIVE-C++ objective-c++: cc1objplus$(exeext)
+
+# Tell GNU make to ignore these if they exist.
+.PHONY: objective-c++ objc++ ObjC++
+
+# Use maximal warnings for this front end (actually, this applies to the ObjC files,
+# not the C++ files, which have been compiled elsewhere).
+objc++-warn = $(STRICT_WARN)
+
+# APPLE LOCAL begin order files ilr
+ifeq ($(ORDER_FILES),yes)
+CC1OBJPLUS_ORDER_FLAGS = `if [ -f $(srcdir)/../order-files/cc1objplus.order ]; then \
+ echo -sectorder __TEXT __text $(srcdir)/../order-files/cc1objplus.order -e start ; fi`
+else
+CC1OBJPLUS_ORDER_FLAGS =
+endif
+# APPLE LOCAL end order files ilr
+
+# Language-specific object files for Objective C++.
+# APPLE LOCAL new tree dump
+# APPLE LOCAL debugging
+# APPLE LOCAL separate outputdir
+OBJCP_OBJS = $(CXX_AND_OBJCP_OBJS) $(CXX_C_OBJS) objcp/objcp-lang.o \
+ objcp/objcp-parse.o objcp/objcp-decl.o objcp/objcp-act.o \
+ objcp/objcp-idebug.o objcp/objcp-dmp-tree.o
+
+# APPLE LOCAL order files ilr
+cc1objplus$(exeext): $(OBJCP_OBJS) $(BACKEND) libcpp.a $(LIBDEPS)
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJCP_OBJS) $(BACKEND) libcpp.a $(LIBS) \
+ $(CC1OBJPLUS_ORDER_FLAGS)
+
+# Objective C++ language specific files.
+
+# APPLE LOCAL separate outputdir
+objcp/objcp-decl.o : $(srcdir)/objcp/objcp-decl.c $(srcdir)/objcp/objcp-decl.h \
+ $(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \
+ $(srcdir)/cp/lex.h $(srcdir)/cp/cp-tree.h $(srcdir)/c-common.h \
+ $(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \
+ $(srcdir)/objc/objc-act.h $(SYSTEM_H) $(CPPLIB_H)
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \
+ -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/objcp/objcp-decl.c $(OUTPUT_OPTION)
+
+# APPLE LOCAL separate outputdir
+objcp/objcp-lang.o : $(srcdir)/cp/cp-lang.c \
+ $(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \
+ $(srcdir)/cp/lex.h $(srcdir)/cp/cp-tree.h $(srcdir)/c-common.h \
+ $(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \
+ $(srcdir)/objc/objc-act.h $(SYSTEM_H) $(CPPLIB_H)
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \
+ -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/cp/cp-lang.c $(OUTPUT_OPTION)
+
+objcp/objcp-parse.o : $(parsedir)/objcp/objcp-parse.c $(CXX_TREE_H) flags.h cp/lex.h \
+ except.h output.h \
+ $(SYSTEM_H) toplev.h $(GGC_H) objc/objc-act.h objcp/objcp-decl.h
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp \
+ -I$(srcdir)/objc $(BIG_SWITCHFLAG) \
+ -DOBJCPLUS $(parsedir)/objcp/objcp-parse.c $(OUTPUT_OPTION)
+
+# APPLE LOCAL parsedir
+po-generated: $(parsedir)/objcp/objcp-parse.c
+
+# APPLE LOCAL parsedir
+# APPLE LOCAL Objective-C++
+$(parsedir)/objcp/objcp-parse.c : $(parsedir)/objcp/objcp-parse.y
+ cd $(parsedir)/objcp; \
+ $(BISON) $(BISONFLAGS) -d -v -o p$$$$.c objcp-parse.y ; \
+ mv -f p$$$$.c objcp-parse.c
+
+# APPLE LOCAL parsedir
+$(parsedir)/objcp/objcp-parse.y : $(srcdir)/cp/cp-parse.in
+ echo '/*WARNING: This file is automatically generated!*/' >tmp-objcp-prs.y
+ sed -e "/^ifcp$$/,/^end ifcp$$/d" \
+ -e "/^ifobjcp$$/d" -e "/^end ifobjcp$$/d" \
+ -e "/^...ifobjcp...$$/d" -e "/^...end ifobjcp...$$/d" \
+ $(srcdir)/cp/cp-parse.in >>tmp-objcp-prs.y
+ $(SHELL) $(srcdir)/move-if-change tmp-objcp-prs.y $(parsedir)/objcp/objcp-parse.y
+
+# APPLE LOCAL separate outputdir
+objcp/objcp-act.o : $(srcdir)/objc/objc-act.c $(srcdir)/objcp/objcp-decl.h \
+ $(CONFIG_H) $(TREE_H) $(RTL_H) $(SYSTEM_H) $(EXPR_H) $(TARGET_H) \
+ $(srcdir)/c-tree.h $(srcdir)/c-common.h $(VARRAY_H) \
+ $(srcdir)/toplev.h $(srcdir)/flags.h objc/objc-act.h objcp/objcp-decl.h \
+ $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/debug.h \
+ $(srcdir)/langhooks.h $(srcdir)/langhooks-def.h
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \
+ -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/objc/objc-act.c $(OUTPUT_OPTION)
+
+# APPLE LOCAL debugging
+# Suppress all warnings explicitly for the idebug builds since there can be
+# many when, and if, -traditional-cpp is used.
+# APPLE LOCAL separate outputdir
+objcp/objcp-idebug.o : $(srcdir)/objc/objc-idebug.c $(CONFIG_H) $(TREE_H) $(C_TREE_H) \
+ $(RTL_H) $(srcdir)/objc/objc-act.h flags.h c-idebug.c idebug.c
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \
+ -I$(srcdir)/objcp -DOBJCPLUS -c -w $(srcdir)/objc/objc-idebug.c $(OUTPUT_OPTION)
+
+# APPLE LOCAL new tree dump
+# APPLE LOCAL separate outputdir
+objcp/objcp-dmp-tree.o: $(srcdir)/objc/objc-dmp-tree.c $(srcdir)/cp/cp-dmp-tree.c \
+ $(srcdir)/c-dmp-tree.c $(CONFIG_H) $(TREE_H) $(SYSTEM_H) $(srcdir)/c-common.h \
+ $(srcdir)/objc/objc-act.h \
+ $(srcdir)/cp/cp-tree.h \
+ $(srcdir)/dmp-tree.c $(srcdir)/dmp-tree.h
+ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \
+ -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/objc/objc-dmp-tree.c $(OUTPUT_OPTION)
+
+# APPLE LOCAL separate outputdir
+objcp/objcp-act.o : config.h
+
+gtype-objcp.h : s-gtype ; @true
+
+#
+# Build hooks:
+
+objc++.all.build:
+objc++.all.cross:
+objc++.start.encap:
+objc++.rest.encap:
+
+objc++.info:
+objc++.dvi:
+objc++.generated-manpages:
+
+#
+# Install hooks:
+# cc1objplus is installed elsewhere as part of $(COMPILERS).
+
+objc++.install-normal:
+
+objc++.install-common:
+
+objc++.install-info:
+
+objc++.install-man:
+
+objc++.uninstall:
+#
+# Clean hooks:
+# A lot of the ancillary files are deleted by the main makefile.
+# We just have to delete files specific to us.
+objc++.mostlyclean:
+ -rm -f objcp/*$(objext)
+objc++.clean: objc++.mostlyclean
+ -rm -rf objcp-headers
+objc++.distclean:
+ -rm -f objcp/config.status objcp/Makefile
+ -rm -f $(parsedir)/objcp/objcp-parse.output
+objc++.extraclean:
+# APPLE LOCAL: parsedir
+objc++.maintainer-clean:
+ -rm -f $(parsedir)/objcp/objcp-parse.y
+ -rm -f $(parsedir)/objcp/objcp-parse.c $(parsedir)/objcp/objcp-parse.output
+
+#
+# Stage hooks:
+
+objc++.stage1: stage1-start
+ -mv objcp/*$(objext) stage1/objcp
+ -mv cc1objplus$(exeext) stage1
+objc++.stage2: stage2-start
+ -mv objcp/*$(objext) stage2/objcp
+ -mv cc1objplus$(exeext) stage2
+objc++.stage3: stage3-start
+ -mv objcp/*$(objext) stage3/objcp
+ -mv cc1objplus$(exeext) stage3
+objc++.stage4: stage4-start
+ -mv objcp/*$(objext) stage4/objcp
+ -mv cc1objplus$(exeext) stage4
+
+# These exist for maintenance purposes.
+
+# APPLE LOCAL Objective-C++
+# Update the tags table.
+objcp/TAGS: force
+ cd $(srcdir)/objcp ; \
+ etags --no-globals -l c `echo *.c | sed 's/objcp-parse.c//'` \
+ objcp-parse.y *.h ../*.c ../*.h;
+
+.PHONY: objcp/TAGS
+
diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in
new file mode 100644
index 00000000000..b6c0ac8cb63
--- /dev/null
+++ b/gcc/objcp/config-lang.in
@@ -0,0 +1,43 @@
+# APPLE LOCAL Objective-C++
+# Top level configure fragment for GNU Objective-C++.
+# Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+
+#This file is part of GNU CC.
+
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING. If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
+# Configure looks for the existence of this file to auto-config each language.
+# We define several parameters used by configure:
+#
+# language - name of language as it would appear in $(LANGUAGES)
+# compilers - value to add to $(COMPILERS)
+# stagestuff - files to add to $(STAGESTUFF)
+# diff_excludes - files to ignore when building diffs between two versions.
+
+language="objc++"
+
+compilers="cc1objplus\$(exeext)"
+
+stagestuff=""
+
+diff_excludes="-x objcp-parse.c -x objcp-parse.y "
+
+# By building the Objective-C and C++ front-ends, we will get
+# the object files we need, along with the libraries (libstdc++,
+# libobjc).
+lang_requires="objc c++"
+
+gtfiles="\$(srcdir)/objcp/objcp-root.h \$(srcdir)/objc/objc-act.h \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/tree.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c"
diff --git a/gcc/objcp/lang-specs.h b/gcc/objcp/lang-specs.h
new file mode 100644
index 00000000000..e8672070a0e
--- /dev/null
+++ b/gcc/objcp/lang-specs.h
@@ -0,0 +1,59 @@
+/* APPLE LOCAL Objective-C++ */
+/* Definitions for specs for C++.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* This is the contribution to the `default_compilers' array in gcc.c for
+ objective-c++. */
+
+#ifndef OBJCPLUSPLUS_CPP_SPEC
+#define OBJCPLUSPLUS_CPP_SPEC 0
+#endif
+
+ {".mm", "@objective-c++", 0},
+ {".M", "@objective-c++", 0},
+ {"@objective-c++",
+ "%{E|M|MM:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\
+ %(cpp_options) %2 %(cpp_debug_options)}\
+ "/* APPLE LOCAL prohibit -arch with -E and -S */"\
+ %{E|S:%{@:%e-E and -S are not allowed with multiple -arch flags}}\
+ %{!E:%{!M:%{!MM:\
+ %{save-temps:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\
+ %(cpp_options) %2 %b.mii \n}\
+ cc1objplus %{save-temps:-fpreprocessed %b.mii}\
+ %{!save-temps:%(cpp_unique_options) %{!no-gcc:-D__GNUG__=%v1}}\
+ %(cc1_options) %{gen-decls} %2 %{+e1*}\
+ %{!fsyntax-only:%(invoke_as)}}}}",
+ OBJCPLUSPLUS_CPP_SPEC},
+ {".mii", "@objc++-cpp-output", 0},
+ {"@objc++-cpp-output",
+ "%{!M:%{!MM:%{!E:\
+ cc1objplus -fpreprocessed %i %(cc1_options) %{gen-decls} %2 %{+e*}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0},
+ {"@objective-c++-header",
+ "%{E|M|MM:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\
+ %(cpp_options) %2 %(cpp_debug_options)}\
+ %{!E:%{!M:%{!MM:\
+ %{save-temps:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\
+ %(cpp_options) %2 %b.mii \n}\
+ cc1objplus %{save-temps:-fpreprocessed %b.mii}\
+ %{!save-temps:%(cpp_unique_options) %{!no-gcc:-D__GNUG__=%v1}}\
+ %(cc1_options) %{gen-decls} %2 %{+e1*}\
+ %(pch) %(dbg_ss)}}}", 0},
diff --git a/gcc/objcp/objcp-decl.c b/gcc/objcp/objcp-decl.c
new file mode 100644
index 00000000000..8c6848ab87b
--- /dev/null
+++ b/gcc/objcp/objcp-decl.c
@@ -0,0 +1,306 @@
+/* APPLE LOCAL file Objective-C++ */
+/* Process the ObjC-specific declarations and variables for
+ the Objective-C++ compiler.
+ Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* Process declarations and symbol lookup for C front end.
+ Also constructs types; the standard scalar types at initialization,
+ and structure, union, array and enum types when they are declared. */
+
+/* ??? not all decl nodes are given the most useful possible
+ line numbers. For example, the CONST_DECLs for enum values. */
+
+#include "config.h"
+#include "system.h"
+#include "tree.h"
+#include "rtl.h"
+#include "expr.h"
+#include "cp-tree.h"
+#include "lex.h"
+#include "c-common.h"
+#include "flags.h"
+#include "input.h"
+#include "except.h"
+#include "output.h"
+#include "toplev.h"
+#include "cpplib.h"
+#include "debug.h"
+#include "target.h"
+#include "varray.h"
+
+#include "objc-act.h"
+#include "objcp-decl.h"
+
+/* APPLE LOCAL indexing */
+#include "genindex.h"
+
+static tree objcp_parmlist = NULL_TREE;
+
+/* Hacks to simulate start_struct() and finish_struct(). */
+
+tree
+objcp_start_struct (code, name)
+ enum tree_code code ATTRIBUTE_UNUSED;
+ tree name;
+{
+ int new_scope = 0;
+ tree h, s;
+ /* The idea here is to mimic the actions that the C++ parser takes when
+ constructing 'extern "C" struct {'. */
+ push_lang_context (lang_name_c);
+ if (!name)
+ name = make_anon_name ();
+ h = handle_class_head (record_type, 0, name, 0, 1, &new_scope);
+
+ /* APPLE LOCAL indexing dpatel */
+ flag_suppress_builtin_indexing = 1;
+
+ s = begin_class_definition (TREE_TYPE (h));
+
+ /* APPLE LOCAL indexing dpatel */
+ flag_suppress_builtin_indexing = 0;
+
+ return s;
+}
+
+tree
+objcp_finish_struct (t, fieldlist, attributes)
+ tree t;
+ tree fieldlist, attributes;
+{
+ tree s, field, next_field;
+
+ /* APPLE LOCAL indexing dpatel */
+ flag_suppress_builtin_indexing = 1;
+
+ for (field = fieldlist; field; field = next_field)
+ {
+ next_field = TREE_CHAIN (field); /* insert one field at a time; */
+ TREE_CHAIN (field) = NULL_TREE; /* otherwise, grokfield croaks. */
+ finish_member_declaration (field);
+ }
+ s = finish_class_definition (t, attributes, 1, 0);
+
+ /* APPLE LOCAL indexing dpatel */
+ flag_suppress_builtin_indexing = 0;
+
+ pop_lang_context ();
+ return s;
+}
+
+int
+objcp_start_function (declspecs, declarator, attributes)
+ tree declspecs, declarator, attributes;
+{
+ return start_function (declspecs, declarator, attributes, 0);
+}
+
+void
+objcp_finish_function (nested)
+ int nested ATTRIBUTE_UNUSED;
+{
+ /* The C++ flavor of 'finish_function' does not generate RTL -- one has
+ to call 'expand_body' to do that. */
+ expand_body (finish_function (0));
+}
+
+tree
+objcp_start_decl (declarator, declspecs, initialized, attributes)
+ tree declarator, declspecs;
+ int initialized;
+ tree attributes;
+{
+ return start_decl (declarator, declspecs, initialized,
+ attributes, NULL_TREE);
+}
+
+void
+objcp_finish_decl (decl, init, asmspec)
+ tree decl, init, asmspec;
+{
+ cp_finish_decl (decl, init, asmspec, 0);
+}
+
+tree
+objcp_lookup_name (name)
+ tree name;
+{
+ return lookup_name (name, -1);
+}
+
+/* Hacks to simulate push_parm_decl() and get_parm_info(). */
+
+tree
+objcp_push_parm_decl (parm)
+ tree parm;
+{
+ /* C++ parms are laid out slightly differently from C parms. Adjust
+ for this here. */
+ TREE_VALUE (parm) = TREE_PURPOSE (parm);
+ TREE_PURPOSE (parm) = NULL_TREE;
+
+ if (objcp_parmlist)
+ objcp_parmlist = chainon (objcp_parmlist, parm);
+ else
+ objcp_parmlist = parm;
+
+ return objcp_parmlist;
+}
+
+tree
+objcp_get_parm_info (void_at_end)
+ int void_at_end;
+{
+ tree parm_info = finish_parmlist (objcp_parmlist, !void_at_end);
+
+ /* The C++ notion of a parameter list differs slightly from that of
+ C. Adjust for this. */
+ parm_info = build_tree_list (parm_info, NULL_TREE);
+ objcp_parmlist = NULL_TREE;
+
+ return parm_info;
+}
+
+void
+objcp_store_parm_decls ()
+{
+ /* In C++ land, 'start_function' calls 'store_parm_decls'; hence we
+ do not need to do anything here. */
+}
+
+tree
+objcp_build_function_call (function, args)
+ tree function, args;
+{
+ /* APPLE MERGE this is probably wrong */
+ return build_function_call (function, args);
+}
+
+tree
+objcp_xref_tag (code, name)
+ enum tree_code code;
+ tree name;
+{
+ if (code != RECORD_TYPE)
+ abort (); /* this is sheer laziness... */
+ return xref_tag (record_type, name, 0, 1);
+}
+
+tree
+objcp_grokfield (filename, line, declarator, declspecs, width)
+ const char *filename ATTRIBUTE_UNUSED;
+ int line ATTRIBUTE_UNUSED;
+ tree declarator, declspecs, width;
+{
+ return (width) ? grokbitfield (declarator, declspecs, width)
+ : grokfield (declarator, declspecs, 0, 0, 0);
+}
+
+tree
+objcp_build_component_ref (datum, component)
+ tree datum, component;
+{
+ /* The 'build_component_ref' routine has been removed from the C++
+ front-end, but 'finish_class_member_access_expr' seems to be
+ a worthy substitute. */
+ return finish_class_member_access_expr (datum, component);
+}
+
+int
+objcp_comptypes (type1, type2)
+ tree type1, type2;
+{
+ return comptypes (type1, type2, 0);
+}
+
+tree
+objcp_type_name (type)
+ tree type;
+{
+ if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
+ return DECL_NAME (TYPE_NAME (type));
+ else
+ return TYPE_NAME (type);
+}
+
+tree
+objcp_type_size (type)
+ tree type;
+{
+ tree size = TYPE_SIZE (type);
+ if (size == NULL_TREE)
+ {
+ warning ("Requesting size of incomplete type `%s'",
+ IDENTIFIER_POINTER (objcp_type_name (type)));
+ layout_type (type);
+ size = TYPE_SIZE (type);
+ }
+ return build_int_2 (TREE_INT_CST_LOW (size), 0);
+}
+
+/* C++'s version of 'builtin_function' winds up placing our precious
+ objc_msgSend and friends in namespace std! This will not do.
+ We shall hence duplicate C's 'builtin_function' here instead. */
+
+tree
+objcp_builtin_function (name, type, code, class, libname, attrs)
+ const char *name;
+ tree type;
+ int code;
+ enum built_in_class class;
+ const char *libname ATTRIBUTE_UNUSED;
+ tree attrs;
+{
+ tree decl = NULL;
+ decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+ make_decl_rtl (decl, NULL);
+ pushdecl (decl);
+ DECL_BUILT_IN_CLASS (decl) = class;
+ DECL_FUNCTION_CODE (decl) = code;
+ DECL_ANTICIPATED (decl) = 1;
+
+ /* Possibly apply some default attributes to this built-in function. */
+ if (attrs)
+ decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
+ else
+ decl_attributes (&decl, NULL_TREE, 0);
+
+ return decl;
+}
+
+int
+objcp_lookup_identifier (token, id, check_conflict)
+ tree token;
+ tree *id;
+ int check_conflict;
+{
+ tree objc_id = lookup_objc_ivar (token);
+
+ if (!check_conflict || objc_id && IS_SUPER (objc_id))
+ *id = objc_id;
+ else if (objc_id && *id && IDENTIFIER_BINDING (token))
+ warning ("local declaration of `%s' hides instance variable",
+ IDENTIFIER_POINTER (token));
+
+ return (objc_id != NULL_TREE);
+}
diff --git a/gcc/objcp/objcp-decl.h b/gcc/objcp/objcp-decl.h
new file mode 100644
index 00000000000..945631d1b91
--- /dev/null
+++ b/gcc/objcp/objcp-decl.h
@@ -0,0 +1,100 @@
+/* Process the ObjC-specific declarations and variables for
+ the Objective-C++ compiler.
+ Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_OBJCP_DECL_H
+#define GCC_OBJCP_DECL_H
+
+/* APPLE LOCAL entire file */
+
+extern tree objcp_start_struct PARAMS ((enum tree_code, tree));
+extern tree objcp_finish_struct PARAMS ((tree, tree, tree));
+extern int objcp_start_function PARAMS ((tree, tree, tree));
+extern void objcp_finish_function PARAMS ((int));
+extern tree objcp_start_decl PARAMS ((tree, tree, int, tree));
+extern void objcp_finish_decl PARAMS ((tree, tree, tree));
+extern tree objcp_lookup_name PARAMS ((tree));
+extern tree objcp_push_parm_decl PARAMS ((tree));
+extern tree objcp_get_parm_info PARAMS ((int));
+extern void objcp_store_parm_decls PARAMS ((void));
+extern tree objcp_build_function_call PARAMS ((tree, tree));
+extern tree objcp_xref_tag PARAMS ((enum tree_code, tree));
+extern tree objcp_grokfield PARAMS ((const char *, int, tree, tree, tree));
+extern tree objcp_build_component_ref PARAMS ((tree, tree));
+extern int objcp_comptypes PARAMS ((tree, tree));
+extern tree objcp_type_name PARAMS ((tree));
+extern tree objcp_type_size PARAMS ((tree));
+extern tree objcp_builtin_function PARAMS ((const char *, tree, int,
+ enum built_in_class, const char *, tree));
+
+extern int objcp_lookup_identifier PARAMS ((tree, tree *, int));
+
+/* Now "cover up" the corresponding C++ functions if required (NB: the
+ OBJCP_ORIGINAL_FUNCTION macro, shown below, can still be used to
+ invoke the original C++ functions if needed). */
+#ifdef OBJCP_REMAP_FUNCTIONS
+
+#define start_struct(code, name) \
+ objcp_start_struct (code, name)
+#define finish_struct(t, fieldlist, attributes) \
+ objcp_finish_struct (t, fieldlist, attributes)
+#define start_function(declspecs, declarator, attributes) \
+ objcp_start_function (declspecs, declarator, attributes)
+#define finish_function(nested) \
+ objcp_finish_function (nested)
+#define start_decl(declarator, declspecs, initialized, attributes) \
+ objcp_start_decl (declarator, declspecs, initialized, attributes)
+#define finish_decl(decl, init, asmspec) \
+ objcp_finish_decl (decl, init, asmspec)
+#define lookup_name(name) \
+ objcp_lookup_name (name)
+#define push_parm_decl(parm) \
+ objcp_push_parm_decl (parm)
+#define get_parm_info(void_at_end) \
+ objcp_get_parm_info (void_at_end)
+#define store_parm_decls() \
+ objcp_store_parm_decls ()
+#define build_function_call(function, args) \
+ objcp_build_function_call (function, args)
+#define xref_tag(code, name) \
+ objcp_xref_tag (code, name)
+#define grokfield(filename, line, declarator, declspecs, width) \
+ objcp_grokfield (filename, line, declarator, declspecs, width)
+#define build_component_ref(datum, component) \
+ objcp_build_component_ref (datum, component)
+#define comptypes(type1, type2) \
+ objcp_comptypes (type1, type2)
+#define builtin_function(name, type, code, class, libname, attr) \
+ objcp_builtin_function(name, type, code, class, libname, attr)
+
+#undef TYPE_NAME
+#define TYPE_NAME(type) \
+ objcp_type_name (type)
+
+#undef TYPE_SIZE
+#define TYPE_SIZE(type) \
+ objcp_type_size (type)
+
+#define OBJCP_ORIGINAL_FUNCTION(name, args) (name)args
+
+#endif /* OBJCP_REMAP_FUNCTIONS */
+
+#endif /* ! GCC_OBJCP_DECL_H */
diff --git a/gcc/objcp/objcp-root.h b/gcc/objcp/objcp-root.h
new file mode 100644
index 00000000000..f55bc6a26f5
--- /dev/null
+++ b/gcc/objcp/objcp-root.h
@@ -0,0 +1,4 @@
+/* APPLE LOCAL file Objective-C++ */
+/* Empty file to be the base for gtype-objcp.h. */
+
+extern GTY(()) tree objcp_dummy;
diff --git a/gcc/opts.c b/gcc/opts.c
index 3bfa1c42ed0..5edbbbfdd30 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -134,6 +134,14 @@ static bool maybe_warn_unused_parameter;
debugging information. */
enum debug_info_type write_symbols = NO_DEBUG;
+/* APPLE LOCAL begin Symbol Separation */
+/* Original value of write_symbols. */
+enum debug_info_type orig_write_symbols = NO_DEBUG;
+
+/* Nonzero means, try to look for separate symbol repositories. */
+int flag_grepository = 0;
+/* APPLE LOCAL end Symbol Separation */
+
/* Level of debugging information we are producing. See flags.h for
the definitions of the different possible levels. */
enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
@@ -434,6 +442,10 @@ handle_option (const char **argv, unsigned int lang_mask)
return result;
}
+/* APPLE LOCAL radar 2866081: Env. variable override ilr */
+static int add_env_options PARAMS ((unsigned int *, const char ***));
+static int override_option PARAMS ((int, int, const char **));
+
/* Decode and handle the vector of command line options. LANG_MASK
contains has a single bit set representing the current
language. */
@@ -442,10 +454,23 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask)
{
unsigned int n, i;
+ /* APPLE LOCAL radar 2866081: Env. variable override ilr */
+ do {
+
for (i = 1; i < argc; i += n)
{
const char *opt = argv[i];
+ /* APPLE LOCAL begin radar 2866081: Env. variable override ilr */
+ if (!override_option (i, argc, argv))
+ {
+ ++i;
+ /* MERGE FIXME: we need to compute 'n'. */
+ n = 0;
+ continue;
+ }
+ /* APPLE LOCAL end radar 2866081: Env. variable override ilr */
+
/* Interpret "-" or a non-switch as a file name. */
if (opt[0] != '-' || opt[1] == '\0')
{
@@ -464,8 +489,518 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask)
error ("unrecognized command line option \"%s\"", opt);
}
}
+
+ /* APPLE LOCAL radar 2866081: Env. variable override ilr */
+ } while (add_env_options (&argc, &argv));
}
+/* APPLE LOCAL begin radar 2866081: Env. variable override ilr */
+/*--------------------------------------------------------------------*/
+
+/* The QA_OVERRIDE_GCC3_OPTIONS environment variable, if it exists,
+ contains a list of options which override their counterparts on
+ the compiler command line. This routine collects the options from
+ that environment variable and creates an array (env_override_options)
+ of n_overrides string pointers to then. Each command line option
+ is passed through override_option() to check to see if it has an
+ override in the env_override_options[] array.
+
+ The general form for QA_OVERRIDE_GCC3_OPTIONS is as follows:
+
+ -opt ... --opt arg s/pattern/replacement/ + -opt --opt arg ...
+
+ In other words a set of override options or option replacements in
+ the forms described below. The '+' means all options that the
+ following options are to be added to the command line if they don't
+ otherwise replace options.
+
+ The syntax of the options in QA_OVERRIDE_GCC3_OPTIONS can be any
+ of the following forms:
+
+ -f[no-]option, -m[no-]option, -W[no-]option
+ Override corresponding (ignoring the 'no-' prefix) options
+ on the command line.
+
+ --option arg
+ Indicates that the -option has an argument and that the
+ argument is to be replaced for that -option if it is
+ present on the command line.
+
+ +
+ Adds the options that follow to the command line. Any of above
+ option forms specified. They are added to the command line if
+ not otherwise used to override an existing command line
+ option.
+
+ s/-option/replacement-option/,
+ s/-option/replacement-option replacement-arg/,
+ s/--option/replacement-option/,
+ s/--option/replacement-option replacement-arg/
+ Replaces the -option and/or its argument. If there is nothing
+ between the second two /'s (which can be any character) the
+ option (and its arg for --option) are deleted. The --option
+ cases indicate that the option and its argument are to
+ be replaced either with an option that has no argument or
+ another (possibly the same option) that itself has an
+ argument.
+
+ Note, there should be only one space between the
+ replacement-option and replacement-arg.
+
+ Normally whenever a command line option is affected by the
+ options in QA_OVERRIDE_GCC3_OPTIONS are displayed confirming
+ what was done (to stderr). For example,
+
+ ### QA_OVERRIDE_GCC3_OPTIONS: -O2 -fno-inline
+ ### QA_OVERRIDE_GCC3_OPTIONS: Optimization set to -O2
+
+ This may be suppressed by placing a '#' as the first character
+ in the QA_OVERRIDE_GCC3_OPTIONS string.
+*/
+
+struct env_overrides {
+ char *option;
+ unsigned short flags;
+};
+#define env_ovr_used 1
+#define env_ovr_has_arg 2
+#define env_ovr_add_arg 4
+#define env_over_no_msg 8
+static struct env_overrides *env_override_options;
+static int n_overrides = 0;
+static int env_override_options_max = 0;
+static int have_added_opts = 0;
+static int add_env_opts = 0;
+static int env_ovr_confirm = 1;
+static char *extract_override_options PARAMS ((void));
+static void override_O_option PARAMS ((void));
+
+static char *
+extract_override_options (void)
+{
+ int has_arg = 0, scnt = 0, added_flag;
+ char *override_O = NULL, s = 0;
+ char *opts = getenv ("QA_OVERRIDE_GCC3_OPTIONS");
+
+ if (opts && *opts)
+ {
+ char c, *p, quote;
+ static char *override_options_line;
+
+ override_options_line = xstrdup (opts);
+
+ if (override_options_line[0] == '#')
+ {
+ env_ovr_confirm = 0;
+ p = override_options_line;
+ }
+ else
+ {
+ env_ovr_confirm = 1;
+ p = override_options_line - 1;
+ }
+
+ if (env_ovr_confirm)
+ fprintf (stderr, "### QA_OVERRIDE_GCC3_OPTIONS: %s\n",
+ override_options_line);
+
+ n_overrides = 0;
+
+ while (1)
+ {
+ while (*++p == ' ') ;
+ if ((c = *p) == '\0')
+ break;
+
+ if (p[0] == '-' && p[1] == 'O')
+ override_O = p;
+ else
+ {
+ if (p[0] == '+')
+ {
+ have_added_opts = env_ovr_add_arg;
+ continue;
+ }
+
+ if (p[0] == 's')
+ {
+ s = p[1];
+ scnt = 0;
+ added_flag = 0;
+ }
+ else
+ {
+ s = scnt = 0;
+ added_flag = have_added_opts;
+ }
+
+ if (n_overrides >= env_override_options_max)
+ {
+ env_override_options_max += 6;
+ env_override_options = (struct env_overrides *)
+ xrealloc (env_override_options,
+ sizeof (struct env_overrides)
+ * env_override_options_max);
+ if (n_overrides == 0) /* match argv[] counting */
+ ++n_overrides;
+ }
+
+ if (!has_arg && p[0] == '-' && p[1] == '-')
+ {
+ env_override_options[n_overrides].flags = env_ovr_has_arg | added_flag;
+ env_override_options[n_overrides].option = p + 1;
+ has_arg = 1;
+ }
+ else
+ {
+ env_override_options[n_overrides].flags = added_flag;
+ env_override_options[n_overrides].option = p--;
+ has_arg = 0;
+ }
+
+ ++n_overrides;
+ }
+
+ quote = 0;
+ while (*++p && (*p != ' ' || quote || s))
+ if (*p == '"' || *p == '\'')
+ quote = (quote && *p == quote) ? 0 : *p;
+ else if (*p == '\\')
+ ++p;
+ else if (*p == s && ++scnt == 3)
+ s = 0;
+
+ if (!*p)
+ break;
+
+ *p = '\0';
+ }
+ }
+
+ if (has_arg)
+ fatal_error ("QA_OVERRIDE_GCC3_OPTIONS invalid - last option should have an argument");
+
+ return override_O;
+}
+
+/* Called to handle -O overrides prior to main argument processing.
+ A -O option can be overridded from the QA_OVERRIDE_GCC3_OPTIONS
+ environment variable. Note that since this is prior to argument
+ processing we call extract_override_options() from here to build
+ the option overrides from QA_OVERRIDE_GCC3_OPTIONS. During
+ main line option processing we then call override_option() to
+ see if a specific option is overridden. */
+
+static void
+override_O_option (void)
+{
+ char *overide_opt = extract_override_options ();
+ int optimize0 = optimize, optimize_size0 = optimize_size;
+
+ if (!overide_opt)
+ return;
+
+ optimize = -1;
+ if (!strcmp (overide_opt, "-O"))
+ {
+ optimize = 1;
+ optimize_size = 0;
+ }
+ else if (overide_opt[0] == '-' && overide_opt[1] == 'O')
+ {
+ /* Handle -Os, -O2, -O3, -O69, ... */
+ char *p = overide_opt + 2;
+
+ if ((p[0] == 's') && (p[1] == 0))
+ {
+ optimize_size = 1;
+
+ /* Optimizing for size forces optimize to be 2. */
+ optimize = 2;
+ }
+ else
+ {
+ const int optimize_val = read_integral_parameter (p, p - 2, -1);
+ if (optimize_val != -1)
+ {
+ optimize = optimize_val;
+ optimize_size = 0;
+ }
+ }
+ }
+
+ if (optimize < 0)
+ fatal_error ("QA_OVERRIDE_GCC3_OPTIONS set with an invalid O option (%s).",
+ overide_opt);
+ if (env_ovr_confirm
+ && (optimize != optimize0 || optimize_size != optimize_size0))
+ fprintf (stderr, "### QA_OVERRIDE_GCC3_OPTIONS: Optimization set to %s\n", overide_opt);
+}
+
+/* Check to see if the specified command line option is overridden
+ by an option in the QA_OVERRIDE_GCC3_OPTIONS environment variable
+ string. If is isn't, return the original command line option. If
+ it is, return the override and display a message that the option
+ was overridden.
+
+ If add_env_opts is set then we only add options that are flagged to
+ be added. This is initiated when add_env_options() is called after
+ processing the command line options.
+*/
+
+static int
+override_option (int i, int argc, const char **argv)
+{
+ int j, len, parg;
+ char *p;
+ const char *opt;
+ char letter_opt1, letter_opt2, s = 0;
+ char *repopt = NULL;
+ char *reparg, *repend;
+ static char rep_option[256], rep_arg[256];
+
+ if (n_overrides == 0)
+ return 1;
+
+ if (add_env_opts)
+ {
+ if ((env_override_options[i].flags & env_ovr_add_arg) == 0
+ || (env_override_options[i].flags & env_ovr_used) != 0
+ || env_override_options[i].option == NULL)
+ return 0;
+ argv[i] = env_override_options[i].option;
+ if (env_override_options[i].flags & env_ovr_has_arg)
+ {
+ argv[i+1] = env_override_options[i+1].option;
+ if (env_ovr_confirm
+ && (env_override_options[i].flags & env_over_no_msg) == 0)
+ fprintf (stderr,
+ "### QA_OVERRIDE_GCC3_OPTIONS: Adding command line option '%s %s'\n",
+ argv[i], argv[i+1]);
+ }
+ else if (env_ovr_confirm
+ && (env_override_options[i].flags & env_over_no_msg) == 0)
+ fprintf (stderr, "### QA_OVERRIDE_GCC3_OPTIONS: Adding command line option '%s'\n",
+ argv[i]);
+ return 1;
+ }
+
+ if (!argv[i])
+ return 0;
+
+ opt = argv[i];
+ letter_opt1 = 0;
+
+ if (opt[0] == '-')
+ {
+ if (opt[1] == 'f' || opt[1] == 'm' || opt[1] == 'W')
+ {
+ letter_opt1 = opt[1];
+ opt += 2;
+ }
+ if (opt[0] == 'n' && opt[1] == 'o' && opt[2] == '-')
+ opt += 3;
+ }
+
+ for (j = 1; j < n_overrides; ++j)
+ {
+ p = env_override_options[j].option;
+ letter_opt2 = 0;
+ s = 0;
+ parg = 0;
+
+ if (p[0] == 's')
+ {
+ s = p[1];
+ p += 2;
+ repopt = strchr (p, s);
+ if (!repopt)
+ return 1;
+ *repopt++ = '\0';
+ if (p[0] == '-' && p[1] == '-')
+ {
+ parg = 1;
+ ++p;
+ }
+ }
+
+ if (p[0] == '-')
+ {
+ if (p[1] == 'f' || p[1] == 'm' || p[1] == 'W')
+ {
+ letter_opt2 = p[1];
+ p += 2;
+ }
+ if (p[0] == 'n' && p[1] == 'o' && p[2] == '-')
+ p += 3;
+ }
+
+ if (strcmp (p, opt) == 0 && letter_opt1 == letter_opt2)
+ {
+ if (i < argc - 1
+ && (env_override_options[j].flags & env_ovr_has_arg))
+ argv[i + 1] = env_override_options[j + 1].option;
+
+ if (s)
+ {
+ repend = strchr (repopt, s);
+ reparg = NULL;
+ if (repend)
+ {
+ reparg = strchr(repopt, ' ');
+ if (reparg)
+ {
+ strncpy (rep_option, repopt, len = reparg - repopt);
+ rep_option[len] = '\0';
+ ++reparg;
+ strncpy (rep_arg, reparg, len = repend - reparg);
+ rep_arg[len] = '\0';
+ }
+ else
+ {
+ strncpy (rep_option, repopt, len = repend - repopt);
+ rep_option[len] = rep_arg[0] = '\0';
+ }
+
+ if (len)
+ {
+ if (parg)
+ {
+ if (reparg) /* s/--opt/rep_option rep_arg/ */
+ {
+ if (strcmp (argv[i], rep_option) != 0
+ || strcmp (argv[i+1], rep_arg) == 0)
+ {
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fprintf (stderr,
+ "### QA_OVERRIDE_GCC3_OPTIONS: Replacing command line option '%s %s' with '%s %s'\n",
+ argv[i], argv[i + 1], rep_option, rep_arg);
+ argv[i] = rep_option;
+ argv[i + 1] = rep_arg;
+ }
+ }
+ else /* s/--opt/rep_option/ */
+ {
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fprintf (stderr,
+ "### QA_OVERRIDE_GCC3_OPTIONS: Replacing command line option '%s %s' with '%s'\n",
+ argv[i], argv[i + 1], rep_option);
+ argv[i] = rep_option;
+ argv[i+1] = NULL;
+ }
+ }
+ else if (reparg) /* s/-opt/rep_option rep_arg/ */
+ {
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fprintf (stderr,
+ "### QA_OVERRIDE_GCC3_OPTIONS: Replacing command line option '%s' with '%s %s'\n",
+ argv[i], rep_option, rep_arg);
+ if (n_overrides+1 >= env_override_options_max)
+ {
+ env_override_options_max += 6;
+ env_override_options = (struct env_overrides *)
+ xrealloc (env_override_options,
+ sizeof (struct env_overrides)
+ * env_override_options_max);
+ if (n_overrides == 0) /* match argv[] counting */
+ ++n_overrides;
+ }
+ env_override_options[n_overrides ].option = rep_option;
+ env_override_options[n_overrides++].flags = env_ovr_has_arg | env_ovr_add_arg | env_over_no_msg;
+ env_override_options[n_overrides ].option = rep_arg;
+ env_override_options[n_overrides++].flags = env_ovr_add_arg | env_over_no_msg;
+ argv[i] = NULL;
+ have_added_opts = 1;
+ }
+ else if (strcmp (argv[i], rep_option) != 0) /* s/-opt/rep_option/ */
+ {
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fprintf (stderr,
+ "### QA_OVERRIDE_GCC3_OPTIONS: Replacing command line option '%s' with '%s'\n",
+ argv[i], rep_option);
+ argv[i] = rep_option;
+ }
+ }
+ else
+ {
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fprintf (stderr, "### QA_OVERRIDE_GCC3_OPTIONS: Deleting command line option '%s", argv[i]);
+ if (parg)
+ {
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fprintf (stderr, " %s", argv[i + 1]);
+ argv[i + 1] = NULL;
+ }
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fputs ("'\n", stderr);
+ argv[i] = NULL;
+ }
+ }
+ *(repopt-1) = s;
+ env_override_options[j].flags |= env_ovr_used;
+ return argv[i] != NULL;
+ }
+ else if (strcmp (argv[i], env_override_options[j].option) != 0)
+ {
+ if (env_ovr_confirm
+ && (env_override_options[j].flags & env_ovr_used) == 0)
+ fprintf (stderr,
+ "### QA_OVERRIDE_GCC3_OPTIONS: Overriding command line option '%s' with '%s'\n",
+ argv[i], env_override_options[j].option);
+ argv[i] = env_override_options[j].option;
+ env_override_options[j].flags |= env_ovr_used;
+ return 1;
+ }
+ }
+ else if (s)
+ *(repopt-1) = s;
+ }
+
+ return 1;
+}
+
+/* Once all command line options are processed this routine is called
+ to see if QA_OVERRIDE_GCC3_OPTIONS specified any options to be
+ added. If there are we will return 1 to cause another option
+ processing pass. But this time argc and argv will be set to use
+ the env_override_options[] array and then only to select the added
+ options. */
+
+static int
+add_env_options (unsigned int *argc, const char ***argv)
+{
+ static unsigned int save_argc;
+ static const char **save_argv;
+
+ if (have_added_opts)
+ {
+ if (!add_env_opts)
+ {
+ save_argv = *argv;
+ save_argc = *argc;
+ *argc = n_overrides;
+ *argv = xmalloc (n_overrides * sizeof (char *));
+ add_env_opts = 1;
+ return 1;
+ }
+
+ free (*argv);
+ *argc = save_argc;
+ *argv = save_argv;
+ add_env_opts = 0;
+ }
+
+ return 0;
+}
+/* APPLE LOCAL end radar 2866081: Env. variable override ilr */
+
/* Handle FILENAME from the command line. */
void
add_input_filename (const char *filename)
@@ -518,8 +1053,35 @@ decode_options (unsigned int argc, const char **argv)
}
}
}
+ /* APPLE LOCAL begin -fast or -fastf or -fastcp */
+ else if (argv[i][0] == '-' && argv[i][1] == 'f')
+ {
+ const char *p = &argv[i][2];
+ if (!strcmp(p, "ast"))
+ flag_fast = 1;
+ else if (!strcmp(p, "astf"))
+ flag_fastf = 1;
+ else if (!strcmp(p, "astcp"))
+ flag_fastcp = 1;
+ }
+ /* APPLE LOCAL end -fast or -fastf */
}
+ /* APPLE LOCAL begin -fast or -fastf or -fastcp */
+ if (flag_fast || flag_fastf || flag_fastcp )
+ {
+ optimize = 3;
+ optimize_size = 0;
+ /* This goes here, rather than in rs6000.c, so that
+ later -fcommon can override it. */
+ if (flag_fast || flag_fastcp)
+ flag_no_common = 1;
+ }
+ /* APPLE LOCAL end -fast or -fastf or -fastcp */
+
+ /* APPLE LOCAL radar 2866081: Env. variable -O override ilr */
+ override_O_option ();
+
if (!optimize)
{
flag_merge_constants = 0;
@@ -537,15 +1099,20 @@ decode_options (unsigned int argc, const char **argv)
#endif
flag_guess_branch_prob = 1;
flag_cprop_registers = 1;
- flag_loop_optimize = 1;
+ flag_loop_optimize2 = 1;
flag_if_conversion = 1;
flag_if_conversion2 = 1;
flag_tree_ccp = 1;
flag_tree_dce = 1;
flag_tree_dom = 1;
flag_tree_dse = 1;
- flag_tree_loop = 0;
+ flag_tree_loop = 1;
+ flag_tree_vectorize = 0;
flag_tree_pre = 1;
+ flag_scalar_evolutions = 0;
+ flag_all_data_deps = 0;
+ flag_tree_elim_checks = 0;
+ flag_ddg = 0;
flag_tree_ter = 1;
flag_tree_sra = 1;
flag_tree_copyrename = 1;
@@ -610,6 +1177,9 @@ decode_options (unsigned int argc, const char **argv)
or less automatically remove extra jumps, but would also try to
use more short jumps instead of long jumps. */
flag_reorder_blocks = 0;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ flag_reorder_blocks_and_partition = 0;
+ /* APPLE LOCAL end hot/cold partitioning */
}
/* Initialize whether `char' is signed. */
@@ -666,6 +1236,21 @@ decode_options (unsigned int argc, const char **argv)
if (flag_really_no_inline == 2)
flag_really_no_inline = flag_no_inline;
+
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* The optimization to partition hot and cold basic blocks into separate
+ sections of the .o and executable files does not work (currently)
+ with exception handling. If flag_exceptions is turned on we need to
+ turn off the partitioning optimization. */
+
+ if (flag_exceptions && flag_reorder_blocks_and_partition)
+ {
+ warning
+ ("-freorder-blocks-and-partition does not work with exceptions");
+ flag_reorder_blocks_and_partition = 0;
+ flag_reorder_blocks = 1;
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
}
/* Handle target- and language-independent options. Return zero to
@@ -851,6 +1436,12 @@ common_handle_option (size_t scode, const char *arg,
flag_pie = value + value;
break;
+ /* APPLE LOCAL begin -floop-transpose */
+ case OPT_floop_transpose:
+ flag_loop_transpose = value;
+ break;
+ /* APPLE LOCAL end -floop-transpose */
+
case OPT_fabi_version_:
flag_abi_version = value;
break;
@@ -1122,6 +1713,10 @@ common_handle_option (size_t scode, const char *arg,
flag_loop_optimize = value;
break;
+ case OPT_floop_optimize2:
+ flag_loop_optimize2 = value;
+ break;
+
case OPT_fmath_errno:
flag_errno_math = value;
break;
@@ -1167,14 +1762,6 @@ common_handle_option (size_t scode, const char *arg,
flag_non_call_exceptions = value;
break;
- case OPT_fold_unroll_all_loops:
- flag_old_unroll_all_loops = value;
- break;
-
- case OPT_fold_unroll_loops:
- flag_old_unroll_loops = value;
- break;
-
case OPT_fomit_frame_pointer:
flag_omit_frame_pointer = value;
break;
@@ -1294,6 +1881,12 @@ common_handle_option (size_t scode, const char *arg,
flag_reorder_blocks = value;
break;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ case OPT_freorder_blocks_and_partition:
+ flag_reorder_blocks_and_partition = value;
+ break;
+ /* APPLE LOCAL end hot/cold partitioning */
+
case OPT_freorder_functions:
flag_reorder_functions = value;
break;
@@ -1467,6 +2060,30 @@ common_handle_option (size_t scode, const char *arg,
flag_tree_dce = value;
break;
+ case OPT_fscalar_evolutions:
+ flag_scalar_evolutions = value;
+ break;
+
+ case OPT_fall_data_deps:
+ flag_all_data_deps = value;
+ break;
+
+ case OPT_ftree_loop_linear:
+ flag_tree_loop_linear = value;
+ break;
+
+ case OPT_ftree_elim_checks:
+ flag_tree_elim_checks = value;
+ break;
+
+ case OPT_ftree_ddg:
+ flag_ddg = value;
+ break;
+
+ case OPT_ftree_vectorize:
+ flag_tree_vectorize = value;
+ break;
+
case OPT_ftree_combine_temps:
flag_tree_combine_temps = value;
break;
@@ -1722,9 +2339,46 @@ static void
set_debug_level (enum debug_info_type type, int extended, const char *arg)
{
static bool type_explicit;
+/* APPLE LOCAL gdb only used symbols ilr */
+ int g_all_len = 0;
use_gnu_debug_info_extensions = extended;
+/* APPLE LOCAL begin gdb only used symbols ilr */
+#ifdef DBX_ONLY_USED_SYMBOLS
+ if (strncmp (arg, "full", 4) == 0 || strncmp (arg, "-full", 5) == 0)
+ {
+ char *p = (char *)arg + (*(char *)arg == '-') + 4;
+ flag_debug_only_used_symbols = 0;
+ if (*p == '-')
+ ++p;
+ g_all_len = p - arg;
+ arg += g_all_len;
+ }
+ if (strncmp (arg, "used", 4) == 0 || strncmp (arg, "-used", 5) == 0)
+ {
+ char *p = (char *)arg + (*(char *)arg == '-') + 4;
+ flag_debug_only_used_symbols = 1;
+ if (*p == '-')
+ ++p;
+ g_all_len = p - arg;
+ arg += g_all_len;
+ }
+#endif
+/* APPLE LOCAL end gdb only used symbols ilr */
+
+/* APPLE LOCAL begin Symbol Separation */
+ if (strncmp (arg, "repository", 10) == 0 || strncmp (arg, "-repository", 11) == 0)
+ {
+ char *p = (char *)arg + (*(char *)arg == '-') + 10;
+ flag_grepository = 1;
+ if (*p == '-')
+ ++p;
+ g_all_len = p - arg;
+ arg += g_all_len;
+ }
+/* APPLE LOCAL end Symbol Separation */
+
if (type == NO_DEBUG)
{
if (write_symbols == NO_DEBUG)
@@ -1738,6 +2392,12 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg)
#elif defined DBX_DEBUGGING_INFO
write_symbols = DBX_DEBUG;
#endif
+/* APPLE LOCAL begin dwarf */
+/* Even though DWARF2_DEBUGGING_INFO is defined, use stabs for
+ debugging symbols with -ggdb. Remove this local patch when we
+ switch to dwarf. */
+ write_symbols = DBX_DEBUG;
+/* APPLE LOCAL end dwarf */
}
if (write_symbols == NO_DEBUG)
@@ -1768,6 +2428,10 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg)
else if (debug_info_level > 3)
error ("debug output level %s is too high", arg);
}
+
+ /* APPLE LOCAL Symbol Separation */
+ /* Save original value */
+ orig_write_symbols = write_symbols;
}
/* Output --help text. */
diff --git a/gcc/output.h b/gcc/output.h
index 3138ed2a99d..4fda6d57b54 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -157,6 +157,11 @@ extern int regno_clobbered_at_setjmp (int);
/* Tell assembler to switch to text section. */
extern void text_section (void);
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Tell assembler to switch to unlikely-to-be-executed text section. */
+extern void unlikely_text_section (void);
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Tell assembler to switch to data section. */
extern void data_section (void);
@@ -167,6 +172,11 @@ extern void readonly_data_section (void);
/* Determine if we're in the text section. */
extern int in_text_section (void);
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Determine if we're in the unlikely-to-be-executed text section. */
+extern int in_unlikely_text_section (void);
+/* APPLE LOCAL end hot/cold partitioning */
+
#ifdef CTORS_SECTION_ASM_OP
extern void ctors_section (void);
#endif
@@ -516,4 +526,8 @@ extern bool default_valid_pointer_mode (enum machine_mode);
extern int default_address_cost (rtx);
+/* APPLE LOCAL begin coalescing */
+extern int darwin_named_section_is (const char* name);
+/* APPLE LOCAL end coalescing */
+
#endif /* ! GCC_OUTPUT_H */
diff --git a/gcc/params.def b/gcc/params.def
index 7bb97b1ab4a..28e7c2eb5f5 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -229,6 +229,14 @@ DEFPARAM(PARAM_MAX_UNSWITCH_LEVEL,
"The maximum number of unswitchings in a single loop",
3)
+/* This parameter limits the size of loop for that we attempt to
+ do doloop optimalization. We set this quite high so that we do
+ not punish unrolled loops. */
+DEFPARAM(PARAM_MAX_DOLOOP_INSNS,
+ "max-doloop-insns",
+ "The maximum number of instructions of loop processed by doloop optimization",
+ 1000)
+
DEFPARAM(HOT_BB_COUNT_FRACTION,
"hot-bb-count-fraction",
"Select fraction of the maximal count of repetitions of basic block in \
@@ -281,6 +289,13 @@ DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH,
"The maximum length of path considered in cse",
10)
+/* The cost of expression in loop invariant motion to be considered
+ expensive. */
+DEFPARAM(PARAM_LIM_EXPENSIVE,
+ "lim-expensive",
+ "The minimum cost of expensive expression in the loop invariant motion",
+ 20)
+
/* The product of the next two is used to decide whether or not to
use .GLOBAL_VAR. See tree-dfa.c. */
DEFPARAM(PARAM_GLOBAL_VAR_THRESHOLD,
@@ -297,8 +312,10 @@ DEFPARAM(PARAM_MAX_CSELIB_MEMORY_LOCATIONS,
# define GGC_MIN_EXPAND_DEFAULT 0
# define GGC_MIN_HEAPSIZE_DEFAULT 0
#else
-# define GGC_MIN_EXPAND_DEFAULT 30
-# define GGC_MIN_HEAPSIZE_DEFAULT 4096
+/* APPLE LOCAL begin try to improve ggc */
+# define GGC_MIN_EXPAND_DEFAULT 100
+# define GGC_MIN_HEAPSIZE_DEFAULT 8192
+/* APPLE LOCAL end try to improve ggc*/
#endif
DEFPARAM(GGC_MIN_EXPAND,
diff --git a/gcc/passes.c b/gcc/passes.c
index e504fa2943a..a4ce3a5ff93 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -523,7 +523,9 @@ rest_of_handle_stack_regs (tree decl, rtx insns)
{
if (cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
| (flag_crossjumping ? CLEANUP_CROSSJUMP : 0))
- && flag_reorder_blocks)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ && (flag_reorder_blocks || flag_reorder_blocks_and_partition))
+ /* APPLE LOCAL end hot/cold partitioning */
{
reorder_basic_blocks ();
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
@@ -719,13 +721,15 @@ rest_of_handle_reorder_blocks (tree decl, rtx insns)
if (flag_sched2_use_traces && flag_schedule_insns_after_reload)
tracer ();
- if (flag_reorder_blocks)
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (flag_reorder_blocks || flag_reorder_blocks_and_partition)
reorder_basic_blocks ();
- if (flag_reorder_blocks
+ if (flag_reorder_blocks || flag_reorder_blocks_and_partition
|| (flag_sched2_use_traces && flag_schedule_insns_after_reload))
changed |= cleanup_cfg (CLEANUP_EXPENSIVE
| (!HAVE_conditional_execution
? CLEANUP_UPDATE_LIFE : 0));
+ /* APPLE LOCAL end hot/cold partitioning */
/* On conditional execution targets we can not update the life cheaply, so
we deffer the updating to after both cleanups. This may lose some cases
@@ -1250,10 +1254,7 @@ rest_of_handle_loop_optimize (tree decl, rtx insns)
/* CFG is no longer maintained up-to-date. */
free_bb_for_insn ();
- if (flag_unroll_loops)
- do_unroll = LOOP_AUTO_UNROLL; /* Having two unrollers is useless. */
- else
- do_unroll = flag_old_unroll_loops ? LOOP_UNROLL : LOOP_AUTO_UNROLL;
+ do_unroll = flag_unroll_loops ? LOOP_UNROLL : LOOP_AUTO_UNROLL;
do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0;
if (flag_rerun_loop_opt)
@@ -1275,7 +1276,7 @@ rest_of_handle_loop_optimize (tree decl, rtx insns)
reg_scan (insns, max_reg_num (), 1);
}
cleanup_barriers ();
- loop_optimize (insns, dump_file, do_unroll | LOOP_BCT | do_prefetch);
+ loop_optimize (insns, dump_file, do_unroll | do_prefetch);
/* Loop can create trivially dead instructions. */
delete_trivially_dead_insns (insns, max_reg_num ());
@@ -1289,12 +1290,19 @@ rest_of_handle_loop_optimize (tree decl, rtx insns)
/* Perform loop optimizations. It might be better to do them a bit
sooner, but we want the profile feedback to work more
efficiently. */
+
static void
rest_of_handle_loop2 (tree decl, rtx insns)
{
struct loops *loops;
basic_block bb;
+ if (!flag_unswitch_loops
+ && !flag_peel_loops
+ && !flag_unroll_loops
+ && !flag_branch_on_count_reg)
+ return;
+
timevar_push (TV_LOOP);
open_dump_file (DFI_loop2, decl);
if (dump_file)
@@ -1308,6 +1316,8 @@ rest_of_handle_loop2 (tree decl, rtx insns)
if (loops)
{
/* The optimizations: */
+ move_loop_invariants (loops);
+
if (flag_unswitch_loops)
unswitch_loops (loops);
@@ -1317,6 +1327,11 @@ rest_of_handle_loop2 (tree decl, rtx insns)
(flag_unroll_loops ? UAP_UNROLL : 0) |
(flag_unroll_all_loops ? UAP_UNROLL_ALL : 0));
+#ifdef HAVE_doloop_end
+ if (flag_branch_on_count_reg && HAVE_doloop_end)
+ doloop_optimize_loops (loops);
+#endif /* HAVE_doloop_end */
+
loop_optimizer_finalize (loops, dump_file);
}
@@ -1595,9 +1610,7 @@ rest_of_compilation (tree decl)
rest_of_handle_tracer (decl, insns);
if (optimize > 0
- && (flag_unswitch_loops
- || flag_peel_loops
- || flag_unroll_loops))
+ && flag_loop_optimize2)
rest_of_handle_loop2 (decl, insns);
if (flag_web)
@@ -1616,6 +1629,22 @@ rest_of_compilation (tree decl)
if (flag_if_conversion)
rest_of_handle_if_after_combine (decl, insns);
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* The optimization to partition hot/cold basic blocks into separate
+ sections of the .o file does not work well with exception handling.
+ Don't call it if there are exceptions. */
+
+ if (flag_reorder_blocks_and_partition)
+ {
+ no_new_pseudos = 0;
+ partition_hot_cold_basic_blocks ();
+ allocate_reg_life_data ();
+ update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
+ PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES);
+ no_new_pseudos = 1;
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
+
if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
rest_of_handle_regmove (decl, insns);
diff --git a/gcc/predict.c b/gcc/predict.c
index 0069274d0f2..83932cf2bb2 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -612,6 +612,9 @@ predict_loops (struct loops *loops_info, bool simpleloops)
/* Free basic blocks from get_loop_body. */
free (bbs);
}
+
+ if (simpleloops)
+ iv_analysis_done ();
}
/* Statically estimate the probability that a branch will be taken and produce
@@ -1578,6 +1581,14 @@ choose_function_section (void)
of all instances. For now just never set frequency for these. */
|| DECL_ONE_ONLY (current_function_decl))
return;
+
+ /* APPLE LOCAL hot/cold partitioning */
+ /* If we are doing the partitioning optimization, let the optimization
+ choose the correct section into which to put things. */
+ if (flag_reorder_blocks_and_partition)
+ return;
+ /* APPLE LOCAL hot/cold partitioning */
+
if (cfun->function_frequency == FUNCTION_FREQUENCY_HOT)
DECL_SECTION_NAME (current_function_decl) =
build_string (strlen (HOT_TEXT_SECTION_NAME), HOT_TEXT_SECTION_NAME);
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index b3f72a5269b..3bf400f5575 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -291,6 +291,16 @@ print_rtx (rtx in_rtx)
fprintf (outfile, " [ ERROR ]");
break;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ case NOTE_INSN_UNLIKELY_EXECUTED_CODE:
+ {
+ basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
+ if (bb != 0)
+ fprintf (outfile, " [bb %d]", bb->index);
+ break;
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
+
case NOTE_INSN_VAR_LOCATION:
fprintf (outfile, " (");
print_mem_expr (outfile, NOTE_VAR_LOCATION_DECL (in_rtx));
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 259466cebb6..e123ef15945 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -275,6 +275,10 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
fputs (" static", file);
if (TREE_DEPRECATED (node))
fputs (" deprecated", file);
+ /* APPLE LOCAL begin unavailable (Radar 2809697) ilr */
+ if (TREE_UNAVAILABLE (node))
+ fputs (" unavailable", file);
+ /* APPLE LOCAL end unavailable ilr */
if (TREE_VISITED (node))
fputs (" visited", file);
if (TREE_LANG_FLAG_0 (node))
@@ -318,6 +322,10 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (DECL_NONLOCAL (node))
fputs (" nonlocal", file);
+ /* APPLE LOCAL coalescing */
+ if (DECL_COALESCED (node))
+ fputs (" coalesced", file);
+
if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
fputs (" suppress-debug", file);
diff --git a/gcc/ra-build.c b/gcc/ra-build.c
index 4f0eac0b166..8c2d1a0f448 100644
--- a/gcc/ra-build.c
+++ b/gcc/ra-build.c
@@ -2301,8 +2301,14 @@ remember_web_was_spilled (struct web *web)
reg_class_contents[reg_alternate_class (web->regno)]);
}
else
+/* APPLE LOCAL */
+#ifdef TARGET_POWERPC
+ COPY_HARD_REG_SET (web->usable_regs,
+ reg_class_contents[(int) NON_SPECIAL_REGS]);
+#else
COPY_HARD_REG_SET (web->usable_regs,
reg_class_contents[(int) GENERAL_REGS]);
+#endif
AND_COMPL_HARD_REG_SET (web->usable_regs, never_use_colors);
prune_hardregs_for_mode (&web->usable_regs, PSEUDO_REGNO_MODE (web->regno));
#ifdef CANNOT_CHANGE_MODE_CLASS
diff --git a/gcc/regrename.c b/gcc/regrename.c
index e15bd87f861..a653966fdb2 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1267,6 +1267,14 @@ static bool
mode_change_ok (enum machine_mode orig_mode, enum machine_mode new_mode,
unsigned int regno ATTRIBUTE_UNUSED)
{
+ /* APPLE LOCAL begin add mode change case */
+#ifdef TARGET_POWERPC
+ /* This arises from FLOAT_EXTEND which is really a NOP. */
+ if (orig_mode == SFmode && new_mode == DFmode)
+ return true;
+#endif
+ /* APPLE LOCAL end add mode change case */
+
if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
return false;
@@ -1712,6 +1720,15 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
/* Notice copies. */
if (set && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set)))
copy_value (SET_DEST (set), SET_SRC (set), vd);
+ /* APPLE LOCAL begin record that float extend is a copy */
+#ifdef TARGET_POWERPC
+ /* FLOAT_EXTEND is actually a copy; record that too. */
+ if (set && REG_P (SET_DEST (set))
+ && GET_CODE (SET_SRC (set)) == FLOAT_EXTEND
+ && REG_P (XEXP (SET_SRC (set), 0)))
+ copy_value (SET_DEST (set), XEXP (SET_SRC (set), 0), vd);
+#endif
+ /* APPLE LOCAL end record that float extend is a copy */
if (insn == BB_END (bb))
break;
diff --git a/gcc/reload.c b/gcc/reload.c
index ae211302efa..2b069a27d18 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -1300,18 +1300,31 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
and IN or CLASS and OUT. Get the icode and push any required reloads
needed for each of them if so. */
+ /* APPLE LOCAL restoration of inmode/outmode */
#ifdef SECONDARY_INPUT_RELOAD_CLASS
if (in != 0)
- secondary_in_reload
- = push_secondary_reload (1, in, opnum, optional, class, inmode, type,
- &secondary_in_icode);
+ {
+ secondary_in_reload
+ = push_secondary_reload (1, in, opnum, optional, class, inmode, type,
+ &secondary_in_icode);
+#ifdef TARGET_POWERPC
+ if ( secondary_in_reload != -1 && in_subreg_loc )
+ inmode = GET_MODE (*in_subreg_loc);
+#endif
+ }
#endif
#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
if (out != 0 && GET_CODE (out) != SCRATCH)
- secondary_out_reload
- = push_secondary_reload (0, out, opnum, optional, class, outmode,
- type, &secondary_out_icode);
+ {
+ secondary_out_reload
+ = push_secondary_reload (0, out, opnum, optional, class, outmode,
+ type, &secondary_out_icode);
+#ifdef TARGET_POWERPC
+ if ( secondary_out_reload != -1 && out_subreg_loc )
+ outmode = GET_MODE (*out_subreg_loc);
+#endif
+ }
#endif
/* We found no existing reload suitable for re-use.
@@ -1720,7 +1733,13 @@ combine_reloads (void)
if ((rld[i].when_needed == RELOAD_FOR_OUTPUT_ADDRESS
|| rld[i].when_needed == RELOAD_FOR_OUTADDR_ADDRESS)
&& rld[i].opnum == rld[output_reload].opnum)
+ /* APPLE LOCAL begin try destroyed input */
+#ifdef TARGET_POWERPC
+ goto try_destroyed_input;
+#else
return;
+#endif
+ /* APPLE LOCAL end try destroyed input */
/* Check each input reload; can we combine it? */
@@ -1817,6 +1836,11 @@ combine_reloads (void)
that it does not occur in the output (we already know it isn't an
earlyclobber. If this is an asm insn, give up. */
+ /* APPLE LOCAL begin try destroyed input */
+#ifdef TARGET_POWERPC
+ try_destroyed_input:
+#endif
+ /* APPLE LOCAL end try destroyed input */
if (INSN_CODE (this_insn) == -1)
return;
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 9f545d83623..6260654e8c0 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -134,7 +134,7 @@ const char * const reg_note_name[] =
"REG_VALUE_PROFILE", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
"REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
"REG_SAVE_NOTE", "REG_MAYBE_DEAD", "REG_NORETURN",
- "REG_NON_LOCAL_GOTO", "REG_SETJMP", "REG_ALWAYS_RETURN",
+ "REG_NON_LOCAL_GOTO", "REG_CROSSING_JUMP", "REG_SETJMP", "REG_ALWAYS_RETURN",
"REG_VTABLE_REF"
};
diff --git a/gcc/rtl.h b/gcc/rtl.h
index b6807424495..1fa5f13e729 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -193,6 +193,8 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
1 in a CALL_INSN if it is a sibling call.
1 in a SET that is for a return.
In a CODE_LABEL, part of the two-bit alternate entry field. */
+ /* APPLE LOCAL weak import
+ SYMBOL_REF_WEAK_IMPORT in a SYMBOL_REF. */
unsigned int jump : 1;
/* In a CODE_LABEL, part of the two-bit alternate entry field.
1 in a MEM if it cannot trap. */
@@ -850,6 +852,13 @@ enum reg_note
computed goto. */
REG_NON_LOCAL_GOTO,
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* Indicates that a jump crosses between hot and cold sections
+ in a (partitioned) assembly or .o file, and therefore should not be
+ reduced to a simpler jump by optimizations. */
+ REG_CROSSING_JUMP,
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* This kind of note is generated at each to `setjmp',
and similar functions that can return twice. */
REG_SETJMP,
@@ -1011,6 +1020,12 @@ enum insn_note
/* Record a prediction. Uses NOTE_PREDICTION. */
NOTE_INSN_PREDICTION,
+ /* APPLE LOCAL begin hot/cold partitioning */
+ /* Record that the current basic block is unlikely to be executed and
+ should be moved to the UNLIKELY_EXECUTED_TEXT_SECTION. */
+ NOTE_INSN_UNLIKELY_EXECUTED_CODE,
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* The location of a variable. */
NOTE_INSN_VAR_LOCATION,
@@ -1390,6 +1405,12 @@ do { \
#define SYMBOL_REF_WEAK(RTX) \
(RTL_FLAG_CHECK1("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
+/* APPLE LOCAL begin weak import */
+/* 1 means a SYMBOL_REF is weak import. */
+#define SYMBOL_REF_WEAK_IMPORT(RTX) \
+ (RTL_FLAG_CHECK1("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->jump)
+/* APPLE LOCAL end weak import */
+
/* The tree (decl or constant) associated with the symbol, or null. */
#define SYMBOL_REF_DECL(RTX) X0TREE ((RTX), 2)
@@ -1639,6 +1660,9 @@ extern rtx simplify_subtraction (rtx);
/* In function.c */
extern rtx assign_stack_local (enum machine_mode, HOST_WIDE_INT, int);
+/* APPLE LOCAL next declaration */
+extern rtx assign_stack_local_with_alias (enum machine_mode,
+ HOST_WIDE_INT, int);
extern rtx assign_stack_temp (enum machine_mode, HOST_WIDE_INT, int);
extern rtx assign_stack_temp_for_type (enum machine_mode,
HOST_WIDE_INT, int, tree);
@@ -2433,6 +2457,20 @@ extern bool expensive_function_p (int);
/* In tracer.c */
extern void tracer (void);
+/* In stor-layout.c. */
+extern void get_mode_bounds (enum machine_mode, int, rtx *, rtx *);
+
+/* In doloop.c. */
+extern rtx doloop_condition_get (rtx);
+
+/* In loop-unswitch.c */
+extern rtx reversed_condition (rtx);
+extern rtx compare_and_jump_seq (rtx, rtx, enum rtx_code, rtx, int, rtx);
+
+/* In loop-iv.c */
+extern rtx canon_condition (rtx);
+extern void simplify_using_condition (rtx, rtx *, struct bitmap_head_def *);
+
/* In var-tracking.c */
extern void variable_tracking_main (void);
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 673416fca07..8dd3f52724b 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -63,6 +63,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h"
#include "recog.h"
#include "cfglayout.h"
+#include "params.h"
#include "sched-int.h"
#include "target.h"
@@ -156,7 +157,7 @@ static int *containing_rgn;
void debug_regions (void);
static void find_single_block_region (void);
static void find_rgns (struct edge_list *);
-static int too_large (int, int *, int *);
+static bool too_large (int, int *, int *);
extern void debug_live (int, int);
@@ -551,10 +552,10 @@ find_single_block_region (void)
}
/* Update number of blocks and the estimate for number of insns
- in the region. Return 1 if the region is "too large" for interblock
- scheduling (compile time considerations), otherwise return 0. */
+ in the region. Return true if the region is "too large" for interblock
+ scheduling (compile time considerations). */
-static int
+static bool
too_large (int block, int *num_bbs, int *num_insns)
{
(*num_bbs)++;
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 2ade695b980..f880b461f26 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1572,7 +1572,11 @@ simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
return simplify_gen_unary (NEG, mode, op1, mode);
/* (-1 - a) is ~a. */
- if (trueop0 == constm1_rtx)
+ /* APPLE LOCAL disallow (not (SYM))
+ But not when a is relocatable (this arises temporarily when
+ pulling 386 global addresses out of a loop). */
+ if (trueop0 == constm1_rtx
+ && GET_CODE (op1) != SYMBOL_REF )
return simplify_gen_unary (NOT, mode, op1, mode);
/* Subtracting 0 has no effect unless the mode has signed zeros
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 95e7988c678..43904839213 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -80,6 +80,15 @@ int immediate_size_expand;
/* Show that REFERENCE_TYPES are internal and should be Pmode. Called only
by front end. */
+/* APPLE LOCAL begin Macintosh alignment 2002-5-24 ff */
+/* Keep track of whether we are laying out the first declared member
+ of a C++ class. We need this flag to handle the case of classes
+ with v-tables where the test to see if the offset in the record
+ is zero is not sufficient to determine if we are dealing with the
+ first declared member. */
+int darwin_align_is_first_member_of_class = 0;
+/* APPLE LOCAL end Macintosh alignment 2002-5-24 ff */
+
void
internal_reference_types (void)
{
@@ -459,6 +468,12 @@ layout_decl (tree decl, unsigned int known_align)
|| DECL_SIZE_UNIT (decl) == 0
|| TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST))
DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
+/* APPLE LOCAL begin Macintosh alignment 2002-2-12 ff */
+#ifdef PEG_ALIGN_FOR_MAC68K
+ else if (TARGET_ALIGN_MAC68K)
+ DECL_ALIGN (decl) = PEG_ALIGN_FOR_MAC68K (DECL_ALIGN (decl));
+#endif
+/* APPLE LOCAL end Macintosh alignment 2002-2-12 ff */
/* Should this be controlled by DECL_USER_ALIGN, too? */
if (maximum_field_alignment != 0)
@@ -473,7 +488,10 @@ layout_decl (tree decl, unsigned int known_align)
= MIN (DECL_ALIGN (decl), (unsigned) BIGGEST_FIELD_ALIGNMENT);
#endif
#ifdef ADJUST_FIELD_ALIGN
- DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl));
+ /* APPLE LOCAL begin Macintosh alignment 2002-5-24 ff */
+ DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl),
+ known_align == 0);
+ /* APPLE LOCAL end Macintosh alignment 2002-5-24 ff */
#endif
}
}
@@ -690,6 +708,19 @@ update_alignment_for_field (record_layout_info rli, tree field,
&& DECL_BIT_FIELD_TYPE (field)
&& ! integer_zerop (TYPE_SIZE (type)));
+#ifdef ADJUST_FIELD_ALIGN
+ if (! user_align)
+ /* APPLE LOCAL begin Macintosh alignment 2002-5-24 ff */
+ /* The third argument to ADJUST_FIELD_ALIGN indicates whether
+ we are dealing with the first field of the structure. */
+ desired_align =
+ ADJUST_FIELD_ALIGN (field, desired_align,
+ (darwin_align_is_first_member_of_class
+ || (integer_zerop (rli->offset)
+ && integer_zerop (rli->bitpos))));
+ /* APPLE LOCAL end Macintosh alignment 2002-5-24 ff */
+#endif
+
/* Record must have at least as much alignment as any field.
Otherwise, the alignment of the field within the record is
meaningless. */
@@ -726,13 +757,24 @@ update_alignment_for_field (record_layout_info rli, tree field,
#ifdef ADJUST_FIELD_ALIGN
if (! TYPE_USER_ALIGN (type))
- type_align = ADJUST_FIELD_ALIGN (field, type_align);
+ /* APPLE LOCAL begin Macintosh alignment */
+ type_align = ADJUST_FIELD_ALIGN (field, type_align,
+ (darwin_align_is_first_member_of_class
+ || (integer_zerop (rli->offset)
+ && integer_zerop (rli->bitpos))));
+ /* APPLE LOCAL end Macintosh alignment */
#endif
if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment);
else if (DECL_PACKED (field))
type_align = MIN (type_align, BITS_PER_UNIT);
+/* APPLE LOCAL begin Macintosh alignment 2002-2-12 ff */
+#ifdef PEG_ALIGN_FOR_MAC68K
+ else if (TARGET_ALIGN_MAC68K)
+ type_align = PEG_ALIGN_FOR_MAC68K (type_align);
+#endif
+/* APPLE LOCAL end Macintosh alignment 2002-2-12 ff */
/* The alignment of the record is increased to the maximum
of the current alignment, the alignment indicated on the
@@ -919,6 +961,11 @@ place_field (record_layout_info rli, tree field)
&& DECL_BIT_FIELD (field)
&& ! DECL_PACKED (field)
&& maximum_field_alignment == 0
+/* APPLE LOCAL begin Macintosh alignment 2002-2-12 ff */
+#ifdef PEG_ALIGN_FOR_MAC68K
+ && ! TARGET_ALIGN_MAC68K
+#endif
+/* APPLE LOCAL end Macintosh alignment 2002-2-12 ff */
&& ! integer_zerop (DECL_SIZE (field))
&& host_integerp (DECL_SIZE (field), 1)
&& host_integerp (rli->offset, 1)
@@ -932,7 +979,12 @@ place_field (record_layout_info rli, tree field)
#ifdef ADJUST_FIELD_ALIGN
if (! TYPE_USER_ALIGN (type))
- type_align = ADJUST_FIELD_ALIGN (field, type_align);
+ /* APPLE LOCAL begin Macintosh alignment */
+ type_align = ADJUST_FIELD_ALIGN (field, type_align,
+ (darwin_align_is_first_member_of_class
+ || (integer_zerop (rli->offset)
+ && integer_zerop (rli->bitpos))));
+ /* APPLE LOCAL end Macintosh alignment */
#endif
/* A bit field may not span more units of alignment of its type
@@ -964,7 +1016,12 @@ place_field (record_layout_info rli, tree field)
#ifdef ADJUST_FIELD_ALIGN
if (! TYPE_USER_ALIGN (type))
- type_align = ADJUST_FIELD_ALIGN (field, type_align);
+ /* APPLE LOCAL begin Macintosh alignment */
+ type_align = ADJUST_FIELD_ALIGN (field, type_align,
+ (darwin_align_is_first_member_of_class
+ || (integer_zerop (rli->offset)
+ && integer_zerop (rli->bitpos))));
+ /* APPLE LOCAL end Macintosh alignment */
#endif
if (maximum_field_alignment != 0)
@@ -973,6 +1030,12 @@ place_field (record_layout_info rli, tree field)
statement, so this code is unreachable currently. */
else if (DECL_PACKED (field))
type_align = MIN (type_align, BITS_PER_UNIT);
+/* APPLE LOCAL begin Macintosh alignment 2002-2-12 ff */
+#ifdef PEG_ALIGN_FOR_MAC68K
+ else if (TARGET_ALIGN_MAC68K)
+ type_align = PEG_ALIGN_FOR_MAC68K (type_align);
+#endif
+/* APPLE LOCAL end Macintosh alignment 2002-2-12 ff */
/* A bit field may not span the unit of alignment of its type.
Advance to next boundary if necessary. */
@@ -1327,6 +1390,16 @@ compute_record_mode (tree type)
RECORD_TYPE. This does not apply to unions. */
if (TREE_CODE (type) == RECORD_TYPE && mode != VOIDmode)
TYPE_MODE (type) = mode;
+ /* APPLE LOCAL 8-byte-struct hack */
+#if defined RS6000_VARARGS_AREA
+ /* Make 8-byte structs BLKmode instead of DImode, which fixes both
+ struct-return methods and attempts to use floats in kernel code.
+ This should probably become a generic macro similar to
+ MEMBER_TYPE_FORCES_BLK above. */
+ else if (mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1) == DImode
+ && flag_pic)
+ ;
+#endif
else
TYPE_MODE (type) = mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1);
diff --git a/gcc/stringpool.c b/gcc/stringpool.c
index 0cf3be14f88..d7b25e1492c 100644
--- a/gcc/stringpool.c
+++ b/gcc/stringpool.c
@@ -122,6 +122,7 @@ get_identifier_with_length (const char *text, size_t length)
return HT_IDENT_TO_GCC_IDENT (ht_node);
}
+
/* If an identifier with the name TEXT (a null-terminated string) has
previously been referred to, return that node; otherwise return
NULL_TREE. */
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 89af47e12ee..8305ae5ae8b 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -270,6 +270,16 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_INIT_BUILTINS hook_void_void
#define TARGET_EXPAND_BUILTIN default_expand_builtin
+/* APPLE LOCAL begin constant cfstrings */
+/* In c-common.c. */
+#ifndef TARGET_EXPAND_TREE_BUILTIN
+#define TARGET_EXPAND_TREE_BUILTIN hook_tree_tree_tree_tree_null
+#endif
+#ifndef TARGET_CONSTRUCT_OBJC_STRING
+#define TARGET_CONSTRUCT_OBJC_STRING hook_tree_tree_null
+#endif
+/* APPLE LOCAL end constant cfstrings */
+
/* In varasm.c. */
#ifndef TARGET_SECTION_TYPE_FLAGS
#define TARGET_SECTION_TYPE_FLAGS default_section_type_flags
@@ -305,6 +315,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
#define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
#define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_false
+#define TARGET_MANGLE_FUNDAMENTAL_TYPE hook_constcharptr_tree_null
#ifndef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS hook_void_void
@@ -318,6 +329,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_ENCODE_SECTION_INFO default_encode_section_info
#endif
+/* APPLE LOCAL begin AltiVec */
+#define TARGET_EXPAND_MACRO_P hook_bool_constcpp_tokenp_false
+#define TARGET_CAST_EXPR_AS_VECTOR_INIT false
+/* APPLE LOCAL end AltiVec */
+
#define TARGET_FIXED_CONDITION_CODE_REGS hook_bool_uintp_uintp_false
#define TARGET_CC_MODES_COMPATIBLE default_cc_modes_compatible
@@ -347,6 +363,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_SETUP_INCOMING_VARARGS default_setup_incoming_varargs
#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_false
#define TARGET_PRETEND_OUTGOING_VARARGS_NAMED default_pretend_outgoing_varargs_named
+/* APPLE LOCAL begin Altivec */
+#define TARGET_SKIP_VEC_ARGS default_skip_vec_args
+/* APPLE LOCAL end Altivec */
#define TARGET_CALLS { \
TARGET_PROMOTE_FUNCTION_ARGS, \
@@ -359,6 +378,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_SETUP_INCOMING_VARARGS, \
TARGET_STRICT_ARGUMENT_NAMING, \
TARGET_PRETEND_OUTGOING_VARARGS_NAMED, \
+ /* APPLE LOCAL begin Altivec */ \
+ TARGET_SKIP_VEC_ARGS, \
+ /* APPLE LOCAL end Altivec */ \
}
/* The whole shebang. */
@@ -376,6 +398,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_MS_BITFIELD_LAYOUT_P, \
TARGET_INIT_BUILTINS, \
TARGET_EXPAND_BUILTIN, \
+ /* APPLE LOCAL begin constant cfstrings */ \
+ TARGET_EXPAND_TREE_BUILTIN, \
+ TARGET_CONSTRUCT_OBJC_STRING, \
+ /* APPLE LOCAL end constant cfstrings */ \
+ TARGET_MANGLE_FUNDAMENTAL_TYPE, \
TARGET_INIT_LIBFUNCS, \
TARGET_SECTION_TYPE_FLAGS, \
TARGET_CANNOT_MODIFY_JUMPS_P, \
@@ -410,6 +437,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_TERMINATE_DW2_EH_FRAME_INFO, \
TARGET_ASM_FILE_START_APP_OFF, \
TARGET_ASM_FILE_START_FILE_DIRECTIVE, \
+ /* APPLE LOCAL begin AltiVec */ \
+ TARGET_EXPAND_MACRO_P, \
+ TARGET_CAST_EXPR_AS_VECTOR_INIT, \
+ /* APPLE LOCAL end AltiVec */ \
TARGET_CALLS, \
}
diff --git a/gcc/target.h b/gcc/target.h
index 2387e4dd38a..b9b4a474015 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -308,6 +308,23 @@ struct gcc_target
rtx (* expand_builtin) (tree exp, rtx target, rtx subtarget,
enum machine_mode mode, int ignore);
+ /* APPLE LOCAL begin constant cfstrings */
+ /* Expand a platform-specific (but machine-independent) builtin. */
+ tree (* expand_tree_builtin) (tree function, tree params,
+ tree coerced_params);
+
+ /* Construct a target-specific Objective-C string object based on the
+ STRING_CST passed in STR, or NULL if the default Objective-C objects
+ (based on NSConstantString or NXConstantString) should be used
+ instead. */
+ tree (* construct_objc_string) (tree str);
+ /* APPLE LOCAL end constant cfstrings */
+
+ /* For a vendor-specific fundamental TYPE, return a pointer to
+ a statically-allocated string containing the C++ mangling for
+ TYPE. In all other cases, return NULL. */
+ const char * (* mangle_fundamental_type) (tree type);
+
/* Make any adjustments to libfunc names needed for this target. */
void (* init_libfuncs) (void);
@@ -455,6 +472,20 @@ struct gcc_target
at the beginning of assembly output. */
bool file_start_file_directive;
+ /* APPLE LOCAL begin AltiVec */
+ /* Return true if we should expand a disabled (conditional) macro. */
+ bool (* expand_macro_p) (const struct cpp_token *);
+
+ /* True if it is permissible to use cast expressions as
+ vector initializers, e.g.:
+
+ (vector unsigned int)(3, 4, 5, 6)
+ (vector float)(2.5)
+
+ This is required for the Motorola AltiVec syntax on the PowerPC. */
+ bool cast_expr_as_vector_init;
+ /* APPLE LOCAL end AltiVec */
+
/* Functions relating to calls - argument passing, returns, etc. */
struct calls {
bool (*promote_function_args) (tree fntype);
@@ -472,6 +503,9 @@ struct gcc_target
targetm.calls.setup_incoming_varargs() and/or
targetm.calls.strict_argument_naming(). */
bool (*pretend_outgoing_varargs_named) (CUMULATIVE_ARGS *ca);
+ /* APPLE LOCAL begin Altivec */
+ bool (*skip_vec_args) (tree, int, int*);
+ /* APPLE LOCAL end Altivec */
} calls;
};
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index c93a1a8ec66..a37f2732f8f 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -127,6 +127,14 @@ default_pretend_outgoing_varargs_named(CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED)
return (targetm.calls.setup_incoming_varargs != default_setup_incoming_varargs);
}
+bool
+default_skip_vec_args(tree type ATTRIBUTE_UNUSED,
+ int pass ATTRIBUTE_UNUSED,
+ int* last_pass ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
/* Generic hook that takes a CUMULATIVE_ARGS pointer and returns true. */
bool
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index f90d6b3612c..2e13325b2ab 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -30,5 +30,8 @@ extern void default_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode
extern rtx default_builtin_setjmp_frame_value (void);
extern bool hook_bool_CUMULATIVE_ARGS_false (CUMULATIVE_ARGS *);
extern bool default_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *);
+/* APPLE LOCAL begin Altivec */
+extern bool default_skip_vec_args (tree, int, int*);
+/* APPLE LOCAL end Altivec */
extern bool hook_bool_CUMULATIVE_ARGS_true (CUMULATIVE_ARGS *);
diff --git a/gcc/testsuite/ChangeLog.apple-ppc b/gcc/testsuite/ChangeLog.apple-ppc
new file mode 100644
index 00000000000..2d2627dbce7
--- /dev/null
+++ b/gcc/testsuite/ChangeLog.apple-ppc
@@ -0,0 +1,4 @@
+2004-04-29 Devang Patel <dpatel@apple.com>
+
+ gcc.dg/tree-ssa/copy-headers.c : Merge from lno-branch as of
+ 2004:04:19 00:00.
diff --git a/gcc/testsuite/ChangeLog.lno b/gcc/testsuite/ChangeLog.lno
new file mode 100644
index 00000000000..ae14c0750a2
--- /dev/null
+++ b/gcc/testsuite/ChangeLog.lno
@@ -0,0 +1,121 @@
+2004-04-15 Dorit Naishlos <dorit@il.ibm.com>
+
+ * gcc.dg/tree-ssa-vect/tree-ssa-vect-26.c: New test.
+ * gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c: New test.
+ * gcc.dg/tree-ssa-vect/tree-ssa-vect-28.c: New test.
+ * gcc.dg/tree-ssa-vect/tree-ssa-vect-29.c: New test.
+ * gcc.dg/tree-ssa-vect/tree-ssa-vect-*.c: Use -msse2 instead of -msse.
+ * gcc.dg/tree-ssa-vect/tree-ssa-vect-*.c: Temporarily change i*86 'run'
+ tests to 'compile' tests.
+
+2004-03-25 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * ssa-chrec-10.c.ddall: Classify more access tuples as
+ independent.
+ * ssa-chrec-36.c.ddall: Same.
+
+2004-03-11 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * gcc.dg/tree-ssa/20040308-2.c: UnXFAIL.
+
+2004-03-11 Andrew Pinski <apinski@apple.com>
+
+ * gcc.dg/tree-ssa/20040308-2.c: Fix dg-final.
+ * gcc.dg/tree-ssa/20040308-1.c: XFAIL as the
+ optimizer for this testcase is disabled.
+
+2004-03-08 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * gcc.dg/tree-ssa/20040308-1.c: New test.
+ * gcc.dg/tree-ssa/20040308-2.c: New test.
+ * gcc.dg/tree-ssa/20040308-3.c: New test.
+ * gcc.dg/tree-ssa/20040308-4.c: New test.
+
+2004-03-03 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * ssa-chrec-*.c.scev: Removed.
+ * ssa-chrec-[54..60].c: New.
+ * ssa-chrec-{59, 60}.c.ddall: New.
+ * ssa-chrec-*.c.ddall: The analyzer don't print the array
+ discovery information, and this information has to go away
+ from the ddall files. This was one of the most varying part
+ of the ddall files. Maybe the base_name of the arrays has to
+ be removed in the same way.
+ * ssa-chrec-*.c: Don't scan the output for scev. Some cases
+ are adapted for using the elimination of checks.
+
+2004-02-20 Devang Patel <dpatel@apple.com>
+
+ * testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-3.c: New test.
+
+2004-02-16 Devang Patel <dpatel@apple.com>
+
+ * gcc.dg/tree-ssa-chrec/20040216-1.c: New test.
+
+2004-01-29 Sebastian Pop <sebastian.pop@ensmp.fr>
+
+ * ssa-chrec-{01, 10, 30, 31, 32, 33, 34, 35, 36, 52, 53}.c: Update
+ comments.
+ * ssa-chrec-{13, 14}.c: Use call functions for avoid optimisations
+ touching the condition.
+ * ssa-chrec-{01, 06, 09, 10, 13, 14, 17, 24, 25, 26, 27, 28, 30, 33,
+ 36, 38, 39, 41, 43, 46, 47, 51, 52, 53}.c.scev: Adjusted.
+
+ * ssa-chrec-10.c.ddall ssa-chrec-30.c.ddall
+ ssa-chrec-31.c.ddall ssa-chrec-32.c.ddall ssa-chrec-33.c.ddall
+ ssa-chrec-34.c.ddall ssa-chrec-35.c.ddall ssa-chrec-36.c.ddall
+ ssa-chrec-52.c.ddall: New files.
+ * ssa-chrec-10.c.alldd ssa-chrec-30.c.alldd
+ ssa-chrec-31.c.alldd ssa-chrec-32.c.alldd ssa-chrec-33.c.alldd
+ ssa-chrec-34.c.alldd ssa-chrec-35.c.alldd ssa-chrec-36.c.alldd
+ ssa-chrec-52.c.alldd ssa-chrec-53.c.alldd: Removed.
+
+2004-01-21 Sebastian Pop <s.pop@laposte.net>
+
+ * ssa-chrec-*: Replace -fdump-scalar-evolutions with
+ -fdump-tree-scev. Replace -fdump-all-data-deps with
+ -fdump-tree-alldd.
+ * tree-ssa-vect-*: Use -fdump-tree-vect instead of
+ -fdump-tree-vect-stats.
+
+2004-01-15 Sebastian Pop <s.pop@laposte.net>
+
+ * ssa-chrec-{06, 38, 42, 43}.c: Modify comments.
+ * ssa-chrec-{06, 07, 08, 09, 11, 12, 13, 14, 16, 18, 20,
+ 21, 37, 38, 39, 42, 43, 44, 45, 53}.c.scev: Adjusted.
+ * ssa-chrec-53.c.alldd: Adjusted.
+
+2004-01-12 Sebastian Pop <s.pop@laposte.net>
+
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-51.c.scev: Adjusted.
+
+2004-01-12 Sebastian Pop <s.pop@laposte.net>
+ Dorit Naishlos <dorit@il.ibm.com>
+
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-53.c: New test.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-53.c.scev: New.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-53.c.alldd: New.
+
+2004-01-09 Sebastian Pop <s.pop@laposte.net>
+
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-{01, 04, 06, 07, 09, 10, 17,
+ 18, 27, 28, 32, 33, 34, 35, 39, 41, 45, 47, 48}.c: Update comments.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-{01, 02, 03, 04, 05, 06, 09,
+ 10, 11, 17, 18, 27, 28, 30, 32, 33, 34, 35, 36, 37, 38, 39, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50}.c.scev: Adjusted.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-{10, 30, 31, 32, 33, 34, 35,
+ 36}.c.alldd: Adjusted.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-{51, 52}.c: New files.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-{51, 52}.c.scev: New.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-52.alldd: New.
+ * ChangeLog.lno: New file.
+
+2003-12-27 Sebastian Pop <s.pop@laposte.net>
+
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c : New testcases.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c.scev: Expected
+ outputs for the scalar evolution analyzer.
+ * gcc.dg/tree-ssa-chrec/ssa-chrec-{10, 30, 31, 32, 33, 34,
+ 35, 36}.c.alldd: Expected outputs for the data dependence analyzer.
+ * gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp: New file.
+ * lib/scantree.exp (diff-tree-dumps): New procedure.
diff --git a/gcc/testsuite/UNTESTABLE b/gcc/testsuite/UNTESTABLE
new file mode 100644
index 00000000000..aa6053a4372
--- /dev/null
+++ b/gcc/testsuite/UNTESTABLE
@@ -0,0 +1,57 @@
+APPLE LOCAL file testsuite
+
+This file lists the markers for local changes that are by their nature
+not testable, such as source code tweaks that don't directly affect
+compiler behavior. Every other local change must have at least one
+test case.
+
+Note that if a local change fixes a bug that is exposed by an existing
+test, then by definition the local change should go into FSF GCC
+instead of being listed here.
+
+APPLE LOCAL MW compatibility
+APPLE LOCAL Mach time
+APPLE LOCAL OS pragma hook
+APPLE LOCAL RTX_COST for multiply
+APPLE LOCAL Stripped encodings ('!T_' and '!t_') should match.
+APPLE LOCAL branch cost
+APPLE LOCAL code size reduction / performance enhancement
+APPLE LOCAL combine hoisted consts
+APPLE LOCAL compare >= 0, not > 0.
+APPLE LOCAL darwin host
+APPLE LOCAL darwin mmap bug workaround
+APPLE LOCAL darwin_set_section_for_var_p
+APPLE LOCAL debugging
+APPLE LOCAL default to ppro
+APPLE LOCAL do not extern fp save/restore
+APPLE LOCAL don't define SAVE_FP_PREFIX and friends
+APPLE LOCAL fat builds readability
+APPLE LOCAL finish file hook
+APPLE LOCAL fix prototypes
+APPLE LOCAL fix redundant add?
+APPLE LOCAL flag_objc
+APPLE LOCAL include guard for darwin.h
+APPLE LOCAL interrupt signal handler (radar 2941633)
+APPLE LOCAL keep tables in sync comment
+APPLE LOCAL make easy_vector_constant globally visible (rs6000-protos.h)
+APPLE LOCAL manual
+APPLE LOCAL more orphaned code
+APPLE LOCAL move is_class_name to stub-objc.c
+APPLE LOCAL move lookup_interface to stub-objc.c
+APPLE LOCAL move lookup_objc_ivar to stub-objc.c
+APPLE LOCAL multiply cost pulled into function
+APPLE LOCAL objc finish file
+APPLE LOCAL order files
+APPLE LOCAL parsedir
+APPLE LOCAL prototypes
+APPLE LOCAL prune man page
+APPLE LOCAL reduce code size
+APPLE LOCAL remove a stub tweak
+APPLE LOCAL remove machopic_output_possible_stub_label
+APPLE LOCAL rename for HFS
+APPLE LOCAL separate outputdir
+APPLE LOCAL setrlimit
+APPLE LOCAL time formatting
+APPLE LOCAL try to improve ggc
+APPLE LOCAL work around a makeinfo complaint
+APPLE LOCAL cp_binding_level
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa3001.a b/gcc/testsuite/ada/acats/tests/cxa/cxa3001.a
deleted file mode 100644
index 9c7e25b977c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa3001.a
+++ /dev/null
@@ -1,507 +0,0 @@
--- CXA3001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the character classification functions defined in
--- package Ada.Characters.Handling produce correct results when provided
--- constant arguments from package Ada.Characters.Latin_1.
---
--- TEST DESCRIPTION:
--- This test checks the character classification functions of package
--- Ada.Characters.Handling. In the evaluation of each function, loops
--- are constructed to examine the function with as many values of type
--- Character (Ada.Characters.Latin_1 constants) as possible in an
--- amount of code that is about equal to the amount of code required
--- to examine the function with a few representative input values and
--- endpoint values.
--- The usage paradigm being demonstrated by this test is that of the
--- functions being used to assign to boolean variables, as well as
--- serving as boolean conditions.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 29 Apr 95 SAIC Fixed subtest checking Is_Graphic function.
---
---!
-
-with Ada.Characters.Latin_1;
-with Ada.Characters.Handling;
-with Report;
-
-procedure CXA3001 is
-
-begin
-
- Report.Test ("CXA3001", "Check that the character classification " &
- "functions defined in package " &
- "Ada.Characters.Handling produce " &
- "correct results when provided constant " &
- "arguments from package Ada.Characters.Latin_1");
-
- Test_Block:
- declare
-
- package AC renames Ada.Characters;
- package ACH renames Ada.Characters.Handling;
-
- TC_Boolean : Boolean := False;
-
- begin
-
- -- Over the next six statements/blocks of code, evaluate functions
- -- Is_Control and Is_Graphic with control character and non-control
- -- character values.
-
- for i in Character'Pos(AC.Latin_1.NUL) ..
- Character'Pos(AC.Latin_1.US) loop
- if not ACH.Is_Control(Character'Val(i)) then
- Report.Failed ("Incorrect result from function Is_Control - 1");
- end if;
- if ACH.Is_Graphic(Character'Val(i)) then
- Report.Failed ("Incorrect result from function Is_Graphic - 1");
- end if;
- end loop;
-
-
- for i in Character'Pos(AC.Latin_1.Space) ..
- Character'Pos(AC.Latin_1.Tilde) loop
- if not ACH.Is_Graphic(Character'Val(i)) then
- Report.Failed ("Incorrect result from function Is_Graphic - 2");
- end if;
- if ACH.Is_Control(Character'Val(i)) then
- Report.Failed ("Incorrect result from function Is_Control - 2");
- end if;
- end loop;
-
-
- for i in Character'Pos(AC.Latin_1.Reserved_128) ..
- Character'Pos(AC.Latin_1.APC) loop
- if not ACH.Is_Control(Character'Val(i)) then
- Report.Failed ("Incorrect result from function Is_Control - 3");
- end if;
- TC_Boolean := ACH.Is_Graphic(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect result from function Is_Graphic - 3");
- TC_Boolean := False;
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.No_Break_Space) ..
- Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
- TC_Boolean := ACH.Is_Control(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect result from function Is_Control - 4");
- TC_Boolean := False;
- end if;
- if not ACH.Is_Graphic(Character'Val(i)) then
- Report.Failed ("Incorrect result from function Is_Graphic - 4");
- end if;
- end loop;
-
- -- Check renamed constants.
-
- if not (ACH.Is_Control(AC.Latin_1.IS4) and
- ACH.Is_Control(AC.Latin_1.IS3) and
- ACH.Is_Control(AC.Latin_1.IS2) and
- ACH.Is_Control(AC.Latin_1.IS1)) or
- (ACH.Is_Control(AC.Latin_1.NBSP) or
- ACH.Is_Control(AC.Latin_1.Paragraph_Sign) or
- ACH.Is_Control(AC.Latin_1.Minus_Sign) or
- ACH.Is_Control(AC.Latin_1.Ring_Above))
- then
- Report.Failed ("Incorrect result from function Is_Control - 5");
- end if;
-
- if (ACH.Is_Graphic(AC.Latin_1.IS4) or
- ACH.Is_Graphic(AC.Latin_1.IS3) or
- ACH.Is_Graphic(AC.Latin_1.IS2) or
- ACH.Is_Graphic(AC.Latin_1.IS1)) or
- not (ACH.Is_Graphic(AC.Latin_1.NBSP) and
- ACH.Is_Graphic(AC.Latin_1.Paragraph_Sign) and
- ACH.Is_Graphic(AC.Latin_1.Minus_Sign) and
- ACH.Is_Graphic(AC.Latin_1.Ring_Above))
- then
- Report.Failed ("Incorrect result from function Is_Graphic - 5");
- end if;
-
-
- -- Evaluate function Is_Letter with letter/non-letter inputs.
-
- for i in Character'Pos('A') .. Character'Pos('Z') loop
- if not ACH.Is_Letter(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Letter result - 1");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_A) ..
- Character'Pos(AC.Latin_1.LC_Z) loop
- if not ACH.Is_Letter(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Letter result - 2");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.UC_A_Grave) ..
- Character'Pos(AC.Latin_1.UC_O_Diaeresis) loop
- if not ACH.Is_Letter(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Letter result - 3");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.UC_O_Oblique_Stroke) ..
- Character'Pos(AC.Latin_1.LC_O_Diaeresis) loop
- if not ACH.Is_Letter(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Letter result - 4");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_O_Oblique_Stroke) ..
- Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
- if not ACH.Is_Letter(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Letter result - 5");
- end if;
- end loop;
-
- -- Check for rejection of non-letters.
- for i in Character'Pos(AC.Latin_1.NUL) ..
- Character'Pos(AC.Latin_1.Commercial_At) loop
- if ACH.Is_Letter(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Letter result - 6");
- end if;
- end loop;
-
-
- -- Evaluate function Is_Lower with lower case/non-lower case inputs.
-
- for i in Character'Pos(AC.Latin_1.LC_A) ..
- Character'Pos(AC.Latin_1.LC_Z) loop
- if not ACH.Is_Lower(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Lower result - 1");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_A_Grave) ..
- Character'Pos(AC.Latin_1.LC_O_Diaeresis) loop
- if not ACH.Is_Lower(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Lower result - 2");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_O_Oblique_Stroke) ..
- Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
- if not ACH.Is_Lower(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Lower result - 3");
- end if;
- end loop;
-
- if ACH.Is_Lower('A') or
- ACH.Is_Lower(AC.Latin_1.UC_Icelandic_Eth) or
- ACH.Is_Lower(AC.Latin_1.Number_Sign) or
- ACH.Is_Lower(AC.Latin_1.Cedilla) or
- ACH.Is_Lower(AC.Latin_1.SYN) or
- ACH.Is_Lower(AC.Latin_1.ESA)
- then
- Report.Failed ("Incorrect Is_Lower result - 4");
- end if;
-
-
- -- Evaluate function Is_Upper with upper case/non-upper case inputs.
-
- for i in Character'Pos('A') .. Character'Pos('Z') loop
- if not ACH.Is_Upper(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Upper result - 1");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.UC_A_Grave) ..
- Character'Pos(AC.Latin_1.UC_O_Diaeresis) loop
- if not ACH.Is_Upper(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Upper result - 2");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.UC_O_Oblique_Stroke) ..
- Character'Pos(AC.Latin_1.UC_Icelandic_Thorn) loop
- if not ACH.Is_Upper(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Upper result - 3");
- end if;
- end loop;
-
- if ACH.Is_Upper('8') or
- ACH.Is_Upper(AC.Latin_1.LC_A_Ring ) or
- ACH.Is_Upper(AC.Latin_1.Dollar_Sign) or
- ACH.Is_Upper(AC.Latin_1.Broken_Bar) or
- ACH.Is_Upper(AC.Latin_1.ETB) or
- ACH.Is_Upper(AC.Latin_1.VTS)
- then
- Report.Failed ("Incorrect Is_Upper result - 4");
- end if;
-
-
- for i in Character'Pos('a') .. Character'Pos('z') loop
- if ACH.Is_Upper(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Upper result - 5");
- end if;
- end loop;
-
-
- -- Evaluate function Is_Basic with basic/non-basic inputs.
- -- (Note: Basic letters are those without diacritical marks.)
-
- for i in Character'Pos('A') .. Character'Pos('Z') loop
- if not ACH.Is_Basic(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Basic result - 1");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_A) ..
- Character'Pos(AC.Latin_1.LC_Z) loop
- if not ACH.Is_Basic(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Basic result - 2");
- end if;
- end loop;
-
-
- if not (ACH.Is_Basic(AC.Latin_1.UC_AE_Diphthong) and
- ACH.Is_Basic(AC.Latin_1.LC_AE_Diphthong) and
- ACH.Is_Basic(AC.Latin_1.LC_German_Sharp_S) and
- ACH.Is_Basic(AC.Latin_1.LC_Icelandic_Eth) and
- ACH.Is_Basic(AC.Latin_1.LC_Icelandic_Thorn) and
- ACH.Is_Basic(AC.Latin_1.UC_Icelandic_Eth) and
- ACH.Is_Basic(AC.Latin_1.UC_Icelandic_Thorn))
- then
- Report.Failed ("Incorrect Is_Basic result - 3");
- end if;
-
- -- Check for rejection of non-basics.
- if ACH.Is_Basic(AC.Latin_1.UC_A_Tilde) or
- ACH.Is_Basic(AC.Latin_1.LC_A_Grave) or
- ACH.Is_Basic(AC.Latin_1.Ampersand) or
- ACH.Is_Basic(AC.Latin_1.Yen_Sign) or
- ACH.Is_Basic(AC.Latin_1.NAK) or
- ACH.Is_Basic(AC.Latin_1.SS2)
- then
- Report.Failed ("Incorrect Is_Basic result - 4");
- end if;
-
-
-
- for i in Character'Pos(AC.Latin_1.NUL) ..
- Character'Pos(AC.Latin_1.Commercial_At) loop
- if ACH.Is_Basic(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Basic result - 5");
- end if;
- end loop;
-
-
- -- Evaluate functions Is_Digit and Is_Decimal_Digit (a rename of
- -- Is_Digit) with decimal digit/non-digit inputs.
-
-
- if not (ACH.Is_Digit('0') and
- ACH.Is_Decimal_Digit('9')) or
- ACH.Is_Digit ('a') or -- Hex digits.
- ACH.Is_Decimal_Digit ('f') or
- ACH.Is_Decimal_Digit ('A') or
- ACH.Is_Digit ('F')
- then
- Report.Failed ("Incorrect Is_Digit/Is_Decimal_Digit result - 1");
- end if;
-
- if ACH.Is_Digit (AC.Latin_1.Full_Stop) or
- ACH.Is_Decimal_Digit (AC.Latin_1.Dollar_Sign) or
- ACH.Is_Digit (AC.Latin_1.Number_Sign) or
- ACH.Is_Decimal_Digit (AC.Latin_1.Left_Parenthesis) or
- ACH.Is_Digit (AC.Latin_1.Right_Parenthesis)
- then
- Report.Failed ("Incorrect Is_Digit/Is_Decimal_Digit result - 2");
- end if;
-
-
- -- Evaluate functions Is_Hexadecimal_Digit with hexadecimal digit and
- -- non-hexadecimal digit inputs.
-
- for i in Character'Pos('0') .. Character'Pos('9') loop
- if not ACH.Is_Hexadecimal_Digit(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Hexadecimal_Digit result - 1");
- end if;
- end loop;
-
- for i in Character'Pos('A') .. Character'Pos('F') loop
- if not ACH.Is_Hexadecimal_Digit(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Hexadecimal_Digit result - 2");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_A) ..
- Character'Pos(AC.Latin_1.LC_F) loop
- if not ACH.Is_Hexadecimal_Digit(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Hexadecimal_Digit result - 3");
- end if;
- end loop;
-
-
- if ACH.Is_Hexadecimal_Digit (AC.Latin_1.Minus_Sign) or
- ACH.Is_Hexadecimal_Digit (AC.Latin_1.Hyphen) or
- ACH.Is_Hexadecimal_Digit (AC.Latin_1.LC_G) or
- ACH.Is_Hexadecimal_Digit (AC.Latin_1.LC_Z) or
- ACH.Is_Hexadecimal_Digit ('G') or
- ACH.Is_Hexadecimal_Digit (AC.Latin_1.Cent_Sign) or
- ACH.Is_Hexadecimal_Digit (AC.Latin_1.Pound_Sign)
- then
- Report.Failed ("Incorrect Is_HexaDecimal_Digit result - 4");
- end if;
-
-
- -- Evaluate functions Is_Alphanumeric and Is_Special with
- -- letters, digits, and non-alphanumeric inputs.
-
- for i in Character'Pos(AC.Latin_1.NUL) ..
- Character'Pos(AC.Latin_1.US) loop
- if ACH.Is_Alphanumeric(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Alphanumeric result - 1");
- end if;
- TC_Boolean := ACH.Is_Special(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Special result - 1");
- TC_Boolean := False;
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.Reserved_128) ..
- Character'Pos(AC.Latin_1.APC) loop
- TC_Boolean := ACH.Is_Alphanumeric(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Alphanumeric result - 2");
- TC_Boolean := False;
- end if;
- if ACH.Is_Special(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Special result - 2");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.Space) ..
- Character'Pos(AC.Latin_1.Solidus) loop
- TC_Boolean := ACH.Is_Alphanumeric(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Alphanumeric result - 3");
- TC_Boolean := False;
- end if;
- if not ACH.Is_Special(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Special result - 3");
- end if;
- end loop;
-
- for i in Character'Pos('A') .. Character'Pos('Z') loop
- if not ACH.Is_Alphanumeric(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Alphanumeric result - 4");
- end if;
- TC_Boolean := ACH.Is_Special(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Special result - 4");
- TC_Boolean := False;
- end if;
- end loop;
-
- for i in Character'Pos('0') .. Character'Pos('9') loop
- if not ACH.Is_Alphanumeric(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Alphanumeric result - 5");
- end if;
- TC_Boolean := ACH.Is_Special(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Special result - 5");
- TC_Boolean := False;
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_A) ..
- Character'Pos(AC.Latin_1.LC_Z) loop
- if not ACH.Is_Alphanumeric(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Alphanumeric result - 6");
- end if;
- TC_Boolean := ACH.Is_Special(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Special result - 6");
- TC_Boolean := False;
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.No_Break_Space) ..
- Character'Pos(AC.Latin_1.Inverted_Question) loop
- TC_Boolean := ACH.Is_Alphanumeric(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Alphanumeric result - 7");
- TC_Boolean := False;
- end if;
- if not ACH.Is_Special(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Special result - 7");
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.UC_A_Grave) ..
- Character'Pos(AC.Latin_1.UC_O_Diaeresis) loop
- if not ACH.Is_Alphanumeric(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Alphanumeric result - 8");
- end if;
- TC_Boolean := ACH.Is_Special(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Special result - 8");
- TC_Boolean := False;
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.UC_O_Oblique_Stroke) ..
- Character'Pos(AC.Latin_1.LC_O_Diaeresis) loop
- if not ACH.Is_Alphanumeric(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Alphanumeric result - 9");
- end if;
- TC_Boolean := ACH.Is_Special(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Special result - 9");
- TC_Boolean := False;
- end if;
- end loop;
-
- for i in Character'Pos(AC.Latin_1.LC_O_Oblique_Stroke) ..
- Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
- if not ACH.Is_Alphanumeric(Character'Val(i)) then
- Report.Failed ("Incorrect Is_Alphanumeric result - 10");
- end if;
- TC_Boolean := ACH.Is_Special(Character'Val(i));
- if TC_Boolean then
- Report.Failed ("Incorrect Is_Special result - 10");
- TC_Boolean := False;
- end if;
- end loop;
-
-
- exception
- when others => Report.Failed ("Exception raised during processing");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA3001;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa3002.a b/gcc/testsuite/ada/acats/tests/cxa/cxa3002.a
deleted file mode 100644
index 12d98fdfe70..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa3002.a
+++ /dev/null
@@ -1,318 +0,0 @@
--- CXA3002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the conversion functions for Characters and Strings
--- defined in package Ada.Characters.Handling provide correct results
--- when given character/string input parameters.
---
--- TEST DESCRIPTION:
--- This test checks the output of the To_Lower, To_Upper, and
--- To_Basic functions for both Characters and Strings. Each function
--- is called with input parameters that are within the appropriate
--- range of values, and also with values outside the specified
--- range (i.e., lower case 'a' to To_Lower). The functions are also
--- used in combination with one another, with the result of one function
--- providing the actual input parameter value to another.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 22 Dec 94 SAIC Corrected evaluations of Functions In Combination.
---
---!
-
-with Ada.Characters.Latin_1;
-with Ada.Characters.Handling;
-with Report;
-
-procedure CXA3002 is
-
- package AC renames Ada.Characters;
- package ACH renames Ada.Characters.Handling;
-
-begin
-
- Report.Test ("CXA3002", "Check that the conversion functions for " &
- "Characters and Strings defined in package " &
- "Ada.Characters.Handling provide correct " &
- "results when given character/string input " &
- "parameters");
-
-
- Character_Block:
- declare
- Offset : constant Integer := Character'Pos('a') - Character'Pos('A');
- begin
-
- -- Function To_Lower for Characters
-
- if ACH.To_Lower('A') /= 'a' or ACH.To_Lower('Z') /= 'z' then
- Report.Failed ("Incorrect operation of function To_Lower - 1");
- end if;
-
-
- for i in Character'Pos('A') .. Character'Pos('Z') loop
- if ACH.To_Lower(Character'Val(i)) /= Character'Val(i + Offset) then
- Report.Failed ("Incorrect operation of function To_Lower - 2");
- end if;
- end loop;
-
-
- if (ACH.To_Lower(AC.Latin_1.UC_A_Grave) /=
- AC.Latin_1.LC_A_Grave) or
- (ACH.To_Lower(AC.Latin_1.UC_Icelandic_Thorn) /=
- AC.Latin_1.LC_Icelandic_Thorn)
- then
- Report.Failed ("Incorrect operation of function To_Lower - 3");
- end if;
-
-
- if ACH.To_Lower('c') /= 'c' or
- ACH.To_Lower('w') /= 'w' or
- ACH.To_Lower(AC.Latin_1.CR) /= AC.Latin_1.CR or
- ACH.To_Lower(AC.Latin_1.LF) /= AC.Latin_1.LF or
- ACH.To_Lower(AC.Latin_1.Comma) /= AC.Latin_1.Comma or
- ACH.To_Lower(AC.Latin_1.Question) /= AC.Latin_1.Question or
- ACH.To_Lower('0') /= '0' or
- ACH.To_Lower('9') /= '9'
- then
- Report.Failed ("Incorrect operation of function To_Lower - 4");
- end if;
-
-
- --- Function To_Upper for Characters
-
-
- if not (ACH.To_Upper('b') = 'B') and (ACH.To_Upper('y') = 'Y') then
- Report.Failed ("Incorrect operation of function To_Upper - 1");
- end if;
-
-
- for i in Character'Pos(AC.Latin_1.LC_A) ..
- Character'Pos(AC.Latin_1.LC_Z) loop
- if ACH.To_Upper(Character'Val(i)) /= Character'Val(i - Offset) then
- Report.Failed ("Incorrect operation of function To_Upper - 2");
- end if;
- end loop;
-
-
- if (ACH.To_Upper(AC.Latin_1.LC_U_Diaeresis) /=
- AC.Latin_1.UC_U_Diaeresis) or
- (ACH.To_Upper(AC.Latin_1.LC_A_Ring) /=
- AC.Latin_1.UC_A_Ring)
- then
- Report.Failed ("Incorrect operation of function To_Upper - 3");
- end if;
-
-
- if not (ACH.To_Upper('F') = 'F' and
- ACH.To_Upper('U') = 'U' and
- ACH.To_Upper(AC.Latin_1.LC_German_Sharp_S) =
- AC.Latin_1.LC_German_Sharp_S and
- ACH.To_Upper(AC.Latin_1.LC_Y_Diaeresis) =
- AC.Latin_1.LC_Y_Diaeresis)
- then
- Report.Failed ("Incorrect operation of function To_Upper - 4");
- end if;
-
-
- --- Function To_Basic for Characters
-
-
- if ACH.To_Basic(AC.Latin_1.LC_A_Circumflex) /=
- ACH.To_Basic(AC.Latin_1.LC_A_Tilde) or
- ACH.To_Basic(AC.Latin_1.LC_E_Grave) /=
- ACH.To_Basic(AC.Latin_1.LC_E_Acute) or
- ACH.To_Basic(AC.Latin_1.LC_I_Circumflex) /=
- ACH.To_Basic(AC.Latin_1.LC_I_Diaeresis) or
- ACH.To_Basic(AC.Latin_1.UC_O_Tilde) /=
- ACH.To_Basic(AC.Latin_1.UC_O_Acute) or
- ACH.To_Basic(AC.Latin_1.UC_U_Grave) /=
- ACH.To_Basic(AC.Latin_1.UC_U_Acute) or
- ACH.To_Basic(AC.Latin_1.LC_Y_Acute) /=
- ACH.To_Basic(AC.Latin_1.LC_Y_Diaeresis)
- then
- Report.Failed ("Incorrect operation of function To_Basic - 1");
- end if;
-
-
- if ACH.To_Basic('Y') /= 'Y' or
- ACH.To_Basic(AC.Latin_1.LC_E_Acute) /= 'e' or
- ACH.To_Basic('6') /= '6' or
- ACH.To_Basic(AC.Latin_1.LC_R) /= 'r'
- then
- Report.Failed ("Incorrect operation of function To_Basic - 2");
- end if;
-
-
- -- Using Functions (for Characters) in Combination
-
-
- if (ACH.To_Upper(ACH.To_Lower('A')) /= 'A' ) or
- (ACH.To_Upper(ACH.To_Lower(AC.Latin_1.UC_A_Acute)) /=
- AC.Latin_1.UC_A_Acute )
- then
- Report.Failed("Incorrect operation of functions in combination - 1");
- end if;
-
-
- if ACH.To_Basic(ACH.To_Lower(ACH.To_Upper(AC.Latin_1.LC_U_Grave))) /=
- 'u'
- then
- Report.Failed("Incorrect operation of functions in combination - 2");
- end if;
-
-
- if ACH.To_Lower (ACH.To_Basic
- (ACH.To_Upper(AC.Latin_1.LC_O_Diaeresis))) /= 'o'
- then
- Report.Failed("Incorrect operation of functions in combination - 3");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Character_Block");
- end Character_Block;
-
-
- String_Block:
- declare
-
- LC_String : constant String := "az" &
- AC.Latin_1.LC_A_Grave &
- AC.Latin_1.LC_C_Cedilla;
-
- UC_String : constant String := "AZ" &
- AC.Latin_1.UC_A_Grave &
- AC.Latin_1.UC_C_Cedilla;
-
- LC_Basic_String : constant String := "aei" & 'o' & 'u';
-
- LC_NonBasic_String : constant String := AC.Latin_1.LC_A_Diaeresis &
- AC.Latin_1.LC_E_Circumflex &
- AC.Latin_1.LC_I_Acute &
- AC.Latin_1.LC_O_Tilde &
- AC.Latin_1.LC_U_Grave;
-
- UC_Basic_String : constant String := "AEIOU";
-
- UC_NonBasic_String : constant String := AC.Latin_1.UC_A_Tilde &
- AC.Latin_1.UC_E_Acute &
- AC.Latin_1.UC_I_Grave &
- AC.Latin_1.UC_O_Diaeresis &
- AC.Latin_1.UC_U_Circumflex;
-
- LC_Special_String : constant String := "ab" &
- AC.Latin_1.LC_German_Sharp_S &
- AC.Latin_1.LC_Y_Diaeresis;
-
- UC_Special_String : constant String := "AB" &
- AC.Latin_1.LC_German_Sharp_S &
- AC.Latin_1.LC_Y_Diaeresis;
-
- begin
-
- -- Function To_Lower for Strings
-
-
- if ACH.To_Lower (UC_String) /= LC_String or
- ACH.To_Lower (LC_String) /= LC_String
- then
- Report.Failed ("Incorrect result from To_Lower for strings - 1");
- end if;
-
-
- if ACH.To_Lower (UC_Basic_String) /= LC_Basic_String then
- Report.Failed ("Incorrect result from To_Lower for strings - 2");
- end if;
-
-
- -- Function To_Upper for Strings
-
-
- if not (ACH.To_Upper (LC_String) = UC_String) then
- Report.Failed ("Incorrect result from To_Upper for strings - 1");
- end if;
-
-
- if ACH.To_Upper (LC_Basic_String) /= UC_Basic_String or
- ACH.To_Upper (UC_String) /= UC_String
- then
- Report.Failed ("Incorrect result from To_Upper for strings - 2");
- end if;
-
-
- if ACH.To_Upper (LC_Special_String) /= UC_Special_String then
- Report.Failed ("Incorrect result from To_Upper for strings - 3");
- end if;
-
-
-
- -- Function To_Basic for Strings
-
-
- if (ACH.To_Basic (LC_String) /= "azac") or
- (ACH.To_Basic (UC_String) /= "AZAC")
- then
- Report.Failed ("Incorrect result from To_Basic for Strings - 1");
- end if;
-
-
- if ACH.To_Basic (LC_NonBasic_String) /= LC_Basic_String then
- Report.Failed ("Incorrect result from To_Basic for Strings - 2");
- end if;
-
-
- if ACH.To_Basic (UC_NonBasic_String) /= UC_Basic_String then
- Report.Failed ("Incorrect result from To_Basic for Strings - 3");
- end if;
-
-
- -- Using Functions (for Strings) in Combination
-
-
- if ACH.To_Upper(ACH.To_Lower(UC_Basic_String)) /= UC_Basic_String or
- ACH.To_Lower(ACH.To_Upper(LC_Basic_String)) /= LC_Basic_String
- then
- Report.Failed ("Incorrect operation of functions in combination - 4");
- end if;
-
-
- if (ACH.To_Basic(ACH.To_Lower(UC_NonBasic_String)) /= LC_Basic_String) or
- (ACH.To_Basic(ACH.To_Upper(LC_NonBasic_String)) /= UC_Basic_String)
- then
- Report.Failed ("Incorrect operation of functions in combination - 5");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in String_Block");
- end String_Block;
-
-
- Report.Result;
-
-end CXA3002;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa3003.a b/gcc/testsuite/ada/acats/tests/cxa/cxa3003.a
deleted file mode 100644
index f469ef8b539..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa3003.a
+++ /dev/null
@@ -1,243 +0,0 @@
--- CXA3003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions defined in package Ada.Characters.Handling
--- for use in classifying and converting characters between the ISO 646
--- and type Character sets produce the correct results with both
--- Character and String input values.
---
--- TEST DESCRIPTION:
--- This test is designed to exercise the classification and conversion
--- functions (between Character and ISO_646 types) found in package
--- Ada.Characters.Handling. Two subprograms are defined, a procedure for
--- characters, a function for strings, that will utilize these functions
--- to validate and change characters in variables. In the procedure, if
--- a character argument is found to be outside the subtype ISO_646, this
--- character is evaluated to determine whether it is also a letter.
--- If it is a letter, the character is converted to a basic character and
--- returned. If it is not a letter, the character is exchanged with an
--- asterisk. In the case of the function subprogram designed for strings,
--- if a character component of a string argument is outside the subtype
--- ISO_646, that character is substituted with an asterisk.
---
--- Arguments for the defined subprograms consist of ISO_646 characters,
--- non-ISO_646 characters, strings with only ISO_646 characters, and
--- strings with non-ISO_646 characters. The character and string values
--- are then validated to determine that the expected results were
--- obtained.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 29 Apr 95 SAIC Modified identifier string lengths.
--- 31 Oct 95 SAIC Update and repair for ACVC 2.0.1.
---
---!
-
-with Ada.Characters.Latin_1;
-with Ada.Characters.Handling;
-with Report;
-
-procedure CXA3003 is
-
-begin
-
- Report.Test ("CXA3003", "Check that the functions defined in package " &
- "Ada.Characters.Handling for use in " &
- "classifying and converting characters " &
- "between the ISO 646 and type Character sets " &
- "produce the correct results with both " &
- "Character and String input values" );
-
- Test_Block:
- declare
-
- -- ISO_646 Characters
-
- Char_1,
- TC_Char_1 : Character := Ada.Characters.Latin_1.NUL; -- Control Char
- Char_2,
- TC_Char_2 : Character := Ada.Characters.Latin_1.Colon; -- Graphic Char
- Char_3,
- TC_Char_3 : Character := '4';
- Char_4,
- TC_Char_4 : Character := 'Z';
- Char_5,
- TC_Char_5 : Character := Ada.Characters.Latin_1.LC_W; -- w
-
- New_ISO_646_Char : Character := '*';
-
-
- -- Non-ISO_646 Characters
-
- Char_Array : array (6..10) of Character :=
- (Ada.Characters.Latin_1.SSA,
- Ada.Characters.Latin_1.Cent_Sign,
- Ada.Characters.Latin_1.Cedilla,
- Ada.Characters.Latin_1.UC_A_Ring,
- Ada.Characters.Latin_1.LC_A_Ring);
-
- TC_Char : constant Character := '*';
-
- -- ISO_646 Strings
-
- Str_1,
- TC_Str_1 : String (1..5) := "ABCDE";
-
- Str_2,
- TC_Str_2 : String (1..5) := "#$%^&";
-
-
- -- Non-ISO_646 Strings
-
- Str_3 : String (1..8) := "$123.45" &
- Ada.Characters.Latin_1.Cent_Sign;
- TC_Str_3 : String (1..8) := "$123.45*";
-
- Str_4 : String (1..7) := "abc" &
- Ada.Characters.Latin_1.Cedilla &
- "efg";
- TC_Str_4 : String (1..7) := "abc*efg";
-
- Str_5 : String (1..3) := Ada.Characters.Latin_1.LC_E_Grave &
- Ada.Characters.Latin_1.LC_T &
- Ada.Characters.Latin_1.LC_E_Acute;
- TC_Str_5 : String (1..3) := "*t*";
-
- ---
-
- procedure Validate_Character (Char : in out Character) is
- -- If parameter Char is an ISO_646 character, Char will be returned,
- -- otherwise the following constant will be returned.
- Star : constant Ada.Characters.Handling.ISO_646 :=
- Ada.Characters.Latin_1.Asterisk;
- begin
- if Ada.Characters.Handling.Is_ISO_646(Char) then
- -- Check that the Is_ISO_646 function provide a correct result.
- if Character'Pos(Char) > 127 then
- Report.Failed("Is_ISO_646 returns a false positive result");
- end if;
- else
- if Character'Pos(Char) < 128 then
- Report.Failed("Is_ISO_646 returns a false negative result");
- end if;
- end if;
- -- Cross-check Is_ISO_646 with To_ISO_646. '*' will be returned
- -- if Char is not in the ISO_646 set.
- Char := Ada.Characters.Handling.To_ISO_646(Char, Star);
- exception
- when others => Report.Failed ("Exception in Validate_Character");
- end Validate_Character;
-
- ---
-
- function Validate_String (Str : String) return String is
- New_ISO_646_Char : constant Ada.Characters.Handling.ISO_646 :=
- Ada.Characters.Latin_1.Asterisk;
- begin
- -- Checking that the string contains non-ISO_646 characters at this
- -- point is not strictly necessary, since the function To_ISO_646
- -- will perform that check as part of its processing, and would
- -- return the original string if no modification were necessary.
- -- However, this format allows for the testing of both functions.
-
- if not Ada.Characters.Handling.Is_ISO_646(Str) then
- return Ada.Characters.Handling.To_ISO_646
- (Item => Str, Substitute => New_ISO_646_Char);
- else
- return Str;
- end if;
- exception
- when others => Report.Failed ("Exception in Validate_String");
- return Str;
- end Validate_String;
-
-
- begin
-
- -- Check each character in turn, and if the character does not belong
- -- to the ISO_646 subset of type Character, replace it with an
- -- asterisk. If the character is a member of the subset, the character
- -- should be returned unchanged.
-
- Validate_Character (Char_1);
- Validate_Character (Char_2);
- Validate_Character (Char_3);
- Validate_Character (Char_4);
- Validate_Character (Char_5);
-
- if Char_1 /= TC_Char_1 or Char_2 /= TC_Char_2 or
- Char_3 /= TC_Char_3 or Char_4 /= TC_Char_4 or
- Char_5 /= TC_Char_5
- then
- Report.Failed ("Incorrect ISO_646 character substitution");
- end if;
-
- -- Non-ISO_646 characters
-
- for i in 6..10 loop
- Validate_Character (Char_Array(i));
- end loop;
-
- for i in 6..10 loop
- if Char_Array(i) /= TC_Char then
- Report.Failed ("Character position " & Integer'Image(i) &
- " not replaced correctly");
- end if;
- end loop;
-
-
-
- -- Check each string, and if the string contains characters that do not
- -- belong to the ISO_646 subset of type Character, replace that character
- -- in the string with an asterisk. If the string is comprised of only
- -- ISO_646 characters, the string should be returned unchanged.
-
-
- Str_1 := Validate_String (Str_1);
- Str_2 := Validate_String (Str_2);
- Str_3 := Validate_String (Str_3);
- Str_4 := Validate_String (Str_4);
- Str_5 := Validate_String (Str_5);
-
-
- if Str_1 /= TC_Str_1 or
- Str_2 /= TC_Str_2 or
- Str_3 /= TC_Str_3 or
- Str_4 /= TC_Str_4 or
- Str_5 /= TC_Str_5
- then
- Report.Failed ("Incorrect ISO_646 character substitution in string");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA3003;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa3004.a b/gcc/testsuite/ada/acats/tests/cxa/cxa3004.a
deleted file mode 100644
index ed2023e37e5..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa3004.a
+++ /dev/null
@@ -1,235 +0,0 @@
--- CXA3004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions defined in package Ada.Characters.Handling
--- for classification of and conversion between Wide_Character and
--- Character values produce correct results when given the appropriate
--- Character and String inputs.
---
--- TEST DESCRIPTION:
--- This test demonstrates the functions defined in package
--- Ada.Characters.Handling which provide for the classification of and
--- conversion between Wide_Characters and Characters, in character
--- variables and strings.
--- Each of the functions is provided with input values that are of the
--- appropriate range. The results of the function processing are
--- subsequently evaluated.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all implementations using the Latin_1 set as the
--- definition of Character.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 27 Dec 94 SAIC Corrected variable names.
---
---!
-
-with Report;
-with Ada.Characters.Handling;
-
-procedure CXA3004 is
-begin
-
- Report.Test ("CXA3004", "Check that the functions defined in package " &
- "Ada.Characters.Handling for classification " &
- "of and conversion between Wide_Character and " &
- "Character values produce correct results " &
- "when given the appropriate Character " &
- "and String inputs");
-
- Test_Block:
- declare
-
- package ACH renames Ada.Characters.Handling;
-
- Char_End : Integer := 255;
- WC_Start : Integer := 256;
- Sub_Char : Character := '*';
-
- Blank : Character := ' ';
- First_Char : Character := Character'First;
- Last_Char : Character := Character'Last;
- F_Char : Character := 'F';
-
-
- First_Wide_Char : Wide_Character := Wide_Character'First;
- Last_Non_Wide_Char : Wide_Character := Wide_Character'Val(Char_End);
- First_Unique_Wide_Char : Wide_Character := Wide_Character'Val(WC_Start);
- Last_Wide_Char : Wide_Character := Wide_Character'Last;
-
- A_String : String (1..3) := First_Char & 'X' & Last_Char;
- A_Wide_String : Wide_String (1..3) := First_Wide_Char &
- ACH.To_Wide_Character('X') &
- ACH.To_Wide_Character(Last_Char);
-
- Unique_Wide_String : Wide_String (1..2) := First_Unique_Wide_Char &
- Last_Wide_Char;
-
- Mixed_Wide_String : Wide_String (1..6) := ACH.To_Wide_Character('A') &
- First_Wide_Char &
- Last_Non_Wide_Char &
- First_Unique_Wide_Char &
- Last_Wide_Char &
- ACH.To_Wide_Character('Z');
-
-
- Basic_Char : Character := 'A';
- Basic_Wide_Char : Wide_Character := 'A';
- Basic_String : String (1..6) := "ABCXYZ";
- Basic_Wide_String : Wide_String (1..6) := "ABCXYZ";
-
- begin
-
-
- -- Function Is_Character
-
-
- if not ACH.Is_Character(First_Wide_Char) then
- Report.Failed ("Incorrect result from Is_Character - 1");
- end if;
-
-
- if ACH.Is_Character(First_Unique_Wide_Char) or
- ACH.Is_Character(Last_Wide_Char)
- then
- Report.Failed ("Incorrect result from Is_Character - 2");
- end if;
-
-
- -- Function Is_String
-
-
- if not ACH.Is_String(A_Wide_String) then
- Report.Failed ("Incorrect result from Is_String - 1");
- end if;
-
-
- if ACH.Is_String(Unique_Wide_String) or
- ACH.Is_String(Mixed_Wide_String)
- then
- Report.Failed ("Incorrect result from Is_String - 2");
- end if;
-
-
- -- Function To_Character
-
-
- -- Use default substitution character in call of To_Character.
-
- if ACH.To_Character(First_Wide_Char) /= First_Char or
- ACH.To_Character(Last_Non_Wide_Char) /= Last_Char
- then
- Report.Failed ("Incorrect result from To_Character - 1");
- end if;
-
-
- -- Provide a substitution character for use with To_Character.
-
- if ACH.To_Character(First_Unique_Wide_Char, Blank) /= Blank or
- ACH.To_Character(First_Unique_Wide_Char, Sub_Char) /= Sub_Char or
- ACH.To_Character(Last_Wide_Char) /= ' ' -- default
- then
- Report.Failed ("Incorrect result from To_Character - 2");
- end if;
-
-
- -- Function To_String
-
-
- if ACH.To_String(A_Wide_String) /= A_String then
- Report.Failed ("Incorrect result from To_String - 1");
- end if;
-
-
- if ACH.To_String(Unique_Wide_String, Sub_Char) /= "**" then
- Report.Failed ("Incorrect result from To_String - 2");
- end if;
-
-
-
- if ACH.To_String(Mixed_Wide_String, Sub_Char) /=
- ('A' & First_Char & Last_Char & "**" & 'Z') or
- ACH.To_String(Mixed_Wide_String, Sub_Char) /=
- (ACH.To_Character(Mixed_Wide_String(1), Sub_Char) &
- ACH.To_Character(Mixed_Wide_String(2), Sub_Char) &
- ACH.To_Character(Mixed_Wide_String(3), Sub_Char) &
- ACH.To_Character(Mixed_Wide_String(4), Sub_Char) &
- ACH.To_Character(Mixed_Wide_String(5), Sub_Char) &
- ACH.To_Character(Mixed_Wide_String(6), Sub_Char))
- then
- Report.Failed ("Incorrect result from To_String - 3");
- end if;
-
-
- -- Function To_Wide_Character
-
-
- if ACH.To_Wide_Character(Basic_Char) /= Basic_Wide_Char then
- Report.Failed ("Incorrect result from To_Wide_Character");
- end if;
-
-
- -- Function To_Wide_String
-
-
- if not (ACH.To_Wide_String(Basic_String) = Basic_Wide_String) then
- Report.Failed ("Incorrect result from To_Wide_String");
- end if;
-
-
- -- Functions Used In Combination
-
- if not ACH.Is_Character (ACH.To_Wide_Character (
- ACH.To_Character(First_Wide_Char)))
- then
- Report.Failed ("Incorrect result from functions in combination - 1");
- end if;
-
-
- if not ACH.Is_String(ACH.To_Wide_String(ACH.To_String(A_Wide_String)))
- then
- Report.Failed ("Incorrect result from functions in combination - 2");
- end if;
-
-
- if ACH.To_String(ACH.To_Wide_Character('A') &
- ACH.To_Wide_Character(F_Char) &
- ACH.To_Wide_Character('Z')) /= "AFZ"
- then
- Report.Failed ("Incorrect result from functions in combination - 3");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA3004;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4001.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4001.a
deleted file mode 100644
index d850acd4a72..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4001.a
+++ /dev/null
@@ -1,218 +0,0 @@
--- CXA4001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the types, operations, and other entities defined within
--- the package Ada.Strings.Maps are available and/or produce correct
--- results.
---
--- TEST DESCRIPTION:
--- This test demonstrates the availability and function of the types and
--- operations defined in package Ada.Strings.Maps. It demonstrates the
--- use of these types and functions as they would be used in common
--- programming practice.
--- Character set creation, assignment, and comparison are evaluated
--- in this test. Each of the functions provided in package
--- Ada.Strings.Maps is utilized in creating or manipulating set objects,
--- and the function results are evaluated for correctness.
--- Character sequences are examined using the functions provided for
--- manipulating objects of this type. Likewise, character maps are
--- created, and their contents evaluated. Exception raising conditions
--- from the function To_Mapping are also created.
--- Note: Throughout this test, the set logical operators are printed in
--- capital letters to enhance their visibility.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Ada.Strings.Maps;
-with Report;
-
-procedure CXA4001 is
-
- use Ada.Strings;
- use type Maps.Character_Set;
-
-begin
-
- Report.Test ("CXA4001", "Check that the types, operations, and other " &
- "entities defined within the package " &
- "Ada.Strings.Maps are available and/or produce " &
- "correct results");
-
- Test_Block:
- declare
-
- MidPoint_Letter : constant := 13;
- Last_Letter : constant := 26;
-
- Vowels : constant Maps.Character_Sequence := "aeiou";
- Quasi_Vowel : constant Character := 'y';
-
- Alphabet : Maps.Character_Sequence (1..Last_Letter);
- Half_Alphabet : Maps.Character_Sequence (1..MidPoint_Letter);
- Inverse_Alphabet : Maps.Character_Sequence (1..Last_Letter);
-
- Alphabet_Set,
- Consonant_Set,
- Vowel_Set,
- Full_Vowel_Set,
- First_Half_Set,
- Second_Half_Set : Maps.Character_Set;
-
- begin
-
- -- Load the alphabet string for use in creating sets.
-
-
- for i in 0..12 loop
- Half_Alphabet(i+1) := Character'Val(Character'Pos('a') + i);
- end loop;
-
- for i in 0..25 loop
- Alphabet(i+1) := Character'Val(Character'Pos('a') + i);
- end loop;
-
-
- -- Initialize a series of Character_Set objects.
-
- Alphabet_Set := Maps.To_Set(Alphabet);
- Vowel_Set := Maps.To_Set(Vowels);
- Full_Vowel_Set := Vowel_Set OR Maps.To_Set(Quasi_Vowel);
- Consonant_Set := Vowel_Set XOR Alphabet_Set;
-
- First_Half_Set := Maps.To_Set(Half_Alphabet);
- Second_Half_Set := Alphabet_Set XOR First_Half_Set;
-
-
- -- Evaluation of Set objects, operators, and functions.
-
- if Alphabet_Set /= (Vowel_Set OR Consonant_Set) then
- Report.Failed("Incorrect set combinations using OR operator");
- end if;
-
-
- for i in 1..5 loop
- if not Maps.Is_In(Vowels(i), Vowel_Set) or
- not Maps.Is_In(Vowels(i), Alphabet_Set) or
- Maps.Is_In(Vowels(i), Consonant_Set)
- then
- Report.Failed("Incorrect function Is_In use with set " &
- "combinations - " & Integer'Image(i));
- end if;
- end loop;
-
-
- if Maps.Is_Subset(Vowel_Set, First_Half_Set) or
- Maps."<="(Vowel_Set, Second_Half_Set) or
- not Maps.Is_Subset(Vowel_Set, Alphabet_Set)
- then
- Report.Failed("Incorrect set evaluation using Is_Subset function");
- end if;
-
-
- if not (Full_Vowel_Set = Maps.To_Set("aeiouy")) then
- Report.Failed("Incorrect result for ""="" set operator");
- end if;
-
-
- if not ((Vowel_Set AND First_Half_Set) OR
- (Full_Vowel_Set AND Second_Half_Set)) = Full_Vowel_Set then
- Report.Failed
- ("Incorrect result for AND, OR, or ""="" set operators");
- end if;
-
-
- if (Alphabet_Set AND Maps.Null_Set) /= Maps.Null_Set or
- (Alphabet_Set OR Maps.Null_Set) /= Alphabet_Set
- then
- Report.Failed("Incorrect result for AND or OR set operators");
- end if;
-
-
- Vowel_Set := Full_Vowel_Set;
- Vowel_Set := Vowel_Set AND (NOT Maps.To_Set(Quasi_Vowel));
-
- if not (Vowels = Maps.To_Sequence(Vowel_Set)) then
- Report.Failed("Incorrect Set to Sequence translation");
- end if;
-
-
- for i in 1..26 loop
- Inverse_Alphabet(i) := Alphabet(27-i);
- end loop;
-
- declare
- Inverse_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(Alphabet, Inverse_Alphabet);
- begin
- if Maps.Value(Maps.Identity, 'b') /= Maps.Value(Inverse_Map,'y')
- then
- Report.Failed("Incorrect Inverse mapping");
- end if;
- end;
-
-
- -- Check that Translation_Error is raised when a character is
- -- repeated in the parameter "From" string.
- declare
- Bad_Map : Maps.Character_Mapping;
- begin
- Bad_Map := Maps.To_Mapping(From => "aa", To => "yz");
- Report.Failed("Exception not raised with repeated character");
- exception
- when Translation_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception raised in To_Mapping with " &
- "a repeated character");
- end;
-
-
- -- Check that Translation_Error is raised when the parameters of the
- -- function To_Mapping are of unequal lengths.
- declare
- Bad_Map : Maps.Character_Mapping;
- begin
- Bad_Map := Maps.To_Mapping("abc", "yz");
- Report.Failed("Exception not raised with unequal parameter lengths");
- exception
- when Translation_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception raised in To_Mapping with " &
- "unequal parameter lengths");
- end;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4001;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4002.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4002.a
deleted file mode 100644
index 583621ab4d9..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4002.a
+++ /dev/null
@@ -1,182 +0,0 @@
--- CXA4002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Fixed are
--- available, and that they produce correct results. Specifically,
--- check the subprograms Index, "*" (string constructor function),
--- Count, Trim, and Replace_Slice.
---
--- TEST DESCRIPTION:
--- This test demonstrates how certain Fixed string functions are used
--- to eliminate specific substrings from portions of text. A procedure
--- is defined that will take as parameters a source string along with
--- a substring that is to be completely removed from the source string.
--- The source string is parsed using the Index function, and any substring
--- slices are replaced in the source string by a series of X's (based on
--- the length of the substring.)
--- Three lines of text are provided to this procedure, and the resulting
--- substitutions are compared with expected results to validate the
--- string processing.
--- A global accumulator is updated with the number of occurrences of the
--- substring in the source string.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Ada.Strings;
-with Ada.Strings.Fixed;
-with Ada.Strings.Maps;
-with Report;
-
-procedure CXA4002 is
-
-begin
-
- Report.Test ("CXA4002", "Check that the subprograms defined in package " &
- "Ada.Strings.Fixed are available, and that " &
- "they produce correct results");
-
- Test_Block:
- declare
-
- TC_Total : Natural := 0;
- Number_Of_Lines : constant := 3;
-
- type Restricted_Words_Array_Type is array (1..10) of String (1..10);
-
- Restricted_Words : Restricted_Words_Array_Type :=
- (" platoon", " marines ", " Marines ",
- "north ", "south ", " east",
- " beach ", " airport", "airfield ",
- " road ");
-
- subtype Line_Of_Text_Type is String(1..25);
- type Page_Of_Text_Type is array (1..Number_Of_Lines)
- of Line_Of_Text_Type;
-
- Text_Page : Page_Of_Text_Type := ("The platoon of Marines ",
- "moved south on the south ",
- "road to the airfield. ");
-
- TC_Revised_Line_1 : constant String := "The XXXXXXX of XXXXXXX ";
- TC_Revised_Line_2 : constant String := "moved XXXXX on the XXXXX ";
- TC_Revised_Line_3 : constant String := "XXXX to the XXXXXXXX. ";
-
- ---
-
- procedure Censor (Source_String : in out String;
- Pattern_String : in String) is
-
- -- Create a replacement string that is the same length as the
- -- pattern string being removed.
- Replacement : constant String := -- "*"
- Ada.Strings.Fixed."*"(Pattern_String'Length, 'X');
-
- Going : Ada.Strings.Direction := Ada.Strings.Forward;
- Map : constant Ada.Strings.Maps.Character_Mapping :=
- Ada.Strings.Maps.Identity;
- Start_Pos,
- Index : Natural := Source_String'First;
-
-
- begin -- Censor
-
- -- Accumulate count of total replacement operations.
-
- TC_Total := TC_Total + -- Count
- Ada.Strings.Fixed.Count (Source => Source_String,
- Pattern => Pattern_String,
- Mapping => Map);
- loop
-
- Index := Ada.Strings.Fixed.Index -- Index
- (Source_String(Start_Pos..Source_String'Last),
- Pattern_String,
- Going,
- Map);
-
- exit when Index = 0; -- No matches, exit loop.
-
- -- if a match was found, modify the substring.
- Ada.Strings.Fixed.Replace_Slice -- Replace_Slice
- (Source_String,
- Index,
- Index + Pattern_String'Length - 1,
- Replacement);
- Start_Pos := Index + Pattern_String'Length;
-
- end loop;
-
- end Censor;
-
-
- begin
-
- -- Invoke Censor subprogram to cleanse text.
- -- Loop through each line of text, and check for the presence of each
- -- restricted word.
- -- Use the Trim function to eliminate leading or trailing blanks from
- -- the restricted word parameters.
-
- for Line in 1..Number_Of_Lines loop
- for Word in Restricted_Words'Range loop
- Censor (Text_Page(Line),
- Ada.Strings.Fixed.Trim(Restricted_Words(Word), -- Trim
- Ada.Strings.Both));
- end loop;
- end loop;
-
-
- -- Validate results.
-
- if TC_Total /= 6 then
- Report.Failed ("Incorrect number of substitutions performed");
- end if;
-
- if Text_Page(1) /= TC_Revised_Line_1 then
- Report.Failed ("Incorrect substitutions on Line 1");
- end if;
-
- if Text_Page(2) /= TC_Revised_Line_2 then
- Report.Failed ("Incorrect substitutions on Line 2");
- end if;
-
- if Text_Page(3) /= TC_Revised_Line_3 then
- Report.Failed ("Incorrect substitutions on Line 3");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4002;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4003.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4003.a
deleted file mode 100644
index cd57a929616..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4003.a
+++ /dev/null
@@ -1,326 +0,0 @@
--- CXA4003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Fixed are
--- available, and that they produce correct results. Specifically,
--- check the subprograms Index, Index_Non_Blank, Head, Tail, Translate,
--- Find_Token, Move, Overwrite, and Replace_Slice.
---
--- TEST DESCRIPTION:
--- This test demonstrates how certain fixed string operations could be
--- used in string information processing. A procedure is defined that
--- will extract portions of a 50 character string that correspond to
--- certain data items (i.e., name, address, state, zip code). These
--- parsed items will then be added to the appropriate fields of data
--- base elements. These data base elements are then compared for
--- accuracy against a similar set of predefined data base elements.
---
--- A variety of fixed string processing subprograms are used in this
--- test. Each parsing operation uses a different combination
--- of the available subprograms to accomplish the same goal, therefore
--- continuity of approach to string parsing is not seen in this test.
--- However, a wide variety of possible approaches are demonstrated, while
--- exercising a large number of the total predefined subprograms of
--- package Ada.Strings.Fixed.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Ada.Strings.Fixed;
-with Ada.Strings.Maps;
-with Report;
-
-procedure CXA4003 is
-
-begin
-
- Report.Test ("CXA4003", "Check that the subprograms defined in package " &
- "Ada.Strings.Fixed are available, and that they " &
- "produce correct results");
-
- Test_Block:
- declare
-
- Number_Of_Info_Strings : constant Natural := 3;
- DB_Size : constant Natural := Number_Of_Info_Strings;
- Count : Natural := 0;
- Finished_Processing : Boolean := False;
- Blank_String : constant String := " ";
-
- subtype Info_String_Type is String (1..50);
- type Info_String_Storage_Type is
- array (1..Number_Of_Info_Strings) of Info_String_Type;
-
-
- subtype Name_Type is String (1..10);
- subtype Street_Number_Type is String (1..5);
- subtype Street_Name_Type is String (1..10);
- subtype City_Type is String (1..10);
- subtype State_Type is String (1..2);
- subtype Zip_Code_Type is String (1..5);
-
- type Data_Base_Element_Type is
- record
- Name : Name_Type := (others => ' ');
- Street_Number : Street_Number_Type := (others => ' ');
- Street_Name : Street_Name_Type := (others => ' ');
- City : City_Type := (others => ' ');
- State : State_Type := (others => ' ');
- Zip_Code : Zip_Code_Type := (others => ' ');
- end record;
-
- type Data_Base_Type is array (1..DB_Size) of Data_Base_Element_Type;
-
- Data_Base : Data_Base_Type;
-
- ---
-
- Info_String_1 : Info_String_Type :=
- "Joe_Jones 123 Sixth_St San_Diego CA 98765";
-
- Info_String_2 : Info_String_Type :=
- "Sam_Smith 56789 S._Seventh Carlsbad CA 92177";
-
- Info_String_3 : Info_String_Type :=
- "Jane_Brown 1219 Info_Lane Tuscon AZ 85643";
-
-
- Info_Strings : Info_String_Storage_Type := (1 => Info_String_1,
- 2 => Info_String_2,
- 3 => Info_String_3);
-
-
-
- TC_DB_Element_1 : Data_Base_Element_Type :=
- ("Joe Jones ", "123 ", "Sixth St ", "San Diego ", "CA", "98765");
-
- TC_DB_Element_2 : Data_Base_Element_Type :=
- ("Sam Smith ", "56789", "S. Seventh", "Carlsbad ", "CA", "92177");
-
- TC_DB_Element_3 : Data_Base_Element_Type :=
- ("Jane Brown", "1219 ", "Info Lane ", "Tuscon ", "AZ", "85643");
-
- TC_Data_Base : Data_Base_Type := (TC_DB_Element_1,
- TC_DB_Element_2,
- TC_DB_Element_3);
-
- ---
-
-
- procedure Store_Information
- (Info_String : in Info_String_Type;
- DB_Record : in out Data_Base_Element_Type) is
-
- package AS renames Ada.Strings;
- use type AS.Maps.Character_Set;
-
- UnderScore : AS.Maps.Character_Sequence := "_";
- Blank : AS.Maps.Character_Sequence := " ";
-
- Start,
- Stop : Natural := 0;
-
- Underscore_to_Blank_Map : constant AS.Maps.Character_Mapping :=
- AS.Maps.To_Mapping(From => UnderScore,
- To => Blank);
-
- Numeric_Set : constant AS.Maps.Character_Set :=
- AS.Maps.To_Set("0123456789");
-
- Cal : constant AS.Maps.Character_Sequence := "CA";
- California_Set : constant AS.Maps.Character_Set :=
- AS.Maps.To_Set(Cal);
- Arizona_Set : constant AS.Maps.Character_Set :=
- AS.Maps.To_Set("AZ");
- Nevada_Set : constant AS.Maps.Character_Set :=
- AS.Maps.To_Set("NV");
-
- begin
-
- -- Find the starting position of the name field (first non-blank),
- -- then, from that position, find the end of the name field (first
- -- blank).
-
- Start := AS.Fixed.Index_Non_Blank(Info_String);
- Stop := AS.Fixed.Index (Info_String(Start..Info_String'Length),
- AS.Maps.To_Set(' '),
- AS.Inside,
- AS.Forward) - 1 ;
-
- -- Store the name field in the data base element field for "Name".
-
- DB_Record.Name := AS.Fixed.Head(Info_String(1..Stop),
- DB_Record.Name'Length);
-
- -- Replace any underscore characters in the name field
- -- that were used to separate first/middle/last names.
-
- AS.Fixed.Translate (DB_Record.Name, Underscore_to_Blank_Map);
-
-
- -- Continue the extraction process; now find the position of
- -- the street number in the string.
-
- Start := Stop + 1;
-
- AS.Fixed.Find_Token(Info_String(Start..Info_String'Length),
- Numeric_Set,
- AS.Inside,
- Start,
- Stop);
-
- -- Store the street number field in the appropriate data base
- -- element.
- -- No modification of the default parameters of procedure Move
- -- is required.
-
- AS.Fixed.Move(Source => Info_String(Start..Stop),
- Target => DB_Record.Street_Number);
-
-
- -- Continue the extraction process; find the street name in the
- -- info string. Skip blanks to the start of the street name, then
- -- search for the index of the next blank character in the string.
-
- Start :=
- AS.Fixed.Index_Non_Blank(Info_String(Stop+1..Info_String'Length));
-
- Stop :=
- AS.Fixed.Index(Info_String(Start..Info_String'Length),
- Blank_String) - 1;
-
- -- Store the street name in the appropriate data base element field.
-
- AS.Fixed.Overwrite(DB_Record.Street_Name,
- 1,
- Info_String(Start..Stop));
-
- -- Replace any underscore characters in the street name field
- -- that were used as word separation.
-
- DB_Record.Street_Name := AS.Fixed.Translate(DB_Record.Street_Name,
- Underscore_to_Blank_Map);
-
-
- -- Continue the extraction; remove the city name from the string.
-
- Start :=
- AS.Fixed.Index_Non_Blank(Info_String(Stop+1..Info_String'Length));
-
- Stop :=
- AS.Fixed.Index(Info_String(Start..Info_String'Length),
- Blank_String) - 1;
-
- -- Store the city name field in the appropriate data base element.
-
- AS.Fixed.Replace_Slice(DB_Record.City,
- 1,
- DB_Record.City'Length,
- Info_String(Start..Stop));
-
- -- Replace any underscore characters in the city name field
- -- that were used as word separation.
-
- AS.Fixed.Translate (DB_Record.City, Underscore_to_Blank_Map);
-
-
- -- Continue the extraction; remove the state identifier from the
- -- info string.
-
- Start := Stop + 1;
-
- AS.Fixed.Find_Token(Info_String(Start..Info_String'Length),
- AS.Maps."OR"(California_Set,
- AS.Maps."OR"(Nevada_Set, Arizona_Set)),
- AS.Inside,
- Start,
- Stop);
-
- -- Store the state indicator into the data base element.
-
- AS.Fixed.Move(Source => Info_String(Start..Stop),
- Target => DB_Record.State,
- Drop => Ada.Strings.Right,
- Justify => Ada.Strings.Left,
- Pad => AS.Space);
-
-
- -- Continue the extraction process; remove the final data item in
- -- the info string, the zip code, and place it into the
- -- corresponding data base element.
-
- DB_Record.Zip_Code := AS.Fixed.Tail(Info_String,
- DB_Record.Zip_Code'Length);
-
- exception
- when AS.Length_Error =>
- Report.Failed ("Length_Error raised in procedure");
- when AS.Pattern_Error =>
- Report.Failed ("Pattern_Error raised in procedure");
- when AS.Translation_Error =>
- Report.Failed ("Translation_Error raised in procedure");
- when others =>
- Report.Failed ("Exception raised in procedure");
- end Store_Information;
-
-
- begin
-
- -- Loop thru the information strings, extract the name and address
- -- information, place this info into elements of the data base.
-
- while not Finished_Processing loop
-
- Count := Count + 1;
-
- Store_Information (Info_Strings(Count), Data_Base(Count));
-
- Finished_Processing := (Count = Number_Of_Info_Strings);
-
- end loop;
-
-
- -- Verify that the string processing was successful.
-
- for i in 1..DB_Size loop
- if Data_Base(i) /= TC_Data_Base(i) then
- Report.Failed
- ("Data processing error on record " & Integer'Image(i));
- end if;
- end loop;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4003;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4004.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4004.a
deleted file mode 100644
index ec11f7d50f9..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4004.a
+++ /dev/null
@@ -1,431 +0,0 @@
--- CXA4004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Fixed are
--- available, and that they produce correct results. Specifically, check
--- the subprograms Count, Find_Token, Index, Index_Non_Blank, and Move.
---
--- TEST DESCRIPTION:
--- This test, when combined with tests CXA4002,3, and 5 will provide
--- thorough coverage of the functionality found in Ada.Strings.Fixed.
--- This test contains many small, specific test cases, situations that
--- although common in user environments, are often difficult to generate
--- in large numbers in a application-based test.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 10 Apr 95 SAIC Corrected subtest for Move, Drop=Right.
---
---!
-
-with Report;
-with Ada.Strings;
-with Ada.Strings.Fixed;
-with Ada.Strings.Maps;
-
-procedure CXA4004 is
-begin
-
- Report.Test("CXA4004", "Check that the subprograms defined in " &
- "package Ada.Strings.Fixed are available, " &
- "and that they produce correct results");
-
- Test_Block:
- declare
-
- package ASF renames Ada.Strings.Fixed;
- package Maps renames Ada.Strings.Maps;
-
- Result_String : String(1..10) := (others => Ada.Strings.Space);
-
- Source_String1 : String(1..5) := "abcde"; -- odd length string
- Source_String2 : String(1..6) := "abcdef"; -- even length string
- Source_String3 : String(1..12) := "abcdefghijkl";
- Source_String4 : String(1..12) := "abcdefghij "; -- last two ch pad
- Source_String5 : String(1..12) := " cdefghijkl"; -- first two ch pad
- Source_String6 : String(1..12) := "abcdefabcdef";
-
- Location : Natural := 0;
- Slice_Start : Positive;
- Slice_End,
- Slice_Count : Natural := 0;
-
- CD_Set : Maps.Character_Set := Maps.To_Set("cd");
- ABCD_Set : Maps.Character_Set := Maps.To_Set("abcd");
- A_to_F_Set : Maps.Character_Set := Maps.To_Set("abcdef");
-
- CD_to_XY_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(From => "cd", To => "xy");
-
- begin
-
- -- Procedure Move
-
- -- Evaluate the Procedure Move with various combinations of
- -- parameters.
-
- -- Justify = Left (default case)
-
- ASF.Move(Source => Source_String1, -- "abcde"
- Target => Result_String);
-
- if Result_String /= "abcde " then
- Report.Failed("Incorrect result from Move with Justify = Left");
- end if;
-
- -- Justify = Right
-
- ASF.Move(Source => Source_String2, -- "abcdef"
- Target => Result_String,
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Right);
-
- if Result_String /= " abcdef" then
- Report.Failed("Incorrect result from Move with Justify = Right");
- end if;
-
- -- Justify = Center (two cases, odd and even pad lengths)
-
- ASF.Move(Source_String1, -- "abcde"
- Result_String,
- Ada.Strings.Error,
- Ada.Strings.Center,
- 'x'); -- non-default padding.
-
- if Result_String /= "xxabcdexxx" then -- Unequal padding added right
- Report.Failed("Incorrect result from Move with Justify = Center-1");
- end if;
-
- ASF.Move(Source_String2, -- "abcdef"
- Result_String,
- Ada.Strings.Error,
- Ada.Strings.Center);
-
- if Result_String /= " abcdef " then -- Equal padding added on L/R.
- Report.Failed("Incorrect result from Move with Justify = Center-2");
- end if;
-
- -- When the source string is longer than the target string, several
- -- cases can be examined, with the results depending on the value of
- -- the Drop parameter.
-
- -- Drop = Left
-
- ASF.Move(Source => Source_String3, -- "abcdefghijkl"
- Target => Result_String,
- Drop => Ada.Strings.Left);
-
- if Result_String /= "cdefghijkl" then
- Report.Failed("Incorrect result from Move with Drop = Left");
- end if;
-
- -- Drop = Right
-
- ASF.Move(Source_String3, Result_String, Ada.Strings.Right);
-
- if Result_String /= "abcdefghij" then
- Report.Failed("Incorrect result from Move with Drop = Right");
- end if;
-
- -- Drop = Error
- -- The effect in this case depends on the value of the justify
- -- parameter, and on whether any characters in Source other than
- -- Pad would fail to be copied.
-
- -- Drop = Error, Justify = Left, right overflow characters are pad.
-
- ASF.Move(Source => Source_String4, -- "abcdefghij "
- Target => Result_String,
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Left);
-
- if not(Result_String = "abcdefghij") then -- leftmost 10 characters
- Report.Failed("Incorrect result from Move with Drop = Error - 1");
- end if;
-
- -- Drop = Error, Justify = Right, left overflow characters are pad.
-
- ASF.Move(Source_String5, -- " cdefghijkl"
- Result_String,
- Ada.Strings.Error,
- Ada.Strings.Right);
-
- if Result_String /= "cdefghijkl" then -- rightmost 10 characters
- Report.Failed("Incorrect result from Move with Drop = Error - 2");
- end if;
-
- -- In other cases of Drop=Error, Length_Error is propagated, such as:
-
- begin
-
- ASF.Move(Source_String3, -- 12 characters, no Pad.
- Result_String, -- 10 characters
- Ada.Strings.Error,
- Ada.Strings.Left);
-
- Report.Failed("Length_Error not raised by Move - 1");
-
- exception
- when Ada.Strings.Length_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception raised by Move - 1");
- end;
-
-
-
- -- Function Index
- -- (Other usage examples of this function found in CXA4002-3.)
- -- Check when the pattern is not found in the source.
-
- if ASF.Index("abcdef", "gh") /= 0 or
- ASF.Index("abcde", "abcdef") /= 0 or -- pattern > source
- ASF.Index("xyz",
- "abcde",
- Ada.Strings.Backward) /= 0 or
- ASF.Index("", "ab") /= 0 or -- null source string.
- ASF.Index("abcde", " ") /= 0 -- blank pattern.
- then
- Report.Failed("Incorrect result from Index, no pattern match");
- end if;
-
- -- Check that Pattern_Error is raised when the pattern is the
- -- null string.
- begin
- Location := ASF.Index(Source_String6, -- "abcdefabcdef"
- "", -- null pattern string.
- Ada.Strings.Forward);
- Report.Failed("Pattern_Error not raised by Index");
- exception
- when Ada.Strings.Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Index, null pattern");
- end;
-
- -- Use the search direction "backward" to locate the particular
- -- pattern within the source string.
-
- Location := ASF.Index(Source_String6, -- "abcdefabcdef"
- "de", -- slice 4..5, 10..11
- Ada.Strings.Backward); -- search from right end.
-
- if Location /= 10 then
- Report.Failed("Incorrect result from Index going Backward");
- end if;
-
- -- Using the version of Index testing character set membership,
- -- check combinations of forward/backward, inside/outside parameter
- -- configurations.
-
- if ASF.Index(Source => Source_String1, -- "abcde"
- Set => CD_Set,
- Test => Ada.Strings.Inside,
- Going => Ada.Strings.Forward) /= 3 or -- 'c' at pos 3.
- ASF.Index(Source_String6, -- "abcdefabcdef"
- CD_Set,
- Ada.Strings.Outside,
- Ada.Strings.Backward) /= 12 or -- 'f' at position 12
- ASF.Index(Source_String6, -- "abcdefabcdef"
- CD_Set,
- Ada.Strings.Inside,
- Ada.Strings.Backward) /= 10 or -- 'd' at position 10
- ASF.Index("cdcdcdcdacdcdcdcd",
- CD_Set,
- Ada.Strings.Outside,
- Ada.Strings.Forward) /= 9 -- 'a' at position 9
- then
- Report.Failed("Incorrect result from function Index for sets - 1");
- end if;
-
- -- Additional interesting uses/combinations using Index for sets.
-
- if ASF.Index("cd", -- same size, str-set
- CD_Set,
- Ada.Strings.Inside,
- Ada.Strings.Forward) /= 1 or -- 'c' at position 1
- ASF.Index("abcd", -- same size, str-set,
- Maps.To_Set("efgh"), -- different contents.
- Ada.Strings.Outside,
- Ada.Strings.Forward) /= 1 or
- ASF.Index("abccd", -- set > string
- Maps.To_Set("acegik"),
- Ada.Strings.Inside,
- Ada.Strings.Backward) /= 4 or -- 'c' at position 4
- ASF.Index("abcde",
- Maps.Null_Set) /= 0 or
- ASF.Index("", -- Null string.
- CD_Set) /= 0 or
- ASF.Index("abc ab", -- blank included
- Maps.To_Set("e "), -- in string and set.
- Ada.Strings.Inside,
- Ada.Strings.Backward) /= 4 -- blank in string.
- then
- Report.Failed("Incorrect result from function Index for sets - 2");
- end if;
-
-
-
- -- Function Index_Non_Blank.
- -- (Other usage examples of this function found in CXA4002-3.)
-
-
- if ASF.Index_Non_Blank(Source => Source_String4, -- "abcdefghij "
- Going => Ada.Strings.Backward) /= 10 or
- ASF.Index_Non_Blank("abc def ghi jkl ",
- Ada.Strings.Backward) /= 15 or
- ASF.Index_Non_Blank(" abcdef") /= 3 or
- ASF.Index_Non_Blank(" ") /= 0
- then
- Report.Failed("Incorrect result from Index_Non_Blank");
- end if;
-
-
-
- -- Function Count
- -- (Other usage examples of this function found in CXA4002-3.)
-
- if ASF.Count("abababa", "aba") /= 2 or
- ASF.Count("abababa", "ab" ) /= 3 or
- ASF.Count("babababa", "ab") /= 3 or
- ASF.Count("abaabaaba", "aba") /= 3 or
- ASF.Count("xxxxxxxxxxxxxxxxxxxy", "xy") /= 1 or
- ASF.Count("xxxxxxxxxxxxxxxxxxxx", "x") /= 20
- then
- Report.Failed("Incorrect result from Function Count");
- end if;
-
- -- Determine the number of slices of Source that when mapped to a
- -- non-identity map, match the pattern string.
-
- Slice_Count := ASF.Count(Source_String6, -- "abcdefabcdef"
- "xy",
- CD_to_XY_Map); -- maps 'c' to 'x', 'd' to 'y'
-
- if Slice_Count /= 2 then -- two slices "xy" in "mapped" Source_String6
- Report.Failed("Incorrect result from Count with non-identity map");
- end if;
-
- -- If the pattern supplied to Function Count is the null string, then
- -- Pattern_Error is propagated.
-
- declare
- The_Null_String : constant String := "";
- begin
- Slice_Count := ASF.Count(Source_String6, The_Null_String);
- Report.Failed("Pattern_Error not raised by Function Count");
- exception
- when Ada.Strings.Pattern_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception from Count with null pattern");
- end;
-
-
- -- Function Count returning the number of characters in a particular
- -- set that are found in source string.
-
- if ASF.Count(Source_String6, CD_Set) /= 4 then -- 2 'c' and 'd' chars.
- Report.Failed("Incorrect result from Count with set");
- end if;
-
-
-
- -- Function Find_Token.
- -- (Other usage examples of this function found in CXA4002-3.)
-
- ASF.Find_Token(Source => Source_String6, -- First slice with no
- Set => ABCD_Set, -- 'a', 'b', 'c', or 'd'
- Test => Ada.Strings.Outside, -- is "ef" at 5..6.
- First => Slice_Start,
- Last => Slice_End);
-
- if Slice_Start /= 5 or Slice_End /= 6 then
- Report.Failed("Incorrect result from Find_Token - 1");
- end if;
-
- -- If no appropriate slice is contained by the source string, then the
- -- value returned in Last is zero, and the value in First is
- -- Source'First.
-
- ASF.Find_Token(Source_String6, -- "abcdefabcdef"
- A_to_F_Set, -- Set of characters 'a' thru 'f'.
- Ada.Strings.Outside, -- No characters outside this set.
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= Source_String6'First or Slice_End /= 0 then
- Report.Failed("Incorrect result from Find_Token - 2");
- end if;
-
- -- Additional testing of Find_Token.
-
- ASF.Find_Token("eabcdabcddcab",
- ABCD_Set,
- Ada.Strings.Inside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 2 or Slice_End /= 13 then
- Report.Failed("Incorrect result from Find_Token - 3");
- end if;
-
- ASF.Find_Token("efghijklabcdabcd",
- ABCD_Set,
- Ada.Strings.Outside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 1 or Slice_End /= 8 then
- Report.Failed("Incorrect result from Find_Token - 4");
- end if;
-
- ASF.Find_Token("abcdefgabcdabcd",
- ABCD_Set,
- Ada.Strings.Outside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 5 or Slice_End /= 7 then
- Report.Failed("Incorrect result from Find_Token - 5");
- end if;
-
- ASF.Find_Token("abcdcbabcdcba",
- ABCD_Set,
- Ada.Strings.Inside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 1 or Slice_End /= 13 then
- Report.Failed("Incorrect result from Find_Token - 6");
- end if;
-
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4004;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4005.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4005.a
deleted file mode 100644
index d61f853ca0e..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4005.a
+++ /dev/null
@@ -1,683 +0,0 @@
--- CXA4005.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Fixed are
--- available, and that they produce correct results. Specifically,
--- check the subprograms Delete, Head, Insert, Overwrite, Replace_Slice,
--- Tail, Trim, and "*".
---
--- TEST DESCRIPTION:
--- This test, when combined with tests CXA4002-4 will provide coverage
--- of the functionality found in Ada.Strings.Fixed.
--- This test contains many small, specific test cases, situations that
--- although common in user environments, are often difficult to generate
--- in large numbers in a application-based test. They represent
--- individual usage paradigms in-the-small.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 11 Apr 95 SAIC Corrected acceptance conditions of certain
--- subtests.
--- 06 Nov 95 SAIC Fixed bugs for ACVC 2.0.1.
--- 22 Feb 01 PHL Check that the lower bound of the result is 1.
--- 13 Mar 01 RLB Fixed a couple of ACATS style violations;
--- removed pointless checks of procedures.
--- Added checks of other functions. These changes
--- were made to test Defect Report 8652/0049, as
--- reflected in Technical Corrigendum 1.
---
---!
-
-with Report;
-with Ada.Strings;
-with Ada.Strings.Fixed;
-with Ada.Strings.Maps;
-
-procedure CXA4005 is
-
- type TC_Name_Holder is access String;
- Name : TC_Name_Holder;
-
- function TC_Check (S : String) return String is
- begin
- if S'First /= 1 then
- Report.Failed ("Lower bound of result of function " & Name.all &
- " is" & Integer'Image (S'First));
- end if;
- return S;
- end TC_Check;
-
- procedure TC_Set_Name (N : String) is
- begin
- Name := new String'(N);
- end TC_Set_Name;
-
-begin
-
- Report.Test("CXA4005", "Check that the subprograms defined in " &
- "package Ada.Strings.Fixed are available, " &
- "and that they produce correct results");
-
- Test_Block:
- declare
-
- package ASF renames Ada.Strings.Fixed;
- package Maps renames Ada.Strings.Maps;
-
- Result_String,
- Delete_String,
- Insert_String,
- Trim_String,
- Overwrite_String : String(1..10) := (others => Ada.Strings.Space);
-
- Source_String1 : String(1..5) := "abcde"; -- odd length string
- Source_String2 : String(1..6) := "abcdef"; -- even length string
- Source_String3 : String(1..12) := "abcdefghijkl";
- Source_String4 : String(1..12) := "abcdefghij "; -- last two ch pad
- Source_String5 : String(1..12) := " cdefghijkl"; -- first two ch pad
- Source_String6 : String(1..12) := "abcdefabcdef";
-
- Location : Natural := 0;
- Slice_Start : Positive;
- Slice_End,
- Slice_Count : Natural := 0;
-
- CD_Set : Maps.Character_Set := Maps.To_Set("cd");
- X_Set : Maps.Character_Set := Maps.To_Set('x');
- ABCD_Set : Maps.Character_Set := Maps.To_Set("abcd");
- A_to_F_Set : Maps.Character_Set := Maps.To_Set("abcdef");
-
- CD_to_XY_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(From => "cd", To => "xy");
-
- begin
-
- -- Procedure Replace_Slice
- -- The functionality of this procedure
- -- is similar to procedure Move, and
- -- is tested here in the same manner, evaluated
- -- with various combinations of parameters.
-
- -- Index_Error propagation when Low > Source'Last + 1
-
- begin
- ASF.Replace_Slice(Result_String,
- Result_String'Last + 2, -- should raise exception
- Result_String'Last,
- "xxxxxxx");
- Report.Failed("Index_Error not raised by Replace_Slice - 1");
- exception
- when Ada.Strings.Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception from Replace_Slice - 1");
- end;
-
- -- Index_Error propagation when High < Source'First - 1
-
- begin
- ASF.Replace_Slice(Result_String(5..10),
- 5,
- 3, -- should raise exception since < 'First - 1.
- "xxxxxxx");
- Report.Failed("Index_Error not raised by Replace_Slice - 2");
- exception
- when Ada.Strings.Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception from Replace_Slice - 2");
- end;
-
- -- Justify = Left (default case)
-
- Result_String := "XXXXXXXXXX";
-
- ASF.Replace_Slice(Source => Result_String,
- Low => 1,
- High => 10,
- By => Source_String1); -- "abcde"
-
- if Result_String /= "abcde " then
- Report.Failed("Incorrect result from Replace_Slice - Justify = Left");
- end if;
-
- -- Justify = Right
-
- ASF.Replace_Slice(Source => Result_String,
- Low => 1,
- High => Result_String'Last,
- By => Source_String2, -- "abcdef"
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Right);
-
- if Result_String /= " abcdef" then
- Report.Failed("Incorrect result from Replace_Slice - Justify=Right");
- end if;
-
- -- Justify = Center (two cases, odd and even pad lengths)
-
- ASF.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String1, -- "abcde"
- Ada.Strings.Error,
- Ada.Strings.Center,
- 'x'); -- non-default padding.
-
- if Result_String /= "xxabcdexxx" then -- Unequal padding added right
- Report.Failed("Incorrect result, Replace_Slice - Justify=Center - 1");
- end if;
-
- ASF.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String2, -- "abcdef"
- Ada.Strings.Error,
- Ada.Strings.Center);
-
- if Result_String /= " abcdef " then -- Equal padding added on L/R.
- Report.Failed("Incorrect result from Replace_Slice with " &
- "Justify = Center - 2");
- end if;
-
- -- When the source string is longer than the target string, several
- -- cases can be examined, with the results depending on the value of
- -- the Drop parameter.
-
- -- Drop = Left
-
- ASF.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String3, -- "abcdefghijkl"
- Drop => Ada.Strings.Left);
-
- if Result_String /= "cdefghijkl" then
- Report.Failed("Incorrect result from Replace_Slice - Drop=Left");
- end if;
-
- -- Drop = Right
-
- ASF.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String3, -- "abcdefghijkl"
- Ada.Strings.Right);
-
- if Result_String /= "abcdefghij" then
- Report.Failed("Incorrect result, Replace_Slice with Drop=Right");
- end if;
-
- -- Drop = Error
-
- -- The effect in this case depends on the value of the justify
- -- parameter, and on whether any characters in Source other than
- -- Pad would fail to be copied.
-
- -- Drop = Error, Justify = Left, right overflow characters are pad.
-
- ASF.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String4, -- "abcdefghij "
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Left);
-
- if not(Result_String = "abcdefghij") then -- leftmost 10 characters
- Report.Failed("Incorrect result, Replace_Slice - Drop = Error - 1");
- end if;
-
- -- Drop = Error, Justify = Right, left overflow characters are pad.
-
- ASF.Replace_Slice(Source => Result_String,
- Low => 1,
- High => Result_String'Last,
- By => Source_String5, -- " cdefghijkl"
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Right);
-
- if Result_String /= "cdefghijkl" then -- rightmost 10 characters
- Report.Failed("Incorrect result, Replace_Slice - Drop = Error - 2");
- end if;
-
- -- In other cases of Drop=Error, Length_Error is propagated, such as:
-
- begin
-
- ASF.Replace_Slice(Source => Result_String,
- Low => 1,
- High => Result_String'Last,
- By => Source_String3, -- "abcdefghijkl"
- Drop => Ada.Strings.Error);
-
- Report.Failed("Length_Error not raised by Replace_Slice - 1");
-
- exception
- when Ada.Strings.Length_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception from Replace_Slice - 3");
- end;
-
-
- -- Function Replace_Slice
-
- TC_Set_Name ("Replace_Slice");
-
- if TC_Check (ASF.Replace_Slice("abcde", 3, 3, "x"))
- /= "abxde" or -- High = Low
- TC_Check (ASF.Replace_Slice("abc", 2, 3, "xyz")) /= "axyz" or
- TC_Check (ASF.Replace_Slice("abcd", 4, 1, "xy"))
- /= "abcxyd" or -- High < Low
- TC_Check (ASF.Replace_Slice("abc", 2, 3, "x")) /= "ax" or
- TC_Check (ASF.Replace_Slice("a", 1, 1, "z")) /= "z"
- then
- Report.Failed("Incorrect result from Function Replace_Slice - 1");
- end if;
-
- if TC_Check (ASF.Replace_Slice("abcde", 5, 5, "z"))
- /= "abcdz" or -- By length 1
- TC_Check (ASF.Replace_Slice("abc", 1, 3, "xyz"))
- /= "xyz" or -- High > Low
- TC_Check (ASF.Replace_Slice("abc", 3, 2, "xy"))
- /= "abxyc" or -- insert
- TC_Check (ASF.Replace_Slice("a", 1, 1, "xyz")) /= "xyz"
- then
- Report.Failed("Incorrect result from Function Replace_Slice - 2");
- end if;
-
-
-
- -- Function Insert.
-
- TC_Set_Name ("Insert");
-
- declare
- New_String : constant String :=
- TC_Check (
- ASF.Insert(Source => Source_String1(2..5), -- "bcde"
- Before => 3,
- New_Item => Source_String2)); -- "abcdef"
- begin
- if New_String /= "babcdefcde" then
- Report.Failed("Incorrect result from Function Insert - 1");
- end if;
- end;
-
- if TC_Check (ASF.Insert("a", 1, "z")) /= "za" or
- TC_Check (ASF.Insert("abc", 3, "")) /= "abc" or
- TC_Check (ASF.Insert("abc", 1, "z")) /= "zabc"
- then
- Report.Failed("Incorrect result from Function Insert - 2");
- end if;
-
- begin
- if TC_Check (ASF.Insert(Source => Source_String1(2..5), -- "bcde"
- Before => Report.Ident_Int(7),
- New_Item => Source_String2)) -- "abcdef"
- /= "babcdefcde" then
- Report.Failed("Index_Error not raised by Insert - 3A");
- else
- Report.Failed("Index_Error not raised by Insert - 3B");
- end if;
- exception
- when Ada.Strings.Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception from Insert - 3");
- end;
-
-
- -- Procedure Insert
-
- -- Drop = Right
-
- ASF.Insert(Source => Insert_String,
- Before => 6,
- New_Item => Source_String2, -- "abcdef"
- Drop => Ada.Strings.Right);
-
- if Insert_String /= " abcde" then -- last char of New_Item dropped.
- Report.Failed("Incorrect result from Insert with Drop = Right");
- end if;
-
- -- Drop = Left
-
- ASF.Insert(Source => Insert_String, -- 10 char string
- Before => 2, -- 9 chars, 2..10 available
- New_Item => Source_String3, -- 12 characters long.
- Drop => Ada.Strings.Left); -- truncate from Left.
-
- if Insert_String /= "l abcde" then -- 10 chars, leading blank.
- Report.Failed("Incorrect result from Insert with Drop=Left");
- end if;
-
- -- Drop = Error
-
- begin
- ASF.Insert(Source => Result_String, -- 10 chars
- Before => Result_String'Last,
- New_Item => "abcdefghijk",
- Drop => Ada.Strings.Error);
- Report.Failed("Exception not raised by Procedure Insert");
- exception
- when Ada.Strings.Length_Error => null; -- OK, expected exception
- when others =>
- Report.Failed("Incorrect exception raised by Procedure Insert");
- end;
-
-
-
- -- Function Overwrite
-
- TC_Set_Name ("Overwrite");
-
- Overwrite_String := TC_Check (
- ASF.Overwrite(Result_String, -- 10 chars
- 1, -- starting at pos=1
- Source_String3(1..10)));
-
- if Overwrite_String /= Source_String3(1..10) then
- Report.Failed("Incorrect result from Function Overwrite - 1");
- end if;
-
-
- if TC_Check (ASF.Overwrite("abcdef", 4, "xyz")) /= "abcxyz" or
- TC_Check (ASF.Overwrite("a", 1, "xyz"))
- /= "xyz" or -- chars appended
- TC_Check (ASF.Overwrite("abc", 3, " "))
- /= "ab " or -- blanks appended
- TC_Check (ASF.Overwrite("abcde", 1, "z" )) /= "zbcde"
- then
- Report.Failed("Incorrect result from Function Overwrite - 2");
- end if;
-
-
-
- -- Procedure Overwrite, with truncation.
-
- ASF.Overwrite(Source => Overwrite_String, -- 10 characters.
- Position => 1,
- New_Item => Source_String3, -- 12 characters.
- Drop => Ada.Strings.Left);
-
- if Overwrite_String /= "cdefghijkl" then
- Report.Failed("Incorrect result from Overwrite with Drop=Left");
- end if;
-
- -- The default drop value is Right, used here.
-
- ASF.Overwrite(Source => Overwrite_String, -- 10 characters.
- Position => 1,
- New_Item => Source_String3); -- 12 characters.
-
- if Overwrite_String /= "abcdefghij" then
- Report.Failed("Incorrect result from Overwrite with Drop=Right");
- end if;
-
- -- Drop = Error
-
- begin
- ASF.Overwrite(Source => Overwrite_String, -- 10 characters.
- Position => 1,
- New_Item => Source_String3, -- 12 characters.
- Drop => Ada.Strings.Error);
- Report.Failed("Exception not raised by Procedure Overwrite");
- exception
- when Ada.Strings.Length_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Procedure Overwrite");
- end;
-
- Overwrite_String := "ababababab";
- ASF.Overwrite(Overwrite_String, Overwrite_String'Last, "z");
- ASF.Overwrite(Overwrite_String, Overwrite_String'First,"z");
- ASF.Overwrite(Overwrite_String, 5, "zz");
-
- if Overwrite_String /= "zbabzzabaz" then
- Report.Failed("Incorrect result from Procedure Overwrite");
- end if;
-
-
-
- -- Function Delete
-
- TC_Set_Name ("Delete");
-
- declare
- New_String1 : constant String := -- This returns a 4 char string.
- TC_Check (ASF.Delete(Source => Source_String3,
- From => 3,
- Through => 10));
- New_String2 : constant String := -- This returns Source.
- TC_Check (ASF.Delete(Source_String3, 10, 3));
- begin
- if New_String1 /= "abkl" or
- New_String2 /= Source_String3
- then
- Report.Failed("Incorrect result from Function Delete - 1");
- end if;
- end;
-
- if TC_Check (ASF.Delete("a", 1, 1))
- /= "" or -- Source length = 1
- TC_Check (ASF.Delete("abc", 1, 2))
- /= "c" or -- From = Source'First
- TC_Check (ASF.Delete("abc", 3, 3))
- /= "ab" or -- From = Source'Last
- TC_Check (ASF.Delete("abc", 3, 1))
- /= "abc" -- From > Through
- then
- Report.Failed("Incorrect result from Function Delete - 2");
- end if;
-
-
-
- -- Procedure Delete
-
- -- Justify = Left
-
- Delete_String := Source_String3(1..10); -- Initialize to "abcdefghij"
-
- ASF.Delete(Source => Delete_String,
- From => 6,
- Through => Delete_String'Last,
- Justify => Ada.Strings.Left,
- Pad => 'x'); -- pad with char 'x'
-
- if Delete_String /= "abcdexxxxx" then
- Report.Failed("Incorrect result from Delete - Justify = Left");
- end if;
-
- -- Justify = Right
-
- ASF.Delete(Source => Delete_String, -- Remove x"s from end and
- From => 6, -- shift right.
- Through => Delete_String'Last,
- Justify => Ada.Strings.Right,
- Pad => 'x'); -- pad with char 'x' on left.
-
- if Delete_String /= "xxxxxabcde" then
- Report.Failed("Incorrect result from Delete - Justify = Right");
- end if;
-
- -- Justify = Center
-
- ASF.Delete(Source => Delete_String,
- From => 1,
- Through => 5,
- Justify => Ada.Strings.Center,
- Pad => 'z');
-
- if Delete_String /= "zzabcdezzz" then -- extra pad char on right side.
- Report.Failed("Incorrect result from Delete - Justify = Center");
- end if;
-
-
-
- -- Function Trim
- -- Use non-identity character sets to perform the trim operation.
-
- TC_Set_Name ("Trim");
-
- Trim_String := "cdabcdefcd";
-
- -- Remove the "cd" from each end of the string. This will not effect
- -- the "cd" slice at 5..6.
-
- declare
- New_String : constant String :=
- TC_Check (ASF.Trim(Source => Trim_String,
- Left => CD_Set, Right => CD_Set));
- begin
- if New_String /= Source_String2 then -- string "abcdef"
- Report.Failed("Incorrect result from Trim with character sets");
- end if;
- end;
-
- if TC_Check (ASF.Trim("abcdef", Maps.Null_Set, Maps.Null_Set))
- /= "abcdef" then
- Report.Failed("Incorrect result from Trim with Null sets");
- end if;
-
- if TC_Check (ASF.Trim("cdxx", CD_Set, X_Set)) /= "" then
- Report.Failed("Incorrect result from Trim, string removal");
- end if;
-
-
- -- Procedure Trim
-
- -- Justify = Right
-
- ASF.Trim(Source => Trim_String,
- Left => CD_Set,
- Right => CD_Set,
- Justify => Ada.Strings.Right,
- Pad => 'x');
-
- if Trim_String /= "xxxxabcdef" then
- Report.Failed("Incorrect result from Trim with Justify = Right");
- end if;
-
- -- Justify = Left
-
- ASF.Trim(Source => Trim_String,
- Left => X_Set,
- Right => Maps.Null_Set,
- Justify => Ada.Strings.Left,
- Pad => Ada.Strings.Space);
-
- if Trim_String /= "abcdef " then -- Padded with 4 blanks on right.
- Report.Failed("Incorrect result from Trim with Justify = Left");
- end if;
-
- -- Justify = Center
-
- ASF.Trim(Source => Trim_String,
- Left => ABCD_Set,
- Right => CD_Set,
- Justify => Ada.Strings.Center,
- Pad => 'x');
-
- if Trim_String /= "xxef xx" then -- Padded with 2 pad chars on L/R
- Report.Failed("Incorrect result from Trim with Justify = Center");
- end if;
-
-
-
- -- Function Head, demonstrating use of padding.
-
- TC_Set_Name ("Head");
-
- -- Use the characters of Source_String1 ("abcde") and pad the
- -- last five characters of Result_String with 'x' characters.
-
-
- Result_String := TC_CHeck (ASF.Head(Source_String1, 10, 'x'));
-
- if Result_String /= "abcdexxxxx" then
- Report.Failed("Incorrect result from Function Head with padding");
- end if;
-
- if TC_Check (ASF.Head(" ab ", 2)) /= " " or
- TC_Check (ASF.Head("a", 6, 'A')) /= "aAAAAA" or
- TC_Check (ASF.Head("abcdefgh", 3, 'x')) /= "abc" or
- TC_Check (ASF.Head(ASF.Head("abc ", 7, 'x'), 10, 'X'))
- /= "abc xxXXX"
- then
- Report.Failed("Incorrect result from Function Head");
- end if;
-
-
-
- -- Function Tail, demonstrating use of padding.
-
- TC_Set_Name ("Tail");
-
- -- Use the characters of Source_String1 ("abcde") and pad the
- -- first five characters of Result_String with 'x' characters.
-
- Result_String := TC_Check (ASF.Tail(Source_String1, 10, 'x'));
-
- if Result_String /= "xxxxxabcde" then
- Report.Failed("Incorrect result from Function Tail with padding");
- end if;
-
- if TC_Check (ASF.Tail("abcde ", 5))
- /= "cde " or -- blanks, back
- TC_Check (ASF.Tail(" abc ", 8, ' '))
- /= " abc " or -- blanks, front/back
- TC_Check (ASF.Tail("", 5, 'Z'))
- /= "ZZZZZ" or -- pad characters only
- TC_Check (ASF.Tail("abc", 0))
- /= "" or -- null result
- TC_Check (ASF.Tail("abcdefgh", 3))
- /= "fgh" or
- TC_Check (ASF.Tail(ASF.Tail(" abc ", 6, 'x'),
- 10,
- 'X')) /= "XXXXx abc "
- then
- Report.Failed("Incorrect result from Function Tail");
- end if;
-
-
- -- Function "*" - with (Natural, String) parameters
-
- TC_Set_Name ("""*""");
-
- if TC_Check (ASF."*"(3, Source_String1)) /= "abcdeabcdeabcde" or
- TC_Check (ASF."*"(2, Source_String2)) /= Source_String6 or
- TC_Check (ASF."*"(4, Source_String1(1..2))) /= "abababab" or
- TC_Check (ASF."*"(0, Source_String1)) /= ""
- then
- Report.Failed("Incorrect result from Function ""*"" with strings");
- end if;
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4005;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4006.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4006.a
deleted file mode 100644
index e1d7f46f5ae..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4006.a
+++ /dev/null
@@ -1,319 +0,0 @@
--- CXA4006.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Bounded are
--- available, and that they produce correct results. Specifically, check
--- the subprograms Length, Slice, "&", To_Bounded_String, Append, Index,
--- To_String, Replace_Slice, Trim, Overwrite, Delete, Insert, and
--- Translate.
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of a variety of the string functions
--- found in the package Ada.Strings.Bounded, simulating the operations
--- found in a text processing package.
--- With bounded strings, the length of each "line" of text can vary up
--- to the instantiated maximum, allowing one to view a page of text as
--- a series of expandable lines. This provides flexibility in text
--- formatting of individual lines (strings).
--- Several subprograms are defined, all of which attempt to take advantage
--- of as many different bounded string utilities as possible. Often,
--- an operation that is being performed in a subprogram using a certain
--- bounded string utility could more efficiently be performed using a
--- a different utility. However, in the interest of including as broad
--- coverage as possible, a mixture of utilities is invoked in this test.
--- A simulated page of text is provided as a parameter to the test
--- defined subprograms, and the appropriate processing performed. The
--- processed page of text is then compared to a predefined "finished"
--- page, and test passage/failure is based on the results of this
--- comparison.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Ada.Strings;
-with Ada.Strings.Bounded;
-with Ada.Strings.Maps;
-with Report;
-
-procedure CXA4006 is
-
-begin
-
- Report.Test ("CXA4006", "Check that the subprograms defined in package " &
- "Ada.Strings.Bounded are available, and that " &
- "they produce correct results");
-
- Test_Block:
- declare
-
- Characters_Per_Line : constant Positive := 40;
- Lines_Per_Page : constant Natural := 4;
-
- package BS_40 is new
- Ada.Strings.Bounded.Generic_Bounded_Length(Characters_Per_Line);
- use type BS_40.Bounded_String;
-
- type Page_Type is array (1..Lines_Per_Page) of BS_40.Bounded_String;
-
- -- Note: Misspellings below are intentional.
-
- Line1 : BS_40.Bounded_String :=
- BS_40.To_Bounded_String("ada is a progrraming language designed");
- Line2 : BS_40.Bounded_String :=
- BS_40.To_Bounded_String("to support the construction of long-");
- Line3 : BS_40.Bounded_String :=
- BS_40.To_Bounded_String("lived, highly reliabel software ");
- Line4 : BS_40.Bounded_String :=
- BS_40.To_Bounded_String("systems");
-
- Page : Page_Type := (1 => Line1, 2 => Line2, 3 => Line3, 4 => Line4);
-
- Finished_Page : Page_Type :=
- (BS_40.To_Bounded_String("Ada is a programming language designed"),
- BS_40.To_Bounded_String("to support the construction of long-"),
- BS_40.To_Bounded_String("lived, HIGHLY RELIABLE software systems."),
- BS_40.To_Bounded_String(""));
-
- ---
-
- procedure Compress (Page : in out Page_Type) is
- Clear_Line : Natural := Lines_Per_Page;
- begin
- -- If two consecutive lines on the page are together less than the
- -- maximum line length, then append those two lines, move up all
- -- lower lines on the page, and blank out the last line.
- for i in 1..Lines_Per_Page - 1 loop
- if BS_40.Length(Page(i)) + BS_40.Length(Page(i+1)) <=
- BS_40.Max_Length
- then
- Page(i) := BS_40."&"(Page(i),
- Page(i+1)); -- "&" (bounded, bounded)
-
- for j in i+1..Lines_Per_Page - 1 loop
- Page(j) :=
- BS_40.To_Bounded_String
- (BS_40.Slice(Page(j+1),
- 1,
- BS_40.Length(Page(j+1))));
- Clear_Line := j + 1;
- end loop;
- Page(Clear_Line) := BS_40.Null_Bounded_String;
- end if;
- end loop;
- end Compress;
-
- ---
-
- procedure Format (Page : in out Page_Type) is
- Sm_Ada : BS_40.Bounded_String := BS_40.To_Bounded_String("ada");
- Cap_Ada : constant String := "Ada";
- Char_Pos : Natural := 0;
- Finished : Boolean := False;
- Line : Natural := Page_Type'Last;
- begin
-
- -- Add a period to the end of the last line.
- while Line >= Page_Type'First and not Finished loop
- if Page(Line) /= BS_40.Null_Bounded_String and
- BS_40.Length(Page(Line)) <= BS_40.Max_Length
- then
- Page(Line) := BS_40.Append(Page(Line), '.');
- Finished := True;
- end if;
- Line := Line - 1;
- end loop;
-
- -- Replace all occurrences of "ada" with "Ada".
- for Line in Page_Type'First .. Page_Type'Last loop
- Finished := False;
- while not Finished loop
- Char_Pos := BS_40.Index(Source => Page(Line),
- Pattern => BS_40.To_String(Sm_Ada),
- Going => Ada.Strings.Backward);
- -- A zero is returned by function Index if no occurrences of
- -- the pattern string are found.
- Finished := (Char_Pos = 0);
- if not Finished then
- BS_40.Replace_Slice
- (Source => Page(Line),
- Low => Char_Pos,
- High => Char_Pos + BS_40.Length(Sm_Ada) - 1,
- By => Cap_Ada);
- end if;
- end loop; -- while loop
- end loop; -- for loop
-
- end Format;
-
- ---
-
- procedure Spell_Check (Page : in out Page_Type) is
- type Spelling_Type is (Incorrect, Correct);
- type Word_Array_Type is array (Spelling_Type)
- of BS_40.Bounded_String;
- type Dictionary_Type is array (1..2) of Word_Array_Type;
-
- -- Note that the "words" in the dictionary will require various
- -- amounts of Trimming prior to their use in the string functions.
- Dictionary : Dictionary_Type :=
- (1 => (BS_40.To_Bounded_String(" reliabel "),
- BS_40.To_Bounded_String(" reliable ")),
- 2 => (BS_40.To_Bounded_String(" progrraming "),
- BS_40.To_Bounded_String(" programming ")));
-
- Pos : Natural := Natural'First;
- Finished : Boolean := False;
-
- begin
-
- for Line in Page_Type'Range loop
-
- -- Search for the first incorrectly spelled word in the Dictionary,
- -- if it is found, replace it with the correctly spelled word,
- -- using the Overwrite function.
-
- while not Finished loop
- Pos :=
- BS_40.Index(Page(Line),
- BS_40.To_String(
- BS_40.Trim(Dictionary(1)(Incorrect),
- Ada.Strings.Both)),
- Ada.Strings.Forward);
- Finished := (Pos = 0);
- if not Finished then
- Page(Line) :=
- BS_40.Overwrite(Page(Line),
- Pos,
- BS_40.To_String
- (BS_40.Trim(Dictionary(1)(Correct),
- Ada.Strings.Both)));
- end if;
- end loop;
-
- Finished := False;
-
- -- Search for the second incorrectly spelled word in the
- -- Dictionary, if it is found, replace it with the correctly
- -- spelled word, using the Delete procedure and Insert function.
-
- while not Finished loop
- Pos :=
- BS_40.Index(Page(Line),
- BS_40.To_String(
- BS_40.Trim(Dictionary(2)(Incorrect),
- Ada.Strings.Both)),
- Ada.Strings.Forward);
-
- Finished := (Pos = 0);
-
- if not Finished then
- BS_40.Delete
- (Page(Line),
- Pos,
- Pos + BS_40.To_String
- (BS_40.Trim(Dictionary(2)(Incorrect),
- Ada.Strings.Both))'Length-1);
- Page(Line) :=
- BS_40.Insert(Page(Line),
- Pos,
- BS_40.To_String
- (BS_40.Trim(Dictionary(2)(Correct),
- Ada.Strings.Both)));
- end if;
- end loop;
-
- Finished := False;
-
- end loop;
- end Spell_Check;
-
- ---
-
- procedure Bold (Page : in out Page_Type) is
- Key_Word : constant String := "highly reliable";
- Bold_Mapping : constant Ada.Strings.Maps.Character_Mapping :=
- Ada.Strings.Maps.To_Mapping(From => " abcdefghijklmnopqrstuvwxyz",
- To => " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- Pos : Natural := Natural'First;
- Finished : Boolean := False;
- begin
- -- This procedure is designed to change the case of the phrase
- -- "highly reliable" into upper case (a type of "Bolding").
- -- All instances of the phrase on all lines of the page will be
- -- modified.
-
- for Line in Page_Type'First .. Page_Type'Last loop
- while not Finished loop
- Pos := BS_40.Index(Page(Line), Key_Word);
- Finished := (Pos = 0);
- if not Finished then
-
- BS_40.Overwrite
- (Page(Line),
- Pos,
- BS_40.To_String
- (BS_40.Translate
- (BS_40.To_Bounded_String
- (BS_40.Slice(Page(Line),
- Pos,
- Pos + Key_Word'Length - 1)),
- Bold_Mapping)));
-
- end if;
- end loop;
- Finished := False;
- end loop;
- end Bold;
-
-
- begin
-
- Compress(Page);
- Format(Page);
- Spell_Check(Page);
- Bold(Page);
-
- for i in 1..Lines_Per_Page loop
- if BS_40.To_String(Page(i)) /= BS_40.To_String(Finished_Page(i)) or
- BS_40.Length(Page(i)) /= BS_40.Length(Finished_Page(i))
- then
- Report.Failed("Incorrect modification of Page, Line " &
- Integer'Image(i));
- end if;
- end loop;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4006;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4007.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4007.a
deleted file mode 100644
index fca15d367b5..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4007.a
+++ /dev/null
@@ -1,334 +0,0 @@
--- CXA4007.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Bounded are
--- available, and that they produce correct results. Specifically, check
--- the subprograms Append, Count, Element, Find_Token, Head,
--- Index_Non_Blank, Replace_Element, Replicate, Tail, To_Bounded_String,
--- "&", ">", "<", ">=", "<=", and "*".
---
--- TEST DESCRIPTION:
--- This test, when taken in conjunction with tests CXA400[6,8,9], will
--- constitute a test of all the functionality contained in package
--- Ada.Strings.Bounded. This test uses a variety of the
--- subprograms defined in the bounded string package in ways typical
--- of common usage. Different combinations of available subprograms
--- are used to accomplish similar bounded string processing goals.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 22 Dec 94 SAIC Changed obsolete constant to Ada.Strings.Space.
---
---!
-
-with Ada.Strings;
-with Ada.Strings.Bounded;
-with Ada.Strings.Maps;
-with Report;
-
-procedure CXA4007 is
-
-begin
-
- Report.Test ("CXA4007", "Check that the subprograms defined in package " &
- "Ada.Strings.Bounded are available, and that " &
- "they produce correct results");
-
- Test_Block:
- declare
-
- package BS80 is new Ada.Strings.Bounded.Generic_Bounded_Length(80);
- use type BS80.Bounded_String;
-
- Part1 : constant String := "Rum";
- Part2 : Character := 'p';
- Part3 : BS80.Bounded_String := BS80.To_Bounded_String("el");
- Part4 : Character := 's';
- Part5 : BS80.Bounded_String := BS80.To_Bounded_String("tilt");
- Part6 : String(1..3) := "ski";
-
- Full_Catenate_String,
- Full_Append_String,
- Constructed_String,
- Drop_String,
- Replicated_String,
- Token_String : BS80.Bounded_String;
-
- CharA : Character := 'A';
- CharB : Character := 'B';
- CharC : Character := 'C';
- CharD : Character := 'D';
- CharE : Character := 'E';
- CharF : Character := 'F';
-
- ABStr : String(1..15) := "AAAAABBBBBBBBBB";
- StrB : String(1..2) := "BB";
- StrE : String(1..2) := "EE";
-
-
- begin
-
- -- Evaluation of the overloaded forms of the "&" operator defined
- -- for instantiations of Bounded Strings.
-
- Full_Catenate_String :=
- BS80."&"(Part2, -- Char & Bnd Str
- BS80."&"(Part3, -- Bnd Str & Bnd Str
- BS80."&"(Part4, -- Char & Bnd Str
- BS80."&"(Part5, -- Bnd Str & Bnd Str
- BS80.To_Bounded_String(Part6)))));
-
- Full_Catenate_String :=
- Part1 & Full_Catenate_String; -- Str & Bnd Str
- Full_Catenate_String :=
- Full_Catenate_String & 'n'; -- Bnd Str & Char
-
-
- -- Evaluation of the overloaded forms of function Append.
-
- Full_Append_String :=
- BS80.Append(Part2, -- Char,Bnd
- BS80.Append(Part3, -- Bnd, Bnd
- BS80.Append(Part4, -- Char,Bnd
- BS80.Append(BS80.To_String(Part5), -- Str,Bnd
- BS80.To_Bounded_String(Part6)))));
-
- Full_Append_String :=
- BS80.Append(BS80.To_Bounded_String(Part1), -- Bnd , Str
- BS80.To_String(Full_Append_String));
-
- Full_Append_String :=
- BS80.Append(Left => Full_Append_String,
- Right => 'n'); -- Bnd, Char
-
-
- -- Validate the resulting bounded strings.
-
- if Full_Catenate_String < Full_Append_String or
- Full_Catenate_String > Full_Append_String or
- not (Full_Catenate_String = Full_Append_String and
- Full_Catenate_String <= Full_Append_String and
- Full_Catenate_String >= Full_Append_String)
- then
- Report.Failed("Incorrect results from bounded string catenation" &
- " and comparison");
- end if;
-
-
- -- Evaluate the overloaded forms of the Constructor function "*" and
- -- the Replicate function.
-
- Constructed_String :=
- (2 * CharA) & -- "AA"
- (2 * StrB) & -- "AABBBB"
- (3 * BS80."*"(2, CharC)) & -- "AABBBBCCCCCC"
- BS80.Replicate(3,
- BS80.Replicate(2, CharD)) & -- "AABBBBCCCCCCDDDDDD"
- BS80.Replicate(2, StrE) & -- "AABBBBCCCCCCDDDDDDEEEE"
- BS80.Replicate(2, CharF); -- "AABBBBCCCCCCDDDDDDEEEEFF"
-
-
- -- Use of Function Replicate that involves dropping characters. The
- -- attempt to replicate the 15 character string six times will exceed
- -- the 80 character bound of the string. Therefore, the result should
- -- be the catenation of 5 copies of the 15 character string, followed
- -- by 5 'A' characters (the first five characters of the 6th
- -- replication) with the remaining characters of the 6th replication
- -- dropped.
-
- Drop_String :=
- BS80.Replicate(Count => 6,
- Item => ABStr, -- "AAAAABBBBBBBBBB"
- Drop => Ada.Strings.Right);
-
- if BS80.Element(Drop_String, 1) /= 'A' or
- BS80.Element(Drop_String, 6) /= 'B' or
- BS80.Element(Drop_String, 76) /= 'A' or
- BS80.Element(Drop_String, 80) /= 'A'
- then
- Report.Failed("Incorrect result from Replicate with Drop");
- end if;
-
-
- -- Use function Index_Non_Blank in the evaluation of the
- -- Constructed_String.
-
- if BS80.Index_Non_Blank(Constructed_String, Ada.Strings.Forward) /=
- BS80.To_String(Constructed_String)'First or
- BS80.Index_Non_Blank(Constructed_String, Ada.Strings.Backward) /=
- BS80.Length(Constructed_String)
- then
- Report.Failed("Incorrect results from constructor functions");
- end if;
-
-
-
- declare
-
- -- Define character set objects for use with the Count function.
- -- Constructed_String = "AABBBBCCCCCCDDDDDDEEEEFF" from above.
-
- A_Set : Ada.Strings.Maps.Character_Set :=
- Ada.Strings.Maps.To_Set(BS80.Element(Constructed_String,1));
- B_Set : Ada.Strings.Maps.Character_Set :=
- Ada.Strings.Maps.To_Set(BS80.Element(Constructed_String,3));
- C_Set : Ada.Strings.Maps.Character_Set :=
- Ada.Strings.Maps.To_Set(BS80.Element(Constructed_String,7));
- D_Set : Ada.Strings.Maps.Character_Set :=
- Ada.Strings.Maps.To_Set(BS80.Element(Constructed_String,13));
- E_Set : Ada.Strings.Maps.Character_Set :=
- Ada.Strings.Maps.To_Set(BS80.Element(Constructed_String,19));
- F_Set : Ada.Strings.Maps.Character_Set :=
- Ada.Strings.Maps.To_Set(BS80.Element(Constructed_String,23));
-
-
- Start : Positive;
- Stop : Natural := 0;
-
- begin
-
- -- Evaluate the results from function Count by comparing the number
- -- of A's to the number of F's, B's to E's, and C's to D's in the
- -- Constructed_String.
- -- There should be an equal number of each of the characters that
- -- are being compared (i.e., 2 A's and F's, 4 B's and E's, etc)
-
- if BS80.Count(Constructed_String, A_Set) /=
- BS80.Count(Constructed_String, F_Set) or
- BS80.Count(Constructed_String, B_Set) /=
- BS80.Count(Constructed_String, E_Set) or
- not (BS80.Count(Constructed_String, C_Set) =
- BS80.Count(Constructed_String, D_Set))
- then
- Report.Failed("Incorrect result from function Count");
- end if;
-
-
- -- Evaluate the functions Head, Tail, and Find_Token.
- -- Create the Token_String from the Constructed_String above.
-
- Token_String :=
- BS80.Tail(BS80.Head(Constructed_String, 3), 2) & -- "AB" &
- BS80.Head(BS80.Tail(Constructed_String, 13), 2) & -- "CD" &
- BS80.Head(BS80.Tail(Constructed_String, 3), 2); -- "EF"
-
- if Token_String /= BS80.To_Bounded_String("ABCDEF") then
- Report.Failed("Incorrect result from Catenation of Token_String");
- end if;
-
-
- -- Find the starting/ending position of the first A in the
- -- Token_String (both should be 1, only one A appears in string).
- -- The Function Head uses the default pad character to return a
- -- bounded string longer than its input parameter bounded string.
-
- BS80.Find_Token(BS80.Head(Token_String, 10), -- Default pad.
- A_Set,
- Ada.Strings.Inside,
- Start,
- Stop);
-
- if Start /= 1 and Stop /= 1 then
- Report.Failed("Incorrect result from Find_Token - 1");
- end if;
-
-
- -- Find the starting/ending position of the first non-AB slice in
- -- the "head" five characters of Token_String (slice CDE at
- -- positions 3-5)
-
- BS80.Find_Token(BS80.Head(Token_String, 5), -- "ABCDE"
- Ada.Strings.Maps."OR"(A_Set, B_Set), -- Set (AB)
- Ada.Strings.Outside,
- Start,
- Stop);
-
- if Start /= 3 and Stop /= 5 then
- Report.Failed("Incorrect result from Find_Token - 2");
- end if;
-
-
- -- Find the starting/ending position of the first CD slice in
- -- the "tail" eight characters (including two pad characters)
- -- of Token_String (slice CD at positions 5-6 of the tail
- -- portion specified)
-
- BS80.Find_Token(BS80.Tail(Token_String, 8,
- Ada.Strings.Space), -- " ABCDEF"
- Ada.Strings.Maps."OR"(C_Set, D_Set), -- Set (CD)
- Ada.Strings.Inside,
- Start,
- Stop);
-
- if Start /= 5 and Stop /= 6 then
- Report.Failed("Incorrect result from Find_Token - 3");
- end if;
-
-
- -- Evaluate the Replace_Element procedure.
-
- -- Token_String = "ABCDEF"
-
- BS80.Replace_Element(Token_String, 3, BS80.Element(Token_String,4));
-
- -- Token_String = "ABDDEF"
-
- BS80.Replace_Element(Source => Token_String,
- Index => 2,
- By => BS80.Element(Token_String, 5));
-
- -- Token_String = "AEDDEF"
-
- BS80.Replace_Element(Token_String,
- 1,
- BS80.Element(BS80.Tail(Token_String, 2), 2));
-
- -- Token_String = "FEDDEF"
- -- Evaluate this result.
-
- if BS80.Element(Token_String, BS80.To_String(Token_String)'First) /=
- BS80.Element(Token_String, BS80.To_String(Token_String)'Last) or
- BS80.Count(Token_String, D_Set) /=
- BS80.Count(Token_String, E_Set) or
- BS80.Index_Non_Blank(BS80.Head(Token_String,6)) /=
- BS80.Index_Non_Blank(BS80.Tail(Token_String,6)) or
- BS80.Head(Token_String, 1) /=
- BS80.Tail(Token_String, 1)
- then
- Report.Failed("Incorrect result from operations in combination");
- end if;
-
- end;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4007;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4008.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4008.a
deleted file mode 100644
index 629305f767a..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4008.a
+++ /dev/null
@@ -1,662 +0,0 @@
--- CXA4008.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Bounded are
--- available, and that they produce correct results, especially under
--- conditions where truncation of the result is required. Specifically,
--- check the subprograms Append, Count with non-Identity maps, Index with
--- non-Identity maps, Index with Set parameters, Insert (function and
--- procedure), Replace_Slice (function and procedure), To_Bounded_String,
--- and Translate.
---
--- TEST DESCRIPTION:
--- This test, in conjunction with tests CXA4006, CXA4007, and CXA4009,
--- will provide coverage of the most common usages of the functionality
--- found in the Ada.Strings.Bounded package. It deals in large part
--- with truncation effects and options. This test contains many small,
--- specific test cases, situations that are often difficult to generate
--- in large numbers in an application-based test. These cases represent
--- specific usage paradigms in-the-small.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 10 Apr 95 SAIC Corrected acceptance condition of subtest for
--- Function Append with Truncation = Left.
--- 31 Oct 95 SAIC Update and repair for ACVC 2.0.1.
---
---!
-
-with Report;
-with Ada.Strings.Maps.Constants;
-with Ada.Strings.Bounded;
-with Ada.Strings.Maps;
-
-procedure CXA4008 is
-
-begin
-
- Report.Test("CXA4008", "Check that the subprograms defined in " &
- "package Ada.Strings.Bounded are available, " &
- "and that they produce correct results, " &
- "especially under conditions where " &
- "truncation of the result is required");
-
- Test_Block:
- declare
-
- package AS renames Ada.Strings;
- package ASB renames Ada.Strings.Bounded;
- package ASC renames Ada.Strings.Maps.Constants;
- package Maps renames Ada.Strings.Maps;
-
- package B10 is new ASB.Generic_Bounded_Length(Max => 10);
- use type B10.Bounded_String;
-
- Result_String : B10.Bounded_String;
- Test_String : B10.Bounded_String;
- AtoE_Bnd_Str : B10.Bounded_String := B10.To_Bounded_String("abcde");
- FtoJ_Bnd_Str : B10.Bounded_String := B10.To_Bounded_String("fghij");
- AtoJ_Bnd_Str : B10.Bounded_String :=
- B10.To_Bounded_String("abcdefghij");
-
- Location : Natural := 0;
- Total_Count : Natural := 0;
-
- CD_Set : Maps.Character_Set := Maps.To_Set("cd");
-
- AB_to_YZ_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(From => "ab", To => "yz");
-
- CD_to_XY_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(From => "cd", To => "xy");
-
-
- begin
- -- Function To_Bounded_String with Truncation
- -- Evaluate the function Append with parameters that will
- -- cause the truncation of the result.
-
- -- Drop = Error (default case, Length_Error will be raised)
-
- begin
- Test_String :=
- B10.To_Bounded_String("Much too long for this bounded string");
- Report.Failed("Length Error not raised by To_Bounded_String");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by To_Bounded_String");
- end;
-
- -- Drop = Left
-
- Test_String := B10.To_Bounded_String(Source => "abcdefghijklmn",
- Drop => Ada.Strings.Left);
-
- if Test_String /= B10.To_Bounded_String("efghijklmn") then
- Report.Failed
- ("Incorrect result from To_Bounded_String, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String := B10.To_Bounded_String(Source => "abcdefghijklmn",
- Drop => Ada.Strings.Right);
-
- if not(Test_String = AtoJ_Bnd_Str) then
- Report.Failed
- ("Incorrect result from To_Bounded_String, Drop = Right");
- end if;
-
-
-
-
- -- Function Append with Truncation
- -- Evaluate the function Append with parameters that will
- -- cause the truncation of the result.
-
- -- Drop = Error (default case, Length_Error will be raised)
-
- begin
- -- Append (Bnd Str, Bnd Str);
- Result_String :=
- B10.Append(B10.To_Bounded_String("abcde"),
- B10.To_Bounded_String("fghijk")); -- 11 char
- Report.Failed("Length_Error not raised by Append - 1");
- exception
- when AS.Length_Error => null; -- OK, correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Append - 1");
- end;
-
- begin
- -- Append (Str, Bnd Str);
- Result_String := B10.Append(B10.To_String(AtoE_Bnd_Str),
- B10.To_Bounded_String("fghijk"),
- AS.Error);
- Report.Failed("Length_Error not raised by Append - 2");
- exception
- when AS.Length_Error => null; -- OK, correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Append - 2");
- end;
-
- begin
- -- Append (Bnd Str, Char);
- Result_String :=
- B10.Append(B10.To_Bounded_String("abcdefghij"), 'k');
- Report.Failed("Length_Error not raised by Append - 3");
- exception
- when AS.Length_Error => null; -- OK, correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Append - 3");
- end;
-
- -- Drop = Left
-
- -- Append (Bnd Str, Bnd Str)
- Result_String := B10.Append(B10.To_Bounded_String("abcdefgh"), -- 8 chs
- B10.To_Bounded_String("ijklmn"), -- 6 chs
- Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_String("efghijklmn") then -- 10 chars
- Report.Failed("Incorrect truncation performed by Append - 4");
- end if;
-
- -- Append (Bnd Str, Str)
- Result_String :=
- B10.Append(B10.To_Bounded_String("abcdefghij"),
- "xyz",
- Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_String("defghijxyz") then
- Report.Failed("Incorrect truncation performed by Append - 5");
- end if;
-
- -- Append (Char, Bnd Str)
-
- Result_String := B10.Append('A',
- B10.To_Bounded_String("abcdefghij"),
- Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_String("abcdefghij") then
- Report.Failed("Incorrect truncation performed by Append - 6");
- end if;
-
- -- Drop = Right
-
- -- Append (Bnd Str, Bnd Str)
- Result_String := B10.Append(FtoJ_Bnd_Str,
- AtoJ_Bnd_Str,
- Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_String("fghijabcde") then
- Report.Failed("Incorrect truncation performed by Append - 7");
- end if;
-
- -- Append (Str, Bnd Str)
- Result_String := B10.Append(B10.To_String(AtoE_Bnd_Str),
- AtoJ_Bnd_Str,
- Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_String("abcdeabcde") then
- Report.Failed("Incorrect truncation performed by Append - 8");
- end if;
-
- -- Append (Char, Bnd Str)
- Result_String := B10.Append('A', AtoJ_Bnd_Str, Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_String("Aabcdefghi") then
- Report.Failed("Incorrect truncation performed by Append - 9");
- end if;
-
-
- -- Function Index with non-Identity map.
- -- Evaluate the function Index with a non-identity map
- -- parameter which will cause mapping of the source parameter
- -- prior to the evaluation of the index position search.
-
- Location := B10.Index(Source => AtoJ_Bnd_Str, -- "abcdefghij"
- Pattern => "xy",
- Going => Ada.Strings.Forward,
- Mapping => CD_to_XY_Map); -- change "cd" to "xy"
-
- if Location /= 3 then
- Report.Failed("Incorrect result from Index, non-Identity map - 1");
- end if;
-
- Location := B10.Index(B10.To_Bounded_String("AND IF MAN"),
- "an",
- Ada.Strings.Backward,
- ASC.Lower_Case_Map);
-
- if Location /= 9 then
- Report.Failed("Incorrect result from Index, non-Identity map - 2");
- end if;
-
- Location := B10.Index(Source => B10.To_Bounded_String("The the"),
- Pattern => "the",
- Going => Ada.Strings.Forward,
- Mapping => ASC.Lower_Case_Map);
-
- if Location /= 1 then
- Report.Failed("Incorrect result from Index, non-Identity map - 3");
- end if;
-
-
- if B10.Index(B10.To_Bounded_String("abcd"), -- Pattern = Source
- "abcd") /= 1 or
- B10.Index(B10.To_Bounded_String("abc"), -- Pattern < Source
- "abcd") /= 0 or
- B10.Index(B10.Null_Bounded_String, -- Source = Null
- "abc") /= 0
- then
- Report.Failed("Incorrect result from Index with string patterns");
- end if;
-
-
- -- Function Index (for Sets).
- -- This version of Index uses Sets as the basis of the search.
-
- -- Test = Inside, Going = Forward (Default case).
- Location :=
- B10.Index(Source => B10.To_Bounded_String("abcdeabcde"),
- Set => CD_Set, -- set containing 'c' and 'd'
- Test => Ada.Strings.Inside,
- Going => Ada.Strings.Forward);
-
- if not (Location = 3) then -- position of first 'c' in source.
- Report.Failed("Incorrect result from Index using Sets - 1");
- end if;
-
- -- Test = Inside, Going = Backward.
- Location :=
- B10.Index(Source => B10."&"(AtoE_Bnd_Str, AtoE_Bnd_Str),
- Set => CD_Set, -- set containing 'c' and 'd'
- Test => Ada.Strings.Inside,
- Going => Ada.Strings.Backward);
-
- if not (Location = 9) then -- position of last 'd' in source.
- Report.Failed("Incorrect result from Index using Sets - 2");
- end if;
-
- -- Test = Outside, Going = Forward.
- Location := B10.Index(B10.To_Bounded_String("deddacd"),
- CD_Set,
- Test => Ada.Strings.Outside,
- Going => Ada.Strings.Forward);
-
- if Location /= 2 then -- position of 'e' in source.
- Report.Failed("Incorrect result from Index using Sets - 3");
- end if;
-
- -- Test = Outside, Going = Backward.
- Location := B10.Index(B10.To_Bounded_String("deddacd"),
- CD_Set,
- Ada.Strings.Outside,
- Ada.Strings.Backward);
-
- if Location /= 5 then -- correct position of 'a'.
- Report.Failed("Incorrect result from Index using Sets - 4");
- end if;
-
- if B10.Index(B10.To_Bounded_String("cd"), -- Source = Set
- CD_Set) /= 1 or
- B10.Index(B10.To_Bounded_String("c"), -- Source < Set
- CD_Set) /= 1 or
- B10.Index(B10.Null_Bounded_String, -- Source = Null
- CD_Set) /= 0 or
- B10.Index(AtoE_Bnd_Str, -- "abcde"
- Maps.Null_Set) /= 0 or -- Null set
- B10.Index(AtoE_Bnd_Str,
- Maps.To_Set('x')) /= 0 -- No match.
- then
- Report.Failed("Incorrect result from Index using Sets - 5");
- end if;
-
-
- -- Function Count with non-Identity mapping.
- -- Evaluate the function Count with a non-identity map
- -- parameter which will cause mapping of the source parameter
- -- prior to the evaluation of the number of matching patterns.
-
- Total_Count :=
- B10.Count(Source => B10.To_Bounded_String("abbabaabab"),
- Pattern => "yz",
- Mapping => AB_to_YZ_Map);
-
- if Total_Count /= 4 then
- Report.Failed
- ("Incorrect result from function Count, non-Identity map - 1");
- end if;
-
- -- And a few with identity maps as well.
-
- if B10.Count(B10.To_Bounded_String("ABABABABAB"),
- "ABA",
- Maps.Identity) /= 2 or
- B10.Count(B10.To_Bounded_String("ADCBADABCD"),
- "AB",
- Maps.To_Mapping("CD", "AB")) /= 5 or
- B10.Count(B10.To_Bounded_String("aaaaaaaaaa"),
- "aaa") /= 3 or
- B10.Count(B10.To_Bounded_String("XX"), -- Source < Pattern
- "XXX",
- Maps.Identity) /= 0 or
- B10.Count(AtoE_Bnd_Str, -- Source = Pattern
- "abcde") /= 1 or
- B10.Count(B10.Null_Bounded_String, -- Source = Null
- " ") /= 0
- then
- Report.Failed
- ("Incorrect result from function Count, w,w/o mapping");
- end if;
-
-
- -- Procedure Translate
-
- -- Partial mapping of source.
-
- Test_String := B10.To_Bounded_String("abcdeabcab");
-
- B10.Translate(Source => Test_String, Mapping => AB_to_YZ_Map);
-
- if Test_String /= B10.To_Bounded_String("yzcdeyzcyz") then
- Report.Failed("Incorrect result from procedure Translate - 1");
- end if;
-
- -- Total mapping of source.
-
- Test_String := B10.To_Bounded_String("abbaaababb");
-
- B10.Translate(Source => Test_String, Mapping => ASC.Upper_Case_Map);
-
- if Test_String /= B10.To_Bounded_String("ABBAAABABB") then
- Report.Failed("Incorrect result from procedure Translate - 2");
- end if;
-
- -- No mapping of source.
-
- Test_String := B10.To_Bounded_String("xyzsypcc");
-
- B10.Translate(Source => Test_String, Mapping => AB_to_YZ_Map);
-
- if Test_String /= B10.To_Bounded_String("xyzsypcc") then
- Report.Failed("Incorrect result from procedure Translate - 3");
- end if;
-
- -- Map > 2 characters, partial mapping.
-
- Test_String := B10.To_Bounded_String("have faith");
-
- B10.Translate(Test_String,
- Maps.To_Mapping("aeiou", "AEIOU"));
-
- if Test_String /= B10.To_Bounded_String("hAvE fAIth") then
- Report.Failed("Incorrect result from procedure Translate - 4");
- end if;
-
-
- -- Function Replace_Slice
- -- Evaluate function Replace_Slice with
- -- a variety of Truncation options.
-
- -- Drop = Error (Default)
-
- begin
- Test_String := AtoJ_Bnd_Str;
- Result_String :=
- B10.Replace_Slice(Source => Test_String, -- "abcdefghij"
- Low => 3,
- High => 5, -- 3-5, 3 chars.
- By => "xxxxxx"); -- more than 3.
- Report.Failed("Length_Error not raised by Function Replace_Slice");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Function Replace_Slice");
- end;
-
- -- Drop = Left
-
- Result_String :=
- B10.Replace_Slice(Source => Test_String, -- "abcdefghij"
- Low => 7,
- High => 10, -- 7-10, 4 chars.
- By => "xxxxxx", -- 6 chars.
- Drop => Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_String("cdefxxxxxx") then -- drop a,b
- Report.Failed
- ("Incorrect result from Function Replace Slice, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String :=
- B10.Replace_Slice(Source => Test_String, -- "abcdefghij"
- Low => 2,
- High => 5, -- 2-5, 4 chars.
- By => "xxxxxx", -- 6 chars.
- Drop => Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_String("axxxxxxfgh") then -- drop i,j
- Report.Failed
- ("Incorrect result from Function Replace Slice, Drop = Right");
- end if;
-
- -- Low = High = Source'Last, "By" length = 1.
-
- if B10.Replace_Slice(AtoE_Bnd_Str,
- B10.To_String(AtoE_Bnd_Str)'Last,
- B10.To_String(AtoE_Bnd_Str)'Last,
- "X",
- Ada.Strings.Error) /=
- B10.To_Bounded_String("abcdX")
- then
- Report.Failed("Incorrect result from Function Replace_Slice");
- end if;
-
-
-
- -- Procedure Replace_Slice
- -- Evaluate procedure Replace_Slice with
- -- a variety of Truncation options.
-
- -- Drop = Error (Default)
-
- begin
- Test_String := AtoJ_Bnd_Str;
- B10.Replace_Slice(Source => Test_String, -- "abcdefghij"
- Low => 3,
- High => 5, -- 3-5, 3 chars.
- By => "xxxxxx"); -- more than 3.
- Report.Failed("Length_Error not raised by Procedure Replace_Slice");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Procedure Replace_Slice");
- end;
-
- -- Drop = Left
-
- Test_String := AtoJ_Bnd_Str;
- B10.Replace_Slice(Source => Test_String, -- "abcdefghij"
- Low => 7,
- High => 9, -- 7-9, 3 chars.
- By => "xxxxx", -- 5 chars.
- Drop => Ada.Strings.Left);
-
- if Test_String /= B10.To_Bounded_String("cdefxxxxxj") then -- drop a,b
- Report.Failed
- ("Incorrect result from Procedure Replace Slice, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String := AtoJ_Bnd_Str;
- B10.Replace_Slice(Source => Test_String, -- "abcdefghij"
- Low => 1,
- High => 3, -- 1-3, 3chars.
- By => "xxxx", -- 4 chars.
- Drop => Ada.Strings.Right);
-
- if Test_String /= B10.To_Bounded_String("xxxxdefghi") then -- drop j
- Report.Failed
- ("Incorrect result from Procedure Replace Slice, Drop = Right");
- end if;
-
- -- High = Source'First, Low > High (Insert before Low).
-
- Test_String := AtoE_Bnd_Str;
- B10.Replace_Slice(Source => Test_String, -- "abcde"
- Low => B10.To_String(Test_String)'Last,
- High => B10.To_String(Test_String)'First,
- By => "XXXX", -- 4 chars.
- Drop => Ada.Strings.Right);
-
- if Test_String /= B10.To_Bounded_String("abcdXXXXe") then
- Report.Failed
- ("Incorrect result from Procedure Replace Slice");
- end if;
-
-
-
- -- Function Insert with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String :=
- B10.Insert(Source => AtoJ_Bnd_Str, -- "abcdefghij"
- Before => 2,
- New_Item => "xyz");
- Report.Failed("Length_Error not raised by Function Insert");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Insert");
- end;
-
- -- Drop = Left
-
- Result_String :=
- B10.Insert(Source => AtoJ_Bnd_Str, -- "abcdefghij"
- Before => 5,
- New_Item => "xyz", -- 3 additional chars.
- Drop => Ada.Strings.Left);
-
- if B10.To_String(Result_String) /= "dxyzefghij" then -- drop a, b, c
- Report.Failed("Incorrect result from Function Insert, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String :=
- B10.Insert(Source => B10.To_Bounded_String("abcdef"),
- Before => 2,
- New_Item => "vwxyz", -- 5 additional chars.
- Drop => Ada.Strings.Right);
-
- if B10.To_String(Result_String) /= "avwxyzbcde" then -- drop f.
- Report.Failed("Incorrect result from Function Insert, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Insert(B10.To_Bounded_String("a"), 1, " B") /=
- B10.To_Bounded_String(" Ba") or
- B10.Insert(B10.Null_Bounded_String, 1, "abcde") /=
- AtoE_Bnd_Str or
- B10.Insert(B10.To_Bounded_String("ab"), 2, "") /=
- B10.To_Bounded_String("ab")
- then
- Report.Failed("Incorrect result from Function Insert");
- end if;
-
-
- -- Procedure Insert
-
- -- Drop = Error (Default).
- begin
- Test_String := AtoJ_Bnd_Str;
- B10.Insert(Source => Test_String, -- "abcdefghij"
- Before => 9,
- New_Item => "wxyz",
- Drop => Ada.Strings.Error);
- Report.Failed("Length_Error not raised by Procedure Insert");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Procedure Insert");
- end;
-
- -- Drop = Left
-
- Test_String := AtoJ_Bnd_Str;
- B10.Insert(Source => Test_String, -- "abcdefghij"
- Before => B10.Length(Test_String), -- before last char
- New_Item => "xyz", -- 3 additional chars.
- Drop => Ada.Strings.Left);
-
- if B10.To_String(Test_String) /= "defghixyzj" then -- drop a, b, c
- Report.Failed("Incorrect result from Procedure Insert, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String := AtoJ_Bnd_Str;
- B10.Insert(Source => Test_String,
- Before => 4,
- New_Item => "yz", -- 2 additional chars.
- Drop => Ada.Strings.Right);
-
- if B10.To_String(Test_String) /= "abcyzdefgh" then -- drop i,j
- Report.Failed
- ("Incorrect result from Procedure Insert, Drop = Right");
- end if;
-
- -- Before = Source'First, New_Item length = 1.
-
- Test_String := B10.To_Bounded_String(" abc ");
- B10.Insert(Test_String,
- B10.To_String(Test_String)'First,
- "Z");
-
- if Test_String /= B10.To_Bounded_String("Z abc ") then
- Report.Failed("Incorrect result from Procedure Insert");
- end if;
-
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4008;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4009.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4009.a
deleted file mode 100644
index f02ef036507..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4009.a
+++ /dev/null
@@ -1,619 +0,0 @@
--- CXA4009.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Bounded are
--- available, and that they produce correct results, especially under
--- conditions where truncation of the result is required. Specifically,
--- check the subprograms Overwrite (function and procedure), Delete,
--- Function Trim (blanks), Trim (Set characters, function and procedure),
--- Head, Tail, and Replicate (characters and strings).
---
--- TEST DESCRIPTION:
--- This test, in conjunction with tests CXA4006, CXA4007, and CXA4008,
--- will provide coverage of the most common usages of the functionality
--- found in the Ada.Strings.Bounded package. It deals in large part
--- with truncation effects and options. This test contains many small,
--- specific test cases, situations that are often difficult to generate
--- in large numbers in an application-based test. These cases represent
--- specific usage paradigms in-the-small.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 10 Apr 95 SAIC Corrected errors in Procedure Overwrite subtests.
--- 01 Nov 95 SAIC Fixed bugs for ACVC 2.0.1.
---
---!
-
-with Report;
-with Ada.Strings.Bounded;
-with Ada.Strings.Maps;
-
-procedure CXA4009 is
-
-begin
-
- Report.Test("CXA4009", "Check that the subprograms defined in " &
- "package Ada.Strings.Bounded are available, " &
- "and that they produce correct results, " &
- "especially under conditions where " &
- "truncation of the result is required");
-
- Test_Block:
- declare
-
- package AS renames Ada.Strings;
- package ASB renames Ada.Strings.Bounded;
- package Maps renames Ada.Strings.Maps;
-
- package B10 is new ASB.Generic_Bounded_Length(Max => 10);
- use type B10.Bounded_String;
-
- Result_String : B10.Bounded_String;
- Test_String : B10.Bounded_String;
- AtoE_Bnd_Str : B10.Bounded_String := B10.To_Bounded_String("abcde");
- FtoJ_Bnd_Str : B10.Bounded_String := B10.To_Bounded_String("fghij");
- AtoJ_Bnd_Str : B10.Bounded_String :=
- B10.To_Bounded_String("abcdefghij");
-
- Location : Natural := 0;
- Total_Count : Natural := 0;
-
- CD_Set : Maps.Character_Set := Maps.To_Set("cd");
- XY_Set : Maps.Character_Set := Maps.To_Set("xy");
-
-
- begin
-
- -- Function Overwrite with Truncation
- -- Drop = Error (Default).
-
- begin
- Test_String := AtoJ_Bnd_Str;
- Result_String :=
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => 9,
- New_Item => "xyz",
- Drop => AS.Error);
- Report.Failed("Exception not raised by Function Overwrite");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Overwrite");
- end;
-
- -- Drop = Left
-
- Result_String :=
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => B10.Length(Test_String), -- 10
- New_Item => "xyz",
- Drop => Ada.Strings.Left);
-
- if B10.To_String(Result_String) /= "cdefghixyz" then -- drop a,b
- Report.Failed
- ("Incorrect result from Function Overwrite, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String := B10.Overwrite(Test_String, -- "abcdefghij"
- 3,
- "xxxyyyzzz",
- Ada.Strings.Right);
-
- if B10.To_String(Result_String) /= "abxxxyyyzz" then -- one 'z' dropped
- Report.Failed
- ("Incorrect result from Function Overwrite, Drop = Right");
- end if;
-
- -- Additional cases of function Overwrite.
-
- if B10.Overwrite(B10.To_Bounded_String("a"), -- Source length = 1
- 1,
- " abc ") /=
- B10.To_Bounded_String(" abc ") or
- B10.Overwrite(B10.Null_Bounded_String, -- Null source
- 1,
- "abcdefghij") /=
- AtoJ_Bnd_Str or
- B10.Overwrite(AtoE_Bnd_Str,
- B10.To_String(AtoE_Bnd_Str)'First,
- " ") /= -- New_Item = 1
- B10.To_Bounded_String(" bcde")
- then
- Report.Failed("Incorrect result from Function Overwrite");
- end if;
-
-
-
- -- Procedure Overwrite
- -- Correct usage, no truncation.
-
- Test_String := AtoE_Bnd_Str; -- "abcde"
- B10.Overwrite(Test_String, 2, "xyz");
-
- if Test_String /= B10.To_Bounded_String("axyze") then
- Report.Failed("Incorrect result from Procedure Overwrite - 1");
- end if;
-
- Test_String := B10.To_Bounded_String("abc");
- B10.Overwrite(Test_String, 2, ""); -- New_Item is null string.
-
- if Test_String /= B10.To_Bounded_String("abc") then
- Report.Failed("Incorrect result from Procedure Overwrite - 2");
- end if;
-
- -- Drop = Error (Default).
-
- begin
- Test_String := AtoJ_Bnd_Str;
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => 8,
- New_Item => "uvwxyz");
- Report.Failed("Exception not raised by Procedure Overwrite");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Procedure Overwrite");
- end;
-
- -- Drop = Left
-
- Test_String := AtoJ_Bnd_Str;
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => B10.Length(Test_String) - 2, -- 8
- New_Item => "uvwxyz",
- Drop => Ada.Strings.Left);
-
- if B10.To_String(Test_String) /= "defguvwxyz" then -- drop a-c
- Report.Failed
- ("Incorrect result from Procedure Overwrite, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String := AtoJ_Bnd_Str;
- B10.Overwrite(Test_String, -- "abcdefghij"
- 3,
- "xxxyyyzzz",
- Ada.Strings.Right);
-
- if B10.To_String(Test_String) /= "abxxxyyyzz" then -- one 'z' dropped
- Report.Failed
- ("Incorrect result from Procedure Overwrite, Drop = Right");
- end if;
-
-
-
- -- Function Delete
-
- if B10.Delete(Source => AtoJ_Bnd_Str, -- "abcdefghij"
- From => 3,
- Through => 8) /=
- B10."&"(B10.Head(AtoJ_Bnd_Str, 2),
- B10.Tail(AtoJ_Bnd_Str, 2)) or
- B10.Delete(AtoJ_Bnd_Str, 6, B10.Length(AtoJ_Bnd_Str)) /=
- AtoE_Bnd_Str or
- B10.Delete(AtoJ_Bnd_Str, 1, 5) /=
- FtoJ_Bnd_Str or
- B10.Delete(AtoE_Bnd_Str, 4, 5) /=
- B10.Delete(AtoJ_Bnd_Str, 4, B10.Length(AtoJ_Bnd_Str))
- then
- Report.Failed("Incorrect result from Function Delete - 1");
- end if;
-
- if B10.Delete(B10.To_Bounded_String("a"), 1, 1) /=
- B10.Null_Bounded_String or
- B10.Delete(AtoE_Bnd_Str,
- 5,
- B10.To_String(AtoE_Bnd_Str)'First) /=
- AtoE_Bnd_Str or
- B10.Delete(AtoE_Bnd_Str,
- B10.To_String(AtoE_Bnd_Str)'Last,
- B10.To_String(AtoE_Bnd_Str)'Last) /=
- B10.To_Bounded_String("abcd")
- then
- Report.Failed("Incorrect result from Function Delete - 2");
- end if;
-
-
-
- -- Function Trim
-
- declare
-
- Text : B10.Bounded_String := B10.To_Bounded_String("Text");
- type Bnd_Array_Type is array (1..5) of B10.Bounded_String;
- Bnd_Array : Bnd_Array_Type :=
- (B10.To_Bounded_String(" Text"),
- B10.To_Bounded_String("Text "),
- B10.To_Bounded_String(" Text "),
- B10.To_Bounded_String("Text Text"), -- Ensure no inter-string
- B10.To_Bounded_String(" Text Text")); -- trimming of blanks.
-
- begin
-
- for i in Bnd_Array_Type'Range loop
- case i is
- when 4 =>
- if B10.Trim(Bnd_Array(i), AS.Both) /=
- Bnd_Array(i) then -- no change
- Report.Failed("Incorrect result from Function Trim - 4");
- end if;
- when 5 =>
- if B10.Trim(Bnd_Array(i), AS.Both) /=
- B10."&"(Text, B10."&"(' ', Text)) then
- Report.Failed("Incorrect result from Function Trim - 5");
- end if;
- when others =>
- if B10.Trim(Bnd_Array(i), AS.Both) /= Text then
- Report.Failed("Incorrect result from Function Trim - " &
- Integer'Image(i));
- end if;
- end case;
- end loop;
-
- end;
-
-
-
- -- Function Trim using Sets
-
- -- Trim characters in sets from both sides of the bounded string.
- if B10.Trim(Source => B10.To_Bounded_String("ddabbaxx"),
- Left => CD_Set,
- Right => XY_Set) /=
- B10.To_Bounded_String("abba")
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Left & Right side - 1");
- end if;
-
- -- Ensure that the characters in the set provided as the actual to
- -- parameter Right are not trimmed from the left side of the bounded
- -- string; likewise for the opposite side. Only "cd" trimmed from left
- -- side, and only "xy" trimmed from right side.
-
- if B10.Trim(B10.To_Bounded_String("cdxyabcdxy"), CD_Set, XY_Set) /=
- B10.To_Bounded_String("xyabcd")
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Left & Right side - 2");
- end if;
-
- -- Ensure that characters contained in the sets are not trimmed from
- -- the "interior" of the bounded string, just the appropriate ends.
-
- if B10.Trim(B10.To_Bounded_String("cdabdxabxy"), CD_Set, XY_Set) /=
- B10.To_Bounded_String("abdxab")
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Left & Right side - 3");
- end if;
-
- -- Trim characters in set from right side only. No change to Left side.
-
- if B10.Trim(B10.To_Bounded_String("abxyzddcd"), XY_Set, CD_Set) /=
- B10.To_Bounded_String("abxyz")
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Right side");
- end if;
-
- -- Trim no characters on either side of the bounded string.
-
- Result_String := B10.Trim(AtoJ_Bnd_Str, CD_Set, XY_Set);
- if Result_String /= AtoJ_Bnd_Str then
- Report.Failed("Incorrect result from Fn Trim - Sets, Neither side");
- end if;
-
- if B10.Trim(AtoE_Bnd_Str, Maps.Null_Set, Maps.Null_Set) /=
- AtoE_Bnd_Str or
- B10.Trim(B10.To_Bounded_String("dcddcxyyxx"),
- CD_Set,
- XY_Set) /=
- B10.Null_Bounded_String
- then
- Report.Failed("Incorrect result from Function Trim");
- end if;
-
-
-
- -- Procedure Trim using Sets
-
- -- Trim characters in sets from both sides of the bounded string.
-
- Test_String := B10.To_Bounded_String("dcabbayx");
- B10.Trim(Source => Test_String,
- Left => CD_Set,
- Right => XY_Set);
-
- if Test_String /= B10.To_Bounded_String("abba") then
- Report.Failed
- ("Incorrect result from Proc Trim - Sets, Left & Right side - 1");
- end if;
-
- -- Ensure that the characters in the set provided as the actual to
- -- parameter Right are not trimmed from the left side of the bounded
- -- string; likewise for the opposite side. Only "cd" trimmed from left
- -- side, and only "xy" trimmed from right side.
-
- Test_String := B10.To_Bounded_String("cdxyabcdxy");
- B10.Trim(Test_String, CD_Set, XY_Set);
-
- if Test_String /= B10.To_Bounded_String("xyabcd") then
- Report.Failed
- ("Incorrect result from Proc Trim - Sets, Left & Right side - 2");
- end if;
-
- -- Ensure that characters contained in the sets are not trimmed from
- -- the "interior" of the bounded string, just the appropriate ends.
-
- Test_String := B10.To_Bounded_String("cdabdxabxy");
- B10.Trim(Test_String, CD_Set, XY_Set);
-
- if not (Test_String = B10.To_Bounded_String("abdxab")) then
- Report.Failed
- ("Incorrect result from Proc Trim - Sets, Left & Right side - 3");
- end if;
-
- -- Trim characters in set from Left side only. No change to Right side.
-
- Test_String := B10.To_Bounded_String("cccdabxyz");
- B10.Trim(Test_String, CD_Set, XY_Set);
-
- if Test_String /= B10.To_Bounded_String("abxyz") then
- Report.Failed
- ("Incorrect result from Proc Trim for Sets, Left side only");
- end if;
-
- -- Trim no characters on either side of the bounded string.
-
- Test_String := AtoJ_Bnd_Str;
- B10.Trim(Test_String, CD_Set, CD_Set);
-
- if Test_String /= AtoJ_Bnd_Str then
- Report.Failed("Incorrect result from Proc Trim-Sets, Neither side");
- end if;
-
-
-
- -- Function Head with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String := B10.Head(Source => AtoJ_Bnd_Str, -- max length
- Count => B10.Length(AtoJ_Bnd_Str) + 1,
- Pad => 'X');
- Report.Failed("Length_Error not raised by Function Head");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Head");
- end;
-
- -- Drop = Left
-
- -- Pad characters (5) are appended to the right end of the string
- -- (which is initially at its maximum length), then the first five
- -- characters of the intermediate result are dropped to conform to
- -- the maximum size limit of the bounded string (10).
-
- Result_String := B10.Head(B10.To_Bounded_String("ABCDEFGHIJ"),
- 15,
- 'x',
- Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_String("FGHIJxxxxx") then
- Report.Failed("Incorrect result from Function Head, Drop = Left");
- end if;
-
- -- Drop = Right
-
- -- Pad characters (6) are appended to the left end of the string
- -- (which is initially at one less than its maximum length), then the
- -- last five characters of the intermediate result are dropped
- -- (which in this case are the pad characters) to conform to the
- -- maximum size limit of the bounded string (10).
-
- Result_String := B10.Head(B10.To_Bounded_String("ABCDEFGHI"),
- 15,
- 'x',
- Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_String("ABCDEFGHIx") then
- Report.Failed("Incorrect result from Function Head, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Head(B10.Null_Bounded_String, 5) /=
- B10.To_Bounded_String(" ") or
- B10.Head(AtoE_Bnd_Str,
- B10.Length(AtoE_Bnd_Str)) /=
- AtoE_Bnd_Str
- then
- Report.Failed("Incorrect result from Function Head");
- end if;
-
-
-
- -- Function Tail with Truncation
- -- Drop = Error (Default Case)
-
- begin
- Result_String := B10.Tail(Source => AtoJ_Bnd_Str, -- max length
- Count => B10.Length(AtoJ_Bnd_Str) + 1,
- Pad => Ada.Strings.Space,
- Drop => Ada.Strings.Error);
- Report.Failed("Length_Error not raised by Function Tail");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Tail");
- end;
-
- -- Drop = Left
-
- -- Pad characters (5) are appended to the left end of the string
- -- (which is initially at two less than its maximum length), then
- -- the first three characters of the intermediate result (in this
- -- case, 3 pad characters) are dropped.
-
- Result_String := B10.Tail(B10.To_Bounded_String("ABCDEFGH"), -- 8 ch
- 13,
- 'x',
- Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_String("xxABCDEFGH") then
- Report.Failed("Incorrect result from Function Tail, Drop = Left");
- end if;
-
- -- Drop = Right
-
- -- Pad characters (3) are appended to the left end of the string
- -- (which is initially at its maximum length), then the last three
- -- characters of the intermediate result are dropped.
-
- Result_String := B10.Tail(B10.To_Bounded_String("ABCDEFGHIJ"),
- 13,
- 'x',
- Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_String("xxxABCDEFG") then
- Report.Failed("Incorrect result from Function Tail, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Tail(B10.Null_Bounded_String, 3, ' ') /=
- B10.To_Bounded_String(" ") or
- B10.Tail(AtoE_Bnd_Str,
- B10.To_String(AtoE_Bnd_Str)'First) /=
- B10.To_Bounded_String("e")
- then
- Report.Failed("Incorrect result from Function Tail");
- end if;
-
-
-
- -- Function Replicate (#, Char) with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String := B10.Replicate(Count => B10.Max_Length + 5,
- Item => 'A',
- Drop => AS.Error);
- Report.Failed
- ("Length_Error not raised by Replicate for characters");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Replicate for characters");
- end;
-
- -- Drop = Left, Right
- -- Since this version of Replicate uses character parameters, the
- -- result after truncation from left or right will appear the same.
- -- The result will be a 10 character bounded string, composed of 10
- -- "Item" characters.
-
- if B10.Replicate(Count => 20, Item => 'A', Drop => Ada.Strings.Left) /=
- B10.Replicate(15, 'A', Ada.Strings.Right)
- then
- Report.Failed("Incorrect result from Replicate for characters - 1");
- end if;
-
- -- Blank-filled 10 character bounded strings.
-
- if B10.Replicate(B10.Max_Length + 1, ' ', Drop => Ada.Strings.Left) /=
- B10.Replicate(B10.Max_Length, Ada.Strings.Space)
- then
- Report.Failed("Incorrect result from Replicate for characters - 2");
- end if;
-
- -- Additional cases.
-
- if B10.Replicate(0, 'a') /= B10.Null_Bounded_String or
- B10.Replicate(1, 'a') /= B10.To_Bounded_String("a")
- then
- Report.Failed("Incorrect result from Replicate for characters - 3");
- end if;
-
-
-
- -- Function Replicate (#, String) with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String := B10.Replicate(Count => 5, -- result would be 15.
- Item => "abc");
- Report.Failed
- ("Length_Error not raised by Replicate for strings");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Replicate for strings");
- end;
-
- -- Drop = Left
-
- Result_String := B10.Replicate(3, "abcd", Drop => Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_String("cdabcdabcd") then
- Report.Failed
- ("Incorrect result from Replicate for strings, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String := B10.Replicate(3, "abcd", Drop => Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_String("abcdabcdab") then
- Report.Failed
- ("Incorrect result from Replicate for strings, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Replicate(10, "X") /= B10.To_Bounded_String("XXXXXXXXXX") or
- B10.Replicate(10, "") /= B10.Null_Bounded_String or
- B10.Replicate( 0, "ab") /= B10.Null_Bounded_String
- then
- Report.Failed("Incorrect result from Replicate for strings");
- end if;
-
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4009;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4010.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4010.a
deleted file mode 100644
index 8646b12b5e4..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4010.a
+++ /dev/null
@@ -1,275 +0,0 @@
--- CXA4010.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Unbounded
--- are available, and that they produce correct results. Specifically,
--- check the subprograms To_String, To_Unbounded_String, Insert, "&",
--- "*", Length, Slice, Replace_Slice, Overwrite, Index, Index_Non_Blank,
--- Head, Tail, and "=", "<=", ">=".
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of many of the subprograms defined
--- in package Ada.Strings.Unbounded for use with unbounded strings.
--- The test simulates how unbounded strings could be used
--- to simulate paragraphs of text. Modifications could be easily be
--- performed using the provided subprograms (although in this test, the
--- main modification performed was the addition of more text to the
--- string). One would not have to worry about the formatting of the
--- paragraph until it was finished and correct in content. Then, once
--- all required editing is complete, the unbounded strings can be divided
--- up into the appropriate lengths based on particular formatting
--- requirements. The test then compares the formatted text product
--- with a predefined "finished product".
---
--- This test uses a large number of the subprograms provided
--- by package Ada.Strings.Unbounded. Often, the processing involved
--- could have been performed more efficiently using a minimum number
--- of the subprograms, in conjunction with loops, etc. However, for
--- testing purposes, and in the interest of minimizing the number of
--- tests developed, subprogram variety and feature mixing was stressed.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Report;
-with Ada.Strings.Maps;
-with Ada.Strings.Unbounded;
-
-procedure CXA4010 is
-begin
-
- Report.Test ("CXA4010", "Check that the subprograms defined in " &
- "package Ada.Strings.Unbounded are available, " &
- "and that they produce correct results");
-
- Test_Block:
- declare
-
- package ASUnb renames Ada.Strings.Unbounded;
- use type ASUnb.Unbounded_String;
- use Ada.Strings;
-
- Pamphlet_Paragraph_Count : constant := 2;
- Lines : constant := 4;
- Line_Length : constant := 40;
-
- type Document_Type is array (Positive range <>)
- of ASUnb.Unbounded_String;
-
- type Camera_Ready_Copy_Type is array (1..Lines)
- of String (1..Line_Length);
-
- Pamphlet : Document_Type (1..Pamphlet_Paragraph_Count);
-
- Camera_Ready_Copy : Camera_Ready_Copy_Type :=
- (others => (others => Ada.Strings.Space));
-
- TC_Finished_Product : Camera_Ready_Copy_Type :=
- ( 1 => "Ada is a programming language designed ",
- 2 => "to support long-lived, reliable software",
- 3 => " systems. ",
- 4 => "Go with Ada! ");
-
- -----
-
-
- procedure Enter_Text_Into_Document (Document : in out Document_Type) is
- begin
-
- -- Fill in both "paragraphs" of the document. Each unbounded string
- -- functions as an individual paragraph, containing an unspecified
- -- number of characters.
- -- Use a variety of different unbounded string subprograms to load
- -- the data.
-
- Document(1) := ASUnb.To_Unbounded_String("Ada is a language");
-
- -- Insert the word "programming" prior to "language".
- Document(1) :=
- ASUnb.Insert(Document(1),
- ASUnb.Index(Document(1),
- "language"),
- ASUnb.To_String("progra" & -- Str &
- ASUnb."*"(2,'m') & -- Unbd &
- "ing ")); -- Str
-
-
- -- Overwrite the word "language" with "language" + additional text.
- Document(1) :=
- ASUnb.Overwrite(Document(1),
- ASUnb.Index(Document(1),
- ASUnb.To_String(
- ASUnb.Tail(Document(1), 8, ' ')),
- Ada.Strings.Backward),
- "language designed to support long-lifed");
-
-
- -- Replace the word "lifed" with "lived".
- Document(1) :=
- ASUnb.Replace_Slice(Document(1),
- ASUnb.Index(Document(1), "lifed"),
- ASUnb.Length(Document(1)),
- "lived");
-
-
- -- Overwrite the word "lived" with "lived" + additional text.
- Document(1) :=
- ASUnb.Overwrite(Document(1),
- ASUnb.Index(Document(1),
- ASUnb.To_String(
- ASUnb.Tail(Document(1), 5, ' ')),
- Ada.Strings.Backward),
- "lived, reliable software systems.");
-
-
- -- Use several of the overloaded versions of "&" to form this
- -- unbounded string.
-
- Document(2) := 'G' &
- ASUnb.To_Unbounded_String("o ") &
- ASUnb.To_Unbounded_String("with") &
- ' ' &
- "Ada!";
-
- end Enter_Text_Into_Document;
-
-
- -----
-
-
- procedure Create_Camera_Ready_Copy
- (Document : in Document_Type;
- Camera_Copy : out Camera_Ready_Copy_Type) is
- begin
- -- Break the unbounded strings into fixed lengths.
-
- -- Search the first unbounded string for portions of text that
- -- are less than or equal to the length of a string in the
- -- Camera_Ready_Copy_Type object.
-
- Camera_Copy(1) := -- Take characters 1-39,
- ASUnb.Slice(Document(1), -- and append a blank space.
- 1,
- ASUnb.Index(ASUnb.To_Unbounded_String(
- ASUnb.Slice(Document(1),
- 1,
- Line_Length)),
- Ada.Strings.Maps.To_Set(' '),
- Ada.Strings.Inside,
- Ada.Strings.Backward)) & ' ';
-
- Camera_Copy(2) := -- Take characters 40-79.
- ASUnb.Slice(Document(1),
- 40,
- (ASUnb.Index_Non_Blank -- Should return 79
- (ASUnb.To_Unbounded_String
- (ASUnb.Slice(Document(1), -- Slice (40..79)
- 40,
- 79)),
- Ada.Strings.Backward) + 39)); -- Increment since
- -- this slice starts
- -- at 40.
-
- Camera_Copy(3)(1..9) := ASUnb.Slice(Document(1), -- Characters 80-88
- 80,
- ASUnb.Length(Document(1)));
-
-
- -- Break the second unbounded string into the appropriate length.
- -- It is only twelve characters in length, so the entire unbounded
- -- string will be placed on one string of the output object.
-
- Camera_Copy(4)(1..ASUnb.Length(Document(2))) :=
- ASUnb.To_String(ASUnb.Head(Document(2),
- ASUnb.Length(Document(2))));
-
- end Create_Camera_Ready_Copy;
-
-
- -----
-
-
- function Valid_Proofread (Draft, Master : Camera_Ready_Copy_Type)
- return Boolean is
- begin
-
- -- Evaluate strings for equality, using the operators defined in
- -- package Ada.Strings.Unbounded. The less than/greater than or
- -- equal comparisons should evaluate to "equals => True".
-
- if ASUnb.To_Unbounded_String(Draft(1)) = -- "="(Unb,Unb)
- ASUnb.To_Unbounded_String(Master(1)) and
- ASUnb.To_Unbounded_String(Draft(2)) <= -- "<="(Unb,Unb)
- ASUnb.To_Unbounded_String(Master(2)) and
- ASUnb.To_Unbounded_String(Draft(3)) >= -- ">="(Unb,Unb)
- ASUnb.To_Unbounded_String(Master(3)) and
- ASUnb.To_Unbounded_String(Draft(4)) = -- "="(Unb,Unb)
- ASUnb.To_Unbounded_String(Master(4))
- then
- return True;
- else
- return False;
- end if;
-
- end Valid_Proofread;
-
-
- -----
-
-
- begin
-
- -- Enter text into the unbounded string paragraphs of the document.
-
- Enter_Text_Into_Document (Pamphlet);
-
-
- -- Reformat the unbounded strings into fixed string format.
-
- Create_Camera_Ready_Copy (Document => Pamphlet,
- Camera_Copy => Camera_Ready_Copy);
-
-
- -- Verify the conversion process.
-
- if not Valid_Proofread (Draft => Camera_Ready_Copy,
- Master => TC_Finished_Product)
- then
- Report.Failed ("Incorrect string processing result");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4010;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4011.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4011.a
deleted file mode 100644
index 05388a04ba7..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4011.a
+++ /dev/null
@@ -1,376 +0,0 @@
--- CXA4011.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Unbounded
--- are available, and that they produce correct results. Specifically,
--- check the subprograms To_Unbounded_String, "&", ">", "<", Element,
--- Replace_Element, Count, Find_Token, Translate, Trim, Delete, and
--- "*".
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of many of the subprograms defined
--- in package Ada.Strings.Unbounded for use with unbounded strings.
--- The test simulates how unbounded strings could be processed in a
--- user environment, using the subprograms provided in this package.
---
--- This test uses a variety of the subprograms defined in the unbounded
--- string package in ways typical of common usage, with different
--- combinations of available subprograms being used to accomplish
--- similar unbounded string processing goals.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 27 Feb 95 SAIC Test description modification.
--- 01 Nov 95 SAIC Update and repair for ACVC 2.0.1.
---
---!
-
-with Report;
-with Ada.Strings.Maps;
-with Ada.Strings.Unbounded;
-
-procedure CXA4011 is
-begin
-
- Report.Test ("CXA4011", "Check that the subprograms defined in " &
- "package Ada.Strings.Unbounded are available, " &
- "and that they produce correct results");
-
- Test_Block:
- declare
-
- package ASUnb renames Ada.Strings.Unbounded;
- use Ada.Strings;
- use type Maps.Character_Set;
- use type ASUnb.Unbounded_String;
-
- Cad_String : ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("cad");
-
- Complete_String : ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("Incomplete") &
- Ada.Strings.Space &
- ASUnb.To_Unbounded_String("String");
-
- Incomplete_String : ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("ncomplete Strin");
-
- Incorrect_Spelling : ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("Guob Dai");
-
- Magic_String : ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("abracadabra");
-
- Incantation : ASUnb.Unbounded_String := Magic_String;
-
-
- A_Small_G : Character := 'g';
- A_Small_D : Character := 'd';
-
- ABCD_Set : Maps.Character_Set := Maps.To_Set("abcd");
- B_Set : Maps.Character_Set := Maps.To_Set('b');
- AB_Set : Maps.Character_Set := Maps."OR"(Maps.To_Set('a'), B_Set);
-
- Code_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(From => "abcd", To => "wxyz");
- Reverse_Code_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(From => "wxyz", To => "abcd");
- Non_Existent_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(From => "jkl", To => "mno");
-
-
- Token_Start : Positive;
- Token_End : Natural := 0;
- Matching_Letters : Natural := 0;
-
-
- begin
-
- -- "&"
-
- -- Prepend an 'I' and append a 'g' to the string.
- Incomplete_String := ASUnb."&"('I', Incomplete_String); -- Char & Unb
- Incomplete_String := ASUnb."&"(Incomplete_String,
- A_Small_G); -- Unb & Char
-
- if Incomplete_String < Complete_String or
- Incomplete_String > Complete_String or
- Incomplete_String /= Complete_String
- then
- Report.Failed("Incorrect result from use of ""&"" operator");
- end if;
-
-
- -- Element
-
- -- Last element of the unbounded string should be a 'g'.
- if ASUnb.Element(Incomplete_String, ASUnb.Length(Incomplete_String)) /=
- A_Small_G
- then
- Report.Failed("Incorrect result from use of Function Element - 1");
- end if;
-
- if ASUnb.Element(Incomplete_String, 2) /=
- ASUnb.Element(ASUnb.Tail(Incomplete_String, 2), 1) or
- ASUnb.Element(ASUnb.Head(Incomplete_String, 4), 2) /=
- ASUnb.Element(ASUnb.To_Unbounded_String("wnqz"), 2)
- then
- Report.Failed("Incorrect result from use of Function Element - 2");
- end if;
-
-
- -- Replace_Element
-
- -- The unbounded string Incorrect_Spelling starts as "Guob Dai", and
- -- is transformed by the following three procedure calls to "Good Day".
-
- ASUnb.Replace_Element(Incorrect_Spelling, 2, 'o');
-
- ASUnb.Replace_Element(Incorrect_Spelling,
- ASUnb.Index(Incorrect_Spelling, B_Set),
- A_Small_D);
-
- ASUnb.Replace_Element(Source => Incorrect_Spelling,
- Index => ASUnb.Length(Incorrect_Spelling),
- By => 'y');
-
- if Incorrect_Spelling /= ASUnb.To_Unbounded_String("Good Day") then
- Report.Failed("Incorrect result from Procedure Replace_Element");
- end if;
-
-
- -- Count
-
- -- Determine the number of characters in the unbounded string that
- -- are contained in the set.
-
- Matching_Letters := ASUnb.Count(Source => Magic_String,
- Set => ABCD_Set);
-
- if Matching_Letters /= 9 then
- Report.Failed
- ("Incorrect result from Function Count with Set parameter");
- end if;
-
- -- Determine the number of occurrences of the following pattern strings
- -- in the unbounded string Magic_String.
-
- if ASUnb.Count(Magic_String, "ab") /=
- (ASUnb.Count(Magic_String, "ac") + ASUnb.Count(Magic_String, "ad")) or
- ASUnb.Count(Magic_String, "ab") /= 2
- then
- Report.Failed
- ("Incorrect result from Function Count with String parameter");
- end if;
-
-
- -- Find_Token
-
- ASUnb.Find_Token(Magic_String, -- Find location of first "ab".
- AB_Set, -- Should be (1..2).
- Ada.Strings.Inside,
- Token_Start,
- Token_End);
-
- if Natural(Token_Start) /= ASUnb.To_String(Magic_String)'First or
- Token_End /= ASUnb.Index(Magic_String, B_Set)
- then
- Report.Failed("Incorrect result from Procedure Find_Token - 1");
- end if;
-
-
- ASUnb.Find_Token(Source => Magic_String, -- Find location of char 'r'
- Set => ABCD_Set, -- in string, should be (3..3)
- Test => Ada.Strings.Outside,
- First => Token_Start,
- Last => Token_End);
-
- if Natural(Token_Start) /= 3 or
- Token_End /= 3 then
- Report.Failed("Incorrect result from Procedure Find_Token - 2");
- end if;
-
-
- ASUnb.Find_Token(Magic_String, -- No 'g' is in the string, so
- Maps.To_Set(A_Small_G), -- the result parameters should
- Ada.Strings.Inside, -- be First = Source'First and
- First => Token_Start, -- Last = 0.
- Last => Token_End);
-
- if Token_Start /= ASUnb.To_String(Magic_String)'First or
- Token_End /= 0
- then
- Report.Failed("Incorrect result from Procedure Find_Token - 3");
- end if;
-
-
- -- Translate
-
- -- Use a mapping ("abcd" -> "wxyz") to transform the contents of
- -- the unbounded string.
- -- Magic_String = "abracadabra"
-
- Incantation := ASUnb.Translate(Magic_String, Code_Map);
-
- if Incantation /= ASUnb.To_Unbounded_String("wxrwywzwxrw") then
- Report.Failed("Incorrect result from Function Translate");
- end if;
-
- -- Use the inverse mapping of the one above to return the "translated"
- -- unbounded string to its original form.
-
- ASUnb.Translate(Incantation, Reverse_Code_Map);
-
- -- The map contained in the following call to Translate contains one
- -- element, and this element is not found in the unbounded string, so
- -- this call to Translate should have no effect on the unbounded string.
-
- if Incantation /= ASUnb.Translate(Magic_String, Non_Existent_Map) then
- Report.Failed("Incorrect result from Procedure Translate");
- end if;
-
-
- -- Trim
-
- Trim_Block:
- declare
-
- XYZ_Set : Maps.Character_Set := Maps.To_Set("xyz");
- PQR_Set : Maps.Character_Set := Maps.To_Set("pqr");
-
- Pad : constant ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("Pad");
-
- The_New_Ada : constant ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("Ada9X");
-
- Space_Array : array (1..4) of ASUnb.Unbounded_String :=
- (ASUnb.To_Unbounded_String(" Pad "),
- ASUnb.To_Unbounded_String("Pad "),
- ASUnb.To_Unbounded_String(" Pad"),
- Pad);
-
- String_Array : array (1..5) of ASUnb.Unbounded_String :=
- (ASUnb.To_Unbounded_String("xyzxAda9Xpqr"),
- ASUnb.To_Unbounded_String("Ada9Xqqrp"),
- ASUnb.To_Unbounded_String("zxyxAda9Xqpqr"),
- ASUnb.To_Unbounded_String("xxxyAda9X"),
- The_New_Ada);
-
- begin
-
- -- Examine the version of Trim that removes blanks from
- -- the left and/or right of a string.
-
- for i in 1..4 loop
- if ASUnb.Trim(Space_Array(i), Ada.Strings.Both) /= Pad then
- Report.Failed("Incorrect result from Trim for spaces - " &
- Integer'Image(i));
- end if;
- end loop;
-
- -- Examine the version of Trim that removes set characters from
- -- the left and right of a string.
-
- for i in 1..5 loop
- if ASUnb.Trim(String_Array(i),
- Left => XYZ_Set,
- Right => PQR_Set) /= The_New_Ada then
- Report.Failed
- ("Incorrect result from Trim for set characters - " &
- Integer'Image(i));
- end if;
- end loop;
-
- end Trim_Block;
-
-
- -- Delete
-
- -- Use the Delete function to remove the first four and last four
- -- characters from the string.
-
- if ASUnb.Delete(Source => ASUnb.Delete(Magic_String,
- 8,
- ASUnb.Length(Magic_String)),
- From => ASUnb.To_String(Magic_String)'First,
- Through => 4) /=
- Cad_String
- then
- Report.Failed("Incorrect results from Function Delete");
- end if;
-
-
- -- Constructors ("*")
-
- Constructor_Block:
- declare
-
- SOS : ASUnb.Unbounded_String;
-
- Dot : constant ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("Dot_");
- Dash : constant String := "Dash_";
-
- Distress : ASUnb.Unbounded_String :=
- ASUnb.To_Unbounded_String("Dot_Dot_Dot_") &
- ASUnb.To_Unbounded_String("Dash_Dash_Dash_") &
- ASUnb.To_Unbounded_String("Dot_Dot_Dot");
-
- Repeat : constant Natural := 3;
- Separator : constant Character := '_';
-
- Separator_Set : Maps.Character_Set := Maps.To_Set(Separator);
-
- begin
-
- -- Use the following constructor forms to construct the string
- -- "Dot_Dot_Dot_Dash_Dash_Dash_Dot_Dot_Dot". Note that the
- -- trailing underscore in the string is removed in the call to
- -- Trim in the If statement condition.
-
- SOS := ASUnb."*"(Repeat, Dot); -- "*"(#, Unb Str)
-
- SOS := SOS &
- ASUnb."*"(Repeat, Dash) & -- "*"(#, Str)
- ASUnb."*"(Repeat, Dot); -- "*"(#, Unb Str)
-
- if ASUnb.Trim(SOS, Maps.Null_Set, Separator_Set) /= Distress then
- Report.Failed("Incorrect results from Function ""*""");
- end if;
-
- end Constructor_Block;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4011;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4012.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4012.a
deleted file mode 100644
index 5ab12b6dfa9..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4012.a
+++ /dev/null
@@ -1,305 +0,0 @@
--- CXA4012.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the types, operations, and other entities defined within
--- the package Ada.Strings.Wide_Maps are available and produce correct
--- results.
---
--- TEST DESCRIPTION:
--- This test demonstrates the availability and function of the types and
--- operations defined in package Ada.Strings.Wide_Maps. It demonstrates
--- the use of these types and functions as they would be used in common
--- programming practice.
--- Wide_Character set creation, assignment, and comparison are evaluated
--- in this test. Each of the functions provided in package
--- Ada.Strings.Wide_Maps is utilized in creating or manipulating set
--- objects, and the function results are evaluated for correctness.
--- Wide_Character sequences are examined using the functions provided for
--- manipulating objects of this type. Likewise, Wide_Character maps are
--- created, and their contents evaluated. Exception raising conditions
--- from the function To_Mapping are also created.
--- Note: Throughout this test, the set logical operators are printed in
--- capital letters to enhance their visibility.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 01 Nov 95 SAIC Update and repair for ACVC 2.0.1.
---
---!
-
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Maps;
-
-package CXA40120 is
-
- function Equiv (Ch : Character) return Wide_Character;
- function Equiv (Str : String)
- return Ada.Strings.Wide_Maps.Wide_Character_Sequence;
- function X_Map(From : Wide_Character) return Wide_Character;
-
-end CXA40120;
-
-package body CXA40120 is
-
- -- The following two functions are used to translate character and string
- -- values to "Wide" values. They will be applied to certain Wide_Map
- -- subprogram parameters to simulate the use of Wide_Characters and
- -- Wide_Character_Sequences in actual practice.
- -- Note: These functions do not actually return "equivalent" wide
- -- characters to their character inputs, just "non-character"
- -- wide characters.
-
- function Equiv (Ch : Character) return Wide_Character is
- C : Character := Ch;
- begin
- if Ch = ' ' then
- return Ada.Characters.Handling.To_Wide_Character(C);
- else
- return Wide_Character'Val(Character'Pos(Ch) +
- Character'Pos(Character'Last) + 1);
- end if;
- end Equiv;
-
- function Equiv (Str : String)
- return Ada.Strings.Wide_Maps.Wide_Character_Sequence is
- use Ada.Strings;
- WS : Wide_Maps.Wide_Character_Sequence(Str'First..Str'Last);
- begin
- for i in Str'First..Str'Last loop
- WS(i) := Equiv(Str(i));
- end loop;
- return WS;
- end Equiv;
-
- function X_Map(From : Wide_Character) return Wide_Character is
- begin
- return Equiv('X');
- end X_Map;
-
-end CXA40120;
-
-
-
-with CXA40120;
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Maps;
-with Report;
-
-procedure CXA4012 is
-
- use CXA40120;
- use Ada.Strings;
-
-begin
-
- Report.Test ("CXA4012", "Check that the types, operations, and other " &
- "entities defined within the package " &
- "Ada.Strings.Wide_Maps are available and " &
- "produce correct results");
-
- Test_Block:
- declare
-
- use type Wide_Maps.Wide_Character_Set;
-
- MidPoint_Letter : constant := 13;
- Last_Letter : constant := 26;
-
- Vowels : constant Wide_Maps.Wide_Character_Sequence :=
- Equiv("aeiou");
- Quasi_Vowel : constant Wide_Character := Equiv('y');
-
- Alphabet : Wide_Maps.Wide_Character_Sequence(1..Last_Letter);
- Half_Alphabet : Wide_Maps.Wide_Character_Sequence(1..MidPoint_Letter);
- Inverse_Alphabet : Wide_Maps.Wide_Character_Sequence(1..Last_Letter);
-
- Alphabet_Set,
- Consonant_Set,
- Vowel_Set,
- Full_Vowel_Set,
- First_Half_Set,
- Second_Half_Set : Wide_Maps.Wide_Character_Set := Wide_Maps.Null_Set;
-
- begin
-
- -- Load the alphabet string for use in creating sets.
-
- for i in 0..MidPoint_Letter-1 loop
- Half_Alphabet(i+1) :=
- Wide_Character'Val(Wide_Character'Pos(Equiv('a')) + i);
- end loop;
-
- for i in 0..Last_Letter-1 loop
- Alphabet(i+1) :=
- Wide_Character'Val(Wide_Character'Pos(Equiv('a')) + i);
- end loop;
-
-
- -- Initialize a series of Wide_Character_Set objects.
-
- Alphabet_Set := Wide_Maps.To_Set(Alphabet);
- Vowel_Set := Wide_Maps.To_Set(Vowels);
- Full_Vowel_Set := Vowel_Set OR Wide_Maps.To_Set(Quasi_Vowel);
- Consonant_Set := Vowel_Set XOR Alphabet_Set;
-
- First_Half_Set := Wide_Maps.To_Set(Half_Alphabet);
- Second_Half_Set := Alphabet_Set XOR First_Half_Set;
-
-
- -- Evaluation of Set objects, operators, and functions.
-
- if Alphabet_Set /= (Vowel_Set OR Consonant_Set) then
- Report.Failed("Incorrect set combinations using OR operator");
- end if;
-
-
- for i in Vowels'First .. Vowels'Last loop
- if not Wide_Maps.Is_In(Vowels(i), Vowel_Set) or
- not Wide_Maps.Is_In(Vowels(i), Alphabet_Set) or
- Wide_Maps.Is_In(Vowels(i), Consonant_Set)
- then
- Report.Failed("Incorrect function Is_In use with set " &
- "combinations - " & Integer'Image(i));
- end if;
- end loop;
-
-
- if Wide_Maps.Is_Subset(Vowel_Set, First_Half_Set) or
- Wide_Maps."<="(Vowel_Set, Second_Half_Set) or
- not Wide_Maps.Is_Subset(Vowel_Set, Alphabet_Set)
- then
- Report.Failed
- ("Incorrect set evaluation using Is_Subset function");
- end if;
-
-
- if not (Full_Vowel_Set = Wide_Maps.To_Set(Equiv("aeiouy"))) then
- Report.Failed("Incorrect result for ""="" set operator");
- end if;
-
-
- if not ((Vowel_Set AND First_Half_Set) OR
- (Full_Vowel_Set AND Second_Half_Set)) = Full_Vowel_Set then
- Report.Failed
- ("Incorrect result for AND, OR, or ""="" set operators");
- end if;
-
-
- if (Alphabet_Set AND Wide_Maps.Null_Set) /= Wide_Maps.Null_Set or
- (Alphabet_Set OR Wide_Maps.Null_Set) /= Alphabet_Set
- then
- Report.Failed("Incorrect result for AND or OR set operators");
- end if;
-
-
- Vowel_Set := Full_Vowel_Set;
- Vowel_Set := Vowel_Set AND (NOT Wide_Maps.To_Set(Quasi_Vowel));
-
- if not (Vowels = Wide_Maps.To_Sequence(Vowel_Set)) then
- Report.Failed("Incorrect Set to Sequence translation");
- end if;
-
-
- for i in 0..Last_Letter-1 loop
- Inverse_Alphabet(i+1) := Alphabet(Last_Letter-i);
- end loop;
-
-
- -- Wide_Character_Mapping
-
- declare
- Inverse_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(Alphabet, Inverse_Alphabet);
- begin
- if Wide_Maps.Value(Wide_Maps.Identity, Equiv('b')) /=
- Wide_Maps.Value(Inverse_Map, Equiv('y'))
- then
- Report.Failed("Incorrect Inverse mapping");
- end if;
- end;
-
-
- -- Check that Translation_Error is raised when a character is
- -- repeated in the parameter "From" string.
- declare
- Bad_Map : Wide_Maps.Wide_Character_Mapping;
- begin
- Bad_Map := Wide_Maps.To_Mapping(From => Equiv("aa"),
- To => Equiv("yz"));
- Report.Failed("Exception not raised with repeated character");
- exception
- when Translation_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception raised in To_Mapping with " &
- "a repeated character");
- end;
-
-
- -- Check that Translation_Error is raised when the parameters of the
- -- function To_Mapping are of unequal lengths.
- declare
- Bad_Map : Wide_Maps.Wide_Character_Mapping;
- begin
- Bad_Map := Wide_Maps.To_Mapping(Equiv("abc"), Equiv("yz"));
- Report.Failed
- ("Exception not raised with unequal parameter lengths");
- exception
- when Translation_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception raised in To_Mapping with " &
- "unequal parameter lengths");
- end;
-
-
- -- Check that the access-to-subprogram type is defined and available.
- -- This provides for one Wide_Character mapping capability only.
- -- The actual mapping functionality will be tested in conjunction with
- -- the tests of subprograms defined for Wide_String handling.
-
- declare
-
- X_Map_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- X_Map'Access;
-
- begin
- if X_Map_Ptr(Equiv('A')) /= -- both return 'X'
- X_Map_Ptr.all(Equiv('Q'))
- then
- Report.Failed
- ("Incorrect result using access-to-subprogram values");
- end if;
- end;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4012;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4013.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4013.a
deleted file mode 100644
index 0f93e9dc8d1..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4013.a
+++ /dev/null
@@ -1,203 +0,0 @@
--- CXA4013.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Wide_Fixed
--- are available, and that they produce correct results. Specifically,
--- check the subprograms Index, "*" (Wide_String constructor function),
--- Count, Trim, and Replace_Slice.
---
--- TEST DESCRIPTION:
--- This test demonstrates how certain Wide_Fixed string functions
--- are used to eliminate specific substrings from portions of text.
--- A procedure is defined that will take as parameters a source
--- Wide_String along with a substring that is to be completely removed
--- from the source string. The source Wide_String is parsed using the
--- Index function, and any substring slices are replaced in the source
--- Wide_String by a series of X's (based on the length of the substring.)
--- Three lines of text are provided to this procedure, and the resulting
--- substitutions are compared with expected results to validate the
--- string processing.
--- A global accumulator is updated with the number of occurrences of the
--- substring in the source string.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Ada.Strings;
-with Ada.Strings.Wide_Fixed;
-with Ada.Strings.Wide_Maps;
-with Report;
-
-procedure CXA4013 is
-
-begin
-
- Report.Test ("CXA4013", "Check that the subprograms defined in package " &
- "Ada.Strings.Wide_Fixed are available, and that " &
- "they produce correct results");
-
- Test_Block:
- declare
-
- TC_Total : Natural := 0;
- Number_Of_Lines : constant := 3;
- WC : Wide_Character :=
- Wide_Character'Val(Character'Pos('X') +
- Character'Pos(Character'Last) +
- 1 );
-
- subtype WS is Wide_String (1..25);
-
- type Restricted_Words_Array_Type is
- array (1..10) of Wide_String (1..10);
-
- Restricted_Words : Restricted_Words_Array_Type :=
- (" platoon", " marines ", " Marines ",
- "north ", "south ", " east",
- " beach ", " airport", "airfield ",
- " road ");
-
- type Page_Of_Text_Type is array (1..Number_Of_Lines) of WS;
-
- Text_Page : Page_Of_Text_Type := ("The platoon of Marines ",
- "moved south on the south ",
- "road to the airfield. ");
-
- TC_Revised_Line_1 : constant Wide_String := "The XXXXXXX of XXXXXXX ";
- TC_Revised_Line_2 : constant Wide_String := "moved XXXXX on the XXXXX ";
- TC_Revised_Line_3 : constant Wide_String := "XXXX to the XXXXXXXX. ";
-
-
- function Equivalent (Left : WS; Right : Wide_String)
- return Boolean is
- begin
- for i in WS'range loop
- if Left(i) /= Right(i) then
- if Left(i) /= WC or Right(i) /= 'X' then
- return False;
- end if;
- end if;
- end loop;
- return True;
- end Equivalent;
-
- ---
-
- procedure Censor (Source_String : in out Wide_String;
- Pattern_String : in Wide_String) is
-
- use Ada.Strings.Wide_Fixed; -- allows infix notation of "*" below.
-
- -- Create a replacement string that is the same length as the
- -- pattern string being removed. Use the infix notation of the
- -- wide string constructor function.
-
- Replacement : constant Wide_String :=
- Pattern_String'Length * WC; -- "*"
-
- Going : Ada.Strings.Direction := Ada.Strings.Forward;
- Start_Pos,
- Index : Natural := Source_String'First;
-
- begin -- Censor
-
- -- Accumulate count of total replacement operations.
-
- TC_Total := TC_Total +
- Ada.Strings.Wide_Fixed.Count -- Count
- (Source => Source_String,
- Pattern => Pattern_String,
- Mapping => Ada.Strings.Wide_Maps.Identity);
- loop
-
- Index := Ada.Strings.Wide_Fixed.Index -- Index
- (Source_String(Start_Pos..Source_String'Last),
- Pattern_String,
- Going,
- Ada.Strings.Wide_Maps.Identity);
-
- exit when Index = 0; -- No matches, exit loop.
-
- -- if a match was found, modify the substring.
- Ada.Strings.Wide_Fixed.Replace_Slice -- Replace_Slice
- (Source_String,
- Index,
- Index + Pattern_String'Length - 1,
- Replacement);
- Start_Pos := Index + Pattern_String'Length;
-
- end loop;
-
- end Censor;
-
-
- begin
-
- -- Invoke Censor subprogram to cleanse text.
- -- Loop through each line of text, and check for the presence of each
- -- restricted word.
- -- Use the Trim function to eliminate leading or trailing blanks from
- -- the restricted word parameters.
-
- for Line in 1..Number_Of_Lines loop
- for Word in Restricted_Words'Range loop
- Censor (Text_Page(Line), -- Trim
- Ada.Strings.Wide_Fixed.Trim(Restricted_Words(Word),
- Ada.Strings.Both));
- end loop;
- end loop;
-
-
- -- Validate results.
-
- if TC_Total /= 6 then
- Report.Failed ("Incorrect number of substitutions performed");
- end if;
-
- if not Equivalent (Text_Page(1), TC_Revised_Line_1) then
- Report.Failed ("Incorrect substitutions on Line 1");
- end if;
-
- if not Equivalent (Text_Page(2), TC_Revised_Line_2) then
- Report.Failed ("Incorrect substitutions on Line 2");
- end if;
-
- if not Equivalent (Text_Page(3), TC_Revised_Line_3) then
- Report.Failed ("Incorrect substitutions on Line 3");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4013;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4014.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4014.a
deleted file mode 100644
index 6e26a0330d5..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4014.a
+++ /dev/null
@@ -1,359 +0,0 @@
--- CXA4014.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Wide_Fixed
--- are available, and that they produce correct results. Specifically,
--- check the subprograms Find_Token, Head, Index, Index_Non_Blank, Move,
--- Overwrite, and Replace_Slice, Tail, and Translate.
--- Use the access-to-subprogram mapping version of Translate (function
--- and procedure).
---
--- TEST DESCRIPTION:
--- This test demonstrates how certain wide fixed string operations could
--- be used in wide string information processing. A procedure is defined
--- that will extract portions of a 50 character string that correspond to
--- certain data items (i.e., name, address, state, zip code). These
--- parsed items will then be added to the appropriate fields of data
--- base elements. These data base elements are then compared for
--- accuracy against a similar set of predefined data base
--- elements.
--- A variety of wide fixed string processing subprograms are used in this
--- test. Each parsing operation attempts to use a different combination
--- of the available subprograms to accomplish the same goal, therefore
--- continuity of approach to wide string parsing is not seen in this
--- test.
--- However, a wide variety of possible approaches are demonstrated, while
--- exercising a large number of the total predefined subprograms of
--- package Ada.Strings.Wide_Fixed.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 02 Nov 95 SAIC Update and repair for ACVC 2.0.1.
---
---!
-
-package CXA40140 is
-
- UnderScore : Wide_Character := '_';
- Blank : Wide_Character := ' ';
-
- -- Function providing a mapping to a blank Wide_Character.
- function US_to_Blank_Map (From : Wide_Character) return Wide_Character;
-
-end CXA40140;
-
-package body CXA40140 is
-
- function US_to_Blank_Map (From : Wide_Character) return Wide_Character is
- begin
- if From = UnderScore then
- return Blank;
- else
- return From;
- end if;
- end US_to_Blank_Map;
-
-end CXA40140;
-
-
-with CXA40140;
-with Ada.Strings.Wide_Fixed;
-with Ada.Strings.Wide_Maps;
-with Report;
-
-procedure CXA4014 is
- use CXA40140;
-begin
-
- Report.Test ("CXA4014", "Check that the subprograms defined in package " &
- "Ada.Strings.Wide_Fixed are available, and that " &
- "they produce correct results");
-
- Test_Block:
- declare
-
- Number_Of_Info_Strings : constant Natural := 3;
- DB_Size : constant Natural := Number_Of_Info_Strings;
- Count : Natural := 0;
- Finished_Processing : Boolean := False;
- Blank_Wide_String : constant Wide_String := " ";
-
- subtype Info_Wide_String_Type is Wide_String (1..50);
- type Info_Wide_String_Storage_Type is
- array (1..Number_Of_Info_Strings) of Info_Wide_String_Type;
-
-
- subtype Name_Type is Wide_String (1..10);
- subtype Street_Number_Type is Wide_String (1..5);
- subtype Street_Name_Type is Wide_String (1..10);
- subtype City_Type is Wide_String (1..10);
- subtype State_Type is Wide_String (1..2);
- subtype Zip_Code_Type is Wide_String (1..5);
-
- type Data_Base_Element_Type is
- record
- Name : Name_Type := (others => ' ');
- Street_Number : Street_Number_Type := (others => ' ');
- Street_Name : Street_Name_Type := (others => ' ');
- City : City_Type := (others => ' ');
- State : State_Type := (others => ' ');
- Zip_Code : Zip_Code_Type := (others => ' ');
- end record;
-
- type Data_Base_Type is array (1..DB_Size) of Data_Base_Element_Type;
-
- Data_Base : Data_Base_Type;
-
- ---
-
- Info_String_1 : Info_Wide_String_Type :=
- "Joe_Jones 123 Sixth_St San_Diego CA 98765";
-
- Info_String_2 : Info_Wide_String_Type :=
- "Sam_Smith 56789 S._Seventh Carlsbad CA 92177";
-
- Info_String_3 : Info_Wide_String_Type :=
- "Jane_Brown 1219 Info_Lane Tuscon AZ 85643";
-
-
- Info_Strings : Info_Wide_String_Storage_Type :=
- (1 => Info_String_1,
- 2 => Info_String_2,
- 3 => Info_String_3);
-
-
-
- TC_DB_Element_1 : Data_Base_Element_Type :=
- ("Joe Jones ", "123 ", "Sixth St ", "San Diego ", "CA", "98765");
-
- TC_DB_Element_2 : Data_Base_Element_Type :=
- ("Sam Smith ", "56789", "S. Seventh", "Carlsbad ", "CA", "92177");
-
- TC_DB_Element_3 : Data_Base_Element_Type :=
- ("Jane Brown", "1219 ", "Info Lane ", "Tuscon ", "AZ", "85643");
-
- TC_Data_Base : Data_Base_Type := (TC_DB_Element_1,
- TC_DB_Element_2,
- TC_DB_Element_3);
-
- ---
-
-
- procedure Store_Information
- (Info_String : in Info_Wide_String_Type;
- DB_Record : in out Data_Base_Element_Type) is
-
- package AS renames Ada.Strings;
- use type AS.Wide_Maps.Wide_Character_Set;
-
- Start,
- Stop : Natural := 0;
-
- Numeric_Set : constant AS.Wide_Maps.Wide_Character_Set :=
- AS.Wide_Maps.To_Set("0123456789");
-
- Cal : constant
- AS.Wide_Maps.Wide_Character_Sequence := "CA";
- California_Set : constant AS.Wide_Maps.Wide_Character_Set :=
- AS.Wide_Maps.To_Set(Cal);
- Arizona_Set : constant AS.Wide_Maps.Wide_Character_Set :=
- AS.Wide_Maps.To_Set("AZ");
- Nevada_Set : constant AS.Wide_Maps.Wide_Character_Set :=
- AS.Wide_Maps.To_Set("NV");
-
- Blank_Ftn_Ptr : AS.Wide_Maps.Wide_Character_Mapping_Function :=
- US_to_Blank_Map'Access;
-
- begin
-
- -- Find the starting position of the name field (first non-blank),
- -- then, from that position, find the end of the name field (first
- -- blank).
-
- Start := AS.Wide_Fixed.Index_Non_Blank(Info_String);
- Stop := AS.Wide_Fixed.Index (Info_String(Start..Info_String'Length),
- AS.Wide_Maps.To_Set(Blank),
- AS.Inside,
- AS.Forward) - 1 ;
-
- -- Store the name field in the data base element field for "Name".
-
- DB_Record.Name := AS.Wide_Fixed.Head(Info_String(1..Stop),
- DB_Record.Name'Length);
-
- -- Replace any underscore characters in the name field
- -- that were used to separate first/middle/last names.
- -- Use the overloaded version of Translate that takes an
- -- access-to-subprogram value.
-
- AS.Wide_Fixed.Translate (DB_Record.Name, Blank_Ftn_Ptr);
-
-
- -- Continue the extraction process; now find the position of
- -- the street number in the string.
-
- Start := Stop + 1;
-
- AS.Wide_Fixed.Find_Token(Info_String(Start..Info_String'Length),
- Numeric_Set,
- AS.Inside,
- Start,
- Stop);
-
- -- Store the street number field in the appropriate data base
- -- element.
- -- No modification of the default parameters of procedure Move
- -- is required.
-
- AS.Wide_Fixed.Move(Source => Info_String(Start..Stop),
- Target => DB_Record.Street_Number);
-
-
- -- Continue the extraction process; find the street name in the
- -- info string. Skip blanks to the start of the street name, then
- -- search for the index of the next blank character in the string.
-
- Start := AS.Wide_Fixed.Index_Non_Blank
- (Info_String(Stop+1..Info_String'Length));
-
- Stop :=
- AS.Wide_Fixed.Index(Info_String(Start..Info_String'Length),
- Blank_Wide_String) - 1;
-
- -- Store the street name in the appropriate data base element field.
-
- AS.Wide_Fixed.Overwrite(DB_Record.Street_Name,
- 1,
- Info_String(Start..Stop));
-
- -- Replace any underscore characters in the street name field
- -- that were used as word separation with blanks. Again, use the
- -- access-to-subprogram value to provide the mapping.
-
- DB_Record.Street_Name :=
- AS.Wide_Fixed.Translate(DB_Record.Street_Name,
- Blank_Ftn_Ptr);
-
-
- -- Continue the extraction; remove the city name from the string.
-
- Start := AS.Wide_Fixed.Index_Non_Blank
- (Info_String(Stop+1..Info_String'Length));
-
- Stop :=
- AS.Wide_Fixed.Index(Info_String(Start..Info_String'Length),
- Blank_Wide_String) - 1;
-
- -- Store the city name field in the appropriate data base element.
-
- AS.Wide_Fixed.Replace_Slice(DB_Record.City,
- 1,
- DB_Record.City'Length,
- Info_String(Start..Stop));
-
- -- Replace any underscore characters in the city name field
- -- that were used as word separation.
-
- AS.Wide_Fixed.Translate (DB_Record.City,
- Blank_Ftn_Ptr);
-
-
- -- Continue the extraction; remove the state identifier from the
- -- info string.
-
- Start := Stop + 1;
-
- AS.Wide_Fixed.Find_Token(Info_String(Start..Info_String'Length),
- AS.Wide_Maps."OR"(California_Set,
- AS.Wide_Maps."OR"(Nevada_Set,
- Arizona_Set)),
- AS.Inside,
- Start,
- Stop);
-
- -- Store the state indicator into the data base element.
-
- AS.Wide_Fixed.Move(Source => Info_String(Start..Stop),
- Target => DB_Record.State,
- Drop => Ada.Strings.Right,
- Justify => Ada.Strings.Left,
- Pad => AS.Wide_Space);
-
-
- -- Continue the extraction process; remove the final data item in
- -- the info string, the zip code, and place it into the
- -- corresponding data base element.
-
- DB_Record.Zip_Code :=
- AS.Wide_Fixed.Tail(Info_String, DB_Record.Zip_Code'Length);
-
- exception
- when AS.Length_Error =>
- Report.Failed ("Length_Error raised in procedure");
- when AS.Pattern_Error =>
- Report.Failed ("Pattern_Error raised in procedure");
- when AS.Translation_Error =>
- Report.Failed ("Translation_Error raised in procedure");
- when others =>
- Report.Failed ("Exception raised in procedure");
- end Store_Information;
-
-
- begin
-
- -- Loop thru the information strings, extract the name and address
- -- information, place this info into elements of the data base.
-
- while not Finished_Processing loop
-
- Count := Count + 1;
-
- Store_Information (Info_Strings(Count), Data_Base(Count));
-
- Finished_Processing := (Count = Number_Of_Info_Strings);
-
- end loop;
-
-
- -- Verify that the string processing was successful.
-
- for i in 1..DB_Size loop
- if Data_Base(i) /= TC_Data_Base(i) then
- Report.Failed
- ("Data processing error on record " & Integer'Image(i));
- end if;
- end loop;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4014;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4015.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4015.a
deleted file mode 100644
index 83fad3af866..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4015.a
+++ /dev/null
@@ -1,580 +0,0 @@
--- CXA4015.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Wide_Fixed
--- are available, and that they produce correct results. Specifically,
--- check the subprograms Count, Find_Token, Index, Index_Non_Blank, and
--- Move.
---
--- TEST DESCRIPTION:
--- This test, when combined with tests CXA4013,14,16 will provide
--- coverage of the functionality found in Ada.Strings.Wide_Fixed.
--- This test contains many small, specific test cases, situations that
--- although common in user environments, are often difficult to generate
--- in large numbers in a application-based test.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 02 Nov 95 SAIC Corrected various accesssibility problems and
--- expected result strings for ACVC 2.0.1.
---
---!
-
-package CXA40150 is
-
- -- Wide Character mapping function defined for use with specific
- -- versions of functions Index and Count.
-
- function AK_to_ZQ_Mapping (From : Wide_Character) return Wide_Character;
-
-end CXA40150;
-
-package body CXA40150 is
-
- function AK_to_ZQ_Mapping (From : Wide_Character)
- return Wide_Character is
- begin
- if From = 'a' then
- return 'z';
- elsif From = 'k' then
- return 'q';
- else
- return From;
- end if;
- end AK_to_ZQ_Mapping;
-
-end CXA40150;
-
-
-with CXA40150;
-with Report;
-with Ada.Strings;
-with Ada.Strings.Wide_Fixed;
-with Ada.Strings.Wide_Maps;
-
-procedure CXA4015 is
-begin
-
- Report.Test("CXA4015", "Check that the subprograms defined in " &
- "package Ada.Strings.Wide_Fixed are available, " &
- "and that they produce correct results");
-
-
- Test_Block:
- declare
-
- use CXA40150;
-
- package ASF renames Ada.Strings.Wide_Fixed;
- package Maps renames Ada.Strings.Wide_Maps;
-
- Result_String : Wide_String(1..10) :=
- (others => Ada.Strings.Wide_Space);
-
- Source_String1 : Wide_String(1..5) := "abcde"; -- odd len Wide_String
- Source_String2 : Wide_String(1..6) := "abcdef"; -- even len Wide_String
- Source_String3 : Wide_String(1..12) := "abcdefghijkl";
- Source_String4 : Wide_String(1..12) := "abcdefghij "; -- last 2 ch pad
- Source_String5 : Wide_String(1..12) := " cdefghijkl"; -- first 2 ch pad
- Source_String6 : Wide_String(1..12) := "abcdefabcdef";
-
- Location : Natural := 0;
- Slice_Start : Positive;
- Slice_End,
- Slice_Count : Natural := 0;
-
- CD_Set : Maps.Wide_Character_Set := Maps.To_Set("cd");
- ABCD_Set : Maps.Wide_Character_Set := Maps.To_Set("abcd");
- A_to_F_Set : Maps.Wide_Character_Set := Maps.To_Set("abcdef");
-
- CD_to_XY_Map : Maps.Wide_Character_Mapping :=
- Maps.To_Mapping(From => "cd", To => "xy");
-
-
- -- Access-to-Subprogram object defined for use with specific versions of
- -- functions Index and Count.
-
- Map_Ptr : Maps.Wide_Character_Mapping_Function :=
- AK_to_ZQ_Mapping'Access;
-
-
- begin
-
-
- -- Procedure Move
- -- Evaluate the Procedure Move with various combinations of
- -- parameters.
-
- -- Justify = Left (default case)
-
- ASF.Move(Source => Source_String1, -- "abcde"
- Target => Result_String);
-
- if Result_String /= "abcde " then
- Report.Failed("Incorrect result from Move with Justify = Left");
- end if;
-
- -- Justify = Right
-
- ASF.Move(Source => Source_String2, -- "abcdef"
- Target => Result_String,
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Right);
-
- if Result_String /= " abcdef" then
- Report.Failed("Incorrect result from Move with Justify = Right");
- end if;
-
- -- Justify = Center (two cases, odd and even pad lengths)
-
- ASF.Move(Source_String1, -- "abcde"
- Result_String,
- Ada.Strings.Error,
- Ada.Strings.Center,
- 'x'); -- non-default padding.
-
- if Result_String /= "xxabcdexxx" then -- Unequal padding added right
- Report.Failed("Incorrect result from Move with Justify = Center-1");
- end if;
-
- ASF.Move(Source_String2, -- "abcdef"
- Result_String,
- Ada.Strings.Error,
- Ada.Strings.Center);
-
- if Result_String /= " abcdef " then -- Equal padding added on L/R.
- Report.Failed("Incorrect result from Move with Justify = Center-2");
- end if;
-
- -- When the source Wide_String is longer than the target Wide_String,
- -- several cases can be examined, with the results depending on the
- -- value of the Drop parameter.
-
- -- Drop = Left
-
- ASF.Move(Source => Source_String3, -- "abcdefghijkl"
- Target => Result_String,
- Drop => Ada.Strings.Left);
-
- if Result_String /= "cdefghijkl" then
- Report.Failed("Incorrect result from Move with Drop = Left");
- end if;
-
- -- Drop = Right
-
- ASF.Move(Source_String3, Result_String, Ada.Strings.Right);
-
- if Result_String /= "abcdefghij" then
- Report.Failed("Incorrect result from Move with Drop = Right");
- end if;
-
- -- Drop = Error
- -- The effect in this case depends on the value of the justify
- -- parameter, and on whether any characters in Source other than
- -- Pad would fail to be copied.
-
- -- Drop = Error, Justify = Left, right overflow characters are pad.
-
- ASF.Move(Source => Source_String4, -- "abcdefghij "
- Target => Result_String,
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Left);
-
- if not(Result_String = "abcdefghij") then -- leftmost 10 characters
- Report.Failed("Incorrect result from Move with Drop = Error - 1");
- end if;
-
- -- Drop = Error, Justify = Right, left overflow characters are pad.
-
- ASF.Move(Source_String5, -- " cdefghijkl"
- Result_String,
- Ada.Strings.Error,
- Ada.Strings.Right);
-
- if Result_String /= "cdefghijkl" then -- rightmost 10 characters
- Report.Failed("Incorrect result from Move with Drop = Error - 2");
- end if;
-
- -- In other cases of Drop=Error, Length_Error is propagated, such as:
-
- begin
-
- ASF.Move(Source_String3, -- 12 characters, no Pad.
- Result_String, -- 10 characters
- Ada.Strings.Error,
- Ada.Strings.Left);
-
- Report.Failed("Length_Error not raised by Move - 1");
-
- exception
- when Ada.Strings.Length_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception raised by Move - 1");
- end;
-
-
-
- -- Function Index
- -- (Other usage examples of this function found in CXA4013-14.)
- -- Check when the pattern is not found in the source.
-
- if ASF.Index("abcdef", "gh") /= 0 or
- ASF.Index("abcde", "abcdef") /= 0 or -- pattern > source
- ASF.Index("xyz",
- "abcde",
- Ada.Strings.Backward) /= 0 or
- ASF.Index("", "ab") /= 0 or -- null source Wide_String.
- ASF.Index("abcde", " ") /= 0 -- blank pattern.
- then
- Report.Failed("Incorrect result from Index, no pattern match");
- end if;
-
- -- Check that Pattern_Error is raised when the pattern is the
- -- null Wide_String.
- begin
- Location := ASF.Index(Source_String6, -- "abcdefabcdef"
- "", -- null pattern Wide_String.
- Ada.Strings.Forward);
- Report.Failed("Pattern_Error not raised by Index");
- exception
- when Ada.Strings.Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Index, null pattern");
- end;
-
- -- Use the search direction "backward" to locate the particular
- -- pattern within the source Wide_String.
-
- Location := ASF.Index(Source_String6, -- "abcdefabcdef"
- "de", -- slice 4..5, 10..11
- Ada.Strings.Backward); -- search from right end.
-
- if Location /= 10 then
- Report.Failed("Incorrect result from Index going Backward");
- end if;
-
-
-
- -- Function Index
- -- Use the version of Index that takes a Wide_Character_Mapping_Function
- -- parameter.
- -- Use the search directions Forward and Backward to locate the
- -- particular pattern wide string within the source wide string.
-
- Location := ASF.Index("akzqefakzqef",
- "qzq", -- slice 8..10
- Ada.Strings.Backward,
- Map_Ptr); -- perform 'a' to 'z', 'k' to 'q'
- -- translation.
- if Location /= 8 then
- Report.Failed
- ("Incorrect result from Index w/map ptr going Backward");
- end if;
-
- Location := ASF.Index("ddkkddakcdakdefcadckdfzaaqd",
- "zq", -- slice 7..8
- Ada.Strings.Forward,
- Map_Ptr); -- perform 'a' to 'z', 'k' to 'q'
- -- translation.
- if Location /= 7 then
- Report.Failed
- ("Incorrect result from Index w/map ptr going Forward");
- end if;
-
-
- if ASF.Index("aakkzq", "zq", Ada.Strings.Forward, Map_Ptr) /= 2 or
- ASF.Index("qzedka", "qz", Ada.Strings.Backward, Map_Ptr) /= 5 or
- ASF.Index("zazaza", "zzzz", Ada.Strings.Backward, Map_Ptr) /= 3 or
- ASF.Index("kka", "qqz", Ada.Strings.Forward, Map_Ptr) /= 1
- then
- Report.Failed("Incorrect result from Index w/map ptr");
- end if;
-
-
- -- Check when the pattern wide string is not found in the source.
-
- if ASF.Index("akzqef", "kzq", Ada.Strings.Forward, Map_Ptr) /= 0 or
- ASF.Index("abcde", "abcdef", Ada.Strings.Backward, Map_Ptr) /= 0 or
- ASF.Index("xyz", "akzde", Ada.Strings.Backward, Map_Ptr) /= 0 or
- ASF.Index("", "zq", Ada.Strings.Forward, Map_Ptr) /= 0 or
- ASF.Index("akcde", " ", Ada.Strings.Backward, Map_Ptr) /= 0
- then
- Report.Failed
- ("Incorrect result from Index w/map ptr, no pattern match");
- end if;
-
- -- Check that Pattern_Error is raised when the pattern is a
- -- null Wide_String.
- begin
- Location := ASF.Index("akzqefakqzef",
- "", -- null pattern Wide_String.
- Ada.Strings.Forward,
- Map_Ptr);
- Report.Failed("Pattern_Error not raised by Index w/map ptr");
- exception
- when Ada.Strings.Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Index w/map ptr, null pattern");
- end;
-
-
-
- -- Function Index
- -- Using the version of Index testing wide character set membership,
- -- check combinations of forward/backward, inside/outside parameter
- -- configurations.
-
- if ASF.Index(Source => Source_String1, -- "abcde"
- Set => CD_Set,
- Test => Ada.Strings.Inside,
- Going => Ada.Strings.Forward) /= 3 or -- 'c' at pos 3.
- ASF.Index(Source_String6, -- "abcdefabcdef"
- CD_Set,
- Ada.Strings.Outside,
- Ada.Strings.Backward) /= 12 or -- 'f' at position 12
- ASF.Index(Source_String6, -- "abcdefabcdef"
- CD_Set,
- Ada.Strings.Inside,
- Ada.Strings.Backward) /= 10 or -- 'd' at position 10
- ASF.Index("cdcdcdcdacdcdcdcd",
- CD_Set,
- Ada.Strings.Outside,
- Ada.Strings.Forward) /= 9 -- 'a' at position 9
- then
- Report.Failed("Incorrect result from function Index for sets - 1");
- end if;
-
- -- Additional interesting uses/combinations using Index for sets.
-
- if ASF.Index("cd", -- same size, str-set
- CD_Set,
- Ada.Strings.Inside,
- Ada.Strings.Forward) /= 1 or -- 'c' at position 1
- ASF.Index("abcd", -- same size, str-set,
- Maps.To_Set("efgh"), -- different contents.
- Ada.Strings.Outside,
- Ada.Strings.Forward) /= 1 or
- ASF.Index("abccd", -- set > Wide_String
- Maps.To_Set("acegik"),
- Ada.Strings.Inside,
- Ada.Strings.Backward) /= 4 or -- 'c' at position 4
- ASF.Index("abcde",
- Maps.Null_Set) /= 0 or
- ASF.Index("", -- Null string.
- CD_Set) /= 0 or
- ASF.Index("abc ab", -- blank included
- Maps.To_Set("e "), -- in Wide_String and
- Ada.Strings.Inside, -- set.
- Ada.Strings.Backward) /= 4 -- blank in Wide_Str.
- then
- Report.Failed("Incorrect result from function Index for sets - 2");
- end if;
-
-
-
- -- Function Index_Non_Blank.
- -- (Other usage examples of this function found in CXA4013-14.)
-
-
- if ASF.Index_Non_Blank(Source => Source_String4, -- "abcdefghij "
- Going => Ada.Strings.Backward) /= 10 or
- ASF.Index_Non_Blank("abc def ghi jkl ",
- Ada.Strings.Backward) /= 15 or
- ASF.Index_Non_Blank(" abcdef") /= 3 or
- ASF.Index_Non_Blank(" ") /= 0
- then
- Report.Failed("Incorrect result from Index_Non_Blank");
- end if;
-
-
-
- -- Function Count
- -- (Other usage examples of this function found in CXA4013-14.)
-
- if ASF.Count("abababa", "aba") /= 2 or
- ASF.Count("abababa", "ab" ) /= 3 or
- ASF.Count("babababa", "ab") /= 3 or
- ASF.Count("abaabaaba", "aba") /= 3 or
- ASF.Count("xxxxxxxxxxxxxxxxxxxy", "xy") /= 1 or
- ASF.Count("xxxxxxxxxxxxxxxxxxxx", "x") /= 20
- then
- Report.Failed("Incorrect result from Function Count");
- end if;
-
- -- Determine the number of slices of Source that when mapped to a
- -- non-identity map, match the pattern Wide_String.
-
- Slice_Count := ASF.Count(Source_String6, -- "abcdefabcdef"
- "xy",
- CD_to_XY_Map); -- maps 'c' to 'x', 'd' to 'y'
-
- if Slice_Count /= 2 then -- two slices "xy" in "mapped" Source_String6
- Report.Failed("Incorrect result from Count with non-identity map");
- end if;
-
- -- If the pattern supplied to Function Count is the null Wide_String,
- -- then Pattern_Error is propagated.
- declare
- The_Null_Wide_String : constant Wide_String := "";
- begin
- Slice_Count := ASF.Count(Source_String6, The_Null_Wide_String);
- Report.Failed("Pattern_Error not raised by Function Count");
- exception
- when Ada.Strings.Pattern_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception from Count with null pattern");
- end;
-
-
-
-
- -- Function Count
- -- Use the version of Count that takes a Wide_Character_Mapping_Function
- -- value as the basis of its source mapping.
-
- if ASF.Count("akakaka", "zqz", Map_Ptr) /= 2 or
- ASF.Count("akakaka", "qz", Map_Ptr) /= 3 or
- ASF.Count("kakakaka", "q", Map_Ptr) /= 4 or
- ASF.Count("zzqaakzaqzzk", "zzq", Map_Ptr) /= 4 or
- ASF.Count(" ", "z", Map_Ptr) /= 0 or
- ASF.Count("", "qz", Map_Ptr) /= 0 or
- ASF.Count("abbababab", "zq", Map_Ptr) /= 0 or
- ASF.Count("aaaaaaaaaaaaaaaaaakk", "zqq", Map_Ptr) /= 1 or
- ASF.Count("azaazaazzzaaaaazzzza", "z", Map_Ptr) /= 20
- then
- Report.Failed("Incorrect result from Function Count w/map ptr");
- end if;
-
- -- If the pattern supplied to Function Count is a null Wide_String,
- -- then Pattern_Error is propagated.
- declare
- The_Null_Wide_String : constant Wide_String := "";
- begin
- Slice_Count := ASF.Count(Source_String6,
- The_Null_Wide_String,
- Map_Ptr);
- Report.Failed
- ("Pattern_Error not raised by Function Count w/map ptr");
- exception
- when Ada.Strings.Pattern_Error => null; -- OK
- when others =>
- Report.Failed
- ("Incorrect exception from Count w/map ptr, null pattern");
- end;
-
-
-
-
- -- Function Count returning the number of characters in a particular
- -- set that are found in source Wide_String.
-
- if ASF.Count(Source_String6, CD_Set) /= 4 or -- 2 'c' and 'd' chars.
- ASF.Count("cddaccdaccdd", CD_Set) /= 10
- then
- Report.Failed("Incorrect result from Count with set");
- end if;
-
-
-
- -- Function Find_Token.
- -- (Other usage examples of this function found in CXA4013-14.)
-
- ASF.Find_Token(Source => Source_String6, -- First slice with no
- Set => ABCD_Set, -- 'a', 'b', 'c', or 'd'
- Test => Ada.Strings.Outside, -- is "ef" at 5..6.
- First => Slice_Start,
- Last => Slice_End);
-
- if Slice_Start /= 5 or Slice_End /= 6 then
- Report.Failed("Incorrect result from Find_Token - 1");
- end if;
-
- -- If no appropriate slice is contained by the source Wide_String,
- -- then the value returned in Last is zero, and the value in First is
- -- Source'First.
-
- ASF.Find_Token(Source_String6, -- "abcdefabcdef"
- A_to_F_Set, -- Set of characters 'a' thru 'f'.
- Ada.Strings.Outside, -- No characters outside this set.
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= Source_String6'First or Slice_End /= 0 then
- Report.Failed("Incorrect result from Find_Token - 2");
- end if;
-
- -- Additional testing of Find_Token.
-
- ASF.Find_Token("eabcdabcddcab",
- ABCD_Set,
- Ada.Strings.Inside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 2 or Slice_End /= 13 then
- Report.Failed("Incorrect result from Find_Token - 3");
- end if;
-
- ASF.Find_Token("efghijklabcdabcd",
- ABCD_Set,
- Ada.Strings.Outside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 1 or Slice_End /= 8 then
- Report.Failed("Incorrect result from Find_Token - 4");
- end if;
-
- ASF.Find_Token("abcdefgabcdabcd",
- ABCD_Set,
- Ada.Strings.Outside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 5 or Slice_End /= 7 then
- Report.Failed("Incorrect result from Find_Token - 5");
- end if;
-
- ASF.Find_Token("abcdcbabcdcba",
- ABCD_Set,
- Ada.Strings.Inside,
- Slice_Start,
- Slice_End);
-
- if Slice_Start /= 1 or Slice_End /= 13 then
- Report.Failed("Incorrect result from Find_Token - 6");
- end if;
-
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4015;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4016.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4016.a
deleted file mode 100644
index 00dcdcdbd00..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4016.a
+++ /dev/null
@@ -1,685 +0,0 @@
--- CXA4016.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Wide_Fixed
--- are available, and that they produce correct results. Specifically,
--- check the subprograms Delete, Head, Insert, Overwrite, Replace_Slice,
--- Tail, Trim, and "*".
---
--- TEST DESCRIPTION:
--- This test, when combined with tests CXA4013-15 will provide
--- coverage of the functionality found in package Ada.Strings.Wide_Fixed.
--- This test contains many small, specific test cases, situations that
--- although common in user environments, are often difficult to generate
--- in large numbers in a application-based test. They represent
--- individual usage paradigms in-the-small.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 10 Apr 94 SAIC Modified comments in a subtest failure message.
--- 06 Nov 95 SAIC Corrected subtest results for ACVC 2.0.1
--- 14 Mar 01 RLB Added checks that the lower bound is 1, similar
--- to CXA4005. These changes were made to test
--- Defect Report 8652/0049, as reflected in
--- Technical Corrigendum 1.
---
---!
-
-with Report;
-with Ada.Strings;
-with Ada.Strings.Wide_Fixed;
-with Ada.Strings.Wide_Maps;
-
-procedure CXA4016 is
-
- type TC_Name_Holder is access String;
- Name : TC_Name_Holder;
-
- function TC_Check (S : Wide_String) return Wide_String is
- begin
- if S'First /= 1 then
- Report.Failed ("Lower bound of result of function " & Name.all &
- " is" & Integer'Image (S'First));
- end if;
- return S;
- end TC_Check;
-
- procedure TC_Set_Name (N : String) is
- begin
- Name := new String'(N);
- end TC_Set_Name;
-
-begin
-
- Report.Test("CXA4016", "Check that the subprograms defined in " &
- "package Ada.Strings.Wide_Fixed are available, " &
- "and that they produce correct results");
-
- Test_Block:
- declare
-
- package ASW renames Ada.Strings.Wide_Fixed;
- package Wide_Maps renames Ada.Strings.Wide_Maps;
-
- Result_String,
- Delete_String,
- Insert_String,
- Trim_String,
- Overwrite_String : Wide_String(1..10) :=
- (others => Ada.Strings.Wide_Space);
- Replace_String : Wide_String(10..30) :=
- (others => Ada.Strings.Wide_Space);
-
- Source_String1 : Wide_String(1..5) := "abcde"; -- odd len wd str
- Source_String2 : Wide_String(1..6) := "abcdef"; -- even len wd str
- Source_String3 : Wide_String(1..12) := "abcdefghijkl";
- Source_String4 : Wide_String(1..12) := "abcdefghij "; -- last two ch pad
- Source_String5 : Wide_String(1..12) := " cdefghijkl"; -- first two ch pad
- Source_String6 : Wide_String(1..12) := "abcdefabcdef";
-
- Location : Natural := 0;
- Slice_Start : Positive;
- Slice_End,
- Slice_Count : Natural := 0;
-
- CD_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set("cd");
- X_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set('x');
- ABCD_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set("abcd");
- A_to_F_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set("abcdef");
-
- CD_to_XY_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(From => "cd", To => "xy");
-
- begin
-
- -- Procedure Replace_Slice
- -- The functionality of this procedure is similar to procedure Move,
- -- and is tested here in the same manner, evaluated with various
- -- combinations of parameters.
-
- -- Index_Error propagation when Low > Source'Last + 1
-
- begin
- ASW.Replace_Slice(Result_String,
- Result_String'Last + 2, -- should raise exception
- Result_String'Last,
- "xxxxxxx");
- Report.Failed("Index_Error not raised by Replace_Slice - 1");
- exception
- when Ada.Strings.Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception from Replace_Slice - 1");
- end;
-
- -- Index_Error propagation when High < Source'First - 1
-
- begin
- ASW.Replace_Slice(Replace_String(20..30),
- Replace_String'First,
- Replace_String'First - 2, -- should raise exception
- "xxxxxxx");
- Report.Failed("Index_Error not raised by Replace_Slice - 2");
- exception
- when Ada.Strings.Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception from Replace_Slice - 2");
- end;
-
- -- Justify = Left (default case)
-
- Result_String := "XXXXXXXXXX";
-
- ASW.Replace_Slice(Source => Result_String,
- Low => 1,
- High => 10,
- By => Source_String1); -- "abcde"
-
- if Result_String /= "abcde " then
- Report.Failed("Incorrect result from Replace_Slice - Justify = Left");
- end if;
-
- -- Justify = Right
-
- ASW.Replace_Slice(Source => Result_String,
- Low => 1,
- High => Result_String'Last,
- By => Source_String2, -- "abcdef"
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Right);
-
- if Result_String /= " abcdef" then
- Report.Failed("Incorrect result from Replace_Slice - Justify=Right");
- end if;
-
- -- Justify = Center (two cases, odd and even pad lengths)
-
- ASW.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String1, -- "abcde"
- Ada.Strings.Error,
- Ada.Strings.Center,
- 'x'); -- non-default padding.
-
- if Result_String /= "xxabcdexxx" then -- Unequal padding added right
- Report.Failed("Incorrect result, Replace_Slice - Justify=Center - 1");
- end if;
-
- ASW.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String2, -- "abcdef"
- Ada.Strings.Error,
- Ada.Strings.Center);
-
- if Result_String /= " abcdef " then -- Equal padding added on L/R.
- Report.Failed("Incorrect result from Replace_Slice with " &
- "Justify = Center - 2");
- end if;
-
- -- When the source string is longer than the target string, several
- -- cases can be examined, with the results depending on the value of
- -- the Drop parameter.
-
- -- Drop = Left
-
- ASW.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String3, -- "abcdefghijkl"
- Drop => Ada.Strings.Left);
-
- if Result_String /= "cdefghijkl" then
- Report.Failed("Incorrect result from Replace_Slice - Drop=Left");
- end if;
-
- -- Drop = Right
-
- ASW.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String3, -- "abcdefghijkl"
- Ada.Strings.Right);
-
- if Result_String /= "abcdefghij" then
- Report.Failed("Incorrect result, Replace_Slice with Drop=Right");
- end if;
-
- -- Drop = Error
-
- -- The effect in this case depends on the value of the justify
- -- parameter, and on whether any characters in Source other than
- -- Pad would fail to be copied.
-
- -- Drop = Error, Justify = Left, right overflow characters are pad.
-
- ASW.Replace_Slice(Result_String,
- 1,
- Result_String'Last,
- Source_String4, -- "abcdefghij "
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Left);
-
- if not(Result_String = "abcdefghij") then -- leftmost 10 characters
- Report.Failed("Incorrect result, Replace_Slice - Drop = Error - 1");
- end if;
-
- -- Drop = Error, Justify = Right, left overflow characters are pad.
-
- ASW.Replace_Slice(Source => Result_String,
- Low => 1,
- High => Result_String'Last,
- By => Source_String5, -- " cdefghijkl"
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Right);
-
- if Result_String /= "cdefghijkl" then -- rightmost 10 characters
- Report.Failed("Incorrect result, Replace_Slice - Drop = Error - 2");
- end if;
-
- -- In other cases of Drop=Error, Length_Error is propagated, such as:
-
- begin
-
- ASW.Replace_Slice(Source => Result_String,
- Low => 1,
- High => Result_String'Last,
- By => Source_String3, -- "abcdefghijkl"
- Drop => Ada.Strings.Error);
-
- Report.Failed("Length_Error not raised by Replace_Slice - 1");
-
- exception
- when Ada.Strings.Length_Error => null; -- OK
- when others =>
- Report.Failed("Incorrect exception from Replace_Slice - 3");
- end;
-
-
- -- Function Replace_Slice
-
- TC_Set_Name ("Replace_Slice");
-
- if TC_Check (ASW.Replace_Slice("abcde", 3, 3, "x"))
- /= "abxde" or -- High = Low
- TC_Check (ASW.Replace_Slice("abc", 2, 3, "xyz")) /= "axyz" or
- TC_Check (ASW.Replace_Slice("abcd", 4, 1, "xy"))
- /= "abcxyd" or -- High < Low
- TC_Check (ASW.Replace_Slice("abc", 2, 3, "x")) /= "ax" or
- TC_Check (ASW.Replace_Slice("a", 1, 1, "z")) /= "z"
- then
- Report.Failed("Incorrect result from Function Replace_Slice - 1");
- end if;
-
- if TC_Check (ASW.Replace_Slice("abcde", 5, 5, "z"))
- /= "abcdz" or -- By length 1
- TC_Check (ASW.Replace_Slice("abc", 1, 3, "xyz"))
- /= "xyz" or -- High > Low
- TC_Check (ASW.Replace_Slice("abc", 3, 2, "xy"))
- /= "abxyc" or -- insert
- TC_Check (ASW.Replace_Slice("a", 1, 1, "xyz")) /= "xyz"
- then
- Report.Failed("Incorrect result from Function Replace_Slice - 2");
- end if;
-
-
-
- -- Function Insert.
-
- TC_Set_Name ("Insert");
-
- declare
- New_String : constant Wide_String :=
- TC_Check (
- ASW.Insert(Source => Source_String1(2..5), -- "bcde"
- Before => 2,
- New_Item => Source_String2)); -- "abcdef"
- begin
- if New_String /= "abcdefbcde" then
- Report.Failed("Incorrect result from Function Insert - 1");
- end if;
- end;
-
- if TC_Check (ASW.Insert("a", 1, "z")) /= "za" or
- TC_Check (ASW.Insert("abc", 3, "")) /= "abc" or
- TC_Check (ASW.Insert("abc", 4, "z")) /= "abcz"
- then
- Report.Failed("Incorrect result from Function Insert - 2");
- end if;
-
- begin
- if TC_Check (ASW.Insert(Source => Source_String1(2..5), -- "bcde"
- Before => Report.Ident_Int(7),
- New_Item => Source_String2)) -- "abcdef"
- /= "babcdefcde" then
- Report.Failed("Index_Error not raised by Insert - 3A");
- else
- Report.Failed("Index_Error not raised by Insert - 3B");
- end if;
- exception
- when Ada.Strings.Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception from Insert - 3");
- end;
-
-
- -- Procedure Insert
-
- -- Drop = Right
-
- ASW.Insert(Source => Insert_String,
- Before => 6,
- New_Item => Source_String2, -- "abcdef"
- Drop => Ada.Strings.Right);
-
- if Insert_String /= " abcde" then -- last char of New_Item dropped.
- Report.Failed("Incorrect result from Insert with Drop = Right");
- end if;
-
- -- Drop = Left
-
- ASW.Insert(Source => Insert_String, -- 10 char string
- Before => 2, -- 9 chars, 2..10 available
- New_Item => Source_String3, -- 12 characters long.
- Drop => Ada.Strings.Left); -- truncate from Left.
-
- if Insert_String /= "l abcde" then -- 10 chars, leading blank.
- Report.Failed("Incorrect result from Insert with Drop=Left");
- end if;
-
- -- Drop = Error
-
- begin
- ASW.Insert(Source => Result_String, -- 10 chars
- Before => Result_String'Last,
- New_Item => "abcdefghijk",
- Drop => Ada.Strings.Error);
- Report.Failed("Exception not raised by Procedure Insert");
- exception
- when Ada.Strings.Length_Error => null; -- OK, expected exception
- when others =>
- Report.Failed("Incorrect exception raised by Procedure Insert");
- end;
-
-
-
- -- Function Overwrite
-
- TC_Set_Name ("Overwrite");
-
- Overwrite_String := TC_Check (
- ASW.Overwrite(Result_String, -- 10 chars
- 1, -- starting at pos=1
- Source_String3(1..10)));
-
- if Overwrite_String /= Source_String3(1..10) then
- Report.Failed("Incorrect result from Function Overwrite - 1");
- end if;
-
-
- if TC_Check (ASW.Overwrite("abcdef", 4, "xyz")) /= "abcxyz" or
- TC_Check (ASW.Overwrite("a", 1, "xyz"))
- /= "xyz" or -- chars appended
- TC_Check (ASW.Overwrite("abc", 3, " "))
- /= "ab " or -- blanks appended
- TC_Check (ASW.Overwrite("abcde", 1, "z" )) /= "zbcde"
- then
- Report.Failed("Incorrect result from Function Overwrite - 2");
- end if;
-
-
-
- -- Procedure Overwrite, with truncation.
-
- ASW.Overwrite(Source => Overwrite_String, -- 10 characters.
- Position => 1,
- New_Item => Source_String3, -- 12 characters.
- Drop => Ada.Strings.Left);
-
- if Overwrite_String /= "cdefghijkl" then
- Report.Failed("Incorrect result from Overwrite with Drop=Left");
- end if;
-
- -- The default drop value is Right, used here.
-
- ASW.Overwrite(Source => Overwrite_String, -- 10 characters.
- Position => 1,
- New_Item => Source_String3); -- 12 characters.
-
- if Overwrite_String /= "abcdefghij" then
- Report.Failed("Incorrect result from Overwrite with Drop=Right");
- end if;
-
- -- Drop = Error
-
- begin
- ASW.Overwrite(Source => Overwrite_String, -- 10 characters.
- Position => 1,
- New_Item => Source_String3, -- 12 characters.
- Drop => Ada.Strings.Error);
- Report.Failed("Exception not raised by Procedure Overwrite");
- exception
- when Ada.Strings.Length_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Procedure Overwrite");
- end;
-
- Overwrite_String := "ababababab";
- ASW.Overwrite(Overwrite_String, Overwrite_String'Last, "z");
- ASW.Overwrite(Overwrite_String, Overwrite_String'First,"z");
- ASW.Overwrite(Overwrite_String, 5, "zz");
-
- if Overwrite_String /= "zbabzzabaz" then
- Report.Failed("Incorrect result from Procedure Overwrite");
- end if;
-
-
-
- -- Function Delete
-
- TC_Set_Name ("Delete");
-
- declare
- New_String1 : constant Wide_String := -- Returns a 4 char wide str.
- TC_Check (ASW.Delete(Source => Source_String3,
- From => 3,
- Through => 10));
- New_String2 : constant Wide_String := -- This returns Source.
- TC_Check (ASW.Delete(Source_String3, 10, 3));
- begin
- if New_String1 /= "abkl" or
- New_String2 /= Source_String3
- then
- Report.Failed("Incorrect result from Function Delete - 1");
- end if;
- end;
-
- if TC_Check (ASW.Delete("a", 1, 1))
- /= "" or -- Source length = 1
- TC_Check (ASW.Delete("abc", 1, 2))
- /= "c" or -- From = Source'First
- TC_Check (ASW.Delete("abc", 3, 3))
- /= "ab" or -- From = Source'Last
- TC_Check (ASW.Delete("abc", 3, 1))
- /= "abc" -- From > Through
- then
- Report.Failed("Incorrect result from Function Delete - 2");
- end if;
-
-
-
- -- Procedure Delete
-
- -- Justify = Left
-
- Delete_String := Source_String3(1..10); -- Initialize to "abcdefghij"
-
- ASW.Delete(Source => Delete_String,
- From => 6,
- Through => Delete_String'Last,
- Justify => Ada.Strings.Left,
- Pad => 'x'); -- pad with char 'x'
-
- if Delete_String /= "abcdexxxxx" then
- Report.Failed("Incorrect result from Delete - Justify = Left");
- end if;
-
- -- Justify = Right
-
- ASW.Delete(Source => Delete_String, -- Remove x"s from end and
- From => 6, -- shift right.
- Through => Delete_String'Last,
- Justify => Ada.Strings.Right,
- Pad => 'x'); -- pad with char 'x' on left.
-
- if Delete_String /= "xxxxxabcde" then
- Report.Failed("Incorrect result from Delete - Justify = Right");
- end if;
-
- -- Justify = Center
-
- ASW.Delete(Source => Delete_String,
- From => 1,
- Through => 5,
- Justify => Ada.Strings.Center,
- Pad => 'z');
-
- if Delete_String /= "zzabcdezzz" then -- extra pad char on right side.
- Report.Failed("Incorrect result from Delete - Justify = Center");
- end if;
-
-
-
- -- Function Trim
- -- Use non-identity character sets to perform the trim operation.
-
- TC_Set_Name ("Trim");
-
- Trim_String := "cdabcdefcd";
-
- -- Remove the "cd" from each end of the string. This will not effect
- -- the "cd" slice at 5..6.
-
- declare
- New_String : constant Wide_String :=
- TC_Check (ASW.Trim(Source => Trim_String,
- Left => CD_Set, Right => CD_Set));
- begin
- if New_String /= Source_String2 then -- string "abcdef"
- Report.Failed
- ("Incorrect result from Trim with wide character sets");
- end if;
- end;
-
- if TC_Check (ASW.Trim("abcdef", Wide_Maps.Null_Set, Wide_Maps.Null_Set))
- /= "abcdef" then
- Report.Failed("Incorrect result from Trim with Null sets");
- end if;
-
- if TC_Check (ASW.Trim("cdxx", CD_Set, X_Set)) /= "" then
- Report.Failed("Incorrect result from Trim, wide string removal");
- end if;
-
-
- -- Procedure Trim
-
- -- Justify = Right
-
- ASW.Trim(Source => Trim_String,
- Left => CD_Set,
- Right => CD_Set,
- Justify => Ada.Strings.Right,
- Pad => 'x');
-
- if Trim_String /= "xxxxabcdef" then
- Report.Failed("Incorrect result from Trim with Justify = Right");
- end if;
-
- -- Justify = Left
-
- ASW.Trim(Source => Trim_String,
- Left => X_Set,
- Right => Wide_Maps.Null_Set,
- Justify => Ada.Strings.Left,
- Pad => ' ');
-
- if Trim_String /= "abcdef " then -- Padded with 4 blanks on right.
- Report.Failed("Incorrect result from Trim with Justify = Left");
- end if;
-
- -- Justify = Center
-
- ASW.Trim(Source => Trim_String,
- Left => ABCD_Set,
- Right => CD_Set,
- Justify => Ada.Strings.Center,
- Pad => 'x');
-
- if Trim_String /= "xxef xx" then -- Padded with 4 pad chars on L/R
- Report.Failed("Incorrect result from Trim with Justify = Center");
- end if;
-
-
-
- -- Function Head, testing use of padding.
-
- TC_Set_Name ("Head");
-
- -- Use the wide characters of Source_String1 ("abcde") and pad the
- -- last five wide characters of Result_String with 'x' wide characters.
-
- Result_String := TC_CHeck (ASW.Head(Source_String1, 10, 'x'));
-
- if Result_String /= "abcdexxxxx" then
- Report.Failed("Incorrect result from Function Head with padding");
- end if;
-
- if TC_Check (ASW.Head(" ab ", 2)) /= " " or
- TC_Check (ASW.Head("a", 6, 'A')) /= "aAAAAA" or
- TC_Check (ASW.Head(ASW.Head("abc ", 7, 'x'), 10, 'X'))
- /= "abc xxXXX"
- then
- Report.Failed("Incorrect result from Function Head");
- end if;
-
-
-
- -- Function Tail, testing use of padding.
-
- TC_Set_Name ("Tail");
-
- -- Use the wide characters of Source_String1 ("abcde") and pad the
- -- first five wide characters of Result_String with 'x' wide characters.
-
- Result_String := TC_Check (ASW.Tail(Source_String1, 10, 'x'));
-
- if Result_String /= "xxxxxabcde" then
- Report.Failed("Incorrect result from Function Tail with padding");
- end if;
-
- if TC_Check (ASW.Tail("abcde ", 5))
- /= "cde " or -- blanks, back
- TC_Check (ASW.Tail(" abc ", 8, ' '))
- /= " abc " or -- blanks, front/back
- TC_Check (ASW.Tail("", 5, 'Z'))
- /= "ZZZZZ" or -- pad characters only
- TC_Check (ASW.Tail("abc", 0))
- /= "" or -- null result
- TC_Check (ASW.Tail(ASW.Tail(" abc ", 6, 'x'),
- 10,
- 'X')) /= "XXXXx abc "
- then
- Report.Failed("Incorrect result from Function Tail");
- end if;
-
-
-
- -- Function "*" - with (Natural, Wide_String) parameters
-
- TC_Set_Name ("""*""");
-
- if TC_Check (ASW."*"(3, Source_String1)) /= "abcdeabcdeabcde" or
- TC_Check (ASW."*"(2, Source_String2)) /= Source_String6 or
- TC_Check (ASW."*"(4, Source_String1(1..2))) /= "abababab" or
- TC_Check (ASW."*"(0, Source_String1)) /= ""
- then
- Report.Failed
- ("Incorrect result from Function ""*"" with wide strings");
- end if;
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4016;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4017.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4017.a
deleted file mode 100644
index 8d6886897ad..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4017.a
+++ /dev/null
@@ -1,337 +0,0 @@
--- CXA4017.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Wide_Bounded
--- are available, and that they produce correct results. Specifically,
--- check the subprograms Append, Delete, Index, Insert , Length,
--- Overwrite, Replace_Slice, Slice, "&", To_Bounded_Wide_String,
--- To_Wide_String, Translate, and Trim.
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of a variety of the Wide_String
--- functions found in the package Ada.Strings.Wide_Bounded, simulating
--- the operations found in a text processing environment.
--- With bounded wide strings, the length of each "line" of text can vary
--- up to the instantiated maximum, allowing one to view a page of text as
--- a series of expandable lines. This provides flexibility in text
--- formatting of individual lines (wide strings).
--- Several subprograms are defined, all of which attempt to take
--- advantage of as many different bounded wide string utilities as
--- possible. Often, an operation that is being performed in a subprogram
--- using a certain bounded wide string utility could more efficiently be
--- performed using a different utility. However, in the interest of
--- including as broad coverage as possible, a mixture of utilities is
--- invoked in this test.
--- A simulated page of text is provided as a parameter to the test
--- defined subprograms, and the appropriate processing performed. The
--- processed page of text is then compared to a predefined "finished"
--- page, and test passage/failure is based on the results of this
--- comparison.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 06 Nov 95 SAIC Corrected initialization error for ACVC 2.0.1.
---
---!
-
-with Ada.Strings;
-with Ada.Strings.Wide_Bounded;
-with Ada.Strings.Wide_Maps;
-with Report;
-
-procedure CXA4017 is
-
-begin
-
- Report.Test ("CXA4017", "Check that the subprograms defined in package " &
- "Ada.Strings.Wide_Bounded are available, and " &
- "that they produce correct results");
-
- Test_Block:
- declare
-
- Characters_Per_Line : constant Positive := 40;
- Lines_Per_Page : constant Natural := 4;
-
-
- package BS_40 is new
- Ada.Strings.Wide_Bounded.Generic_Bounded_Length(Characters_Per_Line);
-
- use type BS_40.Bounded_Wide_String;
-
- type Page_Type is array (1..Lines_Per_Page) of
- BS_40.Bounded_Wide_String;
-
- -- Note: Misspellings below are intentional.
-
- Line1 : BS_40.Bounded_Wide_String :=
- BS_40.To_Bounded_Wide_String
- ("ada is a progrraming language designed");
- Line2 : BS_40.Bounded_Wide_String :=
- BS_40.To_Bounded_Wide_String("to support the construction of long-");
- Line3 : BS_40.Bounded_Wide_String :=
- BS_40.To_Bounded_Wide_String("lived, highly reliabel software ");
- Line4 : BS_40.Bounded_Wide_String :=
- BS_40.To_Bounded_Wide_String("systems");
-
- Page : Page_Type := (1 => Line1, 2 => Line2, 3 => Line3, 4 => Line4);
-
- Finished_Page : Page_Type :=
- (BS_40.To_Bounded_Wide_String
- ("Ada is a programming language designed"),
- BS_40.To_Bounded_Wide_String("to support the construction of long-"),
- BS_40.To_Bounded_Wide_String
- ("lived, HIGHLY RELIABLE software systems."),
- BS_40.To_Bounded_Wide_String(""));
-
- ---
-
- procedure Compress (Page : in out Page_Type) is
- Clear_Line : Natural := Lines_Per_Page;
- begin
- -- If two consecutive lines on the page are together less than the
- -- maximum line length, then append those two lines, move up all
- -- lower lines on the page, and blank out the last line.
- -- This algorithm works one time through the page, does not perform
- -- repetitive compression, and is designed for use with this test
- -- program only.
- for i in 1..Lines_Per_Page - 1 loop
- if BS_40.Length(Page(i)) + BS_40.Length(Page(i+1)) <=
- BS_40.Max_Length
- then
- Page(i) := BS_40."&"(Page(i),
- Page(i+1)); -- "&" (wd bnd, wd bnd)
-
- for j in i+1..Lines_Per_Page - 1 loop
- Page(j) :=
- BS_40.To_Bounded_Wide_String
- (BS_40.Slice(Page(j+1),
- 1,
- BS_40.Length(Page(j+1))));
- Clear_Line := j + 1;
- end loop;
- Page(Clear_Line) := BS_40.Null_Bounded_Wide_String;
- end if;
- end loop;
- end Compress;
-
- ---
-
- procedure Format (Page : in out Page_Type) is
- Sm_Ada : BS_40.Bounded_Wide_String :=
- BS_40.To_Bounded_Wide_String("ada");
- Cap_Ada : constant Wide_String := "Ada";
- Char_Pos : Natural := 0;
- Finished : Boolean := False;
- Line : Natural := Page_Type'Last;
- begin
-
- -- Add a period to the end of the last line.
- while Line >= Page_Type'First and not Finished loop
- if Page(Line) /= BS_40.Null_Bounded_Wide_String and
- BS_40.Length(Page(Line)) <= BS_40.Max_Length
- then
- Page(Line) := BS_40.Append(Page(Line), '.');
- Finished := True;
- end if;
- Line := Line - 1;
- end loop;
-
- -- Replace all occurrences of "ada" with "Ada".
- for Line in Page_Type'First .. Page_Type'Last loop
- Finished := False;
- while not Finished loop
- Char_Pos :=
- BS_40.Index (Source => Page(Line),
- Pattern => BS_40.To_Wide_String(Sm_Ada),
- Going => Ada.Strings.Backward);
- -- A zero is returned by function Index if no occurrences of
- -- the pattern wide string are found.
- Finished := (Char_Pos = 0);
- if not Finished then
- BS_40.Replace_Slice
- (Source => Page(Line),
- Low => Char_Pos,
- High => Char_Pos + BS_40.Length(Sm_Ada) - 1,
- By => Cap_Ada);
- end if;
- end loop; -- while loop
- end loop; -- for loop
-
- end Format;
-
- ---
-
- procedure Spell_Check (Page : in out Page_Type) is
- type Spelling_Type is (Incorrect, Correct);
- type Word_Array_Type is array (Spelling_Type)
- of BS_40.Bounded_Wide_String;
- type Dictionary_Type is array (1..2) of Word_Array_Type;
-
- -- Note that the "words" in the dictionary will require various
- -- amounts of Trimming prior to their use in the bounded wide string
- -- functions.
- Dictionary : Dictionary_Type :=
- (1 => (BS_40.To_Bounded_Wide_String(" reliabel "),
- BS_40.To_Bounded_Wide_String(" reliable ")),
- 2 => (BS_40.To_Bounded_Wide_String(" progrraming "),
- BS_40.To_Bounded_Wide_String(" programming ")));
-
- Pos : Natural := Natural'First;
- Finished : Boolean := False;
-
- begin
-
- for Line in Page_Type'Range loop
-
- -- Search for the first incorrectly spelled word in the
- -- Dictionary, if it is found, replace it with the correctly
- -- spelled word, using the Overwrite function.
-
- while not Finished loop
- Pos :=
- BS_40.Index(Page(Line),
- BS_40.To_Wide_String
- (BS_40.Trim(Dictionary(1)(Incorrect),
- Ada.Strings.Both)),
- Ada.Strings.Forward);
- Finished := (Pos = 0);
- if not Finished then
- Page(Line) :=
- BS_40.Overwrite(Page(Line),
- Pos,
- BS_40.To_Wide_String
- (BS_40.Trim(Dictionary(1)(Correct),
- Ada.Strings.Both)));
- end if;
- end loop;
-
- Finished := False;
-
- -- Search for the second incorrectly spelled word in the
- -- Dictionary, if it is found, replace it with the correctly
- -- spelled word, using the Delete procedure and Insert function.
-
- while not Finished loop
- Pos :=
- BS_40.Index(Page(Line),
- BS_40.To_Wide_String(
- BS_40.Trim(Dictionary(2)(Incorrect),
- Ada.Strings.Both)),
- Ada.Strings.Forward);
-
- Finished := (Pos = 0);
-
- if not Finished then
- BS_40.Delete
- (Page(Line),
- Pos,
- Pos + BS_40.To_Wide_String
- (BS_40.Trim(Dictionary(2)(Incorrect),
- Ada.Strings.Both))'Length-1);
- Page(Line) :=
- BS_40.Insert(Page(Line),
- Pos,
- BS_40.To_Wide_String
- (BS_40.Trim(Dictionary(2)(Correct),
- Ada.Strings.Both)));
- end if;
- end loop;
-
- Finished := False;
-
- end loop;
- end Spell_Check;
-
- ---
-
- procedure Bold (Page : in out Page_Type) is
- Key_Word : constant Wide_String := "highly reliable";
- Bold_Mapping : constant
- Ada.Strings.Wide_Maps.Wide_Character_Mapping :=
- Ada.Strings.Wide_Maps.To_Mapping
- (From => " abcdefghijklmnopqrstuvwxyz",
- To => " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- Pos : Natural := Natural'First;
- Finished : Boolean := False;
- begin
- -- This procedure is designed to change the case of the phrase
- -- "highly reliable" into upper case (a type of "Bolding").
- -- All instances of the phrase on all lines of the page will be
- -- modified.
-
- for Line in Page_Type'First .. Page_Type'Last loop
- while not Finished loop
- Pos := BS_40.Index(Page(Line), Key_Word);
- Finished := (Pos = 0);
- if not Finished then
-
- BS_40.Overwrite
- (Page(Line),
- Pos,
- BS_40.To_Wide_String
- (BS_40.Translate
- (BS_40.To_Bounded_Wide_String
- (BS_40.Slice(Page(Line),
- Pos,
- Pos + Key_Word'Length - 1)),
- Bold_Mapping)));
-
- end if;
- end loop;
- Finished := False;
- end loop;
- end Bold;
-
-
- begin
-
- Compress(Page);
- Format(Page);
- Spell_Check(Page);
- Bold(Page);
-
- for i in 1..Lines_Per_Page loop
- if BS_40.To_Wide_String(Page(i)) /=
- BS_40.To_Wide_String(Finished_Page(i)) or
- BS_40.Length(Page(i)) /=
- BS_40.Length(Finished_Page(i))
- then
- Report.Failed("Incorrect modification of Page, Line " &
- Integer'Image(i));
- end if;
- end loop;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4017;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4018.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4018.a
deleted file mode 100644
index 98e0ded4a2c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4018.a
+++ /dev/null
@@ -1,379 +0,0 @@
--- CXA4018.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package
--- Ada.Strings.Wide_Bounded are available, and that they produce
--- correct results. Specifically, check the subprograms Append,
--- Count, Element, Find_Token, Head, Index_Non_Blank, Replace_Element,
--- Replicate, Tail, To_Bounded_Wide_String, "&", ">", "<", ">=", "<=",
--- and "*".
---
--- TEST DESCRIPTION:
--- This test, when taken in conjunction with test CXA40[17,19,20], will
--- constitute a test of all the functionality contained in package
--- Ada.Strings.Wide_Bounded. This test uses a variety of the
--- subprograms defined in the wide bounded string package in ways typical
--- of common usage. Different combinations of available subprograms
--- are used to accomplish similar wide bounded string processing goals.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 22 Dec 94 SAIC Changed obsolete constant to Strings.Wide_Space.
--- 06 Nov 95 SAIC Corrected evaluation string used in Head/Tail
--- subtests for ACVC 2.0.1.
---
---!
-
-with Ada.Strings;
-with Ada.Strings.Wide_Bounded;
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Maps;
-with Report;
-
-procedure CXA4018 is
-
- -- The following two functions are used to translate character and string
- -- values to "Wide" values. They will be applied to all the Wide_Bounded
- -- subprogram parameters to simulate the use of Wide_Characters and
- -- Wide_Strings in actual practice. Blanks are translated to Wide_Character
- -- blanks and all other characters are translated into Wide_Characters with
- -- position values 256 greater than their (narrow) character position
- -- values.
-
- function Translate (Ch : Character) return Wide_Character is
- C : Character := Ch;
- begin
- if Ch = ' ' then
- return Ada.Characters.Handling.To_Wide_Character(C);
- else
- return Wide_Character'Val(Character'Pos(Ch) +
- Character'Pos(Character'Last) + 1);
- end if;
- end Translate;
-
- function Translate (Str : String) return Wide_String is
- WS : Wide_String(Str'First..Str'Last);
- begin
- for i in Str'First..Str'Last loop
- WS(i) := Translate(Str(i));
- end loop;
- return WS;
- end Translate;
-
-
-begin
-
- Report.Test ("CXA4018", "Check that the subprograms defined in package " &
- "Ada.Strings.Wide_Bounded are available, and " &
- "that they produce correct results");
-
- Test_Block:
- declare
-
- package BS80 is new Ada.Strings.Wide_Bounded.Generic_Bounded_Length(80);
- use type BS80.Bounded_Wide_String;
-
- Part1 : constant Wide_String := Translate("Rum");
- Part2 : Wide_Character := Translate('p');
- Part3 : BS80.Bounded_Wide_String :=
- BS80.To_Bounded_Wide_String(Translate("el"));
- Part4 : Wide_Character := Translate('s');
- Part5 : BS80.Bounded_Wide_String :=
- BS80.To_Bounded_Wide_String(Translate("tilt"));
- Part6 : Wide_String(1..3) := Translate("ski");
-
- Full_Catenate_String,
- Full_Append_String,
- Constructed_String,
- Drop_String,
- Replicated_String,
- Token_String : BS80.Bounded_Wide_String;
-
- CharA : Wide_Character := Translate('A');
- CharB : Wide_Character := Translate('B');
- CharC : Wide_Character := Translate('C');
- CharD : Wide_Character := Translate('D');
- CharE : Wide_Character := Translate('E');
- CharF : Wide_Character := Translate('F');
-
- ABStr : Wide_String(1..15) := Translate("AAAAABBBBBBBBBB");
- StrB : Wide_String(1..2) := Translate("BB");
- StrE : Wide_String(1..2) := Translate("EE");
-
-
- begin
-
- -- Evaluation of the overloaded forms of the "&" operator.
-
- Full_Catenate_String :=
- BS80."&"(Part2, -- WChar & Bnd WStr
- BS80."&"(Part3, -- Bnd WStr & Bnd WStr
- BS80."&"(Part4, -- WChar & Bnd WStr
- BS80."&"(Part5, -- Bnd WStr & Bnd WStr
- BS80.To_Bounded_Wide_String
- (Part6)))));
-
- Full_Catenate_String :=
- BS80."&"(Part1, Full_Catenate_String); -- WStr & Bnd WStr
- Full_Catenate_String :=
- BS80."&"(Left => Full_Catenate_String,
- Right => Translate('n')); -- Bnd WStr & WChar
-
-
- -- Evaluation of the overloaded forms of function Append.
-
- Full_Append_String :=
- BS80.Append(Part2, -- WChar,Bnd WStr
- BS80.Append(Part3, -- Bnd WStr, Bnd WStr
- BS80.Append(Part4, -- WChar,Bnd WStr
- BS80.Append(BS80.To_Wide_String(Part5), -- WStr,Bnd WStr
- BS80.To_Bounded_Wide_String(Part6)))));
-
- Full_Append_String :=
- BS80.Append(BS80.To_Bounded_Wide_String(Part1), -- Bnd WStr, WStr
- BS80.To_Wide_String(Full_Append_String));
-
- Full_Append_String :=
- BS80.Append(Left => Full_Append_String,
- Right => Translate('n')); -- Bnd WStr, WChar
-
-
- -- Validate the resulting bounded wide strings.
-
- if BS80."<"(Full_Catenate_String, Full_Append_String) or
- BS80.">"(Full_Catenate_String, Full_Append_String) or
- not (Full_Catenate_String = Full_Append_String and
- BS80."<="(Full_Catenate_String, Full_Append_String) and
- BS80.">="(Full_Catenate_String, Full_Append_String))
- then
- Report.Failed
- ("Incorrect results from bounded wide string catenation" &
- " and comparison");
- end if;
-
-
- -- Evaluate the overloaded forms of the Constructor function "*" and
- -- the Replicate function.
-
- Constructed_String :=
- BS80."*"(2,CharA) & -- "AA"
- BS80."*"(2,StrB) & -- "AABBBB"
- BS80."*"(3, BS80."*"(2, CharC)) & -- "AABBBBCCCCCC"
- BS80.Replicate(3,
- BS80.Replicate(2, CharD)) & -- "AABBBBCCCCCCDDDDDD"
- BS80.Replicate(2, StrE) & -- "AABBBBCCCCCCDDDDDDEEEE"
- BS80.Replicate(2, CharF); -- "AABBBBCCCCCCDDDDDDEEEEFF"
-
-
- -- Use of Function Replicate that involves dropping wide characters.
- -- The attempt to replicate the 15 character wide string six times will
- -- exceed the 80 wide character bound of the wide string. Therefore,
- -- the result should be the catenation of 5 copies of the 15 character
- -- wide string, followed by 5 'A' wide characters (the first five wide
- -- characters of the 6th replication) with the remaining wide
- -- characters of the 6th replication dropped.
-
- Drop_String :=
- BS80.Replicate(Count => 6,
- Item => ABStr, -- "AAAAABBBBBBBBBB"
- Drop => Ada.Strings.Right);
-
- if BS80.Element(Drop_String, 1) /= Translate('A') or
- BS80.Element(Drop_String, 6) /= Translate('B') or
- BS80.Element(Drop_String, 76) /= Translate('A') or
- BS80.Element(Drop_String, 80) /= Translate('A')
- then
- Report.Failed("Incorrect result from Replicate with Drop");
- end if;
-
-
- -- Use function Index_Non_Blank in the evaluation of the
- -- Constructed_String.
-
- if BS80.Index_Non_Blank(Constructed_String, Ada.Strings.Forward) /=
- BS80.To_Wide_String(Constructed_String)'First or
- BS80.Index_Non_Blank(Constructed_String, Ada.Strings.Backward) /=
- BS80.Length(Constructed_String)
- then
- Report.Failed("Incorrect results from constructor functions");
- end if;
-
-
-
- declare
-
- -- Define wide character set objects for use with the Count function.
- -- Constructed_String = "AABBBBCCCCCCDDDDDDEEEEFF" from above.
-
- A_Set : Ada.Strings.Wide_Maps.Wide_Character_Set :=
- Ada.Strings.Wide_Maps.To_Set(BS80.Element(Constructed_String,
- 1));
- B_Set : Ada.Strings.Wide_Maps.Wide_Character_Set :=
- Ada.Strings.Wide_Maps.To_Set(BS80.Element(Constructed_String,
- 3));
- C_Set : Ada.Strings.Wide_Maps.Wide_Character_Set :=
- Ada.Strings.Wide_Maps.To_Set(BS80.Element(Constructed_String,
- 7));
- D_Set : Ada.Strings.Wide_Maps.Wide_Character_Set :=
- Ada.Strings.Wide_Maps.To_Set(BS80.Element(Constructed_String,
- 13));
- E_Set : Ada.Strings.Wide_Maps.Wide_Character_Set :=
- Ada.Strings.Wide_Maps.To_Set(BS80.Element(Constructed_String,
- 19));
- F_Set : Ada.Strings.Wide_Maps.Wide_Character_Set :=
- Ada.Strings.Wide_Maps.To_Set(BS80.Element(Constructed_String,
- 23));
- Start : Positive;
- Stop : Natural := 0;
-
- begin
-
- -- Evaluate the results from function Count by comparing the number
- -- of A's to the number of F's, B's to E's, and C's to D's in the
- -- Constructed_String.
- -- There should be an equal number of each of the wide characters that
- -- are being compared (i.e., 2 A's and F's, 4 B's and E's, etc)
-
- if BS80.Count(Constructed_String, A_Set) /=
- BS80.Count(Constructed_String, F_Set) or
- BS80.Count(Constructed_String, B_Set) /=
- BS80.Count(Constructed_String, E_Set) or
- not (BS80.Count(Constructed_String, C_Set) =
- BS80.Count(Constructed_String, D_Set))
- then
- Report.Failed("Incorrect result from function Count");
- end if;
-
-
- -- Evaluate the functions Head, Tail, and Find_Token.
- -- Create the Token_String from the Constructed_String above.
-
- Token_String :=
- BS80.Tail(BS80.Head(Constructed_String, 3), 2) & -- "AB" &
- BS80.Head(BS80.Tail(Constructed_String, 13), 2) & -- "CD" &
- BS80.Head(BS80.Tail(Constructed_String, 3), 2); -- "EF"
-
- if Token_String /=
- BS80.To_Bounded_Wide_String(Translate("ABCDEF")) then
- Report.Failed("Incorrect result from Catenation of Token_String");
- end if;
-
-
- -- Find the starting/ending position of the first A in the
- -- Token_String (both should be 1, only one A appears in string).
- -- The Function Head uses the default pad character to return a
- -- bounded wide string longer than its input parameter bounded
- -- wide string.
-
- BS80.Find_Token(BS80.Head(Token_String, 10), -- Default pad.
- A_Set,
- Ada.Strings.Inside,
- Start,
- Stop);
-
- if Start /= 1 and Stop /= 1 then
- Report.Failed("Incorrect result from Find_Token - 1");
- end if;
-
-
- -- Find the starting/ending position of the first non-AB slice in
- -- the "head" five wide characters of Token_String (slice CDE at
- -- positions 3-5)
-
- BS80.Find_Token(BS80.Head(Token_String, 5), -- "ABCDE"
- Ada.Strings.Wide_Maps."OR"(A_Set, B_Set), -- Set (AB)
- Ada.Strings.Outside,
- Start,
- Stop);
-
- if Start /= 3 and Stop /= 5 then
- Report.Failed("Incorrect result from Find_Token - 2");
- end if;
-
-
- -- Find the starting/ending position of the first CD slice in
- -- the "tail" eight wide characters (including two pad wide
- -- characters) of Token_String (slice CD at positions 5-6 of
- -- the tail portion specified)
-
- BS80.Find_Token(BS80.Tail(Token_String, 8,
- Ada.Strings.Wide_Space),
- Ada.Strings.Wide_Maps."OR"(C_Set, D_Set),
- Ada.Strings.Inside,
- Start,
- Stop);
-
- if Start /= 5 and Stop /= 6 then
- Report.Failed("Incorrect result from Find_Token - 3");
- end if;
-
-
- -- Evaluate the Replace_Element function.
-
- -- Token_String = "ABCDEF"
-
- BS80.Replace_Element(Token_String, 3, BS80.Element(Token_String,4));
-
- -- Token_String = "ABDDEF"
-
- BS80.Replace_Element(Source => Token_String,
- Index => 2,
- By => BS80.Element(Token_String, 5));
-
- -- Token_String = "AEDDEF"
-
- BS80.Replace_Element(Token_String,
- 1,
- BS80.Element(BS80.Tail(Token_String, 2), 2));
-
- -- Token_String = "FEDDEF"
- -- Evaluate this result.
-
- if BS80.Element(Token_String,
- BS80.To_Wide_String(Token_String)'First) /=
- BS80.Element(Token_String,
- BS80.To_Wide_String(Token_String)'Last) or
- BS80.Count(Token_String, D_Set) /=
- BS80.Count(Token_String, E_Set) or
- BS80.Index_Non_Blank(BS80.Head(Token_String,6)) /=
- BS80.Index_Non_Blank(BS80.Tail(Token_String,6)) or
- BS80.Head(Token_String, 1) /=
- BS80.Tail(Token_String, 1)
- then
- Report.Failed("Incorrect result from operations in combination");
- end if;
-
- end;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4018;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4019.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4019.a
deleted file mode 100644
index 943e3e73b88..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4019.a
+++ /dev/null
@@ -1,1027 +0,0 @@
--- CXA4019.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Wide_Bounded
--- are available, and that they produce correct results, especially
--- under conditions where truncation of the result is required.
--- Specifically, check the subprograms Append, Count with non-Identity
--- maps, Index with non-Identity maps, Index with Set parameters,
--- Insert (function and procedure), Replace_Slice (function and
--- procedure), To_Bounded_Wide_String, and Translate (function and
--- procedure).
---
--- TEST DESCRIPTION:
--- This test, in conjunction with tests CXA4017, CXA4018, and CXA4020,
--- will provide coverage of the most common usages of the functionality
--- found in the Ada.Strings.Wide_Bounded package. It deals in large part
--- with truncation effects and options. This test contains many small,
--- specific test cases, situations that are often difficult to generate
--- in large numbers in an application-based test. These cases represent
--- specific usage paradigms in-the-small.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 06 Nov 95 SAIC Corrected expected result string in subtest for
--- ACVC 2.0.1.
--- Moved function Dog_to_Cat_Mapping to library
--- level to correct accessibility problem in test.
--- 22 Aug 96 SAIC Corrected three subtests identified in reviewer
--- comments.
--- 17 Feb 97 PWB.CTA Corrected result strings for Translate and Insert
---
---!
-
-package CXA40190 is
-
- -- Wide Character mapping function defined for use with specific
- -- versions of functions Index and Count.
-
- function Dog_to_Cat_Mapping (From : Wide_Character)
- return Wide_Character;
-
-end CXA40190;
-
-package body CXA40190 is
-
- -- Translates "dog" to "cat".
- function Dog_to_Cat_Mapping (From : Wide_Character)
- return Wide_Character is
- begin
- if From = 'd' then
- return 'c';
- elsif From = 'o' then
- return 'a';
- elsif From = 'g' then
- return 't';
- else
- return From;
- end if;
- end Dog_to_Cat_Mapping;
-
-end CXA40190;
-
-
-with CXA40190;
-with Report;
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Bounded;
-with Ada.Strings.Wide_Maps;
-with Ada.Strings.Wide_Maps.Wide_Constants;
-
-procedure CXA4019 is
-
- -- The following two functions are used to translate character and string
- -- values to "Wide" values. They will be applied to all the Wide_Bounded
- -- subprogram parameters to simulate the use of Wide_Characters and
- -- Wide_Strings in actual practice.
-
- function Equiv (Ch : Character) return Wide_Character is
- C : Character := Ch;
- begin
- if Ch = ' ' then
- return Ada.Characters.Handling.To_Wide_Character(C);
- else
- return Wide_Character'Val(Character'Pos(Ch) +
- Character'Pos(Character'Last) + 1);
- end if;
- end Equiv;
-
-
- function Equiv (Str : String) return Wide_String is
- WS : Wide_String(Str'First..Str'Last);
- begin
- for i in Str'First..Str'Last loop
- WS(i) := Equiv(Str(i));
- end loop;
- return WS;
- end Equiv;
-
-begin
-
- Report.Test("CXA4019", "Check that the subprograms defined in " &
- "package Ada.Strings.Wide_Bounded are " &
- "available, and that they produce correct " &
- "results, especially under conditions where " &
- "truncation of the result is required");
-
- Test_Block:
- declare
-
- use CXA40190;
-
- package AS renames Ada.Strings;
- package ASB renames Ada.Strings.Wide_Bounded;
- package ASWC renames Ada.Strings.Wide_Maps.Wide_Constants;
- package Maps renames Ada.Strings.Wide_Maps;
-
- package B10 is new ASB.Generic_Bounded_Length(Max => 10);
- use type B10.Bounded_Wide_String;
-
- Result_String : B10.Bounded_Wide_String;
- Test_String : B10.Bounded_Wide_String;
- AtoE_Bnd_Str : B10.Bounded_Wide_String :=
- B10.To_Bounded_Wide_String(Equiv("abcde"));
- FtoJ_Bnd_Str : B10.Bounded_Wide_String :=
- B10.To_Bounded_Wide_String(Equiv("fghij"));
- AtoJ_Bnd_Str : B10.Bounded_Wide_String :=
- B10.To_Bounded_Wide_String(Equiv("abcdefghij"));
-
- Location : Natural := 0;
- Total_Count : Natural := 0;
-
- CD_Set : Maps.Wide_Character_Set := Maps.To_Set("cd");
- Wide_CD_Set : Maps.Wide_Character_Set := Maps.To_Set(Equiv("cd"));
-
- AB_to_YZ_Map : Maps.Wide_Character_Mapping :=
- Maps.To_Mapping(From => "ab", To => "yz");
-
- Wide_AB_to_YZ_Map : Maps.Wide_Character_Mapping :=
- Maps.To_Mapping(From => Equiv("ab"),
- To => Equiv("yz"));
-
- CD_to_XY_Map : Maps.Wide_Character_Mapping :=
- Maps.To_Mapping(From => "cd", To => "xy");
-
- Wide_CD_to_XY_Map : Maps.Wide_Character_Mapping :=
- Maps.To_Mapping(From => Equiv("cd"),
- To => Equiv("xy"));
-
-
- -- Access-to-Subprogram object defined for use with specific versions of
- -- functions Index, Count Translate, and procedure Translate.
-
- Map_Ptr : Maps.Wide_Character_Mapping_Function :=
- Dog_to_Cat_Mapping'Access;
-
-
-
- begin
-
- -- Function To_Bounded_Wide_String with Truncation
- -- Evaluate the function Append with parameters that will
- -- cause the truncation of the result.
-
- -- Drop = Error (default case, Length_Error will be raised)
-
- begin
- Test_String :=
- B10.To_Bounded_Wide_String
- (Equiv("Much too long for this bounded wide string"));
- Report.Failed("Length Error not raised by To_Bounded_Wide_String");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by To_Bounded_Wide_String");
- end;
-
- -- Drop = Left
-
- Test_String :=
- B10.To_Bounded_Wide_String(Source => Equiv("abcdefghijklmn"),
- Drop => Ada.Strings.Left);
-
- if Test_String /= B10.To_Bounded_Wide_String(Equiv("efghijklmn")) then
- Report.Failed
- ("Incorrect result from To_Bounded_Wide_String, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String :=
- B10.To_Bounded_Wide_String(Source => Equiv("abcdefghijklmn"),
- Drop => Ada.Strings.Right);
-
- if not(Test_String = AtoJ_Bnd_Str) then
- Report.Failed
- ("Incorrect result from To_Bounded_Wide_String, Drop = Right");
- end if;
-
-
-
-
- -- Function Append with Truncation
- -- Evaluate the function Append with parameters that will
- -- cause the truncation of the result.
-
- -- Drop = Error (default case, Length_Error will be raised)
-
- begin
- -- Append (Bnd Str, Bnd Str);
- Result_String :=
- B10.Append(B10.To_Bounded_Wide_String(Equiv("abcde")),
- B10.To_Bounded_Wide_String(Equiv("fghijk"))); -- 11 char
- Report.Failed("Length_Error not raised by Append - 1");
- exception
- when AS.Length_Error => null; -- OK, correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Append - 1");
- end;
-
- begin
- -- Append (Str, Bnd Str);
- Result_String :=
- B10.Append(B10.To_Wide_String(AtoE_Bnd_Str),
- B10.To_Bounded_Wide_String(Equiv("fghijk")),
- AS.Error);
- Report.Failed("Length_Error not raised by Append - 2");
- exception
- when AS.Length_Error => null; -- OK, correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Append - 2");
- end;
-
- begin
- -- Append (Bnd Str, Char);
- Result_String :=
- B10.Append(B10.To_Bounded_Wide_String("abcdefghij"), 'k');
- Report.Failed("Length_Error not raised by Append - 3");
- exception
- when AS.Length_Error => null; -- OK, correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Append - 3");
- end;
-
- -- Drop = Left
-
- -- Append (Bnd Str, Bnd Str)
- Result_String :=
- B10.Append(B10.To_Bounded_Wide_String(Equiv("abcdefgh")), -- 8 chs
- B10.To_Bounded_Wide_String(Equiv("ijklmn")), -- 6 chs
- Ada.Strings.Left);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Equiv("efghijklmn")) -- 10 chars
- then
- Report.Failed("Incorrect truncation performed by Append - 4");
- end if;
-
- -- Append (Bnd Str, Str)
- Result_String :=
- B10.Append(B10.To_Bounded_Wide_String("abcdefghij"),
- "xyz",
- Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_Wide_String("defghijxyz") then
- Report.Failed("Incorrect truncation performed by Append - 5");
- end if;
-
- -- Append (Char, Bnd Str)
-
- Result_String :=
- B10.Append(Equiv('A'),
- B10.To_Bounded_Wide_String(Equiv("abcdefghij")),
- Ada.Strings.Left);
-
- if Result_String /= B10.To_Bounded_Wide_String(Equiv("abcdefghij"))
- then
- Report.Failed("Incorrect truncation performed by Append - 6");
- end if;
-
- -- Drop = Right
-
- -- Append (Bnd Str, Bnd Str)
- Result_String := B10.Append(FtoJ_Bnd_Str,
- AtoJ_Bnd_Str,
- Ada.Strings.Right);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Equiv("fghijabcde"))
- then
- Report.Failed("Incorrect truncation performed by Append - 7");
- end if;
-
- -- Append (Str, Bnd Str)
- Result_String := B10.Append(B10.To_Wide_String(AtoE_Bnd_Str),
- AtoJ_Bnd_Str,
- Ada.Strings.Right);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Equiv("abcdeabcde"))
- then
- Report.Failed("Incorrect truncation performed by Append - 8");
- end if;
-
- -- Append (Char, Bnd Str)
- Result_String := B10.Append(Equiv('A'), AtoJ_Bnd_Str, Ada.Strings.Right);
-
- if Result_String /= B10.To_Bounded_Wide_String(Equiv("Aabcdefghi")) then
- Report.Failed("Incorrect truncation performed by Append - 9");
- end if;
-
-
-
- -- Function Index with non-Identity map.
- -- Evaluate the function Index with a non-identity map
- -- parameter which will cause mapping of the source parameter
- -- prior to the evaluation of the index position search.
-
- Location :=
- B10.Index(Source => B10.To_Bounded_Wide_String("foxy fox 2"),
- Pattern => "FOX",
- Going => Ada.Strings.Backward,
- Mapping => ASWC.Upper_Case_Map);
-
- if Location /= 6 then
- Report.Failed("Incorrect result from Index, non-Identity map - 1");
- end if;
-
- Location :=
- B10.Index(B10.To_Bounded_Wide_String("THE QUICK "),
- "quick",
- Ada.Strings.Forward,
- Ada.Strings.Wide_Maps.Wide_Constants.Lower_Case_Map);
-
- if Location /= 5 then
- Report.Failed("Incorrect result from Index, non-Identity map - 2");
- end if;
-
- Location := B10.Index(Source => B10.To_Bounded_Wide_String("The the"),
- Pattern => "the",
- Going => Ada.Strings.Forward,
- Mapping => ASWC.Lower_Case_Map);
-
- if Location /= 1 then
- Report.Failed("Incorrect result from Index, non-Identity map - 3");
- end if;
-
-
-
- if B10.Index(B10.To_Bounded_Wide_String("abcd"), -- Pattern = Source
- "abcd") /= 1 or
- B10.Index(B10.To_Bounded_Wide_String("abc"), -- Pattern < Source
- "abcd") /= 0 or
- B10.Index(B10.Null_Bounded_Wide_String, -- Source = Null
- "abc") /= 0
- then
- Report.Failed("Incorrect result from Index with string patterns");
- end if;
-
-
-
- -- Function Index with access-to-subprogram mapping value.
- -- Evaluate the function Index with a wide character mapping function
- -- object that performs the mapping operation.
-
- Location := B10.Index(Source => B10.To_Bounded_Wide_String("My dog"),
- Pattern => "cat",
- Going => Ada.Strings.Forward,
- Mapping => Map_Ptr); -- change "dog" to "cat"
-
- if Location /= 4 then
- Report.Failed("Incorrect result from Index, w/map ptr - 1");
- end if;
-
- Location := B10.Index(B10.To_Bounded_Wide_String("cat or dog"),
- "cat",
- Ada.Strings.Backward,
- Map_Ptr);
-
- if Location /= 8 then
- Report.Failed("Incorrect result from Index, w/map ptr - 2");
- end if;
-
- if B10.Index(B10.To_Bounded_Wide_String("dog"), -- Pattern = Source
- "cat",
- Ada.Strings.Forward,
- Map_Ptr) /= 1 or
- B10.Index(B10.To_Bounded_Wide_String("dog"), -- Pattern < Source
- "cats",
- Ada.Strings.Backward,
- Map_Ptr) /= 0 or
- B10.Index(B10.Null_Bounded_Wide_String, -- Source = Null
- "cat",
- Ada.Strings.Forward,
- Map_Ptr) /= 0 or
- B10.Index(B10.To_Bounded_Wide_String("hot dog"),
- "dog",
- Ada.Strings.Backward,
- Map_Ptr) /= 0 or
- B10.Index(B10.To_Bounded_Wide_String(" cat dog "),
- " cat",
- Ada.Strings.Backward,
- Map_Ptr) /= 5 or
- B10.Index(B10.To_Bounded_Wide_String("dog CatDog"),
- "cat",
- Ada.Strings.Backward,
- Map_Ptr) /= 1 or
- B10.Index(B10.To_Bounded_Wide_String("CatandDog"),
- "cat",
- Ada.Strings.Forward,
- Map_Ptr) /= 0 or
- B10.Index(B10.To_Bounded_Wide_String("dddd"),
- "ccccc",
- Ada.Strings.Backward,
- Map_Ptr) /= 0
- then
- Report.Failed("Incorrect result from Index w/map ptr - 3");
- end if;
-
-
-
- -- Function Index (for Sets).
- -- This version of Index uses Sets as the basis of the search.
-
- -- Test = Inside, Going = Forward (Default case).
- Location :=
- B10.Index(Source => B10.To_Bounded_Wide_String(Equiv("abcdeabcde")),
- Set => Wide_CD_Set,
- Test => Ada.Strings.Inside,
- Going => Ada.Strings.Forward);
-
- if not (Location = 3) then -- position of first 'c' equivalent in source.
- Report.Failed("Incorrect result from Index using Sets - 1");
- end if;
-
- -- Test = Inside, Going = Backward.
- Location :=
- B10.Index(Source => B10."&"(AtoE_Bnd_Str, AtoE_Bnd_Str),
- Set => Wide_CD_Set,
- Test => Ada.Strings.Inside,
- Going => Ada.Strings.Backward);
-
- if not (Location = 9) then -- position of last 'd' in source.
- Report.Failed("Incorrect result from Index using Sets - 2");
- end if;
-
- -- Test = Outside, Going = Forward.
- Location := B10.Index(B10.To_Bounded_Wide_String("deddacd"),
- CD_Set,
- Test => Ada.Strings.Outside,
- Going => Ada.Strings.Forward);
-
- if Location /= 2 then -- position of 'e' in source.
- Report.Failed("Incorrect result from Index using Sets - 3");
- end if;
-
- -- Test = Outside, Going = Backward.
- Location := B10.Index(B10.To_Bounded_Wide_String(Equiv("deddacd")),
- Wide_CD_Set,
- Ada.Strings.Outside,
- Ada.Strings.Backward);
-
- if Location /= 5 then -- position of 'a', correct.
- Report.Failed("Incorrect result from Index using Sets - 4");
- end if;
-
- if B10.Index(B10.To_Bounded_Wide_String("cd"), -- Source = Set
- CD_Set) /= 1 or
- B10.Index(B10.To_Bounded_Wide_String("c"), -- Source < Set
- CD_Set) /= 1 or
- B10.Index(B10.Null_Bounded_Wide_String, -- Source = Null
- Wide_CD_Set) /= 0 or
- B10.Index(AtoE_Bnd_Str,
- Maps.To_Set('x')) /= 0 -- No match.
- then
- Report.Failed("Incorrect result from Index using Sets - 5");
- end if;
-
-
-
- -- Function Count with non-Identity mapping.
- -- Evaluate the function Count with a non-identity map
- -- parameter which will cause mapping of the source parameter
- -- prior to the evaluation of the number of matching patterns.
-
- Total_Count :=
- B10.Count(Source => B10.To_Bounded_Wide_String("THE THE TH"),
- Pattern => "th",
- Mapping => ASWC.Lower_Case_Map);
-
- if Total_Count /= 3 then
- Report.Failed
- ("Incorrect result from function Count, non-Identity map - 1");
- end if;
-
- -- And a few with identity maps as well.
-
- if B10.Count(B10.To_Bounded_Wide_String(Equiv("ABABABABAB")),
- Equiv("ABA"),
- Maps.Identity) /= 2 or
- B10.Count(B10.To_Bounded_Wide_String("ADCBADABCD"),
- "AB",
- Maps.To_Mapping("CD", "AB")) /= 5 or
- B10.Count(B10.To_Bounded_Wide_String(Equiv("aaaaaaaaaa")),
- Equiv("aaa")) /= 3 or
- B10.Count(B10.To_Bounded_Wide_String(Equiv("XX")),
- Equiv("XXX"),
- Maps.Identity) /= 0 or
- B10.Count(AtoE_Bnd_Str, -- Source = Pattern
- Equiv("abcde")) /= 1 or
- B10.Count(B10.Null_Bounded_Wide_String, -- Source = Null
- " ") /= 0
- then
- Report.Failed
- ("Incorrect result from function Count, w,w/o mapping");
- end if;
-
-
-
-
-
- -- Function Count with access-to-subprogram mapping.
- -- Evaluate the version function Count that uses an access-to-subprogram
- -- map parameter.
-
- Total_Count :=
- B10.Count(Source => B10.To_Bounded_Wide_String("dogdogdo"),
- Pattern => "ca",
- Mapping => Map_Ptr);
-
- if Total_Count /= 3 then
- Report.Failed
- ("Incorrect result from function Count, w/map ptr - 1");
- end if;
-
-
- if B10.Count(B10.To_Bounded_Wide_String("DdOoGgod"),
- "c",
- Map_Ptr) /= 2 or
- B10.Count(B10.To_Bounded_Wide_String("dododododo"),
- "do",
- Map_Ptr) /= 0 or
- B10.Count(B10.To_Bounded_Wide_String("Dog or dog"),
- "cat",
- Map_Ptr) /= 1 or
- B10.Count(B10.To_Bounded_Wide_String("dddddddddd"),
- "ccccc",
- Map_Ptr) /= 2 or
- B10.Count(B10.To_Bounded_Wide_String("do"), -- Source < Pattern
- "cat",
- Map_Ptr) /= 0 or
- B10.Count(B10.To_Bounded_Wide_String(" dog "), -- Source = Pattern
- " cat ",
- Map_Ptr) /= 1 or
- B10.Count(B10.Null_Bounded_Wide_String, -- Source = Null
- " ",
- Map_Ptr) /= 0
- then
- Report.Failed
- ("Incorrect result from function Count, w/map ptr - 2");
- end if;
-
-
-
-
- -- Procedure Translate
-
- -- Partial mapping of source.
-
- Test_String := B10.To_Bounded_Wide_String("abcdeabcab");
-
- B10.Translate(Source => Test_String, Mapping => AB_to_YZ_Map);
-
- if Test_String /= B10.To_Bounded_Wide_String("yzcdeyzcyz") then
- Report.Failed("Incorrect result from procedure Translate - 1");
- end if;
-
- -- Total mapping of source.
-
- Test_String := B10.To_Bounded_Wide_String("abbaaababb");
-
- B10.Translate(Source => Test_String, Mapping => ASWC.Upper_Case_Map);
-
- if Test_String /= B10.To_Bounded_Wide_String("ABBAAABABB") then
- Report.Failed("Incorrect result from procedure Translate - 2");
- end if;
-
- -- No mapping of source.
-
- Test_String := B10.To_Bounded_Wide_String(Equiv("xyzsypcc"));
-
- B10.Translate(Source => Test_String, Mapping => Wide_AB_to_YZ_Map);
-
- if Test_String /= B10.To_Bounded_Wide_String(Equiv("xyzsypcc")) then
- Report.Failed("Incorrect result from procedure Translate - 3");
- end if;
-
- -- Map > 2 characters, partial mapping.
-
- Test_String := B10.To_Bounded_Wide_String("opabcdelmn");
-
- B10.Translate(Test_String,
- Maps.To_Mapping("abcde", "lmnop"));
-
- if Test_String /= B10.To_Bounded_Wide_String("oplmnoplmn") then
- Report.Failed("Incorrect result from procedure Translate - 4");
- end if;
-
-
-
-
- -- Procedure Translate with access-to-subprogram mapping.
- -- Use the version of Procedure Translate that takes an
- -- access-to-subprogram parameter to perform the Source mapping.
-
- -- Partial mapping of source.
-
- Test_String := B10.To_Bounded_Wide_String("dogeatdog");
-
- B10.Translate(Source => Test_String, Mapping => Map_Ptr);
-
- if Test_String /= B10.To_Bounded_Wide_String("cateatcat") then
- Report.Failed
- ("Incorrect result from procedure Translate w/map ptr - 1");
- end if;
-
- Test_String := B10.To_Bounded_Wide_String("odogcatlmn");
-
- B10.Translate(Test_String, Map_Ptr);
-
- if Test_String /= B10.To_Bounded_Wide_String("acatcatlmn") then
- Report.Failed
- ("Incorrect result from procedure Translate w/map ptr - 2");
- end if;
-
-
- -- Total mapping of source.
-
- Test_String := B10.To_Bounded_Wide_String("gggooooddd");
-
- B10.Translate(Source => Test_String, Mapping => Map_Ptr);
-
- if Test_String /= B10.To_Bounded_Wide_String("tttaaaaccc") then
- Report.Failed
- ("Incorrect result from procedure Translate w/map ptr- 3");
- end if;
-
- -- No mapping of source.
-
- Test_String := B10.To_Bounded_Wide_String(" DOG cat ");
-
- B10.Translate(Source => Test_String, Mapping => Map_Ptr);
-
- if Test_String /= B10.To_Bounded_Wide_String(" DOG cat ") then
- Report.Failed
- ("Incorrect result from procedure Translate w/map ptr - 4");
- end if;
-
- Test_String := B10.Null_Bounded_Wide_String;
-
- B10.Translate(Source => Test_String, Mapping => Map_Ptr);
-
- if Test_String /= B10.To_Bounded_Wide_String("") then
- Report.Failed
- ("Incorrect result from procedure Translate w/map ptr - 5");
- end if;
-
-
-
-
- -- Function Translate with access-to-subprogram mapping.
- -- Use the version of Function Translate that takes an
- -- access-to-subprogram parameter to perform the Source mapping.
-
- -- Partial mapping of source.
-
- if B10.Translate(Source => B10.To_Bounded_Wide_String("cateatdog"),
- Mapping => Map_Ptr) /=
- B10.To_Bounded_Wide_String("cateatcat")
- then
- Report.Failed
- ("Incorrect result from function Translate w/map ptr - 1");
- end if;
-
- if B10.Translate(B10.To_Bounded_Wide_String("cadogtac"),
- Map_Ptr) /=
- B10.To_Bounded_Wide_String("cacattac")
- then
- Report.Failed
- ("Incorrect result from function Translate w/map ptr - 2");
- end if;
-
- -- Total mapping of source.
-
- if B10.Translate(Source => B10.To_Bounded_Wide_String("dogodggdo"),
- Mapping => Map_Ptr) /=
- B10.To_Bounded_Wide_String("catacttca")
- then
- Report.Failed
- ("Incorrect result from function Translate w/map ptr- 3");
- end if;
-
- -- No mapping of source.
-
- if B10.Translate(Source => B10.To_Bounded_Wide_String(" DOG cat "),
- Mapping => Map_Ptr) /=
- B10.To_Bounded_Wide_String(" DOG cat ")
- then
- Report.Failed
- ("Incorrect result from function Translate w/map ptr - 4");
- end if;
-
- if B10.Translate(B10.To_Bounded_Wide_String("d "), Map_Ptr) /=
- B10.To_Bounded_Wide_String("c ") or
- B10.Translate(B10.To_Bounded_Wide_String(" god"), Map_Ptr) /=
- B10.To_Bounded_Wide_String(" tac") or
- B10.Translate(B10.To_Bounded_Wide_String("d o g D og"), Map_Ptr) /=
- B10.To_Bounded_Wide_String("c a t D at") or
- B10.Translate(B10.To_Bounded_Wide_String(" "), Map_Ptr) /=
- B10.To_Bounded_Wide_String(" ") or
- B10.Translate(B10.To_Bounded_Wide_String("dddddddddd"), Map_Ptr) /=
- B10.To_Bounded_Wide_String("cccccccccc")
- then
- Report.Failed
- ("Incorrect result from function Translate w/map ptr - 5");
- end if;
-
- if B10.Translate(Source => B10.Null_Bounded_Wide_String,
- Mapping => Map_Ptr) /=
- B10.To_Bounded_Wide_String("")
- then
- Report.Failed
- ("Incorrect result from function Translate w/map ptr - 6");
- end if;
-
-
-
-
- -- Function Replace_Slice
- -- Evaluate function Replace_Slice with
- -- a variety of Truncation options.
-
- -- Drop = Error (Default)
-
- begin
- Test_String := AtoJ_Bnd_Str;
- Result_String :=
- B10.Replace_Slice(Source => Test_String,
- Low => 3,
- High => 5, -- 3-5, 3 chars.
- By => Equiv("xxxxxx")); -- more than 3.
- Report.Failed("Length_Error not raised by Function Replace_Slice");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Function Replace_Slice");
- end;
-
- -- Drop = Left
-
- Result_String :=
- B10.Replace_Slice(Source => Test_String,
- Low => 7,
- High => 10, -- 7-10, 4 chars.
- By => Equiv("xxxxxx"), -- 6 chars.
- Drop => Ada.Strings.Left);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Equiv("cdefxxxxxx")) -- drop a,b
- then
- Report.Failed
- ("Incorrect result from Function Replace Slice, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String :=
- B10.Replace_Slice(Source => Test_String,
- Low => 2,
- High => 5, -- 2-5, 4 chars.
- By => Equiv("xxxxxx"), -- 6 chars.
- Drop => Ada.Strings.Right);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Equiv("axxxxxxfgh")) -- drop i,j
- then
- Report.Failed
- ("Incorrect result from Function Replace Slice, Drop = Right");
- end if;
-
- -- Low = High = Source'Last, "By" length = 1.
-
- if B10.Replace_Slice(AtoE_Bnd_Str,
- B10.To_Wide_String(AtoE_Bnd_Str)'Last,
- B10.To_Wide_String(AtoE_Bnd_Str)'Last,
- Equiv("X"),
- Ada.Strings.Error) /=
- B10.To_Bounded_Wide_String(Equiv("abcdX"))
- then
- Report.Failed("Incorrect result from Function Replace_Slice");
- end if;
-
- -- Index_Error raised when High < Source'First - 1.
- begin
- Test_String :=
- B10.Replace_Slice(AtoE_Bnd_Str,
- B10.To_Wide_String(AtoE_Bnd_Str)'First,
- B10.To_Wide_String(AtoE_Bnd_Str)'First - 2,
- Equiv("hijklm"));
- Report.Failed("Index_Error not raised by Function Replace_Slice");
- exception
- when AS.Index_Error => null; -- OK, expected exception
- when Constraint_Error => null; -- Also OK, since RM is not clear
- when others =>
- Report.Failed
- ("Incorrect exception raised by Function Replace_Slice");
- end;
-
-
-
- -- Procedure Replace_Slice
- -- Evaluate procedure Replace_Slice with
- -- a variety of Truncation options.
-
- -- Drop = Error (Default)
-
- begin
- Test_String := AtoJ_Bnd_Str;
- B10.Replace_Slice(Source => Test_String,
- Low => 3,
- High => 5, -- 3-5, 3 chars.
- By => Equiv("xxxxxx")); -- more than 3.
- Report.Failed("Length_Error not raised by Procedure Replace_Slice");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Procedure Replace_Slice");
- end;
-
- -- Drop = Left
-
- Test_String := AtoJ_Bnd_Str;
- B10.Replace_Slice(Source => Test_String,
- Low => 7,
- High => 9, -- 7-9, 3 chars.
- By => Equiv("xxxxx"), -- 5 chars.
- Drop => Ada.Strings.Left);
-
- if Test_String /=
- B10.To_Bounded_Wide_String(Equiv("cdefxxxxxj")) -- drop a,b
- then
- Report.Failed
- ("Incorrect result from Procedure Replace Slice, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String := AtoJ_Bnd_Str;
- B10.Replace_Slice(Source => Test_String,
- Low => 1,
- High => 3, -- 1-3, 3chars.
- By => Equiv("xxxx"), -- 4 chars.
- Drop => Ada.Strings.Right);
-
- if Test_String /=
- B10.To_Bounded_Wide_String(Equiv("xxxxdefghi")) -- drop j
- then
- Report.Failed
- ("Incorrect result from Procedure Replace Slice, Drop = Right");
- end if;
-
- -- High = Source'First, Low > High (Insert before Low).
-
- Test_String := AtoE_Bnd_Str;
- B10.Replace_Slice(Source => Test_String,
- Low => B10.To_Wide_String(Test_String)'Last,
- High => B10.To_Wide_String(Test_String)'First,
- By => Equiv("XXXX"), -- 4 chars.
- Drop => Ada.Strings.Right);
-
- if Test_String /= B10.To_Bounded_Wide_String(Equiv("abcdXXXXe")) then
- Report.Failed
- ("Incorrect result from Procedure Replace Slice");
- end if;
-
-
-
-
- -- Function Insert with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String :=
- B10.Insert(Source => AtoJ_Bnd_Str, -- "abcdefghij"
- Before => 2,
- New_Item => Equiv("xyz"));
- Report.Failed("Length_Error not raised by Function Insert");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Insert");
- end;
-
- -- Drop = Left
-
- Result_String :=
- B10.Insert(Source => AtoJ_Bnd_Str, -- "abcdefghij"
- Before => 5,
- New_Item => Equiv("xyz"), -- 3 additional chars.
- Drop => Ada.Strings.Left);
-
- if B10.To_Wide_String(Result_String) /= Equiv("dxyzefghij") then
- Report.Failed("Incorrect result from Function Insert, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String :=
- B10.Insert(Source => B10.To_Bounded_Wide_String("abcdef"),
- Before => 2,
- New_Item => "vwxyz", -- 5 additional chars.
- Drop => Ada.Strings.Right);
-
- if B10.To_Wide_String(Result_String) /= "avwxyzbcde" then -- drop f.
- Report.Failed("Incorrect result from Function Insert, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Insert(B10.To_Bounded_Wide_String("a"), 1, " B") /=
- B10.To_Bounded_Wide_String(" Ba") or
- B10.Insert(B10.Null_Bounded_Wide_String, 1, Equiv("abcde")) /=
- AtoE_Bnd_Str or
- B10.Insert(B10.To_Bounded_Wide_String("ab"), 2, "") /=
- B10.To_Bounded_Wide_String("ab")
- then
- Report.Failed("Incorrect result from Function Insert");
- end if;
-
-
-
- -- Procedure Insert
-
- -- Drop = Error (Default).
- begin
- Test_String := AtoJ_Bnd_Str;
- B10.Insert(Source => Test_String,
- Before => 9,
- New_Item => Equiv("wxyz"),
- Drop => Ada.Strings.Error);
- Report.Failed("Length_Error not raised by Procedure Insert");
- exception
- when AS.Length_Error => null; -- Correct exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Procedure Insert");
- end;
-
- -- Drop = Left
-
- Test_String := AtoJ_Bnd_Str;
- B10.Insert(Source => Test_String,
- Before => B10.Length(Test_String), -- before last char
- New_Item => Equiv("xyz"), -- 3 additional chars.
- Drop => Ada.Strings.Left);
-
- if B10.To_Wide_String(Test_String) /= Equiv("defghixyzj") then
- Report.Failed("Incorrect result from Procedure Insert, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String := AtoJ_Bnd_Str;
- B10.Insert(Source => Test_String,
- Before => 4,
- New_Item => Equiv("yz"), -- 2 additional chars.
- Drop => Ada.Strings.Right);
-
- if B10.To_Wide_String(Test_String) /= Equiv("abcyzdefgh") then
- Report.Failed
- ("Incorrect result from Procedure Insert, Drop = Right");
- end if;
-
- -- Before = Source'First, New_Item length = 1.
-
- Test_String := B10.To_Bounded_Wide_String(" abc ");
- B10.Insert(Test_String,
- B10.To_Wide_String(Test_String)'First,
- "Z");
-
- if Test_String /= B10.To_Bounded_Wide_String("Z abc ") then
- Report.Failed("Incorrect result from Procedure Insert");
- end if;
-
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4019;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4020.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4020.a
deleted file mode 100644
index 24036f17103..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4020.a
+++ /dev/null
@@ -1,688 +0,0 @@
--- CXA4020.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Wide_Bounded
--- are available, and that they produce correct results, especially under
--- conditions where truncation of the result is required. Specifically,
--- check the subprograms Overwrite (function and procedure), Delete,
--- Function Trim (blanks), Trim (Set wide characters, function and
--- procedure), Head, Tail, and Replicate (wide characters and wide
--- strings).
---
--- TEST DESCRIPTION:
--- This test, in conjunction with tests CXA4017, CXA4018, CXA4019,
--- will provide coverage of the most common usages of the functionality
--- found in the Ada.Strings.Wide_Bounded package. It deals in large part
--- with truncation effects and options. This test contains many small,
--- specific test cases, situations that are often difficult to generate
--- in large numbers in an application-based test. These cases represent
--- specific usage paradigms in-the-small.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 22 Dec 94 SAIC Changed obsolete constant to Strings.Wide_Space.
--- 13 Apr 95 SAIC Corrected certain subtest acceptance conditions.
---
---!
-
-with Report;
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Bounded;
-with Ada.Strings.Wide_Maps;
-
-procedure CXA4020 is
-
- -- The following two functions are used to translate character and string
- -- values to "Wide" values. They will be applied to all the Wide_Bounded
- -- subprogram parameters to simulate the use of Wide_Characters and
- -- Wide_Strings in actual practice. Blanks are translated to Wide_Character
- -- blanks and all other characters are translated into Wide_Characters with
- -- position values 256 greater than their (narrow) character position
- -- values.
-
- function Translate (Ch : Character) return Wide_Character is
- C : Character := Ch;
- begin
- if Ch = ' ' then
- return Ada.Characters.Handling.To_Wide_Character(C);
- else
- return Wide_Character'Val(Character'Pos(Ch) +
- Character'Pos(Character'Last) + 1);
- end if;
- end Translate;
-
-
- function Translate (Str : String) return Wide_String is
- WS : Wide_String(Str'First..Str'Last);
- begin
- for i in Str'First..Str'Last loop
- WS(i) := Translate(Str(i));
- end loop;
- return WS;
- end Translate;
-
-
-begin
-
- Report.Test("CXA4020", "Check that the subprograms defined in " &
- "package Ada.Strings.Wide_Bounded are " &
- "available, and that they produce correct " &
- "results, especially under conditions where " &
- "truncation of the result is required");
-
- Test_Block:
- declare
-
- package AS renames Ada.Strings;
- package ASW renames Ada.Strings.Wide_Bounded;
- package Maps renames Ada.Strings.Wide_Maps;
-
- package B10 is new ASW.Generic_Bounded_Length(Max => 10);
- use type B10.Bounded_Wide_String;
-
- Result_String : B10.Bounded_Wide_String;
- Test_String : B10.Bounded_Wide_String;
- AtoE_Bnd_Str : B10.Bounded_Wide_String :=
- B10.To_Bounded_Wide_String(Translate("abcde"));
- FtoJ_Bnd_Str : B10.Bounded_Wide_String :=
- B10.To_Bounded_Wide_String(Translate("fghij"));
- AtoJ_Bnd_Str : B10.Bounded_Wide_String :=
- B10.To_Bounded_Wide_String(Translate("abcdefghij"));
-
- Location : Natural := 0;
- Total_Count : Natural := 0;
-
- CD_Set : Maps.Wide_Character_Set := Maps.To_Set(Translate("cd"));
- XY_Set : Maps.Wide_Character_Set := Maps.To_Set(Translate("xy"));
-
-
- begin
-
- -- Function Overwrite with Truncation
- -- Drop = Error (Default).
-
- begin
- Test_String := AtoJ_Bnd_Str;
- Result_String :=
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => 9,
- New_Item => Translate("xyz"),
- Drop => AS.Error);
- Report.Failed("Exception not raised by Function Overwrite");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Overwrite");
- end;
-
- -- Drop = Left
-
- Result_String :=
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => B10.Length(Test_String), -- 10
- New_Item => Translate("xyz"),
- Drop => Ada.Strings.Left);
-
- if B10.To_Wide_String(Result_String) /=
- Translate("cdefghixyz") then -- drop a,b
- Report.Failed
- ("Incorrect result from Function Overwrite, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String := B10.Overwrite(Test_String, -- "abcdefghij"
- 3,
- Translate("xxxyyyzzz"),
- Ada.Strings.Right);
-
- if B10.To_Wide_String(Result_String) /=
- Translate("abxxxyyyzz")
- then
- Report.Failed
- ("Incorrect result from Function Overwrite, Drop = Right");
- end if;
-
- -- Additional cases of function Overwrite.
-
- if B10.Overwrite(B10.To_Bounded_Wide_String(Translate("a")),
- 1, -- Source length = 1
- Translate(" abc ")) /=
- B10.To_Bounded_Wide_String(Translate(" abc ")) or
- B10.Overwrite(B10.Null_Bounded_Wide_String, -- Null source
- 1,
- Translate("abcdefghij")) /=
- AtoJ_Bnd_Str or
- B10.Overwrite(AtoE_Bnd_Str,
- B10.To_Wide_String(AtoE_Bnd_Str)'First,
- Translate(" ")) /= -- New_Item = 1
- B10.To_Bounded_Wide_String(Translate(" bcde"))
- then
- Report.Failed("Incorrect result from Function Overwrite");
- end if;
-
-
-
- -- Procedure Overwrite
- -- Correct usage, no truncation.
-
- Test_String := AtoE_Bnd_Str; -- "abcde"
- B10.Overwrite(Test_String, 2, Translate("xyz"));
-
- if Test_String /= B10.To_Bounded_Wide_String(Translate("axyze")) then
- Report.Failed("Incorrect result from Procedure Overwrite - 1");
- end if;
-
- Test_String := B10.To_Bounded_Wide_String(Translate("abc"));
- B10.Overwrite(Test_String, 2, ""); -- New_Item is null string.
-
- if Test_String /= B10.To_Bounded_Wide_String(Translate("abc")) then
- Report.Failed("Incorrect result from Procedure Overwrite - 2");
- end if;
-
- -- Drop = Error (Default).
-
- begin
- Test_String := AtoJ_Bnd_Str;
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => 8,
- New_Item => Translate("uvwxyz"));
- Report.Failed("Exception not raised by Procedure Overwrite");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Procedure Overwrite");
- end;
-
- -- Drop = Left
-
- Test_String := AtoJ_Bnd_Str;
- B10.Overwrite(Source => Test_String, -- "abcdefghij"
- Position => B10.Length(Test_String) - 2, -- 8
- New_Item => Translate("uvwxyz"),
- Drop => Ada.Strings.Left);
-
- if B10.To_Wide_String(Test_String) /=
- Translate("defguvwxyz")
- then
- Report.Failed
- ("Incorrect result from Procedure Overwrite, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Test_String := AtoJ_Bnd_Str;
- B10.Overwrite(Test_String, -- "abcdefghij"
- 3,
- Translate("xxxyyyzzz"),
- Ada.Strings.Right);
-
- if B10.To_Wide_String(Test_String) /= Translate("abxxxyyyzz") then
- Report.Failed
- ("Incorrect result from Procedure Overwrite, Drop = Right");
- end if;
-
-
-
- -- Function Delete
-
- if B10.Delete(Source => AtoJ_Bnd_Str, -- "abcdefghij"
- From => 3,
- Through => 8) /=
- B10."&"(B10.Head(AtoJ_Bnd_Str, 2),
- B10.Tail(AtoJ_Bnd_Str, 2)) or
- B10.Delete(AtoJ_Bnd_Str, 6, B10.Length(AtoJ_Bnd_Str)) /=
- AtoE_Bnd_Str or
- B10.Delete(AtoJ_Bnd_Str, 1, 5) /=
- FtoJ_Bnd_Str
- then
- Report.Failed("Incorrect result from Function Delete - 1");
- end if;
-
- if B10.Delete(B10.To_Bounded_Wide_String(Translate("a")), 1, 1) /=
- B10.Null_Bounded_Wide_String or
- B10.Delete(AtoE_Bnd_Str,
- 5,
- B10.To_Wide_String(AtoE_Bnd_Str)'First) /=
- AtoE_Bnd_Str or
- B10.Delete(AtoE_Bnd_Str,
- B10.To_Wide_String(AtoE_Bnd_Str)'Last,
- B10.To_Wide_String(AtoE_Bnd_Str)'Last) /=
- B10.To_Bounded_Wide_String(Translate("abcd"))
- then
- Report.Failed("Incorrect result from Function Delete - 2");
- end if;
-
-
-
- -- Function Trim
-
- declare
-
- Text : B10.Bounded_Wide_String :=
- B10.To_Bounded_Wide_String(Translate("Text"));
- type Bnd_Array_Type is array (1..5) of B10.Bounded_Wide_String;
- Bnd_Array : Bnd_Array_Type :=
- (B10.To_Bounded_Wide_String(Translate(" Text")),
- B10.To_Bounded_Wide_String(Translate("Text ")),
- B10.To_Bounded_Wide_String(Translate(" Text ")),
- B10.To_Bounded_Wide_String(Translate("Text Text")),
- B10.To_Bounded_Wide_String(Translate(" Text Text")));
-
- begin
-
- for i in Bnd_Array_Type'Range loop
- case i is
- when 4 =>
- if B10.Trim(Bnd_Array(i), AS.Both) /=
- Bnd_Array(i) then -- no change
- Report.Failed("Incorrect result from Function Trim - 4");
- end if;
- when 5 =>
- if B10.Trim(Bnd_Array(i), AS.Both) /=
- B10."&"(Text, B10."&"(Translate(' '), Text))
- then
- Report.Failed("Incorrect result from Function Trim - 5");
- end if;
- when others =>
- if B10.Trim(Bnd_Array(i), AS.Both) /= Text then
- Report.Failed("Incorrect result from Function Trim - " &
- Integer'Image(i));
- end if;
- end case;
- end loop;
-
- end;
-
-
-
- -- Function Trim using Sets
-
- -- Trim characters in sets from both sides of the bounded wide string.
- if B10.Trim(Source => B10.To_Bounded_Wide_String(Translate("ddabbaxx")),
- Left => CD_Set,
- Right => XY_Set) /=
- B10.To_Bounded_Wide_String(Translate("abba"))
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Left & Right side - 1");
- end if;
-
- -- Ensure that the characters in the set provided as the actual to
- -- parameter Right are not trimmed from the left side of the bounded
- -- wide string; likewise for the opposite side. Only "cd" trimmed
- -- from left side, and only "xy" trimmed from right side.
-
- if B10.Trim(B10.To_Bounded_Wide_String(Translate("cdxyabcdxy")),
- CD_Set,
- XY_Set) /=
- B10.To_Bounded_Wide_String(Translate("xyabcd"))
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Left & Right side - 2");
- end if;
-
- -- Ensure that characters contained in the sets are not trimmed from
- -- the "interior" of the bounded wide string, just the appropriate ends.
-
- if B10.Trim(B10.To_Bounded_Wide_String(Translate("cdabdxabxy")),
- CD_Set,
- XY_Set) /=
- B10.To_Bounded_Wide_String(Translate("abdxab"))
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Left & Right side - 3");
- end if;
-
- -- Trim characters in set from right side only. No change to Left side.
-
- if B10.Trim(B10.To_Bounded_Wide_String(Translate("abxyzddcd")),
- XY_Set,
- CD_Set) /=
- B10.To_Bounded_Wide_String(Translate("abxyz"))
- then
- Report.Failed
- ("Incorrect result from Fn Trim - Sets, Right side");
- end if;
-
- -- Trim no characters on either side of the bounded string.
-
- Result_String := B10.Trim(AtoJ_Bnd_Str, CD_Set, XY_Set);
- if Result_String /= AtoJ_Bnd_Str then
- Report.Failed("Incorrect result from Fn Trim - Sets, Neither side");
- end if;
-
- if B10.Trim(AtoE_Bnd_Str, Maps.Null_Set, Maps.Null_Set) /=
- AtoE_Bnd_Str or
- B10.Trim(B10.To_Bounded_Wide_String(Translate("dcddcxyyxx")),
- CD_Set,
- XY_Set) /=
- B10.Null_Bounded_Wide_String
- then
- Report.Failed("Incorrect result from Function Trim");
- end if;
-
-
-
- -- Procedure Trim using Sets
-
- -- Trim characters in sets from both sides of the bounded wide string.
-
- Test_String := B10.To_Bounded_Wide_String(Translate("dcabbayx"));
- B10.Trim(Source => Test_String,
- Left => CD_Set,
- Right => XY_Set);
-
- if Test_String /= B10.To_Bounded_Wide_String(Translate("abba")) then
- Report.Failed
- ("Incorrect result from Proc Trim - Sets, Left & Right side - 1");
- end if;
-
- -- Ensure that the characters in the set provided as the actual to
- -- parameter Right are not trimmed from the left side of the bounded
- -- wide string; likewise for the opposite side. Only "cd" trimmed
- -- from left side, and only "xy" trimmed from right side.
-
- Test_String := B10.To_Bounded_Wide_String(Translate("cdxyabcdxy"));
- B10.Trim(Test_String, CD_Set, XY_Set);
-
- if Test_String /= B10.To_Bounded_Wide_String(Translate("xyabcd")) then
- Report.Failed
- ("Incorrect result from Proc Trim - Sets, Left & Right side - 2");
- end if;
-
- -- Ensure that characters contained in the sets are not trimmed from
- -- the "interior" of the bounded wide string, just the appropriate ends.
-
- Test_String := B10.To_Bounded_Wide_String(Translate("cdabdxabxy"));
- B10.Trim(Test_String, CD_Set, XY_Set);
-
- if not
- (Test_String = B10.To_Bounded_Wide_String(Translate("abdxab"))) then
- Report.Failed
- ("Incorrect result from Proc Trim - Sets, Left & Right side - 3");
- end if;
-
- -- Trim characters in set from Left side only. No change to Right side.
-
- Test_String := B10.To_Bounded_Wide_String(Translate("cccdabxyz"));
- B10.Trim(Test_String, CD_Set, XY_Set);
-
- if Test_String /= B10.To_Bounded_Wide_String(Translate("abxyz")) then
- Report.Failed
- ("Incorrect result from Proc Trim for Sets, Left side only");
- end if;
-
- -- Trim no characters on either side of the bounded wide string.
-
- Test_String := AtoJ_Bnd_Str;
- B10.Trim(Test_String, CD_Set, CD_Set);
-
- if Test_String /= AtoJ_Bnd_Str then
- Report.Failed("Incorrect result from Proc Trim-Sets, Neither side");
- end if;
-
-
-
- -- Function Head with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String := B10.Head(Source => AtoJ_Bnd_Str, -- max length
- Count => B10.Length(AtoJ_Bnd_Str) + 1,
- Pad => Translate('X'));
- Report.Failed("Length_Error not raised by Function Head");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Head");
- end;
-
- -- Drop = Left
-
- -- Pad characters (5) are appended to the right end of the bounded
- -- wide string (which is initially at its maximum length), then the
- -- first five characters of the intermediate result are dropped to
- -- conform to the maximum size limit of the bounded wide string (10).
-
- Result_String :=
- B10.Head(B10.To_Bounded_Wide_String(Translate("ABCDEFGHIJ")),
- 15,
- Translate('x'),
- Ada.Strings.Left);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Translate("FGHIJxxxxx"))
- then
- Report.Failed("Incorrect result from Function Head, Drop = Left");
- end if;
-
- -- Drop = Right
-
- -- Pad characters (6) are appended to the left end of the bounded
- -- wide string (which is initially at one less than its maximum length),
- -- then the last five characters of the intermediate result are dropped
- -- (which in this case are the pad characters) to conform to the
- -- maximum size limit of the bounded wide string (10).
-
- Result_String :=
- B10.Head(B10.To_Bounded_Wide_String(Translate("ABCDEFGHI")),
- 15,
- Translate('x'),
- Ada.Strings.Right);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Translate("ABCDEFGHIx"))
- then
- Report.Failed("Incorrect result from Function Head, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Head(B10.Null_Bounded_Wide_String, 5, Translate('a')) /=
- B10.To_Bounded_Wide_String(Translate("aaaaa")) or
- B10.Head(AtoE_Bnd_Str,
- B10.Length(AtoE_Bnd_Str)) /=
- AtoE_Bnd_Str
- then
- Report.Failed("Incorrect result from Function Head");
- end if;
-
-
-
- -- Function Tail with Truncation
- -- Drop = Error (Default Case)
-
- begin
- Result_String := B10.Tail(Source => AtoJ_Bnd_Str, -- max length
- Count => B10.Length(AtoJ_Bnd_Str) + 1,
- Pad => Ada.Strings.Wide_Space,
- Drop => Ada.Strings.Error);
- Report.Failed("Length_Error not raised by Function Tail");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed("Incorrect exception raised by Function Tail");
- end;
-
- -- Drop = Left
-
- -- Pad characters (5) are appended to the left end of the bounded wide
- -- string (which is initially at two less than its maximum length),
- -- then the first three characters of the intermediate result (in this
- -- case, 3 pad characters) are dropped.
-
- Result_String :=
- B10.Tail(B10.To_Bounded_Wide_String(Translate("ABCDEFGH")),
- 13,
- Translate('x'),
- Ada.Strings.Left);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Translate("xxABCDEFGH"))
- then
- Report.Failed("Incorrect result from Function Tail, Drop = Left");
- end if;
-
- -- Drop = Right
-
- -- Pad characters (3) are appended to the left end of the bounded wide
- -- string (which is initially at its maximum length), then the last
- -- three characters of the intermediate result are dropped.
-
- Result_String :=
- B10.Tail(B10.To_Bounded_Wide_String(Translate("ABCDEFGHIJ")),
- 13,
- Translate('x'),
- Ada.Strings.Right);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Translate("xxxABCDEFG"))
- then
- Report.Failed("Incorrect result from Function Tail, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Tail(B10.Null_Bounded_Wide_String, 3, Translate(' ')) /=
- B10.To_Bounded_Wide_String(Translate(" ")) or
- B10.Tail(AtoE_Bnd_Str,
- B10.To_Wide_String(AtoE_Bnd_Str)'First) /=
- B10.To_Bounded_Wide_String(Translate("e"))
- then
- Report.Failed("Incorrect result from Function Tail");
- end if;
-
-
-
- -- Function Replicate (#, Char) with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String := B10.Replicate(Count => B10.Max_Length + 5,
- Item => Translate('A'),
- Drop => AS.Error);
- Report.Failed
- ("Length_Error not raised by Replicate for characters");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Replicate for characters");
- end;
-
- -- Drop = Left, Right
- -- Since this version of Replicate uses wide character parameters, the
- -- result after truncation from left or right will appear the same.
- -- The result will be a 10 character bounded wide string, composed of
- -- 10 "Item" wide characters.
-
- if B10.Replicate(Count => 20,
- Item => Translate('A'),
- Drop => Ada.Strings.Left) /=
- B10.Replicate(15, Translate('A'), Ada.Strings.Right)
- then
- Report.Failed("Incorrect result from Replicate for characters - 1");
- end if;
-
- -- Blank-filled, 10 character bounded wide strings.
-
- if B10.Replicate(B10.Max_Length + 1,
- Translate(' '),
- Drop => Ada.Strings.Left) /=
- B10.Replicate(B10.Max_Length, Ada.Strings.Wide_Space)
- then
- Report.Failed("Incorrect result from Replicate for characters - 2");
- end if;
-
- -- Additional cases.
-
- if B10.Replicate(0, Translate('a')) /= B10.Null_Bounded_Wide_String or
- B10.Replicate(1, Translate('a')) /=
- B10.To_Bounded_Wide_String(Translate("a"))
- then
- Report.Failed("Incorrect result from Replicate for characters - 3");
- end if;
-
-
-
- -- Function Replicate (#, String) with Truncation
- -- Drop = Error (Default).
-
- begin
- Result_String := B10.Replicate(Count => 5, -- result would be 15.
- Item => Translate("abc"));
- Report.Failed
- ("Length_Error not raised by Replicate for wide strings");
- exception
- when AS.Length_Error => null; -- Expected exception raised.
- when others =>
- Report.Failed
- ("Incorrect exception raised by Replicate for wide strings");
- end;
-
- -- Drop = Left
-
- Result_String := B10.Replicate(3, Translate("abcd"), Ada.Strings.Left);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Translate("cdabcdabcd"))
- then
- Report.Failed
- ("Incorrect result from Replicate for wide strings, Drop = Left");
- end if;
-
- -- Drop = Right
-
- Result_String := B10.Replicate(3, Translate("abcd"), Ada.Strings.Right);
-
- if Result_String /=
- B10.To_Bounded_Wide_String(Translate("abcdabcdab")) then
- Report.Failed
- ("Incorrect result from Replicate for wide strings, Drop = Right");
- end if;
-
- -- Additional cases.
-
- if B10.Replicate(5, Translate("X")) /=
- B10.To_Bounded_Wide_String(Translate("XXXXX")) or
- B10.Replicate(10, "") /=
- B10.Null_Bounded_Wide_String or
- B10.Replicate(0, Translate("ab")) /=
- B10.Null_Bounded_Wide_String
- then
- Report.Failed("Incorrect result from Replicate for wide strings");
- end if;
-
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4020;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4021.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4021.a
deleted file mode 100644
index 345a77c68d0..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4021.a
+++ /dev/null
@@ -1,311 +0,0 @@
--- CXA4021.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package
--- Ada.Strings.Wide_Unbounded are available, and that they produce
--- correct results. Specifically, check the subprograms Head, Index,
--- Index_Non_Blank, Insert, Length, Overwrite, Replace_Slice, Slice,
--- Tail, To_Wide_String, To_Unbounded_Wide_String, "*", "&",
--- and "=", "<=", ">=".
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of many of the subprograms defined
--- in package Ada.Strings.Wide_Unbounded for use with unbounded wide
--- strings.
--- The test attempts to simulate how unbounded wide strings could be used
--- to simulate paragraphs of text. Modifications could be easily be
--- performed using the provided subprograms (although in this test, the
--- main modification performed was the addition of more text to the
--- string). One would not have to worry about the formatting of the
--- paragraph until it was finished and correct in content. Then, once
--- all required editing is complete, the unbounded strings can be divided
--- up into the appropriate lengths based on particular formatting
--- requirements. The test then compares the formatted text product
--- with a predefined "finished product".
---
--- This test attempts to use a large number of the subprograms provided
--- by package Ada.Strings.Wide_Unbounded. Often, the processing involved
--- could have been performed more efficiently using a minimum number
--- of the subprograms, in conjunction with loops, etc. However, for
--- testing purposes, and in the interest of minimizing the number of
--- tests developed, subprogram variety and feature mixing was stressed.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Report;
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Maps;
-with Ada.Strings.Wide_Unbounded;
-
-procedure CXA4021 is
-
- -- The following two functions are used to translate character and string
- -- values to "Wide" values. They will be applied to all the Wide_Bounded
- -- subprogram character and string parameters to simulate the use of non-
- -- character Wide_Characters and Wide_Strings in actual practice.
- -- Note: These functions do not actually return "equivalent" wide
- -- characters to their character inputs, just "non-character"
- -- wide characters.
-
- function Equiv (Ch : Character) return Wide_Character is
- C : Character := Ch;
- begin
- if Ch = ' ' then
- return Ada.Characters.Handling.To_Wide_Character(C);
- else
- return Wide_Character'Val(Character'Pos(Ch) +
- Character'Pos(Character'Last) + 1);
- end if;
- end Equiv;
-
-
- function Equiv (Str : String) return Wide_String is
- WS : Wide_String(Str'First..Str'Last);
- begin
- for i in Str'First..Str'Last loop
- WS(i) := Equiv(Str(i));
- end loop;
- return WS;
- end Equiv;
-
-begin
-
- Report.Test ("CXA4021", "Check that the subprograms defined in " &
- "package Ada.Strings.Wide_Unbounded are " &
- "available, and that they produce correct " &
- "results");
-
- Test_Block:
- declare
-
- package ASW renames Ada.Strings.Wide_Unbounded;
- use type ASW.Unbounded_Wide_String;
- use Ada.Strings;
-
- Pamphlet_Paragraph_Count : constant := 2;
- Lines : constant := 4;
- Line_Length : constant := 40;
-
- type Document_Type is array (Positive range <>)
- of ASW.Unbounded_Wide_String;
-
- type Camera_Ready_Copy_Type is array (1..Lines)
- of Wide_String (1..Line_Length);
-
- Pamphlet : Document_Type (1..Pamphlet_Paragraph_Count);
-
- Camera_Ready_Copy : Camera_Ready_Copy_Type :=
- (others => (others => Ada.Strings.Wide_Space));
-
- TC_Finished_Product : Camera_Ready_Copy_Type :=
- ( 1 => Equiv("Ada is a programming language designed "),
- 2 => Equiv("to support long-lived, reliable software"),
- 3 => Equiv(" systems. "),
- 4 => Equiv("Go with Ada! "));
-
- -----
-
-
- procedure Enter_Text_Into_Document (Document : in out Document_Type) is
- begin
-
- -- Fill in both "paragraphs" of the document. Each unbounded wide
- -- string functions as an individual paragraph, containing an
- -- unspecified number of characters.
- -- Use a variety of different unbounded wide string subprograms to
- -- load the data.
-
- Document(1) :=
- ASW.To_Unbounded_Wide_String(Equiv("Ada is a language"));
-
- -- Insert the word "programming" prior to "language".
- Document(1) :=
- ASW.Insert(Document(1),
- ASW.Index(Document(1),
- Equiv("language")),
- ASW.To_Wide_String(Equiv("progra") & -- Wd Str &
- ASW."*"(2,Equiv('m')) & -- Wd Unbd &
- Equiv("ing "))); -- Wd Str
-
-
- -- Overwrite the word "language" with "language" + additional text.
- Document(1) :=
- ASW.Overwrite(Document(1),
- ASW.Index(Document(1),
- ASW.To_Wide_String(
- ASW.Tail(Document(1), 8, Equiv(' '))),
- Ada.Strings.Backward),
- Equiv("language designed to support long-lifed"));
-
-
- -- Replace the word "lifed" with "lived".
- Document(1) :=
- ASW.Replace_Slice(Document(1),
- ASW.Index(Document(1), Equiv("lifed")),
- ASW.Length(Document(1)),
- Equiv("lived"));
-
-
- -- Overwrite the word "lived" with "lived" + additional text.
- Document(1) :=
- ASW.Overwrite(Document(1),
- ASW.Index(Document(1),
- ASW.To_Wide_String
- (ASW.Tail(Document(1), 5, Equiv(' '))),
- Ada.Strings.Backward),
- Equiv("lived, reliable software systems."));
-
-
- -- Use several of the overloaded versions of "&" to form this
- -- unbounded wide string.
-
- Document(2) := Equiv('G') &
- ASW.To_Unbounded_Wide_String(Equiv("o ")) &
- ASW.To_Unbounded_Wide_String(Equiv("with")) &
- Equiv(' ') &
- Equiv("Ada!");
-
- end Enter_Text_Into_Document;
-
-
- -----
-
-
- procedure Create_Camera_Ready_Copy
- (Document : in Document_Type;
- Camera_Copy : out Camera_Ready_Copy_Type) is
- begin
- -- Break the unbounded wide strings into fixed lengths.
-
- -- Search the first unbounded wide string for portions of text that
- -- are less than or equal to the length of a wide string in the
- -- Camera_Ready_Copy_Type object.
-
- Camera_Copy(1) := -- Take characters 1-39,
- ASW.Slice(Document(1), -- and append a blank space.
- 1,
- ASW.Index(ASW.To_Unbounded_Wide_String
- (ASW.Slice(Document(1),
- 1,
- Line_Length)),
- Ada.Strings.Wide_Maps.To_Set(Equiv(' ')),
- Ada.Strings.Inside,
- Ada.Strings.Backward)) & Equiv(' ');
-
- Camera_Copy(2) := -- Take characters 40-79.
- ASW.Slice(Document(1),
- 40,
- (ASW.Index_Non_Blank -- Should return 79
- (ASW.To_Unbounded_Wide_String
- (ASW.Slice(Document(1), -- Slice (40..79)
- 40,
- 79)),
- Ada.Strings.Backward) + 39)); -- Increment since
- -- this slice starts
- -- at 40.
-
- Camera_Copy(3)(1..9) := ASW.Slice(Document(1), -- Characters 80-88
- 80,
- ASW.Length(Document(1)));
-
-
- -- Break the second unbounded wide string into the appropriate
- -- length. It is only twelve characters in length, so the entire
- -- unbounded wide string will be placed on one string of the output
- -- object.
-
- Camera_Copy(4)(1..ASW.Length(Document(2))) :=
- ASW.To_Wide_String(ASW.Head(Document(2),
- ASW.Length(Document(2))));
-
- end Create_Camera_Ready_Copy;
-
-
- -----
-
-
- function Valid_Proofread (Draft, Master : Camera_Ready_Copy_Type)
- return Boolean is
- begin
-
- -- Evaluate wide strings for equality, using the operators defined
- -- in package Ada.Strings.Wide_Unbounded. The less than/greater
- -- than or equal comparisons should evaluate to "equals => True".
-
- if ASW.To_Unbounded_Wide_String(Draft(1)) = -- "="(WUnb,WUnb)
- ASW.To_Unbounded_Wide_String(Master(1)) and
- ASW.To_Unbounded_Wide_String(Draft(2)) <= -- "<="(WUnb,WUnb)
- ASW.To_Unbounded_Wide_String(Master(2)) and
- ASW.To_Unbounded_Wide_String(Draft(3)) >= -- ">="(WUnb,WUnb)
- ASW.To_Unbounded_Wide_String(Master(3)) and
- ASW.To_Unbounded_Wide_String(Draft(4)) = -- "="(WUnb,WUnb)
- ASW.To_Unbounded_Wide_String(Master(4))
- then
- return True;
- else
- return False;
- end if;
-
- end Valid_Proofread;
-
-
- -----
-
-
- begin
-
- -- Enter text into the unbounded wide string paragraphs of the document.
-
- Enter_Text_Into_Document (Pamphlet);
-
-
- -- Reformat the unbounded wide strings into fixed wide string format.
-
- Create_Camera_Ready_Copy (Document => Pamphlet,
- Camera_Copy => Camera_Ready_Copy);
-
-
- -- Verify the conversion process.
-
- if not Valid_Proofread (Draft => Camera_Ready_Copy,
- Master => TC_Finished_Product)
- then
- Report.Failed ("Incorrect unbounded wide string processing result");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4021;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4022.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4022.a
deleted file mode 100644
index 3c649a1a294..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4022.a
+++ /dev/null
@@ -1,531 +0,0 @@
--- CXA4022.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package
--- Ada.Strings.Wide_Unbounded are available, and that they produce
--- correct results. Specifically, check the subprograms Count, Element,
--- Index, Replace_Element, To_Unbounded_Wide_String, and "&", ">", "<".
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of many of the subprograms defined
--- in package Ada.Strings.Wide_Unbounded for use with unbounded wide
--- strings. The test simulates how unbounded wide strings
--- will be processed in a user environment, using the subprograms
--- provided in this package.
---
--- Taken in conjunction with tests CXA4021 and CXA4023, this test will
--- constitute a test of the functionality contained in package
--- Ada.Strings.Wide Unbounded. This test uses a variety
--- of the subprograms defined in the unbounded wide string package
--- in ways typical of common usage, with different combinations of
--- available subprograms being used to accomplish similar
--- unbounded wide string processing goals.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 08 Nov 95 SAIC Corrected accessibility level, type visibility,
--- and subtest acceptance criteria problems for
--- ACVC 2.0.1
---
---!
-
-with Ada.Characters.Handling;
-with Ada.Strings;
-
-package CXA40220 is
-
- -- The following two functions are used to translate character and string
- -- values to "Wide" values. They will be applied to all the Wide_Bounded
- -- subprogram character and string parameters to simulate the use of non-
- -- character Wide_Characters and Wide_Strings in actual practice.
- -- Note: These functions do not actually return "equivalent" wide
- -- characters to their character inputs, just "non-character"
- -- wide characters.
-
- function Equiv (Ch : Character) return Wide_Character;
-
- function Equiv (Str : String) return Wide_String;
-
-
- -- Functions and access-to-subprogram value used to supply mapping
- -- capability to the appropriate versions of Count, Index, and
- -- Translate.
-
- function AB_to_US_Mapping_Function (From : Wide_Character)
- return Wide_Character;
-
- function AB_to_Blank_Mapping_Function (From : Wide_Character)
- return Wide_Character;
-
-end CXA40220;
-
-package body CXA40220 is
-
- function Equiv (Ch : Character) return Wide_Character is
- C : Character := Ch;
- begin
- if Ch = ' ' then
- return Ada.Characters.Handling.To_Wide_Character(C);
- else
- return Wide_Character'Val(Character'Pos(Ch) +
- Character'Pos(Character'Last) + 1);
- end if;
- end Equiv;
-
-
- function Equiv (Str : String) return Wide_String is
- WS : Wide_String(Str'First..Str'Last);
- begin
- for i in Str'First..Str'Last loop
- WS(i) := Equiv(Str(i));
- end loop;
- return WS;
- end Equiv;
-
-
- function AB_to_US_Mapping_Function (From : Wide_Character)
- return Wide_Character is
- UnderScore : constant Wide_Character := Equiv('_');
- begin
- if From = Equiv('a') or From = Equiv('b') then
- return UnderScore;
- else
- return From;
- end if;
- end AB_to_US_Mapping_Function;
-
-
- function AB_to_Blank_Mapping_Function (From : Wide_Character)
- return Wide_Character is
- begin
- if From = Equiv('a') or From = Equiv('b') then
- return Ada.Strings.Wide_Space;
- else
- return From;
- end if;
- end AB_to_Blank_Mapping_Function;
-
-end CXA40220;
-
-
-with CXA40220;
-with Report;
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Maps;
-with Ada.Strings.Wide_Unbounded;
-
-procedure CXA4022 is
-begin
-
- Report.Test ("CXA4022", "Check that the subprograms defined in " &
- "package Ada.Strings.Wide_Unbounded are " &
- "available, and that they produce correct " &
- "results");
-
- Test_Block:
- declare
-
- use CXA40220;
-
- package ASW renames Ada.Strings.Wide_Unbounded;
- use Ada.Strings;
- use type Wide_Maps.Wide_Character_Set;
- use type ASW.Unbounded_Wide_String;
-
- Test_String : ASW.Unbounded_Wide_String;
- AtoE_Str : ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("abcde"));
-
- Complete_String : ASW.Unbounded_Wide_String :=
- ASW."&"(ASW.To_Unbounded_Wide_String(Equiv("Incomplete")),
- ASW."&"(Ada.Strings.Wide_Space,
- ASW.To_Unbounded_Wide_String(Equiv("String"))));
-
- Incomplete_String : ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String
- (Equiv("ncomplete Strin"));
-
- Incorrect_Spelling : ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("Guob Dai"));
-
- Magic_String : ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("abracadabra"));
-
- Incantation : ASW.Unbounded_Wide_String := Magic_String;
-
-
- A_Small_G : Wide_Character := Equiv('g');
- A_Small_D : Wide_Character := Equiv('d');
-
- ABCD_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Equiv("abcd"));
- B_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Equiv('b'));
- CD_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Equiv("cd"));
-
- CD_to_XY_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(From => Equiv("cd"),
- To => Equiv("xy"));
- AB_to_YZ_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(Equiv("ab"), Equiv("yz"));
-
-
- Matching_Letters : Natural := 0;
- Location,
- Total_Count : Natural := 0;
-
-
- Map_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- AB_to_US_Mapping_Function'Access;
-
-
- begin
-
-
- -- Function "&"
-
- -- Prepend an 'I' and append a 'g' to the wide string.
- Incomplete_String := ASW."&"(Equiv('I'),
- Incomplete_String); -- Ch & W Unb
- Incomplete_String := ASW."&"(Incomplete_String,
- A_Small_G); -- W Unb & Ch
-
- if ASW."<"(Incomplete_String, Complete_String) or
- ASW.">"(Incomplete_String, Complete_String) or
- Incomplete_String /= Complete_String
- then
- Report.Failed("Incorrect result from use of ""&"" operator");
- end if;
-
-
-
- -- Function Element
-
- -- Last element of the unbounded wide string should be a 'g'.
- if ASW.Element(Incomplete_String, ASW.Length(Incomplete_String)) /=
- A_Small_G
- then
- Report.Failed("Incorrect result from use of Function Element - 1");
- end if;
-
- if ASW.Element(Incomplete_String, 2) /=
- ASW.Element(ASW.Tail(Incomplete_String, 2), 1) or
- ASW.Element(ASW.Head(Incomplete_String, 4), 2) /=
- ASW.Element(ASW.To_Unbounded_Wide_String(Equiv("wnqz")), 2)
- then
- Report.Failed("Incorrect result from use of Function Element - 2");
- end if;
-
-
-
- -- Procedure Replace_Element
-
- -- The unbounded wide string Incorrect_Spelling starts as "Guob Dai",
- -- and is transformed by the following three procedure calls to
- -- "Good Day".
-
- ASW.Replace_Element(Incorrect_Spelling, 2, Equiv('o'));
-
- ASW.Replace_Element(Incorrect_Spelling,
- ASW.Index(Incorrect_Spelling, B_Set),
- A_Small_D);
-
- ASW.Replace_Element(Source => Incorrect_Spelling,
- Index => ASW.Length(Incorrect_Spelling),
- By => Equiv('y'));
-
- if Incorrect_Spelling /=
- ASW.To_Unbounded_Wide_String(Equiv("Good Day"))
- then
- Report.Failed("Incorrect result from Procedure Replace_Element");
- end if;
-
-
-
- -- Function Index with non-Identity map.
- -- Evaluate the function Index with a non-identity map
- -- parameter which will cause mapping of the source parameter
- -- prior to the evaluation of the index position search.
-
- Location := ASW.Index(Source => ASW.To_Unbounded_Wide_String
- (Equiv("abcdefghij")),
- Pattern => Equiv("xy"),
- Going => Ada.Strings.Forward,
- Mapping => CD_to_XY_Map); -- change "cd" to "xy"
-
- if Location /= 3 then
- Report.Failed("Incorrect result from Index, non-Identity map - 1");
- end if;
-
- Location := ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("abcdabcdab")),
- Equiv("yz"),
- Ada.Strings.Backward,
- AB_to_YZ_Map); -- change all "ab" to "yz"
-
- if Location /= 9 then
- Report.Failed("Incorrect result from Index, non-Identity map - 2");
- end if;
-
- -- A couple with identity maps (default) as well.
-
- if ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("abcd")), -- Pat = Src
- Equiv("abcd")) /= 1 or
- ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("abc")), -- Pat < Src
- Equiv("abcd")) /= 0 or
- ASW.Index(ASW.Null_Unbounded_Wide_String, -- Src = Null
- Equiv("abc")) /= 0
- then
- Report.Failed
- ("Incorrect result from Index with wide string patterns");
- end if;
-
-
-
- -- Function Index (for Sets).
- -- This version of Index uses Sets as the basis of the search.
-
- -- Test = Inside, Going = Forward (Default case).
- Location :=
- ASW.Index(Source => ASW.To_Unbounded_Wide_String(Equiv("abcdeabcde")),
- Set => CD_Set); -- set containing 'c' and 'd'
-
- if not (Location = 3) then -- position of first 'c' in source.
- Report.Failed("Incorrect result from Index using Sets - 1");
- end if;
-
- -- Test = Inside, Going = Backward.
- Location :=
- ASW.Index(Source => ASW."&"(AtoE_Str, AtoE_Str),
- Set => CD_Set, -- set containing 'c' and 'd'
- Test => Ada.Strings.Inside,
- Going => Ada.Strings.Backward);
-
- if not (Location = 9) then -- position of last 'd' in source.
- Report.Failed("Incorrect result from Index using Sets - 2");
- end if;
-
- -- Test = Outside, Going = Forward, Backward
- if ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("deddacd")),
- Wide_Maps.To_Set(Equiv("xydcgf")),
- Test => Ada.Strings.Outside,
- Going => Ada.Strings.Forward) /= 2 or
- ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("deddacd")),
- Wide_Maps.To_Set(Equiv("xydcgf")),
- Test => Ada.Strings.Outside,
- Going => Ada.Strings.Backward) /= 5 or
- ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("deddacd")),
- CD_Set,
- Ada.Strings.Outside,
- Ada.Strings.Backward) /= 5
- then
- Report.Failed("Incorrect result from Index using Sets - 3");
- end if;
-
- -- Default direction (forward) and mapping (identity).
-
- if ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("cd")), -- Source = Set
- CD_Set) /= 1 or
- ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("c")), -- Source < Set
- CD_Set) /= 1 or
- ASW.Index(ASW.Null_Unbounded_Wide_String, -- Source = Null
- CD_Set) /= 0 or
- ASW.Index(AtoE_Str,
- Wide_Maps.Null_Set) /= 0 or -- Null set
- ASW.Index(AtoE_Str,
- Wide_Maps.To_Set(Equiv('x'))) /= 0 -- No match.
- then
- Report.Failed("Incorrect result from Index using Sets - 4");
- end if;
-
-
-
- -- Function Index using access-to-subprogram mapping.
- -- Evaluate the function Index with an access value that supplies the
- -- mapping function for this version of Index.
-
- Map_Ptr := AB_to_US_Mapping_Function'Access;
-
- Location := ASW.Index(Source => ASW.To_Unbounded_Wide_String
- (Equiv("xAxabbxax xaax _cx")),
- Pattern => Equiv("_x"),
- Going => Ada.Strings.Forward,
- Mapping => Map_Ptr); -- change 'a'or 'b' to '_'
-
- if Location /= 6 then -- location of "bx" substring
- Report.Failed("Incorrect result from Index, access value map - 1");
- end if;
-
- Map_Ptr := AB_to_Blank_Mapping_Function'Access;
-
- Location := ASW.Index(ASW.To_Unbounded_Wide_String
- (Equiv("ccacdcbbcdacc")),
- Equiv("cd "),
- Ada.Strings.Backward,
- Map_Ptr); -- change 'a' or 'b' to ' '
-
- if Location /= 9 then
- Report.Failed("Incorrect result from Index, access value map - 2");
- end if;
-
- if ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("abcd")),
- Equiv(" cd"),
- Ada.Strings.Forward,
- Map_Ptr) /= 1 or
- ASW.Index(ASW.To_Unbounded_Wide_String(Equiv("abc")),
- Equiv(" c "), -- No match
- Ada.Strings.Backward,
- Map_Ptr) /= 0
- then
- Report.Failed("Incorrect result from Index, access value map - 3");
- end if;
-
-
-
- -- Function Count
-
- -- Determine the number of characters in the unbounded wide string that
- -- are contained in the set.
-
- Matching_Letters := ASW.Count(Source => Magic_String,
- Set => ABCD_Set);
-
- if Matching_Letters /= 9 then
- Report.Failed
- ("Incorrect result from Function Count with Set parameter");
- end if;
-
- -- Determine the number of occurrences of the following pattern wide
- -- strings in the unbounded wide string Magic_String.
-
- if ASW.Count(Magic_String, Equiv("ab")) /=
- (ASW.Count(Magic_String, Equiv("ac")) +
- ASW.Count(Magic_String, Equiv("ad"))) or
- ASW.Count(Magic_String, Equiv("ab")) /= 2
- then
- Report.Failed
- ("Incorrect result from Function Count, wide string parameter");
- end if;
-
-
-
- -- Function Count with non-Identity mapping.
- -- Evaluate the function Count with a non-identity map
- -- parameter which will cause mapping of the source parameter
- -- prior to the evaluation of the number of matching patterns.
-
- Total_Count :=
- ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("abbabbabbabba")),
- Pattern => Equiv("yz"),
- Mapping => AB_to_YZ_Map);
-
- if Total_Count /= 4 then
- Report.Failed
- ("Incorrect result from function Count, non-Identity map - 1");
- end if;
-
- if ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("ADCBADABCD")),
- Equiv("AB"),
- Wide_Maps.To_Mapping(Equiv("CD"), Equiv("AB"))) /= 5 or
- ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("dcccddcdccdddccccd")),
- Equiv("xxy"),
- CD_to_XY_Map) /= 3
- then
- Report.Failed
- ("Incorrect result from function Count, non-Identity map - 2");
- end if;
-
- -- And a few with identity Wide_Maps as well.
-
- if ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("ABABABABAB")),
- Equiv("ABA"),
- Wide_Maps.Identity) /= 2 or
- ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("aaaaaaaaaa")),
- Equiv("aaa")) /= 3 or
- ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("XX")), -- Src < Pat
- Equiv("XXX"),
- Wide_Maps.Identity) /= 0 or
- ASW.Count(AtoE_Str, -- Source = Pattern
- Equiv("abcde")) /= 1 or
- ASW.Count(ASW.Null_Unbounded_Wide_String, -- Source = Null
- Equiv(" ")) /= 0
- then
- Report.Failed
- ("Incorrect result from function Count, w,w/o mapping");
- end if;
-
-
-
- -- Function Count using access-to-subprogram mapping.
- -- Evaluate the function Count with an access value specifying the
- -- mapping that is going to occur to Source.
-
- Map_Ptr := AB_to_US_Mapping_Function'Access;
-
- Total_Count :=
- ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("abcbacbadbaAbbB")),
- Pattern => Equiv("__"),
- Mapping => Map_Ptr); -- change 'a' and 'b' to '_'
-
- if Total_Count /= 5 then
- Report.Failed
- ("Incorrect result from function Count, access value map - 1");
- end if;
-
- Map_Ptr := AB_to_Blank_Mapping_Function'Access;
-
- if ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("cccaccBcbcaccacAc")),
- Equiv("c c"),
- Map_Ptr) /= 3 or
- ASW.Count(ASW.To_Unbounded_Wide_String
- (Equiv("aBBAAABaBBBBAaBABBABaBBbBB")),
- Equiv(" BB"),
- Map_Ptr) /= 4 or
- ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("aaaaaaaaaa")),
- Equiv(" "),
- Map_Ptr) /= 3 or
- ASW.Count(ASW.To_Unbounded_Wide_String(Equiv("XX")), -- Src < Pat
- Equiv("XX "),
- Map_Ptr) /= 0 or
- ASW.Count(AtoE_Str, -- Source'Length = Pattern'Length
- Equiv(" cde"),
- Map_Ptr) /= 1
- then
- Report.Failed
- ("Incorrect result from function Count, access value map - 3");
- end if;
-
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4022;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4023.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4023.a
deleted file mode 100644
index d0325fc88ec..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4023.a
+++ /dev/null
@@ -1,585 +0,0 @@
--- CXA4023.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package
--- Ada.Strings.Wide_Unbounded are available, and that they produce
--- correct results. Specifically, check the subprograms Delete,
--- Find_Token, Translate, Trim, and "*".
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of many of the subprograms defined
--- in package Ada.Strings.Wide_Unbounded for use with unbounded wide
--- strings. The test simulates how unbounded wide strings
--- will be processed in a user environment, using the subprograms
--- provided in this package.
---
--- This test, when taken in conjunction with tests CXA4021-22, will
--- constitute a test of the functionality contained in package
--- Ada.Strings.Wide_Unbounded. This test uses a variety
--- of the subprograms defined in the unbounded wide string package
--- in ways typical of common usage, with different combinations of
--- available subprograms being used to accomplish similar
--- unbounded wide string processing goals.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 08 Nov 95 SAIC Corrected accessibility level and type
--- visibility problems for ACVC 2.0.1.
---
---!
-
-with Ada.Characters.Handling;
-with Ada.Strings;
-
-package CXA40230 is
-
- -- The following two functions are used to translate character and string
- -- values to non-character "Wide" values. They will be applied to all the
- -- Wide_Bounded subprogram character and string parameters to simulate the
- -- use of Wide_Characters and Wide_Strings in actual practice.
- -- Note: These functions do not actually return "equivalent" wide
- -- characters to their character inputs, just "non-character"
- -- wide characters.
-
- function Equiv (Ch : Character) return Wide_Character;
-
- function Equiv (Str : String) return Wide_String;
-
- -- Functions and access-to-subprogram object used to supply mapping
- -- capability to the appropriate versions of Translate.
-
- function AB_to_US_Mapping_Function (From : Wide_Character)
- return Wide_Character;
-
- function AB_to_Blank_Mapping_Function (From : Wide_Character)
- return Wide_Character;
-
-end CXA40230;
-
-
-package body CXA40230 is
-
- function Equiv (Ch : Character) return Wide_Character is
- C : Character := Ch;
- begin
- if Ch = ' ' then
- return Ada.Characters.Handling.To_Wide_Character(C);
- else
- return Wide_Character'Val(Character'Pos(Ch) +
- Character'Pos(Character'Last) + 1);
- end if;
- end Equiv;
-
-
- function Equiv (Str : String) return Wide_String is
- WS : Wide_String(Str'First..Str'Last);
- begin
- for i in Str'First..Str'Last loop
- WS(i) := Equiv(Str(i));
- end loop;
- return WS;
- end Equiv;
-
-
- function AB_to_US_Mapping_Function (From : Wide_Character)
- return Wide_Character is
- UnderScore : constant Wide_Character := Equiv('_');
- begin
- if From = Equiv('a') or From = Equiv('b') then
- return UnderScore;
- else
- return From;
- end if;
- end AB_to_US_Mapping_Function;
-
-
- function AB_to_Blank_Mapping_Function (From : Wide_Character)
- return Wide_Character is
- begin
- if From = Equiv('a') or From = Equiv('b') then
- return Ada.Strings.Wide_Space;
- else
- return From;
- end if;
- end AB_to_Blank_Mapping_Function;
-
-end CXA40230;
-
-
-with CXA40230;
-with Report;
-with Ada.Characters.Handling;
-with Ada.Strings.Wide_Maps;
-with Ada.Strings.Wide_Unbounded;
-
-procedure CXA4023 is
-begin
-
- Report.Test ("CXA4023", "Check that the subprograms defined in " &
- "package Ada.Strings.Wide_Unbounded are " &
- "available, and that they produce correct " &
- "results");
-
- Test_Block:
- declare
-
- use CXA40230;
-
- package ASW renames Ada.Strings.Wide_Unbounded;
- use Ada.Strings;
- use type Wide_Maps.Wide_Character_Set;
- use type ASW.Unbounded_Wide_String;
-
- Test_String : ASW.Unbounded_Wide_String;
- AtoE_Str : ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("abcde"));
-
- Cad_String : ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("cad"));
-
- Magic_String : ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("abracadabra"));
-
- Incantation : ASW.Unbounded_Wide_String := Magic_String;
-
-
- A_Small_G : Wide_Character := Equiv('g');
-
- ABCD_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Equiv("abcd"));
- B_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Equiv('b'));
- AB_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps."OR"(Wide_Maps.To_Set(Equiv('a')), B_Set);
-
-
- AB_to_YZ_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(From => Equiv("ab"),
- To => Equiv("yz"));
- Code_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(Equiv("abcd"), Equiv("wxyz"));
- Reverse_Code_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(Equiv("wxyz"), Equiv("abcd"));
- Non_Existent_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(Equiv("jkl"), Equiv("mno"));
-
-
- Token_Start : Positive;
- Token_End : Natural := 0;
-
- Map_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- AB_to_US_Mapping_Function'Access;
-
-
- begin
-
- -- Find_Token
-
- ASW.Find_Token(Magic_String, -- Find location of first "ab" equiv.
- AB_Set, -- Should be (1..2).
- Ada.Strings.Inside,
- Token_Start,
- Token_End);
-
- if Natural(Token_Start) /= ASW.To_Wide_String(Magic_String)'First or
- Token_End /= ASW.Index(Magic_String, B_Set) or
- Token_End /= 2
- then
- Report.Failed("Incorrect result from Procedure Find_Token - 1");
- end if;
-
-
- ASW.Find_Token(Source => Magic_String, -- Find location of char 'r'equiv
- Set => ABCD_Set, -- in wide str, should be (3..3)
- Test => Ada.Strings.Outside,
- First => Token_Start,
- Last => Token_End);
-
- if Natural(Token_Start) /= 3 or Token_End /= 3 then
- Report.Failed("Incorrect result from Procedure Find_Token - 2");
- end if;
-
-
- ASW.Find_Token(Magic_String, -- No 'g' "equivalent in
- Wide_Maps.To_Set(A_Small_G), -- the wide str, so the
- Ada.Strings.Inside, -- result params should be
- First => Token_Start, -- First = Source'First and
- Last => Token_End); -- Last = 0.
-
-
- if Token_Start /= ASW.To_Wide_String(Magic_String)'First or
- Token_End /= 0
- then
- Report.Failed("Incorrect result from Procedure Find_Token - 3");
- end if;
-
-
- ASW.Find_Token(ASW.To_Unbounded_Wide_String(Equiv("abpqpqrttrcpqr")),
- Wide_Maps.To_Set(Equiv("trpq")),
- Ada.Strings.Inside,
- Token_Start,
- Token_End);
-
- if Token_Start /= 3 or
- Token_End /= 10
- then
- Report.Failed("Incorrect result from Procedure Find_Token - 4");
- end if;
-
- ASW.Find_Token(ASW.To_Unbounded_Wide_String(Equiv("abpqpqrttrcpqr")),
- Wide_Maps.To_Set(Equiv("abpq")),
- Ada.Strings.Outside,
- Token_Start,
- Token_End);
-
- if Token_Start /= 7 or
- Token_End /= 11
- then
- Report.Failed("Incorrect result from Procedure Find_Token - 5");
- end if;
-
-
-
- -- Translate
-
- -- Use a mapping ("abcd" -> "wxyz") to transform the contents of
- -- the unbounded wide string.
- -- Magic_String = "abracadabra"
-
- Incantation := ASW.Translate(Magic_String, Code_Map);
-
- if Incantation /=
- ASW.To_Unbounded_Wide_String(Equiv("wxrwywzwxrw"))
- then
- Report.Failed("Incorrect result from Function Translate - 1");
- end if;
-
- -- (Note: See below for additional testing of Function Translate)
-
- -- Use the inverse mapping of the one above to return the "translated"
- -- unbounded wide string to its original form.
-
- ASW.Translate(Incantation, Reverse_Code_Map);
-
- -- The map contained in the following call to Translate contains three
- -- elements, and these elements are not found in the unbounded wide
- -- string, so this call to Translate should have no effect on it.
-
- if Incantation /= ASW.Translate(Magic_String, Non_Existent_Map) then
- Report.Failed("Incorrect result from Procedure Translate - 1");
- end if;
-
- -- Partial mapping of source.
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("abcdeabcab"));
-
- ASW.Translate(Source => Test_String, Mapping => AB_to_YZ_Map);
-
- if Test_String /= ASW.To_Unbounded_Wide_String(Equiv("yzcdeyzcyz")) then
- Report.Failed("Incorrect result from Procedure Translate - 2");
- end if;
-
- -- Total mapping of source.
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("abbaaababb"));
-
- ASW.Translate(Source => Test_String, Mapping => AB_to_YZ_Map);
-
- if Test_String /= ASW.To_Unbounded_Wide_String(Equiv("yzzyyyzyzz")) then
- Report.Failed("Incorrect result from Procedure Translate - 3");
- end if;
-
- -- No mapping of source.
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("xyzsypcc"));
-
- ASW.Translate(Source => Test_String, Mapping => AB_to_YZ_Map);
-
- if Test_String /= ASW.To_Unbounded_Wide_String(Equiv("xyzsypcc")) then
- Report.Failed("Incorrect result from Procedure Translate - 4");
- end if;
-
- -- Map > 2 characters, partial mapping.
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("opabcdelmn"));
-
- ASW.Translate(Test_String,
- Wide_Maps.To_Mapping(Equiv("abcde"), Equiv("lmnop")));
-
- if Test_String /= ASW.To_Unbounded_Wide_String(Equiv("oplmnoplmn")) then
- Report.Failed("Incorrect result from Procedure Translate - 5");
- end if;
-
-
-
- -- Various degrees of mapping of source (full, partial, none) used
- -- with Function Translate.
-
- if ASW.Translate(
- ASW.To_Unbounded_Wide_String(Equiv("abcdeabcabbbaaacaa")),
- AB_to_YZ_Map) /=
- ASW.To_Unbounded_Wide_String(Equiv("yzcdeyzcyzzzyyycyy")) or
-
- ASW.Translate(
- ASW.To_Unbounded_Wide_String(Equiv("abbaaababbaaaaba")),
- AB_to_YZ_Map) /=
- ASW.To_Unbounded_Wide_String(Equiv("yzzyyyzyzzyyyyzy")) or
-
- ASW.Translate(ASW.To_Unbounded_Wide_String(Equiv("cABcABBAc")),
- Mapping => AB_to_YZ_Map) /=
- ASW.To_Unbounded_Wide_String(Equiv("cABcABBAc")) or
-
- ASW.Translate(ASW.To_Unbounded_Wide_String("opabcdelmnddeaccabec"),
- Wide_Maps.To_Mapping("abcde", "lmnop")) /=
- ASW.To_Unbounded_Wide_String("oplmnoplmnooplnnlmpn")
- then
- Report.Failed("Incorrect result from Function Translate - 2");
- end if;
-
-
-
- -- Procedure Translate using access-to-subprogram mapping.
- -- Partial mapping of source.
-
- Map_Ptr := AB_to_Blank_Mapping_Function'Access;
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("abABaABbaBAbba"));
-
- ASW.Translate(Source => Test_String, -- change equivalent of 'a' and
- Mapping => Map_Ptr); -- 'b' to ' '
-
- if Test_String /=
- ASW.To_Unbounded_Wide_String(Equiv(" AB AB BA "))
- then
- Report.Failed
- ("Incorrect result from Proc Translate, w/ access value map - 1");
- end if;
-
- -- Total mapping of source to blanks.
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("abbbab"));
-
- ASW.Translate(Source => Test_String,
- Mapping => Map_Ptr);
-
- if Test_String /=
- ASW.To_Unbounded_Wide_String(Equiv(" "))
- then
- Report.Failed
- ("Incorrect result from Proc Translate, w/ access value map - 2");
- end if;
-
- -- No mapping of source.
-
- Map_Ptr := AB_to_US_Mapping_Function'Access;
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("xyzsypcc"));
-
- ASW.Translate(Source => Test_String,
- Mapping => Map_Ptr);
-
- if Test_String /=
- ASW.To_Unbounded_Wide_String(Equiv("xyzsypcc")) -- no change
- then
- Report.Failed
- ("Incorrect result from Proc Translate, w/ access value map - 3");
- end if;
-
-
- -- Function Translate using access-to-subprogram mapping value.
-
- Map_Ptr := AB_to_Blank_Mapping_Function'Access;
-
- Test_String := ASW.To_Unbounded_Wide_String(Equiv("abAbBBAabbacD"));
-
- if ASW.Translate(ASW.Translate(Test_String, Map_Ptr), Map_Ptr) /=
- ASW.To_Unbounded_Wide_String(Equiv(" A BBA cD"))
- then
- Report.Failed
- ("Incorrect result from Function Translate, access value map - 1");
- end if;
-
- if ASW.Translate(Source => ASW.To_Unbounded_Wide_String(Equiv("a")),
- Mapping => Map_Ptr) /=
- ASW.To_Unbounded_Wide_String(Equiv(" ")) or
- ASW.Translate(ASW.To_Unbounded_Wide_String
- (Equiv(" aa Aa A AAaaa a aA")),
- Map_Ptr) /=
- ASW.To_Unbounded_Wide_String(Equiv(" A A AA A")) or
- ASW.Translate(Source => ASW.To_Unbounded_Wide_String(Equiv("a ")),
- Mapping => Map_Ptr) /=
- ASW.To_Unbounded_Wide_String(Equiv(" ")) or
- ASW.Translate(Source => ASW.To_Unbounded_Wide_String(Equiv("xyz")),
- Mapping => Map_Ptr) /=
- ASW.To_Unbounded_Wide_String(Equiv("xyz"))
- then
- Report.Failed
- ("Incorrect result from Function Translate, access value map - 2");
- end if;
-
-
-
- -- Trim
-
- Trim_Block:
- declare
-
- XYZ_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Equiv("xyz"));
- PQR_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Equiv("pqr"));
-
- Pad : constant ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("Pad"));
-
- The_New_Ada : constant ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("Ada9X"));
-
- Space_Array : array (1..4) of ASW.Unbounded_Wide_String :=
- (ASW.To_Unbounded_Wide_String(Equiv(" Pad ")),
- ASW.To_Unbounded_Wide_String(Equiv("Pad ")),
- ASW.To_Unbounded_Wide_String(Equiv(" Pad")),
- Pad);
-
- String_Array : array (1..5) of ASW.Unbounded_Wide_String :=
- (ASW.To_Unbounded_Wide_String(Equiv("xyzxAda9Xpqr")),
- ASW.To_Unbounded_Wide_String(Equiv("Ada9Xqqrp")),
- ASW.To_Unbounded_Wide_String(Equiv("zxyxAda9Xqpqr")),
- ASW.To_Unbounded_Wide_String(Equiv("xxxyAda9X")),
- The_New_Ada);
-
- begin
-
- -- Examine the version of Trim that removes blanks from
- -- the left and/or right of a wide string.
-
- for i in 1..4 loop
- if ASW.Trim(Space_Array(i), Ada.Strings.Both) /= Pad then
- Report.Failed("Incorrect result from Trim for spaces - " &
- Integer'Image(i));
- end if;
- end loop;
-
- -- Examine the version of Trim that removes set characters from
- -- the left and right of a wide string.
-
- for i in 1..5 loop
- if ASW.Trim(String_Array(i),
- Left => XYZ_Set,
- Right => PQR_Set) /= The_New_Ada then
- Report.Failed
- ("Incorrect result from Trim for set characters - " &
- Integer'Image(i));
- end if;
- end loop;
-
- -- No trimming.
-
- if ASW.Trim(
- ASW.To_Unbounded_Wide_String(Equiv("prqqprAda9Xyzzxyzzyz")),
- XYZ_Set,
- PQR_Set) /=
- ASW.To_Unbounded_Wide_String(Equiv("prqqprAda9Xyzzxyzzyz"))
- then
- Report.Failed
- ("Incorrect result from Trim for set, no trimming");
- end if;
-
- end Trim_Block;
-
-
-
- -- Delete
-
- -- Use the Delete function to remove the first four and last four
- -- characters from the wide string.
-
- if ASW.Delete(Source => ASW.Delete(Magic_String,
- 8,
- ASW.Length(Magic_String)),
- From => ASW.To_Wide_String(Magic_String)'First,
- Through => 4) /=
- Cad_String
- then
- Report.Failed("Incorrect results from Function Delete");
- end if;
-
-
-
- -- Constructors ("*")
-
- Constructor_Block:
- declare
-
- SOS : ASW.Unbounded_Wide_String;
-
- Dot : constant ASW.Unbounded_Wide_String :=
- ASW.To_Unbounded_Wide_String(Equiv("Dot_"));
- Dash : constant Wide_String := Equiv("Dash_");
-
- Distress : ASW.Unbounded_Wide_String :=
- ASW."&"(ASW.To_Unbounded_Wide_String
- (Equiv("Dot_Dot_Dot_")),
- ASW."&"(ASW.To_Unbounded_Wide_String
- (Equiv("Dash_Dash_Dash_")),
- ASW.To_Unbounded_Wide_String
- (Equiv("Dot_Dot_Dot"))));
-
- Repeat : constant Natural := 3;
- Separator : constant Wide_Character := Equiv('_');
-
- Separator_Set : Wide_Maps.Wide_Character_Set :=
- Wide_Maps.To_Set(Separator);
-
- begin
-
- -- Use the following constructor forms to construct the wide string
- -- "Dot_Dot_Dot_Dash_Dash_Dash_Dot_Dot_Dot". Note that the
- -- trailing underscore in the wide string is removed in the call to
- -- Trim in the If statement condition.
-
- SOS := ASW."*"(Repeat, Dot); -- "*"(#, W Unb Str)
-
- SOS := ASW."&"(SOS,
- ASW."&"(ASW."*"(Repeat, Dash), -- "*"(#, W Str)
- ASW."*"(Repeat, Dot))); -- "*"(#, W Unb Str)
-
- if ASW.Trim(SOS, Wide_Maps.Null_Set, Separator_Set) /= Distress then
- Report.Failed("Incorrect results from Function ""*""");
- end if;
-
- end Constructor_Block;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4023;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4024.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4024.a
deleted file mode 100644
index 1b0af9ce978..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4024.a
+++ /dev/null
@@ -1,350 +0,0 @@
--- CXA4024.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the function "-", To_Ranges, To_Domain, and To_Range are
--- available in the package Ada.Strings.Maps, and that they produce
--- correct results based on the Character_Set/Character_Mapping input
--- provided.
---
--- TEST DESCRIPTION:
--- This test examines the operation of four functions from within the
--- Ada.Strings.Maps package. A variety of Character_Sequence,
--- Character_Set, and Character_Mapping objects are created and
--- initialized for use with these functions. In each subtest of
--- function operation, specific inputs are provided to the functions as
--- input parameters, and the results are evaluated against expected
--- values. Wherever appropriate, additional characteristics of the
--- function results are verified against the prescribed result
--- characteristics.
---
---
--- CHANGE HISTORY:
--- 03 Feb 95 SAIC Initial prerelease version
--- 10 Mar 95 SAIC Incorporated reviewer comments.
--- 15 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 05 Oct 96 SAIC Incorporated reviewer comments for ACVC 2.1.
---
---!
-
-with Ada.Strings.Maps;
-with Ada.Strings.Maps.Constants;
-with Ada.Characters.Latin_1;
-with Report;
-
-procedure CXA4024 is
-
-begin
-
- Report.Test ("CXA4024", "Check that the function ""-"", To_Ranges, " &
- "To_Domain, and To_Range are available in " &
- "the package Ada.Strings.Maps, and that " &
- "they produce correct results");
-
- Test_Block:
- declare
-
- use Ada.Strings, Ada.Strings.Maps;
- use type Maps.Character_Set; -- To allow logical set operator
- -- infix notation.
- package ACL1 renames Ada.Characters.Latin_1;
-
- MidPoint_Letter : constant := 13;
- Last_Letter : constant := 26;
-
- Vowels : constant Maps.Character_Sequence := "aeiou";
- Quasi_Vowel : constant Character := 'y';
-
- Alphabet : Maps.Character_Sequence (1..Last_Letter);
- Half_Alphabet : Maps.Character_Sequence (1..MidPoint_Letter);
-
- Alphabet_Set,
- Consonant_Set,
- Vowel_Set,
- First_Half_Set,
- Second_Half_Set : Maps.Character_Set;
-
-
- begin
-
- -- Load the alphabet strings for use in creating sets.
- for i in 0..12 loop
- Half_Alphabet(i+1) := Character'Val(Character'Pos('a') + i);
- end loop;
-
- for i in 0..25 loop
- Alphabet(i+1) := Character'Val(Character'Pos('a') + i);
- end loop;
-
- -- Initialize a series of Character_Set objects.
-
- Alphabet_Set := Maps.To_Set(Alphabet);
- Vowel_Set := Maps.To_Set(Vowels);
- Consonant_Set := Vowel_Set XOR Alphabet_Set;
- First_Half_Set := Maps.To_Set(Half_Alphabet);
- Second_Half_Set := Alphabet_Set XOR First_Half_Set;
-
-
-
- -- Evaluation of Set operator "-".
-
- if Consonant_Set /= "-"(Alphabet_Set, Vowel_Set) or
- Vowel_Set /= (Alphabet_Set - Consonant_Set) or
- Alphabet_Set /= Alphabet_Set - Maps.Null_Set or
- First_Half_Set /= "-"(Alphabet_Set, Second_Half_Set) or
- (Alphabet_Set - Vowel_Set) /= "AND"(Alphabet_Set, "NOT"(Vowel_Set))
- then
- Report.Failed("Incorrect result from ""-"" operator for sets");
- end if;
-
-
-
- -- Evaluation of Function "To_Ranges".
-
- declare
-
- use type Maps.Character_Range;
- use type Maps.Character_Ranges;
-
- Set_A_to_C : Maps.Character_Set := Maps.To_Set("ABC");
- Set_J : Maps.Character_Set := Maps.To_Set("J");
- Set_M_to_P : Maps.Character_Set := Maps.To_Set("MNOP");
- Set_X_to_Z : Maps.Character_Set := Maps.To_Set("XYZ");
- Set_Of_Five : Maps.Character_Set := Set_A_to_C OR -- Union of the
- Set_M_to_P OR -- five sets.
- Set_X_to_Z OR
- Set_J OR
- Maps.Null_Set;
-
- TC_Range_A_to_C : Maps.Character_Range := (Low => 'A', High => 'C');
- TC_Range_J : Maps.Character_Range := ('J', 'J');
- TC_Range_M_to_P : Maps.Character_Range := ('M', 'P');
- TC_Range_X_to_Z : Maps.Character_Range := (Low => 'X', High => 'Z');
-
- TC_Ranges : Maps.Character_Ranges (1..4) :=
- (1 => TC_Range_A_to_C,
- 2 => TC_Range_J,
- 3 => TC_Range_M_to_P,
- 4 => TC_Range_X_to_Z);
-
- begin
-
- -- Based on input of a set containing four separate "spans" of
- -- character sequences, Function To_Ranges is required to produce
- -- the shortest array of contiguous ranges of Character values in
- -- the input set, in increasing order of Low.
-
- declare
-
- -- This Character_Ranges constant should consist of array
- -- components, each component being a Character_Range from Low
- -- to High containing the appropriate characters.
-
- Ranges_Result : constant Maps.Character_Ranges :=
- Maps.To_Ranges(Set => Set_Of_Five);
- begin
-
- -- Check the structure and components of the Character_Ranges
- -- constant.
-
- if Ranges_Result(1) /= TC_Range_A_to_C or
- Ranges_Result(1).Low /= TC_Ranges(1).Low or
- Ranges_Result(2) /= TC_Range_J or
- Ranges_Result(2).High /= TC_Ranges(2).High or
- Ranges_Result(3) /= TC_Range_M_to_P or
- Ranges_Result(3).Low /= TC_Ranges(3).Low or
- Ranges_Result(3).High /= TC_Ranges(3).High or
- Ranges_Result(4) /= TC_Range_X_To_Z or
- Ranges_Result(4).Low /= TC_Ranges(4).Low or
- Ranges_Result(4).High /= TC_Ranges(4).High
- then
- Report.Failed ("Incorrect structure or components in " &
- "Character_Ranges constant");
- end if;
-
- exception
- when others =>
- Report.Failed("Exception raised using the Function To_Ranges " &
- "to initialize a Character_Ranges constant");
- end;
- end;
-
-
-
- -- Evaluation of Functions To_Domain and To_Range.
-
- declare
-
- Null_Sequence : constant Maps.Character_Sequence := "";
-
- TC_Upper_Case_Sequence : constant Maps.Character_Sequence :=
- "ZYXWVUTSRQPONMABCDEFGHIJKL";
- TC_Lower_Case_Sequence : constant Maps.Character_Sequence :=
- "zyxwvutsrqponmabcdefghijkl";
- TC_Unordered_Sequence : Maps.Character_Sequence(1..6) :=
- "BxACzy";
-
- TC_Upper_to_Lower_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(TC_Upper_Case_Sequence,
- TC_Lower_Case_Sequence);
-
- TC_Lower_to_Upper_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(TC_Lower_Case_Sequence,
- TC_Upper_Case_Sequence);
-
- TC_Unordered_Map : Maps.Character_Mapping :=
- Maps.To_Mapping(TC_Unordered_Sequence,
- "ikglja");
- begin
-
- declare
-
- TC_Domain_1 : constant Maps.Character_Sequence :=
- Maps.To_Domain(TC_Upper_to_Lower_Map);
-
- TC_Domain_2 : constant Maps.Character_Sequence :=
- Maps.To_Domain(TC_Lower_to_Upper_Map);
-
- TC_Domain_3 : Maps.Character_Sequence(1..6);
-
- TC_Range_1 : constant Maps.Character_Sequence :=
- Maps.To_Range(TC_Upper_to_Lower_Map);
-
- TC_Range_2 : constant Maps.Character_Sequence :=
- Maps.To_Range(TC_Lower_to_Upper_Map);
-
- TC_Range_3 : Maps.Character_Sequence(1..6);
-
- begin
-
- -- Function To_Domain returns the shortest Character_Sequence
- -- value such that each character not in the result maps to
- -- itself, and all characters in the result are in ascending
- -- order.
-
- TC_Domain_3 := Maps.To_Domain(TC_Unordered_Map);
-
- -- Check contents of result of To_Domain, must be in ascending
- -- order.
-
- if TC_Domain_1 /= "ABCDEFGHIJKLMNOPQRSTUVWXYZ" then
- Report.Failed("Incorrect result from To_Domain with " &
- "TC_Upper_to_Lower_Map as input");
- end if;
-
- if TC_Domain_2 /= "abcdefghijklmnopqrstuvwxyz" then
- Report.Failed("Incorrect result from To_Domain with " &
- "TC_Lower_to_Upper_Map as input");
- end if;
-
- if TC_Domain_3 /= "ABCxyz" then
- Report.Failed("Incorrect result from To_Domain with " &
- "an unordered mapping as input");
- end if;
-
-
- -- The lower bound on the returned Character_Sequence value
- -- from To_Domain must be 1.
-
- if TC_Domain_1'First /= 1 or
- TC_Domain_2'First /= 1 or
- TC_Domain_3'First /= 1
- then
- Report.Failed("Incorrect lower bound returned from To_Domain");
- end if;
-
-
- -- Check contents of result of To_Range.
-
- TC_Range_3 := Maps.To_Range(TC_Unordered_Map);
-
- if TC_Range_1 /= "abcdefghijklmnopqrstuvwxyz" then
- Report.Failed("Incorrect result from To_Range with " &
- "TC_Upper_to_Lower_Map as input");
- end if;
-
- if TC_Range_2 /= "ABCDEFGHIJKLMNOPQRSTUVWXYZ" then
- Report.Failed("Incorrect result from To_Range with " &
- "TC_Lower_to_Upper_Map as input");
- end if;
-
- if TC_Range_3 /= "gilkaj" then
- Report.Failed("Incorrect result from To_Range with " &
- "an unordered mapping as input");
- end if;
-
-
- -- The lower bound on the returned Character_Sequence value
- -- must be 1.
-
- if TC_Range_1'First /= 1 or
- TC_Range_2'First /= 1 or
- TC_Range_3'First /= 1
- then
- Report.Failed("Incorrect lower bound returned from To_Range");
- end if;
-
-
- -- The upper bound on the returned Character_Sequence value
- -- must be Map'Length.
-
- if TC_Range_1'Last /= TC_Lower_Case_Sequence'Length or
- TC_Range_2'Last /= TC_Upper_Case_Sequence'Length or
- TC_Range_3'Last /= TC_Unordered_Sequence'Length
- then
- Report.Failed("Incorrect upper bound returned from To_Range");
- end if;
-
- end;
-
- -- Both function To_Domain and To_Range return the null string
- -- when provided the Identity character map as an input parameter.
-
- if Maps.To_Domain(Maps.Identity) /= Null_Sequence then
- Report.Failed("Function To_Domain did not return the null " &
- "string when provided the Identity map as " &
- "input");
- end if;
-
- if Maps.To_Range(Maps.Identity) /= Null_Sequence then
- Report.Failed("Function To_Range did not return the null " &
- "string when provided the Identity map as " &
- "input");
- end if;
-
- exception
- when others =>
- Report.Failed("Exception raised during the evaluation of " &
- "Function To_Domain and To_Range");
- end;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4024;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4025.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4025.a
deleted file mode 100644
index 1665f7a46e8..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4025.a
+++ /dev/null
@@ -1,376 +0,0 @@
--- CXA4025.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functionality found in packages Ada.Strings.Wide_Maps,
--- Ada.Strings.Wide_Fixed, and Ada.Strings.Wide_Maps.Wide_Constants
--- is available and produces correct results.
---
--- TEST DESCRIPTION:
--- This test validates the subprograms found in the various Wide_Map
--- and Wide_String packages. It is based on the tests CXA4024 and
--- CXA4026, which are tests for the complementary "non-wide" packages.
---
--- The functions found in CXA4025_0 provide mapping capability, when
--- used in conjunction with Wide_Character_Mapping_Function objects.
---
---
--- CHANGE HISTORY:
--- 23 Jun 95 SAIC Initial prerelease version.
--- 15 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
---
---!
-
-package CXA4025_0 is
- -- Functions used to supply mapping capability.
- function Map_To_Lower_Case (From : Wide_Character) return Wide_Character;
- function Map_To_Upper_Case (From : Wide_Character) return Wide_Character;
-end CXA4025_0;
-
-with Ada.Characters.Handling;
-package body CXA4025_0 is
- -- Function Map_To_Lower_Case will return the lower case form of
- -- Wide_Characters in the range 'A'..'Z' only, and return the input
- -- wide_character otherwise.
-
- function Map_To_Lower_Case (From : Wide_Character)
- return Wide_Character is
- begin
- return Ada.Characters.Handling.To_Wide_Character(
- Ada.Characters.Handling.To_Lower(
- Ada.Characters.Handling.To_Character(From)));
- end Map_To_Lower_Case;
-
- -- Function Map_To_Upper_Case will return the upper case form of
- -- Wide_Characters in the range 'a'..'z', or whose position is in one
- -- of the ranges 223..246 or 248..255, provided the wide_character has
- -- an upper case form.
-
- function Map_To_Upper_Case (From : Wide_Character)
- return Wide_Character is
- begin
- return Ada.Characters.Handling.To_Wide_Character(
- Ada.Characters.Handling.To_Upper(
- Ada.Characters.Handling.To_Character(From)));
- end Map_To_Upper_Case;
-
-end CXA4025_0;
-
-
-with CXA4025_0;
-with Report;
-with Ada.Characters.Handling;
-with Ada.Characters.Latin_1;
-with Ada.Exceptions;
-with Ada.Strings;
-with Ada.Strings.Wide_Maps;
-with Ada.Strings.Wide_Maps.Wide_Constants;
-with Ada.Strings.Wide_Fixed;
-
-procedure CXA4025 is
-begin
- Report.Test ("CXA4025",
- "Check that subprograms defined in packages " &
- "Ada.Strings.Wide_Maps and Ada.Strings.Wide_Fixed " &
- "produce correct results");
-
- Test_Block:
- declare
-
- package ACL1 renames Ada.Characters.Latin_1;
-
- use Ada.Characters, Ada.Strings;
- use Ada.Exceptions;
- use type Wide_Maps.Wide_Character_Set;
-
- subtype LC_Characters is Wide_Character range 'a'..'z';
-
- Last_Letter : constant := 26;
- Vowels : constant Wide_Maps.Wide_Character_Sequence := "aeiou";
- TC_String : constant Wide_String := "A Standard String";
-
- Alphabet : Wide_Maps.Wide_Character_Sequence (1..Last_Letter);
- Alphabet_Set,
- Consonant_Set,
- Vowel_Set : Wide_Maps.Wide_Character_Set;
-
- String_20 : Wide_String(1..20) := "ABCDEFGHIJKLMNOPQRST";
- String_40 : Wide_String(1..40) := "abcdefghijklmnopqrst" &
- String_20;
- String_80 : Wide_String(1..80) := String_40 & String_40;
- TC_String_5 : Wide_String(1..5) := "ABCDE";
-
- -- The following strings are used in examination of the Translation
- -- subprograms.
- New_Character_String : Wide_String(1..12) :=
- Handling.To_Wide_String(
- ACL1.LC_A_Grave & ACL1.LC_A_Ring & ACL1.LC_AE_Diphthong &
- ACL1.LC_C_Cedilla & ACL1.LC_E_Acute & ACL1.LC_I_Circumflex &
- ACL1.LC_Icelandic_Eth & ACL1.LC_N_Tilde &
- ACL1.LC_O_Oblique_Stroke & ACL1.LC_Icelandic_Thorn &
- ACL1.LC_German_Sharp_S & ACL1.LC_Y_Diaeresis);
-
- -- Note that there is no upper case version of the last two
- -- characters from above.
-
- TC_New_Character_String : Wide_String(1..12) :=
- Handling.To_Wide_String(
- ACL1.UC_A_Grave & ACL1.UC_A_Ring & ACL1.UC_AE_Diphthong &
- ACL1.UC_C_Cedilla & ACL1.UC_E_Acute & ACL1.UC_I_Circumflex &
- ACL1.UC_Icelandic_Eth & ACL1.UC_N_Tilde &
- ACL1.UC_O_Oblique_Stroke & ACL1.UC_Icelandic_Thorn &
- ACL1.LC_German_Sharp_S & ACL1.LC_Y_Diaeresis);
-
- -- Access objects that will be provided as parameters to the
- -- subprograms.
- Map_To_Lower_Case_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- CXA4025_0.Map_To_Lower_Case'Access;
- Map_To_Upper_Case_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- CXA4025_0.Map_To_Upper_Case'Access;
-
- begin
-
- --
- -- Testing of functionality found in Package Ada.Strings.Wide_Maps.
- --
-
- -- Load the alphabet strings for use in creating sets.
- for i in 0..25 loop
- Alphabet(i+1) := Wide_Character'Val(Wide_Character'Pos('a')+i);
- end loop;
-
- -- Initialize a series of Character_Set objects.
- Alphabet_Set := Wide_Maps.To_Set(Alphabet);
- Vowel_Set := Wide_Maps.To_Set(Vowels);
- Consonant_Set := Vowel_Set XOR Alphabet_Set;
-
- -- Evaluation of Set operator "-".
- if
- (Alphabet_Set - Consonant_Set) /=
- "AND"(Alphabet_Set, "NOT"(Consonant_Set)) or
- (Alphabet_Set - Vowel_Set) /= "AND"(Alphabet_Set, "NOT"(Vowel_Set))
- then
- Report.Failed("Incorrect result from ""-"" operator for sets");
- end if;
-
- -- Evaluation of Functions To_Domain and To_Range.
- declare
- Null_Sequence : constant Wide_Maps.Wide_Character_Sequence := "";
- TC_UC_Sequence : constant Wide_Maps.Wide_Character_Sequence :=
- "ZYXWVUTSRQPONMABCDEFGHIJKL";
- TC_LC_Sequence : constant Wide_Maps.Wide_Character_Sequence :=
- "zyxwvutsrqponmabcdefghijkl";
- TC_Upper_to_Lower_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(TC_UC_Sequence,
- TC_LC_Sequence);
- TC_Lower_to_Upper_Map : Wide_Maps.Wide_Character_Mapping :=
- Wide_Maps.To_Mapping(TC_LC_Sequence,
- TC_UC_Sequence);
- begin
- declare
- TC_Domain : constant Wide_Maps.Wide_Character_Sequence :=
- Wide_Maps.To_Domain(TC_Upper_to_Lower_Map);
- TC_Range : constant Wide_Maps.Wide_Character_Sequence :=
- Wide_Maps.To_Range(TC_Lower_to_Upper_Map);
- begin
- -- Function To_Domain returns the shortest Wide_Character_Sequence
- -- value such that each wide character not in the result maps to
- -- itself, and all wide characters in the result are in ascending
- -- order.
- if TC_Domain /= "ABCDEFGHIJKLMNOPQRSTUVWXYZ" then
- Report.Failed("Incorrect result from To_Domain with " &
- "TC_Upper_to_Lower_Map as input");
- end if;
-
- -- The lower bound on the returned Wide_Character_Sequence value
- -- from To_Domain must be 1.
- if TC_Domain'First /= 1 then
- Report.Failed("Incorrect lower bound returned from To_Domain");
- end if;
-
- -- Check contents of result of To_Range.
- if TC_Range /= "ABCDEFGHIJKLMNOPQRSTUVWXYZ" then
- Report.Failed("Incorrect result from To_Range with " &
- "TC_Lower_to_Upper_Map as input");
- end if;
-
- -- The lower bound on the returned Character_Sequence value
- -- must be 1.
- if TC_Range'First /= 1 then
- Report.Failed("Incorrect lower bound returned from To_Range");
- end if;
-
- if TC_Range'Last /= TC_LC_Sequence'Length then
- Report.Failed("Incorrect upper bound returned from To_Range");
- end if;
- end;
-
- -- Both function To_Domain and To_Range return the null string
- -- when provided the Identity character map as an input parameter.
- if Wide_Maps.To_Domain(Wide_Maps.Identity) /= Null_Sequence or
- Wide_Maps.To_Range(Wide_Maps.Identity) /= Null_Sequence
- then
- Report.Failed("Null sequence not returned from To_Domain or " &
- "To_Range when provided the Identity map as input");
- end if;
- exception
- when others =>
- Report.Failed("Exception raised during the evaluation of " &
- "Function To_Domain and To_Range");
- end;
-
- -- Testing of functionality found in Package Ada.Strings.Wide_Fixed.
- --
- -- Function Index, Forward direction search.
-
- if Wide_Fixed.Index("CoMpLeTeLy MiXeD CaSe StRiNg",
- "MIXED CASE STRING",
- Ada.Strings.Forward,
- Map_To_Upper_Case_Ptr) /= 12 or
- Wide_Fixed.Index("STRING WITH NO MATCHING PATTERNS",
- "WITH",
- Ada.Strings.Forward,
- Map_To_Lower_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Index, going " &
- "in Forward direction, using a Character Mapping " &
- "Function parameter");
- end if;
-
- -- Function Index, Backward direction search.
- if Wide_Fixed.Index("Case of a Mixed Case String",
- "case",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 17 or
- Wide_Fixed.Index("WOULD MATCH BUT FOR THE CASE",
- "WOULD MATCH BUT FOR THE CASE",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Index, going " &
- "in Backward direction, using a Character Mapping " &
- "Function parameter");
- end if;
-
- -- Function Count.
- if Wide_Fixed.Count("ABABABA", "ABA", Map_To_Upper_Case_Ptr) /= 2 or
- Wide_Fixed.Count("", "match", Map_To_Lower_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Count, using " &
- "a Character Mapping Function parameter");
- end if;
-
- -- Function Translate.
- if Wide_Fixed.Translate(Source => "A Sample Mixed Case String",
- Mapping => Map_To_Lower_Case_Ptr) /=
- "a sample mixed case string" or
- Wide_Fixed.Translate(New_Character_String,
- Map_To_Upper_Case_Ptr) /=
- TC_New_Character_String
- then
- Report.Failed("Incorrect results from Function Translate, using " &
- "a Wide_Character Mapping Function parameter");
- end if;
-
- -- Procedure Translate.
- declare
- use Ada.Strings.Wide_Fixed;
- Str : Wide_String(1..19) := "A Mixed Case String";
- begin
- Translate(Source => Str, Mapping => Map_To_Lower_Case_Ptr);
- if Str /= "a mixed case string" then
- Report.Failed("Incorrect result from Procedure Translate - 1");
- end if;
-
- Translate(New_Character_String, Map_To_Upper_Case_Ptr);
- if New_Character_String /= TC_New_Character_String then
- Report.Failed("Incorrect result from Procedure Translate - 2");
- end if;
- end;
-
- -- Procedure Trim.
- declare
- use Ada.Strings.Wide_Fixed;
- Trim_String : Wide_String(1..30) := " A string of characters ";
- begin
- Trim(Trim_String, Ada.Strings.Left, Ada.Strings.Right, 'x');
- if Trim_String /= "xxxxA string of characters " then
- Report.Failed("Incorrect result from Procedure Trim, trim " &
- "side = left, justify = right, pad = x");
- end if;
-
- Trim(Trim_String, Ada.Strings.Right, Ada.Strings.Center);
- if Trim_String /= " xxxxA string of characters " then
- Report.Failed("Incorrect result from Procedure Trim, trim " &
- "side = right, justify = center, default pad");
- end if;
- end;
-
- -- Procedure Head.
- declare
- Fixed_String : Wide_String(1..20) := "A sample test string";
- begin
- Wide_Fixed.Head(Source => Fixed_String, Count => 14,
- Justify => Ada.Strings.Center, Pad => '$');
- if Fixed_String /= "$$$A sample test $$$" then
- Report.Failed("Incorrect result from Procedure Head, " &
- "justify = center, pad = $");
- end if;
-
- Wide_Fixed.Head(Fixed_String, 11, Ada.Strings.Right);
- if Fixed_String /= " $$$A sample" then
- Report.Failed("Incorrect result from Procedure Head, " &
- "justify = right, default pad");
- end if;
- end;
-
- -- Procedure Tail.
- declare
- use Ada.Strings.Wide_Fixed;
- Tail_String : Wide_String(1..20) := "ABCDEFGHIJKLMNOPQRST";
- begin
- -- Default left justify.
- Tail(Source => Tail_String, Count => 10, Pad => '-');
- if Tail_String /= "KLMNOPQRST----------" then
- Report.Failed("Incorrect result from Procedure Tail, " &
- "default justify, pad = -");
- end if;
-
- Tail(Tail_String, 6, Ada.Strings.Center, 'a');
- if Tail_String /= "aaaaaaa------aaaaaaa" then
- Report.Failed("Incorrect result from Procedure Tail, " &
- "justify = center, pad = a");
- end if;
- end;
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXA4025;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4026.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4026.a
deleted file mode 100644
index 766979ad057..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4026.a
+++ /dev/null
@@ -1,526 +0,0 @@
--- CXA4026.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Ada.Strings.Fixed procedures Head, Tail, and Trim, as well
--- as the versions of subprograms Translate (procedure and function),
--- Index, and Count, available in the package which use a
--- Maps.Character_Mapping_Function input parameter, produce correct
--- results.
---
--- TEST DESCRIPTION:
--- This test examines the operation of several subprograms contained in
--- the Ada.Strings.Fixed package.
--- This includes procedure versions of Head, Tail, and Trim, as well as
--- four subprograms that use a Character_Mapping_Function as a parameter
--- to provide the mapping capability.
---
--- Two functions are defined to provide the mapping. Access values
--- are defined to refer to these functions. One of the functions will
--- map upper case characters in the range 'A'..'Z' to their lower case
--- counterparts, while the other function will map lower case characters
--- ('a'..'z', or a character whose position is in one of the ranges
--- 223..246 or 248..255, provided the character has an upper case form)
--- to their upper case form.
---
--- Function Index uses the mapping function access value to map the input
--- string prior to searching for the appropriate index value to return.
--- Function Count uses the mapping function access value to map the input
--- string prior to counting the occurrences of the pattern string.
--- Both the Procedure and Function version of Translate use the mapping
--- function access value to perform the translation.
---
--- Results of all subprograms are compared with expected results.
---
---
--- CHANGE HISTORY:
--- 10 Feb 95 SAIC Initial prerelease version
--- 21 Apr 95 SAIC Modified definition of string variable Str_2.
---
---!
-
-
-package CXA4026_0 is
-
- -- Function Map_To_Lower_Case will return the lower case form of
- -- Characters in the range 'A'..'Z' only, and return the input
- -- character otherwise.
-
- function Map_To_Lower_Case (From : Character) return Character;
-
-
- -- Function Map_To_Upper_Case will return the upper case form of
- -- Characters in the range 'a'..'z', or whose position is in one
- -- of the ranges 223..246 or 248..255, provided the character has
- -- an upper case form.
-
- function Map_To_Upper_Case (From : Character) return Character;
-
-end CXA4026_0;
-
-
-with Ada.Characters.Handling;
-package body CXA4026_0 is
-
- function Map_To_Lower_Case (From : Character) return Character is
- begin
- if From in 'A'..'Z' then
- return Character'Val(Character'Pos(From) -
- (Character'Pos('A') - Character'Pos('a')));
- else
- return From;
- end if;
- end Map_To_Lower_Case;
-
- function Map_To_Upper_Case (From : Character) return Character is
- begin
- return Ada.Characters.Handling.To_Upper(From);
- end Map_To_Upper_Case;
-
-end CXA4026_0;
-
-
-with CXA4026_0;
-with Ada.Strings.Fixed;
-with Ada.Strings.Maps;
-with Ada.Characters.Handling;
-with Ada.Characters.Latin_1;
-with Report;
-
-procedure CXA4026 is
-
-begin
-
- Report.Test ("CXA4026", "Check that procedures Trim, Head, and Tail, " &
- "as well as the versions of subprograms " &
- "Translate, Index, and Count, which use the " &
- "Character_Mapping_Function input parameter," &
- "produce correct results");
-
- Test_Block:
- declare
-
- use Ada.Strings, CXA4026_0;
-
- -- The following strings are used in examination of the Translation
- -- subprograms.
-
- New_Character_String : String(1..10) :=
- Ada.Characters.Latin_1.LC_A_Grave &
- Ada.Characters.Latin_1.LC_A_Ring &
- Ada.Characters.Latin_1.LC_AE_Diphthong &
- Ada.Characters.Latin_1.LC_C_Cedilla &
- Ada.Characters.Latin_1.LC_E_Acute &
- Ada.Characters.Latin_1.LC_I_Circumflex &
- Ada.Characters.Latin_1.LC_Icelandic_Eth &
- Ada.Characters.Latin_1.LC_N_Tilde &
- Ada.Characters.Latin_1.LC_O_Oblique_Stroke &
- Ada.Characters.Latin_1.LC_Icelandic_Thorn;
-
-
- TC_New_Character_String : String(1..10) :=
- Ada.Characters.Latin_1.UC_A_Grave &
- Ada.Characters.Latin_1.UC_A_Ring &
- Ada.Characters.Latin_1.UC_AE_Diphthong &
- Ada.Characters.Latin_1.UC_C_Cedilla &
- Ada.Characters.Latin_1.UC_E_Acute &
- Ada.Characters.Latin_1.UC_I_Circumflex &
- Ada.Characters.Latin_1.UC_Icelandic_Eth &
- Ada.Characters.Latin_1.UC_N_Tilde &
- Ada.Characters.Latin_1.UC_O_Oblique_Stroke &
- Ada.Characters.Latin_1.UC_Icelandic_Thorn;
-
-
- -- Functions used to supply mapping capability.
-
-
- -- Access objects that will be provided as parameters to the
- -- subprograms.
-
- Map_To_Lower_Case_Ptr : Maps.Character_Mapping_Function :=
- Map_To_Lower_Case'Access;
-
- Map_To_Upper_Case_Ptr : Maps.Character_Mapping_Function :=
- Map_To_Upper_Case'Access;
-
-
- begin
-
- -- Function Index, Forward direction search.
- -- Note: Several of the following cases use the default value
- -- Forward for the Going parameter.
-
- if Fixed.Index(Source => "The library package Strings.Fixed",
- Pattern => "fix",
- Going => Ada.Strings.Forward,
- Mapping => Map_To_Lower_Case_Ptr) /= 29 or
- Fixed.Index("THE RAIN IN SPAIN FALLS MAINLY ON THE PLAIN",
- "ain",
- Mapping => Map_To_Lower_Case_Ptr) /= 6 or
- Fixed.Index("maximum number",
- "um",
- Ada.Strings.Forward,
- Map_To_Lower_Case_Ptr) /= 6 or
- Fixed.Index("CoMpLeTeLy MiXeD CaSe StRiNg",
- "MIXED CASE STRING",
- Ada.Strings.Forward,
- Map_To_Upper_Case_Ptr) /= 12 or
- Fixed.Index("STRING WITH NO MATCHING PATTERNS",
- "WITH",
- Ada.Strings.Forward,
- Map_To_Lower_Case_Ptr) /= 0 or
- Fixed.Index("THIS STRING IS IN UPPER CASE",
- "IS",
- Ada.Strings.Forward,
- Map_To_Upper_Case_Ptr) /= 3 or
- Fixed.Index("", -- Null string.
- "is",
- Mapping => Map_To_Lower_Case_Ptr) /= 0 or
- Fixed.Index("AAABBBaaabbb",
- "aabb",
- Mapping => Map_To_Lower_Case_Ptr) /= 2
- then
- Report.Failed("Incorrect results from Function Index, going " &
- "in Forward direction, using a Character Mapping " &
- "Function parameter");
- end if;
-
-
-
- -- Function Index, Backward direction search.
-
- if Fixed.Index("Case of a Mixed Case String",
- "case",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 17 or
- Fixed.Index("Case of a Mixed Case String",
- "CASE",
- Ada.Strings.Backward,
- Map_To_Upper_Case_Ptr) /= 17 or
- Fixed.Index("rain, Rain, and more RAIN",
- "rain",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 22 or
- Fixed.Index("RIGHT place, right time",
- "RIGHT",
- Ada.Strings.Backward,
- Map_To_Upper_Case_Ptr) /= 14 or
- Fixed.Index("WOULD MATCH BUT FOR THE CASE",
- "WOULD MATCH BUT FOR THE CASE",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Index, going " &
- "in Backward direction, using a Character Mapping " &
- "Function parameter");
- end if;
-
-
-
- -- Function Index, Pattern_Error if Pattern = Null_String
-
- declare
- use Ada.Strings.Fixed;
- Null_Pattern_String : constant String := "";
- TC_Natural : Natural := 1000;
- begin
- TC_Natural := Index("A Valid String",
- Null_Pattern_String,
- Ada.Strings.Forward,
- Map_To_Lower_Case_Ptr);
- Report.Failed("Pattern_Error not raised by Function Index when " &
- "given a null pattern string");
- exception
- when Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Function Index " &
- "using a Character Mapping Function parameter " &
- "when given a null pattern string");
- end;
-
-
-
- -- Function Count.
-
- if Fixed.Count(Source => "ABABABA",
- Pattern => "aba",
- Mapping => Map_To_Lower_Case_Ptr) /= 2 or
- Fixed.Count("ABABABA", "ABA", Map_To_Lower_Case_Ptr) /= 0 or
- Fixed.Count("This IS a MISmatched issue",
- "is",
- Map_To_Lower_Case_Ptr) /= 4 or
- Fixed.Count("ABABABA", "ABA", Map_To_Upper_Case_Ptr) /= 2 or
- Fixed.Count("This IS a MISmatched issue",
- "is",
- Map_To_Upper_Case_Ptr) /= 0 or
- Fixed.Count("She sells sea shells by the sea shore",
- "s",
- Map_To_Lower_Case_Ptr) /= 8 or
- Fixed.Count("", -- Null string.
- "match",
- Map_To_Upper_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Count, using " &
- "a Character Mapping Function parameter");
- end if;
-
-
-
- -- Function Count, Pattern_Error if Pattern = Null_String
-
- declare
- use Ada.Strings.Fixed;
- Null_Pattern_String : constant String := "";
- TC_Natural : Natural := 1000;
- begin
- TC_Natural := Count("A Valid String",
- Null_Pattern_String,
- Map_To_Lower_Case_Ptr);
- Report.Failed("Pattern_Error not raised by Function Count using " &
- "a Character Mapping Function parameter when " &
- "given a null pattern string");
- exception
- when Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Function Count " &
- "using a Character Mapping Function parameter " &
- "when given a null pattern string");
- end;
-
-
-
- -- Function Translate.
-
- if Fixed.Translate(Source => "A Sample Mixed Case String",
- Mapping => Map_To_Lower_Case_Ptr) /=
- "a sample mixed case string" or
-
- Fixed.Translate("ALL LOWER CASE",
- Map_To_Lower_Case_Ptr) /=
- "all lower case" or
-
- Fixed.Translate("end with lower case",
- Map_To_Lower_Case_Ptr) /=
- "end with lower case" or
-
- Fixed.Translate("", Map_To_Lower_Case_Ptr) /=
- "" or
-
- Fixed.Translate("start with lower case",
- Map_To_Upper_Case_Ptr) /=
- "START WITH LOWER CASE" or
-
- Fixed.Translate("ALL UPPER CASE STRING",
- Map_To_Upper_Case_Ptr) /=
- "ALL UPPER CASE STRING" or
-
- Fixed.Translate("LoTs Of MiXeD CaSe ChArAcTeRs",
- Map_To_Upper_Case_Ptr) /=
- "LOTS OF MIXED CASE CHARACTERS" or
-
- Fixed.Translate("", Map_To_Upper_Case_Ptr) /=
- "" or
-
- Fixed.Translate(New_Character_String,
- Map_To_Upper_Case_Ptr) /=
- TC_New_Character_String
- then
- Report.Failed("Incorrect results from Function Translate, using " &
- "a Character Mapping Function parameter");
- end if;
-
-
-
- -- Procedure Translate.
-
- declare
-
- use Ada.Strings.Fixed;
-
- Str_1 : String(1..24) := "AN ALL UPPER CASE STRING";
- Str_2 : String(1..19) := "A Mixed Case String";
- Str_3 : String(1..32) := "a string with lower case letters";
- TC_Str_1 : constant String := Str_1;
- TC_Str_3 : constant String := Str_3;
-
- begin
-
- Translate(Source => Str_1, Mapping => Map_To_Lower_Case_Ptr);
-
- if Str_1 /= "an all upper case string" then
- Report.Failed("Incorrect result from Procedure Translate - 1");
- end if;
-
- Translate(Source => Str_1, Mapping => Map_To_Upper_Case_Ptr);
-
- if Str_1 /= TC_Str_1 then
- Report.Failed("Incorrect result from Procedure Translate - 2");
- end if;
-
- Translate(Source => Str_2, Mapping => Map_To_Lower_Case_Ptr);
-
- if Str_2 /= "a mixed case string" then
- Report.Failed("Incorrect result from Procedure Translate - 3");
- end if;
-
- Translate(Source => Str_2, Mapping => Map_To_Upper_Case_Ptr);
-
- if Str_2 /= "A MIXED CASE STRING" then
- Report.Failed("Incorrect result from Procedure Translate - 4");
- end if;
-
- Translate(Source => Str_3, Mapping => Map_To_Lower_Case_Ptr);
-
- if Str_3 /= TC_Str_3 then
- Report.Failed("Incorrect result from Procedure Translate - 5");
- end if;
-
- Translate(Source => Str_3, Mapping => Map_To_Upper_Case_Ptr);
-
- if Str_3 /= "A STRING WITH LOWER CASE LETTERS" then
- Report.Failed("Incorrect result from Procedure Translate - 6");
- end if;
-
- Translate(New_Character_String, Map_To_Upper_Case_Ptr);
-
- if New_Character_String /= TC_New_Character_String then
- Report.Failed("Incorrect result from Procedure Translate - 6");
- end if;
-
- end;
-
-
- -- Procedure Trim.
-
- declare
- Use Ada.Strings.Fixed;
- Trim_String : String(1..30) := " A string of characters ";
- begin
-
- Trim(Source => Trim_String,
- Side => Ada.Strings.Left,
- Justify => Ada.Strings.Right,
- Pad => 'x');
-
- if Trim_String /= "xxxxA string of characters " then
- Report.Failed("Incorrect result from Procedure Trim, trim " &
- "side = left, justify = right, pad = x");
- end if;
-
- Trim(Trim_String, Ada.Strings.Right, Ada.Strings.Center);
-
- if Trim_String /= " xxxxA string of characters " then
- Report.Failed("Incorrect result from Procedure Trim, trim " &
- "side = right, justify = center, default pad");
- end if;
-
- Trim(Trim_String, Ada.Strings.Both, Pad => '*');
-
- if Trim_String /= "xxxxA string of characters****" then
- Report.Failed("Incorrect result from Procedure Trim, trim " &
- "side = both, default justify, pad = *");
- end if;
-
- end;
-
-
- -- Procedure Head.
-
- declare
- Fixed_String : String(1..20) := "A sample test string";
- begin
-
- Fixed.Head(Source => Fixed_String,
- Count => 14,
- Justify => Ada.Strings.Center,
- Pad => '$');
-
- if Fixed_String /= "$$$A sample test $$$" then
- Report.Failed("Incorrect result from Procedure Head, " &
- "justify = center, pad = $");
- end if;
-
- Fixed.Head(Fixed_String, 11, Ada.Strings.Right);
-
- if Fixed_String /= " $$$A sample" then
- Report.Failed("Incorrect result from Procedure Head, " &
- "justify = right, default pad");
- end if;
-
- Fixed.Head(Fixed_String, 9, Pad => '*');
-
- if Fixed_String /= " ***********" then
- Report.Failed("Incorrect result from Procedure Head, " &
- "default justify, pad = *");
- end if;
-
- end;
-
-
- -- Procedure Tail.
-
- declare
- Use Ada.Strings.Fixed;
- Tail_String : String(1..20) := "ABCDEFGHIJKLMNOPQRST";
- begin
-
- Tail(Source => Tail_String, Count => 10, Pad => '-');
-
- if Tail_String /= "KLMNOPQRST----------" then
- Report.Failed("Incorrect result from Procedure Tail, " &
- "default justify, pad = -");
- end if;
-
- Tail(Tail_String, 6, Justify => Ada.Strings.Center, Pad => 'a');
-
- if Tail_String /= "aaaaaaa------aaaaaaa" then
- Report.Failed("Incorrect result from Procedure Tail, " &
- "justify = center, pad = a");
- end if;
-
- Tail(Tail_String, 1, Ada.Strings.Right);
-
- if Tail_String /= " a" then
- Report.Failed("Incorrect result from Procedure Tail, " &
- "justify = right, default pad");
- end if;
-
- Tail(Tail_String, 19, Ada.Strings.Right, 'A');
-
- if Tail_String /= "A a" then
- Report.Failed("Incorrect result from Procedure Tail, " &
- "justify = right, pad = A");
- end if;
-
- end;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- Report.Result;
-
-end CXA4026;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4027.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4027.a
deleted file mode 100644
index 05c66d4cc9f..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4027.a
+++ /dev/null
@@ -1,342 +0,0 @@
--- CXA4027.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that versions of Ada.Strings.Bounded subprograms Translate,
--- (procedure and function), Index, and Count, which use the
--- Maps.Character_Mapping_Function input parameter, produce correct
--- results.
---
--- TEST DESCRIPTION:
--- This test examines the operation of several subprograms from within
--- the Ada.Strings.Bounded package that use the
--- Character_Mapping_Function mapping parameter to provide a mapping
--- capability.
---
--- Two functions are defined to provide the mapping. Access values
--- are defined to refer to these functions. One of the functions will
--- map upper case characters in the range 'A'..'Z' to their lower case
--- counterparts, while the other function will map lower case characters
--- ('a'..'z', or a character whose position is in one of the ranges
--- 223..246 or 248..255, provided the character has an upper case form)
--- to their upper case form.
---
--- Function Index uses the mapping function access value to map the input
--- string prior to searching for the appropriate index value to return.
--- Function Count uses the mapping function access value to map the input
--- string prior to counting the occurrences of the pattern string.
--- Both the Procedure and Function version of Translate use the mapping
--- function access value to perform the translation.
---
---
--- CHANGE HISTORY:
--- 16 FEB 95 SAIC Initial prerelease version
--- 17 Jul 95 SAIC Incorporated reviewer comments. Replaced two
--- internally declared functions with two library
--- level functions to eliminate accessibility
--- problems.
---
---!
-
-
--- Function CXA4027_0 will return the lower case form of
--- the character input if it is in upper case, and return the input
--- character otherwise.
-
-with Ada.Characters.Handling;
-function CXA4027_0 (From : Character) return Character;
-
-function CXA4027_0 (From : Character) return Character is
-begin
- return Ada.Characters.Handling.To_Lower(From);
-end CXA4027_0;
-
-
-
--- Function CXA4027_1 will return the upper case form of
--- Characters in the range 'a'..'z', or whose position is in one
--- of the ranges 223..246 or 248..255, provided the character has
--- an upper case form.
-
-with Ada.Characters.Handling;
-function CXA4027_1 (From : Character) return Character;
-
-function CXA4027_1 (From : Character) return Character is
-begin
- return Ada.Characters.Handling.To_Upper(From);
-end CXA4027_1;
-
-
-with CXA4027_0, CXA4027_1;
-with Ada.Strings.Bounded;
-with Ada.Strings.Maps;
-with Ada.Characters.Handling;
-with Report;
-
-procedure CXA4027 is
-begin
-
- Report.Test ("CXA4027", "Check that Ada.Strings.Bounded subprograms " &
- "Translate, Index, and Count, which use the " &
- "Character_Mapping_Function input parameter, " &
- "produce correct results");
-
- Test_Block:
- declare
-
- use Ada.Strings;
-
- -- Functions used to supply mapping capability.
-
- function Map_To_Lower_Case (From : Character) return Character
- renames CXA4027_0;
-
- function Map_To_Upper_Case (From : Character) return Character
- renames CXA4027_1;
-
- Map_To_Lower_Case_Ptr : Maps.Character_Mapping_Function :=
- Map_To_Lower_Case'Access;
-
- Map_To_Upper_Case_Ptr : Maps.Character_Mapping_Function :=
- Map_To_Upper_Case'Access;
-
-
- -- Instantiations of Bounded String generic package.
-
- package BS1 is new Ada.Strings.Bounded.Generic_Bounded_Length(1);
- package BS20 is new Ada.Strings.Bounded.Generic_Bounded_Length(20);
- package BS40 is new Ada.Strings.Bounded.Generic_Bounded_Length(40);
- package BS80 is new Ada.Strings.Bounded.Generic_Bounded_Length(80);
-
- use type BS1.Bounded_String, BS20.Bounded_String,
- BS40.Bounded_String, BS80.Bounded_String;
-
- String_1 : String(1..1) := "A";
- String_20 : String(1..20) := "ABCDEFGHIJKLMNOPQRST";
- String_40 : String(1..40) := "abcdefghijklmnopqrst" & String_20;
- String_80 : String(1..80) := String_40 & String_40;
-
- BString_1 : BS1.Bounded_String := BS1.Null_Bounded_String;
- BString_20 : BS20.Bounded_String := BS20.Null_Bounded_String;
- BString_40 : BS40.Bounded_String := BS40.Null_Bounded_String;
- BString_80 : BS80.Bounded_String := BS80.Null_Bounded_String;
-
-
- begin
-
- -- Function Index.
-
- if BS40.Index(BS40.To_Bounded_String("Package Strings.Bounded"),
- Pattern => "s.b",
- Going => Ada.Strings.Forward,
- Mapping => Map_To_Lower_Case_Ptr) /= 15 or
- BS80.Index(BS80.To_Bounded_String("STRING TRANSLATIONS SUBPROGRAMS"),
- "tr",
- Mapping => Map_To_Lower_Case_Ptr) /= 2 or
- BS20.Index(BS20.To_Bounded_String("maximum number"),
- "um",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 10 or
- BS80.Index(BS80.To_Bounded_String("CoMpLeTeLy MiXeD CaSe StRiNg"),
- "MIXED CASE STRING",
- Ada.Strings.Forward,
- Map_To_Upper_Case_Ptr) /= 12 or
- BS40.Index(BS40.To_Bounded_String("STRING WITH NO MATCHING PATTERN"),
- "WITH",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 0 or
- BS80.Index(BS80.To_Bounded_String("THIS STRING IS IN UPPER CASE"),
- "I",
- Ada.Strings.Backward,
- Map_To_Upper_Case_Ptr) /= 16 or
- BS1.Index(BS1.Null_Bounded_String,
- "i",
- Mapping => Map_To_Lower_Case_Ptr) /= 0 or
- BS40.Index(BS40.To_Bounded_String("AAABBBaaabbb"),
- "aabb",
- Mapping => Map_To_Lower_Case_Ptr) /= 2 or
- BS80.Index(BS80.To_Bounded_String("WOULD MATCH BUT FOR THE CASE"),
- "WOULD MATCH BUT FOR THE CASE",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Index, using a " &
- "Character Mapping Function parameter");
- end if;
-
-
- -- Function Index, Pattern_Error if Pattern = Null_String
-
- declare
- use BS20;
- TC_Natural : Natural := 1000;
- begin
- TC_Natural := Index(To_Bounded_String("A Valid String"),
- "",
- Ada.Strings.Forward,
- Map_To_Lower_Case_Ptr);
- Report.Failed("Pattern_Error not raised by Function Index when " &
- "given a null pattern string");
- exception
- when Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Function Index " &
- "using a Character_Mapping_Function parameter " &
- "when given a null pattern string");
- end;
-
-
- -- Function Count.
-
- if BS20.Count(BS20.To_Bounded_String("ABABABA"),
- Pattern => "aba",
- Mapping => Map_To_Lower_Case_Ptr) /= 2 or
- BS20.Count(BS20.To_Bounded_String("ABABABA"),
- "ABA",
- Map_To_Lower_Case_Ptr) /= 0 or
- BS40.Count(BS40.To_Bounded_String("This IS a MISmatched issue"),
- "is",
- Map_To_Lower_Case_Ptr) /= 4 or
- BS80.Count(BS80.To_Bounded_String("ABABABA"),
- "ABA",
- Map_To_Upper_Case_Ptr) /= 2 or
- BS40.Count(BS40.To_Bounded_String("This IS a MISmatched issue"),
- "is",
- Map_To_Upper_Case_Ptr) /= 0 or
- BS80.Count(BS80.To_Bounded_String
- ("Peter Piper and his Pickled Peppers"),
- "p",
- Map_To_Lower_Case_Ptr) /= 7 or
- BS20.Count(BS20.To_Bounded_String("She sells sea shells"),
- "s",
- Map_To_Upper_Case_Ptr) /= 0 or
- BS80.Count(BS80.To_Bounded_String("No matches what-so-ever"),
- "matches",
- Map_To_Upper_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Count, using " &
- "a Character_Mapping_Function parameter");
- end if;
-
-
- -- Function Count, Pattern_Error if Pattern = Null_String
-
- declare
- use BS80;
- TC_Natural : Natural := 1000;
- begin
- TC_Natural := Count(To_Bounded_String("A Valid String"),
- "",
- Map_To_Lower_Case_Ptr);
- Report.Failed("Pattern_Error not raised by Function Count using " &
- "a Character_Mapping_Function parameter when " &
- "given a null pattern string");
- exception
- when Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Function Count " &
- "using a Character_Mapping_Function parameter " &
- "when given a null pattern string");
- end;
-
-
- -- Function Translate.
-
- if BS40.Translate(BS40.To_Bounded_String("A Mixed Case String"),
- Mapping => Map_To_Lower_Case_Ptr) /=
- BS40.To_Bounded_String("a mixed case string") or
-
- BS20."/="(BS20.Translate(BS20.To_Bounded_String("ALL LOWER CASE"),
- Map_To_Lower_Case_Ptr),
- "all lower case") or
-
- BS20."/="("end with lower case",
- BS20.Translate(
- BS20.To_Bounded_String("end with lower case"),
- Map_To_Lower_Case_Ptr)) or
-
- BS1.Translate(BS1.Null_Bounded_String,
- Map_To_Lower_Case_Ptr) /=
- BS1.Null_Bounded_String or
-
- BS80."/="(BS80.Translate(BS80.To_Bounded_String
- ("start with lower case, end with upper case"),
- Map_To_Upper_Case_Ptr),
- "START WITH LOWER CASE, END WITH UPPER CASE") or
-
- BS40.Translate(BS40.To_Bounded_String("ALL UPPER CASE STRING"),
- Map_To_Upper_Case_Ptr) /=
- BS40.To_Bounded_String("ALL UPPER CASE STRING") or
-
- BS80."/="(BS80.Translate(BS80.To_Bounded_String
- ("LoTs Of MiXeD CaSe ChArAcTeRs In ThE StRiNg"),
- Map_To_Upper_Case_Ptr),
- "LOTS OF MIXED CASE CHARACTERS IN THE STRING")
-
- then
- Report.Failed("Incorrect results from Function Translate, using " &
- "a Character_Mapping_Function parameter");
- end if;
-
-
- -- Procedure Translate.
-
- BString_1 := BS1.To_Bounded_String("A");
-
- BS1.Translate(Source => BString_1, Mapping => Map_To_Lower_Case_Ptr);
-
- if not BS1."="(BString_1, "a") then -- "=" for Bounded_String, String
- Report.Failed("Incorrect result from Procedure Translate - 1");
- end if;
-
- BString_20 := BS20.To_Bounded_String(String_20);
- BS20.Translate(BString_20, Mapping => Map_To_Lower_Case_Ptr);
-
- if BString_20 /= BS20.To_Bounded_String("abcdefghijklmnopqrst") then
- Report.Failed("Incorrect result from Procedure Translate - 2");
- end if;
-
- BString_40 := BS40.To_Bounded_String("String needing highlighting");
- BS40.Translate(BString_40, Map_To_Upper_Case_Ptr);
-
- if not (BString_40 = "STRING NEEDING HIGHLIGHTING") then
- Report.Failed("Incorrect result from Procedure Translate - 3");
- end if;
-
- BString_80 := BS80.Null_Bounded_String;
- BS80.Translate(BString_80, Map_To_Upper_Case_Ptr);
-
- if not (BString_80 = BS80.Null_Bounded_String) then
- Report.Failed("Incorrect result from Procedure Translate - 4");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4027;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4028.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4028.a
deleted file mode 100644
index bc6cac14c5e..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4028.a
+++ /dev/null
@@ -1,331 +0,0 @@
--- CXA4028.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Ada.Strings.Bounded procedures Append, Head, Tail, and
--- Trim, and relational operator functions "=", ">", ">=", "<", "<="
--- with parameter combinations of type String and Bounded_String,
--- produce correct results.
---
--- TEST DESCRIPTION:
--- This test examines the operation of several subprograms from within
--- the Ada.Strings.Bounded package. Four different instantiations of
--- Ada.Strings.Bounded.Generic_Bounded_Length provide packages defined
--- to manipulate bounded strings of lengths 1, 20, 40, and 80.
--- Examples of the above mentioned procedures and relational operators
--- from each of these instantiations are tested, with results compared
--- against expected output.
---
--- Testing of the function versions of many of the subprograms tested
--- here is performed in tests CXA4006-CXA4009.
---
---
--- CHANGE HISTORY:
--- 16 Feb 95 SAIC Initial prerelease version
--- 10 Mar 95 SAIC Incorporated reviewer comments.
--- 15 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
---
---!
-
-with Ada.Exceptions;
-with Ada.Strings.Bounded;
-with Report;
-
-procedure CXA4028 is
-
-begin
-
- Report.Test ("CXA4028", "Check that Ada.Strings.Bounded procedures " &
- "Append, Head, Tail, and Trim, and relational " &
- "operator functions =, >, >=, <, <= with " &
- "parameter combinations of type String and " &
- "Bounded_String, produce correct results");
-
- Test_Block:
- declare
-
- use Ada.Exceptions;
- use Ada.Strings;
-
- -- Instantiations of Bounded String generic package.
-
- package BS1 is new Ada.Strings.Bounded.Generic_Bounded_Length(1);
- package BS20 is new Ada.Strings.Bounded.Generic_Bounded_Length(20);
- package BS40 is new Ada.Strings.Bounded.Generic_Bounded_Length(40);
- package BS80 is new Ada.Strings.Bounded.Generic_Bounded_Length(80);
-
- use type BS1.Bounded_String, BS20.Bounded_String,
- BS40.Bounded_String, BS80.Bounded_String;
-
- String_1 : String(1..1) := "A";
- String_20 : String(1..20) := "ABCDEFGHIJKLMNOPQRST";
- String_40 : String(1..40) := "abcdefghijklmnopqrst" & String_20;
- String_80 : String(1..80) := String_40 & String_40;
-
- BString_1 : BS1.Bounded_String := BS1.Null_Bounded_String;
- BString_20 : BS20.Bounded_String := BS20.Null_Bounded_String;
- BString_40 : BS40.Bounded_String := BS40.Null_Bounded_String;
- BString_80 : BS80.Bounded_String := BS80.Null_Bounded_String;
-
- begin
-
- -- Procedure Append.
-
- declare
- use BS1, BS20;
- begin
- Append(Source => BString_1, New_Item => To_Bounded_String("A"));
- Append(BString_1, "B", Ada.Strings.Left);
- Append(BString_1, 'C', Drop => Ada.Strings.Right); -- Drop appended
- -- character.
- if BString_1 /= To_Bounded_String("B") then
- Report.Failed("Incorrect results from BS1 versions of " &
- "procedure Append");
- end if;
-
- Append(BString_20, 'T'); -- Character.
- Append(BString_20, "his string"); -- String.
- Append(BString_20,
- To_Bounded_String(" is complete."), -- Bounded string.
- Drop => Ada.Strings.Right); -- Drop 4 characters.
-
- if BString_20 /= To_Bounded_String("This string is compl") then
- Report.Failed("Incorrect results from BS20 versions of " &
- "procedure Append");
- end if;
- end;
-
-
- -- Operator "=".
-
- BString_40 := BS40.To_Bounded_String(String_40);
- BString_80 := BS80.To_Bounded_String(
- BS40.To_String(BString_40) &
- BS40.To_String(BString_40));
-
- if not (BString_40 = String_40 and -- (Bounded_String, String)
- BS80."="(String_80, BString_80)) -- (String, Bounded_String)
- then
- Report.Failed("Incorrect results from function ""="" with " &
- "string - bounded string parameter combinations");
- end if;
-
-
- -- Operator "<".
-
- BString_1 := BS1.To_Bounded_String("cat", -- string "c" only.
- Drop => Ada.Strings.Right);
- BString_20 := BS20.To_Bounded_String("Santa Claus");
-
- if BString_1 < "C" or -- (Bounded_String, String)
- BS1."<"(BString_1,"c") or -- (Bounded_String, String)
- "x" < BString_1 or -- (String, Bounded_String)
- BString_20 < "Santa " or -- (Bounded_String, String)
- "Santa and his Elves" < BString_20 -- (String, Bounded_String)
- then
- Report.Failed("Incorrect results from function ""<"" with " &
- "string - bounded string parameter combinations");
- end if;
-
-
- -- Operator "<=".
-
- BString_20 := BS20.To_Bounded_String("Sample string");
-
- if BString_20 <= "Sample strin" or -- (Bounded_String, String)
- "sample string" <= BString_20 or -- (String, Bounded_String)
- not("Sample string" <= BString_20) -- (String, Bounded_String)
- then
- Report.Failed("Incorrect results from function ""<="" with " &
- "string - bounded string parameter combinations");
- end if;
-
-
- -- Operator ">".
-
- BString_40 := BS40.To_Bounded_String("A MUCH LONGER SAMPLE STRING.");
-
- if BString_40 > "A much longer sample string" or -- (Bnd_Str, Str)
- String_20 > BS40.To_Bounded_String(String_40) or -- (Str, Bnd_Str)
- BS40.To_Bounded_String("ABCDEFGH") > "abcdefgh" -- (Str, Bnd_Str)
- then
- Report.Failed("Incorrect results from function "">"" with " &
- "string - bounded string parameter combinations");
- end if;
-
-
- -- Operator ">=".
-
- BString_80 := BS80.To_Bounded_String(String_80);
-
- if not (BString_80 >= String_80 and
- BS80.To_Bounded_String("Programming") >= "PROGRAMMING" and
- "test" >= BS80.To_Bounded_String("tess"))
- then
- Report.Failed("Incorrect results from function "">="" with " &
- "string - bounded string parameter combinations");
- end if;
-
-
- -- Procedure Trim
-
- BString_20 := BS20.To_Bounded_String(" Left Spaces ");
- BS20.Trim(Source => BString_20,
- Side => Ada.Strings.Left);
-
- if "Left Spaces " /= BString_20 then
- Report.Failed("Incorrect results from Procedure Trim with " &
- "Side = Left");
- end if;
-
- BString_40 := BS40.To_Bounded_String(" Right Spaces ");
- BS40.Trim(BString_40, Side => Ada.Strings.Right);
-
- if BString_40 /= " Right Spaces" then
- Report.Failed("Incorrect results from Procedure Trim with " &
- "Side = Right");
- end if;
-
- BString_20 := BS20.To_Bounded_String(" Both Sides ");
- BS20.Trim(BString_20, Ada.Strings.Both);
-
- if BString_20 /= BS20.To_Bounded_String("Both Sides") then
- Report.Failed("Incorrect results from Procedure Trim with " &
- "Side = Both");
- end if;
-
- BString_80 := BS80.To_Bounded_String("Centered Spaces");
- BS80.Trim(BString_80, Ada.Strings.Both);
-
- if BString_80 /= BS80.To_Bounded_String("Centered Spaces") then
- Report.Failed("Incorrect results from Procedure Trim with " &
- "no blank spaces on the ends of the string");
- end if;
-
-
- -- Procedure Head
-
- BString_40 := BS40.To_Bounded_String("Test String");
- BS40.Head(Source => BString_40,
- Count => 4); -- Count < Source'Length
-
- if BString_40 /= BS40.To_Bounded_String("Test") then
- Report.Failed("Incorrect results from Procedure Head with " &
- "the Count parameter less than Source'Length");
- end if;
-
- BString_1 := BS1.To_Bounded_String("X");
- BS1.Head(BString_1, BS1.Length(BString_1)); -- Count = Source'Length
-
- if BString_1 /= "X" then
- Report.Failed("Incorrect results from Procedure Head with " &
- "the Count parameter equal to Source'Length");
- end if;
-
- BString_20 := BS20.To_Bounded_String("Sample string");
- BS20.Head(BString_20,
- Count => BS20.Max_Length, -- Count > Source'Length
- Pad => '*');
-
- if BString_20 /= BS20.To_Bounded_String("Sample string*******") then
- Report.Failed("Incorrect results from Procedure Head with " &
- "the Count parameter greater than Source'Length");
- end if;
-
- BString_20 := BS20.To_Bounded_String("Twenty Characters 20");
- BS20.Head(BString_20, 22, Pad => '*', Drop => Ada.Strings.Left);
-
- if BString_20 /= "enty Characters 20**" then
- Report.Failed("Incorrect results from Procedure Head with " &
- "the Count parameter greater than Source'Length, " &
- "and the Drop parameter = Left");
- end if;
-
- BString_20 := BS20.To_Bounded_String("Short String");
- BS20.Head(BString_20, 23, '-', Ada.Strings.Right);
-
- if ("Short String--------") /= BString_20 then
- Report.Failed("Incorrect results from Procedure Head with " &
- "the Count parameter greater than Source'Length, " &
- "and the Drop parameter = Right");
- end if;
-
-
- -- Procedure Tail
-
- BString_40 := BS40.To_Bounded_String("Test String");
- BS40.Tail(Source => BString_40,
- Count => 6); -- Count < Source'Length
-
- if BString_40 /= BS40.To_Bounded_String("String") then
- Report.Failed("Incorrect results from Procedure Tail with " &
- "the Count parameter less than Source'Length");
- end if;
-
- BString_1 := BS1.To_Bounded_String("X");
- BS1.Tail(BString_1, BS1.Length(BString_1)); -- Count = Source'Length
-
- if BString_1 /= "X" then
- Report.Failed("Incorrect results from Procedure Tail with " &
- "the Count parameter equal to Source'Length");
- end if;
-
- BString_20 := BS20.To_Bounded_String("Sample string");
- BS20.Tail(BString_20,
- Count => BS20.Max_Length, -- Count > Source'Length
- Pad => '*');
-
- if BString_20 /= BS20.To_Bounded_String("*******Sample string") then
- Report.Failed("Incorrect results from Procedure Tail with " &
- "the Count parameter greater than Source'Length");
- end if;
-
- BString_20 := BS20.To_Bounded_String("Twenty Characters"); -- Len = 17
- BS20.Tail(BString_20, 22, Pad => '*', Drop => Ada.Strings.Left);
-
- if BString_20 /= "***Twenty Characters" then
- Report.Failed("Incorrect results from Procedure Tail with " &
- "the Count parameter greater than Source'Length, " &
- "and the Drop parameter = Left");
- end if;
-
- BString_20 := BS20.To_Bounded_String("Maximum Length Chars");
- BS20.Tail(BString_20, 23, '-', Ada.Strings.Right);
-
- if ("---Maximum Length Ch") /= BString_20 then
- Report.Failed("Incorrect results from Procedure Tail with " &
- "the Count parameter greater than Source'Length, " &
- "and the Drop parameter = Right");
- end if;
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXA4028;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4029.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4029.a
deleted file mode 100644
index 7140674544a..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4029.a
+++ /dev/null
@@ -1,333 +0,0 @@
--- CXA4029.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functionality found in packages Ada.Strings.Wide_Maps,
--- Ada.Strings.Wide_Bounded, and Ada.Strings.Wide_Maps.Wide_Constants
--- is available and produces correct results.
---
--- TEST DESCRIPTION:
--- This test tests the subprograms found in the
--- Ada.Strings.Wide_Bounded package. It is based on the tests
--- CXA4027-28, which are tests for the complementary "non-wide"
--- packages.
---
--- The functions found in CXA4029_0 provide mapping capability, when
--- used in conjunction with Wide_Character_Mapping_Function objects.
---
---
--- CHANGE HISTORY:
--- 23 Jun 95 SAIC Initial prerelease version.
--- 18 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
---
---!
-
-package CXA4029_0 is
- -- Functions used to supply mapping capability.
- function Map_To_Lower_Case (From : Wide_Character) return Wide_Character;
- function Map_To_Upper_Case (From : Wide_Character) return Wide_Character;
-end CXA4029_0;
-
-with Ada.Characters.Handling;
-package body CXA4029_0 is
- -- Function Map_To_Lower_Case will return the lower case form of
- -- Wide_Characters in the range 'A'..'Z' only, and return the input
- -- wide_character otherwise.
-
- function Map_To_Lower_Case (From : Wide_Character)
- return Wide_Character is
- begin
- return Ada.Characters.Handling.To_Wide_Character(
- Ada.Characters.Handling.To_Lower(
- Ada.Characters.Handling.To_Character(From)));
- end Map_To_Lower_Case;
-
- -- Function Map_To_Upper_Case will return the upper case form of
- -- Wide_Characters in the range 'a'..'z', or whose position is in one
- -- of the ranges 223..246 or 248..255, provided the wide_character has
- -- an upper case form.
-
- function Map_To_Upper_Case (From : Wide_Character)
- return Wide_Character is
- begin
- return Ada.Characters.Handling.To_Wide_Character(
- Ada.Characters.Handling.To_Upper(
- Ada.Characters.Handling.To_Character(From)));
- end Map_To_Upper_Case;
-
-end CXA4029_0;
-
-
-with CXA4029_0;
-with Report;
-with Ada.Characters.Handling;
-with Ada.Characters.Latin_1;
-with Ada.Strings;
-with Ada.Strings.Wide_Maps;
-with Ada.Strings.Wide_Maps.Wide_Constants;
-with Ada.Strings.Wide_Fixed;
-with Ada.Strings.Wide_Bounded;
-
-procedure CXA4029 is
-begin
- Report.Test ("CXA4029",
- "Check that subprograms defined in package " &
- "Ada.Strings.Wide_Bounded produce correct results");
-
- Test_Block:
- declare
-
- package ACL1 renames Ada.Characters.Latin_1;
- package BS1 is new Ada.Strings.Wide_Bounded.Generic_Bounded_Length(1);
- package BS20 is new Ada.Strings.Wide_Bounded.Generic_Bounded_Length(20);
- package BS40 is new Ada.Strings.Wide_Bounded.Generic_Bounded_Length(40);
- package BS80 is new Ada.Strings.Wide_Bounded.Generic_Bounded_Length(80);
-
- subtype LC_Characters is Wide_Character range 'a'..'z';
-
- use Ada.Characters, Ada.Strings;
- use type Wide_Maps.Wide_Character_Set;
- use type BS1.Bounded_Wide_String, BS20.Bounded_Wide_String,
- BS40.Bounded_Wide_String, BS80.Bounded_Wide_String;
-
- TC_String : constant Wide_String := "A Standard String";
-
- BString_1 : BS1.Bounded_Wide_String :=
- BS1.Null_Bounded_Wide_String;
- BString_20 : BS20.Bounded_Wide_String :=
- BS20.Null_Bounded_Wide_String;
- BString_40 : BS40.Bounded_Wide_String :=
- BS40.Null_Bounded_Wide_String;
- BString_80 : BS80.Bounded_Wide_String :=
- BS80.Null_Bounded_Wide_String;
- String_20 : Wide_String(1..20) := "ABCDEFGHIJKLMNOPQRST";
- String_40 : Wide_String(1..40) := "abcdefghijklmnopqrst" &
- String_20;
- String_80 : Wide_String(1..80) := String_40 & String_40;
- TC_String_5 : Wide_String(1..5) := "ABCDE";
-
- -- The following strings are used in examination of the Translation
- -- subprograms.
- New_Character_String : Wide_String(1..10) :=
- Handling.To_Wide_String(
- ACL1.LC_A_Grave & ACL1.LC_A_Ring & ACL1.LC_AE_Diphthong &
- ACL1.LC_C_Cedilla & ACL1.LC_E_Acute & ACL1.LC_I_Circumflex &
- ACL1.LC_Icelandic_Eth & ACL1.LC_N_Tilde &
- ACL1.LC_O_Oblique_Stroke & ACL1.LC_Icelandic_Thorn);
-
- TC_New_Character_String : Wide_String(1..10) :=
- Handling.To_Wide_String(
- ACL1.UC_A_Grave & ACL1.UC_A_Ring & ACL1.UC_AE_Diphthong &
- ACL1.UC_C_Cedilla & ACL1.UC_E_Acute & ACL1.UC_I_Circumflex &
- ACL1.UC_Icelandic_Eth & ACL1.UC_N_Tilde &
- ACL1.UC_O_Oblique_Stroke & ACL1.UC_Icelandic_Thorn);
-
- -- Access objects that will be provided as parameters to the
- -- subprograms.
- Map_To_Lower_Case_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- CXA4029_0.Map_To_Lower_Case'Access;
- Map_To_Upper_Case_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- CXA4029_0.Map_To_Upper_Case'Access;
-
- begin
-
- -- Testing of functionality found in Package Ada.Strings.Wide_Bounded.
- --
- -- Function Index.
-
- if BS80.Index(BS80.To_Bounded_Wide_String("CoMpLeTeLy MiXeD CaSe"),
- "MIXED CASE",
- Ada.Strings.Forward,
- Map_To_Upper_Case_Ptr) /= 12 or
- BS1.Index(BS1.Null_Bounded_Wide_String,
- "i",
- Mapping => Map_To_Lower_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from BND Function Index, going " &
- "in Forward direction, using a Character Mapping " &
- "Function parameter");
- end if;
-
- -- Function Count.
- if BS40.Count(BS40.To_Bounded_Wide_String("This IS a MISmatched issue"),
- "is",
- Map_To_Lower_Case_Ptr) /= 4 or
- BS80.Count(BS80.To_Bounded_Wide_String("ABABABA"),
- "ABA",
- Map_To_Upper_Case_Ptr) /= 2
- then
- Report.Failed("Incorrect results from BND Function Count, using " &
- "a Character_Mapping_Function parameter");
- end if;
-
- -- Function Translate.
- if BS40.Translate(BS40.To_Bounded_Wide_String("A Mixed Case String"),
- Mapping => Map_To_Lower_Case_Ptr) /=
- BS40.To_Bounded_Wide_String("a mixed case string") or
- BS20."/="("end with lower case",
- BS20.Translate(
- BS20.To_Bounded_Wide_String("end with lower case"),
- Map_To_Lower_Case_Ptr))
- then
- Report.Failed("Incorrect results from BND Function Translate, " &
- "using a Character_Mapping_Function parameter");
- end if;
-
- -- Procedure Translate.
- BString_20 := BS20.To_Bounded_Wide_String(String_20);
- BS20.Translate(BString_20, Mapping => Map_To_Lower_Case_Ptr);
- if BString_20 /= BS20.To_Bounded_Wide_String("abcdefghijklmnopqrst")
- then
- Report.Failed("Incorrect result from BND Procedure Translate - 1");
- end if;
-
- BString_80 := BS80.Null_Bounded_Wide_String;
- BS80.Translate(BString_80, Map_To_Upper_Case_Ptr);
- if not (BString_80 = BS80.Null_Bounded_Wide_String) then
- Report.Failed("Incorrect result from BND Procedure Translate - 2");
- end if;
-
- -- Procedure Append.
- declare
- use BS20;
- begin
- BString_20 := BS20.Null_Bounded_Wide_String;
- Append(BString_20, 'T');
- Append(BString_20, "his string");
- Append(BString_20,
- To_Bounded_Wide_String(" is complete."),
- Drop => Ada.Strings.Right); -- Drop 4 characters.
- if BString_20 /= To_Bounded_Wide_String("This string is compl") then
- Report.Failed("Incorrect results from BS20 versions of " &
- "procedure Append");
- end if;
- exception
- when others => Report.Failed("Exception raised in block checking " &
- "BND Procedure Append");
- end;
-
- -- Operator "=".
- BString_40 := BS40.To_Bounded_Wide_String(String_40);
- BString_80 := BS80.To_Bounded_Wide_String(
- BS40.To_Wide_String(BString_40) &
- BS40.To_Wide_String(BString_40));
- if not (BString_40 = String_40 and
- BS80."="(String_80, BString_80)) then
- Report.Failed("Incorrect results from BND Function ""="" with " &
- "string - bounded string parameter combinations");
- end if;
-
- -- Operator "<".
- BString_1 := BS1.To_Bounded_Wide_String("cat",
- Drop => Ada.Strings.Right);
- BString_20 := BS20.To_Bounded_Wide_String("Santa Claus");
- if BString_1 < "C" or
- BS1."<"(BString_1,"c") or
- BS1."<"("x", BString_1) or
- BS20."<"(BString_20,"Santa ") or
- BS20."<"("Santa and his Elves", BString_20)
- then
- Report.Failed("Incorrect results from BND Function ""<"" with " &
- "string - bounded string parameter combinations");
- end if;
-
- -- Operator "<=".
- BString_20 := BS20.To_Bounded_Wide_String("Sample string");
- if BS20."<="(BString_20,"Sample strin") or
- not(BS20."<="("Sample string",BString_20))
- then
- Report.Failed("Incorrect results from BND Function ""<="" with " &
- "string - bounded string parameter combinations");
- end if;
-
- -- Operator ">".
- BString_40 := BS40.To_Bounded_Wide_String(
- "A MUCH LONGER SAMPLE STRING.");
- if BString_40 > "A much longer sample string" or
- BS40.To_Bounded_Wide_String("ABCDEFGH") > "abcdefgh"
- then
- Report.Failed("Incorrect results from BND Function "">"" with " &
- "string - bounded string parameter combinations");
- end if;
-
- -- Operator ">=".
- BString_80 := BS80.To_Bounded_Wide_String(String_80);
- if not (BString_80 >= String_80 and
- BS80.To_Bounded_Wide_String("Programming") >= "PROGRAMMING" and
- BS80.">="("test", BS80.To_Bounded_Wide_String("tess")))
- then
- Report.Failed("Incorrect results from BND Function "">="" with " &
- "string - bounded string parameter combinations");
- end if;
-
- -- Procedure Trim
- BString_20 := BS20.To_Bounded_Wide_String(" Both Sides ");
- BS20.Trim(BString_20, Ada.Strings.Both);
- if BString_20 /= BS20.To_Bounded_Wide_String("Both Sides") then
- Report.Failed("Incorrect results from BND Procedure Trim with " &
- "Side = Both");
- end if;
-
- -- Procedure Head
- BString_40 := BS40.To_Bounded_Wide_String("Test String");
- BS40.Head(Source => BString_40,
- Count => 4); -- Count < Source'Length
- if BString_40 /= BS40.To_Bounded_Wide_String("Test") then
- Report.Failed("Incorrect results from BND Procedure Head with " &
- "the Count parameter less than Source'Length");
- end if;
-
- BString_20 := BS20.To_Bounded_Wide_String("Short String");
- BS20.Head(BString_20, 23, '-', Ada.Strings.Right);
- if BS20.To_Bounded_Wide_String("Short String--------") /= BString_20 then
- Report.Failed("Incorrect results from BND Procedure Head with " &
- "the Count parameter greater than Source'Length, " &
- "and the Drop parameter = Right");
- end if;
-
- -- Procedure Tail
- BString_40 := BS40.To_Bounded_Wide_String("Test String");
- BS40.Tail(Source => BString_40,
- Count => 6);
- if BString_40 /= BS40.To_Bounded_Wide_String("String") then
- Report.Failed("Incorrect results from BND Procedure Tail with " &
- "the Count parameter less than Source'Length");
- end if;
-
- BString_20 := BS20.To_Bounded_Wide_String("Maximum Length Chars");
- BS20.Tail(BString_20, 23, '-', Ada.Strings.Right);
- if BS20.To_Bounded_Wide_String("---Maximum Length Ch") /= BString_20 then
- Report.Failed("Incorrect results from BND Procedure Tail with " &
- "the Count parameter greater than Source'Length, " &
- "and the Drop parameter = Right");
- end if;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4029;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4030.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4030.a
deleted file mode 100644
index 475d0089921..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4030.a
+++ /dev/null
@@ -1,414 +0,0 @@
--- CXA4030.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Ada.Strings.Unbounded versions of subprograms Translate
--- (procedure and function), Index, and Count, which use a
--- Maps.Character_Mapping_Function input parameter, produce correct
--- results.
---
--- TEST DESCRIPTION:
--- This test examines the operation of the four subprograms contained
--- in the Ada.Strings.Unbounded package that use a
--- Character_Mapping_Function parameter to provide the mapping
--- capability.
--- Two Character_Mapping_Function objects are defined that reference
--- subprograms contained in the Ada.Characters.Handling package;
--- To_Lower will return the lower-case form of the character provided
--- as the input parameter, To_Upper will return the upper-case form
--- of the character input parameter (provided there is an upper-case
--- form).
--- In several instances in this test, the character handling functions
--- are referenced directly in the parameter list of the subprograms
--- under test, demonstrating another form of expected common usage.
---
--- Results of all subprograms are compared with expected results.
---
--- This test, when taken in conjunction with tests CXA4010, CXA4011,
--- CXA4031, and CXA4032 will constitute a test of all the functionality
--- contained in package Ada.Strings.Unbounded. This test uses a variety
--- of the subprograms defined in the unbounded string package in ways
--- typical of common usage.
---
---
--- CHANGE HISTORY:
--- 21 Feb 95 SAIC Initial prerelease version
--- 21 Apr 95 SAIC Modified header commentary.
---
---!
-
-with Ada.Strings.Unbounded;
-with Ada.Strings.Maps;
-with Ada.Characters.Handling;
-with Ada.Characters.Latin_1;
-with Report;
-
-procedure CXA4030 is
-
-begin
-
- Report.Test ("CXA4030", "Check that Ada.Strings.Unbounded versions " &
- "of subprograms Translate (procedure and " &
- "function), Index, and Count, which use a " &
- "Maps.Character_Mapping_Function input " &
- "parameter, produce correct results");
-
- Test_Block:
- declare
-
- package Unb renames Ada.Strings.Unbounded;
- use type Unb.Unbounded_String;
- use Ada.Strings;
- use Ada.Characters;
-
-
- -- The following strings are used in examination of the Translation
- -- subprograms.
-
- New_Character_String : Unb.Unbounded_String :=
- Unb.To_Unbounded_String(
- Latin_1.LC_A_Grave &
- Latin_1.LC_A_Ring &
- Latin_1.LC_AE_Diphthong &
- Latin_1.LC_C_Cedilla &
- Latin_1.LC_E_Acute &
- Latin_1.LC_I_Circumflex &
- Latin_1.LC_Icelandic_Eth &
- Latin_1.LC_N_Tilde &
- Latin_1.LC_O_Oblique_Stroke &
- Latin_1.LC_Icelandic_Thorn);
-
-
- TC_New_Character_String : Unb.Unbounded_String :=
- Unb.To_Unbounded_String(
- Latin_1.UC_A_Grave &
- Latin_1.UC_A_Ring &
- Latin_1.UC_AE_Diphthong &
- Latin_1.UC_C_Cedilla &
- Latin_1.UC_E_Acute &
- Latin_1.UC_I_Circumflex &
- Latin_1.UC_Icelandic_Eth &
- Latin_1.UC_N_Tilde &
- Latin_1.UC_O_Oblique_Stroke &
- Latin_1.UC_Icelandic_Thorn);
-
-
- -- In this test, access objects are defined to refer to two functions
- -- from the Ada.Characters.Handling package. These access objects
- -- will be provided as parameters to the subprograms under test.
- -- Note: There will be several examples in this test of these character
- -- handling functions being referenced directly within the
- -- parameter list of the subprograms under test.
-
- Map_To_Lower_Case_Ptr : Maps.Character_Mapping_Function :=
- Handling.To_Lower'Access;
-
- Map_To_Upper_Case_Ptr : Maps.Character_Mapping_Function :=
- Handling.To_Upper'Access;
-
- begin
-
- -- Function Index, Forward direction search.
- -- Note: Several of the following cases use the default value
- -- Forward for the Going parameter.
-
- if Unb.Index(Source => Unb.To_Unbounded_String(
- "The library package Strings.Unbounded"),
- Pattern => "unb",
- Going => Ada.Strings.Forward,
- Mapping => Map_To_Lower_Case_Ptr) /= 29 or
-
- Unb.Index(Unb.To_Unbounded_String(
- "THE RAIN IN SPAIN FALLS MAINLY ON THE PLAIN"),
- "ain",
- Mapping => Map_To_Lower_Case_Ptr) /= 6 or
-
- Unb.Index(Unb.To_Unbounded_String("maximum number"),
- "um",
- Ada.Strings.Forward,
- Handling.To_Lower'Access) /= 6 or
-
- Unb.Index(Unb.To_Unbounded_String("CoMpLeTeLy MiXeD CaSe StRiNg"),
- "MIXED CASE STRING",
- Ada.Strings.Forward,
- Map_To_Upper_Case_Ptr) /= 12 or
-
- Unb.Index(Unb.To_Unbounded_String(
- "STRING WITH NO MATCHING PATTERNS"),
- "WITH",
- Mapping => Map_To_Lower_Case_Ptr) /= 0 or
-
- Unb.Index(Unb.To_Unbounded_String("THIS STRING IS IN UPPER CASE"),
- "IS",
- Ada.Strings.Forward,
- Handling.To_Upper'Access) /= 3 or
-
- Unb.Index(Unb.Null_Unbounded_String,
- "is",
- Mapping => Map_To_Lower_Case_Ptr) /= 0 or
-
- Unb.Index(Unb.To_Unbounded_String("AAABBBaaabbb"),
- "aabb",
- Mapping => Handling.To_Lower'Access) /= 2
- then
- Report.Failed("Incorrect results from Function Index, going " &
- "in Forward direction, using a Character Mapping " &
- "Function parameter");
- end if;
-
-
-
- -- Function Index, Backward direction search.
-
- if Unb.Index(Unb.To_Unbounded_String("Case of a Mixed Case String"),
- "case",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 17 or
-
- Unb.Index(Unb.To_Unbounded_String("Case of a Mixed Case String"),
- "CASE",
- Ada.Strings.Backward,
- Mapping => Map_To_Upper_Case_Ptr) /= 17 or
-
- Unb.Index(Unb.To_Unbounded_String("rain, Rain, and more RAIN"),
- "rain",
- Ada.Strings.Backward,
- Handling.To_Lower'Access) /= 22 or
-
- Unb.Index(Unb.To_Unbounded_String("RIGHT place, right time"),
- "RIGHT",
- Ada.Strings.Backward,
- Handling.To_Upper'Access) /= 14 or
-
- Unb.Index(Unb.To_Unbounded_String("WOULD MATCH BUT FOR THE CASE"),
- "WOULD MATCH BUT FOR THE CASE",
- Going => Ada.Strings.Backward,
- Mapping => Map_To_Lower_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Index, going " &
- "in Backward direction, using a Character Mapping " &
- "Function parameter");
- end if;
-
-
-
- -- Function Index, Pattern_Error if Pattern = Null_String
-
- declare
- use Unbounded;
- Null_String : constant String := "";
- TC_Natural : Natural := 1000;
- begin
- TC_Natural := Index(To_Unbounded_String("A Valid Unbounded String"),
- Null_String,
- Going => Ada.Strings.Forward,
- Mapping => Handling.To_Lower'Access);
- Report.Failed("Pattern_Error not raised by Function Index when " &
- "given a null pattern string");
- exception
- when Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Function Index " &
- "using a Character Mapping Function parameter " &
- "when given a null pattern string");
- end;
-
-
-
- -- Function Count.
-
- if Unb.Count(Source => Unb.To_Unbounded_String("ABABABA"),
- Pattern => "aba",
- Mapping => Map_To_Lower_Case_Ptr) /= 2 or
-
- Unb.Count(Unb.To_Unbounded_String("ABABABA"),
- "ABA",
- Mapping => Map_To_Lower_Case_Ptr) /= 0 or
-
- Unb.Count(Unb.To_Unbounded_String("This IS a MISmatched issue"),
- "is",
- Handling.To_Lower'Access) /= 4 or
-
- Unb.Count(Unb.To_Unbounded_String("ABABABA"),
- "ABA",
- Map_To_Upper_Case_Ptr) /= 2 or
-
- Unb.Count(Unb.To_Unbounded_String("This IS a MISmatched issue"),
- "is",
- Mapping => Map_To_Upper_Case_Ptr) /= 0 or
-
- Unb.Count(Unb.To_Unbounded_String(
- "She sells sea shells by the sea shore"),
- "s",
- Handling.To_Lower'Access) /= 8 or
-
- Unb.Count(Unb.Null_Unbounded_String,
- "match",
- Map_To_Upper_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Count, using " &
- "a Character Mapping Function parameter");
- end if;
-
-
-
- -- Function Count, Pattern_Error if Pattern = Null_String
-
- declare
- use Ada.Strings.Unbounded;
- Null_Pattern_String : constant String := "";
- TC_Natural : Natural := 1000;
- begin
- TC_Natural := Count(To_Unbounded_String("A Valid String"),
- Null_Pattern_String,
- Map_To_Lower_Case_Ptr);
- Report.Failed("Pattern_Error not raised by Function Count using " &
- "a Character Mapping Function parameter when " &
- "given a null pattern string");
- exception
- when Pattern_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Function Count " &
- "using a Character Mapping Function parameter " &
- "when given a null pattern string");
- end;
-
-
-
- -- Function Translate.
-
- if Unb.Translate(Source => Unb.To_Unbounded_String(
- "A Sample Mixed Case String"),
- Mapping => Map_To_Lower_Case_Ptr) /=
- Unb.To_Unbounded_String("a sample mixed case string") or
-
- Unb.Translate(Unb.To_Unbounded_String("ALL LOWER CASE"),
- Handling.To_Lower'Access) /=
- Unb.To_Unbounded_String("all lower case") or
-
- Unb.Translate(Unb.To_Unbounded_String("end with lower case"),
- Map_To_Lower_Case_Ptr) /=
- Unb.To_Unbounded_String("end with lower case") or
-
- Unb.Translate(Unb.Null_Unbounded_String,
- Handling.To_Lower'Access) /=
- Unb.Null_Unbounded_String or
-
- Unb.Translate(Unb.To_Unbounded_String("start with lower case"),
- Map_To_Upper_Case_Ptr) /=
- Unb.To_Unbounded_String("START WITH LOWER CASE") or
-
- Unb.Translate(Unb.To_Unbounded_String("ALL UPPER CASE STRING"),
- Handling.To_Upper'Access) /=
- Unb.To_Unbounded_String("ALL UPPER CASE STRING") or
-
- Unb.Translate(Unb.To_Unbounded_String(
- "LoTs Of MiXeD CaSe ChArAcTeRs"),
- Map_To_Upper_Case_Ptr) /=
- Unb.To_Unbounded_String("LOTS OF MIXED CASE CHARACTERS") or
-
- Unb.Translate(New_Character_String,
- Handling.To_Upper'Access) /=
- TC_New_Character_String
-
- then
- Report.Failed("Incorrect results from Function Translate, using " &
- "a Character Mapping Function parameter");
- end if;
-
-
-
- -- Procedure Translate.
-
- declare
-
- use Ada.Strings.Unbounded;
- use Ada.Characters.Handling;
-
- Str_1 : Unbounded_String :=
- To_Unbounded_String("AN ALL UPPER CASE STRING");
- Str_2 : Unbounded_String :=
- To_Unbounded_String("A Mixed Case String");
- Str_3 : Unbounded_String :=
- To_Unbounded_String("a string with lower case letters");
- TC_Str_1 : constant Unbounded_String := Str_1;
- TC_Str_3 : constant Unbounded_String := Str_3;
-
- begin
-
- Translate(Source => Str_1, Mapping => Map_To_Lower_Case_Ptr);
-
- if Str_1 /= To_Unbounded_String("an all upper case string") then
- Report.Failed("Incorrect result from Procedure Translate - 1");
- end if;
-
- Translate(Source => Str_1, Mapping => Map_To_Upper_Case_Ptr);
-
- if Str_1 /= TC_Str_1 then
- Report.Failed("Incorrect result from Procedure Translate - 2");
- end if;
-
- Translate(Str_2, Mapping => Map_To_Lower_Case_Ptr);
-
- if Str_2 /= To_Unbounded_String("a mixed case string") then
- Report.Failed("Incorrect result from Procedure Translate - 3");
- end if;
-
- Translate(Str_2, Mapping => To_Upper'Access);
-
- if Str_2 /= To_Unbounded_String("A MIXED CASE STRING") then
- Report.Failed("Incorrect result from Procedure Translate - 4");
- end if;
-
- Translate(Str_3, To_Lower'Access);
-
- if Str_3 /= TC_Str_3 then
- Report.Failed("Incorrect result from Procedure Translate - 5");
- end if;
-
- Translate(Str_3, To_Upper'Access);
-
- if Str_3 /=
- To_Unbounded_String("A STRING WITH LOWER CASE LETTERS")
- then
- Report.Failed("Incorrect result from Procedure Translate - 6");
- end if;
-
- Translate(New_Character_String, Map_To_Upper_Case_Ptr);
-
- if New_Character_String /= TC_New_Character_String then
- Report.Failed("Incorrect result from Procedure Translate - 6");
- end if;
-
- end;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4030;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4031.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4031.a
deleted file mode 100644
index 91bc68ce6e7..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4031.a
+++ /dev/null
@@ -1,291 +0,0 @@
--- CXA4031.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Strings.Unbounded
--- are available, and that they produce correct results. Specifically,
--- check the functions To_Unbounded_String (version with Length
--- parameter), "=", "<", "<=", ">", ">=" (all with String-Unbounded
--- String parameter mix), as well as three versions of Procedure Append.
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of many of the subprograms defined
--- in package Ada.Strings.Unbounded for use with unbounded strings.
--- The test simulates how unbounded strings could be processed in a
--- user environment, using the subprograms provided in this package.
---
--- This test, when taken in conjunction with tests CXA4010, CXA4011,
--- CXA4030, and CXA4032 will constitute a test of all the functionality
--- contained in package Ada.Strings.Unbounded. This test uses a variety
--- of the subprograms defined in the unbounded string package in ways
--- typical of common usage.
---
---
--- CHANGE HISTORY:
--- 27 Feb 95 SAIC Initial prerelease version.
--- 18 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
---
---!
-
-with Report;
-with Ada.Exceptions;
-with Ada.Strings.Maps;
-with Ada.Strings.Unbounded;
-
-procedure CXA4031 is
-begin
-
- Report.Test ("CXA4031", "Check that the subprograms defined in " &
- "package Ada.Strings.Unbounded are available, " &
- "and that they produce correct results");
-
- Test_Block:
- declare
-
- package Unb renames Ada.Strings.Unbounded;
- use Unb;
- use Ada.Exceptions;
-
- subtype LC_Characters is Character range 'a'..'z';
-
- Null_String : constant String := "";
- TC_String : constant String := "A Standard String";
-
- TC_Unb_String,
- TC_New_Unb_String : Unb.Unbounded_String := Unb.Null_Unbounded_String;
-
- begin
-
- -- Function To_Unbounded_String (version with Length parameter)
- -- returns an unbounded string that represents an uninitialized String
- -- whose length is Length.
- -- Note: Unbounded_String length can vary conceptually between 0 and
- -- Natural'Last.
-
- if Unb.Length(Unb.To_Unbounded_String(Length => 10)) /= 10 or
- Unb.Length(Unb.To_Unbounded_String(1)) /= 1 or
- Unb.Length(Unb.To_Unbounded_String(0)) /= 0 or
- Unb.Length(Unb."&"(Unb.To_Unbounded_String(Length => 10),
- Unb."&"(Unb.To_Unbounded_String(1),
- Unb.To_Unbounded_String(0) ))) /= 10+1+0
- then
- Report.Failed
- ("Incorrect results from Function To_Unbounded_String with " &
- "Length parameter");
- end if;
-
-
- -- Procedure Append (Unbounded - Unbounded)
- -- Note: For each of the Append procedures, the resulting string
- -- represented by the Source parameter is given by the
- -- concatenation of the original value of Source and the value
- -- of New_Item.
-
- TC_Unb_String := Unb.To_Unbounded_String("Sample string of length L");
- TC_New_Unb_String := Unb.To_Unbounded_String(" and then some");
-
- Unb.Append(Source => TC_Unb_String, New_Item => TC_New_Unb_String);
-
- if TC_Unb_String /=
- Unb.To_Unbounded_String("Sample string of length L and then some")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "unbounded string parameters - 1");
- end if;
-
-
- TC_Unb_String := Unb.To_Unbounded_String("Sample string of length L");
- TC_New_Unb_String := Unb.Null_Unbounded_String;
-
- Unb.Append(TC_Unb_String, TC_New_Unb_String);
-
- if TC_Unb_String /=
- Unb.To_Unbounded_String("Sample string of length L")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "unbounded string parameters - 2");
- end if;
-
-
- TC_Unb_String := Unb.Null_Unbounded_String;
-
- Unb.Append(TC_Unb_String,
- Unb.To_Unbounded_String("New Unbounded String"));
-
- if TC_Unb_String /=
- Unb.To_Unbounded_String("New Unbounded String")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "unbounded string parameters - 3");
- end if;
-
-
- -- Procedure Append (Unbounded - String)
-
- TC_Unb_String := Unb.To_Unbounded_String("An Unbounded String and ");
-
- Unb.Append(Source => TC_Unb_String, New_Item => TC_String);
-
- if TC_Unb_String /=
- Unb.To_Unbounded_String("An Unbounded String and A Standard String")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "an unbounded string parameter and a string " &
- "parameter - 1");
- end if;
-
-
- TC_Unb_String := Unb.To_Unbounded_String("An Unbounded String");
-
- Unb.Append(TC_Unb_String, New_Item => Null_String);
-
- if TC_Unb_String /=
- Unb.To_Unbounded_String("An Unbounded String")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "an unbounded string parameter and a string " &
- "parameter - 2");
- end if;
-
-
- TC_Unb_String := Unb.Null_Unbounded_String;
-
- Unb.Append(TC_Unb_String, TC_String);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("A Standard String") then
- Report.Failed("Incorrect results from Procedure Append with " &
- "an unbounded string parameter and a string " &
- "parameter - 3");
- end if;
-
-
- -- Procedure Append (Unbounded - Character)
-
- TC_Unb_String := Unb.To_Unbounded_String("Lower Case = ");
-
- for i in LC_Characters'Range loop
- Unb.Append(Source => TC_Unb_String, New_Item => LC_Characters(i));
- end loop;
-
- if TC_Unb_String /=
- Unb.To_Unbounded_String("Lower Case = abcdefghijklmnopqrstuvwxyz")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "an unbounded string parameter and a character " &
- "parameter - 1");
- end if;
-
-
- TC_Unb_String := Unb.Null_Unbounded_String;
-
- Unb.Append(TC_Unb_String, New_Item => 'a');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("a") then
- Report.Failed("Incorrect results from Procedure Append with " &
- "an unbounded string parameter and a character " &
- "parameter - 2");
- end if;
-
-
- -- Function "="
-
- TC_Unb_String := Unb.To_Unbounded_String(TC_String);
-
- if not (TC_Unb_String = TC_String) or -- (Unb_Str, Str)
- not Unb."="("A Standard String", TC_Unb_String) or -- (Str, Unb_Str)
- not ((Unb.Null_Unbounded_String = "") and -- (Unb_Str, Str)
- ("Test String" = -- (Str, Unb_Str)
- Unb.To_Unbounded_String("Test String")))
- then
- Report.Failed("Incorrect results from function ""="" with " &
- "string - unbounded string parameter combinations");
- end if;
-
-
- -- Function "<"
-
- if not ("Extra Space" < Unb.To_Unbounded_String("Extra Space ") and
- Unb.To_Unbounded_String("tess") < "test" and
- Unb.To_Unbounded_String("best") < "test") or
- Unb.Null_Unbounded_String < Null_String or
- " leading blank" < Unb.To_Unbounded_String(" leading blank") or
- "ending blank " < Unb.To_Unbounded_String("ending blank ")
- then
- Report.Failed("Incorrect results from function ""<"" with " &
- "string - unbounded string parameter combinations");
- end if;
-
-
- -- Function "<="
-
- TC_Unb_String := Unb.To_Unbounded_String("Sample string");
-
- if TC_Unb_String <= "Sample strin" or -- (Unb_Str, Str)
- "sample string" <= TC_Unb_String or -- (Str, Unb_Str)
- not(Unb.Null_Unbounded_String <= "") or -- (Unb_Str, Str)
- not("Sample string" <= TC_Unb_String) -- (Str, Unb_Str)
- then
- Report.Failed("Incorrect results from function ""<="" with " &
- "string - unbounded string parameter combinations");
- end if;
-
-
- -- Function ">"
-
- TC_Unb_String := Unb.To_Unbounded_String("A MUCH LONGER STRING");
-
- if not ("A much longer string" > TC_Unb_String and
- Unb.To_Unbounded_String(TC_String) > "A Standard Strin" and
- "abcdefgh" > Unb.To_Unbounded_String("ABCDEFGH")) or
- Unb.Null_Unbounded_String > Null_String
- then
- Report.Failed("Incorrect results from function "">"" with " &
- "string - unbounded string parameter combinations");
- end if;
-
-
- -- Function ">="
-
- TC_Unb_String := Unb.To_Unbounded_String(TC_String);
-
- if not (TC_Unb_String >= TC_String and
- Null_String >= Unb.Null_Unbounded_String and
- "test" >= Unb.To_Unbounded_String("tess") and
- Unb.To_Unbounded_String("Programming") >= "PROGRAMMING")
- then
- Report.Failed("Incorrect results from function "">="" with " &
- "string - unbounded string parameter combinations");
- end if;
-
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXA4031;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4032.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4032.a
deleted file mode 100644
index 031d01c6cb7..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4032.a
+++ /dev/null
@@ -1,457 +0,0 @@
--- CXA4032.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that procedures defined in package Ada.Strings.Unbounded
--- are available, and that they produce correct results. Specifically,
--- check the procedures Replace_Slice, Insert, Overwrite, Delete,
--- Trim (2 versions), Head, and Tail.
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of many of the procedures defined
--- in package Ada.Strings.Unbounded for use with unbounded strings.
--- The test simulates how unbounded strings could be processed in a
--- user environment, using the procedures provided in this package.
---
--- This test, when taken in conjunction with tests CXA4010, CXA4011,
--- CXA4030, and CXA4031 will constitute a test of all the functionality
--- contained in package Ada.Strings.Unbounded. This test uses a variety
--- of the procedures defined in the unbounded string package in ways
--- typical of common usage.
---
---
--- CHANGE HISTORY:
--- 02 Mar 95 SAIC Initial prerelease version.
---
---!
-
-with Report;
-with Ada.Strings;
-with Ada.Strings.Maps;
-with Ada.Strings.Maps.Constants;
-with Ada.Strings.Unbounded;
-
-procedure CXA4032 is
-begin
-
- Report.Test ("CXA4032", "Check that the subprograms defined in " &
- "package Ada.Strings.Unbounded are available, " &
- "and that they produce correct results");
-
- Test_Block:
- declare
-
- package Unb renames Ada.Strings.Unbounded;
- use Unb;
- use Ada.Strings;
-
- TC_Null_String : constant String := "";
- TC_String_5 : String(1..5) := "ABCDE";
-
- TC_Unb_String : Unb.Unbounded_String :=
- Unb.To_Unbounded_String("Test String");
-
- begin
-
- -- Procedure Replace_Slice
-
- begin -- Low > Source'Last+1
- Unb.Replace_Slice(Source => TC_Unb_String,
- Low => Unb.Length(TC_Unb_String) + 2,
- High => Unb.Length(TC_Unb_String),
- By => TC_String_5);
- Report.Failed("Index_Error not raised by Replace_Slice when Low " &
- "> Source'Last+1");
- exception
- when Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Replace_Slice" &
- "when Low > Source'Last+1");
- end;
-
- -- High >= Low
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Replace_Slice(TC_Unb_String, 5, 5, TC_String_5);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("TestABCDEString") then
- Report.Failed("Incorrect results from Replace_Slice - 1");
- end if;
-
- Unb.Replace_Slice(TC_Unb_String, 1, 4, TC_String_5);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("ABCDEABCDEString") then
- Report.Failed("Incorrect results from Replace_Slice - 2");
- end if;
-
- Unb.Replace_Slice(TC_Unb_String,
- 11,
- Unb.Length(TC_Unb_String),
- TC_Null_String);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("ABCDEABCDE") then
- Report.Failed("Incorrect results from Replace_Slice - 3");
- end if;
-
- -- High < Low
-
- Unb.Replace_Slice(TC_Unb_String, Low => 4, High => 1, By => "xxx");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("ABCxxxDEABCDE") then
- Report.Failed("Incorrect results from Replace_Slice - 4");
- end if;
-
- Unb.Replace_Slice(TC_Unb_String, Low => 1, High => 0, By => "yyy");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("yyyABCxxxDEABCDE") then
- Report.Failed("Incorrect results from Replace_Slice - 5");
- end if;
-
- Unb.Replace_Slice(TC_Unb_String,
- Unb.Length(TC_Unb_String) + 1,
- Unb.Length(TC_Unb_String),
- By => "zzz");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("yyyABCxxxDEABCDEzzz") then
- Report.Failed("Incorrect results from Replace_Slice - 6");
- end if;
-
-
- -- Procedure Insert
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- begin -- Before not in Source'First..Source'Last + 1
- Unb.Insert(Source => TC_Unb_String,
- Before => Unb.Length(TC_Unb_String) + 2,
- New_Item => TC_String_5);
- Report.Failed("Index_Error not raised by Insert when Before " &
- "not in the range Source'First..Source'Last+1");
- exception
- when Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Unexpected exception raised by Insert when Before not in " &
- "the range Source'First..Source'Last+1");
- end;
-
- Unb.Insert(TC_Unb_String, 1, "**");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("**Test String") then
- Report.Failed("Incorrect results from Insert - 1");
- end if;
-
- Unb.Insert(TC_Unb_String, Unb.Length(TC_Unb_String)+1, "**");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("**Test String**") then
- Report.Failed("Incorrect results from Insert - 2");
- end if;
-
- Unb.Insert(TC_Unb_String, 8, "---");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("**Test ---String**") then
- Report.Failed("Incorrect results from Insert - 3");
- end if;
-
- Unb.Insert(TC_Unb_String, 3, TC_Null_String);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("**Test ---String**") then
- Report.Failed("Incorrect results from Insert - 4");
- end if;
-
-
- -- Procedure Overwrite
-
- begin -- Position not in Source'First..Source'Last + 1
- Unb.Overwrite(Source => TC_Unb_String,
- Position => Unb.Length(TC_Unb_String) + 2,
- New_Item => TC_String_5);
- Report.Failed("Index_Error not raised by Overwrite when Position " &
- "not in the range Source'First..Source'Last+1");
- exception
- when Index_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Unexpected exception raised by Overwrite when Position not " &
- "in the range Source'First..Source'Last+1");
- end;
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Overwrite(Source => TC_Unb_String,
- Position => 1,
- New_Item => "XXXX");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("XXXX String") then
- Report.Failed("Incorrect results from Overwrite - 1");
- end if;
-
- Unb.Overwrite(TC_Unb_String, Unb.Length(TC_Unb_String)+1, "**");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("XXXX String**") then
- Report.Failed("Incorrect results from Overwrite - 2");
- end if;
-
- Unb.Overwrite(TC_Unb_String, 3, TC_Null_String);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("XXXX String**") then
- Report.Failed("Incorrect results from Overwrite - 3");
- end if;
-
- Unb.Overwrite(TC_Unb_String, 1, "abcdefghijklmn");
-
- if TC_Unb_String /= Unb.To_Unbounded_String("abcdefghijklmn") then
- Report.Failed("Incorrect results from Overwrite - 4");
- end if;
-
-
- -- Procedure Delete
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- -- From > Through (No change to Source)
-
- Unb.Delete(Source => TC_Unb_String,
- From => Unb.Length(TC_Unb_String),
- Through => Unb.Length(TC_Unb_String)-1);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then
- Report.Failed("Incorrect results from Delete - 1");
- end if;
-
- Unb.Delete(TC_Unb_String, 1, 0);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then
- Report.Failed("Incorrect results from Delete - 2");
- end if;
-
- -- From <= Through
-
- Unb.Delete(TC_Unb_String, 1, 5);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("String") then
- Report.Failed("Incorrect results from Delete - 3");
- end if;
-
- Unb.Delete(TC_Unb_String, 3, 3);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Sting") then
- Report.Failed("Incorrect results from Delete - 4");
- end if;
-
-
- -- Procedure Trim
-
- TC_Unb_String := Unb.To_Unbounded_String("No Spaces");
-
- Unb.Trim(Source => TC_Unb_String, Side => Ada.Strings.Both);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("No Spaces") then
- Report.Failed("Incorrect results from Trim - 1");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String(" Leading Spaces ");
-
- Unb.Trim(TC_Unb_String, Ada.Strings.Left);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Leading Spaces ") then
- Report.Failed("Incorrect results from Trim - 2");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String(" Ending Spaces ");
-
- Unb.Trim(TC_Unb_String, Ada.Strings.Right);
-
- if TC_Unb_String /= Unb.To_Unbounded_String(" Ending Spaces") then
- Report.Failed("Incorrect results from Trim - 3");
- end if;
-
- TC_Unb_String :=
- Unb.To_Unbounded_String(" Spaces on both ends ");
-
- Unb.Trim(TC_Unb_String, Ada.Strings.Both);
-
- if TC_Unb_String /=
- Unb.To_Unbounded_String("Spaces on both ends")
- then
- Report.Failed("Incorrect results from Trim - 4");
- end if;
-
-
- -- Procedure Trim (with Character Set parameters)
-
- TC_Unb_String := Unb.To_Unbounded_String("lowerCASEletters");
-
- Unb.Trim(Source => TC_Unb_String,
- Left => Ada.Strings.Maps.Constants.Lower_Set,
- Right => Ada.Strings.Maps.Constants.Lower_Set);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("CASE") then
- Report.Failed("Incorrect results from Trim with Sets - 1");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String("lowerCASEletters");
-
- Unb.Trim(TC_Unb_String,
- Ada.Strings.Maps.Constants.Upper_Set,
- Ada.Strings.Maps.Constants.Upper_Set);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("lowerCASEletters") then
- Report.Failed("Incorrect results from Trim with Sets - 2");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String("012abcdefghGFEDCBA789ab");
-
- Unb.Trim(TC_Unb_String,
- Ada.Strings.Maps.Constants.Hexadecimal_Digit_Set,
- Ada.Strings.Maps.Constants.Hexadecimal_Digit_Set);
-
- if TC_Unb_String /= Unb.To_Unbounded_String("ghG") then
- Report.Failed("Incorrect results from Trim with Sets - 3");
- end if;
-
-
- -- Procedure Head
-
- -- Count <= Source'Length
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Head(Source => TC_Unb_String,
- Count => 0,
- Pad => '*');
-
- if TC_Unb_String /= Unb.Null_Unbounded_String then
- Report.Failed("Incorrect results from Head - 1");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Head(Source => TC_Unb_String,
- Count => 4,
- Pad => '*');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Test") then
- Report.Failed("Incorrect results from Head - 2");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Head(Source => TC_Unb_String,
- Count => Unb.Length(TC_Unb_String),
- Pad => '*');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then
- Report.Failed("Incorrect results from Head - 3");
- end if;
-
- -- Count > Source'Length
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Head(Source => TC_Unb_String,
- Count => Unb.Length(TC_Unb_String) + 4,
- Pad => '*');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Test String****") then
- Report.Failed("Incorrect results from Head - 4");
- end if;
-
- TC_Unb_String := Unb.Null_Unbounded_String;
-
- Unb.Head(Source => TC_Unb_String,
- Count => Unb.Length(TC_Unb_String) + 3,
- Pad => '*');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("***") then
- Report.Failed("Incorrect results from Head - 5");
- end if;
-
-
- -- Procedure Tail
-
- -- Count <= Source'Length
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Tail(Source => TC_Unb_String,
- Count => 0,
- Pad => '*');
-
- if TC_Unb_String /= Unb.Null_Unbounded_String then
- Report.Failed("Incorrect results from Tail - 1");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Tail(Source => TC_Unb_String,
- Count => 6,
- Pad => '*');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("String") then
- Report.Failed("Incorrect results from Tail - 2");
- end if;
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Tail(Source => TC_Unb_String,
- Count => Unb.Length(TC_Unb_String),
- Pad => '*');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then
- Report.Failed("Incorrect results from Tail - 3");
- end if;
-
- -- Count > Source'Length
-
- TC_Unb_String := Unb.To_Unbounded_String("Test String");
-
- Unb.Tail(Source => TC_Unb_String,
- Count => Unb.Length(TC_Unb_String) + 5,
- Pad => 'x');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("xxxxxTest String") then
- Report.Failed("Incorrect results from Tail - 4");
- end if;
-
- TC_Unb_String := Unb.Null_Unbounded_String;
-
- Unb.Tail(Source => TC_Unb_String,
- Count => Unb.Length(TC_Unb_String) + 3,
- Pad => 'X');
-
- if TC_Unb_String /= Unb.To_Unbounded_String("XXX") then
- Report.Failed("Incorrect results from Tail - 5");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4032;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4033.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4033.a
deleted file mode 100644
index 8f39b4cff05..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4033.a
+++ /dev/null
@@ -1,405 +0,0 @@
--- CXA4033.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functionality found in packages Ada.Strings.Wide_Maps,
--- Ada.Strings.Wide_Unbounded, and Ada.Strings.Wide_Maps.Wide_Constants
--- is available and produces correct results.
---
--- TEST DESCRIPTION:
--- This test tests the subprograms found in the
--- Ada.Strings.Wide_Unbounded package. It is based on the tests
--- CXA4030-32, which are tests for the complementary "non-wide"
--- packages.
---
--- The functions found in CXA4033_0 provide mapping capability, when
--- used in conjunction with Wide_Character_Mapping_Function objects.
---
---
--- CHANGE HISTORY:
--- 23 Jun 95 SAIC Initial prerelease version.
--- 24 Feb 97 PWB.CTA Removed attempt to create wide string of length
--- Natural'Last
---!
-
-package CXA4033_0 is
- -- Functions used to supply mapping capability.
- function Map_To_Lower_Case (From : Wide_Character) return Wide_Character;
- function Map_To_Upper_Case (From : Wide_Character) return Wide_Character;
-end CXA4033_0;
-
-with Ada.Characters.Handling;
-package body CXA4033_0 is
- -- Function Map_To_Lower_Case will return the lower case form of
- -- Wide_Characters in the range 'A'..'Z' only, and return the input
- -- wide_character otherwise.
-
- function Map_To_Lower_Case (From : Wide_Character)
- return Wide_Character is
- begin
- return Ada.Characters.Handling.To_Wide_Character(
- Ada.Characters.Handling.To_Lower(
- Ada.Characters.Handling.To_Character(From)));
- end Map_To_Lower_Case;
-
- -- Function Map_To_Upper_Case will return the upper case form of
- -- Wide_Characters in the range 'a'..'z', or whose position is in one
- -- of the ranges 223..246 or 248..255, provided the wide_character has
- -- an upper case form.
-
- function Map_To_Upper_Case (From : Wide_Character)
- return Wide_Character is
- begin
- return Ada.Characters.Handling.To_Wide_Character(
- Ada.Characters.Handling.To_Upper(
- Ada.Characters.Handling.To_Character(From)));
- end Map_To_Upper_Case;
-
-end CXA4033_0;
-
-
-with CXA4033_0;
-with Report;
-with Ada.Characters.Handling;
-with Ada.Characters.Latin_1;
-with Ada.Strings;
-with Ada.Strings.Wide_Maps;
-with Ada.Strings.Wide_Maps.Wide_Constants;
-with Ada.Strings.Wide_Fixed;
-with Ada.Strings.Wide_Unbounded;
-
-procedure CXA4033 is
-begin
- Report.Test ("CXA4033",
- "Check that subprograms defined in the package " &
- "Ada.Strings.Wide_Unbounded produce correct results");
-
- Test_Block:
- declare
-
- package ACL1 renames Ada.Characters.Latin_1;
- package Unb renames Ada.Strings.Wide_Unbounded;
-
- subtype LC_Characters is Wide_Character range 'a'..'z';
-
- use Ada.Characters, Ada.Strings, Unb;
- use type Wide_Maps.Wide_Character_Set;
-
- TC_String : constant Wide_String := "A Standard String";
-
- String_20 : Wide_String(1..20) := "ABCDEFGHIJKLMNOPQRST";
- String_40 : Wide_String(1..40) := "abcdefghijklmnopqrst" &
- String_20;
- String_80 : Wide_String(1..80) := String_40 & String_40;
- TC_String_5 : Wide_String(1..5) := "ABCDE";
- TC_Unb_String : Unbounded_Wide_String := Null_Unbounded_Wide_String;
-
- -- The following strings are used in examination of the Translation
- -- subprograms.
- New_Character_String : Wide_String(1..10) :=
- Handling.To_Wide_String(
- ACL1.LC_A_Grave & ACL1.LC_A_Ring & ACL1.LC_AE_Diphthong &
- ACL1.LC_C_Cedilla & ACL1.LC_E_Acute & ACL1.LC_I_Circumflex &
- ACL1.LC_Icelandic_Eth & ACL1.LC_N_Tilde &
- ACL1.LC_O_Oblique_Stroke & ACL1.LC_Icelandic_Thorn);
-
- TC_New_Character_String : Wide_String(1..10) :=
- Handling.To_Wide_String(
- ACL1.UC_A_Grave & ACL1.UC_A_Ring & ACL1.UC_AE_Diphthong &
- ACL1.UC_C_Cedilla & ACL1.UC_E_Acute & ACL1.UC_I_Circumflex &
- ACL1.UC_Icelandic_Eth & ACL1.UC_N_Tilde &
- ACL1.UC_O_Oblique_Stroke & ACL1.UC_Icelandic_Thorn);
-
- New_UB_Character_String : Unbounded_Wide_String :=
- To_Unbounded_Wide_String(New_Character_String);
-
- TC_New_UB_Character_String : Unbounded_Wide_String :=
- To_Unbounded_Wide_String(TC_New_Character_String);
-
- -- Access objects that will be provided as parameters to the
- -- subprograms.
- Map_To_Lower_Case_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- CXA4033_0.Map_To_Lower_Case'Access;
- Map_To_Upper_Case_Ptr : Wide_Maps.Wide_Character_Mapping_Function :=
- CXA4033_0.Map_To_Upper_Case'Access;
-
- begin
-
- -- Testing functionality found in Package Ada.Strings.Wide_Unbounded.
- --
- -- Function Index.
-
- if Index(To_Unbounded_Wide_String("AAABBBaaabbb"),
- "aabb",
- Mapping => Map_To_Lower_Case_Ptr) /= 2 or
- Index(To_Unbounded_Wide_String("Case of a Mixed Case String"),
- "case",
- Ada.Strings.Backward,
- Map_To_Lower_Case_Ptr) /= 17
- then
- Report.Failed("Incorrect results from Function Index, " &
- "using a Wide Character Mapping Function parameter");
- end if;
-
- -- Function Count.
- if Count(Source => To_Unbounded_Wide_String("ABABABA"),
- Pattern => "aba",
- Mapping => Map_To_Lower_Case_Ptr) /= 2 or
- Count(Null_Unbounded_Wide_String, "mat", Map_To_Upper_Case_Ptr) /= 0
- then
- Report.Failed("Incorrect results from Function Count, using " &
- "a Character Mapping Function parameter");
- end if;
-
- -- Function Translate.
- if Translate(To_Unbounded_Wide_String("A Sample Mixed Case String"),
- Mapping => Map_To_Lower_Case_Ptr) /=
- To_Unbounded_Wide_String("a sample mixed case string") or
- Translate(New_UB_Character_String, Map_To_Upper_Case_Ptr) /=
- TC_New_UB_Character_String
- then
- Report.Failed("Incorrect results from Function Translate, " &
- "using a Character Mapping Function parameter");
- end if;
-
- -- Procedure Translate.
- declare
- use Ada.Characters.Handling;
- Str : Unbounded_Wide_String :=
- To_Unbounded_Wide_String("AN ALL UPPER CASE STRING");
- begin
- Translate(Source => Str, Mapping => Map_To_Lower_Case_Ptr);
- if Str /= To_Unbounded_Wide_String("an all upper case string") then
- Report.Failed("Incorrect result from Procedure Translate 1");
- end if;
-
- Translate(New_UB_Character_String, Map_To_Upper_Case_Ptr);
- if New_UB_Character_String /= TC_New_UB_Character_String then
- Report.Failed("Incorrect result from Procedure Translate 2");
- end if;
- end;
-
- -- Function To_Unbounded_Wide_String (version with Length parameter)
- if Length(To_Unbounded_Wide_String(Length => 10)) /= 10 or
- Length(To_Unbounded_Wide_String(0)) /= 0 or
- Length( To_Unbounded_Wide_String(10) &
- To_Unbounded_Wide_String(1) &
- To_Unbounded_Wide_String(0) ) /= 10 + 1 + 0
- then
- Report.Failed
- ("Incorrect results from Function To_Unbounded_Wide_String " &
- "with Length parameter");
- end if;
-
- -- Procedure Append (Wide_Unbounded - Wide_Unbounded)
- TC_Unb_String := Null_Unbounded_Wide_String;
- Append(TC_Unb_String, To_Unbounded_Wide_String("New Unbounded String"));
- if TC_Unb_String /= To_Unbounded_Wide_String("New Unbounded String")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "unbounded wide string parameters");
- end if;
-
-
- -- Procedure Append (Wide_Unbounded - Wide_String)
- TC_Unb_String := To_Unbounded_Wide_String("An Unbounded String and ");
- Append(Source => TC_Unb_String, New_Item => TC_String);
- if TC_Unb_String /=
- To_Unbounded_Wide_String("An Unbounded String and A Standard String")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "an unbounded wide string parameter and a wide " &
- "string parameter");
- end if;
-
- -- Procedure Append (Wide_Unbounded - Wide_Character)
- TC_Unb_String := To_Unbounded_Wide_String("Lower Case = ");
- for i in LC_Characters'Range loop
- Append(Source => TC_Unb_String, New_Item => LC_Characters(i));
- end loop;
- if TC_Unb_String /=
- Unb.To_Unbounded_Wide_String
- ("Lower Case = abcdefghijklmnopqrstuvwxyz")
- then
- Report.Failed("Incorrect results from Procedure Append with " &
- "an unbounded wide string parameter and a wide " &
- "character parameter");
- end if;
-
- -- Function "="
- TC_Unb_String := To_Unbounded_Wide_String(TC_String);
- if not (TC_Unb_String = TC_String) or
- not "="("A Standard String", TC_Unb_String) or
- not ((Null_Unbounded_Wide_String = "") and
- ("Test String" = To_Unbounded_Wide_String("Test String")))
- then
- Report.Failed("Incorrect results from Function ""="" with " &
- "wide_string - unbounded wide string parameters");
- end if;
-
- -- Function "<"
- if not ("Extra Space" < To_Unbounded_Wide_String("Extra Space ") and
- To_Unbounded_Wide_String("tess") < "test" and
- To_Unbounded_Wide_String("best") < "test")
- then
- Report.Failed("Incorrect results from Function ""<"" with " &
- "wide string - unbounded wide string parameters");
- end if;
-
- -- Function "<="
- TC_Unb_String := To_Unbounded_Wide_String("Sample string");
- if TC_Unb_String <= "Sample strin" or
- not("Sample string" <= TC_Unb_String)
- then
- Report.Failed("Incorrect results from Function ""<="" with " &
- "wide string - unbounded wide string parameters");
- end if;
-
- -- Function ">"
- TC_Unb_String := To_Unbounded_Wide_String("A MUCH LONGER STRING");
- if not ("A much longer string" > TC_Unb_String and
- To_Unbounded_Wide_String(TC_String) > "A Standard Strin" and
- "abcdefgh" > To_Unbounded_Wide_String("ABCDEFGH"))
- then
- Report.Failed("Incorrect results from Function "">"" with " &
- "wide string - unbounded wide string parameters");
- end if;
-
- -- Function ">="
- TC_Unb_String := To_Unbounded_Wide_String(TC_String);
- if not (TC_Unb_String >= TC_String and
- "test" >= To_Unbounded_Wide_String("tess") and
- To_Unbounded_Wide_String("Programming") >= "PROGRAMMING")
- then
- Report.Failed("Incorrect results from Function "">="" with " &
- "wide string - unbounded wide string parameters");
- end if;
-
- -- Procedure Replace_Slice
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Replace_Slice(TC_Unb_String, 5, 5, TC_String_5);
- if TC_Unb_String /= To_Unbounded_Wide_String("TestABCDEString") then
- Report.Failed("Incorrect results from Replace_Slice - 1");
- end if;
-
- Replace_Slice(TC_Unb_String, 1, 4, TC_String_5);
- if TC_Unb_String /= To_Unbounded_Wide_String("ABCDEABCDEString") then
- Report.Failed("Incorrect results from Replace_Slice - 2");
- end if;
-
- -- Procedure Insert
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Insert(TC_Unb_String, 1, "**");
- if TC_Unb_String /= To_Unbounded_Wide_String("**Test String") then
- Report.Failed("Incorrect results from Procedure Insert - 1");
- end if;
-
- Insert(TC_Unb_String, Length(TC_Unb_String)+1, "**");
- if TC_Unb_String /= To_Unbounded_Wide_String("**Test String**") then
- Report.Failed("Incorrect results from Procedure Insert - 2");
- end if;
-
- -- Procedure Overwrite
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Overwrite(TC_Unb_String, 1, New_Item => "XXXX");
- if TC_Unb_String /= To_Unbounded_Wide_String("XXXX String") then
- Report.Failed("Incorrect results from Procedure Overwrite - 1");
- end if;
-
- Overwrite(TC_Unb_String, Length(TC_Unb_String)+1, "**");
- if TC_Unb_String /= To_Unbounded_Wide_String("XXXX String**") then
- Report.Failed("Incorrect results from Procedure Overwrite - 2");
- end if;
-
- -- Procedure Delete
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Delete(TC_Unb_String, 1, 0);
- if TC_Unb_String /= To_Unbounded_Wide_String("Test String") then
- Report.Failed("Incorrect results from Procedure Delete - 1");
- end if;
-
- Delete(TC_Unb_String, 1, 5);
- if TC_Unb_String /= To_Unbounded_Wide_String("String") then
- Report.Failed("Incorrect results from Procedure Delete - 2");
- end if;
-
- -- Procedure Trim
- TC_Unb_String := To_Unbounded_Wide_String(" Leading Spaces ");
- Trim(TC_Unb_String, Ada.Strings.Left);
- if TC_Unb_String /= To_Unbounded_Wide_String("Leading Spaces ") then
- Report.Failed("Incorrect results from Procedure Trim - 1");
- end if;
-
- TC_Unb_String :=
- To_Unbounded_Wide_String(" Spaces on both ends ");
- Trim(TC_Unb_String, Ada.Strings.Both);
- if TC_Unb_String /=
- To_Unbounded_Wide_String("Spaces on both ends")
- then
- Report.Failed("Incorrect results from Procedure Trim - 2");
- end if;
-
- -- Procedure Trim (with Wide_Character_Set parameters)
- TC_Unb_String := To_Unbounded_Wide_String("012abcdefghGFEDCBA789ab");
- Trim(TC_Unb_String,
- Ada.Strings.Wide_Maps.Wide_Constants.Hexadecimal_Digit_Set,
- Ada.Strings.Wide_Maps.Wide_Constants.Hexadecimal_Digit_Set);
- if TC_Unb_String /= To_Unbounded_Wide_String("ghG") then
- Report.Failed("Incorrect results from Procedure Trim with Sets");
- end if;
-
- -- Procedure Head
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Head(Source => TC_Unb_String, Count => 0, Pad => '*');
- if TC_Unb_String /= Null_Unbounded_Wide_String then
- Report.Failed("Incorrect results from Procedure Head - 1");
- end if;
-
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Head(Source => TC_Unb_String, Count => 4, Pad => '*');
- if TC_Unb_String /= To_Unbounded_Wide_String("Test") then
- Report.Failed("Incorrect results from Procedure Head - 2");
- end if;
-
- -- Procedure Tail
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Tail(Source => TC_Unb_String, Count => 0, Pad => '*');
- if TC_Unb_String /= Null_Unbounded_Wide_String then
- Report.Failed("Incorrect results from Procedure Tail - 1");
- end if;
-
- TC_Unb_String := To_Unbounded_Wide_String("Test String");
- Tail(TC_Unb_String, Length(TC_Unb_String) + 5, 'x');
- if TC_Unb_String /= To_Unbounded_Wide_String("xxxxxTest String") then
- Report.Failed("Incorrect results from Procedure Tail - 2");
- end if;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA4033;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa4034.a b/gcc/testsuite/ada/acats/tests/cxa/cxa4034.a
deleted file mode 100644
index a1ed53de0f7..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa4034.a
+++ /dev/null
@@ -1,281 +0,0 @@
--- CXA4034.A
---
--- Grant of Unlimited Rights
---
--- The Ada Conformity Assessment Authority (ACAA) holds unlimited
--- rights in the software and documentation contained herein. Unlimited
--- rights are the same as those granted by the U.S. Government for older
--- parts of the Ada Conformity Assessment Test Suite, and are defined
--- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA
--- intends to confer upon all recipients unlimited rights equal to those
--- held by the ACAA. These rights include rights to use, duplicate,
--- release or disclose the released technical data and computer software
--- in whole or in part, in any manner and for any purpose whatsoever, and
--- to have or permit others to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Ada.Strings.Bounded.Slice raises Index_Error if
--- High > Length (Source) or Low > Length (Source) + 1.
--- (Defect Report 8652/0049).
---
--- Check that Ada.Strings.Wide_Bounded.Slice raises Index_Error if
--- High > Length (Source) or Low > Length (Source) + 1.
---
--- CHANGE HISTORY:
--- 12 FEB 2001 PHL Initial version
--- 14 MAR 2001 RLB Added Wide_Bounded subtest.
---
---!
-with Ada.Exceptions;
-use Ada.Exceptions;
-with Ada.Strings.Bounded;
-with Ada.Strings.Wide_Bounded;
-use Ada.Strings;
-with Report;
-use Report;
-procedure CXA4034 is
-
- package Bs is new Ada.Strings.Bounded.Generic_Bounded_Length (40);
-
- package WBs is new Ada.Strings.Wide_Bounded.Generic_Bounded_Length (32);
-
- Source : String (Ident_Int (1) .. Ident_Int (30));
-
- Wide_Source : Wide_String (Ident_Int (1) .. Ident_Int (24));
-
- X : Bs.Bounded_String;
-
- WX : WBs.Bounded_Wide_String;
-
-begin
- Test ("CXA4034",
- "Check that Slice raises Index_Error if either Low or High is " &
- "greater than the Length(Source) for Ada.Strings.Bounded and " &
- "Ada.Strings.Wide_Bounded");
-
- -- Fill Source with "ABC..."
- for I in Source'Range loop
- Source (I) := Ident_Char (Character'Val (I +
- Character'Pos ('A') - Source'First));
- end loop;
- -- and W with "ABC..."
- for I in Wide_Source'Range loop
- Wide_Source (I) := Ident_Wide_Char (Wide_Character'Val (I +
- Wide_Character'Pos ('A') - Wide_Source'First));
- end loop;
-
- X := Bs.To_Bounded_String (Source);
-
- begin
- declare
- S : constant String :=
- Bs.Slice (X, Low => Ident_Int (28), High => Ident_Int (41));
- begin
- Failed ("No exception raised by Slice - 1");
- if S = Source then
- Comment ("Don't optimize S");
- end if;
- end;
- exception
- when Index_Error =>
- null; -- Expected exception.
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 1");
- end;
-
- begin
- declare
- S : constant String :=
- Bs.Slice (X, Low => Ident_Int (8), High => Ident_Int (31));
- begin
- Failed ("No exception raised by Slice - 2");
- if S = Source then
- Comment ("Don't optimize S");
- end if;
- end;
- exception
- when Index_Error =>
- null; -- Expected exception.
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 2");
- end;
-
- begin
- declare
- S : constant String :=
- Bs.Slice (X, Low => Ident_Int (15), High => Ident_Int (30));
- begin
- if S /= Source(15..30) then
- Failed ("Wrong result - 3");
- end if;
- end;
- exception
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 3");
- end;
-
- begin
- declare
- S : constant String :=
- Bs.Slice (X, Low => Ident_Int (42), High => Ident_Int (28));
- begin
- Failed ("No exception raised by Slice - 4");
- if S = Source then
- Comment ("Don't optimize S");
- end if;
- end;
- exception
- when Index_Error =>
- null; -- Expected exception.
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 4");
- end;
-
- begin
- declare
- S : constant String :=
- Bs.Slice (X, Low => Ident_Int (31), High => Ident_Int (28));
- begin
- if S /= "" then
- Failed ("Wrong result - 5");
- end if;
- end;
- exception
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 5");
- end;
-
- begin
- declare
- S : constant String :=
- Bs.Slice (X, Low => Ident_Int (30), High => Ident_Int (30));
- begin
- if S /= Source(30..30) then
- Failed ("Wrong result - 6");
- end if;
- end;
- exception
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 6");
- end;
-
- WX := WBs.To_Bounded_Wide_String (Wide_Source);
-
- begin
- declare
- W : constant Wide_String :=
- WBs.Slice (WX, Low => Ident_Int (21), High => Ident_Int (33));
- begin
- Failed ("No exception raised by Slice - 7");
- if W = Wide_Source then
- Comment ("Don't optimize W");
- end if;
- end;
- exception
- when Index_Error =>
- null; -- Expected exception.
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 7");
- end;
-
- begin
- declare
- W : constant Wide_String :=
- WBs.Slice (WX, Low => Ident_Int (8), High => Ident_Int (25));
- begin
- Failed ("No exception raised by Slice - 8");
- if W = Wide_Source then
- Comment ("Don't optimize W");
- end if;
- end;
- exception
- when Index_Error =>
- null; -- Expected exception.
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 8");
- end;
-
- begin
- declare
- W : constant Wide_String :=
- WBs.Slice (WX, Low => Ident_Int (15), High => Ident_Int (24));
- begin
- if W /= Wide_Source(15..24) then
- Failed ("Wrong result - 8");
- end if;
- end;
- exception
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 9");
- end;
-
- begin
- declare
- W : constant Wide_String :=
- WBs.Slice (WX, Low => Ident_Int (36), High => Ident_Int (20));
- begin
- Failed ("No exception raised by Slice - 10");
- if W = Wide_Source then
- Comment ("Don't optimize W");
- end if;
- end;
- exception
- when Index_Error =>
- null; -- Expected exception.
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 10");
- end;
-
- begin
- declare
- W : constant Wide_String :=
- WBs.Slice (WX, Low => Ident_Int (25), High => Ident_Int (21));
- begin
- if W /= "" then
- Failed ("Wrong result - 11");
- end if;
- end;
- exception
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 11");
- end;
-
- begin
- declare
- W : constant Wide_String :=
- WBs.Slice (WX, Low => Ident_Int (24), High => Ident_Int (24));
- begin
- if W /= Wide_Source(24..24) then
- Failed ("Wrong result - 12");
- end if;
- end;
- exception
- when E: others =>
- Failed ("Exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E) & " - 12");
- end;
-
- Result;
-end CXA4034;
-
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5011.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5011.a
deleted file mode 100644
index c9a007e524f..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5011.a
+++ /dev/null
@@ -1,471 +0,0 @@
--- CXA5011.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that, for both Float_Random and Discrete_Random packages,
--- the following are true:
--- 1) two objects of type Generator are initialized to the same state.
--- 2) when the Function Reset is used to reset two generators
--- to different time-dependent states, the resulting random values
--- from each generator are different.
--- 3) when the Function Reset uses the same integer initiator
--- to reset two generators to the same state, the resulting random
--- values from each generator are identical.
--- 4) when the Function Reset uses different integer initiator
--- values to reset two generators, the resulting random numbers are
--- different.
---
--- TEST DESCRIPTION:
--- This test evaluates components of the Ada.Numerics.Float_Random and
--- Ada.Numerics.Discrete_Random packages.
--- This test checks to see that objects of type Generator are initialized
--- to the same state. In addition, the functionality of Function Reset is
--- validated.
--- For each of the objectives above, evaluation of the various generators
--- is performed using each of the following techniques. When the states of
--- two generators are to be compared, each state is saved, then
--- transformed to a bounded-string variable. The bounded-strings can
--- then be compared for equality. In this case, matching bounded-strings
--- are evidence that the states of two generators are the same.
--- In addition, two generators are compared by evaluating a series of
--- random numbers they produce. A matching series of random numbers
--- implies that the generators were in the same state prior to producing
--- the numbers.
---
---
--- CHANGE HISTORY:
--- 20 Apr 95 SAIC Initial prerelease version.
--- 07 Jul 95 SAIC Incorporated reviewer comments/suggestions.
--- 22 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 17 Aug 96 SAIC Deleted Subtest #2.
--- 09 Feb 01 RLB Repaired to work on implementations with a 16-bit
--- Integer.
-
---!
-
-with Ada.Exceptions;
-with Ada.Numerics.Float_Random;
-with Ada.Numerics.Discrete_Random;
-with Ada.Strings.Bounded;
-with ImpDef;
-with Report;
-
-procedure CXA5011 is
-begin
-
- Report.Test ("CXA5011", "Check the effect of Function Reset on the " &
- "state of random number generators");
-
- Test_Block:
- declare
-
- use Ada.Exceptions;
- use Ada.Numerics;
- use Ada.Strings.Bounded;
-
- -- Declare an modular subtype, and use it to instantiate the discrete
- -- random number generator generic package.
-
- type Discrete_Range is mod 2**(Integer'Size-1);
- package Discrete_Package is new Discrete_Random(Discrete_Range);
-
- -- Declaration of random number generator objects.
-
- Discrete_Generator_1,
- Discrete_Generator_2 : Discrete_Package.Generator;
- Float_Generator_1,
- Float_Generator_2 : Float_Random.Generator;
-
- -- Declaration of bounded string packages instantiated with the
- -- value of Max_Image_Width constant from each random number generator
- -- package, and bounded string variables used to hold the image of
- -- random number generator states.
-
- package Discrete_String_Pack is
- new Generic_Bounded_Length(Discrete_Package.Max_Image_Width);
-
- package Float_String_Pack is
- new Generic_Bounded_Length(Float_Random.Max_Image_Width);
-
- use Discrete_String_Pack, Float_String_Pack;
-
- TC_Seed : Integer;
- TC_Max_Loop_Count : constant Natural := 1000;
- Allowed_Matches : constant Natural := 2;
- --
- -- In a sequence of TC_Max_Loop_Count random numbers that should
- -- not match, some may match by chance. Up to Allowed_Matches
- -- numbers may match before the test is considered to fail.
- --
-
-
- procedure Check_Float_State (Gen_1, Gen_2 : Float_Random.Generator;
- Sub_Test : Integer;
- States_Should_Match : Boolean) is
-
- use type Float_Random.State;
-
- State_1,
- State_2 : Float_Random.State;
-
- State_String_1,
- State_String_2 : Float_String_Pack.Bounded_String :=
- Float_String_Pack.Null_Bounded_String;
- begin
-
- Float_Random.Save(Gen => Gen_1, To_State => State_1);
- Float_Random.Save(Gen_2, State_2);
-
- State_String_1 :=
- Float_String_Pack.To_Bounded_String(Source =>
- Float_Random.Image(Of_State => State_1));
-
- State_String_2 :=
- Float_String_Pack.To_Bounded_String(Float_Random.Image(State_2));
-
- case States_Should_Match is
- when True =>
- if State_1 /= State_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State values from Float generators " &
- "are not the same");
- end if;
- if State_String_1 /= State_String_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State strings from Float generators " &
- "are not the same");
- end if;
- when False =>
- if State_1 = State_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State values from Float generators " &
- "are the same");
- end if;
- if State_String_1 = State_String_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State strings from Float generators " &
- "are the same");
- end if;
- end case;
- end Check_Float_State;
-
-
-
- procedure Check_Discrete_State (Gen_1,
- Gen_2 : Discrete_Package.Generator;
- Sub_Test : Integer;
- States_Should_Match : Boolean) is
-
- use type Discrete_Package.State;
-
- State_1, State_2 : Discrete_Package.State;
-
- State_String_1,
- State_String_2 : Discrete_String_Pack.Bounded_String :=
- Discrete_String_Pack.Null_Bounded_String;
- begin
-
- Discrete_Package.Save(Gen => Gen_1,
- To_State => State_1);
- Discrete_Package.Save(Gen_2, To_State => State_2);
-
- State_String_1 :=
- Discrete_String_Pack.To_Bounded_String(Source =>
- Discrete_Package.Image(Of_State => State_1));
-
- State_String_2 :=
- Discrete_String_Pack.To_Bounded_String(Source =>
- Discrete_Package.Image(Of_State => State_2));
-
- case States_Should_Match is
- when True =>
- if State_1 /= State_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State values from Discrete " &
- "generators are not the same");
- end if;
- if State_String_1 /= State_String_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State strings from Discrete " &
- "generators are not the same");
- end if;
- when False =>
- if State_1 = State_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State values from Discrete " &
- "generators are the same");
- end if;
- if State_String_1 = State_String_2 then
- Report.Failed("Subtest #" & Integer'Image(Sub_Test) &
- " State strings from Discrete " &
- "generators are the same");
- end if;
- end case;
- end Check_Discrete_State;
-
-
-
- procedure Check_Float_Values (Gen_1, Gen_2 : Float_Random.Generator;
- Sub_Test : Integer;
- Values_Should_Match : Boolean) is
- Matches : Natural := 0;
- Check_Failed : Boolean := False;
- begin
- case Values_Should_Match is
- when True =>
- for i in 1..TC_Max_Loop_Count loop
- if Float_Random.Random(Gen_1) /= Float_Random.Random(Gen_2)
- then
- Check_Failed := True;
- exit;
- end if;
- end loop;
- if Check_Failed then
- Report.Failed("Sub_Test # " & Integer'Image(Sub_Test) &
- " Random numbers from Float generators " &
- "Failed check");
- end if;
- when False =>
- for i in 1..TC_Max_Loop_Count loop
- if Float_Random.Random(Gen_1) = Float_Random.Random(Gen_2)
- then
- Matches := Matches + 1;
- end if;
- end loop;
- end case;
-
- if (Values_Should_Match and Check_Failed) or
- (not Values_Should_Match and Matches > Allowed_Matches)
- then
- Report.Failed("Sub_Test # " & Integer'Image(Sub_Test) &
- " Random numbers from Float generators " &
- "Failed check");
- end if;
-
- end Check_Float_Values;
-
-
-
- procedure Check_Discrete_Values (Gen_1,
- Gen_2 : Discrete_Package.Generator;
- Sub_Test : Integer;
- Values_Should_Match : Boolean) is
- Matches : Natural := 0;
- Check_Failed : Boolean := False;
- begin
- case Values_Should_Match is
- when True =>
- for i in 1..TC_Max_Loop_Count loop
- if Discrete_Package.Random(Gen_1) /=
- Discrete_Package.Random(Gen_2)
- then
- Check_Failed := True;
- exit;
- end if;
- end loop;
- when False =>
- for i in 1..TC_Max_Loop_Count loop
- if Discrete_Package.Random(Gen_1) =
- Discrete_Package.Random(Gen_2)
- then
- Matches := Matches + 1;
- end if;
- end loop;
- end case;
-
- if (Values_Should_Match and Check_Failed) or
- (not Values_Should_Match and Matches > Allowed_Matches)
- then
- Report.Failed("Sub_Test # " & Integer'Image(Sub_Test) &
- " Random numbers from Discrete generators " &
- "Failed check");
- end if;
-
- end Check_Discrete_Values;
-
-
-
- begin
-
- Sub_Test_1:
- -- Check that two objects of type Generator are initialized to the
- -- same state.
- begin
-
- -- Since the discrete and float random generators are in the initial
- -- state, using Procedure Save to save the states of the generator
- -- objects, and transforming these states into strings using
- -- Function Image, should yield identical strings.
-
- Check_Discrete_State (Discrete_Generator_1,
- Discrete_Generator_2,
- Sub_Test => 1,
- States_Should_Match => True);
-
- Check_Float_State (Float_Generator_1,
- Float_Generator_2,
- Sub_Test => 1,
- States_Should_Match => True);
-
- -- Since the two random generator objects are in their initial
- -- state, the values produced from each (upon calls to Random)
- -- should be identical.
-
- Check_Discrete_Values (Discrete_Generator_1,
- Discrete_Generator_2,
- Sub_Test => 1,
- Values_Should_Match => True);
-
- Check_Float_Values (Float_Generator_1,
- Float_Generator_2,
- Sub_Test => 1,
- Values_Should_Match => True);
-
- end Sub_Test_1;
-
-
-
- Sub_Test_3:
- -- Check that when the Function Reset uses the same integer
- -- initiator to reset two generators to the same state, the
- -- resulting random values and the state from each generator
- -- are identical.
- declare
- use Discrete_Package, Float_Random;
- begin
-
- -- Reset the generators to the same states, using the version of
- -- Function Reset with both generator parameter and initiator
- -- specified.
-
- TC_Seed := Integer(Random(Discrete_Generator_1));
- Reset(Gen => Discrete_Generator_1, Initiator => TC_Seed);
- Reset(Discrete_Generator_2, Initiator => TC_Seed);
- Reset(Float_Generator_1, TC_Seed);
- Reset(Float_Generator_2, TC_Seed);
-
- -- Since the random generators have been reset to identical states,
- -- bounded string images of these states should yield identical
- -- strings.
-
- Check_Discrete_State (Discrete_Generator_1,
- Discrete_Generator_2,
- Sub_Test => 3,
- States_Should_Match => True);
-
- Check_Float_State (Float_Generator_1,
- Float_Generator_2,
- Sub_Test => 3,
- States_Should_Match => True);
-
- -- Since the random generators have been reset to identical states,
- -- the values produced from each (upon calls to Random) should
- -- be identical.
-
- Check_Discrete_Values (Discrete_Generator_1,
- Discrete_Generator_2,
- Sub_Test => 3,
- Values_Should_Match => True);
-
- Check_Float_Values (Float_Generator_1,
- Float_Generator_2,
- Sub_Test => 3,
- Values_Should_Match => True);
-
- end Sub_Test_3;
-
-
-
- Sub_Test_4:
- -- Check that when the Function Reset uses different integer
- -- initiator values to reset two generators, the resulting random
- -- numbers and states are different.
- begin
-
- -- Reset the generators to different states.
-
- TC_Seed :=
- Integer(Discrete_Package.Random(Discrete_Generator_1));
-
- Discrete_Package.Reset(Gen => Discrete_Generator_1,
- Initiator => TC_Seed);
-
- -- Set the seed value to a different value for the second call
- -- to Reset.
- -- Note: A second call to Random could be made, as above, but that
- -- would not ensure that the resulting seed value was
- -- different from the first.
-
- if TC_Seed /= Integer'Last then
- TC_Seed := TC_Seed + 1;
- else
- TC_Seed := TC_Seed - 1;
- end if;
-
- Discrete_Package.Reset(Gen => Discrete_Generator_2,
- Initiator => TC_Seed);
-
- Float_Random.Reset(Float_Generator_1, 16#FF#); -- 255
- Float_Random.Reset(Float_Generator_2, 2#1110_0000#); -- 224
-
- -- Since the two float random generators are in different
- -- states, the bounded string images depicting their states should
- -- differ.
-
- Check_Discrete_State (Discrete_Generator_1,
- Discrete_Generator_2,
- Sub_Test => 4,
- States_Should_Match => False);
-
- Check_Float_State (Float_Generator_1,
- Float_Generator_2,
- Sub_Test => 4,
- States_Should_Match => False);
-
- -- Since the two discrete random generator objects were reset
- -- to different states, the values produced from each (upon calls
- -- to Random) should differ.
-
- Check_Discrete_Values (Discrete_Generator_1,
- Discrete_Generator_2,
- Sub_Test => 4,
- Values_Should_Match => False);
-
- Check_Float_Values (Float_Generator_1,
- Float_Generator_2,
- Sub_Test => 4,
- Values_Should_Match => False);
-
- end Sub_Test_4;
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXA5011;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5012.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5012.a
deleted file mode 100644
index a286fa71ed0..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5012.a
+++ /dev/null
@@ -1,536 +0,0 @@
--- CXA5012.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that, for both Float_Random and Discrete_Random packages,
--- the following are true:
--- 1) the procedures Save and Reset can be used to save the
--- specific state of a random number generator, and then restore
--- the specific state to the generator following some intermediate
--- generator activity.
--- 2) the Function Image can be used to obtain a string
--- representation of the state of a generator; and that the
--- Function Value will transform a string representation of the
--- state of a random number generator into the actual state object.
--- 3) a call to Function Value, with a string value that is
--- not the image of any generator state, is a bounded error. This
--- error either raises Constraint_Error or Program_Error, or is
--- accepted. (See Technical Corrigendum 1).
---
--- TEST DESCRIPTION:
--- This test evaluates components of the Ada.Numerics.Float_Random and
--- Ada.Numerics.Discrete_Random packages.
--- The first objective block of this test uses Procedure Save to
--- save the particular state of a random number generator. The random
--- number generator then generates a series of random numbers. The
--- saved state variable is then used to reset (using Procedure Reset)
--- the generator back to the state it was in at the point of the call
--- to Save. Random values are then generated from this restored
--- generator, and compared with expected values.
--- The second objective block of this test uses Function Image to
--- provide a string representation of a state code. This string is
--- then transformed back to a state code value, and used to reset a
--- random number generator to the saved state. Random values are
--- likewise generated from this restored generator, and compared with
--- expected values.
---
---
--- CHANGE HISTORY:
--- 25 Apr 95 SAIC Initial prerelease version.
--- 17 Jul 95 SAIC Incorporated reviewer comments.
--- 17 Dec 97 EDS Change subtype upper limit from 100_000 to 10_000.
--- 16 Sep 99 RLB Updated objective 3 for Technical Corrigendum 1
--- changes.
-
---!
-
-with Ada.Numerics.Float_Random;
-with Ada.Numerics.Discrete_Random;
-with Ada.Strings.Bounded;
-with ImpDef;
-with Report;
-
-procedure CXA5012 is
-
-begin
-
- Report.Test ("CXA5012", "Check the effect of Procedures Save and " &
- "Reset, and Functions Image and Value " &
- "from the Ada.Numerics.Discrete_Random " &
- "and Float_Random packages");
-
- Test_Block:
- declare
-
- use Ada.Numerics, Ada.Strings.Bounded;
-
- -- Declare an integer subtype and an enumeration subtype, and use them
- -- to instantiate the discrete random number generator generic package.
-
- subtype Discrete_Range is Integer range 1..10_000;
- type Suit_Of_Cards is (Ace, One, Two, Three, Four, Five, Six,
- Seven, Eight, Nine, Ten, Jack, Queen, King);
- package Discrete_Pack is new Discrete_Random(Discrete_Range);
- package Card_Pack is new Discrete_Random(Suit_Of_Cards);
-
- -- Declaration of random number generator objects.
-
- DGen_1, DGen_2 : Discrete_Pack.Generator;
- EGen_1, EGen_2 : Card_Pack.Generator;
- FGen_1, FGen_2 : Float_Random.Generator;
-
- -- Variables declared to hold random numbers over the inclusive range
- -- of their corresponding type.
-
- DVal_1, DVal_2 : Discrete_Range;
- EVal_1, EVal_2 : Suit_Of_Cards;
- FVal_1, FVal_2 : Float_Random.Uniformly_Distributed;
-
- -- Declaration of State variables used to hold the state of the
- -- random number generators.
-
- DState_1, DState_2 : Discrete_Pack.State;
- EState_1, EState_2 : Card_Pack.State;
- FState_1, FState_2 : Float_Random.State;
-
- -- Declaration of bounded string packages instantiated with the
- -- value of Max_Image_Width constant, and bounded string variables
- -- used to hold the image of random number generator states.
-
- package DString_Pack is
- new Generic_Bounded_Length(Discrete_Pack.Max_Image_Width);
- package EString_Pack is
- new Generic_Bounded_Length(Card_Pack.Max_Image_Width);
- package FString_Pack is
- new Generic_Bounded_Length(Float_Random.Max_Image_Width);
-
- use DString_Pack, EString_Pack, FString_Pack;
-
- DString_1, DString_2 : DString_Pack.Bounded_String :=
- DString_Pack.Null_Bounded_String;
- EString_1, EString_2 : EString_Pack.Bounded_String :=
- EString_Pack.Null_Bounded_String;
- FString_1, FString_2 : FString_Pack.Bounded_String :=
- FString_Pack.Null_Bounded_String;
-
- -- Test variables.
-
- TC_Count : Natural;
- TC_Discrete_Check_Failed,
- TC_Enum_Check_Failed,
- TC_Float_Check_Failed : Boolean := False;
- TC_Seed : Integer;
-
- begin
-
- Objective_1:
- -- Check that the procedures Save and Reset can be used to save the
- -- specific state of a random number generator, and then restore the
- -- specific state to the generator following some intermediate
- -- generator activity.
- declare
-
- First_Row : constant := 1;
- Second_Row : constant := 2;
- TC_Max_Values : constant := 100;
-
- TC_Discrete_Array : array (First_Row..Second_Row, 1..TC_Max_Values)
- of Discrete_Range;
- TC_Enum_Array : array (First_Row..Second_Row, 1..TC_Max_Values)
- of Suit_Of_Cards;
- TC_Float_Array : array (First_Row..Second_Row, 1..TC_Max_Values)
- of Float_Random.Uniformly_Distributed;
- begin
-
- -- The state of the random number generators are saved to state
- -- variables using the procedure Save.
-
- Discrete_Pack.Save(Gen => DGen_1, To_State => DState_1);
- Card_Pack.Save (Gen => EGen_1, To_State => EState_1);
- Float_Random.Save (Gen => FGen_1, To_State => FState_1);
-
- -- Random number generators are used to fill the first half of the
- -- first row of the arrays with randomly generated values.
-
- for i in 1..TC_Max_Values/2 loop
- TC_Discrete_Array(First_Row, i) := Discrete_Pack.Random(DGen_1);
- TC_Enum_Array(First_Row, i) := Card_Pack.Random(EGen_1);
- TC_Float_Array(First_Row, i) := Float_Random.Random(FGen_1);
- end loop;
-
- -- The random number generators are reset to the states saved in the
- -- state variables, using the procedure Reset.
-
- Discrete_Pack.Reset(Gen => DGen_1, From_State => DState_1);
- Card_Pack.Reset (Gen => EGen_1, From_State => EState_1);
- Float_Random.Reset (Gen => FGen_1, From_State => FState_1);
-
- -- The same random number generators are used to fill the first half
- -- of the second row of the arrays with randomly generated values.
-
- for i in 1..TC_Max_Values/2 loop
- TC_Discrete_Array(Second_Row, i) := Discrete_Pack.Random(DGen_1);
- TC_Enum_Array(Second_Row, i) := Card_Pack.Random(EGen_1);
- TC_Float_Array(Second_Row, i) := Float_Random.Random(FGen_1);
- end loop;
-
- -- Run the random number generators many times (not using results).
-
- for i in Discrete_Range'Range loop
- DVal_1 := Discrete_Pack.Random(DGen_1);
- EVal_1 := Card_Pack.Random(EGen_1);
- FVal_1 := Float_Random.Random(FGen_1);
- end loop;
-
- -- The states of the random number generators are saved to state
- -- variables using the procedure Save.
-
- Discrete_Pack.Save(Gen => DGen_1, To_State => DState_1);
- Card_Pack.Save(Gen => EGen_1, To_State => EState_1);
- Float_Random.Save (Gen => FGen_1, To_State => FState_1);
-
- -- The last half of the first row of the arrays are filled with
- -- values generated from the same random number generators.
-
- for i in (TC_Max_Values/2 + 1)..TC_Max_Values loop
- TC_Discrete_Array(First_Row, i) := Discrete_Pack.Random(DGen_1);
- TC_Enum_Array(First_Row, i) := Card_Pack.Random(EGen_1);
- TC_Float_Array(First_Row, i) := Float_Random.Random(FGen_1);
- end loop;
-
- -- The random number generators are reset to the states saved in the
- -- state variables, using the procedure Reset.
-
- Discrete_Pack.Reset(Gen => DGen_1, From_State => DState_1);
- Card_Pack.Reset(Gen => EGen_1, From_State => EState_1);
- Float_Random.Reset (Gen => FGen_1, From_State => FState_1);
-
- -- The last half of the second row of the arrays are filled with
- -- values generated from the same random number generator.
- -- These values should exactly mirror the values in the last half
- -- of the first row of the arrays that had been previously generated.
-
- for i in (TC_Max_Values/2 + 1)..TC_Max_Values loop
- TC_Discrete_Array(Second_Row, i) := Discrete_Pack.Random(DGen_1);
- TC_Enum_Array(Second_Row, i) := Card_Pack.Random(EGen_1);
- TC_Float_Array(Second_Row, i) := Float_Random.Random(FGen_1);
- end loop;
-
- -- Check that the values in the two rows of the arrays are identical.
-
- for i in 1..TC_Max_Values loop
- if TC_Discrete_Array(First_Row,i) /=
- TC_Discrete_Array(Second_Row,i)
- then
- TC_Discrete_Check_Failed := True;
- exit;
- end if;
- end loop;
-
- for i in 1..TC_Max_Values loop
- if TC_Enum_Array(First_Row,i) /= TC_Enum_Array(Second_Row,i) then
- TC_Enum_Check_Failed := True;
- exit;
- end if;
- end loop;
-
- for i in 1..TC_Max_Values loop
- if TC_Float_Array(First_Row,i) /= TC_Float_Array(Second_Row,i)
- then
- TC_Float_Check_Failed := True;
- exit;
- end if;
- end loop;
-
- if TC_Discrete_Check_Failed then
- Report.Failed("Discrete random values generated following use " &
- "of procedures Save and Reset were not the same");
- TC_Discrete_Check_Failed := False;
- end if;
-
- if TC_Enum_Check_Failed then
- Report.Failed("Enumeration random values generated following " &
- "use of procedures Save and Reset were not the " &
- "same");
- TC_Enum_Check_Failed := False;
- end if;
-
- if TC_Float_Check_Failed then
- Report.Failed("Float random values generated following use " &
- "of procedures Save and Reset were not the same");
- TC_Float_Check_Failed := False;
- end if;
-
- end Objective_1;
-
-
-
- Objective_2:
- -- Check that the Function Image can be used to obtain a string
- -- representation of the state of a generator.
- -- Check that the Function Value will transform a string
- -- representation of the state of a random number generator
- -- into the actual state object.
- begin
-
- -- Use two discrete and float random number generators to generate
- -- a series of values (so that the generators are no longer in their
- -- initial states, and they have generated the same number of
- -- random values).
-
- TC_Seed := Integer(Discrete_Pack.Random(DGen_1));
- Discrete_Pack.Reset(DGen_1, TC_Seed);
- Discrete_Pack.Reset(DGen_2, TC_Seed);
- Card_Pack.Reset (EGen_1, TC_Seed);
- Card_Pack.Reset (EGen_2, TC_Seed);
- Float_Random.Reset (FGen_1, TC_Seed);
- Float_Random.Reset (FGen_2, TC_Seed);
-
- for i in 1..1000 loop
- DVal_1 := Discrete_Pack.Random(DGen_1);
- DVal_2 := Discrete_Pack.Random(DGen_2);
- EVal_1 := Card_Pack.Random(EGen_1);
- EVal_2 := Card_Pack.Random(EGen_2);
- FVal_1 := Float_Random.Random(FGen_1);
- FVal_2 := Float_Random.Random(FGen_2);
- end loop;
-
- -- Use the Procedure Save to save the states of the generators
- -- to state variables.
-
- Discrete_Pack.Save(Gen => DGen_1, To_State => DState_1);
- Discrete_Pack.Save(DGen_2, To_State => DState_2);
- Card_Pack.Save (Gen => EGen_1, To_State => EState_1);
- Card_Pack.Save (EGen_2, To_State => EState_2);
- Float_Random.Save (FGen_1, To_State => FState_1);
- Float_Random.Save (FGen_2, FState_2);
-
- -- Use the Function Image to produce a representation of the state
- -- codes as (bounded) string objects.
-
- DString_1 := DString_Pack.To_Bounded_String(
- Discrete_Pack.Image(Of_State => DState_1));
- DString_2 := DString_Pack.To_Bounded_String(
- Discrete_Pack.Image(DState_2));
- EString_1 := EString_Pack.To_Bounded_String(
- Card_Pack.Image(Of_State => EState_1));
- EString_2 := EString_Pack.To_Bounded_String(
- Card_Pack.Image(EState_2));
- FString_1 := FString_Pack.To_Bounded_String(
- Float_Random.Image(Of_State => FState_1));
- FString_2 := FString_Pack.To_Bounded_String(
- Float_Random.Image(FState_2));
-
- -- Compare the bounded string objects for equality.
-
- if DString_1 /= DString_2 then
- Report.Failed("String values returned from Function Image " &
- "depict different states of Discrete generators");
- end if;
- if EString_1 /= EString_2 then
- Report.Failed("String values returned from Function Image " &
- "depict different states of Enumeration " &
- "generators");
- end if;
- if FString_1 /= FString_2 then
- Report.Failed("String values returned from Function Image " &
- "depict different states of Float generators");
- end if;
-
- -- The string representation of a state code is transformed back
- -- to a state code variable using the Function Value.
-
- DState_1 := Discrete_Pack.Value(Coded_State =>
- DString_Pack.To_String(DString_1));
- EState_1 := Card_Pack.Value(EString_Pack.To_String(EString_1));
- FState_1 := Float_Random.Value(FString_Pack.To_String(FString_1));
-
- -- One of the (pair of each type of ) generators is used to generate
- -- a series of random values, getting them "out of synch" with the
- -- specific generation sequence of the other generators.
-
- for i in 1..100 loop
- DVal_1 := Discrete_Pack.Random(DGen_1);
- EVal_1 := Card_Pack.Random(EGen_1);
- FVal_1 := Float_Random.Random (FGen_1);
- end loop;
-
- -- The "out of synch" generators are reset to the previous state they
- -- had when their states were saved, and they should now have the same
- -- states as the generators that did not generate the values above.
-
- Discrete_Pack.Reset(Gen => DGen_1, From_State => DState_1);
- Card_Pack.Reset (Gen => EGen_1, From_State => EState_1);
- Float_Random.Reset (Gen => FGen_1, From_State => FState_1);
-
- -- All generators should now be in the same state, so the
- -- random values they produce should be the same.
-
- for i in 1..1000 loop
- if Discrete_Pack.Random(DGen_1) /= Discrete_Pack.Random(DGen_2)
- then
- TC_Discrete_Check_Failed := True;
- exit;
- end if;
- end loop;
-
- for i in 1..1000 loop
- if Card_Pack.Random(EGen_1) /= Card_Pack.Random(EGen_2) then
- TC_Enum_Check_Failed := True;
- exit;
- end if;
- end loop;
-
- for i in 1..1000 loop
- if Float_Random.Random(FGen_1) /= Float_Random.Random(FGen_2)
- then
- TC_Float_Check_Failed := True;
- exit;
- end if;
- end loop;
-
- if TC_Discrete_Check_Failed then
- Report.Failed("Random values generated following use of " &
- "procedures Image and Value were not the same " &
- "for Discrete generator");
- end if;
- if TC_Enum_Check_Failed then
- Report.Failed("Random values generated following use of " &
- "procedures Image and Value were not the same " &
- "for Enumeration generator");
- end if;
- if TC_Float_Check_Failed then
- Report.Failed("Random values generated following use of " &
- "procedures Image and Value were not the same " &
- "for Float generator");
- end if;
-
- end Objective_2;
-
-
-
- Objective_3:
- -- Check that a call to Function Value, with a string value that is
- -- not the image of any generator state, is a bounded error. This
- -- error either raises Constraint_Error or Program_Error, or is
- -- accepted. (See Technical Corrigendum 1).
- declare
- Not_A_State : constant String := ImpDef.Non_State_String;
- begin
-
- begin
- DState_1 := Discrete_Pack.Value(Not_A_State);
- if Not_A_State /= "**NONE**" then
- Report.Failed("Exception not raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
- else
- Report.Comment("All strings represent states for Function " &
- "Ada.Numerics.Discrete_Random.Value");
- end if;
- Discrete_Pack.Reset(DGen_1, DState_1);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- Report.Comment("Constraint_Error raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
- when Program_Error => -- OK, expected exception.
- Report.Comment("Program_Error raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
- when others =>
- Report.Failed("Unexpected exception raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
- end;
-
- begin
- EState_1 := Card_Pack.Value(Not_A_State);
- if Not_A_State /= "**NONE**" then
- Report.Failed("Exception not raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of an enumeration " &
- "random number generator");
- else
- Report.Comment("All strings represent states for Function " &
- "Ada.Numerics.Discrete_Random.Value");
- end if;
- Card_Pack.Reset(EGen_1, EState_1);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when Program_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of an enumeration " &
- "random number generator");
- end;
-
- begin
- FState_1 := Float_Random.Value(Not_A_State);
- if Not_A_State /= "**NONE**" then
- Report.Failed("Exception not raised by an " &
- "instantiated version of " &
- "Ada.Numerics.Float_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
- else
- Report.Comment("All strings represent states for Function " &
- "Ada.Numerics.Float_Random.Value");
- end if;
- Float_Random.Reset(FGen_1, FState_1);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when Program_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by an " &
- "instantiated version of " &
- "Ada.Numerics.Float_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
- end;
-
- end Objective_3;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5012;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5015.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5015.a
deleted file mode 100644
index e1035db271b..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5015.a
+++ /dev/null
@@ -1,342 +0,0 @@
--- CXA5015.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the following representation-oriented attributes are
--- available and that the produce correct results:
--- 'Denorm, 'Signed_Zeros, 'Exponent 'Fraction, 'Compose, 'Scaling,
--- 'Floor, 'Ceiling, 'Rounding, 'Unbiased_Rounding, 'Truncation,
--- 'Remainder, 'Adjacent, 'Copy_Sign, 'Leading_Part, 'Machine, and
--- 'Model_Small.
---
--- TEST DESCRIPTION:
--- This test checks whether certain attributes of floating point types
--- are available from an implementation. Where attribute correctness
--- can be verified in a straight forward manner, the appropriate checks
--- are included here. However, this test is not intended to ensure the
--- correctness of the results returned from all of the attributes
--- examined in this test; that process will occur in the tests of the
--- Numerics_Annex.
---
---
--- CHANGE HISTORY:
--- 26 Jun 95 SAIC Initial prerelease version.
--- 29 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 01 DEC 97 EDS Fix value for checking the S'Adjacent attribute
---!
-
-with Report;
-
-procedure CXA5015 is
-
- subtype Float_Subtype is Float range -10.0..10.0;
- type Derived_Float_1 is digits 8;
- type Derived_Float_2 is new Derived_Float_1 range -10.0..10.0E10;
-
- use type Float, Float_Subtype, Derived_Float_1, Derived_Float_2;
-
- TC_Boolean : Boolean;
- TC_Float : Float;
- TC_SFloat : Float_Subtype;
- TC_DFloat_1 : Derived_Float_1;
- TC_DFloat_2 : Derived_Float_2;
- TC_Tolerance : Float := 0.001;
-
- function Not_Equal (Actual_Result, Expected_Result, Tolerance : Float)
- return Boolean is
- begin
- return abs(Actual_Result - Expected_Result) > Tolerance;
- end Not_Equal;
-
-
-begin
-
- Report.Test ("CXA5015", "Check that certain representation-oriented " &
- "attributes are available and that they " &
- "produce correct results");
-
- -- New Representation-Oriented Attributes.
- --
- -- Check the S'Denorm attribute.
-
- TC_Boolean := Float'Denorm;
- TC_Boolean := Float_Subtype'Denorm;
- TC_Boolean := Derived_Float_1'Denorm;
- TC_Boolean := Derived_Float_2'Denorm;
-
-
- -- Check the S'Signed_Zeroes attribute.
-
- TC_Boolean := Float'Signed_Zeros;
- TC_Boolean := Float_Subtype'Signed_Zeros;
- TC_Boolean := Derived_Float_1'Signed_Zeros;
- TC_Boolean := Derived_Float_2'Signed_Zeros;
-
-
- -- New Primitive Function Attributes.
- --
- -- Check the S'Exponent attribute.
-
- TC_Float := 0.5;
- TC_SFloat := 0.99;
- TC_DFloat_1 := 2.45;
- TC_DFloat_2 := 2.65;
-
- if Float'Exponent(TC_Float) > Float_Subtype'Exponent(TC_SFloat) or
- Float'Exponent(TC_Float) > 2
- then
- Report.Failed("Incorrect result from the 'Exponent attribute");
- end if;
-
-
- -- Check the S'Fraction attribute.
-
- if Not_Equal
- (Float'Fraction(TC_Float),
- TC_Float * Float(Float'Machine_Radix)**(-Float'Exponent(TC_Float)),
- TC_Tolerance)
- then
- Report.Failed("Incorrect result from the 'Fraction attribute - 1");
- end if;
-
- if Float'Fraction(TC_Float) <
- (1.0/Float(Float'Machine_Radix)) - TC_Tolerance or
- Float'Fraction(TC_Float) >= 1.0 - TC_Tolerance
- then
- Report.Failed("Incorrect result from the 'Fraction attribute - 2");
- end if;
-
-
- -- Check the S'Compose attribute.
-
- if Not_Equal
- (Float'Compose(TC_Float, 3),
- TC_Float * Float(Float'Machine_Radix)**(3-Float'Exponent(TC_Float)),
- TC_Tolerance)
- then
- Report.Failed("Incorrect result from the 'Compose attribute");
- end if;
-
-
- -- Check the S'Scaling attribute.
-
- if Not_Equal
- (Float'Scaling(TC_Float, 2),
- TC_Float * Float(Float'Machine_Radix)**2,
- TC_Tolerance)
- then
- Report.Failed("Incorrect result from the 'Scaling attribute");
- end if;
-
-
- -- Check the S'Floor attribute.
-
- TC_Float := 0.99;
- TC_SFloat := 1.00;
- TC_DFloat_1 := 2.50;
- TC_DFloat_2 := -2.50;
-
- if Float'Floor(TC_Float) /= 0.0 or
- Float_Subtype'Floor(TC_SFloat) /= 1.0 or
- Derived_Float_1'Floor(TC_DFloat_1) /= 2.0 or
- Derived_Float_2'Floor(TC_DFloat_2) /= -3.0
- then
- Report.Failed("Incorrect result from the 'Floor attribute");
- end if;
-
-
- -- Check the S'Ceiling attribute.
-
- TC_Float := 0.99;
- TC_SFloat := 1.00;
- TC_DFloat_1 := 2.50;
- TC_DFloat_2 := -2.99;
-
- if Float'Ceiling(TC_Float) /= 1.0 or
- Float_Subtype'Ceiling(TC_SFloat) /= 1.0 or
- Derived_Float_1'Ceiling(TC_DFloat_1) /= 3.0 or
- Derived_Float_2'Ceiling(TC_DFloat_2) /= -2.0
- then
- Report.Failed("Incorrect result from the 'Ceiling attribute");
- end if;
-
-
- -- Check the S'Rounding attribute.
-
- TC_Float := 0.49;
- TC_SFloat := 1.00;
- TC_DFloat_1 := 2.50;
- TC_DFloat_2 := -2.50;
-
- if Float'Rounding(TC_Float) /= 0.0 or
- Float_Subtype'Rounding(TC_SFloat) /= 1.0 or
- Derived_Float_1'Rounding(TC_DFloat_1) /= 3.0 or
- Derived_Float_2'Rounding(TC_DFloat_2) /= -3.0
- then
- Report.Failed("Incorrect result from the 'Rounding attribute");
- end if;
-
-
- -- Check the S'Unbiased_Rounding attribute.
-
- TC_Float := 0.50;
- TC_SFloat := 1.50;
- TC_DFloat_1 := 2.50;
- TC_DFloat_2 := -2.50;
-
- if Float'Unbiased_Rounding(TC_Float) /= 0.0 or
- Float_Subtype'Unbiased_Rounding(TC_SFloat) /= 2.0 or
- Derived_Float_1'Unbiased_Rounding(TC_DFloat_1) /= 2.0 or
- Derived_Float_2'Unbiased_Rounding(TC_DFloat_2) /= -2.0
- then
- Report.Failed("Incorrect result from the 'Unbiased_Rounding " &
- "attribute");
- end if;
-
-
- -- Check the S'Truncation attribute.
-
- TC_Float := -0.99;
- TC_SFloat := 1.50;
- TC_DFloat_1 := 2.99;
- TC_DFloat_2 := -2.50;
-
- if Float'Truncation(TC_Float) /= 0.0 or
- Float_Subtype'Truncation(TC_SFloat) /= 1.0 or
- Derived_Float_1'Truncation(TC_DFloat_1) /= 2.0 or
- Derived_Float_2'Truncation(TC_DFloat_2) /= -2.0
- then
- Report.Failed("Incorrect result from the 'Truncation attribute");
- end if;
-
-
- -- Check the S'Remainder attribute.
-
- TC_Float := 9.0;
- TC_SFloat := 7.5;
- TC_DFloat_1 := 5.0;
- TC_DFloat_2 := 8.0;
-
- if Float'Remainder(TC_Float, 2.0) /= 1.0 or
- Float_Subtype'Remainder(TC_SFloat, 3.0) /= 1.5 or
- Derived_Float_1'Remainder(TC_DFloat_1, 2.0) /= 1.0 or
- Derived_Float_2'Remainder(TC_DFloat_2, 4.0) /= 0.0
- then
- Report.Failed("Incorrect result from the 'Remainder attribute");
- end if;
-
-
- -- Check the S'Adjacent attribute.
-
- TC_Float := 4.0;
- TC_SFloat := -1.0;
-
- if Float'Adjacent(TC_Float, TC_Float) /= TC_Float or
- Float_Subtype'Adjacent(TC_SFloat, -1.0) /= TC_SFloat
- then
- Report.Failed("Incorrect result from the 'Adjacent attribute");
- end if;
-
-
- -- Check the S'Copy_Sign attribute.
-
- TC_Float := 0.0;
- TC_SFloat := -1.0;
- TC_DFloat_1 := 5.0;
- TC_DFloat_2 := -2.5;
-
- if Float'Copy_Sign(TC_Float, -2.0) /= 0.0 or
- Float_Subtype'Copy_Sign(TC_SFloat, 4.0) /= 1.0 or
- Derived_Float_1'Copy_Sign(TC_DFloat_1, -2.0) /= -5.0 or
- Derived_Float_2'Copy_Sign(TC_DFloat_2, -2.0) /= -2.5
- then
- Report.Failed("Incorrect result from the 'Copy_Sign attribute");
- end if;
-
-
- -- Check the S'Leading_Part attribute.
-
- TC_Float := 0.0;
- TC_SFloat := -1.0;
- TC_DFloat_1 := 5.88;
- TC_DFloat_2 := -2.52;
-
- -- Leading part obtained in the variables.
- TC_Float := Float'Leading_Part(TC_Float, 2);
- TC_SFloat := Float_Subtype'Leading_Part(TC_SFloat, 2);
- TC_DFloat_1 := Derived_Float_1'Leading_Part(TC_DFloat_1, 2);
- TC_DFloat_2 := Derived_Float_2'Leading_Part(TC_DFloat_2, 2);
-
- -- Checking for the leading part of the variables at this point should
- -- produce the same values.
- if Float'Leading_Part(TC_Float, 2) /= TC_Float or
- Float_Subtype'Leading_Part(TC_SFloat, 2) /= TC_SFloat or
- Derived_Float_1'Leading_Part(TC_DFloat_1, 2) /= TC_DFloat_1 or
- Derived_Float_2'Leading_Part(TC_DFloat_2, 2) /= TC_DFloat_2
- then
- Report.Failed("Incorrect result from the 'Leading_Part attribute");
- end if;
-
-
- -- Check the S'Machine attribute.
-
- TC_Float := 0.0;
- TC_SFloat := -1.0;
- TC_DFloat_1 := 5.88;
- TC_DFloat_2 := -2.52;
-
- -- Closest machine number obtained in the variables.
- TC_Float := Float'Machine(TC_Float);
- TC_SFloat := Float_Subtype'Machine(TC_SFloat);
- TC_DFloat_1 := Derived_Float_1'Machine(TC_DFloat_1);
- TC_DFloat_2 := Derived_Float_2'Machine(TC_DFloat_2);
-
- -- Checking for the closest machine number to each of the variables at
- -- this point should produce the same values.
- if Float'Machine(TC_Float) /= TC_Float or
- Float_Subtype'Machine(TC_SFloat) /= TC_SFloat or
- Derived_Float_1'Machine(TC_DFloat_1) /= TC_DFloat_1 or
- Derived_Float_2'Machine(TC_DFloat_2) /= TC_DFloat_2
- then
- Report.Failed("Incorrect result from the 'Machine attribute");
- end if;
-
-
- -- New Model-Oriented Attributes.
- --
- -- Check the S'Model_Small attribute.
-
- if Not_Equal
- (Float'Model_Small,
- Float(Float'Machine_Radix)**(Float'Model_Emin-1),
- TC_Tolerance)
- then
- Report.Failed("Incorrect result from the 'Model_Small attribute");
- end if;
-
-
- Report.Result;
-
-end CXA5015;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a01.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a01.a
deleted file mode 100644
index 12db5e7e108..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a01.a
+++ /dev/null
@@ -1,338 +0,0 @@
--- CXA5A01.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions Sin and Sinh provide correct results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Sin and Sinh resulting from
--- the instantiation of the Ada.Numerics.Generic_Elementary_Functions
--- with a type derived from type Float, as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, as well as instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A01.A
---
---
--- CHANGE HISTORY:
--- 06 Mar 95 SAIC Initial prerelease version.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 26 Jun 98 EDS Protected exception tests by first testing
--- for 'Machine_Overflows
---!
-
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A01 is
-begin
-
- Report.Test ("CXA5A01", "Check that the functions Sin and Sinh provide " &
- "correct results");
-
- Test_Block:
- declare
-
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- The_Result : Float;
- New_Float_Result : New_Float;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Sin Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that no exception occurs on computing the Sin with very
- -- large (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Sin (New_Float(FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Sin with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Sin (FXA5A00.Minus_Large);
- Dont_Optimize_Float(The_Result, 2);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Sin with large " &
- "negative value");
- end;
-
-
- -- Test of Sin for prescribed result at zero.
-
- if GEF.Sin (0.0) /= 0.0 or
- EF.Sin (0.0) /= 0.0
- then
- Report.Failed("Incorrect value returned from Sin(0.0)");
- end if;
-
-
- -- Test of Sin with expected result value between 0.0 and 1.0.
-
- if not (GEF.Sin (Ada.Numerics.Pi/4.0) < 1.0) or
- not ( EF.Sin (Ada.Numerics.Pi/4.0) < 1.0) or
- not FXA5A00.Result_Within_Range(GEF.Sin(0.35), 0.343, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Sin(1.18), 0.924, 0.001)
- then
- Report.Failed("Incorrect value returned from Sin function when " &
- "the expected result is between 0.0 and 1.0");
- end if;
-
-
- -- Test of Sin with expected result value between -1.0 and 0.0.
-
- if not (GEF.Sin (-Ada.Numerics.Pi/4.0) > -1.0) or
- not ( EF.Sin (-Ada.Numerics.Pi/4.0) > -1.0) or
- not FXA5A00.Result_Within_Range(GEF.Sin(-0.24), -0.238, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Sin(-1.00), -0.841, 0.001)
- then
- Report.Failed("Incorrect value returned from Sin function when " &
- "the expected result is between -1.0 and 0.0");
- end if;
-
-
- -- Testing of the Sin function with Cycle parameter.
-
- -- Check that Argument_Error is raised when the value of the Cycle
- -- parameter is zero.
-
- begin
- New_Float_Result := GEF.Sin (X => 1.0, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by GEF.Sin function " &
- "when the Cycle parameter is zero");
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by GEF.Sin function " &
- "when the Cycle parameter is zero");
- end;
-
- begin
- The_Result := EF.Sin (X => 0.34, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by EF.Sin function when " &
- "the Cycle parameter is zero");
- Dont_Optimize_Float(The_Result, 4);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by EF.Sin function " &
- "when the Cycle parameter is zero");
- end;
-
- -- Check that Argument_Error is raised when the value of the Cycle
- -- parameter is negative.
-
- begin
- New_Float_Result := GEF.Sin (X => 0.45, Cycle => -1.0);
- Report.Failed("Argument_Error not raised by GEF.Sin function " &
- "when the Cycle parameter is negative");
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by GEF.Sin function " &
- "when the Cycle parameter is negative");
- end;
-
- begin
- The_Result := EF.Sin (X => 0.10, Cycle => -4.0);
- Report.Failed("Argument_Error not raised by EF.Sin function when " &
- "the Cycle parameter is negative");
- Dont_Optimize_Float(The_Result, 6);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by EF.Sin function " &
- "when the Cycle parameter is negative");
- end;
-
-
- -- Check that no exception occurs on computing the Sin with very
- -- large (positive and negative) input values and Cycle parameter.
-
- begin
- New_Float_Result := GEF.Sin (New_Float(FXA5A00.Large), 360.0);
- Dont_Optimize_New_Float(New_Float_Result, 7);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Sin with large " &
- "positive value and Cycle parameter");
- end;
-
- begin
- The_Result := EF.Sin (FXA5A00.Minus_Large, 720.0);
- Dont_Optimize_Float(The_Result, 8);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Sin with large " &
- "negative value and Cycle parameter");
- end;
-
-
- -- Test of Sin with Cycle parameter for prescribed result at zero.
-
- if GEF.Sin (0.0, 360.0) /= 0.0 or
- EF.Sin (0.0, 180.0) /= 0.0
- then
- Report.Failed("Incorrect value returned from Sin function with " &
- "cycle parameter for a zero input parameter value");
- end if;
-
-
- -- Tests of Sin function with Cycle parameter for prescribed results.
-
- if GEF.Sin(0.0, 360.0) /= 0.0 or
- EF.Sin(180.0, 360.0) /= 0.0 or
- GEF.Sin(90.0, 360.0) /= 1.0 or
- EF.Sin(450.0, 360.0) /= 1.0 or
- GEF.Sin(270.0, 360.0) /= -1.0 or
- EF.Sin(630.0, 360.0) /= -1.0
- then
- Report.Failed("Incorrect result from the Sin function with " &
- "various cycle values for prescribed results");
- end if;
-
-
- -- Testing of Sinh Function, both instantiated and pre-instantiated
- -- version.
-
- -- Test for Constraint_Error on parameter with large positive magnitude.
-
- begin
-
- if New_Float'Machine_Overflows then
- New_Float_Result := GEF.Sinh (New_Float(FXA5A00.Large));
- Report.Failed("Constraint_Error not raised when the GEF.Sinh " &
- "function is provided a parameter with a large " &
- "positive value");
- Dont_Optimize_New_Float(New_Float_Result, 9);
- end if;
-
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Constraint_Error not raised when the GEF.Sinh " &
- "function is provided a parameter with a large " &
- "positive value");
- end;
-
- -- Test for Constraint_Error on parameter with large negative magnitude.
-
- begin
-
- if Float'Machine_Overflows then
- The_Result := EF.Sinh (FXA5A00.Minus_Large);
- Report.Failed("Constraint_Error not raised when the EF.Sinh " &
- "function is provided a parameter with a " &
- "large negative value");
- Dont_Optimize_Float(The_Result, 10);
- end if;
-
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Constraint_Error not raised when the EF.Sinh " &
- "function is provided a parameter with a " &
- "large negative value");
- end;
-
-
- -- Test that no exception occurs when the Sinh function is provided a
- -- very small positive or negative value.
-
- begin
- New_Float_Result := GEF.Sinh (New_Float(FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 11);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Sinh with a very" &
- "small positive value");
- end;
-
- begin
- The_Result := EF.Sinh (-FXA5A00.Small);
- Dont_Optimize_Float(The_Result, 12);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Sinh with a very" &
- "small negative value");
- end;
-
-
- -- Test for prescribed 0.0 result of Function Sinh with 0.0 parameter.
-
- if GEF.Sinh (0.0) /= 0.0 or
- EF.Sinh (0.0) /= 0.0
- then
- Report.Failed("Incorrect value returned from Sinh(0.0)");
- end if;
-
-
- -- Test of Sinh function with various input parameters.
-
- if not FXA5A00.Result_Within_Range(GEF.Sinh(0.01), 0.010, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Sinh(0.61), 0.649, 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Sinh(1.70), 2.65, 0.01) or
- not FXA5A00.Result_Within_Range( EF.Sinh(3.15), 11.65, 0.01)
- then
- Report.Failed("Incorrect result returned from Sinh function " &
- "with various input parameters");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5A01;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a02.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a02.a
deleted file mode 100644
index 9e6c575dd2c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a02.a
+++ /dev/null
@@ -1,328 +0,0 @@
--- CXA5A02.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions Cos and Cosh provide correct results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Cos and Cosh resulting from
--- the instantiation of the Ada.Numerics.Generic_Elementary_Functions
--- with type derived from type Float, as well as the pre-instantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A02.A
---
---
--- CHANGE HISTORY:
--- 09 Mar 95 SAIC Initial prerelease version.
--- 03 Apr 95 SAIC Removed reference to derived type.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 28 Feb 97 PWB.CTA Removed checks specifying Cycle => 2.0 * Pi
--- 26 Jun 98 EDS Protected exception checks by first testing
--- for 'Machine_Overflows. Removed code deleted
--- by comment.
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks have been deleted.
---!
-
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A02 is
-begin
-
- Report.Test ("CXA5A02", "Check that the functions Cos and Cosh provide " &
- "correct results");
-
- Test_Block:
- declare
-
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- The_Result : Float;
- New_Float_Result : New_Float;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Cos Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that no exception occurs on computing the Cos with very
- -- large (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Cos (New_Float(FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Cos with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Cos (FXA5A00.Minus_Large);
- Dont_Optimize_Float(The_Result, 2);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Cos with large " &
- "negative value");
- end;
-
-
- -- Test of Cos for prescribed result at zero.
-
- if GEF.Cos (0.0) /= 1.0 or
- EF.Cos (0.0) /= 1.0
- then
- Report.Failed("Incorrect value returned from Cos(0.0)");
- end if;
-
-
- -- Test of Cos with expected result value between 1.0 and -1.0.
-
- if not (Result_Within_Range( EF.Cos(Ada.Numerics.Pi/3.0),
- 0.500,
- 0.001) and
- Result_Within_Range(GEF.Cos(0.6166), 0.816, 0.001) and
- Result_Within_Range(GEF.Cos(0.1949), 0.981, 0.001) and
- Result_Within_Range( EF.Cos(Ada.Numerics.Pi/2.0),
- 0.00,
- 0.001) and
- Result_Within_Range( EF.Cos(2.0*Ada.Numerics.Pi/3.0),
- -0.500,
- 0.001) and
- Result_Within_Range(GEF.Cos(New_Float(Ada.Numerics.Pi)),
- -1.00,
- 0.001))
- then
- Report.Failed("Incorrect value returned from Cos function when " &
- "the expected result is between 1.0 and -1.0");
- end if;
-
-
- -- Testing of the Cos function with Cycle parameter.
-
- -- Check that Argument_Error is raised when the value of the Cycle
- -- parameter is zero.
-
- begin
- New_Float_Result := GEF.Cos (X => 1.0, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by GEF.Cos function " &
- "when the Cycle parameter is zero");
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by GEF.cos function " &
- "when the Cycle parameter is zero");
- end;
-
- begin
- The_Result := EF.Cos (X => 0.55, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by EF.Cos function when " &
- "the Cycle parameter is zero");
- Dont_Optimize_Float(The_Result, 4);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by EF.Cos function " &
- "when the Cycle parameter is zero");
- end;
-
- -- Check that Argument_Error is raised when the value of the Cycle
- -- parameter is negative.
-
- begin
- New_Float_Result := GEF.Cos (X => 0.45, Cycle => -2.0*Pi);
- Report.Failed("Argument_Error not raised by GEF.Cos function " &
- "when the Cycle parameter is negative");
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by GEF.Cos function " &
- "when the Cycle parameter is negative");
- end;
-
- begin
- The_Result := EF.Cos (X => 0.10, Cycle => -Pi/2.0);
- Report.Failed("Argument_Error not raised by EF.Cos function when " &
- "the Cycle parameter is negative");
- Dont_Optimize_Float(The_Result, 6);
- exception
- when Ada.Numerics.Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by EF.Cos function " &
- "when the Cycle parameter is negative");
- end;
-
- -- Test of Cos with Cycle parameter for prescribed result at zero.
-
- if GEF.Cos (0.0, 360.0) /= 1.0 or
- EF.Cos (0.0, 360.0) /= 1.0
- then
- Report.Failed("Incorrect value returned from Cos function with " &
- "cycle parameter for a zero input parameter value");
- end if;
-
-
- -- Tests of Cos function with specified Cycle, using various input
- -- parameter values for prescribed results.
-
- if GEF.Cos(0.0, 360.0) /= 1.0 or
- EF.Cos(360.0, 360.0) /= 1.0 or
- GEF.Cos(90.0, 360.0) /= 0.0 or
- EF.Cos(270.0, 360.0) /= 0.0 or
- GEF.Cos(180.0, 360.0) /= -1.0 or
- EF.Cos(540.0, 360.0) /= -1.0
- then
- Report.Failed("Incorrect result from the Cos function with " &
- "specified cycle for prescribed results");
- end if;
-
-
-
- -- Testing of Cosh Function, both instantiated and pre-instantiated
- -- version.
-
- -- Test for Constraint_Error on parameter with large positive magnitude.
-
- begin
-
- if New_Float'Machine_Overflows then
-
- New_Float_Result := GEF.Cosh (New_Float(FXA5A00.Large));
- Report.Failed("Constraint_Error not raised when the GEF.Cosh " &
- "function is provided a parameter with a large " &
- "positive value");
- Dont_Optimize_New_Float(New_Float_Result, 9);
- end if;
-
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Constraint_Error not raised when the GEF.Cosh " &
- "function is provided a parameter with a large " &
- "positive value");
- end;
-
- -- Test for Constraint_Error on parameter with large negative magnitude.
-
- begin
-
- if Float'Machine_Overflows then
- The_Result := EF.Cosh (FXA5A00.Minus_Large);
- Report.Failed("Constraint_Error not raised when the EF.Cosh " &
- "function is provided a parameter with a " &
- "large negative value");
- Dont_Optimize_Float(The_Result, 10);
- end if;
-
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Constraint_Error not raised when the EF.Cosh " &
- "function is provided a parameter with a " &
- "large negative value");
- end;
-
-
- -- Test that no exception occurs when the Cosh function is provided a
- -- very small positive or negative value.
-
- begin
- New_Float_Result := GEF.Cosh (New_Float(FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 11);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Cosh with a very" &
- "small positive value");
- end;
-
- begin
- The_Result := EF.Cosh (-FXA5A00.Small);
- Dont_Optimize_Float(The_Result, 12);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Cosh with a very" &
- "small negative value");
- end;
-
-
- -- Test for prescribed 1.0 result of Function Cosh with 0.0 parameter.
-
- if GEF.Cosh (0.0) /= 1.0 or
- EF.Cosh (0.0) /= 1.0
- then
- Report.Failed("Incorrect value returned from Cosh(0.0)");
- end if;
-
-
- -- Test of Cosh function with various input parameters.
-
- if not FXA5A00.Result_Within_Range(GEF.Cosh(0.24), 1.029, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Cosh(0.59), 1.179, 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Cosh(1.06), 1.616, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Cosh(1.50), 2.352, 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Cosh(1.84), 3.228, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Cosh(3.40), 14.99, 0.01)
- then
- Report.Failed("Incorrect result from Cosh function with " &
- "various input parameters");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5A02;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a03.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a03.a
deleted file mode 100644
index d99ba9bdcf0..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a03.a
+++ /dev/null
@@ -1,426 +0,0 @@
--- CXA5A03.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions Tan, Tanh, and Arctanh provide correct
--- results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Tan, Tanh, and Arctanh
--- the instantiation of the Ada.Numerics.Generic_Elementary_Functions
--- with a type derived from type Float, as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A03.A
---
---
--- CHANGE HISTORY:
--- 14 Mar 95 SAIC Initial prerelease version.
--- 06 Apr 95 SAIC Corrected errors in context clause references
--- and usage of Cycle parameter.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 29 Jun 98 EDS Protected exception tests by first testing
--- for 'Machine_Overflows
---
---!
-
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A03 is
-begin
-
- Report.Test ("CXA5A03", "Check that the functions Tan, Tanh, and " &
- "Arctanh provide correct results");
-
- Test_Block:
- declare
-
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- The_Result : Float;
- New_Float_Result : New_Float;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Tan Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that no exception occurs on computing the Tan with very
- -- large (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Tan (New_Float(FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Tan with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Tan (FXA5A00.Minus_Large);
- Dont_Optimize_Float(The_Result, 2);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Tan with large " &
- "negative value");
- end;
-
-
- -- Check that no exception occurs on computing the Tan with very
- -- small (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Tan (New_Float(FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Tan with small " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Tan (-FXA5A00.Small);
- Dont_Optimize_Float(The_Result, 4);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Tan with small " &
- "negative value");
- end;
-
-
- -- Check prescribed result from Tan function. When the parameter X
- -- has the value zero, the Tan function yields a result of zero.
-
- if GEF.Tan(0.0) /= 0.0 or
- EF.Tan(0.0) /= 0.0
- then
- Report.Failed("Incorrect result from Tan function with zero " &
- "value input parameter");
- end if;
-
-
- -- Check the results of the Tan function with various input parameters.
-
- if not (Result_Within_Range(GEF.Tan(0.7854), 1.0, 0.001) and
- Result_Within_Range(GEF.Tan(0.8436), 1.124, 0.001) and
- Result_Within_Range( EF.Tan(Pi), 0.0, 0.001) and
- Result_Within_Range( EF.Tan(-Pi), 0.0, 0.001) and
- Result_Within_Range(GEF.Tan(0.5381), 0.597, 0.001) and
- Result_Within_Range( EF.Tan(0.1978), 0.200, 0.001))
- then
- Report.Failed("Incorrect result from Tan function with various " &
- "input parameters");
- end if;
-
-
- -- Testing of Tan function with cycle parameter.
-
- -- Check that Constraint_Error is raised by the Tan function with
- -- specified cycle, when the value of the parameter X is an odd
- -- multiple of the quarter cycle.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Tan(270.0, 360.0);
- Report.Failed("Constraint_Error not raised by GEF.Tan on odd " &
- "multiple of the quarter cycle");
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by GEF.Tan on odd " &
- "multiple of the quarter cycle");
- end;
- end if;
-
- -- Check that the exception Numerics.Argument_Error is raised, when
- -- the value of the parameter Cycle is zero or negative.
-
- begin
- New_Float_Result := GEF.Tan(X => 1.0, Cycle => -360.0);
- Report.Failed("Argument_Error not raised by GEF.Tan when Cycle " &
- "parameter has negative value");
- Dont_Optimize_New_Float(New_Float_Result, 6);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by GEF.Tan when Cycle " &
- "parameter has negative value");
- end;
-
- begin
- The_Result := EF.Tan(1.0, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by GEF.Tan when Cycle " &
- "parameter has a zero value");
- Dont_Optimize_Float(The_Result, 7);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by EF.Tan when Cycle " &
- "parameter has a zero value");
- end;
-
-
- -- Check that no exception occurs on computing the Tan with very
- -- large (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Tan (New_Float(FXA5A00.Large), 360.0);
- Dont_Optimize_New_Float(New_Float_Result, 8);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Tan with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Tan (FXA5A00.Minus_Large, Cycle => 360.0);
- Dont_Optimize_Float(The_Result, 9);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Tan with large " &
- "negative value");
- end;
-
-
- -- Check prescribed result from Tan function with Cycle parameter.
-
- if GEF.Tan(0.0, 360.0) /= 0.0 or
- EF.Tan(0.0, Cycle => 360.0) /= 0.0
- then
- Report.Failed("Incorrect result from Tan function with cycle " &
- "parameter, using a zero value input parameter");
- end if;
-
-
- -- Check the Tan function, with specified Cycle parameter, with a
- -- variety of input parameters.
-
- if not Result_Within_Range(GEF.Tan(30.0, 360.0), 0.577, 0.001) or
- not Result_Within_Range( EF.Tan(57.0, 360.0), 1.540, 0.001) or
- not Result_Within_Range(GEF.Tan(115.0, 360.0), -2.145, 0.001) or
- not Result_Within_Range( EF.Tan(299.0, 360.0), -1.804, 0.001) or
- not Result_Within_Range(GEF.Tan(390.0, 360.0), 0.577, 0.001) or
- not Result_Within_Range( EF.Tan(520.0, 360.0), -0.364, 0.001)
- then
- Report.Failed("Incorrect result from the Tan function with " &
- "cycle parameter, with various input parameter " &
- "values");
- end if;
-
-
-
- -- Testing of Tanh Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that no exception occurs on computing the Tan with very
- -- large (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Tanh (New_Float(FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 10);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Tanh with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Tanh (FXA5A00.Minus_Large);
- Dont_Optimize_Float(The_Result, 11);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Tanh with large " &
- "negative value");
- end;
-
-
- -- Check for prescribed result of Tanh with zero value input parameter.
-
- if GEF.Tanh (0.0) /= 0.0 or
- EF.Tanh (0.0) /= 0.0
- then
- Report.Failed("Incorrect result from Tanh with zero parameter");
- end if;
-
-
- -- Check the results of the Tanh function with various input
- -- parameters.
-
- if not (FXA5A00.Result_Within_Range(GEF.Tanh(2.99), 0.995, 0.001) and
- FXA5A00.Result_Within_Range(GEF.Tanh(0.130), 0.129, 0.001) and
- FXA5A00.Result_Within_Range( EF.Tanh(Pi), 0.996, 0.001) and
- FXA5A00.Result_Within_Range( EF.Tanh(-Pi), -0.996, 0.001) and
- FXA5A00.Result_Within_Range(GEF.Tanh(0.60), 0.537, 0.001) and
- FXA5A00.Result_Within_Range( EF.Tanh(1.04), 0.778, 0.001) and
- FXA5A00.Result_Within_Range(GEF.Tanh(1.55), 0.914, 0.001) and
- FXA5A00.Result_Within_Range( EF.Tanh(-2.14), -0.973, 0.001))
- then
- Report.Failed("Incorrect result from Tanh function with various " &
- "input parameters");
- end if;
-
-
-
- -- Testing of Arctanh Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Constraint_Error is raised by the Arctanh function
- -- when the absolute value of the parameter X is one.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Arctanh(X => 1.0);
- Report.Failed("Constraint_Error not raised by Function Arctanh " &
- "when provided a parameter value of 1.0");
- Dont_Optimize_New_Float(New_Float_Result, 12);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arctanh "
- & "when provided a parameter value of 1.0");
- end;
- end if;
-
- if Float'Machine_Overflows = True then
- begin
- The_Result := EF.Arctanh(-1.0);
- Report.Failed("Constraint_Error not raised by Function Arctanh " &
- "when provided a parameter value of -1.0");
- Dont_Optimize_Float(The_Result, 13);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arctanh "
- & "when provided a parameter value of -1.0");
- end;
- end if;
-
- -- Check that Function Arctanh raises Argument_Error when the absolute
- -- value of the parameter X exceeds one.
-
- begin
- New_Float_Result := GEF.Arctanh(New_Float(FXA5A00.One_Plus_Delta));
- Report.Failed("Argument_Error not raised by Function Arctanh " &
- "when provided a parameter value greater than 1.0");
- Dont_Optimize_New_Float(New_Float_Result, 14);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arctanh " &
- "when provided a parameter value greater than 1.0");
- end;
-
-
- begin
- The_Result := EF.Arctanh(FXA5A00.Minus_One_Minus_Delta);
- Report.Failed("Argument_Error not raised by Function Arctanh " &
- "when provided a parameter value less than -1.0");
- Dont_Optimize_Float(The_Result, 15);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arctanh " &
- "when provided a parameter value less than -1.0");
- end;
-
-
- begin
- New_Float_Result := GEF.Arctanh(New_Float(FXA5A00.Large));
- Report.Failed("Argument_Error not raised by Function Arctanh " &
- "when provided a large positive parameter value");
- Dont_Optimize_New_Float(New_Float_Result, 16);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arctanh " &
- "when provided a large positive parameter value");
- end;
-
-
- begin
- The_Result := EF.Arctanh(FXA5A00.Minus_Large);
- Report.Failed("Argument_Error not raised by Function Arctanh " &
- "when provided a large negative parameter value");
- Dont_Optimize_Float(The_Result, 17);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arctanh " &
- "when provided a large negative parameter value");
- end;
-
-
- -- Prescribed results for Function Arctanh with zero input value.
-
- if GEF.Arctanh(0.0) /= 0.0 or
- EF.Arctanh(0.0) /= 0.0
- then
- Report.Failed("Incorrect result from Function Arctanh with a " &
- "parameter value of zero");
- end if;
-
-
- -- Check the results of the Arctanh function with various input
- -- parameters.
-
- if not (Result_Within_Range(GEF.Arctanh(0.15), 0.151, 0.001) and
- Result_Within_Range( EF.Arctanh(0.44), 0.472, 0.001) and
- Result_Within_Range(GEF.Arctanh(0.81), 1.127, 0.001) and
- Result_Within_Range( EF.Arctanh(0.99), 2.647, 0.001))
- then
- Report.Failed("Incorrect result from Arctanh function with " &
- "various input parameters");
- end if;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5A03;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a04.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a04.a
deleted file mode 100644
index 9b590a23cb8..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a04.a
+++ /dev/null
@@ -1,434 +0,0 @@
--- CXA5A04.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions Cot, Coth, and Arccoth provide correct
--- results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Cot, Coth, and Arccoth
--- the instantiation of the Ada.Numerics.Generic_Elementary_Functions
--- with a type derived from type Float, as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A04.A
---
---
--- CHANGE HISTORY:
--- 15 Mar 95 SAIC Initial prerelease version.
--- 07 Apr 95 SAIC Corrected errors in context clause reference,
--- added trigonometric relationship checks.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 18 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 28 Feb 97 PWB.CTA Removed checks with explicit Cycle => 2.0*Pi
--- 29 Jun 98 EDS Protected exception tests by first testing
--- for 'Machine_Overflows
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
-with Ada.Exceptions;
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A04 is
-begin
-
- Report.Test ("CXA5A04", "Check that the functions Cot, Coth, and " &
- "Arccoth provide correct results");
-
- Test_Block:
- declare
-
- use Ada.Exceptions;
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- The_Result : Float;
- New_Float_Result : New_Float;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Cot Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Constraint_Error is raised with the Cot function is
- -- given a parameter input value of 0.0.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Cot (0.0);
- Report.Failed("Constraint_Error not raised by Function Cot " &
- "when provided a zero input parameter value");
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Cot " &
- "when provided a zero input parameter value");
- end;
- end if;
-
- -- Check that no exception occurs on computing the Cot with very
- -- large (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Cot (New_Float(FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 2);
- exception
- when others =>
- Report.Failed("Unexpected exception on GEF.Cot with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Cot (FXA5A00.Minus_Large);
- Dont_Optimize_Float(The_Result, 3);
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Cot with large " &
- "negative value");
- end;
-
-
- -- Check the results of the Cot function with various input parameters.
-
- if not (FXA5A00.Result_Within_Range(GEF.Cot(Pi/4.0), 1.0, 0.001) and
- FXA5A00.Result_Within_Range( EF.Cot(Pi/2.0), 0.0, 0.001) and
- FXA5A00.Result_Within_Range(GEF.Cot(3.0*Pi/4.0),-1.0, 0.001) and
- FXA5A00.Result_Within_Range( EF.Cot(3.0*Pi/2.0), 0.0, 0.001))
- then
- Report.Failed("Incorrect result from Cot function with various " &
- "input parameters");
- end if;
-
-
- -- Check the results of the Cot function against the results of
- -- various trigonometric relationships.
-
- if not FXA5A00.Result_Within_Range(GEF.Cot(New_Float(Pi/4.0)),
- 1.0/EF.Tan(Pi/4.0),
- 0.001) or
- not FXA5A00.Result_Within_Range(EF.Cot(Pi/4.0),
- EF.Cos(Pi/4.0)/EF.Sin(Pi/4.0),
- 0.001) or
- not FXA5A00.Result_Within_Range(EF.Cot(EF.Arccot(Pi/4.0)),
- Pi/4.0,
- 0.001)
- then
- Report.Failed("Incorrect result from Cot function with respect " &
- "to various trigonometric relationship expected " &
- "results");
- end if;
-
-
- -- Testing of Cot with Cycle parameter.
-
- -- Check that Argument_Error is raised by the Cot function when the
- -- value of the Cycle parameter is zero or negative.
-
- begin
- New_Float_Result := GEF.Cot (1.0, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by the Cot Function " &
- "with a specified cycle value of 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 4);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Unexpected exception raised by the Cot Function with " &
- "a specified cycle value of 0.0");
- end;
-
- begin
- The_Result := EF.Cot (X => 1.0, Cycle => -360.0);
- Report.Failed("Argument_Error not raised by the Cot Function " &
- "with a specified cycle value of -360.0");
- Dont_Optimize_Float(The_Result, 5);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Unexpected exception raised by the Cot Function with " &
- "a specified cycle value of -360.0");
- end;
-
-
- -- Check that Constraint_Error is raised by the Cot Function with
- -- specified cycle, when the value of the parameter X is 0.0.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Cot (0.0, 360.0);
- Report.Failed("Constraint_Error not raised by Function Cot " &
- "with specified cycle, when value of parameter " &
- "X is 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 6);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Cot " &
- "with specified cycle, when value of parameter " &
- "X is 0.0");
- end;
- end if;
-
- -- Check that Constraint_Error is raised by the Cot Function with
- -- specified cycle, when the value of the parameter X is a multiple
- -- of the half cycle.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Cot (180.0, 360.0);
- Report.Failed("Constraint_Error not raised by Function Cot " &
- "with specified cycle, when value of parameter " &
- "X is a multiple of the half cycle (180.0, 360.0)");
- Dont_Optimize_New_Float(New_Float_Result, 7);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Cot " &
- "with specified cycle, when value of parameter " &
- "X is a multiple of the half cycle" &
- " (180.0, 360.0)");
- end;
- end if;
-
- if Float'Machine_Overflows = True then
- begin
- The_Result := EF.Cot (540.0, 360.0);
- Report.Failed("Constraint_Error not raised by Function Cot " &
- "with specified cycle, when value of parameter " &
- "X is a multiple of the half cycle (540.0, 360.0)");
- Dont_Optimize_Float(The_Result, 8);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Cot " &
- "with specified cycle, when value of parameter " &
- "X is a multiple of the half cycle (540.0, 360.0)");
- end;
- end if;
-
---pwb-math -- Check that no exception occurs on computing the Cot with very
---pwb-math -- large (positive and negative) input values.
---pwb-math
---pwb-math begin
---pwb-math New_Float_Result := GEF.Cot (New_Float(FXA5A00.Large), 2.0*Pi);
---pwb-math Dont_Optimize_New_Float(New_Float_Result, 9);
---pwb-math exception
---pwb-math when others =>
---pwb-math Report.Failed("Unexpected exception on GEF.Cot with large " &
---pwb-math "positive value");
---pwb-math end;
---pwb-math
---pwb-math begin
---pwb-math The_Result := EF.Cot (FXA5A00.Minus_Large, Cycle => 2.0*Pi);
---pwb-math Dont_Optimize_Float(The_Result, 10);
---pwb-math exception
---pwb-math when others =>
---pwb-math Report.Failed("Unexpected exception on EF.Cot with large " &
---pwb-math "negative value");
---pwb-math end;
---pwb-math
---pwb-math
---pwb-math -- Check prescribed result from Cot function with Cycle parameter.
---pwb-math
---pwb-math if not FXA5A00.Result_Within_Range
---pwb-math (GEF.Cot(New_Float(FXA5A00.Half_Pi), 2.0*Pi), 0.0, 0.001) or
---pwb-math not FXA5A00.Result_Within_Range
---pwb-math (EF.Cot(3.0*Pi/2.0, Cycle => 2.0*Pi), 0.0, 0.001)
---pwb-math then
---pwb-math Report.Failed("Incorrect result from Cot function with cycle " &
---pwb-math "parameter, using a multiple of Pi/2 as the " &
---pwb-math "input parameter");
---pwb-math end if;
-
-
- -- Testing of Coth Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that no exception occurs on computing the Coth with very
- -- large (positive and negative) input values.
-
- begin
- The_Result := EF.Coth (FXA5A00.Large);
- if The_Result > 1.0 then
- Report.Failed("Result of Coth function with large positive " &
- "value greater than 1.0");
- end if;
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Coth with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Coth (FXA5A00.Minus_Large);
- if The_Result < -1.0 then
- Report.Failed("Result of Coth function with large negative " &
- "value less than -1.0");
- end if;
- exception
- when others =>
- Report.Failed("Unexpected exception on EF.Coth with large " &
- "negative value");
- end;
-
-
- -- Check that Constraint_Error is raised by the Coth function, when
- -- the value of the parameter X is 0.0.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Coth (X => 0.0);
- Report.Failed("Constraint_Error not raised by the Coth function " &
- "when the value of parameter X is 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 11);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Coth " &
- "function when the value of parameter X is 0.0");
- end;
- end if;
-
-
- -- Testing of Arccoth Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Constraint_Error is raised by the Arccoth function
- -- when the absolute value of the parameter X is 1.0.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Arccoth (X => 1.0);
- Report.Failed("Constraint_Error not raised by the Arccoth " &
- "function when the value of parameter X is 1.0");
- Dont_Optimize_New_Float(New_Float_Result, 12);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccoth " &
- "function when the value of parameter X is 1.0");
- end;
- end if;
-
- if Float'Machine_Overflows = True then
- begin
- The_Result := EF.Arccoth (-1.0);
- Report.Failed("Constraint_Error not raised by the Arccoth " &
- "function when the value of parameter X is -1.0");
- Dont_Optimize_Float(The_Result, 13);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccoth " &
- "function when the value of parameter X is -1.0");
- end;
- end if;
-
- -- Check that Argument_Error is raised by the Arccoth function when
- -- the absolute value of the parameter X is less than 1.0.
-
- begin
- New_Float_Result := GEF.Arccoth (X => New_Float(One_Minus_Delta));
- Report.Failed("Argument_Error not raised by the Arccoth " &
- "function with parameter value less than 1.0");
- Dont_Optimize_New_Float(New_Float_Result, 14);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccoth " &
- "function with parameter value less than 1.0");
- end;
-
- begin
- The_Result := EF.Arccoth (X => FXA5A00.Minus_One_Plus_Delta);
- Report.Failed("Argument_Error not raised by the Arccoth function " &
- "with parameter value between 0.0 and -1.0");
- Dont_Optimize_Float(The_Result, 15);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccoth " &
- "function with parameter value between 0.0 " &
- "and -1.0");
- end;
-
-
- -- Check the results of the Arccoth function with various input
- -- parameters.
-
- if not (Result_Within_Range(GEF.Arccoth(1.01), 2.652, 0.01) and
- Result_Within_Range( EF.Arccoth(1.25), 1.099, 0.01) and
- Result_Within_Range(GEF.Arccoth(1.56), 0.760, 0.001) and
- Result_Within_Range( EF.Arccoth(1.97), 0.560, 0.001) and
- Result_Within_Range(GEF.Arccoth(2.40), 0.444, 0.001) and
- Result_Within_Range( EF.Arccoth(4.30), 0.237, 0.001) and
- Result_Within_Range(GEF.Arccoth(5.80), 0.174, 0.001) and
- Result_Within_Range( EF.Arccoth(7.00), 0.144, 0.001))
- then
- Report.Failed("Incorrect result from Arccoth function with various " &
- "input parameters");
- end if;
-
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXA5A04;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a05.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a05.a
deleted file mode 100644
index b50da3a6ab5..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a05.a
+++ /dev/null
@@ -1,338 +0,0 @@
--- CXA5A05.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions Arcsin and Arcsinh provide correct
--- results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Arcsin and Arcsinh
--- the instantiation of the Ada.Numerics.Generic_Elementary_Functions
--- with a type derived from type Float, as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A05.A
---
---
--- CHANGE HISTORY:
--- 20 Mar 95 SAIC Initial prerelease version.
--- 06 Apr 95 SAIC Corrected errors in context clause reference and
--- use of Cycle parameter.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 28 Feb 97 PWB.CTA Removed checks with explict Cycle => 2.0*Pi
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A05 is
-begin
-
- Report.Test ("CXA5A05", "Check that the functions Arcsin and Arcsinh " &
- "provide correct results");
-
- Test_Block:
- declare
-
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- The_Result : Float;
- New_Float_Result : New_Float;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Function Arcsin, both instantiated and pre-instantiated
- -- versions.
-
- -- Check that Argument_Error is raised by the Arcsin function when
- -- the absolute value of the parameter X is greater than 1.0.
-
- begin
- New_Float_Result := GEF.Arcsin(New_Float(FXA5A00.One_Plus_Delta));
- Report.Failed("Argument_Error not raised by Arcsin function " &
- "when provided a parameter value larger than 1.0");
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Arcsin function " &
- "when provided a parameter value larger than 1.0");
- end;
-
- begin
- The_Result := EF.Arcsin(FXA5A00.Minus_Large);
- Report.Failed("Argument_Error not raised by Arcsin function " &
- "when provided a large negative parameter value");
- Dont_Optimize_Float(The_Result, 2);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Arcsin function " &
- "when provided a large negative parameter value");
- end;
-
-
- -- Check the prescribed result of function Arcsin with parameter 0.0.
-
- if GEF.Arcsin(X => 0.0) /= 0.0 or
- EF.Arcsin(0.0) /= 0.0
- then
- Report.Failed("Incorrect result from Function Arcsin when the " &
- "value of the parameter X is 0.0");
- end if;
-
-
- -- Check the results of the Arcsin function with various input
- -- parameters.
-
- if not Result_Within_Range(GEF.Arcsin(1.0), 1.571, 0.001) or
- not Result_Within_Range( EF.Arcsin(0.62), 0.669, 0.001) or
- not Result_Within_Range(GEF.Arcsin(0.01), 0.010, 0.001) or
- not Result_Within_Range( EF.Arcsin(-0.29), -0.294, 0.001) or
- not Result_Within_Range(GEF.Arcsin(-0.50), -0.524, 0.001) or
- not Result_Within_Range( EF.Arcsin(-1.0), -1.571, 0.001)
- then
- Report.Failed("Incorrect result from Function Arcsin with " &
- "various input parameters");
- end if;
-
-
- -- Testing of Function Arcsin with specified Cycle parameter.
-
---pwb-math -- Check that Argument_Error is raised by the Arcsin function with
---pwb-math -- specified cycle, whenever the absolute value of the parameter X
---pwb-math -- is greater than 1.0.
---pwb-math
---pwb-math begin
---pwb-math New_Float_Result := GEF.Arcsin(New_Float(FXA5A00.Large), 2.0*Pi);
---pwb-math Report.Failed("Argument_Error not raised by Function Arcsin " &
---pwb-math "with specified cycle, when provided a large " &
---pwb-math "positive input parameter");
---pwb-math Dont_Optimize_New_Float(New_Float_Result, 3);
---pwb-math exception
---pwb-math when Argument_Error => null; -- OK, expected exception.
---pwb-math when others =>
---pwb-math Report.Failed("Unexpected exception raised by Function Arcsin " &
---pwb-math "with specified cycle, when provided a large " &
---pwb-math "positive input parameter");
---pwb-math end;
---pwb-math
---pwb-math begin
---pwb-math The_Result := EF.Arcsin(FXA5A00.Minus_One_Minus_Delta, 2.0*Pi);
---pwb-math Report.Failed("Argument_Error not raised by Function Arcsin " &
---pwb-math "with specified cycle, when provided an input " &
---pwb-math "parameter less than -1.0");
---pwb-math Dont_Optimize_Float(The_Result, 4);
---pwb-math exception
---pwb-math when Argument_Error => null; -- OK, expected exception.
---pwb-math when others =>
---pwb-math Report.Failed("Unexpected exception raised by Function Arcsin " &
---pwb-math "with specified cycle, when provided an input " &
---pwb-math "parameter less than -1.0");
---pwb-math end;
---pwb-math
- -- Check that Argument_Error is raised by the Arcsin function with
- -- specified cycle, whenever the Cycle parameter is zero or negative.
-
- begin
- New_Float_Result := GEF.Arcsin(2.0, 0.0);
- Report.Failed("Argument_Error not raised by Function Arcsin " &
- "with specified cycle of 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arcsin " &
- "with specified cycle of 0.0");
- end;
-
- begin
- The_Result := EF.Arcsin(2.0, -2.0*Pi);
- Report.Failed("Argument_Error not raised by Function Arcsin " &
- "with specified negative cycle parameter");
- Dont_Optimize_Float(The_Result, 6);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Arcsin " &
- "with specified negative cycle parameter");
- end;
-
-
---pwb-math -- Check the prescribed result of function Arcsin with specified Cycle
---pwb-math -- parameter, when the value of parameter X is 0.0.
---pwb-math
---pwb-math if GEF.Arcsin(X => 0.0, Cycle => 2.0*Pi) /= 0.0 or
---pwb-math EF.Arcsin(0.0, 2.0*Pi) /= 0.0
---pwb-math then
---pwb-math Report.Failed("Incorrect result from Function Arcsin with " &
---pwb-math "specified Cycle parameter, when the value " &
---pwb-math "of parameter X is 0.0");
---pwb-math end if;
---pwb-math
---pwb-math
---pwb-math -- Test of the Arcsin function with specified Cycle parameter with
---pwb-math -- various input parameters.
---pwb-math
---pwb-math if not FXA5A00.Result_Within_Range(GEF.Arcsin( 0.01, 2.0*Pi),
---pwb-math 0.010,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range( EF.Arcsin( 0.14, 2.0*Pi),
---pwb-math 0.141,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range(GEF.Arcsin( 0.37, 2.0*Pi),
---pwb-math 0.379,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range( EF.Arcsin( 0.55, 2.0*Pi),
---pwb-math 0.582,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range(GEF.Arcsin(-0.22, 2.0*Pi),
---pwb-math -0.222,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range( EF.Arcsin(-0.99, 2.0*Pi),
---pwb-math -1.43,
---pwb-math 0.01) or
---pwb-math not FXA5A00.Result_Within_Range( EF.Arcsin(1.0, 360.0),
---pwb-math 90.0,
---pwb-math 0.1) or
---pwb-math not FXA5A00.Result_Within_Range( EF.Arcsin(1.0, 100.0),
---pwb-math 25.0,
---pwb-math 0.1)
---pwb-math then
---pwb-math Report.Failed("Incorrect result from Arcsin with specified " &
---pwb-math "cycle parameter with various input parameters");
---pwb-math end if;
-
- -- Testing of Arcsinh Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that no exception occurs on computing the Arcsinh with very
- -- large (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Arcsinh(New_Float(FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 7);
- exception
- when others =>
- Report.Failed("Unexpected exception on Arcsinh with large " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Arcsinh(FXA5A00.Minus_Large);
- Dont_Optimize_Float(The_Result, 8);
- exception
- when others =>
- Report.Failed("Unexpected exception on Arcsinh with large " &
- "negative value");
- end;
-
-
- -- Check that no exception occurs on computing the Arcsinh with very
- -- small (positive and negative) input values.
-
- begin
- New_Float_Result := GEF.Arcsinh(New_Float(FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 9);
- exception
- when others =>
- Report.Failed("Unexpected exception on Arcsinh with small " &
- "positive value");
- end;
-
- begin
- The_Result := EF.Arcsinh(-FXA5A00.Small);
- Dont_Optimize_Float(The_Result, 10);
- exception
- when others =>
- Report.Failed("Unexpected exception on Arcsinh with small " &
- "negative value");
- end;
-
-
- -- Check function Arcsinh for prescribed result with parameter 0.0.
-
- if GEF.Arcsinh(X => 0.0) /= 0.0 or
- EF.Arcsinh(X => 0.0) /= 0.0
- then
- Report.Failed("Incorrect result from Function Arcsinh when " &
- "provided a 0.0 input parameter");
- end if;
-
-
- -- Check the results of the Arcsinh function with various input
- -- parameters.
-
- if not Result_Within_Range(GEF.Arcsinh(0.15), 0.149, 0.001) or
- not Result_Within_Range( EF.Arcsinh(0.82), 0.748, 0.001) or
- not Result_Within_Range(GEF.Arcsinh(1.44), 1.161, 0.001) or
- not Result_Within_Range(GEF.Arcsinh(6.70), 2.601, 0.001) or
- not Result_Within_Range( EF.Arcsinh(Pi), 1.862, 0.001) or
- not Result_Within_Range( EF.Arcsinh(-Pi), -1.862, 0.001) or
- not Result_Within_Range(GEF.Arcsinh(-1.0), -0.881, 0.001) or
- not Result_Within_Range( EF.Arcsinh(-5.5), -2.406, 0.001)
- then
- Report.Failed("Incorrect result from Function Arcsin with " &
- "various input parameters");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5A05;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a06.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a06.a
deleted file mode 100644
index 191a96d7567..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a06.a
+++ /dev/null
@@ -1,334 +0,0 @@
--- CXA5A06.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions Arccos and Arccosh provide correct
--- results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Arccos and Arccosh
--- the instantiation of the Ada.Numerics.Generic_Elementary_Functions
--- with a type derived from type Float, as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A06.A
---
---
--- CHANGE HISTORY:
--- 27 Mar 95 SAIC Initial prerelease version.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 28 Feb 97 PWB.CTA Removed checks with explicit Cycle => 2.0*Pi
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A06 is
-begin
-
- Report.Test ("CXA5A06", "Check that the functions Arccos and Arccosh " &
- "provide correct results");
-
- Test_Block:
- declare
-
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- The_Result : Float;
- New_Float_Result : New_Float;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Arccos Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Argument_Error is raised by the Arccos function when the
- -- absolute value of the input parameter is greater than 1.0.
-
- begin
- New_Float_Result := GEF.Arccos(New_Float(FXA5A00.One_Plus_Delta));
- Report.Failed("Argument_Error not raised by the Arccos function " &
- "when the input parameter is greater than 1.0");
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccos " &
- "function when the input parameter is greater " &
- "than 1.0");
- end;
-
- begin
- The_Result := EF.Arccos(-FXA5A00.Large);
- Report.Failed("Argument_Error not raised by the Arccos function " &
- "when the input parameter is a large negative value");
- Dont_Optimize_Float(The_Result, 2);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccos " &
- "function when the input parameter is a " &
- "large negative value");
- end;
-
-
- -- Check the prescribed results of the Arccos function.
-
- if GEF.Arccos(X => 1.0) /= 0.0 or
- EF.Arccos(1.0) /= 0.0
- then
- Report.Failed("Incorrect result returned by the Arccos function " &
- "when provided a parameter value of 0.0");
- end if;
-
-
- -- Check the results of the Arccos function with various input
- -- parameters.
-
- if not Result_Within_Range(GEF.Arccos(0.77), 0.692, 0.001) or
- not Result_Within_Range( EF.Arccos(0.37), 1.19, 0.01) or
- not Result_Within_Range(GEF.Arccos(0.0), Pi/2.0, 0.01) or
- not Result_Within_Range( EF.Arccos(-0.11), 1.68, 0.01) or
- not Result_Within_Range(GEF.Arccos(-0.67), 2.31, 0.01) or
- not Result_Within_Range( EF.Arccos(-0.94), 2.79, 0.01) or
- not Result_Within_Range(GEF.Arccos(-1.0), Pi, 0.01)
- then
- Report.Failed("Incorrect result returned from the Arccos " &
- "function when provided a variety of input " &
- "parameters");
- end if;
-
-
- -- Testing of the Arccos function with specified Cycle parameter.
-
- -- Check that Argument_Error is raised by the Arccos function, with
- -- specified Cycle parameter, when the absolute value of the input
- -- parameter is greater than 1.0.
-
- begin
---pwb-math: Next line: Changed 2.0*Pi to 360.0
- New_Float_Result := GEF.Arccos(New_Float(Large), Cycle => 360.0);
- Report.Failed("Argument_Error not raised by the Arccos function " &
- "with specified Cycle parameter, when the input " &
- "parameter is a large positive value");
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccos " &
- "function with specified Cycle parameter, when " &
- "the input parameter is a large positive value");
- end;
-
- begin
---pwb-math: Next line: Changed 2.0*Pi to 360.0
- The_Result := EF.Arccos(FXA5A00.Minus_One_Minus_Delta, 360.0);
- Report.Failed("Argument_Error not raised by the Arccos function " &
- "with specified Cycle parameter, when the input " &
- "parameter is less than -1.0");
- Dont_Optimize_Float(The_Result, 4);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccos " &
- "function with specified Cycle parameter, " &
- "when the input parameter is less than -1.0");
- end;
-
-
- -- Check that Argument_Error is raised by the Arccos function with
- -- specified cycle when the value of the Cycle parameter is zero or
- -- negative.
-
- begin
- New_Float_Result := GEF.Arccos(X => 1.0, Cycle => 0.0 );
- Report.Failed("Argument_Error not raised by the Arccos function " &
- "with specified Cycle parameter, when the Cycle " &
- "parameter is 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccos " &
- "function with specified Cycle parameter, when " &
- "the Cycle parameter is 0.0");
- end;
-
- begin
- The_Result := EF.Arccos(1.0, Cycle => -2.0*Pi);
- Report.Failed("Argument_Error not raised by the Arccos function " &
- "with specified Cycle parameter, when the Cycle " &
- "parameter is negative");
- Dont_Optimize_Float(The_Result, 6);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccos " &
- "function with specified Cycle parameter, when " &
- "the Cycle parameter is negative");
- end;
-
-
- -- Check the prescribed result of the Arccos function with specified
- -- Cycle parameter.
-
---pwb-math: Next two lines: Changed 2.0*Pi to 360.0
- if GEF.Arccos(X => 1.0, Cycle => 360.0) /= 0.0 or
- EF.Arccos(1.0, 360.0) /= 0.0
- then
- Report.Failed("Incorrect result from the Arccos function with " &
- "specified Cycle parameter, when the input " &
- "parameter value is 1.0");
- end if;
-
-
- -- Check the results of the Arccos function, with specified Cycle
- -- parameter, with various input parameters.
-
- if --pwb-math not Result_Within_Range(GEF.Arccos( 0.04, 2.0*Pi), 1.53, 0.01) or
---pwb-math not Result_Within_Range( EF.Arccos( 0.14, 2.0*Pi), 1.43, 0.01) or
---pwb-math not Result_Within_Range(GEF.Arccos( 0.57, 2.0*Pi), 0.96, 0.01) or
---pwb-math not Result_Within_Range( EF.Arccos( 0.99, 2.0*Pi), 0.14, 0.01) or
- not Result_Within_Range(GEF.Arccos(-1.0, 360.0), 180.0, 0.1) or
- not Result_Within_Range(GEF.Arccos(-1.0, 100.0), 50.0, 0.1) or
- not Result_Within_Range(GEF.Arccos( 0.0, 360.0), 90.0, 0.1) or
- not Result_Within_Range(GEF.Arccos( 0.0, 100.0), 25.0, 0.1)
- then
- Report.Failed("Incorrect result returned from the Arccos " &
- "function with specified Cycle parameter, " &
- "when provided a variety of input parameters");
- end if;
-
-
-
- -- Testing of Arccosh Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Argument_Error is raised by the Arccosh function when
- -- the value of the parameter X is less than 1.0.
-
- begin
- New_Float_Result := GEF.Arccosh(New_Float(FXA5A00.One_Minus_Delta));
- Report.Failed("Argument_Error not raised by the Arccosh function " &
- "when the parameter value is less than 1.0");
- Dont_Optimize_New_Float(New_Float_Result, 7);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccosh " &
- "function when given a parameter value less " &
- "than 1.0");
- end;
-
- begin
- The_Result := EF.Arccosh(0.0);
- Report.Failed("Argument_Error not raised by the Arccosh function " &
- "when the parameter value is 0.0");
- Dont_Optimize_Float(The_Result, 8);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccosh " &
- "function when given a parameter value of 0.0");
- end;
-
- begin
- New_Float_Result := GEF.Arccosh(New_Float(-FXA5A00.Large));
- Report.Failed("Argument_Error not raised by the Arccosh function " &
- "when the large negative parameter value");
- Dont_Optimize_New_Float(New_Float_Result, 9);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Arccosh " &
- "function when given a large negative parameter " &
- "value");
- end;
-
-
- -- Check the prescribed results of the Arccosh function.
-
- if GEF.Arccosh(X => 1.0) /= 0.0 or
- EF.Arccosh(1.0) /= 0.0
- then
- Report.Failed("Incorrect result returned by the Arccosh " &
- "function when provided a parameter value of 0.0");
- end if;
-
-
- -- Check the results of the Arccosh function with various input
- -- parameters.
-
- if not Result_Within_Range(GEF.Arccosh(1.03), 0.244, 0.001) or
- not Result_Within_Range( EF.Arccosh(1.28), 0.732, 0.001) or
- not Result_Within_Range(GEF.Arccosh(1.50), 0.962, 0.001) or
- not Result_Within_Range( EF.Arccosh(1.77), 1.17, 0.01) or
- not Result_Within_Range(GEF.Arccosh(2.00), 1.32, 0.01) or
- not Result_Within_Range( EF.Arccosh(4.30), 2.14, 0.01) or
- not Result_Within_Range(GEF.Arccosh(6.90), 2.62, 0.01)
- then
- Report.Failed("Incorrect result returned from the Arccosh " &
- "function when provided a variety of input " &
- "parameters");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5A06;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a07.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a07.a
deleted file mode 100644
index 179d54c44bf..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a07.a
+++ /dev/null
@@ -1,413 +0,0 @@
--- CXA5A07.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the function Arctan provides correct results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Arctan resulting from the
--- instantiation of the Ada.Numerics.Generic_Elementary_Functions with
--- a type derived from type Float, as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A07.A
---
---
--- CHANGE HISTORY:
--- 04 Apr 95 SAIC Initial prerelease version.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 28 Feb 97 PWB.CTA Removed checks with explicit Cycle => 2.0*Pi
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A07 is
-begin
-
- Report.Test ("CXA5A07", "Check that the Arctan function provides " &
- "correct results");
-
- Test_Block:
- declare
-
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- Float_Result : Float;
- New_Float_Result : New_Float;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Arctan Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Argument_Error is raised by the Arctan function when
- -- provided parameter values of 0.0, 0.0.
-
- begin
- New_Float_Result := GEF.Arctan(Y => 0.0, X => 0.0);
- Report.Failed("Argument_Error not raised when the Arctan " &
- "function is provided input of 0.0, 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arctan " &
- "function when provided 0.0, 0.0 input parameters");
- end;
-
-
- -- Check that no exception is raised by the Arctan function when
- -- provided a large positive or negative Y parameter value, when
- -- using the default value for parameter X.
-
- begin
- Float_Result := EF.Arctan(Y => FXA5A00.Large);
- Dont_Optimize_Float(Float_Result, 2);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided a large positive Y parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arctan(Y => New_Float(-FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided a large negative Y parameter value");
- end;
-
-
- -- Check that no exception is raised by the Arctan function when
- -- provided a small positive or negative Y parameter value, when
- -- using the default value for parameter X.
-
- begin
- Float_Result := EF.Arctan(Y => FXA5A00.Small);
- Dont_Optimize_Float(Float_Result, 4);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided a small positive Y parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arctan(Y => New_Float(-FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided a small negative Y parameter value");
- end;
-
-
- -- Check that no exception is raised by the Arctan function when
- -- provided combinations of large and small positive or negative
- -- parameter values for both Y and X input parameters.
-
- begin
- Float_Result := EF.Arctan(Y => FXA5A00.Large, X => FXA5A00.Large);
- Dont_Optimize_Float(Float_Result, 6);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided large positive X and Y parameter values");
- end;
-
- begin
- New_Float_Result := GEF.Arctan(New_Float(-FXA5A00.Large),
- X => New_Float(FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 7);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided a large negative Y parameter value " &
- "and a small positive X parameter value");
- end;
-
-
- begin
- Float_Result := EF.Arctan(Y => FXA5A00.Small, X => FXA5A00.Large);
- Dont_Optimize_Float(Float_Result, 8);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided a small positive Y parameter value " &
- "and a large positive X parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arctan(New_Float(-FXA5A00.Small),
- New_Float(-FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 9);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function is " &
- "provided a small negative Y parameter value " &
- "and a large negative parameter value");
- end;
-
-
- -- Check that when the Arctan function is provided a Y parameter value
- -- of 0.0 and a positive X parameter input value, the prescribed result
- -- of zero is returned.
-
- if GEF.Arctan(Y => 0.0) /= 0.0 or -- Default X value
- EF.Arctan(Y => 0.0, X => FXA5A00.Large) /= 0.0 or
---pwb-math: Next line: changed 2.0*Pi to 360.0
- GEF.Arctan(0.0, 360.0) /= 0.0 or
- EF.Arctan(0.0, FXA5A00.Small) /= 0.0
- then
- Report.Failed("Incorrect results from the Arctan function when " &
- "provided a Y parameter value of 0.0 and various " &
- "positive X parameter values");
- end if;
-
-
- -- Check that the Arctan function provides correct results when provided
- -- a variety of Y parameter values.
-
- if not FXA5A00.Result_Within_Range(EF.Arctan(Pi), 1.26, 0.01) or
- not FXA5A00.Result_Within_Range(EF.Arctan(-Pi), -1.26, 0.01) or
- not FXA5A00.Result_Within_Range(GEF.Arctan(1.0), 0.785, 0.001) or
- not FXA5A00.Result_Within_Range(EF.Arctan(-1.0), -0.785, 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Arctan(0.25), 0.245, 0.001) or
- not FXA5A00.Result_Within_Range(EF.Arctan(0.92), 0.744, 0.001)
- then
- Report.Failed("Incorrect results from the Arctan function when " &
- "provided a variety of Y parameter values");
- end if;
-
-
-
- -- Check the results of the Arctan function with specified cycle
- -- parameter.
-
- -- Check that the Arctan function with specified Cycle parameter
- -- raises Argument_Error when the value of the Cycle parameter is zero
- -- or negative.
-
- begin
- Float_Result := EF.Arctan(Y => Pi, Cycle => 0.0); -- Default X value
- Report.Failed("Argument_Error not raised by the Arctan function " &
- "with default X parameter value, when the Cycle " &
- "parameter is 0.0");
- Dont_Optimize_Float(Float_Result, 10);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arctan " &
- "function with default X parameter value, when " &
- "provided a 0.0 cycle parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arctan(Y => Pi, X => 1.0, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by the Arctan function " &
- "when the Cycle parameter is 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 11);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arctan " &
- "function when provided a 0.0 cycle parameter " &
- "value");
- end;
-
- begin
- Float_Result := EF.Arctan(Y => Pi, Cycle => -360.0);
- Report.Failed("Argument_Error not raised by the Arctan function " &
- "with a default X parameter value, when the Cycle " &
- "parameter is -360.0");
- Dont_Optimize_Float(Float_Result, 12);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arctan " &
- "function with a default X parameter value, when " &
- "provided a -360.0 cycle parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arctan(Y => Pi, X => 1.0, Cycle => -Pi);
- Report.Failed("Argument_Error not raised by the Arctan function " &
- "when the Cycle parameter is -Pi");
- Dont_Optimize_New_Float(New_Float_Result, 13);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arctan " &
- "function when provided a -Pi cycle parameter " &
- "value");
- end;
-
-
- -- Check that no exception is raised by the Arctan function with
- -- specified Cycle parameter, when provided large and small positive
- -- or negative parameter values for both Y and X input parameters.
-
- begin
- Float_Result := EF.Arctan(Y => -FXA5A00.Large,
- X => -FXA5A00.Large,
---pwb-math: Next line: changed 2.0*Pi to 360.0
- Cycle => 360.0);
- Dont_Optimize_Float(Float_Result, 14);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function with " &
- "specified Cycle parameter, when provided large " &
- "negative X and Y parameter values");
- end;
-
-
- begin
- New_Float_Result := GEF.Arctan(New_Float(FXA5A00.Large),
- X => New_Float(-FXA5A00.Small),
---pwb-math: Next line: changed 2.0*Pi to 360.0
- Cycle => 360.0);
- Dont_Optimize_New_Float(New_Float_Result, 15);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function with " &
- "specified Cycle parameter, when provided large " &
- "positive Y parameter value and a small negative " &
- "X parameter value");
- end;
-
-
- begin
- Float_Result := EF.Arctan(Y => -FXA5A00.Small,
- X => -FXA5A00.Large,
---pwb-math: Next line: changed 2.0*Pi to 360.0
- Cycle => 360.0);
- Dont_Optimize_Float(Float_Result, 16);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function with " &
- "specified Cycle parameter, when provided large " &
- "negative Y parameter value and a large negative " &
- "X parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arctan(New_Float(FXA5A00.Small),
- New_Float(FXA5A00.Large),
---pwb-math: Next line: changed 2.0*Pi to 360.0
- 360.0);
- Dont_Optimize_New_Float(New_Float_Result, 17);
- exception
- when others =>
- Report.Failed("Exception raised when the Arctan function with " &
- "specified Cycle parameter, when provided a " &
- "small negative Y parameter value and a large " &
- "positive X parameter value");
- end;
-
-
- -- Check that the Arctan function with specified Cycle parameter
- -- provides correct results when provided a variety of Y parameter
- -- input values.
-
---pwb-math if not FXA5A00.Result_Within_Range(EF.Arctan(Pi, Cycle => 2.0*Pi),
---pwb-math 1.26,
---pwb-math 0.01) or
---pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(-Pi, Cycle => 2.0*Pi),
---pwb-math -1.26,
---pwb-math 0.01) or
---pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 2.0*Pi),
---pwb-math 0.785,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(-1.0, Cycle => 2.0*Pi),
---pwb-math -0.785,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(0.16, Cycle => 2.0*Pi),
---pwb-math 0.159,
---pwb-math 0.001) or
---pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(1.0, Cycle => 360.0),
---pwb-math 45.0,
---pwb-math 0.1) or
---pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 100.0),
---pwb-math 12.5,
---pwb-math 0.1)
-
---pwb-math Next 12 lines are replacements for 21 commented lines above
- if not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 2.0*180.0),
- 45.0,
- 0.001) or
- not FXA5A00.Result_Within_Range(EF.Arctan(-1.0, Cycle => 2.0*180.0),
- -45.0,
- 0.001) or
- not FXA5A00.Result_Within_Range(EF.Arctan(1.0, Cycle => 360.0),
- 45.0,
- 0.1) or
- not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 100.0),
- 12.5,
- 0.1)
- then
- Report.Failed("Incorrect results from the Arctan function with " &
- "specified Cycle parameter when provided a variety " &
- "of Y parameter values");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5A07;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a08.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a08.a
deleted file mode 100644
index ae2b85a6d43..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a08.a
+++ /dev/null
@@ -1,474 +0,0 @@
--- CXA5A08.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the function Arccot provides correct results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Arccot resulting from the
--- instantiation of the Ada.Numerics.Generic_Elementary_Functions
--- with a type derived from type Float, as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A08.A
---
---
--- CHANGE HISTORY:
--- 06 Apr 95 SAIC Initial prerelease version.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 18 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 28 Feb 97 CTA.PWB Removed checks with explicit Cycle => 2.0*Pi
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
-with Ada.Exceptions;
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A08 is
-begin
-
- Report.Test ("CXA5A08", "Check that the Arccot function provides " &
- "correct results");
-
- Test_Block:
- declare
-
- use Ada.Exceptions;
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- Float_Result : Float;
- Angle : Float;
- New_Float_Result : New_Float;
- New_Float_Angle : New_Float;
- Incorrect_Inverse : Boolean := False;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Arccot Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Argument_Error is raised by the Arccot function when
- -- provided parameter values of 0.0, 0.0.
-
- begin
- New_Float_Result := GEF.Arccot(X => 0.0, Y => 0.0);
- Report.Failed("Argument_Error not raised when the Arccot " &
- "function is provided input of 0.0, 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arccot " &
- "function when provided 0.0, 0.0 input parameters");
- end;
-
-
- -- Check that no exception is raised by the Arccot function when
- -- provided a large positive or negative X parameter value, when
- -- using the default value for parameter Y.
-
- begin
- Float_Result := EF.Arccot(X => FXA5A00.Large);
- Dont_Optimize_Float(Float_Result, 2);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided a large positive X parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arccot(X => New_Float(-FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided a large negative X parameter value");
- end;
-
-
- -- Check that no exception is raised by the Arccot function when
- -- provided a small positive or negative X parameter value, when
- -- using the default value for parameter Y.
-
- begin
- Float_Result := EF.Arccot(X => FXA5A00.Small);
- Dont_Optimize_Float(Float_Result, 4);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided a small positive X parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arccot(X => New_Float(-FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided a small negative X parameter value");
- end;
-
-
- -- Check that no exception is raised by the Arccot function when
- -- provided combinations of large and small positive or negative
- -- parameter values for both X and Y input parameters.
-
- begin
- Float_Result := EF.Arccot(X => FXA5A00.Large, Y => FXA5A00.Large);
- Dont_Optimize_Float(Float_Result, 6);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided large positive X and Y parameter values");
- end;
-
- begin
- New_Float_Result := GEF.Arccot(New_Float(-FXA5A00.Large),
- Y => New_Float(FXA5A00.Small));
- Dont_Optimize_New_Float(New_Float_Result, 7);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided a large negative X parameter value " &
- "and a small positive Y parameter value");
- end;
-
-
- begin
- Float_Result := EF.Arccot(X => FXA5A00.Small, Y => FXA5A00.Large);
- Dont_Optimize_Float(Float_Result, 8);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided a small positive X parameter value " &
- "and a large positive Y parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arccot(New_Float(-FXA5A00.Small),
- New_Float(-FXA5A00.Large));
- Dont_Optimize_New_Float(New_Float_Result, 9);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function is " &
- "provided a small negative X parameter value " &
- "and a large negative Y parameter value");
- end;
-
-
- -- Check that when the Arccot function is provided a Y parameter value
- -- of 0.0 and a positive X parameter input value, the prescribed result
- -- of zero is returned.
-
- if EF.Arccot(X => FXA5A00.Large, Y => 0.0) /= 0.0 or
- GEF.Arccot(2.0*Pi, Y => 0.0) /= 0.0 or
- EF.Arccot(FXA5A00.Small, 0.0) /= 0.0 or
- EF.Arccot(X => FXA5A00.Large, Y => 0.0, Cycle => 360.0) /= 0.0 or
- GEF.Arccot(2.0*Pi, Y => 0.0, Cycle => 360.0) /= 0.0 or
- EF.Arccot(FXA5A00.Small, 0.0, Cycle => 360.0) /= 0.0
- then
- Report.Failed("Incorrect results from the Arccot function when " &
- "provided a Y parameter value of 0.0 and various " &
- "positive X parameter values");
- end if;
-
-
- -- Check that the Arccot function provides correct results when
- -- provided a variety of X parameter values.
-
- if not Result_Within_Range( EF.Arccot( 1.0), Pi/4.0, 0.001) or
- not Result_Within_Range(GEF.Arccot( 0.0), Pi/2.0, 0.001) or
- not Result_Within_Range( EF.Arccot(-1.0), 3.0*Pi/4.0, 0.001)
- then
- Report.Failed("Incorrect results from the Arccot function when " &
- "provided a variety of Y parameter values");
- end if;
-
-
- -- Check the results of the Arccot function with specified cycle
- -- parameter.
-
- -- Check that the Arccot function with specified Cycle parameter
- -- raises Argument_Error when the value of the Cycle parameter is zero
- -- or negative.
-
- begin
- Float_Result := EF.Arccot(X => Pi, Cycle => 0.0); -- Default Y value
- Report.Failed("Argument_Error not raised by the Arccot function " &
- "with default Y parameter value, when the Cycle " &
- "parameter is 0.0");
- Dont_Optimize_Float(Float_Result, 10);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arccot " &
- "function with default Y parameter value, when " &
- "provided a 0.0 cycle parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arccot(X => Pi, Y => 1.0, Cycle => 0.0);
- Report.Failed("Argument_Error not raised by the Arccot function " &
- "when the Cycle parameter is 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 11);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arccot " &
- "function when provided a 0.0 cycle parameter " &
- "value");
- end;
-
- begin
- Float_Result := EF.Arccot(X => Pi, Cycle => -360.0);
- Report.Failed("Argument_Error not raised by the Arccot function " &
- "with a default Y parameter value, when the Cycle " &
- "parameter is -360.0");
- Dont_Optimize_Float(Float_Result, 12);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arccot " &
- "function with a default Y parameter value, when " &
- "provided a -360.0 cycle parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arccot(X => Pi, Y => 1.0, Cycle => -Pi);
- Report.Failed("Argument_Error not raised by the Arccot function " &
- "when the Cycle parameter is -Pi");
- Dont_Optimize_New_Float(New_Float_Result, 13);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by the Arccot " &
- "function when provided a -Pi cycle parameter " &
- "value");
- end;
-
-
- -- Check that no exception is raised by the Arccot function with
- -- specified Cycle parameter, when provided large and small positive
- -- or negative parameter values for both X and Y input parameters.
-
- begin
- Float_Result := EF.Arccot(X => -FXA5A00.Large,
- Y => -FXA5A00.Large,
---pwb-math Next line: changed 2.0*Pi to 360.0
- Cycle => 360.0);
- Dont_Optimize_Float(Float_Result, 14);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function with " &
- "specified Cycle parameter, when provided large " &
- "negative X and Y parameter values");
- end;
-
-
- begin
- New_Float_Result := GEF.Arccot(New_Float(FXA5A00.Large),
- Y => New_Float(-FXA5A00.Small),
---pwb-math Next line: changed 2.0*Pi to 360.0
- Cycle => 360.0);
- Dont_Optimize_New_Float(New_Float_Result, 15);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function with " &
- "specified Cycle parameter, when provided large " &
- "positive X parameter value and a small negative " &
- "Y parameter value");
- end;
-
-
- begin
- Float_Result := EF.Arccot(X => -FXA5A00.Small,
- Y => -FXA5A00.Large,
---pwb-math Next line: changed 2.0*Pi to 360.0
- Cycle => 360.0);
- Dont_Optimize_Float(Float_Result, 16);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function with " &
- "specified Cycle parameter, when provided small " &
- "negative X parameter value and a large negative " &
- "Y parameter value");
- end;
-
- begin
- New_Float_Result := GEF.Arccot(New_Float(FXA5A00.Small),
- New_Float(FXA5A00.Large),
---pwb-math Next line: changed 2.0*Pi to 360.0
- 360.0);
- Dont_Optimize_New_Float(New_Float_Result, 17);
- exception
- when others =>
- Report.Failed("Exception raised when the Arccot function with " &
- "specified Cycle parameter, when provided a " &
- "small positive X parameter value and a large " &
- "positive Y parameter value");
- end;
-
-
- -- Check that the Arccot function with specified Cycle parameter
- -- provides correct results when provided a variety of X parameter
- -- input values.
-
- if not FXA5A00.Result_Within_Range(GEF.Arccot( 0.0, Cycle => 360.0),
- 90.0,
- 0.001) or
- not FXA5A00.Result_Within_Range(EF.Arccot( 0.0, Cycle => 100.0),
- 25.0,
- 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Arccot( 1.0, Cycle => 360.0),
- 45.0,
- 0.001) or
- not FXA5A00.Result_Within_Range(EF.Arccot( 1.0, Cycle => 100.0),
- 12.5,
- 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Arccot(-1.0, Cycle => 360.0),
- 135.0,
- 0.001) or
- not FXA5A00.Result_Within_Range(EF.Arccot(-1.0, Cycle => 100.0),
- 37.5,
- 0.001)
- then
- Report.Failed("Incorrect results from the Arccot function with " &
- "specified Cycle parameter when provided a variety " &
- "of X parameter values");
- end if;
-
-
- if not FXA5A00.Result_Within_Range(EF.Arccot(0.2425355, 0.9701420),
- EF.Arccot(0.25),
- 0.01) or
- not FXA5A00.Result_Within_Range(EF.Arccot(0.3162277, 0.9486831),
- Ef.Arccot(0.33),
- 0.01)
- then
- Report.Failed("Incorrect results from the Arccot function with " &
- "comparison to other Arccot function results");
- end if;
-
-
- if not FXA5A00.Result_Within_Range(EF.Cot(EF.Arccot(0.4472135,
- 0.8944270)),
- 0.5,
- 0.01) or
- not FXA5A00.Result_Within_Range(EF.Cot(EF.Arccot(0.9987380,
- 0.0499369)),
- 20.0,
- 0.1)
- then
- Report.Failed("Incorrect results from the Arccot function when " &
- "used as argument to Cot function");
- end if;
-
-
- -- Check that inverse function results are correct.
- -- Default Cycle test.
-
- Angle := 0.001;
- while Angle < Pi and not Incorrect_Inverse loop
- if not Result_Within_Range(EF.Arccot(EF.Cot(Angle)), Angle, 0.001)
- then
- Incorrect_Inverse := True;
- end if;
- Angle := Angle + 0.001;
- end loop;
-
- if Incorrect_Inverse then
- Report.Failed("Incorrect results returned from the Inverse " &
- "comparison of Cot and Arccot using the default " &
- "cycle value");
- Incorrect_Inverse := False;
- end if;
-
- -- Non-Default Cycle test.
-
- New_Float_Angle := 0.01;
- while New_Float_Angle < 180.0 and not Incorrect_Inverse loop
- if not Result_Within_Range(EF.Arccot(EF.Cot(Float(New_Float_Angle),
- Cycle => 360.0),
- Cycle => 360.0),
- Float(New_Float_Angle),
- 0.01) or
- not Result_Within_Range(GEF.Arccot(
- New_Float(GEF.Cot(New_Float_Angle,
- Cycle => 360.0)),
- Cycle => 360.0),
- Float(New_Float_Angle),
- 0.01)
- then
- Incorrect_Inverse := True;
- end if;
- New_Float_Angle := New_Float_Angle + 0.01;
- end loop;
-
- if Incorrect_Inverse then
- Report.Failed("Incorrect results returned from the Inverse " &
- "comparison of Cot and Arccot using non-default " &
- "cycle value");
- end if;
-
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXA5A08;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a09.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a09.a
deleted file mode 100644
index 22bd2f8909c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a09.a
+++ /dev/null
@@ -1,400 +0,0 @@
--- CXA5A09.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the function Log provides correct results.
---
--- TEST DESCRIPTION:
--- This test examines both the version of Log resulting from the
--- instantiation of the Ada.Numerics.Generic_Elementary_Functions with
--- with a type derived from type Float,as well as the preinstantiated
--- version of this package for type Float.
--- Prescribed results, including instances prescribed to raise
--- exceptions, are examined in the test cases. In addition,
--- certain evaluations are performed where the actual function result
--- is compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A09.A
---
---
--- CHANGE HISTORY:
--- 11 Apr 95 SAIC Initial prerelease version.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 29 Jun 98 EDS Protected exception tests by first testing
--- for 'Machine_Overflows
---
---!
-
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A09 is
-begin
-
- Report.Test ("CXA5A09", "Check that the Log function provides " &
- "correct results");
-
- Test_Block:
- declare
-
- use Ada.Numerics;
- use FXA5A00;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- Arg,
- Float_Result : Float := 0.0;
- New_Float_Result : New_Float := 0.0;
-
- Incorrect_Inverse,
- Incorrect_Inverse_Base_2,
- Incorrect_Inverse_Base_8,
- Incorrect_Inverse_Base_10,
- Incorrect_Inverse_Base_16 : Boolean := False;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of Log Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Argument_Error is raised when the parameter X is negative.
-
- begin
- New_Float_Result := GEF.Log(X => -1.0);
- Report.Failed("Argument_Error not raised by the Log function " &
- "when the input parameter is negative");
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function " &
- "when the input parameter is negative");
- end;
-
- begin
- Float_Result := EF.Log(X => -FXA5A00.Large);
- Report.Failed("Argument_Error not raised by the Log function " &
- "when the input parameter is negative");
- Dont_Optimize_Float(Float_Result, 2);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function " &
- "when the input parameter is negative");
- end;
-
-
- -- Check that Constraint_Error is raised when the Log function is
- -- provided an input parameter of zero.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Log(X => 0.0);
- Report.Failed("Constraint_Error not raised by the Log function " &
- "when the input parameter is zero");
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function "
- & "when the input parameter is zero");
- end;
- end if;
-
-
- -- Check for the reference manual prescribed results of the Log function.
-
- if GEF.Log(X => 1.0) /= 0.0 or
- EF.Log(X => 1.0) /= 0.0
- then
- Report.Failed("Incorrect result from Function Log when provided " &
- "an input parameter value of 1.0");
- end if;
-
-
- -- Check that the Log function provides correct results when provided
- -- a variety of input parameters.
-
- if not FXA5A00.Result_Within_Range(GEF.Log(0.015), -4.20, 0.01) or
- not FXA5A00.Result_Within_Range(GEF.Log(0.592), -0.524, 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Log(0.997), -0.003, 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Log(1.341), 0.293, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Log(2.826), 1.04, 0.01) or
- not FXA5A00.Result_Within_Range( EF.Log(10.052), 2.31, 0.01) or
- not FXA5A00.Result_Within_Range( EF.Log(2569.143), 7.85, 0.01)
- then
- Report.Failed("Incorrect results from Function Log when provided " &
- "a variety of input parameter values");
- end if;
-
- Arg := 0.001;
- while Arg < 1.0 and not Incorrect_Inverse loop
- if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.001) then
- Incorrect_Inverse := True;
- end if;
- Arg := Arg + 0.001;
- end loop;
-
- if Incorrect_Inverse then
- Report.Failed("Incorrect inverse result comparing ""**"" and " &
- "Log function over argument range 0.001..1.0");
- Incorrect_Inverse := False;
- end if;
-
- Arg := 1.0;
- while Arg < 10.0 and not Incorrect_Inverse loop
- if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.01) then
- Incorrect_Inverse := True;
- end if;
- Arg := Arg + 0.01;
- end loop;
-
- if Incorrect_Inverse then
- Report.Failed("Incorrect inverse result comparing ""**"" and " &
- "Log function over argument range 1.0..10.0");
- Incorrect_Inverse := False;
- end if;
-
- Arg := 1.0;
- while Arg < 1000.0 and not Incorrect_Inverse loop
- if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.1) then
- Incorrect_Inverse := True;
- end if;
- Arg := Arg + 1.0;
- end loop;
-
- if Incorrect_Inverse then
- Report.Failed("Incorrect inverse result comparing ""**"" and " &
- "Log function over argument range 1.0..1000.0");
- end if;
-
-
- -- Testing of Log Function, with specified Base parameter, both
- -- instantiated and pre-instantiated versions.
-
- -- Check that Argument_Error is raised by the Log function with
- -- specified Base parameter, when the X parameter value is negative.
-
- begin
- New_Float_Result := GEF.Log(X => -1.0, Base => 16.0);
- Report.Failed("Argument_Error not raised by the Log function " &
- "with Base parameter, when the input parameter " &
- "value is -1.0");
- Dont_Optimize_New_Float(New_Float_Result, 4);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function " &
- "with Base parameter, when the X parameter value " &
- "is -1.0");
- end;
-
- begin
- Float_Result := EF.Log(X => -FXA5A00.Large, Base => 8.0);
- Report.Failed("Argument_Error not raised by the Log function " &
- "with Base parameter, when the X parameter " &
- "value is a large negative value");
- Dont_Optimize_Float(Float_Result, 5);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function " &
- "with Base parameter, when the X parameter " &
- "value is a large negative value");
- end;
-
-
- -- Check that Argument_Error is raised by the Log function when
- -- the specified Base parameter is zero.
-
- begin
- New_Float_Result := GEF.Log(X => 10.0, Base => 0.0);
- Report.Failed("Argument_Error not raised by the Log function " &
- "with Base parameter of 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 6);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function " &
- "with Base parameter of 0.0");
- end;
-
-
- -- Check that Argument_Error is raised by the Log function when
- -- the specified Base parameter is one.
-
- begin
- Float_Result := EF.Log(X => 12.3, Base => 1.0);
- Report.Failed("Argument_Error not raised by the Log function " &
- "with Base parameter of 1.0");
- Dont_Optimize_Float(Float_Result, 7);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function " &
- "with Base parameter of 1.0");
- end;
-
-
- -- Check that Argument_Error is raised by the Log function when
- -- the specified Base parameter is negative.
-
- begin
- New_Float_Result := GEF.Log(X => 12.3, Base => -10.0);
- Report.Failed("Argument_Error not raised by the Log function " &
- "with negative Base parameter");
- Dont_Optimize_New_Float(New_Float_Result, 8);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the Log function " &
- "with negative Base parameter");
- end;
-
-
- -- Check that Constraint_Error is raised by the Log function when the
- -- input X parameter value is 0.0.
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF.Log(X => 0.0, Base => 16.0);
- Report.Failed("Constraint_Error not raised by the Log function " &
- "with specified Base parameter, when the value of " &
- "the parameter X is 0.0");
- Dont_Optimize_New_Float(New_Float_Result, 9);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Log" &
- "with specified Base parameter, when the value " &
- "of the parameter X is 0.0");
- end;
- end if;
-
- -- Check for the prescribed results of the Log function with specified
- -- Base parameter.
-
- if GEF.Log(X => 1.0, Base => 16.0) /= 0.0 or
- EF.Log(X => 1.0, Base => 10.0) /= 0.0 or
- GEF.Log(1.0, Base => 8.0) /= 0.0 or
- EF.Log(1.0, 2.0) /= 0.0
- then
- Report.Failed("Incorrect result from Function Log with specified " &
- "Base parameter when provided an parameter X input " &
- "value of 1.0");
- end if;
-
-
- -- Check that the Log function with specified Base parameter provides
- -- correct results when provided a variety of input parameters.
-
- if not Result_Within_Range(GEF.Log( 10.0, e), 2.30, 0.01) or
- not Result_Within_Range( EF.Log( 8.0, 2.0), 3.0, 0.01) or
- not Result_Within_Range(GEF.Log(256.0, 2.0), 8.0, 0.01) or
- not Result_Within_Range( EF.Log(512.0, 8.0), 3.0, 0.01) or
- not Result_Within_Range(GEF.Log(0.5649, e), -0.57, 0.01) or
- not Result_Within_Range( EF.Log(1.7714, e), 0.57, 0.01) or
- not Result_Within_Range(GEF.Log(0.5718, 10.0), -0.243, 0.001) or
- not Result_Within_Range( EF.Log(466.25, 10.0), 2.67, 0.01)
- then
- Report.Failed("Incorrect results from Function Log with specified " &
- "Base parameter, when provided a variety of input " &
- "parameter values");
- end if;
-
-
- Arg := 1.0;
- while Arg < 1000.0 and
- not (Incorrect_Inverse_Base_2 and Incorrect_Inverse_Base_8 and
- Incorrect_Inverse_Base_10 and Incorrect_Inverse_Base_16)
- loop
- if not FXA5A00.Result_Within_Range(EF."**"(2.0,EF.Log(Arg,2.0)),
- Arg,
- 0.001)
- then
- Incorrect_Inverse_Base_2 := True;
- end if;
- if not FXA5A00.Result_Within_Range(EF."**"(8.0,EF.Log(Arg,8.0)),
- Arg,
- 0.001)
- then
- Incorrect_Inverse_Base_8 := True;
- end if;
- if not FXA5A00.Result_Within_Range(EF."**"(10.0,EF.Log(Arg,10.0)),
- Arg,
- 0.001)
- then
- Incorrect_Inverse_Base_10 := True;
- end if;
- if not FXA5A00.Result_Within_Range(EF."**"(16.0,EF.Log(Arg,16.0)),
- Arg,
- 0.001)
- then
- Incorrect_Inverse_Base_16 := True;
- end if;
- Arg := Arg + 1.0;
- end loop;
-
- if Incorrect_Inverse_Base_2 then
- Report.Failed("Incorrect inverse result comparing ""**"" and " &
- "Log function for Base 2");
- end if;
-
- if Incorrect_Inverse_Base_8 then
- Report.Failed("Incorrect inverse result comparing ""**"" and " &
- "Log function for Base 8");
- end if;
-
- if Incorrect_Inverse_Base_10 then
- Report.Failed("Incorrect inverse result comparing ""**"" and " &
- "Log function for Base 10");
- end if;
-
- if Incorrect_Inverse_Base_16 then
- Report.Failed("Incorrect inverse result comparing ""**"" and " &
- "Log function for Base 16");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXA5A09;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa5a10.a b/gcc/testsuite/ada/acats/tests/cxa/cxa5a10.a
deleted file mode 100644
index 4804d6729fc..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa5a10.a
+++ /dev/null
@@ -1,551 +0,0 @@
--- CXA5A10.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functions Exp and Sqrt, and the exponentiation
--- operator "**" provide correct results.
---
--- TEST DESCRIPTION:
--- This test examines both the versions of Exp, Sqrt, and "**"
--- resulting from the instantiation of the
--- Ada.Numerics.Generic_Elementary_Functions with a type derived from
--- type Float, as well as the preinstantiated version of this package
--- for type Float.
--- Prescribed results (stated as such in the reference manual),
--- including instances prescribed to raise exceptions, are examined
--- in the test cases. In addition, certain evaluations are performed
--- for the preinstantiated package where the actual function result is
--- compared with the expected result (within an epsilon range of
--- accuracy).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXA5A00.A (foundation code)
--- CXA5A10.A
---
---
--- CHANGE HISTORY:
--- 17 Apr 95 SAIC Initial prerelease version.
--- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
--- use of Result_Within_Range function overloaded for
--- FXA5A00.New_Float_Type.
--- 18 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 01 Oct 01 RLB Protected Constraint_Error exception tests by
--- first testing for 'Machine_Overflows.
---
---!
-
-with Ada.Exceptions;
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Elementary_Functions;
-with FXA5A00;
-with Report;
-
-procedure CXA5A10 is
-begin
-
- Report.Test ("CXA5A10", "Check that Exp, Sqrt, and the ""**"" operator " &
- "provide correct results");
-
- Test_Block:
- declare
-
- use FXA5A00, Ada.Numerics;
- use Ada.Exceptions;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
- package EF renames Ada.Numerics.Elementary_Functions;
-
- use GEF, EF;
-
- Arg,
- Float_Result : Float;
- New_Float_Result : New_Float;
-
- Flag_1, Flag_2, Flag_3, Flag_4,
- Incorrect_Inverse_Base_e,
- Incorrect_Inverse_Base_2,
- Incorrect_Inverse_Base_8,
- Incorrect_Inverse_Base_10,
- Incorrect_Inverse_Base_16 : Boolean := False;
-
- procedure Dont_Optimize_Float is new Dont_Optimize(Float);
- procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
-
- begin
-
- -- Testing of the "**" operator, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Argument_Error is raised by the exponentiation operator
- -- when the value of the Left parameter (operand) is negative.
-
- begin
- New_Float_Result := GEF."**"(Left => -10.0,
- Right => 2.0);
- Report.Failed("Argument_Error not raised by the instantiated " &
- "version of the exponentiation operator when the " &
- "value of the Left parameter is negative");
- Dont_Optimize_New_Float(New_Float_Result, 1);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the " &
- "instantiated version of the exponentiation " &
- "operator when the value of the Left parameter " &
- "is negative");
- end;
-
- begin
- Float_Result := (-FXA5A00.Small) ** 4.0;
- Report.Failed("Argument_Error not raised by the preinstantiated " &
- "version of the exponentiation operator when the " &
- "value of the Left parameter is negative");
- Dont_Optimize_Float(Float_Result, 2);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the " &
- "preinstantiated version of the exponentiation " &
- "operator when the value of the Left parameter " &
- "is negative");
- end;
-
-
- -- Check that Argument_Error is raised by the exponentiation operator
- -- when both parameters (operands) have the value 0.0.
-
- begin
- New_Float_Result := GEF."**"(0.0, Right => 0.0);
- Report.Failed("Argument_Error not raised by the instantiated " &
- "version of the exponentiation operator when " &
- "both operands are zero");
- Dont_Optimize_New_Float(New_Float_Result, 3);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the " &
- "instantiated version of the exponentiation " &
- "operator when both operands are zero");
- end;
-
- begin
- Float_Result := 0.0**0.0;
- Report.Failed("Argument_Error not raised by the preinstantiated " &
- "version of the exponentiation operator when both " &
- "operands are zero");
- Dont_Optimize_Float(Float_Result, 4);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the " &
- "preinstantiated version of the exponentiation " &
- "operator when both operands are zero");
- end;
-
-
- -- Check that Constraint_Error is raised by the exponentiation
- -- operator when the value of the left parameter (operand) is zero,
- -- and the value of the right parameter (exponent) is negative.
- -- This check applies only if Machine_Overflows is true [A.5.1(28, 30)].
-
- if New_Float'Machine_Overflows = True then
- begin
- New_Float_Result := GEF."**"(0.0, Right => -2.0);
- Report.Failed("Constraint_Error not raised by the instantiated " &
- "version of the exponentiation operator when " &
- "the left parameter is 0.0, and the right " &
- "parameter is negative");
- Dont_Optimize_New_Float(New_Float_Result, 5);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the " &
- "instantiated version of the exponentiation " &
- "operator when the left parameter is 0.0, " &
- "and the right parameter is negative");
- end;
- end if;
-
- if Float'Machine_Overflows = True then
- begin
- Float_Result := 0.0 ** (-FXA5A00.Small);
- Report.Failed("Constraint_Error not raised by the " &
- "preinstantiated version of the exponentiation " &
- "operator when the left parameter is 0.0, and the " &
- "right parameter is negative");
- Dont_Optimize_Float(Float_Result, 6);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by the " &
- "preinstantiated version of the exponentiation " &
- "operator when the left parameter is 0.0, and " &
- "the right parameter is negative");
- end;
- end if;
-
- -- Prescribed results.
- -- Check that exponentiation by a 0.0 exponent yields the value one.
-
- if GEF."**"(Left => 10.0, Right => 0.0) /= 1.0 or
- EF."**"(FXA5A00.Large, Right => 0.0) /= 1.0 or
- GEF."**"(3.0, 0.0) /= 1.0 or
- FXA5A00.Small ** 0.0 /= 1.0
- then
- Report.Failed("Incorrect results returned from the ""**"" " &
- "operator when the value of the exponent is 0.0");
- end if;
-
-
- -- Check that exponentiation by a unit exponent yields the value
- -- of the left operand.
-
- if GEF."**"(Left => 50.0, Right => 1.0) /= 50.0 or
- EF."**"(FXA5A00.Large, Right => 1.0) /= FXA5A00.Large or
- GEF."**"(6.0, 1.0) /= 6.0 or
- FXA5A00.Small ** 1.0 /= FXA5A00.Small
- then
- Report.Failed("Incorrect results returned from the ""**"" " &
- "operator when the value of the exponent is 1.0");
- end if;
-
-
- -- Check that exponentiation of the value 1.0 yields the value 1.0.
-
- if GEF."**"(Left => 1.0, Right => 16.0) /= 1.0 or
- EF."**"(1.0, Right => FXA5A00.Large) /= 1.0 or
- GEF."**"(1.0, 3.0) /= 1.0 or
- 1.0 ** FXA5A00.Small /= 1.0
- then
- Report.Failed("Incorrect results returned from the ""**"" " &
- "operator when the value of the operand is 1.0");
- end if;
-
-
- -- Check that exponentiation of the value 0.0 yields the value 0.0.
-
- if GEF."**"(Left => 0.0, Right => 10.0) /= 0.0 or
- EF."**"(0.0, Right => FXA5A00.Large) /= 0.0 or
- GEF."**"(0.0, 4.0) /= 0.0 or
- 0.0 ** FXA5A00.Small /= 0.0
- then
- Report.Failed("Incorrect results returned from the ""**"" " &
- "operator when the value of the operand is 0.0");
- end if;
-
-
- -- Check that exponentiation of various operands with a variety of
- -- of exponent values yield correct results.
-
- if not Result_Within_Range(GEF."**"(5.0, 2.0), 25.0, 0.01) or
- not Result_Within_Range(GEF."**"(1.225, 1.5), 1.36, 0.01) or
- not Result_Within_Range(GEF."**"(0.26, 2.0), 0.068, 0.001) or
- not Result_Within_Range( EF."**"(e, 5.0), 148.4, 0.1) or
- not Result_Within_Range( EF."**"(10.0, e), 522.7, 0.1) or
- not Result_Within_Range( EF."**"(e, (-3.0)), 0.050, 0.001) or
- not Result_Within_Range(GEF."**"(10.0,(-2.0)), 0.010, 0.001)
- then
- Report.Failed("Incorrect results returned from the ""**"" " &
- "operator with a variety of operand and exponent " &
- "values");
- end if;
-
-
- -- Use the following loops to check for internal consistency between
- -- inverse functions.
-
- declare
- -- Use the relative error value to account for non-exact
- -- computations.
- TC_Relative_Error: Float := 0.005;
- begin
- for i in 1..5 loop
- for j in 0..5 loop
- if not Incorrect_Inverse_Base_e and
- not FXA5A00.Result_Within_Range
- (Float(i)**Float(j),
- e**(Float(j)*EF.Log(Float(i))),
- TC_Relative_Error)
- then
- Incorrect_Inverse_Base_e := True;
- Report.Failed("Incorrect Log-** Inverse calc for Base e " &
- "with i= " & Integer'Image(i) & " and j= " &
- Integer'Image(j));
- end if;
- if not Incorrect_Inverse_Base_2 and
- not FXA5A00.Result_Within_Range
- (Float(i)**Float(j),
- 2.0**(Float(j)*EF.Log(Float(i),2.0)),
- TC_Relative_Error)
- then
- Incorrect_Inverse_Base_2 := True;
- Report.Failed("Incorrect Log-** Inverse calc for Base 2 " &
- "with i= " & Integer'Image(i) & " and j= " &
- Integer'Image(j));
- end if;
- if not Incorrect_Inverse_Base_8 and
- not FXA5A00.Result_Within_Range
- (Float(i)**Float(j),
- 8.0**(Float(j)*EF.Log(Float(i),8.0)),
- TC_Relative_Error)
- then
- Incorrect_Inverse_Base_8 := True;
- Report.Failed("Incorrect Log-** Inverse calc for Base 8 " &
- "with i= " & Integer'Image(i) & " and j= " &
- Integer'Image(j));
- end if;
- if not Incorrect_Inverse_Base_10 and
- not FXA5A00.Result_Within_Range
- (Float(i)**Float(j),
- 10.0**(Float(j)*EF.Log(Float(i),10.0)),
- TC_Relative_Error)
- then
- Incorrect_Inverse_Base_10 := True;
- Report.Failed("Incorrect Log-** Inverse calc for Base 10 " &
- "with i= " & Integer'Image(i) & " and j= " &
- Integer'Image(j));
- end if;
- if not Incorrect_Inverse_Base_16 and
- not FXA5A00.Result_Within_Range
- (Float(i)**Float(j),
- 16.0**(Float(j)*EF.Log(Float(i),16.0)),
- TC_Relative_Error)
- then
- Incorrect_Inverse_Base_16 := True;
- Report.Failed("Incorrect Log-** Inverse calc for Base 16 " &
- "with i= " & Integer'Image(i) & " and j= " &
- Integer'Image(j));
- end if;
- end loop;
- end loop;
- end;
-
- -- Reset Flags.
- Incorrect_Inverse_Base_e := False;
- Incorrect_Inverse_Base_2 := False;
- Incorrect_Inverse_Base_8 := False;
- Incorrect_Inverse_Base_10 := False;
- Incorrect_Inverse_Base_16 := False;
-
-
- -- Testing of Exp Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that the result of the Exp Function, when provided an X
- -- parameter value of 0.0, is 1.0.
-
- if GEF.Exp(X => 0.0) /= 1.0 or
- EF.Exp(0.0) /= 1.0
- then
- Report.Failed("Incorrect result returned by Function Exp when " &
- "given a parameter value of 0.0");
- end if;
-
-
- -- Check that the Exp Function provides correct results when provided
- -- a variety of input parameter values.
-
- if not Result_Within_Range(GEF.Exp(0.001), 1.01, 0.01) or
- not Result_Within_Range( EF.Exp(0.1), 1.11, 0.01) or
- not Result_Within_Range(GEF.Exp(1.2697), 3.56, 0.01) or
- not Result_Within_Range( EF.Exp(3.2525), 25.9, 0.1) or
- not Result_Within_Range(GEF.Exp(-0.2198), 0.803, 0.001) or
- not Result_Within_Range( EF.Exp(-1.6621), 0.190, 0.001) or
- not Result_Within_Range(GEF.Exp(-2.3888), 0.092, 0.001) or
- not Result_Within_Range( EF.Exp(-5.4415), 0.004, 0.001)
- then
- Report.Failed("Incorrect result from Function Exp when provided " &
- "a variety of input parameter values");
- end if;
-
- -- Use the following loops to check for internal consistency between
- -- inverse functions.
-
- Arg := 0.01;
- while Arg < 10.0 loop
- if not Incorrect_Inverse_Base_e and
- FXA5A00.Result_Within_Range(EF.Exp(Arg),
- e**(Arg*EF.Log(Arg)),
- 0.001)
- then
- Incorrect_Inverse_Base_e := True;
- Report.Failed("Incorrect Exp-** Inverse calc for Base e");
- end if;
- if not Incorrect_Inverse_Base_2 and
- FXA5A00.Result_Within_Range(EF.Exp(Arg),
- 2.0**(Arg*EF.Log(Arg,2.0)),
- 0.001)
- then
- Incorrect_Inverse_Base_2 := True;
- Report.Failed("Incorrect Exp-** Inverse calc for Base 2");
- end if;
- if not Incorrect_Inverse_Base_8 and
- FXA5A00.Result_Within_Range(EF.Exp(Arg),
- 8.0**(Arg*EF.Log(Arg,8.0)),
- 0.001)
- then
- Incorrect_Inverse_Base_8 := True;
- Report.Failed("Incorrect Exp-** Inverse calc for Base 8");
- end if;
- if not Incorrect_Inverse_Base_10 and
- FXA5A00.Result_Within_Range(EF.Exp(Arg),
- 10.0**(Arg*EF.Log(Arg,10.0)),
- 0.001)
- then
- Incorrect_Inverse_Base_10 := True;
- Report.Failed("Incorrect Exp-** Inverse calc for Base 10");
- end if;
- if not Incorrect_Inverse_Base_16 and
- FXA5A00.Result_Within_Range(EF.Exp(Arg),
- 16.0**(Arg*EF.Log(Arg,16.0)),
- 0.001)
- then
- Incorrect_Inverse_Base_16 := True;
- Report.Failed("Incorrect Exp-** Inverse calc for Base 16");
- end if;
- Arg := Arg + 0.01;
- end loop;
-
-
- -- Testing of Sqrt Function, both instantiated and pre-instantiated
- -- version.
-
- -- Check that Argument_Error is raised by the Sqrt Function when
- -- the value of the input parameter X is negative.
-
- begin
- Float_Result := EF.Sqrt(X => -FXA5A00.Small);
- Report.Failed("Argument_Error not raised by Function Sqrt " &
- "when provided a small negative input parameter " &
- "value");
- Dont_Optimize_Float(Float_Result, 7);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Sqrt " &
- "when provided a small negative input parameter " &
- "value");
- end;
-
- begin
- New_Float_Result := GEF.Sqrt(X => -64.0);
- Report.Failed("Argument_Error not raised by Function Sqrt " &
- "when provided a large negative input parameter " &
- "value");
- Dont_Optimize_New_Float(New_Float_Result, 8);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Function Sqrt " &
- "when provided a large negative input parameter " &
- "value");
- end;
-
-
- -- Check that the Sqrt Function, when given an X parameter value of 0.0,
- -- returns a result of 0.0.
-
- if GEF.Sqrt(X => 0.0) /= 0.0 or
- EF.Sqrt(0.0) /= 0.0
- then
- Report.Failed("Incorrect result from Function Sqrt when provided " &
- "an input parameter value of 0.0");
- end if;
-
-
- -- Check that the Sqrt Function, when given an X parameter input value
- -- of 1.0, returns a result of 1.0.
-
- if GEF.Sqrt(X => 1.0) /= 1.0 or
- EF.Sqrt(1.0) /= 1.0
- then
- Report.Failed("Incorrect result from Function Sqrt when provided " &
- "an input parameter value of 1.0");
- end if;
-
-
- -- Check that the Sqrt Function provides correct results when provided
- -- a variety of input parameter values.
-
- if not FXA5A00.Result_Within_Range(GEF.Sqrt(0.0327), 0.181, 0.001) or
- not FXA5A00.Result_Within_Range( EF.Sqrt(0.1808), 0.425, 0.001) or
- not FXA5A00.Result_Within_Range(GEF.Sqrt(1.0556), 1.03, 0.01) or
- not FXA5A00.Result_Within_Range( EF.Sqrt(32.8208), 5.73, 0.01) or
- not FXA5A00.Result_Within_Range( EF.Sqrt(27851.0), 166.9, 0.1) or
- not FXA5A00.Result_Within_Range( EF.Sqrt(61203.4), 247.4, 0.1) or
- not FXA5A00.Result_Within_Range( EF.Sqrt(655891.0), 809.9, 0.1)
- then
- Report.Failed("Incorrect result from Function Sqrt when provided " &
- "a variety of input parameter values");
- end if;
-
- -- Check internal consistency between functions.
-
- Arg := 0.01;
- while Arg < 10.0 loop
- if not Flag_1 and
- not FXA5A00.Result_Within_Range(Arg,
- EF.Sqrt(Arg)*EF.Sqrt(Arg),
- 0.01)
- then
- Report.Failed("Inconsistency found in Case 1");
- Flag_1 := True;
- end if;
- if not Flag_2 and
- not FXA5A00.Result_Within_Range(Arg, EF.Sqrt(Arg)**2.0, 0.01)
- then
- Report.Failed("Inconsistency found in Case 2");
- Flag_2 := True;
- end if;
- if not Flag_3 and
- not FXA5A00.Result_Within_Range(EF.Log(Arg),
- EF.Log(Sqrt(Arg)**2.0), 0.01)
- then
- Report.Failed("Inconsistency found in Case 3");
- Flag_3 := True;
- end if;
- if not Flag_4 and
- not FXA5A00.Result_Within_Range(EF.Log(Arg),
- 2.00*EF.Log(EF.Sqrt(Arg)),
- 0.01)
- then
- Report.Failed("Inconsistency found in Case 4");
- Flag_4 := True;
- end if;
- Arg := Arg + 1.0;
- end loop;
-
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXA5A10;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa8001.a b/gcc/testsuite/ada/acats/tests/cxa/cxa8001.a
deleted file mode 100644
index 16f30752db1..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa8001.a
+++ /dev/null
@@ -1,243 +0,0 @@
--- CXA8001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that all elements to be transferred to a sequential file of
--- mode Append_File will be placed following the last element currently
--- in the file.
--- Check that it is possible to append data to a file that has been
--- previously appended to.
--- Check that the predefined procedure Write will place an element after
--- the last element in the file in mode Append_File.
---
--- TEST DESCRIPTION:
--- This test implements a sequential file system that has the capability
--- to store data records at the end of a file. Initially, the file is
--- opened with mode Out_File, and data is written to the file. The file
--- is closed, then reopened with mode Append_File. An additional record
--- is written, and again the file is closed. The file is then reopened,
--- again with mode Append_File, and another record is written to the
--- file.
--- The file is closed again, the reopened with mode In_File, and the data
--- in the file is read and checked for proper ordering within the file.
---
--- An expected common usage of Append_File mode would be in the opening
--- of a file that currently contains data. Likewise, the reopening of
--- files in Append_Mode that have been previously appended to for the
--- addition of more data would be frequently encountered. This test
--- attempts to simulate both situations. (Of course, in an actual user
--- environment, the open/write/close processing would be performed using
--- looping structures, rather than the straight-line processing displayed
--- here.)
---
--- APPLICABILITY CRITERIA:
--- Applicable to all systems capable of supporting IO operations on
--- external Sequential_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 27 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Sequential_IO;
-with Report;
-
-procedure CXA8001 is
-
- -- Declare data types and objects to be stored in the file.
- subtype Name_Type is String (1 .. 10);
- type Tickets is range 0 .. 1000;
-
- type Order_Type is record
- Name : Name_Type;
- No_of_Tickets : Tickets;
- end record;
-
- package Order_IO is new Sequential_IO (Order_Type); -- Declare Seq_IO
- -- package,
- Order_File : Order_IO.File_Type; -- and file object.
- Order_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXA8001" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXA8001", "Check that all elements to be transferred to a " &
- "sequential file of mode Append_File will be " &
- "placed following the last element currently " &
- "in the file");
-
- Test_for_Sequential_IO_Support:
- begin
-
- -- An implementation that does not support Sequential_IO in a particular
- -- environment will raise Use_Error or Name_Error on calls to various
- -- Sequential_IO operations. This block statement encloses a call to
- -- Create, which should produce an exception in a non-supportive
- -- environment. These exceptions will be handled to produce a
- -- Not_Applicable result.
-
- Order_IO.Create (File => Order_File, -- Create Sequential_IO file
- Mode => Order_IO.Out_File, -- with mode Out_File.
- Name => Order_Filename);
-
- exception
-
- when Order_IO.Use_Error | Order_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Sequential_IO" );
- raise Incomplete;
-
- end Test_for_Sequential_IO_Support;
-
- Operational_Test_Block:
- declare
- -- Assign values into the component fields of the data objects.
- Buyer_1 : constant Order_Type := ("John Smith", 3);
- Buyer_2 : constant Order_Type :=
- (Name => "Jane Jones", No_of_Tickets => 2);
- Buyer_3 : Order_Type := ("Mike Brown", 5);
-
- begin
- Order_IO.Write (File => Order_File, -- Write initial data item
- Item => Buyer_1); -- to file.
-
- Order_IO.Close (File => Order_File); -- Close file.
-
- --
- -- Enter additional data records into the file. (Append to a file of
- -- previous mode Out_File).
- --
- Order_IO.Open (Order_File, -- Open Sequential_IO file
- Order_IO.Append_File, -- with mode Append_File.
- Order_Filename);
-
- Order_IO.Write (Order_File, Buyer_2); -- Write second data item
- -- to file.
- Order_IO.Close (File => Order_File); -- Close file.
-
- -- Check to determine whether file is actually closed.
- begin
- Order_IO.Write (Order_File, Buyer_2);
- Report.Failed("Exception not raised on Write to Closed file");
- exception
- when Order_IO.Status_Error => null; -- Expected exception.
- when others =>
- Report.Failed("Incorrect exception on Write to Closed file");
- end;
-
- --
- -- The following code segment demonstrates appending data to a file
- -- that has been previously appended to.
- --
-
- Order_IO.Open (Order_File, -- Open Sequential_IO file
- Order_IO.Append_File, -- with mode Append_File.
- Order_Filename );
-
- Order_IO.Write (Order_File, Buyer_3); -- Write third data item
- -- to file.
- Order_IO.Close (File => Order_File); -- Close file.
-
-
- Test_Verification_Block:
- declare
- TC_Order1, TC_Order2, TC_Order3 : Order_Type;
- begin
-
- Order_IO.Open (Order_File, -- Open Sequential_IO file
- Order_IO.In_File, -- with mode In_File.
- Order_Filename );
-
- Order_IO.Read (File => Order_File, -- Read records from file.
- Item => TC_Order1);
- Order_IO.Read (Order_File, TC_Order2);
- Order_IO.Read (Order_File, TC_Order3);
-
- -- Compare the contents of each with the individual data items.
- -- If items read from file do not match the items placed into
- -- the file, in the appropriate order, then fail.
-
- if ((TC_Order1 /= Buyer_1) or
- (TC_Order2.Name /= Buyer_2.Name) or
- (TC_Order2.No_of_Tickets /= Buyer_2.No_of_Tickets) or
- not ((TC_Order3.Name = "Mike Brown") and
- (TC_Order3.No_of_Tickets = 5))) then
- Report.Failed ("Incorrect appending of record data in file");
- end if;
-
- -- Check to determine that no more than three data records were
- -- actually written to the file.
- if not Order_IO.End_Of_File (Order_File) then
- Report.Failed("File not empty after three reads");
- end if;
-
- exception
-
- when Order_IO.End_Error => -- If three items not in
- -- file (data overwritten),
- -- then fail.
- Report.Failed ("Incorrect number of record elements in file");
-
- when others =>
- Report.Failed ("Error raised during data verification");
-
- end Test_Verification_Block;
-
- exception
-
- when others =>
- Report.Failed("Exception raised during Sequential_IO processing");
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- -- Check that file is open prior to deleting it.
- if Order_IO.Is_Open(Order_File) then
- Order_IO.Delete (Order_File);
- else
- Order_IO.Open(Order_File, Order_IO.In_File, Order_Filename);
- Order_IO.Delete (Order_File);
- end if;
-
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Sequential_IO" );
-
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXA8001;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa8002.a b/gcc/testsuite/ada/acats/tests/cxa/cxa8002.a
deleted file mode 100644
index 8670e98bac9..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa8002.a
+++ /dev/null
@@ -1,285 +0,0 @@
--- CXA8002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that resetting a file using mode Append_File allows for the
--- writing of elements to the file starting after the last element in
--- the file.
--- Check that the result of function Name can be used on a subsequent
--- reopen of the file.
--- Check that a mode change occurs on reset of a file to/from mode
--- Append_File.
---
--- TEST DESCRIPTION:
--- This test simulates the read/write of data from/to an individual
--- sequential file. New data can be appended to the end of the existing
--- file, and the same file can be reset to allow reading of data from
--- the file. This process can occur multiple times.
--- When the mode of the file is changed with a Reset, the current mode
--- value assigned to the file is checked using the result of function
--- Mode. This, in conjunction with the read/write operations, verifies
--- that a mode change has taken place on Reset.
---
--- An expected common usage of the scenarios found in this test would
--- be a case where a single data file is kept open continuously, being
--- reset for read/append of data. For systems that do not support a
--- direct form of I/O, this would allow for efficient use of a sequential
--- I/O file.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all systems capable of supporting IO operations on
--- external Sequential_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 19 Feb 97 PWB.CTA Fixed handling for file non-support and Reset
--- non-support.
---!
-
-with Sequential_IO;
-with Report;
-
-procedure CXA8002 is
- subtype Employee_Data is String (1 .. 11);
- package Data_IO is new Sequential_IO (Employee_Data);
-
- Employee_Data_File : Data_IO.File_Type;
- Employee_Filename : constant String :=
- Report.Legal_File_Name (Nam => "CXA8002");
-
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXA8002", "Check that resetting a file using mode " &
- "Append_File allows for the writing of " &
- "elements to the file starting after the " &
- "last element in the file");
-
- Test_for_Sequential_IO_Support:
- begin
-
- -- An implementation that does not support Sequential_IO in a particular
- -- environment will raise Use_Error or Name_Error on calls to various
- -- Sequential_IO operations. This block statement encloses a call to
- -- Create, which should produce an exception in a non-supportive
- -- environment. These exceptions will be handled to produce a
- -- Not_Applicable result.
-
- Data_IO.Create (File => Employee_Data_File, -- Create file in
- Mode => Data_IO.Append_File, -- mode Append_File.
- Name => Employee_Filename);
-
- --
- -- The following portion of code demonstrates the fact that a sequential
- -- file can be created in Append_File mode, and that data can be written
- -- to the file.
- --
-
- exception
- when Data_IO.Use_Error | Data_IO.Name_Error =>
- Report.Not_Applicable
- ( "Sequential files not supported - Create as Append_File");
- raise Incomplete;
- end Test_for_Sequential_IO_Support;
- Operational_Test_Block:
- declare
- Blank_Data : constant Employee_Data := " ";
- Employee_1 : constant Employee_Data := "123-45-6789";
- Employee_2 : Employee_Data := "987-65-4321";
-
- -- Note: Artificial numerical data chosen above to prevent any
- -- unintended similarity with persons alive or dead.
-
- TC_Employee_Data : Employee_Data := Blank_Data;
-
-
- function TC_Mode_Selection (Selector : Integer)
- return Data_IO.File_Mode is
- begin
- case Report.Ident_Int(Selector) is
- when 1 => return Data_IO.In_File;
- when 2 => return Data_IO.Out_File;
- when others => return Data_IO.Append_File;
- end case;
- end TC_Mode_Selection;
-
- Employee_Filename : constant String := -- Use function Name to
- Data_IO.Name (File => Employee_Data_File); -- store filename in
- -- string variable.
- begin
-
- Data_IO.Write (File => Employee_Data_File, -- Write initial data
- Item => Employee_1); -- entry to file.
-
- --
- -- The following portion of code demonstrates that a sequential file
- -- can be reset to various file modes, including Append_File mode,
- -- allowing data to be added to the end of the file.
- --
- begin
- Data_IO.Reset (File => Employee_Data_File, -- Reset file with
- Mode => Data_IO.In_File); -- mode In_File.
- exception
- when Data_IO.Use_Error =>
- Report.Not_Applicable
- ("Reset to In_File not supported for Sequential_IO");
- raise Incomplete;
- when others =>
- Report.Failed
- ("Unexpected exception on Reset to In_File (Sequential_IO)");
- raise Incomplete;
- end;
- if Data_IO."="(Data_IO.Mode (Employee_Data_File),
- TC_Mode_Selection (1)) then -- Compare In_File mode
- -- Reset successful,
- Data_IO.Read (File => Employee_Data_File, -- now verify file data.
- Item => TC_Employee_Data);
-
- if ((TC_Employee_Data (1 .. 7) /= "123-45-") or
- (TC_Employee_Data (5 .. 11) /= "45-6789")) then
- Report.Failed ("Data read error");
- end if;
-
- else
- Report.Failed ("File mode not changed by Reset");
- end if;
-
- --
- -- Simulate appending data to a file that has previously been written
- -- to and read from.
- --
- begin
- Data_IO.Reset (File => Employee_Data_File, -- Reset file with
- Mode => Data_IO.Append_File); -- mode Append_File.
- exception
- when Data_IO.Use_Error =>
- Report.Not_Applicable
- ("Reset to Append_File not supported for Sequential_IO");
- raise Incomplete;
- when others =>
- Report.Failed
- ("Unexpected exception on Reset to Append_File (Sequential_IO)");
- raise Incomplete;
- end;
-
- if Data_IO.Is_Open (Employee_Data_File) then -- File remains open
- -- following Reset to
- -- Append_File mode?
-
- if Data_IO."=" (Data_IO.Mode (Employee_Data_File),
- TC_Mode_Selection (3)) then -- Compare to
- -- Append_File mode.
- Data_IO.Write (File => Employee_Data_File, -- Write additional
- Item => Employee_2); -- data to file.
- else
- Report.Failed ("File mode not changed by Reset");
- end if;
-
- else
- Report.Failed
- ("File status not Open following Reset to Append mode");
- end if;
-
- Data_IO.Close (Employee_Data_File);
-
-
- Test_Verification_Block:
- begin
-
- Data_IO.Open (File => Employee_Data_File, -- Reopen file, using
- Mode => Data_IO.In_File, -- previous result of
- Name => Employee_Filename); -- function Name.
-
- TC_Employee_Data := Blank_Data; -- Clear record field.
- Data_IO.Read (Employee_Data_File, -- Read first record,
- TC_Employee_Data); -- check ordering of
- -- records.
-
- if not ((TC_Employee_Data (1 .. 3) = "123") and then
- (TC_Employee_Data (4 .. 11) = "-45-6789")) then
- Report.Failed ("Data read error - first record");
- end if;
-
- TC_Employee_Data := Blank_Data; -- Clear record field.
- Data_IO.Read (Employee_Data_File, -- Read second record,
- TC_Employee_Data); -- check for ordering of
- -- records.
-
- if ((TC_Employee_Data (1 .. 6) /= "987-65") or else
- not (TC_Employee_Data (3 .. 11) = "7-65-4321")) then
- Report.Failed ("Data read error - second record");
- end if;
-
- -- Check that only two items were written to the file.
- if not Data_IO.End_Of_File(Employee_Data_File) then
- Report.Failed("Incorrect number of records in file");
- end if;
-
- exception
-
- when Data_IO.End_Error => -- If two items not in
- -- file (data overwritten),
- -- then fail.
- Report.Failed ("Incorrect number of record elements in file");
-
- when others =>
- Report.Failed ("Error raised during data verification");
-
- end Test_Verification_Block;
-
- exception
-
- when others =>
- Report.Failed("Exception raised during Sequential_IO processing");
-
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Check that file is open prior to deleting it.
- if Data_IO.Is_Open(Employee_Data_File) then
- Data_IO.Delete (Employee_Data_File);
- else
- Data_IO.Open(Employee_Data_File,
- Data_IO.In_File,
- Employee_Filename);
- Data_IO.Delete (Employee_Data_File);
- end if;
- exception
- when others =>
- Report.Failed ("Sequential_IO Delete not properly supported");
- end Final_Block;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ("Unexpected exception");
- Report.Result;
-end CXA8002;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa8003.a b/gcc/testsuite/ada/acats/tests/cxa/cxa8003.a
deleted file mode 100644
index cf9b5e07598..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa8003.a
+++ /dev/null
@@ -1,214 +0,0 @@
--- CXA8003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Append_File mode has not been added to package Direct_IO.
---
--- TEST DESCRIPTION:
--- This test uses a procedure to change the mode of an existing Direct_IO
--- file. The file descriptor is passed as a parameter, along with a
--- numeric indicator for the new mode. Based on the numeric parameter,
--- a Direct_IO.Reset is performed using a File_Mode'Value transformation
--- of a string constant into a File_Mode value. An attempt to reset a
--- Direct_IO file to mode Append_File should cause an Constraint_Error
--- to be raised, as Append_File mode has not been added to Direct_IO in
--- Ada 9X.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations supporting Direct_IO
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 19 Feb 97 PWB.CTA Allowed for non-support of Reset for certain
--- modes.
---!
-
-with Direct_IO;
-with Report;
-
-procedure CXA8003 is
- Incomplete : exception;
- begin
-
- Report.Test ("CXA8003", "Check that Append_File mode has not " &
- "been added to package Direct_IO");
-
- Test_for_Direct_IO_Support:
- declare
-
- subtype String_Data_Type is String (1 .. 20);
- type Numeric_Data_Type is range 1 .. 512;
- type Composite_Data_Type is array (1 .. 3) of String_Data_Type;
-
- type File_Data_Type is record
- Data_Field_1 : String_Data_Type;
- Data_Field_2 : Numeric_Data_Type;
- Data_Field_3 : Composite_Data_Type;
- end record;
-
- package Dir_IO is new Direct_IO (File_Data_Type);
-
- Data_File : Dir_IO.File_Type;
- Dir_Filename : constant String := Report.Legal_File_Name;
-
- begin
-
- -- An application creates a text file with mode Out_File.
- -- Use_Error will be raised if Direct_IO operations or external
- -- files are not supported.
-
- Dir_IO.Create (Data_File,
- Dir_IO.Out_File,
- Dir_Filename);
-
- Change_File_Mode:
- declare
-
- TC_Append_Test_Executed : Boolean := False;
-
- type Mode_Selection_Type is ( A, I, IO, O );
-
-
- procedure Change_Mode (File : in out Dir_IO.File_Type;
- To : in Mode_Selection_Type) is
- begin
- case To is
- when A =>
- TC_Append_Test_Executed := True;
- Dir_IO.Reset
- (File, Dir_IO.File_Mode'Value("Append_File"));
- when I =>
- begin
- Dir_IO.Reset
- (File, Dir_IO.File_Mode'Value("In_File"));
- exception
- when Dir_IO.Use_Error =>
- Report.Not_Applicable
- ("Reset to In_File not supported: Direct_IO");
- raise Incomplete;
- end;
- when IO =>
- begin
- Dir_IO.Reset
- (File, Dir_IO.File_Mode'Value("Inout_File"));
- exception
- when Dir_IO.Use_Error =>
- Report.Not_Applicable
- ("Reset to InOut_File not supported: Direct_IO");
- raise Incomplete;
- end;
- when O =>
- begin
- Dir_IO.Reset
- (File, Dir_IO.File_Mode'Value("Out_File"));
- exception
- when Dir_IO.Use_Error =>
- Report.Not_Applicable
- ("Reset to Out_File not supported: Direct_IO");
- raise Incomplete;
- end;
- end case;
- end Change_Mode;
-
-
- begin
-
- -- At some point in the processing, the application may call a
- -- procedure to change the mode of the file (perhaps for
- -- additional data entry, data verification, etc.). It is at
- -- this point that a use of Append_File mode for a Direct_IO
- -- file would cause an exception.
-
- for I in reverse Mode_Selection_Type loop
- Change_Mode (Data_File, I);
- Report.Comment
- ("Mode changed to " &
- Dir_IO.File_Mode'Image (Dir_IO.Mode (Data_File)));
- end loop;
-
- Report.Failed("No error raised on change to Append_File mode");
-
- exception
-
- -- A handler has been provided in the application, which
- -- handles the constraint error, allowing processing to
- -- continue.
-
- when Constraint_Error =>
-
- if TC_Append_Test_Executed then
- Report.Comment ("Constraint_Error correctly raised on " &
- "attempted Append_File mode selection " &
- "for a Direct_IO file");
- else
- Report.Failed ("Append test was not executed");
- end if;
-
- when Incomplete => raise;
-
- when others => Report.Failed ("Unexpected exception raised");
-
- end Change_File_Mode;
-
- Final_Block:
- begin
- if Dir_IO.Is_Open (Data_File) then
- Dir_IO.Delete (Data_File);
- else
- Dir_IO.Open (Data_File, Dir_IO.In_File, Dir_Filename);
- Dir_IO.Delete (Data_File);
- end if;
- exception
- when others =>
- Report.Failed ("Delete not properly supported: Direct_IO");
- end Final_Block;
-
- exception
-
- -- Since Use_Error or Name_Error can be raised if, for the
- -- specified mode, the environment does not support Direct_IO
- -- operations, the following handlers are included:
-
- when Dir_IO.Name_Error =>
- Report.Not_Applicable("Name_Error raised on Direct IO Create");
-
- when Dir_IO.Use_Error =>
- Report.Not_Applicable("Use_Error raised on Direct IO Create");
-
- when others =>
- Report.Failed
- ("Unexpected exception raised on Direct IO Create");
-
- end Test_for_Direct_IO_Support;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
-
-end CXA8003;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa9001.a b/gcc/testsuite/ada/acats/tests/cxa/cxa9001.a
deleted file mode 100644
index 4fe9c357614..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa9001.a
+++ /dev/null
@@ -1,287 +0,0 @@
--- CXA9001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the operations defined in the generic package
--- Ada.Storage_IO provide the ability to store and retrieve objects
--- which may include implicit levels of indirection in their
--- implementation, from an in-memory buffer.
---
--- TEST DESCRIPTION:
--- The following scenario demonstrates how an object of a type with
--- (potential) levels of indirection (based on the implementation)
--- can be "flattened" and written/read to/from a Direct_IO file.
--- In this small example, we have attempted to simulate the situation
--- where two independent programs are using a particular Direct_IO file,
--- one writing data to the file, and the second program reading that file.
--- The Storage_IO Read and Write procedures are used to "flatten"
--- and reconstruct objects of the record type.
---
--- APPLICABILITY CRITERIA:
--- Applicable to implementations capable of supporting external
--- Direct_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 07 Jun 95 SAIC Modified to constrain type used with Storage_IO.
--- 20 Nov 95 SAIC Corrected and enhanced for ACVC 2.0.1.
--- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Report;
-with Ada.Storage_IO;
-with Ada.Direct_IO;
-
-procedure CXA9001 is
- package Dir_IO is new Ada.Direct_IO (Integer);
- Test_File : Dir_IO.File_Type;
- Incomplete : exception;
-begin
-
- Report.Test ("CXA9001", "Check that the operations defined in the " &
- "generic package Ada.Storage_IO provide the " &
- "ability to store and retrieve objects which " &
- "may include implicit levels of indirection in " &
- "their implementation, from an in-memory buffer");
-
-
- Test_For_Direct_IO_Support:
- begin
-
- -- The following Create does not have any bearing on the test scenario,
- -- but is included to check that the implementation supports Direct_IO
- -- files. An exception on this Create statement will raise a Name_Error
- -- or Use_Error, which will be handled to produce a Not_Applicable
- -- result. If created, the file is immediately deleted, as it is not
- -- needed for the program scenario.
-
- Dir_IO.Create (Test_File, Dir_IO.Out_File, Report.Legal_File_Name(1));
-
- exception
-
- when Dir_IO.Use_Error | Dir_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Direct_IO" );
- raise Incomplete;
-
- end Test_for_Direct_IO_Support;
-
- Deletion1:
- begin
- Dir_IO.Delete (Test_File);
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Direct_IO - 1" );
- end Deletion1;
-
-
- Test_Block:
- declare
-
- The_Filename : constant String := Report.Legal_File_Name(2);
-
- -- The following type is the basic unit used in this test. It is
- -- incorporated into the definition of the Unit_Array_Type.
-
- type Unit_Type is
- record
- Position : Natural := 19;
- String_Value : String (1..9) := (others => 'X');
- end record;
-
- TC_Size : Natural := Natural'First;
-
- procedure Data_Storage (Number_Of_Units : in Natural;
- Result : out Natural) is
-
- -- Type based on input parameter. Uses type Unit_Type
- -- as the array element.
- type Unit_Array_Type is array (1..Number_Of_Units)
- of Unit_Type;
-
- -- This type definition is the ultimate storage type used
- -- in this test; uses type Unit_Array_Type as a record
- -- component field.
- -- This record type contains a component that is an array of
- -- records, with each of these records containing a Natural
- -- and a String value (i.e., a record containing an array of
- -- records).
-
- type Data_Storage_Type is
- record
- Data_Value : Natural := Number_Of_Units;
- Unit_Array : Unit_Array_Type;
- end record;
-
- -- The instantiation of the following generic package is a
- -- central point in this test. Storage_IO is instantiated for
- -- a specific data type, and will be used to "flatten" objects
- -- of that type into buffers. Direct_IO is instantiated for
- -- these Storage_IO buffers.
-
- package Flat_Storage_IO is
- new Ada.Storage_IO (Data_Storage_Type);
- package Buffer_IO is
- new Ada.Direct_IO (Flat_Storage_IO.Buffer_Type);
-
- Buffer_File : Buffer_IO.File_Type;
- Outbound_Buffer : Flat_Storage_IO.Buffer_Type;
- Storage_Item : Data_Storage_Type;
-
- begin -- procedure Data_Storage
-
- Buffer_IO.Create (Buffer_File,
- Buffer_IO.Out_File,
- The_Filename);
-
- Flat_Storage_IO.Write (Buffer => Outbound_Buffer,
- Item => Storage_Item);
-
- -- At this point, any levels of indirection have been removed
- -- by the Storage_IO procedure, and the buffered data can be
- -- written to a file.
-
- Buffer_IO.Write (Buffer_File, Outbound_Buffer);
- Buffer_IO.Close (Buffer_File);
- Result := Storage_Item.Unit_Array'Last + -- 5 +
- Storage_Item.Unit_Array -- 9
- (Storage_Item.Unit_Array'First).String_Value'Length;
-
- exception
- when others =>
- Report.Failed ("Data storage error");
- if Buffer_IO.Is_Open (Buffer_File) then
- Buffer_IO.Close (Buffer_File);
- end if;
- end Data_Storage;
-
- procedure Data_Retrieval (Number_Of_Units : in Natural;
- Result : out Natural) is
- type Unit_Array_Type is array (1..Number_Of_Units)
- of Unit_Type;
-
- type Data_Storage_Type is
- record
- Data_Value : Natural := Number_Of_Units;
- Unit_Array : Unit_Array_Type;
- end record;
-
- package Flat_Storage_IO is
- new Ada.Storage_IO (Data_Storage_Type);
- package Reader_IO is
- new Ada.Direct_IO (Flat_Storage_IO.Buffer_Type);
-
- Reader_File : Reader_IO.File_Type;
- Inbound_Buffer : Flat_Storage_IO.Buffer_Type;
- Storage_Item : Data_Storage_Type;
- TC_Item : Data_Storage_Type;
-
- begin -- procedure Data_Retrieval
-
- Reader_IO.Open (Reader_File, Reader_IO.In_File, The_Filename);
- Reader_IO.Read (Reader_File, Inbound_Buffer);
-
- Flat_Storage_IO.Read (Inbound_Buffer, Storage_Item);
-
- -- Validate the reconstructed value against an "unflattened"
- -- value.
-
- if Storage_Item.Data_Value /= TC_Item.Data_Value
- then
- Report.Failed ("Data_Retrieval Error - 1");
- end if;
-
- for i in 1..Number_Of_Units loop
- if Storage_Item.Unit_Array(i).String_Value'Length /=
- TC_Item.Unit_Array(i).String_Value'Length or
- Storage_Item.Unit_Array(i).Position /=
- TC_Item.Unit_Array(i).Position or
- Storage_Item.Unit_Array(i).String_Value /=
- TC_Item.Unit_Array(i).String_Value
- then
- Report.Failed ("Data_Retrieval Error - 2");
- end if;
- end loop;
-
- Result := Storage_Item.Unit_Array'Last + -- 5 +
- Storage_Item.Unit_Array -- 9
- (Storage_Item.Unit_Array'First).String_Value'Length;
-
- if Reader_IO.Is_Open (Reader_File) then
- Reader_IO.Delete (Reader_File);
- else
- Reader_IO.Open (Reader_File,
- Reader_IO.In_File,
- The_Filename);
- Reader_IO.Delete (Reader_File);
- end if;
-
- exception
- when others =>
- Report.Failed ("Exception raised in Data_Retrieval");
- if Reader_IO.Is_Open (Reader_File) then
- Reader_IO.Delete (Reader_File);
- else
- Reader_IO.Open (Reader_File,
- Reader_IO.In_File,
- The_Filename);
- Reader_IO.Delete (Reader_File);
- end if;
- end Data_Retrieval;
-
-
- begin -- Test_Block
-
- -- The number of Units is provided in this call to Data_Storage.
- Data_Storage (Number_Of_Units => Natural(Report.Ident_Int(5)),
- Result => TC_Size);
-
- if TC_Size /= 14 then
- Report.Failed ("Data_Storage error in Data_Storage");
- end if;
-
- Data_Retrieval (Number_Of_Units => Natural(Report.Ident_Int(5)),
- Result => TC_Size);
-
- if TC_Size /= 14 then
- Report.Failed ("Data retrieval error in Data_Retrieval");
- end if;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXA9001;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa9002.a b/gcc/testsuite/ada/acats/tests/cxa/cxa9002.a
deleted file mode 100644
index 415a56630ad..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxa9002.a
+++ /dev/null
@@ -1,482 +0,0 @@
--- CXA9002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the operations defined in the generic package
--- Ada.Storage_IO provide the ability to store and retrieve objects
--- of tagged types from in-memory buffers.
---
--- TEST DESCRIPTION:
--- The following scenario demonstrates how objects of a tagged type,
--- extended types, and twice extended types can be written/read
--- to/from Direct_IO files. The Storage_IO subprograms, Read and Write,
--- demonstrated in this scenario, perform tag "fixing" prior to/following
--- transfer to the Direct_IO files.
--- This method is especially important for those implementations that
--- represent tags as pointers, or for cases where the tagged objects
--- are read in by a program other than the one that wrote them.
---
--- In this small example, we have attempted to simulate the situation
--- where two independent programs are using a series of Direct_IO files,
--- one writing data to the files, and the second program reading the
--- data from those files. Two procedures are defined, the first
--- simulating the program responsible for writing, the second simulating
--- a separate program opening and reading the data from the files.
---
--- The hierarchy of types used in this test can be displayed as follows:
---
--- Account_Type
--- / \
--- / \
--- / \
--- Cash_Account_Type Investment_Account_Type
--- / \
--- / \
--- / \
--- Checking_Account_Type Savings_Account_Type
---
--- APPLICABILITY CRITERIA:
--- Applicable to implementations capable of supporting external
--- Direct_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 08 Nov 95 SAIC Corrected incorrect prefix of 'Tag for ACVC 2.0.1,
--- and mode of files in Procedure Read_Data.
--- Added verification of objects reconstructed from
--- files.
--- 27 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-package CXA9002_0 is
-
- type Investment_Type is (Stocks, Bonds, Mutual_Funds);
- type Savings_Type is (Standard, Business, Impound);
-
- type Account_Type is tagged
- record
- Num : String (1..3);
- end record;
-
- type Cash_Account_Type is new Account_Type with
- record
- Years_As_Customer : Natural := 1;
- end record;
-
- type Investment_Account_Type is new Account_Type with
- record
- Investment_Vehicle : Investment_Type := Stocks;
- end record;
-
- type Checking_Account_Type is new Cash_Account_Type with
- record
- Checks_Per_Year : Positive := 200;
- Interest_Bearing : Boolean := False;
- end record;
-
- type Savings_Account_Type is new Cash_Account_Type with
- record
- Kind : Savings_Type := Standard;
- end record;
-
-end CXA9002_0;
-
----
-
-with Report;
-with Ada.Storage_IO;
-with Ada.Direct_IO;
-with Ada.Tags;
-with CXA9002_0;
-
-procedure CXA9002 is
- package Dir_IO is new Ada.Direct_IO (Integer);
- Test_File : Dir_IO.File_Type;
- Incomplete : exception;
-begin
-
- Report.Test ("CXA9002", "Check that the operations defined in the " &
- "generic package Ada.Storage_IO provide the " &
- "ability to store and retrieve objects of " &
- "tagged types from in-memory buffers");
-
-
- Test_For_Direct_IO_Support:
- begin
-
- -- The following Create does not have any bearing on the test scenario,
- -- but is included to check that the implementation supports Direct_IO
- -- files. An exception on this Create statement will raise a Name_Error
- -- or Use_Error, which will be handled to produce a Not_Applicable
- -- result. If created, the file is immediately deleted, as it is not
- -- needed for the program scenario.
-
- Dir_IO.Create (Test_File,
- Dir_IO.Out_File,
- Report.Legal_File_Name(1));
- exception
-
- when Dir_IO.Use_Error | Dir_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Direct_IO" );
- raise Incomplete;
-
- end Test_for_Direct_IO_Support;
-
- Deletion:
- begin
- Dir_IO.Delete (Test_File);
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Direct_IO" );
- end Deletion;
-
- Test_Block:
- declare
-
- use CXA9002_0;
-
- Acct_Filename : constant String := Report.Legal_File_Name(1);
- Cash_Filename : constant String := Report.Legal_File_Name(2);
- Inv_Filename : constant String := Report.Legal_File_Name(3);
- Chk_Filename : constant String := Report.Legal_File_Name(4);
- Sav_Filename : constant String := Report.Legal_File_Name(5);
-
- type Tag_Pointer_Type is access String;
-
- TC_Account_Type_Tag,
- TC_Cash_Account_Type_Tag,
- TC_Investment_Account_Type_Tag,
- TC_Checking_Account_Type_Tag,
- TC_Savings_Account_Type_Tag : Tag_Pointer_Type;
-
- TC_Account : Account_Type :=
- (Num => "123");
-
- TC_Cash_Account : Cash_Account_Type :=
- (Num => "234",
- Years_As_Customer => 3);
-
- TC_Investment_Account : Investment_Account_Type :=
- (Num => "456",
- Investment_Vehicle => Bonds);
-
- TC_Checking_Account : Checking_Account_Type :=
- (Num => "567",
- Years_As_Customer => 2,
- Checks_Per_Year => 300,
- Interest_Bearing => True);
-
- TC_Savings_Account : Savings_Account_Type :=
- (Num => "789",
- Years_As_Customer => 14,
- Kind => Business);
-
- procedure Buffer_Data is
-
- Account : Account_Type :=
- TC_Account;
- Cash_Account : Cash_Account_Type :=
- TC_Cash_Account;
- Investment_Account : Investment_Account_Type :=
- TC_Investment_Account;
- Checking_Account : Checking_Account_Type :=
- TC_Checking_Account;
- Savings_Account : Savings_Account_Type :=
- TC_Savings_Account;
-
- -- The instantiations below are a central point in this test.
- -- Storage_IO is instantiated for each of the specific tagged
- -- type. These instantiated packages will be used to compress
- -- tagged objects of these various types into buffers that will
- -- be written to the Direct_IO files declared below.
-
- package Acct_SIO is new Ada.Storage_IO (Account_Type);
- package Cash_SIO is new Ada.Storage_IO (Cash_Account_Type);
- package Inv_SIO is new Ada.Storage_IO (Investment_Account_Type);
- package Chk_SIO is new Ada.Storage_IO (Checking_Account_Type);
- package Sav_SIO is new Ada.Storage_IO (Savings_Account_Type);
-
- -- Direct_IO is instantiated for the buffer types defined in the
- -- instantiated Storage_IO packages.
-
- package Acct_DIO is new Ada.Direct_IO (Acct_SIO.Buffer_Type);
- package Cash_DIO is new Ada.Direct_IO (Cash_SIO.Buffer_Type);
- package Inv_DIO is new Ada.Direct_IO (Inv_SIO.Buffer_Type);
- package Chk_DIO is new Ada.Direct_IO (Chk_SIO.Buffer_Type);
- package Sav_DIO is new Ada.Direct_IO (Sav_SIO.Buffer_Type);
-
- Acct_Buffer : Acct_SIO.Buffer_Type;
- Cash_Buffer : Cash_SIO.Buffer_Type;
- Inv_Buffer : Inv_SIO.Buffer_Type;
- Chk_Buffer : Chk_SIO.Buffer_Type;
- Sav_Buffer : Sav_SIO.Buffer_Type;
-
- Acct_File : Acct_DIO.File_Type;
- Cash_File : Cash_DIO.File_Type;
- Inv_File : Inv_DIO.File_Type;
- Chk_File : Chk_DIO.File_Type;
- Sav_File : Sav_DIO.File_Type;
-
- begin
-
- Acct_DIO.Create (Acct_File, Acct_DIO.Out_File, Acct_Filename);
- Cash_DIO.Create (Cash_File, Cash_DIO.Out_File, Cash_Filename);
- Inv_DIO.Create (Inv_File, Inv_DIO.Out_File, Inv_Filename);
- Chk_DIO.Create (Chk_File, Chk_DIO.Out_File, Chk_Filename);
- Sav_DIO.Create (Sav_File, Sav_DIO.Out_File, Sav_Filename);
-
- -- Store the tag values of the objects declared above for
- -- comparison with tag values of objects following processing.
-
- TC_Account_Type_Tag :=
- new String'(Ada.Tags.External_Tag(Account_Type'Tag));
-
- TC_Cash_Account_Type_Tag :=
- new String'(Ada.Tags.External_Tag(Cash_Account_Type'Tag));
-
- TC_Investment_Account_Type_Tag :=
- new String'(Ada.Tags.External_Tag(Investment_Account_Type'Tag));
-
- TC_Checking_Account_Type_Tag :=
- new String'(Ada.Tags.External_Tag(Checking_Account_Type'Tag));
-
- TC_Savings_Account_Type_Tag :=
- new String'(Ada.Tags.External_Tag(Savings_Account_Type'Tag));
-
- -- Prepare tagged data for writing to the Direct_IO files using
- -- Storage_IO procedure to place data in buffers.
-
- Acct_SIO.Write (Buffer => Acct_Buffer, Item => Account);
- Cash_SIO.Write (Cash_Buffer, Cash_Account);
- Inv_SIO.Write (Inv_Buffer, Item => Investment_Account);
- Chk_SIO.Write (Buffer => Chk_Buffer, Item => Checking_Account);
- Sav_SIO.Write (Sav_Buffer, Savings_Account);
-
- -- At this point, the data and associated tag values have been
- -- buffered by the Storage_IO procedure, and the buffered data
- -- can be written to the appropriate Direct_IO file.
-
- Acct_DIO.Write (File => Acct_File, Item => Acct_Buffer);
- Cash_DIO.Write (Cash_File, Cash_Buffer);
- Inv_DIO.Write (Inv_File, Item => Inv_Buffer);
- Chk_DIO.Write (File => Chk_File, Item =>Chk_Buffer);
- Sav_DIO.Write (Sav_File, Sav_Buffer);
-
- -- Close all Direct_IO files.
-
- Acct_DIO.Close (Acct_File);
- Cash_DIO.Close (Cash_File);
- Inv_DIO.Close (Inv_File);
- Chk_DIO.Close (Chk_File);
- Sav_DIO.Close (Sav_File);
-
- exception
- when others => Report.Failed("Exception raised in Buffer_Data");
- end Buffer_Data;
-
- procedure Read_Data is
-
- Account : Account_Type;
- Cash_Account : Cash_Account_Type;
- Investment_Account : Investment_Account_Type;
- Checking_Account : Checking_Account_Type;
- Savings_Account : Savings_Account_Type;
-
- -- Storage_IO is instantiated for each of the specific tagged
- -- type.
-
- package Acct_SIO is new Ada.Storage_IO (Account_Type);
- package Cash_SIO is new Ada.Storage_IO (Cash_Account_Type);
- package Inv_SIO is new Ada.Storage_IO (Investment_Account_Type);
- package Chk_SIO is new Ada.Storage_IO (Checking_Account_Type);
- package Sav_SIO is new Ada.Storage_IO (Savings_Account_Type);
-
- -- Direct_IO is instantiated for the buffer types defined in the
- -- instantiated Storage_IO packages.
-
- package Acct_DIO is new Ada.Direct_IO (Acct_SIO.Buffer_Type);
- package Cash_DIO is new Ada.Direct_IO (Cash_SIO.Buffer_Type);
- package Inv_DIO is new Ada.Direct_IO (Inv_SIO.Buffer_Type);
- package Chk_DIO is new Ada.Direct_IO (Chk_SIO.Buffer_Type);
- package Sav_DIO is new Ada.Direct_IO (Sav_SIO.Buffer_Type);
-
- Acct_Buffer : Acct_SIO.Buffer_Type;
- Cash_Buffer : Cash_SIO.Buffer_Type;
- Inv_Buffer : Inv_SIO.Buffer_Type;
- Chk_Buffer : Chk_SIO.Buffer_Type;
- Sav_Buffer : Sav_SIO.Buffer_Type;
-
- Acct_File : Acct_DIO.File_Type;
- Cash_File : Cash_DIO.File_Type;
- Inv_File : Inv_DIO.File_Type;
- Chk_File : Chk_DIO.File_Type;
- Sav_File : Sav_DIO.File_Type;
-
- begin
-
- -- Open the Direct_IO files.
-
- Acct_DIO.Open (Acct_File, Acct_DIO.In_File, Acct_Filename);
- Cash_DIO.Open (Cash_File, Cash_DIO.In_File, Cash_Filename);
- Inv_DIO.Open (Inv_File, Inv_DIO.In_File, Inv_Filename);
- Chk_DIO.Open (Chk_File, Chk_DIO.In_File, Chk_Filename);
- Sav_DIO.Open (Sav_File, Sav_DIO.In_File, Sav_Filename);
-
- -- Read the buffer data from the files using Direct_IO.
-
- Acct_DIO.Read (File => Acct_File, Item => Acct_Buffer);
- Cash_DIO.Read (Cash_File, Cash_Buffer);
- Inv_DIO.Read (Inv_File, Item => Inv_Buffer);
- Chk_DIO.Read (File => Chk_File, Item =>Chk_Buffer);
- Sav_DIO.Read (Sav_File, Sav_Buffer);
-
- -- At this point, the data and associated tag values are stored
- -- in buffers. Use the Storage_IO procedure Read to recreate the
- -- tagged objects from the buffers.
-
- Acct_SIO.Read (Buffer => Acct_Buffer, Item => Account);
- Cash_SIO.Read (Cash_Buffer, Cash_Account);
- Inv_SIO.Read (Inv_Buffer, Item => Investment_Account);
- Chk_SIO.Read (Buffer => Chk_Buffer, Item => Checking_Account);
- Sav_SIO.Read (Sav_Buffer, Savings_Account);
-
- -- Delete all Direct_IO files.
-
- Acct_DIO.Delete (Acct_File);
- Cash_DIO.Delete (Cash_File);
- Inv_DIO.Delete (Inv_File);
- Chk_DIO.Delete (Chk_File);
- Sav_DIO.Delete (Sav_File);
-
- Data_Verification_Block:
- begin
-
- if Account /= TC_Account then
- Report.Failed("Incorrect Account object reconstructed");
- end if;
-
- if Cash_Account /= TC_Cash_Account then
- Report.Failed
- ("Incorrect Cash_Account object reconstructed");
- end if;
-
- if Investment_Account /= TC_Investment_Account then
- Report.Failed
- ("Incorrect Investment_Account object reconstructed");
- end if;
-
- if Checking_Account /= TC_Checking_Account then
- Report.Failed
- ("Incorrect Checking_Account object reconstructed");
- end if;
-
- if Savings_Account /= TC_Savings_Account then
- Report.Failed
- ("Incorrect Savings_Account object reconstructed");
- end if;
-
- exception
- when others =>
- Report.Failed
- ("Exception raised during Data_Verification Block");
- end Data_Verification_Block;
-
-
- -- To ensure that the tags of the values reconstructed by
- -- Storage_IO were properly preserved, object tag values following
- -- object reconstruction are compared with tag values of objects
- -- stored prior to processing.
-
- Tag_Verification_Block:
- begin
-
- if TC_Account_Type_Tag.all /=
- Ada.Tags.External_Tag(Account_Type'Class(Account)'Tag)
- then
- Report.Failed("Incorrect Account tag");
- end if;
-
- if TC_Cash_Account_Type_Tag.all /=
- Ada.Tags.External_Tag(
- Cash_Account_Type'Class(Cash_Account)'Tag)
- then
- Report.Failed("Incorrect Cash_Account tag");
- end if;
-
- if TC_Investment_Account_Type_Tag.all /=
- Ada.Tags.External_Tag(
- Investment_Account_Type'Class(Investment_Account)'Tag)
- then
- Report.Failed("Incorrect Investment_Account tag");
- end if;
-
- if TC_Checking_Account_Type_Tag.all /=
- Ada.Tags.External_Tag(
- Checking_Account_Type'Class(Checking_Account)'Tag)
- then
- Report.Failed("Incorrect Checking_Account tag");
- end if;
-
- if TC_Savings_Account_Type_Tag.all /=
- Ada.Tags.External_Tag(
- Savings_Account_Type'Class(Savings_Account)'Tag)
- then
- Report.Failed("Incorrect Savings_Account tag");
- end if;
-
- exception
- when others =>
- Report.Failed ("Exception raised during tag evaluation");
- end Tag_Verification_Block;
-
- exception
- when others => Report.Failed ("Exception in Read_Data");
- end Read_Data;
-
- begin -- Test_Block
-
- -- Enter the data into the appropriate files.
- Buffer_Data;
-
- -- Reconstruct the data from files, and verify the results.
- Read_Data;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXA9002;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa001.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa001.a
deleted file mode 100644
index 6c2af987009..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa001.a
+++ /dev/null
@@ -1,279 +0,0 @@
--- CXAA001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the Line_Length and Page_Length maximums for a Text_IO
--- file of mode Append_File are initially zero (unbounded) after a
--- Create, Open, or Reset, and that these values can be modified using
--- the procedures Set_Line_Length and Set_Page_Length.
--- Check that setting the Line_Length and Page_Length attributes to zero
--- results in an unbounded Text_IO file.
--- Check that setting the line length when in Append_Mode doesn't
--- change the length of lines previously written to the Text_IO file.
---
--- TEST DESCRIPTION:
--- This test attempts to simulate a possible text processing environment.
--- String values, from a number of different string types, are written to
--- a Text_IO file. Prior to the writing of each, the line length is set
--- to the particular length of the data being written. In addition, the
--- default line and page lengths are checked, to determine whether they
--- are unbounded (length = 0) following a create, reset, or open of a
--- Text_IO file with mode Append_File.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 27 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA001 is
- use Ada;
- Data_File : Text_IO.File_Type;
- Data_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA001" );
- Incomplete : exception;
-begin
-
- Report.Test ("CXAA001","Check that the Line_Length and Page_Length " &
- "maximums for a Text_IO file of mode Append_File " &
- "are initially zero (unbounded) after a Create, " &
- "Open, or Reset, and that these values can be " &
- "modified using the procedures Set_Line_Length " &
- "and Set_Page_Length");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise an exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Data_File,
- Mode => Text_IO.Append_File,
- Name => Data_Filename);
-
- exception
-
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Append_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Text_IO_Support;
-
- Operational_Test_Block:
- declare
-
- subtype Confidential_Data_Type is string (1 .. 10);
- subtype Secret_Data_Type is string (1 .. 20);
- subtype Top_Secret_Data_Type is string (1 .. 30);
-
- Zero : constant Text_IO.Count := 0;
- Confidential_Data_Size : constant Text_IO.Count := 10;
- Secret_Data_Size : constant Text_IO.Count := 20;
- Top_Secret_Data_Size : constant Text_IO.Count := 30;
-
- -- The following generic procedure is designed to simulate a text
- -- processing environment where line and page sizes are set and
- -- verified prior to the writing of data to a file.
-
- generic
- Data_Size : Text_IO.Count;
- procedure Write_Data_To_File (Data_Item : in String);
-
- procedure Write_Data_To_File (Data_Item : in String) is
- use Text_IO; -- Used to provide visibility to the "/=" operator.
- begin
- if (Text_IO.Line_Length (Data_File) /= Zero) then -- Check default
- Report.Failed("Line not of unbounded length"); -- line length,
- elsif (Text_IO.Page_Length (Data_File) /= Zero) then -- default
- Report.Failed ("Page not of unbounded length"); -- page length.
- end if;
-
- Text_IO.Set_Line_Length (File => Data_File, -- Set the line
- To => Data_Size); -- length.
- Text_IO.Set_Page_Length (File => Data_File, -- Set the page
- To => Data_Size); -- length.
- -- Verify the lengths set.
- if (Integer(Text_IO.Line_Length (Data_File)) /=
- Report.Ident_Int(Integer(Data_Size))) then
- Report.Failed ("Line length not set to appropriate length");
- elsif (Integer(Text_IO.Page_Length (Data_File)) /=
- Report.Ident_Int(Integer(Data_Size))) then
- Report.Failed ("Page length not set to appropriate length");
- end if;
-
- Text_IO.Put_Line (File => Data_File, -- Write data to
- Item => Data_Item); -- file.
-
- end Write_Data_To_File;
-
- -- Instantiation for the three data types/sizes.
-
- procedure Write_Confidential_Data is
- new Write_Data_To_File (Data_Size => Confidential_Data_Size);
-
- procedure Write_Secret_Data is
- new Write_Data_To_File (Data_Size => Secret_Data_Size);
-
- procedure Write_Top_Secret_Data is
- new Write_Data_To_File (Data_Size => Top_Secret_Data_Size);
-
- Confidential_Item : Confidential_Data_Type := "Confidenti";
- Secret_Item : Secret_Data_Type := "Secret Data Values ";
- Top_Secret_Item : Top_Secret_Data_Type :=
- "Extremely Top Secret Data ";
-
- begin
-
- -- The following call simulates processing occurring after the create
- -- of a Text_IO file with mode Append_File.
-
- Write_Confidential_Data (Confidential_Item);
-
- -- The following call simulates processing occurring after the reset
- -- of a Text_IO file with mode Append_File.
-
- Reset1:
- begin
- Text_IO.Reset (Data_File, Text_IO.Append_File); -- Reset to
- -- Append_File mode.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- Write_Secret_Data (Data_Item => Secret_Item);
-
- Text_IO.Close (Data_File); -- Close file.
-
- -- The following processing simulates processing occurring after the
- -- opening of an existing file with mode Append_File.
-
- Text_IO.Open (Data_File, -- Open file in
- Text_IO.Append_File, -- Append_File mode.
- Data_Filename);
-
- Write_Top_Secret_Data (Top_Secret_Item);
-
- Test_Verification_Block:
- declare
- TC_String1,
- TC_String2,
- TC_String3 : String (1..80) := (others => ' ');
- TC_Length1,
- TC_Length2,
- TC_Length3 : Natural := 0;
- begin
-
- Reset2:
- begin
- Text_IO.Reset (Data_File, Text_IO.In_File); -- Reset for reading.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset2;
-
- Text_IO.Get_Line (Data_File, TC_String1, TC_Length1);
- Text_IO.Get_Line (Data_File, TC_String2, TC_Length2);
- Text_IO.Get_Line (Data_File, TC_String3, TC_Length3);
-
- -- Verify that the line lengths of each line were accurate.
- -- Note: Each data line was written to the file after the
- -- particular line length had been set (to the data length).
-
- if not ((TC_Length1 = Natural(Confidential_Data_Size)) and
- (TC_Length2 = Natural(Secret_Data_Size)) and
- (TC_Length3 = Natural(Top_Secret_Data_Size))) then
- Report.Failed ("Inaccurate line lengths read from file");
- end if;
-
- -- Verify that the data read from the file are accurate.
-
- if (TC_String1(1..TC_Length1) /= Confidential_Item) or else
- (TC_String2(1..TC_Length2) /= Secret_Item) or else
- (TC_String3(1..TC_Length3) /= Top_Secret_Item) then
- Report.Failed ("Corrupted data items read from file");
- end if;
-
- exception
-
- when Incomplete =>
- raise;
-
- when others =>
- Report.Failed ("Error raised during data verification");
-
- end Test_Verification_Block;
-
- exception
-
- when Incomplete =>
- raise;
-
- when others =>
- Report.Failed ("Exception raised during Text_IO processing");
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- -- Check that the file is open prior to deleting it.
- if Text_IO.Is_Open(Data_File) then
- Text_IO.Delete(Data_File);
- else
- Text_IO.Open(Data_File, Text_IO.In_File, Data_Filename);
- Text_IO.Delete(Data_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA001;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa002.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa002.a
deleted file mode 100644
index 953d33f1d44..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa002.a
+++ /dev/null
@@ -1,257 +0,0 @@
--- CXAA002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the procedures New_Page, Set_Line, Set_Col, and New_Line
--- subprograms perform properly on a text file created with mode
--- Append_File.
--- Check that the attributes Page, Line, and Column are all set to 1
--- following the creation of a text file with mode Append_File.
--- Check that the functions Page, Line, and Col perform properly on a
--- text file created with mode Append_File.
--- Check that the procedures Put and Put_Line perform properly on text
--- files created with mode Append_File.
--- Check that the procedure Set_Line sets the current line number to
--- the value specified by the parameter "To" for text files created with
--- mode Append_File.
--- Check that the procedure Set_Col sets the current column number to
--- the value specified by the parameter "To" for text files created with
--- mode Append_File.
---
--- TEST DESCRIPTION:
--- This test is designed to simulate the text processing that could
--- occur with files that have been created in Append_File mode. Various
--- calls to Text_IO formatting subprograms are called to properly
--- position text appended to a document. The text content and position
--- are subsequently verified for accuracy.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 27 Feb 97 PWB.CTA Allowed for non-support of some IO operations
-
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA002 is
- use Ada;
- Data_File : Text_IO.File_Type;
- Data_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA002" );
- Incomplete : exception;
-begin
-
- Report.Test ("CXAA002", "Check that page, line, and column formatting " &
- "subprograms perform properly on text files " &
- "created with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise the exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Data_File,
- Mode => Text_IO.Append_File,
- Name => Data_Filename);
-
- exception
-
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Append_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Text_IO_Support;
-
- Operational_Test_Block:
- declare
- Default_Position : constant Text_IO.Positive_Count := 1;
- Section_Header : constant String := "VII. ";
- Appendix_Title : constant String := "Appendix A";
- Appendix_Content : constant String := "TBD";
-
- -- The following procedure simulates the addition of an Appendix page
- -- to an existing text file.
- procedure Position_Appendix_Text is
- use Text_IO; -- To provide visibility to the "/=" operator.
- begin
-
- -- Test control code.
- -- Verify initial page, line, column number.
- if "/="(Text_IO.Page (Data_File), Default_Position) then
- Report.Failed ("Incorrect default page number");
- end if;
- if Text_IO.Line (Data_File) /= Default_Position then
- Report.Failed ("Incorrect default line number");
- end if;
- if "/="(Text_IO.Col (Data_File), Default_Position) then
- Report.Failed ("Incorrect default column number");
- end if;
-
- -- Simulated usage code.
- -- Set new page/line positions.
- Text_IO.Put_Line
- (Data_File, "Add some optional data to the file here");
- Text_IO.New_Page (Data_File);
- Text_IO.New_Line (File => Data_File, Spacing => 2);
-
- -- Test control code.
- if Integer(Text_IO.Page (Data_File)) /= Report.Ident_Int(2) or else
- Integer(Text_IO.Line (Data_File)) /= Report.Ident_Int(3) then
- Report.Failed ("Incorrect results from page/line positioning");
- end if;
-
- -- Simulated usage code.
- Text_IO.Put (Data_File, Section_Header); -- Position title
- Text_IO.Put_Line (Data_File, Appendix_Title); -- of Appendix.
-
- Text_IO.Set_Line (File => Data_File, To => 5); -- Set new
- Text_IO.Set_Col (File => Data_File, To => 8); -- position.
-
- -- Test control code.
- if (Integer(Text_IO.Line (Data_File)) /= Report.Ident_Int(5)) or
- (Integer(Text_IO.Col (Data_File)) /= Report.Ident_Int(8)) then
- Report.Failed ("Incorrect results from line/column positioning");
- end if;
-
- -- Simulated usage code. -- Position
- Text_IO.Put_Line (Data_File, Appendix_Content); -- content of
- -- Appendix.
- end Position_Appendix_Text;
-
- begin
-
- -- This code section simulates a scenario that could occur in a
- -- text processing environment:
- -- A document is created/modified/edited Then...
- -- Text is to be appended to the document.
- -- A procedure is called to perform that operation.
- -- The position on the appended page is set, verified, and text is
- -- appended to the existing file.
- --
- -- Note: The text file has been originally created in Append_File
- -- mode, and has not been closed prior to this processing.
-
- Position_Appendix_Text;
-
- Test_Verification_Block:
- declare
- TC_Page,
- TC_Line,
- TC_Column : Text_IO.Positive_Count;
- TC_Position : Natural := 0;
- Blanks : constant String := " ";
- TC_String : String (1 .. 17) := Blanks;
- begin
-
- Reset1:
- begin
- Text_IO.Reset (Data_File, Text_IO.In_File);
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- Text_IO.Skip_Page (Data_File);
- -- Loop to the third line
- for I in 1 .. 3 loop -- and read the contents.
- Text_IO.Get_Line (Data_File, TC_String, TC_Position);
- end loop;
-
- if (TC_Position /= 16) or else -- Verify the title line.
- (TC_String (1..4) /= "VII.") or else
- (TC_String (3..16) /= ("I. " & Appendix_Title)) then
- Report.Failed ("Incorrect positioning of title line");
- end if;
-
- TC_String := Blanks; -- Clear string.
- -- Loop to the fifth line
- for I in 4 .. 5 loop -- and read the contents.
- Text_IO.Get_Line (Data_File, TC_String, TC_Position);
- end loop;
-
- if (TC_Position /= 10) or -- Verify the contents.
- (TC_String (8..10) /= Appendix_Content) then
- Report.Failed ("Incorrect positioning of contents line");
- end if;
-
- exception
-
- when Incomplete =>
- raise;
-
- when others =>
- Report.Failed ("Error raised during data verification");
-
- end Test_Verification_Block;
-
- exception
-
- when Incomplete =>
- raise;
-
- when others =>
- Report.Failed ("Exception raised during Text_IO processing");
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open(Data_File) then
- Text_IO.Delete(Data_File);
- else
- Text_IO.Open(Data_File, Text_IO.In_File, Data_Filename);
- Text_IO.Delete(Data_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA002;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa003.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa003.a
deleted file mode 100644
index c9580dfb343..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa003.a
+++ /dev/null
@@ -1,293 +0,0 @@
--- CXAA003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the procedures New_Page, Set_Line, Set_Col, and New_Line
--- subprograms perform properly on a text file reset (from Out_File)
--- with mode Append_File.
--- Check that the attributes Page, Line, and Column are all set to 1
--- following the reset of a text file with mode Append_File.
--- Check that the functions Page, Line, and Col perform properly on a
--- text file reset with mode Append_File.
--- Check that the procedures Put and Put_Line perform properly on text
--- files reset with mode Append_File.
--- Check that the procedure Set_Line sets the current line number to
--- the value specified by the parameter "To" for text files reset with
--- mode Append_File. Check that Set_Line has no effect if the specified
--- line equals the current line.
--- Check that the procedure Set_Col sets the current column number to
--- the value specified by the parameter "To" for text files reset with
--- mode Append_File.
---
--- TEST DESCRIPTION:
--- This test is designed to simulate the text processing that could
--- occur with files that have been created in Out_File mode,
--- and then reset to Append_File mode.
--- Various calls to Text_IO formatting subprograms are called to properly
--- position text appended to a document. The text content and position
--- are subsequently verified for accuracy.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 24 Feb 97 PWB.CTA Allowed for non-support of some IO operations.
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA003 is
- use Ada;
- Data_File : Text_IO.File_Type;
- Data_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA003" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA003", "Check that page, line, and column formatting " &
- "subprograms perform properly on text files " &
- "reset with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise the exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Data_File,
- Mode => Text_IO.Out_File,
- Name => Data_Filename);
- exception
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Text files not supported - Create as Out_File" );
- raise Incomplete;
- end Test_for_Text_IO_Support;
-
- Operational_Test_Block:
- declare
-
- Default_Position : constant Text_IO.Positive_Count := 1;
-
- Section_Header : constant String := "IX. ";
- Glossary_Title : constant String := "GLOSSARY";
- Glossary_Content : constant String := "TBD";
-
- -- The following procedure simulates the addition of a Glossary page
- -- to an existing text file that has been reset with mode
- -- Append_File.
-
- procedure Position_Glossary_Text
- (The_File : in out Text_IO.File_Type) is
- use Text_IO; -- To provide visibility to the "/=" operator.
- begin
-
- -- Test control code.
- -- Verify initial page value.
- if (Text_IO.Page (The_File) /= Default_Position) then
- Report.Failed ("Incorrect default page number");
- end if;
- -- Verify initial line number.
- if (Text_IO.Line (The_File) /= Default_Position) then
- Report.Failed ("Incorrect default line number");
- end if;
- -- Verify initial column number.
- if (Text_IO.Col (The_File) /= Default_Position) then
- Report.Failed ("Incorrect default column number");
- end if;
- -- Simulated usage code. Set new page/line positions.
- Text_IO.New_Page (The_File);
- Text_IO.New_Page (The_File);
- Text_IO.New_Line (File => The_File, Spacing => 1);
-
- -- Test control code.
- if (Integer(Text_IO.Page(The_File)) /=
- Report.Ident_Int(3)) or else
- (Integer(Text_IO.Line (The_File)) /=
- Report.Ident_Int(2)) then
- Report.Failed ("Incorrect results from page/line positioning");
- end if;
-
- -- Simulated usage code. Position title of Glossary.
- Text_IO.Put (The_File, Section_Header);
- Text_IO.Put_Line (The_File, Glossary_Title);
- -- Set line to the current line.
- Text_IO.Set_Line (File => The_File, To => 3);
-
- -- Test control code.
- if (Integer(Text_IO.Page (The_File)) /= Report.Ident_Int(3)) or
- (Integer(Text_IO.Line (The_File)) /= Report.Ident_Int(3)) or
- (Integer(Text_IO.Col (The_File)) /= Report.Ident_Int(1)) then
- Report.Failed ("Set_Line failed for current line");
- end if;
-
- -- Simulated usage code.
- Text_IO.Set_Line (File => The_File, To => 4); -- Set new
- Text_IO.Set_Col (File => The_File, To => 10); -- position.
-
- -- Test control code.
- if (Integer(Text_IO.Line (The_File)) /= Report.Ident_Int(4)) or
- (Integer(Text_IO.Col (The_File)) /= Report.Ident_Int(10)) then
- Report.Failed
- ("Incorrect results from line/column positioning");
- end if;
-
- -- Simulated usage code. -- Position
- Text_IO.Put_Line (The_File, Glossary_Content); -- content of
- -- Glossary.
- end Position_Glossary_Text;
-
-
- begin
-
- -- In the scenario, data is added to the file here.
- Text_IO.Put_Line (File => Data_File, Item => "Some optional data");
-
- -- This code section simulates a scenario that could occur in a
- -- text processing environment. Text is to be appended to an
- -- existing document:
- -- The file is reset to append mode.
- -- A procedure is called to perform the positioning and placement
- -- of text.
- -- The position on the appended page is set, verified, and text is
- -- placed in the file.
- --
- -- Note: The text file has been originally created in Out_File
- -- mode, and has subsequently been reset to Append_File mode.
-
- Reset1:
- begin
- -- Reset has effect of calling New_Page.
- Text_IO.Reset (Data_File, Text_IO.Append_File);
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- Position_Glossary_Text (The_File => Data_File);
-
- Test_Verification_Block:
- declare
- TC_Page, TC_Line, TC_Column : Text_IO.Positive_Count;
- TC_Position : Natural := 0;
- Blanks : constant String :=
- " ";
- TC_String : String (1 .. 15) := Blanks;
- begin
- Reset2:
- begin
- Text_IO.Reset (Data_File, Text_IO.In_File);
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset2;
-
- Text_IO.Skip_Page (Data_File);
- Text_IO.Skip_Page (Data_File);
-
- -- If the Reset to Append_File mode actually put a page terminator
- -- on the file, as allowed (but not required) by RM A.10.2(4), then
- -- we are now on page 3, an empty page. We'll need to skip one more.
-
- if Text_IO.End_Of_Page (Data_File) then
- Text_IO.Skip_Page (Data_File);
- end if;
-
- -- Now we're on the Glossary page.
-
- -- Loop to the second line
- for I in 1 .. 2 loop -- and read the contents.
- Text_IO.Get_Line (Data_File, TC_String, TC_Position);
- end loop;
- if (TC_Position /= 13) or else -- Verify the title line.
- (TC_String (1..2) /= "IX") or else
- (TC_String (3..13) /= (". " & Glossary_Title)) then
- Report.Failed ("Incorrect positioning of title line");
- end if;
-
- TC_String := Blanks; -- Clear string.
- -- Loop to the fourth line
- for I in 3 .. 4 loop -- and read the contents.
- Text_IO.Get_Line (Data_File, TC_String, TC_Position);
- end loop;
-
- if (TC_Position /= 12) or -- Verify the contents.
- (TC_String (8..12) /= " " & Glossary_Content) then
- Report.Failed ("Incorrect positioning of contents line");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Error raised during data verification");
-
- end Test_Verification_Block;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception raised during Text_IO processing");
-
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open (Data_File) then
- Text_IO.Delete (Data_File);
- else
- Text_IO.Open (Data_File, Text_IO.In_File, Data_Filename);
- Text_IO.Delete (Data_File);
- end if;
- exception
- when others =>
- Report.Failed ( "Delete not properly implemented for Text_IO" );
- end Final_Block;
-
- Report.Result;
-
- exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA003;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa004.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa004.a
deleted file mode 100644
index f3ea17ebad3..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa004.a
+++ /dev/null
@@ -1,260 +0,0 @@
--- CXAA004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the procedures New_Page, Set_Line, Set_Col, and New_Line
--- perform properly on a text file opened with mode Append_File.
--- Check that the attributes Page, Line, and Column are all set to 1
--- following the opening of a text file with mode Append_File.
--- Check that the functions Page, Line, and Col perform properly on a
--- text file opened with mode Append_File.
--- Check that the procedures Put and Put_Line perform properly on text
--- files opened with mode Append_File.
--- Check that the procedure Set_Line sets the current line number to
--- the value specified by the parameter "To" for text files opened with
--- mode Append_File.
--- Check that the procedure Set_Col sets the current column number to
--- the value specified by the parameter "To" for text files reset with
--- mode Append_File.
---
--- TEST DESCRIPTION:
--- This test is designed to simulate the text processing that could
--- occur with files that have been created in Out_File mode,
--- and then reset to Append_File mode.
--- Various calls to Text_IO formatting subprograms are called to properly
--- position text appended to a document. The text content and position
--- are subsequently verified for accuracy.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 24 Feb 97 PWB.CTA Allowed for non-support of some IO operations.
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA004 is
- use Ada;
- Data_File : Text_IO.File_Type;
- Data_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA004" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA004", "Check that page, line, and column formatting " &
- "subprograms perform properly on text files " &
- "opened with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise the exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Data_File,
- Mode => Text_IO.Out_File,
- Name => Data_Filename);
-
- exception
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create for Text_IO" );
- raise Incomplete;
- end Test_for_Text_IO_Support;
-
- Operational_Test_Block:
- declare
- use Text_IO; -- To provide visibility to the "/=" operator.
-
- Default_Position : constant Text_IO.Positive_Count := 1;
-
- Section_Header : constant String := "X. ";
- Reference_Title : constant String := "REFERENCES";
- Reference_Content : constant String := "Available Upon Request";
-
- begin
-
- -- Some amount of text processing would occur here in the scenario
- -- following file creation, prior to file closure.
- Text_IO.Put_Line (File => Data_File, Item => "Some optional data");
-
- -- Close has the effect of a call to New_Page (adding a page
- -- terminator).
- Text_IO.Close (Data_File);
-
- -- This code section simulates a scenario that could occur in a
- -- text processing environment:
- -- Certain text is to be appended to a document.
- -- The file is opened in Append_File mode.
- -- The position on the appended page is set, verified, and text
- -- is placed in the file.
- --
- -- Note: The text file has been originally created in Out_File
- -- mode, has been subsequently closed and is now being reopened in
- -- Append_File mode for further processing.
-
- Text_IO.Open (Data_File, Text_IO.Append_File, Data_Filename);
-
- -- Test control code.
- if (Text_IO.Page(Data_File) /= Default_Position) then -- Verify init.
- Report.Failed ("Incorrect default page number"); -- page value.
- end if;
- if (Text_IO.Line(Data_File) /= Default_Position) then -- Verify init.
- Report.Failed ("Incorrect default line number"); -- line number.
- end if;
- if (Text_IO.Col (Data_File) /= Default_Position) then -- Verify init.
- Report.Failed ("Incorrect default column number"); -- column no.
- end if;
-
- -- Simulated usage code.
- Text_IO.New_Page (Data_File); -- Set new page/
- Text_IO.New_Line (File => Data_File, Spacing => 2); -- line pos.
- Text_IO.Put (Data_File, Section_Header); -- Position
- Text_IO.Put_Line (Data_File, Reference_Title); -- title.
-
- -- Test control code. -- Verify new
- if (Integer(Text_IO.Page (Data_File)) /= -- page and
- Report.Ident_Int(2)) or else -- line.
- (Integer(Text_IO.Line (Data_File)) /=
- Report.Ident_Int(4)) then
- Report.Failed ("Incorrect results from page/line positioning");
- end if;
-
- -- Simulated usage code.
- Text_IO.Set_Line (File => Data_File, To => 8); -- Set new
- Text_IO.Set_Col (File => Data_File, To => 30); -- position.
- Text_IO.Put_Line (Data_File, Reference_Content);
-
- -- Test control code.
- if (Integer(Text_IO.Line (Data_File)) /=
- Report.Ident_Int(9)) or -- Verify new
- (Integer(Text_IO.Col (Data_File)) /= -- position.
- Report.Ident_Int(1)) then
- Report.Failed ("Incorrect results from line/column positioning");
- end if;
-
- Test_Verification_Block:
- declare
- TC_Page, TC_Line, TC_Column : Text_IO.Positive_Count;
- TC_Position : Natural := 0;
- TC_String : String (1 .. 55) := (others => ' ');
- begin
-
- Reset1:
- begin
- Text_IO.Reset (Data_File, Text_IO.In_File);
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- Text_IO.Skip_Page (Data_File);
-
- -- If the Reset to Append_File mode actually put a page terminator
- -- in the file, as allowed (but not required) by RM A.10.2(4), then
- -- we are now on page 2, an empty page. Therefore, we need to skip
- -- one more page.
-
- if Text_IO.End_Of_Page (Data_File) then
- Text_IO.Skip_Page (Data_File);
- end if;
-
- -- Now we're on the reference page.
-
- -- Loop to the third line
- for I in 1 .. 3 loop -- and read the contents.
- Text_IO.Get_Line (Data_File, TC_String, TC_Position);
- end loop;
-
- if (TC_Position /= 14) or else -- Verify the title line.
- (TC_String (1..6) /= "X. RE") or else
- (TC_String (2..14) /= (". " & Reference_Title)) then
- Report.Failed ("Incorrect positioning of title line");
- end if;
- -- Loop to the eighth line
- for I in 4 .. 8 loop -- and read the contents.
- Text_IO.Get_Line (Data_File, TC_String, TC_Position);
- end loop;
-
- if (TC_Position /= 51) or -- Verify the contents.
- (TC_String (30..51) /= "Available Upon Request") then
- Report.Failed ("Incorrect positioning of contents line");
- end if;
-
- exception
-
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Error raised during data verification");
-
- end Test_Verification_Block;
-
- exception
-
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception raised during Text_IO processing");
-
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open (Data_File) then
- Text_IO.Delete (Data_File);
- else
- Text_IO.Open (Data_File, Text_IO.In_File, Data_Filename);
- Text_IO.Delete (Data_File);
- end if;
- exception
- when others =>
- Report.Failed ( "Delete not properly implemented - Text_IO" );
- end Final_Block;
-
- Report.Result;
-
-exception
-
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ("Unexpected exception");
- Report.Result;
-
-end CXAA004;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa005.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa005.a
deleted file mode 100644
index 7b2a0bc39d3..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa005.a
+++ /dev/null
@@ -1,292 +0,0 @@
--- CXAA005.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the procedure Put, when called with string parameters, does
--- not update the line number of a text file of mode Append_File, when
--- the line length is unbounded (i.e., only the column number is
--- updated).
--- Check that a call to the procedure Put with a null string argument
--- has no measurable effect on a text file of mode Append_File.
---
--- TEST DESCRIPTION:
--- This test is designed to ensure that when a string is appended to an
--- unbounded text file, it is placed following the last element currently
--- in the file. For an unbounded text file written with Put procedures
--- only (not Put_Line), the line number should not be incremented by
--- subsequent calls to Put in Append_File mode. Only the column number
--- should be incremented based on the length of the string parameter
--- placed in the file. If a call to Put with a null string argument is
--- made, no change to the line or column number should occur, and no
--- element(s) should be added to the file, so that there would be no
--- measurable change to the file.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations that support Text_IO
--- processing and external files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 24 Feb 97 CTA.PWB Allowed for non-support of some IO operations.
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA005 is
- An_Unbounded_File : Ada.Text_IO.File_Type;
- Unbounded_File_Name : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA005" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA005", "Check that the procedure Put does not " &
- "increment line numbers when used with " &
- "unbounded text files of mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An application creates a text file in mode Out_File, with the intention
- -- of entering string data packets into the file as appropriate. In the
- -- event that the particular environment where the application is running
- -- does not support Text_IO, Use_Error will be raised on calls to Text_IO
- -- operations.
- -- This exception will be handled to produce a Not_Applicable result.
-
- Ada.Text_IO.Create (File => An_Unbounded_File,
- Mode => Ada.Text_IO.Out_File,
- Name => Unbounded_File_Name);
- exception
- when Ada.Text_IO.Use_Error | Ada.Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create for Text_IO" );
- raise Incomplete;
- end Test_For_Text_IO_Support;
-
- Operational_Test_Block:
- declare
- subtype String_Sequence_Type is string (1 .. 20);
- type String_Pointer_Type is access String_Sequence_Type;
-
--- During the course of processing, the application creates a variety of data
--- pointers that refer to particular data items. The possibility of having
--- null data values in this environment exists.
-
- Data_Packet_1 : String_Pointer_Type :=
- new String_Sequence_Type'("One Data Sequence 01");
-
- Data_Packet_2 : String_Pointer_Type :=
- new String_Sequence_Type'("New Data Sequence 02");
-
- Blank_Data_Packet : String_Pointer_Type :=
- new String_Sequence_Type'(" ");
-
- Null_Data_Packet : constant String := "";
-
- TC_Line, TC_Col : Natural := 0;
-
- function TC_Mode_Selection (Selector : Integer)
- return Ada.Text_IO.File_Mode is
- begin
- case Selector is
- when 1 => return Ada.Text_IO.In_File;
- when 2 => return Ada.Text_IO.Out_File;
- when others => return Ada.Text_IO.Append_File;
- end case;
- end TC_Mode_Selection;
-
- begin
-
--- The application places some data into the file, using the Put subroutine.
--- This operation can occur one-to-many times.
-
- Ada.Text_IO.Put (An_Unbounded_File, Data_Packet_1.all);
-
- -- Test control code.
- if (Integer(Ada.Text_IO.Col (An_Unbounded_File)) /=
- Report.Ident_Int(21)) or
- (Integer(Ada.Text_IO.Line (An_Unbounded_File)) /=
- Report.Ident_Int(1)) then
- Report.Failed ("Incorrect Col position after 1st Put");
- end if;
-
--- The application may close the file at some point following its initial
--- entry of data.
-
- Ada.Text_IO.Close (An_Unbounded_File);
-
--- At some later point in the processing, more data needs to be added to the
--- file, so the application opens the file in Append_File mode.
-
- Ada.Text_IO.Open (File => An_Unbounded_File,
- Mode => Ada.Text_IO.Append_File,
- Name => Unbounded_File_Name);
-
- -- Test control code.
- -- Store line/column number for later comparison.
- TC_Line := Natural(Ada.Text_IO.Line(An_Unbounded_File));
- TC_Col := Natural(Ada.Text_IO.Col(An_Unbounded_File));
-
--- Additional data items can then be appended to the file.
-
- Ada.Text_IO.Put (An_Unbounded_File, Blank_Data_Packet.all);
-
- -- Test control code.
- if (Natural(Ada.Text_IO.Col (An_Unbounded_File)) /=
- (TC_Col + 20)) or
- (Natural(Ada.Text_IO.Line (An_Unbounded_File)) /=
- TC_Line) then
- Report.Failed ("Incorrect Col position after 2nd Put");
- end if;
-
--- In order to accommodate various scenarios, the application may have changed
--- the mode of the data file to In_File in order to retrieve/verify some of
--- the data contained there. However, with the need to place more data into
--- the file, the file can be reset to Append_File mode.
-
- Reset1:
- begin
- Ada.Text_IO.Reset (An_Unbounded_File,
- TC_Mode_Selection (Report.Ident_Int(3)));
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- -- Test control code.
- -- Store line/column number for later comparison.
- TC_Line := Natural(Ada.Text_IO.Line(An_Unbounded_File));
- TC_Col := Natural(Ada.Text_IO.Col(An_Unbounded_File));
-
--- Additional data can then be appended to the file. On some occasions, an
--- attempt to enter a null string value into the file may occur. This should
--- have no effect on the file, leaving it unchanged.
-
- -- No measurable effect from Put with null string.
- Ada.Text_IO.Put (An_Unbounded_File, Null_Data_Packet);
-
- -- Test control code.
- -- There should be no change following the Put above.
- if (Natural(Ada.Text_IO.Col (An_Unbounded_File)) /=
- TC_Col) or
- (Natural(Ada.Text_IO.Line (An_Unbounded_File)) /=
- TC_Line) then
- Report.Failed ("Incorrect Col position after 3rd Put");
- end if;
-
--- Additional data can be appended to the file.
-
- Ada.Text_IO.Put (An_Unbounded_File, Data_Packet_2.all);
-
- -- Test control code.
- if (Natural(Ada.Text_IO.Col (An_Unbounded_File)) /=
- (TC_Col + 20)) or
- (Integer(Ada.Text_IO.Line (An_Unbounded_File)) /=
- TC_Line) then
- Report.Failed ("Incorrect Col position after 4th Put");
- end if;
-
- Test_Verification_Block:
- declare
- File_Data : String (1 .. 80);
- TC_Width : Natural;
- begin
-
--- The application has the capability to reset the file to In_File mode to
--- verify some of the data that is contained there.
-
- Reset2:
- begin
- Ada.Text_IO.Reset (An_Unbounded_File, Ada.Text_IO.In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported - Text_IO" );
- raise Incomplete;
- end Reset2;
-
- Ada.Text_IO.Get_Line (An_Unbounded_File,
- File_Data,
- TC_Width);
-
- -- Test control code.
- -- Since it is implementation defined whether a page
- -- terminator separates preexisting text from new text
- -- following an open in append mode (as occurred above),
- -- verify only that the first data item written to the
- -- file was not overwritten by any subsequent call to Put.
-
- if (File_Data (File_Data'First) /= 'O') or
- (File_Data (20) /= '1') then
- Report.Failed ("Data placed incorrectly in file");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Error raised during data verification");
- end Test_Verification_Block;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception in Text_IO processing");
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Ada.Text_IO.Is_Open(An_Unbounded_File) then
- Ada.Text_IO.Delete (An_Unbounded_File);
- else
- Ada.Text_IO.Open(An_Unbounded_File,
- Ada.Text_IO.In_File,
- Unbounded_File_Name);
- Ada.Text_IO.Delete (An_Unbounded_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented -- Text_IO" );
- end Final_Block;
-
- Report.Result;
-
-exception
-
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA005;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa006.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa006.a
deleted file mode 100644
index 518d43b896e..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa006.a
+++ /dev/null
@@ -1,285 +0,0 @@
--- CXAA006.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that for a bounded line length text file of mode Append_File,
--- when the number of characters to be output exceeds the number of
--- columns remaining on the current line, a call to Put will output
--- characters of the string sufficient to fill the remaining columns of
--- the line (up to line length), then output a line terminator, reset the
--- column number, increment the line number, then output the balance of
--- the item.
---
--- Check that the procedure Put does not raise Layout_Error when the
--- number of characters to be output exceeds the line length of a bounded
--- text file of mode Append_File.
---
--- TEST DESCRIPTION:
--- This test demonstrates the situation where an application intends to
--- output variable length string elements to a text file in the most
--- efficient manner possible. This is the case in a typesetting
--- environment where text is compressed and split between lines of a
--- bounded length.
---
--- The procedure Put will break string parameters placed in the file at
--- the point of the line length. Two examples are demonstrated in this
--- test, one being the case where only one column remains on a line, and
--- the other being the case where a larger portion of the line remains
--- unfilled, but still not sufficient to contain the entire output
--- string.
---
--- During the course of the test, the file is reset to Append_File mode,
--- and the bounded line length is modified for different lines of the
--- file.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations that support Text_IO
--- processing and external files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA006 is
-
- A_Bounded_File : Ada.Text_IO.File_Type;
- Bounded_File_Name : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA006" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA006", "Check that procedure Put will correctly " &
- "output string items to a bounded line " &
- "length text file of mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
--- An application creates a text file in mode Append_File, with the intention
--- of using the procedure Put to compress variable length string data into the
--- file in the most efficient manner possible.
-
- Ada.Text_IO.Create (File => A_Bounded_File,
- Mode => Ada.Text_IO.Append_File,
- Name => Bounded_File_Name);
- exception
- when Ada.Text_IO.Use_Error | Ada.Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create with Append_File for Text_IO" );
- raise Incomplete;
- end Test_For_Text_IO_Support;
-
- Operational_Test_Block:
- declare
- Twelve_Characters : constant String := "12Characters";
- Nineteen_Characters : constant String := "Nineteen_Characters";
- TC_Line : Natural := 0;
-
- function TC_Mode_Selection (Selector : Integer)
- return Ada.Text_IO.File_Mode is
- begin
- case Selector is
- when 1 => return Ada.Text_IO.In_File;
- when 2 => return Ada.Text_IO.Out_File;
- when others => return Ada.Text_IO.Append_File;
- end case;
- end TC_Mode_Selection;
-
- begin
-
--- The application sets the line length of the file to be bound at 20. All
--- lines in this file will be limited to that length.
-
- Ada.Text_IO.Set_Line_Length (A_Bounded_File, 20);
-
- Ada.Text_IO.Put (A_Bounded_File, Nineteen_Characters);
-
- -- Test control code.
- if (Integer(Ada.Text_IO.Line (A_Bounded_File)) /=
- Report.Ident_Int(1)) or
- (Integer(Ada.Text_IO.Col (A_Bounded_File)) /=
- Report.Ident_Int(20)) then
- Report.Failed ("Incorrect position after 1st Put");
- end if;
-
--- The application finds that there is only one column available on the
--- current line, so the next string item to be output must be broken at
--- the appropriate place (following the first character).
-
- Ada.Text_IO.Put (File => A_Bounded_File,
- Item => Twelve_Characters);
-
- -- Test control code.
- if (Integer(Ada.Text_IO.Line (A_Bounded_File)) /=
- Report.Ident_Int(2)) or
- (Integer(Ada.Text_IO.Col (A_Bounded_File)) /=
- Report.Ident_Int(12)) then
- Report.Failed ("Incorrect position after 2nd Put");
- end if;
-
--- The application subsequently modifies the processing, resetting the file
--- at this point to In_File mode in order to verify data that has been written
--- to the file. Following this, the application resets the file to Append_File
--- mode in order to continue the placement of data into the file, but modifies
--- the original bounded line length for subsequent lines to be appended.
-
- -- Reset to Append mode; call outputs page terminator and
- -- resets line length to Unbounded.
- Reset1:
- begin
- Ada.Text_IO.Reset (A_Bounded_File,
- TC_Mode_Selection (Report.Ident_Int(3)));
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- Ada.Text_IO.Set_Line_Length (A_Bounded_File, 15);
-
- -- Store line number for later comparison.
- TC_Line := Natural(Ada.Text_IO.Line(A_Bounded_File));
-
--- The application finds that fifteen columns are available on the current
--- line but that the string item to be output exceeds this available space.
--- It must be split at the end of the line, and the balance placed on the
--- next file line.
-
- Ada.Text_IO.Put (File => A_Bounded_File,
- Item => Nineteen_Characters);
-
- -- Test control code.
- -- Positioned on new line at col 5.
- if (Natural(Ada.Text_IO.Line (A_Bounded_File)) /=
- (TC_Line + 1)) or
- (Integer(Ada.Text_IO.Col (A_Bounded_File)) /=
- Report.Ident_Int(5)) then
- Report.Failed ("Incorrect position after 3rd Put");
- end if;
-
-
- Test_Verification_Block:
- declare
- First_String : String (1 .. 80);
- Second_String : String (1 .. 80);
- Third_String : String (1 .. 80);
- Fourth_String : String (1 .. 80);
- TC_Width1 : Natural;
- TC_Width2 : Natural;
- TC_Width3 : Natural;
- TC_Width4 : Natural;
- begin
-
--- The application has the capability to reset the file to In_File mode to
--- verify some or all of the data that is contained there.
-
- Reset2:
- begin
- Ada.Text_IO.Reset (A_Bounded_File, Ada.Text_IO.In_File);
- exception
- when others =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset2;
-
- Ada.Text_IO.Get_Line
- (A_Bounded_File, First_String, TC_Width1);
- Ada.Text_IO.Get_Line
- (A_Bounded_File, Second_String, TC_Width2);
- Ada.Text_IO.Get_Line
- (A_Bounded_File, Third_String, TC_Width3);
- Ada.Text_IO.Get_Line
- (A_Bounded_File, Fourth_String, TC_Width4);
-
- -- Test control code.
- if (First_String (1..TC_Width1) /= Nineteen_Characters & "1") or
- (Second_String (1..TC_Width2) /= "2Characters") or
- (Third_String (1..TC_Width3) /=
- Nineteen_Characters(1..15)) or
- (Fourth_String (1..TC_Width4) /= "ters")
- then
- Report.Failed ("Data placed incorrectly in file");
- end if;
-
- exception
-
- when Incomplete =>
- raise;
-
- when Ada.Text_IO.End_Error =>
- Report.Failed ("Incorrect number of lines in file");
-
- when others =>
- Report.Failed ("Error raised during data verification");
-
- end Test_Verification_Block;
-
- exception
-
- when Ada.Text_IO.Layout_Error =>
- Report.Failed ("Layout Error raised when positioning text");
-
- when others =>
- Report.Failed ("Exception in Text_IO processing");
-
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Ada.Text_IO.Is_Open(A_Bounded_File) then
- Ada.Text_IO.Delete (A_Bounded_File);
- else
- Ada.Text_IO.Open (A_Bounded_File,
- Ada.Text_IO.In_File,
- Bounded_File_Name);
- Ada.Text_IO.Delete (A_Bounded_File);
- end if;
-
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
- end Final_Block;
-
- Report.Result;
-
-exception
-
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA006;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa007.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa007.a
deleted file mode 100644
index fe79c2d7a86..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa007.a
+++ /dev/null
@@ -1,263 +0,0 @@
--- CXAA007.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the capabilities of Text_IO.Integer_IO perform correctly
--- on files of Append_File mode, for instantiations with integer and
--- user-defined subtypes.
--- Check that the formatting parameters available in the package can
--- be used and modified successfully in the storage and retrieval of
--- data.
---
--- TEST DESCRIPTION:
--- This test simulates a receiving department inventory system. Data on
--- items received is entered into an inventory database. This information
--- consists of integer entry number, item number, and bar code.
--- One item is placed into the inventory file immediately following file
--- creation, subsequent items are entered following file opening in
--- Append_File mode. Data items are validated by reading all data from
--- the file and comparing against known values (those used to enter the
--- data originally).
---
--- This test verifies issues of create in Append_File mode, appending to
--- a file previously appended to, opening in Append_File mode, resetting
--- from Append_File mode to In_File mode, as well as a variety of Text_IO
--- and Integer_IO predefined subprograms.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA007 is
- use Ada;
-
- Inventory_File : Text_IO.File_Type;
- Inventory_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA007" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA007", "Check that the capabilities of " &
- "Text_IO.Integer_IO operate correctly for files " &
- "with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise the exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Inventory_File,
- Mode => Text_IO.Append_File,
- Name => Inventory_Filename);
- exception
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create with Append_File for Text_IO" );
- raise Incomplete;
- end Test_for_Text_IO_Support;
-
- Operational_Test_Block:
- declare
-
- Max_Entries_Per_Order : constant Natural := 4;
-
- type Bar_Code_Type is range 0 .. 127; -- Values to be stored as base
- -- two numbers in file.
- type Item_Type is record
- Entry_Number : Natural := 0;
- Item_Number : Integer := 0;
- Bar_Code : Bar_Code_Type := 0;
- end record;
-
- type Inventory_Type is
- array (1 .. Max_Entries_Per_Order) of Item_Type;
-
- Inventory_List : Inventory_Type := ((1, 119, 87), -- Items received
- (2, 206, 44), -- this order.
- (3, -25, 126),
- (4, -18, 31));
-
- Daily_Order : constant := 1;
- Entry_Field_Width : constant Natural := 1;
- Item_Base : constant Natural := 16;
- Items_Inventoried : Natural := 1;
- Items_To_Inventory : Natural := 4;
-
- package Entry_IO is new Text_IO.Integer_IO (Natural);
- package Item_IO is new Text_IO.Integer_IO (Integer);
- package Bar_Code_IO is new Text_IO.Integer_IO (Bar_Code_Type);
-
-
- -- The following procedure simulates the addition of inventory item
- -- information into a data file.
-
- procedure Update_Inventory (The_Item : in Item_Type) is
- Spacer : constant String := " ";
- begin
- -- Enter all the incoming data into the inventory file.
- Entry_IO.Put (Inventory_File, The_Item.Entry_Number);
- Text_IO.Put (Inventory_File, Spacer);
- Item_IO.Put (Inventory_File, The_Item.Item_Number);
- Text_IO.Put (Inventory_File, Spacer);
- Bar_Code_IO.Put(File => Inventory_File,
- Item => The_Item.Bar_Code,
- Width => 13,
- Base => 2);
- Text_IO.New_Line(Inventory_File);
- end Update_Inventory;
-
-
- begin
-
- -- This code section simulates a receiving department maintaining a
- -- data file containing information on items that have been ordered
- -- and received.
- --
- -- As new orders are received, the file is opened in Append_File
- -- mode.
- -- Data is taken from the inventory list and entered into the file,
- -- in specific format.
- -- Enter the order into the inventory file. This is item 1 in
- -- the inventory list.
- -- The data entry process can be repeated numerous times as required.
-
- Entry_IO.Put (Inventory_File,
- Inventory_List(Daily_Order).Entry_Number);
- Item_IO.Put (Inventory_File,
- Inventory_List(Daily_Order).Item_Number);
- Bar_Code_IO.Put (File => Inventory_File,
- Item => Inventory_List(Daily_Order).Bar_Code);
- Text_IO.New_Line (Inventory_File);
-
- Text_IO.Close (Inventory_File);
-
-
- Entry_IO.Default_Width := Entry_Field_Width; -- Modify the default
- -- width of Entry_IO.
- Item_IO.Default_Base := Item_Base; -- Modify the default
- -- number base of
- -- Item_IO
- Text_IO.Open (Inventory_File,
- Text_IO.Append_File, -- Open in Append mode.
- Inventory_Filename);
- -- Enter items
- while (Items_Inventoried < Items_To_Inventory) loop -- 2-4 into the
- Items_Inventoried := Items_Inventoried + 1; -- inventory file.
- Update_Inventory (The_Item => Inventory_List (Items_Inventoried));
- end loop;
-
- Test_Verification_Block: -- Read and check
- declare -- all the data
- TC_Entry : Natural; -- values that
- TC_Item : Integer; -- have been
- TC_Bar_Code : Bar_Code_Type; -- entered in the
- TC_Item_Count : Natural := 0; -- data file.
- begin
-
- Reset1:
- begin
- Text_IO.Reset (Inventory_File, Text_IO.In_File); -- Reset for
- -- reading.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to mode In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- while not Text_IO.End_Of_File (Inventory_File) loop
- Entry_IO.Get (Inventory_File, TC_Entry);
- Item_IO.Get (Inventory_File, TC_Item);
- Bar_Code_IO.Get (Inventory_File, TC_Bar_Code);
- Text_IO.Skip_Line (Inventory_File);
- TC_Item_Count := TC_Item_Count + 1;
-
- if (TC_Item /= Inventory_List(TC_Entry).Item_Number) or
- (TC_Bar_Code /= Inventory_List(TC_Entry).Bar_Code) then
- Report.Failed ("Error in integer data read from file");
- end if;
- end loop;
-
- if (TC_Item_Count /= Max_Entries_Per_Order) then
- Report.Failed ("Incorrect number of records read from file");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Error raised during data verification");
- end Test_Verification_Block;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception in Text_IO.Integer_IO processing");
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open(Inventory_File) then
- Text_IO.Delete (Inventory_File);
- else
- Text_IO.Open (Inventory_File, Text_IO.In_File, Inventory_Filename);
- Text_IO.Delete (Inventory_File);
- end if;
-
- exception
-
- when others =>
- Report.Failed ( "Delete not properly implemented for Text_IO" );
-
- end Final_Block;
-
- Report.Result;
-
-exception
-
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA007;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa008.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa008.a
deleted file mode 100644
index c21d07ea9ac..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa008.a
+++ /dev/null
@@ -1,271 +0,0 @@
--- CXAA008.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the capabilities provided in instantiations of the
--- Ada.Text_IO.Fixed_IO package operate correctly when the mode of
--- the file is Append_File. Check that Fixed_IO procedures Put and Get
--- properly transfer fixed point data to/from data files that are in
--- Append_File mode. Check that the formatting parameters available in
--- the package can be used and modified successfully in the appending and
--- retrieval of data.
---
--- TEST DESCRIPTION:
--- This test simulates order processing, with data values being written
--- to a file, in a specific format, using Fixed_IO. Validation is done
--- on this process by reading the data values from the file, and
--- comparing them for equality with the values originally written to
--- the file.
---
--- This test verifies issues of create in Append_File mode, appending to
--- a file previously appended to, resetting to Append_File mode,
--- resetting from Append_File mode to In_File mode, as well as a
--- variety of Text_IO and Fixed_IO predefined subprograms.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA008 is
- use Ada;
-
- Inventory_File : Text_IO.File_Type;
- Inventory_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA008" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA008", "Check that the capabilities of " &
- "Text_IO.Fixed_IO operate correctly for files " &
- "with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise the exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Inventory_File,
- Mode => Text_IO.Append_File,
- Name => Inventory_Filename);
-
- exception
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create with Append_File for Text_IO" );
- raise Incomplete;
- end Test_For_Text_IO_Support;
-
- Operational_Test_Block:
- declare
-
- Daily_Orders_Received : constant Natural := 4;
-
- type Item_Type is delta 0.1 range 0.0 .. 5000.0;
- type Cost_Type is delta 0.01 range 0.0 .. 10_000.0;
- type Profit_Type is delta 0.01 range -100.0 .. 1000.0;
-
- type Product_Type is record
- Item_Number : Item_Type := 0.0;
- Unit_Cost : Cost_Type := 0.00;
- Percent_Markup : Profit_Type := 0.00;
- end record;
-
- type Inventory_Type is
- array (1 .. Daily_Orders_Received) of Product_Type;
-
- Daily_Inventory : Inventory_Type := (( 1.0, 1.75, 50.00),
- ( 155.0, 20.00, -5.50),
- (3343.5, 2.50, 126.50),
- (4986.0, 180.00, 31.75));
-
- package Item_IO is new Text_IO.Fixed_IO (Item_Type);
- package Cost_IO is new Text_IO.Fixed_IO (Cost_Type);
- package Markup_IO is new Text_IO.Fixed_IO (Profit_Type);
-
-
- function TC_Mode_Selection (Selector : Integer)
- return Text_IO.File_Mode is
- begin
- case Selector is
- when 1 => return Text_IO.In_File;
- when 2 => return Text_IO.Out_File;
- when others => return Text_IO.Append_File;
- end case;
- end TC_Mode_Selection;
-
-
- -- The following function simulates the addition of inventory item
- -- information into a data file. Boolean status of True is returned
- -- if all of the data entry was successful, False otherwise.
-
- function Update_Inventory (The_List : Inventory_Type)
- return Boolean is
- begin
- for I in 1 .. Daily_Orders_Received loop
- Item_IO.Put (Inventory_File, The_List(I).Item_Number);
- Cost_IO.Put (Inventory_File, The_List(I).Unit_Cost, 10, 4, 0);
- Markup_IO.Put(File => Inventory_File,
- Item => The_List(I).Percent_Markup,
- Fore => 6,
- Aft => 3,
- Exp => 2);
- Text_IO.New_Line (Inventory_File);
- end loop;
- return (True); -- Return a Status value.
- exception
- when others => return False;
- end Update_Inventory;
-
-
- begin
-
- -- This code section simulates a receiving department maintaining a
- -- data file containing information on items that have been ordered
- -- and received.
-
- -- Whenever items are received, the file is reset to Append_File
- -- mode. Data is taken from an inventory list and entered into the
- -- file, in specific format.
-
- Reset1:
- begin -- Reset to
- Text_IO.Reset (Inventory_File, -- Append mode.
- TC_Mode_Selection (Report.Ident_Int(3)));
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO" );
- end Reset1;
-
- -- Enter data.
- if not Update_Inventory (The_List => Daily_Inventory) then
- Report.Failed ("Exception occurred during inventory update");
- raise Incomplete;
- end if;
-
- Test_Verification_Block:
- declare
- TC_Item : Item_Type;
- TC_Cost : Cost_Type;
- TC_Markup : Profit_Type;
- TC_Item_Count : Natural := 0;
- begin
-
- Reset2:
- begin
- Text_IO.Reset (Inventory_File, Text_IO.In_File); -- Reset for
- -- reading.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset2;
-
- while not Text_IO.End_Of_File (Inventory_File) loop
- Item_IO.Get (Inventory_File, TC_Item);
- Cost_IO.Get (Inventory_File, TC_Cost);
- Markup_IO.Get (File => Inventory_File,
- Item => TC_Markup,
- Width => 0);
- Text_IO.Skip_Line (Inventory_File);
- TC_Item_Count := TC_Item_Count + 1;
-
- -- Verify all of the data fields read from the file. Compare
- -- with the values that were originally entered into the file.
-
- if (TC_Item /= Daily_Inventory(TC_Item_Count).Item_Number) then
- Report.Failed ("Error in Item_Number read from file");
- end if;
- if (TC_Cost /= Daily_Inventory(TC_Item_Count).Unit_Cost) then
- Report.Failed ("Error in Unit_Cost read from file");
- end if;
- if not (TC_Markup =
- Daily_Inventory(TC_Item_Count).Percent_Markup) then
- Report.Failed ("Error in Percent_Markup read from file");
- end if;
-
- end loop;
-
- if (TC_Item_Count /= Daily_Orders_Received) then
- Report.Failed ("Incorrect number of records read from file");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Error raised during data verification");
- end Test_Verification_Block;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception in Text_IO.Fixed_IO processing");
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open (Inventory_File) then
- Text_IO.Delete (Inventory_File);
- else
- Text_IO.Open (Inventory_File, Text_IO.In_File, Inventory_Filename);
- Text_IO.Delete (Inventory_File);
- end if;
-
- exception
-
- when others =>
- Report.Failed ( "Delete not properly implemented for Text_IO" );
-
- end Final_Block;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA008;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa009.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa009.a
deleted file mode 100644
index d478060808a..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa009.a
+++ /dev/null
@@ -1,290 +0,0 @@
--- CXAA009.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the capabilities provided in instantiations of the
--- Ada.Text_IO.Float_IO package operate correctly when the mode of
--- the file is Append_File. Check that Float_IO procedures Put and Get
--- properly transfer floating point data to/from data files that are in
--- Append_File mode. Check that the formatting parameters available in
--- the package can be used and modified successfully in the appending and
--- retrieval of data.
---
--- TEST DESCRIPTION:
--- This test is designed to simulate an environment where a data file
--- that holds floating point information is created, written to, and
--- closed. In the future, the file can be reopened in Append_File mode,
--- additional data can be appended to it, and then closed. This process
--- of Open/Append/Close can be repeated as necessary. All data written
--- to the file is verified for accuracy when retrieved from the file.
---
--- This test verifies issues of create in Append_File mode, appending to
--- a file previously appended to, opening in Append_File mode, resetting
--- from Append_File mode to In_File mode, as well as a variety of Text_IO
--- and Float_IO predefined subprograms.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA009 is
-
- use Ada;
- Loan_File : Text_IO.File_Type;
- Loan_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA009" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA009", "Check that the capabilities of " &
- "Text_IO.Float_IO operate correctly for files " &
- "with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise the exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Loan_File, -- Create in
- Mode => Text_IO.Out_File, -- Out_File mode.
- Name => Loan_Filename);
-
- exception
-
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Text_IO_Support;
-
- Operational_Test_Block:
- declare
- Total_Loans_Outstanding : constant Natural := 3;
- Transaction_Status : Boolean := False;
-
- type Account_Balance_Type is digits 6 range 0.0 .. 1.0E6;
- type Loan_Balance_Type is digits 6;
- type Interest_Rate_Type is digits 4 range 0.0 .. 30.00;
-
- type Loan_Info_Type is record
- Account_Balance : Account_Balance_Type := 0.00;
- Loan_Balance : Loan_Balance_Type := 0.00;
- Loan_Interest_Rate : Interest_Rate_Type := 0.00;
- end record;
-
- Home_Refinance_Loan : Loan_Info_Type :=
- (14_500.00, 135_000.00, 6.875);
- Line_Of_Credit_Loan : Loan_Info_Type :=
- ( 5490.00, -3000.00, 13.75);
- Small_Business_Loan : Loan_Info_Type :=
- (Account_Balance => 45_000.00,
- Loan_Balance => 10_500.00,
- Loan_Interest_Rate => 5.875);
-
- package Acct_IO is new Text_IO.Float_IO (Account_Balance_Type);
- package Loan_IO is new Text_IO.Float_IO (Loan_Balance_Type);
- package Rate_IO is new Text_IO.Float_IO (Interest_Rate_Type);
-
-
- -- The following procedure performs the addition of loan information
- -- into a data file. Boolean status of True is returned if all of
- -- the data entry was successful, False otherwise.
- -- This demonstrates use of Float_IO using a variety of data formats.
-
- procedure Update_Loan_Info (The_File : in out Text_IO.File_Type;
- The_Loan : in Loan_Info_Type;
- Status : out Boolean ) is
- begin
- Acct_IO.Put (The_File, The_Loan.Account_Balance);
- Loan_IO.Put (The_File, The_Loan.Loan_Balance, 15, 2, 0);
- Rate_IO.Put (File => The_File,
- Item => The_Loan.Loan_Interest_Rate,
- Fore => 6,
- Aft => 3,
- Exp => 0);
- Text_IO.New_Line (The_File);
- Status := True;
- exception
- when others => Status := False;
- end Update_Loan_Info;
-
-
- begin
-
- -- This code section simulates a bank maintaining a data file
- -- containing information on loans that have been made.
- -- The scenario:
- -- The loan file was created in Out_File mode.
- -- Some number of data records are added.
- -- The file is closed.
- -- The file is subsequently reopened in Append_File mode.
- -- Data is appended to the file.
- -- The file is closed.
- -- Repeat the Open/Append/Close process as required.
- -- Verify data in the file.
- -- etc.
-
- Update_Loan_Info(Loan_File, Home_Refinance_Loan, Transaction_Status);
-
- if not Transaction_Status then
- Report.Failed ("Failure in update of first loan data");
- end if;
-
- Text_IO.Close (Loan_File);
-
- -- When subsequent data items are to be added to the file, the file
- -- is opened in Append_File mode.
-
- Text_IO.Open (Loan_File, -- Open with
- Text_IO.Append_File, -- Append mode.
- Loan_Filename);
-
- Update_Loan_Info(Loan_File, Line_Of_Credit_Loan, Transaction_Status);
-
- if not Transaction_Status then
- Report.Failed("Failure in update of first loan data");
- end if;
-
- Text_IO.Close(Loan_File);
-
- -- To add additional data to the file, the file
- -- is again opened in Append_File mode (appending to a file
- -- previously appended to).
-
- Text_IO.Open (Loan_File, -- Open with
- Text_IO.Append_File, -- Append mode.
- Loan_Filename);
-
- Update_Loan_Info(Loan_File, Small_Business_Loan, Transaction_Status);
-
- if not Transaction_Status then
- Report.Failed("Failure in update of first loan data");
- end if;
-
- Test_Verification_Block:
- declare
- type Ledger_Type is
- array (1 .. Total_Loans_Outstanding) of Loan_Info_Type;
- TC_Bank_Ledger : Ledger_Type;
- TC_Item_Count : Natural := 0;
- begin
-
- Reset1:
- begin
- Text_IO.Reset (Loan_File, Text_IO.In_File); -- Reset for
- -- reading.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- while not Text_IO.End_Of_File (Loan_File) loop
- TC_Item_Count := TC_Item_Count + 1;
- Acct_IO.Get (Loan_File,
- TC_Bank_Ledger(TC_Item_Count).Account_Balance);
- Loan_IO.Get (Loan_File,
- TC_Bank_Ledger(TC_Item_Count).Loan_Balance,
- 0);
- Rate_IO.Get(File => Loan_File,
- Item =>
- TC_Bank_Ledger(TC_Item_Count).Loan_Interest_Rate,
- Width => 0);
- Text_IO.Skip_Line(Loan_File);
-
- end loop;
-
- -- Verify all of the data fields read from the file. Compare
- -- with the values that were originally entered into the file.
-
- if (TC_Bank_Ledger(1) /= Home_Refinance_Loan) or
- (TC_Bank_Ledger(2) /= Line_Of_Credit_Loan) or
- (TC_Bank_Ledger(3) /= Small_Business_Loan) then
- Report.Failed("Error in data read from file");
- end if;
-
- if (TC_Item_Count /= Total_Loans_Outstanding) then
- Report.Failed ("Incorrect number of records read from file");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Error raised during data verification");
- end Test_Verification_Block;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception in Text_IO.Float_IO processing");
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open(Loan_File) then
- Text_IO.Delete(Loan_File);
- else
- Text_IO.Open(Loan_File, Text_IO.In_File, Loan_Filename);
- Text_IO.Delete(Loan_File);
- end if;
-
- exception
-
- when Text_IO.Use_Error =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
-
- end Final_Block;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA009;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa010.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa010.a
deleted file mode 100644
index 5678aee6bcf..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa010.a
+++ /dev/null
@@ -1,335 +0,0 @@
--- CXAA010.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the operations defined in package Ada.Text_IO.Decimal_IO
--- are available, and that they function correctly when used for the
--- input/output of Decimal types.
---
--- TEST DESCRIPTION:
--- This test demonstrates the Put and Get procedures found in the
--- generic package Ada.Text_IO.Decimal_IO. Both Put and Get are
--- overloaded to allow placement or extraction of decimal values
--- to/from a text file or a string. This test demonstrates both forms
--- of each subprogram.
--- The test defines an array of records containing decimal value
--- and string component fields. All component values are placed in a
--- Text_IO file, with the decimal values being placed there using the
--- version of Put defined for files, and using user-specified formatting
--- parameters. The data is later extracted from the file, with the
--- decimal values being removed using the version of Get defined for
--- files. Decimal values are then written to strings, using the
--- appropriate Put procedure. Finally, extraction of the decimal data
--- from the strings completes the evaluation of the Decimal_IO package
--- subprograms.
--- The reconstructed data is verified at the end of the test against the
--- data originally written to the file.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all implementations capable of supporting external
--- Text_IO files and Decimal Fixed Point Types
---
--- All implementations must attempt to compile this test.
---
--- For implementations validating against Information Systems Annex (F):
--- this test must execute and report PASSED.
---
--- For implementations not validating against Annex F:
--- this test may report compile time errors at one or more points
--- indicated by "-- ANX-F RQMT", in which case it may be graded as inapplicable.
--- Otherwise, the test must execute and report PASSED.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 20 Feb 95 SAIC Modified test to allow for Use_Error/Name_Error
--- generation by an implementation not supporting
--- Text_IO operations.
--- 14 Nov 95 SAIC Corrected string indexing for ACVC 2.0.1.
--- 27 Feb 97 PWB.CTA Allowed for non-support of some IO operations
--- 16 FEB 98 EDS Modified documentation.
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA010 is
- use Ada.Text_IO;
- Tax_Roll : Ada.Text_IO.File_Type;
- Tax_Roll_Name : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA010" );
- Incomplete : exception;
-begin
-
- Report.Test ("CXAA010", "Check that the operations defined in package " &
- "Ada.Text_IO.Decimal_IO are available, and " &
- "that they function correctly when used for " &
- "the input/output of Decimal types");
-
- Test_for_Decimal_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO creation or naming
- -- of external files in a particular environment will raise Use_Error
- -- or Name_Error on a call to Text_IO Create. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. Either of these exceptions will be
- -- handled to produce a Not_Applicable result.
-
- Ada.Text_IO.Create (Tax_Roll, Ada.Text_IO.Out_File, Tax_Roll_Name);
-
- exception
-
- when Ada.Text_IO.Use_Error | Ada.Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Decimal_IO_Support;
-
- Taxation:
- declare
-
- ID_Length : constant := 5;
- Price_String_Length : constant := 5;
- Value_String_Length : constant := 6;
- Total_String_Length : constant := 20;
- Spacer : constant String := " "; -- Two blanks.
-
- type Price_Type is delta 0.1 digits 4; -- ANX-F RQMT
- type Value_Type is delta 0.01 digits 5; -- ANX-F RQMT
-
- type Property_Type is
- record
- Parcel_ID : String (1..ID_Length);
- Purchase_Price : Price_Type;
- Assessed_Value : Value_Type;
- end record;
-
- type City_Block_Type is array (1..4) of Property_Type;
-
- subtype Tax_Bill_Type is string (1..Total_String_Length);
- type Tax_Bill_Array_Type is array (1..4) of Tax_Bill_Type;
-
- Neighborhood : City_Block_Type :=
- (("X9254", 123.0, 135.00), ("X3569", 345.0, 140.50),
- ("X3434", 234.0, 179.50), ("X8838", 456.0, 158.00));
-
- Neighborhood_Taxes : Tax_Bill_Array_Type;
-
- package Price_IO is new Ada.Text_IO.Decimal_IO (Price_Type);
- package Value_IO is new Ada.Text_IO.Decimal_IO (Value_Type);
-
- begin -- Taxation
-
- Assessors_Office:
- begin
-
- for Parcel in City_Block_Type'Range loop
- -- Note: All data in the file will be separated with a
- -- two-character blank spacer.
- Ada.Text_IO.Put(Tax_Roll, Neighborhood(Parcel).Parcel_ID);
- Ada.Text_IO.Put(Tax_Roll, Spacer);
-
- -- Use Decimal_IO.Put with non-default format parameters to
- -- place decimal data into file.
- Price_IO.Put (Tax_Roll, Neighborhood(Parcel).Purchase_Price,
- Fore => 3, Aft =>1, Exp => 0);
- Ada.Text_IO.Put(Tax_Roll, Spacer);
-
- Value_IO.Put (Tax_Roll, Neighborhood(Parcel).Assessed_Value,
- Fore => 3, Aft =>2, Exp => 0);
- Ada.Text_IO.New_Line(Tax_Roll);
- end loop;
-
- Ada.Text_IO.Close (Tax_Roll);
-
- exception
- when others =>
- Report.Failed ("Exception raised in Assessor's Office");
- end Assessors_Office;
-
-
- Twice_A_Year:
- declare
-
- procedure Collect_Tax(Index : in Integer;
- Tax_Array : in out Tax_Bill_Array_Type) is
- ID : String (1..ID_Length);
- Price : Price_Type := 0.0;
- Value : Value_Type := 0.00;
- Price_String : String (1..Price_String_Length);
- Value_String : String (1..Value_String_Length);
- begin
-
- -- Extract information from the Text_IO file; one string, two
- -- decimal values.
- -- Note that the Spacers that were put in the file above are
- -- not individually read here, due to the fact that each call
- -- to Decimal_IO.Get below uses a zero in the Width field,
- -- which allows each Get procedure to skip these leading blanks
- -- prior to extracting the numeric value.
-
- Ada.Text_IO.Get (Tax_Roll, ID);
-
- -- A zero value of Width is provided, so the following
- -- two calls to Decimal_IO.Get will skip the leading blanks,
- -- (from the Spacer variable above), then read the numeric
- -- literals.
-
- Price_IO.Get (Tax_Roll, Price, 0);
- Value_IO.Get (Tax_Roll, Value, 0);
- Ada.Text_IO.Skip_Line (Tax_Roll);
-
- -- Convert the values read from the file into string format,
- -- using user-specified format parameters.
- -- Format of the Price_String should be "nnn.n"
- -- Format of the Value_String should be "nnn.nn"
-
- Price_IO.Put (To => Price_String,
- Item => Price,
- Aft => 1);
- Value_IO.Put (Value_String, Value, 2);
-
- -- Construct a string of length 20 that contains the Parcel_ID,
- -- the Purchase_Price, and the Assessed_Value, separated by
- -- two-character blank data spacers. Store this string
- -- into the string array out parameter.
- -- Format of each Tax_Array element should be
- -- "Xnnnn nnn.n nnn.nn" (with an 'n' signifying a digit).
-
- Tax_Array(Index) := ID & Spacer &
- Price_String & Spacer &
- Value_String;
- exception
- when Data_Error =>
- Report.Failed("Data Error raised during the extraction " &
- "of decimal data from the file");
- when others =>
- Report.Failed("Exception in Collect_Tax procedure");
- end Collect_Tax;
-
-
- begin -- Twice_A_Year
-
- Ada.Text_IO.Open (Tax_Roll, Ada.Text_IO.In_File, Tax_Roll_Name);
-
- -- Determine property tax bills for the entire neighborhood from
- -- the information that is stored in the file. Store information
- -- in the Neighborhood_Taxes string array.
-
- for Parcel in City_Block_Type'Range loop
- Collect_Tax (Parcel, Neighborhood_Taxes);
- end loop;
-
- exception
- when others =>
- Report.Failed ("Exception in Twice_A_Year Block");
- end Twice_A_Year;
-
- -- Use Decimal_IO Get procedure to extract information from a string.
- -- Verify data against original values.
- Validation_Block:
- declare
- TC_ID : String (1..ID_Length); -- 1..5
- TC_Price : Price_Type;
- TC_Value : Value_Type;
- Length : Positive;
- Front,
- Rear : Integer := 0;
- begin
-
- for Parcel in City_Block_Type'Range loop
- -- Extract values from the strings of the string array.
- -- Each element of the string array is 20 characters long; the
- -- first five characters are the Parcel_ID, two blank characters
- -- separate data, the next five characters contain the Price
- -- decimal value, two blank characters separate data, the last
- -- six characters contain the Value decimal value.
- -- Extract each of these components in turn.
-
- Front := 1; -- 1
- Rear := ID_Length; -- 5
- TC_ID := Neighborhood_Taxes(Parcel)(Front..Rear);
-
- -- Extract the decimal value from the next slice of the string.
- Front := Rear + 3; -- 8
- Rear := Front + Price_String_Length - 1; -- 12
- Price_IO.Get (Neighborhood_Taxes(Parcel)(Front..Rear),
- Item => TC_Price,
- Last => Length);
-
- -- Extract next decimal value from slice of string, based on
- -- length of preceding strings read from string array element.
- Front := Rear + 3; -- 15
- Rear := Total_String_Length; -- 20
- Value_IO.Get (Neighborhood_Taxes(Parcel)(Front..Rear),
- Item => TC_Value,
- Last => Length);
-
- if TC_ID /= Neighborhood(Parcel).Parcel_ID or
- TC_Price /= Neighborhood(Parcel).Purchase_Price or
- TC_Value /= Neighborhood(Parcel).Assessed_Value
- then
- Report.Failed ("Incorrect data validation");
- end if;
-
- end loop;
-
- exception
- when others => Report.Failed ("Exception in Validation Block");
- end Validation_Block;
-
- -- Check that the Text_IO file is open, then delete.
-
- if not Ada.Text_IO.Is_Open (Tax_Roll) then
- Report.Failed ("File not left open after processing");
- Ada.Text_IO.Open (Tax_Roll, Ada.Text_IO.Out_File, Tax_Roll_Name);
- end if;
-
- Ada.Text_IO.Delete (Tax_Roll);
-
- exception
- when others =>
- Report.Failed ("Exception in Taxation block");
- -- Check that the Text_IO file is open, then delete.
- if not Ada.Text_IO.Is_Open (Tax_Roll) then
- Ada.Text_IO.Open (Tax_Roll,
- Ada.Text_IO.Out_File,
- Tax_Roll_Name);
- end if;
- Ada.Text_IO.Delete (Tax_Roll);
- end Taxation;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA010;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa011.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa011.a
deleted file mode 100644
index 8cc136d35ab..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa011.a
+++ /dev/null
@@ -1,266 +0,0 @@
--- CXAA011.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the operations of Text_IO.Enumeration_IO perform correctly
--- on files of Append_File mode, for instantiations using
--- enumeration types. Check that Enumeration_IO procedures Put and Get
--- properly transfer enumeration data to/from data files.
--- Check that the formatting parameters available in the package can
--- be used and modified successfully in the storage and retrieval of data.
---
--- TEST DESCRIPTION:
--- This test is designed to simulate an environment where a data file
--- that holds enumeration type information is reset from it current mode
--- to allow the appending of data to the end of the This process
--- of Reset/Write can be repeated as necessary. All data written
--- to the file is verified for accuracy when retrieved from the file.
---
--- This test verifies issues of resetting a file created in Out_File mode
--- to Append_File mode, resetting from Append_File mode to In_File mode,
--- as well as a variety of Text_IO and Enumeration_IO predefined
--- subprograms.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA011 is
- use Ada;
-
- Status_Log : Text_IO.File_Type;
- Status_Log_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA011" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA011", "Check that the operations of " &
- "Text_IO.Enumeration_IO operate correctly for " &
- "files with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- An implementation that does not support Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Text_IO operations. This block statement encloses a call to
- -- Create, which should raise the exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Text_IO.Create (File => Status_Log,
- Mode => Text_IO.Out_File,
- Name => Status_Log_Filename);
- exception
-
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Text_IO_Support;
-
-
- Operational_Test_Block:
- declare
-
- type Days_In_Week is (Monday, Tuesday, Wednesday, Thursday, Friday,
- Saturday, Sunday);
- type Hours_In_Day is (A0000, A0600, P1200, P0600); -- Six hour
- -- blocks.
- type Status_Type is (Operational, Off_Line);
-
- type Status_Record_Type is record
- Day : Days_In_Week;
- Hour : Hours_In_Day;
- Status : Status_Type;
- end record;
-
- Morning_Reading : Status_Record_Type :=
- (Wednesday, A0600, Operational);
- Evening_Reading : Status_Record_Type :=
- (Saturday, P0600, Off_Line);
-
- package Day_IO is new Text_IO.Enumeration_IO (Days_In_Week);
- package Hours_IO is new Text_IO.Enumeration_IO (Hours_In_Day);
- package Status_IO is new Text_IO.Enumeration_IO (Status_Type);
-
-
- -- The following function simulates the hourly recording of equipment
- -- status.
-
- function Record_Status (Reading : Status_Record_Type)
- return Boolean is
- use Text_IO; -- To provide visibility to type Type_Set and
- -- enumeration literal Upper_Case.
- begin
- Day_IO.Put (File => Status_Log,
- Item => Reading.Day,
- Set => Type_Set'(Upper_Case));
- Hours_IO.Put (Status_Log, Reading.Hour, 7);
- Status_IO.Put (Status_Log, Reading.Status,
- Width => 8, Set => Lower_Case);
- Text_IO.New_Line (Status_Log);
- return (True);
- exception
- when others => return False;
- end Record_Status;
-
- begin
-
- -- The usage scenario intended is as follows:
- -- File is created.
- -- Unrelated/unknown file processing occurs.
- -- On six hour intervals, file is reset to Append_File mode.
- -- Data is appended to file.
- -- Unrelated/unknown file processing resumes.
- -- Reset/Append process is repeated.
-
- Reset1:
- begin
- Text_IO.Reset (Status_Log, -- Reset to
- Text_IO.Append_File); -- Append mode.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- Day_IO.Default_Width := Days_In_Week'Width + 5; -- Default values
- -- are modifiable.
-
- if not Record_Status (Morning_Reading) then -- Enter data.
- Report.Failed ("Exception occurred during data file update");
- end if;
-
- Reset2:
- begin
- Text_IO.Reset (Status_Log, -- Reset to
- Text_IO.Append_File); -- Append mode.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO" );
- raise Incomplete;
- end Reset2;
-
- if not Record_Status (Evening_Reading) then -- Enter data.
- Report.Failed ("Exception occurred during data file update");
- end if;
-
- Test_Verification_Block:
- declare
- TC_Reading1 : Status_Record_Type;
- TC_Reading2 : Status_Record_Type;
- begin
-
- Reset3:
- begin
- Text_IO.Reset (Status_Log, Text_IO.In_File); -- Reset for
- -- reading.
- exception
- when Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset3;
-
- Day_IO.Get (Status_Log, TC_Reading1.Day); -- Read data from
- Hours_IO.Get (Status_Log, TC_Reading1.Hour); -- first record.
- Status_IO.Get (Status_Log, TC_Reading1.Status);
- Text_IO.Skip_Line (Status_Log);
-
- -- Verify the data read from the file. Compare with the
- -- record that was originally entered into the file.
-
- if (TC_Reading1 /= Morning_Reading) then
- Report.Failed ("Data error on reading first record");
- end if;
-
- Day_IO.Get (Status_Log, TC_Reading2.Day); -- Read data from
- Hours_IO.Get (Status_Log, TC_Reading2.Hour); -- second record.
- Status_IO.Get (Status_Log, TC_Reading2.Status);
- Text_IO.Skip_Line (Status_Log);
-
- -- Verify all of the data fields read from the file. Compare
- -- with the values that were originally entered into the file.
-
- if (TC_Reading2.Day /= Evening_Reading.Day) or
- (TC_Reading2.Hour /= Evening_Reading.Hour) or
- (TC_Reading2.Status /= Evening_Reading.Status) then
- Report.Failed ("Data error on reading second record");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Error raised during data verification");
- end Test_Verification_Block;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception in Text_IO.Enumeration_IO processing");
- end Operational_Test_Block;
-
- Final_Block:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open (Status_Log) then
- Text_IO.Delete (Status_Log);
- else
- Text_IO.Open (Status_Log, Text_IO.Out_File, Status_Log_Filename);
- Text_IO.Delete (Status_Log);
- end if;
- exception
- when Text_IO.Use_Error =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
-
- end Final_Block;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA011;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa012.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa012.a
deleted file mode 100644
index 07523b44170..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa012.a
+++ /dev/null
@@ -1,167 +0,0 @@
--- CXAA012.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the exception Mode_Error is raised when an attempt is made
--- to read from (perform a Get_Line) or use the predefined End_Of_File
--- function on a text file with mode Append_File.
---
--- TEST DESCRIPTION:
--- A scenario is created that demonstrates the potential for the
--- incorrect usage of predefined text processing subprograms, resulting
--- from their use with files of the wrong Mode. This results in the
--- raising of Mode_Error exceptions, which is handled within blocks
--- embedded in the test.
--- A count is kept to ensure that each anticipated exception is in fact
--- raised and handled properly.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 27 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA012 is
- use Ada;
- Text_File : Text_IO.File_Type;
- Text_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA012" );
- Incomplete : exception;
-begin
-
- Report.Test ("CXAA012", "Check that the exception Mode_Error is " &
- "raised when an attempt is made to read " &
- "from (perform a Get_Line) or use the " &
- "predefined End_Of_File function on a " &
- "text file with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
- -- Use_Error or Name_Error will be raised if Text_IO operations
- -- or external files are not supported.
-
- Text_IO.Create (Text_File, Text_IO.Out_File, Text_Filename);
-
- exception
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Text_IO" );
- raise Incomplete;
- end Test_for_Text_IO_Support;
-
- -- The application writes some amount of data to the file.
-
- Text_IO.Put_Line (Text_File, "Data entered into the file");
-
- Text_IO.Close (Text_File);
-
- Operational_Test_Block:
- declare
- TC_Number_Of_Forced_Mode_Errors : constant Natural := 2;
- TC_Mode_Errors : Natural := 0;
- begin
-
- Text_IO.Open (Text_File, Text_IO.Append_File, Text_Filename);
-
- Test_for_Reading:
- declare
- TC_Data : String (1..80);
- TC_Length : Natural := 0;
- begin
-
--- During the course of its processing, the application may become confused
--- and erroneously attempt to read data from the file that is currently in
--- Append_File mode (instead of the anticipated In_File mode).
--- This would result in the raising of Mode_Error.
-
- Text_IO.Get_Line (Text_File, TC_Data, TC_Length);
- Report.Failed ("Exception not raised by Get_Line");
-
--- An exception handler present within the application handles the exception
--- and processing can continue.
-
- exception
- when Text_IO.Mode_Error =>
- TC_Mode_Errors := TC_Mode_Errors + 1;
- when others =>
- Report.Failed ("Exception in Get_Line processing");
- end Test_for_Reading;
-
-
- Test_for_End_Of_File:
- declare
- TC_End_Of_File : Boolean;
- begin
-
--- Again, during the course of its processing, the application attempts to
--- call the End_Of_File function for the file that is currently in
--- Append_File mode (instead of the anticipated In_File mode).
-
- TC_End_Of_File := Text_IO.End_Of_File (Text_File);
- Report.Failed ("Exception not raised by End_Of_File");
-
--- Once again, an exception handler present within the application handles
--- the exception and processing continues.
-
- exception
- when Text_IO.Mode_Error =>
- TC_Mode_Errors := TC_Mode_Errors + 1;
- when others =>
- Report.Failed("Exception in End_Of_File processing");
- end Test_for_End_Of_File;
-
-
- if (TC_Mode_Errors /= TC_Number_Of_Forced_Mode_Errors) then
- Report.Failed ("Incorrect number of exceptions handled");
- end if;
-
- end Operational_Test_Block;
-
- -- Delete the external file.
- if Text_IO.Is_Open (Text_File) then
- Text_IO.Delete (Text_File);
- else
- Text_IO.Open (Text_File, Text_IO.In_File, Text_Filename);
- Text_IO.Delete (Text_File);
- end if;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA012;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa013.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa013.a
deleted file mode 100644
index be658ca13e0..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa013.a
+++ /dev/null
@@ -1,167 +0,0 @@
--- CXAA013.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the exception Mode_Error is raised when an attempt is made
--- to skip a line or page using the predefined Skip_Line and Skip_Page
--- procedures on a text file with mode Append_File.
---
--- TEST DESCRIPTION:
--- A scenario is created that demonstrates the potential for the
--- incorrect usage of predefined text processing subprograms, which
--- results in the raising of a Mode_Error exception.
--- A count is kept to ensure that each anticipated exception is in fact
--- raised and handled properly.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 28 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA013 is
- use Ada;
- Text_File : Text_IO.File_Type;
- Text_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA013" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA013", "Check that the exception Mode_Error is " &
- "raised when an attempt is made to skip " &
- "a line or page using the predefined " &
- "Skip_Line and Skip_Page procedures on " &
- "a text file with mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
--- An application creates a text file with mode Append_File.
--- Use_Error will be raised if Text_IO operations or external files are not
--- supported.
-
- Text_IO.Create (Text_File, Text_IO.Append_File, Text_Filename);
-
- exception
-
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Append_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Text_IO_Support;
-
--- The application writes some amount of data to the file.
-
- Text_IO.Put_Line (Text_File, "Data entered into the file");
-
- Operational_Test_Block:
- declare
- TC_Number_Of_Forced_Mode_Errors : constant Natural := 2;
- TC_Mode_Errors : Natural := 0;
- begin
-
- Test_for_Skip_Line:
- declare
- TC_Spacing : constant Text_IO.Count := 3;
- begin
-
--- During the course of its processing, the application may attempt to
--- invoke the Skip_Line procedure on a file that is currently in Append_File
--- mode (instead of the anticipated In_File mode). This results in the
--- raising of Mode_Error.
-
- Text_IO.Skip_Line (Text_File, TC_Spacing);
- Report.Failed ("Exception not raised by Skip_Line");
-
--- An exception handler present within the application handles the exception
--- and processing can continue.
-
- exception
- when Text_IO.Mode_Error =>
- TC_Mode_Errors := TC_Mode_Errors + 1;
- when others =>
- Report.Failed("Exception in Skip_Line processing");
- end Test_for_Skip_Line;
-
- Test_for_Skip_Page:
- begin
-
--- Again, during the course of its processing, the application incorrectly
--- assumes that the file mode is In_File, this time attempting to call the
--- Skip_Page procedure for the file (that is currently in Append_File mode).
-
- Text_IO.Skip_Page (Text_File);
- Report.Failed ("Exception not raised by Skip_Page");
-
--- Once again, an exception handler present within the application handles
--- the exception and processing continues.
-
- exception
- when Text_IO.Mode_Error =>
- TC_Mode_Errors := TC_Mode_Errors + 1;
- when others =>
- Report.Failed("Exception in Skip_Page processing");
- end Test_for_Skip_Page;
-
- if (TC_Mode_Errors /= TC_Number_Of_Forced_Mode_Errors) then
- Report.Failed ("Incorrect number of exceptions handled");
- end if;
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open (Text_File) then
- Text_IO.Delete (Text_File);
- else
- Text_IO.Open (Text_File, Text_IO.In_File, Text_Filename);
- Text_IO.Delete (Text_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA013;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa014.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa014.a
deleted file mode 100644
index 0b74c616959..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa014.a
+++ /dev/null
@@ -1,178 +0,0 @@
--- CXAA014.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the exception Mode_Error is raised when an attempt is made
--- to check for the end of a line or page using the predefined functions
--- End_Of_Line or End_Of_Page on a text file with mode Append_File.
---
--- TEST DESCRIPTION:
--- A scenario is created that demonstrates the potential for the
--- incorrect usage of predefined text processing subprograms, which
--- results in the raising of a Mode_Error exception.
--- A count is kept to ensure that each anticipated exception is in fact
--- raised and handled properly.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 28 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA014 is
- use Ada;
- Text_File : Text_IO.File_Type;
- Text_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA014" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA014", "Check that the exception Mode_Error is " &
- "raised when an attempt is made to check " &
- "for the end of a line or page using the " &
- "predefined functions End_Of_Line or " &
- "End_Of_Page on a text file with mode " &
- "Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
--- Use_Error will be raised if Text_IO operations or external files are not
--- supported.
-
- Text_IO.Create (Text_File, Text_IO.Out_File, Text_Filename);
-
- exception
-
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Text_IO_Support;
-
-
--- The application writes some amount of data to the file.
-
- for I in 1 .. 10 loop
- Text_IO.Put_Line (Text_File, "Data entered into the file");
- end loop;
-
- Text_IO.Close (Text_File);
-
- Operational_Test_Block:
- declare
- TC_Number_Of_Forced_Mode_Errors : constant Natural := 2;
- TC_Mode_Errors : Natural := 0;
- begin
-
- Text_IO.Open (Text_File, Text_IO.Append_File, Text_Filename);
-
- Test_for_End_Of_Line:
- declare
- TC_End_Of_Line : Boolean;
- begin
-
--- During the course of its processing, the application may attempt to
--- invoke the End_Of_Line function on a file that is currently in Append_File
--- mode (instead of the anticipated In_File mode). This results in the
--- raising of Mode_Error.
-
- TC_End_Of_Line := Text_IO.End_Of_Line (Text_File);
- Report.Failed ("Exception not raised by End_Of_Line");
-
--- An exception handler present within the application handles the exception
--- and processing can continue.
-
- exception
- when Text_IO.Mode_Error =>
- TC_Mode_Errors := TC_Mode_Errors + 1;
- when others =>
- Report.Failed("Exception in End_Of_Line processing");
- end Test_for_End_Of_Line;
-
-
- Test_for_End_Of_Page:
- declare
- TC_End_Of_Page : Boolean;
- begin
-
--- Again, during the course of its processing, the application incorrectly
--- assumes that the file mode is In_File, this time attempting to call the
--- End_Of_Page function for the file (that is currently in Append_File mode).
-
- TC_End_Of_Page := Text_IO.End_Of_Page (Text_File);
- Report.Failed ("Exception not raised by End_Of_Page");
-
--- Once again, an exception handler present within the application handles
--- the exception and processing continues.
-
- exception
- when Text_IO.Mode_Error =>
- TC_Mode_Errors := TC_Mode_Errors + 1;
- when others =>
- Report.Failed("Exception in End_Of_Page processing");
- end Test_for_End_Of_Page;
-
-
- if (TC_Mode_Errors /= TC_Number_Of_Forced_Mode_Errors) then
- Report.Failed ("Incorrect number of exceptions handled");
- end if;
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open (Text_File) then
- Text_IO.Delete (Text_File);
- else
- Text_IO.Open (Text_File, Text_IO.In_File, Text_Filename);
- Text_IO.Delete (Text_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA014;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa015.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa015.a
deleted file mode 100644
index 919ef05ca7e..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa015.a
+++ /dev/null
@@ -1,227 +0,0 @@
--- CXAA015.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the exception Status_Error is raised when an attempt is
--- made to create or open a file in Append_File mode when the file is
--- already open.
--- Check that the exception Name_Error is raised by procedure Open when
--- attempting to open a file in Append_File mode when the name supplied
--- as the filename does not correspond to an existing external file.
---
--- TEST DESCRIPTION:
--- A scenario is created that demonstrates the potential for the
--- inappropriate usage of text processing subprograms Create and Open,
--- resulting in the raising of Status_Error and Name_Error exceptions.
--- A count is kept to ensure that each anticipated exception is in fact
--- raised and handled properly.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support text
--- files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 28 Feb 97 PWB.CTA Allowed for non-support of some IO operations
---!
-
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA015 is
- use Ada;
- Text_File : Text_IO.File_Type;
- Text_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAA015" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAA015", "Check that the appropriate exceptions " &
- "are raised when procedures Create and " &
- "Open are used to inappropriately operate " &
- "on files of mode Append_File");
-
- Test_for_Text_IO_Support:
- begin
-
--- An application creates a text file with mode Append_File.
--- Use_Error will be raised if Text_IO operations or external files are not
--- supported.
-
- Text_IO.Create (Text_File, Text_IO.Append_File, Text_Filename);
- exception
-
- when Text_IO.Use_Error | Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Append_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_Text_IO_Support;
-
-
--- The application writes some amount of data to the file.
-
- for I in 1 .. 5 loop
- Text_IO.Put_Line (Text_File, "Data entered into the file");
- end loop;
-
- Operational_Test_Block:
- declare
- TC_Number_Of_Forced_Errors : constant Natural := 3;
- TC_Errors : Natural := 0;
- begin
-
-
- Test_for_Create:
- begin
-
--- During the course of its processing, the application may (erroneously)
--- attempt to create the same file already in existence in Append_File mode.
--- This results in the raising of Status_Error.
-
- Text_IO.Create (Text_File,
- Text_IO.Append_File,
- Text_Filename);
- Report.Failed ("Exception not raised by Create");
-
--- An exception handler present within the application handles the exception
--- and processing can continue.
-
- exception
- when Text_IO.Status_Error =>
- TC_Errors := TC_Errors + 1;
- when others =>
- Report.Failed("Exception in Create processing");
- end Test_for_Create;
-
-
- First_Test_For_Open:
- begin
-
--- Again, during the course of its processing, the application incorrectly
--- attempts to Open a file (in Append_File mode) that is already open.
-
- Text_IO.Open (Text_File, Text_IO.Append_File, Text_Filename);
- Report.Failed ("Exception not raised by improper Open - 1");
-
--- Once again, an exception handler present within the application handles
--- the exception and processing continues.
-
- exception
- when Text_IO.Status_Error =>
- TC_Errors := TC_Errors + 1;
-
--- At some point in its processing, the application closes the file that is
--- currently open.
-
- Text_IO.Close (Text_File);
- when others =>
- Report.Failed("Exception in Open processing - 1");
- end First_Test_For_Open;
-
-
- Open_With_Wrong_Filename:
- declare
- TC_Wrong_Filename : constant String :=
- Report.Legal_File_Name(2);
- begin
-
--- At this point, the application attempts to Open (in Append_File mode) the
--- file used in previous processing, but it attempts this Open using a name
--- string that does not correspond to any existing external file.
--- First make sure the file doesn't exist. (If it did, then the check
--- for open in append mode wouldn't work.)
-
- Verify_No_File:
- begin
- Text_IO.Open (Text_File,
- Text_IO.In_File,
- TC_Wrong_Filename);
- exception
- when Text_IO.Name_Error =>
- null;
- when others =>
- Report.Failed ( "Unexpected exception on Open check" );
- end Verify_No_File;
-
- Delete_No_File:
- begin
- if Text_IO.Is_Open (Text_File) then
- Text_IO.Delete (Text_File);
- end if;
- exception
- when others =>
- Report.Failed ( "Unexpected exception - Delete check" );
- end Delete_No_File;
-
- Text_IO.Open (Text_File,
- Text_IO.Append_File,
- TC_Wrong_Filename);
- Report.Failed ("Exception not raised by improper Open - 2");
-
--- An exception handler for the Name_Error, present within the application,
--- catches the exception and processing continues.
-
- exception
- when Text_IO.Name_Error =>
- TC_Errors := TC_Errors + 1;
- when others =>
- Report.Failed("Exception in Open processing - 2");
- end Open_With_Wrong_Filename;
-
-
- if (TC_Errors /= TC_Number_Of_Forced_Errors) then
- Report.Failed ("Incorrect number of exceptions handled");
- end if;
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- -- Delete the external file.
- if Text_IO.Is_Open (Text_File) then
- Text_IO.Delete (Text_File);
- else
- Text_IO.Open (Text_File, Text_IO.In_File, Text_Filename);
- Text_IO.Delete (Text_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAA015;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa016.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa016.a
deleted file mode 100644
index 8ae69a12664..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa016.a
+++ /dev/null
@@ -1,462 +0,0 @@
--- CXAA016.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the type File_Access is available in Ada.Text_IO, and that
--- objects of this type designate File_Type objects.
--- Check that function Set_Error will set the current default error file.
--- Check that versions of Ada.Text_IO functions Standard_Input,
--- Standard_Output, Standard_Error return File_Access values designating
--- the standard system input, output, and error files.
--- Check that versions of Ada.Text_IO functions Current_Input,
--- Current_Output, Current_Error return File_Access values designating
--- the current system input, output, and error files.
---
--- TEST DESCRIPTION:
--- This test tests the use of File_Access objects in referring
--- to File_Type objects, as well as several new functions that return
--- File_Access objects as results.
--- Four user-defined files are created. These files will be set to
--- function as current system input, output, and error files.
--- Data will be read from and written to these files during the
--- time at which they function as the current system files.
--- An array of File_Access objects will be defined. It will be
--- initialized using functions that return File_Access objects
--- referencing the Standard and Current Input, Output, and Error files.
--- This "saves" the initial system environment, which will be modified
--- to use the user-defined files as the current default Input, Output,
--- and Error files. At the end of the test, the data in this array
--- will be used to restore the initial system environment.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to implementations capable of supporting
--- external Text_IO files.
---
---
--- CHANGE HISTORY:
--- 25 May 95 SAIC Initial prerelease version.
--- 22 Apr 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 26 Feb 97 PWB.CTA Allowed for non-support of some IO operations.
--- 18 Jan 99 RLB Repaired to allow Not_Applicable systems to
--- fail delete.
---!
-
-with Ada.Text_IO;
-package CXAA016_0 is
- New_Input_File,
- New_Output_File,
- New_Error_File_1,
- New_Error_File_2 : aliased Ada.Text_IO.File_Type;
-end CXAA016_0;
-
-
-with Report;
-with Ada.Exceptions;
-with Ada.Text_IO; use Ada.Text_IO;
-with CXAA016_0; use CXAA016_0;
-
-procedure CXAA016 is
-
- Non_Applicable_System : exception;
- No_Reset : exception;
- Not_Applicable_System : Boolean := False;
-
- procedure Delete_File ( A_File : in out Ada.Text_IO.File_Type;
- ID_Num : in Integer ) is
- begin
- if not Ada.Text_IO.Is_Open ( A_File ) then
- Ada.Text_IO.Open ( A_File,
- Ada.Text_IO.In_File,
- Report.Legal_File_Name ( ID_Num ) );
- end if;
- Ada.Text_IO.Delete ( A_File );
- exception
- when Ada.Text_IO.Name_Error =>
- if Not_Applicable_System then
- null; -- File probably wasn't created.
- else
- Report.Failed ( "Can't open file for Text_IO" );
- end if;
- when Ada.Text_IO.Use_Error =>
- if Not_Applicable_System then
- null; -- File probably wasn't created.
- else
- Report.Failed ( "Delete not properly implemented for Text_IO" );
- end if;
- when others =>
- Report.Failed ( "Unexpected exception in Delete_File" );
- end Delete_File;
-
-begin
-
- Report.Test ("CXAA016", "Check that the type File_Access is available " &
- "in Ada.Text_IO, and that objects of this " &
- "type designate File_Type objects");
- Test_Block:
- declare
-
- use Ada.Exceptions;
-
- type System_File_Array_Type is
- array (Integer range <>) of File_Access;
-
- -- Fill the following array with the File_Access results of six
- -- functions.
-
- Initial_Environment : System_File_Array_Type(1..6) :=
- ( Standard_Input,
- Standard_Output,
- Standard_Error,
- Current_Input,
- Current_Output,
- Current_Error );
-
- New_Input_Ptr : File_Access := New_Input_File'Access;
- New_Output_Ptr : File_Access := New_Output_File'Access;
- New_Error_Ptr : File_Access := New_Error_File_1'Access;
-
- Line : String(1..80);
- Length : Natural := 0;
-
- Line_1 : constant String := "This is the first line in the Output file";
- Line_2 : constant String := "This is the next line in the Output file";
- Line_3 : constant String := "This is the first line in Error file 1";
- Line_4 : constant String := "This is the next line in Error file 1";
- Line_5 : constant String := "This is the first line in Error file 2";
- Line_6 : constant String := "This is the next line in Error file 2";
-
-
-
- procedure New_File (The_File : in out File_Type;
- Mode : in File_Mode;
- Next : in Integer) is
- begin
- Create (The_File, Mode, Report.Legal_File_Name(Next));
- exception
- -- The following two exceptions may be raised if a system is not
- -- capable of supporting external Text_IO files. The handler will
- -- raise a user-defined exception which will result in a
- -- Not_Applicable result for the test.
- when Use_Error | Name_Error => raise Non_Applicable_System;
- end New_File;
-
-
-
- procedure Check_Initial_Environment (Env : System_File_Array_Type) is
- begin
- -- Check that the system has defined the following sources/
- -- destinations for input/output/error, and that the six functions
- -- returning File_Access values are available.
- if not (Env(1) = Standard_Input and
- Env(2) = Standard_Output and
- Env(3) = Standard_Error and
- Env(4) = Current_Input and
- Env(5) = Current_Output and
- Env(6) = Current_Error)
- then
- Report.Failed("At the start of the test, the Standard and " &
- "Current File_Access values associated with " &
- "system Input, Output, and Error files do " &
- "not correspond");
- end if;
- end Check_Initial_Environment;
-
-
-
- procedure Load_Input_File (Input_Ptr : in File_Access) is
- begin
- -- Load data into the file that will function as the user-defined
- -- system input file.
- Put_Line(Input_Ptr.all, Line_1);
- Put_Line(Input_Ptr.all, Line_2);
- Put_Line(Input_Ptr.all, Line_3);
- Put_Line(Input_Ptr.all, Line_4);
- Put_Line(Input_Ptr.all, Line_5);
- Put_Line(Input_Ptr.all, Line_6);
- end Load_Input_File;
-
-
-
- procedure Restore_Initial_Environment
- (Initial_Env : System_File_Array_Type) is
- begin
- -- Restore the Current Input, Output, and Error files to their
- -- original states.
-
- Set_Input (Initial_Env(4).all);
- Set_Output(Initial_Env(5).all);
- Set_Error (Initial_Env(6).all);
-
- -- At this point, the user-defined files that were functioning as
- -- the Current Input, Output, and Error files have been replaced in
- -- that capacity by the state of the original environment.
-
- declare
-
- -- Capture the state of the current environment.
-
- Current_Env : System_File_Array_Type (1..6) :=
- (Standard_Input, Standard_Output, Standard_Error,
- Current_Input, Current_Output, Current_Error);
- begin
-
- -- Compare the current environment with that of the saved
- -- initial environment.
-
- if Current_Env /= Initial_Env then
- Report.Failed("Restored file environment was not the same " &
- "as the initial file environment");
- end if;
- end;
- end Restore_Initial_Environment;
-
-
-
- procedure Verify_Files (O_File, E_File_1, E_File_2 : in File_Type) is
- Str_1, Str_2, Str_3, Str_4, Str_5, Str_6 : String (1..80);
- Len_1, Len_2, Len_3, Len_4, Len_5, Len_6 : Natural;
- begin
-
- -- Get the lines that are contained in all the files, and verify
- -- them against the expected results.
-
- Get_Line(O_File, Str_1, Len_1); -- The user defined output file
- Get_Line(O_File, Str_2, Len_2); -- should contain two lines of data.
-
- if Str_1(1..Len_1) /= Line_1 or
- Str_2(1..Len_2) /= Line_2
- then
- Report.Failed("Incorrect results from Current_Output file");
- end if;
-
- Get_Line(E_File_1, Str_3, Len_3); -- The first error file received
- Get_Line(E_File_1, Str_4, Len_4); -- two lines of data originally,
- Get_Line(E_File_1, Str_5, Len_5); -- then had two additional lines
- Get_Line(E_File_1, Str_6, Len_6); -- appended from the second error
- -- file.
- if Str_3(1..Len_3) /= Line_3 or
- Str_4(1..Len_4) /= Line_4 or
- Str_5(1..Len_5) /= Line_5 or
- Str_6(1..Len_6) /= Line_6
- then
- Report.Failed("Incorrect results from first Error file");
- end if;
-
- Get_Line(E_File_2, Str_5, Len_5); -- The second error file
- Get_Line(E_File_2, Str_6, Len_6); -- received two lines of data.
-
- if Str_5(1..Len_5) /= Line_5 or
- Str_6(1..Len_6) /= Line_6
- then
- Report.Failed("Incorrect results from second Error file");
- end if;
-
- end Verify_Files;
-
-
-
- begin
-
- Check_Initial_Environment (Initial_Environment);
-
- -- Create user-defined text files that will be set to serve as current
- -- system input, output, and error files.
-
- New_File (New_Input_File, Out_File, 1); -- Will be reset prior to use.
- New_File (New_Output_File, Out_File, 2);
- New_File (New_Error_File_1, Out_File, 3);
- New_File (New_Error_File_2, Out_File, 4);
-
- -- Enter several lines of text into the new input file. This file will
- -- be reset to mode In_File to function as the current system input file.
- -- Note: File_Access value used as parameter to this procedure.
-
- Load_Input_File (New_Input_Ptr);
-
- -- Reset the New_Input_File to mode In_File, to allow it to act as the
- -- current system input file.
-
- Reset1:
- begin
- Reset (New_Input_File, In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO - 1" );
- raise No_Reset;
- end Reset1;
-
- -- Establish new files that will function as the current system Input,
- -- Output, and Error files.
-
- Set_Input (New_Input_File);
- Set_Output(New_Output_Ptr.all);
- Set_Error (New_Error_Ptr.all);
-
- -- Perform various file processing tasks, exercising specific new
- -- Text_IO functionality.
- --
- -- Read two lines from Current_Input and write them to Current_Output.
-
- for i in 1..2 loop
- Get_Line(Current_Input, Line, Length);
- Put_Line(Current_Output, Line(1..Length));
- end loop;
-
- -- Read two lines from Current_Input and write them to Current_Error.
-
- for i in 1..2 loop
- Get_Line(Current_Input, Line, Length);
- Put_Line(Current_Error, Line(1..Length));
- end loop;
-
- -- Reset the Current system error file.
-
- Set_Error (New_Error_File_2);
-
- -- Read two lines from Current_Input and write them to Current_Error.
-
- for i in 1..2 loop
- Get_Line(Current_Input, Line, Length);
- Put_Line(Current_Error, Line(1..Length));
- end loop;
-
- -- At this point in the processing, the new Output file, and each of
- -- the two Error files, contain two lines of data.
- -- Note that New_Error_File_1 has been replaced by New_Error_File_2
- -- as the current system error file, allowing New_Error_File_1 to be
- -- reset (Mode_Error raised otherwise).
- --
- -- Reset the first Error file to Append_File mode, and then set it to
- -- function as the current system error file.
-
- Reset2:
- begin
- Reset (New_Error_File_1, Append_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Text_IO - 2" );
- raise No_Reset;
- end Reset2;
-
- Set_Error (New_Error_File_1);
-
- -- Reset the second Error file to In_File mode, then set it to become
- -- the current system input file.
-
- Reset3:
- begin
- Reset (New_Error_File_2, In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO - 3" );
- raise No_Reset;
- end Reset3;
-
- New_Error_Ptr := New_Error_File_2'Access;
- Set_Input (New_Error_Ptr.all);
-
- -- Append all of the text lines (2) in the new current system input
- -- file onto the current system error file.
-
- while not End_Of_File(Current_Input) loop
- Get_Line(Current_Input, Line, Length);
- Put_Line(Current_Error, Line(1..Length));
- end loop;
-
- -- Restore the original system file environment, based upon the values
- -- stored at the start of this test.
- -- Check that the original environment has been restored.
-
- Restore_Initial_Environment (Initial_Environment);
-
- -- Reset all three files to In_File_Mode prior to verification.
- -- Note: If these three files had still been the designated Current
- -- Input, Output, or Error files for the system, a Reset
- -- operation at this point would raise Mode_Error.
- -- However, at this point, the environment has been restored to
- -- its original state, and these user-defined files are no longer
- -- designated as current system files, allowing a Reset.
-
- Reset4:
- begin
- Reset(New_Error_File_1, In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO - 4" );
- raise No_Reset;
- end Reset4;
-
- Reset5:
- begin
- Reset(New_Error_File_2, In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO - 5" );
- raise No_Reset;
- end Reset5;
-
- Reset6:
- begin
- Reset(New_Output_File, In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO - 6" );
- raise No_Reset;
- end Reset6;
-
- -- Check that all the files contain the appropriate data.
-
- Verify_Files (New_Output_File, New_Error_File_1, New_Error_File_2);
-
- exception
- when No_Reset =>
- null;
- when Non_Applicable_System =>
- Report.Not_Applicable("System not capable of supporting external " &
- "text files -- Name_Error/Use_Error raised " &
- "during text file creation");
- Not_Applicable_System := True;
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Delete_Block:
- begin
- Delete_File ( New_Input_File, 1 );
- Delete_File ( New_Output_File, 2 );
- Delete_File ( New_Error_File_1, 3 );
- Delete_File ( New_Error_File_2, 4 );
- end Delete_Block;
-
- Report.Result;
-
-end CXAA016;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa017.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa017.a
deleted file mode 100644
index 17d0922cc24..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa017.a
+++ /dev/null
@@ -1,400 +0,0 @@
--- CXAA017.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Ada.Text_IO function Look_Ahead sets parameter End_Of_Line
--- to True if at the end of a line; otherwise check that it returns the
--- next character from a file (without consuming it), while setting
--- End_Of_Line to False.
---
--- Check that Ada.Text_IO function Get_Immediate will return the next
--- control or graphic character in parameter Item from the specified
--- file. Check that the version of Ada.Text_IO function Get_Immediate
--- with the Available parameter will, if a character is available in the
--- specified file, return the character in parameter Item, and set
--- parameter Available to True.
---
--- TEST DESCRIPTION:
--- This test exercises specific capabilities of two Text_IO subprograms,
--- Look_Ahead and Get_Immediate. A file is prepared that contains a
--- variety of graphic and control characters on several lines.
--- In processing this file, a call to Look_Ahead is performed to ensure
--- that characters are available, then individual characters are
--- extracted from the current line using Get_Immediate. The characters
--- returned from both subprogram calls are compared with the expected
--- character result. Processing on each file line continues until
--- Look_Ahead indicates that the end of the line is next. Separate
--- verification is performed to ensure that all characters of each line
--- are processed, and that the Available and End_Of_Line parameters
--- of the subprograms are properly set in the appropriate instances.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to implementations capable of supporting
--- external Text_IO files.
---
---
--- CHANGE HISTORY:
--- 30 May 95 SAIC Initial prerelease version.
--- 01 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 26 Feb 97 PWB.CTA Allowed for non-support of some IO operations.
---!
-
-with Ada.Text_IO;
-package CXAA017_0 is
-
- User_Defined_Input_File : aliased Ada.Text_IO.File_Type;
-
-end CXAA017_0;
-
-
-with CXAA017_0; use CXAA017_0;
-with Ada.Characters.Latin_1;
-with Ada.Exceptions;
-with Ada.Text_IO;
-with Report;
-
-procedure CXAA017 is
-
- use Ada.Characters.Latin_1;
- use Ada.Exceptions;
- use Ada.Text_IO;
-
- Non_Applicable_System : exception;
- No_Reset : exception;
-
-begin
-
- Report.Test ("CXAA017", "Check that Ada.Text_IO subprograms " &
- "Look_Ahead and Get_Immediate are available " &
- "and produce correct results");
-
- Test_Block:
- declare
-
- User_Input_Ptr : File_Access := User_Defined_Input_File'Access;
-
- UDLA_Char, -- Acronym UDLA => "User Defined Look Ahead"
- UDGI_Char, -- Acronym UDGI => "User Defined Get Immediate"
- TC_Char : Character := Ada.Characters.Latin_1.NUL;
-
- UDLA_End_Of_Line,
- UDGI_Available : Boolean := False;
-
- Char_Pos : Natural;
-
- -- This string contains five ISO 646 Control characters and six ISO 646
- -- Graphic characters:
- TC_String_1 : constant String := STX &
- SI &
- DC2 &
- CAN &
- US &
- Space &
- Ampersand &
- Solidus &
- 'A' &
- LC_X &
- DEL;
-
- -- This string contains two ISO 6429 Control and six ISO 6429 Graphic
- -- characters:
- TC_String_2 : constant String := IS4 &
- SCI &
- Yen_Sign &
- Masculine_Ordinal_Indicator &
- UC_I_Grave &
- Multiplication_Sign &
- LC_C_Cedilla &
- LC_Icelandic_Thorn;
-
- TC_Number_Of_Strings : constant := 2;
-
- type String_Access_Type is access constant String;
- type String_Ptr_Array_Type is
- array (1..TC_Number_Of_Strings) of String_Access_Type;
-
- TC_String_Ptr_Array : String_Ptr_Array_Type :=
- (new String'(TC_String_1),
- new String'(TC_String_2));
-
-
-
- procedure Create_New_File (The_File : in out File_Type;
- Mode : in File_Mode;
- Next : in Integer) is
- begin
- Create (The_File, Mode, Report.Legal_File_Name(Next));
- exception
- -- The following two exceptions can be raised if a system is not
- -- capable of supporting external Text_IO files. The handler will
- -- raise a user-defined exception which will result in a
- -- Not_Applicable result for the test.
- when Use_Error | Name_Error => raise Non_Applicable_System;
- end Create_New_File;
-
-
-
- procedure Load_File (The_File : in out File_Type) is
- -- This procedure will load several strings into the file denoted
- -- by the input parameter. A call to New_Line will add line/page
- -- termination characters, which will be available for processing
- -- along with the text in the file.
- begin
- Put_Line (The_File, TC_String_Ptr_Array(1).all);
- New_Line (The_File, Spacing => 1);
- Put_Line (The_File, TC_String_Ptr_Array(2).all);
- end Load_File;
-
-
- begin
-
- -- Create user-defined text file that will serve as the appropriate
- -- sources of input to the procedures under test.
-
- Create_New_File (User_Defined_Input_File, Out_File, 1);
-
- -- Enter several lines of text into the new input file.
- -- The characters that make up these text strings will be processed
- -- using the procedures being exercised in this test.
-
- Load_File (User_Defined_Input_File);
-
- -- Check that Mode_Error is raised by Look_Ahead and Get_Immedidate
- -- if the mode of the file object is not In_File.
- -- Currently, the file mode is Out_File.
-
- begin
- Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
- Report.Failed("Mode_Error not raised by Look_Ahead");
- Report.Comment("This char should never be printed: " & UDLA_Char);
- exception
- when Mode_Error => null; -- OK, expected exception.
- when The_Error : others =>
- Report.Failed ("The following exception was raised during the " &
- "check that Look_Ahead raised Mode_Error when " &
- "provided a file object that is not in In_File " &
- "mode: " & Exception_Name(The_Error));
- end;
-
- begin
- Get_Immediate(User_Defined_Input_File, UDGI_Char);
- Report.Failed("Mode_Error not raised by Get_Immediate");
- Report.Comment("This char should never be printed: " & UDGI_Char);
- exception
- when Mode_Error => null; -- OK, expected exception.
- when The_Error : others =>
- Report.Failed ("The following exception was raised during the " &
- "check that Get_Immediate raised Mode_Error " &
- "when provided a file object that is not in " &
- "In_File mode: " & Exception_Name(The_Error));
- end;
-
-
- -- The file will then be reset to In_File mode to properly function as
- -- a source of input.
-
- Reset1:
- begin
- Reset (User_Defined_Input_File, In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise No_Reset;
- end Reset1;
-
- -- Process the input file, exercising various Text_IO
- -- functionality, and validating the results at each step.
- -- Note: The designated File_Access object is used in processing
- -- the New_Default_Input_File in the second loop below.
-
- -- Process characters in first line of text of each file.
-
- Char_Pos := 1;
-
- -- Check that the first line is not blank.
-
- Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
-
- while not UDLA_End_Of_Line loop
-
- -- Use the Get_Immediate procedure on the file to get the next
- -- available character on the current line.
-
- Get_Immediate(User_Defined_Input_File, UDGI_Char);
-
- -- Check that the characters returned by both procedures are the
- -- same, and that they match the expected character from the file.
-
- if UDLA_Char /= TC_String_Ptr_Array(1).all(Char_Pos) or
- UDGI_Char /= TC_String_Ptr_Array(1).all(Char_Pos)
- then
- Report.Failed("Incorrect retrieval of character " &
- Integer'Image(Char_Pos) & " of first string");
- end if;
-
- -- Increment the character position counter.
- Char_Pos := Char_Pos + 1;
-
- -- Check the next character on the line. If at the end of line,
- -- the processing flow will exit the While loop.
-
- Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
-
- end loop;
-
- -- Check to ensure that the "end of line" results returned from the
- -- Look_Ahead procedure (used to exit the above While loop) corresponds
- -- with the result of Function End_Of_Line.
-
- if not End_Of_Line(User_Defined_Input_File)
- then
- Report.Failed("Result of procedure Look_Ahead that indicated " &
- "being at the end of the line does not correspond " &
- "with the result of function End_Of_Line");
- end if;
-
- -- Check that all characters in the string were processed.
-
- if Char_Pos-1 /= TC_String_1'Length then
- Report.Failed("Not all of the characters on the first line " &
- "were processed");
- end if;
-
-
- -- Call procedure Skip_Line to advance beyond the end of the first line.
-
- Skip_Line(User_Defined_Input_File);
-
-
- -- Process the second line in the file (a blank line).
-
- Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
-
- if not UDLA_End_Of_Line then
- Report.Failed("Incorrect end of line determination from procedure " &
- "Look_Ahead when processing a blank line");
- end if;
-
- -- Call procedure Skip_Line to advance beyond the end of the second line.
-
- Skip_Line(User_Input_Ptr.all);
-
-
- -- Process characters in the third line of the file (second line
- -- of text)
- -- Note: The version of Get_Immediate used in processing this line has
- -- the Boolean parameter Available.
-
- Char_Pos := 1;
-
- -- Check whether the line is blank (i.e., at end of line, page, or file).
-
- Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
-
- while not UDLA_End_Of_Line loop
-
- -- Use the Get_Immediate procedure on the file to get access to the
- -- next character on the current line.
-
- Get_Immediate(User_Input_Ptr.all, UDGI_Char, UDGI_Available);
-
- -- Check that the Available parameter of Get_Immediate was set
- -- to indicate that a character was available in the file.
- -- Check that the characters returned by both procedures are the
- -- same, and they all match the expected character from the file.
-
- if not UDGI_Available or
- UDLA_Char /= TC_String_Ptr_Array(2).all(Char_Pos) or
- UDGI_Char /= TC_String_Ptr_Array(2).all(Char_Pos)
- then
- Report.Failed("Incorrect retrieval of character " &
- Integer'Image(Char_Pos) & " of second string");
- end if;
-
- -- Increment the character position counter.
-
- Char_Pos := Char_Pos + 1;
-
- -- Check the next character on the line. If at the end of line,
- -- the processing flow will exit the While loop.
-
- Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
-
- end loop;
-
- -- Check to ensure that the "end of line" results returned from the
- -- Look_Ahead procedure (used to exit the above While loop) corresponds
- -- with the result of Function End_Of_Line.
-
- if not End_Of_Line(User_Defined_Input_File)
- then
- Report.Failed("Result of procedure Look_Ahead that indicated " &
- "being at the end of the line does not correspond " &
- "with the result of function End_Of_Line");
- end if;
-
- -- Check that all characters in the second string were processed.
-
- if Char_Pos-1 /= TC_String_2'Length then
- Report.Failed("Not all of the characters on the second line " &
- "were processed");
- end if;
-
-
- Deletion:
- begin
- -- Delete the user defined file.
-
- if Is_Open(User_Defined_Input_File) then
- Delete(User_Defined_Input_File);
- else
- Open(User_Defined_Input_File, Out_File, Report.Legal_File_Name(1));
- Delete(User_Defined_Input_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
- end Deletion;
-
-
- exception
-
- when No_Reset =>
- null;
-
- when Non_Applicable_System =>
- Report.Not_Applicable("System not capable of supporting external " &
- "text files -- Name_Error/Use_Error raised " &
- "during text file creation");
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXAA017;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa018.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa018.a
deleted file mode 100644
index 53b16fea498..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa018.a
+++ /dev/null
@@ -1,277 +0,0 @@
--- CXAA018.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in the package Text_IO.Modular_IO
--- provide correct results.
---
--- TEST DESCRIPTION:
--- This test checks that the subprograms defined in the
--- Ada.Text_IO.Modular_IO package provide correct results.
--- A modular type is defined and used to instantiate the generic
--- package Ada.Text_IO.Modular_IO. Values of the modular type are
--- written to a Text_IO file, and to a series of string variables, using
--- different versions of the procedure Put from the instantiated IO
--- package. These modular data items are retrieved from the file and
--- string variables using the appropriate instantiated version of
--- procedure Get. A variety of Base and Width parameter values are
--- used in the procedure calls.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations that support Text_IO
--- processing and external files.
---
---
--- CHANGE HISTORY:
--- 03 Jul 95 SAIC Initial prerelease version.
--- 01 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
---
---!
-
-with Ada.Text_IO;
-with System;
-with Report;
-
-procedure CXAA018 is
-begin
-
- Report.Test ("CXAA018", "Check that the subprograms defined in " &
- "the package Text_IO.Modular_IO provide " &
- "correct results");
-
- Test_for_Text_IO_Support:
- declare
- Data_File : Ada.Text_IO.File_Type;
- Data_Filename : constant String := Report.Legal_File_Name;
- begin
-
- -- An application creates a text file in mode Out_File, with the
- -- intention of entering modular data into the file as appropriate.
- -- In the event that the particular environment where the application
- -- is running does not support Text_IO, Use_Error or Name_Error will be
- -- raised on calls to Text_IO operations. Either of these exceptions
- -- will be handled to produce a Not_Applicable result.
-
- Ada.Text_IO.Create (File => Data_File,
- Mode => Ada.Text_IO.Out_File,
- Name => Data_Filename);
-
- Test_Block:
- declare
-
- type Mod_Type is mod System.Max_Binary_Modulus;
- -- Max_Binary_Modulus must be at least 2**16, which would result
- -- in a base range of 0..65535 (zero to one less than the given
- -- modulus) for this modular type.
-
- package Mod_IO is new Ada.Text_IO.Modular_IO(Mod_Type);
- use Ada.Text_IO, Mod_IO;
- use type Mod_Type;
-
- Number_Of_Modular_Items : constant := 6;
- Number_Of_Error_Items : constant := 1;
-
- TC_Modular : Mod_Type;
- TC_Last_Character_Read : Positive;
-
- Modular_Array : array (1..Number_Of_Modular_Items) of Mod_Type :=
- ( 0, 97, 255, 1025, 12097, 65535 );
-
-
- procedure Load_File (The_File : in out Ada.Text_IO.File_Type) is
- begin
- -- This procedure does not create, open, or close the data file;
- -- The_File file object must be Open at this point.
- -- This procedure is designed to load Modular_Type data into a
- -- data file.
- --
- -- Use the Modular_IO procedure Put to enter modular data items
- -- into the data file.
-
- for i in 1..Number_Of_Modular_Items loop
- -- Use default Base parameter of 10.
- Mod_IO.Put(File => Data_File,
- Item => Modular_Array(i),
- Width => 6,
- Base => Mod_IO.Default_Base);
- end loop;
-
- -- Enter data into the file such that on the corresponding "Get"
- -- of this data, Data_Error must be raised. This value is outside
- -- the base range of Modular_Type.
- -- Text_IO is used to enter the value in the file.
-
- for i in 1..Number_Of_Error_Items loop
- Ada.Text_IO.Put(The_File, "-10");
- end loop;
-
- end Load_File;
-
-
-
- procedure Process_File(The_File : in out Ada.Text_IO.File_Type) is
- begin
- -- This procedure does not create, open, or close the data file;
- -- The_File file object must be Open at this point.
- -- Use procedure Get (for Files) to extract the modular data from
- -- the Text_IO file.
-
- for i in 1..Number_Of_Modular_Items loop
- Mod_IO.Get(The_File, TC_Modular, Width => 6);
-
- if TC_Modular /= Modular_Array(i) then
- Report.Failed("Incorrect modular data read from file " &
- "data item #" & Integer'Image(i));
- end if;
- end loop;
-
- -- The final item in the Data_File is a modular value that is
- -- outside the base range 0..Num'Last. This value should raise
- -- Data_Error on an attempt to "Get" it from the file.
-
- for i in 1..Number_Of_Error_Items loop
- begin
- Mod_IO.Get(The_File, TC_Modular, Mod_IO.Default_Width);
- Report.Failed
- ("Exception Data_Error not raised when Get " &
- "was used to read modular data outside base " &
- "range of type, item # " &
- Integer'Image(i));
- exception
- when Ada.Text_IO.Data_Error =>
- null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised when Get " &
- "was used to read modular data outside " &
- "base range of type from Data_File, " &
- "data item #" & Integer'Image(i));
- end;
- end loop;
-
- exception
- when others =>
- Report.Failed
- ("Unexpected exception raised in Process_File");
- end Process_File;
-
-
-
- begin -- Test_Block.
-
- -- Place modular values into data file.
-
- Load_File(Data_File);
- Ada.Text_IO.Close(Data_File);
-
- -- Read modular values from data file.
-
- Ada.Text_IO.Open(Data_File, Ada.Text_IO.In_File, Data_Filename);
- Process_File(Data_File);
-
- -- Verify versions of Modular_IO procedures Put and Get for Strings.
-
- Modular_IO_in_Strings:
- declare
- TC_String_Array : array (1..Number_Of_Modular_Items)
- of String(1..30) := (others =>(others => ' '));
- begin
-
- -- Place modular values into strings using the Procedure Put,
- -- Use a variety of different "Base" parameter values.
- -- Note: This version of Put uses the length of the given
- -- string as the value of the "Width" parameter.
-
- for i in 1..2 loop
- Mod_IO.Put(To => TC_String_Array(i),
- Item => Modular_Array(i),
- Base => Mod_IO.Default_Base);
- end loop;
- for i in 3..4 loop
- Mod_IO.Put(TC_String_Array(i),
- Modular_Array(i),
- Base => 2);
- end loop;
- for i in 5..6 loop
- Mod_IO.Put(TC_String_Array(i), Modular_Array(i), 16);
- end loop;
-
- -- Get modular values from strings using the Procedure Get.
- -- Compare with expected modular values.
-
- for i in 1..Number_Of_Modular_Items loop
-
- Mod_IO.Get(From => TC_String_Array(i),
- Item => TC_Modular,
- Last => TC_Last_Character_Read);
-
- if TC_Modular /= Modular_Array(i) then
- Report.Failed("Incorrect modular data value obtained " &
- "from String following use of Procedures " &
- "Put and Get from Strings, Modular_Array " &
- "item #" & Integer'Image(i));
- end if;
- end loop;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised during the " &
- "evaluation of Put and Get for Strings");
- end Modular_IO_in_Strings;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- -- Delete the external file.
- if Ada.Text_IO.Is_Open(Data_File) then
- Ada.Text_IO.Delete(Data_File);
- else
- Ada.Text_IO.Open(Data_File,
- Ada.Text_IO.In_File,
- Data_Filename);
- Ada.Text_IO.Delete(Data_File);
- end if;
-
- exception
-
- -- Since Use_Error can be raised if, for the specified mode,
- -- the environment does not support Text_IO operations, the
- -- following handlers are included:
-
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable ("Use_Error raised on Text_IO Create");
-
- when Ada.Text_IO.Name_Error =>
- Report.Not_Applicable ("Name_Error raised on Text_IO Create");
-
- when others =>
- Report.Failed ("Unexpected exception raised on text file Create");
-
- end Test_for_Text_IO_Support;
-
- Report.Result;
-
-end CXAA018;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaa019.a b/gcc/testsuite/ada/acats/tests/cxa/cxaa019.a
deleted file mode 100644
index 04c257e97b6..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaa019.a
+++ /dev/null
@@ -1,138 +0,0 @@
--- CXAA019.A
---
--- Grant of Unlimited Rights
---
--- The Ada Conformity Assessment Authority (ACAA) holds unlimited
--- rights in the software and documentation contained herein. Unlimited
--- rights are the same as those granted by the U.S. Government for older
--- parts of the Ada Conformity Assessment Test Suite, and are defined
--- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA
--- intends to confer upon all recipients unlimited rights equal to those
--- held by the ACAA. These rights include rights to use, duplicate,
--- release or disclose the released technical data and computer software
--- in whole or in part, in any manner and for any purpose whatsoever, and
--- to have or permit others to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Standard_Output can be flushed. Check that 'in' parameters of
--- types Ada.Text_IO.File_Type and Ada.Streams.Stream_IO.File_Type can be
--- flushed. (Defect Report 8652/0051).
---
--- CHANGE HISTORY:
--- 12 FEB 2001 PHL Initial version
--- 16 MAR 2001 RLB Readied for release; fixed Not_Applicable check
--- to terminate test gracefully.
---
---!
-with Ada.Streams.Stream_Io;
-use Ada.Streams;
-with Ada.Text_Io;
-with Ada.Wide_Text_Io;
-with Report;
-use Report;
-procedure CXAA019 is
-
- procedure Check (File : in Ada.Text_Io.File_Type) is
- begin
- Ada.Text_Io.Put_Line
- (File, " - CXAA019 About to flush a Text_IO file passed " &
- "as 'in' parameter");
- Ada.Text_Io.Flush (File);
- end Check;
-
- procedure Check (File : in Ada.Wide_Text_Io.File_Type) is
- begin
- Ada.Wide_Text_Io.Put_Line
- (File, " - CXAA019 About to flush a Wide_Text_IO file passed " &
- "as 'in' parameter");
- Ada.Wide_Text_Io.Flush (File);
- end Check;
-
- procedure Check (File : in Stream_Io.File_Type) is
- S : Stream_Element_Array (1 .. 10);
- begin
- for I in S'Range loop
- S (I) := Stream_Element (Character'Pos ('A') + I);
- end loop;
- Stream_Io.Write (File, S);
- Comment ("About to flush a Stream_IO file passed as 'in' parameter");
- Stream_Io.Flush (File);
- end Check;
-
-
-begin
- Test ("CXAA019",
- "Check that Standard_Output can be flushed; check that " &
- "'in' Ada.Text_IO.File_Type and Ada.Streams.Stream_IO.File_Type" &
- "parameters can be flushed");
-
- Ada.Text_Io.Put_Line (Ada.Text_Io.Standard_Output,
- " - CXAA019 About to flush Standard_Output");
- Ada.Text_Io.Flush (Ada.Text_Io.Standard_Output);
-
- Check (Ada.Text_Io.Current_Output);
-
- declare
- TC_OK : Boolean := False;
- F : Ada.Text_Io.File_Type;
- begin
- begin
- Ada.Text_Io.Create (F, Name => Legal_File_Name (X => 1));
- TC_OK := True;
- exception
- when others =>
- Not_Applicable ("Unable to create Out mode Text_IO file");
- end;
- if TC_OK then
- Check (F);
- Ada.Text_Io.Delete (F);
- end if;
- end;
-
- declare
- TC_OK : Boolean := False;
- F : Ada.Wide_Text_Io.File_Type;
- begin
- begin
- Ada.Wide_Text_Io.Create (F, Name => Legal_File_Name (X => 2));
- TC_OK := True;
- exception
- when others =>
- Not_Applicable ("Unable to create Out mode Wide_Text_IO file");
- end;
- if TC_OK then
- Check (F);
- Ada.Wide_Text_Io.Delete (F);
- end if;
- end;
-
- declare
- TC_OK : Boolean := False;
- F : Stream_Io.File_Type;
- begin
- begin
- Stream_Io.Create (F, Name => Legal_File_Name (X => 3));
- TC_OK := True;
- exception
- when others =>
- Not_Applicable ("Unable to create Out mode Stream_IO file");
- end;
- if TC_OK then
- Check (F);
- Stream_Io.Delete (F);
- end if;
- end;
-
- Result;
-end CXAA019;
-
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxab001.a b/gcc/testsuite/ada/acats/tests/cxa/cxab001.a
deleted file mode 100644
index 483acd16cb2..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxab001.a
+++ /dev/null
@@ -1,272 +0,0 @@
--- CXAB001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the operations defined in package Wide_Text_IO allow for
--- the input/output of Wide_Character and Wide_String data.
---
--- TEST DESCRIPTION:
--- This test is designed to exercise the components of the Wide_Text_IO
--- package, including the Put/Get utilities for Wide_Characters and
--- Wide_String objects.
--- The test utilizes the Put and Get procedures defined for
--- Wide_Characters, as well as the Put, Get, Put_Line, and Get_Line
--- procedures defined for Wide_Strings. In addition, many of the
--- additional subprograms found in package Wide_Text_IO are used in this
--- test.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations capable of supporting
--- external Wide_Text_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 26 Feb 97 CTA.PWB Allowed for non-support of some IO operations.
---!
-
-with Ada.Wide_Text_IO;
-with Report;
-
-procedure CXAB001 is
-
- Filter_File : Ada.Wide_Text_IO.File_Type;
- Filter_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAB001" );
- Incomplete : exception;
-
-
-begin
-
- Report.Test ("CXAB001", "Check that the operations defined in package " &
- "Wide_Text_IO allow for the input/output of " &
- "Wide_Character and Wide_String data");
-
-
- Test_for_Wide_Text_IO_Support:
- begin
-
- -- An implementation that does not support Wide_Text_IO in a particular
- -- environment will raise Use_Error on calls to various
- -- Wide_Text_IO operations. This block statement encloses a call to
- -- Create, which should raise an exception in a non-supportive
- -- environment. This exception will be handled to produce a
- -- Not_Applicable result.
-
- Ada.Wide_Text_IO.Create (File => Filter_File, -- Create.
- Mode => Ada.Wide_Text_IO.Out_File,
- Name => Filter_Filename);
-
- exception
-
- when Ada.Wide_Text_IO.Use_Error | Ada.Wide_Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Wide_Text_IO" );
- raise Incomplete;
-
- end Test_for_Wide_Text_IO_Support;
-
- Operational_Test_Block:
- declare
-
- First_String : constant Wide_String := "Somewhere ";
- Second_String : constant Wide_String := "Over The ";
- Third_String : constant Wide_String := "Rainbow";
- Current_Char : Wide_Character := ' ';
-
- begin
-
- Enter_Data_In_File:
- declare
- Pos : Natural := 1;
- Bad_Character_Found : Boolean := False;
- begin
- -- Use the Put procedure defined for Wide_Character data to
- -- write all of the wide characters of the First_String into
- -- the file individually, followed by a call to New_Line.
-
- while Pos <= First_String'Length loop
- Ada.Wide_Text_IO.Put (Filter_File, First_String (Pos)); -- Put.
- Pos := Pos + 1;
- end loop;
- Ada.Wide_Text_IO.New_Line (Filter_File); -- New_Line.
-
- -- Reset to In_File mode and read file contents, using the Get
- -- procedure defined for Wide_Character data.
- Reset1:
- begin
- Ada.Wide_Text_IO.Reset (Filter_File, -- Reset.
- Ada.Wide_Text_IO.In_File);
- exception
- when Ada.Wide_Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Wide_Text_IO" );
- raise Incomplete;
- end Reset1;
-
- Pos := 1;
- while Pos <= First_String'Length loop
- Ada.Wide_Text_IO.Get (Filter_File, Current_Char); -- Get.
- -- Verify the wide character against the original string.
- if Current_Char /= First_String(Pos) then
- Bad_Character_Found := True;
- end if;
- Pos := Pos + 1;
- end loop;
-
- if Bad_Character_Found then
- Report.Failed ("Incorrect Wide_Character read from file - 1");
- end if;
-
- -- Following user file/string processing, the Wide_String data
- -- of the Second_String and Third_String Wide_String objects are
- -- appended to the file.
- -- The Put procedure defined for Wide_String data is used to
- -- transfer the Second_String, followed by a call to New_Line.
- -- The Put_Line procedure defined for Wide_String data is used
- -- to transfer the Third_String.
- Reset2:
- begin
- Ada.Wide_Text_IO.Reset (Filter_File, -- Reset.
- Ada.Wide_Text_IO.Append_File);
-
- exception
- when Ada.Wide_Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Wide_Text_IO" );
- raise Incomplete;
- end Reset2;
-
- Ada.Wide_Text_IO.Put (Filter_File, Second_String); -- Put.
- Ada.Wide_Text_IO.New_Line (Filter_File); -- New_Line.
-
- Ada.Wide_Text_IO.Put_Line (Filter_File, Third_String); -- Put_Line.
- Ada.Wide_Text_IO.Close (Filter_File); -- Close.
-
- exception
-
- when Incomplete =>
- raise;
-
- when others =>
- Report.Failed ("Exception in Enter_Data_In_File block");
- raise;
-
- end Enter_Data_In_File;
-
- ---
-
- Filter_Block:
- declare
-
- Pos : Positive := 1;
- TC_String2 : Wide_String (1..Second_String'Length);
- TC_String3 : Wide_String (1..Third_String'Length);
- Last : Natural := Natural'First;
-
- begin
-
- Ada.Wide_Text_IO.Open (Filter_File, -- Open.
- Ada.Wide_Text_IO.In_File,
- Filter_Filename);
-
-
- -- Read the data of the First_String from the file, using the
- -- Get procedure defined for Wide_Character data.
- -- Verify that the character corresponds to the data originally
- -- written to the file.
-
- while Pos <= First_String'Length loop
- Ada.Wide_Text_IO.Get (Filter_File, Current_Char); -- Get.
- if Current_Char /= First_String(Pos) then
- Report.Failed
- ("Incorrect Wide_Character read from file - 2");
- end if;
- Pos := Pos + 1;
- end loop;
-
- -- The first line of the file has been read, move to the second.
- Ada.Wide_Text_IO.Skip_Line (Filter_File); -- Skip_Line.
-
- -- Read the Wide_String data from the second and third lines of
- -- the file.
- Ada.Wide_Text_IO.Get (Filter_File, TC_String2); -- Get.
- Ada.Wide_Text_IO.Skip_Line (Filter_File); -- Skip_Line.
- Ada.Wide_Text_IO.Get_Line (Filter_File, -- Get_Line.
- TC_String3, Last);
-
- -- Verify data of second and third strings.
- if TC_String2 /= Second_String then
- Report.Failed ("Incorrect Wide_String read from file - 1");
- end if;
- if TC_String3 /= Third_String then
- Report.Failed ("Incorrect Wide_String read from file - 2");
- end if;
-
- -- The file should now be at EOF.
- if not Ada.Wide_Text_IO.End_Of_File (Filter_File) then -- EOF.
- Report.Failed ("File not empty following filtering");
- end if;
-
- exception
- when others =>
- Report.Failed ("Exception in Filter_Block");
- raise;
- end Filter_Block;
-
- exception
-
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- if Ada.Wide_Text_IO.Is_Open (Filter_File) then -- Is_Open.
- Ada.Wide_Text_IO.Delete (Filter_File); -- Delete.
- else
- Ada.Wide_Text_IO.Open (Filter_File, -- Open.
- Ada.Wide_Text_IO.Out_File,
- Filter_Filename);
- Ada.Wide_Text_IO.Delete (Filter_File); -- Delete.
- end if;
- exception
- when others =>
- Report.Failed ("Delete not properly implemented for Wide_Text_IO");
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAB001;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxac001.a b/gcc/testsuite/ada/acats/tests/cxa/cxac001.a
deleted file mode 100644
index a77d561f5d6..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxac001.a
+++ /dev/null
@@ -1,292 +0,0 @@
--- CXAC001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the attribute T'Write will, for any specific non-limited
--- type T, write an item of the subtype to the stream.
---
--- Check that the attribute T'Read will, for a specific non-limited
--- type T, read a value of the subtype from the stream.
---
--- TEST DESCRIPTION:
--- The scenario depicted in this test is that of an environment where
--- product data is stored in stream form, then reconstructed into the
--- appropriate data structures. Several records of product information
--- are stored in an array; the array is passed as a parameter to a
--- procedure for storage in the stream. A header is created based on the
--- number of data records stored in the array. The header is then written
--- to the stream, followed by each record maintained in the array.
--- In order to retrieve data from the stream, the header information is
--- read from the stream, and the data stored in the header is used to
--- perform the appropriate number of read operations of record data from
--- the stream. All data read from the stream is validated against the
---- values that were written to the stream.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all systems capable of supporting IO operations on
--- external Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 08 Nov 95 SAIC Corrected call to Read in Procedure Retrieve_Data
--- for ACVC 2.0.1.
--- 27 Feb 08 PWB.CTA Allowed for non-support of certain IO operations.
---!
-
-with Ada.Streams.Stream_IO;
-with Report;
-
-procedure CXAC001 is
-
- package Strm_Pack renames Ada.Streams.Stream_IO;
- The_File : Strm_Pack.File_Type;
- The_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAC001" );
- Incomplete : exception;
-
-
-begin
-
- Report.Test ("CXAC001", "Check that the 'Read and 'Write attributes " &
- "will transfer an object of a specific, " &
- "non-limited type to/from a stream");
-
- Test_for_Stream_IO_Support:
- begin
-
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Strm_Pack.Create (The_File, Strm_Pack.Out_File, The_Filename);
-
- exception
-
- when Ada.Streams.Stream_IO.Use_Error |
- Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Stream_IO" );
- raise Incomplete;
-
- end Test_for_Stream_IO_Support;
-
- Operational_Test_Block:
- declare
-
- The_Stream : Strm_Pack.Stream_Access;
- Todays_Date : String (1 .. 6) := "271193";
-
- type ID_Type is range 1 .. 100;
- type Size_Type is (Small, Medium, Large, XLarge);
-
- type Header_Type is record
- Number_of_Elements : Natural := 0;
- Origination_Date : String (1 .. 6);
- end record;
-
- type Data_Type is record
- ID : ID_Type;
- Size : Size_Type;
- end record;
-
- type Data_Array_Type is array (Positive range <>) of Data_Type;
-
- Product_Information_1 : Data_Array_Type (1 .. 3) := ((20, Large),
- (55, Small),
- (89, XLarge));
-
- Product_Information_2 : Data_Array_Type (1 .. 4) := (( 5, XLarge),
- (27, Small),
- (79, Medium),
- (93, XLarge));
-
- procedure Store_Data ( The_Stream : in Strm_Pack.Stream_Access;
- The_Array : in Data_Array_Type ) is
- Header : Header_Type;
- begin
-
- -- Fill in header info.
- Header.Number_of_Elements := The_Array'Length;
- Header.Origination_Date := Todays_Date;
-
- -- Write header to stream.
- Header_Type'Write (The_Stream, Header);
-
- -- Write each record in the array to the stream.
- for I in 1 .. Header.Number_of_Elements loop
- Data_Type'Write (The_Stream, The_Array (I));
- end loop;
-
- end Store_Data;
-
- procedure Retrieve_Data (The_Stream : in Strm_Pack.Stream_Access;
- The_Header : out Header_Type;
- The_Array : out Data_Array_Type ) is
- begin
-
- -- Read header from the stream.
- Header_Type'Read (The_Stream, The_Header);
-
- -- Read the records from the stream into the array.
- for I in 1 .. The_Header.Number_of_Elements loop
- Data_Type'Read (The_Stream, The_Array (I));
- end loop;
-
- end Retrieve_Data;
-
- begin
-
- -- Assign access value.
- The_Stream := Strm_Pack.Stream (The_File);
-
- -- Product information is to be stored in the stream file. These
- -- data arrays are of different sizes (actually, the records
- -- are stored individually, not as a single array). Prior to the
- -- record data being written, a header record is initialized with
- -- information about the data to be written, then itself is written
- -- to the stream.
-
- Store_Data (The_Stream, Product_Information_1);
- Store_Data (The_Stream, Product_Information_2);
-
- Test_Verification_Block:
- declare
- Product_Header_1 : Header_Type;
- Product_Header_2 : Header_Type;
- Product_Array_1 : Data_Array_Type (1 .. 3);
- Product_Array_2 : Data_Array_Type (1 .. 4);
- begin
-
- Reset1:
- begin
- Strm_Pack.Reset (The_File, Strm_Pack.In_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Stream_IO" );
- raise Incomplete;
- end Reset1;
-
- -- Data is read from the stream, first the appropriate header,
- -- then the associated data records, which are then reconstructed
- -- into a data array of product information.
-
- Retrieve_Data (The_Stream, Product_Header_1, Product_Array_1);
-
- -- Validate a field in the header.
- if (Product_Header_1.Origination_Date /= Todays_Date) or
- (Product_Header_1.Number_of_Elements /= 3)
- then
- Report.Failed ("Incorrect Header_1 info read from stream");
- end if;
-
- -- Validate the data records read from the file.
- for I in 1 .. Product_Header_1.Number_of_Elements loop
- if (Product_Array_1(I) /= Product_Information_1(I)) then
- Report.Failed ("Incorrect Product 1 info read from" &
- " record: " & Integer'Image (I));
- end if;
- end loop;
-
- -- Repeat this read and verify operation for the next parcel of
- -- data. Again, header and data record information are read from
- -- the same stream file.
- Retrieve_Data (The_Stream, Product_Header_2, Product_Array_2);
-
- if (Product_Header_2.Origination_Date /= Todays_Date) or
- (Product_Header_2.Number_of_Elements /= 4)
- then
- Report.Failed ("Incorrect Header_2 info read from stream");
- end if;
-
- for I in 1 .. Product_Header_2.Number_of_Elements loop
- if (Product_Array_2(I) /= Product_Information_2(I)) then
- Report.Failed ("Incorrect Product_2 info read from" &
- " record: " & Integer'Image (I));
- end if;
- end loop;
-
- exception
-
- when Incomplete =>
- raise;
-
- when Strm_Pack.End_Error => -- If correct number of
- -- items not in file (data
- -- overwritten), then fail.
- Report.Failed ("Incorrect number of record elements in file");
- if not Strm_Pack.Is_Open (The_File) then
- Strm_Pack.Open (The_File, Strm_Pack.Out_File, The_Filename);
- end if;
-
- when others =>
- Report.Failed ("Exception raised in Data Verification Block");
- if not Strm_Pack.Is_Open (The_File) then
- Strm_Pack.Open (The_File, Strm_Pack.Out_File, The_Filename);
- end if;
-
- end Test_Verification_Block;
-
- exception
-
- when Incomplete =>
- raise;
-
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- -- Delete the file.
- if Strm_Pack.Is_Open (The_File) then
- Strm_Pack.Delete (The_File);
- else
- Strm_Pack.Open (The_File, Strm_Pack.Out_File, The_Filename);
- Strm_Pack.Delete (The_File);
- end if;
-
- exception
-
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Stream_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAC001;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxac002.a b/gcc/testsuite/ada/acats/tests/cxa/cxac002.a
deleted file mode 100644
index e4b303c4bc9..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxac002.a
+++ /dev/null
@@ -1,426 +0,0 @@
--- CXAC002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in package Ada.Streams.Stream_IO
--- are accessible, and that they provide the appropriate functionality.
---
--- TEST DESCRIPTION:
--- This test simulates a user filter designed to capitalize the
--- characters of a string. It utilizes a variety of the subprograms
--- contained in the package Ada.Streams.Stream_IO.
--- Its purpose is to demonstrate the use of a variety of the capabilities
--- found in the Ada.Streams.Stream_IO package.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations capable of supporting
--- external Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 14 Nov 95 SAIC Corrected visibility problems; corrected
--- subtest validating result from function Name
--- for ACVC 2.0.1.
--- 05 Oct 96 SAIC Removed calls to Close/Open in test and replaced
--- them with a single call to Reset (per AI95-0001)
--- 26 Feb 97 PWB.CTA Allowed for non-support of some IO operations.
--- 09 Feb 01 RLB Corrected non-support check to avoid unintended
--- failures.
---!
-
-package CXAC002_0 is
-
- -- This function searches for the first instance of a specified substring
- -- within a specified string, returning boolean result. (Case insensitive
- -- analysis)
-
- function Find (Str : in String; Sub : in String) return Boolean;
-
-end CXAC002_0;
-
-package body CXAC002_0 is
-
- function Find (Str : in String; Sub : in String) return Boolean is
-
- New_Str : String(Str'First..Str'Last);
- New_Sub : String(Sub'First..Sub'Last);
- Pos : Integer := Str'First; -- Character index.
-
- function Upper_Case (Str : in String) return String is
- subtype Upper is Character range 'A'..'Z';
- subtype Lower is Character range 'a'..'z';
- Ret : String(Str'First..Str'Last);
- Pos : Integer;
- begin
- for I in Str'Range loop
- if (Str(I) in Lower) then
- Pos := Upper'Pos(Upper'First) +
- (Lower'Pos(Str(I)) - Lower'Pos(Lower'First));
- Ret(I) := Upper'Val(Pos);
- else
- Ret(I) := Str (I);
- end if;
- end loop;
- return Ret;
- end Upper_Case;
-
- begin
-
- New_Str := Upper_Case(Str); -- Convert Str and Sub to upper
- New_Sub := Upper_Case(Sub); -- case for comparison.
-
- while (Pos <= New_Str'Last-New_Sub'Length+1) -- Search until no more
- and then -- sub-string-length
- (New_Str(Pos..Pos+New_Sub'Length-1) /= New_Sub) -- slices remain.
- loop
- Pos := Pos + 1;
- end loop;
-
- if (Pos > New_Str'Last-New_Sub'Length+1) then -- Substring not found.
- return False;
- else
- return True;
- end if;
-
- end Find;
-
-end CXAC002_0;
-
-
-with Ada.Streams.Stream_IO, CXAC002_0, Report;
-procedure CXAC002 is
- Filter_File : Ada.Streams.Stream_IO.File_Type;
- Filter_Stream : Ada.Streams.Stream_IO.Stream_Access;
- Filter_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAC002" );
- Incomplete : Exception;
-
-begin
-
- Report.Test ("CXAC002", "Check that the subprograms defined in " &
- "package Ada.Streams.Stream_IO are accessible, " &
- "and that they provide the appropriate " &
- "functionality");
-
- Test_for_Stream_IO_Support:
-
- begin
-
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Ada.Streams.Stream_IO.Create (Filter_File, -- Create.
- Ada.Streams.Stream_IO.Out_File,
- Filter_Filename);
- exception
-
- when Ada.Streams.Stream_IO.Use_Error | Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Stream_IO" );
- raise Incomplete;
-
- end Test_for_Stream_IO_Support;
-
- Operational_Test_Block:
- declare
-
- use CXAC002_0;
- use type Ada.Streams.Stream_IO.File_Mode;
- use type Ada.Streams.Stream_IO.Count;
-
- File_Size : Ada.Streams.Stream_IO.Count := -- Count.
- Ada.Streams.Stream_IO.Count'First; -- (0)
- File_Index : Ada.Streams.Stream_IO.Positive_Count := -- Pos. Count.
- Ada.Streams.Stream_IO.Positive_Count'First; -- (1)
-
- First_String : constant String := "this is going to be ";
- Second_String : constant String := "the best year of your life";
- Total_Length : constant Natural := First_String'Length +
- Second_String'Length;
- Current_Char : Character := ' ';
-
- Cap_String : String (1..Total_Length) := (others => ' ');
-
- TC_Capital_String : constant String :=
- "THIS IS GOING TO BE THE BEST YEAR OF YOUR LIFE";
-
- begin
-
- if not Ada.Streams.Stream_IO.Is_Open (Filter_File) then -- Is_Open
- Report.Failed ("File not open following Create");
- end if;
-
- -- Call function Find to determine if the filename (Sub) is contained
- -- in the result of Function Name.
-
- if not Find(Str => Ada.Streams.Stream_IO.Name(Filter_File), -- Name.
- Sub => Filter_Filename)
- then
- Report.Failed ("Function Name provided incorrect filename");
- end if;
- -- Stream.
- Filter_Stream := Ada.Streams.Stream_IO.Stream (Filter_File);
-
- ---
-
- Enter_Data_In_Stream:
- declare
- Pos : Natural := 1;
- Bad_Character_Found : Boolean := False;
- begin
-
- -- Enter data from the first string into the stream.
- while Pos <= Natural(First_String'Length) loop
- -- Write all characters of the First_String to the stream.
- Character'Write (Filter_Stream, First_String (Pos));
- Pos := Pos + 1;
- -- Ensure data put in file on a regular basis.
- if Pos mod 5 = 0 then
- Ada.Streams.Stream_IO.Flush (Filter_File); -- Flush.
- end if;
- end loop;
-
- Ada.Streams.Stream_IO.Flush (Filter_File); -- Flush.
- -- Reset to In_File mode and read stream contents.
- Reset1:
- begin
- Ada.Streams.Stream_IO.Reset (Filter_File, -- Reset.
- Ada.Streams.Stream_IO.In_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Stream_IO" );
- raise Incomplete;
- end Reset1;
-
- Pos := 1;
- while Pos <= First_String'Length loop
- -- Read one character from the stream.
- Character'Read (Filter_Stream, Current_Char); -- 'Read
- -- Verify character against the original string.
- if Current_Char /= First_String(Pos) then
- Bad_Character_Found := True;
- end if;
- Pos := Pos + 1;
- end loop;
-
- if Bad_Character_Found then
- Report.Failed ("Incorrect character read from stream");
- end if;
-
- -- Following user stream/string processing, the stream file is
- -- appended to as follows:
-
- Reset2:
- begin
- Ada.Streams.Stream_IO.Reset (Filter_File, -- Reset.
- Ada.Streams.Stream_IO.Append_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported for Stream_IO" );
- raise Incomplete;
- end Reset2;
-
- if Ada.Streams.Stream_IO.Mode (Filter_File) /= -- Mode.
- Ada.Streams.Stream_IO.Append_File
- then
- Report.Failed ("Incorrect mode following Reset to Append");
- end if;
-
- Pos := 1;
- while Pos <= Natural(Second_String'Length) loop
- -- Write all characters of the Second_String to the stream.
- Character'Write (Filter_Stream, Second_String (Pos)); -- 'Write
- Pos := Pos + 1;
- end loop;
-
- Ada.Streams.Stream_IO.Flush (Filter_File); -- Flush.
-
- -- Record file statistics.
- File_Size := Ada.Streams.Stream_IO.Size (Filter_File); -- Size.
-
- Index_Might_Not_Be_Supported:
- begin
- File_Index := Ada.Streams.Stream_IO.Index (Filter_File); -- Index.
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable ( "Index not supported for Stream_IO" );
- raise Incomplete;
- end Index_Might_Not_Be_Supported;
-
- exception
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception in Enter_Data_In_Stream block");
- raise;
- end Enter_Data_In_Stream;
-
- ---
-
- Filter_Block:
- declare
- Pos : Positive := 1;
- Full_String : constant String := First_String & Second_String;
-
- function Capitalize (Char : Character) return Character is
- begin
- if Char /= ' ' then
- return Character'Val( Character'Pos(Char) -
- (Character'Pos('a') - Character'Pos('A')));
- else
- return Char;
- end if;
- end Capitalize;
-
- begin
-
- Reset3:
- begin
- Ada.Streams.Stream_IO.Reset (Filter_File, -- Reset.
- Ada.Streams.Stream_IO.In_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Stream_IO" );
- raise Incomplete;
- end Reset3;
-
- if Ada.Streams.Stream_IO.Mode (Filter_File) /= -- Mode.
- Ada.Streams.Stream_IO.In_File
- then
- Report.Failed ("Incorrect mode following Reset to In_File");
- end if;
-
- if not Ada.Streams.Stream_IO.Is_Open (Filter_File) then -- Is_Open
- Report.Failed ( "Reset command did not leave file open" );
- end if;
-
- if Ada.Streams.Stream_IO.Size (Filter_File) /= -- Size.
- File_Size
- then
- Report.Failed ("Reset file is not correct size");
- end if;
-
- if Ada.Streams.Stream_IO.Index (Filter_File) /= 1 then -- Index.
- -- File position should have been reset to start of file.
- Report.Failed ("Index of file not set to 1 following Reset");
- end if;
-
- while Pos <= Full_String'Length loop
- -- Read one character from the stream.
- Character'Read (Filter_Stream, Current_Char); -- 'Read
- -- Verify character against the original string.
- if Current_Char /= Full_String(Pos) then
- Report.Failed ("Incorrect character read from stream");
- else
- -- Capitalize the characters read from the stream, and
- -- place them in a string variable.
- Cap_String(Pos) := Capitalize (Current_Char);
- end if;
- Pos := Pos + 1;
- end loop;
-
- -- File index should now be set to the position following the final
- -- character in the file (the same as the index value stored at
- -- the completion of the Enter_Data_In_Stream block).
- if Ada.Streams.Stream_IO.Index (Filter_File) /= -- Index.
- File_Index
- then
- Report.Failed ("Incorrect file index position");
- end if;
-
- -- The stream file should now be at EOF. -- EOF.
- if not Ada.Streams.Stream_IO.End_Of_File (Filter_File) then
- Report.Failed ("File not empty following filtering");
- end if;
-
- exception
-
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception in Filter_Block");
- raise;
- end Filter_Block;
-
- ---
-
- Verification_Block:
- begin
-
- -- Verify that the entire string was examined, and that the
- -- process of capitalizing the character data was successful.
- if Cap_String /= TC_Capital_String then
- Report.Failed ("Incorrect Capitalization");
- end if;
-
- exception
- when others =>
- Report.Failed ("Exception in Verification_Block");
- end Verification_Block;
-
-
- exception
-
- when Incomplete =>
- raise;
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- if Ada.Streams.Stream_IO.Is_Open (Filter_File) then -- Is_Open.
- Ada.Streams.Stream_IO.Delete (Filter_File); -- Delete.
- else
- Ada.Streams.Stream_IO.Open (Filter_File, -- Open.
- Ada.Streams.Stream_IO.Out_File,
- Filter_Filename);
- Ada.Streams.Stream_IO.Delete (Filter_File); -- Delete.
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Stream_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAC002;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxac003.a b/gcc/testsuite/ada/acats/tests/cxa/cxac003.a
deleted file mode 100644
index cc1e044d0a2..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxac003.a
+++ /dev/null
@@ -1,376 +0,0 @@
--- CXAC003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the correct exceptions are raised when improperly
--- manipulating stream file objects.
---
--- TEST DESCRIPTION:
--- This test is designed to focus on Stream_IO file manipulation
--- exceptions. Several potentially common user errors are examined in
--- the test:
---
--- A Status_Error should be raised whenever an attempt is made to perform
--- an operation on a file that is closed.
---
--- A Status_Error should be raised when an attempt is made to open a
--- stream file that is currently open.
---
--- A Mode_Error should be raised when attempting to read from (use the
--- 'Read attribute) on an Out_File or Append_Mode file.
---
--- A Mode_Error should be raised when checking for End Of File on a
--- file with mode Out_File or Append_Mode.
---
--- A Mode_Error should be raised when attempting to write to (use the
--- 'Output attribute) on a file with mode In_File.
---
--- A Name_Error should be raised when the string provided to the Name
--- parameter of an Open operation does not allow association of an
--- external file.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations capable of supporting
--- external Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
--- 02 Mar 01 PHL Check that Ada.Streams.Stream_IO.Stream raises
--- Status_Error if the file is not open. (DR 8652/
--- 0056).
--- 15 Mar 01 RLB Readied for release.
---!
-
-with Ada.Streams.Stream_IO;
-with Report;
-
-procedure CXAC003 is
-
- Stream_File_Object : Ada.Streams.Stream_IO.File_Type;
- Stream_Access_Value : Ada.Streams.Stream_IO.Stream_Access;
- Stream_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAC003" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAC003", "Check that the correct exceptions are " &
- "raised when improperly manipulating stream " &
- "file objects");
-
- Test_for_Stream_IO_Support:
- begin
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Ada.Streams.Stream_IO.Create (Stream_File_Object,
- Ada.Streams.Stream_IO.Out_File,
- Stream_Filename);
-
- exception
-
- when Ada.Streams.Stream_IO.Use_Error | Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Stream_IO" );
- raise Incomplete;
-
- end Test_for_Stream_IO_Support;
-
- Operational_Test_Block:
- begin
- -- A potentially common error in a file processing environment
- -- is to attempt to perform an operation on a stream file that is
- -- not currently open. Status_Error should be raised in this case.
- Check_Status_Error:
- begin
- Ada.Streams.Stream_IO.Close (Stream_File_Object);
- -- Attempt to reset a file that is closed.
- Ada.Streams.Stream_IO.Reset (Stream_File_Object,
- Ada.Streams.Stream_IO.Out_File);
- Report.Failed ("Exception not raised on Reset of closed file");
- exception
- when Ada.Streams.Stream_IO.Status_Error =>
- null;
- when others =>
- Report.Failed ("Incorrect exception raised - 1");
- end Check_Status_Error;
-
- -- A similar error is to use Ada.Streams.Stream_IO.Stream
- -- to attempt to perform an operation on a stream file that is
- -- not currently open. Status_Error should be raised in this case.
- -- (Defect Report 8652/0046, as reflected in Technical Corrigendum 1.)
- Check_Status_Error2:
- begin
- -- Ensure that the file is not open.
- if Ada.Streams.Stream_Io.Is_Open (Stream_File_Object) then
- Ada.Streams.Stream_Io.Close (Stream_File_Object);
- end if;
- Stream_Access_Value :=
- Ada.Streams.Stream_Io.Stream (Stream_File_Object);
- Report.Failed ("Exception not raised on Stream of closed file");
- exception
- when Ada.Streams.Stream_Io.Status_Error =>
- null;
- when others =>
- Report.Failed ("Incorrect exception raised - 2");
- end Check_Status_Error2;
-
- -- Another potentially common error in a file processing environment
- -- is to attempt to Open a stream file that is currently open.
- -- Status_Error should be raised in this case.
- Check_Status_Error3:
- begin
- -- Ensure that the file is open.
- if not Ada.Streams.Stream_IO.Is_Open (Stream_File_Object) then
- Ada.Streams.Stream_IO.Open (Stream_File_Object,
- Ada.Streams.Stream_IO.In_File,
- Stream_Filename);
- end if;
- Ada.Streams.Stream_IO.Open (Stream_File_Object,
- Ada.Streams.Stream_IO.In_File,
- Stream_Filename);
- Report.Failed ("Exception not raised on Open of open file");
- exception
- when Ada.Streams.Stream_IO.Status_Error =>
- null;
- when others =>
- Report.Failed ("Incorrect exception raised - 3");
- end Check_Status_Error3;
-
- -- Another example of a potential error occurring in a file
- -- processing environment is to attempt to use the 'Read attribute
- -- on a stream file that is currently in Out_File or Append_File
- -- mode. Mode_Error should be raised in both of these cases.
- Check_Mode_Error:
- declare
- Int_Var : Integer := -10;
- begin
-
- Reset1:
- begin
- Ada.Streams.Stream_IO.Reset (Stream_File_Object,
- Ada.Streams.Stream_IO.Out_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Out_File not supported for Stream_IO - 1" );
- raise Incomplete;
- end Reset1;
-
- Stream_Access_Value :=
- Ada.Streams.Stream_IO.Stream (Stream_File_Object);
- Integer'Write (Stream_Access_Value, Int_Var);
-
- -- File contains an integer value, but is of mode Out_File.
- Integer'Read (Stream_Access_Value, Int_Var);
- Report.Failed ("Exception not raised by 'Read of Out_File");
- exception
- when Incomplete =>
- raise;
- when Ada.Streams.Stream_IO.Mode_Error =>
- null;
- Try_Read:
- begin
- Reset2:
- begin
- Ada.Streams.Stream_IO.Reset
- (Stream_File_Object, Ada.Streams.Stream_IO.Append_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported " &
- "for Stream_IO - 2" );
- raise Incomplete;
- end Reset2;
-
- Integer'Write (Stream_Access_Value, Int_Var);
- -- Attempt read from Append_File mode file.
- Integer'Read (Stream_Access_Value, Int_Var);
- Report.Failed
- ("Exception not raised by 'Read of Append file");
- exception
- when Incomplete =>
- null;
- when Ada.Streams.Stream_IO.Mode_Error =>
- null;
- when others =>
- Report.Failed ("Incorrect exception raised - 4b");
- end Try_Read;
-
- when others => Report.Failed ("Incorrect exception raised - 4a");
- end Check_Mode_Error;
-
- -- Another example of a this type of potential error is to attempt
- -- to check for End Of File on a stream file that is currently in
- -- Out_File or Append_File mode. Mode_Error should also be raised
- -- in both of these cases.
- Check_End_File:
- declare
- Test_Boolean : Boolean := False;
- begin
- Reset3:
- begin
- Ada.Streams.Stream_IO.Reset (Stream_File_Object,
- Ada.Streams.Stream_IO.Out_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Out_File not supported for Stream_IO - 3" );
- raise Incomplete;
- end Reset3;
-
- Test_Boolean :=
- Ada.Streams.Stream_IO.End_Of_File (Stream_File_Object);
- Report.Failed ("Exception not raised by EOF on Out_File");
- exception
- when Incomplete =>
- null;
- when Ada.Streams.Stream_IO.Mode_Error =>
- null;
- EOF_For_Append_File:
- begin
- Reset4:
- begin
- Ada.Streams.Stream_IO.Reset
- (Stream_File_Object, Ada.Streams.Stream_IO.Append_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to Append_File not supported " &
- "for Stream_IO - 4" );
- raise Incomplete;
- end Reset4;
-
- Test_Boolean :=
- Ada.Streams.Stream_IO.End_Of_File (Stream_File_Object);
- Report.Failed
- ("Exception not raised by EOF of Append file");
- exception
- when Incomplete =>
- raise;
- when Ada.Streams.Stream_IO.Mode_Error =>
- null;
- when others =>
- Report.Failed ("Incorrect exception raised - 5b");
- end EOF_For_Append_File;
-
- when others => Report.Failed ("Incorrect exception raised - 5a");
- end Check_End_File;
-
-
-
- -- In a similar situation to the above cases for attribute 'Read,
- -- an attempt to use the 'Output attribute on a stream file that
- -- is currently in In_File mode should result in Mode_Error being
- -- raised.
- Check_Output_Mode_Error:
- begin
- Reset5:
- begin
- Ada.Streams.Stream_IO.Reset (Stream_File_Object,
- Ada.Streams.Stream_IO.In_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Stream_IO - 6" );
- raise Incomplete;
- end Reset5;
-
- Stream_Access_Value :=
- Ada.Streams.Stream_IO.Stream (Stream_File_Object);
- String'Output (Stream_Access_Value, "User-Oriented String");
- Report.Failed ("Exception not raised by 'Output to In_File");
- exception
- when Incomplete =>
- null;
- when Ada.Streams.Stream_IO.Mode_Error =>
- null;
- when others =>
- Report.Failed ("Incorrect exception raised - 6");
- end Check_Output_Mode_Error;
-
- -- Any case of attempting to Open a stream file with a string for
- -- the parameter Name that does not allow the identification of an
- -- external file will result in the exception Name_Error being
- -- raised.
- Check_Illegal_File_Name:
- begin
- if Ada.Streams.Stream_IO.Is_Open (Stream_File_Object) then
- Ada.Streams.Stream_IO.Close (Stream_File_Object);
- end if;
- -- No external file exists with this filename, allowing no
- -- association with an internal file object, resulting in the
- -- raising of the exception Name_Error.
- Ada.Streams.Stream_IO.Open(File => Stream_File_Object,
- Mode => Ada.Streams.Stream_IO.Out_File,
- Name => Report.Legal_File_Name(2));
- Report.Failed ("Exception not raised by bad filename on Open");
- exception
- when Ada.Streams.Stream_IO.Name_Error =>
- null;
- when others =>
- Report.Failed ("Incorrect exception raised - 7");
- end Check_Illegal_File_Name;
-
- exception
- when Incomplete =>
- null;
- when others =>
- Report.Failed ("Unexpected exception in Operational Test Block");
-
- end Operational_Test_Block;
-
- Deletion:
- begin
- if Ada.Streams.Stream_IO.Is_Open (Stream_File_Object) then
- Ada.Streams.Stream_IO.Delete (Stream_File_Object);
- else
- Ada.Streams.Stream_IO.Open (Stream_File_Object,
- Ada.Streams.Stream_IO.Out_File,
- Stream_Filename);
- Ada.Streams.Stream_IO.Delete (Stream_File_Object);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Stream_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAC003;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxac004.a b/gcc/testsuite/ada/acats/tests/cxa/cxac004.a
deleted file mode 100644
index 9cc88b93cfb..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxac004.a
+++ /dev/null
@@ -1,310 +0,0 @@
--- CXAC004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the Stream_Access type and Stream function found in package
--- Ada.Text_IO.Text_Streams allows a text file to be processed with the
--- functionality of streams.
---
--- TEST DESCRIPTION:
--- This test verifies that the package Ada.Text_IO.Text_Streams is
--- available and that the functionality it contains allows a text file to
--- be manipulated as a stream.
--- The test defines data objects of a variety of types that can be stored
--- in a text file. A text file and associated text stream are then
--- defined, and the 'Write attribute is used to enter the individual data
--- items into the text stream. Once all the individual data items have
--- been written to the stream, the 'Output attribute is used to write
--- arrays of these same data objects to the stream.
--- The text file is reset to serve as an input file, and the 'Read
--- attribute is used to extract the individual data items from the
--- stream. These items are then verified against the data originally
--- written to the stream. Finally, the 'Input attribute is used to
--- extract the data arrays from the stream. These arrays are then
--- verified against the original data written to the stream.
---
--- APPLICABILITY CRITERIA:
--- Applicable to implementations that support external text files.
---
--- CHANGE HISTORY:
--- 06 Jul 95 SAIC Initial prerelease version.
--- 26 Feb 97 PWB.CTA Allowed for non-support of some IO operations;
--- removed requirement for support of decimal types.
---!
-
-with Report;
-with Ada.Text_IO;
-with Ada.Text_IO.Text_Streams;
-with Ada.Characters.Latin_1;
-with Ada.Strings.Unbounded;
-
-procedure CXAC004 is
-
- Data_File : Ada.Text_IO.File_Type;
- Data_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXAC004" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXAC004", "Check that the Stream_Access type and Stream " &
- "function found in package " &
- "Ada.Text_IO.Text_Streams allows a text file to " &
- "be processed with the functionality of streams");
-
- Test_for_IO_Support:
- begin
-
- -- Check for Text_IO support in creating the data file. If the
- -- implementation does not support external files, Name_Error or
- -- Use_Error will be raised at the point of the following call to
- -- Create, resulting in a Not_Applicable test result.
-
- Ada.Text_IO.Create(Data_File, Ada.Text_IO.Out_File, Data_Filename);
-
- exception
-
- when Ada.Text_IO.Use_Error | Ada.Text_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Text_IO" );
- raise Incomplete;
-
- end Test_for_IO_Support;
-
- Test_Block:
- declare
- use Ada.Characters.Latin_1, Ada.Strings.Unbounded;
- TC_Items : constant := 3;
-
- -- Declare types and objects that will be used as data values to be
- -- written to and read from the text file/stream.
-
- type Enum_Type is (Red, Yellow, Green, Blue, Indigo);
- type Fixed_Type is delta 0.125 range 0.0..255.0;
- type Float_Type is digits 7 range 0.0..1.0E5;
- type Modular_Type is mod 256;
- subtype Str_Type is String(1..4);
-
- type Char_Array_Type is array (1..TC_Items) of Character;
- type Enum_Array_Type is array (1..TC_Items) of Enum_Type;
- type Fixed_Array_Type is array (1..TC_Items) of Fixed_Type;
- type Float_Array_Type is array (1..TC_Items) of Float_Type;
- type Int_Array_Type is array (1..TC_Items) of Integer;
- type Mod_Array_Type is array (1..TC_Items) of Modular_Type;
- type Str_Array_Type is array (1..TC_Items) of Str_Type;
- type Unb_Str_Array_Type is array (1..TC_Items) of Unbounded_String;
-
- Char_Array : Char_Array_Type := ('A', 'z', Yen_Sign);
- TC_Char_Array_1,
- TC_Char_Array_2 : Char_Array_Type := (others => Space);
-
- Enum_Array : Enum_Array_Type := (Blue, Yellow, Indigo);
- TC_Enum_Array_1,
- TC_Enum_Array_2 : Enum_Array_Type := (others => Red);
-
- Fix_Array : Fixed_Array_Type := (0.125, 123.5, 250.750);
- TC_Fix_Array_1,
- TC_Fix_Array_2 : Fixed_Array_Type := (others => 0.0);
-
- Flt_Array : Float_Array_Type := (1.0, 150.0, 1500.0);
- TC_Flt_Array_1,
- TC_Flt_Array_2 : Float_Array_Type := (others => 0.0);
-
- Int_Array : Int_Array_Type := (124, 2349, -24_001);
- TC_Int_Array_1,
- TC_Int_Array_2 : Int_Array_Type := (others => -99);
-
- Mod_Array : Mod_Array_Type := (10, 127, 255);
- TC_Mod_Array_1,
- TC_Mod_Array_2 : Mod_Array_Type := (others => 0);
-
- Str_Array : Str_Array_Type := ("abcd", "klmn", "wxyz");
- TC_Str_Array_1,
- TC_Str_Array_2 : Str_Array_Type := (others => " ");
-
- UStr_Array : Unb_Str_Array_Type :=
- (To_Unbounded_String("cat"),
- To_Unbounded_String("testing"),
- To_Unbounded_String("ACVC"));
- TC_UStr_Array_1,
- TC_UStr_Array_2 : Unb_Str_Array_Type :=
- (others => Null_Unbounded_String);
-
- -- Create a stream access object pointing to the data file.
-
- Data_Stream : Ada.Text_IO.Text_Streams.Stream_Access :=
- Ada.Text_IO.Text_Streams.Stream(File => Data_File);
-
- begin
-
- -- Use the 'Write attribute to enter the three sets of data items
- -- into the data stream.
- -- Note that the data will be mixed within the text file.
-
- for i in 1..TC_Items loop
- Character'Write (Data_Stream, Char_Array(i));
- Enum_Type'Write (Data_Stream, Enum_Array(i));
- Fixed_Type'Write (Data_Stream, Fix_Array(i));
- Float_Type'Write (Data_Stream, Flt_Array(i));
- Integer'Write (Data_Stream, Int_Array(i));
- Modular_Type'Write (Data_Stream, Mod_Array(i));
- Str_Type'Write (Data_Stream, Str_Array(i));
- Unbounded_String'Write(Data_Stream, UStr_Array(i));
- end loop;
-
- -- Use the 'Output attribute to enter the entire arrays of each
- -- type of data items into the data stream.
- -- Note that the array bounds will be written to the stream as part
- -- of the action of the 'Output attribute.
-
- Char_Array_Type'Output (Data_Stream, Char_Array);
- Enum_Array_Type'Output (Data_Stream, Enum_Array);
- Fixed_Array_Type'Output (Data_Stream, Fix_Array);
- Float_Array_Type'Output (Data_Stream, Flt_Array);
- Int_Array_Type'Output (Data_Stream, Int_Array);
- Mod_Array_Type'Output (Data_Stream, Mod_Array);
- Str_Array_Type'Output (Data_Stream, Str_Array);
- Unb_Str_Array_Type'Output (Data_Stream, UStr_Array);
-
- -- Reset the data file to mode In_File. The data file will now serve
- -- as the source of data which will be compared to the original data
- -- written to the file above.
- Reset1:
- begin
- Ada.Text_IO.Reset (File => Data_File, Mode => Ada.Text_IO.In_File);
- exception
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Text_IO" );
- raise Incomplete;
- end Reset1;
-
- -- Extract and validate all the single data items from the stream.
-
- for i in 1..TC_Items loop
- Character'Read (Data_Stream, TC_Char_Array_1(i));
- Enum_Type'Read (Data_Stream, TC_Enum_Array_1(i));
- Fixed_Type'Read (Data_Stream, TC_Fix_Array_1(i));
- Float_Type'Read (Data_Stream, TC_Flt_Array_1(i));
- Integer'Read (Data_Stream, TC_Int_Array_1(i));
- Modular_Type'Read (Data_Stream, TC_Mod_Array_1(i));
- Str_Type'Read (Data_Stream, TC_Str_Array_1(i));
- Unbounded_String'Read (Data_Stream, TC_UStr_Array_1(i));
- end loop;
-
- if TC_Char_Array_1 /= Char_Array then
- Report.Failed("Character values do not match");
- end if;
- if TC_Enum_Array_1 /= Enum_Array then
- Report.Failed("Enumeration values do not match");
- end if;
- if TC_Fix_Array_1 /= Fix_Array then
- Report.Failed("Fixed point values do not match");
- end if;
- if TC_Flt_Array_1 /= Flt_Array then
- Report.Failed("Floating point values do not match");
- end if;
- if TC_Int_Array_1 /= Int_Array then
- Report.Failed("Integer values do not match");
- end if;
- if TC_Mod_Array_1 /= Mod_Array then
- Report.Failed("Modular values do not match");
- end if;
- if TC_Str_Array_1 /= Str_Array then
- Report.Failed("String values do not match");
- end if;
- if TC_UStr_Array_1 /= UStr_Array then
- Report.Failed("Unbounded_String values do not match");
- end if;
-
- -- Extract and validate all data arrays from the data stream.
- -- Note that the 'Input attribute denotes a function, whereas the
- -- other stream oriented attributes in this test denote procedures.
-
- TC_Char_Array_2 := Char_Array_Type'Input(Data_Stream);
- TC_Enum_Array_2 := Enum_Array_Type'Input(Data_Stream);
- TC_Fix_Array_2 := Fixed_Array_Type'Input(Data_Stream);
- TC_Flt_Array_2 := Float_Array_Type'Input(Data_Stream);
- TC_Int_Array_2 := Int_Array_Type'Input(Data_Stream);
- TC_Mod_Array_2 := Mod_Array_Type'Input(Data_Stream);
- TC_Str_Array_2 := Str_Array_Type'Input(Data_Stream);
- TC_UStr_Array_2 := Unb_Str_Array_Type'Input(Data_Stream);
-
- if TC_Char_Array_2 /= Char_Array then
- Report.Failed("Character array values do not match");
- end if;
- if TC_Enum_Array_2 /= Enum_Array then
- Report.Failed("Enumeration array values do not match");
- end if;
- if TC_Fix_Array_2 /= Fix_Array then
- Report.Failed("Fixed point array values do not match");
- end if;
- if TC_Flt_Array_2 /= Flt_Array then
- Report.Failed("Floating point array values do not match");
- end if;
- if TC_Int_Array_2 /= Int_Array then
- Report.Failed("Integer array values do not match");
- end if;
- if TC_Mod_Array_2 /= Mod_Array then
- Report.Failed("Modular array values do not match");
- end if;
- if TC_Str_Array_2 /= Str_Array then
- Report.Failed("String array values do not match");
- end if;
- if TC_UStr_Array_2 /= UStr_Array then
- Report.Failed("Unbounded_String array values do not match");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Deletion:
- begin
- -- Delete the data file.
- if not Ada.Text_IO.Is_Open(Data_File) then
- Ada.Text_IO.Open(Data_File, Ada.Text_IO.In_File, Data_Filename);
- end if;
- Ada.Text_IO.Delete(Data_File);
-
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Text_IO" );
-
- end Deletion;
-
- Report.Result;
-
-exception
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXAC004;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxac005.a b/gcc/testsuite/ada/acats/tests/cxa/cxac005.a
deleted file mode 100644
index 34a971f7a51..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxac005.a
+++ /dev/null
@@ -1,343 +0,0 @@
--- CXAC005.A
---
--- Grant of Unlimited Rights
---
--- The Ada Conformity Assessment Authority (ACAA) holds unlimited
--- rights in the software and documentation contained herein. Unlimited
--- rights are the same as those granted by the U.S. Government for older
--- parts of the Ada Conformity Assessment Test Suite, and are defined
--- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA
--- intends to confer upon all recipients unlimited rights equal to those
--- held by the ACAA. These rights include rights to use, duplicate,
--- release or disclose the released technical data and computer software
--- in whole or in part, in any manner and for any purpose whatsoever, and
--- to have or permit others to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that stream file positioning work as specified. (Defect Report
--- 8652/0055).
---
--- CHANGE HISTORY:
--- 12 FEB 2001 PHL Initial version.
--- 14 MAR 2001 RLB Readied for release; fixed Not_Applicable check
--- to terminate test gracefully.
---
---!
-with Ada.Streams.Stream_Io;
-use Ada.Streams;
-with Ada.Exceptions;
-use Ada.Exceptions;
-with Report;
-use Report;
-procedure CXAC005 is
-
- Incomplete : exception;
-
- procedure TC_Assert (Condition : Boolean; Message : String) is
- begin
- if not Condition then
- Failed (Message);
- end if;
- end TC_Assert;
-
- package Checked_Stream_Io is
-
- type File_Type (Max_Size : Stream_Element_Count) is limited private;
- function Stream_Io_File (File : File_Type) return Stream_Io.File_Type;
-
- procedure Create (File : in out File_Type;
- Mode : in Stream_Io.File_Mode := Stream_Io.Out_File;
- Name : in String := "";
- Form : in String := "");
-
- procedure Open (File : in out File_Type;
- Mode : in Stream_Io.File_Mode;
- Name : in String;
- Form : in String := "");
-
- procedure Close (File : in out File_Type);
- procedure Delete (File : in out File_Type);
-
- procedure Reset (File : in out File_Type;
- Mode : in Stream_Io.File_Mode);
- procedure Reset (File : in out File_Type);
-
- procedure Read (File : in out File_Type;
- Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset;
- From : in Stream_Io.Positive_Count);
-
- procedure Read (File : in out File_Type;
- Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset);
-
- procedure Write (File : in out File_Type;
- Item : in Stream_Element_Array;
- To : in Stream_Io.Positive_Count);
-
- procedure Write (File : in out File_Type;
- Item : in Stream_Element_Array);
-
- procedure Set_Index (File : in out File_Type;
- To : in Stream_Io.Positive_Count);
-
- function Index (File : in File_Type) return Stream_Io.Positive_Count;
-
- procedure Set_Mode (File : in out File_Type;
- Mode : in Stream_Io.File_Mode);
-
- private
- type File_Type (Max_Size : Stream_Element_Count) is
- record
- File : Stream_Io.File_Type;
- Index : Stream_Io.Positive_Count;
- Contents :
- Stream_Element_Array
- (Stream_Element_Offset (Ident_Int (1)) .. Max_Size);
- end record;
- end Checked_Stream_Io;
-
- package body Checked_Stream_Io is
-
- use Stream_Io;
-
- function Stream_Io_File (File : File_Type) return Stream_Io.File_Type is
- begin
- return File.File;
- end Stream_Io_File;
-
- procedure Create (File : in out File_Type;
- Mode : in Stream_Io.File_Mode := Stream_Io.Out_File;
- Name : in String := "";
- Form : in String := "") is
- begin
- Stream_Io.Create (File.File, Mode, Name, Form);
- File.Index := Stream_Io.Index (File.File);
- if Mode = Append_File then
- TC_Assert (File.Index = Stream_Io.Size (File.File) + 1,
- "Index /= Size + 1 -- Create - Append_File");
- else
- TC_Assert (File.Index = 1, "Index /= 1 -- Create - " &
- File_Mode'Image (Mode));
- end if;
- end Create;
-
- procedure Open (File : in out File_Type;
- Mode : in Stream_Io.File_Mode;
- Name : in String;
- Form : in String := "") is
- begin
- Stream_Io.Open (File.File, Mode, Name, Form);
- File.Index := Stream_Io.Index (File.File);
- if Mode = Append_File then
- TC_Assert (File.Index = Stream_Io.Size (File.File) + 1,
- "Index /= Size + 1 -- Open - Append_File");
- else
- TC_Assert (File.Index = 1, "Index /= 1 -- Open - " &
- File_Mode'Image (Mode));
- end if;
- end Open;
-
- procedure Close (File : in out File_Type) is
- begin
- Stream_Io.Close (File.File);
- end Close;
-
- procedure Delete (File : in out File_Type) is
- begin
- Stream_Io.Delete (File.File);
- end Delete;
-
- procedure Reset (File : in out File_Type;
- Mode : in Stream_Io.File_Mode) is
- begin
- Stream_Io.Reset (File.File, Mode);
- File.Index := Stream_Io.Index (File.File);
- if Mode = Append_File then
- TC_Assert (File.Index = Stream_Io.Size (File.File) + 1,
- "Index /= Size + 1 -- Reset - Append_File");
- else
- TC_Assert (File.Index = 1, "Index /= 1 -- Reset - " &
- File_Mode'Image (Mode));
- end if;
- end Reset;
-
- procedure Reset (File : in out File_Type) is
- begin
- Reset (File, Stream_Io.Mode (File.File));
- end Reset;
-
-
- procedure Read (File : in out File_Type;
- Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset;
- From : in Stream_Io.Positive_Count) is
- begin
- Set_Index (File, From);
- Read (File, Item, Last);
- end Read;
-
- procedure Read (File : in out File_Type;
- Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset) is
- Index : constant Stream_Element_Offset :=
- Stream_Element_Offset (File.Index);
- begin
- Stream_Io.Read (File.File, Item, Last);
- if Last < Item'Last then
- TC_Assert (Item (Item'First .. Last) =
- File.Contents (Index .. Index + Last - Item'First),
- "Incorrect data read from file - 1");
- TC_Assert (Count (Index + Last - Item'First) =
- Stream_Io.Size (File.File),
- "Read stopped before end of file");
- File.Index := Count (Index + Last - Item'First) + 1;
- else
- TC_Assert (Item = File.Contents (Index .. Index + Item'Length - 1),
- "Incorrect data read from file - 2");
- File.Index := File.Index + Item'Length;
- end if;
- end Read;
-
- procedure Write (File : in out File_Type;
- Item : in Stream_Element_Array;
- To : in Stream_Io.Positive_Count) is
- begin
- Set_Index (File, To);
- Write (File, Item);
- end Write;
-
- procedure Write (File : in out File_Type;
- Item : in Stream_Element_Array) is
- Index : constant Stream_Element_Offset :=
- Stream_Element_Offset (File.Index);
- begin
- Stream_Io.Write (File.File, Item);
- File.Contents (Index .. Index + Item'Length - 1) := Item;
- File.Index := File.Index + Item'Length;
- TC_Assert (File.Index = Stream_Io.Index (File.File),
- "Write failed to move the index");
- end Write;
-
- procedure Set_Index (File : in out File_Type;
- To : in Stream_Io.Positive_Count) is
- begin
- Stream_Io.Set_Index (File.File, To);
- File.Index := Stream_Io.Index (File.File);
- TC_Assert (File.Index = To, "Set_Index failed");
- end Set_Index;
-
- function Index (File : in File_Type) return Stream_Io.Positive_Count is
- New_Index : constant Count := Stream_Io.Index (File.File);
- begin
- TC_Assert (New_Index = File.Index, "Index changed unexpectedly");
- return New_Index;
- end Index;
-
- procedure Set_Mode (File : in out File_Type;
- Mode : in Stream_Io.File_Mode) is
- Old_Index : constant Count := File.Index;
- begin
- Stream_Io.Set_Mode (File.File, Mode);
- File.Index := Stream_Io.Index (File.File);
- if Mode = Append_File then
- TC_Assert (File.Index = Stream_Io.Size (File.File) + 1,
- "Index /= Size + 1 -- Set_Mode - Append_File");
- else
- TC_Assert (File.Index = Old_Index, "Set_Mode changed the index");
- end if;
- end Set_Mode;
-
- end Checked_Stream_Io;
-
- package Csio renames Checked_Stream_Io;
-
- F : Csio.File_Type (100);
- S : Stream_Element_Array (1 .. 10);
- Last : Stream_Element_Offset;
-
-begin
-
- Test ("CXAC005", "Check that stream file positioning work as specified");
-
- declare
- Name : constant String := Legal_File_Name;
- begin
- begin
- Csio.Create (F, Name => Name);
- exception
- when others =>
- Not_Applicable ("Files not supported - Creation with Out_File for Stream_IO");
- raise Incomplete;
- end;
-
- for I in Stream_Element range 1 .. 10 loop
- Csio.Write (F, ((1 => I + 2)));
- end loop;
- Csio.Write (F, (1 .. 15 => 11));
- Csio.Write (F, (1 .. 15 => 12), To => 15);
-
- Csio.Reset (F);
-
- for I in Stream_Element range 1 .. 10 loop
- Csio.Write (F, (1 => I));
- end loop;
- Csio.Write (F, (1 .. 15 => 13));
- Csio.Write (F, (1 .. 15 => 14), To => 15);
- Csio.Write (F, (1 => 90));
-
- Csio.Set_Mode (F, Stream_Io.In_File);
-
- Csio.Read (F, S, Last);
- Csio.Read (F, S, Last, From => 3);
- Csio.Read (F, S, Last, From => 28);
-
- Csio.Set_Mode (F, Stream_Io.Append_File);
- Csio.Write (F, (1 .. 5 => 88));
-
- Csio.Close (F);
-
- Csio.Open (F, Name => Name, Mode => Stream_Io.Append_File);
- Csio.Write (F, (1 .. 3 => 33));
-
- Csio.Set_Mode (F, Stream_Io.In_File);
- Csio.Read (F, S, Last, From => 20);
- Csio.Read (F, S, Last);
- Csio.Reset (F, Stream_Io.Out_File);
-
- Csio.Write (F, (1 .. 9 => 99));
-
- -- Check the contents of the entire file.
- declare
- S : Stream_Element_Array
- (1 .. Stream_Element_Offset
- (Stream_Io.Size (Csio.Stream_Io_File (F))));
- begin
- Csio.Reset (F, Stream_Io.In_File);
- Csio.Read (F, S, Last);
- end;
-
- Csio.Delete (F);
- end;
-
- Result;
-exception
- when Incomplete =>
- Report.Result;
- when E:others =>
- Report.Failed ("Unexpected exception raised - " & Exception_Name (E) &
- " - " & Exception_Message (E));
- Report.Result;
-
-end CXAC005;
-
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaca01.a b/gcc/testsuite/ada/acats/tests/cxa/cxaca01.a
deleted file mode 100644
index cda8776a53d..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaca01.a
+++ /dev/null
@@ -1,291 +0,0 @@
--- CXACA01.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the default attributes 'Write and 'Read work properly when
--- used with objects of a variety of types, including records with
--- default discriminants, records without default discriminants, but
--- which have the discriminant described in a representation clause for
--- the type, and arrays.
---
--- TEST DESCRIPTION:
--- This test simulates a basic sales record system, using Stream_IO to
--- allow the storage of heterogeneous data in a single stream file.
---
--- Four types of data are written to the stream file for each product.
--- First, the "header" information on the product is written.
--- This is an object of a discriminated (with default) record
--- type. This is followed by an integer object containing a count of
--- the number of sales data records to follow. The corresponding number
--- of sales records follow in the stream. These are of a record type
--- with a discriminant without a default, but where the discriminant is
--- included in the representation clause for the type. Finally, an
--- array object with statistical sales information for the product is
--- written to the stream.
---
--- Objects of both record types specified below (discriminated records
--- with defaults, and discriminated records w/o defaults that have the
--- discriminant included in a representation clause for the type) should
--- have their discriminants included in the stream when using 'Write.
--- Likewise, discriminants should be extracted from the stream when
--- using 'Read.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all implementations that support external
--- Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with FXACA00;
-with Ada.Streams.Stream_IO;
-with Report;
-
-procedure CXACA01 is
-
-begin
-
- Report.Test ("CXACA01", "Check that 'Write and 'Read work properly " &
- "when used with complex data types");
-
- Test_for_Stream_IO_Support:
- declare
-
- Info_File : Ada.Streams.Stream_IO.File_Type;
- Info_Stream : Ada.Streams.Stream_IO.Stream_Access;
- The_Filename : constant String := Report.Legal_File_Name;
-
- begin
-
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Ada.Streams.Stream_IO.Create (Info_File,
- Ada.Streams.Stream_IO.Out_File,
- The_Filename);
-
- Operational_Test_Block:
- declare
-
- begin
-
- Info_Stream := Ada.Streams.Stream_IO.Stream (Info_File);
-
- -- Write all of the product information (record, integer, and array
- -- objects) defined in package FXACA00 into the stream.
-
- Store_Data_Block:
- begin
-
- -- Write information about first product to the stream.
- FXACA00.Product_Type'Write (Info_Stream, FXACA00.Product_01);
- Integer'Write (Info_Stream, FXACA00.Sale_Count_01);
- FXACA00.Sales_Record_Type'Write(Info_Stream, FXACA00.Sale_Rec_01);
- FXACA00.Sales_Record_Type'Write(Info_Stream, FXACA00.Sale_Rec_02);
- FXACA00.Sales_Statistics_Type'Write
- (Info_Stream, FXACA00.Product_01_Stats);
-
- -- Write information about second product to the stream.
- -- Note: No Sales_Record_Type objects.
- FXACA00.Product_Type'Write (Info_Stream, FXACA00.Product_02);
- Integer'Write (Info_Stream, FXACA00.Sale_Count_02);
- FXACA00.Sales_Statistics_Type'Write
- (Info_Stream, FXACA00.Product_02_Stats);
-
- -- Write information about third product to the stream.
- FXACA00.Product_Type'Write (Info_Stream, FXACA00.Product_03);
- Integer'Write (Info_Stream, FXACA00.Sale_Count_03);
- FXACA00.Sales_Record_Type'Write(Info_Stream, FXACA00.Sale_Rec_03);
- FXACA00.Sales_Record_Type'Write(Info_Stream, FXACA00.Sale_Rec_04);
- FXACA00.Sales_Record_Type'Write(Info_Stream, FXACA00.Sale_Rec_05);
- FXACA00.Sales_Statistics_Type'Write
- (Info_Stream, FXACA00.Product_03_Stats);
-
- end Store_Data_Block;
-
-
- Verify_Data_Block:
- declare
-
- use FXACA00; -- Used within this block only.
-
- type Domestic_Rec_Array_Type is
- array (Positive range <>) of Sales_Record_Type (Domestic);
-
- type Foreign_Rec_Array_Type is
- array (Positive range <>) of Sales_Record_Type (Foreign);
-
- TC_Rec1 : Domestic_Rec_Array_Type (1..2);
- TC_Rec3 : Foreign_Rec_Array_Type (1..3);
-
- TC_Product1 : Product_Type;
- TC_Product2,
- TC_Product3 : Product_Type (Foreign);
-
- TC_Count1,
- TC_Count2,
- TC_Count3 : Integer := -10; -- Initialized to dummy value.
-
- TC_Stat1,
- TC_Stat2,
- TC_Stat3 : Sales_Statistics_Type := (others => 500);
-
- begin
-
- Ada.Streams.Stream_IO.Reset (Info_File,
- Ada.Streams.Stream_IO.In_File);
-
- -- Read all of the data that is contained in the stream.
- -- Compare all data with the original data in package FXACA00
- -- that was written to the stream.
- -- The calls to the read attribute are in anticipated order, based
- -- on the order of data written to the stream. Possible errors,
- -- such as data placement, overwriting, etc., will be manifest as
- -- exceptions raised by the attribute during an unsuccessful read
- -- attempt.
-
- -- Extract data on first product.
- Product_Type'Read (Info_Stream, TC_Product1);
- Integer'Read (Info_Stream, TC_Count1);
-
- -- Two "domestic" variant sales records will be read from the
- -- stream.
- for i in 1 .. TC_Count1 loop
- Sales_Record_Type'Read (Info_Stream, TC_Rec1(i) );
- end loop;
-
- Sales_Statistics_Type'Read (Info_Stream, TC_Stat1);
-
-
- -- Extract data on second product.
- Product_Type'Read (Info_Stream, TC_Product2);
- Integer'Read (Info_Stream, TC_Count2);
- Sales_Statistics_Type'Read (Info_Stream, TC_Stat2);
-
-
- -- Extract data on third product.
- Product_Type'Read (Info_Stream, TC_Product3);
- Integer'Read (Info_Stream, TC_Count3);
-
- -- Three "foreign" variant sales records will be read from the
- -- stream.
- for i in 1 .. TC_Count3 loop
- Sales_Record_Type'Read (Info_Stream, TC_Rec3(i) );
- end loop;
-
- Sales_Statistics_Type'Read (Info_Stream, TC_Stat3);
-
-
- -- After all the data has been correctly extracted, the file
- -- should be empty.
-
- if not Ada.Streams.Stream_IO.End_Of_File (Info_File) then
- Report.Failed ("Stream file not empty");
- end if;
-
- -- Verify that the data values read from the stream are the same
- -- as those written to the stream.
-
- -- Verify the information of the first product.
- if ((Product_01 /= TC_Product1) or else
- (Product_01.Manufacture /= TC_Product1.Manufacture) or else
- (Sale_Count_01 /= TC_Count1) or else
- (Sale_Rec_01 /= TC_Rec1(1)) or else
- (Sale_Rec_01.Buyer /= TC_Rec1(1).Buyer) or else
- (Sale_Rec_02 /= TC_Rec1(2)) or else
- (Sale_Rec_02.Buyer /= TC_Rec1(2).Buyer) or else
- (Product_01_Stats /= TC_Stat1))
- then
- Report.Failed ("Product 1 information incorrect");
- end if;
-
- -- Verify the information of the second product.
- if not ((Product_02 = TC_Product2) and then
- (Sale_Count_02 = TC_Count2) and then
- (Product_02_Stats = TC_Stat2))
- then
- Report.Failed ("Product 2 information incorrect");
- end if;
-
- -- Verify the information of the third product.
- if ((Product_03 /= TC_Product3) or else
- (Product_03.Manufacture /= TC_Product3.Manufacture) or else
- (Sale_Count_03 /= TC_Count3) or else
- (Sale_Rec_03 /= TC_Rec3(1)) or else
- (Sale_Rec_03.Buyer /= TC_Rec3(1).Buyer) or else
- (Sale_Rec_04 /= TC_Rec3(2)) or else
- (Sale_Rec_04.Buyer /= TC_Rec3(2).Buyer) or else
- (Sale_Rec_05 /= TC_Rec3(3)) or else
- (Sale_Rec_05.Buyer /= TC_Rec3(3).Buyer) or else
- (Product_03_Stats /= TC_Stat3))
- then
- Report.Failed ("Product 3 information incorrect");
- end if;
-
- end Verify_Data_Block;
-
- exception
-
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
-
- end Operational_Test_Block;
-
- if Ada.Streams.Stream_IO.Is_Open (Info_File) then
- Ada.Streams.Stream_IO.Delete (Info_File);
- else
- Ada.Streams.Stream_IO.Open (Info_File,
- Ada.Streams.Stream_IO.In_File,
- The_Filename);
- Ada.Streams.Stream_IO.Delete (Info_File);
- end if;
-
- exception
-
- -- Since Use_Error or Name_Error can be raised if, for the specified
- -- mode, the environment does not support Stream_IO operations,
- -- the following handlers are included:
-
- when Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable ("Name_Error raised on Stream IO Create");
-
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable ("Use_Error raised on Stream IO Create");
-
- when others =>
- Report.Failed ("Unexpected exception raised on Stream IO Create");
-
- end Test_for_Stream_IO_Support;
-
- Report.Result;
-
-end CXACA01;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaca02.a b/gcc/testsuite/ada/acats/tests/cxa/cxaca02.a
deleted file mode 100644
index 5106dd3991d..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaca02.a
+++ /dev/null
@@ -1,360 +0,0 @@
--- CXACA02.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that user defined subprograms can override the default
--- attributes 'Read and 'Write using attribute definition clauses.
--- Use objects of record types.
---
--- TEST DESCRIPTION:
--- This test demonstrates that the default implementations of the
--- 'Read and 'Write attributes can be overridden by user specified
--- subprograms in conjunction with attribute definition clauses.
--- These attributes have been overridden below, and in the user defined
--- substitutes, values are added or subtracted to global variables.
--- The global variables are evaluated to ensure that the user defined
--- subprograms were used in overriding the type-related default
--- attributes.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all implementations that support external
--- Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 21 Nov 95 SAIC Corrected recursive attribute definitions
--- for ACVC 2.0.1.
--- 24 Aug 96 SAIC Corrected typo in test verification criteria.
---
---!
-
-with Report;
-with Ada.Streams.Stream_IO;
-
-procedure CXACA02 is
-begin
-
- Report.Test ("CXACA02", "Check that user defined subprograms can " &
- "override the default attributes 'Read and " &
- "'Write using attribute definition clauses");
-
- Test_for_Stream_IO_Support:
- declare
-
- Data_File : Ada.Streams.Stream_IO.File_Type;
- Data_Stream : Ada.Streams.Stream_IO.Stream_Access;
- The_Filename : constant String := Report.Legal_File_Name;
-
- begin
-
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Ada.Streams.Stream_IO.Create (Data_File,
- Ada.Streams.Stream_IO.Out_File,
- The_Filename);
-
- Operational_Test_Block:
- declare
-
- type Origin_Type is (Foreign, Domestic);
- subtype String_Data_Type is String(1..8);
-
- type Product_Type is
- record
- Item : String_Data_Type;
- ID : Natural range 1..100;
- Manufacture : Origin_Type := Domestic;
- Distributor : String_Data_Type;
- Importer : String_Data_Type;
- end record;
-
- type Sales_Record_Type is
- record
- Name : String_Data_Type;
- Sale_Item : Boolean := False;
- Buyer : Origin_Type;
- Quantity_Discount : Boolean;
- Cash_Discount : Boolean;
- end record;
-
-
- -- Mode conformant, user defined subprograms that will override
- -- the type-related attributes.
- -- In this test, the user defines these subprograms to add/subtract
- -- specific values from global variables.
-
- procedure Product_Read
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : out Product_Type );
-
- procedure Product_Write
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : Product_Type );
-
- procedure Sales_Read
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : out Sales_Record_Type );
-
- procedure Sales_Write
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : Sales_Record_Type );
-
- -- Attribute definition clauses.
-
- for Product_Type'Read use Product_Read;
- for Product_Type'Write use Product_Write;
-
- for Sales_Record_Type'Read use Sales_Read;
- for Sales_Record_Type'Write use Sales_Write;
-
-
- -- Object Declarations
-
- Product_01 : Product_Type :=
- ("Product1", 1, Domestic, "Distrib1", "Import 1");
- Product_02 : Product_Type :=
- ("Product2", 2, Foreign, "Distrib2", "Import 2");
-
- Sale_Rec_01 : Sales_Record_Type :=
- ("Buyer 01", False, Domestic, True, True);
- Sale_Rec_02 : Sales_Record_Type :=
- ("Buyer 02", True, Domestic, True, False);
- Sale_Rec_03 : Sales_Record_Type := (Name => "Buyer 03",
- Sale_Item => True,
- Buyer => Foreign,
- Quantity_Discount => False,
- Cash_Discount => True);
- Sale_Rec_04 : Sales_Record_Type :=
- ("Buyer 04", True, Foreign, False, False);
- Sale_Rec_05 : Sales_Record_Type :=
- ("Buyer 05", False, Foreign, False, False);
-
- TC_Read_Total : Integer := 100;
- TC_Write_Total : Integer := 0;
-
-
- -- Subprogram bodies.
- -- These subprograms are designed to override the default attributes
- -- 'Read and 'Write for the specified types. Each adds/subtracts
- -- a quantity to/from a program control variable, indicating its
- -- activity. In addition, each component of the record is
- -- individually read from or written to the stream, using the
- -- appropriate 'Read or 'Write attribute for the component type.
- -- The string components are moved to/from the stream using the
- -- 'Input and 'Output attributes for the string subtype, so that
- -- the bounds of the strings are also written/read.
-
- procedure Product_Read
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : out Product_Type ) is
- begin
- TC_Read_Total := TC_Read_Total - 10;
-
- The_Item.Item := String_Data_Type'Input(Data_Stream); -- Field 1.
- Natural'Read(Data_Stream, The_Item.ID); -- Field 2.
- Origin_Type'Read(Data_Stream, -- Field 3.
- The_Item.Manufacture);
- The_Item.Distributor := -- Field 4.
- String_Data_Type'Input(Data_Stream);
- The_Item.Importer := -- Field 5.
- String_Data_Type'Input(Data_Stream);
- end Product_Read;
-
-
- procedure Product_Write
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : Product_Type ) is
- begin
- TC_Write_Total := TC_Write_Total + 5;
-
- String_Data_Type'Output(Data_Stream, The_Item.Item); -- Field 1.
- Natural'Write(Data_Stream, The_Item.ID); -- Field 2.
- Origin_Type'Write(Data_Stream, -- Field 3.
- The_Item.Manufacture);
- String_Data_Type'Output(Data_Stream, -- Field 4.
- The_Item.Distributor);
- String_Data_Type'Output(Data_Stream, -- Field 5.
- The_Item.Importer);
- end Product_Write;
-
-
- procedure Sales_Read
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : out Sales_Record_Type ) is
- begin
- TC_Read_Total := TC_Read_Total - 20;
-
- The_Item.Name := String_Data_Type'Input(Data_Stream); -- Field 1.
- Boolean'Read(Data_Stream, The_Item.Sale_Item); -- Field 2.
- Origin_Type'Read(Data_Stream, The_Item.Buyer); -- Field 3.
- Boolean'Read(Data_Stream, The_Item.Quantity_Discount); -- Field 4.
- Boolean'Read(Data_Stream, The_Item.Cash_Discount); -- Field 5.
- end Sales_Read;
-
-
- procedure Sales_Write
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- The_Item : Sales_Record_Type ) is
- begin
- TC_Write_Total := TC_Write_Total + 10;
-
- String_Data_Type'Output(Data_Stream, The_Item.Name); -- Field 1.
- Boolean'Write(Data_Stream, The_Item.Sale_Item); -- Field 2.
- Origin_Type'Write(Data_Stream, The_Item.Buyer); -- Field 3.
- Boolean'Write(Data_Stream, The_Item.Quantity_Discount); -- Field 4.
- Boolean'Write(Data_Stream, The_Item.Cash_Discount); -- Field 5.
- end Sales_Write;
-
-
-
- begin
-
- Data_Stream := Ada.Streams.Stream_IO.Stream (Data_File);
-
- -- Write product and sales data to the stream.
-
- Product_Type'Write (Data_Stream, Product_01);
- Sales_Record_Type'Write (Data_Stream, Sale_Rec_01);
- Sales_Record_Type'Write (Data_Stream, Sale_Rec_02);
-
- Product_Type'Write (Data_Stream, Product_02);
- Sales_Record_Type'Write (Data_Stream, Sale_Rec_03);
- Sales_Record_Type'Write (Data_Stream, Sale_Rec_04);
- Sales_Record_Type'Write (Data_Stream, Sale_Rec_05);
-
- -- Read data from the stream, and verify the use of the user specified
- -- attributes.
-
- Verify_Data_Block:
- declare
-
- TC_Product1,
- TC_Product2 : Product_Type;
-
- TC_Sale1,
- TC_Sale2,
- TC_Sale3,
- TC_Sale4,
- TC_Sale5 : Sales_Record_Type;
-
- begin
-
- -- Reset the mode of the stream file so that Read/Input
- -- operations may be performed.
-
- Ada.Streams.Stream_IO.Reset (Data_File,
- Ada.Streams.Stream_IO.In_File);
-
- -- Data is read/reconstructed from the stream, in the order that
- -- the data was placed into the stream.
-
- Product_Type'Read (Data_Stream, TC_Product1);
- Sales_Record_Type'Read (Data_Stream, TC_Sale1);
- Sales_Record_Type'Read (Data_Stream, TC_Sale2);
-
- Product_Type'Read (Data_Stream, TC_Product2);
- Sales_Record_Type'Read (Data_Stream, TC_Sale3);
- Sales_Record_Type'Read (Data_Stream, TC_Sale4);
- Sales_Record_Type'Read (Data_Stream, TC_Sale5);
-
- -- Verify product data was correctly written to/read from stream.
-
- if TC_Product1 /= Product_01 then
- Report.Failed ("Data verification error, Product 1");
- end if;
- if TC_Product2 /= Product_02 then
- Report.Failed ("Data verification error, Product 2");
- end if;
-
- if TC_Sale1 /= Sale_Rec_01 then
- Report.Failed ("Data verification error, Sale_Rec_01");
- end if;
- if TC_Sale2 /= Sale_Rec_02 then
- Report.Failed ("Data verification error, Sale_Rec_02");
- end if;
- if TC_Sale3 /= Sale_Rec_03 then
- Report.Failed ("Data verification error, Sale_Rec_03");
- end if;
- if TC_Sale4 /= Sale_Rec_04 then
- Report.Failed ("Data verification error, Sale_Rec_04");
- end if;
- if TC_Sale5 /= Sale_Rec_05 then
- Report.Failed ("Data verification error, Sale_Rec_05");
- end if;
-
- -- Verify that the user defined subprograms were used to
- -- override the default 'Read and 'Write attributes.
- -- There were two "product" reads and two writes; there
- -- were five "sale record" reads and five writes.
-
- if (TC_Read_Total /= -20) or (TC_Write_Total /= 60) then
- Report.Failed ("Incorrect use of user defined attributes");
- end if;
-
- end Verify_Data_Block;
-
- exception
-
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
-
- end Operational_Test_Block;
-
- if Ada.Streams.Stream_IO.Is_Open (Data_File) then
- Ada.Streams.Stream_IO.Delete (Data_File);
- else
- Ada.Streams.Stream_IO.Open (Data_File,
- Ada.Streams.Stream_IO.Out_File,
- The_Filename);
- Ada.Streams.Stream_IO.Delete (Data_File);
- end if;
-
-
- exception
-
- -- Since Use_Error or Name_Error can be raised if, for the specified
- -- mode, the environment does not support Stream_IO operations,
- -- the following handlers are included:
-
- when Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable ("Name_Error raised on Stream IO Create");
-
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable ("Use_Error raised on Stream IO Create");
-
- when others =>
- Report.Failed ("Unexpected exception raised");
-
- end Test_for_Stream_IO_Support;
-
- Report.Result;
-
-end CXACA02;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxacb01.a b/gcc/testsuite/ada/acats/tests/cxa/cxacb01.a
deleted file mode 100644
index ac4a905e830..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxacb01.a
+++ /dev/null
@@ -1,264 +0,0 @@
--- CXACB01.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the default attributes 'Input and 'Output work properly when
--- used with objects of a variety of types, including two-dimensional
--- arrays and records without default discriminants.
---
--- TEST DESCRIPTION:
--- This test simulates utility company service record storage, using
--- Stream_IO to allow the storage of heterogeneous data in a single
--- stream file.
---
--- Three types of data are written to the stream file for each utility
--- service customer.
--- First, the general information on the customer is written.
--- This is an object of a discriminated (without default) record
--- type. This is followed by an integer object containing a count of
--- the number of service months for the customer. Finally, a
--- two-dimensional array object with monthly consumption information for
--- the customer is written to the stream.
---
--- Objects of record types with discriminants without defaults should
--- have their discriminants included in the stream when using 'Output.
--- Likewise, discriminants should be extracted
--- from the stream when using 'Input. Similarly, array bounds are written
--- to and read from the stream when using 'Output and 'Input with array
--- objects.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all implementations that support external
--- Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with FXACB00;
-with Ada.Streams.Stream_IO;
-with Report;
-
-procedure CXACB01 is
-begin
-
- Report.Test ("CXACB01", "Check that the default attributes 'Input and " &
- "'Output work properly when used with objects " &
- "of record, natural, and array types" );
-
- Test_for_Stream_IO_Support:
- declare
-
- Util_File : Ada.Streams.Stream_IO.File_Type;
- Util_Stream : Ada.Streams.Stream_IO.Stream_Access;
- Utility_Service_Filename : constant String := Report.Legal_File_Name;
-
- begin
-
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Ada.Streams.Stream_IO.Create (Util_File,
- Ada.Streams.Stream_IO.Out_File,
- Utility_Service_Filename);
-
- Operational_Test_Block:
- declare
-
- -- The following procedure will store all of the customer specific
- -- information into the stream.
-
- procedure Store_Data_In_Stream
- (Customer : in FXACB00.Service_Type;
- Months : in FXACB00.Months_In_Service_Type;
- History : in FXACB00.Service_History_Type) is
- begin
- FXACB00.Service_Type'Output (Util_Stream, Customer);
- FXACB00.Months_In_Service_Type'Output (Util_Stream, Months);
- FXACB00.Service_History_Type'Output (Util_Stream, History);
- end Store_Data_In_Stream;
-
-
- -- The following procedure will remove from the stream all of the
- -- customer related information.
-
- procedure Retrieve_Data_From_Stream
- (Customer : out FXACB00.Service_Type;
- Months : out FXACB00.Months_In_Service_Type;
- History : out FXACB00.Service_History_Type) is
- begin
- Customer := FXACB00.Service_Type'Input (Util_Stream);
- Months := FXACB00.Months_In_Service_Type'Input (Util_Stream);
- History := FXACB00.Service_History_Type'Input (Util_Stream);
- end Retrieve_Data_From_Stream;
-
-
- begin
-
- Util_Stream := Ada.Streams.Stream_IO.Stream (Util_File);
-
- -- Write all of the customer service information (record, numeric,
- -- and array objects) defined in package FXACB00 into the stream.
-
- Data_Storage_Block:
- begin
-
- Store_Data_In_Stream (Customer => FXACB00.Customer1,
- Months => FXACB00.C1_Months,
- History => FXACB00.C1_Service_History);
-
- Store_Data_In_Stream (FXACB00.Customer2,
- FXACB00.C2_Months,
- History => FXACB00.C2_Service_History);
-
- Store_Data_In_Stream (Months => FXACB00.C3_Months,
- History => FXACB00.C3_Service_History,
- Customer => FXACB00.Customer3);
- end Data_Storage_Block;
-
-
- Data_Verification_Block:
- declare
-
- TC_Residence : FXACB00.Service_Type (FXACB00.Residence);
- TC_Apartment : FXACB00.Service_Type (FXACB00.Apartment);
- TC_Commercial : FXACB00.Service_Type (FXACB00.Commercial);
-
-
- TC_Months1,
- TC_Months2,
- TC_Months3 : FXACB00.Months_In_Service_Type :=
- FXACB00.Months_In_Service_Type'First;
-
-
- TC_History1 :
- FXACB00.Service_History_Type (FXACB00.Quarterly_Period_Type,
- FXACB00.Month_In_Quarter_Type) :=
- (others => (others => FXACB00.Electric_Usage_Type'Last));
-
- TC_History2 :
- FXACB00.Service_History_Type
- (FXACB00.Quarterly_Period_Type range
- FXACB00.Spring .. FXACB00.Summer,
- FXACB00.Month_In_Quarter_Type) :=
- (others => (others => FXACB00.Electric_Usage_Type'Last));
-
- TC_History3 :
- FXACB00.Service_History_Type (FXACB00.Quarterly_Period_Type,
- FXACB00.Month_In_Quarter_Type) :=
- (others => (others => FXACB00.Electric_Usage_Type'Last));
-
- begin
-
- Ada.Streams.Stream_IO.Reset (Util_File,
- Ada.Streams.Stream_IO.In_File);
-
- -- Input all of the data that is contained in the stream.
- -- Compare all data with the original data in package FXACB00
- -- that was written to the stream.
-
- Retrieve_Data_From_Stream (TC_Residence, TC_Months1, TC_History1);
- Retrieve_Data_From_Stream (TC_Apartment, TC_Months2, TC_History2);
- Retrieve_Data_From_Stream (Customer => TC_Commercial,
- Months => TC_Months3,
- History => TC_History3);
-
- -- After all the data has been correctly extracted, the file
- -- should be empty.
-
- if not Ada.Streams.Stream_IO.End_Of_File (Util_File) then
- Report.Failed ("Stream file not empty");
- end if;
-
- -- Verify that the data values read from the stream are the same
- -- as those written to the stream.
-
- if ((FXACB00."/="(FXACB00.Customer1, TC_Residence)) or else
- (FXACB00."/="(FXACB00.Customer2, TC_Apartment)) or else
- (FXACB00."/="(FXACB00.Customer3, TC_Commercial)))
- then
- Report.Failed ("Customer information incorrect");
- end if;
-
- if ((FXACB00."/="(FXACB00.C1_Months, TC_Months1)) or
- (FXACB00."/="(FXACB00.C2_Months, TC_Months2)) or
- (FXACB00."/="(FXACB00.C3_Months, TC_Months3)))
- then
- Report.Failed ("Number of Months information incorrect");
- end if;
-
- if not ((FXACB00."="(FXACB00.C1_Service_History, TC_History1)) and
- (FXACB00."="(FXACB00.C2_Service_History, TC_History2)) and
- (FXACB00."="(FXACB00.C3_Service_History, TC_History3)))
- then
- Report.Failed ("Service history information incorrect");
- end if;
-
- end Data_Verification_Block;
-
- exception
-
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
-
- end Operational_Test_Block;
-
- -- Delete the file.
- if Ada.Streams.Stream_IO.Is_Open (Util_File) then
- Ada.Streams.Stream_IO.Delete (Util_File);
- else
- Ada.Streams.Stream_IO.Open (Util_File,
- Ada.Streams.Stream_IO.Out_File,
- Utility_Service_Filename);
- Ada.Streams.Stream_IO.Delete (Util_File);
- end if;
-
-
- exception
-
- -- Since Use_Error or Name_Error can be raised if, for the specified
- -- mode, the environment does not support Stream_IO operations,
- -- the following handlers are included:
-
- when Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable ("Name_Error raised on Stream IO Create");
-
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable ("Use_Error raised on Stream IO Create");
-
- when others =>
- Report.Failed ("Unexpected exception raised");
-
- end Test_for_Stream_IO_Support;
-
- Report.Result;
-
-end CXACB01;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxacb02.a b/gcc/testsuite/ada/acats/tests/cxa/cxacb02.a
deleted file mode 100644
index a0ade9ebe1c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxacb02.a
+++ /dev/null
@@ -1,421 +0,0 @@
--- CXACB02.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that user defined subprograms can override the default
--- attributes 'Input and 'Output using attribute definition clauses,
--- when used with objects of discriminated record and multi-dimensional
--- array types.
---
--- TEST DESCRIPTION:
--- This test demonstrates that the default implementations of the
--- 'Input and 'Output attributes can be overridden by user specified
--- subprograms in conjunction with attribute definition clauses.
--- These attributes have been overridden below, and in the user defined
--- substitutes, values are added or subtracted to global variables.
--- Following the completion of the writing/reading test, the global
--- variables are evaluated to ensure that the user defined subprograms
--- were used in overriding the type-related default attributes.
---
--- APPLICABILITY CRITERIA:
--- Applicable to all implementations that support external
--- Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 14 Nov 95 SAIC Corrected test errors for ACVC 2.0.1.
---
---!
-
-with Report;
-with Ada.Streams.Stream_IO;
-
-procedure CXACB02 is
-begin
-
- Report.Test ("CXACB02", "Check that user defined subprograms can " &
- "override the default attributes 'Input and " &
- "'Output using attribute definition clauses");
-
- Test_for_Stream_IO_Support:
- declare
-
- Util_File : Ada.Streams.Stream_IO.File_Type;
- Util_Stream : Ada.Streams.Stream_IO.Stream_Access;
- Utility_Filename : constant String := Report.Legal_File_Name;
-
- begin
-
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Ada.Streams.Stream_IO.Create (Util_File,
- Ada.Streams.Stream_IO.Out_File,
- Utility_Filename);
-
- Operational_Test_Block:
- declare
-
- type Customer_Type is (Residence, Apartment, Commercial);
- type Electric_Usage_Type is range 0..100000;
- type Months_In_Service_Type is range 1..12;
- type Quarterly_Period_Type is (Spring, Summer, Autumn, Winter);
- subtype Month_In_Quarter_Type is Positive range 1..3;
- type Service_History_Type is
- array (Quarterly_Period_Type range <>,
- Month_In_Quarter_Type range <>) of Electric_Usage_Type;
-
- type Service_Type (Customer : Customer_Type) is
- record
- Name : String (1..21);
- Account_ID : Natural range 0..100;
- case Customer is
- when Residence | Apartment =>
- Low_Income_Credit : Boolean := False;
- when Commercial =>
- Baseline_Allowance : Natural range 0..1000;
- Quantity_Discount : Boolean := False;
- end case;
- end record;
-
-
- -- Mode conformant, user defined subprograms that will override
- -- the type-related attributes.
- -- In this test, the user defines these subprograms to add/subtract
- -- specific values from global variables.
-
- function Service_Input
- (Stream : access Ada.Streams.Root_Stream_Type'Class)
- return Service_Type;
-
- procedure Service_Output
- (Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : Service_Type);
-
- function History_Input
- (Stream : access Ada.Streams.Root_Stream_Type'Class)
- return Service_History_Type;
-
- procedure History_Output
- (Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : Service_History_Type);
-
-
- -- Attribute definition clauses.
-
- for Service_Type'Input use Service_Input;
- for Service_Type'Output use Service_Output;
-
- for Service_History_Type'Input use History_Input;
- for Service_History_Type'Output use History_Output;
-
-
- -- Object Declarations
-
- Customer1 : Service_Type (Residence) :=
- (Residence, "1221 Morningstar Lane", 44, False);
- Customer2 : Service_Type (Apartment) :=
- (Customer => Apartment,
- Account_ID => 67,
- Name => "15 South Front St. #8",
- Low_Income_Credit => True);
- Customer3 : Service_Type (Commercial) :=
- (Commercial,
- "12442 Central Avenue ",
- 100,
- Baseline_Allowance => 938,
- Quantity_Discount => True);
-
- C1_Service_History :
- Service_History_Type (Quarterly_Period_Type,
- Month_In_Quarter_Type) :=
- (Spring => (1 => 35, 2 => 39, 3 => 32),
- Summer => (1 => 34, 2 => 33, 3 => 39),
- Autumn => (1 => 45, 2 => 40, 3 => 38),
- Winter => (1 => 53, 2 => 0, 3 => 0));
-
- C2_Service_History :
- Service_History_Type (Quarterly_Period_Type range Spring..Summer,
- Month_In_Quarter_Type) :=
- (Spring => (23, 22, 0), Summer => (0, 0, 0));
-
- C3_Service_History :
- Service_History_Type (Quarterly_Period_Type,
- Month_In_Quarter_Type) :=
- (others => (others => 200));
-
-
- TC_Input_Total : Integer := 0;
- TC_Output_Total : Integer := 0;
-
-
- -- Subprogram bodies.
- -- These subprograms are designed to override the default attributes
- -- 'Input and 'Output for the specified types. Each adds/subtracts
- -- a quantity to/from a program control variable, indicating its
- -- activity. Each user defined "Input" function uses the 'Read
- -- attribute for the type to accomplish the operation. Likewise,
- -- each user defined "Output" subprogram uses the 'Write attribute
- -- for the type.
-
- function Service_Input
- ( Stream : access Ada.Streams.Root_Stream_Type'Class )
- return Service_Type is
- Customer : Customer_Type;
- begin
- TC_Input_Total := TC_Input_Total + 1;
-
- -- Extract the discriminant value from the stream.
- -- This discriminant would not otherwise be extracted from the
- -- stream when the Service_Type'Read attribute is used below.
- Customer_Type'Read (Stream, Customer);
-
- declare
- -- Declare a constant of Service_Type, using the value just
- -- read from the stream as the discriminant value of the
- -- object.
- Service : Service_Type(Customer);
- begin
- Service_Type'Read (Stream, Service);
- return Service;
- end;
- end Service_Input;
-
-
- procedure Service_Output
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : Service_Type ) is
- begin
- TC_Output_Total := TC_Output_Total + 2;
- -- Write the discriminant value to the stream.
- -- The attribute 'Write (for the record type) will not write the
- -- discriminant of the record object to the stream. Therefore, it
- -- must be explicitly written using the 'Write attribute of the
- -- discriminant type.
- Customer_Type'Write (Stream, Item.Customer);
- -- Write the record component values (but not the discriminant) to
- -- the stream.
- Service_Type'Write (Stream, Item);
- end Service_Output;
-
-
- function History_Input
- ( Stream : access Ada.Streams.Root_Stream_Type'Class )
- return Service_History_Type is
- Quarter_Bound_Low : Quarterly_Period_Type;
- Quarter_Bound_High : Quarterly_Period_Type;
- Month_Bound_Low : Month_In_Quarter_Type;
- Month_Bound_High : Month_In_Quarter_Type;
- begin
- TC_Input_Total := TC_Input_Total + 3;
-
- -- Read the value of the array bounds from the stream.
- -- Use these bounds in the creation of an array object that will
- -- be used to store data from the stream.
- -- The array bound values would not otherwise be read from the
- -- stream by use of the Service_History_Type'Read attribute.
- Quarterly_Period_Type'Read (Stream, Quarter_Bound_Low);
- Quarterly_Period_Type'Read (Stream, Quarter_Bound_High);
- Month_In_Quarter_Type'Read (Stream, Month_Bound_Low);
- Month_In_Quarter_Type'Read (Stream, Month_Bound_High);
-
- declare
- Service_History_Array :
- Service_History_Type
- (Quarterly_Period_Type range
- Quarter_Bound_Low..Quarter_Bound_High,
- Month_In_Quarter_Type range
- Month_Bound_Low .. Month_Bound_High);
- begin
- Service_History_Type'Read (Stream, Service_History_Array);
- return Service_History_Array;
- end;
- end History_Input;
-
-
- procedure History_Output
- ( Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : Service_History_Type ) is
- begin
- TC_Output_Total := TC_Output_Total + 7;
- -- Write the upper/lower bounds of the array object dimensions to
- -- the stream.
- Quarterly_Period_Type'Write (Stream, Item'First(1));
- Quarterly_Period_Type'Write (Stream, Item'Last(1));
- Month_In_Quarter_Type'Write (Stream, Item'First(2));
- Month_In_Quarter_Type'Write (Stream, Item'Last(2));
- -- Write the array values to the stream in canonical order (last
- -- dimension varying fastest).
- Service_History_Type'Write (Stream, Item);
- end History_Output;
-
-
-
- begin
-
- Util_Stream := Ada.Streams.Stream_IO.Stream (Util_File);
-
- -- Write data to the stream. A customer service record is followed
- -- by a service history array.
-
- Service_Type'Output (Util_Stream, Customer1);
- Service_History_Type'Output (Util_Stream, C1_Service_History);
-
- Service_Type'Output (Util_Stream, Customer2);
- Service_History_Type'Output (Util_Stream, C2_Service_History);
-
- Service_Type'Output (Util_Stream, Customer3);
- Service_History_Type'Output (Util_Stream, C3_Service_History);
-
-
- -- Read data from the stream, and verify the use of the user specified
- -- attributes.
-
- Verify_Data_Block:
- declare
-
- TC_Residence : Service_Type (Residence);
- TC_Apartment : Service_Type (Apartment);
- TC_Commercial : Service_Type (Commercial);
-
- TC_History1 : Service_History_Type (Quarterly_Period_Type,
- Month_In_Quarter_Type) :=
- (others => (others => Electric_Usage_Type'First));
-
- TC_History2 : Service_History_Type (Quarterly_Period_Type
- range Spring .. Summer,
- Month_In_Quarter_Type) :=
- (others => (others => Electric_Usage_Type'First));
-
- TC_History3 : Service_History_Type (Quarterly_Period_Type,
- Month_In_Quarter_Type) :=
- (others => (others => Electric_Usage_Type'First));
-
- begin
-
- -- Reset Stream file to mode In_File.
-
- Ada.Streams.Stream_IO.Reset (Util_File,
- Ada.Streams.Stream_IO.In_File);
-
- -- Read data from the stream.
-
- TC_Residence := Service_Type'Input (Util_Stream);
- TC_History1 := Service_History_Type'Input (Util_Stream);
-
- TC_Apartment := Service_Type'Input (Util_Stream);
- TC_History2 := Service_History_Type'Input (Util_Stream);
-
- TC_Commercial := Service_Type'Input (Util_Stream);
- TC_History3 := Service_History_Type'Input (Util_Stream);
-
-
- -- Verify product data was correctly written to/read from stream,
- -- including discriminants and array bounds.
-
- if (TC_Residence /= Customer1) or
- (TC_Residence.Customer /= Customer1.Customer) or
- (TC_History1'Last(1) /= C1_Service_History'Last(1)) or
- (TC_History1'First(1) /= C1_Service_History'First(1)) or
- (TC_History1'Last(2) /= C1_Service_History'Last(2)) or
- (TC_History1'First(2) /= C1_Service_History'First(2))
- then
- Report.Failed ("Incorrect data from stream - 1");
- end if;
-
- if (TC_Apartment /= Customer2) or
- (TC_Apartment.Customer /= Customer2.Customer) or
- (TC_History2 /= C2_Service_History) or
- (TC_History2'Last(1) /= C2_Service_History'Last(1)) or
- (TC_History2'First(1) /= C2_Service_History'First(1)) or
- (TC_History2'Last(2) /= C2_Service_History'Last(2)) or
- (TC_History2'First(2) /= C2_Service_History'First(2))
- then
- Report.Failed ("Incorrect data from stream - 2");
- end if;
-
- if (TC_Commercial /= Customer3) or
- (TC_Commercial.Customer /= Customer3.Customer) or
- (TC_History3 /= C3_Service_History) or
- (TC_History3'Last(1) /= C3_Service_History'Last(1)) or
- (TC_History3'First(1) /= C3_Service_History'First(1)) or
- (TC_History3'Last(2) /= C3_Service_History'Last(2)) or
- (TC_History3'First(2) /= C3_Service_History'First(2))
- then
- Report.Failed ("Incorrect data from stream - 3");
- end if;
-
- -- Verify that the user defined subprograms were used to override
- -- the default 'Input and 'Output attributes.
- -- There were three calls on each of the user defined attributes.
-
- if (TC_Input_Total /= 12 ) or (TC_Output_Total /= 27 ) then
- Report.Failed ("Incorrect use of user defined attributes");
- end if;
-
- end Verify_Data_Block;
-
- exception
-
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
-
- end Operational_Test_Block;
-
- if Ada.Streams.Stream_IO.Is_Open (Util_File) then
- Ada.Streams.Stream_IO.Delete (Util_File);
- else
- Ada.Streams.Stream_IO.Open (Util_File,
- Ada.Streams.Stream_IO.Out_File,
- Utility_Filename);
- Ada.Streams.Stream_IO.Delete (Util_File);
- end if;
-
-
- exception
-
- -- Since Use_Error or Name_Error can be raised if, for the specified
- -- mode, the environment does not support Stream_IO operations,
- -- the following handlers are included:
-
- when Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable ("Name_Error raised on Stream IO Create");
-
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable ("Use_Error raised on Stream IO Create");
-
- when others =>
- Report.Failed ("Unexpected exception raised");
-
- end Test_for_Stream_IO_Support;
-
- Report.Result;
-
-end CXACB02;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxacc01.a b/gcc/testsuite/ada/acats/tests/cxa/cxacc01.a
deleted file mode 100644
index 3ab88f40e6d..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxacc01.a
+++ /dev/null
@@ -1,299 +0,0 @@
--- CXACC01.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the use of 'Class'Output and 'Class'Input allow stream
--- manipulation of objects of non-limited class-wide types.
---
--- TEST DESCRIPTION:
--- This test demonstrates the uses of 'Class'Output and 'Class'Input
--- in moving objects of a particular class to and from a stream file.
--- A procedure uses a class-wide parameter to move objects of specific
--- types in the class to the stream, using the 'Class'Output attribute
--- of the root type of the class. A function returns a class-wide object,
--- using the 'Class'Input attribute of the root type of the class to
--- extract the object from the stream.
--- A field-by-field comparison of record objects is performed to validate
--- the data read from the stream. Operator precedence rules are used
--- in the comparison rather than parentheses.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to all implementations capable of supporting
--- external Stream_IO files.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 14 Nov 95 SAIC Corrected prefix of 'Tag attribute for ACVC 2.0.1.
--- 24 Aug 96 SAIC Changed a call to "Create" to "Reset".
--- 26 Feb 97 CTA.PWB Allowed for non-support of some IO operations.
---!
-
-with FXACC00, Ada.Streams.Stream_IO, Ada.Tags, Report;
-
-procedure CXACC01 is
-
- Order_File : Ada.Streams.Stream_IO.File_Type;
- Order_Stream : Ada.Streams.Stream_IO.Stream_Access;
- Order_Filename : constant String :=
- Report.Legal_File_Name ( Nam => "CXACC01" );
- Incomplete : exception;
-
-begin
-
- Report.Test ("CXACC01", "Check that the use of 'Class'Output " &
- "and 'Class'Input allow stream manipulation " &
- "of objects of non-limited class-wide types");
-
- Test_for_Stream_IO_Support:
- begin
-
- -- If an implementation does not support Stream_IO in a particular
- -- environment, the exception Use_Error or Name_Error will be raised on
- -- calls to various Stream_IO operations. This block statement
- -- encloses a call to Create, which should produce an exception in a
- -- non-supportive environment. These exceptions will be handled to
- -- produce a Not_Applicable result.
-
- Ada.Streams.Stream_IO.Create (Order_File,
- Ada.Streams.Stream_IO.Out_File,
- Order_Filename);
-
- exception
-
- when Ada.Streams.Stream_IO.Use_Error | Ada.Streams.Stream_IO.Name_Error =>
- Report.Not_Applicable
- ( "Files not supported - Create as Out_File for Stream_IO" );
- raise Incomplete;
-
- end Test_for_Stream_IO_Support;
-
- Operational_Test_Block:
- declare
-
- -- Store tag values associated with objects of tagged types.
-
- TC_Box_Office_Tag : constant String :=
- Ada.Tags.External_Tag(FXACC00.Ticket_Request'Tag);
-
- TC_Summer_Tag : constant String :=
- Ada.Tags.External_Tag(FXACC00.Subscriber_Request'Tag);
-
- TC_Mayoral_Tag : constant String :=
- Ada.Tags.External_Tag(FXACC00.VIP_Request'Tag);
-
- TC_Late_Tag : constant String :=
- Ada.Tags.External_Tag(FXACC00.Last_Minute_Request'Tag);
-
- -- The following procedure will take an object of the Ticket_Request
- -- class and output it to the stream. Objects of any extended type
- -- in the class can be output to the stream with this procedure.
-
- procedure Order_Entry (Order : FXACC00.Ticket_Request'Class) is
- begin
- FXACC00.Ticket_Request'Class'Output (Order_Stream, Order);
- end Order_Entry;
-
-
- -- The following function will retrieve from the stream an object of
- -- the Ticket_Request class.
-
- function Order_Retrieval return FXACC00.Ticket_Request'Class is
- begin
- return FXACC00.Ticket_Request'Class'Input (Order_Stream);
- end Order_Retrieval;
-
- begin
-
- Order_Stream := Ada.Streams.Stream_IO.Stream (Order_File);
-
- -- Store the data objects in the stream.
- -- Each of the objects is of a different type within the class.
-
- Order_Entry (FXACC00.Box_Office_Request); -- Object of root type
- Order_Entry (FXACC00.Summer_Subscription); -- Obj. of extended type
- Order_Entry (FXACC00.Mayoral_Ticket_Request); -- Obj. of extended type
- Order_Entry (FXACC00.Late_Request); -- Object of twice
- -- extended type.
-
- -- Reset mode of stream to In_File prior to reading data from it.
- Reset1:
- begin
- Ada.Streams.Stream_IO.Reset (Order_File,
- Ada.Streams.Stream_IO.In_File);
- exception
- when Ada.Streams.Stream_IO.Use_Error =>
- Report.Not_Applicable
- ( "Reset to In_File not supported for Stream_IO - 1" );
- raise Incomplete;
- end Reset1;
-
- Process_Order_Block:
- declare
-
- use FXACC00;
-
- -- Declare variables of the root type class,
- -- and initialize them with class-wide objects returned from
- -- the stream as function result.
-
- Order_1 : Ticket_Request'Class := Order_Retrieval;
- Order_2 : Ticket_Request'Class := Order_Retrieval;
- Order_3 : Ticket_Request'Class := Order_Retrieval;
- Order_4 : Ticket_Request'Class := Order_Retrieval;
-
- -- Declare objects of the specific types from within the class
- -- that correspond to the types of the data written to the
- -- stream. Perform a type conversion on the class-wide objects.
-
- Ticket_Order : Ticket_Request :=
- Ticket_Request(Order_1);
- Subscriber_Order : Subscriber_Request :=
- Subscriber_Request(Order_2);
- VIP_Order : VIP_Request :=
- VIP_Request(Order_3);
- Last_Minute_Order : Last_Minute_Request :=
- Last_Minute_Request(Order_4);
-
- begin
-
- -- Perform a field-by-field comparison of all the class-wide
- -- objects input from the stream with specific type objects
- -- originally written to the stream.
-
- if Ticket_Order.Location /=
- Box_Office_Request.Location or
- Ticket_Order.Number_Of_Tickets /=
- Box_Office_Request.Number_Of_Tickets
- then
- Report.Failed ("Ticket_Request object validation failure");
- end if;
-
- if Subscriber_Order.Location /=
- Summer_Subscription.Location or
- Subscriber_Order.Number_Of_Tickets /=
- Summer_Subscription.Number_Of_Tickets or
- Subscriber_Order.Subscription_Number /=
- Summer_Subscription.Subscription_Number
- then
- Report.Failed ("Subscriber_Request object validation failure");
- end if;
-
- if VIP_Order.Location /=
- Mayoral_Ticket_Request.Location or
- VIP_Order.Number_Of_Tickets /=
- Mayoral_Ticket_Request.Number_Of_Tickets or
- VIP_Order.Rank /=
- Mayoral_Ticket_Request.Rank
- then
- Report.Failed ("VIP_Request object validation failure");
- end if;
-
- if Last_Minute_Order.Location /=
- Late_Request.Location or
- Last_Minute_Order.Number_Of_Tickets /=
- Late_Request.Number_Of_Tickets or
- Last_Minute_Order.Rank /=
- Late_Request.Rank or
- Last_Minute_Order.Special_Consideration /=
- Late_Request.Special_Consideration or
- Last_Minute_Order.Donation /=
- Late_Request.Donation
- then
- Report.Failed ("Last_Minute_Request object validation failure");
- end if;
-
- -- Verify tag values from before and after processing.
- -- The 'Tag attribute is used with objects of a class-wide type.
-
- if TC_Box_Office_Tag /=
- Ada.Tags.External_Tag(Order_1'Tag)
- then
- Report.Failed("Failed tag comparison - 1");
- end if;
-
- if TC_Summer_Tag /=
- Ada.Tags.External_Tag(Order_2'Tag)
- then
- Report.Failed("Failed tag comparison - 2");
- end if;
-
- if TC_Mayoral_Tag /=
- Ada.Tags.External_Tag(Order_3'Tag)
- then
- Report.Failed("Failed tag comparison - 3");
- end if;
-
- if TC_Late_Tag /=
- Ada.Tags.External_Tag(Order_4'Tag)
- then
- Report.Failed("Failed tag comparison - 4");
- end if;
-
- end Process_Order_Block;
-
- -- After all the data has been correctly extracted, the file
- -- should be empty.
-
- if not Ada.Streams.Stream_IO.End_Of_File (Order_File) then
- Report.Failed ("Stream file not empty");
- end if;
-
- exception
- when Incomplete =>
- raise;
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Operational Block");
- when others =>
- Report.Failed ("Exception raised in Operational Test Block");
- end Operational_Test_Block;
-
- Deletion:
- begin
- if Ada.Streams.Stream_IO.Is_Open (Order_File) then
- Ada.Streams.Stream_IO.Delete (Order_File);
- else
- Ada.Streams.Stream_IO.Open (Order_File,
- Ada.Streams.Stream_IO.Out_File,
- Order_Filename);
- Ada.Streams.Stream_IO.Delete (Order_File);
- end if;
- exception
- when others =>
- Report.Failed
- ( "Delete not properly implemented for Stream_IO" );
- end Deletion;
-
- Report.Result;
-
-exception
-
- when Incomplete =>
- Report.Result;
- when others =>
- Report.Failed ( "Unexpected exception" );
- Report.Result;
-
-end CXACC01;
diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxaf001.a b/gcc/testsuite/ada/acats/tests/cxa/cxaf001.a
deleted file mode 100644
index ae3497abde0..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxa/cxaf001.a
+++ /dev/null
@@ -1,199 +0,0 @@
--- CXAF001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that an implementation supports the functionality defined
--- in Package Ada.Command_Line.
---
--- TEST DESCRIPTION:
--- This test verifies that an implementation supports the subprograms
--- contained in package Ada.Command_Line. Each of the subprograms
--- is exercised in a general sense, to ensure that it is available,
--- and that it provides the prescribed results in a known test
--- environment. Function Argument_Count must return zero, or the
--- number of arguments passed to the program calling it. Function
--- Argument is called with a parameter value one greater than the
--- actual number of arguments passed to the executing program, which
--- must result in Constraint_Error being raised. Function Command_Name
--- should return the name of the executing program that called it
--- (specifically, this test name). Function Set_Exit_Status is called
--- with two different parameter values, the constants Failure and
--- Success defined in package Ada.Command_Line.
---
--- The setting of the variable TC_Verbose allows for some additional
--- output to be displayed during the running of the test as an aid in
--- tracing the processing flow of the test.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable to implementations that support the
--- declaration of package Command_Line as defined in the Ada Reference
--- manual.
--- An alternative declaration is allowed for package Command_Line if
--- different functionality is appropriate for the external execution
--- environment.
---
---
--- CHANGE HISTORY:
--- 10 Jul 95 SAIC Initial prerelease version.
--- 02 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
--- 05 AUG 98 EDS Allow Null string result to be returned from
--- Function Command
---!
-
-with Ada.Command_Line;
-with Ada.Exceptions;
-with Report;
-
-procedure CXAF001 is
-begin
-
- Report.Test ("CXAF001", "Check that an implementation supports the " &
- "functionality defined in Package " &
- "Ada.Command_Line");
-
- Test_Block:
- declare
-
- use Ada.Exceptions;
-
- type String_Access is access all String;
-
- TC_Verbose : Boolean := False;
- Number_Of_Arguments : Natural := Natural'Last;
- Name_Of_Command : String_Access;
-
- begin
-
- -- Check the result of function Argument_Count.
- -- Note: If the external environment does not support passing arguments
- -- to the program invoking the function, the function result
- -- will be zero.
-
- Number_Of_Arguments := Ada.Command_Line.Argument_Count;
- if Number_Of_Arguments = Natural'Last then
- Report.Failed("Argument_Count did not provide a return result");
- end if;
- if TC_Verbose then
- Report.Comment
- ("Argument_Count = " & Integer'Image(Number_Of_Arguments));
- end if;
-
-
- -- Check that the result of Function Argument is Constraint_Error
- -- when the Number argument is outside the range of 1..Argument_Count.
-
- Test_Function_Argument_1 :
- begin
- declare
-
- -- Define a value that will be outside the range of
- -- 1..Argument_Count.
- -- Note: If the external execution environment does not support
- -- passing arguments to a program, then Argument(N) for
- -- any N will raise Constraint_Error, since
- -- Argument_Count = 0;
-
- Arguments_Plus_One : Positive :=
- Ada.Command_Line.Argument_Count + 1;
-
- -- Using the above value in a call to Argument must result in
- -- the raising of Constraint_Error.
-
- Argument_String : constant String :=
- Ada.Command_Line.Argument(Arguments_Plus_One);
-
- begin
- Report.Failed("Constraint_Error not raised by Function " &
- "Argument when provided a Number argument " &
- "out of range");
- end;
- exception
- when Constraint_Error => null; -- OK, expected exception.
- if TC_Verbose then
- Report.Comment ("Argument_Count raised Constraint_Error");
- end if;
- when others =>
- Report.Failed ("Unexpected exception raised by Argument " &
- "in Test_Function_Argument_1 block");
- end Test_Function_Argument_1;
-
-
- -- Check that Function Argument returns a string result.
-
- Test_Function_Argument_2 :
- begin
- if Ada.Command_Line.Argument_Count > 0 then
- Report.Comment
- ("Last argument is: " &
- Ada.Command_Line.Argument(Ada.Command_Line.Argument_Count));
- elsif TC_Verbose then
- Report.Comment("Argument_Count is zero, no test of Function " &
- "Argument for string result");
- end if;
- exception
- when others =>
- Report.Failed ("Unexpected exception raised by Argument " &
- "in Test_Function_Argument_2 block");
- end Test_Function_Argument_2;
-
-
- -- Check the result of Function Command_Name.
-
- Name_Of_Command := new String'(Ada.Command_Line.Command_Name);
-
- if Name_Of_Command = null then
- Report.Failed("Null string pointer returned from Function Command");
- elsif Name_Of_Command.all = "" then
- Report.Comment("Null string result returned from Function Command");
- elsif TC_Verbose then
- Report.Comment("Invoking command is " & Name_Of_Command.all);
- end if;
-
-
- -- Check that procedure Set_Exit_Status is available.
- -- Note: If the external execution environment does not support
- -- returning an exit value from a program, then Set_Exit_Status
- -- does nothing.
-
- Ada.Command_Line.Set_Exit_Status(Ada.Command_Line.Failure);
- if TC_Verbose then
- Report.Comment("Exit status set to Failure");
- end if;
-
- Ada.Command_Line.Set_Exit_Status(Ada.Command_Line.Success);
- if TC_Verbose then
- Report.Comment("Exit status set to Success");
- end if;
-
-
- exception
- when The_Error : others =>
- Report.Failed ("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXAF001;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf1001.a b/gcc/testsuite/ada/acats/tests/cxf/cxf1001.a
deleted file mode 100644
index be7e5069252..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf1001.a
+++ /dev/null
@@ -1,261 +0,0 @@
--- CXF1001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that values of 2 and 10 are allowable values for Machine_Radix
--- of a decimal first subtype.
--- Check that the value of Decimal.Max_Decimal_Digits is at least 18;
--- the value of Decimal.Max_Scale is at least 18; the value of
--- Decimal.Min_Scale is at most 0.
---
--- TEST DESCRIPTION:
--- This test examines the Machine_Radix attribute definition clause
--- and its effect on Decimal fixed point types, as well as several
--- constants from the package Ada.Decimal.
--- The first subtest checks that the Machine_Radix attribute will
--- return the value set for Machine_Radix by an attribute definition
--- clause. The second and third subtests examine differences between
--- the binary and decimal scaling of a type, based on the radix
--- representation. The final subtest examines the values
--- assigned to constants Min_Scale, Max_Scale, and Max_Decimal_Digits,
--- found in the package Ada.Decimal.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 29 Dec 94 SAIC Restructured Radix 10 and Radix 2 test blocks.
---
---!
-
-with Report;
-with Ada.Decimal;
-
-procedure CXF1001 is
-begin
-
- Report.Test ("CXF1001", "Check that values of 2 and 10 are allowable " &
- "values for Machine_Radix of a decimal first " &
- "subtype. Check that the value of " &
- "Decimal.Max_Decimal_Digits is at least 18; " &
- "the value of Decimal.Max_Scale is at least " &
- "18; the value of Decimal.Min_Scale is at " &
- "most 0");
-
- Attribute_Check_Block:
- declare
-
- Del : constant := 1.0/10**2;
- Const_Digits : constant := 3;
- Two : constant := 2;
- Ten : constant := 10;
-
- type Radix_2_Type_1 is delta 0.01 digits 7;
- type Radix_2_Type_2 is delta Ada.Decimal.Min_Delta digits 10;
- type Radix_2_Type_3 is
- delta 0.000_1 digits Ada.Decimal.Max_Decimal_Digits;
-
- type Radix_10_Type_1 is delta 10.0**(-Ada.Decimal.Max_Scale) digits 8;
- type Radix_10_Type_2 is delta 10.0**(-Ada.Decimal.Min_Scale) digits 6;
- type Radix_10_Type_3 is delta Ada.Decimal.Max_Delta digits 15;
-
-
- -- Use an attribute definition clause to set the Machine_Radix for a
- -- decimal first subtype to either 2 or 10.
- for Radix_2_Type_1'Machine_Radix use 2;
- for Radix_2_Type_2'Machine_Radix use Two;
- for Radix_2_Type_3'Machine_Radix use 10-8;
-
- for Radix_10_Type_1'Machine_Radix use 2*15/Const_Digits;
- for Radix_10_Type_2'Machine_Radix use Ten;
- for Radix_10_Type_3'Machine_Radix use Radix_10_Type_2'Machine_Radix;
-
-
- begin
-
- -- Check that the attribute 'Machine_Radix returns the value assigned
- -- by the attribute definition clause.
-
- if Radix_2_Type_1'Machine_Radix /= 2 or else
- Radix_2_Type_2'Machine_Radix /= 2 or else
- Radix_2_Type_3'Machine_Radix /= 2
- then
- Report.Failed("Incorrect radix value returned, 2 expected");
- end if;
-
- if Radix_10_Type_1'Machine_Radix /= 10 or else
- Radix_10_Type_2'Machine_Radix /= 10 or else
- Radix_10_Type_3'Machine_Radix /= 10
- then
- Report.Failed("Incorrect radix value returned, 10 expected");
- end if;
-
- exception
- when others => Report.Failed ("Exception raised in Attr_Check_Block");
- end Attribute_Check_Block;
-
-
-
- Radix_Block:
- -- Premises:
- -- 1) Choose several numbers, from types using either decimal scaling or
- -- binary scaling.
- -- 1) Repetitively add these numbers to themselves.
- -- 3) Validate that the result is the expected result, regardless of the
- -- scaling used in the definition of the type.
- declare
-
- Number_Of_Values : constant := 3;
- Loop_Count : constant := 1000;
-
- type Radix_2_Type is delta 0.0001 digits 10;
- type Radix_10_Type is delta 0.0001 digits 10;
-
- for Radix_2_Type'Machine_Radix use 2;
- for Radix_10_Type'Machine_Radix use 10;
-
- type Result_Record_Type is record
- Rad_2 : Radix_2_Type;
- Rad_10 : Radix_10_Type;
- end record;
-
- type Result_Array_Type is array (1..Number_Of_Values)
- of Result_Record_Type;
-
- Result_Array : Result_Array_Type := ((50.00, 50.00),
- (613.00, 613.00),
- (72.70, 72.70));
-
- function Repetitive_Radix_2_Add (Value : in Radix_2_Type)
- return Radix_2_Type is
- Result : Radix_2_Type := 0.0;
- begin
- for i in 1..Loop_Count loop
- Result := Result + Value;
- end loop;
- return Result;
- end Repetitive_Radix_2_Add;
-
- function Repetitive_Radix_10_Add (Value : in Radix_10_Type)
- return Radix_10_Type is
- Result : Radix_10_Type := 0.0;
- begin
- for i in 1..Loop_Count loop
- Result := Result + Value;
- end loop;
- return Result;
- end Repetitive_Radix_10_Add;
-
- begin
-
- -- Radix 2 Cases, three different values.
- -- Compare the result of the repetitive addition with the expected
- -- Radix 2 result, as well as with the Radix 10 value after type
- -- conversion.
-
- if Repetitive_Radix_2_Add(0.05) /= Result_Array(1).Rad_2 or
- Repetitive_Radix_2_Add(0.05) /= Radix_2_Type(Result_Array(1).Rad_10)
- then
- Report.Failed("Incorrect Radix 2 Result, Case 1");
- end if;
-
- if Repetitive_Radix_2_Add(0.613) /=
- Result_Array(2).Rad_2 or
- Repetitive_Radix_2_Add(0.613) /=
- Radix_2_Type(Result_Array(2).Rad_10)
- then
- Report.Failed("Incorrect Radix 2 Result, Case 2");
- end if;
-
- if Repetitive_Radix_2_Add(0.0727) /=
- Result_Array(3).Rad_2 or
- Repetitive_Radix_2_Add(0.0727) /=
- Radix_2_Type(Result_Array(3).Rad_10)
- then
- Report.Failed("Incorrect Radix 2 Result, Case 3");
- end if;
-
- -- Radix 10 Cases, three different values.
- -- Compare the result of the repetitive addition with the expected
- -- Radix 10 result, as well as with the Radix 2 value after type
- -- conversion.
-
- if Repetitive_Radix_10_Add(0.05) /= Result_Array(1).Rad_10 or
- Repetitive_Radix_10_Add(0.05) /= Radix_10_Type(Result_Array(1).Rad_2)
- then
- Report.Failed("Incorrect Radix 10 Result, Case 1");
- end if;
-
- if Repetitive_Radix_10_Add(0.613) /=
- Result_Array(2).Rad_10 or
- Repetitive_Radix_10_Add(0.613) /=
- Radix_10_Type(Result_Array(2).Rad_2)
- then
- Report.Failed("Incorrect Radix 10 Result, Case 2");
- end if;
-
- if Repetitive_Radix_10_Add(0.0727) /=
- Result_Array(3).Rad_10 or
- Repetitive_Radix_10_Add(0.0727) /=
- Radix_10_Type(Result_Array(3).Rad_2)
- then
- Report.Failed("Incorrect Radix 10 Result, Case 3");
- end if;
-
- exception
- when others => Report.Failed ("Exception raised in Radix_Block");
- end Radix_Block;
-
-
-
- Size_Block:
- -- Check the implementation max/min values of constants declared in
- -- package Ada.Decimal.
- declare
- Minimum_Required_Size : constant := 18;
- Maximum_Allowed_Size : constant := 0;
- begin
-
- -- Check that the Max_Decimal_Digits value is at least 18.
- if not (Ada.Decimal.Max_Decimal_Digits >= Minimum_Required_Size) then
- Report.Failed("Insufficient size provided for Max_Decimal_Digits");
- end if;
-
- -- Check that the Max_Scale value is at least 18.
- if not (Ada.Decimal.Max_Scale >= Minimum_Required_Size) then
- Report.Failed("Insufficient size provided for Max_Scale");
- end if;
-
- -- Check that the Min_Scale value is at most 0.
- if not (Ada.Decimal.Min_Scale <= Maximum_Allowed_Size) then
- Report.Failed("Too large a value provided for Min_Scale");
- end if;
-
- exception
- when others => Report.Failed ("Exception raised in Size_Block");
- end Size_Block;
-
- Report.Result;
-
-end CXF1001;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf2001.a b/gcc/testsuite/ada/acats/tests/cxf/cxf2001.a
deleted file mode 100644
index 96d0a0a17d3..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf2001.a
+++ /dev/null
@@ -1,755 +0,0 @@
--- CXF2001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the Divide procedure provides the following results:
--- Quotient = Dividend divided by Divisor and
--- Remainder = Dividend - (Divisor * Quotient)
--- Check that the Remainder is calculated exactly.
---
--- TEST DESCRIPTION:
--- This test is designed to test the generic procedure Divide found in
--- package Ada.Decimal.
---
--- The table below attempts to portray the design approach used in this
--- test. There are three "dimensions" of concern:
--- 1) the delta value of the Quotient and Remainder types, shown as
--- column headers,
--- 2) specific choices for the Dividend and Divisor numerical values
--- (i.e., whether they yielded a repeating/non-terminating result,
--- or a terminating result ["exact"]), displayed on the left side
--- of the tables, and
--- 3) the delta for the Dividend and Divisor.
---
--- Each row in the tables indicates a specific test case, showing the
--- specific quotient and remainder (under the appropriate Delta column)
--- for each combination of dividend and divisor values. Test cases
--- follow the top-to-bottom sequence shown in the tables.
---
--- Most of the test case sets (same dividend/divisor combinations -
--- indicated by dashed horizontal lines in the tables) vary the
--- delta of the quotient and remainder types between test cases. This
--- allows for an examination of how different deltas for a quotient
--- and/or remainder type can influence the results of a division with
--- identical dividend and divisor.
---
--- Note: Test cases are performed for both Radix 10 and Radix 2 types.
---
---
--- Divid Divis Delta Delta Delta Delta Delta
--- (Delta)(Delta)| .1 | .01 | .001 | .0001 | .00001 |Test
--- |---|---|-----|-----|-----|-----|-----|-----|-----|-----|Case
--- quotient | Q | R | Q | R | Q | R | Q | R | Q | R | No.
--- ---------------------------------------------------------------------------
--- .05 .3 |.1 .02 1,21
--- (.01) (.1) |.1 0 2,22
--- | .16 .002 3,23
--- 0.166666.. | .16 .00 4,24
--- | .166 .0002 5,25
--- ---------------------------------------------------------------------------
--- .15 20 | .00 .1500 6,26
--- (.01) (1) | .00 .150 7,27
--- | .00 .15 8,28
--- 0.0075 | .01 .007 9,29
--- | .007 .010 10,30
--- | .0075 .0000 11,31
--- ---------------------------------------------------------------------------
--- .03125 .5 | .0625 .0000 12,32
--- (.00001) (.1) | .062 .00025 13,33
--- | .062 .0002 14,34
--- 0.0625 | .062 .000 15,35
--- | .00 .062 16,36
--- | .06 .00125 17,37
--- | .06 .0012 18,38
--- | .06 .001 19,39
--- | .06 .00 20,40
--- ---------------------------------------------------------------------------
--- Divide by Zero| Raise Constraint_Error 41
--- ---------------------------------------------------------------------------
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 29 Dec 94 SAIC Modified Radix 2 cases to match Radix 10 cases.
--- 03 Oct 95 RBKD Modified to fix incorrect remainder results
--- 15 Nov 95 SAIC Incorporated reviewer fixes for ACVC 2.0.1.
---
---!
-
-with Report;
-with Ada.Decimal;
-
-procedure CXF2001 is
-
- TC_Verbose : Boolean := False;
-
-begin
-
- Report.Test ("CXF2001", "Check that the Divide procedure provides " &
- "correct results. Check that the Remainder " &
- "is calculated exactly");
- Radix_10_Block:
- declare
-
-
- -- Declare all types and variables used in the various blocks below
- -- for all Radix 10 evaluations.
-
- type DT_1 is delta 1.0 digits 5;
- type DT_0_1 is delta 0.1 digits 10;
- type DT_0_01 is delta 0.01 digits 10;
- type DT_0_001 is delta 0.001 digits 10;
- type DT_0_0001 is delta 0.0001 digits 10;
- type DT_0_00001 is delta 0.00001 digits 10;
-
- for DT_1'Machine_Radix use 10;
- for DT_0_1'Machine_Radix use 10;
- for DT_0_01'Machine_Radix use 10;
- for DT_0_001'Machine_Radix use 10;
- for DT_0_0001'Machine_Radix use 10;
- for DT_0_00001'Machine_Radix use 10;
-
- Dd_1, Dv_1, Quot_1, Rem_1 : DT_1 := 0.0;
- Dd_0_1, Dv_0_1, Quot_0_1, Rem_0_1 : DT_0_1 := 0.0;
- Dd_0_01, Dv_0_01, Quot_0_01, Rem_0_01 : DT_0_01 := 0.0;
- Dd_0_001, Dv_0_001, Quot_0_001, Rem_0_001 : DT_0_001 := 0.0;
- Dd_0_0001, Dv_0_0001, Quot_0_0001, Rem_0_0001 : DT_0_0001 := 0.0;
- Dd_0_00001, Dv_0_00001, Quot_0_00001, Rem_0_00001 : DT_0_00001 := 0.0;
-
- begin
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(Dividend_Type => DT_0_01,
- Divisor_Type => DT_0_1,
- Quotient_Type => DT_0_1,
- Remainder_Type => DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 1"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_01);
- if Quot_0_1 /= DT_0_1(0.1) or Rem_0_01 /= DT_0_01(0.02) then
- Report.Failed("Incorrect values returned, Case 1");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_1, DT_0_1);
- begin
- if TC_Verbose then Report.Comment("Case 2"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_1);
- if Quot_0_1 /= DT_0_1(0.1) or Rem_0_1 /= DT_0_1(0.0) then
- Report.Failed("Incorrect values returned, Case 2");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 3"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_001);
- if Quot_0_01 /= DT_0_01(0.16) or Rem_0_001 /= DT_0_001(0.002) then
- Report.Failed("Incorrect values returned, Case 3");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 4"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_01);
- if Quot_0_01 /= DT_0_01(0.16) or Rem_0_01 /= DT_0_01(0.0) then
- Report.Failed("Incorrect values returned, Case 4");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 5"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_001, Rem_0_0001);
- if Quot_0_001 /= DT_0_001(0.166) or
- Rem_0_0001 /= DT_0_0001(0.0002)
- then
- Report.Failed("Incorrect values returned, Case 5");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 6"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_0001);
- if Quot_0_01 /= DT_0_01(0.0) or Rem_0_0001 /= DT_0_0001(0.1500) then
- Report.Failed("Incorrect values returned, Case 6");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 7"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_001);
- if Quot_0_01 /= DT_0_01(0.0) or Rem_0_001 /= DT_0_001(0.150) then
- Report.Failed("Incorrect values returned, Case 7");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 8"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_01);
- if Quot_0_01 /= DT_0_01(0.0) or Rem_0_01 /= DT_0_01(0.15) then
- Report.Failed("Incorrect values returned, Case 8");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 9"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_001);
- if Quot_0_001 /= DT_0_001(0.007) or Rem_0_001 /= DT_0_001(0.01) then
- Report.Failed("Incorrect values returned, Case 9");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 10"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_01);
- if Quot_0_001 /= DT_0_001(0.007) or Rem_0_01 /= DT_0_01(0.01) then
- Report.Failed("Incorrect values returned, Case 10");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_0001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 11"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_0001, Rem_0_0001);
- if Quot_0_0001 /= DT_0_0001(0.0075) or
- Rem_0_0001 /= DT_0_0001(0.0)
- then
- Report.Failed("Incorrect values returned, Case 11");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_0001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 12"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_0001, Rem_0_0001);
- if Quot_0_0001 /= DT_0_0001(0.0625) or
- Rem_0_0001 /= DT_0_0001(0.0)
- then
- Report.Failed("Incorrect values returned, Case 12");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_00001);
- begin
- if TC_Verbose then Report.Comment("Case 13"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_00001);
- if Quot_0_001 /= DT_0_001(0.062) or
- Rem_0_00001 /= DT_0_00001(0.00025)
- then
- Report.Failed("Incorrect values returned, Case 13");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 14"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_0001);
- if Quot_0_001 /= DT_0_001(0.062) or
- Rem_0_0001 /= DT_0_0001(0.0002)
- then
- Report.Failed("Incorrect values returned, Case 14");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 15"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_001);
- if Quot_0_001 /= DT_0_001(0.062) or Rem_0_001 /= DT_0_001(0.000)
- then
- Report.Failed("Incorrect values returned, Case 15");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 16"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_01);
- if Quot_0_001 /= DT_0_001(0.062) or Rem_0_01 /= DT_0_01(0.00) then
- Report.Failed("Incorrect values returned, Case 16");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_00001);
- begin
- if TC_Verbose then Report.Comment("Case 17"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_00001);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_00001 /= DT_0_00001(0.00125)
- then
- Report.Failed("Incorrect values returned, Case 17");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 18"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_0001);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_0001 /= DT_0_0001(0.0012)
- then
- Report.Failed("Incorrect values returned, Case 18");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 19"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_001);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_001 /= DT_0_001(0.001) then
- Report.Failed("Incorrect values returned, Case 19");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 20"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_01);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_01 /= DT_0_01(0.0) then
- Report.Failed("Incorrect values returned, Case 20");
- end if;
- end;
-
-
- exception
- when others => Report.Failed("Exception raised in Radix_10_Block");
- end Radix_10_Block;
-
-
-
- Radix_2_Block:
- declare
-
- -- Declare all types and variables used in the various blocks below
- -- for all Radix 2 evaluations.
-
- type DT_1 is delta 1.0 digits 5;
- type DT_0_1 is delta 0.1 digits 10;
- type DT_0_01 is delta 0.01 digits 10;
- type DT_0_001 is delta 0.001 digits 10;
- type DT_0_0001 is delta 0.0001 digits 10;
- type DT_0_00001 is delta 0.00001 digits 10;
-
- for DT_1'Machine_Radix use 2;
- for DT_0_1'Machine_Radix use 2;
- for DT_0_01'Machine_Radix use 2;
- for DT_0_001'Machine_Radix use 2;
- for DT_0_0001'Machine_Radix use 2;
- for DT_0_00001'Machine_Radix use 2;
-
- Dd_1, Dv_1, Quot_1, Rem_1 : DT_1 := 0.0;
- Dd_0_1, Dv_0_1, Quot_0_1, Rem_0_1 : DT_0_1 := 0.0;
- Dd_0_01, Dv_0_01, Quot_0_01, Rem_0_01 : DT_0_01 := 0.0;
- Dd_0_001, Dv_0_001, Quot_0_001, Rem_0_001 : DT_0_001 := 0.0;
- Dd_0_0001, Dv_0_0001, Quot_0_0001, Rem_0_0001 : DT_0_0001 := 0.0;
- Dd_0_00001, Dv_0_00001, Quot_0_00001, Rem_0_00001 : DT_0_00001 := 0.0;
-
- begin
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(Dividend_Type => DT_0_01,
- Divisor_Type => DT_0_1,
- Quotient_Type => DT_0_1,
- Remainder_Type => DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 21"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_01);
- if Quot_0_1 /= DT_0_1(0.1) or Rem_0_01 /= DT_0_01(0.02) then
- Report.Failed("Incorrect values returned, Case 21");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_1, DT_0_1);
- begin
- if TC_Verbose then Report.Comment("Case 22"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_1);
- if Quot_0_1 /= DT_0_1(0.1) or Rem_0_1 /= DT_0_1(0.0) then
- Report.Failed("Incorrect values returned, Case 22");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 23"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_001);
- if Quot_0_01 /= DT_0_01(0.16) or Rem_0_001 /= DT_0_001(0.002) then
- Report.Failed("Incorrect values returned, Case 23");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 24"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_01);
- if Quot_0_01 /= DT_0_01(0.16) or Rem_0_01 /= DT_0_01(0.0) then
- Report.Failed("Incorrect values returned, Case 24");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 25"); end if;
- Dd_0_01 := DT_0_01(0.05); Dv_0_1 := DT_0_1(0.3);
- Div(Dd_0_01, Dv_0_1, Quot_0_001, Rem_0_0001);
- if Quot_0_001 /= DT_0_001(0.166) or
- Rem_0_0001 /= DT_0_0001(0.0002)
- then
- Report.Failed("Incorrect values returned, Case 25");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 26"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_0001);
- if Quot_0_01 /= DT_0_01(0.0) or Rem_0_0001 /= DT_0_0001(0.1500) then
- Report.Failed("Incorrect values returned, Case 26");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 27"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_001);
- if Quot_0_01 /= DT_0_01(0.0) or Rem_0_001 /= DT_0_001(0.150) then
- Report.Failed("Incorrect values returned, Case 27");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 28"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_01);
- if Quot_0_01 /= DT_0_01(0.0) or Rem_0_01 /= DT_0_01(0.15) then
- Report.Failed("Incorrect values returned, Case 28");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 29"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_001);
- if Quot_0_001 /= DT_0_001(0.007) or Rem_0_001 /= DT_0_001(0.01) then
- Report.Failed("Incorrect values returned, Case 29");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 30"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_01);
- if Quot_0_001 /= DT_0_001(0.007) or Rem_0_01 /= DT_0_01(0.01) then
- Report.Failed("Incorrect values returned, Case 30");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_0001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 31"); end if;
- Dd_0_01 := DT_0_01(0.15); Dv_1 := DT_1(20);
- Div(Dd_0_01, Dv_1, Quot_0_0001, Rem_0_0001);
- if Quot_0_0001 /= DT_0_0001(0.0075) or
- Rem_0_0001 /= DT_0_0001(0.0)
- then
- Report.Failed("Incorrect values returned, Case 31");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_0001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 32"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_0001, Rem_0_0001);
- if Quot_0_0001 /= DT_0_0001(0.0625) or
- Rem_0_0001 /= DT_0_0001(0.0)
- then
- Report.Failed("Incorrect values returned, Case 32");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_00001);
- begin
- if TC_Verbose then Report.Comment("Case 33"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_00001);
- if Quot_0_001 /= DT_0_001(0.062) or
- Rem_0_00001 /= DT_0_00001(0.00025)
- then
- Report.Failed("Incorrect values returned, Case 33");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 34"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_0001);
- if Quot_0_001 /= DT_0_001(0.062) or
- Rem_0_0001 /= DT_0_0001(0.0002)
- then
- Report.Failed("Incorrect values returned, Case 34");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 35"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_001);
- if Quot_0_001 /= DT_0_001(0.062) or Rem_0_001 /= DT_0_001(0.000)
- then
- Report.Failed("Incorrect values returned, Case 35");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 36"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_01);
- if Quot_0_001 /= DT_0_001(0.062) or Rem_0_01 /= DT_0_01(0.00) then
- Report.Failed("Incorrect values returned, Case 36");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_00001);
- begin
- if TC_Verbose then Report.Comment("Case 37"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_00001);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_00001 /= DT_0_00001(0.00125)
- then
- Report.Failed("Incorrect values returned, Case 37");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 38"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_0001);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_0001 /= DT_0_0001(0.0012)
- then
- Report.Failed("Incorrect values returned, Case 38");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_001);
- begin
- if TC_Verbose then Report.Comment("Case 39"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_001);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_001 /= DT_0_001(0.001) then
- Report.Failed("Incorrect values returned, Case 39");
- end if;
- end;
-
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_01);
- begin
- if TC_Verbose then Report.Comment("Case 40"); end if;
- Dd_0_00001 := DT_0_00001(0.03125); Dv_0_1 := DT_0_1(0.5);
- Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_01);
- if Quot_0_01 /= DT_0_01(0.06) or Rem_0_01 /= DT_0_01(0.0) then
- Report.Failed("Incorrect values returned, Case 40");
- end if;
- end;
-
- declare
- procedure Div is
- new Ada.Decimal.Divide(DT_0_0001, DT_1, DT_0_0001, DT_0_0001);
- begin
- if TC_Verbose then Report.Comment("Case 41"); end if;
- Dd_0_0001 := (DT_0_0001(6062.0) / DT_0_0001(16384.0));
- Dv_1 := DT_1(0.0);
- Div(Dd_0_0001, Dv_1, Quot_0_0001, Rem_0_0001);
- Report.Failed("Divide by Zero didn't raise Constraint_Error, " &
- "Case 41");
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised by Divide by Zero," &
- "Case 41");
- end;
-
- exception
- when others => Report.Failed("Exception raised in Radix_10_Block");
- end Radix_2_Block;
-
-
- Report.Result;
-
-end CXF2001;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf2002.a b/gcc/testsuite/ada/acats/tests/cxf/cxf2002.a
deleted file mode 100644
index 984daa97bca..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf2002.a
+++ /dev/null
@@ -1,352 +0,0 @@
--- CXF2002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the multiplying operators for a decimal fixed point type
--- return values that are integral multiples of the small of the type.
--- Check the case where the operand and result types are the same.
---
--- Check that if the mathematical result is between multiples of the
--- small of the result type, the result is truncated toward zero.
--- Check that if the attribute 'Round is applied to the mathematical
--- result, however, the result is rounded to the nearest multiple of
--- the small (away from zero if the result is midway between two
--- multiples of the small).
---
--- TEST DESCRIPTION:
--- Two decimal fixed point types are declared, one with a Machine_Radix
--- value of 2, and one with a value of 10. For each type, checks are
--- performed on the following operations, where the operand and result
--- types are the same:
---
--- - Multiplication.
--- - Multiplication, where the attribute 'Round is applied to the
--- result.
--- - Division.
--- - Division, where the attribute 'Round is applied to the result.
---
--- Each operation is performed within a loop, where one operand is
--- always the same variable. After the loop completes, the cumulative
--- total contained in this variable is compared with the expected
--- result.
---
--- APPLICABILITY CRITERIA:
--- This test is only applicable for a compiler attempting validation
--- for the Information Systems Annex.
---
---
--- CHANGE HISTORY:
--- 27 Mar 96 SAIC Prerelease version for ACVC 2.1.
---
---!
-
-generic
- type Decimal_Fixed is delta <> digits <>;
-package CXF2002_0 is
-
- procedure Multiply_And_Truncate (Balance : in out Decimal_Fixed;
- Factor : in Decimal_Fixed);
-
- procedure Divide_And_Truncate (Balance : in out Decimal_Fixed;
- Divisor : in Decimal_Fixed);
-
- procedure Multiply_And_Round (Balance : in out Decimal_Fixed;
- Factor : in Decimal_Fixed);
-
- procedure Divide_And_Round (Balance : in out Decimal_Fixed;
- Divisor : in Decimal_Fixed);
-
-end CXF2002_0;
-
-
- --==================================================================--
-
-
-package body CXF2002_0 is
-
- procedure Multiply_And_Truncate (Balance : in out Decimal_Fixed;
- Factor : in Decimal_Fixed) is
- Interest : Decimal_Fixed;
- begin
- Interest := Factor * Balance; -- Fixed-fixed multiplication.
- Balance := Balance + Interest;
- end Multiply_And_Truncate;
-
-
- procedure Divide_And_Truncate (Balance : in out Decimal_Fixed;
- Divisor : in Decimal_Fixed) is
- Interest : Decimal_Fixed;
- begin
- Interest := Balance / Divisor; -- Fixed-fixed division.
- Balance := Balance + Interest;
- end Divide_And_Truncate;
-
-
- procedure Multiply_And_Round (Balance : in out Decimal_Fixed;
- Factor : in Decimal_Fixed) is
- Interest : Decimal_Fixed;
- begin
- -- Fixed-fixed multiplication.
- Interest := Decimal_Fixed'Round ( Factor * Balance );
- Balance := Balance + Interest;
- end Multiply_And_Round;
-
-
- procedure Divide_And_Round (Balance : in out Decimal_Fixed;
- Divisor : in Decimal_Fixed) is
- Interest : Decimal_Fixed;
- begin
- -- Fixed-fixed division.
- Interest := Decimal_Fixed'Round ( Balance / Divisor );
- Balance := Balance + Interest;
- end Divide_And_Round;
-
-end CXF2002_0;
-
-
- --==================================================================--
-
-
-package CXF2002_1 is
-
- type Money_Radix2 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix2'Machine_Radix use 2; -- +999,999,999.99
-
-
- type Money_Radix10 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix10'Machine_Radix use 10; -- +999,999,999.99
-
-end CXF2002_1;
-
-
- --==================================================================--
-
-
-with CXF2002_0;
-with CXF2002_1;
-
-with Report;
-procedure CXF2002 is
-
- Loop_Count : constant := 300;
- type Loop_Range is range 1 .. Loop_Count;
-
-begin
-
- Report.Test ("CXF2002", "Check decimal multiplication and division, and " &
- "'Round, where the operand and result types are " &
- "the same");
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_2_SUBTESTS:
- declare
- package Radix_2 is new CXF2002_0 (CXF2002_1.Money_Radix2);
- use type CXF2002_1.Money_Radix2;
- begin
-
- RADIX_2_MULTIPLICATION:
- declare
- Rate : constant CXF2002_1.Money_Radix2 := 0.12;
- Period : constant Integer := 12;
- Factor : CXF2002_1.Money_Radix2 := Rate / Period;
-
- Initial : constant CXF2002_1.Money_Radix2 := 100_000.00;
- Trunc_Expected : constant CXF2002_1.Money_Radix2 := 1_978_837.50;
- Round_Expected : constant CXF2002_1.Money_Radix2 := 1_978_846.75;
-
- Balance : CXF2002_1.Money_Radix2;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Multiply_And_Truncate (Balance, Factor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 2 multiply and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Multiply_And_Round (Balance, Factor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 2 multiply and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_2_MULTIPLICATION;
-
-
- RADIX_2_DIVISION:
- declare
- Rate : constant CXF2002_1.Money_Radix2 := 0.25;
- Period : constant Integer := 12;
- Factor : CXF2002_1.Money_Radix2 := Rate / Period;
- Divisor : constant CXF2002_1.Money_Radix2 := 1.0 / Factor;
-
- Initial : constant CXF2002_1.Money_Radix2 := 5_500.36;
- Trunc_Expected : constant CXF2002_1.Money_Radix2 := 2_091_332.87;
- Round_Expected : constant CXF2002_1.Money_Radix2 := 2_091_436.88;
-
- Balance : CXF2002_1.Money_Radix2;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Divide_And_Truncate (Balance, Divisor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 2 divide and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Divide_And_Round (Balance, Divisor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 2 divide and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_2_DIVISION;
-
- end RADIX_2_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_10_SUBTESTS:
- declare
- package Radix_10 is new CXF2002_0 (CXF2002_1.Money_Radix10);
- use type CXF2002_1.Money_Radix10;
- begin
-
- RADIX_10_MULTIPLICATION:
- declare
- Rate : constant CXF2002_1.Money_Radix10 := 0.37;
- Period : constant Integer := 12;
- Factor : CXF2002_1.Money_Radix10 := Rate / Period;
-
- Initial : constant CXF2002_1.Money_Radix10 := 459.33;
- Trunc_Expected : constant CXF2002_1.Money_Radix10 := 3_259_305.54;
- Round_Expected : constant CXF2002_1.Money_Radix10 := 3_260_544.11;
-
- Balance : CXF2002_1.Money_Radix10;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Multiply_And_Truncate (Balance, Factor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 10 multiply and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Multiply_And_Round (Balance, Factor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 10 multiply and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_10_MULTIPLICATION;
-
-
- RADIX_10_DIVISION:
- declare
- Rate : constant CXF2002_1.Money_Radix10 := 0.15;
- Period : constant Integer := 12;
- Factor : CXF2002_1.Money_Radix10 := Rate / Period;
- Divisor : constant CXF2002_1.Money_Radix10 := 1.0 / Factor;
-
- Initial : constant CXF2002_1.Money_Radix10 := 29_842.08;
- Trunc_Expected : constant CXF2002_1.Money_Radix10 := 590_519.47;
- Round_Expected : constant CXF2002_1.Money_Radix10 := 590_528.98;
-
- Balance : CXF2002_1.Money_Radix10;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Divide_And_Truncate (Balance, Divisor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 10 divide and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Divide_And_Round (Balance, Divisor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 10 divide and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_10_DIVISION;
-
- end RADIX_10_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Report.Result;
-
-end CXF2002;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf2003.a b/gcc/testsuite/ada/acats/tests/cxf/cxf2003.a
deleted file mode 100644
index 133dc48e6c2..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf2003.a
+++ /dev/null
@@ -1,363 +0,0 @@
--- CXF2003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the multiplying operators for a decimal fixed point type
--- return values that are integral multiples of the small of the type.
--- Check the case where the two operands are of different decimal
--- fixed point types.
---
--- Check that if the mathematical result is between multiples of the
--- small of the result type, the result is truncated toward zero.
--- Check that if the attribute 'Round is applied to the mathematical
--- result, however, the result is rounded to the nearest multiple of
--- the small (away from zero if the result is midway between two
--- multiples of the small).
---
--- TEST DESCRIPTION:
--- Two decimal fixed point types A and B are declared, one with a
--- Machine_Radix value of 2, and one with a value of 10. A third decimal
--- fixed point type C is declared with digits and delta values different
--- from those of A and B. For type A (and B), checks are performed
--- on the following operations, where one operand type is C, and the
--- other operand type and the result type is A (or B):
---
--- - Multiplication.
--- - Multiplication, where the attribute 'Round is applied to the
--- result.
--- - Division.
--- - Division, where the attribute 'Round is applied to the result.
---
--- Each operation is performed within a loop, where one operand is
--- always the same variable. After the loop completes, the cumulative
--- total contained in this variable is compared with the expected
--- result.
---
--- APPLICABILITY CRITERIA:
--- This test is only applicable for a compiler attempting validation
--- for the Information Systems Annex.
---
---
--- CHANGE HISTORY:
--- 22 Mar 96 SAIC Prerelease version for ACVC 2.1.
---
---!
-
-generic
- type Decimal_Fixed_1 is delta <> digits <>;
- type Decimal_Fixed_2 is delta <> digits <>;
-package CXF2003_0 is
-
- procedure Multiply_And_Truncate (Balance : in out Decimal_Fixed_1;
- Factor : in Decimal_Fixed_2);
-
- procedure Divide_And_Truncate (Balance : in out Decimal_Fixed_1;
- Divisor : in Decimal_Fixed_2);
-
- procedure Multiply_And_Round (Balance : in out Decimal_Fixed_1;
- Factor : in Decimal_Fixed_2);
-
- procedure Divide_And_Round (Balance : in out Decimal_Fixed_1;
- Divisor : in Decimal_Fixed_2);
-
-end CXF2003_0;
-
-
- --==================================================================--
-
-
-package body CXF2003_0 is
-
- procedure Multiply_And_Truncate (Balance : in out Decimal_Fixed_1;
- Factor : in Decimal_Fixed_2) is
- Interest : Decimal_Fixed_1;
- begin
- Interest := Factor * Balance; -- Fixed-fixed multiplication.
- Balance := Balance + Interest;
- end Multiply_And_Truncate;
-
-
- procedure Divide_And_Truncate (Balance : in out Decimal_Fixed_1;
- Divisor : in Decimal_Fixed_2) is
- Interest : Decimal_Fixed_1;
- begin
- Interest := Balance / Divisor; -- Fixed-fixed division.
- Balance := Balance + Interest;
- end Divide_And_Truncate;
-
-
- procedure Multiply_And_Round (Balance : in out Decimal_Fixed_1;
- Factor : in Decimal_Fixed_2) is
- Interest : Decimal_Fixed_1;
- begin
- -- Fixed-fixed multiplication.
- Interest := Decimal_Fixed_1'Round ( Factor * Balance );
- Balance := Balance + Interest;
- end Multiply_And_Round;
-
-
- procedure Divide_And_Round (Balance : in out Decimal_Fixed_1;
- Divisor : in Decimal_Fixed_2) is
- Interest : Decimal_Fixed_1;
- begin
- -- Fixed-fixed division.
- Interest := Decimal_Fixed_1'Round ( Balance / Divisor );
- Balance := Balance + Interest;
- end Divide_And_Round;
-
-end CXF2003_0;
-
-
- --==================================================================--
-
-
-package CXF2003_1 is
-
- type Money_Radix2 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix2'Machine_Radix use 2; -- +999,999,999.99
-
-
- type Money_Radix10 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix10'Machine_Radix use 10; -- +999,999,999.99
-
-
- type Interest_Rate is delta 0.00001 digits 9; -- range -9999.99999 ..
- -- +9999.99999
-
-end CXF2003_1;
-
-
- --==================================================================--
-
-
-with CXF2003_0;
-with CXF2003_1;
-
-with Report;
-procedure CXF2003 is
-
- Loop_Count : constant := 1825;
- type Loop_Range is range 1 .. Loop_Count;
-
-begin
-
- Report.Test ("CXF2003", "Check decimal multiplication and division, and " &
- "'Round, where the operand types are different");
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_2_SUBTESTS:
- declare
- package Radix_2 is new CXF2003_0 (CXF2003_1.Money_Radix2,
- CXF2003_1.Interest_Rate);
- use type CXF2003_1.Money_Radix2;
- use type CXF2003_1.Interest_Rate;
- begin
-
- RADIX_2_MULTIPLICATION:
- declare
- Rate : CXF2003_1.Interest_Rate := 0.198;
- Period : Integer := 365;
- Factor : CXF2003_1.Interest_Rate := Rate / Period;
-
- Initial : constant CXF2003_1.Money_Radix2 := 1_000.00;
- Trunc_Expected : constant CXF2003_1.Money_Radix2 := 2_662.94;
- Round_Expected : constant CXF2003_1.Money_Radix2 := 2_678.34;
-
- Balance : CXF2003_1.Money_Radix2;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Multiply_And_Truncate (Balance, Factor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 2 multiply and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Multiply_And_Round (Balance, Factor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 2 multiply and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_2_MULTIPLICATION;
-
-
- RADIX_2_DIVISION:
- declare
- Rate : CXF2003_1.Interest_Rate := 0.129;
- Period : Integer := 365;
- Factor : CXF2003_1.Interest_Rate := Rate / Period;
- Divisor : CXF2003_1.Interest_Rate := 1.0 / Factor;
-
- Initial : constant CXF2003_1.Money_Radix2 := 14_626.52;
- Trunc_Expected : constant CXF2003_1.Money_Radix2 := 27_688.26;
- Round_Expected : constant CXF2003_1.Money_Radix2 := 27_701.12;
-
- Balance : CXF2003_1.Money_Radix2;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Divide_And_Truncate (Balance, Divisor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 2 divide and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Divide_And_Round (Balance, Divisor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 2 divide and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_2_DIVISION;
-
- end RADIX_2_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_10_SUBTESTS:
- declare
- package Radix_10 is new CXF2003_0 (CXF2003_1.Money_Radix10,
- CXF2003_1.Interest_Rate);
- use type CXF2003_1.Money_Radix10;
- use type CXF2003_1.Interest_Rate;
- begin
-
- RADIX_10_MULTIPLICATION:
- declare
- Rate : CXF2003_1.Interest_Rate := 0.063;
- Period : Integer := 365;
- Factor : CXF2003_1.Interest_Rate := Rate / Period;
-
- Initial : constant CXF2003_1.Money_Radix10 := 314_036.10;
- Trunc_Expected : constant CXF2003_1.Money_Radix10 := 428_249.48;
- Round_Expected : constant CXF2003_1.Money_Radix10 := 428_260.52;
-
- Balance : CXF2003_1.Money_Radix10;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Multiply_And_Truncate (Balance, Factor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 10 multiply and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Multiply_And_Round (Balance, Factor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 10 multiply and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_10_MULTIPLICATION;
-
-
- RADIX_10_DIVISION:
- declare
- Rate : CXF2003_1.Interest_Rate := 0.273;
- Period : Integer := 365;
- Factor : CXF2003_1.Interest_Rate := Rate / Period;
- Divisor : CXF2003_1.Interest_Rate := 1.0 / Factor;
-
- Initial : constant CXF2003_1.Money_Radix10 := 25.72;
- Trunc_Expected : constant CXF2003_1.Money_Radix10 := 79.05;
- Round_Expected : constant CXF2003_1.Money_Radix10 := 97.46;
-
- Balance : CXF2003_1.Money_Radix10;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Divide_And_Truncate (Balance, Divisor);
- end loop;
-
- if Balance /= Trunc_Expected then
- Report.Failed ("Wrong result: Radix 10 divide and truncate");
- end if;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Divide_And_Round (Balance, Divisor);
- end loop;
-
- if Balance /= Round_Expected then
- Report.Failed ("Wrong result: Radix 10 divide and round");
- end if;
-
- ---=---=---=---=---=---=---
- end RADIX_10_DIVISION;
-
- end RADIX_10_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Report.Result;
-
-end CXF2003;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf2004.a b/gcc/testsuite/ada/acats/tests/cxf/cxf2004.a
deleted file mode 100644
index 9651384ce7e..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf2004.a
+++ /dev/null
@@ -1,513 +0,0 @@
--- CXF2004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the multiplying operators for a decimal fixed point type
--- return values that are integral multiples of the small of the type.
--- Check the case where one operand is of an ordinary fixed point type.
---
--- Check that if the mathematical result is between multiples of the
--- small of the result type, the result is truncated toward zero.
--- Check that if the attribute 'Round is applied to the mathematical
--- result, however, the result is rounded to the nearest multiple of
--- the small (away from zero if the result is midway between two
--- multiples of the small).
---
--- TEST DESCRIPTION:
--- Two decimal fixed point types A and B are declared, one with a
--- Machine_Radix value of 2, and one with a value of 10. An ordinary
--- fixed point type C is declared with a delta value different from
--- those of A and B (although still a power of 10). For type A (and B),
--- checks are performed on the following operations, where one operand
--- type is C, and the other operand type and the result type is A (or B):
---
--- - Multiplication.
--- - Multiplication, where the attribute 'Round is applied to the
--- result.
--- - Division.
--- - Division, where the attribute 'Round is applied to the result.
---
--- Each operation is performed within a loop, where one operand is
--- always the same variable. After the loop completes, the cumulative
--- total contained in this variable is compared with the expected
--- result.
---
--- APPLICABILITY CRITERIA:
--- This test is only applicable for a compiler attempting validation
--- for the Information Systems Annex.
---
---
--- CHANGE HISTORY:
--- 22 Mar 96 SAIC Prerelease version for ACVC 2.1.
--- 11 Aug 96 SAIC ACVC 2.1: In RADIX_2_MULTIPLICATION, corrected
--- value of Rate. Corrected associated commentary.
---
---!
-
-generic
- type Decimal_Fixed is delta <> digits <>;
- type Ordinary_Fixed is delta <>;
-package CXF2004_0 is
-
- procedure Multiply_And_Truncate (Balance : in out Decimal_Fixed;
- Factor : in Ordinary_Fixed);
-
- procedure Divide_And_Truncate (Balance : in out Decimal_Fixed;
- Divisor : in Ordinary_Fixed);
-
- procedure Multiply_And_Round (Balance : in out Decimal_Fixed;
- Factor : in Ordinary_Fixed);
-
- procedure Divide_And_Round (Balance : in out Decimal_Fixed;
- Divisor : in Ordinary_Fixed);
-
-end CXF2004_0;
-
-
- --==================================================================--
-
-
-package body CXF2004_0 is
-
- procedure Multiply_And_Truncate (Balance : in out Decimal_Fixed;
- Factor : in Ordinary_Fixed) is
- Interest : Decimal_Fixed;
- begin
- Interest := Factor * Balance; -- Fixed-fixed multiplication.
- Balance := Balance + Interest;
- end Multiply_And_Truncate;
-
-
- procedure Divide_And_Truncate (Balance : in out Decimal_Fixed;
- Divisor : in Ordinary_Fixed) is
- Interest : Decimal_Fixed;
- begin
- Interest := Balance / Divisor; -- Fixed-fixed division.
- Balance := Balance + Interest;
- end Divide_And_Truncate;
-
-
- procedure Multiply_And_Round (Balance : in out Decimal_Fixed;
- Factor : in Ordinary_Fixed) is
- Interest : Decimal_Fixed;
- begin
- -- Fixed-fixed multiplication.
- Interest := Decimal_Fixed'Round ( Factor * Balance );
- Balance := Balance + Interest;
- end Multiply_And_Round;
-
-
- procedure Divide_And_Round (Balance : in out Decimal_Fixed;
- Divisor : in Ordinary_Fixed) is
- Interest : Decimal_Fixed;
- begin
- -- Fixed-fixed division.
- Interest := Decimal_Fixed'Round ( Balance / Divisor );
- Balance := Balance + Interest;
- end Divide_And_Round;
-
-end CXF2004_0;
-
-
- --==================================================================--
-
-
-package CXF2004_1 is
-
- type Money_Radix2 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix2'Machine_Radix use 2; -- +999,999,999.99
-
-
- type Money_Radix10 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix10'Machine_Radix use 10; -- +999,999,999.99
-
-
- type Interest_Rate is delta 0.001 range 0.0 .. 1_000.0;
- for Interest_Rate'Small use 0.001; -- Power of 10.
-
-end CXF2004_1;
-
-
- --==================================================================--
-
-
-with CXF2004_0;
-with CXF2004_1;
-
-with Report;
-procedure CXF2004 is
-
- Loop_Count : constant := 180;
- type Loop_Range is range 1 .. Loop_Count;
-
- type Rounding_Scheme is ( Rounds, Truncates );
- Machine : Rounding_Scheme;
-
-begin
-
- Report.Test ("CXF2004", "Check decimal multiplication and division, and " &
- "'Round, where one operand type is ordinary fixed");
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- if CXF2004_1.Interest_Rate'Machine_Rounds then -- Determine machine's
- Machine := Rounds; -- rounding scheme.
- else
- Machine := Truncates;
- end if;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_2_SUBTESTS:
- declare
- package Radix_2 is new CXF2004_0 (CXF2004_1.Money_Radix2,
- CXF2004_1.Interest_Rate);
- use type CXF2004_1.Money_Radix2;
- use type CXF2004_1.Interest_Rate;
- begin
-
- RADIX_2_MULTIPLICATION:
- declare
- Rate : constant CXF2004_1.Interest_Rate := 0.154;
- Period : constant Integer := 12;
- Factor : CXF2004_1.Interest_Rate := Rate / Period;
-
- -- The exact value of Factor is:
- --
- -- 0.154/12 = 0.01283333...
- --
- -- The adjacent multiples of small are 0.012 and 0.013. Since
- -- Factor is of an ordinary fixed point type, it may contain either
- -- of these values. However, since "Rate / Period" is a static
- -- expression, the value Factor contains is determined by the
- -- value of CXF2004_1.Interest_Rate'Machine_Rounds:
- --
- -- If Machine_Rounds = FALSE : Factor = 0.012
- -- If Machine_Rounds = TRUE : Factor = 0.013
-
- Initial : constant CXF2004_1.Money_Radix2 := 1_000.00;
-
- Trunc_Expected_MachTrnc: constant CXF2004_1.Money_Radix2 := 8_557.07;
- Round_Expected_MachTrnc: constant CXF2004_1.Money_Radix2 := 8_560.47;
-
- Trunc_Expected_MachRnds: constant CXF2004_1.Money_Radix2 := 10_222.65;
- Round_Expected_MachRnds: constant CXF2004_1.Money_Radix2 := 10_225.81;
-
- Balance : CXF2004_1.Money_Radix2;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Multiply_And_Truncate (Balance, Factor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Trunc_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 2 multiply and truncate");
- end if;
- when Truncates =>
- if Balance /= Trunc_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 2 multiply and truncate");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Multiply_And_Round (Balance, Factor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Round_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 2 multiply and round");
- end if;
- when Truncates =>
- if Balance /= Round_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 2 multiply and round");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
- end RADIX_2_MULTIPLICATION;
-
-
- RADIX_2_DIVISION:
- declare
- Rate : constant CXF2004_1.Interest_Rate := 0.210;
- Period : constant Integer := 12;
- Factor : constant CXF2004_1.Interest_Rate := Rate / Period;
- Divisor : CXF2004_1.Interest_Rate := 1.0 / Factor;
-
- -- The exact value of Factor is:
- --
- -- 0.210/12 = 0.0175
- --
- -- The adjacent multiples of small are 0.017 and 0.018. Since
- -- Factor is of an ordinary fixed point type, it may contain either
- -- of these values. However, since "Rate / Period" is a static
- -- expression, the value Factor contains is determined by the
- -- value of CXF2004_1.Interest_Rate'Machine_Rounds:
- --
- -- If Machine_Rounds = FALSE : Factor = 0.017
- -- If Machine_Rounds = TRUE : Factor = 0.018
- --
- -- The exact value of Divisor is one of the following values:
- --
- -- 1.0/0.017 = 58.82352... (Adjacent smalls 58.823 and 58.824)
- -- 1.0/0.018 = 55.55555... (Adjacent smalls 55.555 and 55.556)
- --
- -- Again, since "1.0 / Factor" is static, the value Divisor contains
- -- is determined by the value of CXF2004_1.Interest_Rate'Rounds:
- --
- -- If Machine_Rounds = FALSE : Divisor = 58.823
- -- If Machine_Rounds = TRUE : Divisor = 55.556
-
- Initial : constant CXF2004_1.Money_Radix2 := 260.13;
-
- Trunc_Expected_MachTrnc: constant CXF2004_1.Money_Radix2 := 5_401.46;
- Round_Expected_MachTrnc: constant CXF2004_1.Money_Radix2 := 5_406.95;
-
- Trunc_Expected_MachRnds: constant CXF2004_1.Money_Radix2 := 6_446.56;
- Round_Expected_MachRnds: constant CXF2004_1.Money_Radix2 := 6_453.78;
-
- Balance : CXF2004_1.Money_Radix2;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Divide_And_Truncate (Balance, Divisor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Trunc_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 2 divide and truncate");
- end if;
- when Truncates =>
- if Balance /= Trunc_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 2 divide and truncate");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_2.Divide_And_Round (Balance, Divisor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Round_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 2 divide and round");
- end if;
- when Truncates =>
- if Balance /= Round_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 2 divide and round");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
- end RADIX_2_DIVISION;
-
- end RADIX_2_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_10_SUBTESTS:
- declare
- package Radix_10 is new CXF2004_0 (CXF2004_1.Money_Radix10,
- CXF2004_1.Interest_Rate);
- use type CXF2004_1.Money_Radix10;
- use type CXF2004_1.Interest_Rate;
- begin
-
- RADIX_10_MULTIPLICATION:
- declare
- Rate : constant CXF2004_1.Interest_Rate := 0.095;
- Period : constant Integer := 12;
- Factor : CXF2004_1.Interest_Rate := Rate / Period;
-
- -- The exact value of Factor is:
- --
- -- 0.095/12 = 0.00791666...
- --
- -- The adjacent multiples of small are 0.007 and 0.008. Since
- -- Factor is of an ordinary fixed point type, it may contain either
- -- of these values. However, since "Rate / Period" is a static
- -- expression, the value Factor contains can be determined based
- -- on the value of CXF2004_1.Interest_Rate'Machine_Rounds:
- --
- -- If Machine_Rounds = FALSE : Factor = 0.007
- -- If Machine_Rounds = TRUE : Factor = 0.008
-
- Initial : constant CXF2004_1.Money_Radix10 := 2_125.00;
-
- Trunc_Expected_MachTrnc: constant CXF2004_1.Money_Radix10 := 7_456.90;
- Round_Expected_MachTrnc: constant CXF2004_1.Money_Radix10 := 7_458.77;
-
- Trunc_Expected_MachRnds: constant CXF2004_1.Money_Radix10 := 8_915.74;
- Round_Expected_MachRnds: constant CXF2004_1.Money_Radix10 := 8_917.84;
-
- Balance : CXF2004_1.Money_Radix10;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Multiply_And_Truncate (Balance, Factor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Trunc_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 10 multiply and truncate");
- end if;
- when Truncates =>
- if Balance /= Trunc_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 10 multiply and truncate");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Multiply_And_Round (Balance, Factor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Round_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 10 multiply and round");
- end if;
- when Truncates =>
- if Balance /= Round_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 10 multiply and round");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
- end RADIX_10_MULTIPLICATION;
-
-
- RADIX_10_DIVISION:
- declare
- Rate : constant CXF2004_1.Interest_Rate := 0.295;
- Period : constant Integer := 12;
- Factor : constant CXF2004_1.Interest_Rate := Rate / Period;
- Divisor : CXF2004_1.Interest_Rate := 1.0 / Factor;
-
- -- The exact value of Factor is:
- --
- -- 0.295/12 = 0.02458333...
- --
- -- The adjacent multiples of small are 0.024 and 0.025. Thus, the
- -- exact value of Divisor is one of the following:
- --
- -- 1.0/0.024 = 41.66666... (Adjacent smalls 41.666 and 41.667)
- -- 1.0/0.025 = 40.0
- --
- -- The value of CXF2004_1.Interest_Rate'Machine_Rounds determines
- -- what Divisor contains:
- --
- -- If Machine_Rounds = FALSE : Divisor = 41.666
- -- If Machine_Rounds = TRUE : Divisor = 40.000
-
- Initial : constant CXF2004_1.Money_Radix10 := 72.19;
-
- Trunc_Expected_MachTrnc: constant CXF2004_1.Money_Radix10 := 5_144.60;
- Round_Expected_MachTrnc: constant CXF2004_1.Money_Radix10 := 5_157.80;
-
- Trunc_Expected_MachRnds: constant CXF2004_1.Money_Radix10 := 6_133.28;
- Round_Expected_MachRnds: constant CXF2004_1.Money_Radix10 := 6_149.06;
-
- Balance : CXF2004_1.Money_Radix10;
- begin
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Divide_And_Truncate (Balance, Divisor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Trunc_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 10 divide and truncate");
- end if;
- when Truncates =>
- if Balance /= Trunc_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 10 divide and truncate");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
-
- Balance := Initial;
-
- for I in Loop_Range loop
- Radix_10.Divide_And_Round (Balance, Divisor);
- end loop;
-
- case (Machine) is
- when Rounds =>
- if Balance /= Round_Expected_MachRnds then
- Report.Failed ("Error (R): Radix 10 divide and round");
- end if;
- when Truncates =>
- if Balance /= Round_Expected_MachTrnc then
- Report.Failed ("Error (T): Radix 10 divide and round");
- end if;
- end case;
-
- ---=---=---=---=---=---=---
- end RADIX_10_DIVISION;
-
- end RADIX_10_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Report.Result;
-
-end CXF2004;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf2005.a b/gcc/testsuite/ada/acats/tests/cxf/cxf2005.a
deleted file mode 100644
index 71cd5bb31b5..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf2005.a
+++ /dev/null
@@ -1,293 +0,0 @@
--- CXF2005.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the multiplying operators for a decimal fixed point type
--- return values that are integral multiples of the small of the type.
--- Check the case where one operand is of the predefined type Integer.
---
--- TEST DESCRIPTION:
--- Two decimal fixed point types A and B are declared, one with a
--- Machine_Radix value of 2, and one with a value of 10. A variable of
--- each type is multiplied repeatedly by a series of different Integer
--- values. A cumulative result is kept and compared to an expected
--- final result. Similar checks are performed for division.
---
--- APPLICABILITY CRITERIA:
--- This test is only applicable for a compiler attempting validation
--- for the Information Systems Annex.
---
---
--- CHANGE HISTORY:
--- 28 Mar 96 SAIC Prerelease version for ACVC 2.1.
---
---!
-
-generic
- type Decimal_Fixed is delta <> digits <>;
-package CXF2005_0 is
-
- function Multiply (Operand : Decimal_Fixed;
- Interval : Integer) return Decimal_Fixed;
-
- function Divide (Operand : Decimal_Fixed;
- Interval : Integer) return Decimal_Fixed;
-
-end CXF2005_0;
-
-
- --==================================================================--
-
-
-package body CXF2005_0 is
-
- function Multiply (Operand : Decimal_Fixed;
- Interval : Integer) return Decimal_Fixed is
- begin
- return Operand * Interval; -- Fixed-Integer multiplication.
- end Multiply;
-
-
- function Divide (Operand : Decimal_Fixed;
- Interval : Integer) return Decimal_Fixed is
- begin
- return Operand / Interval; -- Fixed-Integer division.
- end Divide;
-
-end CXF2005_0;
-
-
- --==================================================================--
-
-
-package CXF2005_1 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Interest_Rate is delta 0.001 range 0.0 .. 1_000.0;
- for Interest_Rate'Small use 0.001; -- Power of 10.
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Money_Radix2 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix2'Machine_Radix use 2; -- +999,999,999.99
-
- function Factor (Rate : Interest_Rate;
- Interval : Integer) return Money_Radix2;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Money_Radix10 is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money_Radix10'Machine_Radix use 10; -- +999,999,999.99
-
- function Factor (Rate : Interest_Rate;
- Interval : Integer) return Money_Radix10;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2005_1;
-
-
- --==================================================================--
-
-
-package body CXF2005_1 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Factor (Rate : Interest_Rate;
- Interval : Integer) return Money_Radix2 is
- begin
- return Money_Radix2( Rate / Interval );
- end Factor;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Factor (Rate : Interest_Rate;
- Interval : Integer) return Money_Radix10 is
- begin
- return Money_Radix10( Rate / Interval );
- end Factor;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2005_1;
-
-
- --==================================================================--
-
-
-with CXF2005_0;
-with CXF2005_1;
-
-with Report;
-procedure CXF2005 is
-
- Loop_Count : constant := 25_000;
- type Loop_Range is range 1 .. Loop_Count;
-
-begin
-
- Report.Test ("CXF2005", "Check decimal multiplication and division, " &
- "where one operand type is Integer");
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_2_SUBTESTS:
- declare
- package Radix_2 is new CXF2005_0 (CXF2005_1.Money_Radix2);
- use type CXF2005_1.Money_Radix2;
- begin
-
- RADIX_2_MULTIPLICATION:
- declare
- Rate : constant CXF2005_1.Interest_Rate := 0.127;
- Period : constant Integer := 12;
-
- Expected : constant CXF2005_1.Money_Radix2 := 2_624.88;
- Balance : CXF2005_1.Money_Radix2 := 1_000.00;
-
- Operand : CXF2005_1.Money_Radix2;
- Increment : CXF2005_1.Money_Radix2;
- Interval : Integer;
- begin
-
- for I in Loop_Range loop
- Interval := (Integer(I) mod Period) + 1; -- Range from 1 to 12.
- Operand := CXF2005_1.Factor (Rate, Period);
- Increment := Radix_2.Multiply (Operand, Interval);
- Balance := Balance + Increment;
- end loop;
-
- if Balance /= Expected then
- Report.Failed ("Error: Radix 2 multiply");
- end if;
-
- end RADIX_2_MULTIPLICATION;
-
-
-
- RADIX_2_DIVISION:
- declare
- Rate : constant CXF2005_1.Interest_Rate := 0.377;
- Period : constant Integer := 12;
-
- Expected : constant CXF2005_1.Money_Radix2 := 36_215.58;
- Balance : CXF2005_1.Money_Radix2 := 456_985.01;
-
- Operand : CXF2005_1.Money_Radix2;
- Increment : CXF2005_1.Money_Radix2;
- Interval : Integer;
- begin
-
- for I in Loop_Range loop
- Interval := (Integer(I+1000) mod (200*Period)) + 1; -- 1 .. 2400.
- Operand := CXF2005_1.Factor (Rate, Period);
- Increment := Radix_2.Divide (Balance, Interval);
- Balance := Balance - (Operand * Increment);
- end loop;
-
- if Balance /= Expected then
- Report.Failed ("Error: Radix 2 divide");
- end if;
-
- end RADIX_2_DIVISION;
-
- end RADIX_2_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- RADIX_10_SUBTESTS:
- declare
- package Radix_10 is new CXF2005_0 (CXF2005_1.Money_Radix10);
- use type CXF2005_1.Money_Radix10;
- begin
-
- RADIX_10_MULTIPLICATION:
- declare
- Rate : constant CXF2005_1.Interest_Rate := 0.721;
- Period : constant Integer := 12;
-
- Expected : constant CXF2005_1.Money_Radix10 := 9_875.62;
- Balance : CXF2005_1.Money_Radix10 := 126.34;
-
- Operand : CXF2005_1.Money_Radix10;
- Increment : CXF2005_1.Money_Radix10;
- Interval : Integer;
- begin
-
- for I in Loop_Range loop
- Interval := (Integer(I) mod Period) + 1; -- Range from 1 to 12.
- Operand := CXF2005_1.Factor (Rate, Period);
- Increment := Radix_10.Multiply (Operand, Interval);
- Balance := Balance + Increment;
- end loop;
-
- if Balance /= Expected then
- Report.Failed ("Error: Radix 10 multiply");
- end if;
-
- end RADIX_10_MULTIPLICATION;
-
-
- RADIX_10_DIVISION:
- declare
- Rate : constant CXF2005_1.Interest_Rate := 0.547;
- Period : constant Integer := 12;
-
- Expected : constant CXF2005_1.Money_Radix10 := 26_116.37;
- Balance : CXF2005_1.Money_Radix10 := 770_082.46;
-
- Operand : CXF2005_1.Money_Radix10;
- Increment : CXF2005_1.Money_Radix10;
- Interval : Integer;
- begin
-
- for I in Loop_Range loop
- Interval := (Integer(I+1000) mod (200*Period)) + 1; -- 1 .. 2400.
- Operand := CXF2005_1.Factor (Rate, Period);
- Increment := Radix_10.Divide (Balance, Interval);
- Balance := Balance - (Operand * Increment);
- end loop;
-
- if Balance /= Expected then
- Report.Failed ("Error: Radix 10 divide");
- end if;
-
- end RADIX_10_DIVISION;
-
- end RADIX_10_SUBTESTS;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Report.Result;
-
-end CXF2005;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf2a01.a b/gcc/testsuite/ada/acats/tests/cxf/cxf2a01.a
deleted file mode 100644
index 002c59d6c8e..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf2a01.a
+++ /dev/null
@@ -1,448 +0,0 @@
--- CXF2A01.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the binary adding operators for a decimal fixed point type
--- return values that are integral multiples of the small of the type.
---
--- TEST DESCRIPTION:
--- The test verifies that decimal addition and subtraction behave as
--- expected for types with various digits, delta, and Machine_Radix
--- values. Types with the minimum values for Decimal.Max_Digits and
--- Decimal.Max_Scale (18) are included.
---
--- Two kinds of checks are performed for each type. In the first check,
--- the iteration, operation, and operand counts in the foundation and
--- the operation tables in this test are given values such that, when the
--- operations loop is complete, each operand will have been added to and
--- subtracted from the loop's cumulator variable the same number of times,
--- albeit in varying order. Thus, the result returned by the operations
--- loop should have the same value as that used to initialize the
--- cumulator (in this test, zero).
---
--- In the second check, the same operation (addition for some types and
--- subtraction for others) is performed during each loop iteration,
--- resulting in a cumulative total which is checked against an expected
--- value.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF2A00.A
--- -> CXF2A01.A
---
--- APPLICABILITY CRITERIA:
--- This test is only applicable for a compiler attempting validation
--- for the Information Systems Annex.
---
---
--- CHANGE HISTORY:
--- 08 Apr 96 SAIC Prerelease version for ACVC 2.1.
---
---!
-
-package CXF2A01_0 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Micro is delta 10.0**(-18) digits 18; -- range -0.999999999999999999 ..
- for Micro'Machine_Radix use 10; -- +0.999999999999999999
-
- function Add (Left, Right : Micro) return Micro;
- function Subtract (Left, Right : Micro) return Micro;
-
-
- type Micro_Optr_Ptr is access function (Left, Right : Micro) return Micro;
-
- Micro_Add : Micro_Optr_Ptr := Add'Access;
- Micro_Sub : Micro_Optr_Ptr := Subtract'Access;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Money is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Money'Machine_Radix use 2; -- +999,999,999.99
-
- function Add (Left, Right : Money) return Money;
- function Subtract (Left, Right : Money) return Money;
-
-
- type Money_Optr_Ptr is access function (Left, Right : Money) return Money;
-
- Money_Add : Money_Optr_Ptr := Add'Access;
- Money_Sub : Money_Optr_Ptr := Subtract'Access;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- -- Same as Money, but with Radix 10:
-
- type Cash is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Cash'Machine_Radix use 10; -- +999,999,999.99
-
- function Add (Left, Right : Cash) return Cash;
- function Subtract (Left, Right : Cash) return Cash;
-
-
- type Cash_Optr_Ptr is access function (Left, Right : Cash) return Cash;
-
- Cash_Add : Cash_Optr_Ptr := Add'Access;
- Cash_Sub : Cash_Optr_Ptr := Subtract'Access;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Broad is delta 10.0**(-9) digits 18; -- range -999,999,999.999999999 ..
- for Broad'Machine_Radix use 10; -- +999,999,999.999999999
-
- function Add (Left, Right : Broad) return Broad;
- function Subtract (Left, Right : Broad) return Broad;
-
-
- type Broad_Optr_Ptr is access function (Left, Right : Broad) return Broad;
-
- Broad_Add : Broad_Optr_Ptr := Add'Access;
- Broad_Sub : Broad_Optr_Ptr := Subtract'Access;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2A01_0;
-
-
- --==================================================================--
-
-
-package body CXF2A01_0 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Add (Left, Right : Micro) return Micro is
- begin
- return (Left + Right); -- Decimal fixed addition.
- end Add;
-
- function Subtract (Left, Right : Micro) return Micro is
- begin
- return (Left - Right); -- Decimal fixed subtraction.
- end Subtract;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Add (Left, Right : Money) return Money is
- begin
- return (Left + Right); -- Decimal fixed addition.
- end Add;
-
- function Subtract (Left, Right : Money) return Money is
- begin
- return (Left - Right); -- Decimal fixed subtraction.
- end Subtract;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Add (Left, Right : Cash) return Cash is
- begin
- return (Left + Right); -- Decimal fixed addition.
- end Add;
-
- function Subtract (Left, Right : Cash) return Cash is
- begin
- return (Left - Right); -- Decimal fixed subtraction.
- end Subtract;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Add (Left, Right : Broad) return Broad is
- begin
- return (Left + Right); -- Decimal fixed addition.
- end Add;
-
- function Subtract (Left, Right : Broad) return Broad is
- begin
- return (Left - Right); -- Decimal fixed subtraction.
- end Subtract;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2A01_0;
-
-
- --==================================================================--
-
-
-with FXF2A00;
-package CXF2A01_0.CXF2A01_1 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Micro_Ops is array (FXF2A00.Optr_Range) of Micro_Optr_Ptr;
- type Micro_Opnds is array (FXF2A00.Opnd_Range) of Micro;
-
- Micro_Optr_Table_Cancel : Micro_Ops := ( Micro_Add, Micro_Sub,
- Micro_Add, Micro_Sub,
- Micro_Add, Micro_Sub );
-
- Micro_Optr_Table_Cumul : Micro_Ops := ( others => Micro_Add );
-
- Micro_Opnd_Table_Cancel : Micro_Opnds := ( 0.001025000235111997,
- 0.000000000000000003,
- 0.724902903219925400,
- 0.000459228020000011,
- 0.049832104921096533 );
-
- Micro_Opnd_Table_Cumul : Micro_Opnds := ( 0.000002309540000000,
- 0.000000278060000000,
- 0.000000000000070000,
- 0.000010003000000000,
- 0.000000023090000000 );
-
- function Test_Micro_Ops is new FXF2A00.Operations_Loop
- (Decimal_Fixed => Micro,
- Operator_Ptr => Micro_Optr_Ptr,
- Operator_Table => Micro_Ops,
- Operand_Table => Micro_Opnds);
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Money_Ops is array (FXF2A00.Optr_Range) of Money_Optr_Ptr;
- type Money_Opnds is array (FXF2A00.Opnd_Range) of Money;
-
- Money_Optr_Table_Cancel : Money_Ops := ( Money_Add, Money_Add,
- Money_Sub, Money_Add,
- Money_Sub, Money_Sub );
-
- Money_Optr_Table_Cumul : Money_Ops := ( others => Money_Sub );
-
- Money_Opnd_Table_Cancel : Money_Opnds := ( 127.10,
- 5600.44,
- 0.05,
- 189662.78,
- 226900402.99 );
-
- Money_Opnd_Table_Cumul : Money_Opnds := ( 17.99,
- 500.41,
- 92.78,
- 0.38,
- 2942.99 );
-
- function Test_Money_Ops is new FXF2A00.Operations_Loop
- (Decimal_Fixed => Money,
- Operator_Ptr => Money_Optr_Ptr,
- Operator_Table => Money_Ops,
- Operand_Table => Money_Opnds);
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Cash_Ops is array (FXF2A00.Optr_Range) of Cash_Optr_Ptr;
- type Cash_Opnds is array (FXF2A00.Opnd_Range) of Cash;
-
- Cash_Optr_Table_Cancel : Cash_Ops := ( Cash_Add, Cash_Add,
- Cash_Sub, Cash_Add,
- Cash_Sub, Cash_Sub );
-
- Cash_Optr_Table_Cumul : Cash_Ops := ( others => Cash_Add );
-
- Cash_Opnd_Table_Cancel : Cash_Opnds := ( 127.10,
- 5600.44,
- 0.05,
- 189662.78,
- 226900402.99 );
-
- Cash_Opnd_Table_Cumul : Cash_Opnds := ( 3.33,
- 100056.14,
- 22.87,
- 3901.55,
- 111.21 );
-
- function Test_Cash_Ops is new FXF2A00.Operations_Loop
- (Decimal_Fixed => Cash,
- Operator_Ptr => Cash_Optr_Ptr,
- Operator_Table => Cash_Ops,
- Operand_Table => Cash_Opnds);
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Broad_Ops is array (FXF2A00.Optr_Range) of Broad_Optr_Ptr;
- type Broad_Opnds is array (FXF2A00.Opnd_Range) of Broad;
-
- Broad_Optr_Table_Cancel : Broad_Ops := ( Broad_Sub, Broad_Add,
- Broad_Add, Broad_Sub,
- Broad_Sub, Broad_Add );
-
- Broad_Optr_Table_Cumul : Broad_Ops := ( others => Broad_Sub );
-
- Broad_Opnd_Table_Cancel : Broad_Opnds := ( 1.000009092,
- 732919479.445022293,
- 89662.787000006,
- 660.101010133,
- 1121127.999905594 );
-
- Broad_Opnd_Table_Cumul : Broad_Opnds := ( 12.000450223,
- 479.430320780,
- 0.003492096,
- 8.112888400,
- 1002.994937800 );
-
- function Test_Broad_Ops is new FXF2A00.Operations_Loop
- (Decimal_Fixed => Broad,
- Operator_Ptr => Broad_Optr_Ptr,
- Operator_Table => Broad_Ops,
- Operand_Table => Broad_Opnds);
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2A01_0.CXF2A01_1;
-
-
- --==================================================================--
-
-
-with CXF2A01_0.CXF2A01_1;
-
-with Report;
-procedure CXF2A01 is
- package Data renames CXF2A01_0.CXF2A01_1;
-
- use type CXF2A01_0.Micro;
- use type CXF2A01_0.Money;
- use type CXF2A01_0.Cash;
- use type CXF2A01_0.Broad;
-
- Micro_Cancel_Expected : constant CXF2A01_0.Micro := 0.0;
- Money_Cancel_Expected : constant CXF2A01_0.Money := 0.0;
- Cash_Cancel_Expected : constant CXF2A01_0.Cash := 0.0;
- Broad_Cancel_Expected : constant CXF2A01_0.Broad := 0.0;
-
- Micro_Cumul_Expected : constant CXF2A01_0.Micro := 0.075682140420000000;
- Money_Cumul_Expected : constant CXF2A01_0.Money := -21327300.00;
- Cash_Cumul_Expected : constant CXF2A01_0.Cash := 624570600.00;
- Broad_Cumul_Expected : constant CXF2A01_0.Broad := -9015252.535794000;
-
- Micro_Actual : CXF2A01_0.Micro;
- Money_Actual : CXF2A01_0.Money;
- Cash_Actual : CXF2A01_0.Cash;
- Broad_Actual : CXF2A01_0.Broad;
-begin
-
- Report.Test ("CXF2A01", "Check decimal addition and subtraction");
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Micro_Actual := Data.Test_Micro_Ops (0.0,
- Data.Micro_Optr_Table_Cancel,
- Data.Micro_Opnd_Table_Cancel);
-
- if Micro_Actual /= Micro_Cancel_Expected then
- Report.Failed ("Wrong cancellation result for type Micro");
- end if;
-
- ---=---=---=---=---=---=---
-
-
- Micro_Actual := Data.Test_Micro_Ops (0.0,
- Data.Micro_Optr_Table_Cumul,
- Data.Micro_Opnd_Table_Cumul);
-
- if Micro_Actual /= Micro_Cumul_Expected then
- Report.Failed ("Wrong cumulation result for type Micro");
- end if;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Money_Actual := Data.Test_Money_Ops (0.0,
- Data.Money_Optr_Table_Cancel,
- Data.Money_Opnd_Table_Cancel);
-
- if Money_Actual /= Money_Cancel_Expected then
- Report.Failed ("Wrong cancellation result for type Money");
- end if;
-
- ---=---=---=---=---=---=---
-
-
- Money_Actual := Data.Test_Money_Ops (0.0,
- Data.Money_Optr_Table_Cumul,
- Data.Money_Opnd_Table_Cumul);
-
- if Money_Actual /= Money_Cumul_Expected then
- Report.Failed ("Wrong cumulation result for type Money");
- end if;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Cash_Actual := Data.Test_Cash_Ops (0.0,
- Data.Cash_Optr_Table_Cancel,
- Data.Cash_Opnd_Table_Cancel);
-
- if Cash_Actual /= Cash_Cancel_Expected then
- Report.Failed ("Wrong cancellation result for type Cash");
- end if;
-
-
- ---=---=---=---=---=---=---
-
-
- Cash_Actual := Data.Test_Cash_Ops (0.0,
- Data.Cash_Optr_Table_Cumul,
- Data.Cash_Opnd_Table_Cumul);
-
- if Cash_Actual /= Cash_Cumul_Expected then
- Report.Failed ("Wrong cumulation result for type Cash");
- end if;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Broad_Actual := Data.Test_Broad_Ops (0.0,
- Data.Broad_Optr_Table_Cancel,
- Data.Broad_Opnd_Table_Cancel);
-
- if Broad_Actual /= Broad_Cancel_Expected then
- Report.Failed ("Wrong cancellation result for type Broad");
- end if;
-
-
- ---=---=---=---=---=---=---
-
-
- Broad_Actual := Data.Test_Broad_Ops (0.0,
- Data.Broad_Optr_Table_Cumul,
- Data.Broad_Opnd_Table_Cumul);
-
- if Broad_Actual /= Broad_Cumul_Expected then
- Report.Failed ("Wrong cumulation result for type Broad");
- end if;
-
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-
- Report.Result;
-
-end CXF2A01;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf2a02.a b/gcc/testsuite/ada/acats/tests/cxf/cxf2a02.a
deleted file mode 100644
index e9977b0f502..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf2a02.a
+++ /dev/null
@@ -1,354 +0,0 @@
--- CXF2A02.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the multiplying operators for a decimal fixed point type
--- return values that are integral multiples of the small of the type.
--- Check the case where the operand and result types are the same.
---
--- Check that if the mathematical result is between multiples of the
--- small of the result type, the result is truncated toward zero.
---
--- TEST DESCRIPTION:
--- The test verifies that decimal multiplication and division behave as
--- expected for types with various digits, delta, and Machine_Radix
--- values.
---
--- The iteration, operation, and operand counts in the foundation, and
--- the operations and operand tables in the test, are given values such
--- that, when the operations loop is complete, truncation of inexact
--- results should cause the result returned by the operations loop to be
--- the same as that used to initialize the loop's cumulator variable (in
--- this test, one).
---
--- TEST FILES:
--- This test consists of the following files:
---
--- FXF2A00.A
--- -> CXF2A02.A
---
--- APPLICABILITY CRITERIA:
--- This test is only applicable for a compiler attempting validation
--- for the Information Systems Annex.
---
---
--- CHANGE HISTORY:
--- 13 Mar 96 SAIC Prerelease version for ACVC 2.1.
--- 04 Aug 96 SAIC Updated prologue.
---
---!
-
-package CXF2A02_0 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Micro is delta 10.0**(-5) digits 6; -- range -9.99999 ..
- for Micro'Machine_Radix use 2; -- +9.99999
-
- function Multiply (Left, Right : Micro) return Micro;
- function Divide (Left, Right : Micro) return Micro;
-
-
- type Micro_Optr_Ptr is access function (Left, Right : Micro) return Micro;
-
- Micro_Mult : Micro_Optr_Ptr := Multiply'Access;
- Micro_Div : Micro_Optr_Ptr := Divide'Access;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Basic is delta 0.01 digits 11; -- range -999,999,999.99 ..
- for Basic'Machine_Radix use 10; -- +999,999,999.99
-
- function Multiply (Left, Right : Basic) return Basic;
- function Divide (Left, Right : Basic) return Basic;
-
-
- type Basic_Optr_Ptr is access function (Left, Right : Basic) return Basic;
-
- Basic_Mult : Basic_Optr_Ptr := Multiply'Access;
- Basic_Div : Basic_Optr_Ptr := Divide'Access;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Broad is delta 10.0**(-3) digits 10; -- range -9,999,999.999 ..
- for Broad'Machine_Radix use 2; -- +9,999,999.999
-
- function Multiply (Left, Right : Broad) return Broad;
- function Divide (Left, Right : Broad) return Broad;
-
-
- type Broad_Optr_Ptr is access function (Left, Right : Broad) return Broad;
-
- Broad_Mult : Broad_Optr_Ptr := Multiply'Access;
- Broad_Div : Broad_Optr_Ptr := Divide'Access;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2A02_0;
-
-
- --==================================================================--
-
-
-package body CXF2A02_0 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Multiply (Left, Right : Micro) return Micro is
- begin
- return (Left * Right); -- Decimal fixed multiplication.
- end Multiply;
-
- function Divide (Left, Right : Micro) return Micro is
- begin
- return (Left / Right); -- Decimal fixed division.
- end Divide;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Multiply (Left, Right : Basic) return Basic is
- begin
- return (Left * Right); -- Decimal fixed multiplication.
- end Multiply;
-
- function Divide (Left, Right : Basic) return Basic is
- begin
- return (Left / Right); -- Decimal fixed division.
- end Divide;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- function Multiply (Left, Right : Broad) return Broad is
- begin
- return (Left * Right); -- Decimal fixed multiplication.
- end Multiply;
-
- function Divide (Left, Right : Broad) return Broad is
- begin
- return (Left / Right); -- Decimal fixed division.
- end Divide;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2A02_0;
-
-
- --==================================================================--
-
-
-with FXF2A00;
-package CXF2A02_0.CXF2A02_1 is
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Micro_Ops is array (FXF2A00.Optr_Range) of Micro_Optr_Ptr;
- type Micro_Opnds is array (FXF2A00.Opnd_Range) of Micro;
-
- Micro_Mult_Operator_Table : Micro_Ops := ( Micro_Mult, Micro_Mult,
- Micro_Mult, Micro_Mult,
- Micro_Mult, Micro_Mult );
-
- Micro_Div_Operator_Table : Micro_Ops := ( Micro_Div, Micro_Div,
- Micro_Div, Micro_Div,
- Micro_Div, Micro_Div );
-
- Micro_Mult_Operand_Table : Micro_Opnds := ( 2.35119,
- 0.05892,
- 9.58122,
- 0.80613,
- 0.93462 );
-
- Micro_Div_Operand_Table : Micro_Opnds := ( 0.58739,
- 4.90012,
- 0.08765,
- 0.71577,
- 5.53768 );
-
- function Test_Micro_Ops is new FXF2A00.Operations_Loop
- (Decimal_Fixed => Micro,
- Operator_Ptr => Micro_Optr_Ptr,
- Operator_Table => Micro_Ops,
- Operand_Table => Micro_Opnds);
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Basic_Ops is array (FXF2A00.Optr_Range) of Basic_Optr_Ptr;
- type Basic_Opnds is array (FXF2A00.Opnd_Range) of Basic;
-
- Basic_Mult_Operator_Table : Basic_Ops := ( Basic_Mult, Basic_Mult,
- Basic_Mult, Basic_Mult,
- Basic_Mult, Basic_Mult );
-
- Basic_Div_Operator_Table : Basic_Ops := ( Basic_Div, Basic_Div,
- Basic_Div, Basic_Div,
- Basic_Div, Basic_Div );
-
- Basic_Mult_Operand_Table : Basic_Opnds := ( 127.10,
- 0.02,
- 0.87,
- 45.67,
- 0.01 );
-
- Basic_Div_Operand_Table : Basic_Opnds := ( 0.03,
- 0.08,
- 23.57,
- 0.11,
- 159.11 );
-
- function Test_Basic_Ops is new FXF2A00.Operations_Loop
- (Decimal_Fixed => Basic,
- Operator_Ptr => Basic_Optr_Ptr,
- Operator_Table => Basic_Ops,
- Operand_Table => Basic_Opnds);
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- type Broad_Ops is array (FXF2A00.Optr_Range) of Broad_Optr_Ptr;
- type Broad_Opnds is array (FXF2A00.Opnd_Range) of Broad;
-
- Broad_Mult_Operator_Table : Broad_Ops := ( Broad_Mult, Broad_Mult,
- Broad_Mult, Broad_Mult,
- Broad_Mult, Broad_Mult );
-
- Broad_Div_Operator_Table : Broad_Ops := ( Broad_Div, Broad_Div,
- Broad_Div, Broad_Div,
- Broad_Div, Broad_Div );
-
- Broad_Mult_Operand_Table : Broad_Opnds := ( 589.720,
- 0.106,
- 21.018,
- 0.002,
- 0.381 );
-
- Broad_Div_Operand_Table : Broad_Opnds := ( 0.008,
- 0.793,
- 9.092,
- 214.300,
- 0.080 );
-
- function Test_Broad_Ops is new FXF2A00.Operations_Loop
- (Decimal_Fixed => Broad,
- Operator_Ptr => Broad_Optr_Ptr,
- Operator_Table => Broad_Ops,
- Operand_Table => Broad_Opnds);
-
- ---=---=---=---=---=---=---=---=---=---=---
-
-end CXF2A02_0.CXF2A02_1;
-
-
- --==================================================================--
-
-
-with CXF2A02_0.CXF2A02_1;
-
-with Report;
-procedure CXF2A02 is
- package Data renames CXF2A02_0.CXF2A02_1;
-
- use type CXF2A02_0.Micro;
- use type CXF2A02_0.Basic;
- use type CXF2A02_0.Broad;
-
- Micro_Expected : constant CXF2A02_0.Micro := 1.0;
- Basic_Expected : constant CXF2A02_0.Basic := 1.0;
- Broad_Expected : constant CXF2A02_0.Broad := 1.0;
-
- Micro_Actual : CXF2A02_0.Micro;
- Basic_Actual : CXF2A02_0.Basic;
- Broad_Actual : CXF2A02_0.Broad;
-begin
-
- Report.Test ("CXF2A02", "Check decimal multiplication and division, " &
- "where the operand and result types are the same");
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- Micro_Actual := 0.0;
- Micro_Actual := Data.Test_Micro_Ops (1.0,
- Data.Micro_Mult_Operator_Table,
- Data.Micro_Mult_Operand_Table);
-
- if Micro_Actual /= Micro_Expected then
- Report.Failed ("Wrong result for type Micro multiplication");
- end if;
-
-
- Micro_Actual := 0.0;
- Micro_Actual := Data.Test_Micro_Ops (1.0,
- Data.Micro_Div_Operator_Table,
- Data.Micro_Div_Operand_Table);
-
- if Micro_Actual /= Micro_Expected then
- Report.Failed ("Wrong result for type Micro division");
- end if;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- Basic_Actual := 0.0;
- Basic_Actual := Data.Test_Basic_Ops (1.0,
- Data.Basic_Mult_Operator_Table,
- Data.Basic_Mult_Operand_Table);
-
- if Basic_Actual /= Basic_Expected then
- Report.Failed ("Wrong result for type Basic multiplication");
- end if;
-
-
- Basic_Actual := 0.0;
- Basic_Actual := Data.Test_Basic_Ops (1.0,
- Data.Basic_Div_Operator_Table,
- Data.Basic_Div_Operand_Table);
-
- if Basic_Actual /= Basic_Expected then
- Report.Failed ("Wrong result for type Basic division");
- end if;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- Broad_Actual := 0.0;
- Broad_Actual := Data.Test_Broad_Ops (1.0,
- Data.Broad_Mult_Operator_Table,
- Data.Broad_Mult_Operand_Table);
-
- if Broad_Actual /= Broad_Expected then
- Report.Failed ("Wrong result for type Broad multiplication");
- end if;
-
-
- Broad_Actual := 0.0;
- Broad_Actual := Data.Test_Broad_Ops (1.0,
- Data.Broad_Div_Operator_Table,
- Data.Broad_Div_Operand_Table);
-
- if Broad_Actual /= Broad_Expected then
- Report.Failed ("Wrong result for type Broad division");
- end if;
-
- ---=---=---=---=---=---=---=---=---=---=---
-
- Report.Result;
-
-end CXF2A02;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3001.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3001.a
deleted file mode 100644
index 1b9abca153f..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3001.a
+++ /dev/null
@@ -1,192 +0,0 @@
--- CXF3001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the edited output string value returned by Function Image
--- is correct.
---
--- TEST DESCRIPTION:
--- This test is structured using tables of data, consisting of
--- numerical values, picture strings, and expected image
--- result strings.
---
--- Each picture string is checked for validity, and an invalid picture
--- string will cause immediate test failure on its first pass through
--- the evaluation loop. Inside the evaluation loop, each decimal data
--- item is combined with each of the picture strings as parameters to a
--- call to Image, and the result of each call is compared to an
--- expected edited output result string.
---
---
--- CHANGE HISTORY:
--- 24 Feb 95 SAIC Initial prerelease version.
--- 23 Jun 95 SAIC Corrected call to functions Valid and To_Picture.
--- 22 Aug 95 SAIC Test name changed to CXF3001 (from CXF3301) to
--- conform to naming conventions.
--- 24 Feb 97 CTA.PWB Corrected picture strings and expected results.
---!
-
-with Ada.Text_IO.Editing;
-with Report;
-
-procedure CXF3001 is
-begin
-
- Report.Test ("CXF3001", "Check that the string value returned by " &
- "Function Image is correct");
-
- Test_Block:
- declare
-
- use Ada.Text_IO;
-
- Number_Of_Decimal_Items : constant := 5;
- Number_Of_Picture_Strings : constant := 4;
- Number_Of_Expected_Results : constant := Number_Of_Decimal_Items *
- Number_Of_Picture_Strings;
-
- type String_Pointer_Type is access String;
-
- -- Define a decimal data type, and instantiate the Decimal_Output
- -- generic package for the data type.
-
- type Decimal_Data_Type is delta 0.01 digits 16;
- package Ed_Out is new Editing.Decimal_Output (Decimal_Data_Type);
-
- -- Define types for the arrays of data that will hold the decimal data
- -- values, picture strings, and expected edited output results.
-
- type Decimal_Data_Array_Type is
- array (Integer range <>) of Decimal_Data_Type;
-
- type Picture_String_Array_Type is
- array (Integer range <>) of String_Pointer_Type;
-
- type Edited_Output_Results_Array_Type is
- array (Integer range <>) of String_Pointer_Type;
-
- -- Define the data arrays for this test.
-
- Decimal_Data :
- Decimal_Data_Array_Type(1..Number_Of_Decimal_Items) :=
- ( 1 => 5678.90,
- 2 => -6789.01,
- 3 => 0.00,
- 4 => 0.20,
- 5 => 3.45
- );
-
- Picture_Strings :
- Picture_String_Array_Type(1..Number_Of_Picture_Strings) :=
- ( 1 => new String'("-$$_$$9.99"),
- 2 => new String'("-$$_$$$.$$"),
- 3 => new String'("-ZZZZ.ZZ"),
- 4 => new String'("-$$$_999.99")
- );
-
- Edited_Output :
- Edited_Output_Results_Array_Type(1..Number_Of_Expected_Results) :=
- ( 1 => new String'(" $5,678.90"),
- 2 => new String'(" $5,678.90"),
- 3 => new String'(" 5678.90"),
- 4 => new String'(" $5,678.90"),
-
- 5 => new String'("-$6,789.01"),
- 6 => new String'("-$6,789.01"),
- 7 => new String'("-6789.01"),
- 8 => new String'("- $6,789.01"),
-
- 9 => new String'(" $0.00"),
- 10 => new String'(" "),
- 11 => new String'(" "),
- 12 => new String'(" $ 000.00"),
-
- 13 => new String'(" $0.20"),
- 14 => new String'(" $.20"),
- 15 => new String'(" .20"),
- 16 => new String'(" $ 000.20"),
-
- 17 => new String'(" $3.45"),
- 18 => new String'(" $3.45"),
- 19 => new String'(" 3.45"),
- 20 => new String'(" $ 003.45")
- );
-
- TC_Picture : Editing.Picture;
- TC_Loop_Count : Natural := 0;
-
- begin
-
- -- Compare string result of Image with expected edited output string.
-
- Evaluate_Edited_Output:
- for i in 1..Number_Of_Decimal_Items loop
- for j in 1..Number_Of_Picture_Strings loop
-
- TC_Loop_Count := TC_Loop_Count + 1;
-
- -- Check on the validity of the picture strings prior to
- -- processing.
-
- if Editing.Valid(Picture_Strings(j).all) then
-
- -- Create the picture object from the picture string.
- TC_Picture := Editing.To_Picture(Picture_Strings(j).all);
-
- -- Compare actual edited output result of Function Image with
- -- the expected result.
-
- if Ed_Out.Image(Decimal_Data(i), TC_Picture) /=
- Edited_Output(TC_Loop_Count).all
- then
- Report.Failed("Incorrect result from Function Image, " &
- "when used with decimal data item # " &
- Integer'Image(i) &
- " and picture string # " &
- Integer'Image(j));
- end if;
-
- else
- Report.Failed("Picture String # " & Integer'Image(j) &
- "reported as being invalid");
- -- Immediate test failure if a string is invalid.
- exit Evaluate_Edited_Output;
- end if;
-
- end loop;
- end loop Evaluate_Edited_Output;
-
- exception
- when Editing.Picture_Error =>
- Report.Failed ("Picture_Error raised in Test_Block");
- when Layout_Error =>
- Report.Failed ("Layout_Error raised in Test_Block");
- when others =>
- Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3001;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3002.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3002.a
deleted file mode 100644
index 8444244ef5c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3002.a
+++ /dev/null
@@ -1,231 +0,0 @@
--- CXF3002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the functionality contained in package
--- Ada.Wide_Text_IO.Editing is available and produces correct results.
---
--- TEST DESCRIPTION:
--- This test is designed to validate the procedures and functions that
--- are found in package Ada.Wide_Text_IO.Editing, the "wide"
--- complementary package to Ada.Text_IO.Editing. The test is similar
--- to CXF3301, which tested a large portion of the Ada.Text_IO.Editing
--- package. Additional testing has been added here to cover the balance
--- of the Wide_Text_IO.Editing child package.
-
--- This test is structured using tables of data, consisting of
--- numerical values, picture strings, and expected image
--- result strings.
---
--- Each picture string is checked for validity, and an invalid picture
--- string will cause immediate test failure on its first pass through
--- the evaluation loop. Inside the evaluation loop, each decimal data
--- item is combined with each of the picture strings as parameters to a
--- call to Image, and the result of each call is compared to an
--- expected edited output result string.
---
--- Note: Each of the functions Valid, To_Picture, and Pic_String has
--- String (rather than Wide_String) as its parameter or result
--- subtype, since a picture String is not localizable.
---
---
--- CHANGE HISTORY:
--- 22 Jun 95 SAIC Initial prerelease version.
--- 22 Aug 95 SAIC Test name changed to CXF3002 (from CXF3401) to
--- conform with naming conventions.
--- 24 Feb 97 PWB.CTA Corrected picture strings and expected values.
---!
-
-with Ada.Wide_Text_IO.Editing;
-with Report;
-
-procedure CXF3002 is
-begin
-
- Report.Test ("CXF3002", "Check that the functionality contained " &
- "in package Ada.Wide_Text_IO.Editing is " &
- "available and produces correct results");
-
- Test_Block:
- declare
-
- use Ada.Wide_Text_IO;
-
- Number_Of_Decimal_Items : constant := 5;
- Number_Of_Picture_Strings : constant := 4;
- Number_Of_Expected_Results : constant := Number_Of_Decimal_Items *
- Number_Of_Picture_Strings;
-
- Def_Cur : constant Wide_String := "$";
- Def_Fill : constant Wide_Character := '*';
- Def_Sep : constant Wide_Character := Editing.Default_Separator;
- Def_Radix : constant Wide_Character := Editing.Default_Radix_Mark;
-
- type String_Pointer_Type is access String;
- type Wide_String_Pointer_Type is access Wide_String;
-
- -- Define a decimal data type, and instantiate the Decimal_Output
- -- generic package for the data type.
-
- type Decimal_Data_Type is delta 0.01 digits 16;
-
- package Wide_Ed_Out is
- new Editing.Decimal_Output(Num => Decimal_Data_Type,
- Default_Currency => Def_Cur,
- Default_Fill => Def_Fill,
- Default_Separator => Def_Sep,
- Default_Radix_Mark => Def_Radix);
-
- -- Define types for the arrays of data that will hold the decimal data
- -- values, picture strings, and expected edited output results.
-
- type Decimal_Data_Array_Type is
- array (Integer range <>) of Decimal_Data_Type;
-
- type Picture_String_Array_Type is
- array (Integer range <>) of String_Pointer_Type;
-
- type Edited_Output_Results_Array_Type is
- array (Integer range <>) of Wide_String_Pointer_Type;
-
- -- Define the data arrays for this test.
-
- Decimal_Data :
- Decimal_Data_Array_Type(1..Number_Of_Decimal_Items) :=
- ( 1 => 5678.90,
- 2 => -6789.01,
- 3 => 0.00,
- 4 => 0.20,
- 5 => 3.45
- );
-
- Picture_Strings :
- Picture_String_Array_Type(1..Number_Of_Picture_Strings) :=
- ( 1 => new String'("-$$_$$9.99"),
- 2 => new String'("-$$_$$$.$$"),
- 3 => new String'("-ZZZZ.ZZ"),
- 4 => new String'("-$$$_999.99")
- );
-
-
- Edited_Output :
- Edited_Output_Results_Array_Type(1..Number_Of_Expected_Results) :=
- ( 1 => new Wide_String'(" $5,678.90"),
- 2 => new Wide_String'(" $5,678.90"),
- 3 => new Wide_String'(" 5678.90"),
- 4 => new Wide_String'(" $5,678.90"),
-
- 5 => new Wide_String'("-$6,789.01"),
- 6 => new Wide_String'("-$6,789.01"),
- 7 => new Wide_String'("-6789.01"),
- 8 => new Wide_String'("- $6,789.01"),
-
- 9 => new Wide_String'(" $0.00"),
- 10 => new Wide_String'(" "),
- 11 => new Wide_String'(" "),
- 12 => new Wide_String'(" $ 000.00"),
-
- 13 => new Wide_String'(" $0.20"),
- 14 => new Wide_String'(" $.20"),
- 15 => new Wide_String'(" .20"),
- 16 => new Wide_String'(" $ 000.20"),
-
- 17 => new Wide_String'(" $3.45"),
- 18 => new Wide_String'(" $3.45"),
- 19 => new Wide_String'(" 3.45"),
- 20 => new Wide_String'(" $ 003.45")
- );
-
- TC_Picture : Editing.Picture;
- TC_Loop_Count : Natural := 0;
-
- begin
-
- -- Compare string result of Image with expected edited output wide
- -- string.
-
- Evaluate_Edited_Output:
- for i in 1..Number_Of_Decimal_Items loop
- for j in 1..Number_Of_Picture_Strings loop
-
- TC_Loop_Count := TC_Loop_Count + 1;
-
- -- Check on the validity of the picture strings prior to
- -- processing.
-
- if Editing.Valid(Picture_Strings(j).all) then
-
- -- Create the picture object from the picture string.
- TC_Picture := Editing.To_Picture(Picture_Strings(j).all);
-
- -- Check results of function Decimal_Output.Valid.
- if not Wide_Ed_Out.Valid(Decimal_Data(i), TC_Picture) then
- Report.Failed("Incorrect result from function Valid " &
- "when examining the picture string that " &
- "was produced from string " &
- Integer'Image(j) & " in conjunction with " &
- "decimal data item # " & Integer'Image(i));
- end if;
-
- -- Check results of function Editing.Pic_String.
- if Editing.Pic_String(TC_Picture) /= Picture_Strings(j).all then
- Report.Failed("Incorrect result from To_Picture/" &
- "Pic_String conversion for picture " &
- "string # " & Integer'Image(j));
- end if;
-
- -- Compare actual edited output result of Function Image with
- -- the expected result.
-
- if Wide_Ed_Out.Image(Decimal_Data(i), TC_Picture) /=
- Edited_Output(TC_Loop_Count).all
- then
- Report.Failed("Incorrect result from Function Image, " &
- "when used with decimal data item # " &
- Integer'Image(i) &
- " and picture string # " &
- Integer'Image(j));
- end if;
-
- else
- Report.Failed("Picture String # " & Integer'Image(j) &
- "reported as being invalid");
- end if;
-
- end loop;
- end loop Evaluate_Edited_Output;
-
- exception
- when Editing.Picture_Error =>
- Report.Failed ("Picture_Error raised in Test_Block");
- when Layout_Error =>
- Report.Failed ("Layout_Error raised in Test_Block");
- when others =>
- Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3002;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3003.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3003.a
deleted file mode 100644
index 7cfce618e7c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3003.a
+++ /dev/null
@@ -1,292 +0,0 @@
--- CXF3003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that statically identifiable picture strings can be used to
--- produce correctly formatted edited output.
---
--- TEST DESCRIPTION:
--- This test defines several picture strings that are statically
--- identifiable, (i.e., Pic : Picture := To_Picture("..."); ).
--- These picture strings are used in conjunction with decimal data
--- as parameters in calls to functions Valid and Image. These
--- functions are created by an instantiation of the generic package
--- Ada.Text_IO.Editing.Decimal_Output.
---
---
--- CHANGE HISTORY:
--- 04 Apr 96 SAIC Initial release for 2.1.
--- 13 Feb 97 PWB.CTA corrected incorrect picture strings.
---!
-
-with Report;
-with Ada.Text_IO.Editing;
-with Ada.Exceptions;
-
-procedure CXF3003 is
-begin
-
- Report.Test ("CXF3003", "Check that statically identifiable " &
- "picture strings can be used to produce " &
- "correctly formatted edited output");
-
- Test_Block:
- declare
-
- use Ada.Exceptions;
- use Ada.Text_IO.Editing;
-
- Def_Cur : constant String := "$";
- Def_Fill : constant Character := '*';
- Def_Sep : constant Character := Default_Separator;
- Def_Radix : constant Character :=
- Ada.Text_IO.Editing.Default_Radix_Mark;
-
- type Str_Ptr is access String;
- type Edited_Output_Array_Type is array (Integer range <>) of Str_Ptr;
-
- -- Define a decimal data type, and instantiate the Decimal_Output
- -- generic package for the data type.
-
- type Decimal_Data_Type is delta 0.01 digits 16;
-
- package Image_IO is
- new Decimal_Output(Num => Decimal_Data_Type,
- Default_Currency => Def_Cur,
- Default_Fill => '*',
- Default_Separator => Default_Separator,
- Default_Radix_Mark => Def_Radix);
-
-
- type Decimal_Data_Array_Type is
- array (Integer range <>) of Decimal_Data_Type;
-
- Decimal_Data : Decimal_Data_Array_Type(1..5) :=
- (1 => 1357.99,
- 2 => -9029.01,
- 3 => 0.00,
- 4 => 0.20,
- 5 => 3.45);
-
- -- Statically identifiable picture strings.
-
- Picture_1 : Picture := To_Picture("-$$_$$9.99");
- Picture_2 : Picture := To_Picture("-$$_$$$.$$");
- Picture_3 : Picture := To_Picture("-ZZZZ.ZZ");
- Picture_5 : Picture := To_Picture("-$$$_999.99");
- Picture_6 : Picture := To_Picture("-###**_***_**9.99");
- Picture_7 : Picture := To_Picture("-$**_***_**9.99");
- Picture_8 : Picture := To_Picture("-$$$$$$.$$");
- Picture_9 : Picture := To_Picture("-$$$$$$.$$");
- Picture_10 : Picture := To_Picture("+BBBZZ_ZZZ_ZZZ.ZZ");
- Picture_11 : Picture := To_Picture("--_---_---_--9");
- Picture_12 : Picture := To_Picture("-$_$$$_$$$_$$9.99");
- Picture_14 : Picture := To_Picture("$_$$9.99");
- Picture_15 : Picture := To_Picture("$$9.99");
-
-
- Picture_1_Output : Edited_Output_Array_Type(1..5) :=
- ( 1 => new String'(" $1,357.99"),
- 2 => new String'("-$9,029.01"),
- 3 => new String'(" $0.00"),
- 4 => new String'(" $0.20"),
- 5 => new String'(" $3.45"));
-
- Picture_2_Output : Edited_Output_Array_Type(1..5) :=
- (1 => new String'(" $1,357.99"),
- 2 => new String'("-$9,029.01"),
- 3 => new String'(" "),
- 4 => new String'(" $.20"),
- 5 => new String'(" $3.45"));
-
- Picture_3_Output : Edited_Output_Array_Type(1..5) :=
- (1 => new String'(" 1357.99"),
- 2 => new String'("-9029.01"),
- 3 => new String'(" "),
- 4 => new String'(" .20"),
- 5 => new String'(" 3.45"));
-
- Picture_5_Output : Edited_Output_Array_Type(1..5) :=
- (1 => new String'(" $1,357.99"),
- 2 => new String'("- $9,029.01"),
- 3 => new String'(" $ 000.00"),
- 4 => new String'(" $ 000.20"),
- 5 => new String'(" $ 003.45"));
-
- begin
-
- -- Check the results of function Valid, using the first five decimal
- -- data items and picture strings.
-
- if not Image_IO.Valid(Decimal_Data(1), Picture_1) then
- Report.Failed("Picture string 1 not valid");
- elsif not Image_IO.Valid(Decimal_Data(2), Picture_2) then
- Report.Failed("Picture string 2 not valid");
- elsif not Image_IO.Valid(Decimal_Data(3), Picture_3) then
- Report.Failed("Picture string 3 not valid");
- elsif not Image_IO.Valid(Decimal_Data(5), Picture_5) then
- Report.Failed("Picture string 5 not valid");
- end if;
-
-
- -- Check the results of function Image, using the picture strings
- -- constructed above, with a variety of named vs. positional
- -- parameter notation and defaulted parameters.
-
- for i in 1..5 loop
- if Image_IO.Image(Item => Decimal_Data(i), Pic => Picture_1) /=
- Picture_1_Output(i).all
- then
- Report.Failed("Incorrect result from function Image with " &
- "decimal data item #" & Integer'Image(i) & ", " &
- "combined with Picture_1 picture string." &
- "Expected: " & Picture_1_Output(i).all & ", " &
- "Found: " &
- Image_IO.Image(Decimal_Data(i),Picture_1));
- end if;
-
- if Image_IO.Image(Decimal_Data(i), Pic => Picture_2) /=
- Picture_2_Output(i).all
- then
- Report.Failed("Incorrect result from function Image with " &
- "decimal data item #" & Integer'Image(i) & ", " &
- "combined with Picture_2 picture string." &
- "Expected: " & Picture_2_Output(i).all & ", " &
- "Found: " &
- Image_IO.Image(Decimal_Data(i),Picture_2));
- end if;
-
- if Image_IO.Image(Decimal_Data(i), Picture_3) /=
- Picture_3_Output(i).all
- then
- Report.Failed("Incorrect result from function Image with " &
- "decimal data item #" & Integer'Image(i) & ", " &
- "combined with Picture_3 picture string." &
- "Expected: " & Picture_3_Output(i).all & ", " &
- "Found: " &
- Image_IO.Image(Decimal_Data(i),Picture_3));
- end if;
-
- if Image_IO.Image(Decimal_Data(i), Picture_5) /=
- Picture_5_Output(i).all
- then
- Report.Failed("Incorrect result from function Image with " &
- "decimal data item #" & Integer'Image(i) & ", " &
- "combined with Picture_5 picture string." &
- "Expected: " & Picture_5_Output(i).all & ", " &
- "Found: " &
- Image_IO.Image(Decimal_Data(i),Picture_5));
- end if;
- end loop;
-
-
- if Image_IO.Image(Item => 123456.78,
- Pic => Picture_6,
- Currency => "$",
- Fill => Def_Fill,
- Separator => Def_Sep,
- Radix_Mark => Def_Radix) /= " $***123,456.78"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_6");
- end if;
-
- if Image_IO.Image(123456.78,
- Pic => Picture_7,
- Currency => Def_Cur,
- Fill => '*',
- Separator => Def_Sep,
- Radix_Mark => Def_Radix) /= " $***123,456.78"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_7");
- end if;
-
- if Image_IO.Image(0.0,
- Picture_8,
- Currency => "$",
- Fill => '*',
- Separator => Def_Sep,
- Radix_Mark => Def_Radix) /= " "
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_8");
- end if;
-
- if Image_IO.Image(0.20,
- Picture_9,
- Def_Cur,
- Fill => Def_Fill,
- Separator => Default_Separator,
- Radix_Mark => Default_Radix_Mark) /= " $.20"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_9");
- end if;
-
- if Image_IO.Image(123456.00,
- Picture_10,
- "$",
- '*',
- Separator => Def_Sep,
- Radix_Mark => Def_Radix) /= "+ 123,456.00"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_10");
- end if;
-
- if Image_IO.Image(-123456.78,
- Picture_11,
- Default_Currency,
- Default_Fill,
- Default_Separator,
- Radix_Mark => Def_Radix) /= " -123,457"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_11");
- end if;
-
- if Image_IO.Image(123456.78, Picture_12, "$", '*', ',', '.') /=
- " $123,456.78"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_12");
- end if;
-
- if Image_IO.Image(1.23,
- Picture_14,
- Currency => Def_Cur,
- Fill => Def_Fill) /= " $1.23"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_14");
- end if;
-
- if Image_IO.Image(12.34, Pic => Picture_15) /= "$12.34"
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_15");
- end if;
-
- exception
- when The_Error : others =>
- Report.Failed("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXF3003;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3004.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3004.a
deleted file mode 100644
index 146047bc824..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3004.a
+++ /dev/null
@@ -1,257 +0,0 @@
--- CXF3004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that statically identifiable picture strings can be used
--- in conjunction with function Image to produce output strings
--- appropriate to foreign currency representations.
---
--- Check that statically identifiable picture strings will cause
--- function Image to raise Layout_Error under the appropriate
--- conditions.
---
--- TEST DESCRIPTION:
--- This test defines several picture strings that are statically
--- identifiable, (i.e., Pic : Picture := To_Picture("..."); ).
--- These picture strings are used in conjunction with decimal data
--- as parameters in calls to function Image.
---
---
--- CHANGE HISTORY:
--- 11 Apr 96 SAIC Initial release for 2.1.
---
---!
-
-with Report;
-with Ada.Text_IO.Editing;
-with Ada.Exceptions;
-
-procedure CXF3004 is
-begin
-
- Report.Test ("CXF3004", "Check that statically identifiable " &
- "picture strings will cause function Image " &
- "to raise Layout_Error under appropriate " &
- "conditions");
-
- Test_Block:
- declare
-
- use Ada.Exceptions;
- use Ada.Text_IO.Editing;
-
- FF_Currency : constant String := "FF";
- DM_Currency : constant String := "DM";
- FF_Separator : constant Character := '.';
- DM_Separator : constant Character := ',';
- FF_Radix : constant Character := ',';
- DM_Radix : constant Character := '.';
- Blank_Fill : constant Character := ' ';
- Star_Fill : constant Character := '*';
-
-
- -- Define a decimal data type, and instantiate the Decimal_Output
- -- generic package for the data type.
-
- type Decimal_Data_Type is delta 0.01 digits 16;
-
- package Image_IO is
- new Decimal_Output(Num => Decimal_Data_Type,
- Default_Currency => "$",
- Default_Fill => Star_Fill,
- Default_Separator => Default_Separator,
- Default_Radix_Mark => DM_Radix);
-
-
-
- -- The following decimal data items are used with picture strings
- -- in evaluating use of foreign currency symbols.
-
- Dec_Data_1 : Decimal_Data_Type := 123456.78;
- Dec_Data_2 : Decimal_Data_Type := 32.10;
- Dec_Data_3 : Decimal_Data_Type := -1234.57;
- Dec_Data_4 : Decimal_Data_Type := 123456.78;
- Dec_Data_5 : Decimal_Data_Type := 12.34;
- Dec_Data_6 : Decimal_Data_Type := 12.34;
- Dec_Data_7 : Decimal_Data_Type := 12345.67;
-
-
- -- Statically identifiable picture strings.
- -- These strings are used in conjunction with non-default values
- -- for Currency string, Radix mark, and Separator in calls to
- -- function Image.
-
- Picture_1 : Picture := To_Picture("-###**_***_**9.99"); -- FF
- Picture_2 : Picture := To_Picture("###z_ZZ9.99"); -- FF
- Picture_3 : Picture := To_Picture("<<<<_<<<.<<###>"); -- DM
- Picture_4 : Picture := To_Picture("-$_$$$_$$$_$$9.99"); -- DM
- Picture_5 : Picture := To_Picture("$Zz9.99"); -- DM
- Picture_6 : Picture := To_Picture("$$$9.99"); -- DM
- Picture_7 : Picture := To_Picture("###_###_##9.99"); -- CHF
-
-
- -- The following ten edited output strings correspond to the ten
- -- foreign currency picture strings.
-
- Output_1 : constant String := " FF***123.456,78";
- Output_2 : constant String := " FF 32,10";
- Output_3 : constant String := " (1,234.57DM )";
- Output_4 : constant String := " DM123,456.78";
- Output_5 : constant String := "DM 12.34";
- Output_6 : constant String := " DM12.34";
- Output_7 : constant String := " CHF12,345.67";
-
-
- begin
-
- -- Check the results of function Image, using the picture strings
- -- constructed above, in creating foreign currency edited output
- -- strings.
-
- if Image_IO.Image(Item => Dec_Data_1,
- Pic => Picture_1,
- Currency => FF_Currency,
- Fill => Star_Fill,
- Separator => FF_Separator,
- Radix_Mark => FF_Radix) /= Output_1
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_1");
- end if;
-
- if Image_IO.Image(Item => Dec_Data_2,
- Pic => Picture_2,
- Currency => FF_Currency,
- Fill => Blank_Fill,
- Separator => FF_Separator,
- Radix_Mark => FF_Radix) /= Output_2
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_2");
- end if;
-
- if Image_IO.Image(Item => Dec_Data_3,
- Pic => Picture_3,
- Currency => DM_Currency,
- Fill => Blank_Fill,
- Separator => DM_Separator,
- Radix_Mark => DM_Radix) /= Output_3
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_3");
- end if;
-
- if Image_IO.Image(Item => Dec_Data_4,
- Pic => Picture_4,
- Currency => DM_Currency,
- Fill => Blank_Fill,
- Separator => DM_Separator,
- Radix_Mark => DM_Radix) /= Output_4
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_4");
- end if;
-
- if Image_IO.Image(Item => Dec_Data_5,
- Pic => Picture_5,
- Currency => DM_Currency,
- Fill => Blank_Fill,
- Separator => DM_Separator,
- Radix_Mark => DM_Radix) /= Output_5
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_5");
- end if;
-
- if Image_IO.Image(Item => Dec_Data_6,
- Pic => Picture_6,
- Currency => DM_Currency,
- Fill => Blank_Fill,
- Separator => DM_Separator,
- Radix_Mark => DM_Radix) /= Output_6
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_6");
- end if;
-
- if Image_IO.Image(Item => Dec_Data_7,
- Pic => Picture_7,
- Currency => "CHF",
- Fill => Blank_Fill,
- Separator => ',',
- Radix_Mark => '.') /= Output_7
- then
- Report.Failed("Incorrect result from Fn. Image using Picture_7");
- end if;
-
-
- -- The following calls of Function Image, using the specific
- -- decimal values and picture strings provided, will cause
- -- a Layout_Error to be raised.
- -- Note: The data and the picture strings used in the following
- -- evaluations are not themselves erroneous, but when used in
- -- combination will cause Layout_Error to be raised.
-
- Exception_Block_1 :
- declare
- Erroneous_Data_1 : Decimal_Data_Type := 12.34;
- Erroneous_Picture_1 : Picture := To_Picture("9.99");
- N : constant Natural := Image_IO.Length(Erroneous_Picture_1);
- TC_String : String(1..N);
- begin
- TC_String := Image_IO.Image(Erroneous_Data_1, Erroneous_Picture_1);
- Report.Failed("Layout_Error not raised by combination of " &
- "Erroneous_Picture_1 and Erroneous_Data_1");
- Report.Comment("Should never be printed: " & TC_String);
- exception
- when Ada.Text_IO.Layout_Error => null; -- OK, expected exception.
- when The_Error : others =>
- Report.Failed
- ("The following exception was incorrectly raised in " &
- "Exception_Block_1: " & Exception_Name(The_Error));
- end Exception_Block_1;
-
- Exception_Block_2 :
- declare
- Erroneous_Data_2 : Decimal_Data_Type := -12.34;
- Erroneous_Picture_2 : Picture := To_Picture("99.99");
- N : constant Natural := Image_IO.Length(Erroneous_Picture_2);
- TC_String : String(1..N);
- begin
- TC_String := Image_IO.Image(Erroneous_Data_2, Erroneous_Picture_2);
- Report.Failed("Layout_Error not raised by combination of " &
- "Erroneous_Picture_2 and Erroneous_Data_2");
- Report.Comment("Should never be printed: " & TC_String);
- exception
- when Ada.Text_IO.Layout_Error => null; -- OK, expected exception.
- when The_Error : others =>
- Report.Failed
- ("The following exception was incorrectly raised in " &
- "Exception_Block_2: " & Exception_Name(The_Error));
- end Exception_Block_2;
-
- exception
- when The_Error : others =>
- Report.Failed("The following exception was raised in the " &
- "Test_Block: " & Exception_Name(The_Error));
- end Test_Block;
-
- Report.Result;
-
-end CXF3004;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a01.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a01.a
deleted file mode 100644
index 202a6996e32..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a01.a
+++ /dev/null
@@ -1,167 +0,0 @@
--- CXF3A01.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the function Ada.Text_IO.Editing.Valid returns False if
--- a) Pic_String is not a well-formed Picture string, or
--- b) the length of Pic_String exceeds Max_Picture_Length, or
--- c) Blank_When_Zero is True and Pic_String contains '*';
--- Check that Valid otherwise returns True.
---
--- TEST DESCRIPTION:
--- This test validates the results of function Editing.Valid under a
--- variety of conditions. Both valid and invalid picture strings are
--- provided as input parameters to the function. The use of the
--- Blank_When_Zero parameter is evaluated with strings that contain the
--- zero suppression character '*'.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A01.A
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Report;
-
-procedure CXF3A01 is
-begin
-
- Report.Test ("CXF3A01", "Check that the Valid function from package " &
- "Ada.Text_IO.Editing returns False for strings " &
- "that fail to comply with the composition " &
- "constraints defined for picture strings. " &
- "Check that the Valid function returns True " &
- "for strings that conform to the composition " &
- "constraints defined for picture strings");
-
- Test_Block:
- declare
- use FXF3A00;
- use Ada.Text_IO;
- begin
-
- -- Use a series of picture strings that conform to the composition
- -- constraints to validate the Ada.Text_IO.Editing.Valid function.
- -- The result for each of these calls should be True.
- -- In all the following cases, the default value of the Blank_When_Zero
- -- parameter is used.
-
- for i in 1..FXF3A00.Number_Of_Valid_Strings loop
-
- if not Editing.Valid(Pic_String => FXF3A00.Valid_Strings(i).all)
- then
- Report.Failed("Incorrect result from Function Valid using " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end if;
-
- end loop;
-
-
- for i in 1..FXF3A00.Number_Of_Foreign_Strings loop
-
- if not Editing.Valid(Pic_String => FXF3A00.Foreign_Strings(i).all)
- then
- Report.Failed("Incorrect result from Function Valid using " &
- "Foreign_String = " &
- FXF3A00.Foreign_Strings(i).all);
- end if;
-
- end loop;
-
-
- -- Use a series of picture strings that violate one or more of the
- -- composition constraints to validate the Ada.Text_IO.Editing.Valid
- -- function. The result for each of these calls should be False.
- -- In all the following cases, the default value of the Blank_When_Zero
- -- parameter is used.
-
- for i in 1..FXF3A00.Number_Of_Invalid_Strings loop
-
- if Editing.Valid(Pic_String => FXF3A00.Invalid_Strings(i).all)
- then
- Report.Failed("Incorrect result from Function Valid using " &
- "Invalid_String = " &
- FXF3A00.Invalid_Strings(i).all);
- end if;
-
- end loop;
-
-
- -- In all the following cases, the default value of the Blank_When_Zero
- -- parameter is overridden with a True actual parameter value. Using
- -- valid picture strings that contain the '*' zero suppression character
- -- when this parameter value is True must result in a False result
- -- from function Valid. Valid picture strings that do not contain the
- -- '*' character should return a function result of True with True
- -- provided as the actual parameter to Blank_When_Zero.
-
- -- Check entries 1, 2, 25, 36 from the Valid_Strings array, all of
- -- which contain the '*' zero suppression character.
-
- if Editing.Valid(Valid_Strings(1).all, Blank_When_Zero => True) or
- Editing.Valid(Valid_Strings(2).all, Blank_When_Zero => True) or
- Editing.Valid(Valid_Strings(25).all, Blank_When_Zero => True) or
- Editing.Valid(Valid_Strings(36).all, Blank_When_Zero => True)
- then
- Report.Failed
- ("Incorrect result from Function Valid when setting " &
- "the value of the Blank_When_Zero parameter to True, " &
- "and using picture strings with the '*' character");
- end if;
-
-
- -- Check entries from the Valid_Strings array, none of
- -- which contain the '*' zero suppression character.
-
- for i in 3..24 loop
-
- if not Editing.Valid(Pic_String => Valid_Strings(i).all,
- Blank_When_Zero => True)
- then
- Report.Failed("Incorrect result from Function Valid when " &
- "setting the value of the Blank_When_Zero " &
- "parameter to True, and using picture strings " &
- "without the '*' character, Valid_String = " &
- FXF3A00.Valid_Strings(i).all);
- end if;
-
- end loop;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3A01;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a02.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a02.a
deleted file mode 100644
index 4231b56aa46..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a02.a
+++ /dev/null
@@ -1,267 +0,0 @@
--- CXF3A02.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the function Ada.Text_IO.Editing.To_Picture raises
--- Picture_Error if the picture string provided as input parameter does
--- not conform to the composition constraints defined for picture
--- strings.
--- Check that when Pic_String is applied to To_Picture, the result
--- is equivalent to the actual string parameter of To_Picture;
--- Check that when Blank_When_Zero is applied to To_Picture, the result
--- is the same value as the Blank_When_Zero parameter of To_Picture.
---
--- TEST DESCRIPTION:
--- This test validates that function Editing.To_Picture returns a
--- Picture result when provided a valid picture string, and raises a
--- Picture_Error exception when provided an invalid picture string
--- input parameter. In addition, the Picture result of To_Picture is
--- converted back to a picture string value using function Pic_String,
--- and the result of function Blank_When_Zero is validated based on the
--- value of parameter Blank_When_Zero used in the formation of the Picture
--- by function To_Picture.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A02.A
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 11 Mar 97 PWB.CTA Corrected invalid picture string and uppercase
--- problem.
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Ada.Strings.Maps;
-with Ada.Strings.Fixed;
-with Report;
-
-procedure CXF3A02 is
-
- Lower_Alpha : constant String := "abcdefghijklmnopqrstuvwxyz";
- Upper_Alpha : constant String := "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- function UpperCase ( Source : String ) return String is
- begin
- return
- Ada.Strings.Fixed.Translate
- ( Source => Source,
- Mapping => Ada.Strings.Maps.To_Mapping
- ( From => Lower_Alpha,
- To => Upper_Alpha ) );
- end UpperCase;
-
-begin
-
- Report.Test ("CXF3A02", "Check that the function " &
- "Ada.Text_IO.Editing.To_Picture raises " &
- "Picture_Error if the picture string provided " &
- "as input parameter does not conform to the " &
- "composition constraints defined for picture " &
- "strings");
-
- Test_Block:
- declare
-
- use Ada.Text_IO;
- use FXF3A00;
-
- TC_Picture : Editing.Picture;
- TC_Blank_When_Zero : Boolean;
-
- begin
-
-
- -- Validate that function To_Picture does not raise Picture_Error when
- -- provided a valid picture string as an input parameter.
-
- for i in 1..FXF3A00.Number_Of_Valid_Strings loop
- begin
- TC_Picture :=
- Editing.To_Picture(Pic_String => Valid_Strings(i).all,
- Blank_When_Zero => False );
- exception
- when Editing.Picture_Error =>
- Report.Failed
- ("Picture_Error raised by function To_Picture " &
- "with a valid picture string as input parameter, " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- when others =>
- Report.Failed("Unexpected exception raised - 1, " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end;
- end loop;
-
-
-
- -- Validate that function To_Picture raises Picture_Error when an
- -- invalid picture string is provided as an input parameter.
- -- Default value used for parameter Blank_When_Zero.
-
- for i in 1..FXF3A00.Number_Of_Invalid_Strings loop
- begin
- TC_Picture :=
- Editing.To_Picture(Pic_String => FXF3A00.Invalid_Strings(i).all);
- Report.Failed
- ("Picture_Error not raised by function To_Picture " &
- "with an invalid picture string as input parameter, " &
- "Invalid_String = " & FXF3A00.Invalid_Strings(i).all);
- exception
- when Editing.Picture_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Unexpected exception raised, " &
- "Invalid_String = " &
- FXF3A00.Invalid_Strings(i).all);
- end;
- end loop;
-
-
-
- -- Validate that To_Picture and Pic_String/Blank_When_Zero provide
- -- "inverse" results.
-
- -- Use the default value of the Blank_When_Zero parameter (False) for
- -- these evaluations (some valid strings have the '*' zero suppression
- -- character, which would result in an invalid string if used with a
- -- True value for the Blank_When_Zero parameter).
-
- for i in 1..FXF3A00.Number_Of_Valid_Strings loop
- begin
-
- -- Format a picture string using function To_Picture.
-
- TC_Picture := Editing.To_Picture(FXF3A00.Valid_Strings(i).all);
-
- -- Reconvert the Picture result from To_Picture to a string value
- -- using function Pic_String, and compare to the original string.
-
- if Editing.Pic_String(Pic => TC_Picture) /=
- Uppercase (FXF3A00.Valid_Strings(i).all)
- then
- Report.Failed
- ("Inverse result incorrect from Editing.Pic_String, " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end if;
-
- -- Ensure that function Blank_When_Zero returns the correct value
- -- of the Blank_When_Zero parameter used in forming the Picture
- -- (default parameter value False used in call to To_Picture
- -- above).
-
- if Editing.Blank_When_Zero(Pic => TC_Picture) then
- Report.Failed
- ("Inverse result incorrect from Editing.Blank_When_Zero, " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end if;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised - 2, " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end;
- end loop;
-
-
- -- Specifically check that any lower case letters in the original
- -- picture string have been converted to upper case form following
- -- the To_Picture/Pic_String conversion (as shown in previous loop).
-
- declare
- The_Picture : Editing.Picture;
- The_Picture_String : constant String := "+bBbZz_zZz_Zz9.99";
- The_Expected_Result : constant String := "+BBBZZ_ZZZ_ZZ9.99";
- begin
- -- Convert Picture String to Picture.
- The_Picture := Editing.To_Picture(Pic_String => The_Picture_String);
-
- declare
- -- Reconvert the Picture to a Picture String.
- The_Result : constant String := Editing.Pic_String(The_Picture);
- begin
- if The_Result /= The_Expected_Result then
- Report.Failed("Conversion to Picture/Reconversion to String " &
- "did not produce expected result when Picture " &
- "String had lower case letters");
- end if;
- end;
- end;
-
-
- -- Use a value of True for the Blank_When_Zero parameter for the
- -- following evaluations (picture strings that do not have the '*' zero
- -- suppression character, which would result in an invalid string when
- -- used here with a True value for the Blank_When_Zero parameter).
-
- for i in 3..24 loop
- begin
-
- -- Format a picture string using function To_Picture.
-
- TC_Picture :=
- Editing.To_Picture(Pic_String => Valid_Strings(i).all,
- Blank_When_Zero => True);
-
- -- Reconvert the Picture result from To_Picture to a string value
- -- using function Pic_String, and compare to the original string.
-
- if Editing.Pic_String(Pic => TC_Picture) /=
- UpperCase (FXF3A00.Valid_Strings(i).all)
- then
- Report.Failed
- ("Inverse result incorrect from Editing.Pic_String, used " &
- "on Picture formed with parameter Blank_When_Zero = True, " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end if;
-
- -- Ensure that function Blank_When_Zero returns the correct value
- -- of the Blank_When_Zero parameter used in forming the Picture
- -- (default parameter value False overridden in call to
- -- To_Picture above).
-
- if not Editing.Blank_When_Zero(Pic => TC_Picture) then
- Report.Failed
- ("Inverse result incorrect from Editing.Blank_When_Zero, " &
- "used on a Picture formed with parameter Blank_When_Zero " &
- "= True, Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end if;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised - 3, " &
- "Valid_String = " & FXF3A00.Valid_Strings(i).all);
- end;
- end loop;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3A02;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a03.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a03.a
deleted file mode 100644
index 86709601464..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a03.a
+++ /dev/null
@@ -1,429 +0,0 @@
--- CXF3A03.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that function Length in the generic package Decimal_Output
--- returns the number of characters in the edited output string
--- produced by function Image, for a particular decimal type,
--- currency string, and radix mark.
--- Check that function Valid in the generic package Decimal_Output
--- returns correct results based on the particular decimal value,
--- and the Picture and Currency string parameters.
---
--- TEST DESCRIPTION:
--- This test uses two instantiations of package Decimal_Output, one
--- for decimal data with delta 0.01, the other for decimal data with
--- delta 1.0. The functions Length and Valid found in this generic
--- package are evaluated for each instantiation.
--- Function Length is examined with picture and currency string input
--- parameters of different sizes.
--- Function Valid is examined with a decimal type data item, picture
--- object, and currency string, for cases that are both valid and
--- invalid (Layout_Error would result from the particular items as
--- input parameters to function Image).
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A03.A
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Report;
-
-procedure CXF3A03 is
-begin
-
- Report.Test ("CXF3A03", "Check that function Length returns the " &
- "number of characters in the edited output " &
- "string produced by function Image, for a " &
- "particular decimal type, currency string, " &
- "and radix mark. Check that function Valid " &
- "returns correct results based on the " &
- "particular decimal value, and the Picture " &
- "and Currency string parameters");
-
- Test_Block:
- declare
-
- use Ada.Text_IO;
- use FXF3A00;
-
- type Instantiation_Type is (NDP, TwoDP);
-
- -- Defaults used for all other generic parameters in these
- -- instantiations.
- package Pack_NDP is new Editing.Decimal_Output (Decimal_Type_NDP);
- package Pack_2DP is new Editing.Decimal_Output (Decimal_Type_2DP);
-
- TC_Lower_Bound,
- TC_Higher_Bound : Integer := 0;
-
- TC_Picture : Editing.Picture;
- TC_US_String : constant String := "$";
- TC_FF_String : constant String := "FF";
- TC_DM_String : constant String := "DM";
- TC_CHF_String : constant String := "CHF";
-
-
- function Dollar_Sign_Present (Str : String) return Boolean is
- begin
- for i in 1..Str'Length loop
- if Str(i) = '$' then
- return True;
- end if;
- end loop;
- return False;
- end Dollar_Sign_Present;
-
- function V_Present (Str : String) return Boolean is
- begin
- for i in 1..Str'Length loop
- if Str(i) = 'V' or Str(i) = 'v' then
- return True;
- end if;
- end loop;
- return False;
- end V_Present;
-
-
- function Accurate_Length (Pict_Str : String;
- Inst : Instantiation_Type;
- Currency_String : String)
- return Boolean is
-
- TC_Length : Natural := 0;
- TC_Currency_Length_Adjustment : Natural := 0;
- TC_Radix_Adjustment : Natural := 0;
- begin
-
- -- Create the picture object from the picture string.
- TC_Picture := Editing.To_Picture(Pict_Str);
-
- -- Calculate the currency length adjustment.
- if Dollar_Sign_Present (Editing.Pic_String(TC_Picture)) then
- TC_Currency_Length_Adjustment := Currency_String'Length - 1;
- end if;
-
- -- Calculate the Radix adjustment.
- if V_Present (Editing.Pic_String(TC_Picture)) then
- TC_Radix_Adjustment := 1;
- end if;
-
- -- Calculate the length, using the version of Length that comes
- -- from the appropriate instantiation of Decimal_Output, based
- -- on the decimal type used in the instantiation.
- if Inst = NDP then
- TC_Length := Pack_NDP.Length(TC_Picture,
- Currency_String);
- else
- TC_Length := Pack_2DP.Length(TC_Picture,
- Currency_String);
- end if;
-
- return TC_Length = Editing.Pic_String(TC_Picture)'Length +
- TC_Currency_Length_Adjustment -
- TC_Radix_Adjustment;
- end Accurate_Length;
-
-
- begin
-
- Length_Block:
- begin
-
- -- The first 10 picture strings in the Valid_Strings array correspond
- -- to data values of a decimal type with delta 0.01.
- -- Note: The appropriate instantiation of the Decimal_Output package
- -- (and therefore function Length) is used by function
- -- Accurate_Length to calculate length.
-
- for i in 1..10 loop
- if not Accurate_Length (FXF3A00.Valid_Strings(i).all,
- TwoDP,
- TC_US_String)
- then
- Report.Failed("Incorrect result from function Length, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " & TC_US_String &
- " in evaluating picture string " &
- FXF3A00.Valid_Strings(i).all );
- end if;
- end loop;
-
-
- -- Picture strings 17-20 in the Valid_Strings array correspond
- -- to data values of a decimal type with delta 1.0. Again, the
- -- instantiation of Decimal_Output used is based on this particular
- -- decimal type.
-
- for i in 17..20 loop
- if not Accurate_Length (FXF3A00.Valid_Strings(i).all,
- NDP,
- TC_US_String)
- then
- Report.Failed("Incorrect result from function Length, " &
- "when used with a decimal type with delta 1.0 " &
- "and with the currency string " & TC_US_String &
- " in evaluating picture string " &
- FXF3A00.Valid_Strings(i).all );
- end if;
- end loop;
-
-
- -- The first 4 picture strings in the Foreign_Strings array
- -- correspond to data values of a decimal type with delta 0.01,
- -- and to the currency string "FF" (two characters).
-
- for i in 1..FXF3A00.Number_of_FF_Strings loop
- if not Accurate_Length (FXF3A00.Foreign_Strings(i).all,
- TwoDP,
- TC_FF_String)
- then
- Report.Failed("Incorrect result from function Length, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " & TC_FF_String &
- " in evaluating picture string " &
- FXF3A00.Foreign_Strings(i).all );
- end if;
- end loop;
-
-
- -- Picture strings 5-9 in the Foreign_Strings array correspond
- -- to data values of a decimal type with delta 0.01, and to the
- -- currency string "DM" (two characters).
-
- TC_Lower_Bound := FXF3A00.Number_of_FF_Strings + 1;
- TC_Higher_Bound := FXF3A00.Number_of_FF_Strings +
- FXF3A00.Number_of_DM_Strings;
-
- for i in TC_Lower_Bound..TC_Higher_Bound loop
- if not Accurate_Length (FXF3A00.Foreign_Strings(i).all,
- TwoDP,
- TC_DM_String)
- then
- Report.Failed("Incorrect result from function Length, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " & TC_DM_String &
- " in evaluating picture string " &
- FXF3A00.Foreign_Strings(i).all );
- end if;
- end loop;
-
-
- -- Picture string #10 in the Foreign_Strings array corresponds
- -- to a data value of a decimal type with delta 0.01, and to the
- -- currency string "CHF" (three characters).
-
- if not Accurate_Length (FXF3A00.Foreign_Strings(10).all,
- TwoDP,
- TC_CHF_String)
- then
- Report.Failed("Incorrect result from function Length, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " &
- TC_CHF_String);
- end if;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised in Length_Block");
- end Length_Block;
-
-
- Valid_Block:
- declare
-
- -- This offset value is used to align picture string and decimal
- -- data values from package FXF3A00 for proper correspondence for
- -- the evaluations below.
-
- TC_Offset : constant Natural := 10;
-
- begin
-
- -- The following four For Loops examine cases where the
- -- decimal data/picture string/currency combinations used will
- -- generate valid Edited Output strings. These combinations, when
- -- provided to the Function Valid (from instantiations of
- -- Decimal_Output), should result in a return result of True.
- -- The particular instantiated version of Valid used in these loops
- -- is that for decimal data with delta 0.01.
-
- -- The first 4 picture strings in the Foreign_Strings array
- -- correspond to data values of a decimal type with delta 0.01,
- -- and to the currency string "FF" (two characters).
-
- for i in 1..FXF3A00.Number_of_FF_Strings loop
- -- Create the picture object from the picture string.
- TC_Picture := Editing.To_Picture(FXF3A00.Foreign_Strings(i).all);
-
- if not Pack_2DP.Valid (FXF3A00.Data_With_2DP(TC_Offset + i),
- TC_Picture,
- TC_FF_String)
- then
- Report.Failed("Incorrect result from function Valid, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " & TC_FF_String &
- " in evaluating picture string " &
- FXF3A00.Foreign_Strings(i).all );
- end if;
- end loop;
-
-
- -- Picture strings 5-9 in the Foreign_Strings array correspond
- -- to data values of a decimal type with delta 0.01, and to the
- -- currency string "DM" (two characters).
-
- TC_Lower_Bound := FXF3A00.Number_of_FF_Strings + 1;
- TC_Higher_Bound := FXF3A00.Number_of_FF_Strings +
- FXF3A00.Number_of_DM_Strings;
-
- for i in TC_Lower_Bound..TC_Higher_Bound loop
- -- Create the picture object from the picture string.
- TC_Picture := Editing.To_Picture(FXF3A00.Foreign_Strings(i).all);
-
- if not Pack_2DP.Valid (FXF3A00.Data_With_2DP(TC_Offset + i),
- TC_Picture,
- TC_DM_String)
- then
- Report.Failed("Incorrect result from function Valid, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " & TC_DM_String &
- " in evaluating picture string " &
- FXF3A00.Foreign_Strings(i).all );
- end if;
- end loop;
-
-
- -- Picture string #10 in the Foreign_Strings array corresponds
- -- to a data value of a decimal type with delta 0.01, and to the
- -- currency string "CHF" (three characters).
-
- -- Create the picture object from the picture string.
- TC_Picture := Editing.To_Picture(FXF3A00.Foreign_Strings(10).all);
-
- if not Pack_2DP.Valid (FXF3A00.Data_With_2DP(TC_Offset + 10),
- TC_Picture,
- TC_CHF_String)
- then
- Report.Failed("Incorrect result from function Valid, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " &
- TC_CHF_String);
- end if;
-
-
- -- The following For Loop examines cases where the
- -- decimal data/picture string/currency combinations used will
- -- generate valid Edited Output strings.
- -- The particular instantiated version of Valid used in this loop
- -- is that for decimal data with delta 1.0; the others above have
- -- been for decimal data with delta 0.01.
- -- Note: TC_Offset is used here to align picture strings from the
- -- FXF3A00.Valid_Strings table with the appropriate decimal
- -- data in the FXF3A00.Data_With_NDP table.
-
- for i in 1..FXF3A00.Number_Of_NDP_Items loop
- -- Create the picture object from the picture string.
- TC_Picture :=
- Editing.To_Picture(FXF3A00.Valid_Strings(TC_Offset + i).all);
-
- if not Pack_NDP.Valid (FXF3A00.Data_With_NDP(i),
- TC_Picture,
- TC_US_String)
- then
- Report.Failed("Incorrect result from function Valid, " &
- "when used with a decimal type with delta .01 " &
- "and with the currency string " & TC_US_String &
- " in evaluating picture string " &
- FXF3A00.Valid_Strings(i).all );
- end if;
- end loop;
-
-
- -- The following three evaluations of picture strings, used in
- -- conjunction with the specific decimal values provided, will cause
- -- Editing.Image to raise Layout_Error (to be examined in other
- -- tests). Function Valid should return a False result for these
- -- combinations.
- -- The first two evaluations use the instantiation of Decimal_Output
- -- with a decimal type with delta 0.01, while the last evaluation
- -- uses the instantiation with decimal type with delta 1.0.
-
- for i in 1..FXF3A00.Number_of_Erroneous_Conditions loop
-
- -- Create the picture object from the picture string.
- TC_Picture :=
- Editing.To_Picture(FXF3A00.Erroneous_Strings(i).all);
-
- if i < 3 then -- Choose the appropriate instantiation.
- if Pack_2DP.Valid(Item => FXF3A00.Erroneous_Data(i),
- Pic => TC_Picture,
- Currency => TC_US_String)
- then
- Report.Failed("Incorrect result from function Valid, " &
- "when used with a decimal type with delta " &
- "0.01 and with the currency string " &
- TC_US_String &
- " in evaluating picture string " &
- FXF3A00.Valid_Strings(i).all );
- end if;
- else
- if Pack_NDP.Valid(Item => FXF3A00.Decimal_Type_NDP(
- FXF3A00.Erroneous_Data(i)),
- Pic => TC_Picture,
- Currency => TC_US_String)
- then
- Report.Failed("Incorrect result from function Valid, " &
- "when used with a decimal type with delta " &
- "1.0 and with the currency string " &
- TC_US_String &
- " in evaluating picture string " &
- FXF3A00.Valid_Strings(i).all );
- end if;
- end if;
- end loop;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised in Valid_Block");
- end Valid_Block;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3A03;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a04.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a04.a
deleted file mode 100644
index 9eee39bb694..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a04.a
+++ /dev/null
@@ -1,293 +0,0 @@
--- CXF3A04.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the edited output string value returned by Function Image
--- is correct.
---
--- TEST DESCRIPTION:
--- This test is structured using tables of data, consisting of
--- numerical values, picture strings, and expected image
--- result strings. These data tables are found in package FXF3A00.
---
--- The results of the Image function are examined under a number of
--- circumstances. The generic package Decimal_Output is instantiated
--- twice, for decimal data with delta 0.01 and delta 1.0. Each version
--- of Image is called with both default parameters and user-provided
--- parameters. The results of each call to Image are compared to an
--- expected edited output result string.
---
--- In addition, three calls to Image are designed to raise Layout_Error,
--- due to the combination of decimal value and picture string provided
--- as input parameters. If Layout_Error is not raised, or an alternate
--- exception is raised instead, test failure results.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A04.A
---
---
--- CHANGE HISTORY:
--- 22 JAN 95 SAIC Initial prerelease version.
--- 11 MAR 97 PWB.CTA Corrected incorrect index expression
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Report;
-
-procedure CXF3A04 is
-begin
-
- Report.Test ("CXF3A04", "Check that the string value returned by " &
- "Function Image is correct, based on the " &
- "numerical data and picture formatting " &
- "parameters provided to the function");
-
- Test_Block:
- declare
-
- use Ada.Text_IO;
-
- -- Instantiate the Decimal_Output generic package for the two data
- -- types, using the default values for the Default_Currency,
- -- Default_Fill, Default_Separator, and Default_Radix_Mark
- -- parameters.
-
- package Pack_NDP is
- new Editing.Decimal_Output (FXF3A00.Decimal_Type_NDP);
-
- package Pack_2DP is
- new Editing.Decimal_Output (FXF3A00.Decimal_Type_2DP);
-
- TC_Currency : constant String := "$";
- TC_Fill : constant Character := '*';
- TC_Separator : constant Character := ',';
- TC_Radix_Mark : constant Character := '.';
-
- TC_Picture : Editing.Picture;
-
-
- begin
-
- Two_Decimal_Place_Data:
- -- Use a decimal fixed point type with delta 0.01 (two decimal places)
- -- and valid picture strings. Evaluate the result of function Image
- -- with the expected edited output result string.
- declare
-
- TC_Loop_End : constant := -- 10
- FXF3A00.Number_Of_2DP_Items - FXF3A00.Number_Of_Foreign_Strings;
-
- begin
- -- The first 10 picture strings in the Valid_Strings array
- -- correspond to data values of a decimal type with delta 0.01.
-
- -- Compare string result of Image with expected edited output
- -- string. Evaluate data using both default parameters of Image
- -- and user-provided parameter values.
- for i in 1..TC_Loop_End loop
-
- -- Create the picture object from the picture string.
- TC_Picture := Editing.To_Picture(FXF3A00.Valid_Strings(i).all);
-
- -- Use the default parameters for this loop evaluation of Image.
- if Pack_2DP.Image(FXF3A00.Data_With_2DP(i), TC_Picture) /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect result from Function Image, " &
- "when used with a decimal type with delta " &
- "0.01, picture string " &
- FXF3A00.Valid_Strings(i).all &
- ", and the default parameters of Image");
- end if;
-
- -- Use user-provided parameters for this loop evaluation of Image.
-
- if Pack_2DP.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture,
- Currency => TC_Currency,
- Fill => TC_Fill,
- Separator => TC_Separator,
- Radix_Mark => TC_Radix_Mark) /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect result from Function Image, " &
- "when used with a decimal type with delta " &
- "0.01, picture string " &
- FXF3A00.Valid_Strings(i).all &
- ", and user-provided parameters");
- end if;
-
- end loop;
-
- exception
- when others =>
- Report.Failed("Exception raised in Two_Decimal_Place_Data block");
- end Two_Decimal_Place_Data;
-
-
-
- No_Decimal_Place_Data:
- -- Use a decimal fixed point type with delta 1.00 (no decimal places)
- -- and valid picture strings. Evaluate the result of function Image
- -- with the expected result string.
- declare
-
- use Editing, FXF3A00;
-
- TC_Offset : constant := 10;
- TC_Loop_Start : constant := TC_Offset + 1; -- 11
- TC_Loop_End : constant := TC_Loop_Start +
- Number_Of_NDP_Items - 1; -- 22
-
- begin
- -- The following evaluations correspond to data values of a
- -- decimal type with delta 1.0.
-
- -- Compare string result of Image with expected edited output
- -- string. Evaluate data using both default parameters of Image
- -- and user-provided parameter values.
- -- Note: TC_Offset is used to align corresponding data the various
- -- data tables in foundation package FXF3A00.
-
- for i in TC_Loop_Start..TC_Loop_End loop
-
- -- Create the picture object from the picture string.
- TC_Picture := To_Picture(Valid_Strings(i).all);
-
- -- Use the default parameters for this loop evaluation of Image.
- if not (Pack_NDP.Image(Data_With_NDP(i-TC_Offset), TC_Picture) =
- Edited_Output(TC_Offset+i).all)
- then
- Report.Failed("Incorrect result from Function Image, " &
- "when used with a decimal type with delta " &
- "1.0, picture string " &
- Valid_Strings(i).all &
- ", and the default parameters of Image");
- end if;
-
- -- Use user-provided parameters for this loop evaluation of Image.
- if Pack_NDP.Image(Item => Data_With_NDP(i - TC_Offset),
- Pic => TC_Picture,
- Currency => TC_Currency,
- Fill => TC_Fill,
- Separator => TC_Separator,
- Radix_Mark => TC_Radix_Mark) /=
- Edited_Output(TC_Offset+i).all
- then
- Report.Failed("Incorrect result from Function Image, " &
- "when used with a decimal type with delta " &
- "1.0, picture string " &
- Valid_Strings(i).all &
- ", and user-provided parameters");
- end if;
-
- end loop;
-
- exception
- when others =>
- Report.Failed("Exception raised in No_Decimal_Place_Data block");
- end No_Decimal_Place_Data;
-
-
-
- Exception_Block:
- -- The following three calls of Function Image, using the specific
- -- decimal values and picture strings provided, will cause
- -- a Layout_Error to be raised.
- -- The first two evaluations use the instantiation of Decimal_Output
- -- with a decimal type with delta 0.01, while the last evaluation
- -- uses the instantiation with decimal type with delta 1.0.
-
- -- Note: The data and the picture strings used in the following
- -- evaluations are not themselves erroneous, but when used in
- -- combination will cause Layout_Error to be raised.
-
- begin
-
- for i in 1..FXF3A00.Number_Of_Erroneous_Conditions loop -- 1..3
- begin
- -- Create the picture object from the picture string.
- TC_Picture :=
- Editing.To_Picture(FXF3A00.Erroneous_Strings(i).all);
-
- -- Layout_Error must be raised by the following calls to
- -- Function Image.
-
- if i < 3 then -- Choose the appropriate instantiation.
- declare
- N : constant Natural := Pack_2DP.Length(TC_Picture);
- TC_String : String(1..N);
- begin
- TC_String := Pack_2DP.Image(FXF3A00.Erroneous_Data(i),
- TC_Picture);
- end;
- else
- declare
- use FXF3A00;
- N : constant Natural := Pack_NDP.Length(TC_Picture,
- TC_Currency);
- TC_String : String(1..N);
- begin
- TC_String :=
- Pack_NDP.Image(Item => Decimal_Type_NDP(
- Erroneous_Data(i)),
- Pic => TC_Picture,
- Currency => TC_Currency,
- Fill => TC_Fill,
- Separator => TC_Separator,
- Radix_Mark => TC_Radix_Mark);
- end;
- end if;
-
- Report.Failed("Layout_Error not raised by combination " &
- "# " & Integer'Image(i) & " " &
- "of decimal data and picture string");
-
- exception
- when Layout_Error => null; -- Expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by combination " &
- "# " & Integer'Image(i) & " " &
- "of decimal data and picture string");
- end;
- end loop;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised in Exception_Block");
- end Exception_Block;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3A04;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a05.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a05.a
deleted file mode 100644
index 3fb39332a50..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a05.a
+++ /dev/null
@@ -1,266 +0,0 @@
--- CXF3A05.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Function Image produces correct results when provided
--- non-default parameters for Currency, Fill, Separator, and
--- Radix_Mark at either the time of package Decimal_Output instantiation,
--- or in a call to Image. Check non-default parameters that are
--- appropriate for foreign currency representations.
---
--- TEST DESCRIPTION:
--- This test is structured using tables of data, consisting of
--- numerical values, picture strings, and expected image
--- result strings. These data tables are found in package FXF3A00.
---
--- The results of the Image function, resulting from several different
--- instantiations of Decimal_Output, are compared with expected
--- edited output string results. The primary focus of this test is to
--- examine the effect of non-default parameters, provided during the
--- instantiation of package Decimal_Output, or provided as part of a
--- call to Function Image (that resulted from an instantiation of
--- Decimal_Output that used default parameters). The non-default
--- parameters provided correspond to foreign currency representations.
---
--- For each picture string/decimal data combination examined, two
--- evaluations of Image are performed. These correspond to the two
--- methods of providing the appropriate non-default parameters described
--- above. Both forms of Function Image should produce the same expected
--- edited output string.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A05.A
---
---
--- CHANGE HISTORY:
--- 26 JAN 95 SAIC Initial prerelease version.
--- 17 FEB 97 PWB.CTA Correct array indices for Foreign_Strings array
--- references.
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Report;
-
-procedure CXF3A05 is
-begin
-
- Report.Test ("CXF3A05", "Check that Function Image produces " &
- "correct results when provided non-default " &
- "parameters for Currency, Fill, Separator, " &
- "and Radix_Mark, appropriate to foreign " &
- "currency representations");
-
- Test_Block:
- declare
-
- use Ada.Text_IO;
-
- -- Instantiate the Decimal_Output generic package for the several
- -- combinations of Default_Currency, Default_Fill, Default_Separator,
- -- and Default_Radix_Mark.
-
- package Pack_Def is -- Uses default parameter values.
- new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP);
-
- package Pack_FF is
- new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP,
- Default_Currency => "FF",
- Default_Fill => '*',
- Default_Separator => '.',
- Default_Radix_Mark => ',');
-
- package Pack_DM is
- new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP,
- Default_Currency => "DM",
- Default_Fill => '*',
- Default_Separator => ',',
- Default_Radix_Mark => '.');
-
- package Pack_CHF is
- new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP,
- Default_Currency => "CHF",
- Default_Fill => '*',
- Default_Separator => ',',
- Default_Radix_Mark => '.');
-
-
- TC_Picture : Editing.Picture;
- TC_Start_Loop : constant := 11;
- TC_End_Loop : constant := TC_Start_Loop + -- 20
- FXF3A00.Number_Of_Foreign_Strings - 1;
-
- begin
-
- -- In the case of each particular type of foreign string examined,
- -- two versions of Function Image are examined. First, a version of
- -- the function that originated from an instantiation of Decimal_Output
- -- with non-default parameters is checked. This version of Image is
- -- called making use of default parameters in the actual function call.
- -- In addition, a version of Function Image is checked that resulted
- -- from an instantiation of Decimal_Output using default parameters,
- -- but which uses non-default parameters in the function call.
-
- for i in TC_Start_Loop..TC_End_Loop loop
-
- -- Create the picture object from the picture string.
-
- TC_Picture := Editing.To_Picture
- (FXF3A00.Foreign_Strings(i - TC_Start_Loop + 1).all);
-
- -- Based on the ordering of the specific foreign picture strings
- -- in the FXF3A00.Foreign_Strings table, the following conditional
- -- is used to determine which type of currency is being examined
- -- as the loop executes.
-
- if i < TC_Start_Loop + FXF3A00.Number_Of_FF_Strings then -- (11-14)
- -- Process the FF picture strings.
-
- -- Check the result of Function Image from an instantiation
- -- of Decimal_Output that provided non-default actual
- -- parameters at the time of package instantiation, and uses
- -- default parameters in the call of Image.
-
- if Pack_FF.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture) /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect output from Function Image " &
- "from package instantiated with FF " &
- "related parameters, using picture string " &
- FXF3A00.Foreign_Strings
- (i - TC_Start_Loop + 1).all);
- end if;
-
- -- Check the result of Function Image that originated from
- -- an instantiation of Decimal_Output where default parameters
- -- were used at the time of package Instantiation, but where
- -- non-default parameters are provided in the call of Image.
-
- if Pack_Def.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture,
- Currency => "FF",
- Fill => '*',
- Separator => '.',
- Radix_Mark => ',') /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect output from Function Image " &
- "from package instantiated with default " &
- "parameters, using picture string " &
- FXF3A00.Foreign_Strings
- (i - TC_Start_Loop + 1).all &
- ", and FF related parameters in call to Image");
- end if;
-
-
- elsif i < TC_Start_Loop + -- (15-19)
- FXF3A00.Number_Of_FF_Strings +
- FXF3A00.Number_Of_DM_Strings then
- -- Process the DM picture strings.
-
- -- Non-default instantiation parameters, default function call
- -- parameters.
-
- if Pack_DM.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture) /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect output from Function Image " &
- "from package instantiated with DM " &
- "related parameters, using picture string " &
- FXF3A00.Foreign_Strings
- (i - TC_Start_Loop + 1).all);
- end if;
-
- -- Default instantiation parameters, non-default function call
- -- parameters.
-
- if Pack_Def.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture,
- Currency => "DM",
- Fill => '*',
- Separator => ',',
- Radix_Mark => '.') /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect output from Function Image " &
- "from package instantiated with default " &
- "parameters, using picture string " &
- FXF3A00.Foreign_Strings
- (i - TC_Start_Loop + 1).all &
- ", and DM related parameters in call to Image");
- end if;
-
-
- else -- (i=20)
- -- Process the CHF string.
-
- -- Non-default instantiation parameters, default function call
- -- parameters.
-
- if Pack_CHF.Image(FXF3A00.Data_With_2DP(i), TC_Picture) /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect output from Function Image " &
- "from package instantiated with CHF " &
- "related parameters, using picture string " &
- FXF3A00.Foreign_Strings
- (i - TC_Start_Loop + 1).all);
- end if;
-
- -- Default instantiation parameters, non-default function call
- -- parameters.
-
- if Pack_Def.Image(FXF3A00.Data_With_2DP(i),
- TC_Picture,
- "CHF",
- '*',
- ',',
- '.') /=
- FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Incorrect output from Function Image " &
- "from package instantiated with default " &
- "parameters, using picture string " &
- FXF3A00.Foreign_Strings
- (i - TC_Start_Loop + 1).all &
- ", and CHF related parameters in call to Image");
- end if;
-
- end if;
-
- end loop;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3A05;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a06.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a06.a
deleted file mode 100644
index 7b769ba96bf..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a06.a
+++ /dev/null
@@ -1,302 +0,0 @@
--- CXF3A06.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Ada.Text_IO.Editing.Put and Ada.Text_IO.Put have the same
--- effect.
---
--- TEST DESCRIPTION:
--- This test is structured using tables of data, consisting of
--- numerical values, picture strings, and expected image
--- result strings. These data tables are found in package FXF3A00.
---
--- The testing approach used in this test is that of writing edited
--- output data to a text file, using two different approaches. First,
--- Ada.Text_IO.Put is used, with a call to an instantiated version of
--- Function Image supplied as the actual for parameter Item. The
--- second approach is to use a version of Function Put from an
--- instantiation of Ada.Text_IO.Editing.Decimal_Output, with the
--- appropriate parameters for decimal data, picture, and format
--- specific parameters. A call to New_Line follows each Put, so that
--- each entry is placed on a separate line in the text file.
---
--- Edited output for decimal data with two decimal places is in the
--- first loop, and once the data has been written to the file, the
--- text file is closed, then opened in In_File mode. The edited
--- output data is read from the file, and data on successive lines
--- is compared with the expected edited output result. The edited
--- output data produced by both of the Put procedures should be
--- identical.
---
--- This process is repeated for decimal data with no decimal places.
--- The file is reopened in Append_File mode, and the edited output
--- data is added to the file in the same manner as described above.
--- The file is closed, and reopened to verify the data written.
--- The data written above (with two decimal places) is skipped, then
--- the data to be verified is extracted as above and verified against
--- the expected edited output string values.
---
--- APPLICABILITY CRITERIA:
--- This test is applicable only to implementations that support
--- external text files.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A06.A
---
---
--- CHANGE HISTORY:
--- 26 JAN 95 SAIC Initial prerelease version.
--- 26 FEB 97 PWB.CTA Made input buffers sufficiently long
--- and removed code depending on shorter buffers
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Report;
-
-procedure CXF3A06 is
- use Ada;
-begin
-
- Report.Test ("CXF3A06", "Check that Ada.Text_IO.Editing.Put and " &
- "Ada.Text_IO.Put have the same effect");
-
- Test_for_Text_IO_Support:
- declare
- Text_File : Ada.Text_IO.File_Type;
- Text_Filename : constant String := Report.Legal_File_Name(1);
- begin
-
- -- Use_Error will be raised if Text_IO operations or external files
- -- are not supported.
-
- Text_IO.Create (Text_File, Text_IO.Out_File, Text_Filename);
-
- Test_Block:
- declare
- use Ada.Text_IO;
-
- -- Instantiate the Decimal_Output generic package for two
- -- different decimal data types.
-
- package Pack_2DP is -- Uses decimal type with delta 0.01.
- new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP);
-
- package Pack_NDP is -- Uses decimal type with delta 1.0.
- new Editing.Decimal_Output(Num => FXF3A00.Decimal_Type_NDP,
- Default_Currency => "$",
- Default_Fill => '*',
- Default_Separator => ',',
- Default_Radix_Mark => '.');
-
- TC_Picture : Editing.Picture;
- TC_Start_Loop : constant := 1;
- TC_End_Loop_1 : constant := FXF3A00.Number_Of_2DP_Items - -- 20-10
- FXF3A00.Number_Of_Foreign_Strings;
- TC_End_Loop_2 : constant := FXF3A00.Number_Of_NDP_Items; -- 12
- TC_Offset : constant := FXF3A00.Number_Of_2DP_Items; -- 20
-
- TC_String_1, TC_String_2 : String(1..255) := (others => ' ');
- TC_Last_1, TC_Last_2 : Natural := 0;
-
- begin
-
- -- Use the two versions of Put, for data with two decimal points,
- -- to write edited output strings to the text file. Use a separate
- -- line for each string entry.
-
- for i in TC_Start_Loop..TC_End_Loop_1 loop -- 1..10
-
- -- Create the picture object from the picture string.
-
- TC_Picture := Editing.To_Picture(FXF3A00.Valid_Strings(i).all);
-
- -- Use the Text_IO version of Put to place an edited output
- -- string into a text file. Use default parameters in the call
- -- to Image for Currency, Fill, Separator, and Radix_Mark.
-
- Text_IO.Put(Text_File,
- Pack_2DP.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture));
- Text_IO.New_Line(Text_File);
-
- -- Use the version of Put from the instantiation of
- -- Decimal_Output to place an edited output string on a separate
- -- line of the Text_File. Use default parameters for Currency,
- -- Fill, Separator, and Radix_Mark.
-
- Pack_2DP.Put(File => Text_File,
- Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture);
- Text_IO.New_Line(Text_File);
-
- end loop;
-
- Text_IO.Close(Text_File);
-
- -- Reopen the text file in In_File mode, and verify the edited
- -- output found on consecutive lines of the file.
-
- Text_IO.Open(Text_File, Text_IO.In_File, Text_Filename);
-
- for i in TC_Start_Loop..TC_End_Loop_1 loop
- -- Read successive lines in the text file.
- Text_IO.Get_Line(Text_File, TC_String_1, TC_Last_1);
- Text_IO.Get_Line(Text_File, TC_String_2, TC_Last_2);
-
- -- Compare the two strings for equality with the expected edited
- -- output result. Failure results if strings don't match, or if
- -- a reading error occurred from the attempted Get_Line resulting
- -- from an improperly formed edited output string.
-
- if TC_String_1(1..TC_Last_1) /= FXF3A00.Edited_Output(i).all or
- TC_String_2(1..TC_Last_2) /= FXF3A00.Edited_Output(i).all
- then
- Report.Failed("Failed comparison of two edited output " &
- "strings from data with two decimal points " &
- ", loop number = " & Integer'Image(i));
- end if;
- end loop;
-
- Text_IO.Close(Text_File);
-
- -- Reopen the text file in Append_File mode.
- -- Use the two versions of Put, for data with no decimal points,
- -- to write edited output strings to the text file. Use a separate
- -- line for each string entry.
-
- Text_IO.Open(Text_File, Text_IO.Append_File, Text_Filename);
-
- for i in TC_Start_Loop..TC_End_Loop_2 loop -- 1..12
-
- -- Create the picture object from the picture string specific to
- -- data with no decimal points. Use appropriate offset into the
- -- Valid_Strings array to account for the string data used above.
-
- TC_Picture :=
- Editing.To_Picture(FXF3A00.Valid_Strings(i+TC_End_Loop_1).all);
-
- -- Use the Text_IO version of Put to place an edited output
- -- string into a text file. Use non-default parameters in the
- -- call to Image for Currency, Fill, Separator, and Radix_Mark.
-
- Text_IO.Put(Text_File,
- Pack_NDP.Image(Item => FXF3A00.Data_With_NDP(i),
- Pic => TC_Picture,
- Currency => "$",
- Fill => '*',
- Separator => ',',
- Radix_Mark => '.'));
- Text_IO.New_Line(Text_File);
-
- -- Use the version of Put from the instantiation of
- -- Decimal_Output to place an edited output string on a separate
- -- line of the Text_File. Use non-default parameters for
- -- Currency, Fill, Separator, and Radix_Mark.
-
- Pack_NDP.Put(File => Text_File,
- Item => FXF3A00.Data_With_NDP(i),
- Pic => TC_Picture,
- Currency => "$",
- Fill => '*',
- Separator => ',',
- Radix_Mark => '.');
- Text_IO.New_Line(Text_File);
-
- end loop;
-
- Text_IO.Close(Text_File);
-
- -- Reopen the text file in In_File mode, and verify the edited
- -- output found on consecutive lines of the file.
-
- Text_IO.Open(Text_File, Text_IO.In_File, Text_Filename);
-
- -- Read past data that has been verified above, skipping two lines
- -- of the data file for each loop.
-
- for i in TC_Start_Loop..TC_End_Loop_1 loop -- 1..10
- Text_IO.Skip_Line(Text_File, 2);
- end loop;
-
- -- Verify the last data set that was written to the file.
-
- for i in TC_Start_Loop..TC_End_Loop_2 loop -- 1..12
- Text_IO.Get_Line(Text_File, TC_String_1, TC_Last_1);
- Text_IO.Get_Line(Text_File, TC_String_2, TC_Last_2);
-
- -- Compare the two strings for equality with the expected edited
- -- output result. Failure results if strings don't match, or if
- -- a reading error occurred from the attempted Get_Line resulting
- -- from an improperly formed edited output string.
-
- if TC_String_1(1..TC_Last_1) /=
- FXF3A00.Edited_Output(i+TC_Offset).all or
- TC_String_2(1..TC_Last_2) /=
- FXF3A00.Edited_Output(i+TC_Offset).all
- then
- Report.Failed("Failed comparison of two edited output " &
- "strings from data with no decimal points " &
- ", loop number = " &
- Integer'Image(i));
- end if;
-
- end loop;
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- -- Delete the external file.
- if Text_IO.Is_Open (Text_File) then
- Text_IO.Delete (Text_File);
- else
- Text_IO.Open (Text_File, Text_IO.In_File, Text_Filename);
- Text_IO.Delete (Text_File);
- end if;
-
- exception
-
- -- Since Use_Error can be raised if, for the specified mode,
- -- the environment does not support Text_IO operations, the
- -- following handlers are included:
-
- when Text_IO.Use_Error =>
- Report.Not_Applicable ("Use_Error raised on Text_IO Create");
-
- when Text_IO.Name_Error =>
- Report.Not_Applicable ("Name_Error raised on Text_IO Create");
-
- when others =>
- Report.Failed ("Unexpected exception raised in Create block");
-
- end Test_for_Text_IO_Support;
-
- Report.Result;
-
-end CXF3A06;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a07.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a07.a
deleted file mode 100644
index 7cb2c360c97..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a07.a
+++ /dev/null
@@ -1,337 +0,0 @@
--- CXF3A07.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that Ada.Text_IO.Editing.Put and Ada.Strings.Fixed.Move
--- have the same effect in putting edited output results into string
--- variables.
---
--- TEST DESCRIPTION:
--- This test is structured using tables of data, consisting of
--- numerical values, picture strings, and expected image
--- result strings. These data tables are found in package FXF3A00.
---
--- The operation of the two above subprograms are examined twice, first
--- with the output of an edited output string to a receiving string
--- object of equal size, the other to a receiving string object of
--- larger size, where justification and padding are considered.
--- The procedure Editing.Put will place an edited output string into
--- a larger receiving string with right justification and blank fill.
--- Procedure Move has parameter control of justification and fill, and
--- in this test will mirror Put by specifying right justification and
--- blank fill.
---
--- In the cases where the edited output string is of shorter length
--- than the receiving string object, a blank-filled constant string
--- will be catenated to the front of the expected edited output string
--- for comparison with the receiving string object, enabling direct
--- string comparison for result verification.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A07.A
---
---
--- CHANGE HISTORY:
--- 30 JAN 95 SAIC Initial prerelease version.
--- 11 MAR 97 PWB.CTA Fixed string lengths
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Ada.Strings.Fixed;
-with Report;
-
-procedure CXF3A07 is
-begin
-
- Report.Test ("CXF3A07", "Check that Ada.Text_IO.Editing.Put and " &
- "Ada.Strings.Fixed.Move have the same " &
- "effect in putting edited output results " &
- "into string variables");
- Test_Block:
- declare
-
- use Ada.Text_IO;
-
- -- Instantiate the Decimal_Output generic package for two
- -- different decimal data types.
-
- package Pack_2DP is -- Uses decimal type with delta 0.01.
- new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP);
-
- package Pack_NDP is -- Uses decimal type with delta 1.0.
- new Editing.Decimal_Output(Num => FXF3A00.Decimal_Type_NDP,
- Default_Currency => "$",
- Default_Fill => '*',
- Default_Separator => ',',
- Default_Radix_Mark => '.');
-
- TC_Picture : Editing.Picture;
- TC_Start_Loop : Integer := 0;
- TC_End_Loop : Integer := 0;
- TC_Offset : Integer := 0;
- TC_Length : Natural := 0;
-
- TC_Put_String_20, -- Longer than the longest edited
- TC_Move_String_20 : String(1..20); -- output string.
-
- TC_Put_String_17, -- Exact length of longest edited
- TC_Move_String_17 : String(1..17); -- output string in 2DP-US data set.
-
- TC_Put_String_8, -- Exact length of longest edited
- TC_Move_String_8 : String(1..8); -- output string in NDP-US data set.
-
-
- begin
-
- -- Examine cases where the output string is longer than the length
- -- of the edited output result. Use the instantiation of
- -- Decimal_Output specific to data with two decimal places.
-
- TC_Start_Loop := 1;
- TC_End_Loop := FXF3A00.Number_of_2DP_Items - -- 10
- FXF3A00.Number_Of_Foreign_Strings;
-
- for i in TC_Start_Loop..TC_End_Loop loop -- 1..10
-
- -- Create the picture object from the picture string.
-
- TC_Picture := Editing.To_Picture(FXF3A00.Valid_Strings(i).all,
- Blank_When_Zero => False);
-
- -- Determine the actual length of the edited output string
- -- that is expected from Put and Image.
-
- TC_Length := Pack_2DP.Length(Pic => TC_Picture,
- Currency => "$");
-
- -- Determine the difference in length between the receiving string
- -- object and the expected length of the edited output string.
- -- Define a blank filled string constant with length equal to this
- -- length difference.
-
- declare
- TC_Length_Diff : Integer := TC_Put_String_20'Length -
- TC_Length;
- TC_Buffer_String : constant String(1..TC_Length_Diff) :=
- (others => ' ');
- begin
-
- -- Fill the two receiving string objects with edited output,
- -- using the two different methods (Put and Move).
-
- Pack_2DP.Put(To => TC_Put_String_20,
- Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture,
- Currency => "$",
- Fill => '*',
- Separator => ',',
- Radix_Mark => '.');
-
-
- Ada.Strings.Fixed.Move
- (Source => Pack_2DP.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture,
- Currency => "$",
- Fill => '*',
- Separator => ',',
- Radix_Mark => '.'),
- Target => TC_Move_String_20,
- Drop => Ada.Strings.Error,
- Justify => Ada.Strings.Right,
- Pad => Ada.Strings.Space);
-
- -- Each receiving string object is now filled with the edited
- -- output result, right justified.
- -- Compare these two string objects with the expected edited
- -- output value, which is appended to the blank filled string
- -- whose length is the difference between the expected edited
- -- output length and the length of the receiving strings.
-
- if TC_Buffer_String & FXF3A00.Edited_Output(i).all /=
- TC_Put_String_20 or
- TC_Buffer_String & FXF3A00.Edited_Output(i).all /=
- TC_Move_String_20
- then
- Report.Failed("Failed case where the output string is " &
- "longer than the length of the edited " &
- "output result, loop #" & Integer'Image(i));
- end if;
-
- exception
- when Layout_Error =>
- Report.Failed("Layout_Error raised when the output string " &
- "is longer than the length of the edited " &
- "output result, loop #" & Integer'Image(i));
- when others =>
- Report.Failed("Exception raised when the output string is " &
- "longer than the length of the edited " &
- "output result, loop #" & Integer'Image(i));
- end;
- end loop;
-
-
- -- Repeat the above loop, but only evaluate three cases - those where
- -- the length of the expected edited output string is the exact length
- -- of the receiving strings (no justification will be required within
- -- the string. This series of evaluations again uses decimal data
- -- with two decimal places.
-
- for i in TC_Start_Loop..TC_End_Loop loop -- 1..10
-
- case i is
- when 1 | 5 | 7 =>
-
- -- Create the picture object from the picture string.
- TC_Picture :=
- Editing.To_Picture(FXF3A00.Valid_Strings(i).all);
-
- -- Fill the two receiving string objects with edited output,
- -- using the two different methods (Put and Move).
- -- Use default parameters in the various calls where possible.
-
- Pack_2DP.Put(To => TC_Put_String_17,
- Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture);
-
-
- Ada.Strings.Fixed.Move
- (Source => Pack_2DP.Image(Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture),
- Target => TC_Move_String_17);
-
- -- Each receiving string object is now filled with the edited
- -- output result. Compare these two string objects with the
- -- expected edited output value.
-
- if FXF3A00.Edited_Output(i).all /= TC_Put_String_17 or
- FXF3A00.Edited_Output(i).all /= TC_Move_String_17
- then
- Report.Failed("Failed case where the output string is " &
- "the exact length of the edited output " &
- "result, loop #" & Integer'Image(i));
- end if;
-
- when others => null;
- end case;
- end loop;
-
-
- -- Evaluate a mix of cases, where the expected edited output string
- -- length is either exactly as long or shorter than the receiving
- -- output string parameter. This series of evaluations uses decimal
- -- data with no decimal places.
-
- TC_Start_Loop := TC_End_Loop + 1; -- 11
- TC_End_Loop := TC_Start_Loop + -- 22
- FXF3A00.Number_of_NDP_Items - 1;
- TC_Offset := FXF3A00.Number_of_Foreign_Strings; -- 10
- -- This offset is required due to the arrangement of data within the
- -- tables found in FXF3A00.
-
- for i in TC_Start_Loop..TC_End_Loop loop -- 11..22
-
- -- Create the picture object from the picture string.
-
- TC_Picture := Editing.To_Picture(FXF3A00.Valid_Strings(i).all);
-
- -- Determine the actual length of the edited output string
- -- that is expected from Put and Image.
-
- TC_Length := Pack_NDP.Length(TC_Picture);
-
- -- Fill the two receiving string objects with edited output,
- -- using the two different methods (Put and Move).
-
- Pack_NDP.Put(TC_Put_String_8,
- FXF3A00.Data_With_NDP(i-TC_Offset),
- TC_Picture);
-
- Ada.Strings.Fixed.Move
- (Pack_NDP.Image(FXF3A00.Data_With_NDP(i-TC_Offset), TC_Picture),
- TC_Move_String_8,
- Ada.Strings.Error,
- Ada.Strings.Right,
- Ada.Strings.Space);
-
- -- Determine if there is a difference in length between the
- -- receiving string object and the expected length of the edited
- -- output string. If so, then define a blank filled string constant
- -- with length equal to this length difference.
-
- if TC_Length < TC_Put_String_8'Length then
- declare
- TC_Length_Diff : Integer := TC_Put_String_8'Length -
- TC_Length;
- TC_Buffer_String : constant String(1..TC_Length_Diff) :=
- (others => ' ');
- begin
-
- -- Each receiving string object is now filled with the edited
- -- output result, right justified.
- -- Compare these two string objects with the expected edited
- -- output value, which is appended to the blank filled string
- -- whose length is the difference between the expected edited
- -- output length and the length of the receiving strings.
-
- if TC_Buffer_String & FXF3A00.Edited_Output(i+TC_Offset).all /=
- TC_Put_String_8 or
- TC_Buffer_String & FXF3A00.Edited_Output(i+TC_Offset).all /=
- TC_Move_String_8
- then
- Report.Failed("Failed case where the output string is " &
- "longer than the length of the edited " &
- "output result, loop #" & Integer'Image(i) &
- ", using data with no decimal places");
- end if;
- end;
- else
-
- -- Compare these two string objects with the expected edited
- -- output value, which is appended to the blank filled string
- -- whose length is the difference between the expected edited
- -- output length and the length of the receiving strings.
-
- if FXF3A00.Edited_Output(i+TC_Offset).all /= TC_Put_String_8 or
- FXF3A00.Edited_Output(i+TC_Offset).all /= TC_Move_String_8
- then
- Report.Failed("Failed case where the output string is " &
- "the same length as the edited output " &
- "result, loop #" & Integer'Image(i) &
- ", using data with no decimal places");
- end if;
- end if;
- end loop;
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3A07;
diff --git a/gcc/testsuite/ada/acats/tests/cxf/cxf3a08.a b/gcc/testsuite/ada/acats/tests/cxf/cxf3a08.a
deleted file mode 100644
index 871ab5600a9..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxf/cxf3a08.a
+++ /dev/null
@@ -1,289 +0,0 @@
--- CXF3A08.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the version of Ada.Text_IO.Editing.Put with an out
--- String parameter propagates Layout_Error if the edited output string
--- result of Put exceeds the length of the out String parameter.
---
--- TEST DESCRIPTION:
--- This test is structured using tables of data, consisting of
--- numerical values, picture strings, and expected image
--- result strings. These data tables are found in package FXF3A00.
---
--- This test examines the case of the out string parameter to Procedure
--- Put being insufficiently long to hold the entire edited output
--- string result of the procedure. In this case, Layout_Error is to be
--- raised. Test failure results if Layout_Error is not raised, or if an
--- exception other than Layout_Error is raised.
---
--- A number of data combinations are examined, using instantiations
--- of Package Decimal_Output with different decimal data types and
--- both default and non-default parameters as generic actual parameters.
--- In addition, calls to Procedure Put are performed using default
--- parameters, non-default parameters, and non-default parameters that
--- override the generic actual parameters provided at the time of
--- instantiation of Decimal_Output.
---
--- TEST FILES:
--- The following files comprise this test:
---
--- FXF3A00.A (foundation code)
--- => CXF3A08.A
---
---
--- CHANGE HISTORY:
--- 31 JAN 95 SAIC Initial prerelease version.
---
---!
-
-with FXF3A00;
-with Ada.Text_IO.Editing;
-with Report;
-
-procedure CXF3A08 is
-begin
-
- Report.Test ("CXF3A08", "Check that the version of " &
- "Ada.Text_IO.Editing.Put with an out " &
- "String parameter propagates Layout_Error " &
- "if the output string exceeds the length " &
- "of the out String parameter");
-
- Test_Block:
- declare
-
- use Ada.Text_IO;
-
- -- Instantiate the Decimal_Output generic package for two
- -- different decimal data types.
- -- Uses decimal type with delta 0.01 and
- package Pack_2DP is -- non-default generic actual parameters.
- new Editing.Decimal_Output(Num => FXF3A00.Decimal_Type_2DP,
- Default_Currency => "$",
- Default_Fill => '*',
- Default_Separator => ',',
- Default_Radix_Mark => '.');
-
- package Pack_NDP is -- Uses decimal type with delta 1.0.
- new Editing.Decimal_Output(FXF3A00.Decimal_Type_NDP);
-
- TC_Picture : Editing.Picture;
- TC_Start_Loop : Integer := 0;
- TC_End_Loop : Integer := 0;
- TC_Offset : Integer := 0;
-
- TC_Short_String : String(1..4); -- Shorter than the shortest edited
- -- output string result.
-
- begin
-
- -- Examine cases where the out string parameter is shorter than
- -- the length of the edited output result. Use the instantiation of
- -- Decimal_Output specific to data with two decimal places.
-
- TC_Start_Loop := 1;
- TC_End_Loop := FXF3A00.Number_of_2DP_Items - -- 10
- FXF3A00.Number_Of_Foreign_Strings;
-
- for i in TC_Start_Loop..TC_End_Loop loop -- 1..10
-
- -- Create the picture object from the picture string.
-
- TC_Picture :=
- Editing.To_Picture(Pic_String => FXF3A00.Valid_Strings(i).all,
- Blank_When_Zero => False);
-
- -- The out parameter string provided in the call to Put is
- -- shorter than the edited output result of the procedure.
- -- This will result in a Layout_Error being raised and handled.
- -- Test failure results from no exception being raised, or from
- -- the wrong exception being raised.
-
- begin
-
- -- Use the instantiation of Decimal_Output specific to decimal
- -- data with two decimal places, as well as non-default
- -- parameters and named parameter association.
-
- Pack_2DP.Put(To => TC_Short_String,
- Item => FXF3A00.Data_With_2DP(i),
- Pic => TC_Picture,
- Currency => "$",
- Fill => '*',
- Separator => ',',
- Radix_Mark => '.');
-
- -- Test failure if exception not raised.
-
- Report.Failed
- ("Layout_Error not raised, decimal data with two decimal " &
- "places, loop #" & Integer'Image(i));
-
- exception
- when Layout_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Incorrect exception raised, Layout_Error expected, " &
- "decimal data with two decimal places, loop #" &
- Integer'Image(i));
- end;
- end loop;
-
-
- -- Perform similar evaluations as above, but use the instantiation
- -- of Decimal_Output specific to decimal data with no decimal places.
-
- TC_Start_Loop := TC_End_Loop + 1; -- 11
- TC_End_Loop := TC_Start_Loop + -- 22
- FXF3A00.Number_of_NDP_Items - 1;
- TC_Offset := FXF3A00.Number_of_Foreign_Strings; -- 10
- -- This offset is required due to the arrangement of data within the
- -- tables found in FXF3A00.
-
- for i in TC_Start_Loop..TC_End_Loop loop -- 11..22
-
- -- Create the picture object from the picture string.
-
- TC_Picture := Editing.To_Picture(FXF3A00.Valid_Strings(i).all);
-
- begin
-
- -- Use the instantiation of Decimal_Output specific to decimal
- -- data with no decimal places, as well as default parameters
- -- and positional parameter association.
-
- Pack_NDP.Put(TC_Short_String,
- FXF3A00.Data_With_NDP(i-TC_Offset),
- TC_Picture);
-
- -- Test failure if exception not raised.
-
- Report.Failed
- ("Layout_Error not raised, decimal data with no decimal " &
- "places, loop #" & Integer'Image(i));
-
- exception
- when Layout_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Incorrect exception raised, Layout_Error expected, " &
- "decimal data with no decimal places, loop #" &
- Integer'Image(i));
- end;
-
- end loop;
-
-
- -- Check that Layout_Error is raised by Put resulting from an
- -- instantiation of Decimal_Output specific to foreign currency
- -- representations.
- -- Note: Both of the following evaluation sets use decimal data with
- -- two decimal places.
-
- declare
-
- package Pack_FF is
- new Editing.Decimal_Output(Num => FXF3A00.Decimal_Type_2DP,
- Default_Currency => "FF",
- Default_Fill => '*',
- Default_Separator => '.',
- Default_Radix_Mark => ',');
-
- begin
-
- TC_Offset := FXF3A00.Number_Of_2DP_Items - -- 10
- FXF3A00.Number_Of_Foreign_Strings;
-
- for i in 1..FXF3A00.Number_Of_FF_Strings loop -- 1..4
- begin
-
- -- Create the picture object from the picture string.
- TC_Picture :=
- Editing.To_Picture(FXF3A00.Foreign_Strings(i).all);
-
- Pack_FF.Put(To => TC_Short_String,
- Item => FXF3A00.Data_With_2DP(i+TC_Offset),
- Pic => TC_Picture);
-
- Report.Failed("Layout_Error was not raised by Put from " &
- "an instantiation of Decimal_Output using " &
- "non-default parameters specific to FF " &
- "currency, loop #" & Integer'Image(i));
-
- exception
- when Layout_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Put from " &
- "an instantiation of Decimal_Output using " &
- "non-default parameters specific to FF " &
- "currency, loop #" & Integer'Image(i));
- end;
- end loop;
-
-
- -- These evaluations use a version of Put resulting from a
- -- non-default instantiation of Decimal_Output, but which has
- -- specific foreign currency parameters provided in the call that
- -- override the generic actual parameters provided at instantiation.
-
- TC_Offset := TC_Offset + FXF3A00.Number_Of_FF_Strings; -- 14
-
- for i in 1..FXF3A00.Number_Of_DM_Strings loop -- 1..5
- begin
- TC_Picture :=
- Editing.To_Picture(FXF3A00.Foreign_Strings
- (i+FXF3A00.Number_Of_FF_Strings).all);
-
- Pack_2DP.Put(To => TC_Short_String,
- Item => FXF3A00.Data_With_2DP(i+TC_Offset),
- Pic => TC_Picture,
- Currency => "DM",
- Fill => '*',
- Separator => ',',
- Radix_Mark => '.');
-
- Report.Failed("Layout_Error was not raised by Put using " &
- "non-default parameters specific to DM " &
- "currency, loop #" & Integer'Image(i));
-
- exception
- when Layout_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by Put using " &
- "non-default parameters specific to DM " &
- "currency, loop #" & Integer'Image(i));
- end;
- end loop;
-
- end;
-
- exception
- when others => Report.Failed("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXF3A08;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg1001.a b/gcc/testsuite/ada/acats/tests/cxg/cxg1001.a
deleted file mode 100644
index 01a0f061e51..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg1001.a
+++ /dev/null
@@ -1,276 +0,0 @@
--- CXG1001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in the package
--- Ada.Numerics.Generic_Complex_Types provide correct results.
--- Specifically, check the functions Re, Im (both versions), procedures
--- Set_Re, Set_Im (both versions), functions Compose_From_Cartesian (all
--- versions), Compose_From_Polar, Modulus, Argument, and "abs".
---
--- TEST DESCRIPTION:
--- The generic package Generic_Complex_Types
--- is instantiated with a real type (new Float), and the results
--- produced by the specified subprograms are verified.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 15 Nov 95 SAIC Corrected visibility problems for ACVC 2.0.1.
--- Modified subtest for Compose_From_Polar.
--- 29 Sep 96 SAIC Incorporated reviewer comments.
---
---!
-
-with Ada.Numerics.Generic_Complex_Types;
-with Report;
-
-procedure CXG1001 is
-
-begin
-
- Report.Test ("CXG1001", "Check that the subprograms defined in " &
- "the package Ada.Numerics.Generic_Complex_Types " &
- "provide correct results");
-
- Test_Block:
- declare
-
- type Real_Type is new Float;
-
- package Complex_Pack is new
- Ada.Numerics.Generic_Complex_Types(Real_Type);
-
- use type Complex_Pack.Complex;
-
- -- Declare a zero valued complex number.
- Complex_Zero : constant Complex_Pack.Complex := (0.0, 0.0);
-
- TC_Complex : Complex_Pack.Complex := Complex_Zero;
- TC_Imaginary : Complex_Pack.Imaginary;
-
- begin
-
- -- Check that the procedures Set_Re and Set_Im (both versions) provide
- -- correct results.
-
- declare
- TC_Complex_Real_Field : Complex_Pack.Complex := (5.0, 0.0);
- TC_Complex_Both_Fields : Complex_Pack.Complex := (5.0, 7.0);
- begin
-
- Complex_Pack.Set_Re(X => TC_Complex, Re => 5.0);
-
- if TC_Complex /= TC_Complex_Real_Field then
- Report.Failed("Incorrect results from Procedure Set_Re");
- end if;
-
- Complex_Pack.Set_Im(X => TC_Complex, Im => 7.0);
-
- if TC_Complex.Re /= 5.0 or
- TC_Complex.Im /= 7.0 or
- TC_Complex /= TC_Complex_Both_Fields
- then
- Report.Failed("Incorrect results from Procedure Set_Im " &
- "with Complex argument");
- end if;
-
- Complex_Pack.Set_Im(X => TC_Imaginary, Im => 3.0);
-
-
- if Complex_Pack.Im(TC_Imaginary) /= 3.0 then
- Report.Failed("Incorrect results returned following the use " &
- "of Procedure Set_Im with Imaginary argument");
- end if;
-
- end;
-
-
- -- Check that the functions Re and Im (both versions) provide
- -- correct results.
-
- declare
- TC_Complex_1 : Complex_Pack.Complex := (1.0, 0.0);
- TC_Complex_2 : Complex_Pack.Complex := (0.0, 2.0);
- TC_Complex_3 : Complex_Pack.Complex := (4.0, 3.0);
- begin
-
- -- Function Re.
-
- if Complex_Pack.Re(X => TC_Complex_1) /= 1.0 or
- Complex_Pack.Re(X => TC_Complex_2) /= 0.0 or
- Complex_Pack.Re(X => TC_Complex_3) /= 4.0
- then
- Report.Failed("Incorrect results from Function Re");
- end if;
-
- -- Function Im; version with Complex argument.
-
- if Complex_Pack.Im(X => TC_Complex_1) /= 0.0 or
- Complex_Pack.Im(X => TC_Complex_2) /= 2.0 or
- Complex_Pack.Im(X => TC_Complex_3) /= 3.0
- then
- Report.Failed("Incorrect results from Function Im " &
- "with Complex argument");
- end if;
-
-
- -- Function Im; version with Imaginary argument.
-
- if Complex_Pack.Im(Complex_Pack.i) /= 1.0 or
- Complex_Pack.Im(Complex_Pack.j) /= 1.0
- then
- Report.Failed("Incorrect results from use of Function Im " &
- "when used with an Imaginary argument");
- end if;
-
- end;
-
-
- -- Verify the results of the three versions of Function
- -- Compose_From_Cartesian
-
- declare
-
- Zero : constant Real_Type := 0.0;
- Six : constant Real_Type := 6.0;
-
- TC_Complex_1 : Complex_Pack.Complex := (3.0, 8.0);
- TC_Complex_2 : Complex_Pack.Complex := (Six, Zero);
- TC_Complex_3 : Complex_Pack.Complex := (Zero, 1.0);
-
- begin
-
- TC_Complex := Complex_Pack.Compose_From_Cartesian(3.0, 8.0);
-
- if TC_Complex /= TC_Complex_1 then
- Report.Failed("Incorrect results from Function " &
- "Compose_From_Cartesian - 1");
- end if;
-
- -- If only one component is given, the other component is
- -- implicitly zero (Both components are set by the following two
- -- function calls).
-
- TC_Complex := Complex_Pack.Compose_From_Cartesian(Re => 6.0);
-
- if TC_Complex /= TC_Complex_2 then
- Report.Failed("Incorrect results from Function " &
- "Compose_From_Cartesian - 2");
- end if;
-
- TC_Complex :=
- Complex_Pack.Compose_From_Cartesian(Im => Complex_Pack.i);
-
- if TC_Complex /= TC_Complex_3 then
- Report.Failed("Incorrect results from Function " &
- "Compose_From_Cartesian - 3");
- end if;
-
- end;
-
-
- -- Verify the results of Function Compose_From_Polar, Modulus, "abs",
- -- and Argument.
-
- declare
-
- use Complex_Pack;
-
- TC_Modulus,
- TC_Argument : Real_Type := 0.0;
-
-
- Angle_0 : constant Real_Type := 0.0;
- Angle_90 : constant Real_Type := 90.0;
- Angle_180 : constant Real_Type := 180.0;
- Angle_270 : constant Real_Type := 270.0;
- Angle_360 : constant Real_Type := 360.0;
-
- begin
-
- -- Verify the result of Function Compose_From_Polar.
- -- When the value of the parameter Modulus is zero, the
- -- Compose_From_Polar function yields a result of zero.
-
- if Compose_From_Polar(0.0, 30.0, 360.0) /= Complex_Zero
- then
- Report.Failed("Incorrect result from Function " &
- "Compose_From_Polar - 1");
- end if;
-
- -- When the value of the parameter Argument is equal to a multiple
- -- of the quarter cycle, the result of the Compose_From_Polar
- -- function with specified cycle lies on one of the axes.
-
- if Compose_From_Polar( 5.0, Angle_0, Angle_360) /= (5.0, 0.0) or
- Compose_From_Polar( 5.0, Angle_90, Angle_360) /= (0.0, 5.0) or
- Compose_From_Polar(-5.0, Angle_180, Angle_360) /= (5.0, 0.0) or
- Compose_From_Polar(-5.0, Angle_270, Angle_360) /= (0.0, 5.0) or
- Compose_From_Polar(-5.0, Angle_90, Angle_360) /= (0.0, -5.0) or
- Compose_From_Polar( 5.0, Angle_270, Angle_360) /= (0.0, -5.0)
- then
- Report.Failed("Incorrect result from Function " &
- "Compose_From_Polar - 2");
- end if;
-
- -- When the parameter to Function Argument represents a point on
- -- the non-negative real axis, the function yields a zero result.
-
- if Argument(Complex_Zero, Angle_360) /= 0.0 then
- Report.Failed("Incorrect result from Function Argument");
- end if;
-
- -- Function Modulus
-
- if Modulus(Complex_Zero) /= 0.0 or
- Modulus(Compose_From_Polar( 5.0, Angle_90, Angle_360)) /= 5.0 or
- Modulus(Compose_From_Polar(-5.0, Angle_180, Angle_360)) /= 5.0
- then
- Report.Failed("Incorrect results from Function Modulus");
- end if;
-
- -- Function "abs", a rename of Function Modulus.
-
- if "abs"(Complex_Zero) /= 0.0 or
- "abs"(Compose_From_Polar( 5.0, Angle_90, Angle_360)) /= 5.0 or
- "abs"(Compose_From_Polar(-5.0, Angle_180, Angle_360)) /= 5.0
- then
- Report.Failed("Incorrect results from Function abs");
- end if;
-
- end;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXG1001;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg1002.a b/gcc/testsuite/ada/acats/tests/cxg/cxg1002.a
deleted file mode 100644
index 39f5f00dbc3..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg1002.a
+++ /dev/null
@@ -1,198 +0,0 @@
--- CXG1002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in the package
--- Ada.Numerics.Generic_Complex_Types provide the prescribed results.
--- Specifically, check the various versions of functions "+" and "-".
---
--- TEST DESCRIPTION:
--- This test checks that the subprograms "+" and "-" defined in the
--- Generic_Complex_Types package provide the results prescribed for the
--- evaluation of these complex arithmetic operations. The functions
--- Re and Im are used to extract the appropriate component of the
--- complex result, in order that the prescribed result component can be
--- verified.
--- The generic package is instantiated with a real type (new Float),
--- and the results produced by the specified subprograms are verified.
---
--- SPECIAL REQUIREMENTS:
--- This test can be run in either "relaxed" or "strict" mode.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
---
---!
-
-with Ada.Numerics.Generic_Complex_Types;
-with Report;
-
-procedure CXG1002 is
-
-begin
-
- Report.Test ("CXG1002", "Check that the subprograms defined in " &
- "the package Ada.Numerics.Generic_Complex_Types " &
- "provide the prescribed results");
-
- Test_Block:
- declare
-
- type Real_Type is new Float;
-
- package Complex_Pack is new
- Ada.Numerics.Generic_Complex_Types(Real_Type);
- use Complex_Pack;
-
- -- Declare a zero valued complex number using the record
- -- aggregate approach.
-
- Complex_Zero : constant Complex_Pack.Complex := (0.0, 0.0);
-
- TC_Complex,
- TC_Complex_Right,
- TC_Complex_Left : Complex_Pack.Complex := Complex_Zero;
-
- TC_Real : Real_Type := 0.0;
-
- TC_Imaginary : Complex_Pack.Imaginary;
-
- begin
-
-
- -- Check that the imaginary component of the result of a binary addition
- -- operator that yields a result of complex type is exact when either
- -- of its operands is of pure-real type.
-
- TC_Complex := Compose_From_Cartesian(2.0, 3.0);
- TC_Real := 3.0;
-
- if Im("+"(Left => TC_Complex, Right => TC_Real)) /= 3.0 or
- Im("+"(TC_Complex, 6.0)) /= 3.0 or
- Im(TC_Complex + TC_Real) /= 3.0 or
- Im(TC_Complex + 5.0) /= 3.0 or
- Im((7.0, 2.0) + 1.0) /= 2.0 or
- Im((7.0, 5.0) + (-2.0)) /= 5.0 or
- Im((-7.0, -2.0) + 1.0) /= -2.0 or
- Im((-7.0, -3.0) + (-3.0)) /= -3.0
- then
- Report.Failed("Incorrect results from Function ""+"" with " &
- "one Complex and one Real argument - 1");
- end if;
-
- if Im("+"(Left => TC_Real, Right => TC_Complex)) /= 3.0 or
- Im("+"(4.0, TC_Complex)) /= 3.0 or
- Im(TC_Real + TC_Complex) /= 3.0 or
- Im(9.0 + TC_Complex) /= 3.0 or
- Im(1.0 + (7.0, -9.0)) /= -9.0 or
- Im((-2.0) + (7.0, 2.0)) /= 2.0 or
- Im(1.0 + (-7.0, -5.0)) /= -5.0 or
- Im((-3.0) + (-7.0, 16.0)) /= 16.0
- then
- Report.Failed("Incorrect results from Function ""+"" with " &
- "one Complex and one Real argument - 2");
- end if;
-
-
- -- Check that the imaginary component of the result of a binary
- -- subtraction operator that yields a result of complex type is exact
- -- when its right operand is of pure-real type.
-
- TC_Complex := (8.0, -4.0);
- TC_Real := 2.0;
-
- if Im("-"(Left => TC_Complex, Right => TC_Real)) /= -4.0 or
- Im("-"(TC_Complex, 5.0)) /= -4.0 or
- Im(TC_Complex - TC_Real) /= -4.0 or
- Im(TC_Complex - 4.0) /= -4.0 or
- Im((6.0, 5.0) - 1.0) /= 5.0 or
- Im((6.0, 13.0) - 7.0) /= 13.0 or
- Im((-5.0, 3.0) - (2.0)) /= 3.0 or
- Im((-5.0, -6.0) - (-3.0)) /= -6.0
- then
- Report.Failed("Incorrect results from Function ""-"" with " &
- "one Complex and one Real argument");
- end if;
-
-
- -- Check that the real component of the result of a binary addition
- -- operator that yields a result of complex type is exact when either
- -- of its operands is of pure-imaginary type.
-
- TC_Complex := (5.0, 0.0);
-
- if Re("+"(Left => TC_Complex, Right => i)) /= 5.0 or
- Re("+"(Complex_Pack.j, TC_Complex)) /= 5.0 or
- Re((-8.0, 5.0) + ( 2.0*i)) /= -8.0 or
- Re((2.0, 5.0) + (-2.0*i)) /= 2.0 or
- Re((-20.0, -5.0) + ( 3.0*i)) /= -20.0 or
- Re((6.0, -5.0) + (-3.0*i)) /= 6.0
- then
- Report.Failed("Incorrect results from Function ""+"" with " &
- "one Complex and one Imaginary argument");
- end if;
-
-
- -- Check that the real component of the result of a binary
- -- subtraction operator that yields a result of complex type is exact
- -- when its right operand is of pure-imaginary type.
-
- TC_Complex := TC_Complex + i; -- Should produce (5.0, 1.0)
-
- if Re("-"(TC_Complex, i)) /= 5.0 or
- Re((-4.0, 4.0) - ( 2.0*i)) /= -4.0 or
- Re((9.0, 4.0) - ( 5.0*i)) /= 9.0 or
- Re((16.0, -5.0) - ( 3.0*i)) /= 16.0 or
- Re((-3.0, -5.0) - (-4.0*i)) /= -3.0
- then
- Report.Failed("Incorrect results from Function ""-"" with " &
- "one Complex and one Imaginary argument");
- end if;
-
-
- -- Check that the result of a binary addition operation is exact when
- -- one of its operands is of real type and the other is of
- -- pure-imaginary type; the operator is analogous to the
- -- Compose_From_Cartesian function; it performs no arithmetic.
-
- TC_Complex := Complex_Pack."+"(5.0, Complex_Pack.i);
-
- if TC_Complex /= (5.0, 1.0) or
- (4.0 + i) /= (4.0, 1.0) or
- "+"(Left => j, Right => 3.0) /= (3.0, 1.0)
- then
- Report.Failed("Incorrect results from Function ""+"" with " &
- "one Real and one Imaginary argument");
- end if;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXG1002;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg1003.a b/gcc/testsuite/ada/acats/tests/cxg/cxg1003.a
deleted file mode 100644
index c3885136b86..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg1003.a
+++ /dev/null
@@ -1,478 +0,0 @@
--- CXG1003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in the package Text_IO.Complex_IO
--- provide correct results.
---
--- TEST DESCRIPTION:
--- The generic package Ada.Numerics.Generic_Complex_Types is instantiated
--- with a real type (new Float). The resulting new package is used as
--- the generic actual to package Complex_IO.
--- Two different versions of Put and Get are examined in this test,
--- those that input/output complex data values from/to Text_IO files,
--- and those that input/output complex data values from/to strings.
--- Two procedures are defined to perform the file data manipulations;
--- one to place complex data into the file, and one to retrieve the data
--- from the file and verify its correctness.
--- Complex data is also put into string variables using the Procedure
--- Put for strings, and this data is then retrieved and reconverted into
--- complex values using the Get procedure.
---
---
--- APPLICABILITY CRITERIA:
--- This test is only applicable to implementations that:
--- support Annex G,
--- support Text_IO and external files
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 29 Dec 94 SAIC Modified Width parameter in Get function calls.
--- 16 Nov 95 SAIC Corrected visibility problems for ACVC 2.0.1.
--- 29 Sep 96 SAIC Incorporated reviewer comments.
---
---!
-
-with Ada.Text_IO.Complex_IO;
-with Ada.Numerics.Generic_Complex_Types;
-with Report;
-
-procedure CXG1003 is
-begin
-
- Report.Test ("CXG1003", "Check that the subprograms defined in " &
- "the package Text_IO.Complex_IO " &
- "provide correct results");
-
- Test_for_Text_IO_Support:
- declare
- use Ada;
-
- Data_File : Ada.Text_IO.File_Type;
- Data_Filename : constant String := Report.Legal_File_Name;
-
- begin
-
- -- An application creates a text file in mode Out_File, with the
- -- intention of entering complex data into the file as appropriate.
- -- In the event that the particular environment where the application
- -- is running does not support Text_IO, Use_Error or Name_Error will be
- -- raised on calls to Text_IO operations. Either of these exceptions
- -- will be handled to produce a Not_Applicable result.
-
- Text_IO.Create (File => Data_File,
- Mode => Ada.Text_IO.Out_File,
- Name => Data_Filename);
-
- Test_Block:
- declare
-
- TC_Verbose : Boolean := False;
-
- type Real_Type is new Float;
-
- package Complex_Pack is new
- Ada.Numerics.Generic_Complex_Types(Real_Type);
-
- package C_IO is new Ada.Text_IO.Complex_IO(Complex_Pack);
-
- use Ada.Text_IO, C_IO;
- use type Complex_Pack.Complex;
-
- Number_Of_Complex_Items : constant := 6;
- Number_Of_Error_Items : constant := 2;
-
- TC_Complex : Complex_Pack.Complex;
- TC_Last_Character_Read : Positive;
-
- Complex_Array : array (1..Number_Of_Complex_Items)
- of Complex_Pack.Complex := ( (3.0, 9.0),
- (4.0, 7.0),
- (5.0, 6.0),
- (6.0, 3.0),
- (2.0, 5.0),
- (3.0, 7.0) );
-
-
- procedure Load_Data_File (The_File : in out Text_IO.File_Type) is
- use Ada.Text_IO;
- begin
- -- This procedure does not create, open, or close the data file;
- -- The_File file object must be Open at this point.
- -- This procedure is designed to load complex data into a data
- -- file twice, first using Text_IO, then Complex_IO. In this
- -- first case, the complex data values are entered as strings,
- -- assuming a variety of legal formats, as provided in the
- -- reference manual.
-
- Put_Line(The_File, "(3.0, 9.0)");
- Put_Line(The_File, "+4. +7."); -- Relaxed real literal format.
- Put_Line(The_File, "(5.0 6.)");
- Put_Line(The_File, "6., 3.0");
- Put_Line(The_File, " ( 2.0 , 5.0 ) ");
- Put_Line(The_File, "("); -- Complex data separated over
- Put_Line(The_File, "3.0"); -- several (5) lines.
- Put_Line(The_File, " , ");
- Put_Line(The_File, "7.0 ");
- Put_Line(The_File, ")");
-
- if TC_Verbose then
- Report.Comment("Complex values entered into data file using " &
- "Text_IO, Procedure Load_Data_File");
- end if;
-
- -- Use the Complex_IO procedure Put to enter Complex data items
- -- into the data file.
- -- Note: Data is being entered into the file for the *second* time
- -- at this point. (Using Complex_IO here, Text_IO above)
-
- for i in 1..Number_Of_Complex_Items loop
- C_IO.Put(File => The_File,
- Item => Complex_Array(i),
- Fore => 1,
- Aft => 1,
- Exp => 0);
- end loop;
-
- if TC_Verbose then
- Report.Comment("Complex values entered into data file using " &
- "Complex_IO, Procedure Load_Data_File");
- end if;
-
- Put_Line(The_File, "(5A,3)"); -- data to raise Data_Error.
- Put_Line(The_File, "(3.0,,8.0)"); -- data to raise Data_Error.
-
- end Load_Data_File;
-
-
-
- procedure Process_Data_File (The_File : in out Text_IO.File_Type) is
- TC_Complex : Complex_Pack.Complex := (0.0, 0.0);
- TC_Width : Integer := 0;
- begin
- -- This procedure does not create, open, or close the data file;
- -- The_File file object must be Open at this point.
- -- Use procedure Get (for Files) to extract the complex data from
- -- the Text_IO file. This data was placed into the file using
- -- Text_IO.
-
-
- for i in 1..Number_Of_Complex_Items loop
-
- C_IO.Get(The_File, TC_Complex, TC_Width);
-
- if TC_Complex /= Complex_Array(i) then
- Report.Failed("Incorrect complex data read from file " &
- "when using Text_IO procedure Get, " &
- "data item #" & Integer'Image(i));
- end if;
- end loop;
-
- if TC_Verbose then
- Report.Comment("First set of complex values extracted " &
- "from data file using Complex_IO, " &
- "Procedure Process_Data_File");
- end if;
-
- -- Use procedure Get (for Files) to extract the complex data from
- -- the Text_IO file. This data was placed into the file using
- -- procedure Complex_IO.Put.
- -- Note: Data is being extracted from the file for the *second*
- -- time at this point (Using Complex_IO here, Text_IO above)
-
- for i in 1..Number_Of_Complex_Items loop
-
- C_IO.Get(The_File, TC_Complex, TC_Width);
-
- if TC_Complex /= Complex_Array(i) then
- Report.Failed("Incorrect complex data read from file " &
- "when using Complex_IO procedure Get, " &
- "data item #" & Integer'Image(i));
- end if;
- end loop;
-
- if TC_Verbose then
- Report.Comment("Second set of complex values extracted " &
- "from data file using Complex_IO, " &
- "Procedure Process_Data_File");
- end if;
-
- -- The final items in the Data_File are complex values with
- -- incorrect syntax, which should raise Data_Error on an attempt
- -- to read them from the file.
- TC_Width := 10;
- for i in 1..Number_Of_Error_Items loop
- begin
- C_IO.Get(The_File, TC_Complex, TC_Width);
- Report.Failed
- ("Exception Data_Error not raised when Complex_IO.Get " &
- "was used to read complex data with incorrect " &
- "syntax from the Data_File, data item #" &
- Integer'Image(i));
- exception
- when Ada.Text_IO.Data_Error => -- OK, expected exception.
- Text_IO.Skip_Line(The_File);
- when others =>
- Report.Failed
- ("Unexpected exception raised when Complex_IO.Get " &
- "was used to read complex data with incorrect " &
- "syntax from the Data_File, data item #" &
- Integer'Image(i));
- end;
- end loop;
-
- if TC_Verbose then
- Report.Comment("Erroneous set of complex values extracted " &
- "from data file using Complex_IO, " &
- "Procedure Process_Data_File");
- end if;
-
-
- exception
- when others =>
- Report.Failed
- ("Unexpected exception raised in Process_Data_File");
- end Process_Data_File;
-
-
-
- begin -- Test_Block.
-
- -- Place complex values into data file.
-
- Load_Data_File(Data_File);
- Text_IO.Close(Data_File);
-
- if TC_Verbose then
- Report.Comment("Data file loaded with Complex values");
- end if;
-
- -- Read complex values from data file.
-
- Text_IO.Open(Data_File, Text_IO.In_File, Data_Filename);
- Process_Data_File(Data_File);
-
- if TC_Verbose then
- Report.Comment("Complex values extracted from data file");
- end if;
-
-
-
- -- Verify versions of Procedures Put and Get for Strings.
-
- declare
- TC_String_Array : array (1..Number_Of_Complex_Items)
- of String(1..15) := (others =>(others => ' '));
- begin
-
- -- Place complex values into strings using the Procedure Put.
-
- for i in 1..Number_Of_Complex_Items loop
- C_IO.Put(To => TC_String_Array(i),
- Item => Complex_Array(i),
- Aft => 1,
- Exp => 0);
- end loop;
-
- if TC_Verbose then
- Report.Comment("Complex values placed into string array");
- end if;
-
- -- Check the format of the strings containing a complex number.
- -- The resulting strings are of 15 character length, with the
- -- real component left justified within the string, followed by
- -- a comma, and with the imaginary component and closing
- -- parenthesis right justified in the string, with blank fill
- -- for the balance of the string.
-
- if TC_String_Array(1) /= "(3.0, 9.0)" or
- TC_String_Array(2) /= "(4.0, 7.0)" or
- TC_String_Array(3) /= "(5.0, 6.0)" or
- TC_String_Array(4) /= "(6.0, 3.0)" or
- TC_String_Array(5) /= "(2.0, 5.0)" or
- TC_String_Array(6) /= "(3.0, 7.0)"
- then
- Report.Failed("Incorrect format for complex values that " &
- "have been placed into string variables " &
- "using the Complex_IO.Put procedure for " &
- "strings");
- end if;
-
- if TC_Verbose then
- Report.Comment("String format of Complex values verified");
- end if;
-
- -- Get complex values from strings using the Procedure Get.
- -- Compare with expected complex values.
-
- for i in 1..Number_Of_Complex_Items loop
-
- C_IO.Get(From => TC_String_Array(i),
- Item => TC_Complex,
- Last => TC_Last_Character_Read);
-
- if TC_Complex /= Complex_Array(i) then
- Report.Failed("Incorrect complex data value obtained " &
- "from String following use of Procedures " &
- "Put and Get from Strings, Complex_Array " &
- "item #" & Integer'Image(i));
- end if;
- end loop;
-
- if TC_Verbose then
- Report.Comment("Complex values removed from String array");
- end if;
-
- -- Verify that Layout_Error is raised if the given string is
- -- too short to hold the formatted output.
- Layout_Error_On_Put:
- declare
- Much_Too_Short : String(1..2);
- Complex_Value : Complex_Pack.Complex := (5.0, 0.0);
- begin
- C_IO.Put(Much_Too_Short, Complex_Value);
- Report.Failed("Layout_Error not raised by Procedure Put " &
- "when the given string was too short to " &
- "hold the formatted output");
- exception
- when Layout_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed
- ("Unexpected exception raised by Procedure Put when " &
- "the given string was too short to hold the " &
- "formatted output");
- end Layout_Error_On_Put;
-
- if TC_Verbose then
- Report.Comment("Layout Errors verified");
- end if;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised during the " &
- "evaluation of Put and Get for Strings");
- end;
-
-
- -- Place complex values into strings using a variety of legal
- -- complex data formats.
- declare
-
- type String_Ptr is access String;
-
- TC_Complex_String_Array :
- array (1..Number_Of_Complex_Items) of String_Ptr :=
- (new String'( "(3.0, 9.0 )" ),
- new String'( "+4.0 +7.0" ),
- new String'( "(5.0 6.0)" ),
- new String'( "6.0, 3.0" ),
- new String'( " ( 2.0 , 5.0 ) " ),
- new String'( "(3.0 7.0)" ));
-
- -- The following array contains Positive values that correspond
- -- to the last character that will be read by Procedure Get when
- -- given each of the above strings as input.
-
- TC_Last_Char_Array : array (1..Number_Of_Complex_Items)
- of Positive := (12,10,9,8,20,22);
-
- begin
-
- -- Get complex values from strings using the Procedure Get.
- -- Compare with expected complex values.
-
- for i in 1..Number_Of_Complex_Items loop
-
- C_IO.Get(TC_Complex_String_Array(i).all,
- TC_Complex,
- TC_Last_Character_Read);
-
- if TC_Complex /= Complex_Array(i) then
- Report.Failed
- ("Incorrect complex data value obtained from " &
- "Procedure Get with complex data input of: " &
- TC_Complex_String_Array(i).all);
- end if;
-
- if TC_Last_Character_Read /= TC_Last_Char_Array(i) then
- Report.Failed
- ("Incorrect value returned as the last character of " &
- "the input string processed by Procedure Get, " &
- "string value : " & TC_Complex_String_Array(i).all &
- " expected last character value read : " &
- Positive'Image(TC_Last_Char_Array(i)) &
- " last character value read : " &
- Positive'Image(TC_Last_Character_Read));
- end if;
-
- end loop;
-
- if TC_Verbose then
- Report.Comment("Complex values removed from strings and " &
- "verified against expected values");
- end if;
-
- exception
- when others =>
- Report.Failed("Unexpected exception raised during the " &
- "evaluation of Get for Strings");
- end;
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
-
- -- Delete the external file.
- if Ada.Text_IO.Is_Open(Data_File) then
- Ada.Text_IO.Delete(Data_File);
- else
- Ada.Text_IO.Open(Data_File,
- Ada.Text_IO.In_File,
- Data_Filename);
- Ada.Text_IO.Delete(Data_File);
- end if;
-
- exception
-
- -- Since Use_Error can be raised if, for the specified mode,
- -- the environment does not support Text_IO operations, the
- -- following handlers are included:
-
- when Ada.Text_IO.Use_Error =>
- Report.Not_Applicable ("Use_Error raised on Text_IO Create");
-
- when Ada.Text_IO.Name_Error =>
- Report.Not_Applicable ("Name_Error raised on Text_IO Create");
-
- when others =>
- Report.Failed ("Unexpected exception raised on text file Create");
-
- end Test_for_Text_IO_Support;
-
- Report.Result;
-
-end CXG1003;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg1004.a b/gcc/testsuite/ada/acats/tests/cxg/cxg1004.a
deleted file mode 100644
index f026eae70db..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg1004.a
+++ /dev/null
@@ -1,360 +0,0 @@
--- CXG1004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the specified exceptions are raised by the subprograms
--- defined in package Ada.Numerics.Generic_Complex_Elementary_Functions
--- given the prescribed input parameter values.
---
--- TEST DESCRIPTION:
--- This test checks that specific subprograms defined in the
--- package Ada.Numerics.Generic_Complex_Elementary_Functions raise the
--- exceptions Argument_Error and Constraint_Error when their input
--- parameter value are those specified as causing each exception.
--- In the case of Constraint_Error, the exception will be raised in
--- each test case, provided that the value of the attribute
--- 'Machine_Overflows (for the actual type of package
--- Generic_Complex_Type) is True.
---
--- APPLICABILITY CRITERIA:
--- This test only applies to implementations supporting the
--- numerics annex.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 16 Nov 95 SAIC Corrected visibility problems for ACVC 2.0.1.
--- 29 Sep 96 SAIC Incorporated reviewer comments.
--- 02 Jun 98 EDS Replace "_i" with "_One".
---!
-
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Generic_Complex_Elementary_Functions;
-with Report;
-
-procedure CXG1004 is
-begin
-
- Report.Test ("CXG1004", "Check that the specified exceptions are " &
- "raised by the subprograms defined in package " &
- "Ada.Numerics.Generic_Complex_Elementary_" &
- "Functions given the prescribed input " &
- "parameter values");
-
- Test_Block:
- declare
-
- type Real_Type is new Float;
-
- TC_Overflows : Boolean := Real_Type'Machine_Overflows;
-
- package Complex_Pack is
- new Ada.Numerics.Generic_Complex_Types(Real_Type);
-
- package CEF is
- new Ada.Numerics.Generic_Complex_Elementary_Functions(Complex_Pack);
-
- use Ada.Numerics, Complex_Pack, CEF;
-
- Complex_Zero : constant Complex := Compose_From_Cartesian(0.0, 0.0);
- Plus_One : constant Complex := Compose_From_Cartesian(1.0, 0.0);
- Minus_One : constant Complex := Compose_From_Cartesian(-1.0, 0.0);
- Plus_i : constant Complex := Compose_From_Cartesian(i);
- Minus_i : constant Complex := Compose_From_Cartesian(-i);
-
- Complex_Negative_Real : constant Complex :=
- Compose_From_Cartesian(-4.0, 2.0);
- Complex_Negative_Imaginary : constant Complex :=
- Compose_From_Cartesian(3.0, -5.0);
-
- TC_Complex : Complex;
-
-
- -- This procedure is used in "Exception Raising" calls below in an
- -- attempt to avoid elimination of the subtest through optimization.
-
- procedure No_Optimize (The_Complex_Number : Complex) is
- begin
- Report.Comment("No Optimize: Should never be printed " &
- Integer'Image(Integer(The_Complex_Number.Im)));
- end No_Optimize;
-
-
- begin
-
- -- Check that the exception Numerics.Argument_Error is raised by the
- -- exponentiation operator when the value of the left operand is zero,
- -- and the real component of the exponent (or the exponent itself) is
- -- zero.
-
- begin
- TC_Complex := "**"(Left => Complex_Zero, Right => Complex_Zero);
- Report.Failed("Argument_Error not raised by exponentiation " &
- "operator, left operand = complex zero, right " &
- "operand = complex zero");
- No_Optimize(TC_Complex);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by exponentiation " &
- "operator, left operand = complex zero, right " &
- "operand = complex zero");
- end;
-
- begin
- TC_Complex := Complex_Zero**0.0;
- Report.Failed("Argument_Error not raised by exponentiation " &
- "operator, left operand = complex zero, right " &
- "operand = real zero");
- No_Optimize(TC_Complex);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by exponentiation " &
- "operator, left operand = complex zero, right " &
- "operand = real zero");
- end;
-
-
- begin
- TC_Complex := "**"(Left => 0.0, Right => Complex_Zero);
- Report.Failed("Argument_Error not raised by exponentiation " &
- "operator, left operand = real zero, right " &
- "operand = complex zero");
- No_Optimize(TC_Complex);
- exception
- when Argument_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised by exponentiation " &
- "operator, left operand = real zero, right " &
- "operand = complex zero");
- end;
-
-
- -- Check that the exception Constraint_Error is raised under the
- -- specified circumstances, provided that
- -- Complex_Types.Real'Machine_Overflows is True.
-
- if TC_Overflows then
-
- -- Raised by Log, when the value of the parameter X is zero.
- begin
- TC_Complex := Log (X => Complex_Zero);
- Report.Failed("Constraint_Error not raised when Function " &
- "Log given parameter value of complex zero");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Log given parameter value of complex zero");
- end;
-
- -- Raised by Cot, when the value of the parameter X is zero.
- begin
- TC_Complex := Cot (X => Complex_Zero);
- Report.Failed("Constraint_Error not raised when Function " &
- "Cot given parameter value of complex zero");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Cot given parameter value of complex zero");
- end;
-
- -- Raised by Coth, when the value of the parameter X is zero.
- begin
- TC_Complex := Coth (Complex_Zero);
- Report.Failed("Constraint_Error not raised when Function " &
- "Coth given parameter value of complex zero");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Coth given parameter value of complex zero");
- end;
-
- -- Raised by the exponentiation operator, when the value of the
- -- left operand is zero and the real component of the exponent
- -- is negative.
- begin
- TC_Complex := Complex_Zero**Complex_Negative_Real;
- Report.Failed("Constraint_Error not raised when the " &
- "exponentiation operator left operand is " &
- "complex zero, and the real component of " &
- "the exponent is negative");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when the " &
- "exponentiation operator left operand is " &
- "complex zero, and the real component of " &
- "the exponent is negative");
- end;
-
- -- Raised by the exponentiation operator, when the value of the
- -- left operand is zero and the exponent itself (when it is of
- -- type real) is negative.
- declare
- Negative_Exponent : constant Real_Type := -4.0;
- begin
- TC_Complex := Complex_Zero**Negative_Exponent;
- Report.Failed("Constraint_Error not raised when the " &
- "exponentiation operator left operand is " &
- "complex zero, and the real exponent is " &
- "negative");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when the " &
- "exponentiation operator left operand is " &
- "complex zero, and the real exponent is " &
- "negative");
- end;
-
- -- Raised by Arctan, when the value of the parameter is +i.
- begin
- TC_Complex := Arctan (Plus_i);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arctan is given parameter value +i");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arctan is given parameter value +i");
- end;
-
- -- Raised by Arctan, when the value of the parameter is -i.
- begin
- TC_Complex := Arctan (Minus_i);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arctan is given parameter value -i");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arctan is given parameter value -i");
- end;
-
- -- Raised by Arccot, when the value of the parameter is +i.
- begin
- TC_Complex := Arccot (Plus_i);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arccot is given parameter value +i");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arccot is given parameter value +i");
- end;
-
- -- Raised by Arccot, when the value of the parameter is -i.
- begin
- TC_Complex := Arccot (Minus_i);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arccot is given parameter value -i");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arccot is given parameter value -i");
- end;
-
- -- Raised by Arctanh, when the value of the parameter is +1.
- begin
- TC_Complex := Arctanh (Plus_One);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arctanh is given parameter value +1");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arctanh is given parameter value +1");
- end;
-
- -- Raised by Arctanh, when the value of the parameter is -1.
- begin
- TC_Complex := Arctanh (Minus_One);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arctanh is given parameter value -1");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arctanh is given parameter value -1");
- end;
-
- -- Raised by Arccoth, when the value of the parameter is +1.
- begin
- TC_Complex := Arccoth (Plus_One);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arccoth is given parameter value +1");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arccoth is given parameter value +1");
- end;
-
- -- Raised by Arccoth, when the value of the parameter is -1.
- begin
- TC_Complex := Arccoth (Minus_One);
- Report.Failed("Constraint_Error not raised when Function " &
- "Arccoth is given parameter value -1");
- No_Optimize(TC_Complex);
- exception
- when Constraint_Error => null; -- OK, expected exception.
- when others =>
- Report.Failed("Incorrect exception raised when Function " &
- "Arccoth is given parameter value -1");
- end;
-
- else
- Report.Comment
- ("Attribute Complex_Pack.Real'Machine_Overflows is False; " &
- "evaluation of the complex elementary functions under " &
- "specified circumstances was not performed");
- end if;
-
-
- exception
- when others =>
- Report.Failed ("Unexpected exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXG1004;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg1005.a b/gcc/testsuite/ada/acats/tests/cxg/cxg1005.a
deleted file mode 100644
index 6faad4e1357..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg1005.a
+++ /dev/null
@@ -1,393 +0,0 @@
--- CXG1005.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the subprograms defined in the package
--- Ada.Numerics.Generic_Complex_Elementary_Functions provide correct
--- results.
---
--- TEST DESCRIPTION:
--- This test checks that specific subprograms defined in the generic
--- package Generic_Complex_Elementary_Functions are available, and that
--- they provide prescribed results given specific input values.
--- The generic package Ada.Numerics.Generic_Complex_Types is instantiated
--- with a real type (new Float). The resulting new package is used as
--- the generic actual to package Complex_IO.
---
--- SPECIAL REQUIREMENTS:
--- Implementations for which Float'Signed_Zeros is True must provide
--- a body for ImpDef.Annex_G.Negative_Zero which returns a negative
--- zero.
---
--- APPLICABILITY CRITERIA
--- This test only applies to implementations that support the
--- numerics annex.
---
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 16 Nov 95 SAIC Corrected visibility problems for ACVC 2.0.1.
--- 21 Feb 96 SAIC Incorporated new structure for package Impdef.
--- 29 Sep 96 SAIC Incorporated reviewer comments.
---
---!
-
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Generic_Complex_Elementary_Functions;
-with ImpDef.Annex_G;
-with Report;
-
-procedure CXG1005 is
-begin
-
- Report.Test ("CXG1005", "Check that the subprograms defined in " &
- "the package Generic_Complex_Elementary_" &
- "Functions provide correct results");
-
- Test_Block:
- declare
-
- type Real_Type is new Float;
-
- TC_Signed_Zeros : Boolean := Real_Type'Signed_Zeros;
-
- package Complex_Pack is new
- Ada.Numerics.Generic_Complex_Types(Real_Type);
-
- package CEF is
- new Ada.Numerics.Generic_Complex_Elementary_Functions(Complex_Pack);
-
- use Ada.Numerics, Complex_Pack, CEF;
-
- Complex_Zero : constant Complex := Compose_From_Cartesian( 0.0, 0.0);
- Plus_One : constant Complex := Compose_From_Cartesian( 1.0, 0.0);
- Minus_One : constant Complex := Compose_From_Cartesian(-1.0, 0.0);
- Plus_i : constant Complex := Compose_From_Cartesian(i);
- Minus_i : constant Complex := Compose_From_Cartesian(-i);
-
- Complex_Positive_Real : constant Complex :=
- Compose_From_Cartesian(4.0, 2.0);
- Complex_Positive_Imaginary : constant Complex :=
- Compose_From_Cartesian(3.0, 5.0);
- Complex_Negative_Real : constant Complex :=
- Compose_From_Cartesian(-4.0, 2.0);
- Complex_Negative_Imaginary : constant Complex :=
- Compose_From_Cartesian(3.0, -5.0);
-
-
- function A_Zero_Result (Z : Complex) return Boolean is
- begin
- return (Re(Z) = 0.0 and Im(Z) = 0.0);
- end A_Zero_Result;
-
-
- -- In order to evaluate complex elementary functions that are
- -- prescribed to return a "real" result (meaning that the imaginary
- -- component is zero), the Function A_Real_Result is defined.
-
- function A_Real_Result (Z : Complex) return Boolean is
- begin
- return Im(Z) = 0.0;
- end A_Real_Result;
-
-
- -- In order to evaluate complex elementary functions that are
- -- prescribed to return an "imaginary" result (meaning that the real
- -- component of the complex number is zero, and the imaginary
- -- component is non-zero), the Function An_Imaginary_Result is defined.
-
- function An_Imaginary_Result (Z : Complex) return Boolean is
- begin
- return (Re(Z) = 0.0 and Im(Z) /= 0.0);
- end An_Imaginary_Result;
-
-
- begin
-
- -- Check that when the input parameter value is zero, the following
- -- functions yield a zero result.
-
- if not A_Zero_Result( Sqrt(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Sqrt with zero input");
- end if;
-
- if not A_Zero_Result( Sin(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Sin with zero input");
- end if;
-
- if not A_Zero_Result( Arcsin(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Arcsin with zero " &
- "input");
- end if;
-
- if not A_Zero_Result( Tan(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Tan with zero input");
- end if;
-
- if not A_Zero_Result( Arctan(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Arctan with zero " &
- "input");
- end if;
-
- if not A_Zero_Result( Sinh(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Sinh with zero input");
- end if;
-
- if not A_Zero_Result( Arcsinh(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Arcsinh with zero " &
- "input");
- end if;
-
- if not A_Zero_Result( Tanh(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Tanh with zero input");
- end if;
-
- if not A_Zero_Result( Arctanh(Complex_Zero) ) then
- Report.Failed("Non-zero result from Function Arctanh with zero " &
- "input");
- end if;
-
-
- -- Check that when the input parameter value is zero, the following
- -- functions yield a result of one.
-
- if Exp(Complex_Zero) /= Plus_One
- then
- Report.Failed("Non-zero result from Function Exp with zero input");
- end if;
-
- if Cos(Complex_Zero) /= Plus_One
- then
- Report.Failed("Non-zero result from Function Cos with zero input");
- end if;
-
- if Cosh(Complex_Zero) /= Plus_One
- then
- Report.Failed("Non-zero result from Function Cosh with zero input");
- end if;
-
-
- -- Check that when the input parameter value is zero, the following
- -- functions yield a real result.
-
- if not A_Real_Result( Arccos(Complex_Zero) ) then
- Report.Failed("Non-real result from Function Arccos with zero input");
- end if;
-
- if not A_Real_Result( Arccot(Complex_Zero) ) then
- Report.Failed("Non-real result from Function Arccot with zero input");
- end if;
-
-
- -- Check that when the input parameter value is zero, the following
- -- functions yield an imaginary result.
-
- if not An_Imaginary_Result( Arccoth(Complex_Zero) ) then
- Report.Failed("Non-imaginary result from Function Arccoth with " &
- "zero input");
- end if;
-
-
- -- Check that when the input parameter value is one, the Sqrt function
- -- yields a result of one.
-
- if Sqrt(Plus_One) /= Plus_One then
- Report.Failed("Incorrect result from Function Sqrt with input " &
- "value of one");
- end if;
-
-
- -- Check that when the input parameter value is one, the following
- -- functions yield a result of zero.
-
- if not A_Zero_Result( Log(Plus_One) ) then
- Report.Failed("Non-zero result from Function Log with input " &
- "value of one");
- end if;
-
- if not A_Zero_Result( Arccos(Plus_One) ) then
- Report.Failed("Non-zero result from Function Arccos with input " &
- "value of one");
- end if;
-
- if not A_Zero_Result( Arccosh(Plus_One) ) then
- Report.Failed("Non-zero result from Function Arccosh with input " &
- "value of one");
- end if;
-
-
- -- Check that when the input parameter value is one, the Arcsin
- -- function yields a real result.
-
- if not A_Real_Result( Arcsin(Plus_One) ) then
- Report.Failed("Non-real result from Function Arcsin with input " &
- "value of one");
- end if;
-
-
- -- Check that when the input parameter value is minus one, the Sqrt
- -- function yields a result of "i", when the sign of the imaginary
- -- component of the input parameter is positive (and yields "-i", if
- -- the sign on the imaginary component is negative), and the
- -- Complex_Types.Real'Signed_Zeros attribute is True.
-
- if TC_Signed_Zeros then
-
- declare
- Minus_One_With_Pos_Zero_Im_Component : Complex :=
- Compose_From_Cartesian(-1.0, +0.0);
- Minus_One_With_Neg_Zero_Im_Component : Complex :=
- Compose_From_Cartesian
- (-1.0, Real_Type(ImpDef.Annex_G.Negative_Zero));
- begin
-
- if Sqrt(Minus_One_With_Pos_Zero_Im_Component) /= Plus_i then
- Report.Failed("Incorrect result from Function Sqrt, when " &
- "input value is minus one with a positive " &
- "imaginary component, Signed_Zeros being True");
- end if;
-
- if Sqrt(Minus_One_With_Neg_Zero_Im_Component) /= Minus_i then
- Report.Failed("Incorrect result from Function Sqrt, when " &
- "input value is minus one with a negative " &
- "imaginary component, Signed_Zeros being True");
- end if;
- end;
-
- else -- Signed_Zeros is False.
-
- -- Check that when the input parameter value is minus one, the Sqrt
- -- function yields a result of "i", when the
- -- Complex_Types.Real'Signed_Zeros attribute is False.
-
- if Sqrt(Minus_One) /= Plus_i then
- Report.Failed("Incorrect result from Function Sqrt, when " &
- "input value is minus one, Signed_Zeros being " &
- "False");
- end if;
-
- end if;
-
-
- -- Check that when the input parameter value is minus one, the Log
- -- function yields an imaginary result.
-
- if not An_Imaginary_Result( Log(Minus_One) ) then
- Report.Failed("Non-imaginary result from Function Log with a " &
- "minus one input value");
- end if;
-
- -- Check that when the input parameter is minus one, the following
- -- functions yield a real result.
-
- if not A_Real_Result( Arcsin(Minus_One) ) then
- Report.Failed("Non-real result from Function Arcsin with a " &
- "minus one input value");
- end if;
-
- if not A_Real_Result( Arccos(Minus_One) ) then
- Report.Failed("Non-real result from Function Arccos with a " &
- "minus one input value");
- end if;
-
-
- -- Check that when the input parameter has a value of +i or -i, the
- -- Log function yields an imaginary result.
-
- if not An_Imaginary_Result( Log(Plus_i) ) then
- Report.Failed("Non-imaginary result from Function Log with an " &
- "input value of ""+i""");
- end if;
-
- if not An_Imaginary_Result( Log(Minus_i) ) then
- Report.Failed("Non-imaginary result from Function Log with an " &
- "input value of ""-i""");
- end if;
-
-
- -- Check that exponentiation by a zero exponent yields the value one.
-
- if "**"(Left => Compose_From_Cartesian(5.0, 3.0),
- Right => Complex_Zero) /= Plus_One or
- Complex_Negative_Real**0.0 /= Plus_One or
- 15.0**Complex_Zero /= Plus_One
- then
- Report.Failed("Incorrect result from exponentiation with a zero " &
- "exponent");
- end if;
-
-
- -- Check that exponentiation by a unit exponent yields the value of
- -- the left operand (as a complex value).
- -- Note: a "unit exponent" is considered the complex number (1.0, 0.0)
-
- if "**"(Complex_Negative_Real, Plus_One) /=
- Complex_Negative_Real or
- Complex_Negative_Imaginary**Plus_One /=
- Complex_Negative_Imaginary or
- 4.0**Plus_One /=
- Compose_From_Cartesian(4.0, 0.0)
- then
- Report.Failed("Incorrect result from exponentiation with a unit " &
- "exponent");
- end if;
-
-
- -- Check that exponentiation of the value one yields the value one.
-
- if "**"(Plus_One, Complex_Negative_Imaginary) /= Plus_One or
- Plus_One**9.0 /= Plus_One or
- 1.0**Complex_Negative_Real /= Plus_One
- then
- Report.Failed("Incorrect result from exponentiation of the value " &
- "One");
- end if;
-
-
- -- Check that exponentiation of the value zero yields the value zero.
- begin
- if not A_Zero_Result("**"(Complex_Zero,
- Complex_Positive_Imaginary)) or
- not A_Zero_Result(Complex_Zero**4.0) or
- not A_Zero_Result(0.0**Complex_Positive_Real)
- then
- Report.Failed("Incorrect result from exponentiation of the " &
- "value zero");
- end if;
- exception
- when others =>
- Report.Failed("Exception raised during the exponentiation of " &
- "the complex value zero");
- end;
-
-
- exception
- when others => Report.Failed ("Exception raised in Test_Block");
- end Test_Block;
-
- Report.Result;
-
-end CXG1005;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2001.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2001.a
deleted file mode 100644
index 0d7afa46091..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2001.a
+++ /dev/null
@@ -1,322 +0,0 @@
--- CXG2001.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the floating point attributes Model_Mantissa,
--- Machine_Mantissa, Machine_Radix, and Machine_Rounds
--- are properly reported.
---
--- TEST DESCRIPTION:
--- This test uses a generic package to compute and check the
--- values of the Machine_ attributes listed above. The
--- generic package is instantiated with the standard FLOAT
--- type and a floating point type for the maximum number
--- of digits of precision.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
---
---
--- CHANGE HISTORY:
--- 26 JAN 96 SAIC Initial Release for 2.1
---
---!
-
--- References:
---
--- "Algorithms To Reveal Properties of Floating-Point Arithmetic"
--- Michael A. Malcolm; CACM November 1972; pgs 949-951.
---
--- Software Manual for Elementary Functions; W. J. Cody and W. Waite;
--- Prentice-Hall; 1980
------------------------------------------------------------------------
---
--- This test relies upon the fact that
--- (A+2.0)-A is not necessarily 2.0. If A is large enough then adding
--- a small value to A does not change the value of A. Consider the case
--- where we have a decimal based floating point representation with 4
--- digits of precision. A floating point number would logically be
--- represented as "DDDD * 10 ** exp" where D is a value in the range 0..9.
--- The first loop of the test starts A at 2.0 and doubles it until
--- ((A+1.0)-A)-1.0 is no longer zero. For our decimal floating point
--- number this will be 1638 * 10**1 (the value 16384 rounded or truncated
--- to fit in 4 digits).
--- The second loop starts B at 2.0 and keeps doubling B until (A+B)-A is
--- no longer 0. This will keep looping until B is 8.0 because that is
--- the first value where rounding (assuming our machine rounds and addition
--- employs a guard digit) will change the upper 4 digits of the result:
--- 1638_
--- + 8
--- -------
--- 1639_
--- Without rounding the second loop will continue until
--- B is 16:
--- 1638_
--- + 16
--- -------
--- 1639_
---
--- The radix is then determined by (A+B)-A which will give 10.
---
--- The use of Tmp and ITmp in the test is to force values to be
--- stored into memory in the event that register precision is greater
--- than the stored precision of the floating point values.
---
---
--- The test for rounding is (ignoring the temporary variables used to
--- get the stored precision) is
--- Rounds := A + Radix/2.0 - A /= 0.0 ;
--- where A is the value determined in the first step that is the smallest
--- power of 2 such that A + 1.0 = A. This means that the true value of
--- A has one more digit in its value than 'Machine_Mantissa.
--- This check will detect the case where a value is always rounded.
--- There is an additional case where values are rounded to the nearest
--- even value. That is referred to as IEEE style rounding in the test.
---
------------------------------------------------------------------------
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2001 is
- Verbose : constant Boolean := False;
-
- -- if one of the attribute computation loops exceeds Max_Iterations
- -- it is most likely due to the compiler reordering an expression
- -- that should not be reordered.
- Illegal_Optimization : exception;
- Max_Iterations : constant := 10_000;
-
- generic
- type Real is digits <>;
- package Chk_Attrs is
- procedure Do_Test;
- end Chk_Attrs;
-
- package body Chk_Attrs is
- package EF is new Ada.Numerics.Generic_Elementary_Functions (Real);
- function Log (X : Real) return Real renames EF.Log;
-
-
- -- names used in paper
- Radix : Integer; -- Beta
- Mantissa_Digits : Integer; -- t
- Rounds : Boolean; -- RND
-
- -- made global to Determine_Attributes to help thwart optimization
- A, B : Real := 2.0;
- Tmp, Tmpa, Tmp1 : Real;
- ITmp : Integer;
- Half_Radix : Real;
-
- -- special constants - not declared as constants so that
- -- the "stored" precision will be used instead of a "register"
- -- precision.
- Zero : Real := 0.0;
- One : Real := 1.0;
- Two : Real := 2.0;
-
-
- procedure Thwart_Optimization is
- -- the purpose of this procedure is to reference the
- -- global variables used by Determine_Attributes so
- -- that the compiler is not likely to keep them in
- -- a higher precision register for their entire lifetime.
- begin
- if Report.Ident_Bool (False) then
- -- never executed
- A := A + 5.0;
- B := B + 6.0;
- Tmp := Tmp + 1.0;
- Tmp1 := Tmp1 + 2.0;
- Tmpa := Tmpa + 2.0;
- One := 12.34; Two := 56.78; Zero := 90.12;
- end if;
- end Thwart_Optimization;
-
-
- -- determines values for Radix, Mantissa_Digits, and Rounds
- -- This is mostly a straight translation of the C code.
- -- The only significant addition is the iteration count
- -- to prevent endless looping if things are really screwed up.
- procedure Determine_Attributes is
- Iterations : Integer;
- begin
- Rounds := True;
-
- Iterations := 0;
- Tmp := Real'Machine (((A + One) - A) - One);
- while Tmp = Zero loop
- A := Real'Machine(A + A);
- Tmp := Real'Machine(A + One);
- Tmp1 := Real'Machine(Tmp - A);
- Tmp := Real'Machine(Tmp1 - One);
-
- Iterations := Iterations + 1;
- if Iterations > Max_Iterations then
- raise Illegal_Optimization;
- end if;
- end loop;
-
- Iterations := 0;
- Tmp := Real'Machine(A + B);
- ITmp := Integer (Tmp - A);
- while ITmp = 0 loop
- B := Real'Machine(B + B);
- Tmp := Real'Machine(A + B);
- ITmp := Integer (Tmp - A);
-
- Iterations := Iterations + 1;
- if Iterations > Max_Iterations then
- raise Illegal_Optimization;
- end if;
- end loop;
-
- Radix := ITmp;
-
- Mantissa_Digits := 0;
- B := 1.0;
- Tmp := Real'Machine(((B + One) - B) - One);
- Iterations := 0;
- while (Tmp = Zero) loop
- Mantissa_Digits := Mantissa_Digits + 1;
- B := B * Real (Radix);
- Tmp := Real'Machine(B + One);
- Tmp1 := Real'Machine(Tmp - B);
- Tmp := Real'Machine(Tmp1 - One);
-
- Iterations := Iterations + 1;
- if Iterations > Max_Iterations then
- raise Illegal_Optimization;
- end if;
- end loop;
-
- Rounds := False;
- Half_Radix := Real (Radix) / Two;
- Tmp := Real'Machine(A + Half_Radix);
- Tmp1 := Real'Machine(Tmp - A);
- if (Tmp1 /= Zero) then
- Rounds := True;
- end if;
- Tmpa := Real'Machine(A + Real (Radix));
- Tmp := Real'Machine(Tmpa + Half_Radix);
- if not Rounds and (Tmp - TmpA /= Zero) then
- Rounds := True;
- if Verbose then
- Report.Comment ("IEEE style rounding");
- end if;
- end if;
-
- exception
- when others =>
- Thwart_Optimization;
- raise;
- end Determine_Attributes;
-
-
- procedure Do_Test is
- Show_Results : Boolean := Verbose;
- Min_Mantissa_Digits : Integer;
- begin
- -- compute the actual Machine_* attribute values
- Determine_Attributes;
-
- if Real'Machine_Radix /= Radix then
- Report.Failed ("'Machine_Radix incorrectly reports" &
- Integer'Image (Real'Machine_Radix));
- Show_Results := True;
- end if;
-
- if Real'Machine_Mantissa /= Mantissa_Digits then
- Report.Failed ("'Machine_Mantissa incorrectly reports" &
- Integer'Image (Real'Machine_Mantissa));
- Show_Results := True;
- end if;
-
- if Real'Machine_Rounds /= Rounds then
- Report.Failed ("'Machine_Rounds incorrectly reports " &
- Boolean'Image (Real'Machine_Rounds));
- Show_Results := True;
- end if;
-
- if Show_Results then
- Report.Comment ("computed Machine_Mantissa is" &
- Integer'Image (Mantissa_Digits));
- Report.Comment ("computed Radix is" &
- Integer'Image (Radix));
- Report.Comment ("computed Rounds is " &
- Boolean'Image (Rounds));
- end if;
-
- -- check the model attributes against the machine attributes
- -- G.2.2(3)/3;6.0
- if Real'Model_Mantissa > Real'Machine_Mantissa then
- Report.Failed ("model mantissa > machine mantissa");
- end if;
-
- -- G.2.2(3)/2;6.0
- -- 'Model_Mantissa >= ceiling(d*log(10)/log(radix))+1
- Min_Mantissa_Digits :=
- Integer (
- Real'Ceiling (
- Real(Real'Digits) * Log(10.0) / Log(Real(Real'Machine_Radix))
- ) ) + 1;
- if Real'Model_Mantissa < Min_Mantissa_Digits then
- Report.Failed ("Model_Mantissa [" &
- Integer'Image (Real'Model_Mantissa) &
- "] < minimum mantissa digits [" &
- Integer'Image (Min_Mantissa_Digits) &
- "]");
- end if;
-
- exception
- when Illegal_Optimization =>
- Report.Failed ("illegal optimization of" &
- " floating point expression");
- end Do_Test;
- end Chk_Attrs;
-
- package Chk_Float is new Chk_Attrs (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package Chk_A_Long_Float is new Chk_Attrs (A_Long_Float);
-begin
- Report.Test ("CXG2001",
- "Check the attributes Model_Mantissa," &
- " Machine_Mantissa, Machine_Radix," &
- " and Machine_Rounds");
-
- Report.Comment ("checking Standard.Float");
- Chk_Float.Do_Test;
-
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- Chk_A_Long_Float.Do_Test;
-
- Report.Result;
-end CXG2001;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2002.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2002.a
deleted file mode 100644
index 6a1f322e8bf..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2002.a
+++ /dev/null
@@ -1,468 +0,0 @@
--- CXG2002.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex "abs" or modulus function returns
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test uses a generic package to compute and check the
--- values of the modulus function. In addition, a non-generic
--- copy of this package is used to check the non-generic package
--- Ada.Numerics.Complex_Types.
--- Of special interest is the case where either the real or
--- the imaginary part of the argument is very large while the
--- other part is very small or 0.
--- We want to check that the value is computed such that
--- an overflow does not occur. If computed directly from the
--- definition
--- abs (x+yi) = sqrt(x**2 + y**2)
--- then overflow or underflow is much more likely than if the
--- argument is normalized first.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 31 JAN 96 SAIC Initial release for 2.1
--- 02 JUN 98 EDS Add parens to intermediate calculations.
---!
-
---
--- Reference:
--- Problems and Methodologies in Mathematical Software Production;
--- editors: P. C. Messina and A Murli;
--- Lecture Notes in Computer Science
--- Volume 142
--- Springer Verlag 1982
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Complex_Types;
-procedure CXG2002 is
- Verbose : constant Boolean := False;
- Maximum_Relative_Error : constant := 3.0;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Complex_Types is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real := Maximum_Relative_Error) is
- Rel_Error,
- Abs_Error,
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * (abs Expected * Real'Model_Epsilon);
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Expected - Actual) &
- " max_err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Do_Test is
- Z : Complex;
- X : Real;
- T : Real;
- begin
-
- --- test 1 ---
- begin
- T := Real'Safe_Last;
- Z := T + 0.0*i;
- X := abs Z;
- Check (X, T, "test 1 -- abs(bigreal + 0i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- begin
- T := Real'Safe_Last;
- Z := 0.0 + T*i;
- X := Modulus (Z);
- Check (X, T, "test 2 -- abs(0 + bigreal*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- begin
- Z := 3.0 + 4.0*i;
- X := abs Z;
- Check (X, 5.0 , "test 3 -- abs(3 + 4*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- S : Real;
- begin
- S := Real(Real'Machine_Radix) ** (Real'Machine_EMax - 3);
- Z := 3.0 * S + 4.0*S*i;
- X := abs Z;
- Check (X, 5.0*S, "test 4 -- abs(3S + 4S*i) for large S",
- 5.0*Real'Model_Epsilon);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- begin
- T := Real'Model_Small;
- Z := T + 0.0*i;
- X := abs Z;
- Check (X, T , "test 5 -- abs(small + 0*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- begin
- T := Real'Model_Small;
- Z := 0.0 + T*i;
- X := abs Z;
- Check (X, T , "test 6 -- abs(0 + small*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 ---
- declare
- S : Real;
- begin
- S := Real(Real'Machine_Radix) ** (Real'Model_EMin + 3);
- Z := 3.0 * S + 4.0*S*i;
- X := abs Z;
- Check (X, 5.0*S, "test 7 -- abs(3S + 4S*i) for small S",
- 5.0*Real'Model_Epsilon);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 7");
- when others =>
- Report.Failed ("exception in test 7");
- end;
-
- --- test 8 ---
- declare
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- begin
- Z := 1.0 + 1.0*i;
- X := abs Z;
- Check (X, Sqrt2 , "test 8 -- abs(1 + 1*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 8");
- when others =>
- Report.Failed ("exception in test 8");
- end;
-
- --- test 9 ---
- begin
- T := 0.0;
- Z := T + 0.0*i;
- X := abs Z;
- Check (X, T , "test 5 -- abs(0 + 0*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 9");
- when others =>
- Report.Failed ("exception in test 9");
- end;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- --- non generic copy of the above generic package
- -----------------------------------------------------------------------
-
- package Non_Generic_Check is
- subtype Real is Float;
- procedure Do_Test;
- end Non_Generic_Check;
-
- package body Non_Generic_Check is
- use Ada.Numerics.Complex_Types;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real := Maximum_Relative_Error) is
- Rel_Error,
- Abs_Error,
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * (abs Expected * Real'Model_Epsilon);
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Expected - Actual) &
- " max_err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Do_Test is
- Z : Complex;
- X : Real;
- T : Real;
- begin
-
- --- test 1 ---
- begin
- T := Real'Safe_Last;
- Z := T + 0.0*i;
- X := abs Z;
- Check (X, T, "test 1 -- abs(bigreal + 0i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- begin
- T := Real'Safe_Last;
- Z := 0.0 + T*i;
- X := Modulus (Z);
- Check (X, T, "test 2 -- abs(0 + bigreal*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- begin
- Z := 3.0 + 4.0*i;
- X := abs Z;
- Check (X, 5.0 , "test 3 -- abs(3 + 4*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- S : Real;
- begin
- S := Real(Real'Machine_Radix) ** (Real'Machine_EMax - 3);
- Z := 3.0 * S + 4.0*S*i;
- X := abs Z;
- Check (X, 5.0*S, "test 4 -- abs(3S + 4S*i) for large S",
- 5.0*Real'Model_Epsilon);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- begin
- T := Real'Model_Small;
- Z := T + 0.0*i;
- X := abs Z;
- Check (X, T , "test 5 -- abs(small + 0*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- begin
- T := Real'Model_Small;
- Z := 0.0 + T*i;
- X := abs Z;
- Check (X, T , "test 6 -- abs(0 + small*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 ---
- declare
- S : Real;
- begin
- S := Real(Real'Machine_Radix) ** (Real'Model_EMin + 3);
- Z := 3.0 * S + 4.0*S*i;
- X := abs Z;
- Check (X, 5.0*S, "test 7 -- abs(3S + 4S*i) for small S",
- 5.0*Real'Model_Epsilon);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 7");
- when others =>
- Report.Failed ("exception in test 7");
- end;
-
- --- test 8 ---
- declare
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- begin
- Z := 1.0 + 1.0*i;
- X := abs Z;
- Check (X, Sqrt2 , "test 8 -- abs(1 + 1*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 8");
- when others =>
- Report.Failed ("exception in test 8");
- end;
-
- --- test 9 ---
- begin
- T := 0.0;
- Z := T + 0.0*i;
- X := abs Z;
- Check (X, T , "test 5 -- abs(0 + 0*i)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 9");
- when others =>
- Report.Failed ("exception in test 9");
- end;
- end Do_Test;
- end Non_Generic_Check;
-
- -----------------------------------------------------------------------
- --- end of "manual instantiation"
- -----------------------------------------------------------------------
- package Chk_Float is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package Chk_A_Long_Float is new Generic_Check (A_Long_Float);
-begin
- Report.Test ("CXG2002",
- "Check the accuracy of the complex modulus" &
- " function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
- Chk_Float.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
- Chk_A_Long_Float.Do_Test;
-
- if Verbose then
- Report.Comment ("checking non-generic package");
- end if;
- Non_Generic_Check.Do_Test;
- Report.Result;
-end CXG2002;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2003.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2003.a
deleted file mode 100644
index d1a225a50a1..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2003.a
+++ /dev/null
@@ -1,701 +0,0 @@
--- CXG2003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the sqrt function returns
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test contains three test packages that are almost
--- identical. The first two packages differ only in the
--- floating point type that is being tested. The first
--- and third package differ only in whether the generic
--- elementary functions package or the pre-instantiated
--- package is used.
--- The test package is not generic so that the arguments
--- and expected results for some of the test values
--- can be expressed as universal real instead of being
--- computed at runtime.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 2 FEB 96 SAIC Initial release for 2.1
--- 18 AUG 96 SAIC Made Check consistent with other tests.
---
---!
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-with Ada.Numerics.Elementary_Functions;
-procedure CXG2003 is
- Verbose : constant Boolean := False;
-
- package Float_Check is
- subtype Real is Float;
- procedure Do_Test;
- end Float_Check;
-
- package body Float_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames
- Elementary_Functions.Sqrt;
- function Log (X : Real) return Real renames
- Elementary_Functions.Log;
- function Exp (X : Real) return Real renames
- Elementary_Functions.Exp;
-
- -- The default Maximum Relative Error is the value specified
- -- in the LRM.
- Default_MRE : constant Real := 2.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real := Default_MRE) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Actual - Expected) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Argument_Range_Check (A, B : Real;
- Test : String) is
- -- test a logarithmically distributed selection of
- -- arguments selected from the range A to B.
- X : Real;
- Expected : Real;
- Y : Real;
- C : Real := Log(B/A);
- Max_Samples : constant := 1000;
-
- begin
- for I in 1..Max_Samples loop
- Expected := A * Exp(C * Real (I) / Real (Max_Samples));
- X := Expected * Expected;
- Y := Sqrt (X);
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (Y, Expected,
- "test " & Test & " -" &
- Integer'Image (I) &
- " of argument range",
- 3.0);
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check");
- when others =>
- Report.Failed ("exception in argument range check");
- end Argument_Range_Check;
-
- procedure Do_Test is
- begin
-
- --- test 1 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- X : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- Expected : constant := (1.0 * Real'Machine_Radix) ** T;
- Y : Real;
- begin
- Y := Sqrt (X);
- Check (Y, Expected, "test 1 -- sqrt(radix**((emax-1)/2))");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- T : constant := (Real'Model_EMin + 1) / 2;
- X : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- Expected : constant := (1.0 * Real'Machine_Radix) ** T;
- Y : Real;
- begin
- Y := Sqrt (X);
- Check (Y, Expected, "test 2 -- sqrt(radix**((emin+1)/2))");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- X : constant := 1.0;
- Expected : constant := 1.0;
- Y : Real;
- begin
- Y := Sqrt(X);
- Check (Y, Expected, "test 3 -- sqrt(1.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- X : constant := 0.0;
- Expected : constant := 0.0;
- Y : Real;
- begin
- Y := Sqrt(X);
- Check (Y, Expected, "test 4 -- sqrt(0.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- declare
- X : constant := -1.0;
- Y : Real;
- begin
- Y := Sqrt(X);
- -- the following code should not be executed.
- -- The call to Check is to keep the call to Sqrt from
- -- appearing to be dead code.
- Check (Y, -1.0, "test 5 -- sqrt(-1)" );
- Report.Failed ("test 5 - argument_error expected");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when Ada.Numerics.Argument_Error =>
- if Verbose then
- Report.Comment ("test 5 correctly got argument_error");
- end if;
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- declare
- X : constant := Ada.Numerics.Pi ** 2;
- Expected : constant := Ada.Numerics.Pi;
- Y : Real;
- begin
- Y := Sqrt (X);
- Check (Y, Expected, "test 6 -- sqrt(pi**2)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 & 8 ---
- Argument_Range_Check (1.0/Sqrt(Real(Real'Machine_Radix)),
- 1.0,
- "7");
- Argument_Range_Check (1.0,
- Sqrt(Real(Real'Machine_Radix)),
- "8");
- end Do_Test;
- end Float_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
-
-
- package A_Long_Float_Check is
- subtype Real is A_Long_Float;
- procedure Do_Test;
- end A_Long_Float_Check;
-
- package body A_Long_Float_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames
- Elementary_Functions.Sqrt;
- function Log (X : Real) return Real renames
- Elementary_Functions.Log;
- function Exp (X : Real) return Real renames
- Elementary_Functions.Exp;
-
- -- The default Maximum Relative Error is the value specified
- -- in the LRM.
- Default_MRE : constant Real := 2.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real := Default_MRE) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Actual - Expected) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Argument_Range_Check (A, B : Real;
- Test : String) is
- -- test a logarithmically distributed selection of
- -- arguments selected from the range A to B.
- X : Real;
- Expected : Real;
- Y : Real;
- C : Real := Log(B/A);
- Max_Samples : constant := 1000;
-
- begin
- for I in 1..Max_Samples loop
- Expected := A * Exp(C * Real (I) / Real (Max_Samples));
- X := Expected * Expected;
- Y := Sqrt (X);
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (Y, Expected,
- "test " & Test & " -" &
- Integer'Image (I) &
- " of argument range",
- 3.0);
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check");
- when others =>
- Report.Failed ("exception in argument range check");
- end Argument_Range_Check;
-
-
- procedure Do_Test is
- begin
-
- --- test 1 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- X : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- Expected : constant := (1.0 * Real'Machine_Radix) ** T;
- Y : Real;
- begin
- Y := Sqrt (X);
- Check (Y, Expected, "test 1 -- sqrt(radix**((emax-1)/2))");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- T : constant := (Real'Model_EMin + 1) / 2;
- X : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- Expected : constant := (1.0 * Real'Machine_Radix) ** T;
- Y : Real;
- begin
- Y := Sqrt (X);
- Check (Y, Expected, "test 2 -- sqrt(radix**((emin+1)/2))");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- X : constant := 1.0;
- Expected : constant := 1.0;
- Y : Real;
- begin
- Y := Sqrt(X);
- Check (Y, Expected, "test 3 -- sqrt(1.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- X : constant := 0.0;
- Expected : constant := 0.0;
- Y : Real;
- begin
- Y := Sqrt(X);
- Check (Y, Expected, "test 4 -- sqrt(0.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- declare
- X : constant := -1.0;
- Y : Real;
- begin
- Y := Sqrt(X);
- -- the following code should not be executed.
- -- The call to Check is to keep the call to Sqrt from
- -- appearing to be dead code.
- Check (Y, -1.0, "test 5 -- sqrt(-1)" );
- Report.Failed ("test 5 - argument_error expected");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when Ada.Numerics.Argument_Error =>
- if Verbose then
- Report.Comment ("test 5 correctly got argument_error");
- end if;
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- declare
- X : constant := Ada.Numerics.Pi ** 2;
- Expected : constant := Ada.Numerics.Pi;
- Y : Real;
- begin
- Y := Sqrt (X);
- Check (Y, Expected, "test 6 -- sqrt(pi**2)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 & 8 ---
- Argument_Range_Check (1.0/Sqrt(Real(Real'Machine_Radix)),
- 1.0,
- "7");
- Argument_Range_Check (1.0,
- Sqrt(Real(Real'Machine_Radix)),
- "8");
- end Do_Test;
- end A_Long_Float_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
- package Non_Generic_Check is
- procedure Do_Test;
- end Non_Generic_Check;
-
- package body Non_Generic_Check is
- package EF renames
- Ada.Numerics.Elementary_Functions;
- subtype Real is Float;
-
- -- The default Maximum Relative Error is the value specified
- -- in the LRM.
- Default_MRE : constant Real := 2.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real := Default_MRE) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Actual - Expected) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
-
- procedure Argument_Range_Check (A, B : Float;
- Test : String) is
- -- test a logarithmically distributed selection of
- -- arguments selected from the range A to B.
- X : Float;
- Expected : Float;
- Y : Float;
- C : Float := EF.Log(B/A);
- Max_Samples : constant := 1000;
-
- begin
- for I in 1..Max_Samples loop
- Expected := A * EF.Exp(C * Float (I) / Float (Max_Samples));
- X := Expected * Expected;
- Y := EF.Sqrt (X);
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (Y, Expected,
- "test " & Test & " -" &
- Integer'Image (I) &
- " of argument range",
- 3.0);
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check");
- when others =>
- Report.Failed ("exception in argument range check");
- end Argument_Range_Check;
-
-
- procedure Do_Test is
- begin
-
- --- test 1 ---
- declare
- T : constant := (Float'Machine_EMax - 1) / 2;
- X : constant := (1.0 * Float'Machine_Radix) ** (2 * T);
- Expected : constant := (1.0 * Float'Machine_Radix) ** T;
- Y : Float;
- begin
- Y := EF.Sqrt (X);
- Check (Y, Expected, "test 1 -- sqrt(radix**((emax-1)/2))");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- T : constant := (Float'Model_EMin + 1) / 2;
- X : constant := (1.0 * Float'Machine_Radix) ** (2 * T);
- Expected : constant := (1.0 * Float'Machine_Radix) ** T;
- Y : Float;
- begin
- Y := EF.Sqrt (X);
- Check (Y, Expected, "test 2 -- sqrt(radix**((emin+1)/2))");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- X : constant := 1.0;
- Expected : constant := 1.0;
- Y : Float;
- begin
- Y := EF.Sqrt(X);
- Check (Y, Expected, "test 3 -- sqrt(1.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- X : constant := 0.0;
- Expected : constant := 0.0;
- Y : Float;
- begin
- Y := EF.Sqrt(X);
- Check (Y, Expected, "test 4 -- sqrt(0.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- declare
- X : constant := -1.0;
- Y : Float;
- begin
- Y := EF.Sqrt(X);
- -- the following code should not be executed.
- -- The call to Check is to keep the call to Sqrt from
- -- appearing to be dead code.
- Check (Y, -1.0, "test 5 -- sqrt(-1)" );
- Report.Failed ("test 5 - argument_error expected");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when Ada.Numerics.Argument_Error =>
- if Verbose then
- Report.Comment ("test 5 correctly got argument_error");
- end if;
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- declare
- X : constant := Ada.Numerics.Pi ** 2;
- Expected : constant := Ada.Numerics.Pi;
- Y : Float;
- begin
- Y := EF.Sqrt (X);
- Check (Y, Expected, "test 6 -- sqrt(pi**2)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 & 8 ---
- Argument_Range_Check (1.0/EF.Sqrt(Float(Float'Machine_Radix)),
- 1.0,
- "7");
- Argument_Range_Check (1.0,
- EF.Sqrt(Float(Float'Machine_Radix)),
- "8");
- end Do_Test;
- end Non_Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-begin
- Report.Test ("CXG2003",
- "Check the accuracy of the sqrt function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking non-generic package");
- end if;
-
- Non_Generic_Check.Do_Test;
-
- Report.Result;
-end CXG2003;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2004.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2004.a
deleted file mode 100644
index 2df296d3d42..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2004.a
+++ /dev/null
@@ -1,499 +0,0 @@
--- CXG2004.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the sin and cos functions return
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both float and a long float type.
--- The test for each floating point type is divided into
--- the following parts:
--- Special value checks where the result is a known constant.
--- Checks using an identity relationship.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 13 FEB 96 SAIC Initial release for 2.1
--- 22 APR 96 SAIC Changed to generic implementation.
--- 18 AUG 96 SAIC Improvements to commentary.
--- 23 OCT 96 SAIC Exact results are not required unless the
--- cycle is specified.
--- 28 FEB 97 PWB.CTA Removed checks where cycle 2.0*Pi is specified
--- 02 JUN 98 EDS Revised calculations to ensure that X is exactly
--- three times Y per advice of numerics experts.
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
--- The sin and cos checks are translated directly from
--- the netlib FORTRAN code that was written by W. Cody.
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-with Ada.Numerics.Elementary_Functions;
-procedure CXG2004 is
- Verbose : constant Boolean := False;
- Number_Samples : constant := 1000;
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
-
- function Sin (X : Real) return Real renames
- Elementary_Functions.Sin;
- function Cos (X : Real) return Real renames
- Elementary_Functions.Cos;
- function Sin (X, Cycle : Real) return Real renames
- Elementary_Functions.Sin;
- function Cos (X, Cycle : Real) return Real renames
- Elementary_Functions.Cos;
-
- Accuracy_Error_Reported : Boolean := False;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Rel_Error,
- Abs_Error,
- Max_Error : Real;
- begin
-
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
-
- -- in addition to the relative error checks we apply the
- -- criteria of G.2.4(16)
- if abs (Actual) > 1.0 then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name & " result > 1.0");
- elsif abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Actual - Expected) &
- " mre:" &
- Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Sin_Check (A, B : Real;
- Arg_Range : String) is
- -- test a selection of
- -- arguments selected from the range A to B.
- --
- -- This test uses the identity
- -- sin(x) = sin(x/3)*(3 - 4 * sin(x/3)**2)
- --
- -- Note that in this test we must take into account the
- -- error in the calculation of the expected result so
- -- the maximum relative error is larger than the
- -- accuracy required by the ARM.
-
- X, Y, ZZ : Real;
- Actual, Expected : Real;
- MRE : Real;
- Ran : Real;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1 .. Number_Samples loop
- -- Evenly distributed selection of arguments
- Ran := Real (I) / Real (Number_Samples);
-
- -- make sure x and x/3 are both exactly representable
- -- on the machine. See "Implementation and Testing of
- -- Function Software" page 44.
- X := (B - A) * Ran + A;
- Y := Real'Leading_Part
- ( X/3.0,
- Real'Machine_Mantissa - Real'Exponent (3.0) );
- X := Y * 3.0;
-
- Actual := Sin (X);
-
- ZZ := Sin(Y);
- Expected := ZZ * (3.0 - 4.0 * ZZ * ZZ);
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- -- See Cody pp 139-141.
- MRE := 4.0;
-
- Check (Actual, Expected,
- "sin test of range" & Arg_Range &
- Integer'Image (I),
- MRE);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in sin check");
- when others =>
- Report.Failed ("exception in sin check");
- end Sin_Check;
-
-
-
- procedure Cos_Check (A, B : Real;
- Arg_Range : String) is
- -- test a selection of
- -- arguments selected from the range A to B.
- --
- -- This test uses the identity
- -- cos(x) = cos(x/3)*(4 * cos(x/3)**2 - 3)
- --
- -- Note that in this test we must take into account the
- -- error in the calculation of the expected result so
- -- the maximum relative error is larger than the
- -- accuracy required by the ARM.
-
- X, Y, ZZ : Real;
- Actual, Expected : Real;
- MRE : Real;
- Ran : Real;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1 .. Number_Samples loop
- -- Evenly distributed selection of arguments
- Ran := Real (I) / Real (Number_Samples);
-
- -- make sure x and x/3 are both exactly representable
- -- on the machine. See "Implementation and Testing of
- -- Function Software" page 44.
- X := (B - A) * Ran + A;
- Y := Real'Leading_Part
- ( X/3.0,
- Real'Machine_Mantissa - Real'Exponent (3.0) );
- X := Y * 3.0;
-
- Actual := Cos (X);
-
- ZZ := Cos(Y);
- Expected := ZZ * (4.0 * ZZ * ZZ - 3.0);
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- -- See Cody pp 141-143.
- MRE := 6.0;
-
- Check (Actual, Expected,
- "cos test of range" & Arg_Range &
- Integer'Image (I),
- MRE);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in cos check");
- when others =>
- Report.Failed ("exception in cos check");
- end Cos_Check;
-
-
- procedure Special_Angle_Checks is
- type Data_Point is
- record
- Degrees,
- Radians,
- Sine,
- Cosine : Real;
- Sin_Result_Error,
- Cos_Result_Error : Boolean;
- end record;
-
- type Test_Data_Type is array (Positive range <>) of Data_Point;
-
- -- the values in the following table only involve static
- -- expressions to minimize any loss of precision. However,
- -- there are two sources of error that must be accounted for
- -- in the following tests.
- -- First, when a cycle is not specified there can be a roundoff
- -- error in the value of Pi used. This error does not apply
- -- when a cycle of 2.0 * Pi is explicitly provided.
- -- Second, the expected results that involve sqrt values also
- -- have a potential roundoff error.
- -- The amount of error due to error in the argument is computed
- -- as follows:
- -- sin(x+err) = sin(x)*cos(err) + cos(x)*sin(err)
- -- ~= sin(x) + err * cos(x)
- -- similarly for cos the error due to error in the argument is
- -- computed as follows:
- -- cos(x+err) = cos(x)*cos(err) - sin(x)*sin(err)
- -- ~= cos(x) - err * sin(x)
- -- In both cases the term "err" is bounded by 0.5 * argument.
-
- Test_Data : constant Test_Data_Type := (
--- degrees radians sine cosine sin_er cos_er test #
- ( 0.0, 0.0, 0.0, 1.0, False, False ), -- 1
- ( 30.0, Pi/6.0, 0.5, Sqrt3/2.0, False, True ), -- 2
- ( 60.0, Pi/3.0, Sqrt3/2.0, 0.5, True, False ), -- 3
- ( 90.0, Pi/2.0, 1.0, 0.0, False, False ), -- 4
- (120.0, 2.0*Pi/3.0, Sqrt3/2.0, -0.5, True, False ), -- 5
- (150.0, 5.0*Pi/6.0, 0.5, -Sqrt3/2.0, False, True ), -- 6
- (180.0, Pi, 0.0, -1.0, False, False ), -- 7
- (210.0, 7.0*Pi/6.0, -0.5, -Sqrt3/2.0, False, True ), -- 8
- (240.0, 8.0*Pi/6.0, -Sqrt3/2.0, -0.5, True, False ), -- 9
- (270.0, 9.0*Pi/6.0, -1.0, 0.0, False, False ), -- 10
- (300.0, 10.0*Pi/6.0, -Sqrt3/2.0, 0.5, True, False ), -- 11
- (330.0, 11.0*Pi/6.0, -0.5, Sqrt3/2.0, False, True ), -- 12
- (360.0, 2.0*Pi, 0.0, 1.0, False, False ), -- 13
- ( 45.0, Pi/4.0, Sqrt2/2.0, Sqrt2/2.0, True, True ), -- 14
- (135.0, 3.0*Pi/4.0, Sqrt2/2.0, -Sqrt2/2.0, True, True ), -- 15
- (225.0, 5.0*Pi/4.0, -Sqrt2/2.0, -Sqrt2/2.0, True, True ), -- 16
- (315.0, 7.0*Pi/4.0, -Sqrt2/2.0, Sqrt2/2.0, True, True ), -- 17
- (405.0, 9.0*Pi/4.0, Sqrt2/2.0, Sqrt2/2.0, True, True ) ); -- 18
-
-
- Y : Real;
- Sin_Arg_Err,
- Cos_Arg_Err,
- Sin_Result_Err,
- Cos_Result_Err : Real;
- begin
- for I in Test_Data'Range loop
- -- compute error components
- Sin_Arg_Err := abs Test_Data (I).Cosine *
- abs Test_Data (I).Radians / 2.0;
- Cos_Arg_Err := abs Test_Data (I).Sine *
- abs Test_Data (I).Radians / 2.0;
-
- if Test_Data (I).Sin_Result_Error then
- Sin_Result_Err := 0.5;
- else
- Sin_Result_Err := 0.0;
- end if;
-
- if Test_Data (I).Cos_Result_Error then
- Cos_Result_Err := 1.0;
- else
- Cos_Result_Err := 0.0;
- end if;
-
-
-
- Y := Sin (Test_Data (I).Radians);
- Check (Y, Test_Data (I).Sine,
- "test" & Integer'Image (I) & " sin(r)",
- 2.0 + Sin_Arg_Err + Sin_Result_Err);
- Y := Cos (Test_Data (I).Radians);
- Check (Y, Test_Data (I).Cosine,
- "test" & Integer'Image (I) & " cos(r)",
- 2.0 + Cos_Arg_Err + Cos_Result_Err);
- Y := Sin (Test_Data (I).Degrees, 360.0);
- Check (Y, Test_Data (I).Sine,
- "test" & Integer'Image (I) & " sin(d,360)",
- 2.0 + Sin_Result_Err);
- Y := Cos (Test_Data (I).Degrees, 360.0);
- Check (Y, Test_Data (I).Cosine,
- "test" & Integer'Image (I) & " cos(d,360)",
- 2.0 + Cos_Result_Err);
---pwb-math Y := Sin (Test_Data (I).Radians, 2.0*Pi);
---pwb-math Check (Y, Test_Data (I).Sine,
---pwb-math "test" & Integer'Image (I) & " sin(r,2pi)",
---pwb-math 2.0 + Sin_Result_Err);
---pwb-math Y := Cos (Test_Data (I).Radians, 2.0*Pi);
---pwb-math Check (Y, Test_Data (I).Cosine,
---pwb-math "test" & Integer'Image (I) & " cos(r,2pi)",
---pwb-math 2.0 + Cos_Result_Err);
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special angle test");
- when others =>
- Report.Failed ("exception in special angle test");
- end Special_Angle_Checks;
-
-
- -- check the rule of A.5.1(41);6.0 which requires that the
- -- result be exact if the mathematical result is 0.0, 1.0,
- -- or -1.0
- procedure Exact_Result_Checks is
- type Data_Point is
- record
- Degrees,
- Sine,
- Cosine : Real;
- end record;
-
- type Test_Data_Type is array (Positive range <>) of Data_Point;
- Test_Data : constant Test_Data_Type := (
- -- degrees sine cosine test #
- ( 0.0, 0.0, 1.0 ), -- 1
- ( 90.0, 1.0, 0.0 ), -- 2
- (180.0, 0.0, -1.0 ), -- 3
- (270.0, -1.0, 0.0 ), -- 4
- (360.0, 0.0, 1.0 ), -- 5
- ( 90.0 + 360.0, 1.0, 0.0 ), -- 6
- (180.0 + 360.0, 0.0, -1.0 ), -- 7
- (270.0 + 360.0,-1.0, 0.0 ), -- 8
- (360.0 + 360.0, 0.0, 1.0 ) ); -- 9
-
- Y : Real;
- begin
- for I in Test_Data'Range loop
- Y := Sin (Test_Data(I).Degrees, 360.0);
- if Y /= Test_Data(I).Sine then
- Report.Failed ("exact result for sin(" &
- Real'Image (Test_Data(I).Degrees) &
- ", 360.0) is not" &
- Real'Image (Test_Data(I).Sine) &
- " Difference is " &
- Real'Image (Y - Test_Data(I).Sine) );
- end if;
-
- Y := Cos (Test_Data(I).Degrees, 360.0);
- if Y /= Test_Data(I).Cosine then
- Report.Failed ("exact result for cos(" &
- Real'Image (Test_Data(I).Degrees) &
- ", 360.0) is not" &
- Real'Image (Test_Data(I).Cosine) &
- " Difference is " &
- Real'Image (Y - Test_Data(I).Cosine) );
- end if;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in exact result check");
- when others =>
- Report.Failed ("exception in exact result check");
- end Exact_Result_Checks;
-
-
- procedure Do_Test is
- begin
- Special_Angle_Checks;
- Sin_Check (0.0, Pi/2.0, "0..pi/2");
- Sin_Check (6.0*Pi, 6.5*Pi, "6pi..6.5pi");
- Cos_Check (7.0*Pi, 7.5*Pi, "7pi..7.5pi");
- Exact_Result_Checks;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2004",
- "Check the accuracy of the sin and cos functions");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
- Report.Result;
-end CXG2004;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2005.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2005.a
deleted file mode 100644
index 4054b83d88a..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2005.a
+++ /dev/null
@@ -1,204 +0,0 @@
--- CXG2005.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that floating point addition and multiplication
--- have the required accuracy.
---
--- TEST DESCRIPTION:
--- The check for the required precision is essentially a
--- check that a guard digit is used for the operations.
--- This test uses a generic package to check the addition
--- and multiplication results. The
--- generic package is instantiated with the standard FLOAT
--- type and a floating point type for the maximum number
--- of digits of precision.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
---
---
--- CHANGE HISTORY:
--- 14 FEB 96 SAIC Initial Release for 2.1
--- 16 SEP 99 RLB Repaired to avoid printing thousands of (almost)
--- identical failure messages.
---!
-
--- References:
---
--- Basic Concepts for Computational Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Vol 142
--- Springer Verlag, 1982
---
--- Software Manual for the Elementary Functions
--- William J. Cody and William Waite
--- Prentice-Hall, 1980
---
-
-with System;
-with Report;
-procedure CXG2005 is
- Verbose : constant Boolean := False;
-
- generic
- type Real is digits <>;
- package Guard_Digit_Check is
- procedure Do_Test;
- end Guard_Digit_Check;
-
- package body Guard_Digit_Check is
- -- made global so that the compiler will be more likely
- -- to keep the values in memory instead of in higher
- -- precision registers.
- X, Y, Z : Real;
- OneX : Real;
- Eps, BN : Real;
-
- -- special constants - not declared as constants so that
- -- the "stored" precision will be used instead of a "register"
- -- precision.
- Zero : Real := 0.0;
- One : Real := 1.0;
- Two : Real := 2.0;
-
- Failure_Count : Natural := 0;
-
- procedure Thwart_Optimization is
- -- the purpose of this procedure is to reference the
- -- global variables used by the test so
- -- that the compiler is not likely to keep them in
- -- a higher precision register for their entire lifetime.
- begin
- if Report.Ident_Bool (False) then
- -- never executed
- X := X + 5.0;
- Y := Y + 6.0;
- Z := Z + 1.0;
- Eps := Eps + 2.0;
- BN := BN + 2.0;
- OneX := X + Y;
- One := 12.34; Two := 56.78; Zero := 90.12;
- end if;
- end Thwart_Optimization;
-
-
- procedure Addition_Test is
- begin
- for K in 1..10 loop
- Eps := Real (K) * Real'Model_Epsilon;
- for N in 1.. Real'Machine_EMax - 1 loop
- BN := Real(Real'Machine_Radix) ** N;
- X := (One + Eps) * BN;
- Y := (One - Eps) * BN;
- Z := X - Y; -- true value for Z is 2*Eps*BN
-
- if Z /= Eps*BN + Eps*BN then
- Report.Failed ("addition check failed. K=" &
- Integer'Image (K) &
- " N=" & Integer'Image (N) &
- " difference=" & Real'Image (Z - 2.0*Eps*BN) &
- " Eps*BN=" & Real'Image (Eps*BN) );
- Failure_Count := Failure_Count + 1;
- exit when Failure_Count > K*4; -- Avoid displaying dozens of messages.
- end if;
- end loop;
- end loop;
- exception
- when others =>
- Thwart_Optimization;
- Report.Failed ("unexpected exception in addition test");
- end Addition_Test;
-
-
- procedure Multiplication_Test is
- begin
- X := Real (Real'Machine_Radix) ** (Real'Machine_EMax - 1);
- OneX := One * X;
- Thwart_Optimization;
- if OneX /= X then
- Report.Failed ("multiplication for large values");
- end if;
-
- X := Real (Real'Machine_Radix) ** (Real'Model_EMin + 1);
- OneX := One * X;
- Thwart_Optimization;
- if OneX /= X then
- Report.Failed ("multiplication for small values");
- end if;
-
- -- selection of "random" values between 1/radix and radix
- Y := One / Real (Real'Machine_Radix);
- Z := Real(Real'Machine_Radix) - One/Real(Real'Machine_Radix);
- for I in 0..100 loop
- X := Y + Real (I) / 100.0 * Z;
- OneX := One * X;
- Thwart_Optimization;
- if OneX /= X then
- Report.Failed ("multiplication for case" & Integer'Image (I));
- exit when Failure_Count > 40+8; -- Avoid displaying dozens of messages.
- end if;
- end loop;
- exception
- when others =>
- Thwart_Optimization;
- Report.Failed ("unexpected exception in multiplication test");
- end Multiplication_Test;
-
-
- procedure Do_Test is
- begin
- Addition_Test;
- Multiplication_Test;
- end Do_Test;
- end Guard_Digit_Check;
-
- package Chk_Float is new Guard_Digit_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package Chk_A_Long_Float is new Guard_Digit_Check (A_Long_Float);
-begin
- Report.Test ("CXG2005",
- "Check the accuracy of floating point" &
- " addition and multiplication");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
- Chk_Float.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
- Chk_A_Long_Float.Do_Test;
-
- Report.Result;
-end CXG2005;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2006.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2006.a
deleted file mode 100644
index da15dc3be67..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2006.a
+++ /dev/null
@@ -1,281 +0,0 @@
--- CXG2006.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex Argument function returns
--- results that are within the error bound allowed.
--- Check that Argument_Error is raised if the Cycle parameter
--- is less than or equal to zero.
---
--- TEST DESCRIPTION:
--- This test uses a generic package to compute and check the
--- values of the Argument function.
--- Of special interest is the case where either the real or
--- the imaginary part of the parameter is very large while the
--- other part is very small or 0.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 15 FEB 96 SAIC Initial release for 2.1
--- 03 MAR 97 PWB.CTA Removed checks involving explicit cycle => 2.0*Pi
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
---
--- Reference:
--- Problems and Methodologies in Mathematical Software Production;
--- editors: P. C. Messina and A Murli;
--- Lecture Notes in Computer Science
--- Volume 142
--- Springer Verlag 1982
---
-
-with System;
-with Report;
-with ImpDef.Annex_G;
-with Ada.Numerics;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Complex_Types;
-procedure CXG2006 is
- Verbose : constant Boolean := False;
-
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Complex_Types is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Actual - Expected) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Cases is
- type Data_Point is
- record
- Re,
- Im,
- Radians,
- Degrees,
- Error_Bound : Real;
- end record;
-
- type Test_Data_Type is array (Positive range <>) of Data_Point;
-
- -- the values in the following table only involve static
- -- expressions to minimize errors in precision introduced by the
- -- test. For cases where Pi is used in the argument we must
- -- allow an extra 1.0*MRE to account for roundoff error in the
- -- argument. Where the result involves a square root we allow
- -- an extra 0.5*MRE to allow for roundoff error.
- Test_Data : constant Test_Data_Type := (
--- Re Im Radians Degrees Err Test #
- (0.0, 0.0, 0.0, 0.0, 4.0 ), -- 1
- (1.0, 0.0, 0.0, 0.0, 4.0 ), -- 2
- (Real'Safe_Last, 0.0, 0.0, 0.0, 4.0 ), -- 3
- (Real'Model_Small, 0.0, 0.0, 0.0, 4.0 ), -- 4
- (1.0, 1.0, Pi/4.0, 45.0, 5.0 ), -- 5
- (1.0, -1.0, -Pi/4.0, -45.0, 5.0 ), -- 6
- (-1.0, -1.0, -3.0*Pi/4.0,-135.0, 5.0 ), -- 7
- (-1.0, 1.0, 3.0*Pi/4.0, 135.0, 5.0 ), -- 8
- (Sqrt3, 1.0, Pi/6.0, 30.0, 5.5 ), -- 9
- (-Sqrt3, 1.0, 5.0*Pi/6.0, 150.0, 5.5 ), -- 10
- (Sqrt3, -1.0, -Pi/6.0, -30.0, 5.5 ), -- 11
- (-Sqrt3, -1.0, -5.0*Pi/6.0,-150.0, 5.5 ), -- 12
- (Real'Model_Small, Real'Model_Small, Pi/4.0, 45.0, 5.0 ), -- 13
- (-Real'Safe_Last, 0.0, Pi, 180.0, 5.0 ), -- 14
- (-Real'Safe_Last, -Real'Model_Small, -Pi,-180.0, 5.0 ), -- 15
- (100000.0, 100000.0, Pi/4.0, 45.0, 5.0 )); -- 16
-
- X : Real;
- Z : Complex;
- begin
- for I in Test_Data'Range loop
- begin
- Z := (Test_Data(I).Re, Test_Data(I).Im);
- X := Argument (Z);
- Check (X, Test_Data(I).Radians,
- "test" & Integer'Image (I) & " argument(z)",
- Test_Data (I).Error_Bound);
---pwb-math X := Argument (Z, 2.0*Pi);
---pwb-math Check (X, Test_Data(I).Radians,
---pwb-math "test" & Integer'Image (I) & " argument(z, 2pi)",
---pwb-math Test_Data (I).Error_Bound);
- X := Argument (Z, 360.0);
- Check (X, Test_Data(I).Degrees,
- "test" & Integer'Image (I) & " argument(z, 360)",
- Test_Data (I).Error_Bound);
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test" &
- Integer'Image (I));
- when others =>
- Report.Failed ("exception in test" &
- Integer'Image (I));
- end;
- end loop;
-
- if Real'Signed_Zeros then
- begin
- X := Argument ((-1.0, Real(ImpDef.Annex_G.Negative_Zero)));
- Check (X, -Pi, "test of arg((-1,-0)", 4.0);
- exception
- when others =>
- Report.Failed ("exception in signed zero test");
- end;
- end if;
- end Special_Cases;
-
-
- procedure Exception_Cases is
- -- check that Argument_Error is raised if Cycle is <= 0
- Z : Complex := (1.0, 1.0);
- X : Real;
- Y : Real;
- begin
- begin
- X := Argument (Z, Cycle => 0.0);
- Report.Failed ("no exception for cycle = 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle = 0.0");
- end;
-
- begin
- Y := Argument (Z, Cycle => -3.0);
- Report.Failed ("no exception for cycle < 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle < 0.0");
- end;
-
- if Report.Ident_Int (2) = 1 then
- -- optimization thwarting code - never executed
- Report.Failed("2=1" & Real'Image (X+Y));
- end if;
- end Exception_Cases;
-
-
- procedure Do_Test is
- begin
- Special_Cases;
- Exception_Cases;
- end Do_Test;
- end Generic_Check;
-
- package Chk_Float is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package Chk_A_Long_Float is new Generic_Check (A_Long_Float);
-begin
- Report.Test ("CXG2006",
- "Check the accuracy of the complex argument" &
- " function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Chk_Float.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- Chk_A_Long_Float.Do_Test;
-
- Report.Result;
-end CXG2006;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2007.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2007.a
deleted file mode 100644
index ba07df29d52..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2007.a
+++ /dev/null
@@ -1,291 +0,0 @@
--- CXG2007.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex Compose_From_Polar function returns
--- results that are within the error bound allowed.
--- Check that Argument_Error is raised if the Cycle parameter
--- is less than or equal to zero.
---
--- TEST DESCRIPTION:
--- This test uses a generic package to compute and check the
--- values of the Compose_From_Polar function.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 23 FEB 96 SAIC Initial release for 2.1
--- 23 APR 96 SAIC Fixed error checking
--- 03 MAR 97 PWB.CTA Deleted checks with explicit Cycle => 2.0*Pi
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
-with System;
-with Report;
-with Ada.Numerics;
-with Ada.Numerics.Generic_Complex_Types;
-procedure CXG2007 is
- Verbose : constant Boolean := False;
-
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Complex_Types is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
-
- Maximum_Relative_Error : constant Real := 3.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real;
- Arg_Error : Real) is
- -- Arg_Error is additional absolute error that is allowed beyond
- -- the MRE to account for error in the result that can be
- -- attributed to error in the arguments.
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Small instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
- Max_Error := Max_Error + Arg_Error;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MRE : Real;
- Arg_Error : Real) is
- -- Arg_Error is additional absolute error that is allowed beyond
- -- the MRE to account for error in the result that can be
- -- attributed to error in the arguments.
- begin
- Check (Actual.Re, Expected.Re,
- Test_Name & " real part",
- MRE, Arg_Error);
- Check (Actual.Im, Expected.Im,
- Test_Name & " imaginary part",
- MRE, Arg_Error);
- end Check;
-
-
- procedure Special_Cases is
- type Data_Point is
- record
- Re,
- Im,
- Modulus,
- Radians,
- Degrees,
- Arg_Error : Real;
- end record;
-
- -- shorthand names for various constants
- P4 : constant := Pi/4.0;
- P6 : constant := Pi/6.0;
-
- MER2 : constant Real := Real'Model_Epsilon * Sqrt2;
-
- type Test_Data_Type is array (Positive range <>) of Data_Point;
-
- -- the values in the following table only involve static
- -- expressions so no loss of precision occurs.
- Test_Data : constant Test_Data_Type := (
- --Re Im Modulus Radians Degrees Arg_Err
- ( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ), -- 1
- ( 0.0, 0.0, 0.0, Pi, 180.0, 0.0 ), -- 2
-
- ( 1.0, 0.0, 1.0, 0.0, 0.0, 0.0 ), -- 3
- (-1.0, 0.0, -1.0, 0.0, 0.0, 0.0 ), -- 4
-
- ( 1.0, 1.0, Sqrt2, P4, 45.0, MER2), -- 5
- (-1.0, 1.0, -Sqrt2, -P4, -45.0, MER2), -- 6
- ( 1.0, -1.0, Sqrt2, -P4, -45.0, MER2), -- 7
- (-1.0, -1.0, -Sqrt2, P4, 45.0, MER2), -- 8
- (-1.0, -1.0, Sqrt2, -3.0*P4,-135.0, MER2), -- 9
- (-1.0, 1.0, Sqrt2, 3.0*P4, 135.0, MER2), -- 10
- ( 1.0, -1.0, -Sqrt2, 3.0*P4, 135.0, MER2), -- 11
-
- (-1.0, 0.0, 1.0, Pi, 180.0, 0.0 ), -- 12
- ( 1.0, 0.0, -1.0, Pi, 180.0, 0.0 ) ); -- 13
-
-
- Z : Complex;
- Exp : Complex;
- begin
- for I in Test_Data'Range loop
- begin
- Exp := (Test_Data (I).Re, Test_Data (I).Im);
-
- Z := Compose_From_Polar (Test_Data (I).Modulus,
- Test_Data (I).Radians);
- Check (Z, Exp,
- "test" & Integer'Image (I) & " compose_from_polar(m,r)",
- Maximum_Relative_Error, Test_Data (I).Arg_Error);
-
---pwb-math Z := Compose_From_Polar (Test_Data (I).Modulus,
---pwb-math Test_Data (I).Radians,
---pwb-math 2.0*Pi);
---pwb-math Check (Z, Exp,
---pwb-math "test" & Integer'Image (I) & " compose_from_polar(m,r,2pi)",
---pwb-math Maximum_Relative_Error, Test_Data (I).Arg_Error);
-
- Z := Compose_From_Polar (Test_Data (I).Modulus,
- Test_Data (I).Degrees,
- 360.0);
- Check (Z, Exp,
- "test" & Integer'Image (I) & " compose_from_polar(m,d,360)",
- Maximum_Relative_Error, Test_Data (I).Arg_Error);
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test" &
- Integer'Image (I));
- when others =>
- Report.Failed ("exception in test" &
- Integer'Image (I));
- end;
- end loop;
- end Special_Cases;
-
-
- procedure Exception_Cases is
- -- check that Argument_Error is raised if Cycle is <= 0
- Z : Complex;
- W : Complex;
- begin
- begin
- Z := Compose_From_Polar (3.0, 0.0, Cycle => 0.0);
- Report.Failed ("no exception for cycle = 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle = 0.0");
- end;
-
- begin
- W := Compose_From_Polar (6.0, 1.0, Cycle => -10.0);
- Report.Failed ("no exception for cycle < 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle < 0.0");
- end;
-
- if Report.Ident_Int (1) = 2 then
- -- not executed - used to make it appear that we use the
- -- results of the above computation
- Z := Z * W;
- Report.Failed(Real'Image (Z.Re + Z.Im));
- end if;
- end Exception_Cases;
-
-
- procedure Do_Test is
- begin
- Special_Cases;
- Exception_Cases;
- end Do_Test;
- end Generic_Check;
-
- package Chk_Float is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package Chk_A_Long_Float is new Generic_Check (A_Long_Float);
-begin
- Report.Test ("CXG2007",
- "Check the accuracy of the Compose_From_Polar" &
- " function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
- Chk_Float.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
- Chk_A_Long_Float.Do_Test;
-
- Report.Result;
-end CXG2007;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2008.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2008.a
deleted file mode 100644
index 58cf367f61c..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2008.a
+++ /dev/null
@@ -1,948 +0,0 @@
--- CXG2008.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex multiplication and division
--- operations return results that are within the allowed
--- error bound.
--- Check that all the required pure Numerics packages are pure.
---
--- TEST DESCRIPTION:
--- This test contains three test packages that are almost
--- identical. The first two packages differ only in the
--- floating point type that is being tested. The first
--- and third package differ only in whether the generic
--- complex types package or the pre-instantiated
--- package is used.
--- The test package is not generic so that the arguments
--- and expected results for some of the test values
--- can be expressed as universal real instead of being
--- computed at runtime.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 24 FEB 96 SAIC Initial release for 2.1
--- 03 JUN 98 EDS Correct the test program's incorrect assumption
--- that Constraint_Error must be raised by complex
--- division by zero, which is contrary to the
--- allowance given by the Ada 95 standard G.1.1(40).
--- 13 MAR 01 RLB Replaced commented out Pure check on non-generic
--- packages, as required by Defect Report
--- 8652/0020 and as reflected in Technical
--- Corrigendum 1.
---!
-
-------------------------------------------------------------------------------
--- Check that the required pure packages are pure by withing them from a
--- pure package. The non-generic versions of those packages are required to
--- be pure by Defect Report 8652/0020, Technical Corrigendum 1 [A.5.1(9/1) and
--- G.1.1(25/1)].
-with Ada.Numerics.Generic_Elementary_Functions;
-with Ada.Numerics.Elementary_Functions;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Complex_Types;
-with Ada.Numerics.Generic_Complex_Elementary_Functions;
-with Ada.Numerics.Complex_Elementary_Functions;
-package CXG2008_0 is
- pragma Pure;
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-end CXG2008_0;
-
-------------------------------------------------------------------------------
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Complex_Types;
-with CXG2008_0; use CXG2008_0;
-procedure CXG2008 is
- Verbose : constant Boolean := False;
-
- package Float_Check is
- subtype Real is Float;
- procedure Do_Test;
- end Float_Check;
-
- package body Float_Check is
- package Complex_Types is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
-
- -- keep track if an accuracy failure has occurred so the test
- -- can be short-circuited to avoid thousands of error messages.
- Failure_Detected : Boolean := False;
-
- Mult_MBE : constant Real := 5.0;
- Divide_MBE : constant Real := 13.0;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MBE : Real) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MBE * abs Expected.Re * Real'Model_Epsilon;
- Abs_Error := MBE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual.Re - Expected.Re) > Max_Error then
- Failure_Detected := True;
- Report.Failed (Test_Name &
- " actual.re: " & Real'Image (Actual.Re) &
- " expected.re: " & Real'Image (Expected.Re) &
- " difference.re " &
- Real'Image (Actual.Re - Expected.Re) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result for real part");
- else
- Report.Comment (Test_Name & " passed for real part");
- end if;
- end if;
-
- Rel_Error := MBE * abs Expected.Im * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
- if abs (Actual.Im - Expected.Im) > Max_Error then
- Failure_Detected := True;
- Report.Failed (Test_Name &
- " actual.im: " & Real'Image (Actual.Im) &
- " expected.im: " & Real'Image (Expected.Im) &
- " difference.im " &
- Real'Image (Actual.Im - Expected.Im) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result for imaginary part");
- else
- Report.Comment (Test_Name & " passed for imaginary part");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Values is
- begin
-
- --- test 1 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- Big : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- Expected : Complex := (0.0, 0.0);
- X : Complex := (0.0, 0.0);
- Y : Complex := (Big, Big);
- Z : Complex;
- begin
- Z := X * Y;
- Check (Z, Expected, "test 1a -- (0+0i) * (big+big*i)",
- Mult_MBE);
- Z := Y * X;
- Check (Z, Expected, "test 1b -- (big+big*i) * (0+0i)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- T : constant := Real'Model_EMin + 1;
- Tiny : constant := (1.0 * Real'Machine_Radix) ** T;
- U : Complex := (Tiny, Tiny);
- X : Complex := (0.0, 0.0);
- Expected : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- Z := U * X;
- Check (Z, Expected, "test 2 -- (tiny,tiny) * (0,0)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- Big : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- B : Complex := (Big, Big);
- X : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- if Real'Machine_Overflows then
- Z := B / X;
- Report.Failed ("test 3 - Constraint_Error not raised");
- Check (Z, Z, "not executed - optimizer thwarting", 0.0);
- end if;
- exception
- when Constraint_Error => null; -- expected
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- T : constant := Real'Model_EMin + 1;
- Tiny : constant := (1.0 * Real'Machine_Radix) ** T;
- U : Complex := (Tiny, Tiny);
- X : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- if Real'Machine_Overflows then
- Z := U / X;
- Report.Failed ("test 4 - Constraint_Error not raised");
- Check (Z, Z, "not executed - optimizer thwarting", 0.0);
- end if;
- exception
- when Constraint_Error => null; -- expected
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
-
- --- test 5 ---
- declare
- X : Complex := (Sqrt2, Sqrt2);
- Z : Complex;
- Expected : constant Complex := (0.0, 4.0);
- begin
- Z := X * X;
- Check (Z, Expected, "test 5 -- (sqrt2,sqrt2) * (sqrt2,sqrt2)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- declare
- X : Complex := Sqrt3 - Sqrt3 * i;
- Z : Complex;
- Expected : constant Complex := (0.0, -6.0);
- begin
- Z := X * X;
- Check (Z, Expected, "test 6 -- (sqrt3,-sqrt3) * (sqrt3,-sqrt3)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 ---
- declare
- X : Complex := Sqrt2 + Sqrt2 * i;
- Y : Complex := Sqrt2 - Sqrt2 * i;
- Z : Complex;
- Expected : constant Complex := 0.0 + i;
- begin
- Z := X / Y;
- Check (Z, Expected, "test 7 -- (sqrt2,sqrt2) / (sqrt2,-sqrt2)",
- Divide_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 7");
- when others =>
- Report.Failed ("exception in test 7");
- end;
- end Special_Values;
-
-
- procedure Do_Mult_Div (X, Y : Complex) is
- Z : Complex;
- Args : constant String :=
- "X=(" & Real'Image (X.Re) & "," & Real'Image (X.Im) & ") " &
- "Y=(" & Real'Image (Y.Re) & "," & Real'Image (Y.Im) & ") " ;
- begin
- Z := (X * X) / X;
- Check (Z, X, "X*X/X " & Args, Mult_MBE + Divide_MBE);
- Z := (X * Y) / X;
- Check (Z, Y, "X*Y/X " & Args, Mult_MBE + Divide_MBE);
- Z := (X * Y) / Y;
- Check (Z, X, "X*Y/Y " & Args, Mult_MBE + Divide_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error in Do_Mult_Div for " & Args);
- when others =>
- Report.Failed ("exception in Do_Mult_Div for " & Args);
- end Do_Mult_Div;
-
- -- select complex values X and Y where the real and imaginary
- -- parts are selected from the ranges (1/radix..1) and
- -- (1..radix). This translates into quite a few combinations.
- procedure Mult_Div_Check is
- Samples : constant := 17;
- Radix : constant Real := Real(Real'Machine_Radix);
- Inv_Radix : constant Real := 1.0 / Real(Real'Machine_Radix);
- Low_Sample : Real; -- (1/radix .. 1)
- High_Sample : Real; -- (1 .. radix)
- Sample : array (1..2) of Real;
- X, Y : Complex;
- begin
- for I in 1 .. Samples loop
- Low_Sample := (1.0 - Inv_Radix) / Real (Samples) * Real (I) +
- Inv_Radix;
- Sample (1) := Low_Sample;
- for J in 1 .. Samples loop
- High_Sample := (Radix - 1.0) / Real (Samples) * Real (I) +
- Radix;
- Sample (2) := High_Sample;
- for K in 1 .. 2 loop
- for L in 1 .. 2 loop
- X := Complex'(Sample (K), Sample (L));
- Y := Complex'(Sample (L), Sample (K));
- Do_Mult_Div (X, Y);
- if Failure_Detected then
- return; -- minimize flood of error messages
- end if;
- end loop;
- end loop;
- end loop; -- J
- end loop; -- I
- end Mult_Div_Check;
-
-
- procedure Do_Test is
- begin
- Special_Values;
- Mult_Div_Check;
- end Do_Test;
- end Float_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- -- check the floating point type with the most digits
-
- package A_Long_Float_Check is
- type A_Long_Float is digits System.Max_Digits;
- subtype Real is A_Long_Float;
- procedure Do_Test;
- end A_Long_Float_Check;
-
- package body A_Long_Float_Check is
-
- package Complex_Types is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
-
- -- keep track if an accuracy failure has occurred so the test
- -- can be short-circuited to avoid thousands of error messages.
- Failure_Detected : Boolean := False;
-
- Mult_MBE : constant Real := 5.0;
- Divide_MBE : constant Real := 13.0;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MBE : Real) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MBE * abs Expected.Re * Real'Model_Epsilon;
- Abs_Error := MBE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual.Re - Expected.Re) > Max_Error then
- Failure_Detected := True;
- Report.Failed (Test_Name &
- " actual.re: " & Real'Image (Actual.Re) &
- " expected.re: " & Real'Image (Expected.Re) &
- " difference.re " &
- Real'Image (Actual.Re - Expected.Re) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result for real part");
- else
- Report.Comment (Test_Name & " passed for real part");
- end if;
- end if;
-
- Rel_Error := MBE * abs Expected.Im * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
- if abs (Actual.Im - Expected.Im) > Max_Error then
- Failure_Detected := True;
- Report.Failed (Test_Name &
- " actual.im: " & Real'Image (Actual.Im) &
- " expected.im: " & Real'Image (Expected.Im) &
- " difference.im " &
- Real'Image (Actual.Im - Expected.Im) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result for imaginary part");
- else
- Report.Comment (Test_Name & " passed for imaginary part");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Values is
- begin
-
- --- test 1 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- Big : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- Expected : Complex := (0.0, 0.0);
- X : Complex := (0.0, 0.0);
- Y : Complex := (Big, Big);
- Z : Complex;
- begin
- Z := X * Y;
- Check (Z, Expected, "test 1a -- (0+0i) * (big+big*i)",
- Mult_MBE);
- Z := Y * X;
- Check (Z, Expected, "test 1b -- (big+big*i) * (0+0i)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- T : constant := Real'Model_EMin + 1;
- Tiny : constant := (1.0 * Real'Machine_Radix) ** T;
- U : Complex := (Tiny, Tiny);
- X : Complex := (0.0, 0.0);
- Expected : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- Z := U * X;
- Check (Z, Expected, "test 2 -- (tiny,tiny) * (0,0)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- Big : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- B : Complex := (Big, Big);
- X : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- if Real'Machine_Overflows then
- Z := B / X;
- Report.Failed ("test 3 - Constraint_Error not raised");
- Check (Z, Z, "not executed - optimizer thwarting", 0.0);
- end if;
- exception
- when Constraint_Error => null; -- expected
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- T : constant := Real'Model_EMin + 1;
- Tiny : constant := (1.0 * Real'Machine_Radix) ** T;
- U : Complex := (Tiny, Tiny);
- X : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- if Real'Machine_Overflows then
- Z := U / X;
- Report.Failed ("test 4 - Constraint_Error not raised");
- Check (Z, Z, "not executed - optimizer thwarting", 0.0);
- end if;
- exception
- when Constraint_Error => null; -- expected
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
-
- --- test 5 ---
- declare
- X : Complex := (Sqrt2, Sqrt2);
- Z : Complex;
- Expected : constant Complex := (0.0, 4.0);
- begin
- Z := X * X;
- Check (Z, Expected, "test 5 -- (sqrt2,sqrt2) * (sqrt2,sqrt2)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- declare
- X : Complex := Sqrt3 - Sqrt3 * i;
- Z : Complex;
- Expected : constant Complex := (0.0, -6.0);
- begin
- Z := X * X;
- Check (Z, Expected, "test 6 -- (sqrt3,-sqrt3) * (sqrt3,-sqrt3)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 ---
- declare
- X : Complex := Sqrt2 + Sqrt2 * i;
- Y : Complex := Sqrt2 - Sqrt2 * i;
- Z : Complex;
- Expected : constant Complex := 0.0 + i;
- begin
- Z := X / Y;
- Check (Z, Expected, "test 7 -- (sqrt2,sqrt2) / (sqrt2,-sqrt2)",
- Divide_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 7");
- when others =>
- Report.Failed ("exception in test 7");
- end;
- end Special_Values;
-
-
- procedure Do_Mult_Div (X, Y : Complex) is
- Z : Complex;
- Args : constant String :=
- "X=(" & Real'Image (X.Re) & "," & Real'Image (X.Im) & ") " &
- "Y=(" & Real'Image (Y.Re) & "," & Real'Image (Y.Im) & ") " ;
- begin
- Z := (X * X) / X;
- Check (Z, X, "X*X/X " & Args, Mult_MBE + Divide_MBE);
- Z := (X * Y) / X;
- Check (Z, Y, "X*Y/X " & Args, Mult_MBE + Divide_MBE);
- Z := (X * Y) / Y;
- Check (Z, X, "X*Y/Y " & Args, Mult_MBE + Divide_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error in Do_Mult_Div for " & Args);
- when others =>
- Report.Failed ("exception in Do_Mult_Div for " & Args);
- end Do_Mult_Div;
-
- -- select complex values X and Y where the real and imaginary
- -- parts are selected from the ranges (1/radix..1) and
- -- (1..radix). This translates into quite a few combinations.
- procedure Mult_Div_Check is
- Samples : constant := 17;
- Radix : constant Real := Real(Real'Machine_Radix);
- Inv_Radix : constant Real := 1.0 / Real(Real'Machine_Radix);
- Low_Sample : Real; -- (1/radix .. 1)
- High_Sample : Real; -- (1 .. radix)
- Sample : array (1..2) of Real;
- X, Y : Complex;
- begin
- for I in 1 .. Samples loop
- Low_Sample := (1.0 - Inv_Radix) / Real (Samples) * Real (I) +
- Inv_Radix;
- Sample (1) := Low_Sample;
- for J in 1 .. Samples loop
- High_Sample := (Radix - 1.0) / Real (Samples) * Real (I) +
- Radix;
- Sample (2) := High_Sample;
- for K in 1 .. 2 loop
- for L in 1 .. 2 loop
- X := Complex'(Sample (K), Sample (L));
- Y := Complex'(Sample (L), Sample (K));
- Do_Mult_Div (X, Y);
- if Failure_Detected then
- return; -- minimize flood of error messages
- end if;
- end loop;
- end loop;
- end loop; -- J
- end loop; -- I
- end Mult_Div_Check;
-
-
- procedure Do_Test is
- begin
- Special_Values;
- Mult_Div_Check;
- end Do_Test;
- end A_Long_Float_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
- package Non_Generic_Check is
- subtype Real is Float;
- procedure Do_Test;
- end Non_Generic_Check;
-
- package body Non_Generic_Check is
-
- use Ada.Numerics.Complex_Types;
-
- -- keep track if an accuracy failure has occurred so the test
- -- can be short-circuited to avoid thousands of error messages.
- Failure_Detected : Boolean := False;
-
- Mult_MBE : constant Real := 5.0;
- Divide_MBE : constant Real := 13.0;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MBE : Real) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MBE * abs Expected.Re * Real'Model_Epsilon;
- Abs_Error := MBE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual.Re - Expected.Re) > Max_Error then
- Failure_Detected := True;
- Report.Failed (Test_Name &
- " actual.re: " & Real'Image (Actual.Re) &
- " expected.re: " & Real'Image (Expected.Re) &
- " difference.re " &
- Real'Image (Actual.Re - Expected.Re) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result for real part");
- else
- Report.Comment (Test_Name & " passed for real part");
- end if;
- end if;
-
- Rel_Error := MBE * abs Expected.Im * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
- if abs (Actual.Im - Expected.Im) > Max_Error then
- Failure_Detected := True;
- Report.Failed (Test_Name &
- " actual.im: " & Real'Image (Actual.Im) &
- " expected.im: " & Real'Image (Expected.Im) &
- " difference.im " &
- Real'Image (Actual.Im - Expected.Im) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result for imaginary part");
- else
- Report.Comment (Test_Name & " passed for imaginary part");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Values is
- begin
-
- --- test 1 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- Big : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- Expected : Complex := (0.0, 0.0);
- X : Complex := (0.0, 0.0);
- Y : Complex := (Big, Big);
- Z : Complex;
- begin
- Z := X * Y;
- Check (Z, Expected, "test 1a -- (0+0i) * (big+big*i)",
- Mult_MBE);
- Z := Y * X;
- Check (Z, Expected, "test 1b -- (big+big*i) * (0+0i)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- T : constant := Real'Model_EMin + 1;
- Tiny : constant := (1.0 * Real'Machine_Radix) ** T;
- U : Complex := (Tiny, Tiny);
- X : Complex := (0.0, 0.0);
- Expected : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- Z := U * X;
- Check (Z, Expected, "test 2 -- (tiny,tiny) * (0,0)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- T : constant := (Real'Machine_EMax - 1) / 2;
- Big : constant := (1.0 * Real'Machine_Radix) ** (2 * T);
- B : Complex := (Big, Big);
- X : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- if Real'Machine_Overflows then
- Z := B / X;
- Report.Failed ("test 3 - Constraint_Error not raised");
- Check (Z, Z, "not executed - optimizer thwarting", 0.0);
- end if;
- exception
- when Constraint_Error => null; -- expected
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- T : constant := Real'Model_EMin + 1;
- Tiny : constant := (1.0 * Real'Machine_Radix) ** T;
- U : Complex := (Tiny, Tiny);
- X : Complex := (0.0, 0.0);
- Z : Complex;
- begin
- if Real'Machine_Overflows then
- Z := U / X;
- Report.Failed ("test 4 - Constraint_Error not raised");
- Check (Z, Z, "not executed - optimizer thwarting", 0.0);
- end if;
- exception
- when Constraint_Error => null; -- expected
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
-
- --- test 5 ---
- declare
- X : Complex := (Sqrt2, Sqrt2);
- Z : Complex;
- Expected : constant Complex := (0.0, 4.0);
- begin
- Z := X * X;
- Check (Z, Expected, "test 5 -- (sqrt2,sqrt2) * (sqrt2,sqrt2)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 5");
- when others =>
- Report.Failed ("exception in test 5");
- end;
-
- --- test 6 ---
- declare
- X : Complex := Sqrt3 - Sqrt3 * i;
- Z : Complex;
- Expected : constant Complex := (0.0, -6.0);
- begin
- Z := X * X;
- Check (Z, Expected, "test 6 -- (sqrt3,-sqrt3) * (sqrt3,-sqrt3)",
- Mult_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 6");
- when others =>
- Report.Failed ("exception in test 6");
- end;
-
- --- test 7 ---
- declare
- X : Complex := Sqrt2 + Sqrt2 * i;
- Y : Complex := Sqrt2 - Sqrt2 * i;
- Z : Complex;
- Expected : constant Complex := 0.0 + i;
- begin
- Z := X / Y;
- Check (Z, Expected, "test 7 -- (sqrt2,sqrt2) / (sqrt2,-sqrt2)",
- Divide_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 7");
- when others =>
- Report.Failed ("exception in test 7");
- end;
- end Special_Values;
-
-
- procedure Do_Mult_Div (X, Y : Complex) is
- Z : Complex;
- Args : constant String :=
- "X=(" & Real'Image (X.Re) & "," & Real'Image (X.Im) & ") " &
- "Y=(" & Real'Image (Y.Re) & "," & Real'Image (Y.Im) & ") " ;
- begin
- Z := (X * X) / X;
- Check (Z, X, "X*X/X " & Args, Mult_MBE + Divide_MBE);
- Z := (X * Y) / X;
- Check (Z, Y, "X*Y/X " & Args, Mult_MBE + Divide_MBE);
- Z := (X * Y) / Y;
- Check (Z, X, "X*Y/Y " & Args, Mult_MBE + Divide_MBE);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error in Do_Mult_Div for " & Args);
- when others =>
- Report.Failed ("exception in Do_Mult_Div for " & Args);
- end Do_Mult_Div;
-
- -- select complex values X and Y where the real and imaginary
- -- parts are selected from the ranges (1/radix..1) and
- -- (1..radix). This translates into quite a few combinations.
- procedure Mult_Div_Check is
- Samples : constant := 17;
- Radix : constant Real := Real(Real'Machine_Radix);
- Inv_Radix : constant Real := 1.0 / Real(Real'Machine_Radix);
- Low_Sample : Real; -- (1/radix .. 1)
- High_Sample : Real; -- (1 .. radix)
- Sample : array (1..2) of Real;
- X, Y : Complex;
- begin
- for I in 1 .. Samples loop
- Low_Sample := (1.0 - Inv_Radix) / Real (Samples) * Real (I) +
- Inv_Radix;
- Sample (1) := Low_Sample;
- for J in 1 .. Samples loop
- High_Sample := (Radix - 1.0) / Real (Samples) * Real (I) +
- Radix;
- Sample (2) := High_Sample;
- for K in 1 .. 2 loop
- for L in 1 .. 2 loop
- X := Complex'(Sample (K), Sample (L));
- Y := Complex'(Sample (L), Sample (K));
- Do_Mult_Div (X, Y);
- if Failure_Detected then
- return; -- minimize flood of error messages
- end if;
- end loop;
- end loop;
- end loop; -- J
- end loop; -- I
- end Mult_Div_Check;
-
-
- procedure Do_Test is
- begin
- Special_Values;
- Mult_Div_Check;
- end Do_Test;
- end Non_Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-begin
- Report.Test ("CXG2008",
- "Check the accuracy of the complex multiplication and" &
- " division operators");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking non-generic package");
- end if;
-
- Non_Generic_Check.Do_Test;
-
- Report.Result;
-end CXG2008;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2009.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2009.a
deleted file mode 100644
index 0b11ca53887..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2009.a
+++ /dev/null
@@ -1,421 +0,0 @@
--- CXG2009.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the real sqrt and complex modulus functions
--- return results that are within the allowed
--- error bound.
---
--- TEST DESCRIPTION:
--- This test checks the accuracy of the sqrt and modulus functions
--- by computing the norm of various vectors where the result
--- is known in advance.
--- This test uses real and complex math together as would an
--- actual application. Considerable use of generics is also
--- employed.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 26 FEB 96 SAIC Initial release for 2.1
--- 22 AUG 96 SAIC Revised Check procedure
---
---!
-
-------------------------------------------------------------------------------
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2009 is
- Verbose : constant Boolean := False;
-
- --=====================================================================
-
- generic
- type Real is digits <>;
- package Generic_Real_Norm_Check is
- procedure Do_Test;
- end Generic_Real_Norm_Check;
-
- -----------------------------------------------------------------------
-
- package body Generic_Real_Norm_Check is
- type Vector is array (Integer range <>) of Real;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames GEF.Sqrt;
-
- function One_Norm (V : Vector) return Real is
- -- sum of absolute values of the elements of the vector
- Result : Real := 0.0;
- begin
- for I in V'Range loop
- Result := Result + abs V(I);
- end loop;
- return Result;
- end One_Norm;
-
- function Inf_Norm (V : Vector) return Real is
- -- greatest absolute vector element
- Result : Real := 0.0;
- begin
- for I in V'Range loop
- if abs V(I) > Result then
- Result := abs V(I);
- end if;
- end loop;
- return Result;
- end Inf_Norm;
-
- function Two_Norm (V : Vector) return Real is
- -- if greatest absolute vector element is 0 then return 0
- -- else return greatest * sqrt (sum((element / greatest) ** 2)))
- -- where greatest is Inf_Norm of the vector
- Inf_N : Real;
- Sum_Squares : Real;
- Term : Real;
- begin
- Inf_N := Inf_Norm (V);
- if Inf_N = 0.0 then
- return 0.0;
- end if;
- Sum_Squares := 0.0;
- for I in V'Range loop
- Term := V (I) / Inf_N;
- Sum_Squares := Sum_Squares + Term * Term;
- end loop;
- return Inf_N * Sqrt (Sum_Squares);
- end Two_Norm;
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real;
- Vector_Length : Integer) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " VectLength:" &
- Integer'Image (Vector_Length) &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Actual - Expected) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- Report.Comment (Test_Name & " vector length" &
- Integer'Image (Vector_Length));
- end if;
- end Check;
-
-
- procedure Do_Test is
- begin
- for Vector_Length in 1 .. 10 loop
- declare
- V : Vector (1..Vector_Length) := (1..Vector_Length => 0.0);
- V1 : Vector (1..Vector_Length) := (1..Vector_Length => 1.0);
- begin
- Check (One_Norm (V), 0.0, "one_norm (z)", 0.0, Vector_Length);
- Check (Inf_Norm (V), 0.0, "inf_norm (z)", 0.0, Vector_Length);
-
- for J in 1..Vector_Length loop
- V := (1..Vector_Length => 0.0);
- V (J) := 1.0;
- Check (One_Norm (V), 1.0, "one_norm (010)",
- 0.0, Vector_Length);
- Check (Inf_Norm (V), 1.0, "inf_norm (010)",
- 0.0, Vector_Length);
- Check (Two_Norm (V), 1.0, "two_norm (010)",
- 0.0, Vector_Length);
- end loop;
-
- Check (One_Norm (V1), Real (Vector_Length), "one_norm (1)",
- 0.0, Vector_Length);
- Check (Inf_Norm (V1), 1.0, "inf_norm (1)",
- 0.0, Vector_Length);
-
- -- error in computing Two_Norm and expected result
- -- are as follows (ME is Model_Epsilon * Expected_Value):
- -- 2ME from expected Sqrt
- -- 2ME from Sqrt in Two_Norm times the error in the
- -- vector calculation.
- -- The vector calculation contains the following error
- -- based upon the length N of the vector:
- -- N*1ME from squaring terms in Two_Norm
- -- N*1ME from the division of each term in Two_Norm
- -- (N-1)*1ME from the sum of the terms
- -- This gives (2 + 2 * (N + N + (N-1)) ) * ME
- -- which simplifies to (2 + 2N + 2N + 2N - 2) * ME
- -- or 6*N*ME
- Check (Two_Norm (V1), Sqrt (Real(Vector_Length)),
- "two_norm (1)",
- (Real (6 * Vector_Length)),
- Vector_Length);
- exception
- when others => Report.Failed ("exception for vector length" &
- Integer'Image (Vector_Length) );
- end;
- end loop;
- end Do_Test;
- end Generic_Real_Norm_Check;
-
- --=====================================================================
-
- generic
- type Real is digits <>;
- package Generic_Complex_Norm_Check is
- procedure Do_Test;
- end Generic_Complex_Norm_Check;
-
- -----------------------------------------------------------------------
-
- package body Generic_Complex_Norm_Check is
- package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
- type Vector is array (Integer range <>) of Complex;
-
- package GEF is new Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames GEF.Sqrt;
-
- function One_Norm (V : Vector) return Real is
- Result : Real := 0.0;
- begin
- for I in V'Range loop
- Result := Result + abs V(I);
- end loop;
- return Result;
- end One_Norm;
-
- function Inf_Norm (V : Vector) return Real is
- Result : Real := 0.0;
- begin
- for I in V'Range loop
- if abs V(I) > Result then
- Result := abs V(I);
- end if;
- end loop;
- return Result;
- end Inf_Norm;
-
- function Two_Norm (V : Vector) return Real is
- Inf_N : Real;
- Sum_Squares : Real;
- Term : Real;
- begin
- Inf_N := Inf_Norm (V);
- if Inf_N = 0.0 then
- return 0.0;
- end if;
- Sum_Squares := 0.0;
- for I in V'Range loop
- Term := abs (V (I) / Inf_N );
- Sum_Squares := Sum_Squares + Term * Term;
- end loop;
- return Inf_N * Sqrt (Sum_Squares);
- end Two_Norm;
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real;
- Vector_Length : Integer) is
- Rel_Error : Real;
- Abs_Error : Real;
- Max_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Report.Failed (Test_Name &
- " VectLength:" &
- Integer'Image (Vector_Length) &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " &
- Real'Image (Actual - Expected) &
- " mre:" & Real'Image (Max_Error) );
- elsif Verbose then
- Report.Comment (Test_Name & " vector length" &
- Integer'Image (Vector_Length));
- end if;
- end Check;
-
-
- procedure Do_Test is
- begin
- for Vector_Length in 1 .. 10 loop
- declare
- V : Vector (1..Vector_Length) :=
- (1..Vector_Length => (0.0, 0.0));
- X, Y : Vector (1..Vector_Length);
- begin
- Check (One_Norm (V), 0.0, "one_norm (z)", 0.0, Vector_Length);
- Check (Inf_Norm (V), 0.0, "inf_norm (z)", 0.0, Vector_Length);
-
- for J in 1..Vector_Length loop
- X := (1..Vector_Length => (0.0, 0.0) );
- Y := X; -- X and Y are now both zeroed
- X (J).Re := 1.0;
- Y (J).Im := 1.0;
- Check (One_Norm (X), 1.0, "one_norm (0x0)",
- 0.0, Vector_Length);
- Check (Inf_Norm (X), 1.0, "inf_norm (0x0)",
- 0.0, Vector_Length);
- Check (Two_Norm (X), 1.0, "two_norm (0x0)",
- 0.0, Vector_Length);
- Check (One_Norm (Y), 1.0, "one_norm (0y0)",
- 0.0, Vector_Length);
- Check (Inf_Norm (Y), 1.0, "inf_norm (0y0)",
- 0.0, Vector_Length);
- Check (Two_Norm (Y), 1.0, "two_norm (0y0)",
- 0.0, Vector_Length);
- end loop;
-
- V := (1..Vector_Length => (3.0, 4.0));
-
- -- error in One_Norm is 3*N*ME for abs computation +
- -- (N-1)*ME for the additions
- -- which gives (4N-1) * ME
- Check (One_Norm (V), 5.0 * Real (Vector_Length),
- "one_norm ((3,4))",
- Real (4*Vector_Length - 1),
- Vector_Length);
-
- -- error in Inf_Norm is from abs of single element (3ME)
- Check (Inf_Norm (V), 5.0,
- "inf_norm ((3,4))",
- 3.0,
- Vector_Length);
-
- -- error in following comes from:
- -- 2ME in sqrt of expected result
- -- 3ME in Inf_Norm calculation
- -- 2ME in sqrt of vector calculation
- -- vector calculation has following error
- -- 3N*ME for abs
- -- N*ME for squaring
- -- N*ME for division
- -- (N-1)ME for sum
- -- this results in [2 + 3 + 2(6N-1) ] * ME
- -- or (12N + 3)ME
- Check (Two_Norm (V), 5.0 * Sqrt (Real(Vector_Length)),
- "two_norm ((3,4))",
- (12.0 * Real (Vector_Length) + 3.0),
- Vector_Length);
- exception
- when others => Report.Failed ("exception for complex " &
- "vector length" &
- Integer'Image (Vector_Length) );
- end;
- end loop;
- end Do_Test;
- end Generic_Complex_Norm_Check;
-
- --=====================================================================
-
- generic
- type Real is digits <>;
- package Generic_Norm_Check is
- procedure Do_Test;
- end Generic_Norm_Check;
-
- -----------------------------------------------------------------------
-
- package body Generic_Norm_Check is
- package RNC is new Generic_Real_Norm_Check (Real);
- package CNC is new Generic_Complex_Norm_Check (Real);
- procedure Do_Test is
- begin
- RNC.Do_Test;
- CNC.Do_Test;
- end Do_Test;
- end Generic_Norm_Check;
-
- --=====================================================================
-
- package Float_Check is new Generic_Norm_Check (Float);
-
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Norm_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
-
-begin
- Report.Test ("CXG2009",
- "Check the accuracy of the real sqrt and complex " &
- " modulus functions");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
- Report.Result;
-end CXG2009;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2010.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2010.a
deleted file mode 100644
index 4140a487526..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2010.a
+++ /dev/null
@@ -1,892 +0,0 @@
--- CXG2010.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the exp function returns
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test contains three test packages that are almost
--- identical. The first two packages differ only in the
--- floating point type that is being tested. The first
--- and third package differ only in whether the generic
--- elementary functions package or the pre-instantiated
--- package is used.
--- The test package is not generic so that the arguments
--- and expected results for some of the test values
--- can be expressed as universal real instead of being
--- computed at runtime.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex and where the Machine_Radix is 2, 4, 8, or 16.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 1 Mar 96 SAIC Initial release for 2.1
--- 2 Sep 96 SAIC Improved check routine
---
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
-
---
--- Notes on derivation of error bound for exp(p)*exp(-p)
---
--- Let a = true value of exp(p) and ac be the computed value.
--- Then a = ac(1+e1), where |e1| <= 4*Model_Epsilon.
--- Similarly, let b = true value of exp(-p) and bc be the computed value.
--- Then b = bc(1+e2), where |e2| <= 4*ME.
---
--- The product of x and y is (x*y)(1+e3), where |e3| <= 1.0ME
---
--- Hence, the computed ab is [ac(1+e1)*bc(1+e2)](1+e3) =
--- (ac*bc)[1 + e1 + e2 + e3 + e1e2 + e1e3 + e2e3 + e1e2e3).
---
--- Throwing away the last four tiny terms, we have (ac*bc)(1 + eta),
---
--- where |eta| <= (4+4+1)ME = 9.0Model_Epsilon.
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-with Ada.Numerics.Elementary_Functions;
-procedure CXG2010 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1000;
- Accuracy_Error_Reported : Boolean := False;
-
- package Float_Check is
- subtype Real is Float;
- procedure Do_Test;
- end Float_Check;
-
- package body Float_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames
- Elementary_Functions.Sqrt;
- function Exp (X : Real) return Real renames
- Elementary_Functions.Exp;
-
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon
- -- instead of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Argument_Range_Check_1 (A, B : Real;
- Test : String) is
- -- test a evenly distributed selection of
- -- arguments selected from the range A to B.
- -- Test using identity: EXP(X-V) = EXP(X) * EXP (-V)
- -- The parameter One_Minus_Exp_Minus_V is the value
- -- 1.0 - Exp (-V)
- -- accurate to machine precision.
- -- This procedure is a translation of part of Cody's test
- X : Real;
- Y : Real;
- ZX, ZY : Real;
- V : constant := 1.0 / 16.0;
- One_Minus_Exp_Minus_V : constant := 6.058693718652421388E-2;
-
- begin
- Accuracy_Error_Reported := False;
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- Y := X - V;
- if Y < 0.0 then
- X := Y + V;
- end if;
-
- ZX := Exp (X);
- ZY := Exp (Y);
-
- -- ZX := Exp(X) - Exp(X) * (1 - Exp(-V);
- -- which simplifies to ZX := Exp (X-V);
- ZX := ZX - ZX * One_Minus_Exp_Minus_V;
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (ZY, ZX,
- "test " & Test & " -" &
- Integer'Image (I) &
- " exp (" & Real'Image (X) & ")",
- 9.0);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check 1");
- when others =>
- Report.Failed ("exception in argument range check 1");
- end Argument_Range_Check_1;
-
-
-
- procedure Argument_Range_Check_2 (A, B : Real;
- Test : String) is
- -- test a evenly distributed selection of
- -- arguments selected from the range A to B.
- -- Test using identity: EXP(X-V) = EXP(X) * EXP (-V)
- -- The parameter One_Minus_Exp_Minus_V is the value
- -- 1.0 - Exp (-V)
- -- accurate to machine precision.
- -- This procedure is a translation of part of Cody's test
- X : Real;
- Y : Real;
- ZX, ZY : Real;
- V : constant := 45.0 / 16.0;
- -- 1/16 - Exp(45/16)
- Coeff : constant := 2.4453321046920570389E-3;
-
- begin
- Accuracy_Error_Reported := False;
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- Y := X - V;
- if Y < 0.0 then
- X := Y + V;
- end if;
-
- ZX := Exp (X);
- ZY := Exp (Y);
-
- -- ZX := Exp(X) * 1/16 - Exp(X) * Coeff;
- -- where Coeff is 1/16 - Exp(45/16)
- -- which simplifies to ZX := Exp (X-V);
- ZX := ZX * 0.0625 - ZX * Coeff;
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (ZY, ZX,
- "test " & Test & " -" &
- Integer'Image (I) &
- " exp (" & Real'Image (X) & ")",
- 9.0);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check 2");
- when others =>
- Report.Failed ("exception in argument range check 2");
- end Argument_Range_Check_2;
-
-
- procedure Do_Test is
- begin
-
- --- test 1 ---
- declare
- Y : Real;
- begin
- Y := Exp(1.0);
- -- normal accuracy requirements
- Check (Y, Ada.Numerics.e, "test 1 -- exp(1)", 4.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- Y : Real;
- begin
- Y := Exp(16.0) * Exp(-16.0);
- Check (Y, 1.0, "test 2 -- exp(16)*exp(-16)", 9.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- Y : Real;
- begin
- Y := Exp (Ada.Numerics.Pi) * Exp (-Ada.Numerics.Pi);
- Check (Y, 1.0, "test 3 -- exp(pi)*exp(-pi)", 9.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- Y : Real;
- begin
- Y := Exp(0.0);
- Check (Y, 1.0, "test 4 -- exp(0.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- -- constants used here only have 19 digits of precision
- if Real'Digits > 19 then
- Error_Low_Bound := 0.00000_00000_00000_0001;
- Report.Comment ("exp accuracy checked to 19 digits");
- end if;
-
- Argument_Range_Check_1 ( 1.0/Sqrt(Real(Real'Machine_Radix)),
- 1.0,
- "5");
- Error_Low_Bound := 0.0; -- reset
-
- --- test 6 ---
- -- constants used here only have 19 digits of precision
- if Real'Digits > 19 then
- Error_Low_Bound := 0.00000_00000_00000_0001;
- Report.Comment ("exp accuracy checked to 19 digits");
- end if;
-
- Argument_Range_Check_2 (1.0,
- Sqrt(Real(Real'Machine_Radix)),
- "6");
- Error_Low_Bound := 0.0; -- reset
-
- end Do_Test;
- end Float_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
-
-
- package A_Long_Float_Check is
- subtype Real is A_Long_Float;
- procedure Do_Test;
- end A_Long_Float_Check;
-
- package body A_Long_Float_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames
- Elementary_Functions.Sqrt;
- function Exp (X : Real) return Real renames
- Elementary_Functions.Exp;
-
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon
- -- instead of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Argument_Range_Check_1 (A, B : Real;
- Test : String) is
- -- test a evenly distributed selection of
- -- arguments selected from the range A to B.
- -- Test using identity: EXP(X-V) = EXP(X) * EXP (-V)
- -- The parameter One_Minus_Exp_Minus_V is the value
- -- 1.0 - Exp (-V)
- -- accurate to machine precision.
- -- This procedure is a translation of part of Cody's test
- X : Real;
- Y : Real;
- ZX, ZY : Real;
- V : constant := 1.0 / 16.0;
- One_Minus_Exp_Minus_V : constant := 6.058693718652421388E-2;
-
- begin
- Accuracy_Error_Reported := False;
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- Y := X - V;
- if Y < 0.0 then
- X := Y + V;
- end if;
-
- ZX := Exp (X);
- ZY := Exp (Y);
-
- -- ZX := Exp(X) - Exp(X) * (1 - Exp(-V);
- -- which simplifies to ZX := Exp (X-V);
- ZX := ZX - ZX * One_Minus_Exp_Minus_V;
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (ZY, ZX,
- "test " & Test & " -" &
- Integer'Image (I) &
- " exp (" & Real'Image (X) & ")",
- 9.0);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check 1");
- when others =>
- Report.Failed ("exception in argument range check 1");
- end Argument_Range_Check_1;
-
-
-
- procedure Argument_Range_Check_2 (A, B : Real;
- Test : String) is
- -- test a evenly distributed selection of
- -- arguments selected from the range A to B.
- -- Test using identity: EXP(X-V) = EXP(X) * EXP (-V)
- -- The parameter One_Minus_Exp_Minus_V is the value
- -- 1.0 - Exp (-V)
- -- accurate to machine precision.
- -- This procedure is a translation of part of Cody's test
- X : Real;
- Y : Real;
- ZX, ZY : Real;
- V : constant := 45.0 / 16.0;
- -- 1/16 - Exp(45/16)
- Coeff : constant := 2.4453321046920570389E-3;
-
- begin
- Accuracy_Error_Reported := False;
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- Y := X - V;
- if Y < 0.0 then
- X := Y + V;
- end if;
-
- ZX := Exp (X);
- ZY := Exp (Y);
-
- -- ZX := Exp(X) * 1/16 - Exp(X) * Coeff;
- -- where Coeff is 1/16 - Exp(45/16)
- -- which simplifies to ZX := Exp (X-V);
- ZX := ZX * 0.0625 - ZX * Coeff;
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (ZY, ZX,
- "test " & Test & " -" &
- Integer'Image (I) &
- " exp (" & Real'Image (X) & ")",
- 9.0);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check 2");
- when others =>
- Report.Failed ("exception in argument range check 2");
- end Argument_Range_Check_2;
-
-
- procedure Do_Test is
- begin
-
- --- test 1 ---
- declare
- Y : Real;
- begin
- Y := Exp(1.0);
- -- normal accuracy requirements
- Check (Y, Ada.Numerics.e, "test 1 -- exp(1)", 4.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- Y : Real;
- begin
- Y := Exp(16.0) * Exp(-16.0);
- Check (Y, 1.0, "test 2 -- exp(16)*exp(-16)", 9.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- Y : Real;
- begin
- Y := Exp (Ada.Numerics.Pi) * Exp (-Ada.Numerics.Pi);
- Check (Y, 1.0, "test 3 -- exp(pi)*exp(-pi)", 9.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- Y : Real;
- begin
- Y := Exp(0.0);
- Check (Y, 1.0, "test 4 -- exp(0.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- -- constants used here only have 19 digits of precision
- if Real'Digits > 19 then
- Error_Low_Bound := 0.00000_00000_00000_0001;
- Report.Comment ("exp accuracy checked to 19 digits");
- end if;
-
- Argument_Range_Check_1 ( 1.0/Sqrt(Real(Real'Machine_Radix)),
- 1.0,
- "5");
- Error_Low_Bound := 0.0; -- reset
-
- --- test 6 ---
- -- constants used here only have 19 digits of precision
- if Real'Digits > 19 then
- Error_Low_Bound := 0.00000_00000_00000_0001;
- Report.Comment ("exp accuracy checked to 19 digits");
- end if;
-
- Argument_Range_Check_2 (1.0,
- Sqrt(Real(Real'Machine_Radix)),
- "6");
- Error_Low_Bound := 0.0; -- reset
-
- end Do_Test;
- end A_Long_Float_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
- package Non_Generic_Check is
- procedure Do_Test;
- subtype Real is Float;
- end Non_Generic_Check;
-
- package body Non_Generic_Check is
-
- package Elementary_Functions renames
- Ada.Numerics.Elementary_Functions;
- function Sqrt (X : Real) return Real renames
- Elementary_Functions.Sqrt;
- function Exp (X : Real) return Real renames
- Elementary_Functions.Exp;
-
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon
- -- instead of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Argument_Range_Check_1 (A, B : Real;
- Test : String) is
- -- test a evenly distributed selection of
- -- arguments selected from the range A to B.
- -- Test using identity: EXP(X-V) = EXP(X) * EXP (-V)
- -- The parameter One_Minus_Exp_Minus_V is the value
- -- 1.0 - Exp (-V)
- -- accurate to machine precision.
- -- This procedure is a translation of part of Cody's test
- X : Real;
- Y : Real;
- ZX, ZY : Real;
- V : constant := 1.0 / 16.0;
- One_Minus_Exp_Minus_V : constant := 6.058693718652421388E-2;
-
- begin
- Accuracy_Error_Reported := False;
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- Y := X - V;
- if Y < 0.0 then
- X := Y + V;
- end if;
-
- ZX := Exp (X);
- ZY := Exp (Y);
-
- -- ZX := Exp(X) - Exp(X) * (1 - Exp(-V);
- -- which simplifies to ZX := Exp (X-V);
- ZX := ZX - ZX * One_Minus_Exp_Minus_V;
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (ZY, ZX,
- "test " & Test & " -" &
- Integer'Image (I) &
- " exp (" & Real'Image (X) & ")",
- 9.0);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check 1");
- when others =>
- Report.Failed ("exception in argument range check 1");
- end Argument_Range_Check_1;
-
-
-
- procedure Argument_Range_Check_2 (A, B : Real;
- Test : String) is
- -- test a evenly distributed selection of
- -- arguments selected from the range A to B.
- -- Test using identity: EXP(X-V) = EXP(X) * EXP (-V)
- -- The parameter One_Minus_Exp_Minus_V is the value
- -- 1.0 - Exp (-V)
- -- accurate to machine precision.
- -- This procedure is a translation of part of Cody's test
- X : Real;
- Y : Real;
- ZX, ZY : Real;
- V : constant := 45.0 / 16.0;
- -- 1/16 - Exp(45/16)
- Coeff : constant := 2.4453321046920570389E-3;
-
- begin
- Accuracy_Error_Reported := False;
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- Y := X - V;
- if Y < 0.0 then
- X := Y + V;
- end if;
-
- ZX := Exp (X);
- ZY := Exp (Y);
-
- -- ZX := Exp(X) * 1/16 - Exp(X) * Coeff;
- -- where Coeff is 1/16 - Exp(45/16)
- -- which simplifies to ZX := Exp (X-V);
- ZX := ZX * 0.0625 - ZX * Coeff;
-
- -- note that since the expected value is computed, we
- -- must take the error in that computation into account.
- Check (ZY, ZX,
- "test " & Test & " -" &
- Integer'Image (I) &
- " exp (" & Real'Image (X) & ")",
- 9.0);
- exit when Accuracy_Error_Reported;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in argument range check 2");
- when others =>
- Report.Failed ("exception in argument range check 2");
- end Argument_Range_Check_2;
-
-
- procedure Do_Test is
- begin
-
- --- test 1 ---
- declare
- Y : Real;
- begin
- Y := Exp(1.0);
- -- normal accuracy requirements
- Check (Y, Ada.Numerics.e, "test 1 -- exp(1)", 4.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- Y : Real;
- begin
- Y := Exp(16.0) * Exp(-16.0);
- Check (Y, 1.0, "test 2 -- exp(16)*exp(-16)", 9.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- Y : Real;
- begin
- Y := Exp (Ada.Numerics.Pi) * Exp (-Ada.Numerics.Pi);
- Check (Y, 1.0, "test 3 -- exp(pi)*exp(-pi)", 9.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- Y : Real;
- begin
- Y := Exp(0.0);
- Check (Y, 1.0, "test 4 -- exp(0.0)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
-
- --- test 5 ---
- -- constants used here only have 19 digits of precision
- if Real'Digits > 19 then
- Error_Low_Bound := 0.00000_00000_00000_0001;
- Report.Comment ("exp accuracy checked to 19 digits");
- end if;
-
- Argument_Range_Check_1 ( 1.0/Sqrt(Real(Real'Machine_Radix)),
- 1.0,
- "5");
- Error_Low_Bound := 0.0; -- reset
-
- --- test 6 ---
- -- constants used here only have 19 digits of precision
- if Real'Digits > 19 then
- Error_Low_Bound := 0.00000_00000_00000_0001;
- Report.Comment ("exp accuracy checked to 19 digits");
- end if;
-
- Argument_Range_Check_2 (1.0,
- Sqrt(Real(Real'Machine_Radix)),
- "6");
- Error_Low_Bound := 0.0; -- reset
-
- end Do_Test;
- end Non_Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-begin
- Report.Test ("CXG2010",
- "Check the accuracy of the exp function");
-
- -- the test only applies to machines with a radix of 2,4,8, or 16
- case Float'Machine_Radix is
- when 2 | 4 | 8 | 16 => null;
- when others =>
- Report.Not_Applicable ("only applicable to binary radix");
- Report.Result;
- return;
- end case;
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking non-generic package");
- end if;
-
- Non_Generic_Check.Do_Test;
-
- Report.Result;
-end CXG2010;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2011.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2011.a
deleted file mode 100644
index 2c018b1321e..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2011.a
+++ /dev/null
@@ -1,490 +0,0 @@
--- CXG2011.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the log function returns
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks in a range where a Taylor series can be used to compute
--- the expected result.
--- Checks that use an identity for determining the result.
--- Exception checks.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 1 Mar 96 SAIC Initial release for 2.1
--- 22 Aug 96 SAIC Improved Check routine
--- 02 DEC 97 EDS Log (0.0) must raise Constraint_Error,
--- not Argument_Error
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2011 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1000;
-
- -- CRC Handbook Page 738
- Ln10 : constant := 2.30258_50929_94045_68401_79914_54684_36420_76011_01489;
- Ln2 : constant := 0.69314_71805_59945_30941_72321_21458_17656_80755_00134;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real'Base) return Real'Base renames
- Elementary_Functions.Sqrt;
- function Exp (X : Real'Base) return Real'Base renames
- Elementary_Functions.Exp;
- function Log (X : Real'Base) return Real'Base renames
- Elementary_Functions.Log;
- function Log (X, Base : Real'Base) return Real'Base renames
- Elementary_Functions.Log;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon
- -- instead of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Value_Test is
- begin
-
- --- test 1 ---
- declare
- Y : Real;
- begin
- Y := Log(1.0);
- Check (Y, 0.0, "special value test 1 -- log(1)",
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 1");
- when others =>
- Report.Failed ("exception in test 1");
- end;
-
- --- test 2 ---
- declare
- Y : Real;
- begin
- Y := Log(10.0);
- Check (Y, Ln10, "special value test 2 -- log(10)", 4.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 2");
- when others =>
- Report.Failed ("exception in test 2");
- end;
-
- --- test 3 ---
- declare
- Y : Real;
- begin
- Y := Log (2.0);
- Check (Y, Ln2, "special value test 3 -- log(2)", 4.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 3");
- when others =>
- Report.Failed ("exception in test 3");
- end;
-
- --- test 4 ---
- declare
- Y : Real;
- begin
- Y := Log (2.0 ** 18, 2.0);
- Check (Y, 18.0, "special value test 4 -- log(2**18,2)", 4.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in test 4");
- when others =>
- Report.Failed ("exception in test 4");
- end;
- end Special_Value_Test;
-
-
- procedure Taylor_Series_Test is
- -- Use a 4 term taylor series expansion to check a selection of
- -- arguments very near 1.0.
- -- The range is chosen so that the 4 term taylor series will
- -- provide accuracy to machine precision. Cody pg 49-50.
- Half_Range : constant Real := Real'Model_Epsilon * 50.0;
- A : constant Real := 1.0 - Half_Range;
- B : constant Real := 1.0 + Half_Range;
- X : Real;
- Xm1 : Real;
- Expected : Real;
- Actual : Real;
-
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
-
- Xm1 := X - 1.0;
- -- The following is the first 4 terms of the taylor series
- -- that has been rearranged to minimize error in the calculation
- Expected := (Xm1 * (1.0/3.0 - Xm1/4.0) - 0.5) * Xm1 * Xm1 + Xm1;
-
- Actual := Log (X);
- Check (Actual, Expected,
- "Taylor Series Test -" &
- Integer'Image (I) &
- " log (" & Real'Image (X) & ")",
- 4.0);
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Taylor Series Test");
- when others =>
- Report.Failed ("exception in Taylor Series Test");
- end Taylor_Series_Test;
-
-
-
- procedure Log_Difference_Identity is
- -- Check using the identity ln(x) = ln(17x/16) - ln(17/16)
- -- over the range A to B.
- -- The selected range assures that both X and 17x/16 will
- -- have the same exponents and neither argument gets too close
- -- to 1. Cody pg 50.
- A : constant Real := 1.0 / Sqrt (2.0);
- B : constant Real := 15.0 / 16.0;
- X : Real;
- Expected : Real;
- Actual : Real;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- -- magic argument purification
- X := Real'Machine (Real'Machine (X+8.0) - 8.0);
-
- Expected := Log (X + X / 16.0) - Log (17.0/16.0);
-
- Actual := Log (X);
- Check (Actual, Expected,
- "Log Difference Identity -" &
- Integer'Image (I) &
- " log (" & Real'Image (X) & ")",
- 4.0);
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Log Difference Identity Test");
- when others =>
- Report.Failed ("exception in Log Difference Identity Test");
- end Log_Difference_Identity;
-
-
- procedure Log_Product_Identity is
- -- Check using the identity ln(x**2) = 2ln(x)
- -- over the range A to B.
- -- This large range is chosen to minimize the possibility of
- -- undetected systematic errors. Cody pg 53.
- A : constant Real := 16.0;
- B : constant Real := 240.0;
- X : Real;
- Expected : Real;
- Actual : Real;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- -- magic argument purification
- X := Real'Machine (Real'Machine (X+8.0) - 8.0);
-
- Expected := 2.0 * Log (X);
-
- Actual := Log (X*X);
- Check (Actual, Expected,
- "Log Product Identity -" &
- Integer'Image (I) &
- " log (" & Real'Image (X) & ")",
- 4.0);
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Log Product Identity Test");
- when others =>
- Report.Failed ("exception in Log Product Identity Test");
- end Log_Product_Identity;
-
-
- procedure Log10_Test is
- -- Check using the identity log(x) = log(11x/10) - log(1.1)
- -- over the range A to B. See Cody pg 52.
- A : constant Real := 1.0 / Sqrt (10.0);
- B : constant Real := 0.9;
- X : Real;
- Expected : Real;
- Actual : Real;
- begin
- if Real'Digits > 17 then
- -- constant used below is accuract to 17 digits
- Error_Low_Bound := 0.00000_00000_00000_01;
- Report.Comment ("log accuracy checked to 19 digits");
- end if;
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
-
- Expected := Log (X + X/10.0, 10.0)
- - 3.77060_15822_50407_5E-4 - 21.0 / 512.0;
-
- Actual := Log (X, 10.0);
- Check (Actual, Expected,
- "Log 10 Test -" &
- Integer'Image (I) &
- " log (" & Real'Image (X) & ")",
- 4.0);
-
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- exit when Accuracy_Error_Reported;
- end loop;
- Error_Low_Bound := 0.0; -- reset
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Log 10 Test");
- when others =>
- Report.Failed ("exception in Log 10 Test");
- end Log10_Test;
-
-
- procedure Exception_Test is
- X1, X2, X3, X4 : Real;
- begin
- begin
- X1 := Log (0.0);
- Report.Failed ("exception not raised for LOG(0)");
- exception
- -- Log (0.0) must raise Constraint_Error, not Argument_Error,
- -- as per A.5.1(28,29). Was incorrect in ACVC 2.1 release.
- when Ada.Numerics.Argument_Error =>
- Report.Failed ("Argument_Error raised instead of" &
- " Constraint_Error for LOG(0)--A.5.1(28,29)");
- when Constraint_Error => null; -- ok
- when others =>
- Report.Failed ("wrong exception raised for LOG(0)");
- end;
-
- begin
- X2 := Log ( 1.0, 0.0);
- Report.Failed ("exception not raised for LOG(1,0)");
- exception
- when Ada.Numerics.Argument_Error => null; -- ok
- when Constraint_Error =>
- Report.Failed ("constraint_error raised instead of" &
- " argument_error for LOG(1,0)");
- when others =>
- Report.Failed ("wrong exception raised for LOG(1,0)");
- end;
-
- begin
- X3 := Log (1.0, 1.0);
- Report.Failed ("exception not raised for LOG(1,1)");
- exception
- when Ada.Numerics.Argument_Error => null; -- ok
- when Constraint_Error =>
- Report.Failed ("constraint_error raised instead of" &
- " argument_error for LOG(1,1)");
- when others =>
- Report.Failed ("wrong exception raised for LOG(1,1)");
- end;
-
- begin
- X4 := Log (1.0, -10.0);
- Report.Failed ("exception not raised for LOG(1,-10)");
- exception
- when Ada.Numerics.Argument_Error => null; -- ok
- when Constraint_Error =>
- Report.Failed ("constraint_error raised instead of" &
- " argument_error for LOG(1,-10)");
- when others =>
- Report.Failed ("wrong exception raised for LOG(1,-10)");
- end;
-
- -- optimizer thwarting
- if Report.Ident_Bool (False) then
- Report.Comment (Real'Image (X1+X2+X3+X4));
- end if;
- end Exception_Test;
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Taylor_Series_Test;
- Log_Difference_Identity;
- Log_Product_Identity;
- Log10_Test;
- Exception_Test;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2011",
- "Check the accuracy of the log function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2011;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2012.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2012.a
deleted file mode 100644
index 6a665d0e077..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2012.a
+++ /dev/null
@@ -1,438 +0,0 @@
--- CXG2012.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the exponentiation operator returns
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
--- Exception checks.
--- While this test concentrates on the "**" operator
--- defined in Generic_Elementary_Functions, a check is also
--- performed on the standard "**" operator.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 7 Mar 96 SAIC Initial release for 2.1
--- 2 Sep 96 SAIC Improvements as suggested by reviewers
--- 3 Jun 98 EDS Add parens to ensure that the expression is not
--- evaluated by multiplying its two large terms
--- together and overflowing.
--- 3 Dec 01 RLB Added 'Machine to insure that equality tests
--- are certain to work.
---
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2012 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1000;
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames
- Elementary_Functions.Sqrt;
- function Exp (X : Real) return Real renames
- Elementary_Functions.Exp;
- function Log (X : Real) return Real renames
- Elementary_Functions.Log;
- function "**" (L, R : Real) return Real renames
- Elementary_Functions."**";
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon
- -- instead of Model_Epsilon and Expected.
- Rel_Error := MRE * (abs Expected * Real'Model_Epsilon);
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- -- the following version of Check computes the allowed error bound
- -- using the operands
- procedure Check (Actual, Expected : Real;
- Left, Right : Real;
- Test_Name : String;
- MRE_Factor : Real := 1.0) is
- MRE : Real;
- begin
- MRE := MRE_Factor * (4.0 + abs (Right * Log(Left)) / 32.0);
- Check (Actual, Expected, Test_Name, MRE);
- end Check;
-
-
- procedure Real_To_Integer_Test is
- type Int_Check is
- record
- Left : Real;
- Right : Integer;
- Expected : Real;
- end record;
- type Int_Checks is array (Positive range <>) of Int_Check;
-
- -- the following tests use only model numbers so the result
- -- is expected to be exact.
- IC : constant Int_Checks :=
- ( ( 2.0, 5, 32.0),
- ( -2.0, 5, -32.0),
- ( 0.5, -5, 32.0),
- ( 2.0, 0, 1.0),
- ( 0.0, 0, 1.0) );
- begin
- for I in IC'Range loop
- declare
- Y : Real;
- begin
- Y := IC (I).Left ** IC (I).Right;
- Check (Y, IC (I).Expected,
- "real to integer test" &
- Real'Image (IC (I).Left) & " ** " &
- Integer'Image (IC (I).Right),
- 0.0); -- no error allowed
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in rtoi test " &
- Integer'Image (I));
- when others =>
- Report.Failed ("exception in rtoi test " &
- Integer'Image (I));
- end;
- end loop;
- end Real_To_Integer_Test;
-
-
- procedure Special_Value_Test is
- No_Error : constant := 0.0;
- begin
- Check (0.0 ** 1.0, 0.0, "0**1", No_Error);
- Check (1.0 ** 0.0, 1.0, "1**0", No_Error);
-
- Check ( 2.0 ** 5.0, 32.0, 2.0, 5.0, "2**5");
- Check ( 0.5**(-5.0), 32.0, 0.5, -5.0, "0.5**-5");
-
- Check (Sqrt2 ** 4.0, 4.0, Sqrt2, 4.0, "Sqrt2**4");
- Check (Sqrt3 ** 6.0, 27.0, Sqrt3, 6.0, "Sqrt3**6");
-
- Check (2.0 ** 0.5, Sqrt2, 2.0, 0.5, "2.0**0.5");
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Special Value Test");
- when others =>
- Report.Failed ("exception in Special Value Test");
- end Special_Value_Test;
-
-
- procedure Small_Range_Test is
- -- Several checks over the range 1/radix .. 1
- A : constant Real := 1.0 / Real (Real'Machine_Radix);
- B : constant Real := 1.0;
- X : Real;
- -- In the cases below where the expected result is
- -- inexact we allow an additional error amount of
- -- 1.0 * Model_Epsilon to account for that error.
- -- This is accomplished by the factor of 1.25 times
- -- the computed error bound (which is > 4.0) thus
- -- increasing the error bound by at least
- -- 1.0 * Model_Epsilon
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 0..Max_Samples loop
- X := Real'Machine((B - A) * Real (I) / Real (Max_Samples) + A);
-
- Check (X ** 1.0, X, -- exact result required
- "Small range" & Integer'Image (I) & ": " &
- Real'Image (X) & " ** 1.0",
- 0.0);
-
- Check ((X*X) ** 1.5, X**3, X*X, 1.5,
- "Small range" & Integer'Image (I) & ": " &
- Real'Image (X*X) & " ** 1.5",
- 1.25);
-
- Check (X ** 13.5, 1.0 / (X ** (-13.5)), X, 13.5,
- "Small range" & Integer'Image (I) & ": " &
- Real'Image (X) & " ** 13.5",
- 2.0); -- 2 ** computations
-
- Check ((X*X) ** 1.25, X**(2.5), X*X, 1.25,
- "Small range" & Integer'Image (I) & ": " &
- Real'Image (X*X) & " ** 1.25",
- 2.0); -- 2 ** computations
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Small Range Test");
- when others =>
- Report.Failed ("exception in Small Range Test");
- end Small_Range_Test;
-
-
- procedure Large_Range_Test is
- -- Check over the range A to B where A is 1.0 and
- -- B is a large value.
- A : constant Real := 1.0;
- B : Real;
- X : Real;
- Iteration : Integer := 0;
- Subtest : Character := 'X';
- begin
- -- upper bound of range should be as large as possible where
- -- B**3 is still valid.
- B := Real'Safe_Last ** 0.333;
- Accuracy_Error_Reported := False; -- reset
- for I in 0..Max_Samples loop
- Iteration := I;
- Subtest := 'X';
- X := Real'Machine((B - A) * (Real (I) / Real (Max_Samples)) + A);
-
- Subtest := 'A';
- Check (X ** 1.0, X, -- exact result required
- "Large range" & Integer'Image (I) & ": " &
- Real'Image (X) & " ** 1.0",
- 0.0);
-
- Subtest := 'B';
- Check ((X*X) ** 1.5, X**3, X*X, 1.5,
- "Large range" & Integer'Image (I) & ": " &
- Real'Image (X*X) & " ** 1.5",
- 1.25); -- inexact expected result
-
- Subtest := 'C';
- Check ((X*X) ** 1.25, X**(2.5), X*X, 1.25,
- "Large range" & Integer'Image (I) & ": " &
- Real'Image (X*X) & " ** 1.25",
- 2.0); -- two ** operators
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Large Range Test" &
- Integer'Image (Iteration) & Subtest);
- when others =>
- Report.Failed ("exception in Large Range Test" &
- Integer'Image (Iteration) & Subtest);
- end Large_Range_Test;
-
-
- procedure Exception_Test is
- X1, X2, X3, X4 : Real;
- begin
- begin
- X1 := 0.0 ** (-1.0);
- Report.Failed ("exception not raised for 0**-1");
- exception
- when Ada.Numerics.Argument_Error =>
- Report.Failed ("argument_error raised instead of" &
- " constraint_error for 0**-1");
- when Constraint_Error => null; -- ok
- when others =>
- Report.Failed ("wrong exception raised for 0**-1");
- end;
-
- begin
- X2 := 0.0 ** 0.0;
- Report.Failed ("exception not raised for 0**0");
- exception
- when Ada.Numerics.Argument_Error => null; -- ok
- when Constraint_Error =>
- Report.Failed ("constraint_error raised instead of" &
- " argument_error for 0**0");
- when others =>
- Report.Failed ("wrong exception raised for 0**0");
- end;
-
- begin
- X3 := (-1.0) ** 1.0;
- Report.Failed ("exception not raised for -1**1");
- exception
- when Ada.Numerics.Argument_Error => null; -- ok
- when Constraint_Error =>
- Report.Failed ("constraint_error raised instead of" &
- " argument_error for -1**1");
- when others =>
- Report.Failed ("wrong exception raised for -1**1");
- end;
-
- begin
- X4 := (-2.0) ** 2.0;
- Report.Failed ("exception not raised for -2**2");
- exception
- when Ada.Numerics.Argument_Error => null; -- ok
- when Constraint_Error =>
- Report.Failed ("constraint_error raised instead of" &
- " argument_error for -2**2");
- when others =>
- Report.Failed ("wrong exception raised for -2**2");
- end;
-
- -- optimizer thwarting
- if Report.Ident_Bool (False) then
- Report.Comment (Real'Image (X1+X2+X3+X4));
- end if;
- end Exception_Test;
-
-
- procedure Do_Test is
- begin
- Real_To_Integer_Test;
- Special_Value_Test;
- Small_Range_Test;
- Large_Range_Test;
- Exception_Test;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2012",
- "Check the accuracy of the ** operator");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2012;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2013.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2013.a
deleted file mode 100644
index 94f180b804d..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2013.a
+++ /dev/null
@@ -1,367 +0,0 @@
--- CXG2013.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the TAN and COT functions return
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
--- Exception checks.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 11 Mar 96 SAIC Initial release for 2.1
--- 17 Aug 96 SAIC Commentary fixes.
--- 03 Feb 97 PWB.CTA Removed checks with explicit Cycle => 2.0*Pi
--- 02 DEC 97 EDS Change Max_Samples constant to 1001.
--- 29 JUN 98 EDS Deleted Special_Angle_Test as fatally flawed.
-
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2013 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1001;
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sqrt (X : Real) return Real renames
- Elementary_Functions.Sqrt;
- function Tan (X : Real) return Real renames
- Elementary_Functions.Tan;
- function Cot (X : Real) return Real renames
- Elementary_Functions.Cot;
- function Tan (X, Cycle : Real) return Real renames
- Elementary_Functions.Tan;
- function Cot (X, Cycle : Real) return Real renames
- Elementary_Functions.Cot;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
- -- factor to be applied in computing MRE
- Maximum_Relative_Error : constant Real := 4.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
-
- procedure Exact_Result_Test is
- No_Error : constant := 0.0;
- begin
- -- A.5.1(38);6.0
- Check (Tan (0.0), 0.0, "tan(0)", No_Error);
-
- -- A.5.1(41);6.0
- Check (Tan (180.0, 360.0), 0.0, "tan(180,360)", No_Error);
- Check (Tan (360.0, 360.0), 0.0, "tan(360,360)", No_Error);
- Check (Tan (720.0, 360.0), 0.0, "tan(720,360)", No_Error);
-
- -- A.5.1(41);6.0
- Check (Cot ( 90.0, 360.0), 0.0, "cot( 90,360)", No_Error);
- Check (Cot (270.0, 360.0), 0.0, "cot(270,360)", No_Error);
- Check (Cot (810.0, 360.0), 0.0, "cot(810,360)", No_Error);
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Tan_Test (A, B : Real) is
- -- Use identity Tan(X) = [2*Tan(x/2)]/[1-Tan(x/2) ** 2]
- -- checks over the range -pi/4 .. pi/4 require no argument reduction
- -- checks over the range 7pi/8 .. 9pi/8 require argument reduction
- X, Y : Real;
- Actual1, Actual2 : Real;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- -- argument purification to insure x and x/2 are exact
- -- See Cody page 170.
- Y := Real'Machine (X*0.5);
- X := Real'Machine (Y + Y);
-
- Actual1 := Tan(X);
- Actual2 := (2.0 * Tan (Y)) / (1.0 - Tan (Y) ** 2);
-
- if abs (X - Pi) > ( (B-A)/Real(2*Max_Samples) ) then
- Check (Actual1, Actual2,
- "Tan_Test " & Integer'Image (I) & ": tan(" &
- Real'Image (X) & ") ",
- (1.0 + Sqrt2) * Maximum_Relative_Error);
- -- see Cody pg 165 for error bound info
- end if;
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Tan_Test");
- when others =>
- Report.Failed ("exception in Tan_Test");
- end Tan_Test;
-
-
-
- procedure Cot_Test is
- -- Use identity Cot(X) = [Cot(X/2)**2 - 1]/[2*Cot(X/2)]
- A : constant := 6.0 * Pi;
- B : constant := 25.0 / 4.0 * Pi;
- X, Y : Real;
- Actual1, Actual2 : Real;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- -- argument purification to insure x and x/2 are exact.
- -- See Cody page 170.
- Y := Real'Machine (X*0.5);
- X := Real'Machine (Y + Y);
-
- Actual1 := Cot(X);
- Actual2 := (Cot (Y) ** 2 - 1.0) / (2.0 * Cot (Y));
-
- Check (Actual1, Actual2,
- "Cot_Test " & Integer'Image (I) & ": cot(" &
- Real'Image (X) & ") ",
- (1.0 + Sqrt2) * Maximum_Relative_Error);
- -- see Cody pg 165 for error bound info
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Cot_Test");
- when others =>
- Report.Failed ("exception in Cot_Test");
- end Cot_Test;
-
-
- procedure Exception_Test is
- X1, X2, X3, X4, X5 : Real := 0.0;
- begin
-
-
- begin -- A.5.1(20);6.0
- X1 := Tan (0.0, Cycle => 0.0);
- Report.Failed ("no exception for cycle = 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle = 0.0");
- end;
-
- begin -- A.5.1(20);6.0
- X2 := Cot (1.0, Cycle => -3.0);
- Report.Failed ("no exception for cycle < 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle < 0.0");
- end;
-
- -- the remaining tests only apply to machines that overflow
- if Real'Machine_Overflows then -- A.5.1(28);6.0
-
- begin -- A.5.1(29);6.0
- X3 := Cot (0.0);
- Report.Failed ("exception not raised for cot(0)");
- exception
- when Constraint_Error => null; -- ok
- when others =>
- Report.Failed ("wrong exception raised for cot(0)");
- end;
-
- begin -- A.5.1(31);6.0
- X4 := Tan (90.0, 360.0);
- Report.Failed ("exception not raised for tan(90,360)");
- exception
- when Constraint_Error => null; -- ok
- when others =>
- Report.Failed ("wrong exception raised for tan(90,360)");
- end;
-
- begin -- A.5.1(32);6.0
- X5 := Cot (180.0, 360.0);
- Report.Failed ("exception not raised for cot(180,360)");
- exception
- when Constraint_Error => null; -- ok
- when others =>
- Report.Failed ("wrong exception raised for cot(180,360)");
- end;
- end if;
-
- -- optimizer thwarting
- if Report.Ident_Bool (False) then
- Report.Comment (Real'Image (X1+X2+X3+X4+X5));
- end if;
- end Exception_Test;
-
-
- procedure Do_Test is
- begin
- Exact_Result_Test;
- Tan_Test (-Pi/4.0, Pi/4.0);
- Tan_Test (7.0*Pi/8.0, 9.0*Pi/8.0);
- Cot_Test;
- Exception_Test;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2013",
- "Check the accuracy of the TAN and COT functions");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2013;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2014.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2014.a
deleted file mode 100644
index 48499a2556f..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2014.a
+++ /dev/null
@@ -1,399 +0,0 @@
--- CXG2014.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the SINH and COSH functions return
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
--- Exception checks.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 15 Mar 96 SAIC Initial release for 2.1
--- 03 Jun 98 EDS In line 80, change 1000 to 1024, making it a model
--- number. Add Taylor Series terms in line 281.
--- 15 Feb 99 RLB Repaired Subtraction_Error_Test to avoid precision
--- problems.
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2014 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1024;
-
- E : constant := Ada.Numerics.E;
- Cosh1 : constant := (E + 1.0 / E) / 2.0; -- cosh(1.0)
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
- function Sinh (X : Real) return Real renames
- Elementary_Functions.Sinh;
- function Cosh (X : Real) return Real renames
- Elementary_Functions.Cosh;
- function Log (X : Real) return Real renames
- Elementary_Functions.Log;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Small instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Small;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Value_Test is
- -- In the following tests the expected result is accurate
- -- to the machine precision so the minimum guaranteed error
- -- bound can be used.
- Minimum_Error : constant := 8.0;
- begin
- Check (Sinh (1.0),
- (E - 1.0 / E) / 2.0,
- "sinh(1)",
- Minimum_Error);
- Check (Cosh (1.0),
- Cosh1,
- "cosh(1)",
- Minimum_Error);
- Check (Sinh (2.0),
- (E * E - (1.0 / (E * E))) / 2.0,
- "sinh(2)",
- Minimum_Error);
- Check (Cosh (2.0),
- (E * E + (1.0 / (E * E))) / 2.0,
- "cosh(2)",
- Minimum_Error);
- Check (Sinh (-1.0),
- (1.0 / E - E) / 2.0,
- "sinh(-1)",
- Minimum_Error);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
-
- procedure Exact_Result_Test is
- No_Error : constant := 0.0;
- begin
- -- A.5.1(38);6.0
- Check (Sinh (0.0), 0.0, "sinh(0)", No_Error);
- Check (Cosh (0.0), 1.0, "cosh(0)", No_Error);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Identity_1_Test is
- -- For the Sinh test use the identity
- -- 2 * Sinh(x) * Cosh(1) = Sinh(x+1) + Sinh (x-1)
- -- which is transformed to
- -- Sinh(x) = ((Sinh(x+1) + Sinh(x-1)) * C
- -- where C = 1/(2*Cosh(1))
- --
- -- For the Cosh test use the identity
- -- 2 * Cosh(x) * Cosh(1) = Cosh(x+1) + Cosh(x-1)
- -- which is transformed to
- -- Cosh(x) = C * (Cosh(x+1) + Cosh(x-1))
- -- where C is the same as above
- --
- -- see Cody pg 230-231 for details on the error analysis.
- -- The net result is a relative error bound of 16 * Model_Epsilon.
-
- A : constant := 3.0;
- -- large upper bound but not so large as to cause Cosh(B)
- -- to overflow
- B : constant Real := Log(Real'Safe_Last) - 2.0;
- X_Minus_1, X, X_Plus_1 : Real;
- Actual1, Actual2 : Real;
- C : constant := 1.0 / (2.0 * Cosh1);
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- -- make sure there is no error in x-1, x, and x+1
- X_Plus_1 := (B - A) * Real (I) / Real (Max_Samples) + A;
- X_Plus_1 := Real'Machine (X_Plus_1);
- X := Real'Machine (X_Plus_1 - 1.0);
- X_Minus_1 := Real'Machine (X - 1.0);
-
- -- Sinh(x) = ((Sinh(x+1) + Sinh(x-1)) * C
- Actual1 := Sinh(X);
- Actual2 := C * (Sinh(X_Plus_1) + Sinh(X_Minus_1));
-
- Check (Actual1, Actual2,
- "Identity_1_Test " & Integer'Image (I) & ": sinh(" &
- Real'Image (X) & ") ",
- 16.0);
-
- -- Cosh(x) = C * (Cosh(x+1) + Cosh(x-1))
- Actual1 := Cosh (X);
- Actual2 := C * (Cosh(X_Plus_1) + Cosh (X_Minus_1));
- Check (Actual1, Actual2,
- "Identity_1_Test " & Integer'Image (I) & ": cosh(" &
- Real'Image (X) & ") ",
- 16.0);
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Identity_1_Test" &
- " for X=" & Real'Image (X));
- when others =>
- Report.Failed ("exception in Identity_1_Test" &
- " for X=" & Real'Image (X));
- end Identity_1_Test;
-
-
-
- procedure Subtraction_Error_Test is
- -- This test detects the error resulting from subtraction if
- -- the obvious algorithm was used for computing sinh. That is,
- -- it it is computed as (e**x - e**-x)/2.
- -- We check the result by using a Taylor series expansion that
- -- will produce a result accurate to the machine precision for
- -- the range under test.
- --
- -- The maximum relative error bound for this test is
- -- 8 for the sinh operation and 7 for the Taylor series
- -- for a total of 15 * Model_Epsilon
- A : constant := 0.0;
- B : constant := 0.5;
- X : Real;
- X_Squared : Real;
- Actual, Expected : Real;
- begin
- if Real'digits > 15 then
- return; -- The approximation below is not accurate beyond
- -- 15 digits. Adding more terms makes the error
- -- larger, so it makes the test worse for more normal
- -- values. Thus, we skip this subtest for larger than
- -- 15 digits.
- end if;
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- X_Squared := X * X;
-
- Actual := Sinh(X);
-
- -- The Taylor series regrouped a bit
- Expected :=
- X * (1.0 + (X_Squared / 6.0) *
- (1.0 + (X_Squared/20.0) *
- (1.0 + (X_Squared/42.0) *
- (1.0 + (X_Squared/72.0) *
- (1.0 + (X_Squared/110.0) *
- (1.0 + (X_Squared/156.0)
- ))))));
-
- Check (Actual, Expected,
- "Subtraction_Error_Test " & Integer'Image (I) & ": sinh(" &
- Real'Image (X) & ") ",
- 15.0);
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Subtraction_Error_Test");
- when others =>
- Report.Failed ("exception in Subtraction_Error_Test");
- end Subtraction_Error_Test;
-
-
- procedure Exception_Test is
- X1, X2 : Real := 0.0;
- begin
- -- this part of the test is only applicable if 'Machine_Overflows
- -- is true.
- if Real'Machine_Overflows then
-
- begin
- X1 := Sinh (Real'Safe_Last / 2.0);
- Report.Failed ("no exception for sinh overflow");
- exception
- when Constraint_Error => null;
- when others =>
- Report.Failed ("wrong exception sinh overflow");
- end;
-
- begin
- X2 := Cosh (Real'Safe_Last / 2.0);
- Report.Failed ("no exception for cosh overflow");
- exception
- when Constraint_Error => null;
- when others =>
- Report.Failed ("wrong exception cosh overflow");
- end;
-
- end if;
-
- -- optimizer thwarting
- if Report.Ident_Bool (False) then
- Report.Comment (Real'Image (X1 + X2));
- end if;
- end Exception_Test;
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- Identity_1_Test;
- Subtraction_Error_Test;
- Exception_Test;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2014",
- "Check the accuracy of the SINH and COSH functions");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2014;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2015.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2015.a
deleted file mode 100644
index 50fda5e1f4f..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2015.a
+++ /dev/null
@@ -1,686 +0,0 @@
--- CXG2015.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the ARCSIN and ARCCOS functions return
--- results that are within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks in a specific range where a Taylor series can be
--- used to compute an accurate result for comparison.
--- Exception checks.
--- The Taylor series tests are a direct translation of the
--- FORTRAN code found in the reference.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 18 Mar 96 SAIC Initial release for 2.1
--- 24 Apr 96 SAIC Fixed error bounds.
--- 17 Aug 96 SAIC Added reference information and improved
--- checking for machines with more than 23
--- digits of precision.
--- 03 Feb 97 PWB.CTA Removed checks with explicit Cycle => 2.0*Pi
--- 22 Dec 99 RLB Added model range checking to "exact" results,
--- in order to avoid too strictly requiring a specific
--- result, and too weakly checking results.
---
--- CHANGE NOTE:
--- According to Ken Dritz, author of the Numerics Annex of the RM,
--- one should never specify the cycle 2.0*Pi for the trigonometric
--- functions. In particular, if the machine number for the first
--- argument is not an exact multiple of the machine number for the
--- explicit cycle, then the specified exact results cannot be
--- reasonably expected. The affected checks in this test have been
--- marked as comments, with the additional notation "pwb-math".
--- Phil Brashear
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
--- CELEFUNT: A Portable Test Package for Complex Elementary Functions
--- ACM Collected Algorithms number 714
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2015 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1000;
-
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
- Pi : constant := Ada.Numerics.Pi;
-
- -- relative error bound from G.2.4(7);6.0
- Minimum_Error : constant := 4.0;
-
- generic
- type Real is digits <>;
- Half_PI_Low : in Real; -- The machine number closest to, but not greater
- -- than PI/2.0.
- Half_PI_High : in Real;-- The machine number closest to, but not less
- -- than PI/2.0.
- PI_Low : in Real; -- The machine number closest to, but not greater
- -- than PI.
- PI_High : in Real; -- The machine number closest to, but not less
- -- than PI.
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
-
- function Arcsin (X : Real) return Real renames
- Elementary_Functions.Arcsin;
- function Arcsin (X, Cycle : Real) return Real renames
- Elementary_Functions.Arcsin;
- function Arccos (X : Real) return Real renames
- Elementary_Functions.ArcCos;
- function Arccos (X, Cycle : Real) return Real renames
- Elementary_Functions.ArcCos;
-
- -- needed for support
- function Log (X, Base : Real) return Real renames
- Elementary_Functions.Log;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Value_Test is
- -- In the following tests the expected result is accurate
- -- to the machine precision so the minimum guaranteed error
- -- bound can be used.
-
- type Data_Point is
- record
- Degrees,
- Radians,
- Argument,
- Error_Bound : Real;
- end record;
-
- type Test_Data_Type is array (Positive range <>) of Data_Point;
-
- -- the values in the following tables only involve static
- -- expressions so no loss of precision occurs. However,
- -- rounding can be an issue with expressions involving Pi
- -- and square roots. The error bound specified in the
- -- table takes the sqrt error into account but not the
- -- error due to Pi. The Pi error is added in in the
- -- radians test below.
-
- Arcsin_Test_Data : constant Test_Data_Type := (
- -- degrees radians sine error_bound test #
- --( 0.0, 0.0, 0.0, 0.0 ), -- 1 - In Exact_Result_Test.
- ( 30.0, Pi/6.0, 0.5, 4.0 ), -- 2
- ( 60.0, Pi/3.0, Sqrt3/2.0, 5.0 ), -- 3
- --( 90.0, Pi/2.0, 1.0, 4.0 ), -- 4 - In Exact_Result_Test.
- --(-90.0, -Pi/2.0, -1.0, 4.0 ), -- 5 - In Exact_Result_Test.
- (-60.0, -Pi/3.0, -Sqrt3/2.0, 5.0 ), -- 6
- (-30.0, -Pi/6.0, -0.5, 4.0 ), -- 7
- ( 45.0, Pi/4.0, Sqrt2/2.0, 5.0 ), -- 8
- (-45.0, -Pi/4.0, -Sqrt2/2.0, 5.0 ) ); -- 9
-
- Arccos_Test_Data : constant Test_Data_Type := (
- -- degrees radians cosine error_bound test #
- --( 0.0, 0.0, 1.0, 0.0 ), -- 1 - In Exact_Result_Test.
- ( 30.0, Pi/6.0, Sqrt3/2.0, 5.0 ), -- 2
- ( 60.0, Pi/3.0, 0.5, 4.0 ), -- 3
- --( 90.0, Pi/2.0, 0.0, 4.0 ), -- 4 - In Exact_Result_Test.
- (120.0, 2.0*Pi/3.0, -0.5, 4.0 ), -- 5
- (150.0, 5.0*Pi/6.0, -Sqrt3/2.0, 5.0 ), -- 6
- --(180.0, Pi, -1.0, 4.0 ), -- 7 - In Exact_Result_Test.
- ( 45.0, Pi/4.0, Sqrt2/2.0, 5.0 ), -- 8
- (135.0, 3.0*Pi/4.0, -Sqrt2/2.0, 5.0 ) ); -- 9
-
- Cycle_Error,
- Radian_Error : Real;
- begin
- for I in Arcsin_Test_Data'Range loop
-
- -- note exact result requirements A.5.1(38);6.0 and
- -- G.2.4(12);6.0
- if Arcsin_Test_Data (I).Error_Bound = 0.0 then
- Cycle_Error := 0.0;
- Radian_Error := 0.0;
- else
- Cycle_Error := Arcsin_Test_Data (I).Error_Bound;
- -- allow for rounding error in the specification of Pi
- Radian_Error := Cycle_Error + 1.0;
- end if;
-
- Check (Arcsin (Arcsin_Test_Data (I).Argument),
- Arcsin_Test_Data (I).Radians,
- "test" & Integer'Image (I) &
- " arcsin(" &
- Real'Image (Arcsin_Test_Data (I).Argument) &
- ")",
- Radian_Error);
---pwb-math Check (Arcsin (Arcsin_Test_Data (I).Argument, 2.0 * Pi),
---pwb-math Arcsin_Test_Data (I).Radians,
---pwb-math "test" & Integer'Image (I) &
---pwb-math " arcsin(" &
---pwb-math Real'Image (Arcsin_Test_Data (I).Argument) &
---pwb-math ", 2pi)",
---pwb-math Cycle_Error);
- Check (Arcsin (Arcsin_Test_Data (I).Argument, 360.0),
- Arcsin_Test_Data (I).Degrees,
- "test" & Integer'Image (I) &
- " arcsin(" &
- Real'Image (Arcsin_Test_Data (I).Argument) &
- ", 360)",
- Cycle_Error);
- end loop;
-
-
- for I in Arccos_Test_Data'Range loop
-
- -- note exact result requirements A.5.1(39);6.0 and
- -- G.2.4(12);6.0
- if Arccos_Test_Data (I).Error_Bound = 0.0 then
- Cycle_Error := 0.0;
- Radian_Error := 0.0;
- else
- Cycle_Error := Arccos_Test_Data (I).Error_Bound;
- -- allow for rounding error in the specification of Pi
- Radian_Error := Cycle_Error + 1.0;
- end if;
-
- Check (Arccos (Arccos_Test_Data (I).Argument),
- Arccos_Test_Data (I).Radians,
- "test" & Integer'Image (I) &
- " arccos(" &
- Real'Image (Arccos_Test_Data (I).Argument) &
- ")",
- Radian_Error);
---pwb-math Check (Arccos (Arccos_Test_Data (I).Argument, 2.0 * Pi),
---pwb-math Arccos_Test_Data (I).Radians,
---pwb-math "test" & Integer'Image (I) &
---pwb-math " arccos(" &
---pwb-math Real'Image (Arccos_Test_Data (I).Argument) &
---pwb-math ", 2pi)",
---pwb-math Cycle_Error);
- Check (Arccos (Arccos_Test_Data (I).Argument, 360.0),
- Arccos_Test_Data (I).Degrees,
- "test" & Integer'Image (I) &
- " arccos(" &
- Real'Image (Arccos_Test_Data (I).Argument) &
- ", 360)",
- Cycle_Error);
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
- procedure Check_Exact (Actual, Expected_Low, Expected_High : Real;
- Test_Name : String) is
- -- If the expected result is not a model number, then Expected_Low is
- -- the first machine number less than the (exact) expected
- -- result, and Expected_High is the first machine number greater than
- -- the (exact) expected result. If the expected result is a model
- -- number, Expected_Low = Expected_High = the result.
- Model_Expected_Low : Real := Expected_Low;
- Model_Expected_High : Real := Expected_High;
- begin
- -- Calculate the first model number nearest to, but below (or equal)
- -- to the expected result:
- while Real'Model (Model_Expected_Low) /= Model_Expected_Low loop
- -- Try the next machine number lower:
- Model_Expected_Low := Real'Adjacent(Model_Expected_Low, 0.0);
- end loop;
- -- Calculate the first model number nearest to, but above (or equal)
- -- to the expected result:
- while Real'Model (Model_Expected_High) /= Model_Expected_High loop
- -- Try the next machine number higher:
- Model_Expected_High := Real'Adjacent(Model_Expected_High, 100.0);
- end loop;
-
- if Actual < Model_Expected_Low or Actual > Model_Expected_High then
- Accuracy_Error_Reported := True;
- if Actual < Model_Expected_Low then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected low: " & Real'Image (Model_Expected_Low) &
- " expected high: " & Real'Image (Model_Expected_High) &
- " difference: " & Real'Image (Actual - Expected_Low));
- else
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected low: " & Real'Image (Model_Expected_Low) &
- " expected high: " & Real'Image (Model_Expected_High) &
- " difference: " & Real'Image (Expected_High - Actual));
- end if;
- elsif Verbose then
- Report.Comment (Test_Name & " passed");
- end if;
- end Check_Exact;
-
-
- procedure Exact_Result_Test is
- begin
- -- A.5.1(38)
- Check_Exact (Arcsin (0.0), 0.0, 0.0, "arcsin(0)");
- Check_Exact (Arcsin (0.0, 45.0), 0.0, 0.0, "arcsin(0,45)");
-
- -- A.5.1(39)
- Check_Exact (Arccos (1.0), 0.0, 0.0, "arccos(1)");
- Check_Exact (Arccos (1.0, 75.0), 0.0, 0.0, "arccos(1,75)");
-
- -- G.2.4(11-13)
- Check_Exact (Arcsin (1.0), Half_PI_Low, Half_PI_High, "arcsin(1)");
- Check_Exact (Arcsin (1.0, 360.0), 90.0, 90.0, "arcsin(1,360)");
-
- Check_Exact (Arcsin (-1.0), -Half_PI_High, -Half_PI_Low, "arcsin(-1)");
- Check_Exact (Arcsin (-1.0, 360.0), -90.0, -90.0, "arcsin(-1,360)");
-
- Check_Exact (Arccos (0.0), Half_PI_Low, Half_PI_High, "arccos(0)");
- Check_Exact (Arccos (0.0, 360.0), 90.0, 90.0, "arccos(0,360)");
-
- Check_Exact (Arccos (-1.0), PI_Low, PI_High, "arccos(-1)");
- Check_Exact (Arccos (-1.0, 360.0), 180.0, 180.0, "arccos(-1,360)");
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("Exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Arcsin_Taylor_Series_Test is
- -- the following range is chosen so that the Taylor series
- -- used will produce a result accurate to machine precision.
- --
- -- The following formula is used for the Taylor series:
- -- TS(x) = x { 1 + (xsq/2) [ (1/3) + (3/4)xsq { (1/5) +
- -- (5/6)xsq [ (1/7) + (7/8)xsq/9 ] } ] }
- -- where xsq = x * x
- --
- A : constant := -0.125;
- B : constant := 0.125;
- X : Real;
- Y, Y_Sq : Real;
- Actual, Sum, Xm : Real;
- -- terms in Taylor series
- K : constant Integer := Integer (
- Log (
- Real (Real'Machine_Radix) ** Real'Machine_Mantissa,
- 10.0)) + 1;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- -- make sure there is no error in x-1, x, and x+1
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
-
- Y := X;
- Y_Sq := Y * Y;
- Sum := 0.0;
- Xm := Real (K + K + 1);
- for M in 1 .. K loop
- Sum := Y_Sq * (Sum + 1.0/Xm);
- Xm := Xm - 2.0;
- Sum := Sum * (Xm /(Xm + 1.0));
- end loop;
- Sum := Sum * Y;
- Actual := Y + Sum;
- Sum := (Y - Actual) + Sum;
- if not Real'Machine_Rounds then
- Actual := Actual + (Sum + Sum);
- end if;
-
- Check (Actual, Arcsin (X),
- "Taylor Series test" & Integer'Image (I) & ": arcsin(" &
- Real'Image (X) & ") ",
- Minimum_Error);
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Arcsin_Taylor_Series_Test" &
- " for X=" & Real'Image (X));
- when others =>
- Report.Failed ("exception in Arcsin_Taylor_Series_Test" &
- " for X=" & Real'Image (X));
- end Arcsin_Taylor_Series_Test;
-
-
-
- procedure Arccos_Taylor_Series_Test is
- -- the following range is chosen so that the Taylor series
- -- used will produce a result accurate to machine precision.
- --
- -- The following formula is used for the Taylor series:
- -- TS(x) = x { 1 + (xsq/2) [ (1/3) + (3/4)xsq { (1/5) +
- -- (5/6)xsq [ (1/7) + (7/8)xsq/9 ] } ] }
- -- arccos(x) = pi/2 - TS(x)
- A : constant := -0.125;
- B : constant := 0.125;
- C1, C2 : Real;
- X : Real;
- Y, Y_Sq : Real;
- Actual, Sum, Xm, S : Real;
- -- terms in Taylor series
- K : constant Integer := Integer (
- Log (
- Real (Real'Machine_Radix) ** Real'Machine_Mantissa,
- 10.0)) + 1;
- begin
- if Real'Digits > 23 then
- -- constants in this section only accurate to 23 digits
- Error_Low_Bound := 0.00000_00000_00000_00000_001;
- Report.Comment ("arctan accuracy checked to 23 digits");
- end if;
-
- -- C1 + C2 equals Pi/2 accurate to 23 digits
- if Real'Machine_Radix = 10 then
- C1 := 1.57;
- C2 := 7.9632679489661923132E-4;
- else
- C1 := 201.0 / 128.0;
- C2 := 4.8382679489661923132E-4;
- end if;
-
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- -- make sure there is no error in x-1, x, and x+1
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
-
- Y := X;
- Y_Sq := Y * Y;
- Sum := 0.0;
- Xm := Real (K + K + 1);
- for M in 1 .. K loop
- Sum := Y_Sq * (Sum + 1.0/Xm);
- Xm := Xm - 2.0;
- Sum := Sum * (Xm /(Xm + 1.0));
- end loop;
- Sum := Sum * Y;
-
- -- at this point we have arcsin(x).
- -- We compute arccos(x) = pi/2 - arcsin(x).
- -- The following code segment is translated directly from
- -- the CELEFUNT FORTRAN implementation
-
- S := C1 + C2;
- Sum := ((C1 - S) + C2) - Sum;
- Actual := S + Sum;
- Sum := ((S - Actual) + Sum) - Y;
- S := Actual;
- Actual := S + Sum;
- Sum := (S - Actual) + Sum;
-
- if not Real'Machine_Rounds then
- Actual := Actual + (Sum + Sum);
- end if;
-
- Check (Actual, Arccos (X),
- "Taylor Series test" & Integer'Image (I) & ": arccos(" &
- Real'Image (X) & ") ",
- Minimum_Error);
-
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- exit when Accuracy_Error_Reported;
- end loop;
- Error_Low_Bound := 0.0; -- reset
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Arccos_Taylor_Series_Test" &
- " for X=" & Real'Image (X));
- when others =>
- Report.Failed ("exception in Arccos_Taylor_Series_Test" &
- " for X=" & Real'Image (X));
- end Arccos_Taylor_Series_Test;
-
-
-
- procedure Identity_Test is
- -- test the identity arcsin(-x) = -arcsin(x)
- -- range chosen to be most of the valid range of the argument.
- A : constant := -0.999;
- B : constant := 0.999;
- X : Real;
- begin
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- -- make sure there is no error in x-1, x, and x+1
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
-
- Check (Arcsin(-X), -Arcsin (X),
- "Identity test" & Integer'Image (I) & ": arcsin(" &
- Real'Image (X) & ") ",
- 8.0); -- 2 arcsin evaluations => twice the error bound
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
- end loop;
- end Identity_Test;
-
-
- procedure Exception_Test is
- X1, X2 : Real := 0.0;
- begin
- begin
- X1 := Arcsin (1.1);
- Report.Failed ("no exception for Arcsin (1.1)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error instead of " &
- "Argument_Error for Arcsin (1.1)");
- when Ada.Numerics.Argument_Error =>
- null; -- expected result
- when others =>
- Report.Failed ("wrong exception for Arcsin(1.1)");
- end;
-
- begin
- X2 := Arccos (-1.1);
- Report.Failed ("no exception for Arccos (-1.1)");
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error instead of " &
- "Argument_Error for Arccos (-1.1)");
- when Ada.Numerics.Argument_Error =>
- null; -- expected result
- when others =>
- Report.Failed ("wrong exception for Arccos(-1.1)");
- end;
-
-
- -- optimizer thwarting
- if Report.Ident_Bool (False) then
- Report.Comment (Real'Image (X1 + X2));
- end if;
- end Exception_Test;
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- Arcsin_Taylor_Series_Test;
- Arccos_Taylor_Series_Test;
- Identity_Test;
- Exception_Test;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- -- These expressions must be truly static, which is why we have to do them
- -- outside of the generic, and we use the named numbers. Note that we know
- -- that PI is not a machine number (it is irrational), and it should be
- -- represented to more digits than supported by the target machine.
- Float_Half_PI_Low : constant := Float'Adjacent(PI/2.0, 0.0);
- Float_Half_PI_High : constant := Float'Adjacent(PI/2.0, 10.0);
- Float_PI_Low : constant := Float'Adjacent(PI, 0.0);
- Float_PI_High : constant := Float'Adjacent(PI, 10.0);
- package Float_Check is new Generic_Check (Float,
- Half_PI_Low => Float_Half_PI_Low,
- Half_PI_High => Float_Half_PI_High,
- PI_Low => Float_PI_Low,
- PI_High => Float_PI_High);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- A_Long_Float_Half_PI_Low : constant := A_Long_Float'Adjacent(PI/2.0, 0.0);
- A_Long_Float_Half_PI_High : constant := A_Long_Float'Adjacent(PI/2.0, 10.0);
- A_Long_Float_PI_Low : constant := A_Long_Float'Adjacent(PI, 0.0);
- A_Long_Float_PI_High : constant := A_Long_Float'Adjacent(PI, 10.0);
- package A_Long_Float_Check is new Generic_Check (A_Long_Float,
- Half_PI_Low => A_Long_Float_Half_PI_Low,
- Half_PI_High => A_Long_Float_Half_PI_High,
- PI_Low => A_Long_Float_PI_Low,
- PI_High => A_Long_Float_PI_High);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2015",
- "Check the accuracy of the ARCSIN and ARCCOS functions");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2015;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2016.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2016.a
deleted file mode 100644
index 832b118224a..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2016.a
+++ /dev/null
@@ -1,482 +0,0 @@
--- CXG2016.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the ARCTAN function returns a
--- result that is within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Exception checks.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 19 Mar 96 SAIC Initial release for 2.1
--- 30 APR 96 SAIC Fixed optimization issue
--- 17 AUG 96 SAIC Incorporated Reviewer's suggestions.
--- 12 OCT 96 SAIC Incorporated Reviewer's suggestions.
--- 02 DEC 97 EDS Remove procedure Identity_1_Test and calls to
--- procedure.
--- 29 JUN 98 EDS Replace -0.0 with call to ImpDef.Annex_G.Negative_Zero
--- 28 APR 99 RLB Replaced comma accidentally deleted in above change.
--- 15 DEC 99 RLB Added model range checking to "exact" results,
--- in order to avoid too strictly requiring a specific
--- result.
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-with Impdef.Annex_G;
-procedure CXG2016 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1000;
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- Half_PI_Low : in Real; -- The machine number closest to, but not greater
- -- than PI/2.0.
- Half_PI_High : in Real;-- The machine number closest to, but not less
- -- than PI/2.0.
- PI_Low : in Real; -- The machine number closest to, but not greater
- -- than PI.
- PI_High : in Real; -- The machine number closest to, but not less
- -- than PI.
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
-
- function Arctan (Y : Real;
- X : Real := 1.0) return Real renames
- Elementary_Functions.Arctan;
- function Arctan (Y : Real;
- X : Real := 1.0;
- Cycle : Real) return Real renames
- Elementary_Functions.Arctan;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon
- -- instead of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Value_Test is
- -- If eta is very small, arctan(x + eta) ~= arctan(x) + eta/(1+x*x).
- --
- -- For tests 4 and 5, there is an error of 4.0ME for arctan + an
- -- additional error of 1.0ME because pi is not exact for a total of 5.0ME.
- --
- -- In test 3 there is the error for pi plus an additional error
- -- of (1.0ME)/4 since sqrt3 is not exact, for a total of 5.25ME.
- --
- -- In test 2 there is the error for pi plus an additional error
- -- of (3/4)(1.0ME) since sqrt3 is not exact, for a total of 5.75ME.
-
-
- type Data_Point is
- record
- Degrees,
- Radians,
- Tangent,
- Allowed_Error : Real;
- end record;
-
- type Test_Data_Type is array (Positive range <>) of Data_Point;
-
- -- the values in the following table only involve static
- -- expressions so no additional loss of precision occurs.
- Test_Data : constant Test_Data_Type := (
- -- degrees radians tangent error test #
- ( 0.0, 0.0, 0.0, 4.0 ), -- 1
- ( 30.0, Pi/6.0, Sqrt3/3.0, 5.75), -- 2
- ( 60.0, Pi/3.0, Sqrt3, 5.25), -- 3
- ( 45.0, Pi/4.0, 1.0, 5.0 ), -- 4
- (-45.0, -Pi/4.0, -1.0, 5.0 ) ); -- 5
-
- begin
- for I in Test_Data'Range loop
- Check (Arctan (Test_Data (I).Tangent),
- Test_Data (I).Radians,
- "special value test" & Integer'Image (I) &
- " arctan(" &
- Real'Image (Test_Data (I).Tangent) &
- ")",
- Test_Data (I).Allowed_Error);
- Check (Arctan (Test_Data (I).Tangent, Cycle => 360.0),
- Test_Data (I).Degrees,
- "special value test" & Integer'Image (I) &
- " arctan(" &
- Real'Image (Test_Data (I).Tangent) &
- ", cycle=>360)",
- Test_Data (I).Allowed_Error);
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
-
- procedure Check_Exact (Actual, Expected_Low, Expected_High : Real;
- Test_Name : String) is
- -- If the expected result is not a model number, then Expected_Low is
- -- the first machine number less than the (exact) expected
- -- result, and Expected_High is the first machine number greater than
- -- the (exact) expected result. If the expected result is a model
- -- number, Expected_Low = Expected_High = the result.
- Model_Expected_Low : Real := Expected_Low;
- Model_Expected_High : Real := Expected_High;
- begin
- -- Calculate the first model number nearest to, but below (or equal)
- -- to the expected result:
- while Real'Model (Model_Expected_Low) /= Model_Expected_Low loop
- -- Try the next machine number lower:
- Model_Expected_Low := Real'Adjacent(Model_Expected_Low, 0.0);
- end loop;
- -- Calculate the first model number nearest to, but above (or equal)
- -- to the expected result:
- while Real'Model (Model_Expected_High) /= Model_Expected_High loop
- -- Try the next machine number higher:
- Model_Expected_High := Real'Adjacent(Model_Expected_High, 100.0);
- end loop;
-
- if Actual < Model_Expected_Low or Actual > Model_Expected_High then
- Accuracy_Error_Reported := True;
- if Actual < Model_Expected_Low then
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected low: " & Real'Image (Model_Expected_Low) &
- " expected high: " & Real'Image (Model_Expected_High) &
- " difference: " & Real'Image (Actual - Expected_Low));
- else
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected low: " & Real'Image (Model_Expected_Low) &
- " expected high: " & Real'Image (Model_Expected_High) &
- " difference: " & Real'Image (Expected_High - Actual));
- end if;
- elsif Verbose then
- Report.Comment (Test_Name & " passed");
- end if;
- end Check_Exact;
-
-
- procedure Exact_Result_Test is
- begin
- -- A.5.1(40);6.0
- Check_Exact (Arctan (0.0, 1.0), 0.0, 0.0, "arctan(0,1)");
- Check_Exact (Arctan (0.0, 1.0, 27.0), 0.0, 0.0, "arctan(0,1,27)");
-
- -- G.2.4(11-13);6.0
-
- Check_Exact (Arctan (1.0, 0.0), Half_PI_Low, Half_PI_High,
- "arctan(1,0)");
- Check_Exact (Arctan (1.0, 0.0, 360.0), 90.0, 90.0, "arctan(1,0,360)");
-
- Check_Exact (Arctan (-1.0, 0.0), -Half_PI_High, -Half_PI_Low,
- "arctan(-1,0)");
- Check_Exact (Arctan (-1.0, 0.0, 360.0), -90.0, -90.0,
- "arctan(-1,0,360)");
-
- if Real'Signed_Zeros then
- Check_Exact (Arctan (0.0, -1.0), PI_Low, PI_High, "arctan(+0,-1)");
- Check_Exact (Arctan (0.0, -1.0, 360.0), 180.0, 180.0,
- "arctan(+0,-1,360)");
- Check_Exact (Arctan ( Real ( ImpDef.Annex_G.Negative_Zero ), -1.0),
- -PI_High, -PI_Low, "arctan(-0,-1)");
- Check_Exact (Arctan ( Real ( ImpDef.Annex_G.Negative_Zero ), -1.0,
- 360.0), -180.0, -180.0, "arctan(-0,-1,360)");
- else
- Check_Exact (Arctan (0.0, -1.0), PI_Low, PI_High, "arctan(0,-1)");
- Check_Exact (Arctan (0.0, -1.0, 360.0), 180.0, 180.0,
- "arctan(0,-1,360)");
- end if;
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("Exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Taylor_Series_Test is
- -- This test checks the Arctan by using a taylor series expansion that
- -- will produce a result accurate to 19 decimal digits for
- -- the range under test.
- --
- -- The maximum relative error bound for this test is
- -- 4 for the arctan operation and 2 for the Taylor series
- -- for a total of 6 * Model_Epsilon
-
- A : constant := -1.0/16.0;
- B : constant := 1.0/16.0;
- X : Real;
- Actual, Expected : Real;
- Sum, Em, X_Squared : Real;
- begin
- if Real'Digits > 19 then
- -- Taylor series calculation produces result accurate to 19
- -- digits. If type being tested has more digits then set
- -- the error low bound to account for this.
- -- The error low bound is conservatively set to 6*10**-19
- Error_Low_Bound := 0.00000_00000_00000_0006;
- Report.Comment ("arctan accuracy checked to 19 digits");
- end if;
-
- Accuracy_Error_Reported := False; -- reset
- for I in 0..Max_Samples loop
- X := (B - A) * Real (I) / Real (Max_Samples) + A;
- X_Squared := X * X;
- Em := 17.0;
- Sum := X_Squared / Em;
-
- for II in 1 .. 7 loop
- Em := Em - 2.0;
- Sum := (1.0 / Em - Sum) * X_Squared;
- end loop;
- Sum := -X * Sum;
- Expected := X + Sum;
- Sum := (X - Expected) + Sum;
- if not Real'Machine_Rounds then
- Expected := Expected + (Sum + Sum);
- end if;
-
- Actual := Arctan (X);
-
- Check (Actual, Expected,
- "Taylor_Series_Test " & Integer'Image (I) & ": arctan(" &
- Real'Image (X) & ") ",
- 6.0);
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
- Error_Low_Bound := 0.0; -- reset
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Taylor_Series_Test");
- when others =>
- Report.Failed ("exception in Taylor_Series_Test");
- end Taylor_Series_Test;
-
-
- procedure Exception_Test is
- X1, X2, X3 : Real := 0.0;
- begin
-
- begin -- A.5.1(20);6.0
- X1 := Arctan(0.0, Cycle => 0.0);
- Report.Failed ("no exception for cycle = 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle = 0.0");
- end;
-
- begin -- A.5.1(20);6.0
- X2 := Arctan (0.0, Cycle => -1.0);
- Report.Failed ("no exception for cycle < 0.0");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for cycle < 0.0");
- end;
-
- begin -- A.5.1(25);6.0
- X3 := Arctan (0.0, 0.0);
- Report.Failed ("no exception for arctan(0,0)");
- exception
- when Ada.Numerics.Argument_Error => null;
- when others =>
- Report.Failed ("wrong exception for arctan(0,0)");
- end;
-
- -- optimizer thwarting
- if Report.Ident_Bool (False) then
- Report.Comment (Real'Image (X1 + X2 + X3));
- end if;
- end Exception_Test;
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- Taylor_Series_Test;
- Exception_Test;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- -- These expressions must be truly static, which is why we have to do them
- -- outside of the generic, and we use the named numbers. Note that we know
- -- that PI is not a machine number (it is irrational), and it should be
- -- represented to more digits than supported by the target machine.
- Float_Half_PI_Low : constant := Float'Adjacent(PI/2.0, 0.0);
- Float_Half_PI_High : constant := Float'Adjacent(PI/2.0, 10.0);
- Float_PI_Low : constant := Float'Adjacent(PI, 0.0);
- Float_PI_High : constant := Float'Adjacent(PI, 10.0);
- package Float_Check is new Generic_Check (Float,
- Half_PI_Low => Float_Half_PI_Low,
- Half_PI_High => Float_Half_PI_High,
- PI_Low => Float_PI_Low,
- PI_High => Float_PI_High);
-
- -- check the Floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- A_Long_Float_Half_PI_Low : constant := A_Long_Float'Adjacent(PI/2.0, 0.0);
- A_Long_Float_Half_PI_High : constant := A_Long_Float'Adjacent(PI/2.0, 10.0);
- A_Long_Float_PI_Low : constant := A_Long_Float'Adjacent(PI, 0.0);
- A_Long_Float_PI_High : constant := A_Long_Float'Adjacent(PI, 10.0);
- package A_Long_Float_Check is new Generic_Check (A_Long_Float,
- Half_PI_Low => A_Long_Float_Half_PI_Low,
- Half_PI_High => A_Long_Float_Half_PI_High,
- PI_Low => A_Long_Float_PI_Low,
- PI_High => A_Long_Float_PI_High);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2016",
- "Check the accuracy of the ARCTAN function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2016;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2017.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2017.a
deleted file mode 100644
index 50add975f7f..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2017.a
+++ /dev/null
@@ -1,296 +0,0 @@
--- CXG2017.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the TANH function returns
--- a result that is within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 20 Mar 96 SAIC Initial release for 2.1
--- 17 Aug 96 SAIC Incorporated reviewer comments.
--- 03 Jun 98 EDS Add parens to remove the potential for overflow.
--- Remove the invocation of Identity_Test that checks
--- Tanh values that are too close to zero for the
--- test's error bounds.
---!
-
---
--- References:
---
--- Software Manual for the Elementary Functions
--- William J. Cody, Jr. and William Waite
--- Prentice-Hall, 1980
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
--- Implementation and Testing of Function Software
--- W. J. Cody
--- Problems and Methodologies in Mathematical Software Production
--- editors P. C. Messina and A. Murli
--- Lecture Notes in Computer Science Volume 142
--- Springer Verlag, 1982
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Elementary_Functions;
-procedure CXG2017 is
- Verbose : constant Boolean := False;
- Max_Samples : constant := 1000;
-
- E : constant := Ada.Numerics.E;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Elementary_Functions is new
- Ada.Numerics.Generic_Elementary_Functions (Real);
-
- function Tanh (X : Real) return Real renames
- Elementary_Functions.Tanh;
-
- function Log (X : Real) return Real renames
- Elementary_Functions.Log;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Small instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Small;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Special_Value_Test is
- -- In the following tests the expected result is accurate
- -- to the machine precision so the minimum guaranteed error
- -- bound can be used.
- Minimum_Error : constant := 8.0;
- E2 : constant := E * E;
- begin
- Check (Tanh (1.0),
- (E - 1.0 / E) / (E + 1.0 / E),
- "tanh(1)",
- Minimum_Error);
- Check (Tanh (2.0),
- (E2 - 1.0 / E2) / (E2 + 1.0 / E2),
- "tanh(2)",
- Minimum_Error);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
-
- procedure Exact_Result_Test is
- No_Error : constant := 0.0;
- begin
- -- A.5.1(38);6.0
- Check (Tanh (0.0), 0.0, "tanh(0)", No_Error);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Identity_Test (A, B : Real) is
- -- For this test we use the identity
- -- TANH(u+v) = [TANH(u) + TANH(v)] / [1 + TANH(u)*TANH(v)]
- -- which is transformed to
- -- TANH(x) = [TANH(y)+C] / [1 + TANH(y) * C]
- -- where C = TANH(1/8) and y = x - 1/8
- --
- -- see Cody pg 248-249 for details on the error analysis.
- -- The net result is a relative error bound of 16 * Model_Epsilon.
- --
- -- The second part of this test checks the identity
- -- TANH(-x) = -TANH(X)
-
- X, Y : Real;
- Actual1, Actual2 : Real;
- C : constant := 1.2435300177159620805e-1;
- begin
- if Real'Digits > 20 then
- -- constant C is accurate to 20 digits. Set the low bound
- -- on the error to 16*10**-20
- Error_Low_Bound := 0.00000_00000_00000_00016;
- Report.Comment ("tanh accuracy checked to 20 digits");
- end if;
-
- Accuracy_Error_Reported := False; -- reset
- for I in 1..Max_Samples loop
- X := (B - A) * (Real (I) / Real (Max_Samples)) + A;
- Actual1 := Tanh(X);
-
- -- TANH(x) = [TANH(y)+C] / [1 + TANH(y) * C]
- Y := X - (1.0 / 8.0);
- Actual2 := (Tanh (Y) + C) / (1.0 + Tanh(Y) * C);
-
- Check (Actual1, Actual2,
- "Identity_1_Test " & Integer'Image (I) & ": tanh(" &
- Real'Image (X) & ") ",
- 16.0);
-
- -- TANH(-x) = -TANH(X)
- Actual2 := Tanh(-X);
- Check (-Actual1, Actual2,
- "Identity_2_Test " & Integer'Image (I) & ": tanh(" &
- Real'Image (X) & ") ",
- 16.0);
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
-
- end loop;
- Error_Low_Bound := 0.0; -- reset
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Identity_Test" &
- " for X=" & Real'Image (X));
- when others =>
- Report.Failed ("exception in Identity_Test" &
- " for X=" & Real'Image (X));
- end Identity_Test;
-
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- -- cover a large range
- Identity_Test (1.0, Real'Safe_Last);
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2017",
- "Check the accuracy of the TANH function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2017;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2018.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2018.a
deleted file mode 100644
index be4f1a82faf..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2018.a
+++ /dev/null
@@ -1,355 +0,0 @@
--- CXG2018.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex EXP function returns
--- a result that is within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check complex numbers based upon
--- both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 21 Mar 96 SAIC Initial release for 2.1
--- 17 Aug 96 SAIC Incorporated reviewer comments.
--- 27 Aug 99 RLB Repair on the error result of checks.
--- 02 Apr 03 RLB Added code to discard excess precision in the
--- construction of the test value for the
--- Identity_Test.
---
---!
-
---
--- References:
---
--- W. J. Cody
--- CELEFUNT: A Portable Test Package for Complex Elementary Functions
--- Algorithm 714, Collected Algorithms from ACM.
--- Published in Transactions On Mathematical Software,
--- Vol. 19, No. 1, March, 1993, pp. 1-21.
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Generic_Complex_Elementary_Functions;
-procedure CXG2018 is
- Verbose : constant Boolean := False;
- -- Note that Max_Samples is the number of samples taken in
- -- both the real and imaginary directions. Thus, for Max_Samples
- -- of 100 the number of values checked is 10000.
- Max_Samples : constant := 100;
-
- E : constant := Ada.Numerics.E;
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Complex_Type is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Type;
-
- package CEF is new
- Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Type);
-
- function Exp (X : Complex) return Complex renames CEF.Exp;
- function Exp (X : Imaginary) return Complex renames CEF.Exp;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Small instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Small;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MRE : Real) is
- begin
- Check (Actual.Re, Expected.Re, Test_Name & " real part", MRE);
- Check (Actual.Im, Expected.Im, Test_Name & " imaginary part", MRE);
- end Check;
-
-
- procedure Special_Value_Test is
- -- In the following tests the expected result is accurate
- -- to the machine precision so the minimum guaranteed error
- -- bound can be used.
- --
- -- The error bounds given assumed z is exact. When using
- -- pi there is an extra error of 1.0ME.
- -- The pi inside the exp call requires that the complex
- -- component have an extra error allowance of 1.0*angle*ME.
- -- Thus for pi/2,the Minimum_Error_I is
- -- (2.0 + 1.0(pi/2))ME <= 3.6ME.
- -- For pi, it is (2.0 + 1.0*pi)ME <= 5.2ME,
- -- and for 2pi, it is (2.0 + 1.0(2pi))ME <= 8.3ME.
-
- -- The addition of 1 or i to a result is so that neither of
- -- the components of an expected result is 0. This is so
- -- that a reasonable relative error is allowed.
- Minimum_Error_C : constant := 7.0; -- for exp(Complex)
- Minimum_Error_I : constant := 2.0; -- for exp(Imaginary)
- begin
- Check (Exp (1.0 + 0.0*i) + i,
- E + i,
- "exp(1+0i)",
- Minimum_Error_C);
- Check (Exp ((Pi / 2.0) * i) + 1.0,
- 1.0 + 1.0*i,
- "exp(pi/2*i)",
- 3.6);
- Check (Exp (Pi * i) + i,
- -1.0 + 1.0*i,
- "exp(pi*i)",
- 5.2);
- Check (Exp (Pi * 2.0 * i) + i,
- 1.0 + i,
- "exp(2pi*i)",
- 8.3);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
-
- procedure Exact_Result_Test is
- No_Error : constant := 0.0;
- begin
- -- G.1.2(36);6.0
- Check (Exp(0.0 + 0.0*i), 1.0 + 0.0 * i, "exp(0+0i)", No_Error);
- Check (Exp( 0.0*i), 1.0 + 0.0 * i, "exp(0i)", No_Error);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Identity_Test (A, B : Real) is
- -- For this test we use the identity
- -- Exp(Z) = Exp(Z-W) * Exp (W)
- -- where W = (1+i)/16
- --
- -- The second part of this test checks the identity
- -- Exp(Z) * Exp(-Z) = 1
- --
-
- X, Y : Complex;
- Actual1, Actual2 : Complex;
- W : constant Complex := (0.0625, 0.0625);
- -- the following constant was taken from the CELEFUNC EXP test.
- -- This is the value EXP(W) - 1
- C : constant Complex := (6.2416044877018563681e-2,
- 6.6487597751003112768e-2);
- begin
- if Real'Digits > 20 then
- -- constant ExpW is accurate to 20 digits.
- -- The low bound is 19 * 10**-20
- Error_Low_Bound := 0.00000_00000_00019;
- Report.Comment ("complex exp accuracy checked to 20 digits");
- end if;
-
- Accuracy_Error_Reported := False; -- reset
- for II in 1..Max_Samples loop
- X.Re := Real'Machine ((B - A) * Real (II) / Real (Max_Samples)
- + A);
- for J in 1..Max_Samples loop
- X.Im := Real'Machine ((B - A) * Real (J) / Real (Max_Samples)
- + A);
-
- Actual1 := Exp(X);
-
- -- Exp(X) = Exp(X-W) * Exp (W)
- -- = Exp(X-W) * (1 - (1-Exp(W))
- -- = Exp(X-W) * (1 + (Exp(W) - 1))
- -- = Exp(X-W) * (1 + C)
- Y := X - W;
- Actual2 := Exp(Y);
- Actual2 := Actual2 + Actual2 * C;
-
- Check (Actual1, Actual2,
- "Identity_1_Test " & Integer'Image (II) &
- Integer'Image (J) & ": Exp((" &
- Real'Image (X.Re) & ", " &
- Real'Image (X.Im) & ")) ",
- 20.0); -- 2 exp and 1 multiply and 1 add = 2*7+1*5+1
- -- Note: The above is not strictly correct, as multiply
- -- has a box error, rather than a relative error.
- -- Supposedly, the interval is chosen to avoid the need
- -- to worry about this.
-
- -- Exp(X) * Exp(-X) + i = 1 + i
- -- The addition of i is to allow a reasonable relative
- -- error in the imaginary part
- Actual2 := (Actual1 * Exp(-X)) + i;
- Check (Actual2, (1.0, 1.0),
- "Identity_2_Test " & Integer'Image (II) &
- Integer'Image (J) & ": Exp((" &
- Real'Image (X.Re) & ", " &
- Real'Image (X.Im) & ")) ",
- 20.0); -- 2 exp and 1 multiply and one add = 2*7+1*5+1
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
- end loop;
- end loop;
- Error_Low_Bound := 0.0;
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Identity_Test" &
- " for X=(" & Real'Image (X.Re) &
- ", " & Real'Image (X.Im) & ")");
- when others =>
- Report.Failed ("exception in Identity_Test" &
- " for X=(" & Real'Image (X.Re) &
- ", " & Real'Image (X.Im) & ")");
- end Identity_Test;
-
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- -- test regions where we can avoid cancellation error problems
- -- See Cody page 10.
- Identity_Test (0.0625, 1.0);
- Identity_Test (15.0, 17.0);
- Identity_Test (1.625, 3.0);
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2018",
- "Check the accuracy of the complex EXP function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2018;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2019.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2019.a
deleted file mode 100644
index 0a4dddcc906..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2019.a
+++ /dev/null
@@ -1,338 +0,0 @@
--- CXG2019.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex LOG function returns
--- a result that is within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check complex numbers based upon
--- both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
--- Exception conditions.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 22 Mar 96 SAIC Initial release for 2.1
---
---!
-
---
--- References:
---
--- W. J. Cody
--- CELEFUNT: A Portable Test Package for Complex Elementary Functions
--- Algorithm 714, Collected Algorithms from ACM.
--- Published in Transactions On Mathematical Software,
--- Vol. 19, No. 1, March, 1993, pp. 1-21.
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Generic_Complex_Elementary_Functions;
-procedure CXG2019 is
- Verbose : constant Boolean := False;
- -- Note that Max_Samples is the number of samples taken in
- -- both the real and imaginary directions. Thus, for Max_Samples
- -- of 100 the number of values checked is 10000.
- Max_Samples : constant := 100;
-
- E : constant := Ada.Numerics.E;
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Complex_Type is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Type;
-
- package CEF is new
- Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Type);
-
- function Log (X : Complex) return Complex renames CEF.Log;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Small instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * abs Expected * Real'Model_Epsilon;
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MRE : Real) is
- begin
- Check (Actual.Re, Expected.Re, Test_Name & " real part", MRE);
- Check (Actual.Im, Expected.Im, Test_Name & " imaginary part", MRE);
- end Check;
-
-
- procedure Special_Value_Test is
- -- In the following tests the expected result is accurate
- -- to the machine precision so the minimum guaranteed error
- -- bound can be used if the argument is exact.
- --
- -- When using pi there is an extra error of 1.0ME.
- -- Although the real component has an error bound of 13.0,
- -- the complex component must take into account this error
- -- in the value for Pi.
- --
- -- One or i is added to the actual and expected results in
- -- order to prevent the expected result from having a
- -- real or imaginary part of 0. This is to allow a reasonable
- -- relative error for that component.
- Minimum_Error : constant := 13.0;
- begin
- Check (1.0 + Log (0.0 + i),
- 1.0 + Pi / 2.0 * i,
- "1+log(0+i)",
- Minimum_Error + 1.0);
- Check (1.0 + Log ((-1.0, 0.0)),
- 1.0 + (Pi * i),
- "log(-1+0i)+1 ",
- Minimum_Error + 1.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
-
- procedure Exact_Result_Test is
- No_Error : constant := 0.0;
- begin
- -- G.1.2(37);6.0
- Check (Log(1.0 + 0.0*i), 0.0 + 0.0 * i, "log(1+0i)", No_Error);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Identity_Test (RA, RB, IA, IB : Real) is
- -- Tests an identity over a range of values specified
- -- by the 4 parameters. RA and RB denote the range for the
- -- real part while IA and IB denote the range for the
- -- imaginary part.
- --
- -- For this test we use the identity
- -- Log(Z*Z) = 2 * Log(Z)
- --
-
- Scale : Real := Real (Real'Machine_Radix) ** (Real'Mantissa / 2 + 4);
- W, X, Y, Z : Real;
- CX, CY : Complex;
- Actual1, Actual2 : Complex;
- begin
- Accuracy_Error_Reported := False; -- reset
- for II in 1..Max_Samples loop
- X := (RB - RA) * Real (II) / Real (Max_Samples) + RA;
- for J in 1..Max_Samples loop
- Y := (IB - IA) * Real (J) / Real (Max_Samples) + IA;
-
- -- purify the arguments to minimize roundoff error.
- -- We construct the values so that the products X*X,
- -- Y*Y, and X*Y are all exact machine numbers.
- -- See Cody page 7 and CELEFUNT code.
- Z := X * Scale;
- W := Z + X;
- X := W - Z;
- Z := Y * Scale;
- W := Z + Y;
- Y := W - Z;
- CX := Compose_From_Cartesian(X,Y);
- Z := X*X - Y*Y;
- W := X*Y;
- CY := Compose_From_Cartesian(Z,W+W);
-
- -- The arguments are now ready so on with the
- -- identity computation.
- Actual1 := Log(CX);
-
- Actual2 := Log(CY) * 0.5;
-
- Check (Actual1, Actual2,
- "Identity_1_Test " & Integer'Image (II) &
- Integer'Image (J) & ": Log((" &
- Real'Image (CX.Re) & ", " &
- Real'Image (CX.Im) & ")) ",
- 26.0); -- 2 logs = 2*13. no error from this multiply
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
- end loop;
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Identity_Test" &
- " for X=(" & Real'Image (X) &
- ", " & Real'Image (X) & ")");
- when others =>
- Report.Failed ("exception in Identity_Test" &
- " for X=(" & Real'Image (X) &
- ", " & Real'Image (X) & ")");
- end Identity_Test;
-
-
- procedure Exception_Test is
- -- Check that log((0,0)) causes constraint_error.
- -- G.1.2(29);
-
- X : Complex := (0.0, 0.0);
- begin
- if not Real'Machine_Overflows then
- -- not applicable: G.1.2(28);6.0
- return;
- end if;
-
- begin
- X := Log ((0.0, 0.0));
- Report.Failed ("exception not raised for log(0,0)");
- exception
- when Constraint_Error => null; -- ok
- when others =>
- Report.Failed ("wrong exception raised for log(0,0)");
- end;
-
- -- optimizer thwarting
- if Report.Ident_Bool(False) then
- Report.Comment (Real'Image (X.Re + X.Im));
- end if;
- end Exception_Test;
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- -- test regions that do not include the unit circle so that
- -- the real part of LOG(Z) does not vanish
- -- See Cody page 9.
- Identity_Test ( 2.0, 10.0, 0.0, 10.0);
- Identity_Test (1000.0, 2000.0, -4000.0, -1000.0);
- Identity_Test (Real'Model_Epsilon, 0.25,
- -0.25, -Real'Model_Epsilon);
- Exception_Test;
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2019",
- "Check the accuracy of the complex LOG function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2019;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2020.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2020.a
deleted file mode 100644
index 1aed4ca5735..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2020.a
+++ /dev/null
@@ -1,351 +0,0 @@
--- CXG2020.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex SQRT function returns
--- a result that is within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check complex numbers based upon
--- both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 24 Mar 96 SAIC Initial release for 2.1
--- 17 Aug 96 SAIC Incorporated reviewer comments.
--- 03 Jun 98 EDS Added parens to ensure that the expression is not
--- evaluated by multiplying its two large terms
--- together and overflowing.
---!
-
---
--- References:
---
--- W. J. Cody
--- CELEFUNT: A Portable Test Package for Complex Elementary Functions
--- Algorithm 714, Collected Algorithms from ACM.
--- Published in Transactions On Mathematical Software,
--- Vol. 19, No. 1, March, 1993, pp. 1-21.
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Generic_Complex_Elementary_Functions;
-procedure CXG2020 is
- Verbose : constant Boolean := False;
- -- Note that Max_Samples is the number of samples taken in
- -- both the real and imaginary directions. Thus, for Max_Samples
- -- of 100 the number of values checked is 10000.
- Max_Samples : constant := 100;
-
- E : constant := Ada.Numerics.E;
- Pi : constant := Ada.Numerics.Pi;
-
- -- CRC Standard Mathematical Tables; 23rd Edition; pg 738
- Sqrt2 : constant :=
- 1.41421_35623_73095_04880_16887_24209_69807_85696_71875_37695;
- Sqrt3 : constant :=
- 1.73205_08075_68877_29352_74463_41505_87236_69428_05253_81039;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Complex_Type is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Type;
-
- package CEF is new
- Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Type);
-
- function Sqrt (X : Complex) return Complex renames CEF.Sqrt;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
-
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon
- -- instead of Model_Epsilon and Expected.
- Rel_Error := MRE * (abs Expected * Real'Model_Epsilon);
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed");
- end if;
- end if;
- end Check;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MRE : Real) is
- begin
- Check (Actual.Re, Expected.Re, Test_Name & " real part", MRE);
- Check (Actual.Im, Expected.Im, Test_Name & " imaginary part", MRE);
- end Check;
-
-
- procedure Special_Value_Test is
- -- In the following tests the expected result is accurate
- -- to the machine precision so the minimum guaranteed error
- -- bound can be used if the argument is exact.
- --
- -- One or i is added to the actual and expected results in
- -- order to prevent the expected result from having a
- -- real or imaginary part of 0. This is to allow a reasonable
- -- relative error for that component.
- Minimum_Error : constant := 6.0;
- Z1, Z2 : Complex;
- begin
- Check (Sqrt(9.0+0.0*i) + i,
- 3.0+1.0*i,
- "sqrt(9+0i)+i",
- Minimum_Error);
- Check (Sqrt (-2.0 + 0.0 * i) + 1.0,
- 1.0 + Sqrt2 * i,
- "sqrt(-2)+1 ",
- Minimum_Error);
-
- -- make sure no exception occurs when taking the sqrt of
- -- very large and very small values.
-
- Z1 := (Real'Safe_Last * 0.9, Real'Safe_Last * 0.9);
- Z2 := Sqrt (Z1);
- begin
- Check (Z2 * Z2,
- Z1,
- "sqrt((big,big))",
- Minimum_Error + 5.0); -- +5 for multiply
- exception
- when others =>
- Report.Failed ("unexpected exception in sqrt((big,big))");
- end;
-
- Z1 := (Real'Model_Epsilon * 10.0, Real'Model_Epsilon * 10.0);
- Z2 := Sqrt (Z1);
- begin
- Check (Z2 * Z2,
- Z1,
- "sqrt((little,little))",
- Minimum_Error + 5.0); -- +5 for multiply
- exception
- when others =>
- Report.Failed ("unexpected exception in " &
- "sqrt((little,little))");
- end;
-
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
-
- procedure Exact_Result_Test is
- No_Error : constant := 0.0;
- begin
- -- G.1.2(36);6.0
- Check (Sqrt(0.0 + 0.0*i), 0.0 + 0.0 * i, "sqrt(0+0i)", No_Error);
-
- -- G.1.2(37);6.0
- Check (Sqrt(1.0 + 0.0*i), 1.0 + 0.0 * i, "sqrt(1+0i)", No_Error);
-
- -- G.1.2(38-39);6.0
- Check (Sqrt(-1.0 + 0.0*i), 0.0 + 1.0 * i, "sqrt(-1+0i)", No_Error);
-
- -- G.1.2(40);6.0
- if Real'Signed_Zeros then
- Check (Sqrt(-1.0-0.0*i), 0.0 - 1.0 * i, "sqrt(-1-0i)", No_Error);
- end if;
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Identity_Test (RA, RB, IA, IB : Real) is
- -- Tests an identity over a range of values specified
- -- by the 4 parameters. RA and RB denote the range for the
- -- real part while IA and IB denote the range for the
- -- imaginary part of the result.
- --
- -- For this test we use the identity
- -- Sqrt(Z*Z) = Z
- --
-
- Scale : Real := Real (Real'Machine_Radix) ** (Real'Mantissa / 2 + 4);
- W, X, Y, Z : Real;
- CX : Complex;
- Actual, Expected : Complex;
- begin
- Accuracy_Error_Reported := False; -- reset
- for II in 1..Max_Samples loop
- X := (RB - RA) * Real (II) / Real (Max_Samples) + RA;
- for J in 1..Max_Samples loop
- Y := (IB - IA) * Real (J) / Real (Max_Samples) + IA;
-
- -- purify the arguments to minimize roundoff error.
- -- We construct the values so that the products X*X,
- -- Y*Y, and X*Y are all exact machine numbers.
- -- See Cody page 7 and CELEFUNT code.
- Z := X * Scale;
- W := Z + X;
- X := W - Z;
- Z := Y * Scale;
- W := Z + Y;
- Y := W - Z;
- -- G.1.2(21);6.0 - real part of result is non-negative
- Expected := Compose_From_Cartesian( abs X,Y);
- Z := X*X - Y*Y;
- W := X*Y;
- CX := Compose_From_Cartesian(Z,W+W);
-
- -- The arguments are now ready so on with the
- -- identity computation.
- Actual := Sqrt(CX);
-
- Check (Actual, Expected,
- "Identity_1_Test " & Integer'Image (II) &
- Integer'Image (J) & ": Sqrt((" &
- Real'Image (CX.Re) & ", " &
- Real'Image (CX.Im) & ")) ",
- 8.5); -- 6.0 from sqrt, 2.5 from argument.
- -- See Cody pg 7-8 for analysis of additional error amount.
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- return;
- end if;
- end loop;
- end loop;
-
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Identity_Test" &
- " for X=(" & Real'Image (X) &
- ", " & Real'Image (X) & ")");
- when others =>
- Report.Failed ("exception in Identity_Test" &
- " for X=(" & Real'Image (X) &
- ", " & Real'Image (X) & ")");
- end Identity_Test;
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- -- ranges where the sign is the same and where it
- -- differs.
- Identity_Test ( 0.0, 10.0, 0.0, 10.0);
- Identity_Test ( 0.0, 100.0, -100.0, 0.0);
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2020",
- "Check the accuracy of the complex SQRT function");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2020;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2021.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2021.a
deleted file mode 100644
index db49fc845f2..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2021.a
+++ /dev/null
@@ -1,386 +0,0 @@
--- CXG2021.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that the complex SIN and COS functions return
--- a result that is within the error bound allowed.
---
--- TEST DESCRIPTION:
--- This test consists of a generic package that is
--- instantiated to check complex numbers based upon
--- both Float and a long float type.
--- The test for each floating point type is divided into
--- several parts:
--- Special value checks where the result is a known constant.
--- Checks that use an identity for determining the result.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 27 Mar 96 SAIC Initial release for 2.1
--- 22 Aug 96 SAIC No longer skips test for systems with
--- more than 20 digits of precision.
---
---!
-
---
--- References:
---
--- W. J. Cody
--- CELEFUNT: A Portable Test Package for Complex Elementary Functions
--- Algorithm 714, Collected Algorithms from ACM.
--- Published in Transactions On Mathematical Software,
--- Vol. 19, No. 1, March, 1993, pp. 1-21.
---
--- CRC Standard Mathematical Tables
--- 23rd Edition
---
-
-with System;
-with Report;
-with Ada.Numerics.Generic_Complex_Types;
-with Ada.Numerics.Generic_Complex_Elementary_Functions;
-procedure CXG2021 is
- Verbose : constant Boolean := False;
- -- Note that Max_Samples is the number of samples taken in
- -- both the real and imaginary directions. Thus, for Max_Samples
- -- of 100 the number of values checked is 10000.
- Max_Samples : constant := 100;
-
- E : constant := Ada.Numerics.E;
- Pi : constant := Ada.Numerics.Pi;
-
- generic
- type Real is digits <>;
- package Generic_Check is
- procedure Do_Test;
- end Generic_Check;
-
- package body Generic_Check is
- package Complex_Type is new
- Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Type;
-
- package CEF is new
- Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Type);
-
- function Sin (X : Complex) return Complex renames CEF.Sin;
- function Cos (X : Complex) return Complex renames CEF.Cos;
-
- -- flag used to terminate some tests early
- Accuracy_Error_Reported : Boolean := False;
-
- -- The following value is a lower bound on the accuracy
- -- required. It is normally 0.0 so that the lower bound
- -- is computed from Model_Epsilon. However, for tests
- -- where the expected result is only known to a certain
- -- amount of precision this bound takes on a non-zero
- -- value to account for that level of precision.
- Error_Low_Bound : Real := 0.0;
-
- -- the E_Factor is an additional amount added to the Expected
- -- value prior to computing the maximum relative error.
- -- This is needed because the error analysis (Cody pg 17-20)
- -- requires this additional allowance.
- procedure Check (Actual, Expected : Real;
- Test_Name : String;
- MRE : Real;
- E_Factor : Real := 0.0) is
- Max_Error : Real;
- Rel_Error : Real;
- Abs_Error : Real;
- begin
- -- In the case where the expected result is very small or 0
- -- we compute the maximum error as a multiple of Model_Epsilon instead
- -- of Model_Epsilon and Expected.
- Rel_Error := MRE * Real'Model_Epsilon * (abs Expected + E_Factor);
- Abs_Error := MRE * Real'Model_Epsilon;
- if Rel_Error > Abs_Error then
- Max_Error := Rel_Error;
- else
- Max_Error := Abs_Error;
- end if;
-
- -- take into account the low bound on the error
- if Max_Error < Error_Low_Bound then
- Max_Error := Error_Low_Bound;
- end if;
-
- if abs (Actual - Expected) > Max_Error then
- Accuracy_Error_Reported := True;
- Report.Failed (Test_Name &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) &
- " efactor:" & Real'Image (E_Factor) );
- elsif Verbose then
- if Actual = Expected then
- Report.Comment (Test_Name & " exact result");
- else
- Report.Comment (Test_Name & " passed" &
- " actual: " & Real'Image (Actual) &
- " expected: " & Real'Image (Expected) &
- " difference: " & Real'Image (Actual - Expected) &
- " max err:" & Real'Image (Max_Error) &
- " efactor:" & Real'Image (E_Factor) );
- end if;
- end if;
- end Check;
-
-
- procedure Check (Actual, Expected : Complex;
- Test_Name : String;
- MRE : Real;
- R_Factor, I_Factor : Real := 0.0) is
- begin
- Check (Actual.Re, Expected.Re, Test_Name & " real part",
- MRE, R_Factor);
- Check (Actual.Im, Expected.Im, Test_Name & " imaginary part",
- MRE, I_Factor);
- end Check;
-
-
- procedure Special_Value_Test is
- -- In the following tests the expected result is accurate
- -- to the machine precision so the minimum guaranteed error
- -- bound can be used if the argument is exact.
- -- Since the argument involves Pi, we must allow for this
- -- inexact argument.
- Minimum_Error : constant := 11.0;
- begin
- Check (Sin (Pi/2.0 + 0.0*i),
- 1.0 + 0.0*i,
- "sin(pi/2+0i)",
- Minimum_Error + 1.0);
- Check (Cos (Pi/2.0 + 0.0*i),
- 0.0 + 0.0*i,
- "cos(pi/2+0i)",
- Minimum_Error + 1.0);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in special value test");
- when others =>
- Report.Failed ("exception in special value test");
- end Special_Value_Test;
-
-
-
- procedure Exact_Result_Test is
- No_Error : constant := 0.0;
- begin
- -- G.1.2(36);6.0
- Check (Sin(0.0 + 0.0*i), 0.0 + 0.0 * i, "sin(0+0i)", No_Error);
- Check (Cos(0.0 + 0.0*i), 1.0 + 0.0 * i, "cos(0+0i)", No_Error);
- exception
- when Constraint_Error =>
- Report.Failed ("Constraint_Error raised in Exact_Result Test");
- when others =>
- Report.Failed ("exception in Exact_Result Test");
- end Exact_Result_Test;
-
-
- procedure Identity_Test (RA, RB, IA, IB : Real) is
- -- Tests an identity over a range of values specified
- -- by the 4 parameters. RA and RB denote the range for the
- -- real part while IA and IB denote the range for the
- -- imaginary part.
- --
- -- For this test we use the identity
- -- Sin(Z) = Sin(Z-W) * Cos(W) + Cos(Z-W) * Sin(W)
- -- and
- -- Cos(Z) = Cos(Z-W) * Cos(W) - Sin(Z-W) * Sin(W)
- --
-
- X, Y : Real;
- Z : Complex;
- W : constant Complex := Compose_From_Cartesian(0.0625, 0.0625);
- ZmW : Complex; -- Z - W
- Sin_ZmW,
- Cos_ZmW : Complex;
- Actual1, Actual2 : Complex;
- R_Factor : Real; -- additional real error factor
- I_Factor : Real; -- additional imaginary error factor
- Sin_W : constant Complex := (6.2581348413276935585E-2,
- 6.2418588008436587236E-2);
- -- numeric stability is enhanced by using Cos(W) - 1.0 instead of
- -- Cos(W) in the computation.
- Cos_W_m_1 : constant Complex := (-2.5431314180235545803E-6,
- -3.9062493377261771826E-3);
-
-
- begin
- if Real'Digits > 20 then
- -- constants used here accurate to 20 digits. Allow 1
- -- additional digit of error for computation.
- Error_Low_Bound := 0.00000_00000_00000_0001;
- Report.Comment ("accuracy checked to 19 digits");
- end if;
-
- Accuracy_Error_Reported := False; -- reset
- for II in 0..Max_Samples loop
- X := (RB - RA) * Real (II) / Real (Max_Samples) + RA;
- for J in 0..Max_Samples loop
- Y := (IB - IA) * Real (J) / Real (Max_Samples) + IA;
-
- Z := Compose_From_Cartesian(X,Y);
- ZmW := Z - W;
- Sin_ZmW := Sin (ZmW);
- Cos_ZmW := Cos (ZmW);
-
- -- now for the first identity
- -- Sin(Z) = Sin(Z-W) * Cos(W) + Cos(Z-W) * Sin(W)
- -- = Sin(Z-W) * (1+(Cos(W)-1)) + Cos(Z-W) * Sin(W)
- -- = Sin(Z-W) + Sin(Z-W)*(Cos(W)-1) + Cos(Z-W)*Sin(W)
-
-
- Actual1 := Sin (Z);
- Actual2 := Sin_ZmW + (Sin_ZmW * Cos_W_m_1 + Cos_ZmW * Sin_W);
-
- -- The computation of the additional error factors are taken
- -- from Cody pages 17-20.
-
- R_Factor := abs (Re (Sin_ZmW) * Re (1.0 - Cos_W_m_1)) +
- abs (Im (Sin_ZmW) * Im (1.0 - Cos_W_m_1)) +
- abs (Re (Cos_ZmW) * Re (Sin_W)) +
- abs (Re (Cos_ZmW) * Re (1.0 - Cos_W_m_1));
-
- I_Factor := abs (Re (Sin_ZmW) * Im (1.0 - Cos_W_m_1)) +
- abs (Im (Sin_ZmW) * Re (1.0 - Cos_W_m_1)) +
- abs (Re (Cos_ZmW) * Im (Sin_W)) +
- abs (Im (Cos_ZmW) * Re (1.0 - Cos_W_m_1));
-
- Check (Actual1, Actual2,
- "Identity_1_Test " & Integer'Image (II) &
- Integer'Image (J) & ": Sin((" &
- Real'Image (Z.Re) & ", " &
- Real'Image (Z.Im) & ")) ",
- 11.0, R_Factor, I_Factor);
-
- -- now for the second identity
- -- Cos(Z) = Cos(Z-W) * Cos(W) - Sin(Z-W) * Sin(W)
- -- = Cos(Z-W) * (1+(Cos(W)-1) - Sin(Z-W) * Sin(W)
- Actual1 := Cos (Z);
- Actual2 := Cos_ZmW + (Cos_ZmW * Cos_W_m_1 - Sin_ZmW * Sin_W);
-
- -- The computation of the additional error factors are taken
- -- from Cody pages 17-20.
-
- R_Factor := abs (Re (Sin_ZmW) * Re (Sin_W)) +
- abs (Im (Sin_ZmW) * Im (Sin_W)) +
- abs (Re (Cos_ZmW) * Re (1.0 - Cos_W_m_1)) +
- abs (Im (Cos_ZmW) * Im (1.0 - Cos_W_m_1));
-
- I_Factor := abs (Re (Sin_ZmW) * Im (Sin_W)) +
- abs (Im (Sin_ZmW) * Re (Sin_W)) +
- abs (Re (Cos_ZmW) * Im (1.0 - Cos_W_m_1)) +
- abs (Im (Cos_ZmW) * Re (1.0 - Cos_W_m_1));
-
- Check (Actual1, Actual2,
- "Identity_2_Test " & Integer'Image (II) &
- Integer'Image (J) & ": Cos((" &
- Real'Image (Z.Re) & ", " &
- Real'Image (Z.Im) & ")) ",
- 11.0, R_Factor, I_Factor);
-
- if Accuracy_Error_Reported then
- -- only report the first error in this test in order to keep
- -- lots of failures from producing a huge error log
- Error_Low_Bound := 0.0; -- reset
- return;
- end if;
- end loop;
- end loop;
-
- Error_Low_Bound := 0.0; -- reset
- exception
- when Constraint_Error =>
- Report.Failed
- ("Constraint_Error raised in Identity_Test" &
- " for Z=(" & Real'Image (X) &
- ", " & Real'Image (Y) & ")");
- when others =>
- Report.Failed ("exception in Identity_Test" &
- " for Z=(" & Real'Image (X) &
- ", " & Real'Image (Y) & ")");
- end Identity_Test;
-
-
- procedure Do_Test is
- begin
- Special_Value_Test;
- Exact_Result_Test;
- -- test regions where sin and cos have the same sign and
- -- about the same magnitude. This will minimize subtraction
- -- errors in the identities.
- -- See Cody page 17.
- Identity_Test (0.0625, 10.0, 0.0625, 10.0);
- Identity_Test ( 16.0, 17.0, 16.0, 17.0);
- end Do_Test;
- end Generic_Check;
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
- package Float_Check is new Generic_Check (Float);
-
- -- check the floating point type with the most digits
- type A_Long_Float is digits System.Max_Digits;
- package A_Long_Float_Check is new Generic_Check (A_Long_Float);
-
- -----------------------------------------------------------------------
- -----------------------------------------------------------------------
-
-
-begin
- Report.Test ("CXG2021",
- "Check the accuracy of the complex SIN and COS functions");
-
- if Verbose then
- Report.Comment ("checking Standard.Float");
- end if;
-
- Float_Check.Do_Test;
-
- if Verbose then
- Report.Comment ("checking a digits" &
- Integer'Image (System.Max_Digits) &
- " floating point type");
- end if;
-
- A_Long_Float_Check.Do_Test;
-
-
- Report.Result;
-end CXG2021;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2022.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2022.a
deleted file mode 100644
index f9e4d1cae33..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2022.a
+++ /dev/null
@@ -1,309 +0,0 @@
--- CXG2022.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that multiplication and division of binary fixed point
--- numbers with compatible 'small values produce exact results.
---
--- TEST DESCRIPTION:
--- Signed, unsigned, and a mixture of signed and unsigned
--- binary fixed point values are multiplied and divided.
--- The result is checked against the expected "perfect result set"
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
---
---
--- CHANGE HISTORY:
--- 1 Apr 96 SAIC Initial release for 2.1
--- 29 Jan 1998 EDS Repaired fixed point errors ("**" and
--- assumptions about 'Small)
---!
-
-with System;
-with Report;
-procedure CXG2022 is
- Verbose : constant Boolean := False;
-
-procedure Check_Signed is
- type Pairs is delta 2.0 range -2.0 ** (System.Max_Mantissa) ..
- 2.0 ** (System.Max_Mantissa) - 1.0;
- type Halves is delta 0.5 range -2.0 ** (System.Max_Mantissa-2) ..
- 2.0 ** (System.Max_Mantissa-2) - 1.0;
- P1, P2, P3, P4 : Pairs;
- H1, H2, H3, H4 : Halves;
-
- procedure Dont_Opt is
- -- keep optimizer from knowing the constant value of expressions
- begin
- if Report.Ident_Bool (False) then
- P1 := 2.0; P2 := 4.0; P3 := 6.0;
- H1 := -2.0; H2 := 9.0; H3 := 3.0;
- end if;
- end Dont_Opt;
-
-begin
- H1 := -0.5;
- H2 := Halves'First;
- H3 := 1.0;
- P1 := 12.0;
- P2 := Pairs'First;
- P3 := Pairs'Last;
- Dont_Opt;
-
- P4 := Pairs (P1 * H1); -- 12.0 * -0.5
- if P4 /= -6.0 then
- Report.Failed ("12.0 * -0.5 = " & Pairs'Image (P4));
- end if;
-
- H4 := Halves (P1 / H1); -- 12.0 / -0.5
- if H4 /= -24.0 then
- Report.Failed ("12.0 / -0.5 = " & Halves'Image (H4));
- end if;
-
- P4 := P3 * H3; -- Pairs'Last * 1.0
- if P4 /= Pairs'Last then
- Report.Failed ("Pairs'Last * 1.0 = " & Pairs'Image (P4));
- end if;
-
- P4 := P3 / H3; -- Pairs'Last / 1.0
- if P4 /= Pairs'Last then
- Report.Failed ("Pairs'Last / 1.0 = " & Pairs'Image (P4));
- end if;
-
- P4 := P2 * 0.25; -- Pairs'First * 0.25
- if P4 /= Pairs (-2.0 ** (System.Max_Mantissa - 2)) then
- Report.Failed ("Pairs'First * 0.25 = " & Pairs'Image (P4));
- end if;
-
- P4 := 100.5 / H1; -- 100.5 / -0.5
- if P4 = -201.0 then
- null; -- Perfect result
- elsif Pairs'Small = 2.0 and ( P4 = -200.0 or P4 = -202.0 ) then
- null; -- Allowed variation
- else
- Report.Failed ("Pairs'Small =" & Pairs'Image (Pairs'Small) &
- " and 100.5/-0.5 = " & Pairs'Image (P4) );
- end if;
-
- H4 := H1 * H2; -- -0.5 * Halves'First
- if H4 /= Halves (2.0 ** (System.Max_Mantissa-3)) then
- Report.Failed ("-0.5 * Halves'First =" & Halves'Image (H4) &
- " instead of " &
- Halves'Image( Halves(2.0 ** (System.Max_Mantissa-3))));
- end if;
-
-exception
- when others =>
- Report.Failed ("unexpected exception in Check_Signed");
-end Check_Signed;
-
-
-
-procedure Check_Unsigned is
- type Pairs is delta 2.0 range 0.0 .. 2.0 ** (System.Max_Mantissa+1) - 1.0;
- type Halves is delta 0.5 range 0.0 .. 2.0 ** (System.Max_Mantissa-1) - 1.0;
- P1, P2, P3, P4 : Pairs;
- H1, H2, H3, H4 : Halves;
-
- procedure Dont_Opt is
- -- keep optimizer from knowing the constant value of expressions
- begin
- if Report.Ident_Bool (False) then
- P1 := 2.0; P2 := 4.0; P3 := 6.0;
- H1 := 2.0; H2 := 9.0; H3 := 3.0;
- end if;
- end Dont_Opt;
-
-begin
- H1 := 10.5;
- H2 := Halves(2.0 ** (System.Max_Mantissa - 6));
- H3 := 1.0;
- P1 := 12.0;
- P2 := Pairs'Last / 2;
- P3 := Pairs'Last;
- Dont_Opt;
-
- P4 := Pairs (P1 * H1); -- 12.0 * 10.5
- if P4 /= 126.0 then
- Report.Failed ("12.0 * 10.5 = " & Pairs'Image (P4));
- end if;
-
- H4 := Halves (P1 / H1); -- 12.0 / 10.5
- if H4 /= 1.0 and H4 /= 1.5 then
- Report.Failed ("12.0 / 10.5 = " & Halves'Image (H4));
- end if;
-
- P4 := P3 * H3; -- Pairs'Last * 1.0
- if P4 /= Pairs'Last then
- Report.Failed ("Pairs'Last * 1.0 = " & Pairs'Image (P4));
- end if;
-
- P4 := P3 / H3; -- Pairs'Last / 1.0
- if P4 /= Pairs'Last then
- Report.Failed ("Pairs'Last / 1.0 = " & Pairs'Image (P4));
- end if;
-
- P4 := P1 * 0.25; -- 12.0 * 0.25
- if P4 /= 2.0 and P4 /= 4.0 then
- Report.Failed ("12.0 * 0.25 = " & Pairs'Image (P4));
- end if;
-
- P4 := 100.5 / H1; -- 100.5 / 10.5 = 9.571...
- if P4 /= 8.0 and P4 /= 10.0 then
- Report.Failed ("100.5/10.5 = " & Pairs'Image (P4));
- end if;
-
- H4 := H2 * 2; -- 2**(max_mantissa-6) * 2
- if H4 /= Halves(2.0 ** (System.Max_Mantissa-5)) then
- Report.Failed ("2**(System.Max_Mantissa-6) * 2=" & Halves'Image (H4) &
- " instead of " &
- Halves'Image( Halves(2.0 ** (System.Max_Mantissa-5))));
- end if;
-
-exception
- when others =>
- Report.Failed ("unexpected exception in Check_Unsigned");
-end Check_Unsigned;
-
-
-
-procedure Check_Mixed is
- type Pairs is delta 2.0 range -2.0 ** (System.Max_Mantissa) ..
- 2.0 ** (System.Max_Mantissa) - 1.0;
- type Halves is delta 0.5 range 0.0 .. 2.0 ** (System.Max_Mantissa-1) - 1.0;
- P1, P2, P3, P4 : Pairs;
- H1, H2, H3, H4 : Halves;
-
- procedure Dont_Opt is
- -- keep optimizer from knowing the constant value of expressions
- begin
- if Report.Ident_Bool (False) then
- P1 := 2.0; P2 := 4.0; P3 := 6.0;
- H1 := 2.0; H2 := 9.0; H3 := 3.0;
- end if;
- end Dont_Opt;
-
-begin
- H1 := 10.5;
- H2 := Halves(2.0 ** (System.Max_Mantissa - 6));
- H3 := 1.0;
- P1 := 12.0;
- P2 := -4.0;
- P3 := Pairs'Last;
- Dont_Opt;
-
- P4 := Pairs (P1 * H1); -- 12.0 * 10.5
- if P4 /= 126.0 then
- Report.Failed ("12.0 * 10.5 = " & Pairs'Image (P4));
- end if;
-
- H4 := Halves (P1 / H1); -- 12.0 / 10.5
- if H4 /= 1.0 and H4 /= 1.5 then
- Report.Failed ("12.0 / 10.5 = " & Halves'Image (H4));
- end if;
-
- P4 := P3 * H3; -- Pairs'Last * 1.0
- if P4 /= Pairs'Last then
- Report.Failed ("Pairs'Last * 1.0 = " & Pairs'Image (P4));
- end if;
-
- P4 := P3 / H3; -- Pairs'Last / 1.0
- if P4 /= Pairs'Last then
- Report.Failed ("Pairs'Last / 1.0 = " & Pairs'Image (P4));
- end if;
-
- P4 := P1 * 0.25; -- 12.0 * 0.25
- if P4 = 3.0 then
- null; -- Perfect result
- elsif Pairs'Small = 2.0 and then ( P4 = 2.0 or P4 = 4.0 ) then
- null; -- Allowed deviation
- else
- Report.Failed ("Pairs'Small =" & Pairs'Image (Pairs'Small) &
- "and 12.0 * 0.25 = " & Pairs'Image (P4) );
- end if;
-
- P4 := 100.5 / H1; -- 100.5 / 10.5 = 9.571...
- if P4 = 9.0 then
- null; -- Perfect result
- elsif Pairs'Small = 2.0 and then ( P4 = 8.0 or P4 = 10.0 ) then
- null; -- Allowed values
- else
- Report.Failed ("Pairs'Small =" & Pairs'Image (Pairs'Small) &
- "and 100.5/10.5 = " & Pairs'Image (P4) );
- end if;
-
- H4 := H2 * 2; -- 2**(max_mantissa-6) * 2
- if H4 /= Halves(2.0 ** (System.Max_Mantissa-5)) then
- Report.Failed ("2**(System.Max_Mantissa-6) * 2=" & Halves'Image (H4) &
- " instead of " &
- Halves'Image( Halves(2.0 ** (System.Max_Mantissa-5))));
- end if;
-
- P4 := Pairs(P1 * 6) / P2; -- 12 * 6 / -4
- if (P4 /= -18.0) then
- Report.Failed ("12*6/-4 = " & Pairs'Image(P4));
- end if;
-
- P4 := Halves(P1 * 6.0) / P2; -- 12 * 6 / -4
- if (P4 /= -18.0) then
- Report.Failed ("Halves(12*6)/-4 = " & Pairs'Image(P4));
- end if;
-
-exception
- when others =>
- Report.Failed ("unexpected exception in Check_Mixed");
-end Check_Mixed;
-
-
-begin -- main
- Report.Test ("CXG2022",
- "Check the accuracy of multiplication and division" &
- " of binary fixed point numbers");
- if Verbose then
- Report.Comment ("starting signed test");
- end if;
- Check_Signed;
-
- if Verbose then
- Report.Comment ("starting unsigned test");
- end if;
- Check_Unsigned;
-
- if Verbose then
- Report.Comment ("starting mixed sign test");
- end if;
- Check_Mixed;
-
- Report.Result;
-end CXG2022;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2023.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2023.a
deleted file mode 100644
index 0cdd5574e09..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2023.a
+++ /dev/null
@@ -1,351 +0,0 @@
--- CXG2023.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that multiplication and division of decimal fixed point
--- numbers produce exact results.
---
--- TEST DESCRIPTION:
--- Check that multiplication and division of decimal fixed point
--- numbers produce exact results.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
--- This test applies only to implementations supporting
--- decimal fixed point types of at least 9 digits.
---
---
--- CHANGE HISTORY:
--- 3 Apr 96 SAIC Initial release for 2.1
---
---!
-
-with System;
-with Report;
-procedure CXG2023 is
- Verbose : constant Boolean := False;
-
-procedure Check_1 is
- Num_Digits : constant := 6;
- type Pennies is delta 0.01 digits Num_Digits;
- type Franklins is delta 100.0 digits Num_Digits;
- type Dollars is delta 1.0 digits Num_Digits;
-
- P1 : Pennies;
- F1 : Franklins;
- D1 : Dollars;
-
- -- optimization thwarting functions
-
- function P (X : Pennies) return Pennies is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 3.21; -- never executed
- end if;
- end P;
-
-
- function F (X : Franklins) return Franklins is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 32100.0; -- never executed
- end if;
- end F;
-
-
- function D (X : Dollars) return Dollars is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 321.0; -- never executed
- end if;
- end D;
-
-
-begin
- -- multiplication where one operand is universal real
-
- P1 := P(0.05) * 200.0;
- if P1 /= 10.00 then
- Report.Failed ("1 - expected 10.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := P(0.05) * 100.0;
- if D1 /= 5.00 then
- Report.Failed ("2 - expected 5.00 got " & Dollars'Image (D1));
- end if;
-
- F1 := P(0.05) * 50_000.0;
- if F1 /= 2500.00 then
- Report.Failed ("3 - expected 2500.0 got " & Franklins'Image (F1));
- end if;
-
- -- multiplication where both operands are decimal fixed
-
- P1 := P(0.05) * D(-200.0);
- if P1 /= -10.00 then
- Report.Failed ("4 - expected -10.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := P(0.05) * P(-100.0);
- if D1 /= -5.00 then
- Report.Failed ("5 - expected -5.00 got " & Dollars'Image (D1));
- end if;
-
- F1 := P(-0.05) * F(50_000.0);
- if F1 /= -2500.00 then
- Report.Failed ("6 - expected -2500.0 got " & Franklins'Image (F1));
- end if;
-
- -- division where one operand is universal real
-
- P1 := P(0.05) / 0.001;
- if P1 /= 50.00 then
- Report.Failed ("7 - expected 50.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := D(1000.0) / 3.0;
- if D1 /= 333.00 then
- Report.Failed ("8 - expected 333.00 got " & Dollars'Image (D1));
- end if;
-
- F1 := P(1234.56) / 0.0001;
- if F1 /= 12345600.00 then
- Report.Failed ("9 - expected 12345600.0 got " & Franklins'Image (F1));
- end if;
-
-
- -- division where both operands are decimal fixed
-
- P1 := P(0.05) / D(1.0);
- if P1 /= 0.05 then
- Report.Failed ("10 - expected 0.05 got " & Pennies'Image (P1));
- end if;
-
- -- check for truncation toward 0
- D1 := P(-101.00) / P(2.0);
- if D1 /= -50.00 then
- Report.Failed ("11 - expected -50.00 got " & Dollars'Image (D1));
- end if;
-
- P1 := P(-102.03) / P(-0.5);
- if P1 /= 204.06 then
- Report.Failed ("12 - expected 204.06 got " & Pennies'Image (P1));
- end if;
-
- F1 := P(876.54) / P(0.03);
- if F1 /= 29200.00 then
- Report.Failed ("13 - expected 29200.0 got " & Franklins'Image (F1));
- end if;
-
-exception
- when others =>
- Report.Failed ("unexpected exception in Check_1");
-end Check_1;
-
-generic
- type Pennies is delta<> digits<>;
- type Dollars is delta<> digits<>;
- type Franklins is delta<> digits<>;
-procedure Generic_Check;
-procedure Generic_Check is
-
- -- the following code is copied directly from the
- -- above procedure Check_1
-
- P1 : Pennies;
- F1 : Franklins;
- D1 : Dollars;
-
- -- optimization thwarting functions
-
- function P (X : Pennies) return Pennies is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 3.21; -- never executed
- end if;
- end P;
-
-
- function F (X : Franklins) return Franklins is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 32100.0; -- never executed
- end if;
- end F;
-
-
- function D (X : Dollars) return Dollars is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 321.0; -- never executed
- end if;
- end D;
-
-
-begin
- -- multiplication where one operand is universal real
-
- P1 := P(0.05) * 200.0;
- if P1 /= 10.00 then
- Report.Failed ("1 - expected 10.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := P(0.05) * 100.0;
- if D1 /= 5.00 then
- Report.Failed ("2 - expected 5.00 got " & Dollars'Image (D1));
- end if;
-
- F1 := P(0.05) * 50_000.0;
- if F1 /= 2500.00 then
- Report.Failed ("3 - expected 2500.0 got " & Franklins'Image (F1));
- end if;
-
- -- multiplication where both operands are decimal fixed
-
- P1 := P(0.05) * D(-200.0);
- if P1 /= -10.00 then
- Report.Failed ("4 - expected -10.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := P(0.05) * P(-100.0);
- if D1 /= -5.00 then
- Report.Failed ("5 - expected -5.00 got " & Dollars'Image (D1));
- end if;
-
- F1 := P(-0.05) * F(50_000.0);
- if F1 /= -2500.00 then
- Report.Failed ("6 - expected -2500.0 got " & Franklins'Image (F1));
- end if;
-
- -- division where one operand is universal real
-
- P1 := P(0.05) / 0.001;
- if P1 /= 50.00 then
- Report.Failed ("7 - expected 50.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := D(1000.0) / 3.0;
- if D1 /= 333.00 then
- Report.Failed ("8 - expected 333.00 got " & Dollars'Image (D1));
- end if;
-
- F1 := P(1234.56) / 0.0001;
- if F1 /= 12345600.00 then
- Report.Failed ("9 - expected 12345600.0 got " & Franklins'Image (F1));
- end if;
-
-
- -- division where both operands are decimal fixed
-
- P1 := P(0.05) / D(1.0);
- if P1 /= 0.05 then
- Report.Failed ("10 - expected 0.05 got " & Pennies'Image (P1));
- end if;
-
- -- check for truncation toward 0
- D1 := P(-101.00) / P(2.0);
- if D1 /= -50.00 then
- Report.Failed ("11 - expected -50.00 got " & Dollars'Image (D1));
- end if;
-
- P1 := P(-102.03) / P(-0.5);
- if P1 /= 204.06 then
- Report.Failed ("12 - expected 204.06 got " & Pennies'Image (P1));
- end if;
-
- F1 := P(876.54) / P(0.03);
- if F1 /= 29200.00 then
- Report.Failed ("13 - expected 29200.0 got " & Franklins'Image (F1));
- end if;
-
-end Generic_Check;
-
-
-procedure Check_G6 is
- Num_Digits : constant := 6;
- type Pennies is delta 0.01 digits Num_Digits;
- type Franklins is delta 100.0 digits Num_Digits;
- type Dollars is delta 1.0 digits Num_Digits;
-
- procedure G is new Generic_Check (Pennies, Dollars, Franklins);
-begin
- G;
-end Check_G6;
-
-
-procedure Check_G9 is
- Num_Digits : constant := 9;
- type Pennies is delta 0.01 digits Num_Digits;
- type Franklins is delta 100.0 digits Num_Digits;
- type Dollars is delta 1.0 digits Num_Digits;
-
- procedure G is new Generic_Check (Pennies, Dollars, Franklins);
-begin
- G;
-end Check_G9;
-
-
-begin -- main
- Report.Test ("CXG2023",
- "Check the accuracy of multiplication and division" &
- " of decimal fixed point numbers");
-
- if Verbose then
- Report.Comment ("starting Check_1");
- end if;
- Check_1;
-
- if Verbose then
- Report.Comment ("starting Check_G6");
- end if;
- Check_G6;
-
- if Verbose then
- Report.Comment ("starting Check_G9");
- end if;
- Check_G9;
-
- Report.Result;
-end CXG2023;
diff --git a/gcc/testsuite/ada/acats/tests/cxg/cxg2024.a b/gcc/testsuite/ada/acats/tests/cxg/cxg2024.a
deleted file mode 100644
index 55648283eba..00000000000
--- a/gcc/testsuite/ada/acats/tests/cxg/cxg2024.a
+++ /dev/null
@@ -1,191 +0,0 @@
--- CXG2024.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that multiplication and division of decimal
--- and binary fixed point numbers that result in a
--- decimal fixed point type produce acceptable results.
---
--- TEST DESCRIPTION:
--- Multiplication and division of mixed binary and decimal
--- values are performed. Identity functions are used so
--- that the operands of the expressions will not be seen
--- as static by the compiler.
---
--- SPECIAL REQUIREMENTS
--- The Strict Mode for the numerical accuracy must be
--- selected. The method by which this mode is selected
--- is implementation dependent.
---
--- APPLICABILITY CRITERIA:
--- This test applies only to implementations supporting the
--- Numerics Annex.
--- This test only applies to the Strict Mode for numerical
--- accuracy.
--- This test applies only to implementations supporting
--- decimal fixed point types of at least 9 digits.
---
---
--- CHANGE HISTORY:
--- 4 Apr 96 SAIC Initial release for 2.1
--- 17 Aug 96 SAIC Removed checks for close results
---
---!
-
-with System;
-with Report;
-procedure CXG2024 is
-
-procedure Do_Check is
- Num_Digits : constant := 9;
- type Pennies is delta 0.01 digits Num_Digits;
- type Dollars is delta 1.0 digits Num_Digits;
-
- type Signed_Sixteenths is delta 0.0625
- range -2.0 ** (System.Max_Mantissa-5) ..
- 2.0 ** (System.Max_Mantissa-5) - 1.0;
- type Unsigned_Sixteenths is delta 0.0625
- range 0.0 .. 2.0 ** (System.Max_Mantissa-4) - 1.0;
-
- P1 : Pennies;
- D1 : Dollars;
-
- -- optimization thwarting functions
-
- function P (X : Pennies) return Pennies is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 3.21; -- never executed
- end if;
- end P;
-
-
- function D (X : Dollars) return Dollars is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 321.0; -- never executed
- end if;
- end D;
-
-
- function US (X : Unsigned_Sixteenths) return Unsigned_Sixteenths is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 321.0; -- never executed
- end if;
- end US;
-
-
- function SS (X : Signed_Sixteenths) return Signed_Sixteenths is
- begin
- if Report.Ident_Bool (True) then
- return X;
- else
- return 321.0; -- never executed
- end if;
- end SS;
-
-
-begin
-
- P1 := P(0.05) * SS(-200.0);
- if P1 /= -10.00 then
- Report.Failed ("1 - expected -10.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := P(0.05) * SS(-100.0);
- if D1 /= -5.00 then
- Report.Failed ("2 - expected -5.00 got " & Dollars'Image (D1));
- end if;
-
- P1 := P(0.05) * US(200.0);
- if P1 /= 10.00 then
- Report.Failed ("3 - expected 10.00 got " & Pennies'Image (P1));
- end if;
-
- D1 := P(-0.05) * US(100.0);
- if D1 /= -5.00 then
- Report.Failed ("4 - expected -5.00 got " & Dollars'Image (D1));
- end if;
-
-
-
- P1 := P(0.05) / US(1.0);
- if P1 /= 0.05 then
- Report.Failed ("6 - expected 0.05 got " & Pennies'Image (P1));
- end if;
-
-
- -- check rounding
-
- D1 := Dollars'Round (Pennies (P(-101.00) / US(2.0)));
- if D1 /= -51.00 then
- Report.Failed ("11 - expected -51.00 got " & Dollars'Image (D1));
- end if;
-
- D1 := Dollars'Round (Pennies (P(101.00) / US(2.0)));
- if D1 /= 51.00 then
- Report.Failed ("12 - expected 51.00 got " & Dollars'Image (D1));
- end if;
-
- D1 := Dollars'Round (Pennies (SS(-101.00) / P(2.0)));
- if D1 /= -51.00 then
- Report.Failed ("13 - expected -51.00 got " & Dollars'Image (D1));
- end if;
-
- D1 := Dollars'Round (Pennies (US(101.00) / P(2.0)));
- if D1 /= 51.00 then
- Report.Failed ("14 - expected 51.00 got " & Dollars'Image (D1));
- end if;
-
-
-
- P1 := P(-102.03) / SS(-0.5);
- if P1 /= 204.06 then
- Report.Failed ("15 - expected 204.06 got " & Pennies'Image (P1));
- end if;
-
-
-exception
- when others =>
- Report.Failed ("unexpected exception in Do_Check");
-end Do_Check;
-
-
-begin -- main
- Report.Test ("CXG2024",
- "Check the accuracy of multiplication and division" &
- " of mixed decimal and binary fixed point numbers");
-
- Do_Check;
-
- Report.Result;
-end CXG2024;
diff --git a/gcc/testsuite/g++.dg/abi/layout2.C b/gcc/testsuite/g++.dg/abi/layout2.C
index fb4e1e5d9ff..d9ccda8a074 100644
--- a/gcc/testsuite/g++.dg/abi/layout2.C
+++ b/gcc/testsuite/g++.dg/abi/layout2.C
@@ -1,5 +1,7 @@
// Red Hat bugzilla 65210
// { dg-do run }
+// APPLE LOCAL Apple has specific long double warning message then FSF
+// { dg-options "-Wno-long-double" { target *-apple-darwin* } }
struct A {
int a;
diff --git a/gcc/testsuite/g++.dg/align-test-1.C b/gcc/testsuite/g++.dg/align-test-1.C
new file mode 100644
index 00000000000..e3df21d6d3b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/align-test-1.C
@@ -0,0 +1,347 @@
+/* APPLE LOCAL file Macintosh alignment */
+
+/* { dg-do run } */
+/* { dg-options "-Wno-long-long" } */
+
+/*
+ * Macintosh compiler alignment test for C++.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2001.
+ * Last modified 2002-5-24.
+ */
+
+ /* Check whether we are testing GCC 3 or later. If so, it has a
+ different scheme for laying out classes: members of a derived
+ class can be laid out starting in the padding at the end of the
+ base class. */
+#ifdef __GNUC__
+#if __GNUC__ >= 3
+ #define GCC3 1
+#endif
+#endif
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+extern "C" void abort (void);
+
+#define Q(x) #x, x
+
+typedef unsigned char UINT8;
+typedef unsigned short UINT16;
+typedef unsigned long UINT32;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+/* === classes === */
+
+class C1 {
+ static const int f1 = 1;
+ UINT8 f2;
+};
+
+class C2 {
+ static int f1;
+ UINT8 f2;
+};
+
+class C3 {
+ public:
+ enum E1 {
+ f1 = 1
+ };
+ protected:
+ UINT8 f2;
+};
+
+class C4 {
+ UINT8 f1;
+ static const int f2 = 1;
+};
+
+class C5 {
+ UINT8 f2;
+ static int f1;
+};
+
+class C6 {
+ UINT8 f1;
+ enum E1 {
+ f2 = 1
+ };
+};
+
+class C7 {
+ /* empty base class */
+};
+
+#pragma options align=mac68k
+
+class C8 {
+ /* empty base class */
+};
+
+class C9: public C8 {
+ public:
+ UINT8 f1;
+};
+
+#pragma options align=reset
+
+/* What is offset of first field after an empty base class? */
+class C10: public C7 {
+ public:
+ UINT8 f1;
+};
+
+/* GCC3 starts layout of derived class in padding at end of base class. */
+class C11 {
+ public:
+ UINT32 f1;
+ UINT8 f2;
+};
+
+class C12: public C11 {
+ public:
+ UINT8 f3;
+};
+
+/* Check whether compiler will reorder members to take advantage of
+ padding. If the compiler did this (which it does not appear to
+ do), f3 and f4 in C14 would be reordered to take advantage of the
+ padding at the end of the base class. */
+class C13 {
+ public:
+ UINT32 f1;
+ UINT16 f2;
+};
+
+class C14: public C13 {
+ public:
+ UINT32 f3;
+ UINT16 f4;
+};
+
+/* Tests for double aligned base class */
+
+class C15 {
+ public:
+ double f1;
+ long f2;
+};
+
+class C16: public C15 {
+};
+
+class C17: public C15 {
+ public:
+ long f3;
+};
+
+class C18: public C16 {
+ public:
+ char f3;
+};
+
+class C19: public C17 {
+ public:
+ char f4;
+};
+
+/* Tests for alignment in class with v-table pointer */
+
+class C20 {
+ public:
+ double f1;
+ virtual void func1(void);
+};
+
+/* === vectors === */
+
+#ifdef __VEC__
+class VC1 {
+ public:
+ vector signed short f1;
+ UINT8 f2;
+};
+
+typedef struct VS1 {
+ VC1 f1;
+ UINT8 f2;
+} VS1;
+
+class VC2: public VC1 {
+ public:
+ UINT8 f1;
+};
+
+typedef struct VS2 {
+ UINT8 f1;
+ VC2 f2;
+ UINT8 f3;
+} VS2;
+
+class VC3 {
+ public:
+ vector signed short f1;
+ virtual void func1(void);
+};
+
+#endif
+
+/* === bools === */
+
+typedef struct B1 {
+ bool f1;
+ UINT8 f2;
+} B1;
+
+typedef struct B2 {
+ UINT8 f1;
+ bool f2;
+} B2;
+
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-20s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+ check(Q(sizeof(C1)), 1, "const as 1st field");
+ check(Q(sizeof(C2)), 1, "static as 1st field");
+ check(Q(sizeof(C3)), 1, "enum as 1st field");
+ check(Q(sizeof(C4)), 1, "const as 2nd field");
+ check(Q(sizeof(C5)), 1, "static as 2nd field");
+ check(Q(sizeof(C6)), 1, "enum as 2nd field");
+ check(Q(sizeof(C7)), 1, "empty class, power mode");
+ check(Q(sizeof(C8)), 2, "empty class, mac68k mode");
+ check(Q(sizeof(C9)), 2, "class with empty base class and one char, mac68k");
+ check(Q(offsetof(C9, f1)), 0, "offset of 1st field after empty base class"); /* { dg-warning "invalid access" "" } */
+ /* { dg-warning "macro was used incorrectly" "" { target *-*-* } 256 } */
+ check(Q(sizeof(C10)), 1, "class based on an empty class, power mode");
+ check(Q(sizeof(C11)), 8, "class with long, char");
+#ifdef GCC3
+ check(Q(sizeof(C12)), 8, "class with base class with long, char and its own char");
+#else
+ check(Q(sizeof(C12)), 12, "class with base class with long, char and its own char");
+#endif
+#ifdef GCC3
+ check(Q(offsetof(C12, f3)), 5, "offset of 1st field in class with a base class with a long, char"); /* { dg-warning "invalid access" "" } */
+ /* { dg-warning "macro was used incorrectly" "" { target *-*-* } 266 } */
+#else
+ check(Q(offsetof(C12, f3)), 8, "offset of 1st field in class with a base class with a long, char");
+#endif
+ check(Q(sizeof(C13)), 8, "class with long, short");
+ check(Q(sizeof(C14)), 16, "derived class with short, long");
+ check(Q(offsetof(C14, f3)), 8, "offset of 1st field after base class with padding"); /* { dg-warning "invalid access" "" } */
+ /* { dg-warning "macro was used incorrectly" "" { target *-*-* } 273 } */
+ check(Q(offsetof(C14, f4)), 12, "offset of 2nd field after base class with padding"); /* { dg-warning "invalid access" "" } */
+ /* { dg-warning "macro was used incorrectly" "" { target *-*-* } 275 } */
+
+ check(Q(sizeof(C15)), 16, "base class with double, long");
+ check(Q(sizeof(C16)), 16, "empty derived class with base with double, long");
+#ifdef GCC3
+ check(Q(sizeof(C17)), 16, "derived class with base with double, long and its own long");
+#else
+ check(Q(sizeof(C17)), 24, "derived class with base with double, long and its own long");
+#endif
+#ifdef GCC3
+ check(Q(sizeof(C18)), 16, "derived class based on empty derived class with base with double, long");
+#else
+ check(Q(sizeof(C18)), 24, "derived class based on empty derived class with base with double, long");
+#endif
+#ifdef GCC3
+ check(Q(sizeof(C19)), 24, "derived class based on derived class with base with double, long and its own long");
+#else
+ check(Q(sizeof(C19)), 32, "derived class based on derived class with base with double, long and its own long");
+#endif
+#ifdef GCC3
+ check(Q(sizeof(C20)), 16, "class with double and v-table ptr");
+ check(Q(offsetof(C20, f1)), 8, "offset of double 1st field in class with v-table ptr"); /* { dg-warning "invalid access" "" } */
+ /* { dg-warning "macro was used incorrectly" "" { target *-*-* } 297 } */
+#else
+ check(Q(sizeof(C20)), 16, "class with double and v-table ptr");
+ check(Q(offsetof(C20, f1)), 0, "offset of 1st field in class with v-table ptr");
+#endif
+
+ /* Vector tests */
+#ifdef __VEC__
+ check(Q(sizeof(VC1)), 32, "class with vector as 1st field");
+ check(Q(sizeof(VS1)), 48, "struct with a class with a vector as 1st field");
+#ifdef GCC3
+ check(Q(sizeof(VC2)), 32, "class with base class containing a vector");
+#else
+ check(Q(sizeof(VC2)), 48, "class with base class containing a vector");
+#endif
+#ifdef GCC3
+ check(Q(offsetof(VC2, f1)), 17, "offset of 1st field after base class with vector, char, and padding");
+#else
+ check(Q(offsetof(VC2, f1)), 32, "offset of 1st field after base class with vector, char, and padding");
+#endif
+#ifdef GCC3
+ check(Q(sizeof(VS2)), 64, "struct with a char, class with a vector, char");
+#else
+ check(Q(sizeof(VS2)), 80, "struct with a char, class with a vector, char");
+#endif
+ check(Q(offsetof(VS2, f2)), 16, "offset of class with a vector in a struct with char, class...");
+#ifdef GCC3
+ check(Q(offsetof(VS2, f3)), 48, "offset of 2nd char in a struct with char, class, char");
+#else
+ check(Q(offsetof(VS2, f3)), 64, "offset of 2nd char in a struct with char, class, char");
+#endif
+#ifdef GCC3
+ check(Q(sizeof(VC3)), 32, "class with a vector and v-table ptr");
+ check(Q(offsetof(VC3, f1)), 16, "offset vector in class with a vector and v-table ptr");
+#else
+ check(Q(sizeof(VC3)), 32, "class with a vector and v-table ptr");
+ check(Q(offsetof(VC3, f1)), 0, "offset vector in class with a vector and v-table ptr");
+#endif
+#endif
+
+ /* bool tests */
+ check(Q(sizeof(bool)), 4, "bool data type");
+ check(Q(sizeof(B1)), 8, "struct with bool, char");
+ check(Q(sizeof(B2)), 8, "struct with char, bool");
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/altivec-1.C b/gcc/testsuite/g++.dg/altivec-1.C
new file mode 100644
index 00000000000..6bda7094db0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/altivec-1.C
@@ -0,0 +1,12 @@
+/* APPLE LOCAL file AltiVec */
+/* Test for static_cast<...> among AltiVec types. */
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-faltivec" } */
+
+struct Foo2 {
+ vector unsigned int vui;
+ vector signed int As_vsi() {
+ return static_cast<vector signed int>(vui); /* { dg-bogus "invalid static_cast" } */
+ }
+};
+
diff --git a/gcc/testsuite/g++.dg/altivec-2.C b/gcc/testsuite/g++.dg/altivec-2.C
new file mode 100644
index 00000000000..0b2f3751a24
--- /dev/null
+++ b/gcc/testsuite/g++.dg/altivec-2.C
@@ -0,0 +1,15 @@
+/* APPLE LOCAL file AltiVec */
+/* Test for distinguishing 'vector bool ...' from 'vector unsigned ...'
+ types by the front-end. */
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-faltivec" } */
+
+struct Foo1 {
+ void foo(vector unsigned char) { }
+ void foo(vector bool char) { } /* { dg-bogus "has already been declared" } */
+ void bar(vector unsigned short) { }
+ void bar(vector bool short) { } /* { dg-bogus "has already been declared" } */
+ void baz(vector unsigned int) { }
+ void baz(vector bool int) { } /* { dg-bogus "has already been declared" } */
+};
+
diff --git a/gcc/testsuite/g++.dg/altivec-3.C b/gcc/testsuite/g++.dg/altivec-3.C
new file mode 100644
index 00000000000..77084a1d824
--- /dev/null
+++ b/gcc/testsuite/g++.dg/altivec-3.C
@@ -0,0 +1,21 @@
+/* APPLE LOCAL file AltiVec */
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-options "-faltivec -Wall" } */
+
+/* This test checks if AltiVec builtins accept const-qualified
+ arguments. */
+
+int main (int argc, const char * argv[])
+{
+ int i;
+ const float cf = 1.0;
+ vector float v;
+ const vector float cv = (vector float)(1.0, 2.0, 3.0, 4.0);
+
+ vec_dst(&cv, i, 0);
+ v = vec_ld(0, &cv);
+ v = vec_lde(0, &cf);
+ vec_lvsl(0, &cf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/altivec-4.C b/gcc/testsuite/g++.dg/altivec-4.C
new file mode 100644
index 00000000000..1b33365408b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/altivec-4.C
@@ -0,0 +1,129 @@
+/* APPLE LOCAL file AltiVec */
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-options "-faltivec -Wno-long-double" } */
+
+/* Test for correct handling of AltiVec constants passed
+ through '...' (va_arg). */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define CHECK_INVARIANT(expr) \
+ if (!(expr)) { \
+ printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \
+ abort (); \
+ }
+
+struct foo { int x; int y; };
+struct vfoo { int x; __vector signed int v; int y; };
+union u { __vector signed int v; signed int i[4]; };
+
+struct foo x_g = { 3, 4};
+struct vfoo vx_g = { 10, (vector signed int)(11, 12, 13, 14), 15 };
+__vector signed int v_g = (vector signed int) (22, 23, 24, 25);
+struct vfoo vx2_g = { 30, (vector signed int)(31, 32, 33, 34), 35 };
+__vector signed int v2_g = (vector signed int)(40, 41, 42, 43);
+int i_1 = 99, i_2 = 33;
+double d_2 = 1.5, d_3 = 1.75;
+long double ld_1 = 1.25;
+
+void bar (int i, ... )
+{
+ struct foo xi;
+ double d;
+ long double ld;
+ float f;
+ char c;
+ short s;
+ va_list ap;
+ va_start(ap, i);
+ xi = va_arg(ap, struct foo);
+ s = (short)va_arg(ap, int);
+ f = (float)va_arg(ap, double);
+ ld = va_arg(ap, long double);
+ c = (char)va_arg(ap, int);
+ d = va_arg(ap, double);
+ va_end(ap);
+
+ CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y);
+ CHECK_INVARIANT (s == (short)i_2);
+ CHECK_INVARIANT (f == (float)d_2);
+ CHECK_INVARIANT (ld == ld_1);
+ CHECK_INVARIANT (c == (char)i_1);
+ CHECK_INVARIANT (d == d_3);
+}
+
+void baz (int i, ... )
+{
+ struct vfoo vx, vx2;
+ __vector signed int v_i, v2_i;
+ int j, k, l;
+ va_list ap;
+ va_start(ap, i);
+ v_i = va_arg(ap, __vector signed int); /* { dg-bogus "non-POD type" } */
+ j = va_arg(ap, int);
+ vx = va_arg(ap, struct vfoo); /* { dg-bogus "non-POD type" } */
+ k = va_arg(ap, int);
+ v2_i = va_arg(ap, __vector signed int); /* { dg-bogus "non-POD type" } */
+ l = va_arg(ap, int);
+ vx2 = va_arg(ap, struct vfoo); /* { dg-bogus "non-POD type" } */
+ va_end(ap);
+
+ CHECK_INVARIANT (vec_all_eq (v_i, v_g));
+ CHECK_INVARIANT (j == i_1);
+ CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
+ CHECK_INVARIANT (k == i_1);
+ CHECK_INVARIANT (vec_all_eq (v2_i, v2_g));
+ CHECK_INVARIANT (l == i_1);
+ CHECK_INVARIANT (vx2.x == vx2_g.x && vec_all_eq(vx2.v, vx2_g.v) && vx2.y == vx2_g.y);
+}
+
+void quux (int i, ... )
+{
+ __vector signed int v_i, v2_i;
+ union u vi, v2i;
+ va_list ap;
+ va_start(ap, i);
+ v_i = va_arg(ap, __vector signed int);
+ v2_i = va_arg(ap, __vector signed int);
+ va_end(ap);
+ vi.v = v_i;
+ v2i.v = v2_i;
+
+ CHECK_INVARIANT (vec_all_eq (v_i, v_g));
+ CHECK_INVARIANT (vec_all_eq (v2_i, v_g));
+ CHECK_INVARIANT (vec_all_eq (vi.v, v_g));
+ CHECK_INVARIANT (vec_all_eq (v2i.v, v_g));
+}
+
+void baz2 (int i, ... )
+{
+ struct vfoo vx;
+ union u vxi;
+ va_list ap;
+ va_start(ap, i);
+ vx = va_arg(ap, struct vfoo);
+ va_end(ap);
+ vxi.v = vx.v;
+
+ CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
+ CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v));
+}
+
+int main(void)
+{
+ CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48);
+
+ bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3);
+ baz(i_1, v_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 122 } */
+ i_1, vx_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 122 } */
+ i_1, v2_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 122 } */
+ i_1, vx2_g); /* { dg-bogus "non-POD type" } */
+ quux(i_1, v_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 124 } */
+ v_g); /* { dg-bogus "non-POD type" } */
+ baz2(i_1, vx_g); /* { dg-bogus "non-POD type" } */
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/altivec-5.C b/gcc/testsuite/g++.dg/altivec-5.C
new file mode 100644
index 00000000000..4c5a21ad46f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/altivec-5.C
@@ -0,0 +1,19 @@
+/* APPLE LOCAL file AltiVec */
+/* Test for AltiVec type overloading. */
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-faltivec" } */
+ void foo(vector unsigned char) { }
+ void foo(vector signed char) { }
+ void foo(vector bool char) { }
+ void foo(vector unsigned short) { }
+ void foo(vector signed short) { }
+ void foo(vector bool short) { }
+ void foo(vector unsigned long) { }
+ void foo(vector signed long) { }
+ void foo(vector bool long) { }
+ void foo(vector float) { }
+ void foo(vector pixel) { }
+ void foo(int) { }
+ void foo(unsigned int) { }
+ void foo(float) { }
+ void foo(bool) { }
diff --git a/gcc/testsuite/g++.dg/apple-altivec-1.C b/gcc/testsuite/g++.dg/apple-altivec-1.C
new file mode 100644
index 00000000000..c070de43f6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/apple-altivec-1.C
@@ -0,0 +1,9 @@
+/* APPLE LOCAL file AltiVec */
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-faltivec" } */
+
+void foo() {
+ vector bool int boolVector = (vector bool int) vec_splat_u32(3);
+ boolVector = vec_sld( boolVector, boolVector,
+ 1 ); /* { dg-bogus "no instance of overloaded" } */
+}
diff --git a/gcc/testsuite/g++.dg/charset/asm1.c b/gcc/testsuite/g++.dg/charset/asm1.c
deleted file mode 100644
index 9c0ff2866b0..00000000000
--- a/gcc/testsuite/g++.dg/charset/asm1.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* { dg-do compile { target *-*-* } }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler ".ascii bar" } }
- { dg-final { scan-assembler ".ascii foo" } }
- */
-extern int x, y;
-
-asm (".ascii bar");
-
-int foo (void)
-{
- __asm__ (".ascii foo");
- return 0;
-}
diff --git a/gcc/testsuite/g++.dg/charset/asm2.c b/gcc/testsuite/g++.dg/charset/asm2.c
deleted file mode 100644
index 8d8dbbb524d..00000000000
--- a/gcc/testsuite/g++.dg/charset/asm2.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Test for complex asm statements. Make sure it compiles
- then test for some of the asm statements not being translated. */
-/* { dg-do compile { target i?86-*-* } }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler "std" } }
- { dg-final { scan-assembler "cld" } }
- { dg-final { scan-assembler "rep" } }
- { dg-final { scan-assembler "movsb" } } */
-#define size_t int
-void *
-memmove (void *__dest, __const void *__src, size_t __n)
-{
- register unsigned long int __d0, __d1, __d2;
- if (__dest < __src)
- __asm__ __volatile__
- ("cld\n\t"
- "rep\n\t"
- "movsb"
- : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
- : "0" (__n), "1" (__src), "2" (__dest)
- : "memory");
- else
- __asm__ __volatile__
- ("std\n\t"
- "rep\n\t"
- "movsb\n\t"
- "cld"
- : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
- : "0" (__n), "1" (__n - 1 + (const char *) __src),
- "2" (__n - 1 + (char *) __dest)
- : "memory");
- return __dest;
-}
diff --git a/gcc/testsuite/g++.dg/charset/asm3.c b/gcc/testsuite/g++.dg/charset/asm3.c
deleted file mode 100644
index cd850c3e81f..00000000000
--- a/gcc/testsuite/g++.dg/charset/asm3.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Simple asm test. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler "foo" } } */
-extern int bar;
-
-int main (void)
-{
- asm ("foo %0" : "=r" (bar));
-}
diff --git a/gcc/testsuite/g++.dg/charset/asm4.c b/gcc/testsuite/g++.dg/charset/asm4.c
deleted file mode 100644
index fa93f40fdaf..00000000000
--- a/gcc/testsuite/g++.dg/charset/asm4.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Test for string translation. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler-not "translate" } } */
-void foo (void)
-{
- asm ("xx" : : "r"("translate") : "cc");
-}
diff --git a/gcc/testsuite/g++.dg/charset/attribute1.c b/gcc/testsuite/g++.dg/charset/attribute1.c
deleted file mode 100644
index 993c7934c80..00000000000
--- a/gcc/testsuite/g++.dg/charset/attribute1.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Test for attribute non-translation. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler "foo" } } */
-int walrus __attribute__ ((section (".foo")));
-
-int main (void)
-{
- return 0;
-}
diff --git a/gcc/testsuite/g++.dg/charset/attribute2.c b/gcc/testsuite/g++.dg/charset/attribute2.c
deleted file mode 100644
index 3cb766aa63a..00000000000
--- a/gcc/testsuite/g++.dg/charset/attribute2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Test to make sure that invalid attributes aren't translated.
- If error recovery is ever testable then "foobar" should be
- translated. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
-*/
-int foo __attribute__ ((walrus)); /* { dg-error "walrus" "ignored" } */
-char x[] = "foobar";
diff --git a/gcc/testsuite/g++.dg/charset/extern1.cc b/gcc/testsuite/g++.dg/charset/extern1.cc
deleted file mode 100644
index 2a68ab7cf78..00000000000
--- a/gcc/testsuite/g++.dg/charset/extern1.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Test extern statments not being translated. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
-*/
-
-extern "C" {
-
-
-int testbug (void) {
-
- return 0;
-
-}
-
-} //extern block
diff --git a/gcc/testsuite/g++.dg/charset/extern2.cc b/gcc/testsuite/g++.dg/charset/extern2.cc
deleted file mode 100644
index 82157a6fea4..00000000000
--- a/gcc/testsuite/g++.dg/charset/extern2.cc
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Check that we push the declaration and then continue translation. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler-not "foobar" } } */
-extern "C" { char *foo = "foobar"; }
diff --git a/gcc/testsuite/g++.dg/charset/string.c b/gcc/testsuite/g++.dg/charset/string.c
deleted file mode 100644
index 375e28a2ed6..00000000000
--- a/gcc/testsuite/g++.dg/charset/string.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Simple character translation test. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler-not "string foobar" } } */
-char *foo = "string foobar";
diff --git a/gcc/testsuite/g++.dg/const-cfstring-1.C b/gcc/testsuite/g++.dg/const-cfstring-1.C
new file mode 100644
index 00000000000..23bfb0e4ee7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/const-cfstring-1.C
@@ -0,0 +1,26 @@
+/* APPLE LOCAL file constant cfstrings */
+/* Test whether the __builtin__CFStringMakeConstantString
+ "function" fails gracefully when handed a non-constant
+ argument. This will only work on MacOS X 10.1.2 and later. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-fconstant-cfstrings" } */
+
+#import <CoreFoundation/CFString.h>
+
+#ifdef __CONSTANT_CFSTRINGS__
+#undef CFSTR
+#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
+#endif
+
+extern int cond;
+extern const char *func(void);
+
+int main(void) {
+ CFStringRef s1 = CFSTR("Str1");
+ CFStringRef s2 = CFSTR(cond? "Str2": "Str3"); /* { dg-error "CFString literal expression is not constant" } */
+ CFStringRef s3 = CFSTR(func()); /* { dg-error "CFString literal expression is not constant" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/debug/debug8.C b/gcc/testsuite/g++.dg/debug/debug8.C
index 1f8a18ac8ac..4a4b55a190d 100644
--- a/gcc/testsuite/g++.dg/debug/debug8.C
+++ b/gcc/testsuite/g++.dg/debug/debug8.C
@@ -1,2 +1,27 @@
-struct t{};
-struct g : public t{};
+// Check -gstabs
+// Contributed by Devang Patel dpatel@apple.com
+// { dg-do compile }
+class LcBase
+{
+public:
+ virtual ~LcBase();
+protected:
+ LcBase();
+};
+
+class LcDerive : public LcBase
+{
+public:
+ LcDerive();
+ ~LcDerive();
+};
+
+LcDerive::LcDerive()
+: LcBase()
+{
+}
+
+LcDerive::~LcDerive()
+{
+}
+
diff --git a/gcc/testsuite/g++.dg/eh/spec7.C b/gcc/testsuite/g++.dg/eh/spec7.C
deleted file mode 100644
index 08586a2af75..00000000000
--- a/gcc/testsuite/g++.dg/eh/spec7.C
+++ /dev/null
@@ -1,35 +0,0 @@
-// PR 14535
-// { dg-do run }
-// { dg-options "-O -finline" }
-//
-// Original test case failure required that Raiser constructor be inlined.
-
-extern "C" void abort();
-bool destructor_called = false;
-
-struct B {
- virtual void Run(){};
-};
-
-struct D : public B {
- virtual void Run()
- {
- struct O {
- ~O() { destructor_called = true; };
- } o;
-
- struct Raiser {
- Raiser() throw( int ) {throw 1;};
- } raiser;
- };
-};
-
-int main() {
- try {
- D d;
- static_cast<B&>(d).Run();
- } catch (...) {}
-
- if (!destructor_called)
- abort ();
-}
diff --git a/gcc/testsuite/g++.dg/expr/align68k-1.C b/gcc/testsuite/g++.dg/expr/align68k-1.C
new file mode 100644
index 00000000000..80ce93039f2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/align68k-1.C
@@ -0,0 +1,46 @@
+// APPLE LOCAL file test of -mdynamic-no-pic combined with 68k alignment
+// Radar 3242139: Positive C++ test case
+// Origin: Matt Austern <austern@apple.com>
+// { dg-do run }
+// { dg-options "-mdynamic-no-pic" }
+
+const long val1 = 0xa0b0;
+const long val2 = 0x1234;
+
+#pragma options align=mac68k
+struct X {
+ long x1;
+ long x2;
+};
+
+#pragma options align=reset
+
+void setX(X* x) {
+ x->x1 = val1;
+ x->x2 = val2;
+}
+
+struct Y
+{
+ X field;
+ void set_vals();
+};
+
+void Y::set_vals()
+{
+ ::setX(&field);
+}
+
+int main()
+{
+ Y y;
+ bool ok = true;
+
+ y.field.x1 = y.field.x2 = 0;
+ ok = ok && y.field.x1 == 0 && y.field.x2 == 0;
+
+ y.set_vals();
+ ok = ok && y.field.x1 == val1 && y.field.x2 == val2;
+
+ return !ok;
+}
diff --git a/gcc/testsuite/g++.dg/expr/align68k-2.C b/gcc/testsuite/g++.dg/expr/align68k-2.C
new file mode 100644
index 00000000000..4070bcdc0ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/align68k-2.C
@@ -0,0 +1,38 @@
+// APPLE LOCAL file test 68k alignment
+// Radar 3313261: Positive C++ test case
+// Origin: Matt Austern <austern@apple.com>
+// { dg-do run }
+
+#pragma options align=mac68k
+
+typedef struct PMR {
+ double x;
+ double y;
+}PMR;
+
+#pragma options align=reset
+
+static void GetDouble(double *doubleP)
+{
+ *doubleP = 1.;
+}
+
+static void GetPMR(PMR *p)
+{
+ GetDouble(&p->x);
+ GetDouble(&p->y);
+}
+
+int main(void)
+{
+ PMR tmp;
+ bool ok = true;
+
+ tmp.x = tmp.y = 0;
+ ok = ok && tmp.x == 0.0 && tmp.y == 0.0;
+
+ GetPMR(&tmp);
+ ok = ok && tmp.x == 1.0 && tmp.y == 1.0;
+
+ return !ok;
+}
diff --git a/gcc/testsuite/g++.dg/expr/cast-ptr-1.C b/gcc/testsuite/g++.dg/expr/cast-ptr-1.C
new file mode 100644
index 00000000000..cb42d13ac48
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/cast-ptr-1.C
@@ -0,0 +1,15 @@
+/* APPLE LOCAL file pointer casts */
+/* Test that casts of pointer to unsigned long long aren't sign extended */
+/* Author: Matt Austern <austern@apple.com> */
+/* { dg-do run } */
+/* { dg-options "-Wno-error -w" } */
+
+int main () {
+ /* Note: test assumes sizeof(long long) >= sizeof(void*) */
+
+ unsigned long x1 = 0x80000000ul;
+ void* p = (void*) x1;
+ unsigned long long x2 = (unsigned long long) p;
+
+ return !(x1 == x2);
+}
diff --git a/gcc/testsuite/g++.dg/expr/fieldref1.C b/gcc/testsuite/g++.dg/expr/fieldref1.C
new file mode 100644
index 00000000000..b04ed137548
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/fieldref1.C
@@ -0,0 +1,23 @@
+// APPLE LOCAL file - test of access to 8-byte struct field
+// Radar 3309305: positive C++ test case
+// Origin: Matt Austern <austern@apple.com>
+// { dg-do run }
+
+struct X {
+ char array[8];
+};
+
+char* get_array(X* p) {
+ char* p2 = p->array;
+ return p2;
+}
+
+int main()
+{
+ X t;
+ X* p = &t;
+ char* p2 = get_array(p);
+
+ bool ok = (void*)p == (void*)p2;
+ return !ok;
+}
diff --git a/gcc/testsuite/g++.dg/ext/anon-struct4.C b/gcc/testsuite/g++.dg/ext/anon-struct4.C
deleted file mode 100644
index f0b3b57f70d..00000000000
--- a/gcc/testsuite/g++.dg/ext/anon-struct4.C
+++ /dev/null
@@ -1,3 +0,0 @@
-// PR c++/14401
-
-struct { struct { int& i ; } bar ; } foo ; // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/ext/attrib14.C b/gcc/testsuite/g++.dg/ext/attrib14.C
deleted file mode 100644
index 3a819e01d82..00000000000
--- a/gcc/testsuite/g++.dg/ext/attrib14.C
+++ /dev/null
@@ -1,13 +0,0 @@
-// PR c++/13170
-// The bogus attribute is ignored, but was in TYPE_ATTRIBUTES during
-// parsing of the class, causing some variants to have it and some not.
-
-struct __attribute__((bogus)) A
-{
- virtual ~A();
- void foo(const A&);
- void bar(const A&);
-}; // { dg-warning "ignored" "" }
-
-void A::foo(const A&) {}
-void A::bar(const A& a) { foo(a); }
diff --git a/gcc/testsuite/g++.dg/init/ctor3.C b/gcc/testsuite/g++.dg/init/ctor3.C
deleted file mode 100644
index 1678aaf2c4d..00000000000
--- a/gcc/testsuite/g++.dg/init/ctor3.C
+++ /dev/null
@@ -1,6 +0,0 @@
-// PR c++/14401
-
-struct S {
- S() {} // { dg-error "" }
- const int i;
-};
diff --git a/gcc/testsuite/g++.dg/init/ref11.C b/gcc/testsuite/g++.dg/init/ref11.C
deleted file mode 100644
index b283e3a69be..00000000000
--- a/gcc/testsuite/g++.dg/init/ref11.C
+++ /dev/null
@@ -1,13 +0,0 @@
-// PR c++/14230
-
-struct A {
- A ();
- A (const A&);
- A& operator= (const A&);
-};
-
-struct D {
- A a;
-};
-
-const A& z = D().a;
diff --git a/gcc/testsuite/g++.dg/init/union1.C b/gcc/testsuite/g++.dg/init/union1.C
deleted file mode 100644
index 0049f442916..00000000000
--- a/gcc/testsuite/g++.dg/init/union1.C
+++ /dev/null
@@ -1,5 +0,0 @@
-// PR c++/14401
-
-union U {
- int& i; // { dg-error "" }
-};
diff --git a/gcc/testsuite/g++.dg/kext1.C b/gcc/testsuite/g++.dg/kext1.C
new file mode 100644
index 00000000000..174ec027259
--- /dev/null
+++ b/gcc/testsuite/g++.dg/kext1.C
@@ -0,0 +1,11 @@
+/* APPLE LOCAL file -findirect-virtual-calls 15 Oct 2002 */
+/* Radar 3008388: Positive C++ test case. */
+/* Origin: Matt Austern <austern@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-fapple-kext" } */
+
+struct B1 { }; /* ok */
+struct B2 { }; /* ok */
+struct D1 : B1 { }; /* ok */
+struct D2 : B1, B2 { }; /* ok */
+struct D3 : virtual B1 { }; /* ok */
diff --git a/gcc/testsuite/g++.dg/kext2.C b/gcc/testsuite/g++.dg/kext2.C
new file mode 100644
index 00000000000..f2f2a9514bd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/kext2.C
@@ -0,0 +1,13 @@
+/* APPLE LOCAL file -findirect-virtual-calls 15 Oct 2002 */
+/* Radar 3008388: Positive C++ test case. */
+/* Origin: Matt Austern <austern@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-fapple-kext" } */
+
+struct B1 { virtual ~B1(); virtual void f(); }; /* ok */
+struct D1 : B1 { }; /* ok */
+struct X1 : D1 { virtual void f(); }; /* ok */
+
+void X1::f() { D1::f(); } /* ok */
+
+
diff --git a/gcc/testsuite/g++.dg/kext3.C b/gcc/testsuite/g++.dg/kext3.C
new file mode 100644
index 00000000000..7d9efbd8cf1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/kext3.C
@@ -0,0 +1,18 @@
+/* APPLE LOCAL file -findirect-virtual-calls 15 Oct 2002 */
+/* Radar 3008388: Negative C++ test case. */
+/* Origin: Matt Austern <austern@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-fapple-kext" } */
+
+struct B1 { virtual ~B1(); virtual void f(); }; /* ok */
+struct D1 : B1 { }; /* ok */
+struct D2 { }; /* ok */
+
+struct X1 : D1, D2 { }; /* ok */
+struct X2 : virtual D1 { }; /* ok */
+
+struct Y1 : X1 { virtual void f(); }; /* ok */
+struct Y2 : X2 { virtual void f(); }; /* ok */
+
+void Y1::f() { X1::f(); } /* { dg-error "indirect virtual" } */
+void Y2::f() { X2::f(); } /* { dg-error "indirect virtual" } */
diff --git a/gcc/testsuite/g++.dg/lookup/enum1.C b/gcc/testsuite/g++.dg/lookup/enum1.C
deleted file mode 100644
index 9422814e271..00000000000
--- a/gcc/testsuite/g++.dg/lookup/enum1.C
+++ /dev/null
@@ -1,5 +0,0 @@
-// PR c++/14476
-
-struct tree_common {
- enum tree_code code : 8; // { dg-error "" }
-};
diff --git a/gcc/testsuite/g++.dg/lookup/struct2.C b/gcc/testsuite/g++.dg/lookup/struct2.C
deleted file mode 100644
index a66f403c291..00000000000
--- a/gcc/testsuite/g++.dg/lookup/struct2.C
+++ /dev/null
@@ -1,7 +0,0 @@
-// PR c++/14510
-
-struct c {};
-namespace A {
- int c(struct c*req);
-}
-int A::c(struct c*req) {}
diff --git a/gcc/testsuite/g++.dg/opt/eh1.C b/gcc/testsuite/g++.dg/opt/eh1.C
deleted file mode 100644
index 63a4d2ef35f..00000000000
--- a/gcc/testsuite/g++.dg/opt/eh1.C
+++ /dev/null
@@ -1,21 +0,0 @@
-// PR middle-end/14477
-// { dg-do compile }
-// { dg-options "-O2 -fno-default-inline" }
-
-struct A
-{
- A();
-};
-
-struct B
-{
- B(const A*);
-};
-
-struct C
-{
- B b;
- C(int) : b(new A) {}
-};
-
-C c(0);
diff --git a/gcc/testsuite/g++.dg/overload/ref1.C b/gcc/testsuite/g++.dg/overload/ref1.C
deleted file mode 100644
index e239d88a438..00000000000
--- a/gcc/testsuite/g++.dg/overload/ref1.C
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation, Inc.
-// Contributed by Nathan Sidwell 5 Mar 2004 <nathan@codesourcery.com>
-
-// Origin: schmid@snake.iap.physik.tu-darmstadt.de
-// Bug 14397: Bogus access error.
-
-struct S {
- S (int);
- S(S const&);
- private:
- S(S&);
-};
-
-S foo()
-{
- int result = 0;
-
- S s ((0,S (result)));
-
- return S (result);
-}
diff --git a/gcc/testsuite/g++.dg/parse/builtin2.C b/gcc/testsuite/g++.dg/parse/builtin2.C
deleted file mode 100644
index c524ea68416..00000000000
--- a/gcc/testsuite/g++.dg/parse/builtin2.C
+++ /dev/null
@@ -1,5 +0,0 @@
-// PR c++/14432
-// { dg-options "" }
-
-struct Y {};
-Y y1;
diff --git a/gcc/testsuite/g++.dg/parse/crash14.C b/gcc/testsuite/g++.dg/parse/crash14.C
deleted file mode 100644
index b4cf49a9921..00000000000
--- a/gcc/testsuite/g++.dg/parse/crash14.C
+++ /dev/null
@@ -1,20 +0,0 @@
-// { dg-do compile }
-// Contributed by: Giovanni Bajo <giovannibajo at libero dot it>
-// PR c++/14448: Fold constant initializers in templates
-
-template <int> struct A
-{
- A();
-};
-
-
-template<typename T> void foo(T)
-{
- static const int n=1+1;
- A<n+1> a;
-}
-
-void bar()
-{
- foo(0);
-}
diff --git a/gcc/testsuite/g++.dg/parse/non-dependent3.C b/gcc/testsuite/g++.dg/parse/non-dependent3.C
deleted file mode 100644
index 9dfb99636a8..00000000000
--- a/gcc/testsuite/g++.dg/parse/non-dependent3.C
+++ /dev/null
@@ -1,17 +0,0 @@
-// PR c++/14586
-
-enum E { e };
-
-E & operator |= (E &f1, const E &f2);
-
-E operator | (const E &f1, const E &f2) {
- E result = f1;
- result |= f2;
- return result;
-}
-
-template <typename> void foo () {
- const E flags = e | e;
-}
-
-template void foo<double> ();
diff --git a/gcc/testsuite/g++.dg/parse/template14.C b/gcc/testsuite/g++.dg/parse/template14.C
deleted file mode 100644
index ada87524352..00000000000
--- a/gcc/testsuite/g++.dg/parse/template14.C
+++ /dev/null
@@ -1,17 +0,0 @@
-// PR c++/14550
-
-struct A {
- A();
-};
-
-template <int> void foo()
-{
- A *p = new A;
-}
-
-void bar()
-{
- foo<0>();
-}
-
-
diff --git a/gcc/testsuite/g++.dg/pascal-strings-1.C b/gcc/testsuite/g++.dg/pascal-strings-1.C
new file mode 100644
index 00000000000..50c52015ec4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pascal-strings-1.C
@@ -0,0 +1,44 @@
+/* APPLE LOCAL file pascal strings */
+/* Positive C++ test cases. */
+/* Origin: Ziemowit Laski <zlaski@apple.com> */
+/* { dg-do run } */
+/* { dg-options "-fpascal-strings" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void abort (void);
+extern "C" size_t strlen (const char *s);
+
+const unsigned char *pascalStr1 = "\pHello, World!";
+const unsigned char *concat1 = "\pConcatenated" "string" "\pliteral";
+
+const unsigned char msg1[] = "\pHello"; /* ok */
+const unsigned char *msg2 = "\pHello"; /* ok */
+const signed char msg3[] = "\pHello"; /* ok */
+const char msg4[] = "\pHello"; /* ok */
+unsigned char msg5[] = "\pHello"; /* ok */
+signed char msg7[] = "\pHello"; /* ok */
+char msg8[] = "\pHello"; /* ok */
+
+int
+main (void)
+{
+ const unsigned char *pascalStr2 = "\pGood-bye!";
+
+ if (strlen ((const char *)pascalStr1) != 14)
+ abort ();
+ if (*pascalStr1 != 13)
+ abort (); /* the length byte does not include trailing null */
+
+ if (strlen ((const char *)pascalStr2) != 10)
+ abort ();
+ if (*pascalStr2 != 9)
+ abort ();
+
+ if (strlen ((const char *)concat1) != 26)
+ abort ();
+ if (*concat1 != 25)
+ abort ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/pascal-strings-2.C b/gcc/testsuite/g++.dg/pascal-strings-2.C
new file mode 100644
index 00000000000..e74c67f89c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pascal-strings-2.C
@@ -0,0 +1,43 @@
+/* APPLE LOCAL file pascal strings */
+/* Negative C++ test cases. */
+/* Origin: Ziemowit Laski <zlaski@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-fpascal-strings" } */
+
+const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-warning "unknown escape sequence" } */
+const wchar_t *pascalStr2 = L"Bye\p!"; /* { dg-warning "unknown escape sequence" } */
+
+const wchar_t *initErr0 = "\pHi"; /* { dg-error "cannot convert" } */
+const wchar_t initErr0a[] = "\pHi"; /* { dg-error "initialized from non-wide string" } */
+const wchar_t *initErr1 = "Bye"; /* { dg-error "cannot convert" } */
+const wchar_t initErr1a[] = "Bye"; /* { dg-error "initialized from non-wide string" } */
+
+const char *initErr2 = L"Hi"; /* { dg-error "cannot convert" } */
+const char initErr2a[] = L"Hi"; /* { dg-error "initialized from wide string" } */
+const signed char *initErr3 = L"Hi"; /* { dg-error "cannot convert" } */
+const signed char initErr3a[] = L"Hi"; /* { dg-error "initialized from wide string" } */
+const unsigned char *initErr4 = L"Hi"; /* { dg-error "cannot convert" } */
+const unsigned char initErr4a[] = L"Hi"; /* { dg-error "initialized from wide string" } */
+
+const char *pascalStr3 = "Hello\p, World!"; /* { dg-warning "unknown escape sequence" } */
+
+const char *concat2 = "Hi" "\pthere"; /* { dg-warning "unknown escape sequence" } */
+const char *concat3 = "Hi" "there\p"; /* { dg-warning "unknown escape sequence" } */
+
+const char *s2 = "\pGoodbye!"; /* { dg-error "invalid conversion" } */
+unsigned char *s3 = "\pHi!"; /* { dg-error "invalid conversion" } */
+char *s4 = "\pHi"; /* { dg-error "invalid conversion" } */
+signed char *s5 = "\pHi"; /* { dg-error "invalid conversion" } */
+const signed char *s6 = "\pHi"; /* { dg-error "invalid conversion" } */
+
+/* the maximum length of a Pascal literal is 255. */
+const unsigned char *almostTooLong =
+ "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345"; /* ok */
+const unsigned char *definitelyTooLong =
+ "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "1234567890123456"; /* { dg-error "too long" } */
diff --git a/gcc/testsuite/g++.dg/preserve-PPC-CR.C b/gcc/testsuite/g++.dg/preserve-PPC-CR.C
new file mode 100644
index 00000000000..55409ba0111
--- /dev/null
+++ b/gcc/testsuite/g++.dg/preserve-PPC-CR.C
@@ -0,0 +1,41 @@
+// APPLE LOCAL preserve CR2 for save_world prologues
+// This testcase failed at -O2 due to a missing EH note describing the PowerPC Condition Register.
+// Thanks to Dale Johannesen.
+
+// { dg-do run }
+// { dg-options "-fpascal-strings" }
+#include <stdlib.h>
+#include <stdio.h>
+int tick = 1;
+int caught_x = 1;
+int h() { return 2; }
+void f()
+{ throw(3); }
+extern int h();
+void ff() {
+ bool xx = h() == 0;
+ if ( !xx ) {
+ try {
+ f();
+ } catch (float f) {
+ if (!xx) printf("%f\n", f);
+ }
+ }
+}
+int g(int y)
+{
+ bool x = h() != 0;
+ if ( x) {
+ try {
+ ff();
+ } catch (int ex) {
+ // if (x) printf("%d\n", ex);
+ if (x) { tick++; caught_x = ex; }
+ }}
+}
+main()
+{
+ g(3);
+ if (tick != 2 || caught_x != 3)
+ abort();
+}
diff --git a/gcc/testsuite/g++.dg/template/spec12.C b/gcc/testsuite/g++.dg/template/spec12.C
deleted file mode 100644
index 7cf2e2f0aa2..00000000000
--- a/gcc/testsuite/g++.dg/template/spec12.C
+++ /dev/null
@@ -1,18 +0,0 @@
-// { dg-do compile }
-// Contributed by: Wolfgang Bangerth <bangerth at dealii dot org>
-// PR c++/14409: Accepts invalid function signature for explicit instantiation
-
-struct X
-{
- template <typename U>
- void foo (U) {}
-
- template <typename U>
- void foo_const (U) const {}
-};
-
-template void X::foo (int);
-template void X::foo_const (int) const;
-
-template void X::foo (int) const; // { dg-error "" }
-template void X::foo_const (int); // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-7.C b/gcc/testsuite/g++.dg/warn/Wunused-7.C
deleted file mode 100644
index 4281bc81569..00000000000
--- a/gcc/testsuite/g++.dg/warn/Wunused-7.C
+++ /dev/null
@@ -1,12 +0,0 @@
-// PR c++/14481
-// { dg-options "-Wunused" }
-
-void func()
-{
- struct mybitfields {
- unsigned int s_field:8;
- };
- struct mybitfields s;
- s.s_field = 255;
-};
-
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static3.C b/gcc/testsuite/g++.old-deja/g++.pt/static3.C
index 6688d23cda5..650b7c02cf1 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/static3.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/static3.C
@@ -1,4 +1,4 @@
-// { dg-do run { xfail *-*-aout *-*-coff *-*-hpux* *-*-hms } }
+// { dg-do run { xfail *-*-aout *-*-coff *-*-hpux* *-*-hms *-*-darwin* } }
// On targets that don't support weak symbols, we require an explicit
// instantiation of arr.
diff --git a/gcc/testsuite/gcc.apple/Wextra-tokens.c b/gcc/testsuite/gcc.apple/Wextra-tokens.c
new file mode 100644
index 00000000000..08b3cb7745c
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/Wextra-tokens.c
@@ -0,0 +1,21 @@
+/* APPLE LOCAL file -Wextra-tokens */
+/* Lifted from gcc.dg/cpp/extratokens2.c. */
+/* Copyright (C) 2002 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-fno-show-column -Wextra-tokens" } */
+
+/* Tests that -Wextra-tokens correctly enables the checks
+ that are disabled by default. */
+
+#if 1
+#if 0
+#else foo /* { dg-warning "extra tokens" "bad warning" } */
+#endif / /* { dg-warning "extra tokens" "bad warning" } */
+#endif
+
+# 36 "file.c" 3
+
+/* ... but in a system header, it's acceptable. */
+#ifdef KERNEL
+#endif KERNEL /* { dg-bogus "extra tokens" "bad warning" } */
diff --git a/gcc/testsuite/gcc.apple/Wfour-char-constants-1.c b/gcc/testsuite/gcc.apple/Wfour-char-constants-1.c
new file mode 100644
index 00000000000..536396454b7
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/Wfour-char-constants-1.c
@@ -0,0 +1,12 @@
+/* APPLE LOCAL file -Wfour-char-constants */
+/* We warn by default on Darwin, so no specific option needed. */
+
+/* { dg-do compile { target "*-*-darwin*" } } */
+/* { dg-options "" } */
+
+int glob1 = 'a';
+int glob2 = 'ab'; /* { dg-warning "multi-character character constant" } */
+int glob3 = 'abc'; /* { dg-warning "multi-character character constant" } */
+int glob4 = 'abcd'; /* say nothing */
+int glob5 = 'abcde'; /* { dg-warning "character constant too long" } */
+
diff --git a/gcc/testsuite/gcc.apple/Wfour-char-constants-2.c b/gcc/testsuite/gcc.apple/Wfour-char-constants-2.c
new file mode 100644
index 00000000000..14115ba6fea
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/Wfour-char-constants-2.c
@@ -0,0 +1,12 @@
+/* APPLE LOCAL file -Wfour-char-constants */
+/* Explicitly enable the warning. */
+
+/* { dg-do compile } */
+/* { dg-options "-Wfour-char-constants" } */
+
+int glob1 = 'a';
+int glob2 = 'ab'; /* { dg-warning "multi-character character constant" } */
+int glob3 = 'abc'; /* { dg-warning "multi-character character constant" } */
+int glob4 = 'abcd'; /* { dg-warning "multi-character character constant" } */
+int glob5 = 'abcde'; /* { dg-warning "character constant too long" } */
+
diff --git a/gcc/testsuite/gcc.apple/Wlong-double.c b/gcc/testsuite/gcc.apple/Wlong-double.c
new file mode 100644
index 00000000000..2a42912b660
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/Wlong-double.c
@@ -0,0 +1,11 @@
+/* APPLE LOCAL file -Wlong-double */
+
+/* We warn by default, so no specific option needed. */
+
+/* { dg-do compile { target "*-*-darwin*" } } */
+/* { dg-options "" } */
+
+long double ld; /* { dg-warning "use of `long double' type" } */
+/* { dg-warning "is reported only once" "" { target *-*-* } 8 } */
+/* { dg-warning "disable this warning" "" { target *-*-* } 8 } */
+
diff --git a/gcc/testsuite/gcc.apple/Wmost.c b/gcc/testsuite/gcc.apple/Wmost.c
new file mode 100644
index 00000000000..6e1d3342539
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/Wmost.c
@@ -0,0 +1,19 @@
+/* APPLE LOCAL file -Wmost */
+
+/* { dg-do compile } */
+/* { dg-options "-Wmost" } */
+
+int baz (void);
+
+int
+foo ()
+{
+ int loc;
+
+ bar (); /* { dg-warning "implicit declaration" } */
+
+ if (loc = baz ()) /* be quiet about this */
+ return 1;
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.apple/align-test-1.c b/gcc/testsuite/gcc.apple/align-test-1.c
new file mode 100644
index 00000000000..f9bdb7b2c21
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-1.c
@@ -0,0 +1,605 @@
+/* APPLE LOCAL file Macintosh alignment */
+
+/* { dg-do run } */
+/* { dg-options "-Wno-long-long" } */
+
+/*
+ * Macintosh compiler alignment test for C.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2002.
+ * Last modified 2002-4-29
+ */
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+#define Q(x) #x, x
+
+typedef unsigned char UINT8;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+/* === basic types === */
+
+typedef struct B1 {
+ char f1;
+ UINT8 f2;
+} B1;
+
+typedef struct B2 {
+ short f1;
+ UINT8 f2;
+} B2;
+
+typedef struct B3 {
+ long f1;
+ UINT8 f2;
+} B3;
+
+typedef struct B4 {
+ int f1;
+ UINT8 f2;
+} B4;
+
+typedef struct B5 {
+ float f1;
+ UINT8 f2;
+} B5;
+
+/* doubles, long longs, and vectors are treated separately below. */
+
+/* === enums === */
+
+typedef enum E1 {
+ e1_b = 0,
+ e1_e = 255
+} E1;
+
+typedef enum E2 {
+ e2_b = -256,
+ e2_e = 255
+} E2;
+
+typedef enum E3 {
+ e3_b = 0,
+ e3_e = 32767
+} E3;
+
+typedef enum E4 {
+ e4_b = 0,
+ e4_e = 65536
+} E4;
+
+/* === pointers === */
+
+typedef struct P1 {
+ char * f1;
+ UINT8 f2;
+} P1;
+
+typedef struct P2 {
+ long * f1;
+ UINT8 f2;
+} P2;
+
+typedef struct P3 {
+ double * f1;
+ UINT8 f2;
+} P3;
+
+typedef struct P4 {
+ long long * f1;
+ UINT8 f2;
+} P4;
+
+typedef struct P5 {
+ void (* f1) (void);
+ UINT8 f2;
+} P5;
+
+#ifdef __VEC__
+typedef struct P61 {
+ vector signed short * f1;
+ UINT8 f2;
+} P6;
+#endif
+
+/* === vectors === */
+
+#ifdef __VEC__
+typedef struct V1 {
+ vector signed short f1;
+ UINT8 f2;
+} V1;
+
+typedef struct V2 {
+ V1 f1;
+ UINT8 f2;
+} V2;
+
+typedef struct V3 {
+ UINT8 f1;
+ vector signed short f2;
+} V3;
+
+typedef struct V4 {
+ V3 f1;
+ UINT8 f2;
+} V4;
+#endif
+
+/* === doubles === */
+
+typedef struct D1 {
+ double f1;
+ UINT8 f2;
+} D1;
+
+typedef struct D2 {
+ D1 f1;
+ UINT8 f2;
+} D2;
+
+typedef struct D3 {
+ UINT8 f1;
+ double f2;
+} D3;
+
+typedef struct D4 {
+ D3 f1;
+ UINT8 f2;
+} D4;
+
+typedef struct D5 {
+ UINT8 f1;
+ D3 f2;
+} D5;
+
+typedef struct D6 {
+ double f1;
+ UINT8 f2;
+ double f3;
+} D6;
+
+typedef struct D7 {
+ UINT8 f1;
+ D1 f2;
+} D7;
+
+/* === long longs === */
+
+typedef struct LL1 {
+ long long f1;
+ UINT8 f2;
+} LL1;
+
+typedef struct LL2 {
+ LL1 f1;
+ UINT8 f2;
+} LL2;
+
+typedef struct LL3 {
+ UINT8 f1;
+ long long f2;
+} LL3;
+
+typedef struct LL4 {
+ LL3 f1;
+ UINT8 f2;
+} LL4;
+
+typedef struct LL5 {
+ UINT8 f1;
+ LL3 f2;
+} LL5;
+
+/* === arrays === */
+
+typedef struct A1 {
+ short f1[4];
+ UINT8 f2;
+} A1;
+
+typedef struct A2 {
+ A1 f1;
+ UINT8 f2;
+} A2;
+
+typedef struct A3 {
+ double f1[4];
+ UINT8 f2;
+} A3;
+
+typedef struct A4 {
+ A3 f1;
+ UINT8 f2;
+} A4;
+
+typedef struct A5 {
+ long long f1[4];
+ UINT8 f2;
+} A5;
+
+typedef struct A6 {
+ A5 f1;
+ UINT8 f2;
+} A6;
+
+#ifdef __VEC__
+typedef struct A7 {
+ vector signed short f1[4];
+ UINT8 f2;
+} A7;
+
+typedef struct A8 {
+ A7 f1;
+ UINT8 f2;
+} A8;
+#endif
+
+typedef struct A9 {
+ D1 f1[4];
+ UINT8 f2;
+} A9;
+
+typedef struct A10 {
+ A9 f1;
+ UINT8 f2;
+} A10;
+
+/* === unions === */
+
+typedef union U1 {
+ UINT8 f1;
+ double f2;
+} U1;
+
+typedef struct U2 {
+ U1 f1;
+ UINT8 f2;
+} U2;
+
+typedef union U3 {
+ UINT8 f1;
+ long long f2;
+} U3;
+
+typedef struct U4 {
+ U3 f1;
+ UINT8 f2;
+} U4;
+
+#ifdef __VEC__
+typedef union U5 {
+ UINT8 f1;
+ vector signed short f2;
+} U5;
+
+typedef struct U6 {
+ U5 f1;
+ UINT8 f2;
+} U6;
+#endif
+
+typedef union U7 {
+ UINT8 f1;
+ short f2[4];
+} U7;
+
+typedef struct U8 {
+ U7 f1;
+ UINT8 f2;
+} U8;
+
+/* === misc === */
+
+typedef struct { /* unnamed struct */
+ long long f1;
+ UINT8 f2;
+} M0;
+
+typedef struct M1 {
+ UINT8 f1[8];
+} M1;
+
+typedef struct M2 {
+ M1 f1;
+ UINT8 f2;
+} M2;
+
+typedef struct M3 {
+ UINT8 f1;
+ M1 f2;
+} M3;
+
+typedef struct M4 { /* M4 & M5: see corresponding mac68k tests (M68K11 & M68K12) */
+ UINT8 f1[9];
+} M4;
+
+typedef struct M5 {
+ UINT8 f1;
+ M4 f2;
+} M5;
+
+/* === mac68k === */
+
+#pragma options align=mac68k
+
+typedef struct M68K0 {
+ long f1;
+ UINT8 f2;
+} M68K0;
+
+typedef struct M68K1 {
+ double f1;
+ UINT8 f2;
+} M68K1;
+
+#pragma options align=reset
+
+typedef struct M68K2 {
+ M68K1 f1;
+ UINT8 f2;
+} M68K2;
+
+#ifdef __VEC__
+#pragma options align=mac68k
+
+typedef struct M68K3 {
+ vector signed short f1;
+ UINT8 f2;
+} M68K3;
+
+typedef struct M68K4 {
+ M68K3 f1;
+ UINT8 f2;
+} M68K4;
+
+#pragma options align=reset
+
+typedef struct M68K5 {
+ M68K3 f1;
+ UINT8 f2;
+} M68K5;
+
+#pragma options align=mac68k
+
+typedef struct M68K6 {
+ UINT8 f1;
+ vector signed short f2;
+} M68K6;
+
+#pragma options align=reset
+#endif
+
+#pragma options align=mac68k
+
+typedef struct M68K7 {
+ UINT8 f1;
+} M68K7;
+
+typedef union M68K8 {
+ UINT8 f1;
+} M68K8;
+
+typedef struct M68K9 {
+ UINT8 f1;
+ int f2;
+ UINT8 f3;
+} M68K9;
+
+#pragma options align=reset
+
+typedef struct M68K10 {
+ UINT8 f1;
+ M68K9 f2;
+} M68K10;
+
+#pragma options align=mac68k
+
+typedef struct M68K11 { /* M68K11 & M68K12: see corresponding power tests (M4 & M5) */
+ UINT8 f1[9];
+} M68K11;
+
+typedef struct M68K12 {
+ UINT8 f1;
+ M68K11 f2;
+} M68K12;
+
+typedef struct M68K13 {
+ UINT8 f1;
+ UINT8 f2[5];
+} M68K13;
+
+#pragma options align=reset
+
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-20s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+ /* === basic data types === */
+
+ check(Q(sizeof(char)), 1, "char data type");
+ check(Q(sizeof(signed char)), 1, "signed char data type");
+ check(Q(sizeof(unsigned char)), 1, "unsigned char data type");
+ check(Q(sizeof(short)), 2, "short data type");
+ check(Q(sizeof(signed short)), 2, "signed short data type");
+ check(Q(sizeof(unsigned short)), 2, "unsigned short data type");
+ check(Q(sizeof(long)), 4, "short long type");
+ check(Q(sizeof(signed long)), 4, "signed long data type");
+ check(Q(sizeof(unsigned long)), 4, "unsigned long data type");
+ check(Q(sizeof(int)), 4, "short int type");
+ check(Q(sizeof(signed int)), 4, "signed int data type");
+ check(Q(sizeof(unsigned int)), 4, "unsigned int data type");
+ check(Q(sizeof(float)), 4, "float type");
+ check(Q(sizeof(double)), 8, "double data type");
+ check(Q(sizeof(long long)), 8, "long long data type");
+ check(Q(sizeof(signed long long)), 8, "signed long long data type");
+ check(Q(sizeof(unsigned long long)), 8, "unsigned long long data type");
+
+ check(Q(sizeof(B1)), 2, "char as 1st field");
+ check(Q(sizeof(B2)), 4, "short as 1st field");
+ check(Q(sizeof(B3)), 8, "long as 1st field");
+ check(Q(sizeof(B4)), 8, "int as 1st field");
+ check(Q(sizeof(B5)), 8, "float as 1st field");
+
+ /* === enums === */
+
+ check(Q(sizeof(E1)), 4, "enum with range 0..255");
+ check(Q(sizeof(E2)), 4, "enum with range -256..255");
+ check(Q(sizeof(E3)), 4, "enum with range 0..32767");
+ check(Q(sizeof(E4)), 4, "enum with range 0..65536");
+
+ /* === pointers === */
+
+ check(Q(sizeof(P1)), 8, "char * as 1st field");
+ check(Q(sizeof(P2)), 8, "long * as 1st field");
+ check(Q(sizeof(P3)), 8, "double * as 1st field");
+ check(Q(sizeof(P4)), 8, "long long * as 1st field");
+ check(Q(sizeof(P5)), 8, "function * as 1st field");
+
+#ifdef __VEC__
+ check(Q(sizeof(P6)), 8, "vector signed short * as 1st field");
+#endif
+
+#ifdef __VEC__
+ /* === vectors === */
+
+ /* ??? Do we want to test all the possible vector data types? ??? */
+ check(Q(sizeof(vector signed short)), 16, "vector signed short data type");
+
+ check(Q(sizeof(V1)), 32, "vector as 1st field");
+ check(Q(sizeof(V2)), 48, "embedding struct with vector as 1st field");
+ check(Q(sizeof(V3)), 32, "vector as 2nd field");
+ check(Q(offsetof(V3, f2)), 16, "offset of vector as 2nd field");
+ check(Q(sizeof(V4)), 48, "embedding struct with vector as 2nd field");
+#endif
+
+ /* === doubles === */
+
+ check(Q(sizeof(D1)), 16, "double as 1st field");
+ check(Q(sizeof(D2)), 24, "embedding struct with double as 1st field");
+ check(Q(sizeof(D3)), 12, "double as 2nd field");
+ check(Q(offsetof(D3, f2)), 4, "offset of double as 2nd field");
+ check(Q(sizeof(D4)), 16, "embedding struct with double as 2nd field");
+ check(Q(sizeof(D5)), 16, "struct with double as 2nd field");
+ check(Q(offsetof(D5, f2)), 4, "offset of struct with double as 2nd field");
+ check(Q(sizeof(D6)), 24, "struct with double, char, double");
+ check(Q(offsetof(D6, f3)), 12, "offset of 2nd double in struct with double, char, double");
+ check(Q(sizeof(D7)), 20, "struct with double as 2nd field of another struct");
+ check(Q(offsetof(D7, f2)), 4, "offset of struct with double as 2nd field of another struct");
+
+ /* === long longs === */
+
+ check(Q(sizeof(LL1)), 16, "long long as 1st field");
+ check(Q(sizeof(LL2)), 24, "embedding struct with long long as 1st field");
+ check(Q(sizeof(LL3)), 12, "long long as 2nd field");
+ check(Q(offsetof(LL3, f2)), 4, "offset of long long as 2nd field");
+ check(Q(sizeof(LL4)), 16, "embedding struct with long long as 2nd field");
+ check(Q(sizeof(LL5)), 16, "struct with long long as 2nd field");
+ check(Q(offsetof(LL5, f2)), 4, "offset of struct with long long as 2nd field");
+
+ /* === arrays === */
+
+ check(Q(sizeof(A1)), 10, "array of shorts as 1st field");
+ check(Q(sizeof(A2)), 12, "embedding struct with array of shorts as 1st field");
+ check(Q(sizeof(A3)), 40, "array of doubles as 1st field");
+ check(Q(sizeof(A4)), 48, "embedding struct with array of doubles as 1st field");
+ check(Q(sizeof(A5)), 40, "array of long longs as 1st field");
+ check(Q(sizeof(A6)), 48, "embedding struct with array of long longs as 1st field");
+#ifdef __VEC__
+ check(Q(sizeof(A7)), 80, "array of vectors as 1st field");
+ check(Q(sizeof(A8)), 96, "embedding struct with array of vectors as 1st field");
+#endif
+ check(Q(sizeof(A9)), 72, "array of structs as 1st field");
+ check(Q(sizeof(A10)), 80, "embedding struct with array of structs as 1st field");
+
+ /* === unions === */
+
+ check(Q(sizeof(U1)), 8, "union with double");
+ check(Q(sizeof(U2)), 16, "embedding union with double");
+ check(Q(sizeof(U3)), 8, "union with long long");
+ check(Q(sizeof(U4)), 16, "embedding union with long long");
+#if __VEC__
+ check(Q(sizeof(U5)), 16, "union with vector");
+ check(Q(sizeof(U6)), 32, "embedding union with vector");
+#endif
+ check(Q(sizeof(U7)), 8, "union with array of shorts");
+ check(Q(sizeof(U8)), 10, "embedding union with array of shorts");
+
+ /* === misc === */
+
+ check(Q(sizeof(M0)), 16, "untagged struct with long long as 1st field");
+ check(Q(sizeof(M1)), 8, "array[8] of char");
+ check(Q(sizeof(M2)), 9, "embedding struct with array[8] of char as 1st field");
+ check(Q(sizeof(M3)), 9, "embedding struct with array[8] of char as 2nd field");
+ check(Q(offsetof(M3, f2)), 1, "offset of struct with array[8] of char as 2nd field");
+ check(Q(sizeof(M4)), 9, "odd size struct: array[9] of char");
+ check(Q(sizeof(M5)), 10, "embedding odd size struct");
+
+ /* === mac68k mode === */
+
+ check(Q(sizeof(M68K0)), 6, "mac68k struct with long");
+ check(Q(sizeof(M68K1)), 10, "mac68k struct with double as 1st field");
+ check(Q(sizeof(M68K2)), 12, "embedding mac68k struct with double as 1st field");
+#ifdef __VEC__
+ check(Q(sizeof(M68K3)), 32, "mac68k struct with vector as 1st field");
+ check(Q(sizeof(M68K4)), 48, "embedding mac68k struct with vector as 1st field in a mac68k struct");
+ check(Q(sizeof(M68K5)), 48, "embedding mac68k struct with vector as 1st field in a power struct");
+ check(Q(offsetof(M68K6, f2)), 16, "offset of vector as 2nd field in a mac68k struct");
+#endif
+ check(Q(sizeof(M68K7)), 2, "padding of mac68k struct with one char");
+ check(Q(sizeof(M68K8)), 2, "padding of mac68k union with one char");
+ check(Q(sizeof(M68K9)), 8, "padding of mac68k struct");
+ check(Q(offsetof(M68K9, f2)), 2, "offset of int as 2nd field in a mac68k struct");
+ check(Q(sizeof(M68K10)), 10, "power struct with embedded mac68k struct");
+ check(Q(offsetof(M68K10, f2)), 2, "offset of mac68k struct as 2nd field in a power struct");
+ check(Q(sizeof(M68K11)), 10, "odd size struct (before padding): array[9] of char");
+ check(Q(sizeof(M68K12)), 12, "embedding odd size struct (before padding)");
+ check(Q(sizeof(M68K13)), 6, "array of char at odd addr in mac68k struct");
+ check(Q(offsetof(M68K13, f2)), 1, "offset of array of char at odd addr in mac68k struct");
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/align-test-2.c b/gcc/testsuite/gcc.apple/align-test-2.c
new file mode 100644
index 00000000000..1e0ecc819c1
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-2.c
@@ -0,0 +1,152 @@
+/* APPLE LOCAL file Macintosh alignment */
+
+/* { dg-do run } */
+/* { dg-options "-Wno-long-long" } */
+
+/*
+ * Macintosh compiler alignment test for alignment extensions in GCC 3.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2002.
+ * Last modified 2002-1-22.
+ */
+
+ /* Check whether we are testing GCC 3 or later. */
+#ifdef __GNUC__
+#if __GNUC__ >= 3
+ #define GCC3 1
+#endif
+#endif
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+#define Q(x) #x, x
+
+typedef unsigned char UINT8;
+typedef unsigned long UINT32;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+/* === alignment modes === */
+
+typedef struct S1 {
+ UINT8 f1;
+} S1;
+
+#pragma options align=mac68k
+
+typedef struct S2 {
+ UINT8 f1;
+} S2;
+
+#pragma options align=native
+
+typedef struct S3 {
+ UINT8 f1;
+} S3;
+
+#pragma options align=reset
+/* Should be mac68k mode here. */
+
+#pragma options align=reset
+/* Should be power mode here. */
+
+typedef struct S4 {
+ UINT8 f1;
+ double f2;
+} S4;
+
+#pragma options align=natural
+
+typedef struct S5 {
+ UINT8 f1;
+ double f2;
+} S5;
+
+typedef struct S6 {
+ UINT8 f1;
+ double f2;
+ UINT8 f3;
+} S6;
+
+#pragma options align=reset
+/* Should be power mode here. */
+
+#pragma options align=packed
+
+typedef struct S7 {
+ UINT8 f1;
+ UINT32 f2;
+} S7;
+
+#pragma options align=reset
+/* Should be power mode here. */
+
+typedef struct S8 {
+ UINT8 f1;
+ UINT32 f2;
+} S8;
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-20s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+#ifndef GCC3
+ printf("This test requires GCC 3");
+ return 1;
+#endif
+
+ check(Q(sizeof(S1)), 1, "struct with 1 char; power mode");
+ check(Q(sizeof(S2)), 2, "struct with 1 char; mac68k mode");
+ check(Q(sizeof(S3)), 1, "struct with 1 char; native mode");
+ check(Q(sizeof(S4)), 12, "struct with char, double; power mode");
+ check(Q(offsetof(S4, f2)), 4, "offset of double in a struct with char, double; power mode");
+ check(Q(sizeof(S5)), 16, "struct with char, double; natural mode");
+ check(Q(offsetof(S5, f2)), 8, "offset of double in a struct with char, double; natural mode");
+ check(Q(sizeof(S6)), 24, "struct with char, double, char; natural mode");
+ check(Q(sizeof(S7)), 5, "struct with char, long; packed mode");
+ check(Q(sizeof(S8)), 8, "struct with char, long; power mode");
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/align-test-3.c b/gcc/testsuite/gcc.apple/align-test-3.c
new file mode 100644
index 00000000000..1351031bec3
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-3.c
@@ -0,0 +1,123 @@
+/* APPLE LOCAL file Macintosh alignment */
+
+/* { dg-do run } */
+/* { dg-options "-Wno-long-long" } */
+
+/*
+ * GCC alignment test for alignment problems due to interactions
+ * between FSF and Macintosh alignment modes.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2002.
+ * Last modified 2002-1-22.
+ */
+
+ /* Check whether we are testing GCC 3 or later. */
+#ifdef __GNUC__
+#if __GNUC__ >= 3
+#define GCC3 1
+#else
+#define GCC3 0
+#endif
+#endif
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+#define Q(x) #x, x
+
+typedef unsigned char UINT8;
+typedef unsigned long UINT32;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+/* === alignment modes === */
+
+#pragma options align=power
+#pragma options align=mac68k
+#pragma pack(1)
+
+typedef struct S0 {
+ UINT32 f1;
+ UINT8 f2;
+} S0;
+
+#pragma options align=reset
+
+/* We should be back in mac68k alignment, if #pragma option align=reset
+ can rest a #pragma pack(n). So check for mac68k alignment. */
+
+typedef struct S1 {
+ UINT32 f1;
+ UINT8 f2;
+} S1;
+
+#if GCC3
+#pragma options align=power
+#pragma options align=mac68k
+//#pragma pack(push, 1)
+//#pragma pack(pop)
+#pragma pack(1)
+#pragma pack()
+
+/* We should be back in mac68k alignment, if #pragma pack()
+ can reset a #pragma pack(n). So check for mac68k alignment. */
+
+typedef struct S2 {
+ UINT32 f1;
+ UINT8 f2;
+} S2;
+#endif /* GCC3 */
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-20s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+ check(Q(sizeof(S0)), 5, "struct with 1 long, 1 char; pack(1) mode");
+ check(Q(sizeof(S1)), 6, "struct with 1 long, 1 char; should be mac68k mode");
+#if GCC3
+ check(Q(sizeof(S2)), 6, "struct with 1 long, 1 char; should be mac68k mode");
+#endif
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/align-test-4.c b/gcc/testsuite/gcc.apple/align-test-4.c
new file mode 100644
index 00000000000..f07a10911f9
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-4.c
@@ -0,0 +1,224 @@
+/* APPLE LOCAL file Macintosh alignment */
+
+/* { dg-do run } */
+/* { dg-options "-Wno-long-long" } */
+
+/*
+ * GCC alignment test for bit-fields.
+ * This came up initially as an alignment problem in the kernel.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2002.
+ * Last modified 2002-2-18.
+ */
+
+ /* Check whether we are testing GCC 3 or later. */
+#ifdef __GNUC__
+#if __GNUC__ >= 3
+#define GCC3 1
+#else
+#define GCC3 0
+#endif
+#endif
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+/*
+ * The following defined determines whether we should compare against
+ * the values produced by GCC 2.95 or against the values I expect given
+ * my understanding of the alignment rules.
+ */
+#define USE_GCC2_VALUES 1
+
+#define NAME2(name,mode) mode##_##name
+#define NAME(name,mode) NAME2(name,mode)
+
+#define STR(s) #s
+#define SIZEOF3(name) STR(sizeof(name)), sizeof(name)
+#define SIZEOF2(name,mode) SIZEOF3(mode##_##name)
+#define SIZEOF(name,mode) SIZEOF2(name,mode)
+
+#define OFFSETOF3(name,field) STR(offsetof(name,field)), offsetof(name,field)
+#define OFFSETOF2(name,mode,field) OFFSETOF3(mode##_##name,field)
+#define OFFSETOF(name,mode,field) OFFSETOF2(name,mode,field)
+
+typedef unsigned char UINT8;
+typedef unsigned long UINT32;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+/* === mac68k alignment problem in kernel === */
+
+typedef unsigned PEF_UBits32, ByteCount;
+typedef short SInt16;
+
+/* === power === */
+#pragma options align=power
+#define MODE power
+#include "align-test-4.h"
+
+/* === mac68k === */
+#pragma options align=mac68k
+#undef MODE
+#define MODE mac68k
+#include "align-test-4.h"
+
+/* === pack(2) === */
+#pragma pack(2)
+#undef MODE
+#define MODE pack2
+#include "align-test-4.h"
+
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-30s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+#undef MODE
+#define MODE power
+
+#if USE_GCC2_VALUES
+ check(SIZEOF(LoaderExport, MODE), 12, "kernel struct");
+ check(OFFSETOF(LoaderExport, MODE, offset), 4, "offset of offset");
+ check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, "offset of sectionNumber");
+ check(SIZEOF(S1, MODE), 8, "bitfields & char");
+ check(SIZEOF(S2, MODE), 8, "int & char");
+ check(SIZEOF(S3, MODE), 12, "char, bitfields(32), char");
+ check(OFFSETOF(S3, MODE, f3), 8, "offset of 2nd char");
+ check(SIZEOF(S4, MODE), 8, "char, bitfields(32), char");
+ check(OFFSETOF(S4, MODE, f3), 7, "offset of 2nd char");
+ check(SIZEOF(S5, MODE), 4, "char, bitfields(16), char");
+ check(OFFSETOF(S5, MODE, f3), 3, "offset of 2nd char");
+ check(SIZEOF(S6, MODE), 4, "char, bitfields(8), char");
+ check(OFFSETOF(S6, MODE, f3), 2, "offset of 2nd char");
+#else
+ check(SIZEOF(LoaderExport, MODE), 12, "kernel struct");
+ check(OFFSETOF(LoaderExport, MODE, offset), 4, "offset of offset");
+ check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, "offset of sectionNumber");
+ check(SIZEOF(S1, MODE), 8, "bitfields & char");
+ check(SIZEOF(S2, MODE), 8, "int & char");
+ check(SIZEOF(S3, MODE), 12, "char, bitfields(32), char");
+ check(OFFSETOF(S3, MODE, f3), 8, "offset of 2nd char");
+ check(SIZEOF(S4, MODE), 12, "char, bitfields(32), char");
+ check(OFFSETOF(S4, MODE, f3), 8, "offset of 2nd char");
+ check(SIZEOF(S5, MODE), 12, "char, bitfields(16), char");
+ check(OFFSETOF(S5, MODE, f3), 8, "offset of 2nd char");
+ check(SIZEOF(S6, MODE), 12, "char, bitfields(8), char");
+ check(OFFSETOF(S6, MODE, f3), 8, "offset of 2nd char");
+#endif
+
+#undef MODE
+#define MODE mac68k
+
+#if USE_GCC2_VALUES
+ check(SIZEOF(LoaderExport, MODE), 10, "kernel struct");
+ check(OFFSETOF(LoaderExport, MODE, offset), 4, "offset of offset");
+ check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, "offset of sectionNumber");
+#if 1
+ // GCC 2 is wrong on the following.
+ check(SIZEOF(S1, MODE), 6, "bitfields & char");
+#else
+ check(SIZEOF(S1, MODE), 8, "bitfields & char");
+#endif
+ check(SIZEOF(S2, MODE), 6, "int & char");
+ check(SIZEOF(S3, MODE), 6, "char, bitfields(32), char");
+ check(OFFSETOF(S3, MODE, f3), 5, "offset of 2nd char");
+ check(SIZEOF(S4, MODE), 6, "char, bitfields(32), char");
+ check(OFFSETOF(S4, MODE, f3), 5, "offset of 2nd char");
+ check(SIZEOF(S5, MODE), 4, "char, bitfields(16), char");
+ check(OFFSETOF(S5, MODE, f3), 3, "offset of 2nd char");
+ check(SIZEOF(S6, MODE), 4, "char, bitfields(8), char");
+ check(OFFSETOF(S6, MODE, f3), 2, "offset of 2nd char");
+#else
+ check(SIZEOF(LoaderExport, MODE), 10, "kernel struct");
+ check(OFFSETOF(LoaderExport, MODE, offset), 4, "offset of offset");
+ check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, "offset of sectionNumber");
+ check(SIZEOF(S1, MODE), 6, "bitfields & char");
+ check(SIZEOF(S2, MODE), 6, "int & char");
+ check(SIZEOF(S3, MODE), 8, "char, bitfields(32), char");
+ check(OFFSETOF(S3, MODE, f3), 6, "offset of 2nd char");
+ check(SIZEOF(S4, MODE), 8, "char, bitfields(32), char");
+ check(OFFSETOF(S4, MODE, f3), 6, "offset of 2nd char");
+ check(SIZEOF(S5, MODE), 6, "char, bitfields(16), char");
+ check(OFFSETOF(S5, MODE, f3), 4, "offset of 2nd char");
+ check(SIZEOF(S6, MODE), 4, "char, bitfields(8), char");
+ check(OFFSETOF(S6, MODE, f3), 2, "offset of 2nd char");
+#endif
+
+#undef MODE
+#define MODE pack2
+
+#if USE_GCC2_VALUES
+ check(SIZEOF(LoaderExport, MODE), 10, "kernel struct");
+ check(OFFSETOF(LoaderExport, MODE, offset), 4, "offset of offset");
+ check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, "offset of sectionNumber");
+ /* GCC2 used to have this as '8', but it should really be 6. */
+ check(SIZEOF(S1, MODE), 6, "bitfields & char");
+ check(SIZEOF(S2, MODE), 6, "int & char");
+ check(SIZEOF(S3, MODE), 6, "char, bitfields(32), char");
+ check(OFFSETOF(S3, MODE, f3), 5, "offset of 2nd char");
+ check(SIZEOF(S4, MODE), 6, "char, bitfields(32), char");
+ check(OFFSETOF(S4, MODE, f3), 5, "offset of 2nd char");
+ check(SIZEOF(S5, MODE), 4, "char, bitfields(16), char");
+ check(OFFSETOF(S5, MODE, f3), 3, "offset of 2nd char");
+ check(SIZEOF(S6, MODE), 4, "char, bitfields(8), char");
+ check(OFFSETOF(S6, MODE, f3), 2, "offset of 2nd char");
+#else
+ check(SIZEOF(LoaderExport, MODE), 10, "kernel struct");
+ check(OFFSETOF(LoaderExport, MODE, offset), 4, "offset of offset");
+ check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, "offset of sectionNumber");
+ check(SIZEOF(S1, MODE), 6, "bitfields & char");
+ check(SIZEOF(S2, MODE), 6, "int & char");
+ check(SIZEOF(S3, MODE), 8, "char, bitfields(32), char");
+ check(OFFSETOF(S3, MODE, f3), 6, "offset of 2nd char");
+ check(SIZEOF(S4, MODE), 8, "char, bitfields(32), char");
+ check(OFFSETOF(S4, MODE, f3), 6, "offset of 2nd char");
+ check(SIZEOF(S5, MODE), 6, "char, bitfields(16), char");
+ check(OFFSETOF(S5, MODE, f3), 4, "offset of 2nd char");
+ check(SIZEOF(S6, MODE), 4, "char, bitfields(8), char");
+ check(OFFSETOF(S6, MODE, f3), 2, "offset of 2nd char");
+#endif
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/align-test-4.h b/gcc/testsuite/gcc.apple/align-test-4.h
new file mode 100644
index 00000000000..f7c18727fee
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-4.h
@@ -0,0 +1,43 @@
+/* APPLE LOCAL file Macintosh alignment */
+
+typedef struct {
+ PEF_UBits32 symClass : 8;
+ PEF_UBits32 nameOffset : 24;
+ ByteCount offset;
+ SInt16 sectionNumber;
+} NAME(LoaderExport, MODE);
+
+typedef struct {
+ unsigned f1 : 32;
+ char f2;
+} NAME(S1, MODE);
+
+typedef struct {
+ unsigned f1;
+ char f2;
+} NAME(S2, MODE);
+
+typedef struct {
+ char f1;
+ unsigned f2 : 32;
+ char f3;
+} NAME(S3, MODE);
+
+typedef struct {
+ char f1;
+ unsigned f2_1 : 8;
+ unsigned f2_2 : 24;
+ char f3;
+} NAME(S4, MODE);
+
+typedef struct {
+ char f1;
+ unsigned f2 : 16;
+ char f3;
+} NAME(S5, MODE);
+
+typedef struct {
+ char f1;
+ unsigned f2 : 8;
+ char f3;
+} NAME(S6, MODE);
diff --git a/gcc/testsuite/gcc.apple/align-test-5a.c b/gcc/testsuite/gcc.apple/align-test-5a.c
new file mode 100644
index 00000000000..6833535fcec
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-5a.c
@@ -0,0 +1,87 @@
+/* APPLE LOCAL file Macintosh alignment */
+/* align-test-5*.c are all the same code but with different options. */
+
+/* { dg-do run } */
+/* { dg-options "-malign-natural -DSIZE=16" } */
+
+/*
+ * GCC alignment test for command line options for setting alignment modes.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2002.
+ * Last modified 2002-2-18.
+ *
+ */
+
+ /* Check whether we are testing GCC 3 or later. */
+#ifdef __GNUC__
+#if __GNUC__ >= 3
+#define GCC3 1
+#else
+#define GCC3 0
+#endif
+#endif
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+#define Q(x) #x, x
+
+typedef unsigned char UINT8;
+typedef unsigned long UINT32;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+typedef struct S0 {
+ UINT8 f1;
+ double f2;
+} S0;
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-20s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+ check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double");
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/align-test-5b.c b/gcc/testsuite/gcc.apple/align-test-5b.c
new file mode 100644
index 00000000000..6845bd34766
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-5b.c
@@ -0,0 +1,87 @@
+/* APPLE LOCAL file Macintosh alignment */
+/* align-test-5*.c are all the same code but with different options. */
+
+/* { dg-do run } */
+/* { dg-options "-malign-power -DSIZE=12" } */
+
+/*
+ * GCC alignment test for command line options for setting alignment modes.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2002.
+ * Last modified 2002-2-18.
+ *
+ */
+
+ /* Check whether we are testing GCC 3 or later. */
+#ifdef __GNUC__
+#if __GNUC__ >= 3
+#define GCC3 1
+#else
+#define GCC3 0
+#endif
+#endif
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+#define Q(x) #x, x
+
+typedef unsigned char UINT8;
+typedef unsigned long UINT32;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+typedef struct S0 {
+ UINT8 f1;
+ double f2;
+} S0;
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-20s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+ check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double");
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/align-test-5c.c b/gcc/testsuite/gcc.apple/align-test-5c.c
new file mode 100644
index 00000000000..fd9bd5cca4c
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/align-test-5c.c
@@ -0,0 +1,87 @@
+/* APPLE LOCAL file Macintosh alignment */
+/* align-test-5*.c are all the same code but with different options. */
+
+/* { dg-do run } */
+/* { dg-options "-malign-mac68k -DSIZE=10" } */
+
+/*
+ * GCC alignment test for command line options for setting alignment modes.
+ * Fred Forsman
+ * Apple Computer, Inc.
+ * (C) 2000-2002.
+ * Last modified 2002-2-18.
+ *
+ */
+
+ /* Check whether we are testing GCC 3 or later. */
+#ifdef __GNUC__
+#if __GNUC__ >= 3
+#define GCC3 1
+#else
+#define GCC3 0
+#endif
+#endif
+
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h>
+
+#define Q(x) #x, x
+
+typedef unsigned char UINT8;
+typedef unsigned long UINT32;
+
+static int bad_option = 0;
+static int flag_verbose = 0;
+static int nbr_failures = 0;
+
+typedef struct S0 {
+ UINT8 f1;
+ double f2;
+} S0;
+
+static void check(char * rec_name, int actual, int expected, char * comment)
+{
+ if (flag_verbose || (actual != expected)) {
+ printf("%-20s = %2d (%2d) ", rec_name, actual, expected);
+ if (actual != expected) {
+ printf("*** FAIL");
+ nbr_failures++;
+ } else
+ printf(" PASS");
+ printf(": %s\n", comment);
+ }
+}
+
+static void check_option(char *option)
+{
+ if (*option == '-') {
+ if (strcmp(option, "-v") == 0)
+ flag_verbose = 1;
+ else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+ } else {
+ fprintf(stderr, "*** unrecognized option '%s'.\n", option);
+ bad_option = 1;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ check_option(argv[i]);
+
+ if (bad_option)
+ return 1;
+
+ check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double");
+
+ if (nbr_failures > 0)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/altivec-1.c b/gcc/testsuite/gcc.apple/altivec-1.c
new file mode 100644
index 00000000000..d2040d96bbc
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/altivec-1.c
@@ -0,0 +1,124 @@
+/* APPLE LOCAL file AltiVec */
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-options "-faltivec -Wno-long-double" } */
+
+/* Test for correct handling of AltiVec constants passed
+ through '...' (va_arg). */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define CHECK_INVARIANT(expr) \
+ if (!(expr)) { \
+ printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \
+ abort (); \
+ }
+
+struct foo { int x; int y; };
+struct vfoo { int x; __vector signed int v; int y; };
+union u { __vector signed int v; signed int i[4]; };
+
+struct foo x_g = { 3, 4};
+struct vfoo vx_g = { 10, (vector signed int)(11, 12, 13, 14), 15 };
+__vector signed int v_g = (vector signed int) (22, 23, 24, 25);
+struct vfoo vx2_g = { 30, (vector signed int)(31, 32, 33, 34), 35 };
+__vector signed int v2_g = (vector signed int)(40, 41, 42, 43);
+int i_1 = 99, i_2 = 33;
+double d_2 = 1.5, d_3 = 1.75;
+long double ld_1 = 1.25;
+
+void bar (int i, ... )
+{
+ struct foo xi;
+ double d;
+ long double ld;
+ float f;
+ char c;
+ short s;
+ va_list ap;
+ va_start(ap, i);
+ xi = va_arg(ap, struct foo);
+ s = (short)va_arg(ap, int);
+ f = (float)va_arg(ap, double);
+ ld = va_arg(ap, long double);
+ c = (char)va_arg(ap, int);
+ d = va_arg(ap, double);
+ va_end(ap);
+
+ CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y);
+ CHECK_INVARIANT (s == (short)i_2);
+ CHECK_INVARIANT (f == (float)d_2);
+ CHECK_INVARIANT (ld == ld_1);
+ CHECK_INVARIANT (c == (char)i_1);
+ CHECK_INVARIANT (d == d_3);
+}
+
+void baz (int i, ... )
+{
+ struct vfoo vx, vx2;
+ __vector signed int v_i, v2_i;
+ int j, k, l;
+ va_list ap;
+ va_start(ap, i);
+ v_i = va_arg(ap, __vector signed int);
+ j = va_arg(ap, int);
+ vx = va_arg(ap, struct vfoo);
+ k = va_arg(ap, int);
+ v2_i = va_arg(ap, __vector signed int);
+ l = va_arg(ap, int);
+ vx2 = va_arg(ap, struct vfoo);
+ va_end(ap);
+
+ CHECK_INVARIANT (vec_all_eq (v_i, v_g));
+ CHECK_INVARIANT (j == i_1);
+ CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
+ CHECK_INVARIANT (k == i_1);
+ CHECK_INVARIANT (vec_all_eq (v2_i, v2_g));
+ CHECK_INVARIANT (l == i_1);
+ CHECK_INVARIANT (vx2.x == vx2_g.x && vec_all_eq(vx2.v, vx2_g.v) && vx2.y == vx2_g.y);
+}
+
+void quux (int i, ... )
+{
+ __vector signed int v_i, v2_i;
+ union u vi, v2i;
+ va_list ap;
+ va_start(ap, i);
+ v_i = va_arg(ap, __vector signed int);
+ v2_i = va_arg(ap, __vector signed int);
+ va_end(ap);
+ vi.v = v_i;
+ v2i.v = v2_i;
+
+ CHECK_INVARIANT (vec_all_eq (v_i, v_g));
+ CHECK_INVARIANT (vec_all_eq (v2_i, v_g));
+ CHECK_INVARIANT (vec_all_eq (vi.v, v_g));
+ CHECK_INVARIANT (vec_all_eq (v2i.v, v_g));
+}
+
+void baz2 (int i, ... )
+{
+ struct vfoo vx;
+ union u vxi;
+ va_list ap;
+ va_start(ap, i);
+ vx = va_arg(ap, struct vfoo);
+ va_end(ap);
+ vxi.v = vx.v;
+
+ CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
+ CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v));
+}
+
+int main(void)
+{
+ CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48);
+
+ bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3);
+ baz(i_1, v_g, i_1, vx_g, i_1, v2_g, i_1, vx2_g);
+ quux(i_1, v_g, v_g);
+ baz2(i_1, vx_g);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/altivec-2.c b/gcc/testsuite/gcc.apple/altivec-2.c
new file mode 100644
index 00000000000..c070de43f6c
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/altivec-2.c
@@ -0,0 +1,9 @@
+/* APPLE LOCAL file AltiVec */
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-faltivec" } */
+
+void foo() {
+ vector bool int boolVector = (vector bool int) vec_splat_u32(3);
+ boolVector = vec_sld( boolVector, boolVector,
+ 1 ); /* { dg-bogus "no instance of overloaded" } */
+}
diff --git a/gcc/testsuite/gcc.apple/applecc.c b/gcc/testsuite/gcc.apple/applecc.c
new file mode 100644
index 00000000000..757ad573272
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/applecc.c
@@ -0,0 +1,14 @@
+/* APPLE LOCAL file Apple version */
+/* { dg-do compile } */
+
+#if __APPLE_CC__ < 1000
+#error build number too small
+#endif
+#if __APPLE_CC__ > 32768
+#error build number too big
+#endif
+#if ! ( __APPLE_CC__ > 1000)
+#error build number not really a number
+#endif
+
+int x = __APPLE_CC__;
diff --git a/gcc/testsuite/gcc.apple/const-cfstring-1.c b/gcc/testsuite/gcc.apple/const-cfstring-1.c
new file mode 100644
index 00000000000..3e8c1194d20
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/const-cfstring-1.c
@@ -0,0 +1,29 @@
+/* APPLE LOCAL file constant CFStrings */
+/* Test whether the __builtin__CFStringMakeConstantString
+ "function" fails gracefully when handed a non-constant
+ argument. This will only work on MacOS X 10.1.2 and later. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-fconstant-cfstrings" } */
+
+typedef const struct __CFString *CFStringRef;
+
+#ifdef __CONSTANT_CFSTRINGS__
+#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
+#else
+#error __CONSTANT_CFSTRINGS__ not defined
+#endif
+
+extern int cond;
+extern const char *func(void);
+
+const CFStringRef s0 = CFSTR("Hello" "there");
+
+int main(void) {
+ CFStringRef s1 = CFSTR("Str1");
+ CFStringRef s2 = CFSTR(cond? "Str2": "Str3"); /* { dg-error "literal expression is not constant" } */
+ CFStringRef s3 = CFSTR(func()); /* { dg-error "literal expression is not constant" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/const-cfstring-2.c b/gcc/testsuite/gcc.apple/const-cfstring-2.c
new file mode 100644
index 00000000000..cbf09d3a977
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/const-cfstring-2.c
@@ -0,0 +1,13 @@
+/* APPLE LOCAL file constant CFStrings */
+/* Test whether the __builtin__CFStringMakeConstantString
+ "function" fails gracefully when used without the
+ -fconstant-cfstrings flag. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-options "-fno-constant-cfstrings" } */
+/* { dg-do compile { target *-*-darwin* } } */
+
+typedef const struct __CFString *CFStringRef;
+
+const CFStringRef S = ((CFStringRef)__builtin___CFStringMakeConstantString("Testing"));
+/* { dg-error "built-in" "built-in function .* requires .* flag" { target *-*-* } 12 } */
diff --git a/gcc/testsuite/gcc.apple/const-cfstring-3.c b/gcc/testsuite/gcc.apple/const-cfstring-3.c
new file mode 100644
index 00000000000..aba558b1f8b
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/const-cfstring-3.c
@@ -0,0 +1,29 @@
+/* APPLE LOCAL file constant CFStrings */
+/* Test whether the __builtin__CFStringMakeConstantString
+ "function" generates compile-time objects with the correct layout. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-fconstant-cfstrings" } */
+
+typedef const struct __CFString *CFStringRef;
+
+#ifdef __CONSTANT_CFSTRINGS__
+#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
+#else
+#error __CONSTANT_CFSTRINGS__ not defined
+#endif
+
+extern int cond;
+extern const char *func(void);
+
+CFStringRef s0 = CFSTR("Hello" "there");
+
+void foo(void) {
+ const CFStringRef s1 = CFSTR("Str1");
+
+ s0 = s1;
+}
+
+/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+4\n" } } */
+/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+10\n" } } */
diff --git a/gcc/testsuite/gcc.dg/charset/charset.exp b/gcc/testsuite/gcc.apple/dg.exp
index ad75cb55af8..42fcefba10e 100644
--- a/gcc/testsuite/gcc.dg/charset/charset.exp
+++ b/gcc/testsuite/gcc.apple/dg.exp
@@ -1,44 +1,40 @@
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# APPLE LOCAL file testsuite
+# Copyright (C) 1997 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# GCC testsuite that uses the 'dg.exp' driver.
-
-# There's a bunch of headers we need.
-if [is_remote host] {
- foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] {
- remote_download host $header
- }
-}
+# Apple-specific GCC testsuite driver.
+# Note that this is basically a clone of gcc.dg/dg.exp, updated
+# whenever the original file changes (which is not very often).
# Load support procs.
load_lib gcc-dg.exp
-load_lib target-supports.exp
# If a testcase doesn't have special options, use these.
-global DEFAULT_CHARSETCFLAGS
-if ![info exists DEFAULT_CHARSETCFLAGS] then {
- set DEFAULT_CHARSETCFLAGS "-fexec-charset=IBM-1047"
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors -Wno-long-double"
}
# Initialize `dg'.
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \
- "" $DEFAULT_CHARSETCFLAGS
+# APPLE LOCAL preprocess .s files
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cSs\]]] \
+ "" $DEFAULT_CFLAGS
# All done.
dg-finish
diff --git a/gcc/testsuite/gcc.apple/execute/bitfield-1.c b/gcc/testsuite/gcc.apple/execute/bitfield-1.c
new file mode 100644
index 00000000000..f013853f48e
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/execute/bitfield-1.c
@@ -0,0 +1,52 @@
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-options "-O2 -fss-const-prop" } */
+/* APPLE LOCAL */
+/* <rdar://problem/3366203>:Setup Assistant crashes in SetModificationDateToPasteboard */
+/* <rdar://problem/3379022>:GCC compiler error in bitfield handling */
+
+
+typedef struct
+{
+ unsigned int b01 : 1;
+ unsigned int b02 : 2;
+ unsigned int b03 : 1;
+ unsigned int b04 : 1;
+ unsigned int b05 : 1;
+ unsigned int b06 : 1;
+ unsigned int b07 : 3;
+ unsigned int b08 : 3;
+ unsigned int b09 : 3;
+ unsigned int b10 : 3;
+ unsigned int b11 : 8;
+ unsigned int b12 : 1;
+ unsigned int b13 : 4;
+} test_struct;
+
+void func( test_struct* s, int t )
+{
+ s->b12 = 0;
+ s->b02 = 0;
+}
+
+main()
+{
+ test_struct r = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+
+ func (&r, 42);
+
+ if (r.b01 != 1
+ || r.b03 != 1
+ || r.b04 != 1
+ || r.b05 != 1
+ || r.b06 != 1
+ || r.b07 != 1
+ || r.b08 != 1
+ || r.b09 != 1
+ || r.b10 != 1
+ || r.b11 != 1
+ || r.b13 != 1)
+ {
+ abort();
+ }
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.apple/execute/execute.exp b/gcc/testsuite/gcc.apple/execute/execute.exp
new file mode 100644
index 00000000000..f7b1f5b5eeb
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/execute/execute.exp
@@ -0,0 +1,43 @@
+# Copyright (C) 1991, 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Rob Savoye. (rob@cygnus.com)
+# Modified and maintained by Jeffrey Wheat (cassidy@cygnus.com)
+
+#
+# These tests come from Torbjorn Granlund (tege@cygnus.com)
+# C torture test suite.
+#
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# load support procs
+load_lib c-torture.exp
+
+#
+# main test loop
+#
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $src] then {
+ continue
+ }
+
+ c-torture-execute $src
+}
diff --git a/gcc/testsuite/gcc.apple/framework1.c b/gcc/testsuite/gcc.apple/framework1.c
new file mode 100644
index 00000000000..bd0203669c2
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/framework1.c
@@ -0,0 +1,12 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-nostdinc -c -F${srcdir}/gcc.apple" } */
+
+/* Contributed by Devang Patel <dpatel@apple.com> */
+
+#include <one/one.h>
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/import.c b/gcc/testsuite/gcc.apple/import.c
new file mode 100644
index 00000000000..110a2d249ed
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/import.c
@@ -0,0 +1,9 @@
+/* APPLE LOCAL file #import not deprecated */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#import "importee.h"
+
+#import "importee.h"
+
+void foo (bar x) {}
diff --git a/gcc/testsuite/gcc.apple/importee.h b/gcc/testsuite/gcc.apple/importee.h
new file mode 100644
index 00000000000..86fbd11da4d
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/importee.h
@@ -0,0 +1,3 @@
+/* APPLE LOCAL file #import not deprecated */
+
+typedef int bar;
diff --git a/gcc/testsuite/gcc.apple/inttypes-1.c b/gcc/testsuite/gcc.apple/inttypes-1.c
new file mode 100644
index 00000000000..40404e2995b
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/inttypes-1.c
@@ -0,0 +1,21 @@
+/* APPLE LOCAL file test of inttypes.h formatter macros */
+
+/* { dg-do compile } */
+/* { dg-options "-Wall -W" } */
+
+#include <stdio.h>
+#include <inttypes.h>
+#include <stdint.h>
+
+int main ()
+{
+ uint32_t x = 12;
+ int32_t y = 15;
+ printf("x = %" PRIo32 "\n", x);
+ printf("x = %" PRIu32 "\n", x);
+ printf("x = %" PRIx32 "\n", x);
+ printf("x = %" PRIX32 "\n", x);
+ printf("y = %" PRId32 "\n", y);
+ printf("y = %" PRIi32 "\n", y);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.apple/no-warning.c b/gcc/testsuite/gcc.apple/no-warning.c
new file mode 100644
index 00000000000..9b71d722239
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/no-warning.c
@@ -0,0 +1,8 @@
+/* APPLE LOCAL file -Wno-#warnings */
+
+/* { dg-do compile } */
+/* { dg-options "-Wno-#warnings" } */
+
+#warning "suppress this warning"
+
+int a;
diff --git a/gcc/testsuite/gcc.apple/one.framework/Headers/one.h b/gcc/testsuite/gcc.apple/one.framework/Headers/one.h
new file mode 100644
index 00000000000..50c24d3e6c5
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/one.framework/Headers/one.h
@@ -0,0 +1,3 @@
+/* Contributed by Devang Patel <dpatel@apple.com> */
+
+/* Empty header */
diff --git a/gcc/testsuite/gcc.apple/pascal-strings-1.c b/gcc/testsuite/gcc.apple/pascal-strings-1.c
new file mode 100644
index 00000000000..c4e2d86ddc9
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/pascal-strings-1.c
@@ -0,0 +1,46 @@
+/* APPLE LOCAL file pascal strings */
+/* Positive C test cases. */
+/* Origin: Ziemowit Laski <zlaski@apple.com> */
+/* { dg-do run } */
+/* { dg-options "-std=iso9899:1999 -fpascal-strings" } */
+
+typedef __WCHAR_TYPE__ wchar_t;
+typedef __SIZE_TYPE__ size_t;
+
+extern void abort (void);
+extern size_t strlen (const char *s);
+
+const unsigned char *pascalStr1 = "\pHello, World!";
+const unsigned char *concat1 = "\pConcatenated" "string" "\pliteral";
+
+const unsigned char msg1[] = "\pHello"; /* ok */
+const unsigned char *msg2 = "\pHello"; /* ok */
+const signed char msg3[] = "\pHello"; /* ok */
+const char msg4[] = "\pHello"; /* ok */
+unsigned char msg5[] = "\pHello"; /* ok */
+signed char msg7[] = "\pHello"; /* ok */
+char msg8[] = "\pHello"; /* ok */
+
+int
+main (void)
+{
+ const unsigned char *pascalStr2 = "\pGood-bye!";
+
+ if (strlen ((const char *)pascalStr1) != 14)
+ abort ();
+ if (*pascalStr1 != 13)
+ abort (); /* the length byte does not include trailing null */
+
+ if (strlen ((const char *)pascalStr2) != 10)
+ abort ();
+ if (*pascalStr2 != 9)
+ abort ();
+
+ if (strlen ((const char *)concat1) != 26)
+ abort ();
+ if (*concat1 != 25)
+ abort ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.apple/pascal-strings-2.c b/gcc/testsuite/gcc.apple/pascal-strings-2.c
new file mode 100644
index 00000000000..6b617fa32c5
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/pascal-strings-2.c
@@ -0,0 +1,45 @@
+/* APPLE LOCAL file pascal strings */
+/* Negative C test cases. */
+/* Origin: Ziemowit Laski <zlaski@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -Wwrite-strings -fpascal-strings" } */
+
+typedef __WCHAR_TYPE__ wchar_t;
+
+const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-warning "unknown escape sequence" } */
+const wchar_t *pascalStr2 = L"Bye\p!"; /* { dg-warning "unknown escape sequence" } */
+
+const wchar_t *initErr0 = "\pHi"; /* { dg-warning "incompatible pointer type" } */
+const wchar_t initErr0a[] = "\pHi"; /* { dg-error "initialized from non-wide string" } */
+const wchar_t *initErr1 = "Bye"; /* { dg-warning "incompatible pointer type" } */
+const wchar_t initErr1a[] = "Bye"; /* { dg-error "initialized from non-wide string" } */
+
+const char *initErr2 = L"Hi"; /* { dg-warning "incompatible pointer type" } */
+const char initErr2a[] = L"Hi"; /* { dg-error "initialized from wide string" } */
+const signed char *initErr3 = L"Hi"; /* { dg-warning "incompatible pointer type" } */
+const signed char initErr3a[] = L"Hi"; /* { dg-error "initialized from wide string" } */
+const unsigned char *initErr4 = L"Hi"; /* { dg-warning "incompatible pointer type" } */
+const unsigned char initErr4a[] = L"Hi"; /* { dg-error "initialized from wide string" } */
+
+const char *pascalStr3 = "Hello\p, World!"; /* { dg-warning "unknown escape sequence" } */
+
+const char *concat2 = "Hi" "\pthere"; /* { dg-warning "unknown escape sequence" } */
+const char *concat3 = "Hi" "there\p"; /* { dg-warning "unknown escape sequence" } */
+
+const char *s2 = "\pGoodbye!"; /* ok */
+unsigned char *s3 = "\pHi!"; /* { dg-warning "initialization discards qualifiers" } */
+char *s4 = "\pHi"; /* { dg-warning "initialization discards qualifiers" } */
+signed char *s5 = "\pHi"; /* { dg-warning "initialization discards qualifiers" } */
+const signed char *s6 = "\pHi"; /* ok */
+
+/* the maximum length of a Pascal literal is 255. */
+const unsigned char *almostTooLong =
+ "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345"; /* ok */
+const unsigned char *definitelyTooLong =
+ "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ "1234567890123456"; /* { dg-error "too long" } */
diff --git a/gcc/testsuite/gcc.apple/preprocess.s b/gcc/testsuite/gcc.apple/preprocess.s
new file mode 100644
index 00000000000..897f2a7d6b1
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/preprocess.s
@@ -0,0 +1,16 @@
+/* APPLE LOCAL file preprocess .s files */
+
+/* Regression test - in assembly language, # may have some significance
+ other than 'stringize macro argument' and therefore must be preserved
+ in the output, and should not be warned about. */
+
+/* { dg-do preprocess } */
+
+#define foo() mov r0, #5 /* { dg-bogus "not followed" "spurious warning" } */
+
+entry:
+ foo()
+
+/* Check we don't EOF on an unknown directive. */
+#unknown directive
+#error a later diagnostic /* { dg-error "diagnostic" } */
diff --git a/gcc/testsuite/gcc.apple/special/liblongcall.c b/gcc/testsuite/gcc.apple/special/liblongcall.c
new file mode 100644
index 00000000000..297e473927a
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/special/liblongcall.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mlongcall" } */
+
+int
+dy_foo (char *str, int i)
+{
+ printf ("dy_foo (\"%s\", %d)\n", str, i);
+ return i + 1;
+}
diff --git a/gcc/testsuite/gcc.apple/special/longcall-prog.c b/gcc/testsuite/gcc.apple/special/longcall-prog.c
new file mode 100644
index 00000000000..59448507350
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/special/longcall-prog.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+/* declare all externally visible functions in libweak.c */
+int dy_foo (char *, int);
+
+main ()
+{
+ int answer, x=41;
+ char *str = "foostr";
+ printf ("%s begins:\n", __FILE__);
+ answer = dy_foo (str, x);
+ printf ("dy_foo (\"%s\", %d) = %d", str, x, answer);
+ if (answer != 42)
+ printf (" (error!)");
+ printf ("\n%s done.\n", __FILE__);
+ exit (answer != 42);
+}
diff --git a/gcc/testsuite/gcc.apple/special/longcall.exp b/gcc/testsuite/gcc.apple/special/longcall.exp
new file mode 100644
index 00000000000..d9ebd1270ea
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/special/longcall.exp
@@ -0,0 +1,69 @@
+# APPLE LOCAL file testsuite
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+set timeout 30
+
+set prms_id 0
+set bug_id 0
+
+set testfile "longcall-prog"
+set binfile ${objdir}/${subdir}/${testfile}
+set srcfile ${srcdir}/${subdir}/${testfile}.c
+
+set libfilestem "longcall"
+set libfile "lib${libfilestem}"
+set libbinfile ${objdir}/${subdir}/${libfile}.dylib
+set libsrcfile ${srcdir}/${subdir}/${libfile}.c
+
+file mkdir ${objdir}/${subdir}
+
+set test "longcall/dylib"
+
+proc note_result {success diagnostic} {
+ set verb [expr {($success) ? "pass" : "fail"}]
+ eval {$verb $diagnostic}
+}
+
+set whine "building $test library"
+set additional_flags "additional_flags=-dynamiclib -mlongcall"
+set result [expr {[gcc_target_compile "${libsrcfile}" "${libbinfile}" executable [list debug $additional_flags]] == ""}]
+note_result $result $whine
+
+set whine "building $test test program"
+set additional_flags "additional_flags=-L${objdir}/${subdir} -l${libfilestem}"
+set result [expr {[gcc_target_compile "${srcfile}" "${binfile}" executable [list debug $additional_flags]] == ""}]
+note_result $result $whine
+
+set result [gcc_load "$binfile" "" ""]
+set status [lindex $result 0]
+set output [lindex $result 1];
+if {$status == "pass" } {
+ pass $test
+ file delete $libbinfile $binfile
+} else {
+ fail $test
+}
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.apple/special/special.exp b/gcc/testsuite/gcc.apple/special/special.exp
new file mode 100644
index 00000000000..5344a4817b7
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/special/special.exp
@@ -0,0 +1,42 @@
+# APPLE LOCAL file testsuite
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+# Test the zerofill support by seeing if a file with a large array
+# compiled -fno-common has a small size on disk.
+
+gcc_target_compile "$srcdir/$subdir/zerofill.c" "zerofill.o" object \
+ "additional_flags=-fno-common"
+
+set size [ exec wc -c < zerofill.o ]
+
+if { $size < 100000 } {
+ pass "zerofill"
+} else {
+ fail "zerofill"
+}
+
+file delete zerofill.o
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.apple/special/zerofill.c b/gcc/testsuite/gcc.apple/special/zerofill.c
new file mode 100644
index 00000000000..e4bd84c816f
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/special/zerofill.c
@@ -0,0 +1,5 @@
+/* APPLE LOCAL file zerofill */
+
+int arr[40000];
+
+foo() {}
diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-4.x b/gcc/testsuite/gcc.c-torture/compile/simd-4.x
new file mode 100644
index 00000000000..6bb99bad79f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/simd-4.x
@@ -0,0 +1,4 @@
+# APPLE LOCAL vector instructions are not supported except with -faltivec
+
+if { [istarget "*-apple-darwin*"] } { set options "-faltivec" }
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040308-1.c b/gcc/testsuite/gcc.c-torture/execute/20040308-1.c
deleted file mode 100644
index 4c63535e7f7..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/20040308-1.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* This used to fail on SPARC with an unaligned memory access. */
-
-void foo(int n)
-{
- struct S {
- int i[n];
- unsigned int b:1;
- int i2;
- } __attribute__ ((packed)) __attribute__ ((aligned (4)));
-
- struct S s;
-
- s.i2 = 0;
-}
-
-int main(void)
-{
- foo(4);
-
- return 0;
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040309-1.c b/gcc/testsuite/gcc.c-torture/execute/20040309-1.c
deleted file mode 100644
index 49fa79560c6..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/20040309-1.c
+++ /dev/null
@@ -1,24 +0,0 @@
-extern void abort ();
-
-int foo(unsigned short x)
-{
- unsigned short y;
- y = x > 32767 ? x - 32768 : 0;
- return y;
-}
-
-int main()
-{
- if (foo (0) != 0)
- abort ();
- if (foo (32767) != 0)
- abort ();
- if (foo (32768) != 0)
- abort ();
- if (foo (32769) != 1)
- abort ();
- if (foo (65535) != 32767)
- abort ();
- return 0;
-}
-
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040311-1.c b/gcc/testsuite/gcc.c-torture/execute/20040311-1.c
deleted file mode 100644
index 013d869abf4..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/20040311-1.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation.
-
- Check that constant folding and RTL simplification of -(x >> y) doesn't
- break anything and produces the expected results.
-
- Written by Roger Sayle, 11th March 2004. */
-
-extern void abort (void);
-
-#define INT_BITS (sizeof(int)*8)
-
-int test1(int x)
-{
- return -(x >> (INT_BITS-1));
-}
-
-int test2(unsigned int x)
-{
- return -((int)(x >> (INT_BITS-1)));
-}
-
-int test3(int x)
-{
- int y;
- y = INT_BITS-1;
- return -(x >> y);
-}
-
-int test4(unsigned int x)
-{
- int y;
- y = INT_BITS-1;
- return -((int)(x >> y));
-}
-
-int main()
-{
- if (test1(0) != 0)
- abort ();
- if (test1(1) != 0)
- abort ();
- if (test1(-1) != 1)
- abort ();
-
- if (test2(0) != 0)
- abort ();
- if (test2(1) != 0)
- abort ();
- if (test2((unsigned int)-1) != -1)
- abort ();
-
- if (test3(0) != 0)
- abort ();
- if (test3(1) != 0)
- abort ();
- if (test3(-1) != 1)
- abort ();
-
- if (test4(0) != 0)
- abort ();
- if (test4(1) != 0)
- abort ();
- if (test4((unsigned int)-1) != -1)
- abort ();
-
- return 0;
-}
-
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040313-1.c b/gcc/testsuite/gcc.c-torture/execute/20040313-1.c
deleted file mode 100644
index c05fe730f0c..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/20040313-1.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* PR middle-end/14470 */
-/* Origin: Lodewijk Voge <lvoge@cs.vu.nl> */
-
-extern void abort(void);
-
-int main()
-{
- int t[1025] = { 1024 }, d;
-
- d = 0;
- d = t[d]++;
- if (t[0] != 1025)
- abort();
- if (d != 1024)
- abort();
- return 0;
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-1.x b/gcc/testsuite/gcc.c-torture/execute/simd-1.x
new file mode 100644
index 00000000000..db203f3d590
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/simd-1.x
@@ -0,0 +1,7 @@
+# APPLE LOCAL vector instructions are not supported except with -faltivec. xfailed it.
+
+if { [istarget "*-apple-darwin*"] } {
+ set torture_compile_xfail "*-apple-darwin*"
+}
+
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-2.x b/gcc/testsuite/gcc.c-torture/execute/simd-2.x
new file mode 100644
index 00000000000..db203f3d590
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/simd-2.x
@@ -0,0 +1,7 @@
+# APPLE LOCAL vector instructions are not supported except with -faltivec. xfailed it.
+
+if { [istarget "*-apple-darwin*"] } {
+ set torture_compile_xfail "*-apple-darwin*"
+}
+
+return 0
diff --git a/gcc/testsuite/gcc.dg/20020416-1.c b/gcc/testsuite/gcc.dg/20020416-1.c
index db1a2617fcd..44916ef1b83 100644
--- a/gcc/testsuite/gcc.dg/20020416-1.c
+++ b/gcc/testsuite/gcc.dg/20020416-1.c
@@ -1,6 +1,7 @@
/* PR bootstrap/6315 */
/* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-O2 -Wno-long-double" } */
/* { dg-options "-O2 -mhard-quad-float" { target sparc*-*-* } } */
/* { dg-options "-O2" { target sparclet*-*-* sparclite*-*-* sparc86x-*-* } } */
diff --git a/gcc/testsuite/gcc.dg/20040322-1.c b/gcc/testsuite/gcc.dg/20040322-1.c
new file mode 100644
index 00000000000..af5e0b4820c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20040322-1.c
@@ -0,0 +1,4 @@
+/* PR c/14069 */
+/* { dg-do compile } */
+struct S { int a; char b[]; char *c; }; /* { dg-error "error" "flexible array member not" } */
+struct S s = { .b = "foo", .c = .b }; /* { dg-error "error" "parse error before" } */
diff --git a/gcc/testsuite/gcc.dg/20040331-1.c b/gcc/testsuite/gcc.dg/20040331-1.c
new file mode 100644
index 00000000000..4cef3d3297a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20040331-1.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fwrapv" } */
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+ struct { int count: 2; } s = { -2 };
+ while (s.count-- != -2)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/20040409-1.c b/gcc/testsuite/gcc.dg/20040409-1.c
new file mode 100644
index 00000000000..dc9206a0ae0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20040409-1.c
@@ -0,0 +1,4 @@
+/* This tests to make sure that the attribute noreturn
+ can be used on function pointers. */
+
+int (*temp) (void) __attribute__((noreturn));
diff --git a/gcc/testsuite/gcc.dg/Wshadow-2.c b/gcc/testsuite/gcc.dg/Wshadow-2.c
new file mode 100644
index 00000000000..b0c051271ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wshadow-2.c
@@ -0,0 +1,10 @@
+/* Bogus warning for a double declaration of the same extern variable,
+ first at file scope, then at block scope. PR 13129. */
+
+/* { dg-options "-Wshadow" } */
+
+extern struct foo bar;
+void dummy()
+{
+ extern struct foo bar; /* { dg-bogus "shadows" } */
+}
diff --git a/gcc/testsuite/gcc.dg/altivec-2.c b/gcc/testsuite/gcc.dg/altivec-2.c
index f64081ff813..914910c3476 100644
--- a/gcc/testsuite/gcc.dg/altivec-2.c
+++ b/gcc/testsuite/gcc.dg/altivec-2.c
@@ -4,13 +4,12 @@
/* Program to test the vector_size attribute. This needs to run on a
target that has vectors, so use AltiVec. */
-#define vector __attribute__((vector_size(16)))
-
vector int foobar;
/* Only floats and integrals allowed. We don't care if they map to SIs. */
struct X { int frances; };
-vector struct X hotdog; /* { dg-error "invalid vector type" } */
+/* APPLE LOCAL AltiVec */
+vector struct X hotdog; /* { dg-error "(syntax error|invalid vector type)" } */
/* Arrays of vectors. */
vector char b[10], ouch;
diff --git a/gcc/testsuite/gcc.dg/altivec-4.c b/gcc/testsuite/gcc.dg/altivec-4.c
index 175663581ac..f5a46493152 100644
--- a/gcc/testsuite/gcc.dg/altivec-4.c
+++ b/gcc/testsuite/gcc.dg/altivec-4.c
@@ -1,8 +1,6 @@
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-options "-maltivec -O0 -Wall" } */
-#define vector __attribute__((vector_size(16)))
-
static int __attribute__((mode(V4SI))) x, y;
static vector signed int i,j;
diff --git a/gcc/testsuite/gcc.dg/altivec-5.c b/gcc/testsuite/gcc.dg/altivec-5.c
index 0adfdb84d19..37c9a9fa79b 100644
--- a/gcc/testsuite/gcc.dg/altivec-5.c
+++ b/gcc/testsuite/gcc.dg/altivec-5.c
@@ -1,8 +1,6 @@
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-options "-maltivec -O2" } */
-#define vector __attribute__((vector_size(16)))
-
void foo (const unsigned long x,
vector signed int a, vector signed int b)
{
diff --git a/gcc/testsuite/gcc.dg/altivec-varargs-1.c b/gcc/testsuite/gcc.dg/altivec-varargs-1.c
index 14e5e6ee976..72e6c4ad9ba 100644
--- a/gcc/testsuite/gcc.dg/altivec-varargs-1.c
+++ b/gcc/testsuite/gcc.dg/altivec-varargs-1.c
@@ -6,7 +6,11 @@
#include "altivec_check.h"
+/* APPLE LOCAL begin AltiVec */
+#ifndef vector
#define vector __attribute__((mode(V4SI)))
+#endif
+/* APPLE LOCAL end AltiVec */
const vector unsigned int v1 = {10,11,12,13};
const vector unsigned int v2 = {20,21,22,23};
diff --git a/gcc/testsuite/gcc.dg/builtin-inf-1.c b/gcc/testsuite/gcc.dg/builtin-inf-1.c
index d2d28415899..0e97114cfca 100644
--- a/gcc/testsuite/gcc.dg/builtin-inf-1.c
+++ b/gcc/testsuite/gcc.dg/builtin-inf-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-
+/* { dg-options "-Wno-long-double" { target *-apple-darwin* } } */
float fi = __builtin_inff();
double di = __builtin_inf();
long double li = __builtin_infl();
diff --git a/gcc/testsuite/gcc.dg/builtins-35.c b/gcc/testsuite/gcc.dg/builtins-35.c
new file mode 100644
index 00000000000..f898707e24a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-35.c
@@ -0,0 +1,6 @@
+/* Test that nan functions are not built-in in C90 mode. Bug 14635. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=c89" } */
+
+int nan, nanf, nanl, nans, nansf, nansl;
diff --git a/gcc/testsuite/gcc.dg/builtins-36.c b/gcc/testsuite/gcc.dg/builtins-36.c
new file mode 100644
index 00000000000..dc711988448
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-36.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Check sin, sinf, sinl, cos, cosf and cosl built-in functions
+ eventually compile to sincos, sincosf and sincosl.
+
+ Written by Uros Bizjak, 5th April 2004. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern double sin(double);
+extern float sinf(float);
+extern long double sinl(long double);
+
+extern double cos(double);
+extern float cosf(float);
+extern long double cosl(long double);
+
+
+double test1(double x)
+{
+ double y1, y2;
+
+ y1 = sin(x);
+ y2 = cos(x);
+
+ return y1 - y2;
+}
+
+float test1f(float x)
+{
+ float y1, y2;
+
+ y1 = sinf(x);
+ y2 = cosf(x);
+
+ return y1 - y2;
+}
+
+long double test1l(long double x)
+{
+ long double y1, y2;
+
+ y1 = sinl(x);
+ y2 = cosl(x);
+
+ return y1 - y2;
+}
+
+double test2(double x)
+{
+ return sin(x);
+}
+
+float test2f(float x)
+{
+ return sinf(x);
+}
+
+long double test2l(long double x)
+{
+ return sinl(x);
+}
+
+double test3(double x)
+{
+ return cos(x);
+}
+
+float test3f(float x)
+{
+ return cosf(x);
+}
+
+long double test3l(long double x)
+{
+ return cosl(x);
+}
+
diff --git a/gcc/testsuite/gcc.dg/builtins-37.c b/gcc/testsuite/gcc.dg/builtins-37.c
new file mode 100644
index 00000000000..e366a6ac552
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-37.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Check tan, tanf and tanl built-in functions.
+
+ Written by Uros Bizjak, 7th April 2004. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern double tan(double);
+extern float tanf(float);
+extern long double tanl(long double);
+
+
+double test1(double x)
+{
+ return tan(x);
+}
+
+float test1f(float x)
+{
+ return tanf(x);
+}
+
+long double test1l(long double x)
+{
+ return tanl(x);
+}
+
diff --git a/gcc/testsuite/gcc.dg/c90-intprom-1.c b/gcc/testsuite/gcc.dg/c90-intprom-1.c
new file mode 100644
index 00000000000..78e4b39ef35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c90-intprom-1.c
@@ -0,0 +1,47 @@
+/* Test for integer promotion rules: C90 subset of types. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+#include <limits.h>
+
+#define CHECK(T1, T2, TC) \
+ do { \
+ T1 a = 0; \
+ T2 b = 0; \
+ TC *c = 0; \
+ __typeof__(a+b) *d = 0; \
+ c = d; \
+ d = c; \
+ } while (0)
+
+void
+f (void)
+{
+ /* One type is unsigned long. */
+ CHECK(unsigned long, unsigned long, unsigned long);
+ CHECK(unsigned int, unsigned long, unsigned long);
+ CHECK(unsigned long, unsigned int, unsigned long);
+ CHECK(int, unsigned long, unsigned long);
+ CHECK(long, unsigned long, unsigned long);
+ CHECK(unsigned long, int, unsigned long);
+ CHECK(unsigned long, long, unsigned long);
+ /* long and unsigned int. */
+#if LONG_MAX >= UINT_MAX
+ CHECK(unsigned int, long, long);
+ CHECK(long, unsigned int, long);
+#else
+ CHECK(unsigned int, long, unsigned long);
+ CHECK(long, unsigned int, unsigned long);
+#endif
+ /* One type is long. */
+ CHECK(long, long, long);
+ CHECK(int, long, long);
+ CHECK(long, int, long);
+ /* One type is unsigned int. */
+ CHECK(unsigned int, unsigned int, unsigned int);
+ CHECK(int, unsigned int, unsigned int);
+ CHECK(unsigned int, int, unsigned int);
+ /* Otherwise int. */
+ CHECK(int, int, int);
+}
diff --git a/gcc/testsuite/gcc.dg/c99-complex-1.c b/gcc/testsuite/gcc.dg/c99-complex-1.c
index 2e1ba7df539..494cdd6a266 100644
--- a/gcc/testsuite/gcc.dg/c99-complex-1.c
+++ b/gcc/testsuite/gcc.dg/c99-complex-1.c
@@ -1,8 +1,8 @@
/* Test for _Complex: in C99 only. A few basic tests. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
-/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
-
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors -Wno-long-double" } */
/* Test _Complex allowed on floating types. */
float _Complex a;
diff --git a/gcc/testsuite/gcc.dg/c99-intprom-1.c b/gcc/testsuite/gcc.dg/c99-intprom-1.c
new file mode 100644
index 00000000000..0d7a33ee8be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-intprom-1.c
@@ -0,0 +1,77 @@
+/* Test for integer promotion rules: extended to long long by C99. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+#include <limits.h>
+
+#define CHECK(T1, T2, TC) \
+ do { \
+ T1 a = 0; \
+ T2 b = 0; \
+ TC *c = 0; \
+ __typeof__(a+b) *d = 0; \
+ c = d; \
+ d = c; \
+ } while (0)
+
+void
+f (void)
+{
+ /* Same type. */
+ CHECK(int, int, int);
+ CHECK(unsigned int, unsigned int, unsigned int);
+ CHECK(long, long, long);
+ CHECK(unsigned long, unsigned long, unsigned long);
+ CHECK(long long, long long, long long);
+ CHECK(unsigned long long, unsigned long long, unsigned long long);
+ /* Both signed. */
+ CHECK(int, long, long);
+ CHECK(int, long long, long long);
+ CHECK(long, int, long);
+ CHECK(long, long long, long long);
+ CHECK(long long, int, long long);
+ CHECK(long long, long, long long);
+ /* Both unsigned. */
+ CHECK(unsigned int, unsigned long, unsigned long);
+ CHECK(unsigned int, unsigned long long, unsigned long long);
+ CHECK(unsigned long, unsigned int, unsigned long);
+ CHECK(unsigned long, unsigned long long, unsigned long long);
+ CHECK(unsigned long long, unsigned int, unsigned long long);
+ CHECK(unsigned long long, unsigned long, unsigned long long);
+ /* Unsigned of greater or equal rank. */
+ CHECK(int, unsigned int, unsigned int);
+ CHECK(int, unsigned long, unsigned long);
+ CHECK(int, unsigned long long, unsigned long long);
+ CHECK(unsigned int, int, unsigned int);
+ CHECK(long, unsigned long, unsigned long);
+ CHECK(long, unsigned long long, unsigned long long);
+ CHECK(unsigned long, int, unsigned long);
+ CHECK(unsigned long, long, unsigned long);
+ CHECK(long long, unsigned long long, unsigned long long);
+ CHECK(unsigned long long, int, unsigned long long);
+ CHECK(unsigned long long, long, unsigned long long);
+ CHECK(unsigned long long, long long, unsigned long long);
+ /* Signed of greater rank. */
+#if LONG_MAX >= UINT_MAX
+ CHECK(unsigned int, long, long);
+ CHECK(long, unsigned int, long);
+#else
+ CHECK(unsigned int, long, unsigned long);
+ CHECK(long, unsigned int, unsigned long);
+#endif
+#if LLONG_MAX >= UINT_MAX
+ CHECK(unsigned int, long long, long long);
+ CHECK(long long, unsigned int, long long);
+#else
+ CHECK(unsigned int, long long, unsigned long long);
+ CHECK(long long, unsigned int, unsigned long long);
+#endif
+#if LLONG_MAX >= ULONG_MAX
+ CHECK(unsigned long, long long, long long);
+ CHECK(long long, unsigned long, long long);
+#else
+ CHECK(unsigned long, long long, unsigned long long);
+ CHECK(long long, unsigned long, unsigned long long);
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/cast-ptr-1.c b/gcc/testsuite/gcc.dg/cast-ptr-1.c
new file mode 100644
index 00000000000..cb42d13ac48
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cast-ptr-1.c
@@ -0,0 +1,15 @@
+/* APPLE LOCAL file pointer casts */
+/* Test that casts of pointer to unsigned long long aren't sign extended */
+/* Author: Matt Austern <austern@apple.com> */
+/* { dg-do run } */
+/* { dg-options "-Wno-error -w" } */
+
+int main () {
+ /* Note: test assumes sizeof(long long) >= sizeof(void*) */
+
+ unsigned long x1 = 0x80000000ul;
+ void* p = (void*) x1;
+ unsigned long long x2 = (unsigned long long) p;
+
+ return !(x1 == x2);
+}
diff --git a/gcc/testsuite/gcc.dg/charset/asm1.c b/gcc/testsuite/gcc.dg/charset/asm1.c
deleted file mode 100644
index d7578d418f6..00000000000
--- a/gcc/testsuite/gcc.dg/charset/asm1.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler ".ascii bar" } }
- { dg-final { scan-assembler ".ascii foo" } }
- */
-extern int x, y;
-
-asm (".ascii bar");
-
-int foo (void)
-{
- __asm__ (".ascii foo");
- return 0;
-}
diff --git a/gcc/testsuite/gcc.dg/charset/asm3.c b/gcc/testsuite/gcc.dg/charset/asm3.c
deleted file mode 100644
index 8d8dbbb524d..00000000000
--- a/gcc/testsuite/gcc.dg/charset/asm3.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Test for complex asm statements. Make sure it compiles
- then test for some of the asm statements not being translated. */
-/* { dg-do compile { target i?86-*-* } }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler "std" } }
- { dg-final { scan-assembler "cld" } }
- { dg-final { scan-assembler "rep" } }
- { dg-final { scan-assembler "movsb" } } */
-#define size_t int
-void *
-memmove (void *__dest, __const void *__src, size_t __n)
-{
- register unsigned long int __d0, __d1, __d2;
- if (__dest < __src)
- __asm__ __volatile__
- ("cld\n\t"
- "rep\n\t"
- "movsb"
- : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
- : "0" (__n), "1" (__src), "2" (__dest)
- : "memory");
- else
- __asm__ __volatile__
- ("std\n\t"
- "rep\n\t"
- "movsb\n\t"
- "cld"
- : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
- : "0" (__n), "1" (__n - 1 + (const char *) __src),
- "2" (__n - 1 + (char *) __dest)
- : "memory");
- return __dest;
-}
diff --git a/gcc/testsuite/gcc.dg/charset/asm4.c b/gcc/testsuite/gcc.dg/charset/asm4.c
deleted file mode 100644
index cd850c3e81f..00000000000
--- a/gcc/testsuite/gcc.dg/charset/asm4.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Simple asm test. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler "foo" } } */
-extern int bar;
-
-int main (void)
-{
- asm ("foo %0" : "=r" (bar));
-}
diff --git a/gcc/testsuite/gcc.dg/charset/asm5.c b/gcc/testsuite/gcc.dg/charset/asm5.c
deleted file mode 100644
index fa93f40fdaf..00000000000
--- a/gcc/testsuite/gcc.dg/charset/asm5.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Test for string translation. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler-not "translate" } } */
-void foo (void)
-{
- asm ("xx" : : "r"("translate") : "cc");
-}
diff --git a/gcc/testsuite/gcc.dg/charset/attribute1.c b/gcc/testsuite/gcc.dg/charset/attribute1.c
deleted file mode 100644
index 993c7934c80..00000000000
--- a/gcc/testsuite/gcc.dg/charset/attribute1.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Test for attribute non-translation. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler "foo" } } */
-int walrus __attribute__ ((section (".foo")));
-
-int main (void)
-{
- return 0;
-}
diff --git a/gcc/testsuite/gcc.dg/charset/attribute2.c b/gcc/testsuite/gcc.dg/charset/attribute2.c
deleted file mode 100644
index 4ce95a51f84..00000000000
--- a/gcc/testsuite/gcc.dg/charset/attribute2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Test to make sure that invalid attributes aren't translated.
- If error recovery is ever testable then "foobar" should be
- translated. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- */
-int foo __attribute__ ((walrus)); /* { dg-error "walrus" "ignored" } */
-char x[] = "foobar";
diff --git a/gcc/testsuite/gcc.dg/charset/string.c b/gcc/testsuite/gcc.dg/charset/string.c
deleted file mode 100644
index 375e28a2ed6..00000000000
--- a/gcc/testsuite/gcc.dg/charset/string.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Simple character translation test. */
-/* { dg-do compile }
- { dg-require-iconv "IBM-1047" }
- { dg-final { scan-assembler-not "string foobar" } } */
-char *foo = "string foobar";
diff --git a/gcc/testsuite/gcc.dg/compare8.c b/gcc/testsuite/gcc.dg/compare8.c
new file mode 100644
index 00000000000..d723c45a095
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compare8.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-Wsign-compare" } */
+
+int
+f(unsigned short a1, unsigned short a2, unsigned int b)
+{
+ return ((a1+a2)|5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+}
+
+int
+g(unsigned short a1, unsigned short a2, unsigned int b)
+{
+ return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+}
+
+int
+h(unsigned short a1, unsigned short a2, unsigned int b)
+{
+ return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_main.c
new file mode 100644
index 00000000000..d6f9eff2563
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_main.c
@@ -0,0 +1,14 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are float
+ scalars. */
+
+extern void struct_by_value_5a_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_5a_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_x.c
new file mode 100644
index 00000000000..90738a7a7e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_x.c
@@ -0,0 +1,43 @@
+#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(f, float)
+CHECKS(f, float)
+
+TEST(Sf1, float)
+TEST(Sf2, float)
+TEST(Sf3, float)
+TEST(Sf4, float)
+TEST(Sf5, float)
+TEST(Sf6, float)
+TEST(Sf7, float)
+TEST(Sf8, float)
+
+#undef T
+
+void
+struct_by_value_5a_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sf1, float)
+T(Sf2, float)
+T(Sf3, float)
+T(Sf4, float)
+T(Sf5, float)
+T(Sf6, float)
+T(Sf7, float)
+T(Sf8, float)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_y.c
new file mode 100644
index 00000000000..9ac1f913474
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5a_y.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(f,float)
+INITS(f, float)
+
+TEST(Sf1, float)
+TEST(Sf2, float)
+TEST(Sf3, float)
+TEST(Sf4, float)
+TEST(Sf5, float)
+TEST(Sf6, float)
+TEST(Sf7, float)
+TEST(Sf8, float)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_main.c
new file mode 100644
index 00000000000..dcb5f27ed09
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_main.c
@@ -0,0 +1,14 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are float
+ scalars. */
+
+extern void struct_by_value_5b_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_5b_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_x.c
new file mode 100644
index 00000000000..3c371558728
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_x.c
@@ -0,0 +1,43 @@
+#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(f, float)
+CHECKS(f, float)
+
+TEST(Sf9, float)
+TEST(Sf10, float)
+TEST(Sf11, float)
+TEST(Sf12, float)
+TEST(Sf13, float)
+TEST(Sf14, float)
+TEST(Sf15, float)
+TEST(Sf16, float)
+
+#undef T
+
+void
+struct_by_value_5b_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sf9, float)
+T(Sf10, float)
+T(Sf11, float)
+T(Sf12, float)
+T(Sf13, float)
+T(Sf14, float)
+T(Sf15, float)
+T(Sf16, float)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_y.c
new file mode 100644
index 00000000000..cedc1660709
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5b_y.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(f,float)
+INITS(f, float)
+
+TEST(Sf9, float)
+TEST(Sf10, float)
+TEST(Sf11, float)
+TEST(Sf12, float)
+TEST(Sf13, float)
+TEST(Sf14, float)
+TEST(Sf15, float)
+TEST(Sf16, float)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_main.c
new file mode 100644
index 00000000000..609c1d67308
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_main.c
@@ -0,0 +1,14 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are double
+ scalars. */
+
+extern void struct_by_value_6a_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_6a_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_x.c
new file mode 100644
index 00000000000..e6852d9c9b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_x.c
@@ -0,0 +1,43 @@
+#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(d, double)
+CHECKS(d, double)
+
+TEST(Sd1, double)
+TEST(Sd2, double)
+TEST(Sd3, double)
+TEST(Sd4, double)
+TEST(Sd5, double)
+TEST(Sd6, double)
+TEST(Sd7, double)
+TEST(Sd8, double)
+
+#undef T
+
+void
+struct_by_value_6a_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sd1, double)
+T(Sd2, double)
+T(Sd3, double)
+T(Sd4, double)
+T(Sd5, double)
+T(Sd6, double)
+T(Sd7, double)
+T(Sd8, double)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_y.c
new file mode 100644
index 00000000000..8684b53c2f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6a_y.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(d, double)
+INITS(d, double)
+
+TEST(Sd1, double)
+TEST(Sd2, double)
+TEST(Sd3, double)
+TEST(Sd4, double)
+TEST(Sd5, double)
+TEST(Sd6, double)
+TEST(Sd7, double)
+TEST(Sd8, double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_main.c
new file mode 100644
index 00000000000..ff17221718f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_main.c
@@ -0,0 +1,14 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are double
+ scalars. */
+
+extern void struct_by_value_6b_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_6b_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_x.c
new file mode 100644
index 00000000000..5b285c9c5b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_x.c
@@ -0,0 +1,43 @@
+#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(d, double)
+CHECKS(d, double)
+
+TEST(Sd9, double)
+TEST(Sd10, double)
+TEST(Sd11, double)
+TEST(Sd12, double)
+TEST(Sd13, double)
+TEST(Sd14, double)
+TEST(Sd15, double)
+TEST(Sd16, double)
+
+#undef T
+
+void
+struct_by_value_6b_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sd9, double)
+T(Sd10, double)
+T(Sd11, double)
+T(Sd12, double)
+T(Sd13, double)
+T(Sd14, double)
+T(Sd15, double)
+T(Sd16, double)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_y.c
new file mode 100644
index 00000000000..c568761b241
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6b_y.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(d, double)
+INITS(d, double)
+
+TEST(Sd9, double)
+TEST(Sd10, double)
+TEST(Sd11, double)
+TEST(Sd12, double)
+TEST(Sd13, double)
+TEST(Sd14, double)
+TEST(Sd15, double)
+TEST(Sd16, double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_main.c
new file mode 100644
index 00000000000..8379dc563c5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_main.c
@@ -0,0 +1,14 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are long double
+ scalars. */
+
+extern void struct_by_value_7a_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_7a_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_x.c
new file mode 100644
index 00000000000..9818c3c2251
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_x.c
@@ -0,0 +1,43 @@
+#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(ld, long double)
+CHECKS(ld, long double)
+
+TEST(Sld1, long double)
+TEST(Sld2, long double)
+TEST(Sld3, long double)
+TEST(Sld4, long double)
+TEST(Sld5, long double)
+TEST(Sld6, long double)
+TEST(Sld7, long double)
+TEST(Sld8, long double)
+
+#undef T
+
+void
+struct_by_value_7a_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sld1, long double)
+T(Sld2, long double)
+T(Sld3, long double)
+T(Sld4, long double)
+T(Sld5, long double)
+T(Sld6, long double)
+T(Sld7, long double)
+T(Sld8, long double)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_y.c
new file mode 100644
index 00000000000..cb53df89dac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7a_y.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(ld, long double)
+INITS(ld, long double)
+
+TEST(Sld1, long double)
+TEST(Sld2, long double)
+TEST(Sld3, long double)
+TEST(Sld4, long double)
+TEST(Sld5, long double)
+TEST(Sld6, long double)
+TEST(Sld7, long double)
+TEST(Sld8, long double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_main.c
new file mode 100644
index 00000000000..5d6908bfc1f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_main.c
@@ -0,0 +1,14 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are long double
+ scalars. */
+
+extern void struct_by_value_7b_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_7b_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_x.c
new file mode 100644
index 00000000000..508ff616584
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_x.c
@@ -0,0 +1,43 @@
+#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(ld, long double)
+CHECKS(ld, long double)
+
+TEST(Sld9, long double)
+TEST(Sld10, long double)
+TEST(Sld11, long double)
+TEST(Sld12, long double)
+TEST(Sld13, long double)
+TEST(Sld14, long double)
+TEST(Sld15, long double)
+TEST(Sld16, long double)
+
+#undef T
+
+void
+struct_by_value_7b_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sld9, long double)
+T(Sld10, long double)
+T(Sld11, long double)
+T(Sld12, long double)
+T(Sld13, long double)
+T(Sld14, long double)
+T(Sld15, long double)
+T(Sld16, long double)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_y.c
new file mode 100644
index 00000000000..cc70a7d2925
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7b_y.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(ld, long double)
+INITS(ld, long double)
+
+TEST(Sld9, long double)
+TEST(Sld10, long double)
+TEST(Sld11, long double)
+TEST(Sld12, long double)
+TEST(Sld13, long double)
+TEST(Sld14, long double)
+TEST(Sld15, long double)
+TEST(Sld16, long double)
diff --git a/gcc/testsuite/gcc.dg/cpp/c++98-pedantic.cc b/gcc/testsuite/gcc.dg/cpp/c++98-pedantic.cc
new file mode 100644
index 00000000000..1e8c160a96f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c++98-pedantic.cc
@@ -0,0 +1,11 @@
+/* APPLE LOCAL file rename for HFS */
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-std=c++98 -pedantic" } */
+
+/* This file is for testing the preprocessor in -std=c++98 -pedantic mode.
+ Neil Booth, 2 Dec 2000. */
+
+#if 1LL /* { dg-warning "long long" } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/c++98.cc b/gcc/testsuite/gcc.dg/cpp/c++98.cc
new file mode 100644
index 00000000000..a9843b878fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c++98.cc
@@ -0,0 +1,11 @@
+/* APPLE LOCAL file rename for HFS */
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-std=c++98" } */
+
+/* This file is for testing the preprocessor in -std=c++98 mode.
+ Neil Booth, 2 Dec 2000. */
+
+#if 1LL
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c b/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c
index d5c6eb960e6..a5db0fbc80f 100644
--- a/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c
+++ b/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c
@@ -1,8 +1,8 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. */
-
/* { dg-do preprocess } */
/* { dg-options "-Wno-endif-labels -pedantic" } */
-
+/* APPLE LOCAL No error emit by Apple's default, use -Wextra-tokens to enable */
+/* { dg-options "-Wextra-tokens -Wno-endif-labels -pedantic" { target *-apple-darwin* } } */
/* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c
for more general tests. */
diff --git a/gcc/testsuite/gcc.dg/cpp/extratokens.c b/gcc/testsuite/gcc.dg/cpp/extratokens.c
index c06a41d4c2b..e57374cef93 100644
--- a/gcc/testsuite/gcc.dg/cpp/extratokens.c
+++ b/gcc/testsuite/gcc.dg/cpp/extratokens.c
@@ -1,7 +1,8 @@
/* Copyright (C) 2000 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
-/* { dg-options "-fno-show-column" } */
+/* APPLE LOCAL Wextra-tokens */
+/* { dg-options "-fno-show-column -Wextra-tokens" } */
/* Tests all directives that do not permit excess tokens at the end of
the line. */
diff --git a/gcc/testsuite/gcc.dg/cpp/if-2.c b/gcc/testsuite/gcc.dg/cpp/if-2.c
index 866d25c3a60..6630bf55d65 100644
--- a/gcc/testsuite/gcc.dg/cpp/if-2.c
+++ b/gcc/testsuite/gcc.dg/cpp/if-2.c
@@ -18,6 +18,8 @@
#endif
#if 'abcd' /* { dg-warning "multi-character character constant" "multi-character charconst" } */
+# /* APPLE LOCAL enable the warning with the -Wfour-char-constants flag */
+# /* { dg-options "-Wfour-char-constants" { target *-apple-darwin* } } */
#endif
#if 'abcdefghi' /* { dg-error "character constant (is )?too long" "charconst too long" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/include2.c b/gcc/testsuite/gcc.dg/cpp/include2.c
index 60edfccb0cd..e935703b614 100644
--- a/gcc/testsuite/gcc.dg/cpp/include2.c
+++ b/gcc/testsuite/gcc.dg/cpp/include2.c
@@ -1,10 +1,10 @@
/* Copyright (C) 2000 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
-
+/* APPLE LOCAL BEGIN Apple disable this warning by default */
/* Tests that #include does not allow the terminating '>' or '"' to be
escaped, as per the standard. */
-
+/* { dg-options "-Wextra-tokens" } */
/* Source: Neil Booth, 4 Nov 2000. */
#include <silly\>> /* { dg-warning "extra tokens" "" } */
@@ -13,4 +13,4 @@
/* These error is No such file or directory, just once. However, this
message is locale-dependent, so don't test for it. */
/* { dg-error "silly" "" { target *-*-* } 10 } */
-
+/* APPLE LOCAL END */
diff --git a/gcc/testsuite/gcc.dg/cpp/skipping2.c b/gcc/testsuite/gcc.dg/cpp/skipping2.c
index 3b0d0f32c8e..21378003fe2 100644
--- a/gcc/testsuite/gcc.dg/cpp/skipping2.c
+++ b/gcc/testsuite/gcc.dg/cpp/skipping2.c
@@ -6,6 +6,9 @@
/* Source: Neil Booth, 25 Jul 2001. */
+/* APPLE LOCAL -Wextra-tokens required in Apple's compiler to elicit req'd warnings here */
+/* { dg-options "-Wextra-tokens" } */
+
#if 0
#if foo
#else foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/sysmac2.c b/gcc/testsuite/gcc.dg/cpp/sysmac2.c
index 0d1efabdc07..19ddf6ccb94 100644
--- a/gcc/testsuite/gcc.dg/cpp/sysmac2.c
+++ b/gcc/testsuite/gcc.dg/cpp/sysmac2.c
@@ -1,7 +1,8 @@
/* Copyright (C) 2001 Free Software Foundation, Inc. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -pedantic -Wtraditional -fno-show-column" } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-std=gnu99 -pedantic -Wtraditional -fno-show-column -Wno-long-double" } */
/* Tests diagnostics are suppressed for some macros defined in system
headers. */
diff --git a/gcc/testsuite/gcc.dg/debug/20020220-1.c b/gcc/testsuite/gcc.dg/debug/20020220-1.c
index 07109e86a98..21bdc22b62b 100644
--- a/gcc/testsuite/gcc.dg/debug/20020220-1.c
+++ b/gcc/testsuite/gcc.dg/debug/20020220-1.c
@@ -3,6 +3,8 @@
constant -4.0 in constant pool was never referenced by anything
but Dwarf-2 location descriptor. */
/* { dg-do run } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-Wno-long-double" } */
void __attribute__((noinline))
foo (const char *x __attribute__((unused)),
diff --git a/gcc/testsuite/gcc.dg/debug/debug-1.c b/gcc/testsuite/gcc.dg/debug/debug-1.c
index 8cc520dcd79..b6faed04519 100644
--- a/gcc/testsuite/gcc.dg/debug/debug-1.c
+++ b/gcc/testsuite/gcc.dg/debug/debug-1.c
@@ -1,7 +1,8 @@
/* Verify that the scheduler does not discard the lexical block. */
/* { dg-do compile } */
/* { dg-options "-dA" } */
-/* { dg-final { scan-assembler "xyzzy" } } */
+/* APPLE LOCAL xfail for Apple only, serena */
+/* { dg-final { scan-assembler "xyzzy" { xfail *-apple-darwin* } } } */
long p;
diff --git a/gcc/testsuite/gcc.dg/debug/debug-2.c b/gcc/testsuite/gcc.dg/debug/debug-2.c
index b164ff97734..f3a3cf80777 100644
--- a/gcc/testsuite/gcc.dg/debug/debug-2.c
+++ b/gcc/testsuite/gcc.dg/debug/debug-2.c
@@ -1,7 +1,8 @@
/* Verify that the scheduler does not discard the lexical block. */
/* { dg-do compile } */
/* { dg-options "-dA" } */
-/* { dg-final { scan-assembler "xyzzy" } } */
+/* APPLE LOCAL xfail for Apple only, serena */
+/* { dg-final { scan-assembler "xyzzy" { xfail *-apple-darwin* } } } */
long p;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die1.c
deleted file mode 100644
index 39f0bf2792a..00000000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die1.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Verify that inline function never actually inlined has no abstract DIE. */
-/* { dg-do compile */
-/* { dg-options "-O2 -gdwarf-2 -dA" } */
-/* { dg-final { scan-assembler-not "DW_AT_inline" } } */
-inline int t()
-{
-}
-int (*q)()=t;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die2.c
deleted file mode 100644
index 48bce243d41..00000000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die2.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Verify that inline function never actually emit has no DIE. */
-/* { dg-do compile */
-/* { dg-options "-O0 -gdwarf-2 -dA" } */
-/* { dg-final { scan-assembler-not "CIE Version" } } */
-static inline int t()
-{
-}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die3.c
deleted file mode 100644
index 34fddfaffc0..00000000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die3.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Verify that extern inline function never actually inlined has no abstract DIE. */
-/* { dg-do compile */
-/* { dg-options "-O0 -gdwarf-2 -dA" } */
-/* { dg-final { scan-assembler-not "DW_AT_inline" } } */
-extern inline int t()
-{
-}
-int (*q)()=t;
-int t()
-{
-}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die5.c
deleted file mode 100644
index b3a245d2b11..00000000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die5.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Inlined inline function must have abstract DIE */
-/* { dg-do compile */
-/* { dg-options "-O2 -gdwarf-2 -dA -fpreprocessed" } */
-/* { dg-final { scan-assembler "3.*DW_AT_inline" } } */
-#1 "test.h"
-inline int t()
-{
-}
-int q()
-{
- t();
-}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die6.c
deleted file mode 100644
index 40cdc8dee37..00000000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die6.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* not inline inline function must not have abstract DIE */
-/* { dg-do compile */
-/* { dg-options "-O2 -fno-inline -gdwarf-2 -dA -fpreprocessed" } */
-/* { dg-final { scan-assembler-not "DW_AT_inline" } } */
-#1 "test.h"
-inline int t()
-{
-}
-int q()
-{
- t();
-}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die7.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die7.c
deleted file mode 100644
index d8d013af38c..00000000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die7.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Inlined non-inline function must have abstract DIE */
-/* { dg-do compile */
-/* { dg-options "-O2 -gdwarf-2 -dA -fpreprocessed" } */
-/* { dg-final { scan-assembler "1.*DW_AT_inline" } } */
-#1 "test.h"
-void f(void);
-static int t()
-{
- f();
-}
-int q()
-{
- t();
-}
diff --git a/gcc/testsuite/gcc.dg/dg.exp b/gcc/testsuite/gcc.dg/dg.exp
index 14cf79d7e14..eb11a3a70c5 100644
--- a/gcc/testsuite/gcc.dg/dg.exp
+++ b/gcc/testsuite/gcc.dg/dg.exp
@@ -22,7 +22,7 @@ load_lib gcc-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
- set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors -Wno-long-double"
}
# Initialize `dg'.
diff --git a/gcc/testsuite/gcc.dg/format/c90-printf-1.c b/gcc/testsuite/gcc.dg/format/c90-printf-1.c
index e4c18f76862..f2a566aa5fa 100644
--- a/gcc/testsuite/gcc.dg/format/c90-printf-1.c
+++ b/gcc/testsuite/gcc.dg/format/c90-printf-1.c
@@ -4,7 +4,8 @@
*/
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
-/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-long-double" } */
#include "format.h"
diff --git a/gcc/testsuite/gcc.dg/format/c90-scanf-1.c b/gcc/testsuite/gcc.dg/format/c90-scanf-1.c
index ea42f1e131e..2a949f937a7 100644
--- a/gcc/testsuite/gcc.dg/format/c90-scanf-1.c
+++ b/gcc/testsuite/gcc.dg/format/c90-scanf-1.c
@@ -4,7 +4,8 @@
*/
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
-/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-long-double" } */
#include "format.h"
diff --git a/gcc/testsuite/gcc.dg/format/strfmon-1.c b/gcc/testsuite/gcc.dg/format/strfmon-1.c
index d163751328c..94c68586f49 100644
--- a/gcc/testsuite/gcc.dg/format/strfmon-1.c
+++ b/gcc/testsuite/gcc.dg/format/strfmon-1.c
@@ -1,7 +1,8 @@
/* Test for strfmon format checking. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wformat" } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-std=gnu99 -Wformat -Wno-long-double" } */
#include "format.h"
diff --git a/gcc/testsuite/gcc.dg/gnu89-init-3.c b/gcc/testsuite/gcc.dg/gnu89-init-3.c
new file mode 100644
index 00000000000..bd4283ec875
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu89-init-3.c
@@ -0,0 +1,18 @@
+/* PR 11527 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu89" } */
+
+typedef struct smrdd_memory_blocks_s
+{
+ int blocks;
+ int block[];
+} smrdd_memory_blocks_t;
+
+const smrdd_memory_blocks_t smrdd_memory_blocks =
+{
+ 3,
+ {
+ [5] = 5,
+ [1] = 2,
+ }
+};
diff --git a/gcc/testsuite/gcc.dg/i386-387-7.c b/gcc/testsuite/gcc.dg/i386-387-7.c
new file mode 100644
index 00000000000..43c916c61d0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-387-7.c
@@ -0,0 +1,10 @@
+/* Verify that 387 fsincos instruction is generated. */
+/* { dg-do compile { target "i?86-*-*" } } */
+/* { dg-options "-O -ffast-math -march=i686" } */
+/* { dg-final { scan-assembler "fsincos" } } */
+
+double f1(double x)
+{
+ return sin(x) + cos (x);
+}
+
diff --git a/gcc/testsuite/gcc.dg/i386-387-8.c b/gcc/testsuite/gcc.dg/i386-387-8.c
new file mode 100644
index 00000000000..05787160b00
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-387-8.c
@@ -0,0 +1,12 @@
+/* Verify that 387 fptan instruction is generated. Also check fptan
+ peephole2 optimizer. */
+/* { dg-do compile { target "i?86-*-*" } } */
+/* { dg-options "-O2 -ffast-math -march=i686" } */
+/* { dg-final { scan-assembler "fptan" } } */
+/* { dg-final { scan-assembler-not "fld1" } } */
+
+double f1(double x)
+{
+ return 1.0 / tan(x);
+}
+
diff --git a/gcc/testsuite/gcc.dg/noncompile/incomplete-3.c b/gcc/testsuite/gcc.dg/noncompile/incomplete-3.c
new file mode 100644
index 00000000000..735ef465b38
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/incomplete-3.c
@@ -0,0 +1,9 @@
+/* Both occurrences of "c" should get diagnostics. PR 12391. */
+typedef struct { int a; } b_t;
+
+int foo (void)
+{
+ b_t d;
+ struct b_t *c = &d; /* { dg-warning "incompatible pointer type" } */
+ c->a; /* { dg-error "incomplete type" } */
+}
diff --git a/gcc/testsuite/gcc.dg/noncompile/undeclared-1.c b/gcc/testsuite/gcc.dg/noncompile/undeclared-1.c
new file mode 100644
index 00000000000..5bb7c2a4df9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/undeclared-1.c
@@ -0,0 +1,8 @@
+/* Test for no ICE with an undeclared identifier in an enum in old-style
+ parameter decls. PR 12560. */
+/* { dg-options "-w" } */
+
+foo(c)
+ enum { a = b } c; /* { dg-error "undeclared|for each" } */
+{
+}
diff --git a/gcc/testsuite/gcc.dg/noncompile/undeclared-2.c b/gcc/testsuite/gcc.dg/noncompile/undeclared-2.c
new file mode 100644
index 00000000000..36cd0eaf175
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/undeclared-2.c
@@ -0,0 +1,3 @@
+/* Invalid, but should not ICE. PRs 11944, 14734. */
+
+void foo(const int[i]); /* { dg-error "undeclared|for each" } */
diff --git a/gcc/testsuite/gcc.dg/pch/apple-altivec-1.c b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.c
new file mode 100644
index 00000000000..7dc24c0d797
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.c
@@ -0,0 +1,126 @@
+/* APPLE LOCAL file AltiVec */
+/* { dg-do compile { target powerpc-*-darwin* } } */
+/* { dg-options "-faltivec -Wno-long-double -I." } */
+
+#include "apple-altivec-1.h"
+
+/* Test for correct handling of AltiVec constants passed
+ through '...' (va_arg). */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define CHECK_INVARIANT(expr) \
+ if (!(expr)) { \
+ printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \
+ abort (); \
+ }
+
+struct foo { int x; int y; };
+struct vfoo { int x; __vector signed int v; int y; };
+union u { __vector signed int v; signed int i[4]; };
+
+struct foo x_g = { 3, 4};
+struct vfoo vx_g = { 10, (vector signed int)(11, 12, 13, 14), 15 };
+__vector signed int v_g = (vector signed int) (22, 23, 24, 25);
+struct vfoo vx2_g = { 30, (vector signed int)(31, 32, 33, 34), 35 };
+__vector signed int v2_g = (vector signed int)(40, 41, 42, 43);
+int i_1 = 99, i_2 = 33;
+double d_2 = 1.5, d_3 = 1.75;
+long double ld_1 = 1.25;
+
+void bar (int i, ... )
+{
+ struct foo xi;
+ double d;
+ long double ld;
+ float f;
+ char c;
+ short s;
+ va_list ap;
+ va_start(ap, i);
+ xi = va_arg(ap, struct foo);
+ s = (short)va_arg(ap, int);
+ f = (float)va_arg(ap, double);
+ ld = va_arg(ap, long double);
+ c = (char)va_arg(ap, int);
+ d = va_arg(ap, double);
+ va_end(ap);
+
+ CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y);
+ CHECK_INVARIANT (s == (short)i_2);
+ CHECK_INVARIANT (f == (float)d_2);
+ CHECK_INVARIANT (ld == ld_1);
+ CHECK_INVARIANT (c == (char)i_1);
+ CHECK_INVARIANT (d == d_3);
+}
+
+void baz (int i, ... )
+{
+ struct vfoo vx, vx2;
+ __vector signed int v_i, v2_i;
+ int j, k, l;
+ va_list ap;
+ va_start(ap, i);
+ v_i = va_arg(ap, __vector signed int);
+ j = va_arg(ap, int);
+ vx = va_arg(ap, struct vfoo);
+ k = va_arg(ap, int);
+ v2_i = va_arg(ap, __vector signed int);
+ l = va_arg(ap, int);
+ vx2 = va_arg(ap, struct vfoo);
+ va_end(ap);
+
+ CHECK_INVARIANT (vec_all_eq (v_i, v_g));
+ CHECK_INVARIANT (j == i_1);
+ CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
+ CHECK_INVARIANT (k == i_1);
+ CHECK_INVARIANT (vec_all_eq (v2_i, v2_g));
+ CHECK_INVARIANT (l == i_1);
+ CHECK_INVARIANT (vx2.x == vx2_g.x && vec_all_eq(vx2.v, vx2_g.v) && vx2.y == vx2_g.y);
+}
+
+void quux (int i, ... )
+{
+ __vector signed int v_i, v2_i;
+ union u vi, v2i;
+ va_list ap;
+ va_start(ap, i);
+ v_i = va_arg(ap, __vector signed int);
+ v2_i = va_arg(ap, __vector signed int);
+ va_end(ap);
+ vi.v = v_i;
+ v2i.v = v2_i;
+
+ CHECK_INVARIANT (vec_all_eq (v_i, v_g));
+ CHECK_INVARIANT (vec_all_eq (v2_i, v_g));
+ CHECK_INVARIANT (vec_all_eq (vi.v, v_g));
+ CHECK_INVARIANT (vec_all_eq (v2i.v, v_g));
+}
+
+void baz2 (int i, ... )
+{
+ struct vfoo vx;
+ union u vxi;
+ va_list ap;
+ va_start(ap, i);
+ vx = va_arg(ap, struct vfoo);
+ va_end(ap);
+ vxi.v = vx.v;
+
+ CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
+ CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v));
+}
+
+int main(void)
+{
+ CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48);
+
+ bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3);
+ baz(i_1, v_g, i_1, vx_g, i_1, v2_g, i_1, vx2_g);
+ quux(i_1, v_g, v_g);
+ baz2(i_1, vx_g);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pch/apple-altivec-1.hs b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.hs
new file mode 100644
index 00000000000..d31591ae112
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.hs
@@ -0,0 +1,2 @@
+/* APPLE LOCAL file AltiVec */
+/* { dg-options "-faltivec -Wno-long-double" } */
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.c b/gcc/testsuite/gcc.dg/pch/valid-1.c
new file mode 100644
index 00000000000..ebfa85a9949
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-1.c
@@ -0,0 +1,5 @@
+/* { dg-options "-I. -Winvalid-pch -g" } */
+
+#include "valid-1.h"/* { dg-error "created with -gnone, but used with -g|No such file|they were invalid" } */
+
+int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.hs b/gcc/testsuite/gcc.dg/pch/valid-1.hs
new file mode 100644
index 00000000000..e1ed11df4cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-1.hs
@@ -0,0 +1,3 @@
+/* { dg-options "-I. -Winvalid-pch -g0" } */
+
+extern int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1b.c b/gcc/testsuite/gcc.dg/pch/valid-1b.c
new file mode 100644
index 00000000000..a2709967c07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-1b.c
@@ -0,0 +1,5 @@
+/* { dg-options "-I. -Winvalid-pch -g0" } */
+
+#include "valid-1b.h"
+
+int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1b.hs b/gcc/testsuite/gcc.dg/pch/valid-1b.hs
new file mode 100644
index 00000000000..6dc358735a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-1b.hs
@@ -0,0 +1,3 @@
+/* { dg-options "-I. -Winvalid-pch -g" } */
+
+extern int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-2.c b/gcc/testsuite/gcc.dg/pch/valid-2.c
new file mode 100644
index 00000000000..52a2e35a441
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-2.c
@@ -0,0 +1,5 @@
+/* { dg-options "-I. -Winvalid-pch -fexceptions" } */
+
+#include "valid-2.h"/* { dg-error "settings for -fexceptions do not match|No such file|they were invalid" } */
+
+int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-2.hs b/gcc/testsuite/gcc.dg/pch/valid-2.hs
new file mode 100644
index 00000000000..2497af651c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-2.hs
@@ -0,0 +1 @@
+extern int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-3.c b/gcc/testsuite/gcc.dg/pch/valid-3.c
new file mode 100644
index 00000000000..741a917df5d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-3.c
@@ -0,0 +1,5 @@
+/* { dg-options "-I. -Winvalid-pch -fno-unit-at-a-time" } */
+
+#include "valid-3.h"/* { dg-error "settings for -funit-at-a-time do not match|No such file|they were invalid" } */
+
+int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-3.hs b/gcc/testsuite/gcc.dg/pch/valid-3.hs
new file mode 100644
index 00000000000..2a0af94c9f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-3.hs
@@ -0,0 +1,3 @@
+/* { dg-options "-I. -Winvalid-pch -funit-at-a-time" } */
+
+extern int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-4.c b/gcc/testsuite/gcc.dg/pch/valid-4.c
new file mode 100644
index 00000000000..1249531ef67
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-4.c
@@ -0,0 +1,6 @@
+/* { dg-options "-I. -Winvalid-pch -Wtrigraphs" } */
+
+#include "valid-4.h"
+
+char * x = "??/"; /* { dg-error "trigraph" } */
+
diff --git a/gcc/testsuite/gcc.dg/pch/valid-4.hs b/gcc/testsuite/gcc.dg/pch/valid-4.hs
new file mode 100644
index 00000000000..051c720ee3f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-4.hs
@@ -0,0 +1 @@
+extern char * x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-5.c b/gcc/testsuite/gcc.dg/pch/valid-5.c
new file mode 100644
index 00000000000..4022d0458f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-5.c
@@ -0,0 +1,5 @@
+/* { dg-options "-I. -Winvalid-pch -pedantic-errors" } */
+
+#include "valid-5.h"
+
+int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-5.hs b/gcc/testsuite/gcc.dg/pch/valid-5.hs
new file mode 100644
index 00000000000..2497af651c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-5.hs
@@ -0,0 +1 @@
+extern int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-6.c b/gcc/testsuite/gcc.dg/pch/valid-6.c
new file mode 100644
index 00000000000..f111c31ae99
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-6.c
@@ -0,0 +1,5 @@
+/* { dg-options "-I. -Winvalid-pch -dH -pipe -fcond-mismatch" } */
+
+#include "valid-6.h"
+
+int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-6.hs b/gcc/testsuite/gcc.dg/pch/valid-6.hs
new file mode 100644
index 00000000000..2497af651c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pch/valid-6.hs
@@ -0,0 +1 @@
+extern int x;
diff --git a/gcc/testsuite/gcc.dg/reg-vol-struct-1.c b/gcc/testsuite/gcc.dg/reg-vol-struct-1.c
new file mode 100644
index 00000000000..7751bb4a117
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/reg-vol-struct-1.c
@@ -0,0 +1,18 @@
+/* Test cases of structures with volatile fields declared register:
+ should be allowed unless register name given but explicitly taking
+ the address forbidden. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+
+/* { dg-do compile } */
+
+struct S { volatile int field; };
+
+void
+f (void)
+{
+ register struct S a;
+ register struct S b[2];
+ register struct S c __asm__("nosuchreg"); /* { dg-error "object with volatile field" "explicit reg name" } */
+ &a; /* { dg-warning "address of register" "explicit address" } */
+ b; /* { dg-warning "address of register" "implicit address" } */
+}
diff --git a/gcc/testsuite/gcc.dg/spill-1.c b/gcc/testsuite/gcc.dg/spill-1.c
new file mode 100644
index 00000000000..b85942e87aa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/spill-1.c
@@ -0,0 +1,15 @@
+/* This caused an ICE during register spilling when targeting thumb.
+ There are 8 registers available for arithmetic operations (r0-r7)
+ r7 is the frame pointer, and r0-r3 are used to pass arguments.
+ Combine was extending the lives of the arguments (in r0-r3) up until the
+ call to z. This leaves only 3 regs free which isn't enough to preform the
+ doubleword addition. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-omit-frame-pointer" } */
+void z(int);
+int foo(int a, int b, int c, int d, long long *q)
+{
+ *q=*q+1;
+ z (a+b+c+d);
+}
+
diff --git a/gcc/testsuite/gcc.dg/ss/README b/gcc/testsuite/gcc.dg/ss/README
new file mode 100644
index 00000000000..ca8a96a5483
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ss/README
@@ -0,0 +1,17 @@
+APPLE LOCAL entire file
+
+This directory contains tests for Symbol Separation.
+
+Information about various files in this directory:
+
+README : This file
+ss.exp : Driver for Symbol Separation tests
+*.h : Normal header file
+*.ssh : Header file is candidate for making separate
+ repository. This header is included in source
+ file as *.h. It will renamed on the fly during
+ test.
+
+*.c : Normal source file
+*_part_2.c : Second source file associated with corrosponding
+ *.c source file.
diff --git a/gcc/testsuite/gcc.dg/ss/one.c b/gcc/testsuite/gcc.dg/ss/one.c
new file mode 100644
index 00000000000..866177926c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ss/one.c
@@ -0,0 +1,18 @@
+/* APPLE LOCAL entire file */
+/* Copyright (C) 2003 Free Software Foundation.
+ Contributed by Devang Patel <dpatel@apple.com> */
+
+/* Test simple use of symbol repository.
+ Include file one.h is supplied as one.ssh in this directory,
+ so that ss.exp can pick it up as candidate for making
+ repository. */
+/* { dg-do assemble } */
+
+#include "one.h"
+int main ()
+{
+ struct x_y_point a;
+ a.x = 0;
+ a.y = 0;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ss/one.ssh b/gcc/testsuite/gcc.dg/ss/one.ssh
new file mode 100644
index 00000000000..57d77bbf06d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ss/one.ssh
@@ -0,0 +1,13 @@
+/* APPLE LOCAL entire file */
+
+/* Copyright (C) 2003 Free Software Foundation.
+ Contributed by Devang Patel <dpatel@apple.com> */
+
+/* Test simple use of symbol repository.
+ Part of one.c test. */
+
+struct x_y_point
+{
+ int x;
+ int y;
+};
diff --git a/gcc/testsuite/gcc.dg/ss/ss-cmd1.c b/gcc/testsuite/gcc.dg/ss/ss-cmd1.c
new file mode 100644
index 00000000000..167d666f63e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ss/ss-cmd1.c
@@ -0,0 +1,10 @@
+/* APPLE LOCAL entire file */
+/* Copyright (C) 2003 Free Software Foundation.
+ Contributed by Devang Patel <dpatel@apple.com> */
+/* Test command line option -grepository */
+/* { dg-do compile } */
+/* { dg-options "-grepository" } */
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ss/ss.exp b/gcc/testsuite/gcc.dg/ss/ss.exp
new file mode 100644
index 00000000000..b393f973425
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ss/ss.exp
@@ -0,0 +1,235 @@
+# APPLE LOCAL entire file
+# Copyright (C) 1997, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# GCC testsuite for symbol separation interaction,
+# that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+# Get checksum (first field of BINCL and EXCL stab information
+proc get_checksum {input_file search_string} {
+
+ # Regular expression to extract hexadecimal word
+ set hexexp {[0-9a-fA-F]+}
+
+ # Do nm on input_file and grep for search_string
+ catch {exec nm -ap $input_file >& $input_file.nm}
+ catch {exec grep "$search_string" $input_file.nm >& $input_file.grep}
+
+ # Extract dummy-checksum from the grep result (first hexdecimal word)
+ # and save it in RESULT
+ set file_h [open $input_file.grep r]
+ while {[gets $file_h line] >= 0} {
+ # We expect only one line in file_h
+ regexp $hexexp $line RESULT
+ }
+ close $file_h
+
+ # Clean up
+ catch { file delete "$input_file.nm" }
+ catch { file delete "$input_file.grep" }
+
+ # Return check sum
+ return $RESULT
+}
+
+set old_dg_do_what_default "${dg-do-what-default}"
+
+# Main loop.
+foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
+ global runtests torture_without_loops dg-do-what-default
+
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $test] {
+ continue
+ }
+
+ # [file tail name] returns part of name after last /
+ set nshort "$subdir/[file tail $test]"
+ set short_bname "[file rootname [file tail $test]]"
+ set bname "[file rootname $test]"
+ set hexexp {[0-9a-fA-F]+}
+ set ss_exp_debug 0
+
+ catch { file delete "$bname.h" }
+ catch { file delete "$bname.h.cinfo" }
+ catch { file delete "$bname.o" }
+ catch { file delete "$bname.h.o" }
+
+ # We don't try to use the loop-optimizing options, since they are highly
+ # unlikely to make any difference to CINFO.
+ foreach flags $torture_without_loops {
+ verbose "Testing $nshort, $flags" 1
+
+ if {$ss_exp_debug == 1} {
+ puts "ss_exp_debug: various names"
+ puts "ss_exp_debug bname:"; puts $bname
+ puts "ss_exp_debug bname.ssh:"; puts $bname.ssh
+ puts "ss_exp_debug test:"; puts $test
+ puts "ss_exp_debug short_bname:"; puts $short_bname
+ }
+
+ # 1) compile foo.h to create foo.cinfo and foo.h.o
+ if { [ file exists "$bname.ssh" ] } {
+
+ # For the header files, the default is to make repository
+ set dg-do-what-default assemble
+
+ # Header files are supplied using .ssh extension, so that we can
+ # identify candidates for makeing symbol repository. Get header copy
+ # with .h here.
+ file copy -force "$bname.ssh" "$bname.h"
+ file copy -force "$bname.ssh" "$short_bname.h"
+
+ # Make repository
+ # This will create two output files, $short_bname.o and $short_h.cinfo
+ dg-test -keep-output "$bname.h" $flags "-fsave-repository=. "
+
+ if { [ file exists "$short_bname.o" ] } {
+ file rename -force "$short_bname.o" "$bname.h.o"
+
+ # Do nm on $bname.h.o and grep for "BINCL $bname.h"
+ # Extract dummy-checksum from the grep result and save it in RESULT1
+ set RESULT1 [get_checksum $bname.h.o "BINCL $bname.h"]
+
+ if {$ss_exp_debug == 1} {
+ puts "ss_exp_debug: RESULT1"; puts $RESULT1
+ }
+
+ pass "$nshort $flags Make Repository"
+
+ } else {
+ set RESULT1 " "
+ fail "$nshort $flags Make Repository"
+ }
+
+ if { [ file exists "$short_bname.h.cinfo" ] } {
+
+ # 2) compile foo.c to create foo.o
+ dg-test -keep-output $test $flags "-I. -grepository -Winvalid-sr"
+ if { [ file exists "$short_bname.o" ] } {
+
+ # Do nm on $bname.o and grep for "EXCL $bname.h"
+ # Extract dummy-checksum from the grep result and save it in RESULT2
+ set RESULT2 [get_checksum $short_bname.o "EXCL $bname.h"]
+
+ if {$ss_exp_debug == 1} {
+ puts "ss_exp_debug: RESULT2"; puts $RESULT2
+ }
+
+ pass "$nshort $flags Use symbol repository"
+
+ } else {
+ set RESULT2 " "
+ fail "$nshort $flags Use symbol repository YES"
+ }
+
+
+ if { [ file exists "$bname.part_2.c" ] } {
+
+ # 3) compile foo_part_2.c to create foo_part_2.o
+ dg-test -keep-output "$bname_part_2.c" $flags "-I. -grepository"
+ if { [ file exists "$short_bname_part_2.o" ] } {
+
+ # Do nm on $bname_part_2.o and grep for "EXCL $bname.h"
+ # Extract dummy-checksum from the grep result and save it in RESULT3
+ set RESULT3 [get_checksum $short_bname_part_2.o "EXCL $bname.h"]
+
+ if {$ss_exp_debug == 1} {
+ puts "ss_exp_debug: RESULT3"; puts $RESULT3
+ }
+
+ pass "$nshort $flags Use symbol repository"
+
+ } else {
+ set RESULT3 " "
+ fail "$nshort $flags Use symbol repository"
+ }
+
+ # 4) Link foo.h.o foo.o and foo_part_2.o to create foo
+ set dg-do-what-default link
+ dg-test -keep-output "$bname.h.o" "$bname.o" "$bname_part_2.o" "-o $short_bname.out"
+
+ # 5) do 'nm |grep ' on final assembler and save result in RES4
+ # Do nm on $bname.out and grep for "EXCL $bname.h"
+ # Extract dummy-checksum from the grep result and save it in RESULT4
+ set RESULT4 [get_checksum $short_bname.out "EXCL $bname.h"]
+
+ # Do nm on $bname.out and grep for "BINCL $bname.h"
+ # Extract dummy-checksum from the grep result and save it in RESULT5
+ set RESULT5 [get_checksum $short_bname.out "BINCL $bname.h"]
+
+ if {$ss_exp_debug == 1} {
+ puts "ss_exp_debug: RESULT4"; puts $RESULT4
+ puts "ss_exp_debug: RESULT5"; puts $RESULT5
+ }
+
+ pass "$nshort $flags symbol separation: linking"
+
+ } else {
+
+ # If we are not testing second part then set values so that comparison test succeeds
+ set RESULT3 $RESULT2
+ set RESULT4 $RESULT2
+ set RESULT5 $RESULT2
+ if {$ss_exp_debug == 1} {
+ puts "ss_exp_debug: RESULT3"; puts $RESULT3
+ puts "ss_exp_debug: RESULT4"; puts $RESULT4
+ puts "ss_exp_debug: RESULT5"; puts $RESULT5
+ }
+ }
+
+ # 6) Compare RES1 and RES2 and RES3 and RES4
+ if { ( $RESULT1 == $RESULT2 )
+ && ( $RESULT1 == $RESULT3 )
+ && ( $RESULT1 == $RESULT4 ) } {
+ pass "$nshort $flags symbol separation valid use test"
+ } else {
+ fail "$nshort $flags symbol separation valid use test"
+ }
+ if { ( $RESULT1 == $RESULT5 ) } {
+ pass "$nshort $flags symbol separation link test"
+ } else {
+ fail "$nshort $flags symbol separation link test"
+ }
+
+ } else {
+ fail "$nshort $flags Make repository"
+ }
+ } else {
+
+ # Normal test
+ set dg-do-what-default compile
+ dg-test -keep-output $test $flags "-I."
+ }
+
+ # Clean up
+ catch { file delete "$bname.h" }
+ catch { file delete "$bname.h.cinfo" }
+ catch { file delete "$bname.o" }
+ catch { file delete "$bname.h.o" }
+ }
+}
+
+set dg-do-what-default "$old_dg_do_what_default"
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c b/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
new file mode 100644
index 00000000000..ac671590d20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
@@ -0,0 +1,138 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Verify that built-in math function conversion to smaller FP types
+ is correctly performed by the compiler.
+
+ Written by Kaveh Ghazi, 2004-03-17. */
+
+/* { dg-do link } */
+/* { dg-options "-ffast-math" } */
+
+#include "../builtins-config.h"
+
+/* This check is necessary when converting to a C99 function. */
+#ifdef HAVE_C99_RUNTIME
+#define C99CODE(CODE) (CODE)
+#define MAYBEC99(CODE, C99) (CODE)
+#else
+#define C99CODE(CODE) 0
+#define MAYBEC99(CODE, C99) (!(C99) && (CODE))
+#endif
+
+#define PROTOTYPE1(FN) extern double FN(double); extern float FN##f(float); \
+ extern long double FN##l(long double);
+
+void test(double d1, float f1, long double ld1)
+{
+ /* Test converting math builtins to narrower FP types based on a
+ narrowing cast on the outside of the call. MATHFN is the
+ function to test, and C99 is 0/1 depending on whether the
+ `double' version of MATHFN is a C99 function. The optimization
+ is only performed if the replacement function is actually
+ narrower in width, so check that first. */
+#define OUTER_CAST1(MATHFN, C99) \
+ PROTOTYPE1 (MATHFN) \
+ extern void link_failure_outer_##MATHFN##l_##MATHFN##_1(void); \
+ extern void link_failure_outer_##MATHFN##l_##MATHFN##_2(void); \
+ extern void link_failure_outer_##MATHFN##l_##MATHFN##f_1(void); \
+ extern void link_failure_outer_##MATHFN##l_##MATHFN##f_2(void); \
+ extern void link_failure_outer_##MATHFN##_##MATHFN##f_1(void); \
+ extern void link_failure_outer_##MATHFN##_##MATHFN##f_2(void); \
+ if (sizeof (long double) > sizeof (double) \
+ && MAYBEC99 ((double) MATHFN##l((double)ld1) != MATHFN(ld1), C99)) \
+ link_failure_outer_##MATHFN##l_##MATHFN##_1(); \
+ if (sizeof (long double) > sizeof (double) \
+ && MAYBEC99 ((double) MATHFN##l(d1) != MATHFN(d1), C99)) \
+ link_failure_outer_##MATHFN##l_##MATHFN##_1(); \
+ if (sizeof (long double) > sizeof (double) \
+ && MAYBEC99 ((double) MATHFN##l(f1) != MATHFN(f1), C99)) \
+ link_failure_outer_##MATHFN##l_##MATHFN##_2(); \
+ if (sizeof (long double) > sizeof (float) \
+ && C99CODE ((float) MATHFN##l((float) ld1) != MATHFN##f(ld1))) \
+ link_failure_outer_##MATHFN##l_##MATHFN##f_1(); \
+ if (sizeof (long double) > sizeof (float) \
+ && C99CODE ((float) MATHFN##l((float) d1) != MATHFN##f(d1))) \
+ link_failure_outer_##MATHFN##l_##MATHFN##f_1(); \
+ if (sizeof (long double) > sizeof (float) \
+ && C99CODE ((float) MATHFN##l(f1) != MATHFN##f(f1))) \
+ link_failure_outer_##MATHFN##l_##MATHFN##f_2(); \
+ if (sizeof (double) > sizeof (float) \
+ && C99CODE ((float) MATHFN((float) ld1) != MATHFN##f(ld1))) \
+ link_failure_outer_##MATHFN##_##MATHFN##f_1(); \
+ if (sizeof (double) > sizeof (float) \
+ && C99CODE ((float) MATHFN((float) d1) != MATHFN##f(d1))) \
+ link_failure_outer_##MATHFN##_##MATHFN##f_1(); \
+ if (sizeof (double) > sizeof (float) \
+ && C99CODE ((float) MATHFN(f1) != MATHFN##f(f1))) \
+ link_failure_outer_##MATHFN##_##MATHFN##f_2()
+
+ /* Test converting math builtins to narrower FP types based on if
+ the argument is a narrower type (perhaps implicitly) cast to a
+ wider one. */
+#define INNER_CAST1(MATHFN, C99) \
+ PROTOTYPE1 (MATHFN) \
+ extern void link_failure_inner_##MATHFN##l_##MATHFN(void); \
+ extern void link_failure_inner_##MATHFN##l_##MATHFN##f(void); \
+ extern void link_failure_inner_##MATHFN##_##MATHFN##f(void); \
+ if (sizeof (long double) > sizeof (double) \
+ && MAYBEC99 (MATHFN##l(d1) != (long double) MATHFN(d1), C99)) \
+ link_failure_inner_##MATHFN##l_##MATHFN(); \
+ if (sizeof (long double) > sizeof (float) \
+ && C99CODE (MATHFN##l(f1) != (long double) MATHFN##f(f1))) \
+ link_failure_inner_##MATHFN##l_##MATHFN##f(); \
+ if (sizeof (long double) > sizeof (float) \
+ && C99CODE (MATHFN##l((double)f1) != (long double) MATHFN##f(f1))) \
+ link_failure_inner_##MATHFN##l_##MATHFN##f(); \
+ if (sizeof (double) > sizeof (float) \
+ && C99CODE (MATHFN(f1) != (double) MATHFN##f(f1))) \
+ link_failure_inner_##MATHFN##_##MATHFN##f()
+
+
+#ifdef __OPTIMIZE__
+ OUTER_CAST1 (acos, /*C99=*/ 0);
+ OUTER_CAST1 (acosh, /*C99=*/ 1);
+ OUTER_CAST1 (asin, /*C99=*/ 1);
+ OUTER_CAST1 (asinh, /*C99=*/ 1);
+ OUTER_CAST1 (atan, /*C99=*/ 0);
+ OUTER_CAST1 (atanh, /*C99=*/ 1);
+ OUTER_CAST1 (cbrt, /*C99=*/ 1);
+ OUTER_CAST1 (cos, /*C99=*/ 0);
+ OUTER_CAST1 (cosh, /*C99=*/ 0);
+ OUTER_CAST1 (erf, /*C99=*/ 1);
+ OUTER_CAST1 (erfc, /*C99=*/ 1);
+ OUTER_CAST1 (exp, /*C99=*/ 0);
+ OUTER_CAST1 (exp2, /*C99=*/ 1);
+ OUTER_CAST1 (expm1, /*C99=*/ 1);
+ OUTER_CAST1 (fabs, /*C99=*/ 0);
+ OUTER_CAST1 (lgamma, /*C99=*/ 1);
+ OUTER_CAST1 (log, /*C99=*/ 0);
+ OUTER_CAST1 (log10, /*C99=*/ 0);
+ OUTER_CAST1 (log1p, /*C99=*/ 1);
+ OUTER_CAST1 (log2, /*C99=*/ 1);
+ OUTER_CAST1 (logb, /*C99=*/ 1);
+ OUTER_CAST1 (sin, /*C99=*/ 0);
+ OUTER_CAST1 (sinh, /*C99=*/ 0);
+ OUTER_CAST1 (sqrt, /*C99=*/ 0);
+ OUTER_CAST1 (tan, /*C99=*/ 0);
+ OUTER_CAST1 (tanh, /*C99=*/ 0);
+ OUTER_CAST1 (tgamma, /*C99=*/ 1);
+
+ INNER_CAST1 (ceil, /*C99=*/ 0);
+ OUTER_CAST1 (ceil, /*C99=*/ 0);
+ INNER_CAST1 (floor, /*C99=*/ 0);
+ OUTER_CAST1 (floor, /*C99=*/ 0);
+ INNER_CAST1 (nearbyint, /*C99=*/ 1);
+ OUTER_CAST1 (nearbyint, /*C99=*/ 1);
+ INNER_CAST1 (rint, /*C99=*/ 1);
+ OUTER_CAST1 (rint, /*C99=*/ 1);
+ INNER_CAST1 (round, /*C99=*/ 1);
+ OUTER_CAST1 (round, /*C99=*/ 1);
+ INNER_CAST1 (trunc, /*C99=*/ 1);
+ OUTER_CAST1 (trunc, /*C99=*/ 1);
+#endif /* __OPTIMIZE__ */
+}
+
+int main (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-ctype-1.c b/gcc/testsuite/gcc.dg/torture/builtin-ctype-1.c
new file mode 100644
index 00000000000..ad6fc1c60b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-ctype-1.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Verify that built-in ctype function attributes are correctly set by
+ the compiler.
+
+ Written by Kaveh Ghazi, 2004-03-23. */
+
+/* { dg-do link } */
+
+
+void test(int i)
+{
+ /* All of these ctype functions should be const/pure and thus
+ eliminated. */
+#define TEST_CTYPE(FN) \
+ extern int FN(int); \
+ extern void link_failure_##FN(void); \
+ if (FN(i) != FN(i)) \
+ link_failure_##FN()
+
+#ifdef __OPTIMIZE__
+ TEST_CTYPE(isalnum);
+ TEST_CTYPE(isalpha);
+ TEST_CTYPE(isascii);
+ TEST_CTYPE(isblank);
+ TEST_CTYPE(iscntrl);
+ TEST_CTYPE(isdigit);
+ TEST_CTYPE(isgraph);
+ TEST_CTYPE(islower);
+ TEST_CTYPE(isprint);
+ TEST_CTYPE(ispunct);
+ TEST_CTYPE(isspace);
+ TEST_CTYPE(isupper);
+ TEST_CTYPE(isxdigit);
+ TEST_CTYPE(toascii);
+ TEST_CTYPE(tolower);
+ TEST_CTYPE(toupper);
+#endif /* __OPTIMIZE__ */
+}
+
+int main (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-ctype-2.c b/gcc/testsuite/gcc.dg/torture/builtin-ctype-2.c
new file mode 100644
index 00000000000..7046aad6562
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-ctype-2.c
@@ -0,0 +1,107 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Verify that built-in ctype transformations are done correctly by
+ the compiler.
+
+ Written by Kaveh Ghazi, 2004-04-05. */
+
+/* { dg-do link } */
+
+extern void link_failure_var(void);
+
+void test(int i)
+{
+ /* All of these ctype calls should compile-time evaluate to true. */
+#define TEST_CTYPE_CST_TRUE(FN, VALUE) \
+ extern void link_failure_##FN##_cst_true(void); \
+ extern int FN(int); \
+ if (! FN(VALUE)) \
+ link_failure_##FN##_cst_true()
+
+ /* All of these ctype calls should compile-time evaluate to false. */
+#define TEST_CTYPE_CST_FALSE(FN, VALUE) \
+ extern void link_failure_##FN##_cst_false(void); \
+ extern int FN(int); \
+ if (FN(VALUE)) \
+ link_failure_##FN##_cst_false()
+
+ /* All of these ctype calls should compile-time evaluate to true. */
+#define TEST_TOCTYPE_CST_TRUE(FN, VALUE) \
+ extern void link_failure_##FN##_cst_true(void); \
+ extern int FN(int); \
+ if (FN(VALUE) != (VALUE)) \
+ link_failure_##FN##_cst_true()
+
+ /* All of these ctype calls should compile-time evaluate to false. */
+#define TEST_TOCTYPE_CST_FALSE(FN, VALUE) \
+ extern void link_failure_##FN##_cst_false(void); \
+ extern int FN(int); \
+ if (FN(VALUE) == (VALUE)) \
+ link_failure_##FN##_cst_false()
+
+#ifdef __OPTIMIZE__
+ TEST_CTYPE_CST_TRUE (isascii, 0);
+ TEST_CTYPE_CST_TRUE (isascii, 1);
+ TEST_CTYPE_CST_TRUE (isascii, 126);
+ TEST_CTYPE_CST_TRUE (isascii, 127);
+
+ TEST_CTYPE_CST_FALSE (isascii, -1);
+ TEST_CTYPE_CST_FALSE (isascii, 128);
+ TEST_CTYPE_CST_FALSE (isascii, 129);
+ TEST_CTYPE_CST_FALSE (isascii, 255);
+ TEST_CTYPE_CST_FALSE (isascii, 256);
+ TEST_CTYPE_CST_FALSE (isascii, 257);
+ TEST_CTYPE_CST_FALSE (isascii, 10000);
+ TEST_CTYPE_CST_FALSE (isascii, __INT_MAX__);
+
+ /* This ctype call should transform into another expression. */
+ if (isascii(i) != ((i & ~0x7f) == 0))
+ link_failure_var();
+
+ TEST_TOCTYPE_CST_TRUE (toascii, 0);
+ TEST_TOCTYPE_CST_TRUE (toascii, 1);
+ TEST_TOCTYPE_CST_TRUE (toascii, 126);
+ TEST_TOCTYPE_CST_TRUE (toascii, 127);
+
+ TEST_TOCTYPE_CST_FALSE (toascii, -1);
+ TEST_TOCTYPE_CST_FALSE (toascii, 128);
+ TEST_TOCTYPE_CST_FALSE (toascii, 129);
+ TEST_TOCTYPE_CST_FALSE (toascii, 255);
+ TEST_TOCTYPE_CST_FALSE (toascii, 256);
+ TEST_TOCTYPE_CST_FALSE (toascii, 10000);
+ TEST_TOCTYPE_CST_FALSE (toascii, __INT_MAX__);
+
+ /* This ctype call should transform into another expression. */
+ if (toascii(i) != (i & 0x7f))
+ link_failure_var();
+
+ TEST_CTYPE_CST_TRUE (isdigit, '0');
+ TEST_CTYPE_CST_TRUE (isdigit, '1');
+ TEST_CTYPE_CST_TRUE (isdigit, '2');
+ TEST_CTYPE_CST_TRUE (isdigit, '3');
+ TEST_CTYPE_CST_TRUE (isdigit, '4');
+ TEST_CTYPE_CST_TRUE (isdigit, '5');
+ TEST_CTYPE_CST_TRUE (isdigit, '6');
+ TEST_CTYPE_CST_TRUE (isdigit, '7');
+ TEST_CTYPE_CST_TRUE (isdigit, '8');
+ TEST_CTYPE_CST_TRUE (isdigit, '9');
+
+ TEST_CTYPE_CST_FALSE (isdigit, '0'-1);
+ TEST_CTYPE_CST_FALSE (isdigit, '9'+1);
+ TEST_CTYPE_CST_FALSE (isdigit, -1);
+ TEST_CTYPE_CST_FALSE (isdigit, 0);
+ TEST_CTYPE_CST_FALSE (isdigit, 255);
+ TEST_CTYPE_CST_FALSE (isdigit, 256);
+ TEST_CTYPE_CST_FALSE (isdigit, 10000);
+ TEST_CTYPE_CST_FALSE (isdigit, __INT_MAX__);
+
+ /* This ctype call should transform into another expression. */
+ if (isdigit(i) != ((unsigned)i - '0' <= 9))
+ link_failure_var();
+#endif /* __OPTIMIZE__ */
+}
+
+int main (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-power-1.c b/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
new file mode 100644
index 00000000000..45566118a81
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
@@ -0,0 +1,105 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Verify that built-in folding of various math "power" functions is
+ correctly performed by the compiler.
+
+ Written by Kaveh Ghazi, 2004-03-11. */
+
+/* { dg-do link } */
+/* { dg-options "-ffast-math" } */
+
+#include "../builtins-config.h"
+
+#ifdef HAVE_C99_RUNTIME
+#define C99CODE(CODE) CODE
+#else
+#define C99CODE(CODE) 0
+#endif
+
+#define PROTOTYPE(FN) extern double FN(double); extern float FN##f(float); \
+ extern long double FN##l(long double);
+#define PROTOTYPE2(FN) extern double FN(double, double); \
+ extern float FN##f(float, float); \
+ extern long double FN##l(long double, long double);
+
+PROTOTYPE(sqrt)
+PROTOTYPE(cbrt)
+PROTOTYPE2(pow)
+
+void test(double d1, double d2, double d3,
+ float f1, float f2, float f3,
+ long double ld1, long double ld2, long double ld3)
+{
+ /* Test N1root(N2root(x)) -> pow(x,1/(N1*N2)). */
+ /* E.g. sqrt(cbrt(x)) -> pow(x,1/6). */
+#define ROOT_ROOT(FN1,N1,FN2,N2) \
+ extern void link_failure_##FN1##_##FN2(void); \
+ if (FN1(FN2(d1)) != pow(d1,1.0/(N1*N2)) \
+ || C99CODE (FN1##f(FN2##f(f1)) != powf(f1,1.0F/(N1*N2))) \
+ || C99CODE (FN1##l(FN2##l(ld1)) != powl(ld1,1.0L/(N1*N2)))) \
+ link_failure_##FN1##_##FN2()
+
+ ROOT_ROOT(sqrt,2,sqrt,2);
+ ROOT_ROOT(sqrt,2,cbrt,3);
+ ROOT_ROOT(cbrt,3,sqrt,2);
+ /*ROOT_ROOT(cbrt,3,cbrt,3); Intentionally not implemented. */
+
+ /* Test pow(Nroot(x),y) -> pow(x,y/N). */
+#define POW_ROOT(FN,N) \
+ extern void link_failure_pow_##FN(void); \
+ if (pow(FN(d1), d2) != pow(d1,d2/N) \
+ || powf(FN##f(f1),f2) != powf(f1,f2/N) \
+ || powl(FN##l(ld1),ld2) != powl(ld1,ld2/N)) \
+ link_failure_pow_##FN()
+
+ POW_ROOT(sqrt,2);
+ /*POW_ROOT(cbrt,3); Intentionally not implemented. */
+
+ /* Test Nroot(pow(x,y)) -> pow(x,y/N). */
+#define ROOT_POW(FN,N) \
+ extern void link_failure_##FN##_pow(void); \
+ if (FN(pow(d1, d2)) != pow(d1,d2/N) \
+ || FN##f(powf(f1,f2)) != powf(f1,f2/N) \
+ || FN##l(powl(ld1,ld2)) != powl(ld1,ld2/N)) \
+ link_failure_##FN##_pow()
+
+ ROOT_POW(sqrt,2);
+ /*ROOT_POW(cbrt,3); Intentionally not implemented. */
+
+ /* Test pow(pow(x,y),z) -> pow(x,y*z). */
+#define POW_POW \
+ extern void link_failure_pow_pow(void); \
+ if (pow(pow(d1, d2), d3) != pow(d1,d2*d3) \
+ || powf(powf(f1,f2),f3) != powf(f1,f2*f3) \
+ || powl(powl(ld1,ld2),ld3) != powl(ld1,ld2*ld3)) \
+ link_failure_pow_pow()
+
+ POW_POW;
+
+ /* Test Nroot(x)*Nroot(y) -> Nroot(x*y). */
+#define ROOT_X_ROOT(FN) \
+ extern void link_failure_root_x_root(void); \
+ if (FN(d1)*FN(d2) != FN(d1*d2) \
+ || FN##f(f1)*FN##f(f2) != FN##f(f1*f2) \
+ || FN##l(ld1)*FN##l(ld2) != FN##l(ld1*ld2)) \
+ link_failure_root_x_root()
+
+ ROOT_X_ROOT(sqrt);
+ ROOT_X_ROOT(cbrt);
+
+ /* Test pow(x,y)*pow(x,z) -> pow(x,y+z). */
+#define POW_X_POW \
+ extern void link_failure_pow_x_pow(void); \
+ if (pow(d1,d2)*pow(d1,d3) != pow(d1,d2+d3) \
+ || powf(f1,f2)*powf(f1,f3) != powf(f1,f2+f3) \
+ || powl(ld1,ld2)*powl(ld1,ld3) != powl(ld1,ld2+ld3)) \
+ link_failure_pow_x_pow()
+
+ POW_X_POW;
+
+}
+
+int main (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c b/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c
new file mode 100644
index 00000000000..b8338de0bd1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Verify that built-in wctype function attributes are correctly set
+ by the compiler.
+
+ Written by Kaveh Ghazi, 2004-03-25. */
+
+/* { dg-do link } */
+
+
+void test(int i)
+{
+ /* All of these ctype functions should be const/pure and thus
+ eliminated. */
+#define TEST_CTYPE(FN) \
+ extern int FN(int); \
+ extern void link_failure_##FN(void); \
+ if (FN(i) != FN(i)) \
+ link_failure_##FN()
+
+#ifdef __OPTIMIZE__
+ TEST_CTYPE(iswalnum);
+ TEST_CTYPE(iswalpha);
+ TEST_CTYPE(iswblank);
+ TEST_CTYPE(iswcntrl);
+ TEST_CTYPE(iswdigit);
+ TEST_CTYPE(iswgraph);
+ TEST_CTYPE(iswlower);
+ TEST_CTYPE(iswprint);
+ TEST_CTYPE(iswpunct);
+ TEST_CTYPE(iswspace);
+ TEST_CTYPE(iswupper);
+ TEST_CTYPE(iswxdigit);
+ TEST_CTYPE(towlower);
+ TEST_CTYPE(towupper);
+#endif /* __OPTIMIZE__ */
+}
+
+int main (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/20040216-1.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/20040216-1.c
new file mode 100644
index 00000000000..f4ac534bcc7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/20040216-1.c
@@ -0,0 +1,26 @@
+/* Test dependence graph. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fscalar-evolutions -ftree-ddg -c -fdump-tree-all" } */
+
+#define N 16
+void bar(int *);
+void foo()
+{
+ int i,j;
+ int A[N];
+ int X[N];
+ int Y[N];
+ int Z[N];
+
+ for (i=2; i<9; i++)
+ {
+ X[i] = Y[i] + Z[i];
+ A[i] = X[i-1] + 1;
+ }
+
+ bar (A);
+}
+
+/* Find 4 Dependence nodes */
+/* { dg-final { scan-tree-dump-times "Dependence Node" 4 "ddg"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c
new file mode 100644
index 00000000000..f293f9b8c37
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int main(void)
+{
+ unsigned a;
+ int b;
+ int c;
+
+ /* loop_1 runs exactly 4 times. */
+ for (a = 22; a < 50; a+=1)
+ {
+ /* loop_2 runs exactly 6 times. On exit, the variable B is equal to 53. */
+ for (b = 23; b < 50; b+=5)
+ {
+ ++a;
+
+ /* loop_3 runs {{77, +, -7}_1, +, -1}_2 times. */
+ for (c = a; c < 100; c++)
+ {
+
+ }
+ }
+ }
+}
+
+/* The analyzer has to detect the following evolution functions:
+ b -> {23, +, 5}_2
+ a -> {{22, +, 7}_1, +, 1}_2
+ c -> {{{23, +, 7}_1, +, 1}_2, +, 1}_3
+*/
+/* { dg-final { scan-tree-dump-times "nb_iterations 4" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 6" 1 "scev"} } */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c
new file mode 100644
index 00000000000..4baecaceb1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int main(void)
+{
+ int a;
+ int b;
+ int *c;
+
+ /* The following loop runs exactly 3 times. */
+ for (a = 11; a < 50; a++)
+ {
+ /* The following loop runs exactly 9 times. */
+ for (b = 8; b < 50; b+=5)
+ {
+ c[a + 5] = 5;
+ c[b] = 6;
+ a+=2;
+ }
+ }
+}
+
+/* The analyzer has to detect the following evolution functions:
+ b -> {8, +, 5}_2
+ a -> {{11, +, 19}_1, +, 2}_2
+*/
+/* { dg-final { scan-tree-dump-times "nb_iterations 3" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 9" 1 "scev"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-03.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-03.c
new file mode 100644
index 00000000000..9b681273c15
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-03.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-stats" } */
+
+
+int main(void)
+{
+ int a;
+ int b;
+ int *c;
+
+ /* loop_1 runs exactly 5 times. */
+ for (a = 11; a < 50; a++)
+ {
+ /* loop_2 runs exactly 7 times. */
+ for (b = 8; b < 50; b+=5)
+ {
+ c[a++] = 5;
+ c[b++] = 6;
+ }
+ }
+}
+
+/* The analyzer has to detect the following evolution functions:
+ b -> {8, +, 6}_2
+ a -> {{11, +, 8}_1, +, 1}_2
+*/
+/* { dg-final { scan-tree-dump-times "nb_iterations 5" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 7" 1 "scev"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-04.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-04.c
new file mode 100644
index 00000000000..99986cfdbc6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-04.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -ftree-elim-checks -fdump-tree-scev-details -fdump-tree-elck-details -fdump-tree-optimized" } */
+
+void remove_me (void);
+
+int main(void)
+{
+ int a;
+ int b = 22;
+
+ /* loop_1 runs exactly 28 times. */
+ for (a = 22; a < 50; a++) /* a -> {22, +, 1}_1 */
+ {
+ if (a > b) /* This condition is always false. */
+ remove_me ();
+ b = b + 2; /* b -> {22, +, 2}_1 */
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "nb_iterations 28" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-05.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-05.c
new file mode 100644
index 00000000000..cb02875e674
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-05.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main(void)
+{
+ int a;
+ int b;
+ int c;
+
+ /* nb_iterations 28 */
+ for (a = 22; a < 50; a++)
+ {
+ /* nb_iterations 6 */
+ for (b = 23; b < 50; b+=5)
+ {
+ /* nb_iterations {78, +, -1}_1 */
+ for (c = a; c < 100; c++)
+ {
+
+ }
+ }
+ }
+}
+
+/* The analyzer has to detect the following evolution functions:
+ a -> {22, +, 1}_1
+ b -> {23, +, 5}_2
+ c -> {{22, +, 1}_1, +, 1}_3
+*/
+/* { dg-final { scan-tree-dump-times "nb_iterations 28" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 6" 1 "scev"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-06.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-06.c
new file mode 100644
index 00000000000..7d720c94f2b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-06.c
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -ftree-elim-checks -fdump-tree-scev-details -fdump-tree-optimized" } */
+
+void remove_me (void);
+
+int main(void)
+{
+ int a;
+ int b;
+ int c;
+
+ /* loop_1 runs 2 times. */
+ for (a = 22; a < 83; a+=1) /* a -> {22, +, 60}_1 */
+ {
+ c = a;
+
+ /* loop_2 runs exactly 6 times. */
+ for (b = 23; b < 50; b+=5) /* b -> {23, +, 5}_2 */
+ {
+ ++a;
+ }
+ /* The following stmt exercises the value of B on the exit of the loop.
+ In this case the value of B out of the loop is that of the evolution
+ function of B applied to the number of iterations the inner loop_2 runs.
+ Value (B) = {23, +, 5}_2 (6) = 53. */
+
+ /* At this point, the variable A has the evolution function:
+ {{22, +, 6}_1, +, 1}_2. */
+ if (b != 53
+ || a != c + 6)
+ remove_me ();
+
+ a = a + b;
+ /* At this point, the variable A has the evolution function:
+ {{22, +, 59}_1, +, 1}_2. The evolution of the variable B in
+ the loop_2 does not matter, and is not recorded in the
+ evolution of A. The above statement is equivalent to:
+ "a = a + 53", ie. the scalar value of B on exit of the loop_2. */
+
+ if (a != c + 59)
+ remove_me ();
+
+ /* And finally the a+=1 from the FOR_STMT produces the evolution
+ function: {{22, +, 60}_1, +, 1}_2. */
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "nb_iterations 2" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 6" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-07.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-07.c
new file mode 100644
index 00000000000..8cc619a6f47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-07.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-elim-checks -fdump-tree-optimized" } */
+
+void remove_me (void);
+
+int main(void)
+{
+ int a = -100;
+ int b = 2;
+ int d = -1;
+ int e = -100;
+
+ while (a)
+ {
+ /* Exercises higher order polynomials. */
+ a = a + b; /* a -> {-100, +, {2, +, 3}_1}_1 */
+ b = b + 3; /* b -> {2, +, 3}_1 */
+
+ d = d + 3; /* d -> {-1, +, 3}_1 */
+ e = e + d; /* e -> {-100, +, {2, +, 3}_1}_1 */
+
+ if (a != e) /* a -> {-98, +, {5, +, 3}_1}_1 */
+ remove_me ();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-08.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-08.c
new file mode 100644
index 00000000000..3d6eb7ba3b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-08.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-elim-checks -fdump-tree-optimized" } */
+
+void remove_me (void);
+
+int main(void)
+{
+ int a = -100;
+ int b = 2;
+ int c = 3;
+ int d = -5;
+ int e = 3;
+ int f = -100;
+
+ while (a)
+ {
+ /* Exercises higher order polynomials. */
+ a = a + b; /* a -> {-100, +, 2, +, 3, +, 4}_1 */
+ b = b + c; /* b -> {2, +, 3, +, 4}_1 */
+ c = c + 4; /* c -> {3, +, 4}_1 */
+
+ d = d + 4; /* d -> {-5, +, 4}_1 */
+ e = e + d; /* e -> {3, +, -1, +, 4}_1 */
+ f = f + e; /* f -> {-100, +, 2, +, 3, +, 4}_1 */
+
+ if (a != f) /* (a == f) -> {-98, +, 5, +, 7, +, 4}_1 */
+ remove_me ();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-09.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-09.c
new file mode 100644
index 00000000000..9964a6d30c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-09.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int main(void)
+{
+ int a = -100;
+ int b = 2;
+ int c = 3;
+ int d = 4;
+ int e = 5;
+
+ while (a)
+ {
+ /* Exercises the cycle detector: a -> b -> (c -> d -> e -> c)*. */
+ a += b;
+ b += c;
+ c += d;
+ d += e;
+ e += c;
+ }
+}
+
+/* This is what is commonly called a "mixer". It whirls the data in a
+ strongly connected component. We expect the following evolution
+ functions:
+
+ e -> {5, +, c_13}_1
+ d -> {4, +, {5, +, c_13}_1}_1
+ c -> {3, +, {4, +, {5, +, c_13}_1}_1}_1
+ b -> {2, +, {3, +, {4, +, {5, +, c_13}_1}_1}_1}_1
+ a -> {-100, +, {2, +, {3, +, {4, +, {5, +, c_13}_1}_1}_1}_1}_1
+*/
+
+/* FIXME:
+ For the moment this testcase does not test for anything, but for
+ not ICEing, and for documentation purposes (okay here is the
+ definition of a mixer). However, I'm considering testing something
+ around the lines of ssa-chrec-08.c, ie. build two mixers, and then
+ compare their values. But that is difficult, and low priority. */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c
new file mode 100644
index 00000000000..649dfb0b2d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev -fall-data-deps -fdump-tree-ddall" } */
+
+void bar (int);
+
+int foo (void)
+{
+ int a;
+ int x;
+ int c[100][100];
+
+ /* loop_1 runs 39 times. */
+ for (a = 11; a < 50; a++)
+ {
+ /* Array access functions have to be analyzed. */
+ x = a + 5;
+ c[x][a+1] = c[x+2][a+3] + c[x-1][a+2];
+ }
+ bar (c[1][2]);
+}
+
+/* The analyzer has to detect the scalar functions:
+ a -> {11, +, 1}_1
+ x -> {16, +, 1}_1
+ x+2 -> {18, +, 1}_1
+ x-1 -> {15, +, 1}_1
+*/
+
+/* { dg-final { scan-tree-dump-times "nb_iterations 39" 1 "scev"} } */
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c.ddall
new file mode 100644
index 00000000000..5bf0e92b185
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c.ddall
@@ -0,0 +1,215 @@
+
+;; Function foo (foo)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {14, +, 1}_1
+ access_fn_B: {14, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {18, +, 1}_1
+ access_fn_B: {18, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1): (no dependence)
+
+)
+(Data Dep (A = 0, B = 2):
+ (subscript 0:
+ access_fn_A: {14, +, 1}_1
+ access_fn_B: {12, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {2, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {18, +, 1}_1
+ access_fn_B: {16, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {2, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(2
+)
+(2
+)
+ )
+ (Direction Vector:
+(+)
+(+)
+ )
+
+)
+(Data Dep (A = 0, B = 3): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0): (no dependence)
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {13, +, 1}_1
+ access_fn_B: {13, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {15, +, 1}_1
+ access_fn_B: {15, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2): (no dependence)
+
+)
+(Data Dep (A = 1, B = 3): (no dependence)
+
+)
+(Data Dep (A = 2, B = 0):
+ (subscript 0:
+ access_fn_A: {12, +, 1}_1
+ access_fn_B: {14, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {2, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {16, +, 1}_1
+ access_fn_B: {18, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {2, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-2
+)
+(-2
+)
+ )
+ (Direction Vector:
+(-)
+(-)
+ )
+
+)
+(Data Dep (A = 2, B = 1): (no dependence)
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: {12, +, 1}_1
+ access_fn_B: {12, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {16, +, 1}_1
+ access_fn_B: {16, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 2, B = 3): (no dependence)
+
+)
+(Data Dep (A = 3, B = 0): (no dependence)
+
+)
+(Data Dep (A = 3, B = 1): (no dependence)
+
+)
+(Data Dep (A = 3, B = 2): (no dependence)
+
+)
+(Data Dep (A = 3, B = 3):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 1
+ access_fn_B: 1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-11.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-11.c
new file mode 100644
index 00000000000..b68b3d5bf1f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-11.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main(void)
+{
+ int a = -100;
+ int b = 2;
+
+ int f = 6;
+ int g = 7;
+ int h = 8;
+
+ /* Exercises complex loop exit conditions.
+ FIXME: This is a strange case where the compiler cc1 and the wrapper gcc
+ don't produce the same representation:
+
+ (with gcc from command line)
+
+ T.1_9 = f_2 | a_1;
+ if (T.1_9 == 0)
+ {
+ goto <UL47e0>;
+ }
+
+ versus (with cc1 called from gdb):
+
+ if (f_2 == 0)
+ {
+ if (a_1 == 0)
+ {
+ goto <ULc7e0>;
+ }
+ else
+ {
+ (void)0
+ }
+ }
+ else
+ {
+ (void)0
+ };
+ */
+ while (f || a)
+ {
+ a += b;
+
+ f += g;
+ g += h;
+ }
+}
+
+/*
+ g -> {7, +, 8}_1
+ f -> {6, +, {7, +, 8}_1}_1
+ a -> {-100, +, 2}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-12.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-12.c
new file mode 100644
index 00000000000..ab43eaf0a1a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-12.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo ()
+{
+ int a = -100;
+ int b = 2;
+ int c = 3;
+ int d = 4;
+
+ while (a)
+ {
+ a = a + b;
+
+ /* Exercises if-phi-nodes. */
+ if (bar ())
+ b = b + c;
+
+ c = c + d;
+ }
+}
+
+/* The analyzer has to detect the following evolution functions:
+ c -> {3, +, 4}_1
+ b -> {2, +, {[0, 3], +, [0, 4]}_1}_1
+ a -> {-100, +, {2, +, {[0, 3], +, [0, 4]}_1}_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-13.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-13.c
new file mode 100644
index 00000000000..37fba692f27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-13.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int foo (void);
+
+int main (void)
+{
+ int a = -100;
+ int b = 2;
+ int c = 3;
+
+ while (a)
+ {
+ /* Exercises if-phi-nodes. */
+ if (foo ())
+ a += b;
+ else
+ a += c;
+
+ b++;
+ c++;
+ }
+}
+
+/* The analyzer has to detect the following evolution function:
+ a -> {-100, +, {[2, 3], +, 1}_1}_1
+*/
+
+/* FIXME. */
+
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-14.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-14.c
new file mode 100644
index 00000000000..e541160ebb6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-14.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int foo (void);
+
+int main (void)
+{
+ int a = -100;
+ int b = 2;
+ int c = 3;
+ int d = 4;
+
+ while (d)
+ {
+ if (foo ())
+ a += b;
+ else
+ a += c;
+
+ b += 1;
+ c += 5;
+
+ /* Exercises the initial condition of A after the if-phi-node. */
+ d = d + a;
+ }
+}
+
+/* The analyzer has to detect the following evolution function:
+ b -> {2, +, 1}_1
+ c -> {3, +, 5}_1
+ a -> {-100, +, {[2, 3], +, [1, 5]}_1}_1
+ d -> {4, +, {[-98, -97], +, {[2, 3], +, [1, 5]}_1}_1}_1
+*/
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-15.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-15.c
new file mode 100644
index 00000000000..e56a7dd91b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-15.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main (void)
+{
+ int a;
+ int b;
+ int c;
+
+ /* Exercises the MINUS_EXPR. loop_1 runs 50 times. */
+ for (a = 100; a > 50; a--)
+ {
+
+ }
+}
+
+/* The analyzer has to detect the following evolution function:
+ a -> {100, +, -1}_1
+*/
+
+/* { dg-final { scan-tree-dump-times "nb_iterations 50" 1 "scev"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-16.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-16.c
new file mode 100644
index 00000000000..b2c26348dc0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-16.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main (void)
+{
+ int a = -100;
+ int b = 2;
+ int c = 3;
+ int d = 4;
+
+ /* Determining the number of iterations for the != or == is work in
+ progress. Same for polynomials of degree >= 2, where we have to
+ find the zeros of the polynomial. */
+ while (d)
+ {
+ a += 23;
+ d = a + d;
+ }
+}
+
+/* a -> {-100, +, 23}_1
+ d -> {4, +, {-77, +, 23}_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-17.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-17.c
new file mode 100644
index 00000000000..9c624b08ca9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-17.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+void foo ()
+{
+ int a = -100;
+ int b = 2;
+
+ while (b)
+ {
+ if (bar ())
+ a += 3;
+ else
+ a = 2;
+
+ /* Exercises the case when one of the branches of the if-phi-node is a constant.
+ FIXME:
+ - What is the chrec representation of such an evolution?
+ - Does this kind of code exist in real codes? */
+ b += a;
+ }
+}
+
+/* For the moment the analyzer is expected to output a "don't know" answer,
+ both for the initial condition and for the evolution part. This is done
+ in the merge condition branches information.
+
+ a -> [-oo, +oo]
+ b -> {2, +, a_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-18.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-18.c
new file mode 100644
index 00000000000..73996eac447
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-18.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo (int x)
+{
+ int a = -100;
+ int b = 2;
+
+ while (b)
+ {
+ if (x)
+ a += 3;
+ else
+ a += bar ();
+
+ /* Exercises the case when one of the branches of the if-phi-node cannot
+ be determined: [-oo, +oo].
+ Since the evolution function is too difficult to handle in the expanded
+ form, we have to keep it in its symbolic form: "b -> {2, +, a_1}_1". */
+ b += a;
+ }
+}
+
+/* a -> {-100, +, [min<t, 3>, max<t, 3>]}_1
+ b -> {2, +, {[min<t, 3>, max<t, 3>] - 100, +, [min<t, 3>, max<t, 3>]}_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-19.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-19.c
new file mode 100644
index 00000000000..47219680039
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-19.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int b = 2;
+
+ while (b)
+ {
+ /* Exercises the MULT_EXPR. */
+ b = 2*b;
+ }
+}
+
+/* b -> {2, *, 2}_1
+*/
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-20.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-20.c
new file mode 100644
index 00000000000..521f60efe52
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-20.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 3;
+ int b = 2;
+
+ while (a)
+ {
+ b += 5;
+ a += b;
+
+ /* Exercises the sum of a polynomial of degree 2 with an
+ evolution of degree 1:
+
+ (loop_num = 1, chrec_var = {3, +, 7, +, 5}, to_add = 2).
+ The result should be: {3, +, 9, +, 5}. */
+ a += 2;
+ }
+}
+
+/*
+ b -> {2, +, 5}_1
+ a -> {3, +, {9, +, 5}_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-21.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-21.c
new file mode 100644
index 00000000000..1f8d0e600d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-21.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 3;
+ int b = 2;
+
+ while (b)
+ {
+ a *= 4;
+ b *= a;
+ }
+}
+
+/* a -> {3, *, 4}_1
+ b -> {{2, *, 12}_1, *, 4}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-22.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-22.c
new file mode 100644
index 00000000000..a6df37051d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-22.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 2;
+ int b = 4;
+
+ while (a)
+ {
+ a *= 3;
+ a *= b;
+ b *= 5;
+ }
+}
+
+/*
+ b -> {4, *, 5}_1
+ a -> {2, *, {12, *, 5}_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-23.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-23.c
new file mode 100644
index 00000000000..2b67406b6a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-23.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 1;
+ int b = 1;
+
+ while (a)
+ {
+ a *= b;
+ b += 1;
+ }
+}
+
+/* a -> {1, *, {1, +, 1}_1}_1
+*/
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-24.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-24.c
new file mode 100644
index 00000000000..a81957e583d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-24.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo ()
+{
+ int c;
+
+ /* This exercises the initial condition propagator:
+ Interval Copy Constant Propagation (ICCP). */
+ if (bar ())
+ c = 2;
+ else
+ c = 3;
+
+ while (c)
+ {
+ c += 5;
+ }
+}
+
+/*
+ c -> {[2, 3], +, 5}_1
+*/
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-25.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-25.c
new file mode 100644
index 00000000000..5c535707cca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-25.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo ()
+{
+ int c = 7;
+
+ /* This exercises the initial condition propagator:
+ Interval Copy Constant Propagation (ICCP). */
+ if (bar ())
+ c = 2;
+ else
+ c += 3;
+
+ while (c)
+ {
+ c += 5;
+ }
+}
+
+/*
+ c -> {[2, 10], +, 5}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-26.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-26.c
new file mode 100644
index 00000000000..b9e08d45810
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-26.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo ()
+{
+ int a = -100;
+ int b = -10;
+
+ /* This exercises a code with two loop nests. */
+
+ while (a)
+ a++;
+
+ while (b)
+ b++;
+}
+
+/* a -> {-100, +, 1}_1
+ b -> {-10, +, 1}_2
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c
new file mode 100644
index 00000000000..c699bc6ac80
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo ()
+{
+ int a = -100;
+
+ /* This exercises a code with two loop nests. */
+
+ /* loop_1 runs 100 times. */
+ while (a < 0)
+ a++;
+
+ a -= 77;
+
+ /* loop_2 runs 26 times. */
+ while (a < 0)
+ a+=3;
+}
+
+/* The analyzer sees two loop nests:
+ for the first, it determines the evolution:
+ a -> {-100, +, 1}_1
+
+ and for the second, it determines that the first loop ends at 0 and then:
+ a -> {-77, +, 3}_2
+
+ When the constant propagation is postponed, the analyzer detects
+ for the second loop the evolution function:
+ a -> {a_5, +, 3}_2
+
+*/
+
+/* { dg-final { scan-tree-dump-times "nb_iterations 100" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 26" 1 "scev"} } */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-28.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-28.c
new file mode 100644
index 00000000000..59702851d9a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-28.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo ()
+{
+ int i;
+ int a = 2;
+
+ while (a)
+ {
+ a *= 3;
+
+ for (i = 0; i < 100; i++)
+ a += 4;
+ }
+}
+
+/* FIXME: We have to transform the evolution function of "a" into an infinite
+ sum, a -> {//2, *, 2//}, and then to add the 400 from the inner sum...
+ But this is quite difficult, and cases like this one do not happen often.
+
+ (Francois Irigoin consider that this case falls into the 0.01 percent
+ rule, and it is no worth to implement a solution for this testcase in a
+ production compiler. )
+*/
+
+/* Do nothing for this testcase.
+ The following evolutions are detected:
+
+ i -> {0, +, 1}_2
+ a -> {{2, *, [-oo, +oo]}_1, +, 4}_2
+
+*/
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-29.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-29.c
new file mode 100644
index 00000000000..716797361fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-29.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int bar (void);
+
+int foo ()
+{
+ int i;
+ int a = 2;
+
+ while (a)
+ {
+ a *= 3;
+ a += 5;
+ }
+}
+
+/* FIXME: This exposes a problem in the representation. Is it
+ possible to have an exponential and a polynomial together?
+
+ The first assignment constructs "a -> {2, *, 3}_1",
+ while the second adds 5 as a polynomial function.
+
+ The following two representations are not correct:
+ "a -> {{2, *, 3}_1, +, 5}_1"
+ "a -> {{2, +, 5}_1, *, 3}_1"
+
+ The right solution is:
+ "a -> {2, *, 3}_1 + {0, +, 5}_1"
+ but this exposes yet again the "exp + poly" problem: the representation
+ is not homogen. Going into a Taylor decomposition could solve this problem.
+
+ This is too difficult for the moment, and does not happen often.
+*/
+
+/* Do nothing for this testcase. */
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c
new file mode 100644
index 00000000000..3a36c5173c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+void foo (int);
+
+int main ()
+{
+ int c[100][200];
+ int a;
+ int x;
+
+ for (a = 1; a < 50; a++)
+ {
+ x = a;
+ c[x-7][1] = c[x+2][3] + c[x-1][2];
+ c[x][2] = c[x+2][3];
+ }
+ foo (c[12][13]);
+}
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c.ddall
new file mode 100644
index 00000000000..1e9a201c189
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-30.c.ddall
@@ -0,0 +1,383 @@
+
+;; Function main (main)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: 3
+ access_fn_B: 3
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {3, +, 1}_1
+ access_fn_B: {3, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1): (no dependence)
+
+)
+(Data Dep (A = 0, B = 2): (no dependence)
+
+)
+(Data Dep (A = 0, B = 3):
+ (subscript 0:
+ access_fn_A: 3
+ access_fn_B: 3
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {3, +, 1}_1
+ access_fn_B: {3, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 4): (no dependence)
+
+)
+(Data Dep (A = 0, B = 5): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0): (no dependence)
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2): (no dependence)
+
+)
+(Data Dep (A = 1, B = 3): (no dependence)
+
+)
+(Data Dep (A = 1, B = 4):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {1, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(-1
+)
+ )
+ (Direction Vector:
+(=)
+(-)
+ )
+
+)
+(Data Dep (A = 1, B = 5): (no dependence)
+
+)
+(Data Dep (A = 2, B = 0): (no dependence)
+
+)
+(Data Dep (A = 2, B = 1): (no dependence)
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: 1
+ access_fn_B: 1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {-6, +, 1}_1
+ access_fn_B: {-6, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 2, B = 3): (no dependence)
+
+)
+(Data Dep (A = 2, B = 4): (no dependence)
+
+)
+(Data Dep (A = 2, B = 5): (no dependence)
+
+)
+(Data Dep (A = 3, B = 0):
+ (subscript 0:
+ access_fn_A: 3
+ access_fn_B: 3
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {3, +, 1}_1
+ access_fn_B: {3, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 3, B = 1): (no dependence)
+
+)
+(Data Dep (A = 3, B = 2): (no dependence)
+
+)
+(Data Dep (A = 3, B = 3):
+ (subscript 0:
+ access_fn_A: 3
+ access_fn_B: 3
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {3, +, 1}_1
+ access_fn_B: {3, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 3, B = 4): (no dependence)
+
+)
+(Data Dep (A = 3, B = 5): (no dependence)
+
+)
+(Data Dep (A = 4, B = 0): (no dependence)
+
+)
+(Data Dep (A = 4, B = 1):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {1, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(1
+)
+ )
+ (Direction Vector:
+(=)
+(+)
+ )
+
+)
+(Data Dep (A = 4, B = 2): (no dependence)
+
+)
+(Data Dep (A = 4, B = 3): (no dependence)
+
+)
+(Data Dep (A = 4, B = 4):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 4, B = 5): (no dependence)
+
+)
+(Data Dep (A = 5, B = 0): (no dependence)
+
+)
+(Data Dep (A = 5, B = 1): (no dependence)
+
+)
+(Data Dep (A = 5, B = 2): (no dependence)
+
+)
+(Data Dep (A = 5, B = 3): (no dependence)
+
+)
+(Data Dep (A = 5, B = 4): (no dependence)
+
+)
+(Data Dep (A = 5, B = 5):
+ (subscript 0:
+ access_fn_A: 13
+ access_fn_B: 13
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 12
+ access_fn_B: 12
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c
new file mode 100644
index 00000000000..bb3f29cab3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+void bar (short);
+
+#define N 100
+foo (){
+ short a[N];
+ short b[N];
+ short c[N];
+ int i;
+
+ for (i=0; i<N; i++){
+ a[i] = b[i] + c[i];
+ }
+ bar (a[2]);
+}
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c.ddall
new file mode 100644
index 00000000000..6aaf0f386c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-31.c.ddall
@@ -0,0 +1,143 @@
+
+;; Function foo (foo)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1): (no dependence)
+
+)
+(Data Dep (A = 0, B = 2): (no dependence)
+
+)
+(Data Dep (A = 0, B = 3): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0): (no dependence)
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2): (no dependence)
+
+)
+(Data Dep (A = 1, B = 3): (no dependence)
+
+)
+(Data Dep (A = 2, B = 0): (no dependence)
+
+)
+(Data Dep (A = 2, B = 1): (no dependence)
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 2, B = 3):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-2
+)
+ )
+ (Direction Vector:
+(-)
+ )
+
+)
+(Data Dep (A = 3, B = 0): (no dependence)
+
+)
+(Data Dep (A = 3, B = 1): (no dependence)
+
+)
+(Data Dep (A = 3, B = 2):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(2
+)
+ )
+ (Direction Vector:
+(+)
+ )
+
+)
+(Data Dep (A = 3, B = 3):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c
new file mode 100644
index 00000000000..784caef3270
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+void bar (short);
+
+#define N 100
+#define NPad 10
+#define M 32
+void foo()
+{
+ short coef[M];
+ short input[N];
+ short output[N];
+
+ int i,j,k;
+ int sum;
+
+ for (i = 0; i < N; i++) {
+ sum = 0;
+ for (j = 0; j < M; j++) {
+ sum += input[i+NPad-j] * coef[j];
+ }
+ output[i] = sum;
+ }
+ bar (sum);
+}
+
+/* The following evolution functions have to be detected:
+
+ i -> {0, +, 1}_1
+ j -> {0, +, 1}_2
+
+*/
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c.ddall
new file mode 100644
index 00000000000..2929ec3271a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-32.c.ddall
@@ -0,0 +1,47 @@
+
+;; Function foo (foo)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {{10, +, 1}_1, +, -1}_2
+ access_fn_B: {{10, +, 1}_1, +, -1}_2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0): (no dependence)
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c
new file mode 100644
index 00000000000..a2a24a7e4e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+void bar (int);
+
+#define N 100
+#define NPad 10
+#define M 32
+
+void foo ()
+{
+ short coefs[2*M];
+ short input[2*N];
+ short output[2*N];
+
+ int sum_real, sum_imag;
+ int i,j,k;
+
+ k = NPad;
+ for (i = 0; i < N; i++)
+ {
+ sum_real = 0;
+ sum_imag = 0;
+ for (j = 0; j < M; j++)
+ {
+ sum_real +=
+ input[2*k-2*j+1]*coefs[2*j+1] - input[2*k-2*j]*coefs[2*j];
+
+ sum_imag +=
+ input[2*k-2*j]*coefs[2*j+1] + input[2*k-2*j+1]*coefs[2*j];
+ }
+ output[2*i+1] = sum_imag;
+ output[2*i] = sum_real;
+ k++;
+ }
+ bar (sum_imag);
+}
+
+/* The following evolution functions have to be detected:
+
+ i -> {0, +, 1}_1
+ j -> {0, +, 1}_2
+
+*/
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c.ddall
new file mode 100644
index 00000000000..1e9f1ee4002
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-33.c.ddall
@@ -0,0 +1,113 @@
+
+;; Function foo (foo)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {{21, +, 2}_1, +, -2}_2
+ access_fn_B: {{21, +, 2}_1, +, -2}_2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1): (no dependence)
+
+)
+(Data Dep (A = 0, B = 2): (no dependence)
+
+)
+(Data Dep (A = 0, B = 3): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0): (no dependence)
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {1, +, 2}_2
+ access_fn_B: {1, +, 2}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2): (no dependence)
+
+)
+(Data Dep (A = 1, B = 3): (no dependence)
+
+)
+(Data Dep (A = 2, B = 0): (no dependence)
+
+)
+(Data Dep (A = 2, B = 1): (no dependence)
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: {{20, +, 2}_1, +, -2}_2
+ access_fn_B: {{20, +, 2}_1, +, -2}_2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 2, B = 3): (no dependence)
+
+)
+(Data Dep (A = 3, B = 0): (no dependence)
+
+)
+(Data Dep (A = 3, B = 1): (no dependence)
+
+)
+(Data Dep (A = 3, B = 2): (no dependence)
+
+)
+(Data Dep (A = 3, B = 3):
+ (subscript 0:
+ access_fn_A: {0, +, 2}_2
+ access_fn_B: {0, +, 2}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c
new file mode 100644
index 00000000000..1a5687a527b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+void bar (int);
+
+#define M 16
+#define N 8
+
+short foo (short image[][M], short block[][N]){
+ int sad, diff = 0;
+ int i, j;
+ int tmp;
+
+ for (i = 0; i < N; i++) {
+ sad = 0;
+ for (j = 0; j < N; j++) {
+ tmp = image[i][j] - block[i][j];
+ sad += (tmp < 0) ? -tmp : tmp;
+ }
+ diff += sad;
+ }
+
+ return diff;
+}
+
+/* The following evolution functions have to be detected:
+
+ i -> {0, +, 1}_1
+ j -> {0, +, 1}_2
+
+*/
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c.ddall
new file mode 100644
index 00000000000..9f3d13edc91
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c.ddall
@@ -0,0 +1,47 @@
+
+;; Function foo (foo)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0): (no dependence)
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c
new file mode 100644
index 00000000000..f33f28b397a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+#define L 100
+#define M 100
+#define N 100
+
+int bar (float);
+
+int foo (float A[][M][N])
+{
+ int i, j, k;
+
+ for (i = 0; i < L; i++)
+ for (j = 0; j < M; j++)
+ for (k = 0; k < N; k++)
+ A[i][j][j] = A[i][j][k];
+
+ return bar (A[10][11][12]);
+}
+
+/* The following evolution functions have to be detected:
+
+ i -> {0, +, 1}_1
+ j -> {0, +, 1}_2
+ k -> {0, +, 1}_3
+
+ For the subscript [j] vs. [k], "{0, +, 1}_2" vs. "{0, +, 1}_3"
+ the overlapping elements are respectively located at iterations:
+ {0, +, 1}_3 and {0, +, 1}_2.
+
+*/
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c.ddall
new file mode 100644
index 00000000000..858b925f649
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-35.c.ddall
@@ -0,0 +1,167 @@
+
+;; Function foo (foo)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_3
+ access_fn_B: {0, +, 1}_3
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_3
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_3
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_3
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_3
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+([-oo, +oo]
+)
+(0
+)
+ )
+ (Direction Vector:
+(*)
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 2): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_3
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_3
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+([-oo, +oo]
+)
+(0
+)
+ )
+ (Direction Vector:
+(*)
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2): (no dependence)
+
+)
+(Data Dep (A = 2, B = 0): (no dependence)
+
+)
+(Data Dep (A = 2, B = 1): (no dependence)
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: 12
+ access_fn_B: 12
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 11
+ access_fn_B: 11
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c
new file mode 100644
index 00000000000..916c81548c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+int foo (int);
+
+int main ()
+{
+ int res;
+ int c[100][200];
+ int a;
+ int x;
+
+ for (a = 1; a < 50; a++)
+ {
+ c[a+1][a] = 2;
+ res += c[a][a];
+
+ /* This case exercises the subscript coupling detection: the dependence
+ detectors have to determine that there is no dependence between
+ c[a+1][a] and c[a][a]. */
+ }
+
+ return res + foo (c[12][13]);
+}
+
+/* This also exercises the case when, after a PRE, the loop phi node contains:
+ " # a_1 = PHI <1(0), T.1_11(1)>;
+ ...
+ T.1_11 = a_1 + 1;".
+ In fact this creates a cycle: a -> T.1 -> a.
+ The PRE has screwed up the case...
+ ...I really have to implement the mixers analyzers. */
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c.ddall
new file mode 100644
index 00000000000..ac9536852cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-36.c.ddall
@@ -0,0 +1,221 @@
+
+;; Function main (main)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {2, +, 1}_1
+ access_fn_B: {2, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1): (no dependence)
+
+)
+(Data Dep (A = 0, B = 2):
+ (subscript 0:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: 13
+ iterations_that_access_an_element_twice_in_A: 12
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {2, +, 1}_1
+ access_fn_B: 12
+ iterations_that_access_an_element_twice_in_A: 10
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-12
+)
+(-10
+)
+ )
+ (Direction Vector:
+(-)
+(-)
+ )
+
+)
+(Data Dep (A = 1, B = 0): (no dependence)
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2):
+ (subscript 0:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: 13
+ iterations_that_access_an_element_twice_in_A: 12
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: 12
+ iterations_that_access_an_element_twice_in_A: 11
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-12
+)
+(-11
+)
+ )
+ (Direction Vector:
+(-)
+(-)
+ )
+
+)
+(Data Dep (A = 2, B = 0):
+ (subscript 0:
+ access_fn_A: 13
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 12
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 12
+ access_fn_B: {2, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 10
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(12
+)
+(10
+)
+ )
+ (Direction Vector:
+(+)
+(+)
+ )
+
+)
+(Data Dep (A = 2, B = 1):
+ (subscript 0:
+ access_fn_A: 13
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 12
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 12
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 11
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(12
+)
+(11
+)
+ )
+ (Direction Vector:
+(+)
+(+)
+ )
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: 13
+ access_fn_B: 13
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 12
+ access_fn_B: 12
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-37.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-37.c
new file mode 100644
index 00000000000..43653454dfd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-37.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a;
+ int b = 2;
+ int c = 11;
+
+ for (a = -123; a < 0; c += 12, b += 5)
+ {
+ a += b;
+
+ /* The next stmt exercises the add_function_to_loop_evolution
+ (loop_num = 1, chrec_before = {-123, +, {2, +, 5}_1}_1, to_add = {11, +, 12}_1).
+ The result should be: {-123, +, {13, +, 17}_1}_1. */
+ a += c;
+ }
+}
+
+/*
+ b -> {2, +, 5}_1
+ c -> {11, +, 12}_1
+ a -> {-123, +, {13, +, 17}_1}_1
+*/
+
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-38.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-38.c
new file mode 100644
index 00000000000..3108ec24851
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-38.c
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 3;
+ int b = 2;
+ int c = 11;
+ int d = -5;
+
+ while (a)
+ {
+ b += 5;
+ a += b;
+
+ for (d = -5; d < 0; d++)
+ {
+ /* Exercises the build_polynomial_evolution_in_loop function in the following context:
+ (add_to_evolution
+ loop_num = 2
+ chrec_before = {3, +, 7, +, 5}_1
+ to_add = {11, +, 12}_1
+ res = {{3, +, 7, +, 5}_1, +, {11, +, 12}_1}_2
+ )
+
+ This also exercises the chrec_apply function in the following context:
+ (chrec_apply
+ var = 2
+ chrec = {0, +, {11, +, 12}_1}_2
+ x = 5
+ res = {55, +, 60}_1
+ )
+ */
+ a += c;
+ }
+ c += 12;
+ }
+}
+
+/*
+ b -> {2, +, 5}_1
+ c -> {11, +, 12}_1
+ d -> {-5, +, 1}_2
+ a -> {{3, +, 62, +, 65}_1, +, {11, +, 12}_1}_2
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-39.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-39.c
new file mode 100644
index 00000000000..8e1857277c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-39.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int foo (int ParmN)
+{
+ int a = 3;
+ int b = 2;
+ int d = -5;
+
+ while (a)
+ {
+ b += 25;
+ a += b;
+
+ for (d = -5; d < 0; d++)
+ {
+ /* Exercises the build_polynomial_evolution_in_loop in the following context:
+ (add_to_evolution
+ loop_num = 2
+ chrec_before = {3, +, {27, +, 25}_1}_1
+ to_add = ParmN_15
+ res = {{3, +, {27, +, 25}_1}_1, +, ParmN_15}_2
+ )
+
+ Then it exercises the add_expr_to_loop_evolution in the following context:
+ (add_to_evolution
+ loop_num = 1
+ chrec_before = {{3, +, {27, +, 25}_1}_1, +, ParmN_15}_2
+ to_add = ParmN_15 * 5
+ res = {{3, +, {ParmN_15 * 5 + 27, +, 25}_1}_1, +, ParmN_15}_2
+ )
+ */
+ a += ParmN;
+ }
+ }
+}
+
+/*
+ b -> {2, +, 25}_1
+ d -> {-5, +, 1}_2
+ a -> {{3, +, {ParmN * 5 + 27, +, 25}_1}_1, +, ParmN}_2
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-40.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-40.c
new file mode 100644
index 00000000000..6603a960275
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-40.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 1;
+ int b = 1;
+
+ while (a)
+ {
+ a += b;
+ b *= 2;
+ }
+}
+
+/*
+ b -> {1, *, 2}_1
+ a -> {1, +, {1, *, 2}_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-41.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-41.c
new file mode 100644
index 00000000000..f8c0cd0ca20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-41.c
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 2;
+ int b = 4;
+ int c = 2;
+
+ while (a)
+ {
+ a *= 3;
+ for (c = -10; c < 0; c++)
+ {
+ /* Exercises the build_exponential_evolution_in_loop function in the following context:
+ (multiply_evolution
+ loop_num = 2
+ chrec_before = {2, *, 3}_1
+ to_mult = {4, *, 5}_1
+ res = {{2, *, 3}_1, *, {4, *, 5}_1}_2
+ )
+
+ Then it exerces the chrec_apply in the following context:
+ (chrec_apply
+ var = 2
+ chrec = {0, +, {4, *, 5}_1}_2
+ x = 10
+ res = {40, *, 5}_1
+ )
+
+ Finally it tests the
+ (add_to_evolution
+ loop_num = 1
+ chrec_before = {{2, *, 3}_1, *, {4, *, 5}_1}_2
+ to_add = {40, *, 5}_1
+ res = {{2, *, {120, *, 5}_1}_1, *, {4, *, 5}_1}_2
+ )
+ */
+ a *= b;
+ }
+ b *= 5;
+ }
+}
+
+/*
+ c -> {-10, +, 1}_2
+ b -> {4, *, 5}_1
+ a -> {{2, *, {120, *, 5}_1}_1, *, {4, *, 5}_1}_2
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-42.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-42.c
new file mode 100644
index 00000000000..7b62a712d9e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-42.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 1;
+ int b = 2;
+ int c = 0;
+ int d = 5;
+
+ while (a)
+ {
+ a += b;
+ a += d;
+
+ b += c;
+ c += 1;
+ d += 9;
+ }
+}
+
+/*
+ c -> {0, +, 1}_1
+ b -> {2, +, 0, +, 1}_1
+ d -> {5, +, 9}_1
+ a -> {1, +, 7, +, 9, +, 1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-43.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-43.c
new file mode 100644
index 00000000000..16ea96731b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-43.c
@@ -0,0 +1,64 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+
+int main ()
+{
+ int a = 1;
+ int b = 2;
+ int c = 0;
+ int d = 5;
+ int e;
+
+ while (a)
+ {
+ /* The following statement produces the evolution function:
+ (add_to_evolution
+ loop_num = 1
+ chrec_before = 1
+ to_add = {{2, +, 0}_1, +, 10}_1
+ res = {{{1, +, 2}_1, +, 0}_1, +, 10}_1
+ )
+ Note that the evolution of B in the inner loop_2 is not
+ relevant to the evolution of A in the loop_1. */
+ a += b;
+
+ /* And finally the following statement produces the expected scev:
+ (add_to_evolution
+ loop_num = 1
+ chrec_before = {{{1, +, 2}_1, +, 0}_1, +, 10}_1
+ to_add = {5, +, 9}_1
+ res = {{{1, +, 7}_1, +, 9}_1, +, 10}_1
+ )
+ That ends this not so formal proof ("CQFD" in french ;-). */
+ a += d;
+
+ for (e = 0; e < 10; e++)
+ b += c;
+ /* After having analyzed this loop, the overall effect is added to the evolution of b.
+ This corresponds to the following operation:
+ (add_to_evolution
+ loop_num = 1
+ chrec_before = {2, +, {0, +, 1}_1}_2
+ to_add = {0, +, 10}_1
+ res = {{{2, +, 0}_1, +, 10}_1, +, {0, +, 1}_1}_2
+ ).
+ Note that the variable c has not yet been updated in the loop, and thus its value
+ at this version is "{0, +, 1}_1". Since the loop_2 runs exactly 10 times, the overall
+ effect of the loop is "10 * {0, +, 1}_1": that is the TO_ADD argument.
+ */
+
+ c += 1;
+ d += 9;
+ }
+}
+
+/*
+ c -> {0, +, 1}_1
+ e -> {0, +, 1}_2
+ b -> {{2, +, 0, +, 10}_1, +, {0, +, 1}_1}_2
+ d -> {5, +, 9}_1
+ a -> {1, +, 7, +, 9, +, 10}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-44.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-44.c
new file mode 100644
index 00000000000..1a3099a90a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-44.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+/* That's a reduced testcase of one of my favourite simulation programs.
+ This is also known under the name: "Newton's falling apple".
+ The general version is known under the name: "the N-body simulation problem".
+
+ The physics terminology is the best to describe the scalar evolution algorithm:
+ - first determine the initial conditions of the system,
+ - then analyze its evolution.
+*/
+
+double Newton_s_apple ()
+{
+ /* Initial conditions. */
+ double g = -10.0;
+ double speed_z = 0;
+ double altitude = 3000;
+ double delta_t = 0.1;
+ double total_time = 0;
+
+ /* Laws of evolution. */
+ while (altitude > 0.0)
+ {
+ speed_z += g * delta_t;
+ altitude += speed_z * delta_t;
+ total_time += delta_t;
+ }
+
+ return total_time;
+}
+
+/*
+ speed_z -> {0.0, +, -1.0e+0}_1
+ altitude -> {3.0e+3, +, {(0.0 + -1.0e+0) * 1.00000000000000005551115123125782702118158340454e-1, +, -1.0e+0 * 1.00000000000000005551115123125782702118158340454e-1}_1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-45.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-45.c
new file mode 100644
index 00000000000..5ece3403a42
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-45.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+/* That's a reduced testcase of one of my favourite simulation programs.
+ This is also known under the name: "Newton's falling apple".
+ The general version is known under the name: "the N-body simulation problem".
+
+ The physics terminology is the best to describe the scalar evolution algorithm:
+ - first determine the initial conditions of the system,
+ - then analyze its evolution.
+*/
+
+double Newton_s_apple ()
+{
+ /* Initial conditions. */
+ double g = 10.0;
+ double speed_z = 0;
+ double altitude = 3000;
+ double delta_t = 0.1;
+ double total_time = 0;
+
+ /* Laws of evolution. */
+ while (altitude > 0.0)
+ {
+ speed_z += g * delta_t;
+ altitude -= speed_z * delta_t;
+ total_time += delta_t;
+ }
+
+ return total_time;
+}
+
+/*
+ speed_z -> {0.0, +, 1.0e+0}_1
+ altitude -> {3.0e+3, +, {(0.0 + 1.0e+0) * 1.00000000000000005551115123125782702118158340454e-1 * -1, +, 1.0e+0 * 1.00000000000000005551115123125782702118158340454e-1 * -1}_1}_1
+
+ When computing evolutions in the "symbolic as long as possible" strategy,
+ the analyzer extracts only the following:
+
+ altitude -> {3.0e+3, +, T.2_11 * -1}_1
+
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-46.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-46.c
new file mode 100644
index 00000000000..6c21ae23d80
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-46.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int
+foo (int i,
+ int precision)
+{
+ i = precision - i - 1;
+
+ /* At this point the analyzer is confused by the initialisation of "i".
+ It keeps the initial condition under a symbolic form: "i_1". */
+
+ while (--i);
+}
+
+/* i -> {i_1, +, -1}_1 */
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-47.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-47.c
new file mode 100644
index 00000000000..ea38c59df1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-47.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int
+foo (int unknown_parm, int a, int b)
+{
+ int p;
+
+ if (unknown_parm)
+ {
+ p = a + 2;
+ }
+ else
+ {
+ p = b + 1;
+ }
+
+ /* At this point the initial condition of "p" is unknown.
+ In this case, the analyzer has to keep the initial condition under a symbolic form. */
+
+ while (p)
+ p--;
+
+}
+
+/*
+ p -> {p_1, +, -1}_1
+
+ or, when the Value Range Propagation does its work:
+
+ p -> {[MIN_EXPR <p_4, p_6>, MAX_EXPR <p_4, p_6>], +, -1}_1
+
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-48.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-48.c
new file mode 100644
index 00000000000..400f08d7078
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-48.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int
+foo (int *c)
+{
+ int i;
+ int j = 10;
+
+ for (i = 0; i < 5; i++)
+ {
+ for (j = 10;; j--)
+ {
+ if (j == 0)
+ break;
+
+ *(c + j) = *(c + j) - 1;
+ }
+ }
+
+ return j;
+}
+
+/*
+ j -> {10, +, -1}_2
+ i -> {0, +, 1}_1
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-49.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-49.c
new file mode 100644
index 00000000000..6b911b692b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-49.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int
+foo (int *c)
+{
+ int i = 0;
+ int j = 10;
+
+ while (1)
+ {
+ if (i == j)
+ break;
+
+ i++;
+ j--;
+ }
+
+ return j;
+}
+
+/* i -> {0, +, 1}_1 */
+/* j -> {10, +, -1}_1 */
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-50.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-50.c
new file mode 100644
index 00000000000..3da547ccd11
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-50.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int
+foo (int *c)
+{
+ int i = 0;
+ int j = 10;
+
+ while (1)
+ {
+ /* This case exercises the number of iterations detector for
+ {0, +, 1}_1 == {10, +, -1}_1
+ */
+ if (i == j)
+ break;
+
+ i++;
+ j--;
+ }
+
+ return j;
+}
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-51.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-51.c
new file mode 100644
index 00000000000..b2a92edc474
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-51.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int
+foo (int j)
+{
+ int i = 0;
+ int temp_var;
+
+ while (i < 100)
+ {
+ /* This exercises the analyzer on strongly connected
+ components: here "i -> temp_var -> i". */
+ temp_var = i + j;
+ i = temp_var + 2;
+ }
+
+ return i;
+}
+
+/* FIXME. */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c
new file mode 100644
index 00000000000..594a583b645
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+int bar (int);
+
+int foo (void)
+{
+ int a;
+ int parm = 11;
+ int x;
+ int c[100];
+
+ for (a = parm; a < 50; a++)
+ {
+ /* Array access functions have to be analyzed. */
+ x = a + 5;
+ c[x] = c[x+2] + c[x-1];
+ }
+ bar (c[1]);
+}
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c.ddall
new file mode 100644
index 00000000000..4c1fc50d97d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-52.c.ddall
@@ -0,0 +1,203 @@
+
+;; Function foo (foo)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {18, +, 1}_1
+ access_fn_B: {18, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1):
+ (subscript 0:
+ access_fn_A: {18, +, 1}_1
+ access_fn_B: {15, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {3, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(3
+)
+ )
+ (Direction Vector:
+(+)
+ )
+
+)
+(Data Dep (A = 0, B = 2):
+ (subscript 0:
+ access_fn_A: {18, +, 1}_1
+ access_fn_B: {16, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {2, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(2
+)
+ )
+ (Direction Vector:
+(+)
+ )
+
+)
+(Data Dep (A = 0, B = 3): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0):
+ (subscript 0:
+ access_fn_A: {15, +, 1}_1
+ access_fn_B: {18, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {3, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-3
+)
+ )
+ (Direction Vector:
+(-)
+ )
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {15, +, 1}_1
+ access_fn_B: {15, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2):
+ (subscript 0:
+ access_fn_A: {15, +, 1}_1
+ access_fn_B: {16, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {1, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-1
+)
+ )
+ (Direction Vector:
+(-)
+ )
+
+)
+(Data Dep (A = 1, B = 3): (no dependence)
+
+)
+(Data Dep (A = 2, B = 0):
+ (subscript 0:
+ access_fn_A: {16, +, 1}_1
+ access_fn_B: {18, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {2, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-2
+)
+ )
+ (Direction Vector:
+(-)
+ )
+
+)
+(Data Dep (A = 2, B = 1):
+ (subscript 0:
+ access_fn_A: {16, +, 1}_1
+ access_fn_B: {15, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {1, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(1
+)
+ )
+ (Direction Vector:
+(+)
+ )
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: {16, +, 1}_1
+ access_fn_B: {16, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 2, B = 3): (no dependence)
+
+)
+(Data Dep (A = 3, B = 0): (no dependence)
+
+)
+(Data Dep (A = 3, B = 1): (no dependence)
+
+)
+(Data Dep (A = 3, B = 2): (no dependence)
+
+)
+(Data Dep (A = 3, B = 3):
+ (subscript 0:
+ access_fn_A: 1
+ access_fn_B: 1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-53.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-53.c
new file mode 100644
index 00000000000..9e36aecca52
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-53.c
@@ -0,0 +1,128 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
+
+#define N 16
+
+void fbar (float *);
+void ibar (int *);
+void sbar (short *);
+
+/* Should be vectorized */
+
+foo (int n)
+{
+ float a[N+1];
+ float b[N];
+ float c[N];
+ float d[N];
+ int ia[N];
+ int ib[N];
+ int ic[N];
+ double da[N];
+ double db[N];
+ short sa[N];
+ short sb[N];
+ short sc[N];
+ int i,j;
+ int diff = 0;
+ char cb[N];
+ char cc[N];
+ char image[N][N];
+ char block[N][N];
+
+ /* Not vetorizable yet (unknown loop bound). */
+ for (i = 0; i < n; i++){
+ a[i] = b[i];
+ }
+ fbar (a);
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i];
+ }
+ fbar (a);
+
+ /* Not Vectorizable (mode not supported). */
+ for (i = 0; i < N; i++){
+ da[i] = db[i];
+ }
+ fbar (a);
+
+ /* Not vetorizable yet (constant assignment). */
+ for (i = 0; i < N; i++){
+ a[i] = 5;
+ }
+ fbar (a);
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i] + d[i];
+ }
+ fbar (a);
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] * c[i];
+ }
+ fbar (a);
+
+ /* Vectorizable. */
+ for (i = 0; i < N/2; i++){
+ a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ d[i] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ }
+ fbar (a);
+
+ /* Not vetorizable yet (too conservative dependence test). */
+ for (i = 0; i < N/2; i++){
+ a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ a[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ }
+ fbar (a);
+
+ /* Not vetorizable yet (access pattern). */
+ for (i = 0; i < N/2; i++){
+ a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
+ d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
+ }
+ fbar (a);
+
+ /* Not vetorizable yet (too conservative dependence test; access pattern). */
+ for (i = 0; i < N/2; i++){
+ a[2*i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
+ a[2*i+1] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
+ }
+ fbar (a);
+
+ /* Not vetorizable yet (no support for integer mult). */
+ for (i = 0; i < N; i++){
+ ia[i] = ib[i] * ic[i];
+ }
+ ibar (ia);
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i];
+ d[i] = b[i] + c[i];
+ ia[i] = ib[i] + ic[i];
+ }
+ ibar (ia);
+ fbar (a);
+ fbar (d);
+
+ /* Not vectorizable yet (two types with different nunits in vector). */
+ for (i = 0; i < N; i++){
+ ia[i] = ib[i] + ic[i];
+ sa[i] = sb[i] + sc[i];
+ }
+ ibar (ia);
+ sbar (sa);
+
+ /* Not vetorizable yet (too conservative dependence test). */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i];
+ a[i+1] = b[i] + c[i];
+ }
+ fbar (a);
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-54.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-54.c
new file mode 100644
index 00000000000..9dfc15b642f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-54.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int main(void)
+{
+ int a = 5;
+ int b = 6;
+ int c = 20;
+
+ while (a <= 100)
+ {
+ int i;
+
+ a = b;
+ for (i = 0; i <= 12; i++)
+ {
+ a++;
+ }
+ b = b + c;
+ }
+}
+
+/* This example has been distilled from Pattern1 that cannot be
+ handled: "Big steps, small steps" from the ICS'01 paper "Monotonic
+ Evolution" by Peng Wu.
+
+ The analyzer has to detect the following evolution functions:
+ i -> {0, +, 1}_2
+ b -> {6, +, 20}_1
+ a -> {{6, +, 20}_1, +, 1}_2
+*/
+
+/* FIXME. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-55.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-55.c
new file mode 100644
index 00000000000..796cceb4b50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-55.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int main(int argc)
+{
+ int I, J;
+ const int N = 30;
+ const int M = 40;
+ for (J = argc; J < N; J += 3)
+ {
+ for (I = J; I < M; I++)
+ {
+ printf ("%d %d\n", I, J);
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-56.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-56.c
new file mode 100644
index 00000000000..ba2b69ca867
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-56.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -ftree-elim-checks -fdump-tree-elck-details -fdump-tree-optimized" } */
+
+void remove_me (void);
+
+int main (void)
+{
+ int a = -100;
+ int b = 0;
+ int c = 3;
+
+ for (a = 0; a < 100; a++)
+ {
+ b = b + 3;
+ if (b != c)
+ remove_me ();
+ c = c + 3;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-57.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-57.c
new file mode 100644
index 00000000000..a873b9fc314
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-57.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -ftree-elim-checks -fdump-tree-elck-details -fdump-tree-optimized" } */
+
+void remove_me (void);
+
+int main (void)
+{
+ int a = -100;
+ int b = 0;
+ int c = 3;
+
+ for (a = 0; a < 100; a++)
+ {
+ if (b > c)
+ remove_me ();
+ b = b + 2;
+ c = c + 3;
+ }
+}
+
+
+/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-58.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-58.c
new file mode 100644
index 00000000000..b0ef757fbb3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-58.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -ftree-elim-checks -fdump-tree-elck-details -fdump-tree-optimized" } */
+
+void remove_me (void);
+
+int main (void)
+{
+ int a, b;
+ int N = 100;
+
+ a = 0;
+ b = 0;
+ while (a < N)
+ {
+ if (b >= 5*N - 4)
+ remove_me ();
+ a++;
+ b+=5;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c
new file mode 100644
index 00000000000..9d19bdfb19a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev -fall-data-deps -fdump-tree-ddall" } */
+
+extern int foo (float A[100][200]);
+
+int bar ()
+{
+ int i, j;
+ float A[100][200];
+
+ for (i=0; i<5; i++)
+ for (j=0; j<5; j++)
+ A[i][j] = A[i+1][j];
+ foo (A);
+ return A[1][2];
+}
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c.ddall
new file mode 100644
index 00000000000..44b70258d3d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-59.c.ddall
@@ -0,0 +1,275 @@
+
+;; Function bar (bar)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {1, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(1
+)
+ )
+ (Direction Vector:
+(=)
+(+)
+ )
+
+)
+(Data Dep (A = 0, B = 2):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {1, +, 1}_1
+ access_fn_B: 1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-2
+)
+(0
+)
+ )
+ (Direction Vector:
+(-)
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 0):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {1, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(-1
+)
+ )
+ (Direction Vector:
+(=)
+(-)
+ )
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2):
+ (subscript 0:
+ access_fn_A: {0, +, 1}_2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 2
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: {0, +, 1}_1
+ access_fn_B: 1
+ iterations_that_access_an_element_twice_in_A: 1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(-2
+)
+(-1
+)
+ )
+ (Direction Vector:
+(-)
+(-)
+ )
+
+)
+(Data Dep (A = 2, B = 0):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 1
+ access_fn_B: {1, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(2
+)
+(0
+)
+ )
+ (Direction Vector:
+(+)
+(=)
+ )
+
+)
+(Data Dep (A = 2, B = 1):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: {0, +, 1}_2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 2
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 1
+ access_fn_B: {0, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(2
+)
+(1
+)
+ )
+ (Direction Vector:
+(+)
+(+)
+ )
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: 2
+ access_fn_B: 2
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+
+ (subscript 1:
+ access_fn_A: 1
+ access_fn_B: 1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+(0
+)
+ )
+ (Direction Vector:
+(=)
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c
new file mode 100644
index 00000000000..f71561252b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev -fall-data-deps -fdump-tree-ddall" } */
+
+extern int foo (float A[100]);
+
+int bar ()
+{
+ int i, j;
+ float A[100];
+
+ for (i=0; i<5; i++)
+ {
+ A[i * 3] = i + 3;
+ A[i + 7] = i;
+ }
+
+ foo (A);
+ return A[1];
+}
+
+/* { dg-final { diff-tree-dumps "ddall" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c.ddall b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c.ddall
new file mode 100644
index 00000000000..6310edfed42
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-60.c.ddall
@@ -0,0 +1,107 @@
+
+;; Function bar (bar)
+
+
+(Data Dep (A = 0, B = 0):
+ (subscript 0:
+ access_fn_A: {0, +, 3}_1
+ access_fn_B: {0, +, 3}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 0, B = 1):
+ (subscript 0:
+ access_fn_A: {0, +, 3}_1
+ access_fn_B: {7, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {3, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {2, +, 3}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+([-oo, +oo]
+)
+ )
+ (Direction Vector:
+(*)
+ )
+
+)
+(Data Dep (A = 0, B = 2): (no dependence)
+
+)
+(Data Dep (A = 1, B = 0):
+ (subscript 0:
+ access_fn_A: {7, +, 1}_1
+ access_fn_B: {0, +, 3}_1
+ iterations_that_access_an_element_twice_in_A: {2, +, 3}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {3, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+([-oo, +oo]
+)
+ )
+ (Direction Vector:
+(*)
+ )
+
+)
+(Data Dep (A = 1, B = 1):
+ (subscript 0:
+ access_fn_A: {7, +, 1}_1
+ access_fn_B: {7, +, 1}_1
+ iterations_that_access_an_element_twice_in_A: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: {0, +, 1}_1
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+(Data Dep (A = 1, B = 2): (no dependence)
+
+)
+(Data Dep (A = 2, B = 0): (no dependence)
+
+)
+(Data Dep (A = 2, B = 1): (no dependence)
+
+)
+(Data Dep (A = 2, B = 2):
+ (subscript 0:
+ access_fn_A: 1
+ access_fn_B: 1
+ iterations_that_access_an_element_twice_in_A: 0
+ last_iteration_that_access_an_element_twice_in_A: [-oo, +oo]
+ iterations_that_access_an_element_twice_in_B: 0
+ last_iteration_that_access_an_element_twice_in_B: [-oo, +oo]
+ )
+ (Distance Vector:
+(0
+)
+ )
+ (Direction Vector:
+(=)
+ )
+
+)
+
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp b/gcc/testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp
index 6e3621db3ce..ee8394880ba 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 1997 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,21 +22,14 @@ load_lib gcc-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
- set DEFAULT_CFLAGS " -ansi -pedantic-errors -gdwarf-2"
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
}
# Initialize `dg'.
dg-init
# Main loop.
-set comp_output [gcc_target_compile \
- "$srcdir/$subdir/../trivial.c" "trivial.S" assembly \
- "additional_flags=-gdwarf-2"]
-if { ! [string match "*: target system does not support the * debug format*" \
- $comp_output] } {
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
- "" $DEFAULT_CFLAGS
-}
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS
# All done.
dg-finish
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-1.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-1.c
new file mode 100644
index 00000000000..f1fae42e0ef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-1.c
@@ -0,0 +1,101 @@
+/* { dg-do compile { target powerpc*-*-* i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#define N 16
+
+void fbar (float *);
+void ibar (int *);
+void sbar (short *);
+
+/* multiple loops */
+
+foo (int n)
+{
+ float a[N+1];
+ float b[N];
+ float c[N];
+ float d[N];
+ int ia[N];
+ int ib[N];
+ int ic[N];
+ short sa[N];
+ short sb[N];
+ short sc[N];
+ int i,j;
+ int diff = 0;
+ char cb[N];
+ char cc[N];
+ char image[N][N];
+ char block[N][N];
+
+ /* Not vetorizable yet (cross-iteration cycle). */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ diff += (cb[i] - cc[i]);
+ }
+ ibar (&diff);
+
+
+ /* Not vetorizable yet (outer-loop: not attempted.
+ inner-loop: cross iteration cycle; multi-dimensional arrays). */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ for (i = 0; i < N; i++) {
+ diff += (image[i][j] - block[i][j]);
+ }
+ }
+ ibar (&diff);
+
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i];
+ }
+ fbar (a);
+
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i] + d[i];
+ }
+ fbar (a);
+
+
+ /* Not vetorizable yet (access pattern). */
+ for (i = 0; i < N/2; i++){
+ a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
+ d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
+ }
+ fbar (a);
+
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i];
+ d[i] = b[i] + c[i];
+ ia[i] = ib[i] + ic[i];
+ }
+ ibar (ia);
+ fbar (a);
+ fbar (d);
+
+
+ /* Not vectorizable yet (two types with different nunits in vector). */
+ for (i = 0; i < N; i++){
+ ia[i] = ib[i] + ic[i];
+ sa[i] = sb[i] + sc[i];
+ }
+ ibar (ia);
+ sbar (sa);
+
+
+ /* Not vetorizable yet (too conservative dependence test). */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i];
+ a[i+1] = b[i] + c[i];
+ }
+ fbar (a);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-10.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-10.c
new file mode 100644
index 00000000000..7cb6240aea3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-10.c
@@ -0,0 +1,27 @@
+/* { dg-do compile { target powerpc*-*-* i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#define N 16
+
+short a[N];
+short d[N];
+
+int foo ()
+{
+ int i;
+ short b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ short c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+
+
+ /* Not vetorizable yet (strided access pattern). */
+ for (i = 0; i < N/2; i++)
+ {
+ a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
+ d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-11.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-11.c
new file mode 100644
index 00000000000..907f5b92dac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-11.c
@@ -0,0 +1,51 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int main1 ()
+{
+ int i;
+ int ia[N];
+ int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+
+ /* Not vetorizable yet (integer mult). */
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] * ic[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i] * ic[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-12.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-12.c
new file mode 100644
index 00000000000..98db33915ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-12.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int main1 ()
+{
+ int i;
+ int ia[N];
+ int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ short sa[N];
+ short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+
+ /* Not vetorizable yet (multiple types with different nunits in vector). */
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] + ic[i];
+ sa[i] = sb[i] + sc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i] + ic[i] || sa[i] != sb[i] + sc[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-13.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-13.c
new file mode 100644
index 00000000000..f32451d4d02
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-13.c
@@ -0,0 +1,25 @@
+/* { dg-do compile { target powerpc*-*-* i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+
+#define N 16
+
+int a[N];
+int results[N] = {0,1,2,3,0,0,0,0,0,0,0,0,12,13,14,15};
+
+int main ()
+{
+ int i;
+ int b[N] = {0,1,2,3,-4,-5,-6,-7,-8,-9,-10,-11,12,13,14,15};
+
+ /* Not vectorizable yet (condition in loop). */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = (b[i] >= 0 ? b[i] : 0);
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-14.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-14.c
new file mode 100644
index 00000000000..6aed7b99b57
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-14.c
@@ -0,0 +1,49 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int main1 ()
+{
+ int i;
+ int ia[N];
+
+
+ /* Not vetorizable yet (induction). */
+ for ( i = 0; i < N; i++) {
+ ia[i] = i;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != i)
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-15.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-15.c
new file mode 100644
index 00000000000..5f0ea5ead9a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-15.c
@@ -0,0 +1,50 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int main1 ()
+{
+ int i;
+ int a[N];
+ int b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+
+ /* Not vetorizable yet (reverse access and forward access). */
+ for (i = N; i > 0; i--)
+ {
+ a[N-i] = b[i-1];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != b[N-1-i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-16.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-16.c
new file mode 100644
index 00000000000..9818dc4a09e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-16.c
@@ -0,0 +1,49 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+#define DIFF 240
+
+int main1 ()
+{
+ int i;
+ float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ float diff;
+
+ /* Not vetorizable yet (reduction). */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ diff += (b[i] - c[i]);
+ }
+
+ /* check results: */
+ if (diff != DIFF)
+ abort ();
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-17.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-17.c
new file mode 100644
index 00000000000..4799dd5a634
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-17.c
@@ -0,0 +1,140 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] & ic[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != ib[i] & ic[i])
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = cb[i] & cc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ca[i] != cb[i] & cc[i])
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = sb[i] & sc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != sb[i] & sc[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-18.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-18.c
new file mode 100644
index 00000000000..f66c3d4aca8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-18.c
@@ -0,0 +1,139 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = (ib[i] | ic[i]);
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != (ib[i] | ic[i]))
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = (cb[i] | cc[i]);
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ca[i] != (cb[i] | cc[i]))
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = (sb[i] | sc[i]);
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != (sb[i] | sc[i]))
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-19.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-19.c
new file mode 100644
index 00000000000..87f1bc41d07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-19.c
@@ -0,0 +1,139 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] ^ ic[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != ib[i] ^ ic[i])
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = cb[i] ^ cc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ca[i] != cb[i] ^ cc[i])
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = sb[i] ^ sc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != sb[i] ^ sc[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-2.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-2.c
new file mode 100644
index 00000000000..397519f08a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-2.c
@@ -0,0 +1,50 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int main1 ()
+{
+ char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ char ca[N];
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ca[i] != cb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-20.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-20.c
new file mode 100644
index 00000000000..10347d10150
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-20.c
@@ -0,0 +1,139 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ~ib[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != ~ib[i])
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = ~cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ca[i] != ~cb[i])
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = ~sb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != ~sb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-21.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-21.c
new file mode 100644
index 00000000000..feea2e5c5f9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-21.c
@@ -0,0 +1,140 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = !ib[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != !ib[i])
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = !cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ca[i] != !cb[i])
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = !sb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != !sb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-22.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-22.c
new file mode 100644
index 00000000000..064fbab2333
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-22.c
@@ -0,0 +1,140 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = -ib[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != -ib[i])
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = -cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ca[i] != -cb[i])
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = -sb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != -sb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-23.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-23.c
new file mode 100644
index 00000000000..6781ad1caf5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-23.c
@@ -0,0 +1,140 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] && ic[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != ib[i] && ic[i])
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = cb[i] && cc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ca[i] != cb[i] && cc[i])
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = sb[i] && sc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != sb[i] && sc[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-24.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-24.c
new file mode 100644
index 00000000000..08f0cff3d75
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-24.c
@@ -0,0 +1,140 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 64
+
+int
+main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N]=
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+ int ic[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char ca[N];
+ char cb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ char cc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sa[N];
+ short sb[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ short sc[N] =
+ {1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0,
+ 1,1,0,0,1,0,1,0};
+
+ /* Check ints. */
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = (ib[i] || ic[i]);
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ia[i] != (ib[i] || ic[i]))
+ abort ();
+ }
+
+ /* Check chars. */
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = (cb[i] || cc[i]);
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (ca[i] != (cb[i] || cc[i]))
+ abort ();
+ }
+
+ /* Check shorts. */
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = (sb[i] || sc[i]);
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (sa[i] != (sb[i] || sc[i]))
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-25.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-25.c
new file mode 100644
index 00000000000..bdfc38367bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-25.c
@@ -0,0 +1,66 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 128
+
+int main1 (int n, int *p)
+{
+ int i;
+ int ib[N];
+ int ia[N];
+ int k;
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = n;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != n)
+ abort ();
+ }
+
+ k = *p;
+ for (i = 0; i < N; i++)
+ {
+ ib[i] = k;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ib[i] != k)
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ int m = 8;
+
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 (m, &m);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-26.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-26.c
new file mode 100644
index 00000000000..9afe6a27aaa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-26.c
@@ -0,0 +1,51 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 128
+
+/* unaligned store. */
+
+int main1 ()
+{
+ int i;
+ int ia[N+1];
+
+ for (i = 1; i <= N; i++)
+ {
+ ia[i] = 5;
+ }
+
+ /* check results: */
+ for (i = 1; i <= N; i++)
+ {
+ if (ia[i] != 5)
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c
new file mode 100644
index 00000000000..42f55fdb6bc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c
@@ -0,0 +1,57 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 128
+
+/* unaligned load. */
+
+int main1 ()
+{
+ int i;
+ int ia[N];
+ int ib[N+1];
+
+ for (i=0; i < N; i++)
+ {
+ ib[i] = i;
+ }
+
+ for (i = 1; i <= N; i++)
+ {
+ ia[i-1] = ib[i];
+ }
+
+ /* check results: */
+ for (i = 1; i <= N; i++)
+ {
+ if (ia[i-1] != ib[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-28.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-28.c
new file mode 100644
index 00000000000..2154aeb9f93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-28.c
@@ -0,0 +1,54 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 128
+#define OFF 3
+
+/* unaligned store. */
+
+int main1 (int off)
+{
+ int i;
+ int ia[N+OFF];
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i+off] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i+off] != 5)
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ main1 (0); /* aligned */
+ main1 (OFF); /* unaligned */
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-29.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-29.c
new file mode 100644
index 00000000000..98dfa585bb2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-29.c
@@ -0,0 +1,60 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 128
+#define OFF 3
+
+/* unaligned load. */
+
+int main1 (int off)
+{
+ int i;
+ int ia[N];
+ int ib[N+OFF];
+
+ for (i = 0; i < N+OFF; i++)
+ {
+ ib[i] = i;
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i+off];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i+off])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ main1 (0); /* aligned */
+ main1 (OFF); /* unaligned */
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-3.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-3.c
new file mode 100644
index 00000000000..0a0d8231d27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-3.c
@@ -0,0 +1,63 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 20
+
+int
+main1 ()
+{
+ int i;
+ float a[N];
+ float e[N];
+ float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+ int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ia[N];
+
+ for (i = 0; i < N; i++)
+ {
+ a[i] = b[i] + c[i] + d[i];
+ e[i] = b[i] + c[i] + d[i];
+ ia[i] = ib[i] + ic[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ float fres = b[i] + c[i] + d[i];
+ int ires = ib[i] + ic[i];
+ if (a[i] != fres || e[i] != fres || ia[i] != ires)
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */
+
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-4.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-4.c
new file mode 100644
index 00000000000..698e8a1b3c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-4.c
@@ -0,0 +1,51 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 20
+
+int
+main1 ()
+{
+ int i;
+ float a[N];
+ float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+ float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+
+ for (i = 0; i < N; i++)
+ {
+ a[i] = b[i] * c[i];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != b[i] * c[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-5.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-5.c
new file mode 100644
index 00000000000..d5445c8c119
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-5.c
@@ -0,0 +1,69 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int main1 ()
+{
+ int i, j;
+ float a[N];
+ float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+
+ i = 0;
+ j = 0;
+ while (i < 5*N)
+ {
+ a[j] = c[j];
+ i += 5;
+ j++;
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != c[i])
+ abort ();
+ }
+
+
+ for (i = N; i > 0; i--)
+ {
+ a[N-i] = d[N-i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != d[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-6.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-6.c
new file mode 100644
index 00000000000..3a40503e1ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-6.c
@@ -0,0 +1,71 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+float results1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,0.00};
+float results2[N] = {0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
+
+int main1 ()
+{
+ int i;
+ float a[N] = {0};
+ float e[N] = {0};
+ float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+
+ for (i = 0; i < N/2; i++)
+ {
+ a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ e[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ }
+
+ for (i=0; i<N; i++)
+ {
+ if (a[i] != results1[i] || e[i] != results2[i])
+ abort();
+ }
+
+ /* check results: */
+
+ for (i = 1; i <=N-4; i++)
+ {
+ a[i+3] = b[i-1];
+ }
+
+ /* check results: */
+ for (i = 1; i <=N-4; i++)
+ {
+ if (a[i+3] != b[i-1])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-7.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-7.c
new file mode 100644
index 00000000000..d54ef642d1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-7.c
@@ -0,0 +1,64 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 128
+
+int main1 ()
+{
+ int i;
+ short sa[N];
+ short sb[N];
+
+ for (i = 0; i < N; i++)
+ {
+ sb[i] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (sb[i] != 5)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = sb[i] + 100;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (sa[i] != 105)
+ abort ();
+ }
+
+ return 0;
+}
+
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-8.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-8.c
new file mode 100644
index 00000000000..e66718f77ef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-8.c
@@ -0,0 +1,50 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+float b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+float a[N];
+
+int main1 (int n)
+{
+ int i;
+
+ /* Not vetorizable yet (unknown loop bound). */
+ for (i = 0; i < n; i++){
+ a[i] = b[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < n; i++)
+ {
+ if (a[i] != b[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 (N);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-9.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-9.c
new file mode 100644
index 00000000000..939e265d539
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-9.c
@@ -0,0 +1,50 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int main1 ()
+{
+ int i;
+ short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ia[N];
+
+ /* Not vetorizable yet (type cast). */
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = (int) sb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != (int) sb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-all.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-all.c
new file mode 100644
index 00000000000..2c3fee0cf2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-all.c
@@ -0,0 +1,228 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#include <stdarg.h>
+#include <signal.h>
+
+#define N 16
+
+int iadd_results[N] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
+float fadd_results[N] = {0.0,6.0,12.0,18.0,24.0,30.0,36.0,42.0,48.0,54.0,60.0,66.0,72.0,78.0,84.0,90.0};
+float fmul_results[N] = {0.0,3.0,12.0,27.0,48.0,75.0,108.0,147.0,192.0,243.0,300.0,363.0,432.0,507.0,588.0,675.0};
+float fresults1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,48.00,54.00,60.00,66.00,72.00,78.00,84.00,90.00};
+float fresults2[N] = {0.00,6.00,12.00,18.00,24.00,30.00,36.00,42.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
+
+/****************************************************/
+void icheck_results (int *a, int *results)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != results[i])
+ abort ();
+ }
+}
+
+void fcheck_results (float *a, float *results)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != results[i])
+ abort ();
+ }
+}
+
+void
+fbar_mul (float *a)
+{
+ fcheck_results (a, fmul_results);
+}
+
+void
+fbar_add (float *a)
+{
+ fcheck_results (a, fadd_results);
+}
+
+void
+ibar_add (int *a)
+{
+ icheck_results (a, iadd_results);
+}
+
+void
+fbar1 (float *a)
+{
+ fcheck_results (a, fresults1);
+}
+
+void
+fbar2 (float *a)
+{
+ fcheck_results (a, fresults2);
+}
+
+
+/* All of the loops below are currently vectorizable. */
+
+int
+main1 ()
+{
+ int i,j;
+ float a[N];
+ float e[N];
+ float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+ int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ia[N];
+ char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ char ca[N];
+ short sa[N];
+
+ /* Test 1: copy chars. */
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = cb[i];
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ca[i] != cb[i])
+ abort ();
+ }
+
+
+ /* Test 2: fp mult. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = b[i] * c[i];
+ }
+ fbar_mul (a);
+
+
+ /* Test 3: mixed types (int, fp), same nunits in vector. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = b[i] + c[i] + d[i];
+ e[i] = b[i] + c[i] + d[i];
+ ia[i] = ib[i] + ic[i];
+ }
+ ibar_add (ia);
+ fbar_add (a);
+ fbar_add (e);
+
+
+ /* Test 4: access with offset. */
+ for (i = 0; i < N/2; i++)
+ {
+ a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ e[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ }
+ fbar1 (a);
+ fbar2 (e);
+
+
+ /* Test 5: access with offset */
+ for (i = 1; i <=N-4; i++)
+ {
+ a[i+3] = b[i-1];
+ }
+ /* check results: */
+ for (i = 1; i <=N-4; i++)
+ {
+ if (a[i+3] != b[i-1])
+ abort ();
+ }
+
+
+ /* Test 6 - loop induction with stride != 1. */
+ i = 0;
+ j = 0;
+ while (i < 5*N)
+ {
+ a[j] = c[j];
+ i += 5;
+ j++;
+ }
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != c[i])
+ abort ();
+ }
+
+
+ /* Test 7 - reverse access. */
+ for (i = N; i > 0; i--)
+ {
+ a[N-i] = d[N-i];
+ }
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != d[i])
+ abort ();
+ }
+
+
+ /* Tests 8,9,10 - constants. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = 5.0;
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != 5.0)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = 5;
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (sa[i] != 5)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] + 5;
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i] + 5)
+ abort ();
+ }
+
+ return 0;
+}
+
+void
+sig_ill_handler (int sig)
+{
+ exit(0);
+}
+
+int main (void)
+{
+ /* Exit on systems without altivec. */
+ signal (SIGILL, sig_ill_handler);
+ /* Altivec instruction, 'vor %v0,%v0,%v0'. */
+ asm volatile (".long 0x10000484");
+ signal (SIGILL, SIG_DFL);
+
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 10 loops" 1 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-none.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-none.c
new file mode 100644
index 00000000000..2d90a15b9b5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-none.c
@@ -0,0 +1,190 @@
+/* { dg-do compile { target powerpc*-*-* i?86-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
+/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
+
+#define N 16
+
+int iadd_results[N] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
+float fadd_results[N] = {0.0,6.0,12.0,18.0,24.0,30.0,36.0,42.0,48.0,54.0,60.0,66.0,72.0,78.0,84.0,90.0};
+float fmul_results[N] = {0.0,3.0,12.0,27.0,48.0,75.0,108.0,147.0,192.0,243.0,300.0,363.0,432.0,507.0,588.0,675.0};
+float fresults1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,48.00,54.00,60.00,66.00,72.00,78.00,84.00,90.00};
+float fresults2[N] = {0.00,6.00,12.00,18.00,24.00,30.00,36.00,42.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
+
+/****************************************************/
+void icheck_results (int *a, int *results)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != results[i])
+ abort ();
+ }
+}
+
+void fcheck_results (float *a, float *results)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != results[i])
+ abort ();
+ }
+}
+
+void
+fbar_mul (float *a)
+{
+ fcheck_results (a, fmul_results);
+}
+
+void
+fbar_add (float *a)
+{
+ fcheck_results (a, fadd_results);
+}
+
+void
+ibar_add (int *a)
+{
+ icheck_results (a, iadd_results);
+}
+
+void
+fbar1 (float *a)
+{
+ fcheck_results (a, fresults1);
+}
+
+void
+fbar2 (float *a)
+{
+ fcheck_results (a, fresults2);
+}
+
+
+/* None of the loops below is currently vectorizable. The vectorizer will
+ be enhanced to vectorize most of these loops. */
+
+int
+foo (int n)
+{
+ int i,j;
+ float a[N];
+ float e[N];
+ float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+ short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ short sa[N];
+ int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ int ia[N];
+ int diff = 0;
+ char cb[N];
+ char cc[N];
+ char image[N][N];
+ char block[N][N];
+
+
+ /* Test 1 - unknown loop bound. */
+ for (i = 0; i < n; i++)
+ {
+ a[i] = b[i];
+ }
+ fbar (a);
+
+
+ /* Test 2 - type cast. */
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = (int) sb[i];
+ }
+ fbar (a);
+
+
+ /* Test 3 - strided access pattern. */
+ for (i = 0; i < N/2; i++)
+ {
+ a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
+ d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
+ }
+ fbar (a);
+
+
+ /* Test 4 - no target support for integer mult. */
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] * ic[i];
+ }
+ ibar (ia);
+
+
+ /* Test 5 - two types with different nunits in vector. */
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] + ic[i];
+ sa[i] = sb[i] + sc[i];
+ }
+ ibar (ia);
+ sbar (sa);
+
+
+ /* Test 6 - too conservative dependence test. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i];
+ a[i+1] = b[i] + c[i];
+ }
+ fbar (a);
+
+
+ /* Test 7 - condition in loop. */
+ for (i = 0; i < N; i++){
+ a[i] = (b[i] > 0 ? b[i] : 0);
+ }
+ fbar (a);
+
+
+ /* Test 8 - cross-iteration cycle. */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ diff += (cb[i] - cc[i]);
+ }
+ ibar (&diff);
+
+
+ /* Test 9 - outer-loop not attempted; inner-loop has cross
+ iteration cycle and multi-dimensional arrays. */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ for (i = 0; i < N; i++) {
+ diff += (image[i][j] - block[i][j]);
+ }
+ }
+ ibar (&diff);
+
+
+ /* Test 10 - induction. */
+ for ( i = 0; i < N; i++) {
+ a[i] = i;
+ }
+ fbar (a);
+
+
+ /* Test 11 - reverse access and forward access. */
+ for (i = N; i > 0; i--)
+ {
+ a[N-i] = b[i-1];
+ }
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != b[N-1-i])
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized " 3 "vect"} } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 3 "vect"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect.exp b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect.exp
new file mode 100644
index 00000000000..ee8394880ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect.exp
@@ -0,0 +1,35 @@
+# Copyright (C) 1997 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c
index eba207a25e5..c51c4fe5925 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-dom3" } */
+/* { dg-options "-O1 -fdump-tree-dom3 -ftree-loop-optimize" } */
union tree_node;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c b/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c
index 6a43360b07f..76f7b62d469 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-dom3" } */
+/* { dg-options "-O1 -fdump-tree-dom3 -ftree-loop-optimize" } */
union tree_node;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040308-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040308-1.c
new file mode 100644
index 00000000000..59397d8cbb1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040308-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */
+
+int t( int i)
+{
+ int j;
+ if(i ==0)
+ j = 1;
+ else
+ j = 0;
+
+
+ return j;
+}
+
+/* We should convert one COND_EXPRs into straightline code. */
+/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1" {xfail *-*-* } } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040308-2.c b/gcc/testsuite/gcc.dg/tree-ssa/20040308-2.c
new file mode 100644
index 00000000000..3d2daae6f47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040308-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt1-details -fdump-tree-tailc-details" } */
+
+
+int f(int i)
+{
+ int result;
+ result = t(i);
+ if (result)
+ return result;
+ return 0;
+}
+
+/* We should convert one COND_EXPRs into straightline code. */
+/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1" } } */
+/* Also we should have found that the call to t is tail called. */
+/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040308-3.c b/gcc/testsuite/gcc.dg/tree-ssa/20040308-3.c
new file mode 100644
index 00000000000..86f003f127a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040308-3.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */
+
+int t( int i)
+{
+ int j;
+ if(i>=0)
+ j = i;
+ else
+ j = -i;
+ return j;
+}
+
+/* We should convert one COND_EXPRs into straightline code with ABS. */
+/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1"} } */
+/* { dg-final { scan-tree-dump-times "ABS_EXPR" 1 "phiopt1"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040308-4.c b/gcc/testsuite/gcc.dg/tree-ssa/20040308-4.c
new file mode 100644
index 00000000000..ac85077551f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040308-4.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */
+
+int t( int i, int k)
+{
+ int j;
+ if(i!=k)
+ j = i;
+ else
+ j = k;
+
+ return j;
+}
+
+/* We should convert one COND_EXPRs into straightline code. */
+/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-headers.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-headers.c
index efe831beab5..eb03840e770 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/copy-headers.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-headers.c
@@ -1,15 +1,18 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-ch-details" } */
+/* { dg-options "-O2 -fdump-tree-dom1 -ftree-loop-optimize" } */
-extern int foo (int);
+extern void link_error (void);
void bla (void)
{
- int i, n = foo (0);
+ int i, j = 1;
- for (i = 0; i < n; i++)
- foo (i);
+ for (i = 0; i < 100; i++)
+ j = 0;
+
+ if (j)
+ link_error ();
}
-/* There should be a header scheduled for duplication. */
-/* { dg-final { scan-tree-dump-times "Scheduled" 1 "ch"} } */
+/* There should be no link_error call in the dom1 dump. */
+/* { dg-final { scan-tree-dump-times "link_error" 0 "dom1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ivcanon-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ivcanon-1.c
new file mode 100644
index 00000000000..430a9514ca5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ivcanon-1.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-optimize -fscalar-evolutions -funroll-loops -fdump-tree-optimized" } */
+
+void foo(void)
+{
+ int n = 16875;
+
+ while (n)
+ {
+ if (n&1)
+ bar (n);
+ n >>= 1;
+ }
+}
+
+static inline int power (long x, unsigned int n)
+{
+ long y = n % 2 ? x : 1;
+
+ while (n >>= 1)
+ {
+ x = x * x;
+ if (n % 2)
+ y = y * x;
+ }
+
+ return y;
+}
+
+void test(long x)
+{
+ bar (power (x, 10));
+ bar (power (x, 27));
+}
+
+/* All loops should be completely unrolled, so there should be no labels. */
+/* { dg-final { scan-tree-dump-times "<L" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/typespec-1.c b/gcc/testsuite/gcc.dg/typespec-1.c
index 1acaaf73676..a0e0c1a9992 100644
--- a/gcc/testsuite/gcc.dg/typespec-1.c
+++ b/gcc/testsuite/gcc.dg/typespec-1.c
@@ -11,7 +11,8 @@
not requiring -pedantic. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-std=gnu99 -Wno-long-double" } */
typedef char type;
void *x0;
diff --git a/gcc/testsuite/gcc.dg/va-arg-2.c b/gcc/testsuite/gcc.dg/va-arg-2.c
index 2e2849c1528..5140545f121 100644
--- a/gcc/testsuite/gcc.dg/va-arg-2.c
+++ b/gcc/testsuite/gcc.dg/va-arg-2.c
@@ -6,7 +6,10 @@
#include <varargs.h> /* { dg-bogus "varargs.h" "missing file" } */
/* { dg-error "" "In file included from" { target *-*-* } 6 } */
-/* { dg-error "no longer implements" "#error 1" { target *-*-* } 4 } */
-/* { dg-error "Revise your code" "#error 2" { target *-*-* } 5 } */
+
+/* APPLE LOCAL BEGIN - varargs.h changes to line numbers hartoog@apple.com */
+/* { dg-error "no longer implements" "#error 1" { target *-*-* } 10 } */
+/* { dg-error "Revise your code" "#error 2" { target *-*-* } 11 } */
+/* APPLE LOCAL END - varargs.h changes to line numbers hartoog@apple.com */
int x; /* prevent empty-source-file warning */
diff --git a/gcc/testsuite/gcc.dg/verbose-asm-2.c b/gcc/testsuite/gcc.dg/verbose-asm-2.c
new file mode 100644
index 00000000000..4a8b1b45972
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/verbose-asm-2.c
@@ -0,0 +1,13 @@
+/* APPLE LOCAL entire file */
+/* Test whether -fverbose-asm emits option values. */
+/* Contibuted by Devang Patel <dpatel@apple.com>. */
+
+/* { dg-do compile } */
+/* { dg-options "-fverbose-asm" } */
+/* { dg-final { scan-assembler "fpeephole=0" } } */
+
+int
+main (int argc, char *argv [])
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-conversion-1.c b/gcc/testsuite/gcc.dg/wtr-conversion-1.c
index 18d26165f2a..b133ff1e8c4 100644
--- a/gcc/testsuite/gcc.dg/wtr-conversion-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-conversion-1.c
@@ -2,7 +2,8 @@
Note, gcc should omit these warnings in system header files.
By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 4/09/2001. */
/* { dg-do compile } */
-/* { dg-options "-Wtraditional" } */
+/* APPLE LOCAL -Wlong-double */
+/* { dg-options "-Wtraditional -Wno-long-double" } */
extern void foo_i (int);
extern void foo_f (float);
diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp
index 518e836020c..48226db72a9 100644
--- a/gcc/testsuite/lib/g++.exp
+++ b/gcc/testsuite/lib/g++.exp
@@ -299,12 +299,20 @@ proc g++_target_compile { source dest type options } {
}
lappend options "additional_flags=[libio_include_flags]"
+ # APPLE LOCAL begin testsuite multiply defined
+ if [ istarget *-*-darwin* ] {
+ lappend options "ldflags=-Wl,-multiply_defined,suppress"
+ }
+ # APPLE LOCAL end testsuite multiply defined
lappend options "compiler=$GXX_UNDER_TEST";
set options [concat $gpp_compile_options $options]
set options [concat "$ALWAYS_CXXFLAGS" $options];
+ # APPLE LOCAL long double warning
+ lappend options "additional_flags=-Wno-long-double"
+
if { [regexp "(^| )-frepo( |$)" $options] && \
[regexp "\.o(|bj)$" $dest] } then {
regsub "\.o(|bj)$" $dest ".rpo" rponame
diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp
index ac4dc35e8e9..a27b3583d90 100644
--- a/gcc/testsuite/lib/gcc.exp
+++ b/gcc/testsuite/lib/gcc.exp
@@ -143,7 +143,7 @@ proc gcc_target_compile { source dest type options } {
if [target_info exists gcc,no_trampolines] {
lappend options "additional_flags=-DNO_TRAMPOLINES"
}
- if [target_info exists gcc,no_label_values] {
+ if { 1 } {
lappend options "additional_flags=-DNO_LABEL_VALUES"
}
# TOOL_OPTIONS must come first, so that it doesn't override testcase
@@ -154,6 +154,11 @@ proc gcc_target_compile { source dest type options } {
if [target_info exists gcc,timeout] {
lappend options "timeout=[target_info gcc,timeout]"
}
+ # APPLE LOCAL begin testsuite multiply defined
+ if [ istarget *-*-darwin* ] {
+ lappend options "ldflags=-Wl,-multiply_defined,suppress"
+ }
+ # APPLE LOCAL end testsuite multiply defined
lappend options "compiler=$GCC_UNDER_TEST"
set options [dg-additional-files-options $options $source]
return [target_compile $source $dest $type $options]
diff --git a/gcc/testsuite/lib/obj-c++-dg.exp b/gcc/testsuite/lib/obj-c++-dg.exp
new file mode 100644
index 00000000000..90e4a37a940
--- /dev/null
+++ b/gcc/testsuite/lib/obj-c++-dg.exp
@@ -0,0 +1,165 @@
+# APPLE LOCAL file Objective-C++
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+load_lib dg.exp
+load_lib file-format.exp
+load_lib target-supports.exp
+load_lib scanasm.exp
+
+# For prune_gcc_output.
+load_lib gcc.exp
+
+if ![info exists TORTURE_OPTIONS] {
+ # It is theoretically beneficial to group all of the O2/O3 options together,
+ # as in many cases the compiler will generate identical executables for
+ # all of them--and the c-torture testsuite will skip testing identical
+ # executables multiple times.
+ # Also note that -finline-functions is explicitly included in one of the
+ # items below, even though -O3 is also specified, because some ports may
+ # choose to disable inlining functions by default, even when optimizing.
+ set TORTURE_OPTIONS [list \
+ { -O0 } \
+ { -O1 } \
+ { -O2 } \
+ { -O3 -fomit-frame-pointer } \
+ { -O3 -fomit-frame-pointer -funroll-loops } \
+ { -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
+ { -O3 -g } \
+ { -Os } ]
+}
+
+
+# Split TORTURE_OPTIONS into two choices: one for testcases with loops and
+# one for testcases without loops.
+
+set torture_with_loops $TORTURE_OPTIONS
+set torture_without_loops ""
+foreach option $TORTURE_OPTIONS {
+ if ![string match "*loop*" $option] {
+ lappend torture_without_loops $option
+ }
+}
+
+# Define gcc callbacks for dg.exp.
+
+proc obj-c++-dg-test { prog do_what extra_tool_flags } {
+ # Set up the compiler flags, based on what we're going to do.
+
+ switch $do_what {
+ "preprocess" {
+ set compile_type "preprocess"
+ set output_file "[file rootname [file tail $prog]].i"
+ }
+ "compile" {
+ set compile_type "assembly"
+ set output_file "[file rootname [file tail $prog]].s"
+ }
+ "assemble" {
+ set compile_type "object"
+ set output_file "[file rootname [file tail $prog]].o"
+ }
+ "link" {
+ set compile_type "executable"
+ set output_file "[file rootname [file tail $prog]].exe"
+ # The following line is needed for targets like the i960 where
+ # the default output file is b.out. Sigh.
+ }
+ "run" {
+ set compile_type "executable"
+ # FIXME: "./" is to cope with "." not being in $PATH.
+ # Should this be handled elsewhere?
+ # YES.
+ set output_file "./[file rootname [file tail $prog]].exe"
+ # This is the only place where we care if an executable was
+ # created or not. If it was, dg.exp will try to run it.
+ remote_file build delete $output_file;
+ }
+ default {
+ perror "$do_what: not a valid dg-do keyword"
+ return ""
+ }
+ }
+ set options ""
+ if { $extra_tool_flags != "" } {
+ lappend options "additional_flags=$extra_tool_flags"
+ }
+
+ set comp_output [obj-c++_target_compile "$prog" "$output_file" "$compile_type" $options];
+
+ return [list $comp_output $output_file]
+}
+
+proc obj-c++-dg-prune { system text } {
+ set text [prune_gcc_output $text]
+
+ # If we see "region xxx is full" then the testcase is too big for ram.
+ # This is tricky to deal with in a large testsuite like c-torture so
+ # deal with it here. Just mark the testcase as unsupported.
+ if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $text] {
+ # The format here is important. See dg.exp.
+ return "::unsupported::memory full"
+ }
+
+ return $text
+}
+
+# Utility routines.
+
+#
+# search_for -- looks for a string match in a file
+#
+proc search_for { file pattern } {
+ set fd [open $file r]
+ while { [gets $fd cur_line]>=0 } {
+ if [string match "*$pattern*" $cur_line] then {
+ close $fd
+ return 1
+ }
+ }
+ close $fd
+ return 0
+}
+
+# Modified dg-runtest that can cycle through a list of optimization options
+# as c-torture does.
+proc obj-c++-dg-runtest { testcases default-extra-flags } {
+ global runtests
+
+ foreach test $testcases {
+ # If we're only testing specific files and this isn't one of
+ # them, skip it.
+ if ![runtest_file_p $runtests $test] {
+ continue
+ }
+
+ # Look for a loop within the source code - if we don't find one,
+ # don't pass -funroll[-all]-loops.
+ global torture_with_loops torture_without_loops
+ if [expr [search_for $test "for*("]+[search_for $test "while*("]] {
+ set option_list $torture_with_loops
+ } else {
+ set option_list $torture_without_loops
+ }
+
+ set nshort [file tail [file dirname $test]]/[file tail $test]
+
+ foreach flags $option_list {
+ verbose "Testing $nshort, $flags" 1
+ dg-test $test $flags ${default-extra-flags}
+ }
+ }
+}
diff --git a/gcc/testsuite/lib/obj-c++.exp b/gcc/testsuite/lib/obj-c++.exp
new file mode 100644
index 00000000000..05a84268758
--- /dev/null
+++ b/gcc/testsuite/lib/obj-c++.exp
@@ -0,0 +1,311 @@
+# APPLE LOCAL file Objective-C++
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Rob Savoye (rob@cygnus.com)
+# Currently maintained by Doug Evans (dje@cygnus.com)
+
+# This file is loaded by the tool init file (eg: unix.exp). It provides
+# default definitions for objc_start, etc. and other supporting cast members.
+
+# These globals are used by objc_start if no compiler arguments are provided.
+# They are also used by the various testsuites to define the environment:
+# where to find stdio.h, libc.a, etc.
+
+load_lib libgloss.exp
+load_lib prune.exp
+load_lib gcc-defs.exp
+
+# We want to sponge off many G++ goodies.
+load_lib g++.exp
+
+#
+# OBJCXX_UNDER_TEST is the compiler under test.
+#
+
+#
+# default_obj-c++_version -- extract and print the version number of the compiler
+#
+
+proc default_obj-c++_version { } {
+ global OBJCXX_UNDER_TEST
+
+ obj-c++_init;
+
+ # ignore any arguments after the command
+ set compiler [lindex $OBJCXX_UNDER_TEST 0]
+
+ if ![is_remote host] {
+ set compiler_name [which $compiler];
+ } else {
+ set compiler_name $compiler;
+ }
+
+ # verify that the compiler exists
+ if { $compiler_name != 0 } then {
+ set tmp [remote_exec host "$compiler -v"]
+ set status [lindex $tmp 0];
+ set output [lindex $tmp 1];
+ regexp "version.*$" $output version
+ if { $status == 0 && [info exists version] } then {
+ clone_output "$compiler_name $version\n"
+ } else {
+ clone_output "Couldn't determine version of $compiler_name: $output\n"
+ }
+ } else {
+ # compiler does not exist (this should have already been detected)
+ warning "$compiler does not exist"
+ }
+}
+
+#
+# Call obj-c++_version. We do it this way so we can override it if needed.
+#
+proc obj-c++_version { } {
+ default_obj-c++_version;
+}
+
+#
+# obj-c++_init -- called at the start of each .exp script.
+#
+# There currently isn't much to do, but always using it allows us to
+# make some enhancements without having to go back and rewrite the scripts.
+#
+
+set objcxx_initialized 0
+
+proc obj-c++_init { args } {
+ global subdir
+ global objcxx_initialized
+ global base_dir
+ global tmpdir
+ global libdir
+ global gluefile wrap_flags
+ global ALWAYS_CXXFLAGS
+ global GXX_UNDER_TEST
+ global OBJCXX_UNDER_TEST
+ global TOOL_EXECUTABLE
+ global TESTING_IN_BUILD_TREE
+
+ if { $objcxx_initialized == 1 } { return; }
+
+ if ![info exists GXX_UNDER_TEST] then {
+ if [info exists TOOL_EXECUTABLE] {
+ set GXX_UNDER_TEST $TOOL_EXECUTABLE;
+ } else {
+ if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
+ set GXX_UNDER_TEST [transform c++]
+ } else {
+ set GXX_UNDER_TEST [findfile $base_dir/../g++ "$base_dir/../g++ -B$base_dir/../" [findfile $base_dir/g++ "$base_dir/g++ -B$base_dir/" [transform c++]]]
+ }
+ }
+ }
+
+ set OBJCXX_UNDER_TEST "$GXX_UNDER_TEST -x objective-c++"
+
+ if ![info exists tmpdir] then {
+ set tmpdir /tmp
+ }
+ if { [target_info needs_status_wrapper]!="" && ![info exists gluefile] } {
+ set gluefile ${tmpdir}/testglue.o;
+ set result [build_wrapper $gluefile];
+ if { $result != "" } {
+ set gluefile [lindex $result 0];
+ set wrap_flags [lindex $result 1];
+ } else {
+ unset gluefile
+ }
+ }
+
+ set ALWAYS_CXXFLAGS ""
+
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ lappend ALWAYS_CXXFLAGS "additional_flags=[g++_include_flags [get_multilibs ${TOOL_OPTIONS}] ]";
+ lappend ALWAYS_CXXFLAGS "ldflags=[g++_link_flags [get_multilibs ${TOOL_OPTIONS}] ]";
+ } else {
+ lappend ALWAYS_CXXFLAGS "additional_flags=[g++_include_flags [get_multilibs] ]";
+ lappend ALWAYS_CXXFLAGS "ldflags=[g++_link_flags [get_multilibs] ]";
+ }
+ }
+
+ if [info exists TOOL_OPTIONS] {
+ lappend ALWAYS_CXXFLAGS "additional_flags=$TOOL_OPTIONS";
+ }
+
+ # Make sure that lines are not wrapped. That can confuse the
+ # error-message parsing machinery.
+ lappend ALWAYS_CXXFLAGS "additional_flags=-fmessage-length=0"
+
+ verbose -log "ALWAYS_CXXFLAGS set to $ALWAYS_CXXFLAGS"
+
+ verbose "obj-c++ is initialized" 3
+}
+
+proc obj-c++_target_compile { source dest type options } {
+ global rootme;
+ global tmpdir;
+ global gluefile wrap_flags;
+ global ALWAYS_CXXFLAGS
+ global OBJCXX_UNDER_TEST
+ global TOOL_OPTIONS
+ global ld_library_path
+
+ lappend options "compiler=$OBJCXX_UNDER_TEST"
+
+ #set ld_library_path ".:${rootme}"
+ lappend options "libs=-lstdc++"
+
+ if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
+ lappend options "libs=${gluefile}"
+ lappend options "ldflags=$wrap_flags"
+ }
+
+ if [target_info exists obj-c++,stack_size] {
+ lappend options "additional_flags=-DSTACK_SIZE=[target_info obj-c++,stack_size]"
+ }
+ if [target_info exists obj-c++,no_trampolines] {
+ lappend options "additional_flags=-DNO_TRAMPOLINES"
+ }
+ if [target_info exists obj-c++,no_label_values] {
+ lappend options "additional_flags=-DNO_LABEL_VALUES"
+ }
+ if [info exists TOOL_OPTIONS] {
+ lappend options "additional_flags=$TOOL_OPTIONS"
+ }
+
+ set options [concat "$ALWAYS_CXXFLAGS" $options];
+
+ return [target_compile $source $dest $type $options]
+}
+
+#
+# obj-c++_pass -- utility to record a testcase passed
+#
+
+proc obj-c++_pass { testcase cflags } {
+ if { "$cflags" == "" } {
+ pass "$testcase"
+ } else {
+ pass "$testcase, $cflags"
+ }
+}
+
+#
+# obj-c++_fail -- utility to record a testcase failed
+#
+
+proc obj-c++_fail { testcase cflags } {
+ if { "$cflags" == "" } {
+ fail "$testcase"
+ } else {
+ fail "$testcase, $cflags"
+ }
+}
+
+#
+# obj-c++_finish -- called at the end of every .exp script that calls obj-c++_init
+#
+# The purpose of this proc is to hide all quirks of the testing environment
+# from the testsuites. It also exists to undo anything that obj-c++_init did
+# (that needs undoing).
+#
+
+proc obj-c++_finish { } {
+ # The testing harness apparently requires this.
+ global errorInfo;
+
+ if [info exists errorInfo] then {
+ unset errorInfo
+ }
+
+ # Might as well reset these (keeps our caller from wondering whether
+ # s/he has to or not).
+ global prms_id bug_id
+ set prms_id 0
+ set bug_id 0
+}
+
+proc obj-c++_exit { } {
+ global gluefile;
+
+ if [info exists gluefile] {
+ file_on_build delete $gluefile;
+ unset gluefile;
+ }
+}
+
+# If this is an older version of dejagnu (without runtest_file_p),
+# provide one and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
+# This can be deleted after next dejagnu release.
+
+if { [info procs runtest_file_p] == "" } then {
+ proc runtest_file_p { runtests testcase } {
+ if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
+ if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
+ return 1
+ } else {
+ return 0
+ }
+ }
+ return 1
+ }
+}
+
+# Provide a definition of this if missing (delete after next dejagnu release).
+
+if { [info procs prune_warnings] == "" } then {
+ proc prune_warnings { text } {
+ return $text
+ }
+}
+
+# Utility used by mike-gcc.exp and c-torture.exp.
+# Check the compiler(/assembler/linker) output for text indicating that
+# the testcase should be marked as "unsupported".
+#
+# When dealing with a large number of tests, it's difficult to weed out the
+# ones that are too big for a particular cpu (eg: 16 bit with a small amount
+# of memory). There are various ways to deal with this. Here's one.
+# Fortunately, all of the cases where this is likely to happen will be using
+# gld so we can tell what the error text will look like.
+
+proc ${tool}_check_unsupported_p { output } {
+ if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
+ return "memory full"
+ }
+ return ""
+}
+
+# Prune messages from obj-c++ that aren't useful.
+
+proc prune_obj-c++_output { text } {
+ #send_user "Before:$text\n"
+ regsub -all "(^|\n)\[^\n\]*: In (function|method) \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: At top level:\[^\n\]*" $text "" text
+
+ # It would be nice to avoid passing anything to obj-c++ that would cause it to
+ # issue these messages (since ignoring them seems like a hack on our part),
+ # but that's too difficult in the general case. For example, sometimes
+ # you need to use -B to point obj-c++ at crt0.o, but there are some targets
+ # that don't have crt0.o.
+ regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
+ regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
+
+ #send_user "After:$text\n"
+
+ return $text
+}
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index 79d93cbf089..527813139f6 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -156,12 +156,13 @@ proc scan-assembler-dem { args } {
}
# Find c++filt like we find g++ in g++.exp.
+ # APPLE LOCAL - c++filt3
if ![info exists cxxfilt] {
set cxxfilt [findfile $base_dir/../../binutils/cxxfilt \
$base_dir/../../binutils/cxxfilt \
[findfile $base_dir/../c++filt $base_dir/../c++filt \
[findfile $base_dir/c++filt $base_dir/c++filt \
- [transform c++filt]]]]
+ [transform c++filt3]]]]
verbose -log "c++filt is $cxxfilt"
}
@@ -202,12 +203,13 @@ proc scan-assembler-dem-not { args } {
}
# Find c++filt like we find g++ in g++.exp.
+ # APPLE LOCAL - c++filt3
if ![info exists cxxfilt] {
set cxxfilt [findfile $base_dir/../../binutils/cxxfilt \
$base_dir/../../binutils/cxxfilt \
[findfile $base_dir/../c++filt $base_dir/../c++filt \
[findfile $base_dir/c++filt $base_dir/c++filt \
- [transform c++filt]]]]
+ [transform c++filt3]]]]
verbose -log "c++filt is $cxxfilt"
}
diff --git a/gcc/testsuite/lib/scantree.exp b/gcc/testsuite/lib/scantree.exp
index 76d1a59fb60..b53c1ba235f 100644
--- a/gcc/testsuite/lib/scantree.exp
+++ b/gcc/testsuite/lib/scantree.exp
@@ -19,6 +19,51 @@
#
# This is largely borrowed from scanasm.exp.
+# Utility for diffing compiler result against an expected output file.
+# Invoked via dg-final. Call pass if there are no differences between
+# the output of the compiler and the expected output file, otherwise
+# fail. The expected output file has the same name as the output
+# file, and is stored in the same directory as the testcase.
+#
+# Argument 0 is the suffix for the tree dump file
+# Argument 1 handles expected failures and the like
+proc diff-tree-dumps { args } {
+ if { [llength $args] < 1 } {
+ error "diff-tree-dumps: too few arguments"
+ return
+ }
+ if { [llength $args] > 2 } {
+ error "diff-tree-dumps:: too many arguments"
+ return
+ }
+ if { [llength $args] >= 2 } {
+ switch [dg-process-target [lindex $args 1]] {
+ "S" { }
+ "N" { return }
+ "F" { setup_xfail "*-*-*" }
+ "P" { }
+ }
+ }
+
+ # This assumes that we are two frames down from dg-test, and that
+ # it still stores the filename of the testcase in a local variable "name".
+ # A cleaner solution would require a new dejagnu release.
+ upvar 2 prog testcase
+
+ # This must match the rule in gcc-dg.exp.
+ set new_file "[glob [file tail $testcase].t??.[lindex $args 0]]"
+ set reference_file "[glob $testcase.[lindex $args 0]]"
+
+ set test_result [diff $reference_file $new_file]
+
+ if { $test_result == 1 } {
+ pass "$testcase diff-tree-dumps [lindex $args 0]"
+ } else {
+ fail "$testcase diff-tree-dumps [lindex $args 0]"
+ local_exec (diff $reference_file $new_file 0);
+ }
+}
+
# Utility for scanning compiler result, invoked via dg-final.
# Call pass if pattern is present, otherwise fail.
#
diff --git a/gcc/testsuite/obj-c++.dg/basic.mm b/gcc/testsuite/obj-c++.dg/basic.mm
new file mode 100644
index 00000000000..6a0de713825
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/basic.mm
@@ -0,0 +1,24 @@
+// APPLE LOCAL file Objective-C++
+// A basic sanity check for Objective-C++.
+// { dg-do run }
+
+#include <objc/objc.h>
+#include <objc/Object.h>
+
+#include <iostream>
+
+@interface Greeter : Object
+- (void) greet;
+@end
+
+@implementation Greeter
+- (void) greet { printf ("Hello from Objective-C\n"); }
+@end
+
+int
+main ()
+{
+ std::cout << "Hello from C++\n";
+ Greeter *obj = [Greeter new];
+ [obj greet];
+}
diff --git a/gcc/testsuite/obj-c++.dg/dg.exp b/gcc/testsuite/obj-c++.dg/dg.exp
new file mode 100644
index 00000000000..52109d30131
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/dg.exp
@@ -0,0 +1,40 @@
+# APPLE LOCAL file Objective-C++
+# GCC Objective-C++ testsuite that uses the `dg.exp' driver.
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Load support procs.
+load_lib obj-c++-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CXXFLAGS
+if ![info exists DEFAULT_CXXFLAGS] then {
+ set DEFAULT_CXXFLAGS ""
+}
+
+# Initialize `dg'.
+dg-init
+
+# Gather a list of all tests.
+set all [lsort [find $srcdir/$subdir *.mm]]
+
+# Main loop.
+# (The -lobjc is a cheap hack, should be fixed to account for both
+# installed and uninstalled objc libs)
+dg-runtest $all "" "$DEFAULT_CXXFLAGS -lobjc"
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/obj-c++.dg/method-1.mm b/gcc/testsuite/obj-c++.dg/method-1.mm
new file mode 100644
index 00000000000..7b6f9364140
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/method-1.mm
@@ -0,0 +1,30 @@
+/* APPLE LOCAL file Objective-C++ */
+/* Test whether casting 'id' to a specific class removes method lookup
+ ambiguity. */
+/* Author: Ziemowit Laski <zlaski@apple.com>. */
+/* { dg-do compile } */
+
+#import <objc/objc.h>
+
+@class Int1, Int2;
+
+@interface Int1
++ (Int1 *)classMethod1;
++ (id)classMethod2;
+- (Int1 *)instanceMethod:(Int2 *)arg; /* { dg-bogus "using" } */
+@end
+
+@interface Int2: Int1
++ (Int1 *)classMethod1;
++ (id)classMethod2;
+- (id)int2Method;
+- (int)instanceMethod:(int)arg; /* { dg-bogus "also found" } */
+@end
+
+int main(void) {
+ id i = [(Int2 *)[Int1 classMethod1] int2Method]; /* { dg-bogus "does not respond to" } */
+ int j = [(Int2 *)[Int2 classMethod2] instanceMethod: 45]; /* { dg-bogus "multiple declarations" } */
+ /* { dg-bogus "invalid conversion" "" { target *-*-* } 26 } */
+ /* { dg-bogus "invalid conversion" "" { target *-*-* } 26 } */
+ return j;
+}
diff --git a/gcc/testsuite/obj-c++.dg/super-class-1.mm b/gcc/testsuite/obj-c++.dg/super-class-1.mm
new file mode 100644
index 00000000000..5b1bd6c0236
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/super-class-1.mm
@@ -0,0 +1,30 @@
+/* APPLE LOCAL file call super */
+/* Test calling super from within a category method. */
+/* { dg-do compile } */
+#import <objc/objc.h>
+
+@interface NSObject
+@end
+@interface NSMenuItem: NSObject
+@end
+
+@interface NSObject (Test)
++ (int) test_func;
+@end
+
+@implementation NSObject (Test)
++ (int) test_func
+{}
+@end
+
+@interface NSMenuItem (Test)
++ (int) test_func;
+@end
+
+@implementation NSMenuItem (Test)
++ (int) test_func
+{
+ return [super test_func]; /* { dg-bogus "invalid use of undefined type" } */
+} /* { dg-bogus "forward declaration of" "" { target *-*-* } 27 } */
+@end
+
diff --git a/gcc/testsuite/obj-c++/redo-dg.exp b/gcc/testsuite/obj-c++/redo-dg.exp
new file mode 100644
index 00000000000..be5eebd632d
--- /dev/null
+++ b/gcc/testsuite/obj-c++/redo-dg.exp
@@ -0,0 +1,38 @@
+# APPLE LOCAL file Objective-C++
+# GCC Objective-C++ testsuite that uses the `dg.exp' driver.
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Load support procs.
+load_lib obj-c++-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CXXFLAGS
+if ![info exists DEFAULT_CXXFLAGS] then {
+ set DEFAULT_CXXFLAGS ""
+}
+
+# Initialize `dg'.
+dg-init
+
+# Gather a list of all tests.
+set all [lsort [find $srcdir/g++.dg *.C]]
+
+# Main loop.
+dg-runtest $all "" "$DEFAULT_CXXFLAGS"
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/obj-c++/redo-old-deja.exp b/gcc/testsuite/obj-c++/redo-old-deja.exp
new file mode 100644
index 00000000000..1e06c55460e
--- /dev/null
+++ b/gcc/testsuite/obj-c++/redo-old-deja.exp
@@ -0,0 +1,63 @@
+# APPLE LOCAL file Objective-C++
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Rob Savoye. (rob@cygnus.com)
+
+#
+# these tests come from the original DejaGnu test suite
+# developed at Cygnus Support. If this isn't deja gnu, I
+# don't know what is...
+#
+
+# load support procs
+load_lib old-dejagnu.exp
+load_lib obj-c++.exp
+
+
+# When a testcase doesn't have any special options, use these.
+if ![info exists DEFAULT_CXXFLAGS] {
+ set DEFAULT_CXXFLAGS "-ansi -pedantic-errors -Wno-long-long"
+
+}
+
+old-dejagnu-init
+global OBJCXX_UNDER_TEST
+
+#
+# main test loop
+#
+
+set dirlen [expr [string length "$srcdir/$subdir"] + 1];
+foreach file [lsort [find $srcdir/g++.old-deja *.C]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ set tfile [string range $file $dirlen end];
+ if ![runtest_file_p $runtests $tfile] then {
+ continue
+ }
+ verbose "Testing $file"
+
+ # We don't want old-dejagnu.exp to have to know about all the global
+ # variables we use. For now we tell it about CXXFLAGS and LIBS and
+ # leave LDFLAGS alone.
+ old-dejagnu $OBJCXX_UNDER_TEST "$file" "$tfile" "" "$DEFAULT_CXXFLAGS" "-lstdc++"
+}
+
+# The framework doesn't like to see any error remnants,
+# so remove them.
+if [info exists errorInfo] then {
+ unset errorInfo
+}
diff --git a/gcc/testsuite/objc.dg/call-super-1.m b/gcc/testsuite/objc.dg/call-super-1.m
index 19e0d4900dd..b33af776f49 100644
--- a/gcc/testsuite/objc.dg/call-super-1.m
+++ b/gcc/testsuite/objc.dg/call-super-1.m
@@ -1,7 +1,8 @@
+/* APPLE LOCAL file msg send super */
/* Check if objc_super stack variables are created correctly (and
not clobbered by other values). */
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
-/* { dg-options "-std=c99 -lobjc" } */
+/* { dg-options "-std=c99" } */
/* { dg-do run } */
#include <objc/objc.h>
diff --git a/gcc/testsuite/objc.dg/category-1.m b/gcc/testsuite/objc.dg/category-1.m
index 1d29e374aea..251b125a617 100644
--- a/gcc/testsuite/objc.dg/category-1.m
+++ b/gcc/testsuite/objc.dg/category-1.m
@@ -1,16 +1,10 @@
+/* APPLE LOCAL file objc test suite */
/* Test class methods inside categories. */
/* Author: Ziemowit Laski <zlaski@apple.com>. */
/* { dg-options "-lobjc" } */
/* { dg-do run } */
#include <objc/Object.h>
-
-#ifdef __NEXT_RUNTIME__
-#define SUPERCLASS superclass
-#else
-#define SUPERCLASS superClass
-#endif
-
extern int strcmp(const char *s1, const char *s2);
extern void abort(void);
#define CHECK_IF(expr) if(!(expr)) abort()
@@ -20,7 +14,7 @@ extern void abort(void);
@end
@implementation MyObject
-+ (Class)whatever1 { return [super SUPERCLASS]; }
++ (Class)whatever1 { return [super superclass]; }
@end
@interface MyObject (ThisWontCompile)
@@ -28,7 +22,7 @@ extern void abort(void);
@end
@implementation MyObject (ThisWontCompile)
-+(Class)whatever2 { return [super SUPERCLASS]; }
++(Class)whatever2 { return [super superclass]; }
@end
int main (int argc, const char * argv[])
diff --git a/gcc/testsuite/objc.dg/const-cfstring-1.m b/gcc/testsuite/objc.dg/const-cfstring-1.m
new file mode 100644
index 00000000000..d409209daed
--- /dev/null
+++ b/gcc/testsuite/objc.dg/const-cfstring-1.m
@@ -0,0 +1,56 @@
+/* APPLE LOCAL file constant cfstrings */
+/* Test the -fconstant-cfstrings option for constructing
+ compile-time immutable CFStrings, and their interoperation
+ with both Cocoa and CoreFoundation. This will only work
+ on MacOS X 10.1.2 and later. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-options "-fconstant-cfstrings -framework Cocoa" } */
+
+#import <Foundation/NSString.h>
+#import <CoreFoundation/CFString.h>
+
+void printOut(NSString *str) {
+ NSLog(@"The value of str is: %@", str);
+}
+
+CFStringRef s0a = CFSTR("Compile-time string literal");
+CFStringRef s0b = CFSTR("Compile-time string literal");
+
+void checkNSRange(NSRange r) {
+ if (r.location != 6 || r.length != 5) {
+ printOut(@"Range check failed");
+ abort();
+ }
+}
+
+void checkCFRange(CFRange r) {
+ if (r.location != 6 || r.length != 5) {
+ printOut(@"Range check failed");
+ abort();
+ }
+}
+
+int main(void) {
+ const NSString *s1 = @"Compile-time string literal";
+ CFStringRef s2 = CFSTR("Compile-time string literal");
+
+ checkNSRange([@"Hello World" rangeOfString:@"World"]);
+ checkNSRange([(id)CFSTR("Hello World") rangeOfString:@"World"]);
+ checkNSRange([@"Hello World" rangeOfString:(id)CFSTR("World")]);
+ checkNSRange([(id)CFSTR("Hello World") rangeOfString:(id)CFSTR("World")]);
+
+ checkCFRange(CFStringFind((CFStringRef)@"Hello World", (CFStringRef)@"World", 0));
+ checkCFRange(CFStringFind(CFSTR("Hello World"), (CFStringRef)@"World", 0));
+ checkCFRange(CFStringFind((CFStringRef)@"Hello World", CFSTR("World"), 0));
+ checkCFRange(CFStringFind(CFSTR("Hello World"), CFSTR("World"), 0));
+
+ /* Check for string uniquing. */
+ if (s0a != s0b || s0a != s2 || s1 != (id)s2) {
+ NSLog(@"String uniquing failed");
+ abort ();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/const-cfstring-2.m b/gcc/testsuite/objc.dg/const-cfstring-2.m
new file mode 100644
index 00000000000..57b8d95a7d4
--- /dev/null
+++ b/gcc/testsuite/objc.dg/const-cfstring-2.m
@@ -0,0 +1,26 @@
+/* APPLE LOCAL file constant CFStrings */
+/* Test the -Wnonportable-cfstrings option, which should give
+ warnings if non-ASCII characters are embedded in constant
+ CFStrings. This will only work on MacOS X 10.2 and later. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-fconstant-cfstrings -Wnonportable-cfstrings" } */
+
+#import <Foundation/NSString.h>
+#import <CoreFoundation/CFString.h>
+
+#ifndef __CONSTANT_CFSTRINGS__
+#error The -fconstant-cfstrings option is not functioning properly
+#endif
+
+void foo(void) {
+ NSString *s1 = @"Compile-time string literal";
+ CFStringRef s2 = CFSTR("Compile-time string literal");
+ NSString *s3 = @"Non-ASCII literal - \222"; /* { dg-warning "non-ASCII character in CFString literal" } */
+ CFStringRef s4 = CFSTR("\222 - Non-ASCII literal"); /* { dg-warning "non-ASCII character in CFString literal" } */
+ CFStringRef s5 = CFSTR("Non-ASCII (\222) literal"); /* { dg-warning "non-ASCII character in CFString literal" } */
+ NSString *s6 = @"\0Embedded NUL"; /* { dg-warning "embedded NUL in CFString literal" } */
+ CFStringRef s7 = CFSTR("Embedded \0NUL"); /* { dg-warning "embedded NUL in CFString literal" } */
+ CFStringRef s8 = CFSTR("Embedded NUL\0"); /* { dg-warning "embedded NUL in CFString literal" } */
+}
diff --git a/gcc/testsuite/objc.dg/const-str-3.m b/gcc/testsuite/objc.dg/const-str-3.m
index edc03ff62c7..9fe508b525c 100644
--- a/gcc/testsuite/objc.dg/const-str-3.m
+++ b/gcc/testsuite/objc.dg/const-str-3.m
@@ -1,9 +1,10 @@
+/* APPLE LOCAL file constant strings */
/* Test the -fconstant-string-class=Foo option under the NeXT
runtime. */
/* Developed by Markus Hitter <mah@jump-ing.de>. */
/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */
-/* { dg-do run { target *-*-darwin* } } */
+/* { dg-do run } */
#include <stdio.h>
#include <objc/objc.h>
@@ -26,11 +27,6 @@ struct objc_class _FooClassReference;
int main () {
Foo *string = @"bla";
- Foo *string2 = @"bla";
-
- if(string != string2)
- abort();
- printf("Strings are being uniqued properly\n");
/* This memcpy has to be done before the first message is sent to a
constant string object. Can't be moved to +initialize since _that_
diff --git a/gcc/testsuite/objc.dg/dg.exp b/gcc/testsuite/objc.dg/dg.exp
index ebf952967c7..7b3eba41d98 100644
--- a/gcc/testsuite/objc.dg/dg.exp
+++ b/gcc/testsuite/objc.dg/dg.exp
@@ -28,7 +28,8 @@ if ![info exists DEFAULT_CFLAGS] then {
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[m\]]] \
+# APPLE LOCAL -ObjC
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[mc\]]] \
"" $DEFAULT_CFLAGS
# All done.
diff --git a/gcc/testsuite/objc.dg/encode-1.m b/gcc/testsuite/objc.dg/encode-1.m
index 868c3254753..126e5d010f4 100644
--- a/gcc/testsuite/objc.dg/encode-1.m
+++ b/gcc/testsuite/objc.dg/encode-1.m
@@ -1,9 +1,9 @@
+/* APPLE LOCAL file bool encoding */
/* Test if the Objective-C @encode machinery distinguishes between
- 'BOOL *' (which should be encoded as a pointer to BOOL) and 'char *' (which
- should be encoded as '*'). This is somewhat tricky wrt the NeXT runtime,
- where we have 'typedef char BOOL'. */
+ 'BOOL *' (which should be encoded as '^c') and 'char *' (which
+ should be encoded as '*'). */
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
-/* { dg-options "-fnext-runtime -lobjc" } */
+/* { dg-options "-lobjc" } */
/* { dg-do run } */
#include <string.h>
@@ -12,10 +12,9 @@
int main(void) {
const char *BOOL_ptr = @encode(BOOL *);
- const char *BOOL_ = @encode(BOOL);
const char *char_ptr = @encode(char *);
-
- if(*BOOL_ptr != '^' || strcmp(BOOL_ptr + 1, BOOL_))
+
+ if(strcmp(BOOL_ptr, "^c"))
abort();
if(strcmp(char_ptr, "*"))
diff --git a/gcc/testsuite/objc.dg/nested-func-1.m b/gcc/testsuite/objc.dg/nested-func-1.m
index 7a182bd938e..ae45fee8621 100644
--- a/gcc/testsuite/objc.dg/nested-func-1.m
+++ b/gcc/testsuite/objc.dg/nested-func-1.m
@@ -1,3 +1,4 @@
+/* APPLE LOCAL file nested functions */
/* Test basic nested C function functionality within ObjC
methods. */
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
diff --git a/gcc/testsuite/objc.dg/objc.c b/gcc/testsuite/objc.dg/objc.c
new file mode 100644
index 00000000000..748111c26eb
--- /dev/null
+++ b/gcc/testsuite/objc.dg/objc.c
@@ -0,0 +1,6 @@
+/* APPLE LOCAL file -ObjC */
+
+/* { dg-do compile } */
+/* { dg-options "-ObjC" } */
+
+@class foo;
diff --git a/gcc/timevar.c b/gcc/timevar.c
index 1b5d2443c19..b19a6be59a6 100644
--- a/gcc/timevar.c
+++ b/gcc/timevar.c
@@ -27,6 +27,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
+
+/* APPLE LOCAL begin Mach time */
+#ifdef HAVE_MACH_MACH_TIME_H
+#include <mach/mach_time.h>
+#define HAVE_MACH_TIME 1
+static double timeBaseRatio;
+static struct mach_timebase_info tbase;
+#else
+#define HAVE_MACH_TIME 0
+#endif
+/* APPLE LOCAL end Mach time */
#include "coretypes.h"
#include "tm.h"
#include "intl.h"
@@ -69,6 +80,33 @@ struct tms
/* Prefer times to getrusage to clock (each gives successively less
information). */
+/* APPLE LOCAL begin Mach time */
+/* On Darwin, prefer getrusage, plus Mach absolute time for the wall
+ clock time. Use PPC intrinsics if possible. */
+#if defined(__APPLE__) && defined(__POWERPC__) && HAVE_MACH_TIME
+#if __POWERPC__
+# include "../more-hdrs/ppc_intrinsics.h"
+# define HAVE_WALL_TIME
+# define USE_PPC_INTRINSICS
+inline double ppc_intrinsic_time()
+{
+ unsigned long hi, lo;
+ do
+ {
+ hi = __mftbu();
+ lo = __mftb();
+ } while (hi != __mftbu());
+ return (hi * 0x100000000ull + lo) * timeBaseRatio;
+}
+#endif /* __POWERPC__ */
+#elif HAVE_MACH_TIME
+# define USE_GETRUSAGE
+# define USE_MACH_TIME
+# define HAVE_USER_TIME
+# define HAVE_SYS_TIME
+# define HAVE_WALL_TIME
+# else
+/* APPLE LOCAL end Mach time */
#ifdef HAVE_TIMES
# if defined HAVE_DECL_TIMES && !HAVE_DECL_TIMES
extern clock_t times (struct tms *);
@@ -95,6 +133,8 @@ struct tms
#endif
#endif
#endif
+/* APPLE LOCAL Mach time */
+#endif /* HAVE_MACH_TIME */
/* libc is very likely to have snuck a call to sysconf() into one of
the underlying constants, and that can be very slow, so we have to
@@ -203,6 +243,14 @@ get_time (struct timevar_time_def *now)
#ifdef USE_CLOCK
now->user = clock () * clocks_to_msec;
#endif
+ /* APPLE LOCAL begin Mach time */
+#ifdef USE_MACH_TIME
+ now->wall = mach_absolute_time() * timeBaseRatio;
+#endif
+#ifdef USE_PPC_INTRINSICS
+ now->wall = ppc_intrinsic_time();
+#endif
+ /* APPLE LOCAL end Mach time */
}
}
@@ -240,6 +288,12 @@ timevar_init (void)
#ifdef USE_CLOCK
clocks_to_msec = CLOCKS_TO_MSEC;
#endif
+ /* APPLE LOCAL begin Mach time */
+#if defined(USE_MACH_TIME) || defined(USE_PPC_INTRINSICS)
+ mach_timebase_info(&tbase);
+ timeBaseRatio = ((double) tbase.numer / (double) tbase.denom) * 1e-9;
+#endif
+ /* APPLE LOCAL end Mach time */
}
/* Push TIMEVAR onto the timing stack. No further elapsed time is
@@ -489,15 +543,20 @@ timevar_print (FILE *fp)
/* Print total time. */
fputs (_(" TOTAL :"), fp);
#ifdef HAVE_USER_TIME
- fprintf (fp, "%7.2f ", total->user);
-#endif
+ /* APPLE LOCAL time formatting */
+ fprintf (fp, "%7.2f", total->user);
+#endif
#ifdef HAVE_SYS_TIME
- fprintf (fp, "%7.2f ", total->sys);
+ /* APPLE LOCAL time formatting */
+ fprintf (fp, " %7.2f", total->sys);
#endif
#ifdef HAVE_WALL_TIME
- fprintf (fp, "%7.2f\n", total->wall);
+ /* APPLE LOCAL time formatting */
+ fprintf (fp, " %7.2f", total->wall);
#endif
-
+ /* APPLE LOCAL time formatting */
+ putc ('\n', fp);
+
#ifdef ENABLE_CHECKING
fprintf (fp, "Extra diagnostic checks enabled; compiler may run slowly.\n");
fprintf (fp, "Configure with --disable-checking to disable checks.\n");
diff --git a/gcc/timevar.def b/gcc/timevar.def
index ec942588c0e..101a95b590c 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -75,12 +75,21 @@ DEFTIMEVAR (TV_TREE_SRA , "tree SRA")
DEFTIMEVAR (TV_TREE_CCP , "tree CCP")
DEFTIMEVAR (TV_TREE_SPLIT_EDGES , "tree split crit edges")
DEFTIMEVAR (TV_TREE_PRE , "tree PRE")
+DEFTIMEVAR (TV_SCALAR_EVOLUTIONS , "scalar evolutions")
+DEFTIMEVAR (TV_ALL_DATA_DEPS , "all data dependences")
+DEFTIMEVAR (TV_TREE_ELIM_CHECKS , "chrec eliminate checks")
+DEFTIMEVAR (TV_DEP_GRAPH , "data dependences graph")
DEFTIMEVAR (TV_TREE_PHIOPT , "tree linearize phis")
+DEFTIMEVAR (TV_TREE_RETURN , "tree merge returns")
DEFTIMEVAR (TV_TREE_FORWPROP , "tree forward propagate")
DEFTIMEVAR (TV_TREE_DCE , "tree conservative DCE")
DEFTIMEVAR (TV_TREE_CD_DCE , "tree aggressive DCE")
DEFTIMEVAR (TV_TREE_DSE , "tree DSE")
DEFTIMEVAR (TV_TREE_LOOP , "tree loop optimization")
+DEFTIMEVAR (TV_TREE_LINEAR_TRANSFORM , "tree loop linear transforms")
+DEFTIMEVAR (TV_TREE_LOOP_IVOPTS , "tree iv optimization")
+DEFTIMEVAR (TV_TREE_LOOP_IVCANON , "tree canonical iv creation")
+DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree loop vectorization")
DEFTIMEVAR (TV_TREE_CH , "tree copy headers")
DEFTIMEVAR (TV_TREE_SSA_TO_NORMAL , "tree SSA to normal")
DEFTIMEVAR (TV_TREE_NRV , "tree NRV optimization")
@@ -125,6 +134,8 @@ DEFTIMEVAR (TV_SHORTEN_BRANCH , "shorten branches")
DEFTIMEVAR (TV_REG_STACK , "reg stack")
DEFTIMEVAR (TV_FINAL , "final")
DEFTIMEVAR (TV_SYMOUT , "symout")
+/* APPLE LOCAL */
+DEFTIMEVAR (TV_OV_RESOLUTION , "overload resolution")
DEFTIMEVAR (TV_VAR_TRACKING , "variable tracking")
/* Everything else in rest_of_compilation not included above. */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 2a3b5ec73ec..b74f5f843c4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -108,6 +108,8 @@ static void init_asm_output (const char *);
static void finalize (void);
static void crash_signal (int) ATTRIBUTE_NORETURN;
+/* APPLE LOCAL interrupt signal handler (radar 2941633) ilr */
+static void interrupt_signal (int) ATTRIBUTE_NORETURN;
static void setup_core_dumping (void);
static void compile_file (void);
@@ -139,6 +141,11 @@ static const char **save_argv;
const char *main_input_filename;
+/* APPLE LOCAL fat builds */
+/* for radar 2865464 ilr */
+static int arch_specified = 0;
+/* APPLE LOCAL end fat builds */
+
/* Current position in real source file. */
location_t input_location;
@@ -255,6 +262,13 @@ int flag_branch_probabilities = 0;
int flag_reorder_blocks = 0;
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Nonzero if blocks should be partitioned into hot and cold sections in
+ addition to being reordered. */
+
+int flag_reorder_blocks_and_partition = 0;
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Nonzero if functions should be reordered. */
int flag_reorder_functions = 0;
@@ -309,12 +323,25 @@ int flag_signed_char;
int flag_short_enums;
+/* APPLE LOCAL begin -fast */
+/* Nonzero if we should perform SPEC oriented optimizations. */
+int flag_fast = 0;
+int flag_fastf = 0;
+int flag_fastcp = 0;
+/* APPLE LOCAL end -fast */
+
/* Nonzero for -fcaller-saves: allocate values in regs that need to
be saved across function calls, if that produces overall better code.
Optional now, so people can test it. */
int flag_caller_saves = 0;
+/* APPLE LOCAL begin -ffppc 2001-08-01 sts */
+/* Nonzero if the floating point precision control pass should
+ be performed. (x86 only really, but we pretend it's generic) */
+int flag_fppc = 0;
+/* APPLE LOCAL end -ffppc 2001-08-01 sts */
+
/* Nonzero if structures and unions should be returned in memory.
This should only be defined if compatibility with another compiler or
@@ -370,22 +397,10 @@ int flag_thread_jumps;
int flag_strength_reduce = 0;
-/* Nonzero enables loop unrolling in unroll.c. Only loops for which the
- number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
- UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
- unrolled. */
-
-int flag_old_unroll_loops;
-
-/* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
- This is generally not a win. */
-
-int flag_old_unroll_all_loops;
-
-/* Enables unrolling of simple loops in loop-unroll.c. */
+/* Enables unrolling of simple loops. */
int flag_unroll_loops;
-/* Enables unrolling of all loops in loop-unroll.c. */
+/* Enables unrolling of all loops. */
int flag_unroll_all_loops;
/* Nonzero enables loop peeling. */
@@ -494,6 +509,10 @@ int flag_web;
int flag_loop_optimize;
+/* Nonzero means perform second pass of the loop optimizer. */
+
+int flag_loop_optimize2;
+
/* Nonzero means perform crossjumping. */
int flag_crossjumping;
@@ -564,6 +583,13 @@ int flag_rerun_loop_opt;
int flag_inline_functions;
+/* APPLE LOCAL begin -fobey-inline */
+/* Nonzero for -fobey-inline: 'inline' keyword must be obeyed, regardless
+ of codesize. */
+
+int flag_obey_inline;
+/* APPLE LOCAL end -fobey-inline */
+
/* Nonzero for -fkeep-inline-functions: even if we make a function
go inline everywhere, keep its definition around for debugging
purposes. */
@@ -813,6 +839,24 @@ int flag_tree_ccp = 0;
/* Enable SSA-DCE on trees. */
int flag_tree_dce = 0;
+/* Enable the analysis of the scalar evolutions on trees. */
+int flag_scalar_evolutions = 0;
+
+/* Enable the analysis of all data dependences. */
+int flag_all_data_deps = 0;
+
+/* Enable data dependence graph. */
+int flag_ddg = 0;
+
+/* Enable the elimination of checks on trees. */
+int flag_tree_elim_checks = 0;
+
+/* Enable linear loop transforms on trees. */
+int flag_tree_loop_linear = 0;
+
+/* Enable loop vectorization on trees */
+int flag_tree_vectorize = 0;
+
/* Enable loop header copying on tree-ssa. */
int flag_tree_ch = 0;
@@ -840,10 +884,21 @@ int flag_tree_dse = 0;
/* Nonzero if we perform superblock formation. */
int flag_tracer = 0;
+/* APPLE LOCAL begin loop transposition */
+/* Nonzero if we should perform automatic loop transposition. */
+int flag_loop_transpose = 0;
+/* APPLE LOCAL end loop transposition */
+
/* Nonzero if we perform whole unit at a time compilation. */
int flag_unit_at_a_time = 0;
+/* APPLE LOCAL BEGIN pch distcc mrs */
+/* True if PCH should omit from the -E output all lines from PCH files
+ found in PCH files. */
+int flag_pch_preprocess = 0;
+/* APPLE LOCAL END pch distcc mrs */
+
/* Nonzero if we should track variables. When
flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according
to optimize, debug_info_level and debug_hooks in process_options (). */
@@ -892,6 +947,31 @@ int flag_evaluation_order = 0;
/* Add or remove a leading underscore from user symbols. */
int flag_leading_underscore = -1;
+/* APPLE LOCAL begin coalescing turly 20020319 */
+/* Don't enable coalescing by default unless we have one of these
+ features in cctools. */
+#if defined(APPLE_WEAK_SECTION_ATTRIBUTE) || defined(APPLE_WEAK_ASSEMBLER_DIRECTIVE)
+#define COALESCE_BY_DEFAULT 1
+#else
+#define COALESCE_BY_DEFAULT 0
+#endif
+/* Nonzero means that certain data and code items can be marked as
+ coalesced, which is a lesser form of ELF weak symbols. */
+int flag_coalescing_enabled = COALESCE_BY_DEFAULT;
+
+/* Nonzero means mark template instantiations as coalesced. */
+int flag_coalesce_templates = COALESCE_BY_DEFAULT;
+
+/* Nonzero means use the OS X 10.2 "weak_definitions" section attribute.
+ If this is set, then explicit template instantiations DO NOT get
+ coalesced, but are plain old text or data instead. */
+int flag_weak_coalesced_definitions = COALESCE_BY_DEFAULT;
+
+/* Coalesced symbols are private export by default. This EXPERIMENTAL
+ flag will make them global instead. */
+int flag_export_coalesced = 0;
+/* APPLE LOCAL end coalescing turly 20020319 */
+
/* The version of the C++ ABI in use. The following values are
allowed:
@@ -942,10 +1022,9 @@ static const lang_independent_options f_options[] =
{"expensive-optimizations", &flag_expensive_optimizations, 1 },
{"thread-jumps", &flag_thread_jumps, 1 },
{"strength-reduce", &flag_strength_reduce, 1 },
+ {"loop-transpose", &flag_loop_transpose, 1, },
{"unroll-loops", &flag_unroll_loops, 1 },
{"unroll-all-loops", &flag_unroll_all_loops, 1 },
- {"old-unroll-loops", &flag_old_unroll_loops, 1 },
- {"old-unroll-all-loops", &flag_old_unroll_all_loops, 1 },
{"peel-loops", &flag_peel_loops, 1 },
{"unswitch-loops", &flag_unswitch_loops, 1 },
{"prefetch-loop-arrays", &flag_prefetch_loop_arrays, 1 },
@@ -958,6 +1037,8 @@ static const lang_independent_options f_options[] =
{"inline-functions", &flag_inline_functions, 1 },
{"keep-inline-functions", &flag_keep_inline_functions, 1 },
{"inline", &flag_no_inline, 0 },
+ /* APPLE LOCAL -fobey-inline */
+ {"obey-inline", &flag_obey_inline, 1, },
{"keep-static-consts", &flag_keep_static_consts, 1 },
{"syntax-only", &flag_syntax_only, 1 },
{"shared-data", &flag_shared_data, 1 },
@@ -1008,6 +1089,7 @@ static const lang_independent_options f_options[] =
{"profile", &profile_flag, 1 },
{"tree-based-profiling", &flag_tree_based_profiling, 1 },
{"reorder-blocks", &flag_reorder_blocks, 1 },
+ {"reorder-blocks-and-partition", &flag_reorder_blocks_and_partition, 1},
{"reorder-functions", &flag_reorder_functions, 1 },
{"rename-registers", &flag_rename_registers, 1 },
{"cprop-registers", &flag_cprop_registers, 1 },
@@ -1049,19 +1131,33 @@ static const lang_independent_options f_options[] =
{"mem-report", &mem_report, 1 },
{ "trapv", &flag_trapv, 1 },
{ "wrapv", &flag_wrapv, 1 },
+ /* APPLE LOCAL -ffppc 2001-08-01 sts */
+ { "fppc", &flag_fppc, 1 },
+ /* APPLE LOCAL begin coalescing turly */
+ { "coalesce", &flag_coalescing_enabled, 1 },
+ { "weak-coalesced", &flag_weak_coalesced_definitions, 1 },
+ { "coalesce-templates", &flag_coalesce_templates, 1 },
+ { "export-coalesced", &flag_export_coalesced, 1 },
+ /* APPLE LOCAL end coalescing turly */
{ "new-ra", &flag_new_regalloc, 1 },
{ "var-tracking", &flag_var_tracking, 1},
{ "tree-gvn", &flag_tree_gvn, 1 },
{ "tree-pre", &flag_tree_pre, 1 },
{ "tree-ccp", &flag_tree_ccp, 1 },
{ "tree-dce", &flag_tree_dce, 1 },
+ { "scalar-evolutions", &flag_scalar_evolutions, 1 },
+ { "all-data-deps", &flag_all_data_deps, 1 },
+ { "tree-elim-checks", &flag_tree_elim_checks, 1 },
+ { "tree-ddg", &flag_ddg, 1 },
{ "tree-dominator-opts", &flag_tree_dom, 1 },
{ "tree-copyrename", &flag_tree_copyrename, 1 },
{ "tree-dse", &flag_tree_dse, 1 },
{ "tree-combine-temps", &flag_tree_combine_temps, 1 },
{ "tree-ter", &flag_tree_ter, 1 },
{ "tree-ch", &flag_tree_ch, 1 },
- { "tree-loop-optimize", &flag_tree_loop, 1 }
+ { "tree-loop-optimize", &flag_tree_loop, 1 },
+ { "tree-loop-linear", &flag_tree_loop_linear, 1},
+ { "tree-vectorize", &flag_tree_vectorize, 1}
};
/* Here is a table, controlled by the tm.h file, listing each -m switch
@@ -1253,6 +1349,31 @@ floor_log2_wide (unsigned HOST_WIDE_INT x)
return log;
}
+/* APPLE LOCAL begin interrupt signal handler (radar 2941633) ilr */
+/* If the compilation is interrupted do some cleanup. Any files created
+ by the compilation are deleted. The compilation is terminated from
+ here. */
+static void
+interrupt_signal (int signo ATTRIBUTE_UNUSED)
+{
+ /* Close the dump files. */
+ if (flag_gen_aux_info)
+ {
+ fclose (aux_info_file);
+ unlink (aux_info_file_name);
+ }
+
+ if (asm_out_file)
+ {
+ fclose (asm_out_file);
+ if (asm_file_name && *asm_file_name)
+ unlink (asm_file_name);
+ }
+
+ exit (FATAL_EXIT_CODE);
+}
+/* APPLE LOCAL end interrupt signal handler */
+
/* Handler for fatal signals, such as SIGSEGV. These are transformed
into ICE messages, which is much more user friendly. In case the
error printer crashes, reset the signal to prevent infinite recursion. */
@@ -1575,6 +1696,46 @@ warn_deprecated_use (tree node)
}
}
+/* APPLE LOCAL begin unavailable ilr */
+/* Warn about a use of an identifier which was marked deprecated. */
+void
+warn_unavailable_use (tree node)
+{
+ if (node == 0)
+ return;
+
+ if (DECL_P (node))
+ warning ("`%s' is unavailable (declared at %s:%d)",
+ IDENTIFIER_POINTER (DECL_NAME (node)),
+ DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
+ else if (TYPE_P (node))
+ {
+ const char *what = NULL;
+ tree decl = TYPE_STUB_DECL (node);
+
+ if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
+ what = IDENTIFIER_POINTER (TYPE_NAME (node));
+ else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (node)))
+ what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
+
+ if (what)
+ {
+ if (decl)
+ warning ("`%s' is unavailable (declared at %s:%d)", what,
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ warning ("`%s' is unavailable", what);
+ }
+ else if (decl)
+ warning ("type is unavailable (declared at %s:%d)",
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ warning ("type is unavailable");
+ }
+}
+/* APPLE LOCAL end unavailable ilr */
+
/* Save the current INPUT_LOCATION on the top entry in the
INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
INPUT_LOCATION accordingly. */
@@ -1849,7 +2010,12 @@ set_target_switch (const char *name)
}
#endif
- if (!valid_target_option)
+ /* APPLE LOCAL begin fat builds */
+ /* Note, the driver guarantees that -arch will precede the -m
+ options so that arch_specified will be known by the time we get
+ here. For Radar 2865464. */
+ if (!valid_target_option && !arch_specified)
+ /* APPLE LOCAL end fat builds */
error ("invalid option `%s'", name);
}
@@ -1942,6 +2108,18 @@ print_switch_values (FILE *file, int pos, int max,
continue;
if ((*p)[1] == 'd')
continue;
+ /* APPLE LOCAL begin -fast or -fastf or -fastcp */
+ if ((flag_fast || flag_fastf || flag_fastcp)
+ && (*p)[0] == '-' && (*p)[1] == 'O')
+ {
+ int optimize_val;
+ if ((*p)[2] == 's' && (*p)[3] == '\0')
+ continue;
+ optimize_val = read_integral_parameter (*p+2, 0, -1);
+ if (optimize_val != 3)
+ continue;
+ }
+ /* APPLE LOCAL end -fast or -fastf or -fastcp */
pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
}
@@ -1957,8 +2135,15 @@ print_switch_values (FILE *file, int pos, int max,
for (j = 0; j < ARRAY_SIZE (f_options); j++)
if (*f_options[j].variable == f_options[j].on_value)
- pos = print_single_switch (file, pos, max, indent, sep, term,
- "-f", f_options[j].string);
+ /* APPLE LOCAL begin 3372156 */
+ /* FSF candidate */
+ {
+ char value[256];
+ sprintf (value, "-f%s=%d", f_options[j].string,f_options[j].on_value);
+ pos = print_single_switch (file, pos, max, indent, sep, term,
+ "", value);
+ }
+ /* APPLE LOCAL end 3372156 */
/* Print target specific options. */
@@ -2220,6 +2405,15 @@ general_init (const char *argv0)
#if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
signal (SIGIOT, crash_signal);
#endif
+ /* APPLE LOCAL begin interrupt signal handler (radar 2941633) ilr */
+ /* Handle compilation interrupts. */
+ if (signal (SIGINT, SIG_IGN) != SIG_IGN)
+ signal (SIGINT, interrupt_signal);
+ if (signal (SIGKILL, SIG_IGN) != SIG_IGN)
+ signal (SIGINT, interrupt_signal);
+ if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
+ signal (SIGTERM, interrupt_signal);
+ /* APPLE LOCAL end interrupt signal handler */
#ifdef SIGFPE
signal (SIGFPE, crash_signal);
#endif
@@ -2227,6 +2421,22 @@ general_init (const char *argv0)
/* Other host-specific signal setup. */
(*host_hooks.extra_signals)();
+ /* APPLE LOCAL begin setrlimit */
+#ifdef RLIMIT_STACK
+ /* Get rid of any avoidable limit on stack size. */
+ {
+ struct rlimit rlim;
+
+ /* Set the stack limit huge. (Compiles normally work within
+ a megabyte of stack, but the normal limit on OSX is 512K for
+ some reason.) */
+ getrlimit (RLIMIT_STACK, &rlim);
+ rlim.rlim_cur = rlim.rlim_max;
+ setrlimit (RLIMIT_STACK, &rlim);
+ }
+#endif /* RLIMIT_STACK defined */
+ /* APPLE LOCAL end setrlimit */
+
/* Initialize the garbage-collector, string pools and tree type hash
table. */
init_ggc ();
@@ -2296,25 +2506,19 @@ process_options (void)
if (flag_unroll_all_loops)
flag_unroll_loops = 1;
- if (flag_unroll_loops)
- {
- flag_old_unroll_loops = 0;
- flag_old_unroll_all_loops = 0;
- }
-
- if (flag_old_unroll_all_loops)
- flag_old_unroll_loops = 1;
+ if (flag_loop_optimize2)
+ flag_loop_optimize = 0;
/* Old loop unrolling requires that strength_reduction be on also. Silently
turn on strength reduction here if it isn't already on. Also, the loop
unrolling code assumes that cse will be run after loop, so that must
be turned on also. */
- if (flag_old_unroll_loops)
+ if (flag_unroll_loops)
{
flag_strength_reduce = 1;
flag_rerun_cse_after_loop = 1;
}
- if (flag_unroll_loops || flag_peel_loops)
+ if (flag_peel_loops)
flag_rerun_cse_after_loop = 1;
if (flag_non_call_exceptions)
@@ -2534,6 +2738,7 @@ lang_dependent_init (const char *name)
provide a dummy function context for them. */
init_dummy_function_start ();
init_expr_once ();
+ init_set_costs ();
expand_dummy_function_end ();
/* If dbx symbol table desired, initialize writing it and output the
diff --git a/gcc/toplev.h b/gcc/toplev.h
index daad92fa10e..c4fdce403f6 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -78,6 +78,8 @@ extern void announce_function (tree);
extern void error_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warning_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warn_deprecated_use (tree);
+/* APPLE LOCAL unavailable */
+extern void warn_unavailable_use (tree);
#ifdef BUFSIZ
extern void output_quoted_string (FILE *, const char *);
@@ -110,6 +112,7 @@ extern int target_flags_explicit;
/* See toplev.c. */
extern int flag_loop_optimize;
+extern int flag_loop_optimize2;
extern int flag_crossjumping;
extern int flag_if_conversion;
extern int flag_if_conversion2;
@@ -119,9 +122,7 @@ extern int flag_peel_loops;
extern int flag_rerun_cse_after_loop;
extern int flag_thread_jumps;
extern int flag_tracer;
-extern int flag_unroll_loops;
extern int flag_unroll_all_loops;
-extern int flag_unswitch_loops;
extern int flag_cprop_registers;
extern int time_report;
extern int flag_new_regalloc;
diff --git a/gcc/tree-alias-common.c b/gcc/tree-alias-common.c
index d4d2d94387f..df46241213b 100644
--- a/gcc/tree-alias-common.c
+++ b/gcc/tree-alias-common.c
@@ -52,11 +52,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "tree-pass.h"
#include "timevar.h"
-/* Reduce ifdefery later. */
-#ifndef HAVE_BANSHEE
-#define HAVE_BANSHEE 0
-#endif
-
/* This file contains the implementation of the common parts of the
tree points-to analysis infrastructure.
@@ -975,7 +970,7 @@ static void
create_alias_vars (void)
{
basic_block bb;
-#if HAVE_BANSHEE
+#ifdef HAVE_BANSHEE
if (flag_tree_points_to == PTA_ANDERSEN)
current_alias_ops = andersen_alias_ops;
else
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 499a4d183ff..6d1414a76f7 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -67,15 +67,6 @@ static struct cfg_stats_d cfg_stats;
/* Nonzero if we found a computed goto while building basic blocks. */
static bool found_computed_goto;
-/* If we found computed gotos, then they are all revectored to this
- location. We try to unfactor them after we have translated out
- of SSA form. */
-static GTY(()) tree factored_computed_goto_label;
-
-/* The factored computed goto. We cache this so we can easily recover
- the destination of computed gotos when unfactoring them. */
-static GTY(()) tree factored_computed_goto;
-
/* Basic blocks and flowgraphs. */
static basic_block create_bb (void *, void *, basic_block);
static void create_block_annotation (basic_block);
@@ -83,7 +74,6 @@ static void free_blocks_annotations (void);
static void clear_blocks_annotations (void);
static void make_blocks (tree);
static void factor_computed_gotos (void);
-static tree tree_block_label (basic_block bb);
/* Edges. */
static void make_edges (void);
@@ -224,6 +214,7 @@ factor_computed_gotos (void)
basic_block bb;
tree factored_label_decl = NULL;
tree var = NULL;
+ tree factored_computed_goto = NULL;
/* We know there are one or more computed gotos in this function.
Examine the last statement in each basic block to see if the block
@@ -247,6 +238,7 @@ factor_computed_gotos (void)
if (computed_goto_p (last))
{
tree assignment;
+ tree factored_computed_goto_label;
/* The first time we find a computed goto we need to create
the factored goto block and the variable each original
@@ -1807,6 +1799,9 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi)
ssa_remove_edge (e);
retval = true;
}
+
+ if (taken_edge->probability > REG_BR_PROB_BASE)
+ taken_edge->probability = REG_BR_PROB_BASE;
}
if (taken_edge->probability > REG_BR_PROB_BASE)
taken_edge->probability = REG_BR_PROB_BASE;
@@ -2466,20 +2461,11 @@ disband_implicit_edges (void)
abort ();
label = tree_block_label (e->dest);
- /* ??? Why bother putting this back together when rtl is just
- about to take it apart again? */
- if (factored_computed_goto_label
- && label == LABEL_EXPR_LABEL (factored_computed_goto_label))
- label = GOTO_DESTINATION (factored_computed_goto);
-
bsi_insert_after (&last,
build1 (GOTO_EXPR, void_type_node, label),
BSI_NEW_STMT);
e->flags &= ~EDGE_FALLTHRU;
}
-
- factored_computed_goto = NULL;
- factored_computed_goto_label = NULL;
}
/* Remove all the blocks and edges that make up the flowgraph. */
@@ -2601,6 +2587,20 @@ set_bb_for_stmt (tree t, basic_block bb)
}
}
+/* Finds iterator for STMT. */
+
+extern block_stmt_iterator
+stmt_bsi (tree stmt)
+{
+ block_stmt_iterator bsi;
+
+ for (bsi = bsi_start (bb_for_stmt (stmt)); !bsi_end_p (bsi); bsi_next (&bsi))
+ if (bsi_stmt (bsi) == stmt)
+ return bsi;
+
+ abort ();
+}
+
/* Insert a statement, or statement list, before the given pointer. */
void
@@ -2698,10 +2698,12 @@ bsi_replace (const block_stmt_iterator *bsi, tree stmt, bool preserve_eh_info)
In all cases, the returned *BSI points to the correct location. The
return value is true if insertion should be done after the location,
- or false if before the location. */
+ or false if before the location. If new basic block has to be created,
+ it is stored in *NEW_BB. */
static bool
-tree_find_edge_insert_loc (edge e, block_stmt_iterator *bsi)
+tree_find_edge_insert_loc (edge e, block_stmt_iterator *bsi,
+ basic_block *new_bb)
{
basic_block dest, src;
tree tmp;
@@ -2762,6 +2764,8 @@ tree_find_edge_insert_loc (edge e, block_stmt_iterator *bsi)
/* Otherwise, create a new basic block, and split this edge. */
dest = split_edge (e);
+ if (new_bb)
+ *new_bb = dest;
e = dest->pred;
goto restart;
}
@@ -2804,7 +2808,7 @@ bsi_commit_edge_inserts_1 (edge e)
PENDING_STMT (e) = NULL_TREE;
- if (tree_find_edge_insert_loc (e, &bsi))
+ if (tree_find_edge_insert_loc (e, &bsi, NULL))
bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
else
bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
@@ -2821,21 +2825,25 @@ bsi_insert_on_edge (edge e, tree stmt)
append_to_statement_list (stmt, &PENDING_STMT (e));
}
-/* Similar to bsi_insert_on_edge+bsi_commit_edge_inserts. */
+/* Similar to bsi_insert_on_edge+bsi_commit_edge_inserts. If new block has to
+ be created, it is returned. */
/* ??? Why in the world do we need this? Only PRE uses it. */
-void
+basic_block
bsi_insert_on_edge_immediate (edge e, tree stmt)
{
block_stmt_iterator bsi;
+ basic_block new_bb = NULL;
if (PENDING_STMT (e))
abort ();
- if (tree_find_edge_insert_loc (e, &bsi))
+ if (tree_find_edge_insert_loc (e, &bsi, &new_bb))
bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
else
bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
+
+ return new_bb;
}
/*---------------------------------------------------------------------------
@@ -3562,11 +3570,21 @@ thread_jumps (void)
edge e, next, last, old;
basic_block bb, dest, tmp;
tree phi;
- int arg;
+ int arg, old_forwardable;
bool retval = false;
+ mark_dfs_back_edges ();
FOR_EACH_BB (bb)
- bb_ann (bb)->forwardable = 1;
+ {
+ /* Prevent threading though loop headers. This could create irreducible
+ regions (for entry edges) or loops with shared headers (for latch
+ edges). */
+ for (e = bb->pred; e; e = e->pred_next)
+ if (e->flags & EDGE_DFS_BACK)
+ break;
+
+ bb_ann (bb)->forwardable = (e == NULL);
+ }
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
{
@@ -3581,6 +3599,7 @@ thread_jumps (void)
/* This block is now part of a forwarding path, mark it as not
forwardable so that we can detect loops. This bit will be
reset below. */
+ old_forwardable = bb_ann (bb)->forwardable;
bb_ann (bb)->forwardable = 0;
/* Examine each of our block's successors to see if it is
@@ -3604,11 +3623,6 @@ thread_jumps (void)
last = dest->succ,
dest = dest->succ->dest)
{
- /* An infinite loop detected. We redirect the edge anyway, so
- that the loop is shrinked into single basic block. */
- if (!bb_ann (dest)->forwardable)
- break;
-
if (dest->succ->dest == EXIT_BLOCK_PTR)
break;
@@ -3668,7 +3682,7 @@ thread_jumps (void)
/* Reset the forwardable bit on our block since it's no longer in
a forwarding chain path. */
- bb_ann (bb)->forwardable = 1;
+ bb_ann (bb)->forwardable = old_forwardable;
}
return retval;
}
@@ -3676,7 +3690,7 @@ thread_jumps (void)
/* Return a non-special label in the head of basic block BLOCK.
Create one if it doesn't exist. */
-static tree
+tree
tree_block_label (basic_block bb)
{
block_stmt_iterator i, s = bsi_start (bb);
@@ -3760,7 +3774,7 @@ tree_redirect_edge_and_branch (edge e, basic_block dest)
return ret;
if (e->dest == dest)
- return NULL;
+ return e;
label = tree_block_label (dest);
@@ -3912,11 +3926,18 @@ tree_duplicate_bb (basic_block bb)
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
+ tree copy;
if (TREE_CODE (stmt) == LABEL_EXPR)
continue;
- bsi_insert_after (&bsi_tgt, unshare_expr (stmt), BSI_NEW_STMT);
+ copy = unshare_expr (stmt);
+
+ /* Copy also the virtual operands. */
+ get_stmt_ann (copy);
+ copy_virtual_operands (copy, stmt);
+
+ bsi_insert_after (&bsi_tgt, copy, BSI_NEW_STMT);
}
return new_bb;
@@ -4035,11 +4056,11 @@ print_pred_bbs (FILE *file,
return;
else if (e->pred_next == NULL)
- fprintf (file, "bb_%d", e->src->index);
+ fprintf (file, "%d", e->src->index);
else
{
- fprintf (file, "bb_%d, ", e->src->index);
+ fprintf (file, "%d ", e->src->index);
print_pred_bbs (file, e->pred_next);
}
}
@@ -4054,11 +4075,11 @@ print_succ_bbs (FILE *file,
return;
else if (e->succ_next == NULL)
- fprintf (file, "bb_%d", e->dest->index);
+ fprintf (file, "%d", e->dest->index);
else
{
- fprintf (file, "bb_%d, ", e->dest->index);
+ fprintf (file, "%d ", e->dest->index);
print_succ_bbs (file, e->succ_next);
}
}
@@ -4082,28 +4103,34 @@ print_loop (FILE *file,
/* Print the loop's header. */
- fprintf (file, "%sloop_%d\n", s_indent, loop->num);
+ fprintf (file, "%s(loop (num %d)", s_indent, loop->num);
+ if (loop_nb_iterations (loop))
+ {
+ fprintf (file, " (nb_iterations ");
+ print_generic_expr (file, loop_nb_iterations (loop), 0);
+ fprintf (file, ")");
+ }
+
+ else
+ fprintf (file, " (nb_iterations not_analyzed_yet)");
/* Print the loop's body. */
- fprintf (file, "%s{\n", s_indent);
+ fprintf (file, " (body (\n");
FOR_EACH_BB (bb)
if (bb->loop_father == loop)
{
/* Print the basic_block's header. */
- fprintf (file, "%s bb_%d (preds = {", s_indent, bb->index);
+ fprintf (file, "%s (bb (num %d) (preds ", s_indent, bb->index);
print_pred_bbs (file, bb->pred);
- fprintf (file, "}, succs = {");
+ fprintf (file, ") (succs ");
print_succ_bbs (file, bb->succ);
- fprintf (file, "})\n");
-
- /* Print the basic_block's body. */
- fprintf (file, "%s {\n", s_indent);
+ fprintf (file, ") (stmts (\n");
tree_dump_bb (bb, file, indent + 4);
- fprintf (file, "%s }\n", s_indent);
+ fprintf (file, "%s )))\n", s_indent);
}
print_loop (file, loop->inner, indent + 2);
- fprintf (file, "%s}\n", s_indent);
+ fprintf (file, "%s)))\n", s_indent);
print_loop (file, loop->next, indent);
}
@@ -4123,11 +4150,19 @@ print_loop_ir (FILE *file)
/* Debugging loops structure at tree level. */
void
-debug_loop_ir (void)
+tree_debug_loops (void)
{
print_loop_ir (stderr);
}
+/* Debugging loops structure at tree level. */
+
+void
+tree_debug_loop (struct loop *loop)
+{
+ print_loop (stderr, loop, 0);
+}
+
/* Return 1 if BB ends with a call, possibly followed by some
instructions that must stay with the call, 0 otherwise. */
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
new file mode 100644
index 00000000000..34ec3bf3714
--- /dev/null
+++ b/gcc/tree-chrec.c
@@ -0,0 +1,2011 @@
+/* Chains of recurrences.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* This file implements operations on chains of recurrences. Chains
+ of recurrences are used for modeling evolution functions of scalar
+ variables.
+*/
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "diagnostic.h"
+#include "varray.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
+#include "tree-pass.h"
+
+
+/* Extended folder for chrecs. */
+
+/* Determines whether CST is not a constant evolution. */
+
+static inline bool
+is_not_constant_evolution (tree cst)
+{
+ return (TREE_CODE (cst) == POLYNOMIAL_CHREC
+ || TREE_CODE (cst) == EXPONENTIAL_CHREC
+ || TREE_CODE (cst) == PEELED_CHREC);
+}
+
+/* Fold CODE for a polynomial function and a constant. */
+
+static inline tree
+chrec_fold_poly_cst (enum tree_code code,
+ tree type,
+ tree poly,
+ tree cst)
+{
+#if defined ENABLE_CHECKING
+ if (poly == NULL_TREE
+ || cst == NULL_TREE
+ || TREE_CODE (poly) != POLYNOMIAL_CHREC
+ || is_not_constant_evolution (cst))
+ abort ();
+#endif
+
+ switch (code)
+ {
+ case PLUS_EXPR:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly),
+ chrec_fold_plus (type, CHREC_LEFT (poly), cst),
+ CHREC_RIGHT (poly));
+
+ case MINUS_EXPR:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly),
+ chrec_fold_minus (type, CHREC_LEFT (poly), cst),
+ CHREC_RIGHT (poly));
+
+ case MULT_EXPR:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly),
+ chrec_fold_multiply (type, CHREC_LEFT (poly), cst),
+ chrec_fold_multiply (type, CHREC_RIGHT (poly), cst));
+
+ default:
+ return chrec_top;
+ }
+}
+
+/* Fold the addition of a peeled chrec and a constant. */
+
+static inline tree
+chrec_fold_plus_peel_cst (tree type,
+ tree peel,
+ tree cst)
+{
+#if defined ENABLE_CHECKING
+ if (peel == NULL_TREE
+ || cst == NULL_TREE
+ || TREE_CODE (peel) != PEELED_CHREC
+ || is_not_constant_evolution (cst))
+ abort ();
+#endif
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ chrec_fold_plus (type, CHREC_LEFT (peel), cst),
+ chrec_fold_plus (type, CHREC_RIGHT (peel), cst));
+}
+
+/* Fold the addition of an exponential function and a constant. */
+
+static inline tree
+chrec_fold_plus_expo_cst (enum tree_code code,
+ tree type,
+ tree expo,
+ tree cst)
+{
+#if defined ENABLE_CHECKING
+ if (expo == NULL_TREE
+ || cst == NULL_TREE
+ || TREE_CODE (expo) != EXPONENTIAL_CHREC
+ || is_not_constant_evolution (cst))
+ abort ();
+#endif
+
+ /* For the moment, we don't know how to fold this further. */
+ return build (code, type, expo, cst);
+}
+
+/* Fold the addition of an exponential function and a constant. */
+
+static inline tree
+chrec_fold_plus_cst_expo (enum tree_code code,
+ tree type,
+ tree cst,
+ tree expo)
+{
+#if defined ENABLE_CHECKING
+ if (expo == NULL_TREE
+ || cst == NULL_TREE
+ || TREE_CODE (expo) != EXPONENTIAL_CHREC
+ || is_not_constant_evolution (cst))
+ abort ();
+#endif
+
+ /* For the moment, we don't know how to fold this further. */
+ return build (code, type, cst, expo);
+}
+
+/* Fold the addition of two polynomial functions. */
+
+static inline tree
+chrec_fold_plus_poly_poly (enum tree_code code,
+ tree type,
+ tree poly0,
+ tree poly1)
+{
+ tree left, right;
+
+#if defined ENABLE_CHECKING
+ if (poly0 == NULL_TREE
+ || poly1 == NULL_TREE
+ || TREE_CODE (poly0) != POLYNOMIAL_CHREC
+ || TREE_CODE (poly1) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /*
+ {a, +, b}_1 + {c, +, d}_2 -> {{a, +, b}_1 + c, +, d}_2,
+ {a, +, b}_2 + {c, +, d}_1 -> {{c, +, d}_1 + a, +, b}_2,
+ {a, +, b}_x + {c, +, d}_x -> {a+c, +, b+d}_x. */
+ if (CHREC_VARIABLE (poly0) < CHREC_VARIABLE (poly1))
+ {
+ if (code == PLUS_EXPR)
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly1),
+ chrec_fold_plus (type, poly0, CHREC_LEFT (poly1)),
+ CHREC_RIGHT (poly1));
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly1),
+ chrec_fold_minus (type, poly0, CHREC_LEFT (poly1)),
+ chrec_fold_multiply (integer_type_node, CHREC_RIGHT (poly1),
+ integer_minus_one_node));
+ }
+
+ if (CHREC_VARIABLE (poly0) > CHREC_VARIABLE (poly1))
+ {
+ if (code == PLUS_EXPR)
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly0),
+ chrec_fold_plus (type, CHREC_LEFT (poly0), poly1),
+ CHREC_RIGHT (poly0));
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly0),
+ chrec_fold_minus (type, CHREC_LEFT (poly0), poly1),
+ CHREC_RIGHT (poly0));
+ }
+
+ if (code == PLUS_EXPR)
+ {
+ left = chrec_fold_plus
+ (type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
+ right = chrec_fold_plus
+ (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
+ }
+ else
+ {
+ left = chrec_fold_minus
+ (type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
+ right = chrec_fold_minus
+ (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
+ }
+
+ if (chrec_zerop (right))
+ return left;
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly0), left, right);
+}
+
+/* Fold the addition of a polynomial and a peeled chrec. */
+
+static inline tree
+chrec_fold_plus_poly_peel (enum tree_code code,
+ tree type,
+ tree poly,
+ tree peel)
+{
+#if defined ENABLE_CHECKING
+ if (peel == NULL_TREE
+ || poly == NULL_TREE
+ || TREE_CODE (peel) != PEELED_CHREC
+ || TREE_CODE (poly) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /*
+ {a, +, b}_1 + (c, d)_2 -> ({a, +, b}_1 + c, {a, +, b}_1 + d)_2,
+ {a, +, b}_2 + (c, d)_1 -> {a + (c, d)_1, +, b}_2,
+ {a, +, b}_x + (c, d)_x -> ({a, +, b}_x + c, {a, +, b}_x + d)_x. */
+ if (CHREC_VARIABLE (poly) < CHREC_VARIABLE (peel))
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, poly, CHREC_LEFT (peel)) :
+ chrec_fold_minus (type, poly, CHREC_LEFT (peel))),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, poly, CHREC_RIGHT (peel)) :
+ chrec_fold_minus (type, poly, CHREC_RIGHT (peel))));
+
+ if (CHREC_VARIABLE (poly) > CHREC_VARIABLE (peel))
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_LEFT (poly), peel) :
+ chrec_fold_minus (type, CHREC_LEFT (poly), peel)),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_RIGHT (poly), peel) :
+ chrec_fold_minus (type, CHREC_RIGHT (poly), peel)));
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, poly, CHREC_LEFT (peel)) :
+ chrec_fold_minus (type, poly, CHREC_LEFT (peel))),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, poly, CHREC_RIGHT (peel)) :
+ chrec_fold_minus (type, poly, CHREC_RIGHT (peel))));
+}
+
+/* Fold the addition of a polynomial and a peeled chrec. */
+
+static inline tree
+chrec_fold_plus_peel_poly (enum tree_code code,
+ tree type,
+ tree peel,
+ tree poly)
+{
+#if defined ENABLE_CHECKING
+ if (peel == NULL_TREE
+ || poly == NULL_TREE
+ || TREE_CODE (peel) != PEELED_CHREC
+ || TREE_CODE (poly) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /*
+ {a, +, b}_1 + (c, d)_2 -> ({a, +, b}_1 + c, {a, +, b}_1 + d)_2,
+ {a, +, b}_2 + (c, d)_1 -> {a + (c, d)_1, +, b}_2,
+ {a, +, b}_x + (c, d)_x -> ({a, +, b}_x + c, {a, +, b}_x + d)_x. */
+ if (CHREC_VARIABLE (poly) < CHREC_VARIABLE (peel))
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_LEFT (peel), poly) :
+ chrec_fold_minus (type, CHREC_LEFT (peel), poly)),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_RIGHT (peel), poly) :
+ chrec_fold_minus (type, CHREC_RIGHT (peel), poly)));
+
+ if (CHREC_VARIABLE (poly) > CHREC_VARIABLE (peel))
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, peel, CHREC_LEFT (poly)) :
+ chrec_fold_minus (type, peel, CHREC_LEFT (poly))),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, peel, CHREC_RIGHT (poly)) :
+ chrec_fold_minus (type, peel, CHREC_RIGHT (poly))));
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_LEFT (peel), poly) :
+ chrec_fold_minus (type, CHREC_LEFT (peel), poly)),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_RIGHT (peel), poly) :
+ chrec_fold_minus (type, CHREC_RIGHT (peel), poly)));
+}
+
+/* Fold the addition of a polynomial and an exponential functions. */
+
+static inline tree
+chrec_fold_plus_poly_expo (enum tree_code code,
+ tree type,
+ tree poly,
+ tree expo)
+{
+#if defined ENABLE_CHECKING
+ if (expo == NULL_TREE
+ || poly == NULL_TREE
+ || TREE_CODE (expo) != EXPONENTIAL_CHREC
+ || TREE_CODE (poly) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /* For the moment, we don't know how to fold this further. */
+ return build (code, type, poly, expo);
+}
+
+/* Fold the addition of a polynomial and an exponential functions. */
+
+static inline tree
+chrec_fold_plus_expo_poly (enum tree_code code,
+ tree type,
+ tree expo,
+ tree poly)
+{
+#if defined ENABLE_CHECKING
+ if (expo == NULL_TREE
+ || poly == NULL_TREE
+ || TREE_CODE (expo) != EXPONENTIAL_CHREC
+ || TREE_CODE (poly) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /* For the moment, we don't know how to fold this further. */
+ return build (code, type, expo, poly);
+}
+
+/* Fold the addition of two peeled chrecs. */
+
+static inline tree
+chrec_fold_plus_peel_peel (tree type,
+ tree peel0,
+ tree peel1)
+{
+#if defined ENABLE_CHECKING
+ if (peel0 == NULL_TREE
+ || peel1 == NULL_TREE
+ || TREE_CODE (peel0) != PEELED_CHREC
+ || TREE_CODE (peel1) != PEELED_CHREC)
+ abort ();
+#endif
+
+ /*
+ (a, b)_1 + (c, d)_2 -> ((a, b)_1 + c, (a, b)_1 + d)_2,
+ (a, b)_2 + (c, d)_1 -> (a + (c, d)_1, b + (c, d)_1)_2,
+ (a, b)_x + (c, d)_x -> (a + c, b + d)_x. */
+ if (CHREC_VARIABLE (peel0) < CHREC_VARIABLE (peel1))
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel1),
+ chrec_fold_plus (type, peel0, CHREC_LEFT (peel1)),
+ chrec_fold_plus (type, peel0, CHREC_RIGHT (peel1)));
+
+ if (CHREC_VARIABLE (peel0) > CHREC_VARIABLE (peel1))
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel0),
+ chrec_fold_plus (type, CHREC_LEFT (peel0), peel1),
+ chrec_fold_plus (type, CHREC_RIGHT (peel0), peel1));
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel0),
+ chrec_fold_plus (type, CHREC_LEFT (peel0), CHREC_LEFT (peel1)),
+ chrec_fold_plus (type, CHREC_RIGHT (peel0), CHREC_RIGHT (peel1)));
+}
+
+/* Fold the addition of two exponential functions. */
+
+static inline tree
+chrec_fold_plus_expo_expo (enum tree_code code,
+ tree type,
+ tree expo0,
+ tree expo1)
+{
+#if defined ENABLE_CHECKING
+ if (expo0 == NULL_TREE
+ || expo1 == NULL_TREE
+ || TREE_CODE (expo0) != EXPONENTIAL_CHREC
+ || TREE_CODE (expo1) != EXPONENTIAL_CHREC)
+ abort ();
+#endif
+
+ /* For the moment, we don't know how to fold this further. */
+ return build (code, type, expo0, expo1);
+}
+
+
+
+/* Fold the multiplication of a peeled chrec and a constant. */
+
+static inline tree
+chrec_fold_multiply_peel_cst (tree type,
+ tree peel,
+ tree cst)
+{
+#if defined ENABLE_CHECKING
+ if (peel == NULL_TREE
+ || cst == NULL_TREE
+ || TREE_CODE (peel) != PEELED_CHREC
+ || is_not_constant_evolution (cst))
+ abort ();
+#endif
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ chrec_fold_multiply (type, CHREC_LEFT (peel), cst),
+ chrec_fold_multiply (type, CHREC_RIGHT (peel), cst));
+}
+
+/* Fold the multiplication of an interval and a constant. */
+
+static inline tree
+chrec_fold_multiply_ival_cst (tree type,
+ tree ival,
+ tree cst)
+{
+ tree lowm, upm;
+
+#if defined ENABLE_CHECKING
+ if (ival == NULL_TREE
+ || cst == NULL_TREE
+ || TREE_CODE (ival) != INTERVAL_CHREC
+ || is_not_constant_evolution (cst))
+ abort ();
+#endif
+
+ /* Don't modify abstract values. */
+ if (ival == chrec_top)
+ return chrec_top;
+ if (ival == chrec_bot)
+ return chrec_bot;
+
+ lowm = chrec_fold_multiply (type, CHREC_LOW (ival), cst);
+ upm = chrec_fold_multiply (type, CHREC_UP (ival), cst);
+
+ /* When the fold resulted in an overflow, conservatively answer
+ chrec_top. */
+ if (!evolution_function_is_constant_p (lowm)
+ || !evolution_function_is_constant_p (upm)
+ || TREE_OVERFLOW (lowm)
+ || TREE_OVERFLOW (upm))
+ return chrec_top;
+
+ return build_interval_chrec (tree_fold_min (type, lowm, upm),
+ tree_fold_max (type, lowm, upm));
+}
+
+/* Fold the multiplication of two polynomial functions. */
+
+static inline tree
+chrec_fold_multiply_poly_poly (tree type,
+ tree poly0,
+ tree poly1)
+{
+#if defined ENABLE_CHECKING
+ if (poly0 == NULL_TREE
+ || poly1 == NULL_TREE
+ || TREE_CODE (poly0) != POLYNOMIAL_CHREC
+ || TREE_CODE (poly1) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /* {a, +, b}_1 * {c, +, d}_2 -> {c*{a, +, b}_1, +, d}_2,
+ {a, +, b}_2 * {c, +, d}_1 -> {a*{c, +, d}_1, +, b}_2,
+ {a, +, b}_x * {c, +, d}_x -> {a*c, +, a*d + b*c + b*d, +, 2*b*d}_x. */
+ if (CHREC_VARIABLE (poly0) < CHREC_VARIABLE (poly1))
+ /* poly0 is a constant wrt. poly1. */
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly1),
+ chrec_fold_multiply (type, CHREC_LEFT (poly1), poly0),
+ CHREC_RIGHT (poly1));
+
+ if (CHREC_VARIABLE (poly1) < CHREC_VARIABLE (poly0))
+ /* poly1 is a constant wrt. poly0. */
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly0),
+ chrec_fold_multiply (type, CHREC_LEFT (poly0), poly1),
+ CHREC_RIGHT (poly0));
+
+ /* poly0 and poly1 are two polynomials in the same variable,
+ {a, +, b}_x * {c, +, d}_x -> {a*c, +, a*d + b*c + b*d, +, 2*b*d}_x. */
+ return
+ build_polynomial_chrec
+ (CHREC_VARIABLE (poly0),
+ build_polynomial_chrec
+ (CHREC_VARIABLE (poly0),
+
+ /* "a*c". */
+ chrec_fold_multiply (type, CHREC_LEFT (poly0), CHREC_LEFT (poly1)),
+
+ /* "a*d + b*c + b*d". */
+ chrec_fold_plus
+ (type, chrec_fold_multiply (type, CHREC_LEFT (poly0), CHREC_RIGHT (poly1)),
+
+ chrec_fold_plus
+ (type,
+ chrec_fold_multiply (type, CHREC_RIGHT (poly0), CHREC_LEFT (poly1)),
+ chrec_fold_multiply (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1))))),
+
+ /* "2*b*d". */
+ chrec_fold_multiply
+ (type, build_int_2 (2, 0),
+ chrec_fold_multiply (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1))));
+}
+
+/* Fold the addition of a polynomial and a peeled chrec. */
+
+static inline tree
+chrec_fold_multiply_poly_peel (tree type,
+ tree poly,
+ tree peel)
+{
+#if defined ENABLE_CHECKING
+ if (peel == NULL_TREE
+ || poly == NULL_TREE
+ || TREE_CODE (peel) != PEELED_CHREC
+ || TREE_CODE (poly) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /*
+ {a, +, b}_1 * (c, d)_2 -> ({a, +, b}_1 * c, {a, +, b}_1 * d)_2,
+ {a, +, b}_2 * (c, d)_1 -> {a * (c, d)_1, +, b}_2,
+ {a, +, b}_x * (c, d)_x -> ({a, +, b}_x * c, {a, +, b}_x * d)_x. */
+ if (CHREC_VARIABLE (poly) < CHREC_VARIABLE (peel))
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ chrec_fold_multiply (type, poly, CHREC_LEFT (peel)),
+ chrec_fold_multiply (type, poly, CHREC_RIGHT (peel)));
+
+ if (CHREC_VARIABLE (poly) > CHREC_VARIABLE (peel))
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (poly),
+ chrec_fold_multiply (type, CHREC_LEFT (poly), peel),
+ chrec_fold_multiply (type, CHREC_RIGHT (poly), peel));
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel),
+ chrec_fold_multiply (type, poly, CHREC_LEFT (peel)),
+ chrec_fold_multiply (type, poly, CHREC_RIGHT (peel)));
+}
+
+/* Fold the multiplication of a polynomial and an exponential
+ functions. */
+
+static inline tree
+chrec_fold_multiply_poly_expo (tree type,
+ tree poly,
+ tree expo)
+{
+#if defined ENABLE_CHECKING
+ if (expo == NULL_TREE
+ || poly == NULL_TREE
+ || TREE_CODE (expo) != EXPONENTIAL_CHREC
+ || TREE_CODE (poly) != POLYNOMIAL_CHREC)
+ abort ();
+#endif
+
+ /* For the moment, we don't know how to fold this further. */
+ return build (MULT_EXPR, type, expo, poly);
+}
+
+/* Fold the addition of two peeled chrecs. */
+
+static inline tree
+chrec_fold_multiply_peel_peel (tree type,
+ tree peel0,
+ tree peel1)
+{
+#if defined ENABLE_CHECKING
+ if (peel0 == NULL_TREE
+ || peel1 == NULL_TREE
+ || TREE_CODE (peel0) != PEELED_CHREC
+ || TREE_CODE (peel1) != PEELED_CHREC)
+ abort ();
+#endif
+
+ /*
+ (a, b)_1 * (c, d)_2 -> ((a, b)_1 * c, (a, b)_1 * d)_2,
+ (a, b)_2 * (c, d)_1 -> (a * (c, d)_1, b * (c, d)_1)_2,
+ (a, b)_x * (c, d)_x -> (a * c, b * d)_x. */
+ if (CHREC_VARIABLE (peel0) < CHREC_VARIABLE (peel1))
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel1),
+ chrec_fold_multiply (type, peel0, CHREC_LEFT (peel1)),
+ chrec_fold_multiply (type, peel0, CHREC_RIGHT (peel1)));
+
+ if (CHREC_VARIABLE (peel0) > CHREC_VARIABLE (peel1))
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel0),
+ chrec_fold_multiply (type, CHREC_LEFT (peel0), peel1),
+ chrec_fold_multiply (type, CHREC_RIGHT (peel0), peel1));
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (peel0),
+ chrec_fold_multiply (type, CHREC_LEFT (peel0), CHREC_LEFT (peel1)),
+ chrec_fold_multiply (type, CHREC_RIGHT (peel0), CHREC_RIGHT (peel1)));
+}
+
+/* Fold the multiplication of two exponential functions. */
+
+static inline tree
+chrec_fold_multiply_expo_expo (tree type,
+ tree expo0,
+ tree expo1)
+{
+#if defined ENABLE_CHECKING
+ if (expo0 == NULL_TREE
+ || expo1 == NULL_TREE
+ || TREE_CODE (expo0) != EXPONENTIAL_CHREC
+ || TREE_CODE (expo1) != EXPONENTIAL_CHREC)
+ abort ();
+#endif
+
+ if (CHREC_VARIABLE (expo0) < CHREC_VARIABLE (expo1))
+ /* expo0 is a constant wrt. expo1. */
+ return build_exponential_chrec
+ (CHREC_VARIABLE (expo1),
+ chrec_fold_multiply (type, CHREC_LEFT (expo1), expo0),
+ CHREC_RIGHT (expo1));
+
+ if (CHREC_VARIABLE (expo1) < CHREC_VARIABLE (expo0))
+ /* expo1 is a constant wrt. expo0. */
+ return build_exponential_chrec
+ (CHREC_VARIABLE (expo0),
+ chrec_fold_multiply (type, CHREC_LEFT (expo0), expo1),
+ CHREC_RIGHT (expo0));
+
+ return build_exponential_chrec
+ (CHREC_VARIABLE (expo0),
+ chrec_fold_multiply (type, CHREC_LEFT (expo0), CHREC_LEFT (expo1)),
+ chrec_fold_multiply (type, CHREC_RIGHT (expo0), CHREC_RIGHT (expo1)));
+}
+
+/* Fold the multiplication of two intervals. */
+
+static inline tree
+chrec_fold_multiply_ival_ival (tree type,
+ tree ival0,
+ tree ival1)
+{
+ tree ac, ad, bc, bd;
+
+#if defined ENABLE_CHECKING
+ if (ival0 == NULL_TREE
+ || ival1 == NULL_TREE
+ || TREE_CODE (ival0) != INTERVAL_CHREC
+ || TREE_CODE (ival1) != INTERVAL_CHREC)
+ abort ();
+#endif
+
+ /* Don't modify abstract values. */
+ if (automatically_generated_chrec_p (ival0)
+ || automatically_generated_chrec_p (ival1))
+ chrec_fold_automatically_generated_operands (ival0, ival1);
+
+ ac = tree_fold_multiply (type, CHREC_LOW (ival0), CHREC_LOW (ival1));
+ ad = tree_fold_multiply (type, CHREC_LOW (ival0), CHREC_UP (ival1));
+ bc = tree_fold_multiply (type, CHREC_UP (ival0), CHREC_LOW (ival1));
+ bd = tree_fold_multiply (type, CHREC_UP (ival0), CHREC_UP (ival1));
+
+ /* When the fold resulted in an overflow, conservatively answer
+ chrec_top. */
+ if (!evolution_function_is_constant_p (ac)
+ || !evolution_function_is_constant_p (ad)
+ || !evolution_function_is_constant_p (bc)
+ || !evolution_function_is_constant_p (bd)
+ || TREE_OVERFLOW (ac)
+ || TREE_OVERFLOW (ad)
+ || TREE_OVERFLOW (bc)
+ || TREE_OVERFLOW (bd))
+ return chrec_top;
+
+ /* [a, b] * [c, d] -> [min (ac, ad, bc, bd), max (ac, ad, bc, bd)],
+ for reference, see Moore's "Interval Arithmetic". */
+ return build_interval_chrec
+ (tree_fold_min
+ (type, tree_fold_min
+ (type, tree_fold_min (type, ac, ad), bc), bd),
+ tree_fold_max
+ (type, tree_fold_max
+ (type, tree_fold_max (type, ac, ad), bc), bd));
+}
+
+/* When the operands are automatically_generated_chrec_p, the fold has
+ to respect the semantics of the operands. */
+
+tree
+chrec_fold_automatically_generated_operands (tree op0,
+ tree op1)
+{
+ /* TOP op x = TOP,
+ x op TOP = TOP. */
+ if (op0 == chrec_top
+ || op1 == chrec_top)
+ return chrec_top;
+
+ /* BOT op TOP = TOP,
+ TOP op BOT = TOP,
+ BOT op x = BOT,
+ x op BOT = BOT. */
+ if (op0 == chrec_bot
+ || op1 == chrec_bot)
+ return chrec_bot;
+
+ if (op0 == chrec_not_analyzed_yet
+ || op1 == chrec_not_analyzed_yet)
+ return chrec_not_analyzed_yet;
+
+ /* The default case produces a safe result. */
+ return chrec_top;
+}
+
+/* Fold the addition of two chrecs. */
+
+static tree
+chrec_fold_plus_1 (enum tree_code code,
+ tree type,
+ tree op0,
+ tree op1)
+{
+ tree t1, t2;
+
+ if (automatically_generated_chrec_p (op0)
+ || automatically_generated_chrec_p (op1))
+ return chrec_fold_automatically_generated_operands (op0, op1);
+
+ switch (TREE_CODE (op0))
+ {
+ case POLYNOMIAL_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return chrec_fold_plus_poly_poly (code, type, op0, op1);
+
+ case EXPONENTIAL_CHREC:
+ return chrec_fold_plus_poly_expo (code, type, op0, op1);
+
+ case PEELED_CHREC:
+ return chrec_fold_plus_poly_peel (code, type, op0, op1);
+
+ default:
+ if (code == PLUS_EXPR)
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op0),
+ chrec_fold_plus (type, CHREC_LEFT (op0), op1),
+ CHREC_RIGHT (op0));
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op0),
+ chrec_fold_minus (type, CHREC_LEFT (op0), op1),
+ CHREC_RIGHT (op0));
+ }
+
+ case EXPONENTIAL_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return chrec_fold_plus_expo_poly (code, type, op0, op1);
+
+ case EXPONENTIAL_CHREC:
+ return chrec_fold_plus_expo_expo (code, type, op0, op1);
+
+ case PEELED_CHREC:
+ return build (code, type, op0, op1);
+
+ default:
+ return chrec_fold_plus_expo_cst (code, type, op0, op1);
+ }
+
+ case PEELED_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return chrec_fold_plus_peel_poly (code, type, op0, op1);
+
+ case PEELED_CHREC:
+ return chrec_fold_plus_peel_peel (type, op0, op1);
+
+ case EXPONENTIAL_CHREC:
+ return build (code, type, op0, op1);
+
+ default:
+ return build_peeled_chrec
+ (CHREC_VARIABLE (op0),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_LEFT (op0), op1) :
+ chrec_fold_minus (type, CHREC_LEFT (op0), op1)),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_RIGHT (op0), op1) :
+ chrec_fold_minus (type, CHREC_RIGHT (op0), op1)));
+ }
+
+ case INTERVAL_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op1),
+ (code == PLUS_EXPR ?
+ chrec_fold_plus (type, op0, CHREC_LEFT (op1)) :
+ chrec_fold_minus (type, op0, CHREC_LEFT (op1))),
+ CHREC_RIGHT (op1));
+
+ case EXPONENTIAL_CHREC:
+ return chrec_top;
+
+ case INTERVAL_CHREC:
+ t1 = (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_LOW (op0), CHREC_LOW (op1)) :
+ chrec_fold_minus (type, CHREC_LOW (op0), CHREC_LOW (op1)));
+ t2 = (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_UP (op0), CHREC_UP (op1)) :
+ chrec_fold_minus (type, CHREC_UP (op0), CHREC_UP (op1)));
+
+ /* When the fold resulted in an overflow, conservatively answer
+ chrec_top. */
+ if (!evolution_function_is_constant_p (t1)
+ || !evolution_function_is_constant_p (t2)
+ || TREE_OVERFLOW (t1)
+ || TREE_OVERFLOW (t2))
+ return chrec_top;
+
+ return build_interval_chrec
+ (tree_fold_min (type, t1, t2),
+ tree_fold_max (type, t1, t2));
+
+ default:
+ t1 = (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_LOW (op0), op1) :
+ chrec_fold_minus (type, CHREC_LOW (op0), op1));
+ t2 = (code == PLUS_EXPR ?
+ chrec_fold_plus (type, CHREC_UP (op0), op1) :
+ chrec_fold_minus (type, CHREC_UP (op0), op1));
+
+ /* When the fold resulted in an overflow, conservatively answer
+ chrec_top. */
+ if (!evolution_function_is_constant_p (t1)
+ || !evolution_function_is_constant_p (t2)
+ || TREE_OVERFLOW (t1)
+ || TREE_OVERFLOW (t2))
+ return chrec_top;
+
+ return build_interval_chrec
+ (tree_fold_min (type, t1, t2),
+ tree_fold_max (type, t1, t2));
+ }
+
+ default:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ if (code == PLUS_EXPR)
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_plus (type, op0, CHREC_LEFT (op1)),
+ CHREC_RIGHT (op1));
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_minus (type, op0, CHREC_LEFT (op1)),
+ chrec_fold_multiply (type, CHREC_RIGHT (op1),
+ convert (type,
+ integer_minus_one_node)));
+
+ case EXPONENTIAL_CHREC:
+ return chrec_fold_plus_cst_expo (code, type, op0, op1);
+
+ case PEELED_CHREC:
+ if (code == PLUS_EXPR)
+ return build_peeled_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_plus (type, op0, CHREC_LEFT (op1)),
+ chrec_fold_plus (type, op0, CHREC_RIGHT (op1)));
+ else
+ return build_peeled_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_minus (type, op0, CHREC_LEFT (op1)),
+ chrec_fold_minus (type, op0, CHREC_RIGHT (op1)));
+
+ case INTERVAL_CHREC:
+ t1 = (code == PLUS_EXPR ?
+ chrec_fold_plus (type, op0, CHREC_LOW (op1)) :
+ chrec_fold_minus (type, op0, CHREC_LOW (op1)));
+ t2 = (code == PLUS_EXPR ?
+ chrec_fold_plus (type, op0, CHREC_UP (op1)) :
+ chrec_fold_minus (type, op0, CHREC_UP (op1)));
+
+ /* When the fold resulted in an overflow, conservatively answer
+ chrec_top. */
+ if (!evolution_function_is_constant_p (t1)
+ || !evolution_function_is_constant_p (t2)
+ || TREE_OVERFLOW (t1)
+ || TREE_OVERFLOW (t2))
+ return chrec_top;
+
+ return build_interval_chrec
+ (tree_fold_min (type, t1, t2),
+ tree_fold_max (type, t1, t2));
+
+ default:
+ if (tree_contains_chrecs (op0)
+ || tree_contains_chrecs (op1))
+ return build (code, type, op0, op1);
+ else
+ return fold (build (code, type, op0, op1));
+ }
+ }
+}
+
+/* Fold the addition of two chrecs. */
+
+tree
+chrec_fold_plus (tree type,
+ tree op0,
+ tree op1)
+{
+ if (integer_zerop (op0)
+ || (TREE_CODE (op0) == INTERVAL_CHREC
+ && integer_zerop (CHREC_LOW (op0))
+ && integer_zerop (CHREC_UP (op0))))
+ return op1;
+ if (integer_zerop (op1)
+ || (TREE_CODE (op1) == INTERVAL_CHREC
+ && integer_zerop (CHREC_LOW (op1))
+ && integer_zerop (CHREC_UP (op1))))
+ return op0;
+
+ return chrec_fold_plus_1 (PLUS_EXPR, type, op0, op1);
+}
+
+/* Fold the substraction of two chrecs. */
+
+tree
+chrec_fold_minus (tree type,
+ tree op0,
+ tree op1)
+{
+ if (integer_zerop (op1)
+ || (TREE_CODE (op1) == INTERVAL_CHREC
+ && integer_zerop (CHREC_LOW (op1))
+ && integer_zerop (CHREC_UP (op1))))
+ return op0;
+
+ return chrec_fold_plus_1 (MINUS_EXPR, type, op0, op1);
+}
+
+/* Fold the multiplication of two chrecs. */
+
+tree
+chrec_fold_multiply (tree type,
+ tree op0,
+ tree op1)
+{
+ if (automatically_generated_chrec_p (op0)
+ || automatically_generated_chrec_p (op1))
+ return chrec_fold_automatically_generated_operands (op0, op1);
+
+ switch (TREE_CODE (op0))
+ {
+ case POLYNOMIAL_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return chrec_fold_multiply_poly_poly (type, op0, op1);
+
+ case PEELED_CHREC:
+ return chrec_fold_multiply_poly_peel (type, op0, op1);
+
+ case EXPONENTIAL_CHREC:
+ return chrec_fold_multiply_poly_expo (type, op0, op1);
+
+ default:
+ if (integer_onep (op1))
+ return op0;
+ if (integer_zerop (op1))
+ return integer_zero_node;
+
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op0),
+ chrec_fold_multiply (type, CHREC_LEFT (op0), op1),
+ chrec_fold_multiply (type, CHREC_RIGHT (op0), op1));
+ }
+
+ case PEELED_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return chrec_fold_multiply_poly_peel (type, op1, op0);
+
+ case PEELED_CHREC:
+ return chrec_fold_multiply_peel_peel (type, op0, op1);
+
+ default:
+ if (integer_onep (op1))
+ return op0;
+ if (integer_zerop (op1))
+ return integer_zero_node;
+
+ return build_peeled_chrec
+ (CHREC_VARIABLE (op0),
+ chrec_fold_multiply (type, CHREC_LEFT (op0), op1),
+ chrec_fold_multiply (type, CHREC_RIGHT (op0), op1));
+ }
+
+ case EXPONENTIAL_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return chrec_fold_multiply_poly_expo (type, op1, op0);
+
+ case EXPONENTIAL_CHREC:
+ return chrec_fold_multiply_expo_expo (type, op0, op1);
+
+ default:
+ if (integer_onep (op1))
+ return op0;
+ if (integer_zerop (op1))
+ return integer_zero_node;
+
+ return build_exponential_chrec
+ (CHREC_VARIABLE (op0),
+ chrec_fold_multiply (type, CHREC_LEFT (op0), op1),
+ CHREC_RIGHT (op0));
+ }
+
+ case INTERVAL_CHREC:
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
+ chrec_fold_multiply (type, CHREC_RIGHT (op1), op0));
+
+ case PEELED_CHREC:
+ return build_peeled_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
+ chrec_fold_multiply (type, CHREC_RIGHT (op1), op0));
+
+ case EXPONENTIAL_CHREC:
+ return build_exponential_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
+ CHREC_RIGHT (op1));
+
+ case INTERVAL_CHREC:
+ return chrec_fold_multiply_ival_ival (type, op0, op1);
+
+ default:
+ if (integer_onep (op1))
+ return op0;
+ if (integer_zerop (op1))
+ return integer_zero_node;
+ return chrec_fold_multiply_ival_cst (type, op0, op1);
+ }
+
+ default:
+ if (integer_onep (op0))
+ return op1;
+
+ if (integer_zerop (op0))
+ return integer_zero_node;
+
+ switch (TREE_CODE (op1))
+ {
+ case POLYNOMIAL_CHREC:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
+ chrec_fold_multiply (type, CHREC_RIGHT (op1), op0));
+
+ case PEELED_CHREC:
+ return build_peeled_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
+ chrec_fold_multiply (type, CHREC_RIGHT (op1), op0));
+
+ case EXPONENTIAL_CHREC:
+ return build_exponential_chrec
+ (CHREC_VARIABLE (op1),
+ chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
+ CHREC_RIGHT (op1));
+
+ case INTERVAL_CHREC:
+ return chrec_fold_multiply_ival_cst (type, op1, op0);
+
+ default:
+ if (integer_onep (op1))
+ return op0;
+ if (integer_zerop (op1))
+ return integer_zero_node;
+ return tree_fold_multiply (type, op0, op1);
+ }
+ }
+}
+
+
+
+/* Operations. */
+
+/* Try to recognize the nature of the peeled chrec and to transform it
+ into a more specific chrec: polynomial, periodic, ... For example,
+ this function transforms (6, {9, +, 3}_1)_1 into {6, +, 3}_1. */
+
+tree
+simplify_peeled_chrec (tree peel)
+{
+ tree res = peel;
+
+ return res;
+}
+
+/* Helper function. Use the Newton's interpolating formula for
+ evaluating the value of the evolution function. */
+
+static tree
+chrec_evaluate (unsigned var,
+ tree chrec,
+ tree n,
+ tree k)
+{
+ tree binomial_n_k = tree_fold_binomial (n, k);
+
+ if (TREE_CODE (chrec) == EXPONENTIAL_CHREC
+ && CHREC_VARIABLE (chrec) == var)
+ return chrec_top;
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
+ {
+ if (CHREC_VARIABLE (chrec) > var)
+ return chrec_evaluate (var, CHREC_LEFT (chrec), n, k);
+
+ if (CHREC_VARIABLE (chrec) == var)
+ return chrec_fold_plus
+ (chrec_type (chrec),
+ chrec_fold_multiply (chrec_type (CHREC_LEFT (chrec)),
+ binomial_n_k,
+ CHREC_LEFT (chrec)),
+ chrec_evaluate (var, CHREC_RIGHT (chrec), n,
+ tree_fold_plus (integer_type_node,
+ k, integer_one_node)));
+
+ return chrec_fold_multiply (chrec_type (chrec), binomial_n_k, chrec);
+ }
+ else
+ return chrec_fold_multiply (chrec_type (chrec), binomial_n_k, chrec);
+}
+
+/* Evaluates "CHREC (X)" when the varying variable is VAR.
+ Example: Given the following parameters,
+
+ var = 1
+ chrec = {5, +, {3, +, 4}_1}_1
+ x = 10
+
+ The result is given by the Newton's interpolating formula:
+ 5 * \binom{10}{0} + 3 * \binom{10}{1} + 4 * \binom{10}{2}.
+*/
+
+tree
+chrec_apply (unsigned var,
+ tree chrec,
+ tree x)
+{
+ tree res = chrec_top;
+
+ if (automatically_generated_chrec_p (chrec)
+ || automatically_generated_chrec_p (x)
+
+ /* When the symbols are defined in an outer loop, it is possible
+ to symbolically compute the apply, since the symbols are
+ constants with respect to the varying loop. */
+ || chrec_contains_symbols_defined_in_loop (chrec, var)
+ || chrec_contains_symbols (x))
+ return chrec_top;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(chrec_apply \n");
+
+ if (evolution_function_is_affine_p (chrec))
+ {
+ /* "{a, +, b} (x)" -> "a + b*x". */
+ if (TREE_CODE (CHREC_LEFT (chrec)) == INTEGER_CST
+ && integer_zerop (CHREC_LEFT (chrec)))
+ res = chrec_fold_multiply
+ (chrec_type (chrec), CHREC_RIGHT (chrec), x);
+
+ else
+ res = chrec_fold_plus (chrec_type (chrec),
+ CHREC_LEFT (chrec),
+ chrec_fold_multiply
+ (chrec_type (chrec), CHREC_RIGHT (chrec), x));
+ }
+
+ else if (TREE_CODE (chrec) != POLYNOMIAL_CHREC
+ && TREE_CODE (chrec) != EXPONENTIAL_CHREC)
+ res = chrec;
+
+ else if (TREE_CODE (x) == INTEGER_CST
+ && tree_int_cst_sgn (x) == 1)
+ /* testsuite/.../ssa-chrec-38.c. */
+ res = chrec_evaluate (var, chrec, x, integer_zero_node);
+
+ else
+ res = chrec_top;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (varying_loop = %d\n", var);
+ fprintf (dump_file, ")\n (chrec = ");
+ print_generic_expr (dump_file, chrec, 0);
+ fprintf (dump_file, ")\n (x = ");
+ print_generic_expr (dump_file, x, 0);
+ fprintf (dump_file, ")\n (res = ");
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ return res;
+}
+
+/* Replaces the initial condition in CHREC with INIT_COND. */
+
+tree
+chrec_replace_initial_condition (tree chrec,
+ tree init_cond)
+{
+ if (automatically_generated_chrec_p (chrec))
+ return chrec;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec),
+ chrec_replace_initial_condition (CHREC_LEFT (chrec), init_cond),
+ CHREC_RIGHT (chrec));
+
+ case EXPONENTIAL_CHREC:
+ return build_exponential_chrec
+ (CHREC_VARIABLE (chrec),
+ chrec_replace_initial_condition (CHREC_LEFT (chrec), init_cond),
+ CHREC_RIGHT (chrec));
+
+ case PEELED_CHREC:
+ return chrec_top;
+
+ default:
+ return init_cond;
+ }
+}
+
+/* Returns the initial condition of a given CHREC. */
+
+tree
+initial_condition (tree chrec)
+{
+ if (automatically_generated_chrec_p (chrec))
+ return chrec;
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC
+ || TREE_CODE (chrec) == EXPONENTIAL_CHREC)
+ return initial_condition (CHREC_LEFT (chrec));
+ else
+ return chrec;
+}
+
+/* Returns a multivariate function that has no evolution in LOOP_NUM.
+ Mask the evolution LOOP_NUM. */
+
+tree
+hide_evolution_in_loop (tree chrec, unsigned loop_num)
+{
+ if (automatically_generated_chrec_p (chrec))
+ return chrec;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) >= loop_num)
+ return hide_evolution_in_loop (CHREC_LEFT (chrec), loop_num);
+
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec),
+ hide_evolution_in_loop (CHREC_LEFT (chrec), loop_num),
+ CHREC_RIGHT (chrec));
+
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) >= loop_num)
+ return hide_evolution_in_loop (CHREC_LEFT (chrec), loop_num);
+
+ else
+ return build_exponential_chrec
+ (CHREC_VARIABLE (chrec),
+ hide_evolution_in_loop (CHREC_LEFT (chrec), loop_num),
+ CHREC_RIGHT (chrec));
+
+ default:
+ return chrec;
+ }
+}
+
+/* Returns a univariate function that represents the evolution in
+ LOOP_NUM. Mask the evolution of any other loop. */
+
+tree
+hide_evolution_in_other_loops_than_loop (tree chrec,
+ unsigned loop_num)
+{
+ if (automatically_generated_chrec_p (chrec))
+ return chrec;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) == loop_num)
+ return build_polynomial_chrec
+ (loop_num,
+ hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
+ loop_num),
+ CHREC_RIGHT (chrec));
+
+ else if (CHREC_VARIABLE (chrec) < loop_num)
+ /* There is no evolution in this loop. */
+ return initial_condition (chrec);
+
+ else
+ return hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
+ loop_num);
+
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) == loop_num)
+ return build_exponential_chrec
+ (loop_num,
+ hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
+ loop_num),
+ CHREC_RIGHT (chrec));
+
+ else if (CHREC_VARIABLE (chrec) < loop_num)
+ /* There is no evolution in this loop. */
+ return initial_condition (chrec);
+
+ else
+ return hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
+ loop_num);
+
+ default:
+ return chrec;
+ }
+}
+
+/* Returns the evolution part in LOOP_NUM. Example: the call
+ get_evolution_in_loop (1, {{0, +, 1}_1, +, 2}_1) returns
+ {1, +, 2}_1 */
+
+tree
+evolution_part_in_loop_num (tree chrec,
+ unsigned loop_num)
+{
+ if (automatically_generated_chrec_p (chrec))
+ return chrec;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) == loop_num)
+ {
+ if (TREE_CODE (CHREC_LEFT (chrec)) != POLYNOMIAL_CHREC
+ || CHREC_VARIABLE (CHREC_LEFT (chrec)) != CHREC_VARIABLE (chrec))
+ return CHREC_RIGHT (chrec);
+
+ else
+ return build_polynomial_chrec
+ (loop_num,
+ evolution_part_in_loop_num (CHREC_LEFT (chrec), loop_num),
+ CHREC_RIGHT (chrec));
+ }
+
+ else if (CHREC_VARIABLE (chrec) < loop_num)
+ /* There is no evolution part in this loop. */
+ return NULL_TREE;
+
+ else
+ return evolution_part_in_loop_num (CHREC_LEFT (chrec), loop_num);
+
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) == loop_num)
+ {
+ if (TREE_CODE (CHREC_LEFT (chrec)) != EXPONENTIAL_CHREC
+ || CHREC_VARIABLE (CHREC_LEFT (chrec)) != CHREC_VARIABLE (chrec))
+ return CHREC_RIGHT (chrec);
+
+ else
+ return build_exponential_chrec
+ (loop_num,
+ evolution_part_in_loop_num (CHREC_LEFT (chrec), loop_num),
+ CHREC_RIGHT (chrec));
+ }
+
+ else if (CHREC_VARIABLE (chrec) < loop_num)
+ /* There is no evolution part in this loop. */
+ return NULL_TREE;
+
+ else
+ return evolution_part_in_loop_num (CHREC_LEFT (chrec), loop_num);
+
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Set or reset the evolution of CHREC to NEW_EVOL in loop LOOP_NUM.
+ This function is essentially used for setting the evolution to
+ chrec_top, for example after having determined that it is
+ impossible to say how many times a loop will execute. */
+
+tree
+reset_evolution_in_loop (unsigned loop_num,
+ tree chrec,
+ tree new_evol)
+{
+ if ((TREE_CODE (chrec) == POLYNOMIAL_CHREC
+ || TREE_CODE (chrec) == EXPONENTIAL_CHREC)
+ && CHREC_VARIABLE (chrec) > loop_num)
+ return build
+ (TREE_CODE (chrec),
+ build_int_2 (CHREC_VARIABLE (chrec), 0),
+ reset_evolution_in_loop (loop_num, CHREC_LEFT (chrec), new_evol),
+ reset_evolution_in_loop (loop_num, CHREC_RIGHT (chrec), new_evol));
+
+ while ((TREE_CODE (chrec) == POLYNOMIAL_CHREC
+ || TREE_CODE (chrec) == EXPONENTIAL_CHREC)
+ && CHREC_VARIABLE (chrec) == loop_num)
+ chrec = CHREC_LEFT (chrec);
+
+ return build_polynomial_chrec (loop_num, chrec, new_evol);
+}
+
+
+/* Returns the value of the variable after one execution of the loop
+ LOOP_NB, supposing that CHREC is the evolution function of the
+ variable.
+
+ Example:
+ chrec_eval_next_init_cond (4, {{1, +, 3}_2, +, 10}_4) = 11. */
+
+tree
+chrec_eval_next_init_cond (unsigned loop_nb,
+ tree chrec)
+{
+ tree init_cond;
+
+ init_cond = initial_condition (chrec);
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC
+ || TREE_CODE (chrec) == EXPONENTIAL_CHREC)
+ {
+ if (CHREC_VARIABLE (chrec) < loop_nb)
+ /* There is no evolution in this dimension. */
+ return init_cond;
+
+ while ((TREE_CODE (CHREC_LEFT (chrec)) == POLYNOMIAL_CHREC
+ || TREE_CODE (CHREC_LEFT (chrec)) == EXPONENTIAL_CHREC)
+ && CHREC_VARIABLE (CHREC_LEFT (chrec)) >= loop_nb)
+ chrec = CHREC_LEFT (chrec);
+
+ if (CHREC_VARIABLE (chrec) != loop_nb)
+ /* There is no evolution in this dimension. */
+ return init_cond;
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
+ /* testsuite/.../ssa-chrec-14.c */
+ return chrec_fold_plus (chrec_type (init_cond), init_cond,
+ initial_condition (CHREC_RIGHT (chrec)));
+
+ else
+ return chrec_fold_multiply (chrec_type (init_cond), init_cond,
+ initial_condition (CHREC_RIGHT (chrec)));
+ }
+
+ else
+ return init_cond;
+}
+
+/* Determine the type of the result after the merge of types TYPE0 and
+ TYPE1. */
+
+static inline tree
+chrec_merge_types (tree type0,
+ tree type1)
+{
+ if (type0 == type1)
+ return type0;
+
+ else
+ /* FIXME. */
+ return NULL_TREE;
+}
+
+/* Merge the information contained in intervals or scalar constants.
+ merge ([a, b], [c, d]) -> [min (a, c), max (b, d)],
+ merge ([a, b], c) -> [min (a, c), max (b, c)],
+ merge (a, [b, c]) -> [min (a, b), max (a, c)],
+ merge (a, b) -> [min (a, b), max (a, b)]. */
+
+static inline tree
+chrec_merge_intervals (tree chrec1,
+ tree chrec2)
+{
+ tree type1 = chrec_type (chrec1);
+ tree type2 = chrec_type (chrec2);
+ tree type = chrec_merge_types (type1, type2);
+
+ if (type == NULL_TREE)
+ return chrec_top;
+
+ if (TREE_CODE (chrec1) == INTERVAL_CHREC)
+ {
+ if (TREE_CODE (chrec2) == INTERVAL_CHREC)
+ return build_interval_chrec
+ (tree_fold_min (type, CHREC_LOW (chrec1), CHREC_LOW (chrec2)),
+ tree_fold_max (type, CHREC_UP (chrec1), CHREC_UP (chrec2)));
+ else
+ return build_interval_chrec
+ (tree_fold_min (type, CHREC_LOW (chrec1), chrec2),
+ tree_fold_max (type, CHREC_UP (chrec1), chrec2));
+ }
+ else if (TREE_CODE (chrec2) == INTERVAL_CHREC)
+ return build_interval_chrec
+ (tree_fold_min (type, CHREC_LOW (chrec2), chrec1),
+ tree_fold_max (type, CHREC_UP (chrec2), chrec1));
+ else
+ return build_interval_chrec
+ (tree_fold_min (type, chrec1, chrec2),
+ tree_fold_max (type, chrec1, chrec2));
+}
+
+/* Merges two evolution functions that were found by following two
+ alternate paths of a conditional expression. */
+
+tree
+chrec_merge (tree chrec1,
+ tree chrec2)
+{
+ if (chrec1 == chrec_top
+ || chrec2 == chrec_top)
+ return chrec_top;
+
+ if (chrec1 == chrec_bot
+ || chrec2 == chrec_bot)
+ return chrec_bot;
+
+ if (chrec1 == chrec_not_analyzed_yet)
+ return chrec2;
+ if (chrec2 == chrec_not_analyzed_yet)
+ return chrec1;
+
+ if (operand_equal_p (chrec1, chrec2, 0))
+ return chrec1;
+
+ switch (TREE_CODE (chrec1))
+ {
+ case INTEGER_CST:
+ case INTERVAL_CHREC:
+ switch (TREE_CODE (chrec2))
+ {
+ case INTEGER_CST:
+ case INTERVAL_CHREC:
+ return chrec_merge_intervals (chrec1, chrec2);
+
+ case POLYNOMIAL_CHREC:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec2),
+ chrec_merge (chrec1, CHREC_LEFT (chrec2)),
+ chrec_merge (integer_zero_node, CHREC_RIGHT (chrec2)));
+
+ case EXPONENTIAL_CHREC:
+ return build_exponential_chrec
+ (CHREC_VARIABLE (chrec2),
+ chrec_merge (chrec1, CHREC_LEFT (chrec2)),
+ chrec_merge (integer_one_node, CHREC_RIGHT (chrec2)));
+
+ default:
+ return chrec_top;
+ }
+
+ case POLYNOMIAL_CHREC:
+ switch (TREE_CODE (chrec2))
+ {
+ case INTEGER_CST:
+ case INTERVAL_CHREC:
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec1),
+ chrec_merge (CHREC_LEFT (chrec1), chrec2),
+ chrec_merge (CHREC_RIGHT (chrec1), integer_zero_node));
+
+ case POLYNOMIAL_CHREC:
+ if (CHREC_VARIABLE (chrec1) == CHREC_VARIABLE (chrec2))
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec2),
+ chrec_merge (CHREC_LEFT (chrec1), CHREC_LEFT (chrec2)),
+ chrec_merge (CHREC_RIGHT (chrec1), CHREC_RIGHT (chrec2)));
+ else if (CHREC_VARIABLE (chrec1) < CHREC_VARIABLE (chrec2))
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec2),
+ chrec_merge (chrec1, CHREC_LEFT (chrec2)),
+ chrec_merge (integer_zero_node, CHREC_RIGHT (chrec2)));
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec1),
+ chrec_merge (CHREC_LEFT (chrec1), chrec2),
+ chrec_merge (CHREC_RIGHT (chrec1), integer_zero_node));
+
+ case EXPONENTIAL_CHREC:
+ return chrec_top;
+
+ default:
+ return chrec_top;
+ }
+
+ case EXPONENTIAL_CHREC:
+ return chrec_top;
+
+ default:
+ return chrec_top;
+ }
+}
+
+
+
+/* Observers. */
+
+/* Helper function for is_multivariate_chrec. */
+
+static bool
+is_multivariate_chrec_rec (tree chrec, unsigned int rec_var)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC
+ || TREE_CODE (chrec) == EXPONENTIAL_CHREC)
+ {
+ if (CHREC_VARIABLE (chrec) != rec_var)
+ return true;
+ else
+ return (is_multivariate_chrec_rec (CHREC_LEFT (chrec), rec_var)
+ || is_multivariate_chrec_rec (CHREC_RIGHT (chrec), rec_var));
+ }
+ else
+ return false;
+}
+
+/* Determine whether the given chrec is multivariate or not. */
+
+bool
+is_multivariate_chrec (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC
+ || TREE_CODE (chrec) == EXPONENTIAL_CHREC)
+ return (is_multivariate_chrec_rec (CHREC_LEFT (chrec),
+ CHREC_VARIABLE (chrec))
+ || is_multivariate_chrec_rec (CHREC_RIGHT (chrec),
+ CHREC_VARIABLE (chrec)));
+ else
+ return false;
+}
+
+/* Determine whether the given chrec is a polynomial or not. */
+
+bool
+is_pure_sum_chrec (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return true;
+
+ if (TREE_CODE (chrec) == EXPONENTIAL_CHREC)
+ return false;
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
+ return (is_pure_sum_chrec (CHREC_LEFT (chrec))
+ && is_pure_sum_chrec (CHREC_RIGHT (chrec)));
+
+ return true;
+}
+
+/* Determines whether the chrec contains symbolic names or not. */
+
+bool
+chrec_contains_symbols (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (chrec) == SSA_NAME
+ || TREE_CODE (chrec) == VAR_DECL
+ || TREE_CODE (chrec) == PARM_DECL
+ || TREE_CODE (chrec) == FUNCTION_DECL
+ || TREE_CODE (chrec) == LABEL_DECL
+ || TREE_CODE (chrec) == RESULT_DECL
+ || TREE_CODE (chrec) == FIELD_DECL)
+ return true;
+
+ switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
+ {
+ case 3:
+ if (chrec_contains_symbols (TREE_OPERAND (chrec, 2)))
+ return true;
+
+ case 2:
+ if (chrec_contains_symbols (TREE_OPERAND (chrec, 1)))
+ return true;
+
+ case 1:
+ if (chrec_contains_symbols (TREE_OPERAND (chrec, 0)))
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Determines whether the chrec contains undetermined coefficients. */
+
+bool
+chrec_contains_undetermined (tree chrec)
+{
+ if (chrec == chrec_top
+ || chrec == chrec_not_analyzed_yet
+ || chrec == NULL_TREE)
+ return true;
+
+ switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
+ {
+ case 3:
+ if (chrec_contains_undetermined (TREE_OPERAND (chrec, 2)))
+ return true;
+
+ case 2:
+ if (chrec_contains_undetermined (TREE_OPERAND (chrec, 1)))
+ return true;
+
+ case 1:
+ if (chrec_contains_undetermined (TREE_OPERAND (chrec, 0)))
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Determines whether the chrec contains interval coefficients. */
+
+bool
+chrec_contains_intervals (tree chrec)
+{
+ if (chrec == NULL_TREE
+ || automatically_generated_chrec_p (chrec))
+ return false;
+
+ if (TREE_CODE (chrec) == INTERVAL_CHREC)
+ return true;
+
+ switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
+ {
+ case 3:
+ if (chrec_contains_intervals (TREE_OPERAND (chrec, 2)))
+ return true;
+
+ case 2:
+ if (chrec_contains_intervals (TREE_OPERAND (chrec, 1)))
+ return true;
+
+ case 1:
+ if (chrec_contains_intervals (TREE_OPERAND (chrec, 0)))
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Determines whether the tree EXPR contains chrecs. */
+
+bool
+tree_contains_chrecs (tree expr)
+{
+ if (expr == NULL_TREE)
+ return false;
+
+ if (tree_is_chrec (expr))
+ return true;
+
+ switch (TREE_CODE_LENGTH (TREE_CODE (expr)))
+ {
+ case 3:
+ if (tree_contains_chrecs (TREE_OPERAND (expr, 2)))
+ return true;
+
+ case 2:
+ if (tree_contains_chrecs (TREE_OPERAND (expr, 1)))
+ return true;
+
+ case 1:
+ if (tree_contains_chrecs (TREE_OPERAND (expr, 0)))
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Determine whether the given tree is an affine multivariate
+ evolution. */
+
+bool
+evolution_function_is_affine_multivariate_p (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ if (evolution_function_is_constant_p (CHREC_LEFT (chrec)))
+ {
+ if (evolution_function_is_constant_p (CHREC_RIGHT (chrec)))
+ return true;
+ else
+ {
+ if (CHREC_VARIABLE (CHREC_RIGHT (chrec))
+ != CHREC_VARIABLE (chrec)
+ && evolution_function_is_affine_multivariate_p
+ (CHREC_RIGHT (chrec)))
+ return true;
+ else
+ return false;
+ }
+ }
+ else
+ {
+ if (evolution_function_is_constant_p (CHREC_RIGHT (chrec))
+ && CHREC_VARIABLE (CHREC_LEFT (chrec)) != CHREC_VARIABLE (chrec)
+ && evolution_function_is_affine_multivariate_p
+ (CHREC_LEFT (chrec)))
+ return true;
+ else
+ return false;
+ }
+
+
+ case EXPONENTIAL_CHREC:
+ case INTERVAL_CHREC:
+ default:
+ return false;
+ }
+}
+
+/* Determine whether the given tree is a function in zero or one
+ variables. */
+
+bool
+evolution_function_is_univariate_p (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return true;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ case EXPONENTIAL_CHREC:
+ switch (TREE_CODE (CHREC_LEFT (chrec)))
+ {
+ case POLYNOMIAL_CHREC:
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) != CHREC_VARIABLE (CHREC_LEFT (chrec)))
+ return false;
+ if (!evolution_function_is_univariate_p (CHREC_LEFT (chrec)))
+ return false;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (TREE_CODE (CHREC_RIGHT (chrec)))
+ {
+ case POLYNOMIAL_CHREC:
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec) != CHREC_VARIABLE (CHREC_RIGHT (chrec)))
+ return false;
+ if (!evolution_function_is_univariate_p (CHREC_RIGHT (chrec)))
+ return false;
+ break;
+
+ default:
+ break;
+ }
+
+ default:
+ return true;
+ }
+}
+
+
+
+/* Convert the initial condition of chrec to type. */
+
+tree
+chrec_convert (tree type,
+ tree chrec)
+{
+ tree ct;
+
+ if (automatically_generated_chrec_p (chrec))
+ return chrec;
+
+ ct = chrec_type (chrec);
+ if (ct == type)
+ return chrec;
+
+ if (TYPE_PRECISION (ct) < TYPE_PRECISION (type))
+ return convert (type, chrec);
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ return build_polynomial_chrec (CHREC_VARIABLE (chrec),
+ chrec_convert (type,
+ CHREC_LEFT (chrec)),
+ chrec_convert (type,
+ CHREC_RIGHT (chrec)));
+
+ case EXPONENTIAL_CHREC:
+ return build_exponential_chrec (CHREC_VARIABLE (chrec),
+ chrec_convert (type,
+ CHREC_LEFT (chrec)),
+ chrec_convert (type,
+ CHREC_RIGHT (chrec)));
+
+ case PEELED_CHREC:
+ return build_peeled_chrec
+ (CHREC_VARIABLE (chrec),
+ chrec_convert (type, CHREC_LEFT (chrec)),
+ chrec_convert (type, CHREC_RIGHT (chrec)));
+
+ case INTERVAL_CHREC:
+ return build_interval_chrec
+ (chrec_convert (type, CHREC_LOW (chrec)),
+ chrec_convert (type, CHREC_UP (chrec)));
+
+ default:
+ return convert (type, chrec);
+ }
+}
+
+/* Returns the type of the chrec. */
+
+tree
+chrec_type (tree chrec)
+{
+ if (automatically_generated_chrec_p (chrec))
+ return NULL_TREE;
+
+ return TREE_TYPE (chrec);
+}
+
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
new file mode 100644
index 00000000000..e58c0640e5b
--- /dev/null
+++ b/gcc/tree-chrec.h
@@ -0,0 +1,352 @@
+/* Chains of recurrences.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_TREE_CHREC_H
+#define GCC_TREE_CHREC_H
+
+/* Accessors for the chains of recurrences. */
+#define CHREC_VAR(NODE) TREE_OPERAND (NODE, 0)
+#define CHREC_LEFT(NODE) TREE_OPERAND (NODE, 1)
+#define CHREC_RIGHT(NODE) TREE_OPERAND (NODE, 2)
+#define CHREC_VARIABLE(NODE) TREE_INT_CST_LOW (CHREC_VAR (NODE))
+#define CHREC_LOW(NODE) TREE_OPERAND (INTERVAL_CHREC_CHECK (NODE), 0)
+#define CHREC_UP(NODE) TREE_OPERAND (INTERVAL_CHREC_CHECK (NODE), 1)
+
+
+
+/* The following trees are unique elements. Thus the comparison of another
+ element to these elements should be done on the pointer to these trees,
+ and not on their value. */
+
+extern tree chrec_not_analyzed_yet;
+extern tree chrec_top;
+extern tree chrec_bot;
+
+static inline bool automatically_generated_chrec_p (tree);
+
+/* After having added an automatically generated element, please
+ include it in the following function. */
+
+static inline bool
+automatically_generated_chrec_p (tree chrec)
+{
+ return (chrec == chrec_not_analyzed_yet
+ || chrec == chrec_top
+ || chrec == chrec_bot);
+}
+
+/* The tree nodes aka. CHRECs. */
+
+static inline bool
+tree_is_chrec (tree expr)
+{
+ if (TREE_CODE (expr) == INTERVAL_CHREC
+ || TREE_CODE (expr) == POLYNOMIAL_CHREC
+ || TREE_CODE (expr) == EXPONENTIAL_CHREC
+ || TREE_CODE (expr) == PEELED_CHREC)
+ return true;
+ else
+ return false;
+}
+
+
+
+/* Constructors. */
+static inline tree build_interval_chrec (tree, tree);
+static inline tree build_polynomial_chrec (unsigned, tree, tree);
+static inline tree build_exponential_chrec (unsigned, tree, tree);
+static inline tree build_peeled_chrec (unsigned, tree, tree);
+
+/* Chrec folding functions. */
+extern tree chrec_fold_plus (tree, tree, tree);
+extern tree chrec_fold_minus (tree, tree, tree);
+extern tree chrec_fold_multiply (tree, tree, tree);
+extern tree chrec_convert (tree, tree);
+extern tree chrec_type (tree);
+
+/* Operations. */
+extern tree simplify_peeled_chrec (tree);
+extern tree chrec_apply (unsigned, tree, tree);
+extern tree chrec_replace_initial_condition (tree, tree);
+extern tree update_initial_condition_to_origin (tree);
+extern tree initial_condition (tree);
+extern tree evolution_part_in_loop_num (tree, unsigned);
+extern tree hide_evolution_in_other_loops_than_loop (tree, unsigned);
+extern tree hide_evolution_in_loop (tree, unsigned);
+extern tree reset_evolution_in_loop (unsigned, tree, tree);
+extern tree chrec_eval_next_init_cond (unsigned, tree);
+extern tree chrec_merge (tree, tree);
+extern tree chrec_fold_automatically_generated_operands (tree, tree);
+
+/* Observers. */
+extern bool is_multivariate_chrec (tree);
+extern bool is_pure_sum_chrec (tree);
+extern bool chrec_is_positive (tree, bool *);
+extern bool chrec_contains_symbols (tree);
+extern bool chrec_contains_symbols_defined_in_loop (tree, unsigned);
+extern bool chrec_contains_undetermined (tree);
+extern bool chrec_contains_intervals (tree);
+extern bool tree_contains_chrecs (tree);
+extern bool evolution_function_is_affine_multivariate_p (tree);
+extern bool evolution_function_is_univariate_p (tree);
+static inline bool is_chrec (tree);
+static inline bool chrec_zerop (tree);
+static inline bool symbolic_parameter_expr_p (tree);
+static inline bool evolution_function_is_constant_p (tree);
+static inline bool evolution_function_is_affine_p (tree);
+static inline bool chrec_should_remain_symbolic (tree);
+
+
+
+/* Constructors. */
+
+/* Build an interval. */
+
+static inline tree
+build_interval_chrec (tree low,
+ tree up)
+{
+ if (automatically_generated_chrec_p (low)
+ || automatically_generated_chrec_p (up))
+ return chrec_fold_automatically_generated_operands (low, up);
+
+ if (integer_zerop (tree_fold_minus (chrec_type (low), up, low)))
+ return low;
+ else
+ return build (INTERVAL_CHREC, TREE_TYPE (low), low, up);
+}
+
+/* Build a polynomial chain of recurrence. */
+
+static inline tree
+build_polynomial_chrec (unsigned loop_num,
+ tree left,
+ tree right)
+{
+ return build (POLYNOMIAL_CHREC, TREE_TYPE (left),
+ build_int_2 (loop_num, 0), left, right);
+}
+
+/* Build an exponential chain of recurrence. */
+
+static inline tree
+build_exponential_chrec (unsigned loop_num,
+ tree left,
+ tree right)
+{
+ return build (EXPONENTIAL_CHREC, TREE_TYPE (left),
+ build_int_2 (loop_num, 0), left, right);
+}
+
+/* Build a peeled chain of recurrence. */
+
+static inline tree
+build_peeled_chrec (unsigned loop_num,
+ tree left,
+ tree right)
+{
+ return build (PEELED_CHREC, TREE_TYPE (left),
+ build_int_2 (loop_num, 0), left, right);
+}
+
+
+
+/* Observers. */
+
+/* Determine whether the given tree is a chain of recurrence or not. */
+
+static inline bool
+is_chrec (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ case EXPONENTIAL_CHREC:
+ case INTERVAL_CHREC:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Determines whether CHREC is equal to zero. */
+
+static inline bool
+chrec_zerop (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (chrec) == INTEGER_CST)
+ return integer_zerop (chrec);
+
+ if (TREE_CODE (chrec) == INTERVAL_CHREC)
+ return (integer_zerop (CHREC_LOW (chrec))
+ && integer_zerop (CHREC_UP (chrec)));
+
+ return false;
+}
+
+/* Determines whether the expression CHREC is a symbolic parameter.
+ Be aware of the fact that the expression is supposed to be part of
+ an evolution function, and not an expression from the AST of the
+ program.
+
+ A symbolic parameter is matches the following pattern: "a variable
+ that does not have a loop-phi node", this variable is either a loop
+ invariant, or a secondary induction variable.
+*/
+
+static inline bool
+symbolic_parameter_expr_p (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (chrec) == VAR_DECL
+ || TREE_CODE (chrec) == PARM_DECL
+ || TREE_CODE (chrec) == SSA_NAME)
+ return true;
+
+ return false;
+}
+
+/* Determines whether the expression CHREC is a constant. */
+
+static inline bool
+evolution_function_is_constant_p (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ switch (TREE_CODE (chrec))
+ {
+ case INTEGER_CST:
+ case REAL_CST:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Determine whether the given tree is an affine evolution function or not. */
+
+static inline bool
+evolution_function_is_affine_p (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ if (evolution_function_is_constant_p (CHREC_LEFT (chrec))
+ && evolution_function_is_constant_p (CHREC_RIGHT (chrec)))
+ return true;
+ else
+ return false;
+
+ case EXPONENTIAL_CHREC:
+ case INTERVAL_CHREC:
+ default:
+ return false;
+ }
+}
+
+/* Determine whether the given tree is an affine or constant evolution
+ function. */
+
+static inline bool
+evolution_function_is_affine_or_constant_p (tree chrec)
+{
+ return evolution_function_is_affine_p (chrec)
+ || evolution_function_is_constant_p (chrec);
+}
+
+/* Determine whether the given tree is a multivariate evolution. */
+
+static inline bool
+evolution_function_is_multivariate (tree chrec)
+{
+ return !evolution_function_is_univariate_p (chrec);
+}
+
+/* Determine whether the given tree is an affine peeled chrec. */
+
+static inline bool
+evolution_function_is_peeled_affine_p (tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (chrec) == PEELED_CHREC)
+ return (evolution_function_is_affine_or_constant_p (CHREC_LEFT (chrec))
+ && evolution_function_is_affine_p (CHREC_RIGHT (chrec)));
+
+ return false;
+}
+
+/* Determines which expressions are simpler to be {handled | kept} in a
+ symbolic form. */
+
+static inline bool
+chrec_should_remain_symbolic (tree evfun)
+{
+ if (evfun == NULL_TREE
+ || evfun == chrec_top)
+ return true;
+
+ return false;
+}
+
+/* Determines whether EXPR does not contains chrec expressions. */
+
+static inline bool
+tree_does_not_contain_chrecs (tree expr)
+{
+ return !tree_contains_chrecs (expr);
+}
+
+/* Determines whether CHREC is a loop invariant with respect to LOOP_NUM.
+ Set the result in RES and return true when the property can be computed. */
+
+static inline bool
+no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res)
+{
+ tree scev;
+
+ if (chrec == chrec_not_analyzed_yet
+ || chrec == chrec_top
+ || chrec_contains_symbols_defined_in_loop (chrec, loop_num))
+ return false;
+
+ scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num);
+ *res = (TREE_CODE (scev) != POLYNOMIAL_CHREC
+ && TREE_CODE (scev) != EXPONENTIAL_CHREC);
+ return true;
+}
+
+#endif /* GCC_TREE_CHREC_H */
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
new file mode 100644
index 00000000000..7b83420c498
--- /dev/null
+++ b/gcc/tree-data-ref.c
@@ -0,0 +1,1740 @@
+/* Data references and dependences detectors.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* This pass walks the whole program searching for array references.
+ The array accesses are recorded in DATA_REFERENCE nodes. Since the
+ information in the DATA_REFERENCE nodes is too precise, the
+ dependence testers abstract this information into classic
+ representations: distance vectors, direction vectors, affine
+ dependence functions, ... Both the precise and more abstract
+ informations are then exposed to the other passes.
+
+ The basic test for determining the dependences is:
+ given two access functions chrec1 and chrec2 to a same array, and
+ x and y two vectors from the iteration domain, the same element of
+ the array is accessed twice at iterations x and y if and only if:
+ | chrec1 (x) == chrec2 (y).
+
+ The goals of this analysis are:
+
+ - to determine the independence: the relation between two
+ independent accesses is qualified with the chrec_bot (this
+ information allows a loop parallelization),
+
+ - when two data references access the same data, to qualify the
+ dependence relation with classic dependence representations:
+
+ - distance vectors
+ - direction vectors
+ - loop carried level dependence
+ - polyhedron dependence
+ or with the chains of recurrences based representation,
+
+
+ - to define a knowledge base for storing the data dependeces
+ information,
+
+ - to define an interface to access this data.
+
+
+ Definitions:
+
+ - What is a subscript? Given two array accesses a subscript is the
+ tuple composed of the access functions for a given dimension.
+ Example: Given A[f1][f2][f3] and B[g1][g2][g3], there are three
+ subscripts: (f1, g1), (f2, g2), (f3, g3).
+
+ - Vertical and horizontal couplings. In some of the comments of
+ this analysis, I refer to the overlapping elements of a subscript
+ as the vertical coupling, in opposition to the horizontal coupling
+ that refers to the coupling between subscripts.
+
+ References:
+
+ - "Advanced Compilation for High Performance Computing" by Randy Allen
+ and Ken Kennedy.
+
+ - "Loop Transformations for Restructuring Compilers - The Foundations"
+ by Utpal Banerjee.
+
+*/
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+
+/* These RTL headers are needed for basic-block.h. */
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "lambda.h"
+
+static void subscript_dependence_tester (struct data_dependence_relation *);
+
+static unsigned int data_ref_id = 0;
+
+
+
+/* Dump into FILE all the data references from DATAREFS. */
+
+void
+dump_data_references (FILE *file,
+ varray_type datarefs)
+{
+ unsigned int i;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
+ dump_data_reference (file, VARRAY_GENERIC_PTR (datarefs, i));
+}
+
+/* Dump into FILE all the dependence relations from DDR. */
+
+void
+dump_data_dependence_relations (FILE *file,
+ varray_type ddr)
+{
+ unsigned int i;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (ddr); i++)
+ dump_data_dependence_relation (file, VARRAY_GENERIC_PTR (ddr, i));
+}
+
+/* Dump function for a DATA_REFERENCE structure. */
+
+void
+dump_data_reference (FILE *outf,
+ struct data_reference *dr)
+{
+ unsigned int i;
+
+ fprintf (outf, "(Data Ref %d: \n stmt: ", DR_ID (dr));
+ print_generic_stmt (outf, DR_STMT (dr), 0);
+ fprintf (outf, " ref: ");
+ print_generic_stmt (outf, DR_REF (dr), 0);
+ fprintf (outf, " base_name: ");
+ print_generic_stmt (outf, DR_BASE_NAME (dr), 0);
+
+ for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
+ {
+ fprintf (outf, " Access function %d: ", i);
+ print_generic_stmt (outf, DR_ACCESS_FN (dr, i), 0);
+ }
+ fprintf (outf, ")\n");
+}
+
+/* Dump function for a DATA_DEPENDENCE_RELATION structure. */
+
+void
+dump_data_dependence_relation (FILE *outf,
+ struct data_dependence_relation *ddr)
+{
+ unsigned int i;
+ struct data_reference *dra, *drb;
+
+ dra = DDR_A (ddr);
+ drb = DDR_B (ddr);
+
+ fprintf (outf, "\n(Data Dep (A = %d, B = %d):", DR_ID (dra), DR_ID (drb));
+
+ if (DDR_ARE_DEPENDENT (ddr) == chrec_top)
+ fprintf (outf, " (don't know)\n");
+
+ else if (DDR_ARE_DEPENDENT (ddr) == chrec_bot)
+ fprintf (outf, " (no dependence)\n");
+
+ else
+ {
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
+ {
+ tree chrec;
+ struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
+
+ fprintf (outf, "\n (subscript %d:\n", i);
+ fprintf (outf, " access_fn_A: ");
+ print_generic_stmt (outf, DR_ACCESS_FN (dra, i), 0);
+ fprintf (outf, " access_fn_B: ");
+ print_generic_stmt (outf, DR_ACCESS_FN (drb, i), 0);
+
+ chrec = SUB_CONFLICTS_IN_A (subscript);
+ fprintf (outf, " iterations_that_access_an_element_twice_in_A: ");
+ print_generic_stmt (outf, chrec, 0);
+ if (chrec == chrec_bot)
+ fprintf (outf, " (no dependence)\n");
+ else if (chrec == chrec_top)
+ fprintf (outf, " (don't know)\n");
+ else
+ {
+ tree last_iteration = SUB_LAST_CONFLICT_IN_A (subscript);
+ fprintf (outf, " last_iteration_that_access_an_element_twice_in_A: ");
+ print_generic_stmt (outf, last_iteration, 0);
+ }
+
+ chrec = SUB_CONFLICTS_IN_B (subscript);
+ fprintf (outf, " iterations_that_access_an_element_twice_in_B: ");
+ print_generic_stmt (outf, chrec, 0);
+ if (chrec == chrec_bot)
+ fprintf (outf, " (no dependence)\n");
+ else if (chrec == chrec_top)
+ fprintf (outf, " (don't know)\n");
+ else
+ {
+ tree last_iteration = SUB_LAST_CONFLICT_IN_B (subscript);
+ fprintf (outf, " last_iteration_that_access_an_element_twice_in_B: ");
+ print_generic_stmt (outf, last_iteration, 0);
+ }
+
+ fprintf (outf, " )\n");
+ }
+
+ fprintf (outf, " (Distance Vector: \n");
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
+ {
+ struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
+
+ fprintf (outf, "(");
+ print_generic_stmt (outf, SUB_DISTANCE (subscript), 0);
+ fprintf (outf, ")\n");
+ }
+ fprintf (outf, " )\n");
+
+ fprintf (outf, " (Direction Vector: \n");
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
+ {
+ struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
+
+ fprintf (outf, "(");
+ dump_data_dependence_direction (outf, SUB_DIRECTION (subscript));
+ fprintf (outf, ")\n");
+ }
+ fprintf (outf, " )\n");
+ }
+
+ fprintf (outf, "\n)");
+}
+
+
+
+/* Dump function for a DATA_DEPENDENCE_DIRECTION structure. */
+
+void
+dump_data_dependence_direction (FILE *file,
+ enum data_dependence_direction dir)
+{
+ switch (dir)
+ {
+ case dir_positive:
+ fprintf (file, "+");
+ break;
+
+ case dir_negative:
+ fprintf (file, "-");
+ break;
+
+ case dir_equal:
+ fprintf (file, "=");
+ break;
+
+ case dir_positive_or_negative:
+ fprintf (file, "+-");
+ break;
+
+ case dir_positive_or_equal:
+ fprintf (file, "+=");
+ break;
+
+ case dir_negative_or_equal:
+ fprintf (file, "-=");
+ break;
+
+ case dir_star:
+ fprintf (file, "*");
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+/* Given an ARRAY_REF node REF, records its access functions.
+ Example: given A[i][3], record the opnd1 function, ie. the constant
+ "3", then recursively call the function on opnd0, ie. the ARRAY_REF
+ "A[i]". The function returns the base name: "A". */
+
+static tree
+analyze_array_indexes (struct loop *loop,
+ varray_type access_fns,
+ tree ref)
+{
+ tree opnd0, opnd1;
+ tree access_fn;
+
+ opnd0 = TREE_OPERAND (ref, 0);
+ opnd1 = TREE_OPERAND (ref, 1);
+
+ /* The detection of the evolution function for this data access is
+ postponed until the dependence test. This lazy strategy avoids
+ the computation of access functions that are of no interest for
+ the optimizers. */
+ access_fn = instantiate_parameters
+ (loop, analyze_scalar_evolution (loop, opnd1));
+
+ VARRAY_PUSH_TREE (access_fns, access_fn);
+
+ /* Recursively record other array access functions. */
+ if (TREE_CODE (opnd0) == ARRAY_REF)
+ return analyze_array_indexes (loop, access_fns, opnd0);
+
+ /* Return the base name of the data access. */
+ else
+ return opnd0;
+}
+
+/* For a data reference REF contained in the statemet STMT, initialize
+ a DATA_REFERENCE structure, and return it. */
+
+struct data_reference *
+analyze_array (tree stmt,
+ tree ref)
+{
+ struct data_reference *res;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(analyze_array \n");
+ fprintf (dump_file, " (ref = ");
+ print_generic_stmt (dump_file, ref, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ res = ggc_alloc (sizeof (struct data_reference));
+
+ DR_ID (res) = data_ref_id++;
+ DR_STMT (res) = stmt;
+ DR_REF (res) = ref;
+ VARRAY_TREE_INIT (DR_ACCESS_FNS (res), 5, "access_fns");
+ DR_BASE_NAME (res) = analyze_array_indexes
+ (loop_of_stmt (stmt), DR_ACCESS_FNS (res), ref);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+
+ return res;
+}
+
+
+
+/* When there exists a dependence relation, determine its distance
+ vector. */
+
+static void
+compute_distance_vector (struct data_dependence_relation *ddr)
+{
+ if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
+ {
+ unsigned int i;
+
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
+ {
+ tree conflicts_a, conflicts_b, difference;
+ struct subscript *subscript;
+
+ subscript = DDR_SUBSCRIPT (ddr, i);
+ conflicts_a = SUB_CONFLICTS_IN_A (subscript);
+ conflicts_b = SUB_CONFLICTS_IN_B (subscript);
+ difference = chrec_fold_minus
+ (integer_type_node, conflicts_b, conflicts_a);
+
+ if (evolution_function_is_constant_p (difference))
+ SUB_DISTANCE (subscript) = difference;
+
+ else
+ SUB_DISTANCE (subscript) = chrec_top;
+ }
+ }
+}
+
+/* When there exists a dependence relation, determine its direction
+ vector. */
+
+static void
+compute_direction_vector (struct data_dependence_relation *ddr)
+{
+ if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
+ {
+ unsigned int i;
+
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
+ {
+ tree distance;
+ struct subscript *subscript;
+ bool value;
+
+ subscript = DDR_SUBSCRIPT (ddr, i);
+ distance = SUB_DISTANCE (subscript);
+
+ if (distance == chrec_top)
+ SUB_DIRECTION (subscript) = dir_star;
+
+ else if (chrec_zerop (distance))
+ SUB_DIRECTION (subscript) = dir_equal;
+
+ else if (!chrec_is_positive (distance, &value))
+ SUB_DIRECTION (subscript) = dir_star;
+
+ else if (value == true)
+ SUB_DIRECTION (subscript) = dir_positive;
+
+ else
+ SUB_DIRECTION (subscript) = dir_negative;
+ }
+ }
+}
+
+/* Initialize a ddr. */
+
+static struct data_dependence_relation *
+initialize_data_dependence_relation (struct data_reference *a,
+ struct data_reference *b)
+{
+ struct data_dependence_relation *res;
+
+ res = ggc_alloc (sizeof (struct data_dependence_relation));
+ DDR_A (res) = a;
+ DDR_B (res) = b;
+
+ /* When the dimensions of A and B differ, we directly initialize
+ the relation to "there is no dependence": chrec_bot. */
+ if (DR_NUM_DIMENSIONS (a) != DR_NUM_DIMENSIONS (b)
+ || array_base_name_differ_p (a, b))
+ DDR_ARE_DEPENDENT (res) = chrec_bot;
+
+ else
+ {
+ unsigned int i;
+ DDR_ARE_DEPENDENT (res) = NULL_TREE;
+ DDR_SUBSCRIPTS_VECTOR_INIT (res, DR_NUM_DIMENSIONS (a));
+
+ for (i = 0; i < DR_NUM_DIMENSIONS (a); i++)
+ {
+ struct subscript *subscript;
+
+ subscript = ggc_alloc (sizeof (struct subscript));
+ SUB_CONFLICTS_IN_A (subscript) = chrec_top;
+ SUB_CONFLICTS_IN_B (subscript) = chrec_top;
+ SUB_LAST_CONFLICT_IN_A (subscript) = chrec_top;
+ SUB_LAST_CONFLICT_IN_B (subscript) = chrec_top;
+ SUB_DISTANCE (subscript) = chrec_top;
+ SUB_DIRECTION (subscript) = dir_star;
+ VARRAY_PUSH_GENERIC_PTR (DDR_SUBSCRIPTS (res), subscript);
+ }
+ }
+
+ return res;
+}
+
+
+
+/* This section contains the classic Banerjee. The functions are
+ represented by chains of recurrences. */
+
+/* This is the ZIV test. ZIV = Zero Index Variable, ie. both
+ functions do not depend on the iterations of a loop. */
+
+static inline bool
+ziv_subscript_p (tree chrec_a,
+ tree chrec_b)
+{
+ return (evolution_function_is_constant_p (chrec_a)
+ && evolution_function_is_constant_p (chrec_b));
+}
+
+/* Determines whether the subscript depends on the evolution of a
+ single loop or not. SIV = Single Index Variable. */
+
+static bool
+siv_subscript_p (tree chrec_a,
+ tree chrec_b)
+{
+ if ((evolution_function_is_constant_p (chrec_a)
+ && evolution_function_is_univariate_p (chrec_b))
+ || (evolution_function_is_constant_p (chrec_b)
+ && evolution_function_is_univariate_p (chrec_a)))
+ return true;
+
+ if (evolution_function_is_univariate_p (chrec_a)
+ && evolution_function_is_univariate_p (chrec_b))
+ {
+ switch (TREE_CODE (chrec_a))
+ {
+ case POLYNOMIAL_CHREC:
+ case EXPONENTIAL_CHREC:
+ switch (TREE_CODE (chrec_b))
+ {
+ case POLYNOMIAL_CHREC:
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec_a) != CHREC_VARIABLE (chrec_b))
+ return false;
+
+ default:
+ return true;
+ }
+
+ default:
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/* Analyze a ZIV (Zero Index Variable) subscript. */
+
+static void
+analyze_ziv_subscript (tree chrec_a,
+ tree chrec_b,
+ tree *overlaps_a,
+ tree *overlaps_b)
+{
+ tree difference;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(analyze_ziv_subscript \n");
+
+ difference = chrec_fold_minus (integer_type_node, chrec_a, chrec_b);
+
+ switch (TREE_CODE (difference))
+ {
+ case INTEGER_CST:
+ if (integer_zerop (difference))
+ {
+ /* The difference is equal to zero: the accessed index
+ overlaps for each iteration in the loop. */
+ *overlaps_a = integer_zero_node;
+ *overlaps_b = integer_zero_node;
+ }
+ else
+ {
+ /* The accesses do not overlap. */
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ }
+ break;
+
+ case INTERVAL_CHREC:
+ if (integer_zerop (CHREC_LOW (difference))
+ && integer_zerop (CHREC_UP (difference)))
+ {
+ /* The difference is equal to zero: the accessed index
+ overlaps for each iteration in the loop. */
+ *overlaps_a = integer_zero_node;
+ *overlaps_b = integer_zero_node;
+ }
+ else
+ {
+ /* There could be an overlap, conservative answer:
+ "don't know". */
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ }
+ break;
+
+ default:
+ /* We're not sure whether the indexes overlap. For the moment,
+ conservatively answer "don't know". */
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ break;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+}
+
+/* This is a part of the SIV subscript analyzer (Single Index
+ Variable). */
+
+static void
+analyze_siv_subscript_cst_affine (tree chrec_a,
+ tree chrec_b,
+ tree *overlaps_a,
+ tree *overlaps_b)
+{
+ bool value0, value1, value2;
+ tree difference = chrec_fold_minus
+ (integer_type_node, CHREC_LEFT (chrec_b), chrec_a);
+
+ if (!chrec_is_positive (initial_condition (difference), &value0))
+ {
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ return;
+ }
+ else
+ {
+ if (value0 == false)
+ {
+ if (!chrec_is_positive (CHREC_RIGHT (chrec_b), &value1))
+ {
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ return;
+ }
+ else
+ {
+ if (value1 == true)
+ {
+ /* Example:
+ chrec_a = 12
+ chrec_b = {10, +, 1}
+ */
+
+ if (tree_fold_divides_p
+ (integer_type_node, CHREC_RIGHT (chrec_b), difference))
+ {
+ *overlaps_a = integer_zero_node;
+ *overlaps_b = tree_fold_exact_div
+ (integer_type_node,
+ tree_fold_abs (integer_type_node, difference),
+ CHREC_RIGHT (chrec_b));
+ return;
+ }
+
+ /* When the step does not divides the difference, there are
+ no overlaps. */
+ else
+ {
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ return;
+ }
+ }
+
+ else
+ {
+ /* Example:
+ chrec_a = 12
+ chrec_b = {10, +, -1}
+
+ In this case, chrec_a will not overlap with chrec_b. */
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (!chrec_is_positive (CHREC_RIGHT (chrec_b), &value2))
+ {
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ return;
+ }
+ else
+ {
+ if (value2 == false)
+ {
+ /* Example:
+ chrec_a = 3
+ chrec_b = {10, +, -1}
+ */
+ if (tree_fold_divides_p
+ (integer_type_node, CHREC_RIGHT (chrec_b), difference))
+ {
+ *overlaps_a = integer_zero_node;
+ *overlaps_b = tree_fold_exact_div
+ (integer_type_node, difference, CHREC_RIGHT (chrec_b));
+ return;
+ }
+
+ /* When the step does not divides the difference, there
+ are no overlaps. */
+ else
+ {
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ return;
+ }
+ }
+ else
+ {
+ /* Example:
+ chrec_a = 3
+ chrec_b = {4, +, 1}
+
+ In this case, chrec_a will not overlap with chrec_b. */
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ return;
+ }
+ }
+ }
+ }
+}
+
+/* This is a part of the SIV subscript analyzer (Single Index
+ Variable). */
+
+static void
+analyze_siv_subscript_affine_cst (tree chrec_a,
+ tree chrec_b,
+ tree *overlaps_a,
+ tree *overlaps_b)
+{
+ analyze_siv_subscript_cst_affine (chrec_b, chrec_a, overlaps_b, overlaps_a);
+}
+
+/* Determines the overlapping elements due to accesses CHREC_A and
+ CHREC_B, that are affine functions. This is a part of the
+ subscript analyzer. */
+
+static void
+analyze_subscript_affine_affine (tree chrec_a,
+ tree chrec_b,
+ tree *overlaps_a,
+ tree *overlaps_b)
+{
+ tree left_a, left_b, right_a, right_b;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(analyze_subscript_affine_affine \n");
+
+ /* For determining the initial intersection, we have to solve a
+ Diophantine equation. This is the most time consuming part.
+
+ For answering to the question: "Is there a dependence?" we have
+ to prove that there exists a solution to the Diophantine
+ equation, and that the solution is in the iteration domain,
+ ie. the solution is positive or zero, and that the solution
+ happens before the upper bound loop.nb_iterations. Otherwise
+ there is no dependence. This function outputs a description of
+ the iterations that hold the intersections. */
+
+ left_a = CHREC_LEFT (chrec_a);
+ left_b = CHREC_LEFT (chrec_b);
+ right_a = CHREC_RIGHT (chrec_a);
+ right_b = CHREC_RIGHT (chrec_b);
+
+ if (chrec_zerop (chrec_fold_minus (integer_type_node, left_a, left_b)))
+ {
+ /* The first element accessed twice is on the first
+ iteration. */
+ *overlaps_a = build_polynomial_chrec
+ (CHREC_VARIABLE (chrec_b), integer_zero_node, integer_one_node);
+ *overlaps_b = build_polynomial_chrec
+ (CHREC_VARIABLE (chrec_a), integer_zero_node, integer_one_node);
+ }
+
+ else if (TREE_CODE (left_a) == INTEGER_CST
+ && TREE_CODE (left_b) == INTEGER_CST
+ && TREE_CODE (right_a) == INTEGER_CST
+ && TREE_CODE (right_b) == INTEGER_CST
+
+ /* Both functions should have the same evolution sign. */
+ && ((tree_int_cst_sgn (right_a) > 0
+ && tree_int_cst_sgn (right_b) > 0)
+ || (tree_int_cst_sgn (right_a) < 0
+ && tree_int_cst_sgn (right_b) < 0)))
+ {
+ /* Here we have to solve the Diophantine equation. Reference
+ book: "Loop Transformations for Restructuring Compilers - The
+ Foundations" by Utpal Banerjee, pages 59-80.
+
+ ALPHA * X0 = BETA * Y0 + GAMMA.
+
+ with:
+ ALPHA = RIGHT_A
+ BETA = RIGHT_B
+ GAMMA = LEFT_B - LEFT_A
+ CHREC_A = {LEFT_A, +, RIGHT_A}
+ CHREC_B = {LEFT_B, +, RIGHT_B}
+
+ The Diophantine equation has a solution if and only if gcd
+ (ALPHA, BETA) divides GAMMA. This is commonly known under
+ the name of the "gcd-test".
+ */
+ tree alpha, beta, gamma;
+ tree la, lb;
+ tree gcd_alpha_beta;
+ tree u11, u12, u21, u22;
+
+ /* Both alpha and beta have to be integer_type_node. The gcd
+ function does not work correctly otherwise. */
+ alpha = copy_node (right_a);
+ beta = copy_node (right_b);
+ la = copy_node (left_a);
+ lb = copy_node (left_b);
+ TREE_TYPE (alpha) = integer_type_node;
+ TREE_TYPE (beta) = integer_type_node;
+ TREE_TYPE (la) = integer_type_node;
+ TREE_TYPE (lb) = integer_type_node;
+
+ gamma = tree_fold_minus (integer_type_node, lb, la);
+
+ /* FIXME: Use lambda_*_Hermite for implementing Bezout. */
+ gcd_alpha_beta = tree_fold_bezout
+ (alpha,
+ tree_fold_multiply (integer_type_node, beta, integer_minus_one_node),
+ &u11, &u12,
+ &u21, &u22);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (alpha = ");
+ print_generic_expr (dump_file, alpha, 0);
+ fprintf (dump_file, ")\n (beta = ");
+ print_generic_expr (dump_file, beta, 0);
+ fprintf (dump_file, ")\n (gamma = ");
+ print_generic_expr (dump_file, gamma, 0);
+ fprintf (dump_file, ")\n (gcd_alpha_beta = ");
+ print_generic_expr (dump_file, gcd_alpha_beta, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ /* The classic "gcd-test". */
+ if (!tree_fold_divides_p (integer_type_node, gcd_alpha_beta, gamma))
+ {
+ /* The "gcd-test" has determined that there is no integer
+ solution, ie. there is no dependence. */
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ }
+
+ else
+ {
+ /* The solutions are given by:
+ |
+ | [GAMMA/GCD_ALPHA_BETA t].[u11 u12] = [X]
+ | [u21 u22] [Y]
+
+ For a given integer t. Using the following variables,
+
+ | i0 = u11 * gamma / gcd_alpha_beta
+ | j0 = u12 * gamma / gcd_alpha_beta
+ | i1 = u21
+ | j1 = u22
+
+ the solutions are:
+
+ | x = i0 + i1 * t,
+ | y = j0 + j1 * t. */
+
+ tree i0, j0, i1, j1, t;
+ tree gamma_gcd;
+
+ /* X0 and Y0 are the first iterations for which there is a
+ dependence. X0, Y0 are two solutions of the Diophantine
+ equation: chrec_a (X0) = chrec_b (Y0). */
+ tree x0, y0;
+
+ /* Exact div because in this case gcd_alpha_beta divides
+ gamma. */
+ gamma_gcd = tree_fold_exact_div
+ (integer_type_node, gamma, gcd_alpha_beta);
+ i0 = tree_fold_multiply (integer_type_node, u11, gamma_gcd);
+ j0 = tree_fold_multiply (integer_type_node, u12, gamma_gcd);
+ i1 = u21;
+ j1 = u22;
+
+ if ((tree_int_cst_sgn (i1) == 0
+ && tree_int_cst_sgn (i0) < 0)
+ || (tree_int_cst_sgn (j1) == 0
+ && tree_int_cst_sgn (j0) < 0))
+ {
+ /* There is no solution.
+ FIXME: The case "i0 > nb_iterations, j0 > nb_iterations"
+ falls in here, but for the moment we don't look at the
+ upper bound of the iteration domain. */
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ }
+
+ else
+ {
+ if (tree_int_cst_sgn (i1) > 0)
+ {
+ t = tree_fold_ceil_div
+ (integer_type_node,
+ tree_fold_multiply (integer_type_node, i0,
+ integer_minus_one_node),
+ i1);
+
+ if (tree_int_cst_sgn (j1) > 0)
+ {
+ t = tree_fold_max
+ (integer_type_node, t,
+ tree_fold_ceil_div (integer_type_node,
+ tree_fold_multiply
+ (integer_type_node, j0,
+ integer_minus_one_node),
+ j1));
+
+ x0 = tree_fold_plus
+ (integer_type_node, i0,
+ tree_fold_multiply (integer_type_node, i1, t));
+ y0 = tree_fold_plus
+ (integer_type_node, j0,
+ tree_fold_multiply (integer_type_node, j1, t));
+
+ *overlaps_a = build_polynomial_chrec
+ (CHREC_VARIABLE (chrec_b), x0, u21);
+ *overlaps_b = build_polynomial_chrec
+ (CHREC_VARIABLE (chrec_a), y0, u22);
+ }
+ else
+ {
+ /* FIXME: For the moment, the upper bound of the
+ iteration domain for j is not checked. */
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ }
+ }
+
+ else
+ {
+ /* FIXME: For the moment, the upper bound of the
+ iteration domain for i is not checked. */
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ }
+ }
+ }
+ }
+
+ else
+ {
+ /* For the moment, "don't know". */
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (overlaps_a = ");
+ print_generic_expr (dump_file, *overlaps_a, 0);
+ fprintf (dump_file, ")\n (overlaps_b = ");
+ print_generic_expr (dump_file, *overlaps_b, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+}
+
+/* Analyze single index variable subscript. Note that the dependence
+ testing is not commutative, and that's why both versions of
+ analyze_siv_subscript_x_y and analyze_siv_subscript_y_x are
+ implemented. */
+
+static void
+analyze_siv_subscript (tree chrec_a,
+ tree chrec_b,
+ tree *overlaps_a,
+ tree *overlaps_b)
+{
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(analyze_siv_subscript \n");
+
+ if (evolution_function_is_constant_p (chrec_a)
+ && evolution_function_is_affine_p (chrec_b))
+ analyze_siv_subscript_cst_affine (chrec_a, chrec_b,
+ overlaps_a, overlaps_b);
+
+ else if (evolution_function_is_affine_p (chrec_a)
+ && evolution_function_is_constant_p (chrec_b))
+ analyze_siv_subscript_affine_cst (chrec_a, chrec_b,
+ overlaps_a, overlaps_b);
+
+ else if (evolution_function_is_affine_p (chrec_a)
+ && evolution_function_is_affine_p (chrec_b)
+ && (CHREC_VARIABLE (chrec_a) == CHREC_VARIABLE (chrec_b)))
+ analyze_subscript_affine_affine (chrec_a, chrec_b,
+ overlaps_a, overlaps_b);
+ else
+ {
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+}
+
+/* Helper for determining whether the evolution steps of an affine
+ CHREC divide the constant CST. */
+
+static bool
+chrec_steps_divide_constant_p (tree chrec,
+ tree cst)
+{
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ return (tree_fold_divides_p (integer_type_node, CHREC_RIGHT (chrec), cst)
+ && chrec_steps_divide_constant_p (CHREC_LEFT (chrec), cst));
+
+ default:
+ /* On the initial condition, return true. */
+ return true;
+ }
+}
+
+/* This is the MIV subscript analyzer (Multiple Index Variable). */
+
+static void
+analyze_miv_subscript (tree chrec_a,
+ tree chrec_b,
+ tree *overlaps_a,
+ tree *overlaps_b)
+{
+ /* FIXME: This is a MIV subscript, not yet handled.
+ Example: (A[{1, +, 1}_1] vs. A[{1, +, 1}_2]) that comes from
+ (A[i] vs. A[j]).
+
+ In the SIV test we had to solve a Diophantine equation with two
+ variables. In the MIV case we have to solve a Diophantine
+ equation with 2*n variables (if the subscript uses n IVs).
+ */
+ tree difference;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(analyze_miv_subscript \n");
+
+ difference = chrec_fold_minus (integer_type_node, chrec_a, chrec_b);
+
+ if (chrec_zerop (difference))
+ {
+ /* Access functions are the same: all the elements are accessed
+ in the same order. */
+ *overlaps_a = integer_zero_node;
+ *overlaps_b = integer_zero_node;
+ }
+
+ else if (evolution_function_is_constant_p (difference)
+ /* For the moment, the following is verified:
+ evolution_function_is_affine_multivariate_p (chrec_a) */
+ && !chrec_steps_divide_constant_p (chrec_a, difference))
+ {
+ /* testsuite/.../ssa-chrec-33.c
+ {{21, +, 2}_1, +, -2}_2 vs. {{20, +, 2}_1, +, -2}_2
+
+ The difference is 1, and the evolution steps are equal to 2,
+ consequently there are no overlapping elements. */
+ *overlaps_a = chrec_bot;
+ *overlaps_b = chrec_bot;
+ }
+
+ else if (evolution_function_is_univariate_p (chrec_a)
+ && evolution_function_is_univariate_p (chrec_b))
+ {
+ /* testsuite/.../ssa-chrec-35.c
+ {0, +, 1}_2 vs. {0, +, 1}_3
+ the overlapping elements are respectively located at iterations:
+ {0, +, 1}_3 and {0, +, 1}_2.
+ */
+ if (evolution_function_is_affine_p (chrec_a)
+ && evolution_function_is_affine_p (chrec_b))
+ analyze_subscript_affine_affine (chrec_a, chrec_b,
+ overlaps_a, overlaps_b);
+ else
+ {
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ }
+ }
+
+ else
+ {
+ /* When the analysis is too difficult, answer "don't know". */
+ *overlaps_a = chrec_top;
+ *overlaps_b = chrec_top;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+}
+
+/* Determines the iterations for which CHREC_A is equal to CHREC_B.
+ OVERLAP_ITERATIONS_A and OVERLAP_ITERATIONS_B are two functions
+ that describe the iterations that contain conflicting elements.
+
+ Remark: For an integer k >= 0, the following equality is true:
+
+ CHREC_A (OVERLAP_ITERATIONS_A (k)) == CHREC_B (OVERLAP_ITERATIONS_B (k)).
+*/
+
+static void
+analyze_overlapping_iterations (tree chrec_a,
+ tree chrec_b,
+ tree *overlap_iterations_a,
+ tree *overlap_iterations_b)
+{
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(analyze_overlapping_iterations \n");
+ fprintf (dump_file, " (chrec_a = ");
+ print_generic_expr (dump_file, chrec_a, 0);
+ fprintf (dump_file, ")\n chrec_b = ");
+ print_generic_expr (dump_file, chrec_b, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ if (chrec_a == NULL_TREE
+ || chrec_b == NULL_TREE
+ || chrec_contains_undetermined (chrec_a)
+ || chrec_contains_undetermined (chrec_b)
+ || chrec_contains_symbols (chrec_a)
+ || chrec_contains_symbols (chrec_b)
+ || chrec_contains_intervals (chrec_a)
+ || chrec_contains_intervals (chrec_b))
+ {
+ *overlap_iterations_a = chrec_top;
+ *overlap_iterations_b = chrec_top;
+ }
+
+ else if (ziv_subscript_p (chrec_a, chrec_b))
+ analyze_ziv_subscript (chrec_a, chrec_b,
+ overlap_iterations_a, overlap_iterations_b);
+
+ else if (siv_subscript_p (chrec_a, chrec_b))
+ analyze_siv_subscript (chrec_a, chrec_b,
+ overlap_iterations_a, overlap_iterations_b);
+
+ else
+ analyze_miv_subscript (chrec_a, chrec_b,
+ overlap_iterations_a, overlap_iterations_b);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (overlap_iterations_a = ");
+ print_generic_expr (dump_file, *overlap_iterations_a, 0);
+ fprintf (dump_file, ")\n (overlap_iterations_b = ");
+ print_generic_expr (dump_file, *overlap_iterations_b, 0);
+ fprintf (dump_file, ")\n");
+ }
+}
+
+
+
+/* This section contains the affine functions dependences detector. */
+
+/* This is the subscript dependence tester (SubDT). It computes the
+ conflicting iterations. */
+
+static void
+subscript_dependence_tester (struct data_dependence_relation *ddr)
+{
+ unsigned int i;
+ struct data_reference *dra = DDR_A (ddr);
+ struct data_reference *drb = DDR_B (ddr);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(subscript_dependence_tester \n");
+
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
+ {
+ tree overlaps_a, overlaps_b;
+ struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
+
+ analyze_overlapping_iterations (DR_ACCESS_FN (dra, i),
+ DR_ACCESS_FN (drb, i),
+ &overlaps_a, &overlaps_b);
+
+ if (overlaps_a == chrec_top
+ || overlaps_b == chrec_top)
+ {
+ DDR_ARE_DEPENDENT (ddr) = chrec_top;
+ DDR_SUBSCRIPTS_VECTOR_FINALIZE (ddr);
+ break;
+ }
+
+ else if (overlaps_a == chrec_bot
+ || overlaps_b == chrec_bot)
+ {
+ DDR_ARE_DEPENDENT (ddr) = chrec_bot;
+ DDR_SUBSCRIPTS_VECTOR_FINALIZE (ddr);
+ break;
+ }
+
+ else
+ {
+ SUB_CONFLICTS_IN_A (subscript) = overlaps_a;
+ SUB_CONFLICTS_IN_B (subscript) = overlaps_b;
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+}
+
+/* Return value of a constant X.
+ Borrowed from tree-ssa-loop-ivopts.c
+ XXX: Move this into tree.c and remove from both files. */
+
+static HOST_WIDE_INT
+int_cst_value (tree x)
+{
+ unsigned bits = TYPE_PRECISION (TREE_TYPE (x));
+ unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x);
+ bool negative = ((val >> (bits - 1)) & 1) != 0;
+
+ if (negative)
+ val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1;
+ else
+ val &= ~((~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1);
+
+ return val;
+}
+
+/* Compute the classic per loop distance vector. */
+
+static void
+build_classic_dist_vector (struct data_dependence_relation *res,
+ varray_type *classic_dist,
+ unsigned nb_loops)
+{
+ unsigned i;
+ lambda_vector dist_v, init_v;
+
+ dist_v = lambda_vector_new (nb_loops);
+ init_v = lambda_vector_new (nb_loops);
+ lambda_vector_clear (dist_v, nb_loops);
+ lambda_vector_clear (init_v, nb_loops);
+
+ if (DDR_ARE_DEPENDENT (res) != NULL_TREE)
+ return;
+
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (res); i++)
+ {
+ struct subscript *subscript = DDR_SUBSCRIPT (res, i);
+
+ if (SUB_DISTANCE (subscript) == chrec_top)
+ return;
+
+ if (TREE_CODE (SUB_CONFLICTS_IN_A (subscript)) == POLYNOMIAL_CHREC)
+ {
+ int dist;
+ unsigned loop_nb;
+ loop_nb = CHREC_VARIABLE (SUB_CONFLICTS_IN_A (subscript));
+ dist = int_cst_value (SUB_DISTANCE (subscript));
+
+ /* This is the subscript coupling test.
+ | loop i = 0, N, 1
+ | T[i+1][i] = ...
+ | ... = T[i][i]
+ | endloop
+ There is no dependence. */
+ if (init_v[loop_nb] != 0
+ && dist_v[loop_nb] != dist)
+ {
+ DDR_ARE_DEPENDENT (res) = chrec_bot;
+ return;
+ }
+
+ dist_v[loop_nb] = dist;
+ init_v[loop_nb] = 1;
+ }
+ }
+
+ /* There is a distance of 1 on all the outer loops:
+
+ Example: there is a dependence of distance 1 on loop_1 for the array A.
+ | loop_1
+ | A[5] = ...
+ | endloop
+ */
+ {
+ struct loop *lca, *loop_a, *loop_b;
+ struct data_reference *a = DDR_A (res);
+ struct data_reference *b = DDR_B (res);
+
+ loop_a = loop_of_stmt (DR_STMT (a));
+ loop_b = loop_of_stmt (DR_STMT (b));
+
+ /* Get the common ancestor loop. */
+ lca = find_common_loop (loop_a, loop_b);
+
+ /* For each outer_loop where init_v is not set, the accesses are
+ in dependence of distance 1 in the loop. */
+ if (lca != loop_a
+ && lca != loop_b
+ && init_v[loop_num (lca)] == 0)
+ dist_v[loop_num (lca)] = 1;
+
+ lca = outer_loop (lca);
+ if (lca)
+ while (loop_depth (lca) != 0)
+ {
+ if (init_v[loop_num (lca)] == 0)
+ dist_v[loop_num (lca)] = 1;
+ lca = outer_loop (lca);
+ }
+ }
+
+ VARRAY_PUSH_GENERIC_PTR (*classic_dist, dist_v);
+}
+
+/* Compute the classic per loop direction vector. */
+
+static void
+build_classic_dir_vector (struct data_dependence_relation *res,
+ varray_type *classic_dir,
+ unsigned nb_loops)
+{
+ unsigned i;
+ lambda_vector dir_v, init_v;
+
+ dir_v = lambda_vector_new (nb_loops);
+ init_v = lambda_vector_new (nb_loops);
+ lambda_vector_clear (dir_v, nb_loops);
+ lambda_vector_clear (init_v, nb_loops);
+
+ if (DDR_ARE_DEPENDENT (res) != NULL_TREE)
+ return;
+
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (res); i++)
+ {
+ struct subscript *subscript = DDR_SUBSCRIPT (res, i);
+
+ if (TREE_CODE (SUB_CONFLICTS_IN_A (subscript)) == POLYNOMIAL_CHREC
+ && TREE_CODE (SUB_CONFLICTS_IN_B (subscript)) == POLYNOMIAL_CHREC)
+ {
+ unsigned loop_nb = CHREC_VARIABLE (SUB_CONFLICTS_IN_A (subscript));
+ enum data_dependence_direction dir = dir_star;
+
+ if (SUB_DISTANCE (subscript) == chrec_top)
+ {
+
+ }
+ else
+ {
+ int dist = int_cst_value (SUB_DISTANCE (subscript));
+
+ if (dist == 0)
+ dir = dir_equal;
+ else if (dist > 0)
+ dir = dir_positive;
+ else if (dist < 0)
+ dir = dir_negative;
+ }
+
+ /* This is the subscript coupling test.
+ | loop i = 0, N, 1
+ | T[i+1][i] = ...
+ | ... = T[i][i]
+ | endloop
+ There is no dependence. */
+ if (init_v[loop_nb] != 0
+ && (enum data_dependence_direction) dir_v[loop_nb] != dir)
+ {
+ DDR_ARE_DEPENDENT (res) = chrec_bot;
+ return;
+ }
+
+ dir_v[loop_nb] = dir;
+ init_v[loop_nb] = 1;
+ }
+ }
+
+ /* There is a distance of 1 on all the outer loops:
+
+ Example: there is a dependence of distance 1 on loop_1 for the array A.
+ | loop_1
+ | A[5] = ...
+ | endloop
+ */
+ {
+ struct loop *lca, *loop_a, *loop_b;
+ struct data_reference *a = DDR_A (res);
+ struct data_reference *b = DDR_B (res);
+
+ loop_a = loop_of_stmt (DR_STMT (a));
+ loop_b = loop_of_stmt (DR_STMT (b));
+
+ /* Get the common ancestor loop. */
+ lca = find_common_loop (loop_a, loop_b);
+
+ /* For each outer_loop where init_v is not set, the accesses are
+ in dependence of distance 1 in the loop. */
+ if (lca != loop_a
+ && lca != loop_b
+ && init_v[loop_num (lca)] == 0)
+ dir_v[loop_num (lca)] = dir_positive;
+
+ lca = outer_loop (lca);
+ if (lca)
+ while (loop_depth (lca) != 0)
+ {
+ if (init_v[loop_num (lca)] == 0)
+ dir_v[loop_num (lca)] = dir_positive;
+ lca = outer_loop (lca);
+ }
+ }
+
+ VARRAY_PUSH_GENERIC_PTR (*classic_dir, dir_v);
+}
+
+/* For all the subscripts, set the same value: CHREC. */
+
+static void
+set_all_subscripts_to (struct data_dependence_relation *ddr,
+ tree chrec)
+{
+ unsigned int i;
+
+ if (chrec == chrec_top
+ || chrec == chrec_bot)
+ {
+ DDR_ARE_DEPENDENT (ddr) = chrec;
+ DDR_SUBSCRIPTS_VECTOR_FINALIZE (ddr);
+ }
+
+ for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
+ {
+ struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
+ SUB_CONFLICTS_IN_A (subscript) = chrec;
+ SUB_CONFLICTS_IN_B (subscript) = chrec;
+ }
+}
+
+/* Determine whether the access functions are affine functions, in
+ which case the dependence tester can be runned. */
+
+static bool
+access_functions_are_affine_or_constant_p (struct data_reference *a)
+{
+ unsigned int i;
+ varray_type fns = DR_ACCESS_FNS (a);
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (fns); i++)
+ if (!evolution_function_is_constant_p (VARRAY_TREE (fns, i))
+ && !evolution_function_is_affine_multivariate_p (VARRAY_TREE (fns, i)))
+ return false;
+
+ return true;
+}
+
+/* This computes the affine dependence relation between A and B.
+ CHREC_BOT is used for representing the independence between two
+ accesses, while CHREC_TOP is used for representing the unknown
+ relation.
+
+ Note that it is possible to stop the computation of the dependence
+ relation the first time we detect a CHREC_BOT element for a given
+ subscript. */
+
+static void
+compute_affine_dependence (struct data_dependence_relation *ddr)
+{
+ struct data_reference *dra = DDR_A (ddr);
+ struct data_reference *drb = DDR_B (ddr);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(compute_affine_dependence (%d, %d)\n",
+ DR_ID (dra), DR_ID (drb));
+ fprintf (dump_file, " (stmt_a = \n");
+ print_generic_expr (dump_file, DR_STMT (dra), 0);
+ fprintf (dump_file, ")\n (stmt_b = \n");
+ print_generic_expr (dump_file, DR_STMT (drb), 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ /* Analyze only when the dependence relation is not yet known. */
+ if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
+ {
+ if (access_functions_are_affine_or_constant_p (dra)
+ && access_functions_are_affine_or_constant_p (drb))
+ subscript_dependence_tester (ddr);
+
+ /* As a last case, if the dependence cannot be determined, or if
+ the dependence is considered too difficult to determine, answer
+ "don't know". */
+ else
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "I'm not smart enough for this dependence test,"
+ "please teach me what I should answer. \n");
+
+ set_all_subscripts_to (ddr, chrec_top);
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+}
+
+/* Compute all the data dependence relations. */
+
+static void
+compute_all_dependences (varray_type datarefs,
+ varray_type *dependence_relations)
+{
+ unsigned int i, j;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
+ for (j = 0; j < VARRAY_ACTIVE_SIZE (datarefs); j++)
+ {
+ struct data_reference *a, *b;
+ struct data_dependence_relation *ddr;
+
+ a = VARRAY_GENERIC_PTR (datarefs, i);
+ b = VARRAY_GENERIC_PTR (datarefs, j);
+ ddr = initialize_data_dependence_relation (a, b);
+
+ VARRAY_PUSH_GENERIC_PTR (*dependence_relations, ddr);
+ compute_affine_dependence (ddr);
+ compute_distance_vector (ddr);
+ compute_direction_vector (ddr);
+ }
+}
+
+/* Search the data references in LOOP, and record the information into
+ DATAREFS.
+
+ FIXME: This is a "dumb" walker over all the trees in the loop body.
+ Find another technique that avoids this costly walk. This is
+ acceptable for the moment, since this function is used only for
+ debugging purposes. */
+
+static void
+find_data_references_in_loop (struct loop *loop, varray_type *datarefs)
+{
+ basic_block bb;
+ block_stmt_iterator bsi;
+
+ FOR_EACH_BB (bb)
+ {
+ if (!flow_bb_inside_loop_p (loop, bb))
+ continue;
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ tree expr = bsi_stmt (bsi);
+ vdef_optype vdefs = VDEF_OPS (stmt_ann (expr));
+ vuse_optype vuses = VUSE_OPS (stmt_ann (expr));
+
+ if (vuses || vdefs)
+ switch (TREE_CODE (expr))
+ {
+ case MODIFY_EXPR:
+ /* In the GIMPLE representation, the left-hand side of
+ a modify expression is either an ARRAY_REF or
+ otherwise it does not contain other ARRAY_REFs. */
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ARRAY_REF)
+ VARRAY_PUSH_GENERIC_PTR
+ (*datarefs, analyze_array (expr, TREE_OPERAND (expr, 0)));
+
+ if (TREE_CODE (TREE_OPERAND (expr, 1)) == ARRAY_REF)
+ VARRAY_PUSH_GENERIC_PTR
+ (*datarefs, analyze_array (expr, TREE_OPERAND (expr, 1)));
+
+ break;
+
+ case COND_EXPR:
+ case CALL_EXPR:
+ case VA_ARG_EXPR:
+ case ASM_EXPR:
+ case RETURN_EXPR:
+ /* In the GIMPLE representation, these nodes do not
+ contain ARRAY_REFs in their operands. */
+ break;
+
+ default:
+ debug_tree (expr);
+ /* abort (); */
+ fprintf (dump_file, "Find ARRAY_REFs: abort.\n");
+ break;
+ }
+ }
+ }
+}
+
+
+
+/* This section contains all the entry points. */
+
+/* Yet another entry point. "Give me a loop nest, I will return you a
+ set of distance/direction vectors." */
+
+void
+compute_data_dependences_for_loop (unsigned nb_loops,
+ struct loop *loop,
+ varray_type *datarefs,
+ varray_type *dependence_relations,
+ varray_type *classic_dist,
+ varray_type *classic_dir)
+{
+ unsigned int i;
+
+ find_data_references_in_loop (loop, datarefs);
+ compute_all_dependences (*datarefs, dependence_relations);
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (*dependence_relations); i++)
+ {
+ struct data_dependence_relation *ddr;
+ ddr = VARRAY_GENERIC_PTR (*dependence_relations, i);
+ build_classic_dist_vector (ddr, classic_dist, nb_loops);
+ build_classic_dir_vector (ddr, classic_dir, nb_loops);
+ }
+}
+
+/* Entry point. Analyze all the data references and the dependence
+ relations.
+
+ The data references are computed first.
+
+ A relation on these nodes is represented by a complete graph. Some
+ of the relations could be of no interest, thus the relations can be
+ computed on demand.
+
+ In the following function we compute all the relations. This is
+ just a first implementation that is here for:
+ - for showing how to ask for the dependence relations,
+ - for the debugging the whole dependence graph,
+ - for the dejagnu testcases and maintenance.
+
+ It is possible to ask only for a part of the graph, avoiding to
+ compute the whole dependence graph. The computed dependences are
+ stored in a knowledge base (KB) such that later queries don't
+ recompute the same information. The implementation of this KB is
+ transparent to the optimizer, and thus the KB can be changed with a
+ more efficient implementation, or the KB could be disabled. */
+
+void
+analyze_all_data_dependences (struct loops *loops)
+{
+ unsigned int i;
+ varray_type datarefs;
+ varray_type dependence_relations;
+ varray_type classic_dist, classic_dir;
+ int nb_data_refs = 10;
+
+#if 0
+ dump_file = stderr;
+ dump_flags = 31;
+#endif
+
+ VARRAY_GENERIC_PTR_INIT (classic_dist, 10, "classic_dist");
+ VARRAY_GENERIC_PTR_INIT (classic_dir, 10, "classic_dir");
+ VARRAY_GENERIC_PTR_INIT (datarefs, nb_data_refs, "datarefs");
+ VARRAY_GENERIC_PTR_INIT (dependence_relations,
+ nb_data_refs * nb_data_refs,
+ "dependence_relations");
+
+ /* Compute DDs on the whole function. */
+ compute_data_dependences_for_loop (loops->num, loop_from_num (loops, 0),
+ &datarefs, &dependence_relations,
+ &classic_dist, &classic_dir);
+
+ if (dump_file)
+ {
+ dump_data_dependence_relations (dump_file, dependence_relations);
+ fprintf (dump_file, "\n\n");
+ }
+
+ /* Don't dump distances in order to avoid to update the
+ testsuite. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (classic_dist); i++)
+ {
+ fprintf (dump_file, "DISTANCE_V (");
+ print_lambda_vector (dump_file,
+ VARRAY_GENERIC_PTR (classic_dist, i),
+ loops->num);
+ fprintf (dump_file, ")\n");
+ }
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (classic_dir); i++)
+ {
+ fprintf (dump_file, "DIRECTION_V (");
+ print_lambda_vector (dump_file,
+ VARRAY_GENERIC_PTR (classic_dir, i),
+ loops->num);
+ fprintf (dump_file, ")\n");
+ }
+ fprintf (dump_file, "\n\n");
+ }
+
+ if (dump_file && (dump_flags & TDF_STATS))
+ {
+ unsigned nb_top_relations = 0;
+ unsigned nb_bot_relations = 0;
+ unsigned nb_basename_differ = 0;
+ unsigned nb_chrec_relations = 0;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
+ {
+ struct data_dependence_relation *ddr;
+ ddr = VARRAY_GENERIC_PTR (dependence_relations, i);
+
+ if (DDR_ARE_DEPENDENT (ddr) == chrec_top)
+ nb_top_relations++;
+
+ else if (DDR_ARE_DEPENDENT (ddr) == chrec_bot)
+ {
+ struct data_reference *a = DDR_A (ddr);
+ struct data_reference *b = DDR_B (ddr);
+
+ if (DR_NUM_DIMENSIONS (a) != DR_NUM_DIMENSIONS (b)
+ || array_base_name_differ_p (a, b))
+ nb_basename_differ++;
+ else
+ nb_bot_relations++;
+ }
+
+ else
+ nb_chrec_relations++;
+ }
+
+ fprintf (dump_file, "\n(\n");
+ fprintf (dump_file, "%d\tnb_top_relations\n", nb_top_relations);
+ fprintf (dump_file, "%d\tnb_bot_relations\n", nb_bot_relations);
+ fprintf (dump_file, "%d\tnb_basename_differ\n", nb_basename_differ);
+ fprintf (dump_file, "%d\tnb_distance_relations\n", (int) VARRAY_ACTIVE_SIZE (classic_dist));
+ fprintf (dump_file, "%d\tnb_chrec_relations\n", nb_chrec_relations);
+ fprintf (dump_file, "\n)\n");
+
+ gather_stats_on_scev_database ();
+ }
+
+ varray_clear (dependence_relations);
+ varray_clear (datarefs);
+ varray_clear (classic_dist);
+ varray_clear (classic_dir);
+}
+
+
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
new file mode 100644
index 00000000000..500246d139b
--- /dev/null
+++ b/gcc/tree-data-ref.h
@@ -0,0 +1,184 @@
+/* Data references and dependences detectors.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_TREE_DATA_REF_H
+#define GCC_TREE_DATA_REF_H
+
+struct data_reference GTY(())
+{
+ /* An identifier. */
+ unsigned int id;
+
+ /* A pointer to the statement that contains this DR. */
+ tree stmt;
+
+ /* A pointer to the ARRAY_REF node. */
+ tree ref;
+
+ /* The name of the array. */
+ tree base_name;
+
+ /* A list of chrecs. */
+ varray_type access_fns;
+
+ /* Auxiliary info specific to a pass. */
+ int aux;
+};
+
+#define DR_ID(DR) DR->id
+#define DR_STMT(DR) DR->stmt
+#define DR_REF(DR) DR->ref
+#define DR_BASE_NAME(DR) DR->base_name
+#define DR_ACCESS_FNS(DR) DR->access_fns
+#define DR_ACCESS_FN(DR, I) VARRAY_TREE (DR_ACCESS_FNS (DR), I)
+#define DR_NUM_DIMENSIONS(DR) VARRAY_ACTIVE_SIZE (DR_ACCESS_FNS (DR))
+
+enum data_dependence_direction {
+ dir_positive,
+ dir_negative,
+ dir_equal,
+ dir_positive_or_negative,
+ dir_positive_or_equal,
+ dir_negative_or_equal,
+ dir_star,
+ dir_independent
+};
+
+/* What is a subscript? Given two array accesses a subscript is the
+ tuple composed of the access functions for a given dimension.
+ Example: Given A[f1][f2][f3] and B[g1][g2][g3], there are three
+ subscripts: (f1, g1), (f2, g2), (f3, g3). These three subscripts
+ are stored in the data_dependence_relation structure under the form
+ of an array of subscripts. */
+
+struct subscript GTY(())
+{
+ /* A description of the iterations for which the elements are
+ accessed twice. */
+ tree conflicting_iterations_in_a;
+ tree conflicting_iterations_in_b;
+
+ /* These fields store the information about the iteration domain
+ validity of the dependence relation. */
+ tree last_conflict_in_a;
+ tree last_conflict_in_b;
+
+ /* Distance from the iteration that access a conflicting element in
+ A to the iteration that access this same conflicting element in
+ B. The distance is a tree scalar expression, ie. a constant or a
+ symbolic expression, but certainly not a chrec function. */
+ tree distance;
+
+ /* Direction (or sign) of the distance. This more abstract (less
+ precise) information is extracted from the distance field, for
+ the convenience of some analyzers. */
+ enum data_dependence_direction direction;
+};
+
+#define SUB_CONFLICTS_IN_A(SUB) SUB->conflicting_iterations_in_a
+#define SUB_CONFLICTS_IN_B(SUB) SUB->conflicting_iterations_in_b
+#define SUB_LAST_CONFLICT_IN_A(SUB) SUB->last_conflict_in_a
+#define SUB_LAST_CONFLICT_IN_B(SUB) SUB->last_conflict_in_b
+#define SUB_DISTANCE(SUB) SUB->distance
+#define SUB_DIRECTION(SUB) SUB->direction
+
+/* A data_dependence_relation represents a relation between two
+ data_references A and B. */
+
+struct data_dependence_relation GTY(())
+{
+
+ struct data_reference *a;
+ struct data_reference *b;
+
+ /* A "yes/no/maybe" field for the dependence relation:
+
+ - when "ARE_DEPENDENT == NULL_TREE", there exist a dependence
+ relation between A and B, and the description of this relation
+ is given in the SUBSCRIPTS array,
+
+ - when "ARE_DEPENDENT == CHREC_BOT", there is no dependence and
+ SUBSCRIPTS is empty,
+
+ - when "ARE_DEPENDENT == CHREC_TOP", there may be a dependence,
+ but the analyzer cannot be more specific. */
+ tree are_dependent;
+
+ /* For each subscript in the dependence test, there is an element in
+ this array. This is the attribute that labels the edge A->B of
+ the data_dependence_relation. */
+ varray_type subscripts;
+};
+
+#define DDR_A(DDR) DDR->a
+#define DDR_B(DDR) DDR->b
+#define DDR_ARE_DEPENDENT(DDR) DDR->are_dependent
+#define DDR_SUBSCRIPTS(DDR) DDR->subscripts
+#define DDR_SUBSCRIPTS_VECTOR_INIT(DDR, N) \
+ VARRAY_GENERIC_PTR_INIT (DDR_SUBSCRIPTS (DDR), N, "subscripts_vector");
+#define DDR_SUBSCRIPTS_VECTOR_FINALIZE(DDR) varray_clear (DDR_SUBSCRIPTS (DDR))
+#define DDR_SUBSCRIPT(DDR, I) VARRAY_GENERIC_PTR (DDR_SUBSCRIPTS (DDR), I)
+#define DDR_NUM_SUBSCRIPTS(DDR) VARRAY_ACTIVE_SIZE (DDR_SUBSCRIPTS (DDR))
+
+
+
+extern void analyze_all_data_dependences (struct loops *);
+extern void compute_data_dependences_for_loop (unsigned, struct loop *,
+ varray_type *, varray_type *,
+ varray_type *, varray_type *);
+extern struct data_reference *analyze_array (tree, tree);
+
+
+extern void dump_data_reference (FILE *, struct data_reference *);
+extern void dump_data_references (FILE *, varray_type);
+extern void dump_data_dependence_relation (FILE *,
+ struct data_dependence_relation *);
+extern void dump_data_dependence_relations (FILE *, varray_type);
+extern void dump_data_dependence_direction (FILE *,
+ enum data_dependence_direction);
+
+
+
+/* Inline functions. */
+
+static inline bool array_base_name_differ_p (struct data_reference *, struct data_reference *);
+
+
+/* This is the simplest data dependence test: determines whether the
+ data references A and B access the same array. */
+
+static inline bool
+array_base_name_differ_p (struct data_reference *a,
+ struct data_reference *b)
+{
+ if (DR_BASE_NAME (a) == DR_BASE_NAME (b))
+ return false;
+
+ if (TREE_CODE (DR_BASE_NAME (a)) == INDIRECT_REF
+ && TREE_CODE (DR_BASE_NAME (b)) == INDIRECT_REF
+ && TREE_OPERAND (DR_BASE_NAME (a), 0)
+ == TREE_OPERAND (DR_BASE_NAME (b), 0))
+ return false;
+
+ return true;
+}
+
+#endif /* GCC_TREE_DATA_REF_H */
diff --git a/gcc/tree-dg.c b/gcc/tree-dg.c
new file mode 100644
index 00000000000..fee51bd5bf5
--- /dev/null
+++ b/gcc/tree-dg.c
@@ -0,0 +1,583 @@
+/* Dependence Graph
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Devang Patel <dpatel@apple.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* This pass build data dependence graph based on the information
+ collected by scalar evolution analyzer.
+
+ A short description of data dependence graph:
+
+ Each node in the graph represents one GIMPLE statement.
+
+ Nodes are connected using dependence edge that describes data
+ dependence relation between two nodes. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "flags.h"
+#include "timevar.h"
+#include "varray.h"
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "cfgloop.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "tree-dg.h"
+
+/* local function prototypes */
+static void dg_init_graph (void);
+static void set_dg_node_for_stmt (tree, dependence_node);
+static dependence_node dg_get_node_for_stmt (tree, bool);
+static dependence_node alloc_dependence_node (void);
+static dependence_edge alloc_dependence_edge (void);
+static dependence_node dg_create_node (tree);
+static dependence_edge dg_find_edge (dependence_node, dependence_node, bool);
+static void dump_dg (FILE *, int);
+static void dg_delete_edges (void);
+static void dg_delete_node (dependence_node);
+static struct data_dependence_relation * find_ddr_between_stmts (tree, tree);
+
+/* Initial dependence graph capacity. */
+static int dependence_graph_size = 25;
+
+/* The dependence graph. */
+static GTY (()) varray_type dependence_graph;
+static GTY (()) varray_type datarefs;
+static GTY (()) varray_type dependence_relations;
+static GTY (()) varray_type classic_dist;
+static GTY (()) varray_type classic_dir;
+
+/* Total dependence node count. */
+static int n_dependence_node = 0;
+
+#define DEPENDENCE_GRAPH(N) (VARRAY_DG (dependence_graph, (N)))
+
+/* Initialize data dependence graph. */
+static
+void dg_init_graph (void)
+{
+ VARRAY_DG_INIT (dependence_graph, dependence_graph_size, "dependence_graph");
+}
+
+/* Create dependency graph. */
+void dg_create_graph (struct loops *loops)
+{
+ unsigned int i;
+
+ VARRAY_GENERIC_PTR_INIT (classic_dist, 10, "classic_dist");
+ VARRAY_GENERIC_PTR_INIT (classic_dir, 10, "classic_dir");
+ VARRAY_GENERIC_PTR_INIT (datarefs, 10, "datarefs");
+ VARRAY_GENERIC_PTR_INIT (dependence_relations, 10 * 10,
+ "dependence_relations");
+
+ /* Analyze data references and dependence relations using scev. */
+
+ compute_data_dependences_for_loop (loops->num, loop_from_num (loops, 0),
+ &datarefs, &dependence_relations,
+ &classic_dist, &classic_dir);
+
+ /* Initialize. */
+ dg_init_graph ();
+
+ /* Using data refernces, populate graph. */
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
+ {
+ dependence_edge connecting_edge;
+
+ struct data_reference *first_dr, *second_dr;
+ struct data_dependence_relation *ddr;
+ tree first_stmt, second_stmt;
+
+ ddr = VARRAY_GENERIC_PTR (dependence_relations, i);
+
+ /* If there is no dependence than do not create an edge. */
+ if (DDR_ARE_DEPENDENT (ddr) == chrec_bot)
+ continue;
+
+ /* Get dependence references */
+ first_dr = DDR_A (ddr);
+ second_dr = DDR_B (ddr);
+
+ /* Get statements */
+ first_stmt = DR_STMT (first_dr);
+ second_stmt = DR_STMT(second_dr);
+
+ /* Find connecting edge. */
+ connecting_edge = dg_find_edge (dg_get_node_for_stmt (first_stmt, true),
+ dg_get_node_for_stmt (second_stmt, true),
+ true);
+
+ /* Record data dependence relation. */
+ connecting_edge->ddr = ddr;
+ }
+
+ if (dump_file)
+ {
+ dump_dg (dump_file, dump_flags);
+ }
+}
+
+/* Delete data dependence graph. */
+void
+dg_delete_graph (void)
+{
+ if (dependence_graph)
+ {
+
+ /* Delete all edges. */
+ dg_delete_edges ();
+
+ /* Reset node count. */
+ n_dependence_node = 0;
+
+ /* Clear data reference and dependence relations. */
+ if (datarefs)
+ VARRAY_CLEAR (datarefs);
+
+ if (dependence_relations)
+ VARRAY_CLEAR (dependence_relations);
+
+ if (classic_dir)
+ VARRAY_CLEAR (classic_dir);
+
+ if (classic_dist)
+ VARRAY_CLEAR (classic_dist);
+
+ /* Clear dependence graph itself. */
+ VARRAY_CLEAR (dependence_graph);
+
+ datarefs = NULL;
+ dependence_relations = NULL;
+ dependence_graph = NULL;
+ }
+
+}
+
+
+/*---------------------------------------------------------------------------
+ Dependence node
+---------------------------------------------------------------------------*/
+
+/* Allocate memory for dependence_node. */
+
+static dependence_node
+alloc_dependence_node (void)
+{
+ dependence_node dg_node;
+ dg_node = ggc_alloc_cleared (sizeof (*dg_node));
+ return dg_node;
+}
+
+/* Create new dependency_node. */
+
+static dependence_node
+dg_create_node (tree stmt)
+{
+ dependence_node dg_node;
+ if (!stmt)
+ return NULL;
+
+ /* Allocate */
+ dg_node = alloc_dependence_node ();
+
+ /* Assign id. */
+ dg_node->node_id = n_dependence_node;
+
+ VARRAY_PUSH_DG (dependence_graph, dg_node);
+
+ /* Increment count. */
+ n_dependence_node++;
+
+ /* Connect dg_node and stmt with each other. */
+ dg_node->stmt = stmt;
+ set_dg_node_for_stmt (stmt, dg_node);
+
+ return dg_node;
+}
+
+/* Delete dependence node. */
+static void
+dg_delete_node (dependence_node node)
+{
+ stmt_ann_t ann = stmt_ann (node->stmt);
+
+#ifdef ENABLE_CHECKING
+ /* If node has live edges, then it is a problem. */
+ if (node->succ || node->pred)
+ abort ();
+#endif
+
+ /* Clear dg_node entry in stmt_ann */
+ if (ann)
+ ann->dg_node = NULL;
+
+ /* Delete node. */
+ node = NULL;
+}
+
+/*---------------------------------------------------------------------------
+ Dependence edge
+---------------------------------------------------------------------------*/
+
+/* Allocate memory for dependence_edge. */
+
+static dependence_edge
+alloc_dependence_edge (void)
+{
+ dependence_edge dg_edge;
+ dg_edge = ggc_alloc_cleared (sizeof (*dg_edge));
+ return dg_edge;
+}
+
+/* Find edge in the dependence graph that connects two nodes.
+ If required, create new edge. */
+
+static dependence_edge
+dg_find_edge (dependence_node n1, dependence_node n2, bool create)
+{
+ tree stmt1, stmt2;
+ dependence_edge e;
+
+ if (!n1 || !n2)
+ abort ();
+
+ stmt1 = DN_STMT (n1);
+ stmt2 = DN_STMT (n2);
+
+ if (!stmt1 || !stmt2)
+ abort ();
+
+ /* Browse succ edges and see if dst of any edge is stmt2.
+ If there is one then return that edge. */
+ for (e = n1->succ; e; e = e->succ_next)
+ {
+ if (DN_STMT (e->dst) == stmt2)
+ return e;
+ }
+
+ /* Browse pred edges and see if src of any edge is stmt2.
+ If there is one then return that edge. */
+ for (e = n1->pred; e; e = e->pred_next)
+ {
+ if (DN_STMT (e->src) == stmt2)
+ return e;
+ }
+
+ if (!create)
+ return NULL;
+
+ /* OK, time to create new edge to connect these two nodes. */
+ e = alloc_dependence_edge ();
+
+ /* Set source and destination nodes. */
+ e->src = n1;
+ e->dst = n2;
+
+ /* Set succ and pred */
+ if (n1->succ)
+ e->succ_next = n1->succ;
+ n1->succ = e;
+
+ if (n2->pred)
+ e->pred_next = n2->pred;
+ n2->pred = e;
+
+ /* Return newly created edge. */
+ return e;
+}
+
+/* Delete edge 'e' from the graph. After deleting edge 'e'
+ if source or destination node does not have any more edges
+ associated then delete nodes also. */
+void
+dg_delete_edge (dependence_edge e)
+{
+ dependence_edge current_edge,prev_edge;
+ dependence_node src, dst;
+
+ src = e->src;
+ dst = e->dst;
+
+ /* Remove edge from the list of source successors. */
+ prev_edge = NULL;
+ for (current_edge = src->succ;
+ current_edge;
+ current_edge = current_edge->succ_next)
+ {
+ if (current_edge == e)
+ {
+ /* Found edge 'e' in the list. Remove it from the link list. */
+ if (prev_edge)
+ prev_edge->succ_next = current_edge->succ_next;
+ else
+ src->succ = current_edge->succ_next;
+ }
+ else
+ /* If this is not edge 'e' then make it prev_edge for next
+ iteration. */
+ prev_edge = current_edge;
+ }
+
+ /* If source is not associated with any edge then delete it. */
+ if (!src->succ && !src->pred)
+ dg_delete_node (src);
+
+ /* Remove edge from the list of destination predecessors. */
+ prev_edge = NULL;
+ for (current_edge = dst->pred;
+ current_edge;
+ current_edge = current_edge->pred_next)
+ {
+ if (current_edge == e)
+ {
+ /* Found edge 'e' in the list. Remove it from the link list. */
+ if (prev_edge)
+ prev_edge->pred_next = current_edge->pred_next;
+ else
+ dst->pred = current_edge->pred_next;
+ }
+ else
+ /* If this is not edge 'e' then make it prev_edge for next
+ iteration. */
+ prev_edge = current_edge;
+ }
+
+ /* If source is not associated with any edge then delete it. */
+ if (!dst->succ && !dst->pred)
+ dg_delete_node (dst);
+
+
+ /* Now, actually delete this edge. */
+ e = NULL;
+}
+
+/* Delete all edges in the dependence graph. */
+static void
+dg_delete_edges (void)
+{
+ unsigned int i;
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_graph); i++)
+ {
+ dependence_edge e;
+ dependence_node dg_node = DEPENDENCE_GRAPH (i);
+
+ if (!dg_node)
+ continue;
+
+ /* One by one delete all edges. */
+ for (e = dg_node->succ; e; e = e->succ_next)
+ dg_delete_edge (e);
+ }
+
+}
+
+/*---------------------------------------------------------------------------
+ stmt_ann manipulation for dg_node
+---------------------------------------------------------------------------*/
+
+/* Find dependence_node for the given input tree. If there is not one,
+ create new one. */
+
+static
+dependence_node dg_get_node_for_stmt (tree t, bool create)
+{
+ dependence_node dg_node = dg_node_for_stmt (t);
+
+ /* If there is none, create one. */
+ if (!dg_node && create)
+ dg_node = dg_create_node (t);
+
+ return dg_node;
+}
+
+/* Set the dg_node for the input tree. */
+static void
+set_dg_node_for_stmt (tree t, dependence_node dg_node)
+{
+ stmt_ann_t ann;
+
+ if (!t)
+ abort ();
+
+ ann = get_stmt_ann (t);
+ if (!ann)
+ abort ();
+
+ ann->dg_node = dg_node;
+}
+
+/*---------------------------------------------------------------------------
+ Dependence Info Access
+---------------------------------------------------------------------------*/
+
+/* Find data dependence relation between two statements. If there is no
+ relation between two statements then return NULL. */
+
+static struct data_dependence_relation *
+find_ddr_between_stmts (tree stmt1, tree stmt2)
+{
+ dependence_edge e = NULL;
+ dependence_node n1 = NULL;
+ dependence_node n2 = NULL;
+
+
+#ifdef ENABLE_CHECKING
+ if (!stmt1 || !stmt2)
+ abort ();
+#endif
+
+ /* First find nodes for the statements. */
+ n1 = dg_node_for_stmt (stmt1);
+ n2 = dg_node_for_stmt (stmt2);
+
+ /* If associated dependence node does not exist then this
+ two statements are independent. */
+ if (!n1 || !n2)
+ return NULL;
+
+ /* Find edge between these two statements. */
+ e = dg_find_edge (n1, n2, false /* Do not create new edge */);
+
+ /* Absence of edge indicates that this two statements are independent. */
+ if (!e)
+ return NULL;
+
+ return e->ddr;
+
+}
+
+/* Find data dependence direction between two statements. */
+
+enum data_dependence_direction
+ddg_direction_between_stmts (tree stmt1, tree stmt2, int loop_num)
+{
+ struct subscript *sub = NULL;
+ struct data_dependence_relation *ddr = find_ddr_between_stmts (stmt1, stmt2);
+
+ /* If there is no relation then statements are independent. */
+ if (!ddr)
+ return dir_independent;
+
+ /* Get subscript info. */
+ sub = DDR_SUBSCRIPT (ddr, loop_num);
+ if (!sub)
+ abort ();
+
+ return SUB_DIRECTION (sub);
+}
+
+/* Find data dependence distance between two statements. */
+
+tree
+ddg_distance_between_stmts (tree stmt1, tree stmt2, int loop_num)
+{
+ struct subscript *sub = NULL;
+ struct data_dependence_relation *ddr = find_ddr_between_stmts (stmt1, stmt2);
+
+ /* If there is no relation then statements are independent. */
+ if (!ddr)
+ return NULL_TREE;
+
+ /* Get subscript info. */
+ sub = DDR_SUBSCRIPT (ddr, loop_num);
+ if (!sub)
+ abort ();
+
+ return SUB_DISTANCE (sub);
+}
+
+/*---------------------------------------------------------------------------
+ Printing and debugging
+---------------------------------------------------------------------------*/
+
+/* Print dependency graph in the dump file. */
+static void
+dump_dg (FILE *file, int flags ATTRIBUTE_UNUSED)
+{
+ unsigned int i, j;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_graph); i++)
+ {
+ dependence_edge e;
+ dependence_node dg_node = DEPENDENCE_GRAPH (i);
+
+ if (!dg_node)
+ abort ();
+
+ fprintf (file, "# Dependence Node %d\n", dg_node->node_id);
+
+ /* Print Predecssors */
+ fprintf (file, "# Pred :");
+ for (e = dg_node->pred; e; e = e->pred_next)
+ if (e->dst == dg_node)
+ fprintf (file, "%d ", DN_ID(e->src));
+ fprintf (file, "\n");
+
+ /* Print Successors */
+ fprintf (file, "# Succ :");
+ for (e = dg_node->succ; e; e = e->succ_next)
+ if (e->src == dg_node)
+ fprintf (file, "%d ", DN_ID(e->dst));
+ fprintf (file, "\n");
+
+ fprintf (file, "# Statement :");
+ print_generic_stmt (file, DN_STMT (dg_node), 0);
+
+ fprintf (file, "# From\tTo\tDirection Vector\n");
+ for (e = dg_node->succ; e; e = e->succ_next)
+ {
+
+ fprintf (file," %d\t", DN_ID(e->src));
+ fprintf (file,"%d\t", DN_ID(e->dst));
+
+ if (DDR_ARE_DEPENDENT (e->ddr) == chrec_top)
+ fprintf (file, "don't know\n");
+
+ for (j = 0; j < DDR_NUM_SUBSCRIPTS (e->ddr); j++)
+ {
+ struct subscript *sub = DDR_SUBSCRIPT (e->ddr, j);
+
+ dump_data_dependence_direction (file, SUB_DIRECTION (sub));
+ fprintf (file, " ");
+ }
+ fprintf (file,"\n");
+ }
+
+ /* Add one blank line at the end of this node. */
+ fprintf (file, "\n");
+ }
+}
+
+void
+debug_dg (int flags)
+{
+ dump_dg (stderr, flags);
+}
diff --git a/gcc/tree-dg.h b/gcc/tree-dg.h
new file mode 100644
index 00000000000..cb35f13b386
--- /dev/null
+++ b/gcc/tree-dg.h
@@ -0,0 +1,87 @@
+/* Dependence Graph
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Devang Patel <dpatel@apple.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_TREE_SSA_DG_H
+#define GCC_TREE_SSA_DG_H
+
+#include "tree-data-ref.h"
+
+struct dependence_edge_def GTY (())
+{
+ /* Dependence relation */
+ struct data_dependence_relation *ddr;
+
+ /* Links through the predessor and successor lists. */
+ struct dependence_edge_def *pred_next;
+ struct dependence_edge_def *succ_next;
+
+ /* Source and destination. */
+ struct dependence_node_def *src;
+ struct dependence_node_def *dst;
+
+ /* Auxiliary info. */
+ /* PTR GTY ((skip (""))) aux; */
+};
+
+typedef struct dependence_edge_def *dependence_edge;
+
+struct dependence_node_def GTY (())
+{
+
+ int node_id;
+
+ /* Statement */
+ tree stmt;
+
+ /* Dependece ddges */
+ dependence_edge pred;
+ dependence_edge succ;
+
+ /* Next and previous nodes in the chain. */
+ struct dependence_node_def *next;
+ struct dependence_node_def *prev;
+
+};
+
+typedef struct dependence_node_def *dependence_node;
+
+#define DN_STMT(node) (node->stmt)
+#define DN_ID(node) (node->node_id)
+
+/* Create dependency graph. */
+extern void dg_create_graph (struct loops *);
+
+/* Delete dependency graph. */
+extern void dg_delete_graph (void);
+
+/* Delete edge from the dependency graph. */
+void dg_delete_edge (dependence_edge);
+
+/* Debug dependence graph. */
+extern void debug_dg (int);
+
+/* Find data dependence direction between two statements. */
+enum data_dependence_direction ddg_direction_between_stmts (tree, tree, int);
+
+/* Find data dependence distance between two statements. */
+tree ddg_distance_between_stmts (tree, tree, int);
+
+#endif
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index d45498ed455..759bda21153 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -604,6 +604,17 @@ dump_node (tree t, int flags, FILE *stream)
dump_queue_p dq;
dump_queue_p next_dq;
+#if 0
+ /* MERGE FIX ME */
+ /* APPLE LOCAL begin new tree dump ilr */
+ /* The -fdmp-xxxx options indicate that we are to use dmp_tree() as
+ opposed to the dump format provided here. */
+ if (flags & TDF_DMP_TREE)
+ if ((*lang_hooks.dmp_tree3) (stream, t, flags))
+ return;
+ /* APPLE LOCAL end new tree dump ilr */
+#endif
+
/* Initialize the dump-information structure. */
di.stream = stream;
di.index = 0;
@@ -643,7 +654,8 @@ struct dump_file_info
/* Table of tree dump switches. This must be consistent with the
TREE_DUMP_INDEX enumeration in tree.h */
-static struct dump_file_info dump_files[TDI_end] =
+/* APPLE LOCAL new tree dump ilr */
+static struct dump_file_info dump_files[TDI_end*2] =
{
{NULL, NULL, 0, 0},
{".tu", "translation-unit", 0, 0},
diff --git a/gcc/tree-elim-check.c b/gcc/tree-elim-check.c
new file mode 100644
index 00000000000..1ba69e4c455
--- /dev/null
+++ b/gcc/tree-elim-check.c
@@ -0,0 +1,478 @@
+/* Elimination of redundant checks.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@cri.ensmp.fr>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/*
+ Description:
+
+ Compute the scalar evolutions for all the scalar variables of a
+ condition expression, and based on this information performs a
+ proof. The condition is rewritten based on the result of this
+ static proof.
+
+ Examples:
+
+ Example 1: A simple illustration of the algorithm.
+
+ Given the COND_EXPR "if (a < b)" with "a -> {2, +, 1}_1" and "b
+ -> {3, +, 1}_1", the proof consists in comparing these evolution
+ functions: is it always true for a given iteration x that "{2, +,
+ 1}_1 (x) < {3, +, 1}_1 (x)"? The answer is yes, and the test of
+ the condition is consequently replaced by "1".
+
+ Further readings:
+
+ There is no further readings for the moment.
+
+ Based on the fact that this algorithm is similar to the Value
+ Range Propagation you can have a look at the corresponding
+ papers: ...
+*/
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+
+/* These RTL headers are needed for basic-block.h. */
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "flags.h"
+
+
+/* Determines whether "CHREC0 (x) > CHREC1 (x)" for all the integers x
+ such that "0 <= x < nb_iter". When this property is statically
+ computable, set VALUE and return true. */
+
+static inline bool
+prove_truth_value_gt (tree type, tree chrec0, tree chrec1, bool *value)
+{
+ tree diff = chrec_fold_minus (type, chrec0, chrec1);
+ return chrec_is_positive (diff, value);
+}
+
+/* Determines whether "CHREC0 (x) < CHREC1 (x)" for all the integers
+ x such that "x >= 0". When this property is statically computable,
+ set VALUE and return true. */
+
+static inline bool
+prove_truth_value_lt (tree type, tree chrec0, tree chrec1, bool *value)
+{
+ return prove_truth_value_gt (type, chrec1, chrec0, value);
+}
+
+/* Determines whether "CHREC0 (x) <= CHREC1 (x)" for all the integers
+ x such that "x >= 0". When this property is statically computable,
+ set VALUE and return true. */
+
+static inline bool
+prove_truth_value_le (tree type, tree chrec0, tree chrec1, bool *value)
+{
+ if (prove_truth_value_gt (type, chrec0, chrec1, value))
+ {
+ *value = !*value;
+ return true;
+ }
+
+ return false;
+}
+
+/* Determines whether "CHREC0 (x) >= CHREC1 (x)" for all the integers
+ x such that "x >= 0". When this property is statically computable,
+ set VALUE and return true. */
+
+static inline bool
+prove_truth_value_ge (tree type, tree chrec0, tree chrec1, bool *value)
+{
+ if (prove_truth_value_gt (type, chrec1, chrec0, value))
+ {
+ *value = !*value;
+ return true;
+ }
+
+ return false;
+}
+
+/* Determines whether "CHREC0 (x) == CHREC1 (x)" for all the integers
+ x such that "x >= 0". When this property is statically computable,
+ set VALUE and return true. */
+
+static inline bool
+prove_truth_value_eq (tree type, tree chrec0, tree chrec1, bool *value)
+{
+ tree diff = chrec_fold_minus (integer_type_node, chrec0, chrec1);
+
+ if (TREE_CODE (diff) == INTEGER_CST)
+ {
+ if (integer_zerop (diff))
+ *value = true;
+
+ else
+ *value = false;
+
+ return true;
+ }
+
+ else
+ return false;
+}
+
+/* Determines whether "CHREC0 (x) != CHREC1 (x)" for all the integers
+ x such that "x >= 0". When this property is statically computable,
+ set VALUE and return true. */
+
+static inline bool
+prove_truth_value_ne (tree type, tree chrec0, tree chrec1, bool *value)
+{
+ if (prove_truth_value_eq (type, chrec0, chrec1, value))
+ {
+ *value = !*value;
+ return true;
+ }
+
+ return false;
+}
+
+/* Try to determine whether "CHREC0 (x) CODE CHREC1 (x)", using
+ symbolic computations. When this property is computable, set VALUE
+ and return true. */
+
+static bool
+prove_truth_value_symbolic (enum tree_code code, tree chrec0, tree chrec1,
+ bool *value)
+{
+ tree type0 = chrec_type (chrec0);
+ tree type1 = chrec_type (chrec1);
+
+ /* Disabled for the moment. */
+ return false;
+
+ if (type0 != type1)
+ return false;
+
+ switch (code)
+ {
+ case EQ_EXPR:
+ return prove_truth_value_eq (type1, chrec0, chrec1, value);
+
+ case NE_EXPR:
+ return prove_truth_value_ne (type1, chrec0, chrec1, value);
+
+ case LT_EXPR:
+ return prove_truth_value_lt (type1, chrec0, chrec1, value);
+
+ case LE_EXPR:
+ return prove_truth_value_le (type1, chrec0, chrec1, value);
+
+ case GT_EXPR:
+ return prove_truth_value_gt (type1, chrec0, chrec1, value);
+
+ case GE_EXPR:
+ return prove_truth_value_ge (type1, chrec0, chrec1, value);
+
+ default:
+ return false;
+ }
+}
+
+/* Return the negation of the comparison code. */
+
+static inline enum tree_code
+not_code (enum tree_code code)
+{
+ switch (code)
+ {
+ case EQ_EXPR:
+ return NE_EXPR;
+ case NE_EXPR:
+ return EQ_EXPR;
+ case LT_EXPR:
+ return GE_EXPR;
+ case LE_EXPR:
+ return GT_EXPR;
+ case GT_EXPR:
+ return LE_EXPR;
+ case GE_EXPR:
+ return LT_EXPR;
+
+ default:
+ return code;
+ }
+}
+
+/* Determine whether "CHREC0 (x) CODE CHREC1 (x)", for all the
+ integers x such that "0 <= x <= NB_ITERS_IN_LOOP". When this
+ property is statically computable, set VALUE and return true. */
+
+static bool
+prove_truth_value (enum tree_code code,
+ unsigned loop_nb,
+ tree chrec0,
+ tree chrec1,
+ tree nb_iters_in_loop,
+ bool *value)
+{
+ tree nb_iters_in_then, nb_iters_in_else;
+
+ if (automatically_generated_chrec_p (nb_iters_in_loop))
+ return prove_truth_value_symbolic (code, chrec0, chrec1, value);
+
+ /* Compute the number of iterations that fall in the THEN clause,
+ and the number of iterations that fall in the ELSE clause. */
+ nb_iters_in_then = first_iteration_non_satisfying
+ (code, loop_nb, chrec0, chrec1);
+ nb_iters_in_else = first_iteration_non_satisfying
+ (not_code (code), loop_nb, chrec0, chrec1);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (nb_iters_in_loop = ");
+ print_generic_expr (dump_file, nb_iters_in_loop, 0);
+ fprintf (dump_file, ")\n (nb_iters_in_then = ");
+ print_generic_expr (dump_file, nb_iters_in_then, 0);
+ fprintf (dump_file, ")\n (nb_iters_in_else = ");
+ print_generic_expr (dump_file, nb_iters_in_else, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ if (nb_iters_in_then == chrec_top
+ || nb_iters_in_else == chrec_top)
+ return prove_truth_value_symbolic (code, chrec0, chrec1, value);
+
+ if (nb_iters_in_then == chrec_bot
+ && integer_zerop (nb_iters_in_else))
+ {
+ *value = true;
+ return true;
+ }
+
+ if (nb_iters_in_else == chrec_bot
+ && integer_zerop (nb_iters_in_then))
+ {
+ *value = false;
+ return true;
+ }
+
+ if (TREE_CODE (nb_iters_in_then) == INTEGER_CST
+ && TREE_CODE (nb_iters_in_else) == INTEGER_CST)
+ {
+ if (integer_zerop (nb_iters_in_then)
+ && tree_is_ge (nb_iters_in_else, nb_iters_in_loop))
+ {
+ *value = false;
+ return true;
+ }
+
+ if (integer_zerop (nb_iters_in_else)
+ && tree_is_ge (nb_iters_in_then, nb_iters_in_loop))
+ {
+ *value = true;
+ return true;
+ }
+ }
+
+ return prove_truth_value_symbolic (code, chrec0, chrec1, value);
+}
+
+/* Remove the check by setting the condition COND to VALUE. */
+
+static inline void
+remove_redundant_check (tree cond, bool value)
+{
+ /* A dead COND_EXPR means the condition is dead. We don't change any
+ flow, just replace the expression with a constant. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Replacing one of the conditions.\n");
+
+ if (value == true)
+ COND_EXPR_COND (cond) = integer_one_node;
+
+ else
+ COND_EXPR_COND (cond) = integer_zero_node;
+
+ modify_stmt (cond);
+}
+
+/* If the condition TEST is decidable at compile time, then eliminate
+ the check. */
+
+static void
+try_eliminate_check (tree cond)
+{
+ bool value;
+ tree test, opnd0, opnd1;
+ tree chrec0, chrec1;
+ struct loop *loop = loop_of_stmt (cond);
+ tree nb_iters = number_of_iterations_in_loop (loop);
+ enum tree_code code;
+
+ if (automatically_generated_chrec_p (nb_iters))
+ return;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(try_eliminate_check \n");
+ fprintf (dump_file, " (cond = ");
+ print_generic_expr (dump_file, cond, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ test = COND_EXPR_COND (cond);
+ code = TREE_CODE (test);
+ switch (code)
+ {
+ case SSA_NAME:
+ /* Matched "if (opnd0)" ie, "if (opnd0 != 0)". */
+ opnd0 = test;
+ chrec0 = instantiate_parameters
+ (loop, analyze_scalar_evolution (loop, opnd0));
+ if (chrec_contains_undetermined (chrec0))
+ goto end;
+
+ chrec1 = convert (TREE_TYPE (opnd0), integer_zero_node);
+ code = NE_EXPR;
+ break;
+
+ case LT_EXPR:
+ case LE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ opnd0 = TREE_OPERAND (test, 0);
+ opnd1 = TREE_OPERAND (test, 1);
+
+ chrec0 = instantiate_parameters
+ (loop, analyze_scalar_evolution (loop, opnd0));
+ chrec1 = instantiate_parameters
+ (loop, analyze_scalar_evolution (loop, opnd1));
+
+ if (chrec_contains_undetermined (chrec0)
+ || chrec_contains_undetermined (chrec1))
+ goto end;
+
+ break;
+
+ default:
+ goto end;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (test = ");
+ print_generic_expr (dump_file, test, 0);
+ fprintf (dump_file, ")\n (loop_nb = %d)\n", loop->num);
+ fprintf (dump_file, " (nb_iters = ");
+ print_generic_expr (dump_file, nb_iters, 0);
+ fprintf (dump_file, ")\n (chrec0 = ");
+ print_generic_expr (dump_file, chrec0, 0);
+ fprintf (dump_file, ")\n (chrec1 = ");
+ print_generic_expr (dump_file, chrec1, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ if (prove_truth_value (code, loop->num, chrec0, chrec1, nb_iters, &value))
+ remove_redundant_check (cond, value);
+
+ end:;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+}
+
+/* Compute the exit edges for all the loops. */
+
+static void
+scan_all_loops_r (struct loop *loop)
+{
+ if (!loop)
+ return;
+
+ /* Recurse on the inner loops, then on the next (sibling) loops. */
+ scan_all_loops_r (inner_loop (loop));
+ scan_all_loops_r (next_loop (loop));
+
+ flow_loop_scan (loop, LOOP_EXIT_EDGES);
+}
+
+/* Walk over all the statements, searching for conditional statements.
+
+ A better way to determine the conditional expressions that are good
+ candidates for elimination would be needed. For the moment
+ systematically search the conditional expressions over the whole
+ function. */
+
+void
+eliminate_redundant_checks (void)
+{
+ basic_block bb;
+ block_stmt_iterator bsi;
+
+#if 0
+ dump_file = stderr;
+ dump_flags = 31;
+#endif
+
+ bb = BASIC_BLOCK (0);
+ if (bb && bb->loop_father)
+ {
+ scan_all_loops_r (bb->loop_father);
+
+ FOR_EACH_BB (bb)
+ {
+ struct loop *loop = bb->loop_father;
+
+ /* Don't try to prove anything about the loop exit
+ conditions: avoid the block that contains the condition
+ that guards the exit of the loop. */
+ if (!loop_exit_edges (loop)
+ || edge_source (loop_exit_edge (loop, 0)) == bb)
+ continue;
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ tree expr = bsi_stmt (bsi);
+
+ switch (TREE_CODE (expr))
+ {
+ case COND_EXPR:
+ try_eliminate_check (expr);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+}
+
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 3505b0c4f19..9d6e5ab5839 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -99,6 +99,14 @@ bb_for_stmt (tree t)
return ann ? ann->bb : NULL;
}
+/* Return associated dependence_node with the statement. */
+static inline dependence_node
+dg_node_for_stmt (tree t)
+{
+ stmt_ann_t ann = stmt_ann (t);
+ return ann ? ann->dg_node : NULL;
+}
+
static inline varray_type
may_aliases (tree var)
{
@@ -522,6 +530,50 @@ bsi_start (basic_block bb)
}
static inline block_stmt_iterator
+bsi_after_labels (basic_block bb)
+{
+ block_stmt_iterator bsi;
+ tree_stmt_iterator next;
+
+ bsi.bb = bb;
+
+ if (!bb->stmt_list)
+ {
+#ifdef ENABLE_CHECKING
+ if (bb->index >= 0)
+ abort ();
+#endif
+ bsi.tsi.ptr = NULL;
+ bsi.tsi.container = NULL;
+ return bsi;
+ }
+
+ bsi.tsi = tsi_start (bb->stmt_list);
+ if (tsi_end_p (bsi.tsi))
+ return bsi;
+
+ /* Ensure that there are some labels. The rationale is that we want
+ to insert after the bsi that is returned, and these insertions should
+ be placed at the start of the basic block. This would not work if the
+ first statement was not label; rather fail here than enable the user
+ proceed in wrong way. */
+ if (TREE_CODE (tsi_stmt (bsi.tsi)) != LABEL_EXPR)
+ abort ();
+
+ next = bsi.tsi;
+ tsi_next (&next);
+
+ while (!tsi_end_p (next)
+ && TREE_CODE (tsi_stmt (next)) == LABEL_EXPR)
+ {
+ bsi.tsi = next;
+ tsi_next (&next);
+ }
+
+ return bsi;
+}
+
+static inline block_stmt_iterator
bsi_last (basic_block bb)
{
block_stmt_iterator bsi;
@@ -570,6 +622,18 @@ bsi_stmt_ptr (block_stmt_iterator i)
return tsi_stmt_ptr (i.tsi);
}
+/* Returns the loop of the statement STMT. */
+
+static inline struct loop *
+loop_of_stmt (tree stmt)
+{
+ basic_block bb = bb_for_stmt (stmt);
+ if (!bb)
+ return NULL;
+
+ return bb->loop_father;
+}
+
static inline bool
may_be_aliased (tree var)
{
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 61eeff517aa..ab4651ebbf5 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA. */
#include "hashtab.h"
#include "tree-simple.h"
#include "tree-ssa-operands.h"
+#include "tree-dg.h"
/* Forward declare structures for the garbage collector GTY markers. */
#ifndef GCC_BASIC_BLOCK_H
@@ -40,12 +41,21 @@ typedef struct basic_block_def *basic_block;
/*---------------------------------------------------------------------------
Tree annotations stored in tree_common.ann
---------------------------------------------------------------------------*/
-enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN, SSA_NAME_ANN };
+enum tree_ann_type
+{
+ TREE_ANN_COMMON,
+ VAR_ANN,
+ STMT_ANN,
+ SSA_NAME_ANN
+};
struct tree_ann_common_d GTY(())
{
/* Annotation type. */
enum tree_ann_type type;
+
+ /* Auxiliary info specific to a pass. */
+ PTR GTY ((skip (""))) aux;
};
/* It is advantageous to avoid things like life analysis for variables which
@@ -194,7 +204,6 @@ struct dataflow_d GTY(())
typedef struct dataflow_d *dataflow_t;
-
struct stmt_ann_d GTY(())
{
struct tree_ann_common_d common;
@@ -224,6 +233,9 @@ struct stmt_ann_d GTY(())
/* Basic block that contains this statement. */
basic_block GTY ((skip (""))) bb;
+ /* Node representing this stmt in dependence graph. */
+ dependence_node GTY ((skip (""))) dg_node;
+
/* Statement operands. */
struct def_optype_d * GTY (()) def_ops;
struct use_optype_d * GTY (()) use_ops;
@@ -259,6 +271,11 @@ struct ssa_name_ann_d GTY(())
/* Nonzero if the value of this pointer escapes the current function. */
unsigned int value_escapes_p : 1;
+ /* This field indicates whether or not the variable may need PHI nodes.
+ See the enum's definition for more detailed information about the
+ states. */
+ ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
+
/* Set of variables that this pointer may point to. */
bitmap pt_vars;
@@ -399,11 +416,13 @@ typedef struct {
static inline block_stmt_iterator bsi_start (basic_block);
static inline block_stmt_iterator bsi_last (basic_block);
+static inline block_stmt_iterator bsi_after_labels (basic_block);
static inline bool bsi_end_p (block_stmt_iterator);
static inline void bsi_next (block_stmt_iterator *);
static inline void bsi_prev (block_stmt_iterator *);
static inline tree bsi_stmt (block_stmt_iterator);
static inline tree * bsi_stmt_ptr (block_stmt_iterator);
+extern block_stmt_iterator stmt_bsi (tree);
extern void bsi_remove (block_stmt_iterator *);
extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
@@ -452,7 +471,8 @@ extern void debug_tree_cfg (int);
extern void dump_cfg_stats (FILE *);
extern void debug_cfg_stats (void);
extern void tree_cfg2dot (FILE *);
-extern void debug_loop_ir (void);
+extern void tree_debug_loop (struct loop *);
+extern void tree_debug_loops (void);
extern void print_loop_ir (FILE *);
extern void cleanup_tree_cfg (void);
extern tree first_stmt (basic_block);
@@ -467,12 +487,13 @@ extern void tree_optimize_tail_calls (bool, enum tree_dump_index);
extern edge tree_block_forwards_to (basic_block bb);
extern void bsi_insert_on_edge (edge, tree);
extern void bsi_commit_edge_inserts (int *);
-extern void bsi_insert_on_edge_immediate (edge, tree);
+extern basic_block bsi_insert_on_edge_immediate (edge, tree);
extern void notice_special_calls (tree);
extern void clear_special_calls (void);
extern void compute_dominance_frontiers (bitmap *);
extern bool verify_stmt (tree);
extern void verify_stmts (void);
+extern tree tree_block_label (basic_block);
extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
/* In tree-pretty-print.c. */
@@ -552,9 +573,14 @@ extern void verify_ssa (void);
extern void delete_tree_ssa (void);
extern void register_new_def (tree, tree, varray_type *, varray_type);
extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *);
+extern void kill_redundant_phi_nodes (void);
/* In tree-into-ssa.c */
-extern void rewrite_into_ssa (void);
+extern void rewrite_into_ssa (bool);
+extern void rewrite_ssa_into_ssa (bitmap);
+
+void compute_global_livein (bitmap, bitmap);
+tree duplicate_ssa_name (tree, tree);
extern unsigned int highest_ssa_version;
@@ -575,6 +601,34 @@ extern void replace_exp (tree *, tree);
extern bool cprop_into_stmt (tree, varray_type);
extern void cprop_into_successor_phis (basic_block, varray_type);
+/* In tree-ssa-dce.c. */
+void tree_ssa_dce_no_cfg_changes (void);
+
+/* In tree-ssa-loop*.c */
+struct loops *tree_loop_optimizer_init (FILE *, bool);
+void tree_ssa_lim (struct loops *loops);
+void tree_ssa_iv_optimize (struct loops *);
+void canonicalize_induction_variables (struct loops *loops);
+void test_unrolling_and_peeling (struct loops *loops);
+bool tree_duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
+ unsigned int, sbitmap,
+ edge, edge *,
+ unsigned int *, int);
+void create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
+ tree *, tree *);
+void test_loop_versioning (struct loops *loops);
+struct loop *tree_ssa_loop_version (struct loops *, struct loop *, tree,
+ basic_block *);
+void update_lv_condition (basic_block *, tree);
+bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
+void linear_transform_loops (struct loops *);
+void loop_commit_inserts (void);
+void tree_ssa_unswitch_loops (struct loops *loops);
+unsigned estimate_loop_size (struct loop *loop);
+void rewrite_into_loop_closed_ssa (void);
+void verify_loop_closed_ssa (void);
+void compute_phi_arg_on_exit (edge, tree, tree);
+
/* In tree-flow-inline.h */
static inline int phi_arg_from_edge (tree, edge);
static inline struct phi_arg_d *phi_element_for_edge (tree, edge);
diff --git a/gcc/tree-fold-const.c b/gcc/tree-fold-const.c
new file mode 100644
index 00000000000..90317ebff8e
--- /dev/null
+++ b/gcc/tree-fold-const.c
@@ -0,0 +1,222 @@
+/* Fold GENERIC expressions.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "tree-fold-const.h"
+
+
+
+/* Least common multiple. */
+
+tree
+tree_fold_lcm (tree a,
+ tree b)
+{
+ tree pgcd;
+
+#if defined ENABLE_CHECKING
+ if (TREE_CODE (a) != INTEGER_CST
+ || TREE_CODE (b) != INTEGER_CST)
+ abort ();
+#endif
+
+ if (integer_onep (a))
+ return b;
+
+ if (integer_onep (b))
+ return a;
+
+ if (integer_zerop (a)
+ || integer_zerop (b))
+ return integer_zero_node;
+
+ pgcd = tree_fold_gcd (a, b);
+
+ if (integer_onep (pgcd))
+ return tree_fold_multiply (integer_type_node, a, b);
+ else
+ return tree_fold_multiply
+ (integer_type_node, pgcd,
+ tree_fold_lcm (tree_fold_exact_div (integer_type_node, a, pgcd),
+ tree_fold_exact_div (integer_type_node, b, pgcd)));
+}
+
+/* Greatest common divisor. */
+
+tree
+tree_fold_gcd (tree a,
+ tree b)
+{
+ tree a_mod_b;
+ tree type = TREE_TYPE (a);
+
+#if defined ENABLE_CHECKING
+ if (TREE_CODE (a) != INTEGER_CST
+ || TREE_CODE (b) != INTEGER_CST)
+ abort ();
+#endif
+
+ if (integer_zerop (a))
+ return b;
+
+ if (integer_zerop (b))
+ return a;
+
+ if (tree_int_cst_sgn (a) == -1)
+ a = tree_fold_multiply (type, a,
+ convert (type, integer_minus_one_node));
+
+ if (tree_int_cst_sgn (b) == -1)
+ b = tree_fold_multiply (type, b,
+ convert (type, integer_minus_one_node));
+
+ while (1)
+ {
+ a_mod_b = fold (build (CEIL_MOD_EXPR, type, a, b));
+
+ if (!TREE_INT_CST_LOW (a_mod_b)
+ && !TREE_INT_CST_HIGH (a_mod_b))
+ return b;
+
+ a = b;
+ b = a_mod_b;
+ }
+}
+
+/* Bezout: Let a1 and a2 be two integers; there exist two integers u11
+ and u12 such that,
+
+ | u11 * a1 + u12 * a2 = gcd (a1, a2).
+
+ This function computes the greatest common divisor using the
+ Blankinship algorithm. The gcd is returned, and the coefficients
+ of the unimodular matrix U are (u11, u12, u21, u22) such that,
+
+ | U.A = S
+
+ | (u11 u12) (a1) = (gcd)
+ | (u21 u22) (a2) (0)
+
+ FIXME: Use lambda_..._hermite for implementing this function.
+*/
+
+tree
+tree_fold_bezout (tree a1,
+ tree a2,
+ tree *u11, tree *u12,
+ tree *u21, tree *u22)
+{
+ tree s1, s2;
+
+ /* Initialize S with the coefficients of A. */
+ s1 = a1;
+ s2 = a2;
+
+ /* Initialize the U matrix */
+ *u11 = integer_one_node;
+ *u12 = integer_zero_node;
+ *u21 = integer_zero_node;
+ *u22 = integer_one_node;
+
+ if (integer_zerop (a1)
+ || integer_zerop (a2))
+ return integer_zero_node;
+
+ while (!integer_zerop (s2))
+ {
+ int sign;
+ tree z, zu21, zu22, zs2;
+
+ sign = tree_int_cst_sgn (s1) * tree_int_cst_sgn (s2);
+ z = tree_fold_floor_div (integer_type_node,
+ tree_fold_abs (integer_type_node, s1),
+ tree_fold_abs (integer_type_node, s2));
+ zu21 = tree_fold_multiply (integer_type_node, z, *u21);
+ zu22 = tree_fold_multiply (integer_type_node, z, *u22);
+ zs2 = tree_fold_multiply (integer_type_node, z, s2);
+
+ /* row1 -= z * row2. */
+ if (sign < 0)
+ {
+ *u11 = tree_fold_plus (integer_type_node, *u11, zu21);
+ *u12 = tree_fold_plus (integer_type_node, *u12, zu22);
+ s1 = tree_fold_plus (integer_type_node, s1, zs2);
+ }
+ else if (sign > 0)
+ {
+ *u11 = tree_fold_minus (integer_type_node, *u11, zu21);
+ *u12 = tree_fold_minus (integer_type_node, *u12, zu22);
+ s1 = tree_fold_minus (integer_type_node, s1, zs2);
+ }
+ else
+ /* Should not happen. */
+ abort ();
+
+ /* Interchange row1 and row2. */
+ {
+ tree flip;
+
+ flip = *u11;
+ *u11 = *u21;
+ *u21 = flip;
+
+ flip = *u12;
+ *u12 = *u22;
+ *u22 = flip;
+
+ flip = s1;
+ s1 = s2;
+ s2 = flip;
+ }
+ }
+
+ if (tree_int_cst_sgn (s1) < 0)
+ {
+ *u11 = tree_fold_multiply (integer_type_node, *u11,
+ integer_minus_one_node);
+ *u12 = tree_fold_multiply (integer_type_node, *u12,
+ integer_minus_one_node);
+ s1 = tree_fold_multiply (integer_type_node, s1, integer_minus_one_node);
+ }
+
+ return s1;
+}
+
+/* The factorial. */
+
+tree
+tree_fold_factorial (tree f)
+{
+ if (tree_int_cst_sgn (f) <= 0)
+ return integer_one_node;
+ else
+ return tree_fold_multiply
+ (integer_type_node, f,
+ tree_fold_factorial (tree_fold_minus
+ (integer_type_node, f, integer_one_node)));
+}
+
diff --git a/gcc/tree-fold-const.h b/gcc/tree-fold-const.h
new file mode 100644
index 00000000000..42353ea050c
--- /dev/null
+++ b/gcc/tree-fold-const.h
@@ -0,0 +1,245 @@
+/* Fold GENERIC expressions.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+/* This file defines an interface of the tree folder.
+ For the moment, the functions in this file are just wrappers around
+ the "big-ugly" fold function. The final aim is to completely split
+ up the fold function into small pieces in such a way that client
+ passes don't see the changes to the underlying implementation. */
+
+#ifndef GCC_TREE_FOLD_H
+#define GCC_TREE_FOLD_H
+
+
+
+/* Interface for integer operations folding. */
+extern tree tree_fold_lcm (tree, tree);
+extern tree tree_fold_gcd (tree, tree);
+extern tree tree_fold_bezout (tree, tree, tree *, tree *, tree *, tree *);
+extern tree tree_fold_factorial (tree);
+
+
+
+/* Fold the addition. */
+
+static inline tree
+tree_fold_plus (tree type,
+ tree a,
+ tree b)
+{
+ tree res = fold (build (PLUS_EXPR, type, a, b));
+
+ /* Strip away the NON_LVALUE_EXPR: fixes bootstrap on Darwin. */
+ if (TREE_CODE (res) == NON_LVALUE_EXPR)
+ return TREE_OPERAND (res, 0);
+
+ else
+ return res;
+}
+
+/* Fold the substraction. */
+
+static inline tree
+tree_fold_minus (tree type,
+ tree a,
+ tree b)
+{
+ tree res = fold (build (MINUS_EXPR, type, a, b));
+
+ /* Strip away the NON_LVALUE_EXPR: fixes bootstrap on Darwin. */
+ if (TREE_CODE (res) == NON_LVALUE_EXPR)
+ return TREE_OPERAND (res, 0);
+
+ else
+ return res;
+}
+
+/* Fold the multiplication. */
+
+static inline tree
+tree_fold_multiply (tree type,
+ tree a,
+ tree b)
+{
+ tree res = fold (build (MULT_EXPR, type, a, b));
+
+ /* Strip away the NON_LVALUE_EXPR: fixes bootstrap on Darwin. */
+ if (TREE_CODE (res) == NON_LVALUE_EXPR)
+ return TREE_OPERAND (res, 0);
+
+ else
+ return res;
+}
+
+/* Division for integer result that rounds the quotient toward zero. */
+
+static inline tree
+tree_fold_trunc_div (tree type,
+ tree a,
+ tree b)
+{
+ return fold (build (TRUNC_DIV_EXPR, type, a, b));
+}
+
+/* Division for integer result that rounds the quotient toward infinity. */
+
+static inline tree
+tree_fold_ceil_div (tree type,
+ tree a,
+ tree b)
+{
+ return fold (build (CEIL_DIV_EXPR, type, a, b));
+}
+
+/* Division for integer result that rounds toward minus infinity. */
+
+static inline tree
+tree_fold_floor_div (tree type,
+ tree a,
+ tree b)
+{
+ return fold (build (FLOOR_DIV_EXPR, type, a, b));
+}
+
+/* Division which is not supposed to need rounding. */
+
+static inline tree
+tree_fold_exact_div (tree type,
+ tree a,
+ tree b)
+{
+ return fold (build (EXACT_DIV_EXPR, type, a, b));
+}
+
+/* Computes the minimum. */
+
+static inline tree
+tree_fold_min (tree type,
+ tree a,
+ tree b)
+{
+ return fold (build (MIN_EXPR, type, a, b));
+}
+
+/* Computes the maximum. */
+
+static inline tree
+tree_fold_max (tree type,
+ tree a,
+ tree b)
+{
+ return fold (build (MAX_EXPR, type, a, b));
+}
+
+/* Computes the absolute value. */
+
+static inline tree
+tree_fold_abs (tree type,
+ tree a)
+{
+ return fold (build1 (ABS_EXPR, type, a));
+}
+
+/* The binomial coefficient. */
+
+static inline tree
+tree_fold_binomial (tree n,
+ tree k)
+{
+ return tree_fold_exact_div
+ (integer_type_node, tree_fold_factorial (n),
+ tree_fold_multiply
+ (integer_type_node, tree_fold_factorial (k),
+ tree_fold_factorial
+ (tree_fold_minus (integer_type_node, n, k))));
+}
+
+/* Determines whether (a divides b), or (a == gcd (a, b)). */
+
+static inline bool
+tree_fold_divides_p (tree type,
+ tree a,
+ tree b)
+{
+ if (integer_onep (a))
+ return true;
+
+ return integer_zerop
+ (tree_fold_minus
+ (type, a, tree_fold_gcd (a, b)));
+}
+
+/* Given two integer constants A and B, determine whether "A >= B". */
+
+static inline bool
+tree_is_ge (tree a, tree b)
+{
+ tree cmp = fold (build (GE_EXPR, boolean_type_node, a, b));
+ return (tree_int_cst_sgn (cmp) != 0);
+}
+
+/* Given two integer constants A and B, determine whether "A > B". */
+
+static inline bool
+tree_is_gt (tree a, tree b)
+{
+ tree cmp = fold (build (GT_EXPR, boolean_type_node, a, b));
+ return (tree_int_cst_sgn (cmp) != 0);
+}
+
+/* Given two integer constants A and B, determine whether "A <= B". */
+
+static inline bool
+tree_is_le (tree a, tree b)
+{
+ tree cmp = fold (build (LE_EXPR, boolean_type_node, a, b));
+ return (tree_int_cst_sgn (cmp) != 0);
+}
+
+/* Given two integer constants A and B, determine whether "A < B". */
+
+static inline bool
+tree_is_lt (tree a, tree b)
+{
+ tree cmp = fold (build (LT_EXPR, boolean_type_node, a, b));
+ return (tree_int_cst_sgn (cmp) != 0);
+}
+
+/* Given two integer constants A and B, determine whether "A == B". */
+
+static inline bool
+tree_is_eq (tree a, tree b)
+{
+ tree cmp = fold (build (EQ_EXPR, boolean_type_node, a, b));
+ return (tree_int_cst_sgn (cmp) != 0);
+}
+
+/* Given two integer constants A and B, determine whether "A != B". */
+
+static inline bool
+tree_is_ne (tree a, tree b)
+{
+ tree cmp = fold (build (NE_EXPR, boolean_type_node, a, b));
+ return (tree_int_cst_sgn (cmp) != 0);
+}
+
+#endif /* GCC_TREE_FOLD_H */
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index d8949de2b2a..7c21b46c38e 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -66,6 +66,9 @@ struct def_blocks_d
Ith block contains a definition of VAR. */
bitmap def_blocks;
+ /* Blocks that contain a phi node for VAR. */
+ bitmap phi_blocks;
+
/* Blocks where VAR is live-on-entry. Similar semantics as
DEF_BLOCKS. */
bitmap livein_blocks;
@@ -88,6 +91,12 @@ struct mark_def_sites_global_data
solely to avoid the overhead of allocating and deallocating
the bitmap. */
sbitmap kills;
+
+ /* Bitmap of names to rename. */
+ sbitmap names_to_rename;
+
+ /* Array of ssa names. */
+ tree *ssa_names;
};
/* Table to store the current reaching definition for every variable in
@@ -100,7 +109,6 @@ struct rewrite_block_data
varray_type block_defs;
};
-
/* Local functions. */
static void rewrite_finalize_block (struct dom_walk_data *, basic_block);
static void rewrite_initialize_block_local_data (struct dom_walk_data *,
@@ -111,15 +119,14 @@ static void mark_def_sites (struct dom_walk_data *walk_data,
basic_block bb, block_stmt_iterator);
static void mark_def_sites_initialize_block (struct dom_walk_data *walk_data,
basic_block bb);
-static void compute_global_livein (bitmap, bitmap);
-static void set_def_block (tree, basic_block);
+static void set_def_block (tree, basic_block, bool);
static void set_livein_block (tree, basic_block);
static bool prepare_operand_for_rename (tree *op_p, size_t *uid_p);
-static void insert_phi_nodes (bitmap *);
+static void insert_phi_nodes (bitmap *, bitmap, tree *);
static void rewrite_stmt (struct dom_walk_data *, basic_block,
block_stmt_iterator);
static inline void rewrite_operand (tree *);
-static void insert_phi_nodes_for (tree, bitmap *);
+static void insert_phi_nodes_for (tree, bitmap *, varray_type *);
static tree get_reaching_def (tree);
static tree get_value_for (tree, varray_type);
static void set_value_for (tree, tree, varray_type);
@@ -131,12 +138,37 @@ static inline struct def_blocks_d *get_def_blocks_for (tree);
static inline struct def_blocks_d *find_def_blocks_for (tree);
static void htab_statistics (FILE *, htab_t);
+/* Gets phi_state field for VAR. */
+
+static inline enum need_phi_state
+get_phi_state (tree var)
+{
+ if (TREE_CODE (var) == SSA_NAME)
+ return get_ssa_name_ann (var)->need_phi_state;
+ else
+ return var_ann (var)->need_phi_state;
+}
+
+/* Sets phi_state field for VAR to STATE. */
+
+static inline void
+set_phi_state (tree var, enum need_phi_state state)
+{
+ if (TREE_CODE (var) == SSA_NAME)
+ get_ssa_name_ann (var)->need_phi_state = state;
+ else
+ var_ann (var)->need_phi_state = state;
+}
+
/* Return the value associated with variable VAR in TABLE. */
static inline tree
get_value_for (tree var, varray_type table)
{
- return VARRAY_TREE (table, var_ann (var)->uid);
+ if (TREE_CODE (var) == SSA_NAME)
+ return VARRAY_TREE (table, SSA_NAME_VERSION (var));
+ else
+ return VARRAY_TREE (table, var_ann (var)->uid);
}
@@ -145,7 +177,10 @@ get_value_for (tree var, varray_type table)
static inline void
set_value_for (tree var, tree value, varray_type table)
{
- VARRAY_TREE (table, var_ann (var)->uid) = value;
+ if (TREE_CODE (var) == SSA_NAME)
+ VARRAY_TREE (table, SSA_NAME_VERSION (var)) = value;
+ else
+ VARRAY_TREE (table, var_ann (var)->uid) = value;
}
@@ -157,20 +192,18 @@ set_value_for (tree var, tree value, varray_type table)
to include global livein (i.e., it modifies the underlying bitmap
for LIVEIN). */
-static void
+void
compute_global_livein (bitmap livein, bitmap def_blocks)
{
basic_block bb, *worklist, *tos;
+ int index;
tos = worklist
- = (basic_block *) xmalloc (sizeof (basic_block) * (last_basic_block + 1));
+ = (basic_block *) xmalloc (sizeof (basic_block) * (n_basic_blocks + 1));
/* Initialize the worklist. */
- FOR_EACH_BB (bb)
- {
- if (bitmap_bit_p (livein, bb->index))
- *tos++ = bb;
- }
+ EXECUTE_IF_SET_IN_BITMAP (livein, 0, index,
+ *tos++ = BASIC_BLOCK (index));
/* Iterate until the worklist is empty. */
while (tos != worklist)
@@ -214,6 +247,65 @@ mark_def_sites_initialize_block (struct dom_walk_data *walk_data,
sbitmap_zero (kills);
}
+/* Block initialization routine for mark_def_sites. Clear the
+ KILLS bitmap at the start of each block. */
+
+static void
+ssa_mark_def_sites_initialize_block (struct dom_walk_data *walk_data,
+ basic_block bb)
+{
+ struct mark_def_sites_global_data *gd = walk_data->global_data;
+ sbitmap kills = gd->kills;
+ tree phi, def;
+ unsigned def_uid;
+
+ sbitmap_zero (kills);
+
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ {
+ def = PHI_RESULT (phi);
+ def_uid = SSA_NAME_VERSION (def);
+
+ if (!TEST_BIT (gd->names_to_rename, def_uid))
+ continue;
+
+ gd->ssa_names[def_uid] = def;
+
+ set_def_block (def, bb, true);
+ SET_BIT (kills, def_uid);
+ }
+}
+
+/* Marks ssa names used as arguments of phis at the end of BB. */
+
+static void
+ssa_mark_phi_uses (struct dom_walk_data *walk_data, basic_block bb)
+{
+ struct mark_def_sites_global_data *gd = walk_data->global_data;
+ sbitmap kills = gd->kills;
+ edge e;
+ tree phi, use;
+ unsigned uid;
+
+ for (e = bb->succ; e; e = e->succ_next)
+ {
+ if (e->dest == EXIT_BLOCK_PTR)
+ continue;
+
+ for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+ {
+ use = phi_element_for_edge (phi, e)->def;
+ if (TREE_CODE (use) != SSA_NAME)
+ continue;
+
+ uid = SSA_NAME_VERSION (use);
+
+ if (TEST_BIT (gd->names_to_rename, uid)
+ && !TEST_BIT (kills, uid))
+ set_livein_block (use, bb);
+ }
+ }
+}
/* Call back for walk_dominator_tree used to collect definition sites
for every variable in the function. For every statement S in block
@@ -291,7 +383,7 @@ mark_def_sites (struct dom_walk_data *walk_data,
if (!TEST_BIT (kills, uid))
set_livein_block (VDEF_OP (vdefs, i), bb);
- set_def_block (VDEF_RESULT (vdefs, i), bb);
+ set_def_block (VDEF_RESULT (vdefs, i), bb, false);
}
}
@@ -304,25 +396,113 @@ mark_def_sites (struct dom_walk_data *walk_data,
if (prepare_operand_for_rename (def_p, &uid))
{
- set_def_block (*def_p, bb);
+ set_def_block (*def_p, bb, false);
SET_BIT (kills, uid);
}
}
}
+/* Ditto, but works over ssa names. */
-/* Mark block BB as the definition site for variable VAR. */
+static void
+ssa_mark_def_sites (struct dom_walk_data *walk_data,
+ basic_block bb,
+ block_stmt_iterator bsi)
+{
+ struct mark_def_sites_global_data *gd = walk_data->global_data;
+ sbitmap kills = gd->kills;
+ vdef_optype vdefs;
+ vuse_optype vuses;
+ def_optype defs;
+ use_optype uses;
+ size_t i, uid, def_uid;
+ tree stmt, use, def;
+ stmt_ann_t ann;
+
+ /* Mark all the blocks that have definitions for each variable in the
+ names_to_rename bitmap. */
+ stmt = bsi_stmt (bsi);
+ get_stmt_operands (stmt);
+ ann = stmt_ann (stmt);
+
+ /* If a variable is used before being set, then the variable is live
+ across a block boundary, so mark it live-on-entry to BB. */
+ uses = USE_OPS (ann);
+ for (i = 0; i < NUM_USES (uses); i++)
+ {
+ use = USE_OP (uses, i);
+ uid = SSA_NAME_VERSION (use);
+
+ if (TEST_BIT (gd->names_to_rename, uid)
+ && !TEST_BIT (kills, uid))
+ set_livein_block (use, bb);
+ }
+
+ /* Similarly for virtual uses. */
+ vuses = VUSE_OPS (ann);
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ {
+ use = VUSE_OP (vuses, i);
+ uid = SSA_NAME_VERSION (use);
+
+ if (TEST_BIT (gd->names_to_rename, uid)
+ && !TEST_BIT (kills, uid))
+ set_livein_block (use, bb);
+ }
+
+ vdefs = VDEF_OPS (ann);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ {
+ def = VDEF_RESULT (vdefs, i);
+ def_uid = SSA_NAME_VERSION (def);
+
+ use = VDEF_OP (vdefs, i);
+ uid = SSA_NAME_VERSION (use);
+
+ if (TEST_BIT (gd->names_to_rename, uid)
+ && !TEST_BIT (kills, uid))
+ set_livein_block (use, bb);
+
+ if (TEST_BIT (gd->names_to_rename, def_uid))
+ {
+ gd->ssa_names[def_uid] = def;
+ set_def_block (def, bb, false);
+ SET_BIT (kills, def_uid);
+ }
+ }
+
+ /* Now process the definition made by this statement. Mark the
+ variables in KILLS. */
+ defs = DEF_OPS (ann);
+ for (i = 0; i < NUM_DEFS (defs); i++)
+ {
+ def = DEF_OP (defs, i);
+ def_uid = SSA_NAME_VERSION (def);
+
+ if (TEST_BIT (gd->names_to_rename, def_uid))
+ {
+ gd->ssa_names[def_uid] = def;
+ set_def_block (def, bb, false);
+ SET_BIT (kills, def_uid);
+ }
+ }
+}
+
+/* Mark block BB as the definition site for variable VAR. PHI_P is true if
+ VAR is defined by a phi node. */
static void
-set_def_block (tree var, basic_block bb)
+set_def_block (tree var, basic_block bb, bool phi_p)
{
struct def_blocks_d *db_p;
- enum need_phi_state state = var_ann (var)->need_phi_state;
+ enum need_phi_state state = get_phi_state (var);
db_p = get_def_blocks_for (var);
/* Set the bit corresponding to the block where VAR is defined. */
bitmap_set_bit (db_p->def_blocks, bb->index);
+ if (phi_p)
+ bitmap_set_bit (db_p->phi_blocks, bb->index);
/* Keep track of whether or not we may need to insert phi nodes.
@@ -337,9 +517,9 @@ set_def_block (tree var, basic_block bb)
definition(s). In this case we may need a PHI node, so enter
state NEED_PHI_STATE_MAYBE. */
if (state == NEED_PHI_STATE_UNKNOWN)
- var_ann (var)->need_phi_state = NEED_PHI_STATE_NO;
+ set_phi_state (var, NEED_PHI_STATE_NO);
else
- var_ann (var)->need_phi_state = NEED_PHI_STATE_MAYBE;
+ set_phi_state (var, NEED_PHI_STATE_MAYBE);
}
@@ -349,7 +529,7 @@ static void
set_livein_block (tree var, basic_block bb)
{
struct def_blocks_d *db_p;
- enum need_phi_state state = var_ann (var)->need_phi_state;
+ enum need_phi_state state = get_phi_state (var);
db_p = get_def_blocks_for (var);
@@ -369,10 +549,10 @@ set_livein_block (tree var, basic_block bb)
if (def_block_index == -1
|| ! dominated_by_p (CDI_DOMINATORS, bb,
BASIC_BLOCK (def_block_index)))
- var_ann (var)->need_phi_state = NEED_PHI_STATE_MAYBE;
+ set_phi_state (var, NEED_PHI_STATE_MAYBE);
}
else
- var_ann (var)->need_phi_state = NEED_PHI_STATE_MAYBE;
+ set_phi_state (var, NEED_PHI_STATE_MAYBE);
}
@@ -405,41 +585,57 @@ prepare_operand_for_rename (tree *op_p, size_t *uid_p)
/* Helper for insert_phi_nodes. If VAR needs PHI nodes, insert them
- at the dominance frontier (DFS) of blocks defining VAR. */
+ at the dominance frontier (DFS) of blocks defining VAR.
+ WORK_STACK is the varray used to implement the worklist of basic
+ blocks. */
static inline
-void insert_phi_nodes_1 (tree var, bitmap *dfs)
+void insert_phi_nodes_1 (tree var, bitmap *dfs, varray_type *work_stack)
{
- var_ann_t ann = var_ann (var);
- if (ann->need_phi_state != NEED_PHI_STATE_NO)
- insert_phi_nodes_for (var, dfs);
+ if (get_phi_state (var) != NEED_PHI_STATE_NO)
+ insert_phi_nodes_for (var, dfs, work_stack);
}
-
/* Insert PHI nodes at the dominance frontier of blocks with variable
definitions. DFS contains the dominance frontier information for
the flowgraph. PHI nodes will only be inserted at the dominance
frontier of definition blocks for variables whose NEED_PHI_STATE
annotation is marked as ``maybe'' or ``unknown'' (computed by
- mark_def_sites). */
+ mark_def_sites). If NAMES_TO_RENAME is not NULL, do the same but
+ for ssa name rewriting. SSA_NAMES then maps versions to ssa names. */
static void
-insert_phi_nodes (bitmap *dfs)
+insert_phi_nodes (bitmap *dfs, bitmap names_to_rename, tree *ssa_names)
{
size_t i;
+ varray_type work_stack;
timevar_push (TV_TREE_INSERT_PHI_NODES);
+ /* Array WORK_STACK is a stack of CFG blocks. Each block that contains
+ an assignment or PHI node will be pushed to this stack. */
+ VARRAY_GENERIC_PTR_NOGC_INIT (work_stack, last_basic_block, "work_stack");
+
/* Iterate over all variables in VARS_TO_RENAME. For each variable, add
to the work list all the blocks that have a definition for the
variable. PHI nodes will be added to the dominance frontier blocks of
each definition block. */
- if (vars_to_rename)
+ if (names_to_rename)
+ {
+ EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i,
+ {
+ if (ssa_names[i])
+ insert_phi_nodes_1 (ssa_names[i], dfs, &work_stack);
+ });
+ }
+ else if (vars_to_rename)
EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i,
- insert_phi_nodes_1 (referenced_var (i), dfs));
+ insert_phi_nodes_1 (referenced_var (i), dfs, &work_stack));
else
for (i = 0; i < num_referenced_vars; i++)
- insert_phi_nodes_1 (referenced_var (i), dfs);
+ insert_phi_nodes_1 (referenced_var (i), dfs, &work_stack);
+
+ VARRAY_FREE (work_stack);
timevar_pop (TV_TREE_INSERT_PHI_NODES);
}
@@ -519,6 +715,66 @@ rewrite_initialize_block (struct dom_walk_data *walk_data, basic_block bb)
}
}
+/* Creates a duplicate of a ssa name NAME defined in statement STMT. */
+
+tree
+duplicate_ssa_name (tree name, tree stmt)
+{
+ tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt);
+ ssa_name_ann_t old_ann = get_ssa_name_ann (name);
+ ssa_name_ann_t ann = get_ssa_name_ann (new_name);
+
+ *ann = *old_ann;
+ if (old_ann->pt_vars)
+ {
+ ann->pt_vars = BITMAP_GGC_ALLOC ();
+ bitmap_copy (ann->pt_vars, old_ann->pt_vars);
+ }
+
+ return new_name;
+}
+
+/* Ditto, for rewriting ssa names. */
+
+static void
+ssa_rewrite_initialize_block (struct dom_walk_data *walk_data, basic_block bb)
+{
+ tree phi, new_name;
+ struct rewrite_block_data *bd
+ = (struct rewrite_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
+ sbitmap names_to_rename = walk_data->global_data;
+ edge e;
+ bool abnormal_phi;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index);
+
+ for (e = bb->pred; e; e = e->pred_next)
+ if (e->flags & EDGE_ABNORMAL)
+ break;
+ abnormal_phi = (e != NULL);
+
+ /* Step 1. Register new definitions for every PHI node in the block.
+ Conceptually, all the PHI nodes are executed in parallel and each PHI
+ node introduces a new version for the associated variable. */
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ {
+ tree result = PHI_RESULT (phi);
+
+ if (TEST_BIT (names_to_rename, SSA_NAME_VERSION (result)))
+ {
+ new_name = duplicate_ssa_name (result, phi);
+ PHI_RESULT (phi) = new_name;
+
+ if (abnormal_phi)
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_name) = 1;
+ }
+ else
+ new_name = result;
+
+ register_new_def (result, new_name, &bd->block_defs, currdefs);
+ }
+}
/* SSA Rewriting Step 3. Visit all the successor blocks of BB looking for
PHI nodes. For every PHI node found, add a new argument containing the
@@ -551,6 +807,38 @@ rewrite_add_phi_arguments (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
}
}
+/* Ditto, for ssa name rewriting. */
+
+static void
+ssa_rewrite_phi_arguments (struct dom_walk_data *walk_data, basic_block bb)
+{
+ edge e;
+ sbitmap names_to_rename = walk_data->global_data;
+ tree *op;
+
+ for (e = bb->succ; e; e = e->succ_next)
+ {
+ tree phi;
+
+ if (e->dest == EXIT_BLOCK_PTR)
+ continue;
+
+ for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+ {
+ op = &phi_element_for_edge (phi, e)->def;
+ if (TREE_CODE (*op) != SSA_NAME)
+ continue;
+
+ if (!TEST_BIT (names_to_rename, SSA_NAME_VERSION (*op)))
+ continue;
+
+ *op = get_reaching_def (*op);
+ if (e->flags & EDGE_ABNORMAL)
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (*op) = 1;
+ }
+ }
+}
+
/* SSA Rewriting Step 5. Restore the current reaching definition for each
variable referenced in the block (in reverse order). */
@@ -583,6 +871,29 @@ rewrite_finalize_block (struct dom_walk_data *walk_data,
}
}
+/* Ditto, for rewriting ssa names. */
+
+static void
+ssa_rewrite_finalize_block (struct dom_walk_data *walk_data,
+ basic_block bb ATTRIBUTE_UNUSED)
+{
+ struct rewrite_block_data *bd
+ = (struct rewrite_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
+
+ /* Step 5. Restore the current reaching definition for each variable
+ referenced in the block (in reverse order). */
+ while (bd->block_defs && VARRAY_ACTIVE_SIZE (bd->block_defs) > 0)
+ {
+ tree var;
+ tree saved_def = VARRAY_TOP_TREE (bd->block_defs);
+ VARRAY_POP (bd->block_defs);
+
+ var = VARRAY_TOP_TREE (bd->block_defs);
+ VARRAY_POP (bd->block_defs);
+
+ set_value_for (var, saved_def, currdefs);
+ }
+}
/* Dump SSA information to FILE. */
@@ -650,29 +961,28 @@ htab_statistics (FILE *file, htab_t htab)
/* Insert PHI nodes for variable VAR using the dominance frontier
- information given in DFS. */
+ information given in DFS. WORK_STACK is the varray used to
+ implement the worklist of basic blocks. */
static void
-insert_phi_nodes_for (tree var, bitmap *dfs)
+insert_phi_nodes_for (tree var, bitmap *dfs, varray_type *work_stack)
{
struct def_blocks_d *def_map;
bitmap phi_insertion_points;
int bb_index;
- varray_type work_stack;
+ edge e;
+ tree phi;
+ basic_block bb;
def_map = find_def_blocks_for (var);
if (def_map == NULL)
return;
- /* Array WORK_STACK is a stack of CFG blocks. Each block that contains
- an assignment or PHI node will be pushed to this stack. */
- VARRAY_BB_INIT (work_stack, last_basic_block, "work_stack");
-
phi_insertion_points = BITMAP_XMALLOC ();
EXECUTE_IF_SET_IN_BITMAP (def_map->def_blocks, 0, bb_index,
{
- VARRAY_PUSH_BB (work_stack, BASIC_BLOCK (bb_index));
+ VARRAY_PUSH_GENERIC_PTR_NOGC (*work_stack, BASIC_BLOCK (bb_index));
});
/* Pop a block off the worklist, add every block that appears in
@@ -687,13 +997,14 @@ insert_phi_nodes_for (tree var, bitmap *dfs)
determine if fully pruned or semi pruned SSA form was appropriate.
We now always use fully pruned SSA form. */
- while (VARRAY_ACTIVE_SIZE (work_stack) > 0)
+ while (VARRAY_ACTIVE_SIZE (*work_stack) > 0)
{
- basic_block bb = VARRAY_TOP_BB (work_stack);
- int bb_index = bb->index;
int dfs_index;
- VARRAY_POP (work_stack);
+ bb = VARRAY_TOP_GENERIC_PTR_NOGC (*work_stack);
+ bb_index = bb->index;
+
+ VARRAY_POP (*work_stack);
EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index],
phi_insertion_points,
@@ -701,11 +1012,15 @@ insert_phi_nodes_for (tree var, bitmap *dfs)
{
basic_block bb = BASIC_BLOCK (dfs_index);
- VARRAY_PUSH_BB (work_stack, bb);
+ VARRAY_PUSH_GENERIC_PTR_NOGC (*work_stack, bb);
bitmap_set_bit (phi_insertion_points, dfs_index);
});
}
+ /* Remove the blocks where we already have the phis. */
+ bitmap_operation (phi_insertion_points, phi_insertion_points,
+ def_map->phi_blocks, BITMAP_AND_COMPL);
+
/* Now compute global livein for this variable. Note this modifies
def_map->livein_blocks. */
compute_global_livein (def_map->livein_blocks, def_map->def_blocks);
@@ -713,11 +1028,22 @@ insert_phi_nodes_for (tree var, bitmap *dfs)
/* And insert the PHI nodes. */
EXECUTE_IF_AND_IN_BITMAP (phi_insertion_points, def_map->livein_blocks,
0, bb_index,
- {
- create_phi_node (var, BASIC_BLOCK (bb_index));
- });
+ do
+ {
+ bb = BASIC_BLOCK (bb_index);
- BITMAP_FREE (phi_insertion_points);
+ phi = create_phi_node (var, bb);
+
+ /* If we are rewriting ssa names, add also the phi arguments. */
+ if (TREE_CODE (var) == SSA_NAME)
+ {
+ for (e = bb->pred; e; e = e->pred_next)
+ add_phi_arg (&phi, var, e);
+ }
+ }
+ while (0));
+
+ BITMAP_XFREE (phi_insertion_points);
}
/* SSA Rewriting Step 2. Rewrite every variable used in each statement in
@@ -800,6 +1126,93 @@ rewrite_stmt (struct dom_walk_data *walk_data,
}
}
+/* Ditto, for rewriting ssa names. */
+
+static void
+ssa_rewrite_stmt (struct dom_walk_data *walk_data,
+ basic_block bb ATTRIBUTE_UNUSED,
+ block_stmt_iterator si)
+{
+ size_t i;
+ stmt_ann_t ann;
+ tree stmt, var, *use_p;
+ vuse_optype vuses;
+ vdef_optype vdefs;
+ def_optype defs;
+ use_optype uses;
+ struct rewrite_block_data *bd;
+ sbitmap names_to_rename = walk_data->global_data;
+
+ bd = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
+
+ stmt = bsi_stmt (si);
+ ann = stmt_ann (stmt);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Renaming statement ");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+#if defined ENABLE_CHECKING
+ /* We have just scanned the code for operands. No statement should
+ be modified. */
+ if (ann->modified)
+ abort ();
+#endif
+
+ defs = DEF_OPS (ann);
+ uses = USE_OPS (ann);
+ vuses = VUSE_OPS (ann);
+ vdefs = VDEF_OPS (ann);
+
+ /* Step 1. Rewrite USES and VUSES in the statement. */
+ for (i = 0; i < NUM_USES (uses); i++)
+ {
+ use_p = USE_OP_PTR (uses, i);
+ if (TEST_BIT (names_to_rename, SSA_NAME_VERSION (*use_p)))
+ *use_p = get_reaching_def (*use_p);
+ }
+
+ /* Rewrite virtual uses in the statement. */
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ {
+ use_p = VUSE_OP_PTR (vuses, i);
+ if (TEST_BIT (names_to_rename, SSA_NAME_VERSION (*use_p)))
+ *use_p = get_reaching_def (*use_p);
+ }
+
+ /* Step 2. Register the statement's DEF and VDEF operands. */
+ for (i = 0; i < NUM_DEFS (defs); i++)
+ {
+ tree *def_p = DEF_OP_PTR (defs, i);
+ var = *def_p;
+
+ if (!TEST_BIT (names_to_rename, SSA_NAME_VERSION (*def_p)))
+ continue;
+
+ *def_p = duplicate_ssa_name (var, stmt);
+ register_new_def (var, *def_p, &bd->block_defs, currdefs);
+ }
+
+ /* Register new virtual definitions made by the statement. */
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ {
+ tree *def_p = VDEF_RESULT_PTR (vdefs, i);
+ var = *def_p;
+
+ use_p = VDEF_OP_PTR (vdefs, i);
+ if (TEST_BIT (names_to_rename, SSA_NAME_VERSION (*use_p)))
+ *use_p = get_reaching_def (*use_p);
+
+ if (!TEST_BIT (names_to_rename, SSA_NAME_VERSION (*def_p)))
+ continue;
+
+ *def_p = duplicate_ssa_name (var, stmt);
+ register_new_def (var, *def_p, &bd->block_defs, currdefs);
+ }
+}
/* Replace the operand pointed by OP_P with its immediate reaching
definition. */
@@ -811,7 +1224,6 @@ rewrite_operand (tree *op_p)
*op_p = get_reaching_def (*op_p);
}
-
/* Register DEF to be a new definition for variable VAR and push VAR's
current reaching definition into the stack pointed by BLOCK_DEFS_P.
IS_REAL_OPERAND is true when DEF is a real definition. */
@@ -828,7 +1240,8 @@ register_new_def (tree var, tree def,
/* If the current reaching definition is NULL, push the variable itself
so that the dominator tree callbacks know what variable is associated
with this NULL reaching def when unwinding the *BLOCK_DEFS_P stack. */
- if (currdef == NULL_TREE)
+ if (currdef == NULL_TREE
+ || TREE_CODE (var) == SSA_NAME)
VARRAY_PUSH_TREE (*block_defs_p, var);
/* Push the current reaching definition into *BLOCK_DEFS_P. This stack is
@@ -851,7 +1264,7 @@ register_new_def (tree var, tree def,
static tree
get_reaching_def (tree var)
{
- tree default_d, currdef_var;
+ tree default_d, currdef_var, avar;
/* Lookup the current reaching definition for VAR. */
default_d = NULL_TREE;
@@ -861,11 +1274,16 @@ get_reaching_def (tree var)
default definition for it (if needed). */
if (currdef_var == NULL_TREE)
{
- default_d = default_def (var);
+ if (TREE_CODE (var) == SSA_NAME)
+ avar = SSA_NAME_VAR (var);
+ else
+ avar = var;
+
+ default_d = default_def (avar);
if (default_d == NULL_TREE)
{
- default_d = make_ssa_name (var, build_empty_stmt ());
- set_default_def (var, default_d);
+ default_d = make_ssa_name (avar, build_empty_stmt ());
+ set_default_def (avar, default_d);
}
set_value_for (var, default_d, currdefs);
}
@@ -898,8 +1316,9 @@ static void
def_blocks_free (void *p)
{
struct def_blocks_d *entry = p;
- BITMAP_FREE (entry->def_blocks);
- BITMAP_FREE (entry->livein_blocks);
+ BITMAP_XFREE (entry->def_blocks);
+ BITMAP_XFREE (entry->phi_blocks);
+ BITMAP_XFREE (entry->livein_blocks);
free (entry);
}
@@ -965,6 +1384,7 @@ get_def_blocks_for (tree var)
db_p = xmalloc (sizeof (*db_p));
db_p->var = var;
db_p->def_blocks = BITMAP_XMALLOC ();
+ db_p->phi_blocks = BITMAP_XMALLOC ();
db_p->livein_blocks = BITMAP_XMALLOC ();
*slot = (void *) db_p;
}
@@ -996,24 +1416,40 @@ get_def_blocks_for (tree var)
(rewrite_stmt).
Steps 3 and 5 are done using the dominator tree walker
- (walk_dominator_tree). */
+ (walk_dominator_tree).
+
+ ALL is true if all variables should be renamed (otherwise just those
+ mentioned in vars_to_rename are taken into account). */
void
-rewrite_into_ssa (void)
+rewrite_into_ssa (bool all)
{
bitmap *dfs;
basic_block bb;
struct dom_walk_data walk_data;
struct mark_def_sites_global_data mark_def_sites_global_data;
+ bitmap old_vars_to_rename = vars_to_rename;
timevar_push (TV_TREE_SSA_OTHER);
- /* Initialize the array of variables to rename. */
- if (vars_to_rename != NULL)
+ if (all)
+ vars_to_rename = NULL;
+ else
{
size_t i;
bool rename_name_tags_p;
+ /* Initialize the array of variables to rename. */
+
+ if (vars_to_rename == NULL)
+ abort ();
+
+ if (bitmap_first_set_bit (vars_to_rename) < 0)
+ {
+ timevar_pop (TV_TREE_SSA_OTHER);
+ return;
+ }
+
/* If any of the variables in VARS_TO_RENAME is a pointer, we need to
invalidate all the name memory tags associated with the variables
that we are about to rename. FIXME: Currently we just invalidate
@@ -1102,7 +1538,7 @@ rewrite_into_ssa (void)
sbitmap_free (mark_def_sites_global_data.kills);
/* Insert PHI nodes at dominance frontiers of definition blocks. */
- insert_phi_nodes (dfs);
+ insert_phi_nodes (dfs, NULL, NULL);
/* Rewrite all the basic blocks in the program. */
timevar_push (TV_TREE_SSA_REWRITE_BLOCKS);
@@ -1147,14 +1583,164 @@ rewrite_into_ssa (void)
htab_delete (def_blocks);
VARRAY_CLEAR (currdefs);
+ vars_to_rename = old_vars_to_rename;
timevar_pop (TV_TREE_SSA_OTHER);
}
+/* The ssa names in NAMES_TO_RENAME may have more than one definition;
+ add phi nodes and rewrite them to fix this. */
+
+void
+rewrite_ssa_into_ssa (bitmap names_to_rename)
+{
+ bitmap *dfs;
+ basic_block bb;
+ struct dom_walk_data walk_data;
+ struct mark_def_sites_global_data mark_def_sites_global_data;
+ tree *ssa_names;
+ unsigned i;
+ sbitmap snames_to_rename;
+
+ if (bitmap_first_set_bit (names_to_rename) < 0)
+ return;
+
+ timevar_push (TV_TREE_SSA_OTHER);
+
+ /* Allocate memory for the DEF_BLOCKS hash table. */
+ def_blocks = htab_create (highest_ssa_version,
+ def_blocks_hash, def_blocks_eq, def_blocks_free);
+
+ VARRAY_TREE_INIT (currdefs, highest_ssa_version, "currdefs");
+
+ ssa_names = xcalloc (highest_ssa_version, sizeof (tree));
+
+ /* Initialize dominance frontier and immediate dominator bitmaps.
+ Also count the number of predecessors for each block. Doing so
+ can save significant time during PHI insertion for large graphs. */
+ dfs = (bitmap *) xmalloc (last_basic_block * sizeof (bitmap *));
+ FOR_EACH_BB (bb)
+ {
+ edge e;
+ int count = 0;
+
+ for (e = bb->pred; e; e = e->pred_next)
+ count++;
+
+ bb_ann (bb)->num_preds = count;
+ dfs[bb->index] = BITMAP_XMALLOC ();
+ }
+
+ /* Ensure that the dominance information is OK. */
+ calculate_dominance_info (CDI_DOMINATORS);
+
+ /* Compute dominance frontiers. */
+ compute_dominance_frontiers (dfs);
+
+ /* Setup callbacks for the generic dominator tree walker to find and
+ mark definition sites. */
+ walk_data.walk_stmts_backward = false;
+ walk_data.dom_direction = CDI_DOMINATORS;
+ walk_data.initialize_block_local_data = NULL;
+ walk_data.before_dom_children_before_stmts
+ = ssa_mark_def_sites_initialize_block;
+ walk_data.before_dom_children_walk_stmts = ssa_mark_def_sites;
+ walk_data.before_dom_children_after_stmts = ssa_mark_phi_uses;
+ walk_data.after_dom_children_before_stmts = NULL;
+ walk_data.after_dom_children_walk_stmts = NULL;
+ walk_data.after_dom_children_after_stmts = NULL;
+
+ snames_to_rename = sbitmap_alloc (highest_ssa_version);
+ sbitmap_zero (snames_to_rename);
+ EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i,
+ SET_BIT (snames_to_rename, i));
+
+ mark_def_sites_global_data.kills = sbitmap_alloc (highest_ssa_version);
+ mark_def_sites_global_data.names_to_rename = snames_to_rename;
+ mark_def_sites_global_data.ssa_names = ssa_names;
+ walk_data.global_data = &mark_def_sites_global_data;
+
+ /* We do not have any local data. */
+ walk_data.block_local_data_size = 0;
+
+ /* Initialize the dominator walker. */
+ init_walk_dominator_tree (&walk_data);
+
+ /* Recursively walk the dominator tree. */
+ walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
+
+ /* Finalize the dominator walker. */
+ fini_walk_dominator_tree (&walk_data);
+
+ /* We no longer need this bitmap, clear and free it. */
+ sbitmap_free (mark_def_sites_global_data.kills);
+
+ /* Insert PHI nodes at dominance frontiers of definition blocks. */
+ insert_phi_nodes (dfs, names_to_rename, ssa_names);
+
+ /* Rewrite all the basic blocks in the program. */
+ timevar_push (TV_TREE_SSA_REWRITE_BLOCKS);
+
+ /* Setup callbacks for the generic dominator tree walker. */
+ walk_data.walk_stmts_backward = false;
+ walk_data.dom_direction = CDI_DOMINATORS;
+ walk_data.initialize_block_local_data
+ = rewrite_initialize_block_local_data;
+ walk_data.before_dom_children_before_stmts = ssa_rewrite_initialize_block;
+ walk_data.before_dom_children_walk_stmts = ssa_rewrite_stmt;
+ walk_data.before_dom_children_after_stmts = ssa_rewrite_phi_arguments;
+ walk_data.after_dom_children_before_stmts = NULL;
+ walk_data.after_dom_children_walk_stmts = NULL;
+ walk_data.after_dom_children_after_stmts = ssa_rewrite_finalize_block;
+ walk_data.global_data = snames_to_rename;
+ walk_data.block_local_data_size = sizeof (struct rewrite_block_data);
+
+ /* Initialize the dominator walker. */
+ init_walk_dominator_tree (&walk_data);
+
+ /* Recursively walk the dominator tree rewriting each statement in
+ each basic block. */
+ walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
+
+ /* Finalize the dominator walker. */
+ fini_walk_dominator_tree (&walk_data);
+
+ sbitmap_free (snames_to_rename);
+
+ timevar_pop (TV_TREE_SSA_REWRITE_BLOCKS);
+
+ /* Debugging dumps. */
+ if (dump_file && (dump_flags & TDF_STATS))
+ {
+ dump_dfa_stats (dump_file);
+ dump_tree_ssa_stats (dump_file);
+ }
+
+ /* Free allocated memory. */
+ FOR_EACH_BB (bb)
+ BITMAP_XFREE (dfs[bb->index]);
+ free (dfs);
+
+ htab_delete (def_blocks);
+ VARRAY_CLEAR (currdefs);
+
+ free (ssa_names);
+
+ timevar_pop (TV_TREE_SSA_OTHER);
+}
+
+/* Rewrites all variables into ssa. */
+
+static void
+rewrite_all_into_ssa (void)
+{
+ rewrite_into_ssa (true);
+}
+
struct tree_opt_pass pass_build_ssa =
{
"ssa", /* name */
NULL, /* gate */
- rewrite_into_ssa, /* execute */
+ rewrite_all_into_ssa, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
diff --git a/gcc/tree-loop-linear.c b/gcc/tree-loop-linear.c
new file mode 100644
index 00000000000..37a6048c093
--- /dev/null
+++ b/gcc/tree-loop-linear.c
@@ -0,0 +1,113 @@
+/* Linear Loop transforms
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Daniel Berlin <dberlin@dberlin.org>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "target.h"
+
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-fold-const.h"
+#include "expr.h"
+#include "optabs.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "varray.h"
+#include "lambda.h"
+
+/* Linear loop transforms include any composition of interchange,
+ scaling, skewing, and reversal. They are used to change the
+ iteration order of loop nests in order to optimize data locality of
+ traversals, or remove dependences that prevent
+ parallelization/vectorization/etc.
+
+ TODO: Determine reuse vectors/matrix and use it to determine optimal
+ transform matrix for locality purposes.
+ TODO: Add dependence matrix collection and approriate matrix
+ calculations so we can determine if a given transformation matrix
+ is legal for a loop.
+ TODO: Completion of partial transforms.
+*/
+
+/* Perform a set of linear transforms on LOOPS. */
+
+void
+linear_transform_loops (struct loops *loops)
+{
+ unsigned int i;
+ for (i = 1; i < loops->num; i++)
+ {
+ struct loop *loop_nest = loops->parray[i];
+ varray_type oldivs;
+ varray_type invariants;
+ lambda_loopnest before, after;
+ lambda_trans_matrix trans;
+
+ if (!loop_nest->inner)
+ continue;
+ flow_loop_scan (loop_nest, LOOP_ALL);
+ flow_loop_scan (loop_nest->inner, LOOP_ALL);
+#if 0
+ if (loop_nest->num_pre_header_edges != 1
+ || loop_nest->inner->num_pre_header_edges != 1)
+ continue;
+#endif
+ before = gcc_loopnest_to_lambda_loopnest (loop_nest, &oldivs, &invariants);
+ if (!before)
+ continue;
+ if (dump_file)
+ {
+ fprintf (dump_file, "Before:\n");
+ print_lambda_loopnest (dump_file, before, 'i');
+ }
+ trans = lambda_trans_matrix_new (LN_DEPTH (before), LN_DEPTH (before));
+#if 1
+ lambda_matrix_id (LTM_MATRIX (trans), LN_DEPTH (before));
+#else
+ /* This is a 2x2 interchange matrix. */
+ LTM_MATRIX (trans)[0][0] = 0;
+ LTM_MATRIX (trans)[0][1] = 1;
+ LTM_MATRIX (trans)[1][0] = 1;
+ LTM_MATRIX (trans)[1][1] = 0;
+#endif
+ after = lambda_loopnest_transform (before, trans);
+ if (dump_file)
+ {
+ fprintf (dump_file, "After:\n");
+ print_lambda_loopnest (dump_file, after, 'u');
+ }
+ lambda_loopnest_to_gcc_loopnest (loop_nest, oldivs, invariants,
+ after, trans);
+ }
+}
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 9172541af39..6e9f2b9e928 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -563,40 +563,27 @@ mf_xform_derefs_1 (tree_stmt_iterator *iter, tree *tp,
{
case ARRAY_REF:
{
- /* Omit checking if we can statically determine that the access is
- valid. For non-addressable local arrays this is not optional,
- since we won't have called __mf_register for the object. */
- tree op0, op1;
-
- op0 = TREE_OPERAND (t, 0);
- op1 = TREE_OPERAND (t, 1);
- while (TREE_CODE (op1) == INTEGER_CST)
- {
- tree dom = TYPE_DOMAIN (TREE_TYPE (op0));
-
- /* Test for index in range. Break if not. */
- if (!dom)
- break;
- if (!TYPE_MIN_VALUE (dom) || !really_constant_p (TYPE_MIN_VALUE (dom)))
- break;
- if (!TYPE_MAX_VALUE (dom) || !really_constant_p (TYPE_MAX_VALUE (dom)))
- break;
- if (tree_int_cst_lt (op1, TYPE_MIN_VALUE (dom))
- || tree_int_cst_lt (TYPE_MAX_VALUE (dom), op1))
- break;
-
- /* If we're looking at a non-external VAR_DECL, then the
- access must be ok. */
- if (TREE_CODE (op0) == VAR_DECL && !DECL_EXTERNAL (op0))
- return;
-
- /* Only continue if we're still looking at an array. */
- if (TREE_CODE (op0) != ARRAY_REF)
- break;
-
- op1 = TREE_OPERAND (op0, 1);
- op0 = TREE_OPERAND (op0, 0);
- }
+ /* Omit checking if we can statically determine that the access is
+ valid. For non-addressable local arrays this is not optional,
+ since we won't have called __mf_register for the object. */
+ tree op0, op1;
+
+ op0 = TREE_OPERAND (t, 0);
+ op1 = TREE_OPERAND (t, 1);
+ while (in_array_bounds_p (op0, op1))
+ {
+ /* If we're looking at a non-external VAR_DECL, then the
+ access must be ok. */
+ if (TREE_CODE (op0) == VAR_DECL && !DECL_EXTERNAL (op0))
+ return;
+
+ /* Only continue if we're still looking at an array. */
+ if (TREE_CODE (op0) != ARRAY_REF)
+ break;
+
+ op1 = TREE_OPERAND (op0, 1);
+ op0 = TREE_OPERAND (op0, 0);
+ }
/* If we got here, we couldn't statically the check. */
ptr_type = build_pointer_type (type);
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 6af4b029389..24296a529c0 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -282,6 +282,7 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_early_warn_uninitialized);
NEXT_PASS (pass_dce);
+ NEXT_PASS (pass_return);
NEXT_PASS (pass_dominator);
NEXT_PASS (pass_redundant_phi);
NEXT_PASS (DUP_PASS (pass_dce));
@@ -293,6 +294,7 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_del_pta);
NEXT_PASS (pass_profile);
NEXT_PASS (pass_lower_complex);
+ NEXT_PASS (DUP_PASS (pass_return));
NEXT_PASS (pass_sra);
NEXT_PASS (DUP_PASS (pass_rename_ssa_copies));
NEXT_PASS (DUP_PASS (pass_dominator));
@@ -301,12 +303,13 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_dse);
NEXT_PASS (DUP_PASS (pass_forwprop));
NEXT_PASS (DUP_PASS (pass_phiopt));
- NEXT_PASS (pass_loop);
NEXT_PASS (pass_ccp);
NEXT_PASS (DUP_PASS (pass_redundant_phi));
NEXT_PASS (pass_fold_builtins);
NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_pre);
+ NEXT_PASS (pass_scev);
+ NEXT_PASS (pass_loop);
NEXT_PASS (DUP_PASS (pass_dominator));
NEXT_PASS (DUP_PASS (pass_redundant_phi));
NEXT_PASS (pass_cd_dce);
@@ -322,6 +325,19 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_del_cfg);
*p = NULL;
+ p = &pass_scev.sub;
+ NEXT_PASS (pass_scev_init);
+ NEXT_PASS (pass_scev_anal);
+ NEXT_PASS (pass_scev_depend);
+ NEXT_PASS (pass_scev_elim_checks);
+ NEXT_PASS (pass_scev_iv_canon);
+ NEXT_PASS (pass_scev_linear_transform);
+ NEXT_PASS (pass_ddg);
+ NEXT_PASS (pass_scev_vectorize);
+ NEXT_PASS (pass_delete_ddg);
+ NEXT_PASS (pass_scev_done);
+ *p = NULL;
+
#undef NEXT_PASS
#undef DUP_PASS
@@ -339,9 +355,8 @@ execute_todo (unsigned int flags)
{
if (flags & TODO_rename_vars)
{
- if (bitmap_first_set_bit (vars_to_rename) >= 0)
- rewrite_into_ssa ();
- BITMAP_XFREE (vars_to_rename);
+ rewrite_into_ssa (false);
+ bitmap_clear (vars_to_rename);
}
if ((flags & TODO_dump_func) && dump_file)
@@ -397,10 +412,6 @@ execute_one_pass (struct tree_opt_pass *pass)
if (pass->tv_id)
timevar_push (pass->tv_id);
- /* If the pass is requesting ssa variable renaming, allocate the bitmap. */
- if (pass->todo_flags_finish & TODO_rename_vars)
- vars_to_rename = BITMAP_XMALLOC ();
-
/* Do it! */
if (pass->execute)
pass->execute ();
@@ -522,6 +533,9 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
}
}
+ if (!vars_to_rename)
+ vars_to_rename = BITMAP_XMALLOC ();
+
/* Perform all tree transforms and optimizations. */
execute_pass_list (all_passes);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index cdaf8efefdc..9639b2e7963 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -75,7 +75,7 @@ struct tree_opt_pass
#define PROP_pta (1 << 5)
#define PROP_ssa (1 << 6)
#define PROP_no_crit_edges (1 << 7)
-
+#define PROP_scev (1 << 8)
/* To-do flags. */
#define TODO_dump_func (1 << 0) /* pass doesn't dump itself */
#define TODO_rename_vars (1 << 1) /* rewrite new vars to ssa */
@@ -102,6 +102,17 @@ extern struct tree_opt_pass pass_sra;
extern struct tree_opt_pass pass_tail_recursion;
extern struct tree_opt_pass pass_tail_calls;
extern struct tree_opt_pass pass_loop;
+extern struct tree_opt_pass pass_scev;
+extern struct tree_opt_pass pass_scev_init;
+extern struct tree_opt_pass pass_scev_anal;
+extern struct tree_opt_pass pass_scev_depend;
+extern struct tree_opt_pass pass_scev_linear_transform;
+extern struct tree_opt_pass pass_scev_iv_canon;
+extern struct tree_opt_pass pass_scev_elim_checks;
+extern struct tree_opt_pass pass_scev_vectorize;
+extern struct tree_opt_pass pass_scev_done;
+extern struct tree_opt_pass pass_ddg;
+extern struct tree_opt_pass pass_delete_ddg;
extern struct tree_opt_pass pass_ch;
extern struct tree_opt_pass pass_ccp;
extern struct tree_opt_pass pass_build_ssa;
@@ -122,6 +133,7 @@ extern struct tree_opt_pass pass_phiopt;
extern struct tree_opt_pass pass_forwprop;
extern struct tree_opt_pass pass_redundant_phi;
extern struct tree_opt_pass pass_dse;
+extern struct tree_opt_pass pass_return;
extern struct tree_opt_pass pass_nrv;
extern struct tree_opt_pass pass_remove_useless_vars;
extern struct tree_opt_pass pass_rename_ssa_copies;
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 08816cb2e22..660a9319dc7 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -30,6 +30,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "hashtab.h"
#include "tree-flow.h"
#include "langhooks.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
#include "tree-iterator.h"
/* Local functions, macros and variables. */
@@ -1472,6 +1474,54 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_decimal_int (buffer, SSA_NAME_VERSION (node));
break;
+ case POLYNOMIAL_CHREC:
+ pp_string (buffer, "{");
+ dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
+ pp_string (buffer, ", +, ");
+ dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
+ pp_string (buffer, "}_");
+ dump_generic_node (buffer, CHREC_VAR (node), spc, flags, false);
+ is_stmt = false;
+ break;
+
+ case EXPONENTIAL_CHREC:
+ pp_string (buffer, "{");
+ dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
+ pp_string (buffer, ", *, ");
+ dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
+ pp_string (buffer, "}_");
+ dump_generic_node (buffer, CHREC_VAR (node), spc, flags, false);
+ is_stmt = false;
+ break;
+
+ case PEELED_CHREC:
+ pp_string (buffer, "(");
+ dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
+ pp_string (buffer, ")_");
+ dump_generic_node (buffer, CHREC_VAR (node), spc, flags, false);
+ is_stmt = false;
+ break;
+
+ case INTERVAL_CHREC:
+ if (node == chrec_top)
+ pp_string (buffer, "[-oo, +oo]");
+ else if (node == chrec_bot)
+ pp_string (buffer, "[+oo, -oo]");
+ else if (node == chrec_not_analyzed_yet)
+ pp_string (buffer, "not_analyzed_yet");
+ else
+ {
+ pp_string (buffer, "[");
+ dump_generic_node (buffer, CHREC_LOW (node), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, CHREC_UP (node), spc, flags, false);
+ pp_string (buffer, "]");
+ }
+ is_stmt = false;
+ break;
+
default:
NIY;
}
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
new file mode 100644
index 00000000000..1daeb42aa16
--- /dev/null
+++ b/gcc/tree-scalar-evolution.c
@@ -0,0 +1,3768 @@
+/* Scalar evolution detector.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/*
+ Description:
+
+ This pass analyzes the evolution of scalar variables in loop
+ structures. The algorithm is based on the SSA representation,
+ and on the loop hierarchy tree. This algorithm is not based on
+ the notion of versions of a variable, as it was the case for the
+ previous implementations of the scalar evolution algorithm, but
+ it assumes that each defined name is unique.
+
+ A short sketch of the algorithm is:
+
+ Given a scalar variable to be analyzed, follow the SSA edge to
+ its definition:
+
+ - When the definition is a MODIFY_EXPR: if the right hand side
+ (RHS) of the definition cannot be statically analyzed, the answer
+ of the analyzer is: "don't know", that corresponds to the
+ conservative [-oo, +oo] element of the lattice of intervals.
+ Otherwise, for all the variables that are not yet analyzed in the
+ RHS, try to determine their evolution, and finally try to
+ evaluate the operation of the RHS that gives the evolution
+ function of the analyzed variable.
+
+ - When the definition is a condition-phi-node: determine the
+ evolution function for all the branches of the phi node, and
+ finally merge these evolutions (see chrec_merge).
+
+ - When the definition is a loop-phi-node: determine its initial
+ condition, that is the SSA edge defined in an outer loop, and
+ keep it symbolic. Then determine the SSA edges that are defined
+ in the body of the loop. Follow the inner edges until ending on
+ another loop-phi-node of the same analyzed loop. If the reached
+ loop-phi-node is not the starting loop-phi-node, then we keep
+ this definition under a symbolic form. If the reached
+ loop-phi-node is the same as the starting one, then we compute a
+ symbolic stride on the return path. The result is then the
+ symbolic chrec {initial_condition, +, symbolic_stride}_loop.
+
+ Examples:
+
+ Example 1: Illustration of the basic algorithm.
+
+ | a = 3
+ | loop_1
+ | b = phi (a, c)
+ | c = b + 1
+ | if (c > 10) exit_loop
+ | endloop
+
+ Suppose that we want to know the number of iterations of the
+ loop_1. The exit_loop is controlled by a COND_EXPR (c > 10). We
+ ask the scalar evolution analyzer two questions: what's the
+ scalar evolution (scev) of "c", and what's the scev of "10". For
+ "10" the answer is "10" since it is a scalar constant. For the
+ scalar variable "c", it follows the SSA edge to its definition,
+ "c = b + 1", and then asks again what's the scev of "b".
+ Following the SSA edge, we end on a loop-phi-node "b = phi (a,
+ c)", where the initial condition is "a", and the inner loop edge
+ is "c". The initial condition is kept under a symbolic form (it
+ may be the case that the copy constant propagation has done its
+ work and we end with the constant "3" as one of the edges of the
+ loop-phi-node). The update edge is followed to the end of the
+ loop, and until reaching again the starting loop-phi-node: b -> c
+ -> b. At this point we have drawn a path from "b" to "b" from
+ which we compute the stride in the loop: in this example it is
+ "+1". The resulting scev for "b" is "b -> {a, +, 1}_1". Now
+ that the scev for "b" is known, it is possible to compute the
+ scev for "c", that is "c -> {a + 1, +, 1}_1". In order to
+ determine the number of iterations in the loop_1, we have to
+ instantiate_parameters ({a + 1, +, 1}_1), that gives after some
+ more analysis the scev {4, +, 1}_1, or in other words, this is
+ the function "f (x) = x + 4", where x is the iteration count of
+ the loop_1. Now we have to solve the inequality "x + 4 > 10",
+ and take the smallest iteration number for which the loop is
+ exited: x = 7. This loop runs from x = 0 to x = 7, and in total
+ there are 8 iterations. In terms of loop normalization, we have
+ created a variable that is implicitly defined, "x" or just "_1",
+ and all the other analyzed scalars of the loop are defined in
+ function of this variable:
+
+ a -> 3
+ b -> {3, +, 1}_1
+ c -> {4, +, 1}_1
+
+ or in terms of a C program:
+
+ | a = 3
+ | for (x = 0; x <= 7; x++)
+ | {
+ | b = x + 3
+ | c = x + 4
+ | }
+
+ Example 2: Illustration of the algorithm on nested loops.
+
+ | loop_1
+ | a = phi (1, b)
+ | c = a + 2
+ | loop_2 10 times
+ | b = phi (c, d)
+ | d = b + 3
+ | endloop
+ | endloop
+
+ For analyzing the scalar evolution of "a", the algorithm follows
+ the SSA edge into the loop's body: "a -> b". "b" is an inner
+ loop-phi-node, and its analysis as in Example 1, gives:
+
+ b -> {c, +, 3}_2
+ d -> {c + 3, +, 3}_2
+
+ Following the SSA edge for the initial condition, we end on "c = a
+ + 2", and then on the starting loop-phi-node "a". From this point,
+ the loop stride is computed: back on "c = a + 2" we get a "+2" in
+ the loop_1, then on the loop-phi-node "b" we compute the overall
+ effect of the inner loop that is "b = c + 30", and we get a "+30"
+ in the loop_1. That means that the overall stride in loop_1 is
+ equal to "+32", and the result is:
+
+ a -> {1, +, 32}_1
+ c -> {3, +, 32}_1
+
+ Example 3: Higher degree polynomials.
+
+ | loop_1
+ | a = phi (2, b)
+ | c = phi (5, d)
+ | b = a + 1
+ | d = c + a
+ | endloop
+
+ a -> {2, +, 1}_1
+ b -> {3, +, 1}_1
+ c -> {5, +, a}_1
+ d -> {5 + a, +, a}_1
+
+ instantiate_parameters ({5, +, a}_1) -> {5, +, 2, +, 1}_1
+ instantiate_parameters ({5 + a, +, a}_1) -> {7, +, 3, +, 1}_1
+
+ Example 4: Lucas, Fibonacci, or mixers in general.
+
+ | loop_1
+ | a = phi (1, b)
+ | c = phi (3, d)
+ | b = c
+ | d = c + a
+ | endloop
+
+ a -> (1, c)_1
+ c -> {3, +, a}_1
+
+ The syntax "(1, c)_1" stands for a PEELED_CHREC that has the
+ following semantics: during the first iteration of the loop_1, the
+ variable contains the value 1, and then it contains the value "c".
+ Note that this syntax is close to the syntax of the loop-phi-node:
+ "a -> (1, c)_1" vs. "a = phi (1, c)".
+
+ The symbolic chrec representation contains all the semantics of the
+ original code. What is more difficult is to use this information.
+
+ Example 5: Flip-flops, or exchangers.
+
+ | loop_1
+ | a = phi (1, b)
+ | c = phi (3, d)
+ | b = c
+ | d = a
+ | endloop
+
+ a -> (1, c)_1
+ c -> (3, a)_1
+
+ Based on these symbolic chrecs, it is possible to refine this
+ information into the more precise PERIODIC_CHRECs:
+
+ a -> |1, 3|_1
+ c -> |3, 1|_1
+
+ This transformation is not yet implemented.
+
+ Further readings:
+
+ You can find a more detailed description of the algorithm in:
+ http://icps.u-strasbg.fr/~pop/DEA_03_Pop.pdf
+ http://icps.u-strasbg.fr/~pop/DEA_03_Pop.ps.gz. But note that
+ this is a preliminary report and some of the details of the
+ algorithm have changed. I'm working on a research report that
+ updates the description of the algorithms to reflect the design
+ choices used in this implementation.
+
+ A set of slides show a high level overview of the algorithm and
+ run an example through the scalar evolution analyzer:
+ http://cri.ensmp.fr/~pop/gcc/mar04/slides.pdf
+
+ Fixmes:
+
+ FIXME taylor: This FIXME concerns all the cases where we have to
+ deal with additions of exponential functions: "exp + exp" or
+ "poly + exp" or "cst + exp". This could be handled by a Taylor
+ decomposition of the exponential function, but this is still
+ under construction (not implemented yet, or chrec_top).
+
+ The idea is to represent the exponential evolution functions
+ using infinite degree polynomials:
+
+ | a -> {1, *, 2}_1 = {1, +, 1, +, 1, +, ...}_1 = {1, +, a}_1
+
+ Proof:
+ \begin{eqnarray*}
+ \{1, *, t+1\} (x) &=& exp \left(log (1) + log (t+1) \binom{x}{1} \right) \\
+ &=& (t+1)^x \\
+ &=& \binom{x}{0} + \binom{x}{1}t + \binom{x}{2}t^2 +
+ \ldots + \binom{x}{x}t^x \\
+ &=& \{1, +, t, +, t^2, +, \ldots, +, t^x\} \\
+ \end{eqnarray*}
+
+ While this equality is simple to prove for exponentials of degree
+ 1, it is still work in progress for higher degree exponentials.
+*/
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+
+/* These RTL headers are needed for basic-block.h. */
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "tree-vectorizer.h"
+#include "flags.h"
+
+static tree analyze_scalar_evolution_1 (struct loop *, tree, tree);
+
+/* The cached information about a ssa name VAR, claiming that inside LOOP,
+ the value of VAR can be expressed as CHREC. */
+
+struct scev_info_str
+{
+ tree var;
+ tree chrec;
+};
+
+/* Counters for the scev database. */
+static unsigned nb_set_scev = 0;
+static unsigned nb_get_scev = 0;
+
+/* The following trees are unique elements. Thus the comparison of
+ another element to these elements should be done on the pointer to
+ these trees, and not on their value. */
+
+/* The SSA_NAMEs that are not yet analyzed are qualified with NULL_TREE. */
+tree chrec_not_analyzed_yet;
+
+/* Reserved to the cases where the analyzer has detected an
+ undecidable property at compile time. */
+tree chrec_top;
+
+/* When the analyzer has detected that a property will never
+ happen, then it qualifies it with chrec_bot. */
+tree chrec_bot;
+
+static struct loops *current_loops;
+static varray_type already_instantiated;
+
+static htab_t scalar_evolution_info;
+
+/* Flag to indicate availability of dependency info. */
+static bool dd_info_available;
+
+
+/* Constructs a new SCEV_INFO_STR structure. */
+
+static inline struct scev_info_str *
+new_scev_info_str (tree var)
+{
+ struct scev_info_str *res;
+
+ res = xmalloc (sizeof (struct scev_info_str));
+ res->var = var;
+ res->chrec = chrec_not_analyzed_yet;
+
+ return res;
+}
+
+/* Computes a hash function for database element ELT. */
+
+static hashval_t
+hash_scev_info (const void *elt)
+{
+ return SSA_NAME_VERSION (((struct scev_info_str *) elt)->var);
+}
+
+/* Compares database elements E1 and E2. */
+
+static int
+eq_scev_info (const void *e1, const void *e2)
+{
+ const struct scev_info_str *elt1 = e1;
+ const struct scev_info_str *elt2 = e2;
+
+ return elt1->var == elt2->var;
+}
+
+/* Deletes database element E. */
+
+static void
+del_scev_info (void *e)
+{
+ free (e);
+}
+
+/* Get the index corresponding to VAR in the current LOOP. If
+ it's the first time we ask for this VAR, then we return
+ chrec_not_analysed_yet for this VAR and return its index. */
+
+static tree *
+find_var_scev_info (tree var)
+{
+ struct scev_info_str *res;
+ struct scev_info_str tmp;
+ PTR *slot;
+
+ tmp.var = var;
+ slot = htab_find_slot (scalar_evolution_info, &tmp, INSERT);
+
+ if (!*slot)
+ *slot = new_scev_info_str (var);
+ res = *slot;
+
+ return &res->chrec;
+}
+
+/* Determines whether the chrec contains symbolic names defined in
+ LOOP_NB. */
+
+bool
+chrec_contains_symbols_defined_in_loop (tree chrec, unsigned loop_nb)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (chrec) == VAR_DECL
+ || TREE_CODE (chrec) == PARM_DECL
+ || TREE_CODE (chrec) == FUNCTION_DECL
+ || TREE_CODE (chrec) == LABEL_DECL
+ || TREE_CODE (chrec) == RESULT_DECL
+ || TREE_CODE (chrec) == FIELD_DECL)
+ return true;
+
+ if (TREE_CODE (chrec) == SSA_NAME)
+ {
+ tree def = SSA_NAME_DEF_STMT (chrec);
+ struct loop *def_loop = loop_of_stmt (def);
+ struct loop *loop = loop_from_num (current_loops, loop_nb);
+
+ if (def_loop == NULL)
+ return false;
+
+ if (loop == def_loop || flow_loop_nested_p (loop, def_loop))
+ return true;
+
+ return false;
+ }
+
+ switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
+ {
+ case 3:
+ if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (chrec, 2),
+ loop_nb))
+ return true;
+
+ case 2:
+ if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (chrec, 1),
+ loop_nb))
+ return true;
+
+ case 1:
+ if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (chrec, 0),
+ loop_nb))
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+
+/* This section contains the interface to the SSA IR. */
+
+/* This function determines whether PHI is a loop-phi-node. Otherwise
+ it is a condition-phi-node. */
+
+static bool
+loop_phi_node_p (tree phi)
+{
+ /* The implementation of this function is based on the following
+ property: "all the loop-phi-nodes of a loop are contained in the
+ loop's header basic block". */
+
+ return loop_of_stmt (phi)->header == bb_for_stmt (phi);
+}
+
+/* Compute the scalar evolution for EVOLUTION_FN after crossing LOOP.
+ In general, in the case of multivariate evolutions we want to get
+ the evolution in different loops. LOOP specifies the level for
+ which to get the evolution.
+
+ Example:
+
+ | for (j = 0; j < 100; j++)
+ | {
+ | for (k = 0; k < 100; k++)
+ | {
+ | i = k + j; - Here the value of i is a function of j, k.
+ | }
+ | ... = i - Here the value of i is a function of j.
+ | }
+ | ... = i - Here the value of i is a scalar.
+
+ Example:
+
+ | i_0 = ...
+ | loop_1 10 times
+ | i_1 = phi (i_0, i_2)
+ | i_2 = i_1 + 2
+ | endloop
+
+ This loop has the same effect as:
+ LOOP_1 has the same effect as:
+
+ | i_1 = i_0 + 20
+
+ This overall effect of the loop is obtained by passing in the
+ parameters: LOOP = 1, EVOLUTION_FN {i_0, +, 2}_1.
+*/
+
+static tree
+compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn)
+{
+ bool val = false;
+
+ if (evolution_fn == chrec_top)
+ return chrec_top;
+
+ else if (TREE_CODE (evolution_fn) == POLYNOMIAL_CHREC)
+ {
+ if (CHREC_VARIABLE (evolution_fn) >= loop_num (loop))
+ {
+ struct loop *inner_loop =
+ loop_from_num (current_loops, CHREC_VARIABLE (evolution_fn));
+ tree nb_iter = number_of_iterations_in_loop (inner_loop);
+
+ if (nb_iter == chrec_top)
+ return chrec_top;
+ else
+ {
+ tree res;
+
+ /* Number of iterations is off by one (the ssa name we
+ analyze must be defined before the exit). */
+ nb_iter = chrec_fold_minus (chrec_type (nb_iter),
+ nb_iter,
+ convert (chrec_type (nb_iter),
+ integer_one_node));
+
+ /* evolution_fn is the evolution function in LOOP. Get
+ its value in the nb_iter-th iteration. */
+ res = chrec_apply (inner_loop->num, evolution_fn, nb_iter);
+
+ /* Continue the computation until ending on a parent of LOOP. */
+ return compute_overall_effect_of_inner_loop (loop, res);
+ }
+ }
+ else
+ return evolution_fn;
+ }
+
+ /* If the evolution function is an invariant, there is nothing to do. */
+ else if (no_evolution_in_loop_p (evolution_fn, loop->num, &val) && val)
+ return evolution_fn;
+
+ else
+ return chrec_top;
+}
+
+
+
+/* The following section constitutes the interface with the chrecs. */
+
+/* Determine whether the CHREC is always positive/negative. If the expression
+ cannot be statically analyzed, return false, otherwise set the answer into
+ VALUE. */
+
+bool
+chrec_is_positive (tree chrec, bool *value)
+{
+ bool value0, value1;
+ bool value2;
+ tree end_value;
+ tree nb_iter;
+
+ switch (TREE_CODE (chrec))
+ {
+ case INTERVAL_CHREC:
+ if (!chrec_is_positive (CHREC_LOW (chrec), &value0)
+ || !chrec_is_positive (CHREC_UP (chrec), &value1))
+ return false;
+
+ *value = value0;
+ return value0 == value1;
+
+ case POLYNOMIAL_CHREC:
+ case EXPONENTIAL_CHREC:
+ if (!chrec_is_positive (CHREC_LEFT (chrec), &value0)
+ || !chrec_is_positive (CHREC_RIGHT (chrec), &value1))
+ return false;
+
+ /* FIXME -- overflows. */
+ if (value0 == value1)
+ {
+ *value = value0;
+ return true;
+ }
+
+ /* Otherwise the chrec is under the form: "{-197, +, 2}_1",
+ and the proof consists in showing that the sign never
+ changes during the execution of the loop, from 0 to
+ loop_nb_iterations (). */
+ if (!evolution_function_is_affine_p (chrec))
+ return false;
+
+ nb_iter = number_of_iterations_in_loop
+ (loop_from_num (current_loops, CHREC_VARIABLE (chrec)));
+ nb_iter = chrec_fold_minus
+ (chrec_type (nb_iter), nb_iter,
+ convert (chrec_type (nb_iter), integer_one_node));
+
+#if 0
+ /* TODO -- If the test is after the exit, we may decrease the number of
+ iterations by one. */
+ if (after_exit)
+ nb_iter = chrec_fold_minus
+ (chrec_type (nb_iter), nb_iter,
+ convert (chrec_type (nb_iter), integer_one_node));
+#endif
+
+ end_value = chrec_apply (CHREC_VARIABLE (chrec), chrec, nb_iter);
+
+ if (!chrec_is_positive (end_value, &value2))
+ return false;
+
+ *value = value0;
+ return value0 == value1;
+
+ case INTEGER_CST:
+ *value = (tree_int_cst_sgn (chrec) == 1);
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Associate CHREC to SCALAR. */
+
+static void
+set_scalar_evolution (tree scalar, tree chrec)
+{
+ tree *scalar_info;
+
+ if (TREE_CODE (scalar) != SSA_NAME)
+ return;
+
+ scalar_info = find_var_scev_info (scalar);
+
+ if (dump_file)
+ {
+ if (dump_flags & TDF_DETAILS)
+ {
+ fprintf (dump_file, "(set_scalar_evolution \n");
+ fprintf (dump_file, " (scalar = ");
+ print_generic_expr (dump_file, scalar, 0);
+ fprintf (dump_file, ")\n (scalar_evolution = ");
+ print_generic_expr (dump_file, chrec, 0);
+ fprintf (dump_file, "))\n");
+ }
+ if (dump_flags & TDF_STATS)
+ nb_set_scev++;
+ }
+
+ *scalar_info = chrec;
+}
+
+/* Retrieve the chrec associated to SCALAR in the LOOP. */
+
+static tree
+get_scalar_evolution (tree scalar)
+{
+ tree res;
+
+ if (dump_file)
+ {
+ if (dump_flags & TDF_DETAILS)
+ {
+ fprintf (dump_file, "(get_scalar_evolution \n");
+ fprintf (dump_file, " (scalar = ");
+ print_generic_expr (dump_file, scalar, 0);
+ fprintf (dump_file, ")\n");
+ }
+ if (dump_flags & TDF_STATS)
+ nb_get_scev++;
+ }
+
+ switch (TREE_CODE (scalar))
+ {
+ case SSA_NAME:
+ res = *find_var_scev_info (scalar);
+ break;
+
+ case REAL_CST:
+ case INTEGER_CST:
+ res = scalar;
+ break;
+
+ default:
+ res = chrec_not_analyzed_yet;
+ break;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (scalar_evolution = ");
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ return res;
+}
+
+/* When CHREC_BEFORE has an evolution part in LOOP_NB, add to this
+ evolution the expression TO_ADD, otherwise construct an evolution
+ part for this loop. */
+
+static tree
+add_to_evolution_1 (unsigned loop_nb,
+ tree chrec_before,
+ tree to_add)
+{
+ switch (TREE_CODE (chrec_before))
+ {
+ case POLYNOMIAL_CHREC:
+ if (CHREC_VARIABLE (chrec_before) <= loop_nb)
+ {
+ unsigned var;
+ tree left, right;
+ tree type = chrec_type (chrec_before);
+
+ /* When there is no evolution part in this loop, build it. */
+ if (CHREC_VARIABLE (chrec_before) < loop_nb)
+ {
+ var = loop_nb;
+ left = chrec_before;
+ right = convert (type, integer_zero_node);
+ }
+ else
+ {
+ var = CHREC_VARIABLE (chrec_before);
+ left = CHREC_LEFT (chrec_before);
+ right = CHREC_RIGHT (chrec_before);
+ }
+
+ return build_polynomial_chrec
+ (var, left, chrec_fold_plus (type, right, to_add));
+ }
+ else
+ /* Search the evolution in LOOP_NB. */
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec_before),
+ add_to_evolution_1 (loop_nb, CHREC_LEFT (chrec_before), to_add),
+ CHREC_RIGHT (chrec_before));
+
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec_before) == loop_nb)
+ /* We still don't know how to fold these operations that mix
+ polynomial and exponential functions. For the moment, give
+ a rough approximation: [-oo, +oo]. */
+ return build_exponential_chrec (loop_nb, CHREC_LEFT (chrec_before),
+ chrec_top);
+
+ /* When there is no evolution part in this loop, build it. */
+ else if (CHREC_VARIABLE (chrec_before) < loop_nb)
+ return build_polynomial_chrec (loop_nb, chrec_before, to_add);
+
+ else
+ return build_exponential_chrec
+ (CHREC_VARIABLE (chrec_before),
+ add_to_evolution_1 (loop_nb, CHREC_LEFT (chrec_before), to_add),
+ CHREC_RIGHT (chrec_before));
+
+ default:
+ /* These nodes do not depend on a loop. */
+ if (chrec_before == chrec_top)
+ return chrec_top;
+ return build_polynomial_chrec (loop_nb, chrec_before, to_add);
+ }
+}
+
+/* Add TO_ADD to the evolution part of CHREC_BEFORE in the dimension
+ of LOOP_NB.
+
+ Description (provided for completeness, for those who read code in
+ a plane, and for my poor 62 bytes brain that would have forgotten
+ all this in the next two or three months):
+
+ The algorithm of translation of programs from the SSA representation
+ into the chrecs syntax is based on a pattern matching. After having
+ reconstructed the overall tree expression for a loop, there are only
+ two cases that can arise:
+
+ 1. a = loop-phi (init, a + expr)
+ 2. a = loop-phi (init, expr)
+
+ where EXPR is either a scalar constant with respect to the analyzed
+ loop (this is a degree 0 polynomial), or an expression containing
+ other loop-phi definitions (these are higher degree polynomials).
+
+ Examples:
+
+ 1.
+ | init = ...
+ | loop_1
+ | a = phi (init, a + 5)
+ | endloop
+
+ 2.
+ | inita = ...
+ | initb = ...
+ | loop_1
+ | a = phi (inita, 2 * b + 3)
+ | b = phi (initb, b + 1)
+ | endloop
+
+ For the first case, the semantics of the SSA representation is:
+
+ | a (x) = init + \sum_{j = 0}^{x - 1} expr (j)
+
+ that is, there is a loop index "x" that determines the scalar value
+ of the variable during the loop execution. During the first
+ iteration, the value is that of the initial condition INIT, while
+ during the subsequent iterations, it is the sum of the initial
+ condition with the sum of all the values of EXPR from the initial
+ iteration to the before last considered iteration.
+
+ For the second case, the semantics of the SSA program is:
+
+ | a (x) = init, if x = 0;
+ | expr (x - 1), otherwise.
+
+ The second case corresponds to the PEELED_CHREC, whose syntax is
+ close to the syntax of a loop-phi-node:
+
+ | phi (init, expr) vs. (init, expr)_x
+
+ The proof of the translation algorithm for the first case is a
+ proof by structural induction based on the degree of EXPR.
+
+ Degree 0:
+ When EXPR is a constant with respect to the analyzed loop, or in
+ other words when EXPR is a polynomial of degree 0, the evolution of
+ the variable A in the loop is an affine function with an initial
+ condition INIT, and a step EXPR. In order to show this, we start
+ from the semantics of the SSA representation:
+
+ f (x) = init + \sum_{j = 0}^{x - 1} expr (j)
+
+ and since "expr (j)" is a constant with respect to "j",
+
+ f (x) = init + x * expr
+
+ Finally, based on the semantics of the pure sum chrecs, by
+ identification we get the corresponding chrecs syntax:
+
+ f (x) = init * \binom{x}{0} + expr * \binom{x}{1}
+ f (x) -> {init, +, expr}_x
+
+ Higher degree:
+ Suppose that EXPR is a polynomial of degree N with respect to the
+ analyzed loop_x for which we have already determined that it is
+ written under the chrecs syntax:
+
+ | expr (x) -> {b_0, +, b_1, +, ..., +, b_{n-1}} (x)
+
+ We start from the semantics of the SSA program:
+
+ | f (x) = init + \sum_{j = 0}^{x - 1} expr (j)
+ |
+ | f (x) = init + \sum_{j = 0}^{x - 1}
+ | (b_0 * \binom{j}{0} + ... + b_{n-1} * \binom{j}{n-1})
+ |
+ | f (x) = init + \sum_{j = 0}^{x - 1}
+ | \sum_{k = 0}^{n - 1} (b_k * \binom{j}{k})
+ |
+ | f (x) = init + \sum_{k = 0}^{n - 1}
+ | (b_k * \sum_{j = 0}^{x - 1} \binom{j}{k})
+ |
+ | f (x) = init + \sum_{k = 0}^{n - 1}
+ | (b_k * \binom{x}{k + 1})
+ |
+ | f (x) = init + b_0 * \binom{x}{1} + ...
+ | + b_{n-1} * \binom{x}{n}
+ |
+ | f (x) = init * \binom{x}{0} + b_0 * \binom{x}{1} + ...
+ | + b_{n-1} * \binom{x}{n}
+ |
+
+ And finally from the definition of the chrecs syntax, we identify:
+ | f (x) -> {init, +, b_0, +, ..., +, b_{n-1}}_x
+
+ This shows the mechanism that stands behind the add_to_evolution
+ function. An important point is that the use of symbolic
+ parameters avoids the need of an analysis schedule.
+
+ Example:
+
+ | inita = ...
+ | initb = ...
+ | loop_1
+ | a = phi (inita, a + 2 + b)
+ | b = phi (initb, b + 1)
+ | endloop
+
+ When analyzing "a", the algorithm keeps "b" symbolically:
+
+ | a -> {inita, +, 2 + b}_1
+
+ Then, after instantiation, the analyzer ends on the evolution:
+
+ | a -> {inita, +, 2 + initb, +, 1}_1
+
+*/
+
+static tree
+add_to_evolution (unsigned loop_nb,
+ tree chrec_before,
+ enum tree_code code,
+ tree to_add)
+{
+ tree type = chrec_type (to_add);
+ tree res = NULL_TREE;
+
+ if (to_add == NULL_TREE)
+ return chrec_before;
+
+ /* TO_ADD is either a scalar, or a parameter. TO_ADD is not
+ instantiated at this point. */
+ if (TREE_CODE (to_add) == POLYNOMIAL_CHREC
+ || TREE_CODE (to_add) == EXPONENTIAL_CHREC)
+ /* This should not happen. */
+ return chrec_top;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(add_to_evolution \n");
+ fprintf (dump_file, " (loop_nb = %d)\n", loop_nb);
+ fprintf (dump_file, " (chrec_before = ");
+ print_generic_expr (dump_file, chrec_before, 0);
+ fprintf (dump_file, ")\n (to_add = ");
+ print_generic_expr (dump_file, to_add, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ if (code == MINUS_EXPR)
+ to_add = chrec_fold_multiply (type, to_add,
+ convert (type, integer_minus_one_node));
+
+ res = add_to_evolution_1 (loop_nb, chrec_before, to_add);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (res = ");
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ return res;
+}
+
+/* When CHREC_BEFORE has an evolution part in LOOP_NB, multiply its
+ evolution by the expression TO_MULT, otherwise construct an
+ evolution part for this loop. */
+
+static tree
+multiply_evolution_1 (unsigned loop_nb,
+ tree chrec_before,
+ tree to_mult)
+{
+ if (chrec_before == chrec_not_analyzed_yet)
+ return chrec_not_analyzed_yet;
+
+ switch (TREE_CODE (chrec_before))
+ {
+ case POLYNOMIAL_CHREC:
+ if (CHREC_VARIABLE (chrec_before) == loop_nb)
+ /* We still don't know how to fold these operations that mix
+ polynomial and exponential functions. For the moment, give
+ a rough approximation: [-oo, +oo]. */
+ return build_polynomial_chrec (loop_nb, CHREC_LEFT (chrec_before),
+ chrec_top);
+
+ /* When there is no evolution part in this loop, build it. */
+ else if (CHREC_VARIABLE (chrec_before) < loop_nb)
+ return build_exponential_chrec (loop_nb, chrec_before, to_mult);
+
+ else
+ return build_polynomial_chrec
+ (CHREC_VARIABLE (chrec_before),
+ multiply_evolution_1 (loop_nb, CHREC_LEFT (chrec_before), to_mult),
+ CHREC_RIGHT (chrec_before));
+
+ case EXPONENTIAL_CHREC:
+ if (CHREC_VARIABLE (chrec_before) == loop_nb
+ /* The evolution has to be multiplied on the leftmost position for
+ loop_nb. */
+ && ((TREE_CODE (CHREC_LEFT (chrec_before)) != POLYNOMIAL_CHREC
+ && TREE_CODE (CHREC_LEFT (chrec_before)) != EXPONENTIAL_CHREC)
+ || (CHREC_VARIABLE (CHREC_LEFT (chrec_before)) != loop_nb)))
+ return build_exponential_chrec
+ (loop_nb,
+ CHREC_LEFT (chrec_before),
+ chrec_fold_multiply (chrec_type (to_mult),
+ CHREC_RIGHT (chrec_before), to_mult));
+
+ else if (CHREC_VARIABLE (chrec_before) < loop_nb)
+ return build_exponential_chrec (loop_nb, chrec_before, to_mult);
+
+ else
+ return build_exponential_chrec
+ (CHREC_VARIABLE (chrec_before),
+ multiply_evolution_1 (loop_nb, CHREC_LEFT (chrec_before), to_mult),
+ CHREC_RIGHT (chrec_before));
+
+ default:
+ /* These nodes do not depend on a loop. */
+ return build_exponential_chrec (loop_nb, chrec_before, to_mult);
+ }
+}
+
+/* Add TO_MULT to the evolution part of CHREC_BEFORE in the dimension
+ of LOOP_NB. */
+
+static tree
+multiply_evolution (unsigned loop_nb,
+ tree chrec_before,
+ tree to_mult)
+{
+ tree res = NULL_TREE;
+
+ if (to_mult == chrec_not_analyzed_yet)
+ return chrec_before;
+
+ /* TO_MULT is either a scalar, or a parameter. TO_MULT is not
+ instantiated at this point. */
+ if (TREE_CODE (to_mult) == POLYNOMIAL_CHREC
+ || TREE_CODE (to_mult) == EXPONENTIAL_CHREC)
+ /* This should not happen. */
+ return chrec_top;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(multiply_evolution \n");
+ fprintf (dump_file, " (loop_nb = %d)\n", loop_nb);
+ fprintf (dump_file, " (chrec_before = ");
+ print_generic_expr (dump_file, chrec_before, 0);
+ fprintf (dump_file, ")\n (to_mult = ");
+ print_generic_expr (dump_file, to_mult, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ res = multiply_evolution_1 (loop_nb, chrec_before, to_mult);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (res = ");
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ return res;
+}
+
+
+
+/* This section deals with the approximation of the number of
+ iterations a loop will run. */
+
+/* Helper function that determines whether the considered types are
+ compatible for finding a solution. */
+#if 0
+static bool
+types_forbid_solutions_p (enum tree_code code,
+ tree type0,
+ tree type1)
+{
+ switch (code)
+ {
+ case LE_EXPR:
+ return tree_is_le (TYPE_MAX_VALUE (type0),
+ TYPE_MIN_VALUE (type1));
+
+ case LT_EXPR:
+ return tree_is_lt (TYPE_MAX_VALUE (type0),
+ TYPE_MIN_VALUE (type1));
+
+ case EQ_EXPR:
+ return false;
+
+ case NE_EXPR:
+ return (tree_is_lt (TYPE_MAX_VALUE (type0),
+ TYPE_MIN_VALUE (type1))
+ || tree_is_lt (TYPE_MAX_VALUE (type1),
+ TYPE_MIN_VALUE (type0)));
+
+ default:
+ abort ();
+ return false;
+ }
+}
+#endif
+
+/* Helper function for the case when both evolution functions don't
+ have an evolution in the considered loop. */
+
+static tree
+first_iteration_non_satisfying_noev_noev (enum tree_code code,
+ unsigned loop_nb ATTRIBUTE_UNUSED,
+ tree chrec0,
+ tree chrec1)
+{
+ tree init0 = initial_condition (chrec0);
+ tree init1 = initial_condition (chrec1);
+
+ if (TREE_CODE (init0) != INTEGER_CST
+ || TREE_CODE (init1) != INTEGER_CST)
+ return chrec_top;
+
+ if (!evolution_function_is_constant_p (chrec0)
+ || !evolution_function_is_constant_p (chrec1))
+ return chrec_top;
+
+ switch (code)
+ {
+ case LE_EXPR:
+ if (tree_is_gt (init0, init1))
+ return integer_zero_node;
+ else
+ return chrec_bot;
+
+ case LT_EXPR:
+ if (tree_is_ge (init0, init1))
+ return integer_zero_node;
+ else
+ return chrec_bot;
+
+ case EQ_EXPR:
+ if (tree_is_eq (init0, init1))
+ return integer_zero_node;
+ else
+ return chrec_bot;
+
+ case NE_EXPR:
+ if (tree_is_ne (init0, init1))
+ return integer_zero_node;
+ else
+ return chrec_bot;
+
+ default:
+ return chrec_top;
+ }
+}
+
+/* Helper function for the case when CHREC0 has no evolution and
+ CHREC1 has an evolution in the considered loop. */
+
+static tree
+first_iteration_non_satisfying_noev_ev (enum tree_code code,
+ unsigned loop_nb,
+ tree chrec0,
+ tree chrec1)
+{
+ tree type1 = chrec_type (chrec1);
+ /* tree tmax = TYPE_MAX_VALUE (type1); */
+ tree ev_in_this_loop;
+ tree init0, init1, step1;
+ tree nb_iters;
+
+ ev_in_this_loop = hide_evolution_in_other_loops_than_loop (chrec1, loop_nb);
+ if (!evolution_function_is_affine_p (ev_in_this_loop))
+ /* For the moment handle only polynomials of degree 1. */
+ return chrec_top;
+
+ init1 = CHREC_LEFT (ev_in_this_loop);
+ step1 = CHREC_RIGHT (ev_in_this_loop);
+ init0 = initial_condition (chrec0);
+ if (TREE_CODE (init0) != INTEGER_CST
+ || TREE_CODE (init1) != INTEGER_CST
+ || TREE_CODE (step1) != INTEGER_CST)
+ /* For the moment we deal only with INTEGER_CSTs. */
+ return chrec_top;
+
+ switch (code)
+ {
+ case LE_EXPR:
+ {
+ if (tree_is_gt (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (2 <= {0, +, 1}_2)". */
+ return integer_zero_node;
+ else
+ /* Example: "while ({2, +, -1}_1 <= {0, +, 1}_2)". The
+ number of iterations in loop_2 during the first two
+ iterations of loop_1 is equal to 0. */
+ return chrec_top;
+ }
+
+ if (tree_int_cst_sgn (step1) > 0)
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (2 <= {3, +, 1}_2)". */
+ return chrec_top;
+ /* nb_iters = tree_fold_plus
+ (integer_type_node,
+ tree_fold_floor_div (integer_type_node,
+ tree_fold_minus (integer_type_node,
+ tmax, init1),
+ step1),
+ integer_one_node);
+ */
+ else
+ /* Example: "while ({2, +, 1}_1 <= {3, +, 1}_2)". */
+ return chrec_top;
+ }
+
+ else
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (2 <= {3, +, -1}_2)". */
+ nb_iters = tree_fold_plus
+ (integer_type_node,
+ tree_fold_floor_div (integer_type_node,
+ tree_fold_minus (integer_type_node,
+ init1, init0),
+ tree_fold_abs (integer_type_node,
+ step1)),
+ integer_one_node);
+ else
+ /* Example: "while ({2, +, 1}_1 <= {3, +, -1}_2)". */
+ return chrec_top;
+ }
+
+ /* Verify the result. */
+ if (evolution_function_is_constant_p (chrec0)
+ && tree_is_gt (init0,
+ tree_fold_plus (type1, init1,
+ tree_fold_multiply
+ (integer_type_node,
+ nb_iters, step1))))
+ return nb_iters;
+
+ else
+ /* Difficult cases fall down there. Example: When the
+ evolution step is big enough the wrapped value can be
+ bigger than init0. In these cases the loop may end after
+ several wraps, or never end. */
+ return chrec_top;
+ }
+
+ case LT_EXPR:
+ {
+ if (tree_is_ge (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (2 < {0, +, 1}_2)". */
+ return integer_zero_node;
+ else
+ /* Example: "while ({2, +, 1}_1 < {0, +, 1}_2)". */
+ return chrec_top;
+ }
+
+ if (tree_int_cst_sgn (step1) > 0)
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (2 < {3, +, 1}_2)". */
+ return chrec_top;
+ /* nb_iters = tree_fold_ceil_div
+ (integer_type_node,
+ tree_fold_minus (integer_type_node, tmax, init1),
+ step1);
+ */
+ else
+ /* Example: "while ({2, +, 1}_1 < {3, +, 1}_2)". */
+ return chrec_top;
+ }
+ else
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (2 < {3, +, -1}_2)". */
+ nb_iters = tree_fold_ceil_div
+ (integer_type_node,
+ tree_fold_minus (type1, init1, init0),
+ tree_fold_abs (type1, step1));
+ else
+ /* Example: "while ({2, +, 1}_1 < {3, +, -1}_2)". */
+ return chrec_top;
+ }
+
+ /* Verify the result. */
+ if (evolution_function_is_constant_p (chrec0)
+ && tree_is_ge (init0,
+ tree_fold_plus (type1, init1,
+ tree_fold_multiply
+ (integer_type_node,
+ nb_iters, step1))))
+ return nb_iters;
+
+ else
+ /* Difficult cases fall down there. */
+ return chrec_top;
+ }
+
+ case EQ_EXPR:
+ {
+ if (tree_is_ne (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (2 == {0, +, 1}_2)". */
+ return integer_zero_node;
+ else
+ /* Example: "while ({2, +, -1}_1 == {0, +, 1}_2)". */
+ return chrec_top;
+ }
+
+ if (evolution_function_is_constant_p (chrec0))
+ {
+ if (integer_zerop (step1))
+ /* Example: "while (2 == {2, +, 0}_2)". */
+ return chrec_bot;
+ else
+ return integer_one_node;
+ }
+ else
+ return chrec_top;
+ }
+
+ case NE_EXPR:
+ {
+ if (tree_is_eq (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ /* Example: "while (0 != {0, +, 1}_2)". */
+ return integer_zero_node;
+ else
+ /* Example: "while ({0, +, -1}_1 != {0, +, 1}_2)". */
+ return chrec_top;
+ }
+
+ if (tree_int_cst_sgn (step1) > 0)
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ {
+ if (tree_is_gt (init0, init1))
+ {
+ tree diff = tree_fold_minus (integer_type_node,
+ init0, init1);
+ if (tree_fold_divides_p (integer_type_node, step1, diff))
+ /* Example: "while (3 != {2, +, 1}_2)". */
+ nb_iters = tree_fold_exact_div
+ (integer_type_node, diff, step1);
+ else
+ /* Example: "while (3 != {2, +, 2}_2)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while (2 != {3, +, 1}_2)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while ({2, +, 1}_1 != {3, +, 1}_2)". */
+ return chrec_top;
+ }
+
+ else
+ {
+ if (evolution_function_is_constant_p (chrec0))
+ {
+ if (tree_is_lt (init0, init1))
+ {
+ tree diff = tree_fold_minus (integer_type_node,
+ init1, init0);
+ if (tree_fold_divides_p (integer_type_node, step1, diff))
+ /* Example: "while (2 != {3, +, -1}_2)". */
+ nb_iters = tree_fold_exact_div
+ (integer_type_node, diff,
+ tree_fold_abs (integer_type_node, step1));
+ else
+ /* Example: "while (2 != {3, +, -2}_2)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while (3 != {2, +, -1}_2)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while ({2, +, 1}_1 != {3, +, -1}_2)". */
+ return chrec_top;
+ }
+
+ /* Verify the result. */
+ if (evolution_function_is_constant_p (chrec0)
+ && tree_is_eq (init0,
+ tree_fold_plus (type1, init1,
+ tree_fold_multiply
+ (integer_type_node,
+ nb_iters, step1))))
+ return nb_iters;
+
+ else
+ /* Difficult cases fall down there. */
+ return chrec_top;
+ }
+
+ default:
+ return chrec_top;
+ }
+ return chrec_top;
+}
+
+/* Helper function for the case when CHREC1 has no evolution and
+ CHREC0 has an evolution in the considered loop. */
+
+static tree
+first_iteration_non_satisfying_ev_noev (enum tree_code code,
+ unsigned loop_nb,
+ tree chrec0,
+ tree chrec1)
+{
+ tree type0 = chrec_type (chrec0);
+ /* tree tmin = TYPE_MIN_VALUE (type0); */
+ tree ev_in_this_loop;
+ tree init0, init1, step0;
+ tree nb_iters;
+
+ ev_in_this_loop = hide_evolution_in_other_loops_than_loop (chrec0, loop_nb);
+ if (!evolution_function_is_affine_p (ev_in_this_loop))
+ /* For the moment handle only polynomials of degree 1. */
+ return chrec_top;
+
+ init0 = CHREC_LEFT (ev_in_this_loop);
+ step0 = CHREC_RIGHT (ev_in_this_loop);
+ init1 = initial_condition (chrec1);
+ if (TREE_CODE (init1) != INTEGER_CST
+ || TREE_CODE (init0) != INTEGER_CST
+ || TREE_CODE (step0) != INTEGER_CST)
+ /* For the moment we deal only with INTEGER_CSTs. */
+ return chrec_top;
+
+ switch (code)
+ {
+ case LE_EXPR:
+ {
+ if (tree_is_gt (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({2, +, 1}_2 <= 0)". */
+ return integer_zero_node;
+
+ else
+ /* Example: "while ({2, +, 1}_2 <= {0, +, 1}_1)". */
+ return chrec_top;
+ }
+
+ if (tree_int_cst_sgn (step0) < 0)
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({2, +, -1}_2 <= 3)". */
+ return chrec_top;
+ /* nb_iters = tree_fold_plus
+ (integer_type_node,
+ tree_fold_floor_div (integer_type_node,
+ tree_fold_minus (integer_type_node,
+ init0, tmin),
+ tree_fold_abs (integer_type_node,
+ step0)),
+ integer_one_node);
+ */
+ else
+ /* Example: "while ({2, +, -1}_2 <= {3, +, 1}_1)". */
+ return chrec_top;
+ }
+ else
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({2, +, 1}_2 <= 3)". */
+ nb_iters = tree_fold_plus
+ (integer_type_node,
+ tree_fold_floor_div (integer_type_node,
+ tree_fold_minus (integer_type_node,
+ init1, init0),
+ step0),
+ integer_one_node);
+ else
+ /* Example: "while ({2, +, 1}_2 <= {3, +, 1}_1)". */
+ return chrec_top;
+ }
+
+ /* Verify the result. */
+ if (evolution_function_is_constant_p (chrec1)
+ && tree_is_gt (tree_fold_plus (type0, init0,
+ tree_fold_multiply
+ (integer_type_node,
+ nb_iters, step0)),
+ init1))
+ return nb_iters;
+
+ else
+ /* Difficult cases fall down there. */
+ return chrec_top;
+ }
+
+ case LT_EXPR:
+ {
+ if (tree_is_ge (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({2, +, 1}_2 < 0)". */
+ return integer_zero_node;
+
+ else
+ /* Example: "while ({2, +, 1}_2 < {0, +, 1}_1)". */
+ return chrec_top;
+ }
+
+ if (tree_int_cst_sgn (step0) < 0)
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({2, +, -1}_2 < 3)". */
+ return chrec_top;
+ /* nb_iters = tree_fold_ceil_div
+ (integer_type_node,
+ tree_fold_minus (integer_type_node, init0, tmin),
+ tree_fold_abs (integer_type_node, step0));
+ */
+ else
+ /* Example: "while ({2, +, -1}_2 < {3, +, 1}_1)". */
+ return chrec_top;
+ }
+ else
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({2, +, 1}_2 < 3)". */
+ nb_iters = tree_fold_ceil_div
+ (integer_type_node,
+ tree_fold_minus (integer_type_node, init1, init0),
+ step0);
+ else
+ /* Example: "while ({2, +, 1}_2 < {3, +, 1}_1)". */
+ return chrec_top;
+ }
+
+ /* Verify the result. */
+ if (evolution_function_is_constant_p (chrec1)
+ && tree_is_ge (tree_fold_plus (type0, init0,
+ tree_fold_multiply
+ (integer_type_node,
+ nb_iters, step0)),
+ init1))
+ return nb_iters;
+
+ else
+ /* Difficult cases fall down there. */
+ return chrec_top;
+ }
+
+ case EQ_EXPR:
+ {
+ if (tree_is_ne (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({2, +, 1}_2 == 0)". */
+ return integer_zero_node;
+ else
+ /* Example: "while ({2, +, -1}_2 == {0, +, 1}_1)". */
+ return chrec_top;
+ }
+
+ if (evolution_function_is_constant_p (chrec1))
+ {
+ if (integer_zerop (step0))
+ /* Example: "while ({2, +, 0}_2 == 2)". */
+ return chrec_bot;
+ else
+ return integer_one_node;
+ }
+ else
+ return chrec_top;
+ }
+
+ case NE_EXPR:
+ {
+ if (tree_is_eq (init0, init1))
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ /* Example: "while ({0, +, 1}_2 != 0)". */
+ return integer_zero_node;
+ else
+ /* Example: "while ({0, +, -1}_2 != {0, +, 1}_1)". */
+ return chrec_top;
+ }
+
+ if (tree_int_cst_sgn (step0) > 0)
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ {
+ if (tree_is_lt (init0, init1))
+ {
+ tree diff = tree_fold_minus (integer_type_node,
+ init1, init0);
+ if (tree_fold_divides_p (integer_type_node, step0, diff))
+ /* Example: "while ({2, +, 1}_2 != 3)". */
+ nb_iters = tree_fold_exact_div
+ (integer_type_node, diff, step0);
+ else
+ /* Example: "while ({2, +, 2}_2 != 3)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while ({3, +, 1}_2 != 2)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while ({2, +, 1}_2 != {3, +, 1}_1)". */
+ return chrec_top;
+ }
+
+ else
+ {
+ if (evolution_function_is_constant_p (chrec1))
+ {
+ if (tree_is_gt (init0, init1))
+ {
+ tree diff = tree_fold_minus (integer_type_node,
+ init0, init1);
+ if (tree_fold_divides_p (integer_type_node, step0, diff))
+ /* Example: "while ({3, +, -1}_2 != 2)". */
+ nb_iters = tree_fold_exact_div
+ (integer_type_node, diff,
+ tree_fold_abs (integer_type_node, step0));
+ else
+ /* Example: "while ({3, +, -2}_2 != 2)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while ({2, +, -1}_2 != 3)". */
+ return chrec_top;
+ }
+ else
+ /* Example: "while ({2, +, -1}_2 != {3, +, -1}_1)". */
+ return chrec_top;
+ }
+
+ /* Verify the result. */
+ if (evolution_function_is_constant_p (chrec1)
+ && tree_is_eq (tree_fold_plus (type0, init0,
+ tree_fold_multiply
+ (integer_type_node,
+ nb_iters, step0)),
+ init1))
+ return nb_iters;
+ else
+ /* Difficult cases fall down there. */
+ return chrec_top;
+ }
+
+ default:
+ return chrec_top;
+ }
+
+ return chrec_top;
+}
+
+/* Helper function for the case when both CHREC0 and CHREC1 has an
+ evolution in the considered loop. */
+
+static tree
+first_iteration_non_satisfying_ev_ev (enum tree_code code,
+ unsigned loop_nb ATTRIBUTE_UNUSED,
+ tree chrec0 ATTRIBUTE_UNUSED,
+ tree chrec1 ATTRIBUTE_UNUSED)
+{
+ switch (code)
+ {
+ case LE_EXPR:
+
+ case LT_EXPR:
+
+ case EQ_EXPR:
+
+ case NE_EXPR:
+
+ default:
+ return chrec_top;
+ }
+
+ return chrec_top;
+}
+
+/* Helper function. */
+
+static tree
+first_iteration_non_satisfying_1 (enum tree_code code,
+ unsigned loop_nb,
+ tree chrec0,
+ tree chrec1)
+{
+ bool val = false;
+ tree res, other_evs;
+
+ if (automatically_generated_chrec_p (chrec0)
+ || automatically_generated_chrec_p (chrec1))
+ return chrec_top;
+
+ if (!no_evolution_in_loop_p (chrec0, loop_nb, &val))
+ return chrec_top;
+
+ else if (val)
+ {
+ if (!no_evolution_in_loop_p (chrec1, loop_nb, &val))
+ return chrec_top;
+
+ else if (val)
+ return first_iteration_non_satisfying_noev_noev (code, loop_nb,
+ chrec0, chrec1);
+ else
+ {
+ res = first_iteration_non_satisfying_noev_ev (code, loop_nb,
+ chrec0, chrec1);
+ if (res == chrec_top)
+ return res;
+
+ other_evs = hide_evolution_in_loop (chrec1, loop_nb);
+ other_evs = chrec_replace_initial_condition
+ (other_evs, convert (chrec_type (other_evs), integer_zero_node));
+ }
+ }
+
+ else
+ {
+ if (!no_evolution_in_loop_p (chrec1, loop_nb, &val))
+ return chrec_top;
+
+ else if (val)
+ {
+ res = first_iteration_non_satisfying_ev_noev (code, loop_nb,
+ chrec0, chrec1);
+ if (res == chrec_top)
+ return res;
+
+ other_evs = hide_evolution_in_loop (chrec0, loop_nb);
+ other_evs = chrec_replace_initial_condition
+ (other_evs, convert (chrec_type (other_evs), integer_zero_node));
+ }
+ else
+ return first_iteration_non_satisfying_ev_ev (code, loop_nb,
+ chrec0, chrec1);
+ }
+
+ res = chrec_fold_minus (chrec_type (res), res, other_evs);
+ return res;
+}
+
+/* Try to compute the first iteration I of LOOP_NB that does not satisfy
+ CODE: in the context of the computation of the number of iterations:
+ - if (CODE is LE_EXPR) the loop exits when CHREC0 (I) > CHREC1 (I),
+ - if (CODE is LT_EXPR) the loop exits when CHREC0 (I) >= CHREC1 (I),
+ - if (CODE is EQ_EXPR) the loop exits when CHREC0 (I) != CHREC1 (I),
+ ...
+
+ The result is one of the following:
+ - CHREC_TOP when the analyzer cannot determine the property,
+ - CHREC_BOT when the property is always true,
+ - an INTEGER_CST tree node,
+ - a CHREC,
+ - an expression containing SSA_NAMEs.
+*/
+
+tree
+first_iteration_non_satisfying (enum tree_code code,
+ unsigned loop_nb,
+ tree chrec0,
+ tree chrec1)
+{
+ switch (code)
+ {
+ case LT_EXPR:
+ return first_iteration_non_satisfying_1 (LT_EXPR, loop_nb,
+ chrec0, chrec1);
+
+ case LE_EXPR:
+ return first_iteration_non_satisfying_1 (LE_EXPR, loop_nb,
+ chrec0, chrec1);
+
+ case GT_EXPR:
+ return first_iteration_non_satisfying_1 (LT_EXPR, loop_nb,
+ chrec1, chrec0);
+
+ case GE_EXPR:
+ return first_iteration_non_satisfying_1 (LE_EXPR, loop_nb,
+ chrec1, chrec0);
+
+ case EQ_EXPR:
+ return first_iteration_non_satisfying_1 (EQ_EXPR, loop_nb,
+ chrec0, chrec1);
+
+ case NE_EXPR:
+ return first_iteration_non_satisfying_1 (NE_EXPR, loop_nb,
+ chrec0, chrec1);
+
+ default:
+ return chrec_top;
+ }
+}
+
+/* Helper function. */
+
+static inline tree
+set_nb_iterations_in_loop (struct loop *loop,
+ tree res)
+{
+ /* After the loop copy headers has transformed the code, each loop
+ runs at least once. */
+ res = chrec_fold_plus (chrec_type (res), res, integer_one_node);
+ /* FIXME HWI: However we want to store one iteration less than the
+ count of the loop in order to be compatible with the other
+ nb_iter computations in loop-iv. This also allows the
+ representation of nb_iters that are equal to MAX_INT. */
+ if (TREE_CODE (res) == INTEGER_CST
+ && TREE_INT_CST_LOW (res) == 0)
+ res = chrec_top;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (set_nb_iterations_in_loop = ");
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ loop->nb_iterations = res;
+ return res;
+}
+
+
+
+/* This section selects the loops that will be good candidates for the
+ scalar evolution analysis.
+
+ Note: This section will be rewritten to expose a better interface
+ to other client passes. For the moment, greedily select all the
+ loop nests we could analyze. */
+
+/* Determine whether it is possible to analyze this condition
+ expression. */
+
+static bool
+analyzable_condition (tree expr)
+{
+ tree condition;
+
+ if (TREE_CODE (expr) != COND_EXPR)
+ return false;
+
+ condition = TREE_OPERAND (expr, 0);
+
+ switch (TREE_CODE (condition))
+ {
+ case SSA_NAME:
+ /* Volatile expressions are not analyzable. */
+ if (TREE_THIS_VOLATILE (SSA_NAME_VAR (condition)))
+ return false;
+ return true;
+
+ case LT_EXPR:
+ case LE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ {
+ tree opnd0, opnd1;
+
+ opnd0 = TREE_OPERAND (condition, 0);
+ opnd1 = TREE_OPERAND (condition, 1);
+
+ if (TREE_CODE (opnd0) == SSA_NAME
+ && TREE_THIS_VOLATILE (SSA_NAME_VAR (opnd0)))
+ return false;
+
+ if (TREE_CODE (opnd1) == SSA_NAME
+ && TREE_THIS_VOLATILE (SSA_NAME_VAR (opnd1)))
+ return false;
+
+ return true;
+ }
+
+ default:
+ return false;
+ }
+
+ return false;
+}
+
+/* For a loop with a single exit edge, determine the COND_EXPR that
+ guards the exit edge. If the expression is too difficult to
+ analyze, then give up. */
+
+tree
+get_loop_exit_condition (struct loop *loop)
+{
+ tree res = NULL_TREE;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(get_loop_exit_condition \n ");
+
+ if (loop_exit_edges (loop))
+ {
+ edge exit_edge;
+ tree expr;
+
+ exit_edge = loop_exit_edge (loop, 0);
+ expr = last_stmt (edge_source (exit_edge));
+
+ if (analyzable_condition (expr))
+ res = expr;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ return res;
+}
+
+/* Recursively determine and enqueue the exit conditions for a loop. */
+
+static void
+get_exit_conditions_rec (struct loop *loop,
+ varray_type *exit_conditions)
+{
+ if (!loop)
+ return;
+
+ /* Recurse on the inner loops, then on the next (sibling) loops. */
+ get_exit_conditions_rec (inner_loop (loop), exit_conditions);
+ get_exit_conditions_rec (next_loop (loop), exit_conditions);
+
+ flow_loop_scan (loop, LOOP_EXIT_EDGES);
+ if (loop_num_exits (loop) == 1)
+ {
+ tree loop_condition = get_loop_exit_condition (loop);
+
+ if (loop_condition)
+ VARRAY_PUSH_TREE (*exit_conditions, loop_condition);
+ }
+}
+
+/* Select the candidate loop nests for the analysis. This function
+ initializes the EXIT_CONDITIONS array. The vector EXIT_CONDITIONS is
+ initialized in a loop-depth-first order, ie. the inner loops
+ conditions appear before the outer. This property of the
+ EXIT_CONDITIONS list is exploited by the evolution analyzer. */
+
+static void
+select_loops_exit_conditions (struct loops *loops,
+ varray_type *exit_conditions)
+{
+ struct loop *function_body = loops->parray[0];
+
+ get_exit_conditions_rec (inner_loop (function_body), exit_conditions);
+}
+
+
+
+/* Debugging functions section. */
+
+extern void draw_tree_cfg (void);
+
+/* Draw the flow graph. */
+
+void
+draw_tree_cfg (void)
+{
+ FILE *dump_file;
+ if (n_basic_blocks > 0)
+ {
+ dump_file = fopen ("tree_cfg.dot", "w");
+ if (dump_file)
+ {
+ tree_cfg2dot (dump_file);
+ fclose (dump_file);
+ system ("dotty tree_cfg.dot");
+ }
+ }
+}
+
+
+/* Depth first search algorithm. */
+
+static bool follow_ssa_edge (struct loop *loop, tree, tree, tree *);
+
+/* Follow the ssa edge into the right hand side of an assignment. */
+
+static bool
+follow_ssa_edge_in_rhs (struct loop *loop,
+ tree rhs,
+ tree halting_phi,
+ tree *evolution_of_loop)
+{
+ bool res = false;
+ tree rhs0, rhs1;
+ tree type_rhs = TREE_TYPE (rhs);
+
+ /* The RHS is one of the following cases:
+ - an SSA_NAME,
+ - an INTEGER_CST,
+ - a PLUS_EXPR,
+ - a MINUS_EXPR,
+ - other cases are not yet handled.
+ */
+ switch (TREE_CODE (rhs))
+ {
+ case INTEGER_CST:
+ /* This assignment is under the form "a_1 = 7". */
+ res = false;
+ break;
+
+ case SSA_NAME:
+ /* This assignment is under the form: "a_1 = b_2". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs), halting_phi, evolution_of_loop);
+ break;
+
+ case PLUS_EXPR:
+ /* This case is under the form "rhs0 + rhs1". */
+ rhs0 = TREE_OPERAND (rhs, 0);
+ rhs1 = TREE_OPERAND (rhs, 1);
+
+ if (TREE_CODE (rhs0) == SSA_NAME)
+ {
+ if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ /* Match an assignment under the form:
+ "a = b + c". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
+ evolution_of_loop);
+
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num,
+ chrec_convert (type_rhs, *evolution_of_loop),
+ PLUS_EXPR, rhs1);
+
+ else
+ {
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
+ evolution_of_loop);
+
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num,
+ chrec_convert (type_rhs, *evolution_of_loop),
+ PLUS_EXPR, rhs0);
+ }
+ }
+
+ else
+ {
+ /* Match an assignment under the form:
+ "a = b + ...". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
+ evolution_of_loop);
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num, chrec_convert (type_rhs, *evolution_of_loop),
+ PLUS_EXPR, rhs1);
+ }
+ }
+
+ else if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ /* Match an assignment under the form:
+ "a = ... + c". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
+ evolution_of_loop);
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num, chrec_convert (type_rhs, *evolution_of_loop),
+ PLUS_EXPR, rhs0);
+ }
+
+ else
+ /* Otherwise, match an assignment under the form:
+ "a = ... + ...". */
+ /* And there is nothing to do. */
+ res = false;
+
+ break;
+
+ case MINUS_EXPR:
+ /* This case is under the form "opnd0 = rhs0 - rhs1". */
+ rhs0 = TREE_OPERAND (rhs, 0);
+ rhs1 = TREE_OPERAND (rhs, 1);
+ if (TREE_CODE (rhs0) == SSA_NAME)
+ {
+ if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ /* Match an assignment under the form:
+ "a = b - c". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
+ evolution_of_loop);
+
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num, chrec_convert (type_rhs, *evolution_of_loop),
+ MINUS_EXPR, rhs1);
+
+ else
+ {
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
+ evolution_of_loop);
+
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num,
+ chrec_fold_multiply (type_rhs,
+ *evolution_of_loop,
+ convert (type_rhs,
+ integer_minus_one_node)),
+ PLUS_EXPR, rhs0);
+ }
+ }
+
+ else
+ {
+ /* Match an assignment under the form:
+ "a = b - ...". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
+ evolution_of_loop);
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num, chrec_convert (type_rhs, *evolution_of_loop),
+ MINUS_EXPR, rhs1);
+ }
+ }
+
+ else if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ /* Match an assignment under the form:
+ "a = ... - c". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
+ evolution_of_loop);
+ if (res)
+ *evolution_of_loop = add_to_evolution
+ (loop->num,
+ chrec_fold_multiply (type_rhs,
+ *evolution_of_loop,
+ convert (type_rhs, integer_minus_one_node)),
+ PLUS_EXPR, rhs0);
+ }
+
+ else
+ /* Otherwise, match an assignment under the form:
+ "a = ... - ...". */
+ /* And there is nothing to do. */
+ res = false;
+
+ break;
+
+ case MULT_EXPR:
+ /* This case is under the form "opnd0 = rhs0 * rhs1". */
+ rhs0 = TREE_OPERAND (rhs, 0);
+ rhs1 = TREE_OPERAND (rhs, 1);
+ if (TREE_CODE (rhs0) == SSA_NAME)
+ {
+ if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ /* Match an assignment under the form:
+ "a = b * c". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
+ evolution_of_loop);
+
+ if (res)
+ *evolution_of_loop = multiply_evolution
+ (loop->num, *evolution_of_loop, rhs1);
+
+ else
+ {
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
+ evolution_of_loop);
+
+ if (res)
+ *evolution_of_loop = multiply_evolution
+ (loop->num, *evolution_of_loop, rhs0);
+ }
+ }
+
+ else
+ {
+ /* Match an assignment under the form:
+ "a = b * ...". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
+ evolution_of_loop);
+ if (res)
+ *evolution_of_loop = multiply_evolution
+ (loop->num, *evolution_of_loop, rhs1);
+ }
+ }
+
+ else if (TREE_CODE (rhs1) == SSA_NAME)
+ {
+ /* Match an assignment under the form:
+ "a = ... * c". */
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
+ evolution_of_loop);
+ if (res)
+ *evolution_of_loop = multiply_evolution
+ (loop->num, *evolution_of_loop, rhs0);
+ }
+
+ else
+ /* Otherwise, match an assignment under the form:
+ "a = ... * ...". */
+ /* And there is nothing to do. */
+ res = false;
+
+ break;
+
+ default:
+ res = false;
+ break;
+ }
+
+ return res;
+}
+
+/* Checks whether the I-th argument of a PHI comes from a backedge. */
+
+static bool
+backedge_phi_arg_p (tree phi, int i)
+{
+ edge e = PHI_ARG_EDGE (phi, i);
+
+ /* We would in fact like to test EDGE_DFS_BACK here, but we do not care
+ about updating it anywhere, and this should work as well most of the
+ time. */
+ if (e->flags & EDGE_IRREDUCIBLE_LOOP)
+ return true;
+
+ return false;
+}
+
+/* Helper function for one branch of the condition-phi-node. */
+
+static inline bool
+follow_ssa_edge_in_condition_phi_branch (int i,
+ struct loop *loop,
+ tree condition_phi,
+ tree halting_phi,
+ tree *evolution_of_branch,
+ tree init_cond)
+{
+ tree branch = PHI_ARG_DEF (condition_phi, i);
+ *evolution_of_branch = chrec_top;
+
+ /* Do not follow back edges (they must belong to an irreducible loop, which
+ we really do not want to worry about). */
+ if (backedge_phi_arg_p (condition_phi, i))
+ return false;
+
+ if (TREE_CODE (branch) == SSA_NAME)
+ {
+ *evolution_of_branch = init_cond;
+ return follow_ssa_edge (loop, SSA_NAME_DEF_STMT (branch), halting_phi,
+ evolution_of_branch);
+ }
+
+ /* This case occurs when one of the condition branches sets
+ the variable to a constant: ie. a phi-node like
+ "a_2 = PHI <a_7(5), 2(6)>;".
+ The testsuite/.../ssa-chrec-17.c exercises this code.
+
+ FIXME: This case have to be refined correctly:
+ in some cases it is possible to say something better than
+ chrec_top, for example using a wrap-around notation. */
+ return false;
+}
+
+/* This function merges the branches of a condition-phi-node in a
+ loop. */
+
+static bool
+follow_ssa_edge_in_condition_phi (struct loop *loop,
+ tree condition_phi,
+ tree halting_phi,
+ tree *evolution_of_loop)
+{
+ int i;
+ tree init = *evolution_of_loop;
+ tree evolution_of_branch;
+
+ if (!follow_ssa_edge_in_condition_phi_branch (0, loop, condition_phi,
+ halting_phi,
+ &evolution_of_branch,
+ init))
+ return false;
+ *evolution_of_loop = evolution_of_branch;
+
+ for (i = 1; i < PHI_NUM_ARGS (condition_phi); i++)
+ {
+ if (!follow_ssa_edge_in_condition_phi_branch (i, loop, condition_phi,
+ halting_phi,
+ &evolution_of_branch,
+ init))
+ return false;
+
+ *evolution_of_loop = chrec_merge (*evolution_of_loop,
+ evolution_of_branch);
+ }
+
+ return true;
+}
+
+/* Follow an SSA edge in an inner loop. It computes the overall
+ effect of the loop, and following the symbolic initial conditions,
+ it follows the edges in the parent loop. The inner loop is
+ considered as a single statement. */
+
+static bool
+follow_ssa_edge_inner_loop_phi (struct loop *outer_loop,
+ tree loop_phi_node,
+ tree halting_phi,
+ tree *evolution_of_loop)
+{
+ struct loop *loop = loop_of_stmt (loop_phi_node);
+ tree ev = analyze_scalar_evolution (loop, PHI_RESULT (loop_phi_node));
+
+ /* Sometimes, the inner loop is too difficult to analyze, and the
+ result of the analysis is a symbolic parameter. */
+ if (ev == PHI_RESULT (loop_phi_node))
+ {
+ bool res = false;
+ int i;
+
+ for (i = 0; i < PHI_NUM_ARGS (loop_phi_node); i++)
+ {
+ tree arg = PHI_ARG_DEF (loop_phi_node, i);
+ basic_block bb;
+
+ /* Follow the edges that exit the inner loop. */
+ bb = PHI_ARG_EDGE (loop_phi_node, i)->src;
+ if (!flow_bb_inside_loop_p (loop, bb))
+ res = res || follow_ssa_edge_in_rhs (outer_loop, arg, halting_phi,
+ evolution_of_loop);
+ }
+
+ /* If the path crosses this loop-phi, give up. */
+ if (res == true)
+ *evolution_of_loop = chrec_top;
+
+ return res;
+ }
+
+ /* Otherwise, compute the overall effect of the inner loop. */
+ ev = compute_overall_effect_of_inner_loop (loop, ev);
+ return follow_ssa_edge_in_rhs (outer_loop, ev, halting_phi,
+ evolution_of_loop);
+}
+
+/* Follow an SSA edge from a loop-phi-node to itself, constructing a
+ path that is analyzed on the return walk. */
+
+static bool
+follow_ssa_edge (struct loop *loop,
+ tree def,
+ tree halting_phi,
+ tree *evolution_of_loop)
+{
+ struct loop *def_loop;
+
+ if (TREE_CODE (def) == NOP_EXPR)
+ return false;
+
+ def_loop = loop_of_stmt (def);
+
+ switch (TREE_CODE (def))
+ {
+ case PHI_NODE:
+ if (!loop_phi_node_p (def))
+ /* DEF is a condition-phi-node. Follow the branches, and
+ record their evolutions. Finally, merge the collected
+ information and set the approximation to the main
+ variable. */
+ return follow_ssa_edge_in_condition_phi
+ (loop, def, halting_phi, evolution_of_loop);
+
+ /* When the analyzed phi is the halting_phi, the
+ depth-first search is over: we have found a path from
+ the halting_phi to itself in the loop. */
+ if (def == halting_phi)
+ return true;
+
+ /* Otherwise, the evolution of the HALTING_PHI depends
+ on the evolution of another loop-phi-node, ie. the
+ evolution function is a higher degree polynomial. */
+ if (def_loop == loop)
+ return false;
+
+ /* Inner loop. */
+ if (flow_loop_nested_p (loop, def_loop))
+ return follow_ssa_edge_inner_loop_phi
+ (loop, def, halting_phi, evolution_of_loop);
+
+ /* Outer loop. */
+ return false;
+
+ case MODIFY_EXPR:
+ return follow_ssa_edge_in_rhs (loop,
+ TREE_OPERAND (def, 1),
+ halting_phi,
+ evolution_of_loop);
+
+ default:
+ /* At this level of abstraction, the program is just a set
+ of MODIFY_EXPRs and PHI_NODEs. In principle there is no
+ other node to be handled. */
+ return false;
+ }
+}
+
+
+
+/* Given a LOOP_PHI_NODE, this function determines the evolution
+ function from LOOP_PHI_NODE to LOOP_PHI_NODE in the loop. */
+
+static tree
+analyze_evolution_in_loop (tree loop_phi_node,
+ tree init_cond)
+{
+ int i;
+ tree evolution_function = chrec_not_analyzed_yet;
+ struct loop *loop = loop_of_stmt (loop_phi_node);
+ basic_block bb;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(analyze_evolution_in_loop \n");
+ fprintf (dump_file, " (loop_phi_node = ");
+ print_generic_expr (dump_file, loop_phi_node, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ for (i = 0; i < PHI_NUM_ARGS (loop_phi_node); i++)
+ {
+ tree arg = PHI_ARG_DEF (loop_phi_node, i);
+ tree ssa_chain, ev_fn;
+ bool res;
+
+ /* Select the edges that enter the loop body. */
+ bb = PHI_ARG_EDGE (loop_phi_node, i)->src;
+ if (!flow_bb_inside_loop_p (loop, bb))
+ continue;
+
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ ssa_chain = SSA_NAME_DEF_STMT (arg);
+
+ /* Pass in the initial condition to the follow edge function. */
+ ev_fn = init_cond;
+ res = follow_ssa_edge (loop, ssa_chain, loop_phi_node, &ev_fn);
+ }
+ else
+ res = false;
+
+ /* When it is impossible to go back on the same
+ loop_phi_node by following the ssa edges, the
+ evolution is represented by a peeled chrec, ie. the
+ first iteration, EV_FN has the value INIT_COND, then
+ all the other iterations it has the value of ARG. */
+ if (!res)
+ {
+ /* FIXME: when dealing with periodic scalars, the
+ analysis of the scalar evolution of ARG would
+ create an infinite recurrence. Solution: don't
+ try to simplify the peeled chrec at this time,
+ but wait until having more information. */
+ ev_fn = build_peeled_chrec (loop->num, init_cond, arg);
+
+ /* Try to simplify the peeled chrec. */
+ ev_fn = simplify_peeled_chrec (ev_fn);
+ }
+
+ /* When there are multiple back edges of the loop (which in fact never
+ happens currently, but nevertheless), merge their evolutions. */
+ evolution_function = chrec_merge (evolution_function, ev_fn);
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (evolution_function = ");
+ print_generic_expr (dump_file, evolution_function, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ return evolution_function;
+}
+
+/* Given a loop-phi-node, this function determines the initial
+ conditions of the variable on entry of the loop. When the CCP has
+ propagated constants into the loop-phi-node, the initial condition
+ is instantiated, otherwise the initial condition is kept symbolic.
+ This analyzer does not analyze the evolution outside the current
+ loop, and leaves this task to the on-demand tree reconstructor. */
+
+static tree
+analyze_initial_condition (tree loop_phi_node)
+{
+ int i;
+ tree init_cond = chrec_not_analyzed_yet;
+ struct loop *loop = bb_for_stmt (loop_phi_node)->loop_father;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(analyze_initial_condition \n");
+ fprintf (dump_file, " (loop_phi_node = \n");
+ print_generic_expr (dump_file, loop_phi_node, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ for (i = 0; i < PHI_NUM_ARGS (loop_phi_node); i++)
+ {
+ tree branch = PHI_ARG_DEF (loop_phi_node, i);
+ basic_block bb = PHI_ARG_EDGE (loop_phi_node, i)->src;
+
+ /* When the branch is oriented to the loop's body, it does
+ not contribute to the initial condition. */
+ if (flow_bb_inside_loop_p (loop, bb))
+ continue;
+
+ if (init_cond == chrec_not_analyzed_yet)
+ {
+ init_cond = branch;
+ continue;
+ }
+
+ if (TREE_CODE (branch) == SSA_NAME)
+ {
+ init_cond = chrec_top;
+ break;
+ }
+
+ init_cond = chrec_merge (init_cond, branch);
+ }
+
+ /* Ooops -- a loop without an entry??? */
+ if (init_cond == chrec_not_analyzed_yet)
+ init_cond = chrec_top;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (init_cond = ");
+ print_generic_expr (dump_file, init_cond, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ return init_cond;
+}
+
+/* Analyze the scalar evolution for LOOP_PHI_NODE. */
+
+static tree
+interpret_loop_phi (struct loop *loop, tree loop_phi_node)
+{
+ tree res;
+ struct loop *phi_loop = loop_of_stmt (loop_phi_node);
+ tree init_cond;
+
+ if (phi_loop != loop)
+ {
+ struct loop *subloop;
+ tree evolution_fn = analyze_scalar_evolution
+ (phi_loop, PHI_RESULT (loop_phi_node));
+
+ /* Dive one level deeper. */
+ subloop = superloop_at_depth (phi_loop, loop->depth + 1);
+
+ /* Interpret the subloop. */
+ res = compute_overall_effect_of_inner_loop (subloop, evolution_fn);
+ return res;
+ }
+
+ /* Otherwise really interpret the loop phi. */
+ init_cond = analyze_initial_condition (loop_phi_node);
+ res = analyze_evolution_in_loop (loop_phi_node, init_cond);
+
+ return res;
+}
+
+/* This function merges the branches of a condition-phi-node,
+ contained in the outermost loop, and whose arguments are already
+ analyzed. */
+
+static tree
+interpret_condition_phi (struct loop *loop, tree condition_phi)
+{
+ int i;
+ tree res = chrec_not_analyzed_yet;
+
+ for (i = 0; i < PHI_NUM_ARGS (condition_phi); i++)
+ {
+ tree branch_chrec;
+
+ if (backedge_phi_arg_p (condition_phi, i))
+ {
+ res = chrec_top;
+ break;
+ }
+
+ branch_chrec = analyze_scalar_evolution
+ (loop, PHI_ARG_DEF (condition_phi, i));
+
+ res = chrec_merge (res, branch_chrec);
+ }
+
+ return res;
+}
+
+/* Interpret the right hand side of a modify_expr OPND1. If we didn't
+ analyzed this node before, follow the definitions until ending
+ either on an analyzed modify_expr, or on a loop-phi-node. On the
+ return path, this function propagates evolutions (ala constant copy
+ propagation). OPND1 is not a GIMPLE expression because we could
+ analyze the effect of an inner loop: see interpret_loop_phi. */
+
+static tree
+interpret_rhs_modify_expr (struct loop *loop,
+ tree opnd1, tree type)
+{
+ tree res, opnd10, opnd11, chrec10, chrec11;
+
+ if (is_gimple_min_invariant (opnd1))
+ return chrec_convert (type, opnd1);
+
+ switch (TREE_CODE (opnd1))
+ {
+ case PLUS_EXPR:
+ opnd10 = TREE_OPERAND (opnd1, 0);
+ opnd11 = TREE_OPERAND (opnd1, 1);
+ chrec10 = analyze_scalar_evolution (loop, opnd10);
+ chrec11 = analyze_scalar_evolution (loop, opnd11);
+ chrec10 = chrec_convert (type, chrec10);
+ chrec11 = chrec_convert (type, chrec11);
+ res = chrec_fold_plus (type, chrec10, chrec11);
+ break;
+
+ case MINUS_EXPR:
+ opnd10 = TREE_OPERAND (opnd1, 0);
+ opnd11 = TREE_OPERAND (opnd1, 1);
+ chrec10 = analyze_scalar_evolution (loop, opnd10);
+ chrec11 = analyze_scalar_evolution (loop, opnd11);
+ chrec10 = chrec_convert (type, chrec10);
+ chrec11 = chrec_convert (type, chrec11);
+ res = chrec_fold_minus (type, chrec10, chrec11);
+ break;
+
+ case NEGATE_EXPR:
+ opnd10 = TREE_OPERAND (opnd1, 0);
+ chrec10 = analyze_scalar_evolution (loop, opnd10);
+ chrec10 = chrec_convert (type, chrec10);
+ res = chrec_fold_minus (type, convert (type, integer_zero_node),
+ chrec10);
+ break;
+
+ case MULT_EXPR:
+ opnd10 = TREE_OPERAND (opnd1, 0);
+ opnd11 = TREE_OPERAND (opnd1, 1);
+ chrec10 = analyze_scalar_evolution (loop, opnd10);
+ chrec11 = analyze_scalar_evolution (loop, opnd11);
+ chrec10 = chrec_convert (type, chrec10);
+ chrec11 = chrec_convert (type, chrec11);
+ res = chrec_fold_multiply (type, chrec10, chrec11);
+ break;
+
+ case SSA_NAME:
+ res = chrec_convert (type, analyze_scalar_evolution (loop, opnd1));
+ break;
+
+ case NOP_EXPR:
+ case CONVERT_EXPR:
+ opnd10 = TREE_OPERAND (opnd1, 0);
+ chrec10 = analyze_scalar_evolution (loop, opnd10);
+ res = chrec_convert (type, chrec10);
+ break;
+
+ default:
+ res = chrec_top;
+ break;
+ }
+
+ return res;
+}
+
+
+
+/* This section contains all the entry points:
+ - number_of_iterations_in_loop,
+ - analyze_scalar_evolution,
+ - instantiate_parameters.
+*/
+
+/* Compute the evolution function in WRTO_LOOP, the nearest common
+ ancestor of DEF_LOOP and USE_LOOP. */
+
+static tree
+compute_scalar_evolution_in_loop (struct loop *wrto_loop,
+ struct loop *def_loop,
+ tree ev)
+{
+ tree res;
+ if (def_loop == wrto_loop)
+ return ev;
+
+ def_loop = superloop_at_depth (def_loop, wrto_loop->depth + 1);
+ res = compute_overall_effect_of_inner_loop (def_loop, ev);
+
+ return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet);
+}
+
+/* Helper recursive function. */
+
+static tree
+analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
+{
+ tree def, type = TREE_TYPE (var);
+ basic_block bb;
+ struct loop *def_loop;
+
+ if (loop == NULL)
+ return chrec_top;
+
+ if (TREE_CODE (var) != SSA_NAME)
+ return interpret_rhs_modify_expr (loop, var, type);
+
+ def = SSA_NAME_DEF_STMT (var);
+ bb = bb_for_stmt (def);
+ def_loop = bb ? bb->loop_father : NULL;
+
+ if (bb == NULL
+ || !flow_bb_inside_loop_p (loop, bb))
+ {
+ /* Keep the symbolic form. */
+ res = var;
+ goto set_and_end;
+ }
+
+ if (res != chrec_not_analyzed_yet)
+ {
+ if (loop != bb->loop_father)
+ res = compute_scalar_evolution_in_loop
+ (find_common_loop (loop, bb->loop_father), bb->loop_father, res);
+
+ goto set_and_end;
+ }
+
+ if (loop != def_loop)
+ {
+ res = analyze_scalar_evolution_1 (def_loop, var, chrec_not_analyzed_yet);
+ res = compute_scalar_evolution_in_loop (loop, def_loop, res);
+
+ goto set_and_end;
+ }
+
+ switch (TREE_CODE (def))
+ {
+ case MODIFY_EXPR:
+ res = interpret_rhs_modify_expr (loop, TREE_OPERAND (def, 1), type);
+ break;
+
+ case PHI_NODE:
+ if (loop_phi_node_p (def))
+ res = interpret_loop_phi (loop, def);
+ else
+ res = interpret_condition_phi (loop, def);
+ break;
+
+ default:
+ res = chrec_top;
+ break;
+ }
+
+ set_and_end:
+
+ /* Keep the symbolic form. */
+ if (res == chrec_top)
+ res = var;
+
+ if (loop == def_loop)
+ set_scalar_evolution (var, res);
+
+ return res;
+}
+
+/* Entry point for the scalar evolution analyzer.
+ Analyzes and returns the scalar evolution of the ssa_name VAR.
+ LOOP_NB is the identifier number of the loop in which the variable
+ is used.
+
+ Example of use: having a pointer VAR to a SSA_NAME node, STMT a
+ pointer to the statement that uses this variable, in order to
+ determine the evolution function of the variable, use the following
+ calls:
+
+ unsigned loop_nb = loop_num (loop_of_stmt (stmt));
+ tree chrec_with_symbols = analyze_scalar_evolution (loop_nb, var);
+ tree chrec_instantiated = instantiate_parameters
+ (loop_nb, chrec_with_symbols);
+*/
+
+tree
+analyze_scalar_evolution (struct loop *loop, tree var)
+{
+ tree res;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(analyze_scalar_evolution \n");
+ fprintf (dump_file, " (loop_nb = %d)\n", loop->num);
+ fprintf (dump_file, " (scalar = ");
+ print_generic_expr (dump_file, var, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ res = analyze_scalar_evolution_1 (loop, var, get_scalar_evolution (var));
+
+ if (TREE_CODE (var) == SSA_NAME && res == chrec_top)
+ res = var;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ")\n");
+
+ return res;
+}
+
+/* Analyze scalar evolution of use of VERSION in USE_LOOP with respect to
+ WRTO_LOOP (which should be a superloop of both USE_LOOP and definition
+ of VERSION). */
+
+tree
+analyze_scalar_evolution_in_loop (struct loop *wrto_loop, struct loop *use_loop,
+ tree version)
+{
+ bool val = false;
+ tree ev = version;
+
+ while (1)
+ {
+ ev = analyze_scalar_evolution (use_loop, ev);
+
+ if (use_loop == wrto_loop)
+ return ev;
+
+ /* If the value of the use changes in the inner loop, we cannot express
+ its value in the outer loop (we might try to return interval chrec,
+ but we do not have a user for it anyway) */
+ if (!no_evolution_in_loop_p (ev, use_loop->num, &val)
+ || !val)
+ return chrec_top;
+
+ use_loop = use_loop->outer;
+ }
+}
+
+/* Analyze all the parameters of the chrec that were left under a symbolic form,
+ with respect to LOOP. CHREC is the chrec to instantiate. */
+
+static tree
+instantiate_parameters_1 (struct loop *loop, tree chrec)
+{
+ tree res, op0, op1, op2;
+ basic_block def_bb;
+ struct loop *def_loop;
+
+ if (chrec == NULL_TREE
+ || automatically_generated_chrec_p (chrec))
+ return chrec;
+
+ if (is_gimple_min_invariant (chrec))
+ return chrec;
+
+ switch (TREE_CODE (chrec))
+ {
+ case SSA_NAME:
+ def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (chrec));
+
+ /* A parameter, nothing to do. */
+ if (!def_bb)
+ return chrec;
+
+ /* Don't instantiate the SSA_NAME if it is in a mixer
+ structure. This is used for avoiding the instantiation of
+ recursively defined functions, such as:
+
+ | a_2 -> {0, +, 1, +, a_2}_1
+
+ Note: the size of already_instantiated is proportional to
+ the degree of the evolution function. This is the number
+ of parameters that have to be instantiated, and is almost
+ all the time less than 2. */
+ if (tree_is_in_varray_tree_p (chrec, already_instantiated))
+ {
+ if (!flow_bb_inside_loop_p (loop, def_bb))
+ {
+ /* It is an invariant in LOOP, so we may keep the symbolic
+ form. */
+ return chrec;
+ }
+ else
+ {
+ /* Something with unknown behavior in LOOP. */
+ return chrec_top;
+ }
+ }
+
+ def_loop = find_common_loop (loop, def_bb->loop_father);
+
+ /* If the analysis yields a parametric chrec, instantiate
+ the result again. Enqueue the SSA_NAME such that it will
+ never be instantiated twice, avoiding the cyclic
+ instantiation in mixers. */
+ VARRAY_PUSH_TREE (already_instantiated, chrec);
+ res = analyze_scalar_evolution (def_loop, chrec);
+ res = instantiate_parameters (loop, res);
+ VARRAY_POP (already_instantiated);
+ return res;
+
+ case POLYNOMIAL_CHREC:
+ op0 = instantiate_parameters (loop, CHREC_LEFT (chrec));
+ op1 = instantiate_parameters (loop, CHREC_RIGHT (chrec));
+ return build_polynomial_chrec (CHREC_VARIABLE (chrec), op0, op1);
+
+ case EXPONENTIAL_CHREC:
+ op0 = instantiate_parameters (loop, CHREC_LEFT (chrec));
+ op1 = instantiate_parameters (loop, CHREC_RIGHT (chrec));
+ return build_exponential_chrec (CHREC_VARIABLE (chrec), op0, op1);
+
+ case PEELED_CHREC:
+ op0 = instantiate_parameters (loop, CHREC_LEFT (chrec));
+ op1 = instantiate_parameters (loop, CHREC_RIGHT (chrec));
+ return build_peeled_chrec (CHREC_VARIABLE (chrec), op0, op1);
+
+ case INTERVAL_CHREC:
+ op0 = instantiate_parameters (loop, CHREC_LOW (chrec));
+ op1 = instantiate_parameters (loop, CHREC_UP (chrec));
+ return build_interval_chrec (op0, op1);
+
+ case PLUS_EXPR:
+ op0 = instantiate_parameters (loop, TREE_OPERAND (chrec, 0));
+ op1 = instantiate_parameters (loop, TREE_OPERAND (chrec, 1));
+ return chrec_fold_plus (TREE_TYPE (chrec), op0, op1);
+
+ case MINUS_EXPR:
+ op0 = instantiate_parameters (loop, TREE_OPERAND (chrec, 0));
+ op1 = instantiate_parameters (loop, TREE_OPERAND (chrec, 1));
+ return chrec_fold_minus (TREE_TYPE (chrec), op0, op1);
+
+ case MULT_EXPR:
+ op0 = instantiate_parameters (loop, TREE_OPERAND (chrec, 0));
+ op1 = instantiate_parameters (loop, TREE_OPERAND (chrec, 1));
+ return chrec_fold_multiply (TREE_TYPE (chrec), op0, op1);
+
+ case NOP_EXPR:
+ op0 = instantiate_parameters (loop, TREE_OPERAND (chrec, 0));
+ return chrec_convert (TREE_TYPE (chrec), op0);
+
+ default:
+ break;
+ }
+
+ switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
+ {
+ case 3:
+ op0 = instantiate_parameters (loop, TREE_OPERAND (chrec, 0));
+ op1 = instantiate_parameters (loop, TREE_OPERAND (chrec, 1));
+ op2 = instantiate_parameters (loop, TREE_OPERAND (chrec, 2));
+ return build (TREE_CODE (chrec), TREE_TYPE (chrec), op0, op1, op2);
+
+ case 2:
+ op0 = instantiate_parameters (loop, TREE_OPERAND (chrec, 0));
+ op1 = instantiate_parameters (loop, TREE_OPERAND (chrec, 1));
+ return build (TREE_CODE (chrec), TREE_TYPE (chrec), op0, op1);
+
+ case 1:
+ op0 = instantiate_parameters (loop, TREE_OPERAND (chrec, 0));
+ return build1 (TREE_CODE (chrec), TREE_TYPE (chrec), op0);
+
+ case 0:
+ return chrec;
+
+ default:
+ break;
+ }
+
+ /* Too complicated to handle. */
+ return chrec_top;
+}
+
+/* Analyze all the parameters of the chrec that were left under a
+ symbolic form. LOOP is the loop in which symbolic names have to
+ be analyzed and instantiated. */
+
+tree
+instantiate_parameters (struct loop *loop,
+ tree chrec)
+{
+ tree res;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "(instantiate_parameters \n");
+ fprintf (dump_file, " (loop_nb = %d)\n", loop->num);
+ fprintf (dump_file, " (chrec = ");
+ print_generic_expr (dump_file, chrec, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ res = instantiate_parameters_1 (loop, chrec);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (res = ");
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, "))\n");
+ }
+
+ return res;
+}
+
+/* Entry point for the analysis of the number of iterations pass.
+ This function tries to safely approximate the number of iterations
+ the loop will run. When this property is not decidable at compile
+ time, the result is chrec_top: [-oo, +oo]. Otherwise the result is
+ a scalar, an interval, or a symbolic parameter.
+
+ Example of analysis: suppose that the loop has an exit condition:
+
+ "if (b > 49) goto end_loop;"
+
+ and that in a previous analysis we have determined that the
+ variable 'b' has an evolution function:
+
+ "EF = {23, +, 5}_2".
+
+ When we evaluate the function at the point 5, i.e. the value of the
+ variable 'b' after 5 iterations in the loop, we have EF (5) = 48,
+ and EF (6) = 53. In this case the value of 'b' on exit is '53' and
+ the loop body has been executed 6 times. */
+
+tree
+number_of_iterations_in_loop (struct loop *loop)
+{
+ enum tree_code code;
+ tree res;
+ tree cond, test, opnd0, opnd1;
+ tree chrec0, chrec1;
+ edge exit;
+
+ /* Determine whether the number_of_iterations_in_loop has already
+ been computed. */
+ res = loop_nb_iterations (loop);
+ if (res)
+ return res;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "(number_of_iterations_in_loop \n");
+
+ cond = get_loop_exit_condition (loop);
+ if (cond == NULL_TREE)
+ return set_nb_iterations_in_loop (loop, chrec_top);
+
+ test = TREE_OPERAND (cond, 0);
+ exit = loop_exit_edge (loop, 0);
+ if (exit->flags & EDGE_TRUE_VALUE)
+ test = invert_truthvalue (test);
+
+ code = TREE_CODE (test);
+ switch (code)
+ {
+ case SSA_NAME:
+ /* "while (opnd0 != 0)". */
+ code = NE_EXPR;
+ chrec0 = analyze_scalar_evolution (loop, test);
+ chrec1 = integer_zero_node;
+
+ if (chrec0 == chrec_top)
+ /* KEEP_IT_SYMBOLIC. */
+ chrec0 = test;
+
+ goto end;
+
+ case LT_EXPR:
+ case LE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ opnd0 = TREE_OPERAND (test, 0);
+ opnd1 = TREE_OPERAND (test, 1);
+ chrec0 = analyze_scalar_evolution (loop, opnd0);
+ chrec1 = analyze_scalar_evolution (loop, opnd1);
+
+ chrec0 = instantiate_parameters (loop, chrec0);
+ chrec1 = instantiate_parameters (loop, chrec1);
+
+ if (chrec0 == chrec_top)
+ /* KEEP_IT_SYMBOLIC. */
+ chrec0 = opnd0;
+
+ if (chrec1 == chrec_top)
+ /* KEEP_IT_SYMBOLIC. */
+ chrec1 = opnd1;
+
+ goto end;
+
+ default:
+ return set_nb_iterations_in_loop (loop, chrec_top);
+ }
+
+ end:
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " (loop_nb = %d)\n", loop->num);
+ fprintf (dump_file, " (loop_while_expr_is_true: ");
+ print_generic_expr (dump_file, test, 0);
+ fprintf (dump_file, ")\n (chrec0 = ");
+ print_generic_expr (dump_file, chrec0, 0);
+ fprintf (dump_file, ")\n (chrec1 = ");
+ print_generic_expr (dump_file, chrec1, 0);
+ fprintf (dump_file, ")\n");
+ }
+
+ if (chrec_contains_undetermined (chrec0)
+ || chrec_contains_undetermined (chrec1))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " (nb_iterations cannot be determined))\n");
+
+ /* Do not update the loop->nb_iterations. */
+ return chrec_top;
+ }
+
+ res = first_iteration_non_satisfying (code, loop->num, chrec0, chrec1);
+
+ return set_nb_iterations_in_loop (loop, res);
+}
+
+/* One of the drivers for testing the scalar evolutions analysis.
+ This function computes the number of iterations for all the loops
+ from the EXIT_CONDITIONS array. */
+
+static void
+number_of_iterations_for_all_loops (varray_type exit_conditions)
+{
+ unsigned int i;
+ unsigned nb_chrec_top_loops = 0;
+ unsigned nb_static_loops = 0;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (exit_conditions); i++)
+ {
+ tree res = number_of_iterations_in_loop
+ (loop_of_stmt (VARRAY_TREE (exit_conditions, i)));
+ if (res == chrec_top)
+ nb_chrec_top_loops++;
+ else
+ nb_static_loops++;
+ }
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n(\n");
+ fprintf (dump_file, "-----------------------------------------\n");
+ fprintf (dump_file, "%d\tnb_chrec_top_loops\n", nb_chrec_top_loops);
+ fprintf (dump_file, "%d\tnb_static_loops\n", nb_static_loops);
+ fprintf (dump_file, "%d\tnb_total_loops\n", current_loops->num);
+ fprintf (dump_file, "-----------------------------------------\n");
+ fprintf (dump_file, ")\n\n");
+
+ print_loop_ir (dump_file);
+ }
+}
+
+
+
+/* Counters for the stats. */
+
+struct chrec_stats
+{
+ unsigned nb_chrecs;
+ unsigned nb_peeled;
+ unsigned nb_affine;
+ unsigned nb_affine_multivar;
+ unsigned nb_higher_poly;
+ unsigned nb_expo;
+ unsigned nb_chrec_top;
+ unsigned nb_interval_chrec;
+ unsigned nb_undetermined;
+};
+
+/* Reset the counters. */
+
+static inline void
+reset_chrecs_counters (struct chrec_stats *stats)
+{
+ stats->nb_chrecs = 0;
+ stats->nb_peeled = 0;
+ stats->nb_affine = 0;
+ stats->nb_affine_multivar = 0;
+ stats->nb_higher_poly = 0;
+ stats->nb_expo = 0;
+ stats->nb_chrec_top = 0;
+ stats->nb_interval_chrec = 0;
+ stats->nb_undetermined = 0;
+}
+
+/* Dump the contents of a CHREC_STATS structure. */
+
+static void
+dump_chrecs_stats (FILE *file, struct chrec_stats *stats)
+{
+ fprintf (file, "\n(\n");
+ fprintf (file, "-----------------------------------------\n");
+ fprintf (file, "%d\taffine univariate chrecs\n", stats->nb_affine);
+ fprintf (file, "%d\taffine multivariate chrecs\n", stats->nb_affine_multivar);
+ fprintf (file, "%d\tdegree greater than 2 polynomials\n",
+ stats->nb_higher_poly);
+ fprintf (file, "%d\taffine peeled chrecs\n", stats->nb_peeled);
+ fprintf (file, "%d\texponential chrecs\n", stats->nb_expo);
+ fprintf (file, "%d\tchrec_top chrecs\n", stats->nb_chrec_top);
+ fprintf (file, "%d\tinterval chrecs\n", stats->nb_chrec_top);
+ fprintf (file, "-----------------------------------------\n");
+ fprintf (file, "%d\ttotal chrecs\n", stats->nb_chrecs);
+ fprintf (file, "%d\twith undetermined coefficients\n",
+ stats->nb_undetermined);
+ fprintf (file, "-----------------------------------------\n");
+ fprintf (file, "%d\tchrecs in the scev database\n",
+ (int) htab_elements (scalar_evolution_info));
+ fprintf (file, "%d\tsets in the scev database\n", nb_set_scev);
+ fprintf (file, "%d\tgets in the scev database\n", nb_get_scev);
+ fprintf (file, "-----------------------------------------\n");
+ fprintf (file, ")\n\n");
+}
+
+/* Gather statistics about CHREC. */
+
+static void
+gather_chrec_stats (tree chrec, struct chrec_stats *stats)
+{
+ if (dump_file && (dump_flags & TDF_STATS))
+ {
+ fprintf (dump_file, "(classify_chrec ");
+ print_generic_expr (dump_file, chrec, 0);
+ fprintf (dump_file, "\n");
+ }
+
+ stats->nb_chrecs++;
+
+ if (chrec == NULL_TREE)
+ {
+ stats->nb_undetermined++;
+ return;
+ }
+
+ switch (TREE_CODE (chrec))
+ {
+ case POLYNOMIAL_CHREC:
+ if (evolution_function_is_affine_p (chrec))
+ {
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " affine_univariate\n");
+ stats->nb_affine++;
+ }
+ else if (evolution_function_is_affine_multivariate_p (chrec))
+ {
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " affine_multivariate\n");
+ stats->nb_affine_multivar++;
+ }
+ else
+ {
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " higher_degree_polynomial\n");
+ stats->nb_higher_poly++;
+ }
+
+ break;
+
+ case EXPONENTIAL_CHREC:
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " exponential\n");
+ stats->nb_expo++;
+ break;
+
+ case INTERVAL_CHREC:
+ if (chrec == chrec_top)
+ {
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " chrec_top\n");
+ stats->nb_chrec_top++;
+ }
+ else
+ {
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " interval chrec\n");
+ stats->nb_interval_chrec++;
+ }
+ break;
+
+ case PEELED_CHREC:
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " peeled chrec\n");
+ stats->nb_peeled++;
+ break;
+
+ default:
+ break;
+ }
+
+ if (chrec_contains_undetermined (chrec))
+ {
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, " undetermined\n");
+ stats->nb_undetermined++;
+ }
+
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, ")\n");
+}
+
+/* One of the drivers for testing the scalar evolutions analysis.
+ This function analyzes the scalar evolution of all the scalars
+ defined as loop phi nodes in one of the loops from the
+ EXIT_CONDITIONS array.
+
+ TODO Optimization: A loop is in canonical form if it contains only
+ a single scalar loop phi node. All the other scalars that have an
+ evolution in the loop are rewritten in function of this single
+ index. This allows the parallelization of the loop. */
+
+static void
+analyze_scalar_evolution_for_all_loop_phi_nodes (varray_type exit_conditions)
+{
+ unsigned int i;
+ struct chrec_stats stats;
+
+ reset_chrecs_counters (&stats);
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (exit_conditions); i++)
+ {
+ struct loop *loop;
+ basic_block bb;
+ tree phi, chrec;
+
+ loop = loop_of_stmt (VARRAY_TREE (exit_conditions, i));
+ bb = loop_header (loop);
+
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ if (is_gimple_reg (PHI_RESULT (phi)))
+ {
+ chrec = instantiate_parameters
+ (loop,
+ analyze_scalar_evolution (loop, PHI_RESULT (phi)));
+
+ if (dump_file && (dump_flags & TDF_STATS))
+ gather_chrec_stats (chrec, &stats);
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_STATS))
+ dump_chrecs_stats (dump_file, &stats);
+}
+
+/* Callback for htab_traverse, gathers information on chrecs in the
+ hashtable. */
+
+static int
+gather_stats_on_scev_database_1 (void **slot, void *stats)
+{
+ struct scev_info_str *entry = *slot;
+
+ gather_chrec_stats (entry->chrec, stats);
+
+ return 1;
+}
+
+/* Classify the chrecs of the whole database. */
+
+void
+gather_stats_on_scev_database (void)
+{
+ struct chrec_stats stats;
+
+ if (!dump_file)
+ return;
+
+ reset_chrecs_counters (&stats);
+
+ htab_traverse (scalar_evolution_info, gather_stats_on_scev_database_1,
+ &stats);
+
+ dump_chrecs_stats (dump_file, &stats);
+}
+
+
+
+static void initialize_scalar_evolutions_analyzer (void);
+static void scev_init (void);
+static void scev_analysis (void);
+static void scev_depend (void);
+static void scev_elim_checks (void);
+static void scev_vectorize (void);
+static void scev_done (void);
+static bool gate_scev (void);
+static bool gate_scev_analysis (void);
+static bool gate_scev_depend (void);
+static bool gate_scev_elim_checks (void);
+static bool gate_scev_vectorize (void);
+
+/* Initializer. */
+
+static void
+initialize_scalar_evolutions_analyzer (void)
+{
+ /* The elements below are unique. The values contained in these
+ intervals are not used. */
+ chrec_not_analyzed_yet = NULL_TREE;
+ chrec_top = build_interval_chrec
+ (build_int_2 (2222, 0), build_int_2 (3222, 0));
+ chrec_bot = build_interval_chrec
+ (build_int_2 (3333, 0), build_int_2 (4333, 0));
+}
+
+/* Initialize the analysis of scalar evolutions for LOOPS. */
+
+void
+scev_initialize (struct loops *loops)
+{
+ unsigned i;
+ current_loops = loops;
+
+ scalar_evolution_info = htab_create (100, hash_scev_info,
+ eq_scev_info, del_scev_info);
+ VARRAY_TREE_INIT (already_instantiated, 3,
+ "already_instantiated");
+
+ initialize_scalar_evolutions_analyzer ();
+
+ for (i = 1; i < loops->num; i++)
+ if (loops->parray[i])
+ flow_loop_scan (loops->parray[i], LOOP_EXIT_EDGES);
+}
+
+/* Initialize the analysis of scalar evolutions. */
+
+static void
+scev_init (void)
+{
+ current_loops = tree_loop_optimizer_init (NULL, flag_tree_loop != 0);
+ if (!current_loops)
+ return;
+ scev_initialize (current_loops);
+}
+
+/* Runs the analysis of scalar evolutions. */
+
+static void
+scev_analysis (void)
+{
+ varray_type exit_conditions;
+
+ VARRAY_GENERIC_PTR_INIT (exit_conditions, 37, "exit_conditions");
+ select_loops_exit_conditions (current_loops, &exit_conditions);
+
+#if 0
+ dump_file = stderr;
+ dump_flags = 31;
+#endif
+
+ if (dump_file && (dump_flags & TDF_STATS))
+ analyze_scalar_evolution_for_all_loop_phi_nodes (exit_conditions);
+
+ number_of_iterations_for_all_loops (exit_conditions);
+ VARRAY_CLEAR (exit_conditions);
+}
+
+/* Runs the analysis of all the data dependences. */
+
+static void
+scev_depend (void)
+{
+ analyze_all_data_dependences (current_loops);
+ dd_info_available = true;
+}
+
+static void
+scev_elim_checks (void)
+{
+ eliminate_redundant_checks ();
+}
+
+/* Runs the linear loop transformations. */
+
+static void
+scev_linear_transform (void)
+{
+ linear_transform_loops (current_loops);
+}
+
+/* Runs the canonical iv creation pass. */
+
+static void
+scev_iv_canon (void)
+{
+ canonicalize_induction_variables (current_loops);
+}
+
+/* Runs the vectorization pass. */
+
+static void
+scev_vectorize (void)
+{
+ bitmap_clear (vars_to_rename);
+
+ vectorize_loops (current_loops);
+}
+
+/* Finalize the scalar evolution analysis. */
+
+void
+scev_finalize (void)
+{
+ htab_delete (scalar_evolution_info);
+ already_instantiated = NULL;
+ current_loops = NULL;
+}
+
+/* Finalize the scalar evolution passes. */
+
+static void
+scev_done (void)
+{
+ if (current_loops)
+ {
+ loop_optimizer_finalize (current_loops, NULL);
+ scev_finalize ();
+ cleanup_tree_cfg ();
+ }
+
+ dd_info_available = false;
+}
+
+static bool
+gate_scev (void)
+{
+ return (flag_scalar_evolutions != 0
+ || flag_tree_vectorize != 0
+ || flag_all_data_deps != 0
+ || flag_tree_elim_checks != 0
+ || flag_tree_loop_linear != 0);
+}
+
+static bool
+gate_scev_analysis (void)
+{
+ return current_loops && flag_scalar_evolutions != 0;
+}
+
+static bool
+gate_scev_depend (void)
+{
+ return current_loops && flag_all_data_deps != 0;
+}
+
+static bool
+gate_scev_elim_checks (void)
+{
+ return current_loops && flag_tree_elim_checks != 0;
+}
+
+static bool
+gate_scev_linear_transform (void)
+{
+ return current_loops && flag_tree_loop_linear != 0;
+}
+
+static bool
+gate_scev_iv_canon (void)
+{
+ return (current_loops
+ /* Only run this pass if we will be able to eliminate the
+ superfluous ivs we create. */
+ && flag_tree_loop);
+}
+
+static bool
+gate_scev_vectorize (void)
+{
+ return current_loops && flag_tree_vectorize != 0;
+}
+
+static bool
+gate_ddg (void)
+{
+ return dd_info_available && flag_ddg && flag_scalar_evolutions != 0;
+}
+
+static bool
+gate_delete_ddg (void)
+{
+ return flag_ddg && flag_scalar_evolutions != 0;
+}
+
+static void
+create_dg_graph (void)
+{
+ dg_create_graph (current_loops);
+}
+
+struct tree_opt_pass pass_scev =
+{
+ NULL, /* name */
+ gate_scev, /* gate */
+ NULL, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_init =
+{
+ NULL, /* name */
+ NULL, /* gate */
+ scev_init, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_anal =
+{
+ "scev", /* name */
+ gate_scev_analysis, /* gate */
+ scev_analysis, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_SCALAR_EVOLUTIONS, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_depend =
+{
+ "ddall", /* name */
+ gate_scev_depend, /* gate */
+ scev_depend, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_ALL_DATA_DEPS, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ PROP_scev, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_vectorize =
+{
+ "vect", /* name */
+ gate_scev_vectorize, /* gate */
+ scev_vectorize, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_VECTORIZATION, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func | TODO_rename_vars /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_linear_transform =
+{
+ "ltrans", /* name */
+ gate_scev_linear_transform, /* gate */
+ scev_linear_transform, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_LINEAR_TRANSFORM, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_iv_canon =
+{
+ "ivcan", /* name */
+ gate_scev_iv_canon, /* gate */
+ scev_iv_canon, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_LOOP_IVCANON, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_elim_checks =
+{
+ "elck", /* name */
+ gate_scev_elim_checks, /* gate */
+ scev_elim_checks, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_ELIM_CHECKS, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_scev_done =
+{
+ NULL, /* name */
+ NULL, /* gate */
+ scev_done, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_ddg =
+{
+ "ddg", /* name */
+ gate_ddg, /* gate */
+ create_dg_graph, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_DEP_GRAPH, /* tv_id */
+ PROP_scev, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+};
+
+struct tree_opt_pass pass_delete_ddg =
+{
+ "delete ddg", /* name */
+ gate_delete_ddg, /* gate */
+ dg_delete_graph, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_DEP_GRAPH, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+};
diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h
new file mode 100644
index 00000000000..3a638b6e3cc
--- /dev/null
+++ b/gcc/tree-scalar-evolution.h
@@ -0,0 +1,40 @@
+/* Scalar evolution detector.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <s.pop@laposte.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_TREE_SCALAR_EVOLUTION_H
+#define GCC_TREE_SCALAR_EVOLUTION_H
+
+extern tree first_iteration_non_satisfying (enum tree_code, unsigned,
+ tree, tree);
+extern tree number_of_iterations_in_loop (struct loop *);
+extern tree get_loop_exit_condition (struct loop *);
+
+extern void scev_initialize (struct loops *loops);
+extern void scev_finalize (void);
+extern tree analyze_scalar_evolution (struct loop *, tree);
+extern tree analyze_scalar_evolution_in_loop (struct loop *, struct loop *,
+ tree);
+extern tree instantiate_parameters (struct loop *, tree);
+extern void eliminate_redundant_checks (void);
+extern void gather_stats_on_scev_database (void);
+
+
+#endif /* GCC_TREE_SCALAR_EVOLUTION_H */
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 9ba570f394d..36787e00adb 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -98,7 +98,7 @@ struct alias_info
/* Array of counters to keep track of how many times each pointer has
been dereferenced in the program. This is used by the alias grouping
heuristic in compute_flow_insensitive_aliasing. */
- size_t *num_references;
+ varray_type num_references;
/* Total number of virtual operands that will be needed to represent
all the aliases of all the pointers found in the program. */
@@ -369,13 +369,9 @@ init_alias_info (void)
ai = xcalloc (1, sizeof (struct alias_info));
ai->ssa_names_visited = BITMAP_XMALLOC ();
- VARRAY_TREE_INIT (ai->processed_ptrs, 20, "processed_ptrs");
+ VARRAY_TREE_INIT (ai->processed_ptrs, 50, "processed_ptrs");
ai->addresses_needed = BITMAP_XMALLOC ();
- /* FIXME. We probably want a hash table here. This array has to
- be big enough to hold the existing variables and the memory tags
- created during alias analysis. Since we can't create more than 2 tags
- per pointer, 3 times the number of referenced vars is enough. */
- ai->num_references = xcalloc (3 * num_referenced_vars, sizeof (size_t));
+ VARRAY_UINT_INIT (ai->num_references, num_referenced_vars, "num_references");
ai->written_vars = BITMAP_XMALLOC ();
ai->dereferenced_ptrs_store = BITMAP_XMALLOC ();
ai->dereferenced_ptrs_load = BITMAP_XMALLOC ();
@@ -409,7 +405,7 @@ delete_alias_info (struct alias_info *ai)
}
free (ai->pointers);
- free (ai->num_references);
+ ai->num_references = NULL;
BITMAP_FREE (ai->written_vars);
BITMAP_FREE (ai->dereferenced_ptrs_store);
BITMAP_FREE (ai->dereferenced_ptrs_load);
@@ -587,8 +583,15 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
ssa_name_ann_t ptr_ann;
bool is_store;
+ /* If the operand's variable may be aliased, keep track
+ of how many times we've referenced it. This is used
+ for alias grouping in compute_flow_sensitive_aliasing.
+ Note that we don't need to grow AI->NUM_REFERENCES
+ because we are processing regular variables, not
+ memory tags (the array's initial size is set to
+ NUM_REFERENCED_VARS). */
if (may_be_aliased (SSA_NAME_VAR (op)))
- ai->num_references[v_ann->uid]++;
+ (VARRAY_UINT (ai->num_references, v_ann->uid))++;
if (!POINTER_TYPE_P (TREE_TYPE (op)))
continue;
@@ -610,8 +613,10 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
ptr_ann->name_mem_tag = get_nmt_for (op);
/* Keep track of how many time we've dereferenced each
- pointer. */
- ai->num_references[v_ann->uid]++;
+ pointer. Again, we don't need to grow
+ AI->NUM_REFERENCES because we're processing
+ existing program variables. */
+ (VARRAY_UINT (ai->num_references, v_ann->uid))++;
/* If this is a store operation, mark OP as being
dereferenced to store, otherwise mark it as being
@@ -648,7 +653,7 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
var_ann_t ann = var_ann (var);
bitmap_set_bit (ai->written_vars, ann->uid);
if (may_be_aliased (var))
- ai->num_references[ann->uid]++;
+ (VARRAY_UINT (ai->num_references, ann->uid))++;
}
/* Mark variables in VDEF operands as being written to. */
@@ -804,8 +809,10 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
if (may_alias_p (p_map->var, p_map->set, var, v_map->set))
{
- size_t num_tag_refs = ai->num_references[tag_ann->uid];
- size_t num_var_refs = ai->num_references[v_ann->uid];
+ size_t num_tag_refs, num_var_refs;
+
+ num_tag_refs = VARRAY_UINT (ai->num_references, tag_ann->uid);
+ num_var_refs = VARRAY_UINT (ai->num_references, v_ann->uid);
/* Add VAR to TAG's may-aliases set. */
add_may_alias (tag, var);
@@ -870,7 +877,7 @@ group_aliases_into (tree tag, sbitmap tag_aliases, struct alias_info *ai)
{
size_t i;
var_ann_t tag_ann = var_ann (tag);
- size_t num_tag_refs = ai->num_references[tag_ann->uid];
+ size_t num_tag_refs = VARRAY_UINT (ai->num_references, tag_ann->uid);
EXECUTE_IF_SET_IN_SBITMAP (tag_aliases, 0, i,
{
@@ -1214,8 +1221,14 @@ setup_pointers_and_addressables (struct alias_info *ai)
/* All the dereferences of pointer VAR count as references of
TAG. Since TAG can be associated with several pointers, add
- the dereferences of VAR to the TAG. */
- ai->num_references[t_ann->uid] += ai->num_references[v_ann->uid];
+ the dereferences of VAR to the TAG. We may need to grow
+ AI->NUM_REFERENCES because we have been adding name and
+ type tags. */
+ if (t_ann->uid >= VARRAY_SIZE (ai->num_references))
+ VARRAY_GROW (ai->num_references, t_ann->uid + 10);
+
+ VARRAY_UINT (ai->num_references, t_ann->uid)
+ += VARRAY_UINT (ai->num_references, v_ann->uid);
}
}
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index effc148a844..69bd452038c 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -697,6 +697,9 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb)
redirect_edge_and_branch (bb->succ, post_dom_bb);
PENDING_STMT (bb->succ) = NULL;
+ /* Dominators are wrong now. */
+ free_dominance_info (CDI_DOMINATORS);
+
/* The edge is no longer associated with a conditional, so it does
not have TRUE/FALSE flags. */
bb->succ->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
@@ -743,6 +746,7 @@ print_stats (void)
stats.removed_phis, stats.total_phis, (int) percg);
}
}
+
/* Initialization for this pass. Set up the used data structures. */
@@ -797,6 +801,8 @@ tree_dce_done (bool aggressive)
In aggressive mode, control dependences are taken into account, which
results in more dead code elimination, but at the cost of some time.
+ If NO_CFG_CHANGES is true, avoid changing cfg.
+
FIXME: Aggressive mode before PRE doesn't work currently because
the dominance info is not invalidated after DCE1. This is
not an issue right now because we only run aggressive DCE
@@ -804,10 +810,13 @@ tree_dce_done (bool aggressive)
start experimenting with pass ordering. */
static void
-perform_tree_ssa_dce (bool aggressive)
+perform_tree_ssa_dce (bool aggressive, bool no_cfg_changes)
{
struct edge_list *el = NULL;
+ if (no_cfg_changes && aggressive)
+ abort ();
+
tree_dce_init (aggressive);
if (aggressive)
@@ -829,7 +838,8 @@ perform_tree_ssa_dce (bool aggressive)
if (aggressive)
free_dominance_info (CDI_POST_DOMINATORS);
- cleanup_tree_cfg ();
+ if (!no_cfg_changes)
+ cleanup_tree_cfg ();
/* Debugging dumps. */
if (dump_file)
@@ -841,17 +851,25 @@ perform_tree_ssa_dce (bool aggressive)
tree_dce_done (aggressive);
}
+/* Cleanup the dead code, but avoid cfg changes. */
+
+void
+tree_ssa_dce_no_cfg_changes (void)
+{
+ perform_tree_ssa_dce (false, true);
+}
+
/* Pass entry points. */
static void
tree_ssa_dce (void)
{
- perform_tree_ssa_dce (/*aggressive=*/false);
+ perform_tree_ssa_dce (/*aggressive=*/false, false);
}
static void
tree_ssa_cd_dce (void)
{
- perform_tree_ssa_dce (/*aggressive=*/optimize >= 2);
+ perform_tree_ssa_dce (/*aggressive=*/optimize >= 2, false);
}
static bool
@@ -892,4 +910,3 @@ struct tree_opt_pass pass_cd_dce =
TODO_ggc_collect | TODO_verify_ssa | TODO_verify_flow
/* todo_flags_finish */
};
-
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index d8dfc02de47..af11b49a93e 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -35,6 +35,7 @@ Boston, MA 02111-1307, USA. */
#include "function.h"
#include "diagnostic.h"
#include "timevar.h"
+#include "cfgloop.h"
#include "tree-dump.h"
#include "tree-flow.h"
#include "domwalk.h"
@@ -539,6 +540,10 @@ tree_ssa_dominator_optimize (void)
{
basic_block bb;
struct dom_walk_data walk_data;
+ struct loops *loops;
+
+ /* Compute the natural loops. */
+ loops = loop_optimizer_init (NULL);
/* Mark loop edges so we avoid threading across loop boundaries.
This may result in transforming natural loop into irreducible
@@ -626,7 +631,7 @@ tree_ssa_dominator_optimize (void)
if (cfg_altered
&& bitmap_first_set_bit (vars_to_rename) >= 0)
{
- rewrite_into_ssa ();
+ rewrite_into_ssa (false);
bitmap_clear (vars_to_rename);
VARRAY_GROW (const_and_copies, highest_ssa_version);
VARRAY_GROW (vrp_data, highest_ssa_version);
@@ -643,6 +648,8 @@ tree_ssa_dominator_optimize (void)
/* Remove any unreachable blocks left behind and linearize the CFG. */
cleanup_tree_cfg ();
+ loop_optimizer_finalize (loops, NULL);
+
/* Debugging dumps. */
if (dump_file && (dump_flags & TDF_STATS))
dump_dominator_optimization_stats (dump_file);
@@ -1634,7 +1641,8 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
/* See if the RHS_DEF_STMT has the same form as our statement. */
if (TREE_CODE (rhs_def_stmt) == MODIFY_EXPR
- && TREE_CODE (TREE_OPERAND (rhs_def_stmt, 1)) == rhs_code)
+ && TREE_CODE (TREE_OPERAND (rhs_def_stmt, 1)) == rhs_code
+ && loop_of_stmt (rhs_def_stmt) == loop_of_stmt (stmt))
{
tree rhs_def_operand;
@@ -1662,7 +1670,9 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
tree rhs_def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));
/* See if the RHS_DEF_STMT has the same form as our statement. */
- if (TREE_CODE (rhs_def_stmt) == MODIFY_EXPR)
+ if (TREE_CODE (rhs_def_stmt) == MODIFY_EXPR
+ && TREE_CODE (TREE_OPERAND (rhs_def_stmt, 1)) == rhs_code
+ && loop_of_stmt (rhs_def_stmt) == loop_of_stmt (stmt))
{
tree rhs_def_rhs = TREE_OPERAND (rhs_def_stmt, 1);
enum tree_code rhs_def_code = TREE_CODE (rhs_def_rhs);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
new file mode 100644
index 00000000000..b02269d9981
--- /dev/null
+++ b/gcc/tree-ssa-loop-im.c
@@ -0,0 +1,1094 @@
+/* Loop invariant motion.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "output.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "domwalk.h"
+#include "params.h"
+#include "tree-pass.h"
+#include "flags.h"
+
+/* A list of dependencies. */
+
+struct depend
+{
+ tree stmt;
+ struct depend *next;
+};
+
+/* The possibilities of statement movement. */
+
+enum move_pos
+{
+ MOVE_IMPOSSIBLE, /* No movement -- side effect expression. */
+ MOVE_PRESERVE_EXECUTION, /* Must not cause the non-executed statement
+ become executed -- memory accesses, ... */
+ MOVE_POSSIBLE /* Unlimited movement. */
+};
+
+/* The auxiliary data kept for each statement. */
+
+struct lim_aux_data
+{
+ struct loop *max_loop; /* The outermost loop in that the statement
+ is invariant. */
+
+ struct loop *tgt_loop; /* The loop out of that we want to move the
+ invariant. */
+
+ struct loop *always_executed_in;
+ /* The outermost loop for that we are sure
+ the statement is executed if the loop
+ is entered. */
+
+ bool sm_done; /* The store motion for a memory reference in
+ the statement has already been decided. */
+
+ unsigned cost; /* Cost of the computation of the value. */
+
+ struct depend *depends; /* List of statements that must be moved as
+ well. */
+};
+
+#define LIM_DATA(STMT) ((struct lim_aux_data *) (stmt_ann (STMT)->common.aux))
+
+/* Description of a use. */
+
+struct use
+{
+ tree *addr; /* The use itself. */
+ tree stmt; /* The statement in that it occurs. */
+ struct use *next; /* Next use in the chain. */
+};
+
+/* Minimum cost of an expensive expression. */
+#define LIM_EXPENSIVE ((unsigned) PARAM_VALUE (PARAM_LIM_EXPENSIVE))
+
+/* The outermost loop for that execution of the header guarantees that the
+ block will be executed. */
+#define ALWAYS_EXECUTED_IN(BB) ((struct loop *) (BB)->aux)
+
+/* Maximum uid in the statement in the function. */
+
+static unsigned max_uid;
+
+/* Checks whether MEM is a memory access that might fail. */
+
+static bool
+unsafe_memory_access_p (tree mem)
+{
+ tree base, idx;
+
+ switch (TREE_CODE (mem))
+ {
+ case ADDR_EXPR:
+ return false;
+
+ case COMPONENT_REF:
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ return unsafe_memory_access_p (TREE_OPERAND (mem, 0));
+
+ case ARRAY_REF:
+ base = TREE_OPERAND (mem, 0);
+ idx = TREE_OPERAND (mem, 1);
+ if (unsafe_memory_access_p (base))
+ return true;
+
+ if (TREE_CODE_CLASS (TREE_CODE (idx)) != 'c')
+ return true;
+
+ return !in_array_bounds_p (base, idx);
+
+ case INDIRECT_REF:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Determines whether it is possible to move the statement STMT. */
+
+static enum move_pos
+movement_possibility (tree stmt)
+{
+ tree lhs, rhs;
+
+ if (flag_unswitch_loops
+ && TREE_CODE (stmt) == COND_EXPR)
+ {
+ /* If we perform unswitching, force the operands of the invariant
+ condition to be moved out of the loop. */
+ get_stmt_operands (stmt);
+
+ return MOVE_POSSIBLE;
+ }
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ return MOVE_IMPOSSIBLE;
+
+ if (stmt_ends_bb_p (stmt))
+ return MOVE_IMPOSSIBLE;
+
+ get_stmt_operands (stmt);
+
+ if (stmt_ann (stmt)->has_volatile_ops)
+ return MOVE_IMPOSSIBLE;
+
+ lhs = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (lhs) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+ return MOVE_IMPOSSIBLE;
+
+ rhs = TREE_OPERAND (stmt, 1);
+
+ if (TREE_SIDE_EFFECTS (rhs))
+ return MOVE_IMPOSSIBLE;
+
+ if (TREE_CODE (lhs) != SSA_NAME
+ || tree_could_trap_p (rhs)
+ || unsafe_memory_access_p (rhs))
+ return MOVE_PRESERVE_EXECUTION;
+
+ return MOVE_POSSIBLE;
+}
+
+/* Returns the outermost loop in that DEF behaves as an invariant with respect
+ to LOOP. */
+
+static struct loop *
+outermost_invariant_loop (tree def, struct loop *loop)
+{
+ tree def_stmt;
+ basic_block def_bb;
+ struct loop *max_loop;
+
+ if (is_gimple_min_invariant (def))
+ return superloop_at_depth (loop, 1);
+
+ def_stmt = SSA_NAME_DEF_STMT (def);
+ def_bb = bb_for_stmt (def_stmt);
+ if (!def_bb)
+ return superloop_at_depth (loop, 1);
+
+ max_loop = find_common_loop (loop, def_bb->loop_father);
+
+ if (LIM_DATA (def_stmt) && LIM_DATA (def_stmt)->max_loop)
+ max_loop = find_common_loop (max_loop,
+ LIM_DATA (def_stmt)->max_loop->outer);
+ if (max_loop == loop)
+ return NULL;
+ max_loop = superloop_at_depth (loop, max_loop->depth + 1);
+
+ return max_loop;
+}
+
+/* Adds a dependency on DEF to DATA on statement inside LOOP. If ADD_COST is
+ true, add the cost of the computation to the cost in DATA. */
+
+static bool
+add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
+ bool add_cost)
+{
+ tree def_stmt = SSA_NAME_DEF_STMT (def);
+ basic_block def_bb = bb_for_stmt (def_stmt);
+ struct loop *max_loop;
+ struct depend *dep;
+
+ if (!def_bb)
+ return true;
+
+ max_loop = outermost_invariant_loop (def, loop);
+ if (!max_loop)
+ return false;
+
+ if (flow_loop_nested_p (data->max_loop, max_loop))
+ data->max_loop = max_loop;
+
+ if (!LIM_DATA (def_stmt))
+ return true;
+
+ if (add_cost
+ && def_bb->loop_father == loop)
+ data->cost += LIM_DATA (def_stmt)->cost;
+
+ dep = xmalloc (sizeof (struct depend));
+ dep->stmt = def_stmt;
+ dep->next = data->depends;
+ data->depends = dep;
+
+ return true;
+}
+
+/* Estimates a cost of statement STMT. TODO -- the values here are just ad-hoc
+ constants. The estimates should be based on target-specific values. */
+
+static unsigned
+stmt_cost (tree stmt)
+{
+ tree lhs, rhs;
+ unsigned cost = 1;
+
+ /* Always try to create possibilities for unswitching. */
+ if (TREE_CODE (stmt) == COND_EXPR)
+ return 20;
+
+ lhs = TREE_OPERAND (stmt, 0);
+ rhs = TREE_OPERAND (stmt, 1);
+
+ /* Hoisting memory references out should almost surely be a win. */
+ if (!is_gimple_variable (lhs))
+ cost += 20;
+ if (is_gimple_addr_expr_arg (rhs) && !is_gimple_variable (rhs))
+ cost += 20;
+
+ switch (TREE_CODE (rhs))
+ {
+ case CALL_EXPR:
+ /* So should be hoisting calls. */
+
+ /* Unless the call is a builtin_constant_p; this always folds to a
+ constant, so moving it is useless. */
+ rhs = get_callee_fndecl (rhs);
+ if (DECL_BUILT_IN (rhs)
+ && DECL_FUNCTION_CODE (rhs) == BUILT_IN_CONSTANT_P)
+ return 0;
+
+ cost += 20;
+ break;
+
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ case CEIL_DIV_EXPR:
+ case FLOOR_DIV_EXPR:
+ case ROUND_DIV_EXPR:
+ case EXACT_DIV_EXPR:
+ case CEIL_MOD_EXPR:
+ case FLOOR_MOD_EXPR:
+ case ROUND_MOD_EXPR:
+ case TRUNC_MOD_EXPR:
+ /* Division and multiplication are usually expensive. */
+ cost += 20;
+ break;
+
+ default:
+ break;
+ }
+
+ return cost;
+}
+
+/* Determine maximal level to that it is possible to move a statement STMT.
+ If MUST_PRESERVE_EXEC is true, we must preserve the fact whether the
+ statement is executed. */
+
+static bool
+determine_max_movement (tree stmt, bool must_preserve_exec)
+{
+ basic_block bb = bb_for_stmt (stmt);
+ struct loop *loop = bb->loop_father;
+ struct loop *level;
+ struct lim_aux_data *lim_data = LIM_DATA (stmt);
+ use_optype uses;
+ vuse_optype vuses;
+ vdef_optype vdefs;
+ stmt_ann_t ann = stmt_ann (stmt);
+ unsigned i;
+
+ if (must_preserve_exec)
+ level = ALWAYS_EXECUTED_IN (bb);
+ else
+ level = superloop_at_depth (loop, 1);
+ lim_data->max_loop = level;
+
+ uses = USE_OPS (ann);
+ for (i = 0; i < NUM_USES (uses); i++)
+ if (!add_dependency (USE_OP (uses, i), lim_data, loop, true))
+ return false;
+
+ vuses = VUSE_OPS (ann);
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ if (!add_dependency (VUSE_OP (vuses, i), lim_data, loop, false))
+ return false;
+
+ vdefs = VDEF_OPS (ann);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ if (!add_dependency (VDEF_OP (vdefs, i), lim_data, loop, false))
+ return false;
+
+ lim_data->cost += stmt_cost (stmt);
+
+ return true;
+}
+
+/* Sets a level to that the statement STMT is moved to LEVEL due to moving of
+ statement from ORIG_LOOP and update levels of all dependencies. */
+
+static void
+set_level (tree stmt, struct loop *orig_loop, struct loop *level)
+{
+ struct loop *stmt_loop = bb_for_stmt (stmt)->loop_father;
+ struct depend *dep;
+
+ stmt_loop = find_common_loop (orig_loop, stmt_loop);
+ if (LIM_DATA (stmt) && LIM_DATA (stmt)->tgt_loop)
+ stmt_loop = find_common_loop (stmt_loop,
+ LIM_DATA (stmt)->tgt_loop->outer);
+ if (flow_loop_nested_p (stmt_loop, level))
+ return;
+
+ if (!LIM_DATA (stmt))
+ abort ();
+
+ if (level != LIM_DATA (stmt)->max_loop
+ && !flow_loop_nested_p (LIM_DATA (stmt)->max_loop, level))
+ abort ();
+
+ LIM_DATA (stmt)->tgt_loop = level;
+ for (dep = LIM_DATA (stmt)->depends; dep; dep = dep->next)
+ set_level (dep->stmt, orig_loop, level);
+}
+
+/* Determines a level to that really hoist the statement STMT. TODO -- use
+ profiling information to set it more sanely. */
+
+static void
+set_profitable_level (tree stmt)
+{
+ set_level (stmt, bb_for_stmt (stmt)->loop_father, LIM_DATA (stmt)->max_loop);
+}
+
+/* Checks whether STMT is a nonpure call. */
+
+static bool
+nonpure_call_p (tree stmt)
+{
+ if (TREE_CODE (stmt) == MODIFY_EXPR)
+ stmt = TREE_OPERAND (stmt, 1);
+
+ return (TREE_CODE (stmt) == CALL_EXPR
+ && TREE_SIDE_EFFECTS (stmt));
+}
+
+/* Releases the memory occupied by DATA. */
+
+static void
+free_lim_aux_data (struct lim_aux_data *data)
+{
+ struct depend *dep, *next;
+
+ for (dep = data->depends; dep; dep = next)
+ {
+ next = dep->next;
+ free (dep);
+ }
+ free (data);
+}
+
+/* Determine invariantness of statements in basic block BB. Callback
+ for walk_dominator_tree. */
+
+static void
+determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
+ basic_block bb)
+{
+ enum move_pos pos;
+ block_stmt_iterator bsi;
+ tree stmt;
+ bool maybe_never = ALWAYS_EXECUTED_IN (bb) == NULL;
+ struct loop *outermost = ALWAYS_EXECUTED_IN (bb);
+
+ if (!bb->loop_father->outer)
+ return;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Basic block %d (loop %d -- depth %d):\n\n",
+ bb->index, bb->loop_father->num, bb->loop_father->depth);
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ stmt = bsi_stmt (bsi);
+
+ pos = movement_possibility (stmt);
+ if (pos == MOVE_IMPOSSIBLE)
+ {
+ if (nonpure_call_p (stmt))
+ {
+ maybe_never = true;
+ outermost = NULL;
+ }
+ continue;
+ }
+
+ stmt_ann (stmt)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
+ LIM_DATA (stmt)->always_executed_in = outermost;
+
+ if (maybe_never && pos == MOVE_PRESERVE_EXECUTION)
+ continue;
+
+ if (!determine_max_movement (stmt, pos == MOVE_PRESERVE_EXECUTION))
+ {
+ LIM_DATA (stmt)->max_loop = NULL;
+ continue;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_generic_stmt_indented (dump_file, stmt, 0, 2);
+ fprintf (dump_file, " invariant up to level %d, cost %d.\n\n",
+ LIM_DATA (stmt)->max_loop->depth,
+ LIM_DATA (stmt)->cost);
+ }
+
+ if (LIM_DATA (stmt)->cost >= LIM_EXPENSIVE)
+ set_profitable_level (stmt);
+ }
+}
+
+/* For each statement determines the outermost loop in that it is invariant,
+ statements on whose motion it depends and the cost of the computation. */
+
+static void
+determine_invariantness (void)
+{
+ struct dom_walk_data walk_data;
+
+ memset (&walk_data, 0, sizeof (struct dom_walk_data));
+ walk_data.before_dom_children_before_stmts = determine_invariantness_stmt;
+
+ init_walk_dominator_tree (&walk_data);
+ walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
+ fini_walk_dominator_tree (&walk_data);
+}
+
+/* Commits edge inserts and updates loop info. */
+
+void
+loop_commit_inserts (void)
+{
+ unsigned old_last_basic_block, i;
+ basic_block bb;
+
+ old_last_basic_block = last_basic_block;
+ bsi_commit_edge_inserts (NULL);
+ for (i = old_last_basic_block; i < (unsigned) last_basic_block; i++)
+ {
+ bb = BASIC_BLOCK (i);
+ add_bb_to_loop (bb,
+ find_common_loop (bb->succ->dest->loop_father,
+ bb->pred->src->loop_father));
+ }
+}
+
+/* Moves the statements in basic block BB to the right place. Callback
+ for walk_dominator_tree. */
+
+static void
+move_computations_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
+ basic_block bb)
+{
+ struct loop *level;
+ block_stmt_iterator bsi;
+ tree stmt;
+ unsigned cost = 0;
+
+ if (!bb->loop_father->outer)
+ return;
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
+ {
+ stmt = bsi_stmt (bsi);
+
+ if (!LIM_DATA (stmt))
+ {
+ bsi_next (&bsi);
+ continue;
+ }
+
+ cost = LIM_DATA (stmt)->cost;
+ level = LIM_DATA (stmt)->tgt_loop;
+ free_lim_aux_data (LIM_DATA (stmt));
+ stmt_ann (stmt)->common.aux = NULL;
+
+ if (!level)
+ {
+ bsi_next (&bsi);
+ continue;
+ }
+
+ /* We do not really want to move conditionals out of the loop; we just
+ placed it here to force its operands to be moved if neccesary. */
+ if (TREE_CODE (stmt) == COND_EXPR)
+ continue;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Moving statement\n");
+ print_generic_stmt (dump_file, stmt, 0);
+ fprintf (dump_file, "(cost %u) out of loop %d.\n\n",
+ cost, level->num);
+ }
+ bsi_insert_on_edge (loop_preheader_edge (level), stmt);
+ bsi_remove (&bsi);
+ }
+}
+
+/* Moves the statements to the requiered level. */
+
+static void
+move_computations (void)
+{
+ struct dom_walk_data walk_data;
+
+ memset (&walk_data, 0, sizeof (struct dom_walk_data));
+ walk_data.before_dom_children_before_stmts = move_computations_stmt;
+
+ init_walk_dominator_tree (&walk_data);
+ walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
+ fini_walk_dominator_tree (&walk_data);
+
+ loop_commit_inserts ();
+ rewrite_into_ssa (false);
+ if (bitmap_first_set_bit (vars_to_rename) >= 0)
+ {
+ /* The rewrite of ssa names may cause violation of loop closed ssa
+ form invariants. TODO -- avoid these rewrites completely.
+ Information in virtual phi nodes is sufficient for it. */
+ rewrite_into_loop_closed_ssa ();
+ }
+ bitmap_clear (vars_to_rename);
+}
+
+/* Checks whether variable in *INDEX is movable out of the loop passed
+ in DATA. Callback for for_each_index. */
+
+static bool
+may_move_till (tree base ATTRIBUTE_UNUSED, tree *index, void *data)
+{
+ struct loop *loop = data, *max_loop;
+
+ if (TREE_CODE (*index) != SSA_NAME)
+ return true;
+
+ max_loop = outermost_invariant_loop (*index, loop);
+
+ if (!max_loop)
+ return false;
+
+ if (loop == max_loop
+ || flow_loop_nested_p (max_loop, loop))
+ return true;
+
+ return false;
+}
+
+/* Forces variable in *INDEX to be moved out of the loop passed
+ in DATA. Callback for for_each_index. */
+
+static bool
+force_move_till (tree base ATTRIBUTE_UNUSED, tree *index, void *data)
+{
+ tree stmt;
+
+ if (TREE_CODE (*index) != SSA_NAME)
+ return true;
+
+ stmt = SSA_NAME_DEF_STMT (*index);
+ if (IS_EMPTY_STMT (stmt))
+ return true;
+
+ set_level (stmt, bb_for_stmt (stmt)->loop_father, data);
+
+ return true;
+}
+
+/* Records use of *ADDR in STMT to USES. */
+
+static void
+record_use (struct use **uses, tree stmt, tree *addr)
+{
+ struct use *use = xmalloc (sizeof (struct use));
+
+ use->stmt = stmt;
+ use->addr = addr;
+
+ use->next = *uses;
+ *uses = use;
+}
+
+/* Releases list of uses USES. */
+
+static void
+free_uses (struct use *uses)
+{
+ struct use *act;
+
+ while (uses)
+ {
+ act = uses;
+ uses = uses->next;
+ free (act);
+ }
+}
+
+/* Finds the single address inside LOOP corresponding to the virtual
+ ssa version defined in STMT. Stores the list of its uses to USES. */
+
+static tree
+single_reachable_address (struct loop *loop, tree stmt, struct use **uses)
+{
+ tree *queue = xmalloc (sizeof (tree) * max_uid);
+ sbitmap seen = sbitmap_alloc (max_uid);
+ tree addr = NULL, *aaddr;
+ unsigned in_queue = 1;
+ dataflow_t df;
+ unsigned i, n;
+
+ sbitmap_zero (seen);
+
+ *uses = NULL;
+
+ queue[0] = stmt;
+ SET_BIT (seen, stmt_ann (stmt)->uid);
+
+ while (in_queue)
+ {
+ stmt = queue[--in_queue];
+
+ if (LIM_DATA (stmt)
+ && LIM_DATA (stmt)->sm_done)
+ goto fail;
+
+ switch (TREE_CODE (stmt))
+ {
+ case MODIFY_EXPR:
+ aaddr = &TREE_OPERAND (stmt, 0);
+ if (is_gimple_reg (*aaddr)
+ || !is_gimple_lvalue (*aaddr))
+ aaddr = &TREE_OPERAND (stmt, 1);
+ if (is_gimple_reg (*aaddr)
+ || !is_gimple_lvalue (*aaddr)
+ || (addr && !operand_equal_p (*aaddr, addr, 0)))
+ goto fail;
+ addr = *aaddr;
+
+ record_use (uses, stmt, aaddr);
+ /* Fallthru. */
+
+ case PHI_NODE:
+ df = get_immediate_uses (stmt);
+ n = num_immediate_uses (df);
+
+ for (i = 0; i < n; i++)
+ {
+ stmt = immediate_use (df, i);
+
+ if (!flow_bb_inside_loop_p (loop, bb_for_stmt (stmt)))
+ continue;
+
+ if (TEST_BIT (seen, stmt_ann (stmt)->uid))
+ continue;
+ SET_BIT (seen, stmt_ann (stmt)->uid);
+
+ queue[in_queue++] = stmt;
+ }
+
+ break;
+
+ default:
+ goto fail;
+ }
+ }
+
+ free (queue);
+ sbitmap_free (seen);
+
+ return addr;
+
+fail:
+ free_uses (*uses);
+ *uses = NULL;
+ free (queue);
+ sbitmap_free (seen);
+
+ return NULL;
+}
+
+/* Rewrites uses in list USES by TMP_VAR. */
+
+static void
+rewrite_uses (tree tmp_var, struct use *uses)
+{
+ vdef_optype vdefs;
+ vuse_optype vuses;
+ unsigned i;
+ tree var;
+
+ for (; uses; uses = uses->next)
+ {
+ vdefs = STMT_VDEF_OPS (uses->stmt);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ {
+ var = SSA_NAME_VAR (VDEF_RESULT (vdefs, i));
+ bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
+ }
+
+ vuses = STMT_VUSE_OPS (uses->stmt);
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ {
+ var = SSA_NAME_VAR (VUSE_OP (vuses, i));
+ bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
+ }
+
+ *uses->addr = tmp_var;
+ modify_stmt (uses->stmt);
+ }
+}
+
+/* Records request for store motion of address ADDR from LOOP. USES is the
+ list of uses to replace. Exits from the LOOP are stored in EXITS, there
+ are N_EXITS of them. */
+
+static void
+schedule_sm (struct loop *loop, edge *exits, unsigned n_exits, tree addr,
+ struct use *uses)
+{
+ struct use *use;
+ tree tmp_var;
+ unsigned i;
+ tree load, store;
+
+ tmp_var = create_tmp_var (TREE_TYPE (addr), "lsm_tmp");
+ add_referenced_tmp_var (tmp_var);
+ bitmap_set_bit (vars_to_rename, var_ann (tmp_var)->uid);
+
+ for_each_index (&addr, force_move_till, loop);
+
+ rewrite_uses (tmp_var, uses);
+ for (use = uses; use; use = use->next)
+ if (LIM_DATA (use->stmt))
+ LIM_DATA (use->stmt)->sm_done = true;
+
+ /* Emit the load & stores. */
+ load = build (MODIFY_EXPR, void_type_node, tmp_var, addr);
+ modify_stmt (load);
+ stmt_ann (load)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
+ LIM_DATA (load)->max_loop = loop;
+ LIM_DATA (load)->tgt_loop = loop;
+
+ /* Put this into the latch, so that we are sure it will be processed after
+ all dependencies. */
+ bsi_insert_on_edge (loop_latch_edge (loop), load);
+
+ for (i = 0; i < n_exits; i++)
+ {
+ store = build (MODIFY_EXPR, void_type_node,
+ unshare_expr (addr), tmp_var);
+ bsi_insert_on_edge (exits[i], store);
+ }
+}
+
+/* For a virtual ssa version REG, determine whether all its uses inside
+ the LOOP correspond to a single address and whether it is hoistable. LOOP
+ has N_EXITS stored in EXITS. */
+
+static void
+determine_lsm_reg (struct loop *loop, edge *exits, unsigned n_exits, tree reg)
+{
+ tree addr;
+ struct use *uses, *use;
+ struct loop *must_exec;
+
+ if (is_gimple_reg (reg))
+ return;
+
+ addr = single_reachable_address (loop, SSA_NAME_DEF_STMT (reg), &uses);
+ if (!addr)
+ return;
+
+ if (!for_each_index (&addr, may_move_till, loop))
+ {
+ free_uses (uses);
+ return;
+ }
+
+ if (unsafe_memory_access_p (addr))
+ {
+ for (use = uses; use; use = use->next)
+ {
+ if (!LIM_DATA (use->stmt))
+ continue;
+
+ must_exec = LIM_DATA (use->stmt)->always_executed_in;
+ if (!must_exec)
+ continue;
+
+ if (must_exec == loop
+ || flow_loop_nested_p (must_exec, loop))
+ break;
+ }
+
+ if (!use)
+ {
+ free_uses (uses);
+ return;
+ }
+ }
+
+ schedule_sm (loop, exits, n_exits, addr, uses);
+ free_uses (uses);
+}
+
+/* Checks whether LOOP with N_EXITS exits stored in EXITS is suitable for
+ a store motion. */
+
+static bool
+loop_suitable_for_sm (struct loop *loop ATTRIBUTE_UNUSED, edge *exits, unsigned n_exits)
+{
+ unsigned i;
+
+ for (i = 0; i < n_exits; i++)
+ if (exits[i]->flags & EDGE_ABNORMAL)
+ return false;
+
+ return true;
+}
+
+/* Determine for all memory references whether we can hoist them out of
+ the LOOP. */
+
+static void
+determine_lsm_loop (struct loop *loop)
+{
+ tree phi;
+ unsigned n_exits;
+ edge *exits = get_loop_exit_edges (loop, &n_exits);
+
+ if (!loop_suitable_for_sm (loop, exits, n_exits))
+ {
+ free (exits);
+ return;
+ }
+
+ for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+ determine_lsm_reg (loop, exits, n_exits, PHI_RESULT (phi));
+
+ free (exits);
+}
+
+/* Determine for all memory references inside LOOPS whether we can hoist them
+ out. */
+
+static void
+determine_lsm (struct loops *loops)
+{
+ struct loop *loop;
+ basic_block bb;
+
+ /* Create a UID for each statement in the function. Ordering of the
+ UIDs is not important for this pass. */
+ max_uid = 0;
+ FOR_EACH_BB (bb)
+ {
+ block_stmt_iterator bsi;
+ tree phi;
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ stmt_ann (bsi_stmt (bsi))->uid = max_uid++;
+
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ stmt_ann (phi)->uid = max_uid++;
+ }
+
+ compute_immediate_uses (TDFA_USE_VOPS, NULL);
+
+ /* Pass the loops from the outermost. For each virtual operand loop phi node
+ check whether all the references inside the loop correspond to a single
+ address, and if so, move them. */
+
+ loop = loops->tree_root->inner;
+ while (1)
+ {
+ determine_lsm_loop (loop);
+
+ if (loop->inner)
+ {
+ loop = loop->inner;
+ continue;
+ }
+ while (!loop->next)
+ {
+ loop = loop->outer;
+ if (loop == loops->tree_root)
+ {
+ free_df ();
+ loop_commit_inserts ();
+ return;
+ }
+ }
+ loop = loop->next;
+ }
+}
+
+/* Fills ALWAYS_EXECUTED_IN for basic blocks in LOOP. CONTAINS_CALL is
+ the bitmap of blocks that contain a call. */
+
+static void
+fill_always_executed_in (struct loop *loop, sbitmap contains_call)
+{
+ basic_block bb = NULL, *bbs, last = NULL;
+ unsigned i;
+ edge e;
+ struct loop *inn_loop = loop;
+
+ if (!loop->header->aux)
+ {
+ bbs = get_loop_body_in_dom_order (loop);
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ bb = bbs[i];
+
+ if (dominated_by_p (CDI_DOMINATORS, loop->latch, bb))
+ last = bb;
+
+ if (TEST_BIT (contains_call, bb->index))
+ break;
+
+ for (e = bb->succ; e; e = e->succ_next)
+ if (!flow_bb_inside_loop_p (loop, e->dest))
+ break;
+ if (e)
+ break;
+
+ /* A loop might be infinite (TODO use simple loop analysis
+ to disprove this if possible). */
+ if (bb->flags & BB_IRREDUCIBLE_LOOP)
+ break;
+
+ if (!flow_bb_inside_loop_p (inn_loop, bb))
+ break;
+
+ if (bb->loop_father->header == bb)
+ {
+ if (!dominated_by_p (CDI_DOMINATORS, loop->latch, bb))
+ break;
+
+ /* In a loop that is always entered we may proceed anyway.
+ But record that we entered it and stop once we leave it. */
+ inn_loop = bb->loop_father;
+ }
+ }
+
+ while (1)
+ {
+ last->aux = loop;
+ if (last == loop->header)
+ break;
+ last = get_immediate_dominator (CDI_DOMINATORS, last);
+ }
+
+ free (bbs);
+ }
+
+ for (loop = loop->inner; loop; loop = loop->next)
+ fill_always_executed_in (loop, contains_call);
+}
+
+/* Compute information needed by the pass. LOOPS is the loop tree. */
+
+static void
+tree_ssa_lim_initialize (struct loops *loops)
+{
+ sbitmap contains_call = sbitmap_alloc (last_basic_block);
+ block_stmt_iterator bsi;
+ struct loop *loop;
+ basic_block bb;
+
+ /* Set ALWAYS_EXECUTED_IN. Quadratic, can be improved. */
+
+ sbitmap_zero (contains_call);
+ FOR_EACH_BB (bb)
+ {
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ if (nonpure_call_p (bsi_stmt (bsi)))
+ break;
+ }
+
+ if (!bsi_end_p (bsi))
+ SET_BIT (contains_call, bb->index);
+ }
+
+ for (loop = loops->tree_root->inner; loop; loop = loop->next)
+ fill_always_executed_in (loop, contains_call);
+
+ sbitmap_free (contains_call);
+}
+
+/* Cleans up after the invariant motion pass. */
+
+static void
+tree_ssa_lim_finalize (void)
+{
+ basic_block bb;
+
+ FOR_EACH_BB (bb)
+ {
+ bb->aux = NULL;
+ }
+}
+
+/* Moves invariants from LOOPS. Only "expensive" invariants are moved out --
+ i.e. those that are likely to be win regardless of the register presure. */
+
+void
+tree_ssa_lim (struct loops *loops)
+{
+ tree_ssa_lim_initialize (loops);
+
+ /* For each statement determine the outermost loop in that it is
+ invariant and cost for computing the invariant. */
+ determine_invariantness ();
+
+ /* For each memory reference determine whether it is possible to hoist it
+ out of the loop. Force the necessary invariants to be moved out of the
+ loops as well. */
+ determine_lsm (loops);
+
+ /* Move the expressions that are expensive enough. */
+ move_computations ();
+
+ tree_ssa_lim_finalize ();
+}
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
new file mode 100644
index 00000000000..0cd64073eae
--- /dev/null
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -0,0 +1,487 @@
+/* Induction variable canonicalization.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* This pass detects the loops that iterate a constant number of times,
+ adds a canonical induction variable (step -1, tested against 0)
+ and replaces the exit test. This enables the less powerful rtl
+ level analysis to use this information.
+
+ This might spoil the code in some cases (by increasing register pressure).
+ Note that in the case the new variable is not needed, ivopts will get rid
+ of it, so it might only be a problem when there are no other linear induction
+ variables. In that case the created optimization possibilities are likely
+ to pay up.
+
+ Additionally in case we detect that it is benefitial to unroll the
+ loop completely, we do it right here to expose the optimization
+ possibilities to the following passes. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "output.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "cfgloop.h"
+#include "tree-pass.h"
+#include "ggc.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
+#include "tree-scalar-evolution.h"
+#include "params.h"
+#include "flags.h"
+#include "tree-inline.h"
+
+/* Bound on the number of iterations we try to evaluate. */
+
+#define MAX_ITERATIONS_TO_TRACK 1000
+
+/* Determines a loop phi node of LOOP such that X is derived from it
+ by a chain of operations with constants. */
+
+static tree
+chain_of_csts_start (struct loop *loop, tree x)
+{
+ tree stmt = SSA_NAME_DEF_STMT (x);
+ basic_block bb = bb_for_stmt (stmt);
+ use_optype uses;
+
+ if (!bb
+ || !flow_bb_inside_loop_p (loop, bb))
+ return NULL_TREE;
+
+ if (TREE_CODE (stmt) == PHI_NODE)
+ {
+ if (bb == loop->header)
+ return stmt;
+
+ return NULL_TREE;
+ }
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ return NULL_TREE;
+
+ get_stmt_operands (stmt);
+ if (NUM_VUSES (STMT_VUSE_OPS (stmt)) > 0)
+ return NULL_TREE;
+ if (NUM_VDEFS (STMT_VDEF_OPS (stmt)) > 0)
+ return NULL_TREE;
+ if (NUM_DEFS (STMT_DEF_OPS (stmt)) > 1)
+ return NULL_TREE;
+ uses = STMT_USE_OPS (stmt);
+ if (NUM_USES (uses) != 1)
+ return NULL_TREE;
+
+ return chain_of_csts_start (loop, USE_OP (uses, 0));
+}
+
+/* Determines whether X is derived from a value of a phi node in LOOP
+ such that
+
+ * this derivation consists only from operations with constants
+ * the initial value of the phi node is constant
+ * its value in the next iteration can be derived from the current one
+ by a chain of operations with constants. */
+
+static tree
+get_base_for (struct loop *loop, tree x)
+{
+ tree phi, init, next;
+
+ if (is_gimple_min_invariant (x))
+ return x;
+
+ phi = chain_of_csts_start (loop, x);
+ if (!phi)
+ return NULL_TREE;
+
+ init = phi_element_for_edge (phi, loop_preheader_edge (loop))->def;
+ next = phi_element_for_edge (phi, loop_latch_edge (loop))->def;
+
+ if (TREE_CODE (next) != SSA_NAME)
+ return NULL_TREE;
+
+ if (!is_gimple_min_invariant (init))
+ return NULL_TREE;
+
+ if (chain_of_csts_start (loop, next) != phi)
+ return NULL_TREE;
+
+ return phi;
+}
+
+/* Evaluates value of X, provided that the value of the variable defined
+ in the loop phi node from that X is derived by operations with constants
+ is BASE. */
+
+static tree
+get_val_for (tree x, tree base)
+{
+ tree stmt, *op, nx, val;
+ use_optype uses;
+
+ if (!x)
+ return base;
+
+ stmt = SSA_NAME_DEF_STMT (x);
+ if (TREE_CODE (stmt) == PHI_NODE)
+ return base;
+
+ uses = STMT_USE_OPS (stmt);
+ op = USE_OP_PTR (uses, 0);
+
+ nx = *op;
+ val = get_val_for (nx, base);
+ *op = val;
+ val = fold (TREE_OPERAND (stmt, 1));
+ *op = nx;
+
+ return val;
+}
+
+/* Tries to count the number of iterations of LOOP till it exits by EXIT
+ by brute force. */
+
+static tree
+loop_niter_by_eval (struct loop *loop, edge exit)
+{
+ tree cond, cnd, acnd;
+ tree op[2], val[2], next[2], aval[2], phi[2];
+ unsigned i, j;
+ enum tree_code cmp;
+
+ cond = last_stmt (exit->src);
+ if (!cond || TREE_CODE (cond) != COND_EXPR)
+ return chrec_top;
+
+ cnd = COND_EXPR_COND (cond);
+ if (exit->flags & EDGE_TRUE_VALUE)
+ cnd = invert_truthvalue (cnd);
+
+ cmp = TREE_CODE (cnd);
+ switch (cmp)
+ {
+ case EQ_EXPR:
+ case NE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ case LT_EXPR:
+ case LE_EXPR:
+ for (j = 0; j < 2; j++)
+ op[j] = TREE_OPERAND (cnd, j);
+ break;
+
+ default:
+ return chrec_top;
+ }
+
+ for (j = 0; j < 2; j++)
+ {
+ phi[j] = get_base_for (loop, op[j]);
+ if (!phi[j])
+ return chrec_top;
+ }
+
+ for (j = 0; j < 2; j++)
+ {
+ if (TREE_CODE (phi[j]) == PHI_NODE)
+ {
+ val[j] = phi_element_for_edge (phi[j],
+ loop_preheader_edge (loop))->def;
+ next[j] = phi_element_for_edge (phi[j],
+ loop_latch_edge (loop))->def;
+ }
+ else
+ {
+ val[j] = phi[j];
+ next[j] = NULL_TREE;
+ op[j] = NULL_TREE;
+ }
+ }
+
+ for (i = 0; i < MAX_ITERATIONS_TO_TRACK; i++)
+ {
+ for (j = 0; j < 2; j++)
+ aval[j] = get_val_for (op[j], val[j]);
+
+ acnd = fold (build (cmp, boolean_type_node, aval[0], aval[1]));
+ if (integer_zerop (acnd))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "Proved that loop %d iterates %d times using brute force.\n",
+ loop->num, i);
+ return build_int_2 (i, 0);
+ }
+
+ for (j = 0; j < 2; j++)
+ val[j] = get_val_for (next[j], val[j]);
+ }
+
+ return chrec_top;
+}
+
+/* Finds the exit of the LOOP by that the loop exits after a constant
+ number of iterations and stores it to *EXIT. The iteration count
+ is returned. */
+
+static tree
+find_loop_niter_by_eval (struct loop *loop, edge *exit)
+{
+ unsigned n_exits, i;
+ edge *exits = get_loop_exit_edges (loop, &n_exits);
+ edge ex;
+ tree niter = NULL_TREE, aniter;
+
+ *exit = NULL;
+ for (i = 0; i < n_exits; i++)
+ {
+ ex = exits[i];
+ if (!just_once_each_iteration_p (loop, ex->src))
+ continue;
+
+ aniter = loop_niter_by_eval (loop, ex);
+ if (TREE_CODE (aniter) != INTEGER_CST)
+ continue;
+
+ if (niter
+ && !integer_nonzerop (fold (build (LT_EXPR, boolean_type_node,
+ aniter, niter))))
+ continue;
+
+ niter = aniter;
+ *exit = ex;
+ }
+ free (exits);
+
+ return niter ? niter : chrec_top;
+}
+
+/* Adds a canonical induction variable to LOOP iterating NITER times. EXIT
+ is the exit edge whose condition is replaced. */
+
+static void
+create_canonical_iv (struct loop *loop, edge exit, tree niter)
+{
+ edge in;
+ tree cond, type, var;
+ block_stmt_iterator incr_at;
+ enum tree_code cmp;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Added canonical iv to loop %d, ", loop->num);
+ print_generic_expr (dump_file, niter, TDF_SLIM);
+ fprintf (dump_file, " iterations.\n");
+ }
+
+ cond = last_stmt (exit->src);
+ in = exit->src->succ;
+ if (in == exit)
+ in = in->succ_next;
+
+ type = TREE_TYPE (niter);
+ niter = fold (build (PLUS_EXPR, type,
+ niter, convert (type, integer_one_node)));
+ incr_at = bsi_last (in->src);
+ create_iv (niter, convert (type, integer_minus_one_node), NULL_TREE, loop,
+ &incr_at, false, NULL, &var);
+
+ cmp = (exit->flags & EDGE_TRUE_VALUE) ? EQ_EXPR : NE_EXPR;
+ COND_EXPR_COND (cond) = build (cmp, boolean_type_node,
+ var, convert (type, integer_zero_node));
+ modify_stmt (cond);
+}
+
+/* Computes an estimated number of insns in LOOP. */
+
+unsigned
+estimate_loop_size (struct loop *loop)
+{
+ basic_block *body = get_loop_body (loop);
+ block_stmt_iterator bsi;
+ unsigned size = 0, i;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ for (bsi = bsi_start (body[i]); !bsi_end_p (bsi); bsi_next (&bsi))
+ size += estimate_num_insns (bsi_stmt (bsi));
+ free (body);
+
+ return size;
+}
+
+/* Tries to unroll LOOP completely, i.e. NITER times. LOOPS is the
+ loop tree. COMPLETELY_UNROLL is true if we should unroll the loop
+ even if it may cause code growth. EXIT is the exit of the loop
+ that should be eliminated. */
+
+static bool
+try_unroll_loop_completely (struct loops *loops, struct loop *loop,
+ edge exit, tree niter,
+ bool completely_unroll)
+{
+ tree max_unroll = build_int_2 (PARAM_VALUE (PARAM_MAX_COMPLETELY_PEEL_TIMES),
+ 0);
+ unsigned n_unroll, ninsns;
+ tree cond, dont_exit, do_exit;
+
+ if (loop->inner)
+ return false;
+
+ if (!integer_nonzerop (fold (build (LE_EXPR, boolean_type_node,
+ niter, max_unroll))))
+ return false;
+ n_unroll = tree_low_cst (niter, 1);
+
+ if (n_unroll && !completely_unroll)
+ return false;
+
+ ninsns = estimate_loop_size (loop);
+
+ if (n_unroll * ninsns
+ > (unsigned) PARAM_VALUE (PARAM_MAX_COMPLETELY_PEELED_INSNS))
+ return false;
+
+ if (exit->flags & EDGE_TRUE_VALUE)
+ {
+ dont_exit = boolean_false_node;
+ do_exit = boolean_true_node;
+ }
+ else
+ {
+ dont_exit = boolean_true_node;
+ do_exit = boolean_false_node;
+ }
+ cond = last_stmt (exit->src);
+
+ if (n_unroll)
+ {
+ if (!flag_unroll_loops)
+ return false;
+
+ COND_EXPR_COND (cond) = dont_exit;
+ modify_stmt (cond);
+
+ if (!tree_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
+ loops, n_unroll, NULL,
+ NULL, NULL, NULL, 0))
+ return false;
+ }
+
+ COND_EXPR_COND (cond) = do_exit;
+ modify_stmt (cond);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unrolled loop %d completely.\n", loop->num);
+
+ return true;
+}
+
+/* Adds a canonical induction variable to LOOP if suitable. LOOPS is the loops
+ tree. CREATE_IV is true if we may create a new iv. COMPLETELY_UNROLL is
+ true if we should do complete unrolling even if it may cause the code
+ growth. */
+
+static void
+canonicalize_loop_induction_variables (struct loops *loops, struct loop *loop,
+ bool create_iv, bool completely_unroll)
+{
+ edge exit = NULL;
+ tree niter;
+
+ /* ??? Why is this needed? I.e. from where comes the invalid info? */
+ loop->nb_iterations = NULL;
+
+ niter = number_of_iterations_in_loop (loop);
+
+ if (TREE_CODE (niter) == INTEGER_CST)
+ {
+#ifdef ENABLE_CHECKING
+ tree nit;
+ edge ex;
+#endif
+
+ exit = loop_exit_edge (loop, 0);
+ if (!just_once_each_iteration_p (loop, exit->src))
+ return;
+
+ /* The result of number_of_iterations_in_loop is by one higher than
+ we expect (i.e. it returns number of executions of the exit
+ condition, not of the loop latch edge). */
+ niter = fold (build (PLUS_EXPR, TREE_TYPE (niter), niter,
+ convert (TREE_TYPE (niter),
+ integer_minus_one_node)));
+
+#ifdef ENABLE_CHECKING
+ nit = find_loop_niter_by_eval (loop, &ex);
+
+ if (ex == exit
+ && TREE_CODE (nit) == INTEGER_CST
+ && !operand_equal_p (niter, nit, 0))
+ abort ();
+#endif
+ }
+ else
+ niter = find_loop_niter_by_eval (loop, &exit);
+
+ if (TREE_CODE (niter) != INTEGER_CST)
+ return;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Loop %d iterates ", loop->num);
+ print_generic_expr (dump_file, niter, TDF_SLIM);
+ fprintf (dump_file, " times.\n");
+ }
+
+ if (try_unroll_loop_completely (loops, loop, exit, niter, completely_unroll))
+ return;
+
+ if (create_iv)
+ create_canonical_iv (loop, exit, niter);
+}
+
+/* The main entry point of the pass. Adds canonical induction variables
+ to the suitable LOOPS. */
+
+void
+canonicalize_induction_variables (struct loops *loops)
+{
+ unsigned i;
+ struct loop *loop;
+ bool create_ivs = flag_unroll_loops || flag_branch_on_count_reg;
+ bool completely_unroll_loops = flag_unroll_loops;
+
+ for (i = 1; i < loops->num; i++)
+ {
+ loop = loops->parray[i];
+
+ if (loop)
+ canonicalize_loop_induction_variables (loops, loop, create_ivs,
+ completely_unroll_loops);
+ }
+}
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
new file mode 100644
index 00000000000..df567564dd7
--- /dev/null
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -0,0 +1,5077 @@
+/* Induction variable optimizations.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* This pass tries to find the optimal set of induction variables for the loop.
+ It optimizes just the basic linear induction variables (although adding
+ support for other types should not be too hard). It includes the
+ optimizations commonly known as strength reduction, induction variable
+ coalescing and induction variable elimination. It does it in the
+ following steps:
+
+ 1) The interesting uses of induction variables are found. This includes
+
+ -- uses of induction variables in non-linear expressions
+ -- adresses of arrays
+ -- comparisons of induction variables
+
+ 2) Candidates for the induction variables are found. This includes
+
+ -- old induction variables
+ -- the variables defined by expressions derived from the "interesting
+ uses" above
+
+ 3) The optimal (w.r. to a cost function) set of variables is chosen. The
+ cost function assigns a cost to sets of induction variables and consists
+ of three parts:
+
+ -- The use costs. Each of the interesting uses choses the best induction
+ variable in the set and adds its cost to the sum. The cost reflects
+ the time spent on modifying the induction variables value to be usable
+ for the given purpose (adding base and offset for arrays, etc.).
+ -- The variable costs. Each of the variables has a cost assigned that
+ reflects the costs assoctiated with incrementing the value of the
+ variable. The original variables are somewhat preferred.
+ -- The set cost. Depending on the size of the set, extra cost may be
+ added to reflect register pressure.
+
+ All the costs are defined in a machine-specific way, using the target
+ hooks and machine descriptions to determine them.
+
+ 4) The trees are transformed to use the new variables, the dead code is
+ removed.
+
+ All of this is done loop by loop. Doing it globally is theoretically
+ possible, it might give a better performance and it might enable us
+ to decide costs more precisely, but getting all the interactions right
+ would be complicated. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "output.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "varray.h"
+#include "expr.h"
+#include "tree-pass.h"
+#include "ggc.h"
+#include "insn-config.h"
+#include "recog.h"
+#include "hashtab.h"
+#include "tree-fold-const.h"
+#include "tree-chrec.h"
+#include "tree-scalar-evolution.h"
+
+/* The infinite cost. */
+#define INFTY 10000000
+
+/* The expected number of loop iterations. TODO -- use profiling instead of
+ this. */
+#define AVG_LOOP_NITER(LOOP) 5
+
+/* Just to shorten the ugly names. */
+#define EXEC_BINARY nondestructive_fold_binary_to_constant
+#define EXEC_UNARY nondestructive_fold_unary_to_constant
+
+/* Representation of the induction variable. */
+struct iv
+{
+ tree base; /* Initial value of the iv. */
+ tree step; /* Step of the iv (constant only). */
+ tree ssa_name; /* The ssa name with the value. */
+ bool biv_p; /* Is it a biv? */
+ bool have_use_for; /* Do we already have a use for it? */
+ unsigned use_id; /* The identificator in the use if it is the case. */
+};
+
+/* Per-ssa version information (induction variable descriptions, etc.). */
+struct version_info
+{
+ tree name; /* The ssa name. */
+ struct iv *iv; /* Induction variable description. */
+ bool has_nonlin_use; /* For a loop-level invariant, whether it is used in
+ an expression that is not an induction variable. */
+ unsigned inv_id; /* Id of an invariant. */
+ bool preserve_biv; /* For the original biv, whether to preserve it. */
+};
+
+/* Description of number of iterations of a loop. */
+struct tree_niter_desc
+{
+ tree assumptions; /* Assumptions for the number of iterations be valid. */
+ tree may_be_zero; /* Condition under that the loop exits in the first
+ iteration. */
+ tree niter; /* Number of iterations. */
+};
+
+/* Information attached to loop. */
+struct loop_data
+{
+ unsigned n_exits; /* Number of exit edges. */
+ edge single_exit; /* The exit edge in case there is exactly one and
+ its source dominates the loops latch. */
+ struct tree_niter_desc niter;
+ /* Number of iterations. */
+
+ unsigned regs_used; /* Number of registers used. */
+};
+
+/* Types of uses. */
+enum use_type
+{
+ USE_NONLINEAR_EXPR, /* Use in a nonlinear expression. */
+ USE_OUTER, /* The induction variable is used outside the loop. */
+ USE_ADDRESS, /* Use in an address. */
+ USE_COMPARE /* Use is a compare. */
+};
+
+/* The candidate - cost pair. */
+struct cost_pair
+{
+ struct iv_cand *cand; /* The candidate. */
+ unsigned cost; /* The cost. */
+ bitmap depends_on; /* The list of invariants that have to be
+ preserved. */
+};
+
+/* Use. */
+struct iv_use
+{
+ unsigned id; /* The id of the use. */
+ enum use_type type; /* Type of the use. */
+ struct iv *iv; /* The induction variable it is based on. */
+ tree stmt; /* Statement in that it occurs. */
+ tree *op_p; /* The place where it occurs. */
+ bitmap related_cands; /* The set of "related" iv candidates. */
+
+ unsigned n_map_members; /* Number of candidates in the cost_map list. */
+ struct cost_pair *cost_map;
+ /* The costs wrto the iv candidates. */
+
+ struct iv_cand *selected;
+ /* The selected candidate. */
+};
+
+/* The position where the iv is computed. */
+enum iv_position
+{
+ IP_NORMAL, /* At the end, just before the exit condition. */
+ IP_END, /* At the end of the latch block. */
+ IP_ORIGINAL /* The original biv. */
+};
+
+/* The induction variable candidate. */
+struct iv_cand
+{
+ unsigned id; /* The number of the candidate. */
+ bool important; /* Whether this is an "important" candidate, i.e. such
+ that it should be considered by all uses. */
+ enum iv_position pos; /* Where it is computed. */
+ tree incremented_at; /* For original biv, the statement where it is
+ incremented. */
+ tree var_before; /* The variable used for it before incrementation. */
+ tree var_after; /* The variable used for it after incrementation. */
+ struct iv *iv; /* The value of the candidate. NULL for
+ "pseudocandidate" used to indicate the possibility
+ to replace the final value of an iv by direct
+ computation of the value. */
+ unsigned cost; /* Cost of the candidate. */
+};
+
+/* The data used by the induction variable optimizations. */
+
+struct ivopts_data
+{
+ /* The currently optimized loop. */
+ struct loop *current_loop;
+
+ /* The size of version_info array allocated. */
+ unsigned version_info_size;
+
+ /* The array of information for the ssa names. */
+ struct version_info *version_info;
+
+ /* The bitmap of indices in version_info whose value was changed. */
+ bitmap relevant;
+
+ /* The maximum invariant id. */
+ unsigned max_inv_id;
+
+ /* The uses of induction variables. */
+ varray_type iv_uses;
+
+ /* The candidates. */
+ varray_type iv_candidates;
+
+ /* Whether to consider just related and important candidates when replacing a
+ use. */
+ bool consider_all_candidates;
+};
+
+/* Bound on number of candidates below that all candidates are considered. */
+
+#define CONSIDER_ALL_CANDIDATES_BOUND 15
+
+/* The properties of the target. */
+
+static unsigned avail_regs; /* Number of available registers. */
+static unsigned res_regs; /* Number of reserved registers. */
+static unsigned small_cost; /* The cost for register when there is a free one. */
+static unsigned pres_cost; /* The cost for register when there are not too many
+ free ones. */
+static unsigned spill_cost; /* The cost for register when we need to spill. */
+
+/* The list of trees for that the decl_rtl field must be reset is stored
+ here. */
+
+static varray_type decl_rtl_to_reset;
+
+#define SWAP(X, Y) do { void *tmp = (X); (X) = (Y); (Y) = tmp; } while (0)
+
+static tree force_gimple_operand (tree, tree *, bool);
+
+/* Number of uses recorded in DATA. */
+
+static inline unsigned
+n_iv_uses (struct ivopts_data *data)
+{
+ return VARRAY_ACTIVE_SIZE (data->iv_uses);
+}
+
+/* Ith use recorded in DATA. */
+
+static inline struct iv_use *
+iv_use (struct ivopts_data *data, unsigned i)
+{
+ return VARRAY_GENERIC_PTR_NOGC (data->iv_uses, i);
+}
+
+/* Number of candidates recorded in DATA. */
+
+static inline unsigned
+n_iv_cands (struct ivopts_data *data)
+{
+ return VARRAY_ACTIVE_SIZE (data->iv_candidates);
+}
+
+/* Ith candidate recorded in DATA. */
+
+static inline struct iv_cand *
+iv_cand (struct ivopts_data *data, unsigned i)
+{
+ return VARRAY_GENERIC_PTR_NOGC (data->iv_candidates, i);
+}
+
+/* The data for LOOP. */
+
+static inline struct loop_data *
+loop_data (struct loop *loop)
+{
+ return loop->aux;
+}
+
+/* Dumps information about the induction variable IV to FILE. */
+
+extern void dump_iv (FILE *, struct iv *);
+void
+dump_iv (FILE *file, struct iv *iv)
+{
+ fprintf (file, "ssa name ");
+ print_generic_expr (file, iv->ssa_name, TDF_SLIM);
+ fprintf (file, "\n");
+
+ if (iv->step)
+ {
+ fprintf (file, " base ");
+ print_generic_expr (file, iv->base, TDF_SLIM);
+ fprintf (file, "\n");
+
+ fprintf (file, " step ");
+ print_generic_expr (file, iv->step, TDF_SLIM);
+ fprintf (file, "\n");
+ }
+ else
+ {
+ fprintf (file, " invariant ");
+ print_generic_expr (file, iv->base, TDF_SLIM);
+ fprintf (file, "\n");
+ }
+
+ if (iv->biv_p)
+ fprintf (file, " is a biv\n");
+}
+
+/* Dumps information about the USE to FILE. */
+
+extern void dump_use (FILE *, struct iv_use *);
+void
+dump_use (FILE *file, struct iv_use *use)
+{
+ struct iv *iv = use->iv;
+
+ fprintf (file, "use %d\n", use->id);
+
+ switch (use->type)
+ {
+ case USE_NONLINEAR_EXPR:
+ fprintf (file, " generic\n");
+ break;
+
+ case USE_OUTER:
+ fprintf (file, " outside\n");
+ break;
+
+ case USE_ADDRESS:
+ fprintf (file, " address\n");
+ break;
+
+ case USE_COMPARE:
+ fprintf (file, " compare\n");
+ break;
+
+ default:
+ abort ();
+ }
+
+ fprintf (file, " in statement ");
+ print_generic_expr (file, use->stmt, TDF_SLIM);
+ fprintf (file, "\n");
+
+ fprintf (file, " at position ");
+ print_generic_expr (file, *use->op_p, TDF_SLIM);
+ fprintf (file, "\n");
+
+ if (iv->step)
+ {
+ fprintf (file, " base ");
+ print_generic_expr (file, iv->base, TDF_SLIM);
+ fprintf (file, "\n");
+
+ fprintf (file, " step ");
+ print_generic_expr (file, iv->step, TDF_SLIM);
+ fprintf (file, "\n");
+ }
+ else
+ {
+ fprintf (file, " invariant ");
+ print_generic_expr (file, iv->base, TDF_SLIM);
+ fprintf (file, "\n");
+ }
+
+ fprintf (file, " related candidates ");
+ dump_bitmap (file, use->related_cands);
+}
+
+/* Dumps information about the uses to FILE. */
+
+extern void dump_uses (FILE *, struct ivopts_data *);
+void
+dump_uses (FILE *file, struct ivopts_data *data)
+{
+ unsigned i;
+ struct iv_use *use;
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ use = iv_use (data, i);
+
+ dump_use (file, use);
+ fprintf (file, "\n");
+ }
+}
+
+/* Dumps information about induction variable candidate CAND to FILE. */
+
+extern void dump_cand (FILE *, struct iv_cand *);
+void
+dump_cand (FILE *file, struct iv_cand *cand)
+{
+ struct iv *iv = cand->iv;
+
+ fprintf (file, "candidate %d%s\n",
+ cand->id, cand->important ? " (important)" : "");
+
+ if (!iv)
+ {
+ fprintf (file, " final value replacement\n");
+ return;
+ }
+
+ switch (cand->pos)
+ {
+ case IP_NORMAL:
+ fprintf (file, " incremented before exit test\n");
+ break;
+
+ case IP_END:
+ fprintf (file, " incremented at end\n");
+ break;
+
+ case IP_ORIGINAL:
+ fprintf (file, " original biv\n");
+ break;
+ }
+
+ if (iv->step)
+ {
+ fprintf (file, " base ");
+ print_generic_expr (file, iv->base, TDF_SLIM);
+ fprintf (file, "\n");
+
+ fprintf (file, " step ");
+ print_generic_expr (file, iv->step, TDF_SLIM);
+ fprintf (file, "\n");
+ }
+ else
+ {
+ fprintf (file, " invariant ");
+ print_generic_expr (file, iv->base, TDF_SLIM);
+ fprintf (file, "\n");
+ }
+}
+
+/* Returns the info for ssa version VER. */
+
+static inline struct version_info *
+ver_info (struct ivopts_data *data, unsigned ver)
+{
+ return data->version_info + ver;
+}
+
+/* Returns the info for ssa name NAME. */
+
+static inline struct version_info *
+name_info (struct ivopts_data *data, tree name)
+{
+ return ver_info (data, SSA_NAME_VERSION (name));
+}
+
+/* Checks whether ARG is either NULL_TREE or constant zero. */
+
+static bool
+zero_p (tree arg)
+{
+ if (!arg)
+ return true;
+
+ return integer_zerop (arg);
+}
+
+/* Checks that X is integer constant that fits in unsigned HOST_WIDE_INT.
+ Similar to host_integerp (x, 1), but does not fail if the value is
+ negative. */
+
+static bool
+cst_and_fits_in_hwi (tree x)
+{
+ if (TREE_CODE (x) != INTEGER_CST)
+ return false;
+
+ return (TREE_INT_CST_HIGH (x) == 0
+ || TREE_INT_CST_HIGH (x) == -1);
+}
+
+/* Return value of a constant X. */
+
+static HOST_WIDE_INT
+int_cst_value (tree x)
+{
+ unsigned bits = TYPE_PRECISION (TREE_TYPE (x));
+ unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x);
+ bool negative = ((val >> (bits - 1)) & 1) != 0;
+
+ if (negative)
+ val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1;
+ else
+ val &= ~((~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1);
+
+ return val;
+}
+
+/* Builds integer constant of type TYPE and value VAL. */
+
+static tree
+build_int_cst (tree type, unsigned HOST_WIDE_INT val)
+{
+ unsigned bits = TYPE_PRECISION (type);
+ bool signed_p = !TREE_UNSIGNED (type);
+ bool negative = ((val >> (bits - 1)) & 1) != 0;
+ tree ival;
+
+ if (signed_p && negative)
+ {
+ val = val | (~(unsigned HOST_WIDE_INT) 0 << (bits - 1) << 1);
+ ival = build_int_2 (val, -1);
+ }
+ else
+ {
+ val = val & ~(~(unsigned HOST_WIDE_INT) 0 << (bits - 1) << 1);
+ ival = build_int_2 (val, 0);
+ }
+
+ return convert (type, ival);
+}
+
+/* Checks whether there exists number X such that X * B = A, counting modulo
+ 2^BITS. */
+
+static bool
+divide (unsigned bits, unsigned HOST_WIDE_INT a, unsigned HOST_WIDE_INT b,
+ HOST_WIDE_INT *x)
+{
+ unsigned HOST_WIDE_INT mask = ~(~(unsigned HOST_WIDE_INT) 0 << (bits - 1) << 1);
+ unsigned HOST_WIDE_INT inv, ex, val;
+ unsigned i;
+
+ a &= mask;
+ b &= mask;
+
+ /* First divide the whole equation by 2 as long as possible. */
+ while (!(a & 1) && !(b & 1))
+ {
+ a >>= 1;
+ b >>= 1;
+ bits--;
+ mask >>= 1;
+ }
+
+ if (!(b & 1))
+ {
+ /* If b is still even, a is odd and there is no such x. */
+ return false;
+ }
+
+ /* Find the inverse of b. We compute it as
+ b^(2^(bits - 1) - 1) (mod 2^bits). */
+ inv = 1;
+ ex = b;
+ for (i = 0; i < bits - 1; i++)
+ {
+ inv = (inv * ex) & mask;
+ ex = (ex * ex) & mask;
+ }
+
+ val = (a * inv) & mask;
+
+ if (((val * b) & mask) != a)
+ abort ();
+
+ if ((val >> (bits - 1)) & 1)
+ val |= ~mask;
+
+ *x = val;
+
+ return true;
+}
+
+/* Calls CBCK for each index in ADDR_P. It passes the pointer to the index,
+ the base if it is an array and DATA to the callback. If the callback returns
+ false, the whole search stops and false is returned. */
+
+bool
+for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data)
+{
+ tree *nxt;
+
+ for (; ; addr_p = nxt)
+ {
+ switch (TREE_CODE (*addr_p))
+ {
+ case SSA_NAME:
+ return cbck (NULL, addr_p, data);
+
+ case INDIRECT_REF:
+ nxt = &TREE_OPERAND (*addr_p, 0);
+ return cbck (NULL, nxt, data);
+
+ case BIT_FIELD_REF:
+ case COMPONENT_REF:
+ nxt = &TREE_OPERAND (*addr_p, 0);
+ break;
+
+ case ARRAY_REF:
+ nxt = &TREE_OPERAND (*addr_p, 0);
+ if (!cbck (*nxt, &TREE_OPERAND (*addr_p, 1), data))
+ return false;
+ break;
+
+ case VAR_DECL:
+ case PARM_DECL:
+ case STRING_CST:
+ case RESULT_DECL:
+ return true;
+
+ default:
+ abort ();
+ }
+ }
+}
+
+/* Forces IDX to be either constant or ssa name. Callback for
+ for_each_index. */
+
+struct idx_fs_data
+{
+ tree stmts;
+};
+
+static bool
+idx_force_simple (tree base ATTRIBUTE_UNUSED, tree *idx, void *data)
+{
+ struct idx_fs_data *d = data;
+ tree stmts;
+
+ *idx = force_gimple_operand (*idx, &stmts, true);
+
+ if (stmts)
+ {
+ tree_stmt_iterator tsi = tsi_start (d->stmts);
+ tsi_link_before (&tsi, stmts, TSI_SAME_STMT);
+ }
+
+ return true;
+}
+
+/* Updates TREE_ADDRESSABLE flag for the base variable of EXPR. */
+
+static void
+update_addressable_flag (tree expr)
+{
+ if (TREE_CODE (expr) != ADDR_EXPR)
+ abort ();
+
+ expr = TREE_OPERAND (expr, 0);
+ while (TREE_CODE (expr) == ARRAY_REF
+ || TREE_CODE (expr) == COMPONENT_REF
+ || TREE_CODE (expr) == REALPART_EXPR
+ || TREE_CODE (expr) == IMAGPART_EXPR)
+ expr = TREE_OPERAND (expr, 0);
+ if (TREE_CODE (expr) != VAR_DECL
+ && TREE_CODE (expr) != PARM_DECL)
+ return;
+
+ TREE_ADDRESSABLE (expr) = 1;
+}
+
+/* Expands EXPR to list of gimple statements STMTS, forcing it to become
+ a gimple operand that is returned. If SIMPLE is true, force the operand
+ to be either ssa_name or integer constant. */
+
+static tree
+force_gimple_operand (tree expr, tree *stmts, bool simple)
+{
+ enum tree_code code = TREE_CODE (expr);
+ char class = TREE_CODE_CLASS (code);
+ tree op0, op1, stmts0, stmts1, stmt, rhs, name;
+ tree_stmt_iterator tsi;
+ struct idx_fs_data d;
+ tree atmp;
+
+ if (is_gimple_val (expr)
+ && (!simple
+ || TREE_CODE (expr) == SSA_NAME
+ || TREE_CODE (expr) == INTEGER_CST))
+ {
+ if (code == ADDR_EXPR)
+ update_addressable_flag (expr);
+
+ *stmts = NULL_TREE;
+ return expr;
+ }
+
+ if (code == ADDR_EXPR)
+ {
+ op0 = TREE_OPERAND (expr, 0);
+ if (TREE_CODE (op0) == INDIRECT_REF)
+ return force_gimple_operand (TREE_OPERAND (op0, 0), stmts, simple);
+ }
+
+ atmp = create_tmp_var (TREE_TYPE (expr), "fgotmp");
+ add_referenced_tmp_var (atmp);
+
+ switch (class)
+ {
+ case '1':
+ case '2':
+ op0 = force_gimple_operand (TREE_OPERAND (expr, 0), &stmts0, false);
+ if (class == '2')
+ {
+ op1 = force_gimple_operand (TREE_OPERAND (expr, 1), &stmts1, false);
+ rhs = build (code, TREE_TYPE (expr), op0, op1);
+ }
+ else
+ {
+ rhs = build1 (code, TREE_TYPE (expr), op0);
+ stmts1 = NULL_TREE;
+ }
+
+ stmt = build (MODIFY_EXPR, void_type_node, atmp, rhs);
+ name = make_ssa_name (atmp, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+
+ if (stmts0)
+ {
+ *stmts = stmts0;
+ if (stmts1)
+ {
+ tsi = tsi_last (*stmts);
+ tsi_link_after (&tsi, stmts1, TSI_CONTINUE_LINKING);
+ }
+ }
+ else if (stmts1)
+ *stmts = stmts1;
+ else
+ *stmts = alloc_stmt_list ();
+
+ tsi = tsi_last (*stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ return name;
+
+ default:
+ break;
+ }
+
+ /* Some specially handled codes: */
+ switch (TREE_CODE (expr))
+ {
+ case ADDR_EXPR:
+ stmt = build (MODIFY_EXPR, void_type_node, atmp, expr);
+ name = make_ssa_name (atmp, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+
+ *stmts = alloc_stmt_list ();
+ tsi = tsi_last (*stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+
+ d.stmts = *stmts;
+ for_each_index (&TREE_OPERAND (expr, 0), idx_force_simple, &d);
+
+ update_addressable_flag (TREE_OPERAND (stmt, 1));
+
+ return name;
+
+ case INTEGER_CST:
+ if (!TREE_OVERFLOW (expr))
+ abort ();
+
+ stmt = build (MODIFY_EXPR, void_type_node, atmp, expr);
+ name = make_ssa_name (atmp, stmt);
+ TREE_OPERAND (stmt, 0) = name;
+
+ *stmts = alloc_stmt_list ();
+ tsi = tsi_last (*stmts);
+ tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
+ return name;
+
+ default:
+ abort ();
+ }
+}
+
+/* If TYPE is an array type, corresponding pointer type is returned,
+ otherwise the TYPE is returned unchanged. */
+
+static tree
+array2ptr (tree type)
+{
+ if (TREE_CODE (type) != ARRAY_TYPE)
+ return type;
+
+ return build_pointer_type (TREE_TYPE (type));
+}
+
+/* Sets single_exit field for loops. */
+
+static void
+find_exit_edges (void)
+{
+ basic_block bb;
+ edge e;
+ struct loop *src, *dest;;
+
+ FOR_EACH_BB (bb)
+ {
+ for (e = bb->succ; e; e = e->succ_next)
+ {
+ src = e->src->loop_father;
+ dest = find_common_loop (src, e->dest->loop_father);
+
+ for (; src != dest; src = src->outer)
+ {
+ loop_data (src)->n_exits++;
+ if (loop_data (src)->n_exits > 1)
+ {
+ loop_data (src)->single_exit = NULL;
+ continue;
+ }
+
+ if (!dominated_by_p (CDI_DOMINATORS, src->latch, e->src))
+ continue;
+
+ loop_data (src)->single_exit = e;
+ }
+ }
+ }
+}
+
+/* Returns the basic block in that statements should be emitted for IP_END
+ position in LOOP. */
+
+static basic_block
+ip_end_pos (struct loop *loop)
+{
+ return loop->latch;
+}
+
+/* Returns the basic block in that statements should be emitted for IP_NORMAL
+ position in LOOP. */
+
+static basic_block
+ip_normal_pos (struct loop *loop)
+{
+ tree last;
+ basic_block bb;
+ edge exit;
+
+ if (loop->latch->pred->pred_next)
+ return NULL;
+
+ bb = loop->latch->pred->src;
+ last = last_stmt (bb);
+ if (TREE_CODE (last) != COND_EXPR)
+ return NULL;
+
+ exit = bb->succ;
+ if (exit->dest == loop->latch)
+ exit = exit->succ_next;
+
+ if (flow_bb_inside_loop_p (loop, exit->dest))
+ return NULL;
+
+ return bb;
+}
+
+/* Returs true if STMT is after the place where the IP_NORMAL ivs will be
+ emitted in LOOP. */
+
+static bool
+stmt_after_ip_normal_pos (struct loop *loop, tree stmt)
+{
+ basic_block bb = ip_normal_pos (loop), sbb = bb_for_stmt (stmt);
+
+ if (!bb)
+ abort ();
+
+ if (sbb == loop->latch)
+ return true;
+
+ if (sbb != bb)
+ return false;
+
+ return stmt == last_stmt (bb);
+}
+
+/* Returns true if STMT if after the place where the original induction
+ variable CAND is incremented. */
+
+static bool
+stmt_after_ip_original_pos (struct iv_cand *cand, tree stmt)
+{
+ basic_block cand_bb = bb_for_stmt (cand->incremented_at);
+ basic_block stmt_bb = bb_for_stmt (stmt);
+ block_stmt_iterator bsi;
+
+ if (!dominated_by_p (CDI_DOMINATORS, stmt_bb, cand_bb))
+ return false;
+
+ if (stmt_bb != cand_bb)
+ return true;
+
+ /* Scan the block from the end, since the original ivs are usually
+ incremented at the end of the loop body. */
+ for (bsi = bsi_last (stmt_bb); ; bsi_prev (&bsi))
+ {
+ if (bsi_stmt (bsi) == cand->incremented_at)
+ return false;
+ if (bsi_stmt (bsi) == stmt)
+ return true;
+ }
+}
+
+/* Returns true if STMT if after the place where the induction variable
+ CAND is incremented in LOOP. */
+
+static bool
+stmt_after_increment (struct loop *loop, struct iv_cand *cand, tree stmt)
+{
+ switch (cand->pos)
+ {
+ case IP_END:
+ return false;
+
+ case IP_NORMAL:
+ return stmt_after_ip_normal_pos (loop, stmt);
+
+ case IP_ORIGINAL:
+ return stmt_after_ip_original_pos (cand, stmt);
+
+ default:
+ abort ();
+ }
+}
+
+/* Initializes data structures used by the iv optimization pass, stored
+ in DATA. LOOPS is the loop tree. */
+
+static void
+tree_ssa_iv_optimize_init (struct loops *loops, struct ivopts_data *data)
+{
+ unsigned i;
+
+ data->version_info_size = 2 * highest_ssa_version;
+ data->version_info = xcalloc (data->version_info_size,
+ sizeof (struct version_info));
+ data->relevant = BITMAP_XMALLOC ();
+ data->max_inv_id = 0;
+
+ for (i = 1; i < loops->num; i++)
+ if (loops->parray[i])
+ loops->parray[i]->aux = xcalloc (1, sizeof (struct loop_data));
+
+ find_exit_edges ();
+
+ VARRAY_GENERIC_PTR_NOGC_INIT (data->iv_uses, 20, "iv_uses");
+ VARRAY_GENERIC_PTR_NOGC_INIT (data->iv_candidates, 20, "iv_candidates");
+ VARRAY_GENERIC_PTR_NOGC_INIT (decl_rtl_to_reset, 20, "decl_rtl_to_reset");
+
+ scev_initialize (loops);
+}
+
+/* Allocates an induction variable with given initial value BASE and step STEP
+ for loop LOOP. */
+
+static struct iv *
+alloc_iv (tree base, tree step)
+{
+ struct iv *iv = xcalloc (1, sizeof (struct iv));
+
+ if (step && integer_zerop (step))
+ step = NULL_TREE;
+
+ iv->base = base;
+ iv->step = step;
+ iv->biv_p = false;
+ iv->have_use_for = false;
+ iv->use_id = 0;
+ iv->ssa_name = NULL_TREE;
+
+ return iv;
+}
+
+/* Sets STEP and BASE for induction variable IV. */
+
+static void
+set_iv (struct ivopts_data *data, tree iv, tree base, tree step)
+{
+ struct version_info *info = name_info (data, iv);
+
+ if (info->iv)
+ abort ();
+
+ bitmap_set_bit (data->relevant, SSA_NAME_VERSION (iv));
+ info->iv = alloc_iv (base, step);
+ info->iv->ssa_name = iv;
+}
+
+/* Finds induction variable declaration for VAR. */
+
+static struct iv *
+get_iv (struct ivopts_data *data, tree var)
+{
+ basic_block bb;
+
+ if (!name_info (data, var)->iv)
+ {
+ bb = bb_for_stmt (SSA_NAME_DEF_STMT (var));
+
+ if (!bb
+ || !flow_bb_inside_loop_p (data->current_loop, bb))
+ set_iv (data, var, var, NULL_TREE);
+ }
+
+ return name_info (data, var)->iv;
+}
+
+/* Determines the step of a biv defined in PHI. */
+
+static tree
+determine_biv_step (tree phi)
+{
+ struct loop *loop = bb_for_stmt (phi)->loop_father;
+ tree name = PHI_RESULT (phi), ev, step;
+ tree type = TREE_TYPE (name);
+
+ if (!is_gimple_reg (name))
+ return NULL_TREE;
+
+ /* Just work for integers and pointers. */
+ if (TREE_CODE (type) != INTEGER_TYPE
+ && TREE_CODE (type) != POINTER_TYPE)
+ return NULL_TREE;
+
+ ev = analyze_scalar_evolution (loop, name);
+ if (TREE_CODE (ev) == INTEGER_CST
+ || TREE_CODE (ev) == SSA_NAME)
+ return convert (type, integer_zero_node);
+
+ if (TREE_CODE (ev) != POLYNOMIAL_CHREC)
+ return NULL_TREE;
+
+ step = CHREC_RIGHT (ev);
+
+ if (TREE_CODE (step) != INTEGER_CST)
+ return NULL_TREE;
+
+ return step;
+}
+
+/* Retunrs false if INDEX is a ssa name that occurs in an
+ abnormal phi node. Callback for for_each_index. */
+
+static bool
+idx_contains_abnormal_ssa_name_p (tree base ATTRIBUTE_UNUSED, tree *index,
+ void *data ATTRIBUTE_UNUSED)
+{
+ if (TREE_CODE (*index) != SSA_NAME)
+ return true;
+
+ return SSA_NAME_OCCURS_IN_ABNORMAL_PHI (*index) == 0;
+}
+
+/* Returns true if EXPR contains a ssa name that occurs in an
+ abnormal phi node. */
+
+static bool
+contains_abnormal_ssa_name_p (tree expr)
+{
+ enum tree_code code = TREE_CODE (expr);
+ char class = TREE_CODE_CLASS (code);
+
+ if (code == SSA_NAME)
+ return SSA_NAME_OCCURS_IN_ABNORMAL_PHI (expr) != 0;
+
+ if (code == INTEGER_CST
+ || is_gimple_min_invariant (expr))
+ return false;
+
+ if (code == ADDR_EXPR)
+ return !for_each_index (&TREE_OPERAND (expr, 1),
+ idx_contains_abnormal_ssa_name_p,
+ NULL);
+
+ switch (class)
+ {
+ case '2':
+ if (contains_abnormal_ssa_name_p (TREE_OPERAND (expr, 1)))
+ return true;
+
+ /* Fallthru. */
+ case '1':
+ if (contains_abnormal_ssa_name_p (TREE_OPERAND (expr, 0)))
+ return true;
+
+ break;
+
+ default:
+ abort ();
+ }
+
+ return false;
+}
+
+/* Finds basic ivs. */
+
+static bool
+find_bivs (struct ivopts_data *data)
+{
+ tree phi, step, type, base;
+ bool found = false;
+ struct loop *loop = data->current_loop;
+
+ for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+ {
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)))
+ continue;
+
+ step = determine_biv_step (phi);
+
+ if (!step)
+ continue;
+ if (cst_and_fits_in_hwi (step)
+ && int_cst_value (step) == 0)
+ continue;
+
+ base = phi_element_for_edge (phi, loop_preheader_edge (loop))->def;
+ if (contains_abnormal_ssa_name_p (base))
+ continue;
+
+ type = TREE_TYPE (PHI_RESULT (phi));
+ base = convert (type, base);
+ step = convert (type, step);
+
+ set_iv (data, PHI_RESULT (phi), base, step);
+ found = true;
+ }
+
+ return found;
+}
+
+/* Marks basic ivs. */
+
+static void
+mark_bivs (struct ivopts_data *data)
+{
+ tree phi, var;
+ struct iv *iv, *incr_iv;
+ struct loop *loop = data->current_loop;
+ basic_block incr_bb;
+
+ for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+ {
+ iv = get_iv (data, PHI_RESULT (phi));
+ if (!iv)
+ continue;
+
+ var = phi_element_for_edge (phi, loop_latch_edge (loop))->def;
+ incr_iv = get_iv (data, var);
+ if (!incr_iv)
+ continue;
+
+ /* If the increment is in the subloop, ignore it. */
+ incr_bb = bb_for_stmt (SSA_NAME_DEF_STMT (var));
+ if (incr_bb->loop_father != data->current_loop
+ || (incr_bb->flags & BB_IRREDUCIBLE_LOOP))
+ continue;
+
+ iv->biv_p = true;
+ incr_iv->biv_p = true;
+ }
+}
+
+/* Finds definition of VAR and fills in BASE and STEP accordingly. */
+
+static bool
+get_var_def (struct ivopts_data *data, tree var, tree *base, tree *step)
+{
+ struct iv *iv;
+
+ if (is_gimple_min_invariant (var))
+ {
+ *base = var;
+ *step = NULL_TREE;
+ return true;
+ }
+
+ if (TREE_CODE (var) != SSA_NAME)
+ return false;
+
+ iv = get_iv (data, var);
+ if (!iv)
+ return false;
+
+ *base = iv->base;
+ *step = iv->step;
+
+ return true;
+}
+
+/* Checks whether STMT defines a linear induction variable and stores its
+ parameters to BASE and STEP. */
+
+static bool
+find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt,
+ tree *base, tree *step)
+{
+ tree lhs, type, ev;
+ struct loop *loop = data->current_loop;
+ basic_block bb = bb_for_stmt (stmt);
+
+ *base = NULL_TREE;
+ *step = NULL_TREE;
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ return false;
+
+ lhs = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (lhs) != SSA_NAME)
+ return false;
+
+ type = TREE_TYPE (lhs);
+ if (TREE_CODE (type) != INTEGER_TYPE
+ && TREE_CODE (type) != POINTER_TYPE)
+ return false;
+
+ ev = analyze_scalar_evolution_in_loop (loop, bb->loop_father, lhs);
+ if (tree_does_not_contain_chrecs (ev)
+ && !chrec_contains_symbols (ev))
+ {
+ *base = ev;
+ return true;
+ }
+
+ if (TREE_CODE (ev) != POLYNOMIAL_CHREC
+ || CHREC_VARIABLE (ev) != (unsigned) loop->num)
+ return false;
+
+ *step = CHREC_RIGHT (ev);
+ if (TREE_CODE (*step) != INTEGER_CST)
+ return false;
+ *base = CHREC_LEFT (ev);
+ if (tree_contains_chrecs (*base)
+ || chrec_contains_symbols (*base))
+ return false;
+
+ if (contains_abnormal_ssa_name_p (*base))
+ return false;
+
+ return true;
+}
+
+/* Finds general ivs in statement STMT. */
+
+static void
+find_givs_in_stmt (struct ivopts_data *data, tree stmt)
+{
+ tree base, step;
+
+ if (!find_givs_in_stmt_scev (data, stmt, &base, &step))
+ return;
+
+ set_iv (data, TREE_OPERAND (stmt, 0), base, step);
+}
+
+/* Finds general ivs in basic block BB. */
+
+static void
+find_givs_in_bb (struct ivopts_data *data, basic_block bb)
+{
+ block_stmt_iterator bsi;
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ find_givs_in_stmt (data, bsi_stmt (bsi));
+}
+
+/* Finds general ivs. */
+
+static void
+find_givs (struct ivopts_data *data)
+{
+ struct loop *loop = data->current_loop;
+ basic_block *body = get_loop_body_in_dom_order (loop);
+ unsigned i;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ find_givs_in_bb (data, body[i]);
+ free (body);
+}
+
+/* Computes inverse of X modulo 2^s, where MASK = 2^s-1. */
+
+static tree
+inverse (tree x, tree mask)
+{
+ tree type = TREE_TYPE (x);
+ tree ctr = EXEC_BINARY (RSHIFT_EXPR, type, mask, integer_one_node);
+ tree rslt = convert (type, integer_one_node);
+
+ while (integer_nonzerop (ctr))
+ {
+ rslt = EXEC_BINARY (MULT_EXPR, type, rslt, x);
+ rslt = EXEC_BINARY (BIT_AND_EXPR, type, rslt, mask);
+ x = EXEC_BINARY (MULT_EXPR, type, x, x);
+ x = EXEC_BINARY (BIT_AND_EXPR, type, x, mask);
+ ctr = EXEC_BINARY (RSHIFT_EXPR, type, ctr, integer_one_node);
+ }
+
+ return rslt;
+}
+
+/* Determine the number of iterations according to condition (for staying
+ inside loop) BASE0 + STEP0 * i (CODE) BASE1 + STEP1 * i, computed in TYPE.
+ Store the results to NITER. */
+
+static void
+number_of_iterations_cond (tree type, tree base0, tree step0,
+ enum tree_code code, tree base1, tree step1,
+ struct tree_niter_desc *niter)
+{
+ tree step, delta, mmin, mmax;
+ tree may_xform, bound, s, d, tmp;
+ bool was_sharp = false;
+ tree assumption;
+ tree assumptions = boolean_true_node;
+ tree noloop_assumptions = boolean_false_node;
+ tree unsigned_step_type;
+
+ /* The meaning of these assumptions is this:
+ if !assumptions
+ then the rest of information does not have to be valid
+ if noloop_assumptions then the loop does not have to roll
+ (but it is only conservative approximation, i.e. it only says that
+ if !noloop_assumptions, then the loop does not end before the computed
+ number of iterations) */
+
+ /* Make < comparison from > ones. */
+ if (code == GE_EXPR
+ || code == GT_EXPR)
+ {
+ SWAP (base0, base1);
+ SWAP (step0, step1);
+ code = swap_tree_comparison (code);
+ }
+
+ /* We can take care of the case of two induction variables chasing each other
+ if the test is NE. I have never seen a loop using it, but still it is
+ cool. */
+ if (!zero_p (step0) && !zero_p (step1))
+ {
+ if (code != NE_EXPR)
+ return;
+
+ step0 = EXEC_BINARY (MINUS_EXPR, type, step0, step1);
+ step1 = NULL_TREE;
+ }
+
+ /* If the result is a constant, the loop is weird. More precise handling
+ would be possible, but the situation is not common enough to waste time
+ on it. */
+ if (zero_p (step0) && zero_p (step1))
+ return;
+
+ /* Ignore loops of while (i-- < 10) type. */
+ if (code != NE_EXPR)
+ {
+ if (step0 && !tree_expr_nonnegative_p (step0))
+ return;
+
+ if (!zero_p (step1) && tree_expr_nonnegative_p (step1))
+ return;
+ }
+
+ /* For pointers these are NULL. We assume pointer arithmetics never
+ overflows. */
+ mmin = TYPE_MIN_VALUE (type);
+ mmax = TYPE_MAX_VALUE (type);
+
+ /* Some more condition normalization. We must record some assumptions
+ due to overflows. */
+
+ if (code == LT_EXPR)
+ {
+ /* We want to take care only of <=; this is easy,
+ as in cases the overflow would make the transformation unsafe the loop
+ does not roll. Seemingly it would make more sense to want to take
+ care of <, as NE is more simmilar to it, but the problem is that here
+ the transformation would be more difficult due to possibly infinite
+ loops. */
+ if (zero_p (step0))
+ {
+ if (mmax)
+ assumption = fold (build (EQ_EXPR, boolean_type_node, base0, mmax));
+ else
+ assumption = boolean_true_node;
+ if (integer_nonzerop (assumption))
+ goto zero_iter;
+ base0 = fold (build (PLUS_EXPR, type, base0,
+ convert (type, integer_one_node)));
+ }
+ else
+ {
+ if (mmin)
+ assumption = fold (build (EQ_EXPR, boolean_type_node, base1, mmin));
+ else
+ assumption = boolean_true_node;
+ if (integer_nonzerop (assumption))
+ goto zero_iter;
+ base1 = fold (build (MINUS_EXPR, type, base1,
+ convert (type, integer_one_node)));
+ }
+ noloop_assumptions = assumption;
+ code = LE_EXPR;
+
+ /* It will be useful to be able to tell the difference once more in
+ <= -> != reduction. */
+ was_sharp = true;
+ }
+
+ /* Take care of trivially infinite loops. */
+ if (code != NE_EXPR)
+ {
+ if (zero_p (step0)
+ && mmin
+ && operand_equal_p (base0, mmin, 0))
+ return;
+ if (zero_p (step1)
+ && mmax
+ && operand_equal_p (base1, mmax, 0))
+ return;
+ }
+
+ /* If we can we want to take care of NE conditions instead of size
+ comparisons, as they are much more friendly (most importantly
+ this takes care of special handling of loops with step 1). We can
+ do it if we first check that upper bound is greater or equal to
+ lower bound, their difference is constant c modulo step and that
+ there is not an overflow. */
+ if (code != NE_EXPR)
+ {
+ if (zero_p (step0))
+ step = EXEC_UNARY (NEGATE_EXPR, type, step1);
+ else
+ step = step0;
+ delta = build (MINUS_EXPR, type, base1, base0);
+ delta = fold (build (FLOOR_MOD_EXPR, type, delta, step));
+ may_xform = boolean_false_node;
+
+ if (TREE_CODE (delta) == INTEGER_CST)
+ {
+ tmp = EXEC_BINARY (MINUS_EXPR, type, step, integer_zero_node);
+ if (was_sharp
+ && operand_equal_p (delta, tmp, 0))
+ {
+ /* A special case. We have transformed condition of type
+ for (i = 0; i < 4; i += 4)
+ into
+ for (i = 0; i <= 3; i += 4)
+ obviously if the test for overflow during that transformation
+ passed, we cannot overflow here. Most importantly any
+ loop with sharp end condition and step 1 falls into this
+ cathegory, so handling this case specially is definitely
+ worth the troubles. */
+ may_xform = boolean_true_node;
+ }
+ else if (zero_p (step0))
+ {
+ if (!mmin)
+ may_xform = boolean_true_node;
+ else
+ {
+ bound = EXEC_BINARY (PLUS_EXPR, type, mmin, step);
+ bound = EXEC_BINARY (MINUS_EXPR, type, bound, delta);
+ may_xform = fold (build (LE_EXPR, boolean_type_node,
+ bound, base0));
+ }
+ }
+ else
+ {
+ if (!mmax)
+ may_xform = boolean_true_node;
+ else
+ {
+ bound = EXEC_BINARY (MINUS_EXPR, type, mmax, step);
+ bound = EXEC_BINARY (PLUS_EXPR, type, bound, delta);
+ may_xform = fold (build (LE_EXPR, boolean_type_node,
+ base1, bound));
+ }
+ }
+ }
+
+ if (!integer_zerop (may_xform))
+ {
+ /* We perform the transformation always provided that it is not
+ completely senseless. This is OK, as we would need this assumption
+ to determine the number of iterations anyway. */
+ if (!integer_nonzerop (may_xform))
+ assumptions = may_xform;
+
+ if (zero_p (step0))
+ {
+ base0 = build (PLUS_EXPR, type, base0, delta);
+ base0 = fold (build (MINUS_EXPR, type, base0, step));
+ }
+ else
+ {
+ base1 = build (MINUS_EXPR, type, base1, delta);
+ base1 = fold (build (PLUS_EXPR, type, base1, step));
+ }
+
+ assumption = fold (build (GT_EXPR, boolean_type_node, base0, base1));
+ noloop_assumptions = fold (build (TRUTH_OR_EXPR, boolean_type_node,
+ noloop_assumptions, assumption));
+ code = NE_EXPR;
+ }
+ }
+
+ /* Count the number of iterations. */
+ if (code == NE_EXPR)
+ {
+ /* Everything we do here is just arithmetics modulo size of mode. This
+ makes us able to do more involved computations of number of iterations
+ than in other cases. First transform the condition into shape
+ s * i <> c, with s positive. */
+ base1 = fold (build (MINUS_EXPR, type, base1, base0));
+ base0 = NULL_TREE;
+ if (!zero_p (step1))
+ step0 = EXEC_UNARY (NEGATE_EXPR, type, step1);
+ step1 = NULL_TREE;
+ if (!tree_expr_nonnegative_p (step0))
+ {
+ step0 = EXEC_UNARY (NEGATE_EXPR, type, step0);
+ base1 = fold (build1 (NEGATE_EXPR, type, base1));
+ }
+
+ /* Let nsd (s, size of mode) = d. If d does not divide c, the loop
+ is infinite. Otherwise, the number of iterations is
+ (inverse(s/d) * (c/d)) mod (size of mode/d). */
+ s = step0;
+ d = integer_one_node;
+ unsigned_step_type = make_unsigned_type (TYPE_PRECISION (type));
+ bound = convert (unsigned_step_type, build_int_2 (~0, ~0));
+ while (1)
+ {
+ tmp = EXEC_BINARY (BIT_AND_EXPR, type, s, integer_one_node);
+ if (integer_nonzerop (tmp))
+ break;
+
+ s = EXEC_BINARY (RSHIFT_EXPR, type, s, integer_one_node);
+ d = EXEC_BINARY (LSHIFT_EXPR, type, d, integer_one_node);
+ bound = EXEC_BINARY (RSHIFT_EXPR, type, bound, integer_one_node);
+ }
+
+ tmp = fold (build (EXACT_DIV_EXPR, type, base1, d));
+ tmp = fold (build (MULT_EXPR, type, tmp, inverse (s, bound)));
+ niter->niter = fold (build (BIT_AND_EXPR, type, tmp, bound));
+ }
+ else
+ {
+ if (zero_p (step1))
+ /* Condition in shape a + s * i <= b
+ We must know that b + s does not overflow and a <= b + s and then we
+ can compute number of iterations as (b + s - a) / s. (It might
+ seem that we in fact could be more clever about testing the b + s
+ overflow condition using some information about b - a mod s,
+ but it was already taken into account during LE -> NE transform). */
+ {
+ if (mmax)
+ {
+ bound = EXEC_BINARY (MINUS_EXPR, type, mmax, step0);
+ assumption = fold (build (LE_EXPR, boolean_type_node,
+ base1, bound));
+ assumptions = fold (build (TRUTH_AND_EXPR, boolean_type_node,
+ assumptions, assumption));
+ }
+ step = step0;
+ tmp = fold (build (PLUS_EXPR, type, base1, step0));
+ assumption = fold (build (GT_EXPR, boolean_type_node, base0, tmp));
+ delta = fold (build (PLUS_EXPR, type, base1, step));
+ delta = fold (build (MINUS_EXPR, type, delta, base0));
+ }
+ else
+ {
+ /* Condition in shape a <= b - s * i
+ We must know that a - s does not overflow and a - s <= b and then
+ we can again compute number of iterations as (b - (a - s)) / s. */
+ if (mmin)
+ {
+ bound = EXEC_BINARY (MINUS_EXPR, type, mmin, step1);
+ assumption = fold (build (LE_EXPR, boolean_type_node,
+ bound, base0));
+ assumptions = fold (build (TRUTH_AND_EXPR, boolean_type_node,
+ assumptions, assumption));
+ }
+ step = fold (build1 (NEGATE_EXPR, type, step1));
+ tmp = fold (build (PLUS_EXPR, type, base0, step1));
+ assumption = fold (build (GT_EXPR, boolean_type_node, tmp, base1));
+ delta = fold (build (MINUS_EXPR, type, base0, step));
+ delta = fold (build (MINUS_EXPR, type, base1, delta));
+ }
+ noloop_assumptions = fold (build (TRUTH_OR_EXPR, boolean_type_node,
+ noloop_assumptions, assumption));
+ delta = fold (build (FLOOR_DIV_EXPR, type, delta, step));
+ niter->niter = delta;
+ }
+
+ niter->assumptions = assumptions;
+ niter->may_be_zero = noloop_assumptions;
+ return;
+
+zero_iter:
+ niter->assumptions = boolean_true_node;
+ niter->may_be_zero = boolean_true_node;
+ niter->niter = convert (type, integer_zero_node);
+ return;
+}
+
+/* Determine the number of iterations of the current loop. */
+
+static void
+determine_number_of_iterations (struct ivopts_data *data)
+{
+ tree stmt, cond, type;
+ tree op0, base0, step0;
+ tree op1, base1, step1;
+ enum tree_code code;
+ struct loop *loop = data->current_loop;
+
+ if (!loop_data (loop)->single_exit)
+ return;
+
+ stmt = last_stmt (loop_data (loop)->single_exit->src);
+ if (!stmt || TREE_CODE (stmt) != COND_EXPR)
+ return;
+
+ /* We want the condition for staying inside loop. */
+ cond = COND_EXPR_COND (stmt);
+ if (loop_data (loop)->single_exit->flags & EDGE_TRUE_VALUE)
+ cond = invert_truthvalue (cond);
+
+ code = TREE_CODE (cond);
+ switch (code)
+ {
+ case GT_EXPR:
+ case GE_EXPR:
+ case NE_EXPR:
+ case LT_EXPR:
+ case LE_EXPR:
+ break;
+
+ default:
+ return;
+ }
+
+ op0 = TREE_OPERAND (cond, 0);
+ op1 = TREE_OPERAND (cond, 1);
+ type = TREE_TYPE (op0);
+
+ if (TREE_CODE (type) != INTEGER_TYPE
+ && TREE_CODE (type) != POINTER_TYPE)
+ return;
+
+ if (!get_var_def (data, op0, &base0, &step0))
+ return;
+ if (!get_var_def (data, op1, &base1, &step1))
+ return;
+
+ number_of_iterations_cond (type, base0, step0, code, base1, step1,
+ &loop_data (loop)->niter);
+}
+
+/* For each ssa name defined in LOOP determines whether it is an induction
+ variable and if so, its initial value and step. */
+
+static bool
+find_induction_variables (struct ivopts_data *data)
+{
+ unsigned i;
+ struct loop *loop = data->current_loop;
+
+ if (!find_bivs (data))
+ return false;
+
+ find_givs (data);
+ mark_bivs (data);
+ determine_number_of_iterations (data);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ if (loop_data (loop)->niter.niter)
+ {
+ fprintf (dump_file, " number of iterations ");
+ print_generic_expr (dump_file, loop_data (loop)->niter.niter,
+ TDF_SLIM);
+ fprintf (dump_file, "\n");
+
+ fprintf (dump_file, " may be zero if ");
+ print_generic_expr (dump_file, loop_data (loop)->niter.may_be_zero,
+ TDF_SLIM);
+ fprintf (dump_file, "\n");
+
+ fprintf (dump_file, " bogus unless ");
+ print_generic_expr (dump_file, loop_data (loop)->niter.assumptions,
+ TDF_SLIM);
+ fprintf (dump_file, "\n");
+ fprintf (dump_file, "\n");
+ };
+
+ fprintf (dump_file, "Induction variables:\n\n");
+
+ EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i,
+ {
+ if (ver_info (data, i)->iv)
+ dump_iv (dump_file, ver_info (data, i)->iv);
+ });
+ }
+
+ return true;
+}
+
+/* Records a use of type USE_TYPE at *USE_P in STMT whose value is IV. */
+
+static struct iv_use *
+record_use (struct ivopts_data *data, tree *use_p, struct iv *iv,
+ tree stmt, enum use_type use_type)
+{
+ struct iv_use *use = xcalloc (1, sizeof (struct iv_use));
+
+ use->id = n_iv_uses (data);
+ use->type = use_type;
+ use->iv = iv;
+ use->stmt = stmt;
+ use->op_p = use_p;
+ use->related_cands = BITMAP_XMALLOC ();
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ dump_use (dump_file, use);
+
+ VARRAY_PUSH_GENERIC_PTR_NOGC (data->iv_uses, use);
+
+ return use;
+}
+
+/* Checks whether OP is a loop-level invariant and if so, records it.
+ NONLINEAR_USE is true if the invariant is used in a way we do not
+ handle specially. */
+
+static void
+record_invariant (struct ivopts_data *data, tree op, bool nonlinear_use)
+{
+ basic_block bb;
+ struct version_info *info;
+
+ if (TREE_CODE (op) != SSA_NAME
+ || !is_gimple_reg (op))
+ return;
+
+ bb = bb_for_stmt (SSA_NAME_DEF_STMT (op));
+ if (bb
+ && flow_bb_inside_loop_p (data->current_loop, bb))
+ return;
+
+ info = name_info (data, op);
+ info->name = op;
+ info->has_nonlin_use |= nonlinear_use;
+ if (!info->inv_id)
+ info->inv_id = ++data->max_inv_id;
+ bitmap_set_bit (data->relevant, SSA_NAME_VERSION (op));
+}
+
+/* Checks whether the use OP is interesting and if so, records it
+ as TYPE. */
+
+static struct iv_use *
+find_interesting_uses_outer_or_nonlin (struct ivopts_data *data, tree op,
+ enum use_type type)
+{
+ struct iv *iv;
+ struct iv *civ;
+ tree stmt, *op_p;
+ struct iv_use *use;
+
+ if (TREE_CODE (op) != SSA_NAME)
+ return NULL;
+
+ iv = get_iv (data, op);
+ if (!iv)
+ return NULL;
+
+ if (iv->have_use_for)
+ {
+ use = iv_use (data, iv->use_id);
+
+ if (use->type != USE_NONLINEAR_EXPR
+ && use->type != USE_OUTER)
+ abort ();
+
+ if (type == USE_NONLINEAR_EXPR)
+ use->type = USE_NONLINEAR_EXPR;
+ return use;
+ }
+
+ if (zero_p (iv->step))
+ {
+ record_invariant (data, op, true);
+ return NULL;
+ }
+ iv->have_use_for = true;
+
+ civ = xmalloc (sizeof (struct iv));
+ *civ = *iv;
+
+ stmt = SSA_NAME_DEF_STMT (op);
+ if (TREE_CODE (stmt) == PHI_NODE)
+ op_p = &PHI_RESULT (stmt);
+ else if (TREE_CODE (stmt) == MODIFY_EXPR)
+ op_p = &TREE_OPERAND (stmt, 0);
+ else
+ abort ();
+
+ use = record_use (data, op_p, civ, stmt, type);
+ iv->use_id = use->id;
+
+ return use;
+}
+
+/* Checks whether the use OP is interesting and if so, records it. */
+
+static struct iv_use *
+find_interesting_uses_op (struct ivopts_data *data, tree op)
+{
+ return find_interesting_uses_outer_or_nonlin (data, op, USE_NONLINEAR_EXPR);
+}
+
+/* Records a definition of induction variable OP that is used outside of the
+ loop. */
+
+static struct iv_use *
+find_interesting_uses_outer (struct ivopts_data *data, tree op)
+{
+ return find_interesting_uses_outer_or_nonlin (data, op, USE_OUTER);
+}
+
+/* Checks whether the condition *COND_P in STMT is interesting
+ and if so, records it. */
+
+static void
+find_interesting_uses_cond (struct ivopts_data *data, tree stmt, tree *cond_p)
+{
+ tree *op0_p;
+ tree *op1_p;
+ struct iv *iv0 = NULL, *iv1 = NULL, *civ;
+ struct iv const_iv;
+ tree zero = integer_zero_node;
+
+ const_iv.step = NULL_TREE;
+
+ if (integer_zerop (*cond_p)
+ || integer_nonzerop (*cond_p))
+ return;
+
+ if (TREE_CODE (*cond_p) == SSA_NAME)
+ {
+ op0_p = cond_p;
+ op1_p = &zero;
+ }
+ else
+ {
+ op0_p = &TREE_OPERAND (*cond_p, 0);
+ op1_p = &TREE_OPERAND (*cond_p, 1);
+ }
+
+ if (TREE_CODE (*op0_p) == SSA_NAME)
+ iv0 = get_iv (data, *op0_p);
+ else
+ iv0 = &const_iv;
+
+ if (TREE_CODE (*op1_p) == SSA_NAME)
+ iv1 = get_iv (data, *op1_p);
+ else
+ iv1 = &const_iv;
+
+ if (/* When comparing with non-invariant value, we may not do any senseful
+ induction variable elimination. */
+ (!iv0 || !iv1)
+ /* Eliminating condition based on two ivs would be nontrivial.
+ ??? TODO -- it is not really important to handle this case. */
+ || (!zero_p (iv0->step) && !zero_p (iv1->step)))
+ {
+ find_interesting_uses_op (data, *op0_p);
+ find_interesting_uses_op (data, *op1_p);
+ return;
+ }
+
+ if (zero_p (iv0->step) && zero_p (iv1->step))
+ {
+ /* If both are invariants, this is a work for unswitching. */
+ return;
+ }
+
+ civ = xmalloc (sizeof (struct iv));
+ *civ = zero_p (iv0->step) ? *iv1: *iv0;
+ record_use (data, cond_p, civ, stmt, USE_COMPARE);
+}
+
+/* Cumulates the steps of indices into DATA and replaces their values with the
+ initial ones. Returns false when the value of the index cannot be determined.
+ Callback for for_each_index. */
+
+static struct ivopts_data *ifs_ivopts_data;
+static bool
+idx_find_step (tree base, tree *idx, void *data)
+{
+ tree *step_p = data;
+ struct iv *iv;
+ tree step, type, iv_type;
+
+ if (TREE_CODE (*idx) != SSA_NAME)
+ return true;
+
+ iv = get_iv (ifs_ivopts_data, *idx);
+ if (!iv)
+ return false;
+
+ *idx = iv->base;
+
+ if (!iv->step)
+ return true;
+
+ iv_type = TREE_TYPE (iv->base);
+ if (base)
+ {
+ type = array2ptr (TREE_TYPE (base));
+ step = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (base)));
+ }
+ else
+ {
+ type = TREE_TYPE (*idx);
+ /* The step for pointer arithmetics already is 1 byte. */
+ step = convert (type, integer_one_node);
+ }
+
+ if (TYPE_PRECISION (iv_type) < TYPE_PRECISION (type))
+ {
+ /* The index might wrap. */
+
+ /* TODO -- this is especially bad for targets where
+ sizeof (int) < sizeof (void *). We should at least:
+
+ 1) Use the number of iterations of the current loop to prove
+ that the index cannot wrap.
+ 2) Record whether only a signed arithmetics is used during computation
+ of the index (behavior of overflows during signed arithmetics is
+ undefined, so we may assume that it does not happen). Problems:
+ * The optimizations may create overflowing signed arithmetics.
+ * And they may also remove the no-op casts used to make the
+ behavior of overflows defined.
+ 3) Use array bounds when known (if the memory is accessed at each
+ iteration, we know the index cannot come out of them). Better,
+ use this to estimate the number of iterations of the loop.
+ 4) If all indices are of the same type, we can also rewrite the
+ access as &base + (extend) (step * i), and optimize the step * i
+ part separately. */
+ return false;
+ }
+
+ step = EXEC_BINARY (MULT_EXPR, type, step,
+ convert (type, iv->step));
+
+ if (!*step_p)
+ *step_p = step;
+ else
+ *step_p = EXEC_BINARY (PLUS_EXPR, type, *step_p, step);
+
+ return true;
+}
+
+/* Records use in index IDX. Callback for for_each_index. Ivopts data
+ object is passed to it in DATA. */
+
+static bool
+idx_record_use (tree base ATTRIBUTE_UNUSED, tree *idx,
+ void *data)
+{
+ find_interesting_uses_op (data, *idx);
+ return true;
+}
+
+/* Finds addresses in *OP_P inside STMT. */
+
+static void
+find_interesting_uses_address (struct ivopts_data *data, tree stmt, tree *op_p)
+{
+ tree base = unshare_expr (*op_p), step = NULL;
+ struct iv *civ;
+
+ /* Ignore bitfields for now. Not really something terribly complicated
+ to handle. TODO. */
+ if (TREE_CODE (base) == COMPONENT_REF
+ && DECL_NONADDRESSABLE_P (TREE_OPERAND (base, 1)))
+ goto fail;
+
+ ifs_ivopts_data = data;
+ if (!for_each_index (&base, idx_find_step, &step)
+ || zero_p (step))
+ goto fail;
+
+ if (TREE_CODE (base) == INDIRECT_REF)
+ base = TREE_OPERAND (base, 0);
+ else
+ base = build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (base)),
+ base);
+
+ civ = alloc_iv (base, step);
+ record_use (data, op_p, civ, stmt, USE_ADDRESS);
+ return;
+
+fail:
+ for_each_index (op_p, idx_record_use, data);
+}
+
+/* Finds and records invariants used in STMT. */
+
+static void
+find_invariants_stmt (struct ivopts_data *data, tree stmt)
+{
+ use_optype uses = NULL;
+ unsigned i, n;
+ tree op;
+
+ if (TREE_CODE (stmt) == PHI_NODE)
+ n = PHI_NUM_ARGS (stmt);
+ else
+ {
+ get_stmt_operands (stmt);
+ uses = STMT_USE_OPS (stmt);
+ n = NUM_USES (uses);
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ if (TREE_CODE (stmt) == PHI_NODE)
+ op = PHI_ARG_DEF (stmt, i);
+ else
+ op = USE_OP (uses, i);
+
+ record_invariant (data, op, false);
+ }
+}
+
+/* Finds interesting uses of induction variables in the statement STMT. */
+
+static void
+find_interesting_uses_stmt (struct ivopts_data *data, tree stmt)
+{
+ struct iv *iv;
+ tree *op_p, lhs, rhs;
+ use_optype uses = NULL;
+ unsigned i, n;
+
+ find_invariants_stmt (data, stmt);
+
+ if (TREE_CODE (stmt) == COND_EXPR)
+ {
+ find_interesting_uses_cond (data, stmt, &COND_EXPR_COND (stmt));
+ return;
+ }
+
+ if (TREE_CODE (stmt) == MODIFY_EXPR)
+ {
+ lhs = TREE_OPERAND (stmt, 0);
+ rhs = TREE_OPERAND (stmt, 1);
+
+ if (TREE_CODE (lhs) == SSA_NAME)
+ {
+ /* If the statement defines an induction variable, the uses are not
+ interesting by themselves. */
+
+ iv = get_iv (data, lhs);
+
+ if (iv && !zero_p (iv->step))
+ return;
+ }
+
+ switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
+ {
+ case '<':
+ find_interesting_uses_cond (data, stmt, &TREE_OPERAND (stmt, 1));
+ return;
+
+ case 'r':
+ find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 1));
+ if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r')
+ find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
+ return;
+
+ default: ;
+ }
+
+ if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r')
+ {
+ find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
+ find_interesting_uses_op (data, rhs);
+ return;
+ }
+ }
+
+ if (TREE_CODE (stmt) == PHI_NODE
+ && bb_for_stmt (stmt) == data->current_loop->header)
+ {
+ lhs = PHI_RESULT (stmt);
+ iv = get_iv (data, lhs);
+
+ if (iv && !zero_p (iv->step))
+ return;
+ }
+
+ if (TREE_CODE (stmt) == PHI_NODE)
+ n = PHI_NUM_ARGS (stmt);
+ else
+ {
+ uses = STMT_USE_OPS (stmt);
+ n = NUM_USES (uses);
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ if (TREE_CODE (stmt) == PHI_NODE)
+ op_p = &PHI_ARG_DEF (stmt, i);
+ else
+ op_p = USE_OP_PTR (uses, i);
+
+ if (TREE_CODE (*op_p) != SSA_NAME)
+ continue;
+
+ iv = get_iv (data, *op_p);
+ if (!iv)
+ continue;
+
+ find_interesting_uses_op (data, *op_p);
+ }
+}
+
+/* Finds interesting uses of induction variables outside of loops
+ on loop exit edge EXIT. */
+
+static void
+find_interesting_uses_outside (struct ivopts_data *data, edge exit)
+{
+ tree phi, def;
+
+ for (phi = phi_nodes (exit->dest); phi; phi = TREE_CHAIN (phi))
+ {
+ def = phi_element_for_edge (phi, exit)->def;
+ find_interesting_uses_outer (data, def);
+ }
+}
+
+/* Finds uses of the induction variables that are interesting. */
+
+static void
+find_interesting_uses (struct ivopts_data *data)
+{
+ basic_block bb;
+ block_stmt_iterator bsi;
+ tree phi;
+ basic_block *body = get_loop_body (data->current_loop);
+ unsigned i;
+ struct version_info *info;
+ edge e;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Uses:\n\n");
+
+ for (i = 0; i < data->current_loop->num_nodes; i++)
+ {
+ bb = body[i];
+
+ for (e = bb->succ; e; e = e->succ_next)
+ if (e->dest != EXIT_BLOCK_PTR
+ && !flow_bb_inside_loop_p (data->current_loop, e->dest))
+ find_interesting_uses_outside (data, e);
+
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ find_interesting_uses_stmt (data, phi);
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ find_interesting_uses_stmt (data, bsi_stmt (bsi));
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\n");
+
+ EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i,
+ {
+ info = ver_info (data, i);
+ if (info->inv_id)
+ {
+ fprintf (dump_file, " ");
+ print_generic_expr (dump_file, info->name, TDF_SLIM);
+ fprintf (dump_file, " is invariant (%d)%s\n",
+ info->inv_id, info->has_nonlin_use ? "" : ", eliminable");
+ }
+ });
+
+ fprintf (dump_file, "\n");
+ }
+
+ free (body);
+}
+
+/* Adds a candidate BASE + STEP * i. Important field is set to IMPORTANT and
+ position to POS. If USE is not NULL, the candidate is set as related to
+ it. If both BASE and STEP are NULL, we add a pseudocandidate for the
+ replacement of the final value of the iv by a direct computation. */
+
+static struct iv_cand *
+add_candidate_1 (struct ivopts_data *data,
+ tree base, tree step, bool important, enum iv_position pos,
+ struct iv_use *use, tree incremented_at)
+{
+ unsigned i;
+ struct iv_cand *cand = NULL;
+
+ for (i = 0; i < n_iv_cands (data); i++)
+ {
+ cand = iv_cand (data, i);
+
+ if (cand->pos != pos)
+ continue;
+
+ if (cand->incremented_at != incremented_at)
+ continue;
+
+ if (!cand->iv)
+ {
+ if (!base && !step)
+ break;
+
+ continue;
+ }
+
+ if (!base && !step)
+ continue;
+
+ if (!operand_equal_p (base, cand->iv->base, 0))
+ continue;
+
+ if (zero_p (cand->iv->step))
+ {
+ if (zero_p (step))
+ break;
+ }
+ else
+ {
+ if (step && operand_equal_p (step, cand->iv->step, 0))
+ break;
+ }
+ }
+
+ if (i == n_iv_cands (data))
+ {
+ cand = xcalloc (1, sizeof (struct iv_cand));
+ cand->id = i;
+
+ if (!base && !step)
+ cand->iv = NULL;
+ else
+ cand->iv = alloc_iv (base, step);
+
+ cand->pos = pos;
+ if (pos != IP_ORIGINAL && cand->iv)
+ {
+ cand->var_before = create_tmp_var_raw (TREE_TYPE (base), "ivtmp");
+ cand->var_after = cand->var_before;
+ }
+ cand->important = important;
+ cand->incremented_at = incremented_at;
+ VARRAY_PUSH_GENERIC_PTR_NOGC (data->iv_candidates, cand);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ dump_cand (dump_file, cand);
+ }
+
+ if (important && !cand->important)
+ {
+ cand->important = true;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Candidate %d is important\n", cand->id);
+ }
+
+ if (use)
+ {
+ bitmap_set_bit (use->related_cands, i);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Candidate %d is related to use %d\n",
+ cand->id, use->id);
+ }
+
+ return cand;
+}
+
+/* Adds a candidate BASE + STEP * i. Important field is set to IMPORTANT and
+ position to POS. If USE is not NULL, the candidate is set as related to
+ it. The candidate computation is scheduled on all available positions. */
+
+static void
+add_candidate (struct ivopts_data *data,
+ tree base, tree step, bool important, struct iv_use *use)
+{
+ if (ip_normal_pos (data->current_loop))
+ add_candidate_1 (data, base, step, important, IP_NORMAL, use, NULL_TREE);
+ if (ip_end_pos (data->current_loop))
+ add_candidate_1 (data, base, step, important, IP_END, use, NULL_TREE);
+}
+
+/* Adds standard iv candidates. */
+
+static void
+add_standard_iv_candidates (struct ivopts_data *data)
+{
+ /* Add 0 + 1 * iteration candidate. */
+ add_candidate (data,
+ convert (integer_type_node, integer_zero_node),
+ convert (integer_type_node, integer_one_node),
+ true, NULL);
+
+ /* The same for a long type. */
+ add_candidate (data,
+ convert (long_integer_type_node, integer_zero_node),
+ convert (long_integer_type_node, integer_one_node),
+ true, NULL);
+}
+
+
+/* Adds candidates bases on the old induction variable IV. */
+
+static void
+add_old_iv_candidates (struct ivopts_data *data, struct iv *iv)
+{
+ tree phi, def;
+ struct iv_cand *cand;
+
+ add_candidate (data, iv->base, iv->step, true, NULL);
+
+ /* The same, but with initial value zero. */
+ add_candidate (data,
+ convert (TREE_TYPE (iv->base), integer_zero_node),
+ iv->step, true, NULL);
+
+ phi = SSA_NAME_DEF_STMT (iv->ssa_name);
+ if (TREE_CODE (phi) == PHI_NODE)
+ {
+ /* Additionally record the possibility of leaving the original iv
+ untouched. */
+ def = phi_element_for_edge (phi,
+ loop_latch_edge (data->current_loop))->def;
+ cand = add_candidate_1 (data,
+ iv->base, iv->step, true, IP_ORIGINAL, NULL,
+ SSA_NAME_DEF_STMT (def));
+ cand->var_before = iv->ssa_name;
+ cand->var_after = def;
+ }
+}
+
+/* Adds candidates based on the old induction variables. */
+
+static void
+add_old_ivs_candidates (struct ivopts_data *data)
+{
+ unsigned i;
+ struct iv *iv;
+
+ EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i,
+ {
+ iv = ver_info (data, i)->iv;
+ if (iv && iv->biv_p && !zero_p (iv->step))
+ add_old_iv_candidates (data, iv);
+ });
+}
+
+/* Adds candidates based on the value of the induction variable IV and USE. */
+
+static void
+add_iv_value_candidates (struct ivopts_data *data,
+ struct iv *iv, struct iv_use *use)
+{
+ add_candidate (data, iv->base, iv->step, false, use);
+
+ /* The same, but with initial value zero. */
+ add_candidate (data,
+ convert (array2ptr (TREE_TYPE (iv->base)), integer_zero_node),
+ iv->step, false, use);
+}
+
+/* Adds candidates based on the address IV and USE. */
+
+static void
+add_address_candidates (struct ivopts_data *data,
+ struct iv *iv, struct iv_use *use)
+{
+ tree base, type;
+
+ /* First, the trivial choices. */
+ add_iv_value_candidates (data, iv, use);
+
+ /* Second, try removing the COMPONENT_REFs. */
+ if (TREE_CODE (iv->base) == ADDR_EXPR)
+ {
+ base = TREE_OPERAND (iv->base, 0);
+ type = TREE_TYPE (iv->base);
+ while (TREE_CODE (base) == COMPONENT_REF
+ || (TREE_CODE (base) == ARRAY_REF
+ && TREE_CODE (TREE_OPERAND (base, 1)) == INTEGER_CST))
+ base = TREE_OPERAND (base, 0);
+
+ if (base != TREE_OPERAND (iv->base, 0))
+ {
+ if (TREE_CODE (base) == INDIRECT_REF)
+ base = TREE_OPERAND (base, 0);
+ else
+ base = build1 (ADDR_EXPR, type, base);
+ add_candidate (data, base, iv->step, false, use);
+ }
+ }
+}
+
+/* Possibly adds pseudocandidate for replacing the final value of USE by
+ a direct computation. */
+
+static void
+add_iv_outer_candidates (struct ivopts_data *data, struct iv_use *use)
+{
+ struct tree_niter_desc *niter;
+ struct loop *loop = data->current_loop;
+
+ /* We must know where we exit the loop and how many times does it roll. */
+ if (!loop_data (loop)->single_exit)
+ return;
+
+ niter = &loop_data (loop)->niter;
+ if (!niter->niter
+ || !operand_equal_p (niter->assumptions, boolean_true_node, 0)
+ || !operand_equal_p (niter->may_be_zero, boolean_false_node, 0))
+ return;
+
+ add_candidate_1 (data, NULL, NULL, false, IP_NORMAL, use, NULL_TREE);
+}
+
+/* Adds candidates based on the uses. */
+
+static void
+add_derived_ivs_candidates (struct ivopts_data *data)
+{
+ unsigned i;
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ struct iv_use *use = iv_use (data, i);
+
+ if (!use)
+ continue;
+
+ switch (use->type)
+ {
+ case USE_NONLINEAR_EXPR:
+ case USE_COMPARE:
+ /* Just add the ivs based on the value of the iv used here. */
+ add_iv_value_candidates (data, use->iv, use);
+ break;
+
+ case USE_OUTER:
+ add_iv_value_candidates (data, use->iv, use);
+
+ /* Additionally, add the pseudocandidate for the possibility to
+ replace the final value by a direct computation. */
+ add_iv_outer_candidates (data, use);
+ break;
+
+ case USE_ADDRESS:
+ add_address_candidates (data, use->iv, use);
+ break;
+
+ default:
+ abort ();
+ }
+ }
+}
+
+/* Finds the candidates for the induction variables. */
+
+static void
+find_iv_candidates (struct ivopts_data *data)
+{
+ /* Add commonly used ivs. */
+ add_standard_iv_candidates (data);
+
+ /* Add old induction variables. */
+ add_old_ivs_candidates (data);
+
+ /* Add induction variables derived from uses. */
+ add_derived_ivs_candidates (data);
+}
+
+/* Allocates the data structure mapping the (use, candidate) pairs to costs.
+ If consider_all_candidates is true, we use a two-dimensional array, otherwise
+ we allocate a simple list to every use. */
+
+static void
+alloc_use_cost_map (struct ivopts_data *data)
+{
+ unsigned i, n_imp = 0, size, j;
+
+ if (!data->consider_all_candidates)
+ {
+ for (i = 0; i < n_iv_cands (data); i++)
+ {
+ struct iv_cand *cand = iv_cand (data, i);
+ if (cand->important)
+ n_imp++;
+ }
+ }
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ struct iv_use *use = iv_use (data, i);
+
+ if (data->consider_all_candidates)
+ {
+ size = n_iv_cands (data);
+ use->n_map_members = size;
+ }
+ else
+ {
+ size = n_imp;
+ EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, size++);
+ use->n_map_members = 0;
+ }
+
+ use->cost_map = xcalloc (size, sizeof (struct cost_pair));
+ }
+}
+
+/* Sets cost of (USE, CANDIDATE) pair to COST and record that it depends
+ on invariants DEPENDS_ON. */
+
+static void
+set_use_iv_cost (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand, unsigned cost,
+ bitmap depends_on)
+{
+ if (cost == INFTY
+ && depends_on)
+ {
+ BITMAP_XFREE (depends_on);
+ depends_on = NULL;
+ }
+
+ if (data->consider_all_candidates)
+ {
+ use->cost_map[cand->id].cand = cand;
+ use->cost_map[cand->id].cost = cost;
+ use->cost_map[cand->id].depends_on = depends_on;
+ return;
+ }
+
+ if (cost == INFTY)
+ return;
+
+ use->cost_map[use->n_map_members].cand = cand;
+ use->cost_map[use->n_map_members].cost = cost;
+ use->cost_map[use->n_map_members].depends_on = depends_on;
+ use->n_map_members++;
+}
+
+/* Gets cost of (USE, CANDIDATE) pair. Stores the bitmap of dependencies to
+ DEPENDS_ON. */
+
+static unsigned
+get_use_iv_cost (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand, bitmap *depends_on)
+{
+ unsigned i;
+
+ if (!cand)
+ return INFTY;
+
+ if (data->consider_all_candidates)
+ i = cand->id;
+ else
+ {
+ for (i = 0; i < use->n_map_members; i++)
+ if (use->cost_map[i].cand == cand)
+ break;
+
+ if (i == use->n_map_members)
+ return INFTY;
+ }
+
+ if (depends_on)
+ *depends_on = use->cost_map[i].depends_on;
+ return use->cost_map[i].cost;
+}
+
+/* Returns estimate on cost of computing SEQ. */
+
+static unsigned
+seq_cost (rtx seq)
+{
+ unsigned cost = 0;
+ rtx set;
+
+ for (; seq; seq = NEXT_INSN (seq))
+ {
+ set = single_set (seq);
+ if (set)
+ cost += rtx_cost (set, SET);
+ else
+ cost++;
+ }
+
+ return cost;
+}
+
+/* Prepares decl_rtl for variables referred in *EXPR_P. Callback for
+ walk_tree. DATA contains the actual fake register number. */
+
+static tree
+prepare_decl_rtl (tree *expr_p, int *ws, void *data)
+{
+ tree obj = NULL_TREE;
+ rtx x = NULL_RTX;
+ int *regno = data;
+
+ switch (TREE_CODE (*expr_p))
+ {
+ case SSA_NAME:
+ *ws = 0;
+ obj = SSA_NAME_VAR (*expr_p);
+ if (!DECL_RTL_SET_P (obj))
+ x = gen_raw_REG (DECL_MODE (obj), (*regno)++);
+ break;
+
+ case VAR_DECL:
+ case PARM_DECL:
+ case RESULT_DECL:
+ *ws = 0;
+ obj = *expr_p;
+
+ if (DECL_RTL_SET_P (obj))
+ break;
+
+ if (DECL_MODE (obj) == BLKmode)
+ {
+ if (TREE_STATIC (obj)
+ || DECL_EXTERNAL (obj))
+ {
+ const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (obj));
+ x = gen_rtx_SYMBOL_REF (Pmode, name);
+ }
+ else
+ x = gen_raw_REG (Pmode, (*regno)++);
+
+ x = gen_rtx_MEM (DECL_MODE (obj), x);
+ }
+ else
+ x = gen_raw_REG (DECL_MODE (obj), (*regno)++);
+
+ break;
+
+ default:
+ break;
+ }
+
+ if (x)
+ {
+ VARRAY_PUSH_GENERIC_PTR_NOGC (decl_rtl_to_reset, obj);
+ SET_DECL_RTL (obj, x);
+ }
+
+ return NULL_TREE;
+}
+
+/* Determines cost of the computation of EXPR. */
+
+static unsigned
+computation_cost (tree expr)
+{
+ rtx seq, rslt;
+ tree type = TREE_TYPE (expr);
+ unsigned cost;
+ int regno = 0;
+
+ walk_tree (&expr, prepare_decl_rtl, &regno, NULL);
+ start_sequence ();
+ rslt = expand_expr (expr, NULL_RTX, TYPE_MODE (type), EXPAND_NORMAL);
+ seq = get_insns ();
+ end_sequence ();
+
+ cost = seq_cost (seq);
+ if (GET_CODE (rslt) == MEM)
+ cost += address_cost (XEXP (rslt, 0), TYPE_MODE (type));
+
+ return cost;
+}
+
+/* Returns variable containing the value of candidate CAND at statement AT. */
+
+static tree
+var_at_stmt (struct loop *loop, struct iv_cand *cand, tree stmt)
+{
+ if (stmt_after_increment (loop, cand, stmt))
+ return cand->var_after;
+ else
+ return cand->var_before;
+}
+
+/* Determines the expression by that USE is expressed from induction variable
+ CAND at statement AT in LOOP. */
+
+static tree
+get_computation_at (struct loop *loop,
+ struct iv_use *use, struct iv_cand *cand, tree at)
+{
+ tree ubase = use->iv->base, ustep = use->iv->step;
+ tree cbase = cand->iv->base, cstep = cand->iv->step;
+ tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
+ tree expr, delta;
+ tree ratio;
+ unsigned HOST_WIDE_INT ustepi, cstepi;
+ HOST_WIDE_INT ratioi;
+
+ expr = var_at_stmt (loop, cand, at);
+
+ if (TYPE_PRECISION (utype) > TYPE_PRECISION (ctype))
+ {
+ /* We do not have a precision to express the values of use. */
+ return NULL_TREE;
+ }
+
+ if (utype != ctype)
+ {
+ expr = convert (utype, expr);
+ cbase = convert (utype, cbase);
+ cstep = convert (utype, cstep);
+ }
+
+ if (!cst_and_fits_in_hwi (cstep)
+ || !cst_and_fits_in_hwi (ustep))
+ return NULL_TREE;
+
+ ustepi = int_cst_value (ustep);
+ cstepi = int_cst_value (cstep);
+
+ if (!divide (TYPE_PRECISION (utype), ustepi, cstepi, &ratioi))
+ {
+ /* TODO maybe consider case when ustep divides cstep and the ratio is
+ a power of 2 (so that the division is fast to execute)? We would
+ need to be much more careful with overflows etc. then. */
+ return NULL_TREE;
+ }
+
+ /* We may need to shift the value if we are after the increment. */
+ if (stmt_after_increment (loop, cand, at))
+ cbase = fold (build (PLUS_EXPR, utype, cbase, cstep));
+
+ /* use = ubase + ratio * (var - cbase). If either cbase is a constant
+ or |ratio| == 1, it is better to handle this like
+
+ ubase - ratio * cbase + ratio * var. */
+
+ if (ratioi == 1)
+ {
+ delta = fold (build (MINUS_EXPR, utype, ubase, cbase));
+ expr = fold (build (PLUS_EXPR, utype, expr, delta));
+ }
+ else if (ratioi == -1)
+ {
+ delta = fold (build (PLUS_EXPR, utype, ubase, cbase));
+ expr = fold (build (MINUS_EXPR, utype, delta, expr));
+ }
+ else if (TREE_CODE (cbase) == INTEGER_CST)
+ {
+ ratio = build_int_cst (utype, ratioi);
+ delta = fold (build (MULT_EXPR, utype, ratio, cbase));
+ delta = fold (build (MINUS_EXPR, utype, ubase, delta));
+ expr = fold (build (MULT_EXPR, utype, ratio, expr));
+ expr = fold (build (PLUS_EXPR, utype, delta, expr));
+ }
+ else
+ {
+ expr = fold (build (MINUS_EXPR, utype, expr, cbase));
+ ratio = build_int_cst (utype, ratioi);
+ expr = fold (build (MULT_EXPR, utype, ratio, expr));
+ expr = fold (build (PLUS_EXPR, utype, ubase, expr));
+ }
+
+ return expr;
+}
+
+/* Determines the expression by that USE is expressed from induction variable
+ CAND in LOOP. */
+
+static tree
+get_computation (struct loop *loop, struct iv_use *use, struct iv_cand *cand)
+{
+ return get_computation_at (loop, use, cand, use->stmt);
+}
+
+/* Strips constant offsets from EXPR and adds them to OFFSET. */
+
+static void
+strip_offset (tree *expr, unsigned HOST_WIDE_INT *offset)
+{
+ tree op0, op1;
+ enum tree_code code;
+
+ while (1)
+ {
+ if (cst_and_fits_in_hwi (*expr))
+ {
+ *offset += int_cst_value (*expr);
+ *expr = integer_zero_node;
+ return;
+ }
+
+ code = TREE_CODE (*expr);
+
+ if (code != PLUS_EXPR && code != MINUS_EXPR)
+ return;
+
+ op0 = TREE_OPERAND (*expr, 0);
+ op1 = TREE_OPERAND (*expr, 1);
+
+ if (cst_and_fits_in_hwi (op1))
+ {
+ if (code == PLUS_EXPR)
+ *offset += int_cst_value (op1);
+ else
+ *offset -= int_cst_value (op1);
+
+ *expr = op0;
+ continue;
+ }
+
+ if (code != PLUS_EXPR)
+ return;
+
+ if (!cst_and_fits_in_hwi (op0))
+ return;
+
+ *offset += int_cst_value (op0);
+ *expr = op1;
+ }
+}
+
+/* Returns cost of addition in MODE. */
+
+static unsigned
+add_cost (enum machine_mode mode)
+{
+ static unsigned costs[NUM_MACHINE_MODES];
+ rtx seq;
+ unsigned cost;
+
+ if (costs[mode])
+ return costs[mode];
+
+ start_sequence ();
+ force_operand (gen_rtx_fmt_ee (PLUS, mode,
+ gen_raw_REG (mode, FIRST_PSEUDO_REGISTER),
+ gen_raw_REG (mode, FIRST_PSEUDO_REGISTER + 1)),
+ NULL_RTX);
+ seq = get_insns ();
+ end_sequence ();
+
+ cost = seq_cost (seq);
+ if (!cost)
+ cost = 1;
+
+ costs[mode] = cost;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Addition in %s costs %d\n",
+ GET_MODE_NAME (mode), cost);
+ return cost;
+}
+
+/* Entry in a hashtable of already known costs for multiplication. */
+struct mbc_entry
+{
+ HOST_WIDE_INT cst; /* The constant to multiply by. */
+ enum machine_mode mode; /* In mode. */
+ unsigned cost; /* The cost. */
+};
+
+/* Counts hash value for the ENTRY. */
+
+static hashval_t
+mbc_entry_hash (const void *entry)
+{
+ const struct mbc_entry *e = entry;
+
+ return 57 * (hashval_t) e->mode + (hashval_t) (e->cst % 877);
+}
+
+/* Compares the hash table entries ENTRY1 and ENTRY2. */
+
+static int
+mbc_entry_eq (const void *entry1, const void *entry2)
+{
+ const struct mbc_entry *e1 = entry1;
+ const struct mbc_entry *e2 = entry2;
+
+ return (e1->mode == e2->mode
+ && e1->cst == e2->cst);
+}
+
+/* Returns cost of multiplication by constant CST in MODE. */
+
+static unsigned
+multiply_by_cost (HOST_WIDE_INT cst, enum machine_mode mode)
+{
+ static htab_t costs;
+ struct mbc_entry **cached, act;
+ rtx seq;
+ unsigned cost;
+
+ if (!costs)
+ costs = htab_create (100, mbc_entry_hash, mbc_entry_eq, free);
+
+ act.mode = mode;
+ act.cst = cst;
+ cached = (struct mbc_entry **) htab_find_slot (costs, &act, INSERT);
+ if (*cached)
+ return (*cached)->cost;
+
+ *cached = xmalloc (sizeof (struct mbc_entry));
+ (*cached)->mode = mode;
+ (*cached)->cst = cst;
+
+ start_sequence ();
+ expand_mult (mode, gen_raw_REG (mode, FIRST_PSEUDO_REGISTER), GEN_INT (cst),
+ NULL_RTX, 0);
+ seq = get_insns ();
+ end_sequence ();
+
+ cost = seq_cost (seq);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Multiplication by %d in %s costs %d\n",
+ (int) cst, GET_MODE_NAME (mode), cost);
+
+ (*cached)->cost = cost;
+
+ return cost;
+}
+
+/* Returns cost of address in shape symbol + var + OFFSET + RATIO * index.
+ If SYMBOL_PRESENT is false, symbol is omitted. If VAR_PRESENT is false,
+ variable is omitted. The created memory accesses MODE.
+
+ TODO -- there must be some better way. This all is quite crude. */
+
+static unsigned
+get_address_cost (bool symbol_present, bool var_present,
+ unsigned HOST_WIDE_INT offset, HOST_WIDE_INT ratio)
+{
+#define MAX_RATIO 128
+ static sbitmap valid_mult;
+ static HOST_WIDE_INT rat, off;
+ static HOST_WIDE_INT min_offset, max_offset;
+ static unsigned costs[2][2][2][2];
+ unsigned cost, acost;
+ rtx seq, addr, base;
+ bool offset_p, ratio_p;
+ rtx reg1;
+ HOST_WIDE_INT s_offset;
+ unsigned HOST_WIDE_INT mask;
+ unsigned bits;
+
+ if (!valid_mult)
+ {
+ HOST_WIDE_INT i;
+
+ reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
+
+ addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, NULL_RTX);
+ for (i = 1; i <= 1 << 20; i <<= 1)
+ {
+ XEXP (addr, 1) = GEN_INT (i);
+ if (!memory_address_p (Pmode, addr))
+ break;
+ }
+ max_offset = i >> 1;
+ off = max_offset;
+
+ for (i = 1; i <= 1 << 20; i <<= 1)
+ {
+ XEXP (addr, 1) = GEN_INT (-i);
+ if (!memory_address_p (Pmode, addr))
+ break;
+ }
+ min_offset = -(i >> 1);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "get_address_cost:\n");
+ fprintf (dump_file, " min offset %d\n", (int) min_offset);
+ fprintf (dump_file, " max offset %d\n", (int) max_offset);
+ }
+
+ valid_mult = sbitmap_alloc (2 * MAX_RATIO + 1);
+ sbitmap_zero (valid_mult);
+ rat = 1;
+ addr = gen_rtx_fmt_ee (MULT, Pmode, reg1, NULL_RTX);
+ for (i = -MAX_RATIO; i <= MAX_RATIO; i++)
+ {
+ XEXP (addr, 1) = GEN_INT (i);
+ if (memory_address_p (Pmode, addr))
+ {
+ SET_BIT (valid_mult, i + MAX_RATIO);
+ rat = i;
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " allowed multipliers:");
+ for (i = -MAX_RATIO; i <= MAX_RATIO; i++)
+ if (TEST_BIT (valid_mult, i + MAX_RATIO))
+ fprintf (dump_file, " %d", (int) i);
+ fprintf (dump_file, "\n");
+ fprintf (dump_file, "\n");
+ }
+ }
+
+ bits = GET_MODE_BITSIZE (Pmode);
+ mask = ~(~(unsigned HOST_WIDE_INT) 0 << (bits - 1) << 1);
+ offset &= mask;
+ if ((offset >> (bits - 1) & 1))
+ offset |= ~mask;
+ s_offset = offset;
+
+ cost = 0;
+ offset_p = (min_offset <= s_offset && s_offset <= max_offset);
+ ratio_p = (ratio != 1
+ && -MAX_RATIO <= ratio && ratio <= MAX_RATIO
+ && TEST_BIT (valid_mult, ratio + MAX_RATIO));
+
+ if (ratio != 1 && !ratio_p)
+ cost += multiply_by_cost (ratio, Pmode);
+
+ if (s_offset && !offset_p && !symbol_present)
+ {
+ cost += add_cost (Pmode);
+ var_present = true;
+ }
+
+ acost = costs[symbol_present][var_present][offset_p][ratio_p];
+ if (!acost)
+ {
+ acost = 0;
+
+ addr = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
+ reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER + 1);
+ if (ratio_p)
+ addr = gen_rtx_fmt_ee (MULT, Pmode, addr, GEN_INT (rat));
+
+ if (symbol_present)
+ {
+ base = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (""));
+ if (offset_p)
+ base = gen_rtx_fmt_e (CONST, Pmode,
+ gen_rtx_fmt_ee (PLUS, Pmode,
+ base,
+ GEN_INT (off)));
+ if (var_present)
+ base = gen_rtx_fmt_ee (PLUS, Pmode, reg1, base);
+ }
+
+ else if (var_present)
+ {
+ base = reg1;
+ if (offset_p)
+ base = gen_rtx_fmt_ee (PLUS, Pmode, base, GEN_INT (off));
+ }
+ else if (offset_p)
+ base = GEN_INT (off);
+ else
+ base = NULL_RTX;
+
+ if (base)
+ addr = gen_rtx_fmt_ee (PLUS, Pmode, base, addr);
+
+ start_sequence ();
+ addr = memory_address (Pmode, addr);
+ seq = get_insns ();
+ end_sequence ();
+
+ acost = seq_cost (seq);
+ acost += address_cost (addr, Pmode);
+
+ if (!acost)
+ acost = 1;
+ costs[symbol_present][var_present][offset_p][ratio_p] = acost;
+ }
+
+ return cost + acost;
+}
+
+/* Records invariants in *EXPR_P. Callback for walk_tree. DATA contains
+ the bitmap to that we should store it. */
+
+static struct ivopts_data *fd_ivopts_data;
+static tree
+find_depends (tree *expr_p, int *ws ATTRIBUTE_UNUSED, void *data)
+{
+ bitmap *depends_on = data;
+ struct version_info *info;
+
+ if (TREE_CODE (*expr_p) != SSA_NAME)
+ return NULL_TREE;
+ info = name_info (fd_ivopts_data, *expr_p);
+
+ if (!info->inv_id || info->has_nonlin_use)
+ return NULL_TREE;
+
+ if (!*depends_on)
+ *depends_on = BITMAP_XMALLOC ();
+ bitmap_set_bit (*depends_on, info->inv_id);
+
+ return NULL_TREE;
+}
+
+/* Estimates cost of forcing EXPR into variable. DEPENDS_ON is a set of the
+ invariants the computation depends on. */
+
+static unsigned
+force_var_cost (struct ivopts_data *data,
+ tree expr, bitmap *depends_on)
+{
+ if (depends_on)
+ {
+ fd_ivopts_data = data;
+ walk_tree (&expr, find_depends, depends_on, NULL);
+ }
+
+ if (TREE_INVARIANT (expr)
+ || SSA_VAR_P (expr))
+ return 0;
+
+ return spill_cost;
+}
+
+/* Peels a single layer of ADDR. If DIFF is not NULL, do it only if the
+ offset is constant and add the offset to DIFF. */
+
+static tree
+peel_address (tree addr, unsigned HOST_WIDE_INT *diff)
+{
+ tree off, size;
+ HOST_WIDE_INT bit_offset;
+
+ switch (TREE_CODE (addr))
+ {
+ case SSA_NAME:
+ case INDIRECT_REF:
+ case BIT_FIELD_REF:
+ case VAR_DECL:
+ case PARM_DECL:
+ case RESULT_DECL:
+ case STRING_CST:
+ return NULL_TREE;
+
+ case COMPONENT_REF:
+ off = DECL_FIELD_BIT_OFFSET (TREE_OPERAND (addr, 1));
+ bit_offset = TREE_INT_CST_LOW (off);
+
+ if (bit_offset % BITS_PER_UNIT)
+ abort ();
+
+ if (diff)
+ *diff += bit_offset / BITS_PER_UNIT;
+
+ return TREE_OPERAND (addr, 0);
+
+ case ARRAY_REF:
+ off = TREE_OPERAND (addr, 1);
+
+ if (diff)
+ {
+ if (!cst_and_fits_in_hwi (off))
+ return NULL_TREE;
+
+ size = TYPE_SIZE_UNIT (TREE_TYPE (addr));
+ if (!cst_and_fits_in_hwi (size))
+ return NULL_TREE;
+
+ *diff += TREE_INT_CST_LOW (off) * TREE_INT_CST_LOW (size);
+ }
+
+ return TREE_OPERAND (addr, 0);
+
+ default:
+ abort ();
+ }
+}
+
+/* Checks whether E1 and E2 have constant difference, and if they do,
+ store it in *DIFF. */
+
+static bool
+ptr_difference_const (tree e1, tree e2, unsigned HOST_WIDE_INT *diff)
+{
+ int d1 = 0, d2 = 0;
+ tree x;
+ unsigned HOST_WIDE_INT delta1 = 0, delta2 = 0;
+
+ /* Find depths of E1 and E2. */
+ for (x = e1; x; x = peel_address (x, NULL))
+ d1++;
+ for (x = e2; x; x = peel_address (x, NULL))
+ d2++;
+
+ for (; e1 && d1 > d2; e1 = peel_address (e1, &delta1))
+ d1--;
+ for (; e2 && d2 > d1; e2 = peel_address (e2, &delta2))
+ d2--;
+
+ while (e1 && e2 && !operand_equal_p (e1, e2, 0))
+ {
+ e1 = peel_address (e1, &delta1);
+ e2 = peel_address (e2, &delta1);
+ }
+
+ if (!e1 || !e2)
+ return false;
+
+ *diff = delta1 - delta2;
+ return true;
+}
+
+/* Estimates cost of expressing address ADDR as var + symbol + offset. The
+ value of offset is added to OFFSET, SYMBOL_PRESENT and VAR_PRESENT are set
+ to false if the corresponding part is missing. DEPENDS_ON is a set of the
+ invariants the computation depends on. */
+
+static unsigned
+split_address_cost (struct ivopts_data *data,
+ tree addr, bool *symbol_present, bool *var_present,
+ unsigned HOST_WIDE_INT *offset, bitmap *depends_on)
+{
+ tree core = addr;
+
+ while (core
+ && TREE_CODE (core) != VAR_DECL)
+ core = peel_address (core, offset);
+
+ if (!core)
+ {
+ *symbol_present = false;
+ *var_present = true;
+ fd_ivopts_data = data;
+ walk_tree (&addr, find_depends, depends_on, NULL);
+ return spill_cost;
+ }
+
+ if (TREE_STATIC (core)
+ || DECL_EXTERNAL (core))
+ {
+ *symbol_present = true;
+ *var_present = false;
+ return 0;
+ }
+
+ *symbol_present = false;
+ *var_present = true;
+ return 0;
+}
+
+/* Estimates cost of expressing difference of addresses E1 - E2 as
+ var + symbol + offset. The value of offset is added to OFFSET,
+ SYMBOL_PRESENT and VAR_PRESENT are set to false if the corresponding
+ part is missing. DEPENDS_ON is a set of the invariants the computation
+ depends on. */
+
+static unsigned
+ptr_difference_cost (struct ivopts_data *data,
+ tree e1, tree e2, bool *symbol_present, bool *var_present,
+ unsigned HOST_WIDE_INT *offset, bitmap *depends_on)
+{
+ unsigned HOST_WIDE_INT diff = 0;
+ unsigned cost;
+
+ if (TREE_CODE (e1) != ADDR_EXPR)
+ abort ();
+
+ if (TREE_CODE (e2) == ADDR_EXPR
+ && ptr_difference_const (TREE_OPERAND (e1, 0),
+ TREE_OPERAND (e2, 0), &diff))
+ {
+ *offset += diff;
+ *symbol_present = false;
+ *var_present = false;
+ return 0;
+ }
+
+ if (e2 == integer_zero_node)
+ return split_address_cost (data, TREE_OPERAND (e1, 0),
+ symbol_present, var_present, offset, depends_on);
+
+ *symbol_present = false;
+ *var_present = true;
+
+ cost = force_var_cost (data, e1, depends_on);
+ cost += force_var_cost (data, e2, depends_on);
+ cost += add_cost (Pmode);
+
+ return cost;
+}
+
+/* Estimates cost of expressing difference E1 - E2 as
+ var + symbol + offset. The value of offset is added to OFFSET,
+ SYMBOL_PRESENT and VAR_PRESENT are set to false if the corresponding
+ part is missing. DEPENDS_ON is a set of the invariants the computation
+ depends on. */
+
+static unsigned
+difference_cost (struct ivopts_data *data,
+ tree e1, tree e2, bool *symbol_present, bool *var_present,
+ unsigned HOST_WIDE_INT *offset, bitmap *depends_on)
+{
+ unsigned cost;
+ enum machine_mode mode = TYPE_MODE (TREE_TYPE (e1));
+
+ strip_offset (&e1, offset);
+ *offset = -*offset;
+ strip_offset (&e2, offset);
+ *offset = -*offset;
+
+ if (TREE_CODE (e1) == ADDR_EXPR)
+ return ptr_difference_cost (data, e1, e2, symbol_present, var_present, offset,
+ depends_on);
+ *symbol_present = false;
+
+ if (operand_equal_p (e1, e2, 0))
+ {
+ *var_present = false;
+ return 0;
+ }
+ *var_present = true;
+ if (zero_p (e2))
+ return force_var_cost (data, e1, depends_on);
+
+ if (zero_p (e1))
+ {
+ cost = force_var_cost (data, e2, depends_on);
+ cost += multiply_by_cost (-1, mode);
+
+ return cost;
+ }
+
+ cost = force_var_cost (data, e1, depends_on);
+ cost += force_var_cost (data, e2, depends_on);
+ cost += add_cost (mode);
+
+ return cost;
+}
+
+/* Determines the cost of the computation by that USE is expressed
+ from induction variable CAND. If ADDRESS_P is true, we just need
+ to create an address from it, otherwise we want to get it into
+ register. A set of invariants we depend on is stored in
+ DEPENDS_ON. AT is the statement at that the value is computed. */
+
+static unsigned
+get_computation_cost_at (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand,
+ bool address_p, bitmap *depends_on, tree at)
+{
+ tree ubase = use->iv->base, ustep = use->iv->step;
+ tree cbase, cstep;
+ tree utype = TREE_TYPE (ubase), ctype;
+ unsigned HOST_WIDE_INT ustepi, cstepi, offset = 0;
+ HOST_WIDE_INT ratio, aratio;
+ bool var_present, symbol_present;
+ unsigned cost = 0, n_sums;
+
+ *depends_on = NULL;
+
+ /* Only consider real candidates. */
+ if (!cand->iv)
+ return INFTY;
+
+ cbase = cand->iv->base;
+ cstep = cand->iv->step;
+ ctype = TREE_TYPE (cbase);
+
+ if (TYPE_PRECISION (utype) > TYPE_PRECISION (ctype))
+ {
+ /* We do not have a precision to express the values of use. */
+ return INFTY;
+ }
+
+ if (!cst_and_fits_in_hwi (ustep)
+ || !cst_and_fits_in_hwi (cstep))
+ return INFTY;
+
+ if (TREE_CODE (ubase) == INTEGER_CST
+ && !cst_and_fits_in_hwi (ubase))
+ goto fallback;
+
+ if (TREE_CODE (cbase) == INTEGER_CST
+ && !cst_and_fits_in_hwi (cbase))
+ goto fallback;
+
+ ustepi = int_cst_value (ustep);
+ cstepi = int_cst_value (cstep);
+
+ if (TYPE_PRECISION (utype) != TYPE_PRECISION (ctype))
+ {
+ /* TODO -- add direct handling of this case. */
+ goto fallback;
+ }
+
+ if (!divide (TYPE_PRECISION (utype), ustepi, cstepi, &ratio))
+ return INFTY;
+
+ /* use = ubase + ratio * (var - cbase). If either cbase is a constant
+ or ratio == 1, it is better to handle this like
+
+ ubase - ratio * cbase + ratio * var
+
+ (also holds in the case ratio == -1, TODO. */
+
+ if (TREE_CODE (cbase) == INTEGER_CST)
+ {
+ offset = - ratio * int_cst_value (cbase);
+ cost += difference_cost (data,
+ ubase, integer_zero_node,
+ &symbol_present, &var_present, &offset,
+ depends_on);
+ }
+ else if (ratio == 1)
+ {
+ cost += difference_cost (data,
+ ubase, cbase,
+ &symbol_present, &var_present, &offset,
+ depends_on);
+ }
+ else
+ {
+ cost += force_var_cost (data, cbase, depends_on);
+ cost += add_cost (TYPE_MODE (ctype));
+ cost += difference_cost (data,
+ ubase, integer_zero_node,
+ &symbol_present, &var_present, &offset,
+ depends_on);
+ }
+
+ /* If we are after the increment, the value of the candidate is higher by
+ one iteration. */
+ if (stmt_after_increment (data->current_loop, cand, at))
+ offset -= ratio * cstepi;
+
+ /* Now the computation is in shape symbol + var1 + const + ratio * var2.
+ (symbol/var/const parts may be omitted). If we are looking for an address,
+ find the cost of addressing this. */
+ if (address_p)
+ return get_address_cost (symbol_present, var_present, offset, ratio);
+
+ /* Otherwise estimate the costs for computing the expression. */
+ aratio = ratio > 0 ? ratio : -ratio;
+ if (!symbol_present && !var_present && !offset)
+ {
+ if (ratio != 1)
+ cost += multiply_by_cost (ratio, TYPE_MODE (ctype));
+
+ return cost;
+ }
+
+ if (aratio != 1)
+ cost += multiply_by_cost (aratio, TYPE_MODE (ctype));
+
+ n_sums = 1;
+ if (var_present
+ /* Symbol + offset should be compile-time computable. */
+ && (symbol_present || offset))
+ n_sums++;
+
+ return cost + n_sums * add_cost (TYPE_MODE (ctype));
+
+fallback:
+ {
+ /* Just get the expression, expand it and measure the cost. */
+ tree comp = get_computation_at (data->current_loop, use, cand, at);
+
+ if (!comp)
+ return INFTY;
+
+ if (address_p)
+ comp = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (comp)), comp);
+
+ return computation_cost (comp);
+ }
+}
+
+/* Determines the cost of the computation by that USE is expressed
+ from induction variable CAND. If ADDRESS_P is true, we just need
+ to create an address from it, otherwise we want to get it into
+ register. A set of invariants we depend on is stored in
+ DEPENDS_ON. */
+
+static unsigned
+get_computation_cost (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand,
+ bool address_p, bitmap *depends_on)
+{
+ return get_computation_cost_at (data,
+ use, cand, address_p, depends_on, use->stmt);
+}
+
+/* Determines cost of basing replacement of USE on CAND in a generic
+ expression. */
+
+static void
+determine_use_iv_cost_generic (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ bitmap depends_on;
+ unsigned cost = get_computation_cost (data, use, cand, false, &depends_on);
+
+ set_use_iv_cost (data, use, cand, cost, depends_on);
+}
+
+/* Determines cost of basing replacement of USE on CAND in an address. */
+
+static void
+determine_use_iv_cost_address (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ bitmap depends_on;
+ unsigned cost = get_computation_cost (data, use, cand, true, &depends_on);
+
+ set_use_iv_cost (data, use, cand, cost, depends_on);
+}
+
+/* Computes value of induction variable IV in iteration NITER. */
+
+static tree
+iv_value (struct iv *iv, tree niter)
+{
+ tree val;
+ tree type = TREE_TYPE (iv->base);
+
+ niter = convert (type, niter);
+ val = fold (build (MULT_EXPR, type, iv->step, niter));
+
+ return fold (build (PLUS_EXPR, type, iv->base, val));
+}
+
+/* Computes value of candidate CAND at position AT in iteration NITER. */
+
+static tree
+cand_value_at (struct loop *loop, struct iv_cand *cand, tree at, tree niter)
+{
+ tree type = TREE_TYPE (niter);
+
+ if (stmt_after_increment (loop, cand, at))
+ niter = fold (build (PLUS_EXPR, type, niter,
+ convert (type, integer_one_node)));
+
+ return iv_value (cand->iv, niter);
+}
+
+/* Check whether it is possible to express the condition in USE by comparison
+ of candidate CAND. If so, store the comparison code to COMPARE and the
+ value compared with to BOUND. */
+
+static bool
+may_eliminate_iv (struct loop *loop,
+ struct iv_use *use, struct iv_cand *cand,
+ enum tree_code *compare, tree *bound)
+{
+ edge exit;
+ struct tree_niter_desc *niter;
+
+ /* For now just very primitive -- we work just for the single exit condition,
+ and are quite conservative about the possible overflows. TODO -- both of
+ these can be improved. */
+ exit = loop_data (loop)->single_exit;
+ if (!exit)
+ return false;
+ if (use->stmt != last_stmt (exit->src))
+ return false;
+
+ niter = &loop_data (loop)->niter;
+ if (!niter->niter
+ || !operand_equal_p (niter->assumptions, boolean_true_node, 0)
+ || !operand_equal_p (niter->may_be_zero, boolean_false_node, 0))
+ return false;
+
+ /* FIXME -- we ignore the possible overflow here. For example
+ in case the loop iterates MAX_UNSIGNED_INT / 2 times and
+ the step of candidate is 4, this is wrong. */
+ if (exit->flags & EDGE_TRUE_VALUE)
+ *compare = EQ_EXPR;
+ else
+ *compare = NE_EXPR;
+
+ *bound = cand_value_at (loop, cand, use->stmt, niter->niter);
+
+ return true;
+}
+
+/* Determines cost of basing replacement of USE on CAND in a condition. */
+
+static void
+determine_use_iv_cost_condition (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ tree bound;
+ enum tree_code compare;
+
+ /* Only consider real candidates. */
+ if (!cand->iv)
+ {
+ set_use_iv_cost (data, use, cand, INFTY, NULL);
+ return;
+ }
+
+ if (may_eliminate_iv (data->current_loop, use, cand, &compare, &bound))
+ {
+ bitmap depends_on = NULL;
+ unsigned cost = force_var_cost (data, bound, &depends_on);
+
+ set_use_iv_cost (data, use, cand, cost, depends_on);
+ return;
+ }
+
+ /* The induction variable elimination failed; just express the original
+ giv. If it is compared with an invariant, note that we cannot get
+ rid of it. */
+ if (TREE_CODE (*use->op_p) == SSA_NAME)
+ record_invariant (data, *use->op_p, true);
+ else
+ {
+ record_invariant (data, TREE_OPERAND (*use->op_p, 0), true);
+ record_invariant (data, TREE_OPERAND (*use->op_p, 1), true);
+ }
+
+ determine_use_iv_cost_generic (data, use, cand);
+}
+
+/* Checks whether it is possible to replace the final value of USE by
+ a direct computation. If so, the formula is stored to *VALUE. */
+
+static bool
+may_replace_final_value (struct loop *loop, struct iv_use *use, tree *value)
+{
+ edge exit;
+ struct tree_niter_desc *niter;
+
+ exit = loop_data (loop)->single_exit;
+ if (!exit)
+ return false;
+
+ if (!dominated_by_p (CDI_DOMINATORS, exit->src,
+ bb_for_stmt (use->stmt)))
+ abort ();
+
+ niter = &loop_data (loop)->niter;
+ if (!niter->niter
+ || !operand_equal_p (niter->assumptions, boolean_true_node, 0)
+ || !operand_equal_p (niter->may_be_zero, boolean_false_node, 0))
+ return false;
+
+ *value = iv_value (use->iv, niter->niter);
+
+ return true;
+}
+
+/* Determines cost of replacing final value of USE using CAND. */
+
+static void
+determine_use_iv_cost_outer (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ bitmap depends_on;
+ unsigned cost;
+ edge exit;
+ tree value;
+ struct loop *loop = data->current_loop;
+
+ if (!cand->iv)
+ {
+ if (!may_replace_final_value (loop, use, &value))
+ {
+ set_use_iv_cost (data, use, cand, INFTY, NULL);
+ return;
+ }
+
+ depends_on = NULL;
+ cost = force_var_cost (data, value, &depends_on);
+
+ cost /= AVG_LOOP_NITER (loop);
+
+ set_use_iv_cost (data, use, cand, cost, depends_on);
+ return;
+ }
+
+ exit = loop_data (loop)->single_exit;
+ if (exit)
+ {
+ /* If there is just a single exit, we may use value of the candidate
+ after we take it to determine the value of use. */
+ cost = get_computation_cost_at (data, use, cand, false, &depends_on,
+ last_stmt (exit->src));
+ cost /= AVG_LOOP_NITER (loop);
+ }
+ else
+ {
+ /* Otherwise we just need to compute the iv. */
+ cost = get_computation_cost (data, use, cand, false, &depends_on);
+ }
+
+ set_use_iv_cost (data, use, cand, cost, depends_on);
+}
+
+/* Determines cost of basing replacement of USE on CAND. */
+
+static void
+determine_use_iv_cost (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ switch (use->type)
+ {
+ case USE_NONLINEAR_EXPR:
+ determine_use_iv_cost_generic (data, use, cand);
+ break;
+
+ case USE_OUTER:
+ determine_use_iv_cost_outer (data, use, cand);
+ break;
+
+ case USE_ADDRESS:
+ determine_use_iv_cost_address (data, use, cand);
+ break;
+
+ case USE_COMPARE:
+ determine_use_iv_cost_condition (data, use, cand);
+ break;
+
+ default:
+ abort ();
+ }
+}
+
+/* Determines costs of basing the use of the iv on an iv candidate. */
+
+static void
+determine_use_iv_costs (struct ivopts_data *data)
+{
+ unsigned i, j;
+ struct iv_use *use;
+ struct iv_cand *cand;
+
+ data->consider_all_candidates = (n_iv_cands (data)
+ <= CONSIDER_ALL_CANDIDATES_BOUND);
+
+ alloc_use_cost_map (data);
+
+ if (!data->consider_all_candidates)
+ {
+ /* Add the important candidate entries. */
+ for (j = 0; j < n_iv_cands (data); j++)
+ {
+ cand = iv_cand (data, j);
+ if (!cand->important)
+ continue;
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ use = iv_use (data, i);
+ determine_use_iv_cost (data, use, cand);
+ }
+ }
+ }
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ use = iv_use (data, i);
+
+ if (data->consider_all_candidates)
+ {
+ for (j = 0; j < n_iv_cands (data); j++)
+ {
+ cand = iv_cand (data, j);
+ determine_use_iv_cost (data, use, cand);
+ }
+ }
+ else
+ {
+ EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j,
+ {
+ cand = iv_cand (data, j);
+ if (!cand->important)
+ determine_use_iv_cost (data, use, cand);
+ });
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Use-candidate costs:\n");
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ use = iv_use (data, i);
+
+ fprintf (dump_file, "Use %d:\n", i);
+ fprintf (dump_file, " cand\tcost\tdepends on\n");
+ for (j = 0; j < use->n_map_members; j++)
+ {
+ if (!use->cost_map[j].cand
+ || use->cost_map[j].cost == INFTY)
+ continue;
+
+ fprintf (dump_file, " %d\t%d\t",
+ use->cost_map[j].cand->id,
+ use->cost_map[j].cost);
+ if (use->cost_map[j].depends_on)
+ bitmap_print (dump_file,
+ use->cost_map[j].depends_on, "","");
+ fprintf (dump_file, "\n");
+ }
+
+ fprintf (dump_file, "\n");
+ }
+ fprintf (dump_file, "\n");
+ }
+}
+
+/* Determines cost of the candidate CAND. */
+
+static void
+determine_iv_cost (struct ivopts_data *data, struct iv_cand *cand)
+{
+ unsigned cost_base, cost_step;
+ tree base, last;
+ basic_block bb;
+
+ if (!cand->iv)
+ {
+ cand->cost = 0;
+ return;
+ }
+
+ /* There are two costs associated with the candidate -- its incrementation
+ and its initialization. The second is almost negligible for any loop
+ that rolls enough, so we take it just very little into account. */
+
+ base = cand->iv->base;
+ cost_base = force_var_cost (data, base, NULL);
+ cost_step = add_cost (TYPE_MODE (TREE_TYPE (base)));
+
+ cand->cost = cost_step + cost_base / AVG_LOOP_NITER (current_loop);
+
+ /* Prefer the original iv unless we may gain something by replacing it. */
+ if (cand->pos == IP_ORIGINAL)
+ cand->cost--;
+
+ /* Prefer not to insert statements into latch unless there are some
+ already (so that we do not create unnecesary jumps). */
+ if (cand->pos == IP_END)
+ {
+ bb = ip_end_pos (data->current_loop);
+ last = last_stmt (bb);
+
+ if (!last
+ || TREE_CODE (last) == LABEL_EXPR)
+ cand->cost++;
+ }
+}
+
+/* Determines costs of computation of the candidates. */
+
+static void
+determine_iv_costs (struct ivopts_data *data)
+{
+ unsigned i;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Candidate costs:\n");
+ fprintf (dump_file, " cand\tcost\n");
+ }
+
+ for (i = 0; i < n_iv_cands (data); i++)
+ {
+ struct iv_cand *cand = iv_cand (data, i);
+
+ determine_iv_cost (data, cand);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " %d\t%d\n", i, cand->cost);
+ }
+
+if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n");
+}
+
+/* Calculates cost for having SIZE new loop global variables. REGS_USED is the
+ number of global registers used in loop. N_USES is the number of relevant
+ variable uses. */
+
+unsigned
+global_cost_for_size (unsigned size, unsigned regs_used, unsigned n_uses)
+{
+ unsigned regs_needed = regs_used + size;
+ unsigned cost = 0;
+
+ if (regs_needed + res_regs <= avail_regs)
+ cost += small_cost * size;
+ else if (regs_needed <= avail_regs)
+ cost += pres_cost * size;
+ else
+ {
+ cost += pres_cost * size;
+ cost += spill_cost * n_uses * (regs_needed - avail_regs) / regs_needed;
+ }
+
+ return cost;
+}
+
+/* Calculates cost for having SIZE induction variables. */
+
+static unsigned
+ivopts_global_cost_for_size (struct ivopts_data *data, unsigned size)
+{
+ return global_cost_for_size (size,
+ loop_data (data->current_loop)->regs_used,
+ n_iv_uses (data));
+}
+
+/* Initialize the constants for computing set costs. */
+
+void
+init_set_costs (void)
+{
+ rtx seq;
+ rtx reg1 = gen_raw_REG (SImode, FIRST_PSEUDO_REGISTER);
+ rtx reg2 = gen_raw_REG (SImode, FIRST_PSEUDO_REGISTER + 1);
+ rtx addr = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER + 2);
+ rtx mem = validize_mem (gen_rtx_MEM (SImode, addr));
+ unsigned i;
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS], i)
+ && !fixed_regs[i])
+ avail_regs++;
+
+ res_regs = 3;
+
+ /* These are really just heuristic values. */
+
+ start_sequence ();
+ emit_move_insn (reg1, reg2);
+ seq = get_insns ();
+ end_sequence ();
+ small_cost = seq_cost (seq);
+ pres_cost = 2 * small_cost;
+
+ start_sequence ();
+ emit_move_insn (mem, reg1);
+ emit_move_insn (reg2, mem);
+ seq = get_insns ();
+ end_sequence ();
+ spill_cost = seq_cost (seq);
+}
+
+/* For each size of the induction variable set determine the penalty. */
+
+static void
+determine_set_costs (struct ivopts_data *data)
+{
+ unsigned j, n;
+ tree phi, op;
+ struct loop *loop = data->current_loop;
+
+ /* We use the following model (definitely improvable, especially the
+ cost function -- TODO):
+
+ We estimate the number of registers available (using MD data), name it A.
+
+ We estimate the number of registers used by the loop, name it U. This
+ number is obtained as the number of loop phi nodes (not counting virtual
+ registers and bivs) + the number of variables from outside of the loop.
+
+ We set a reserve R (free regs that are used for temporary computations,
+ etc.). For now the reserve a constant 3.
+
+ Let I be the number of induction variables.
+
+ -- if U + I + R <= A, the cost is I * SMALL_COST (just not to encourage
+ make a lot of ivs without a reason).
+ -- if A - R < U + I <= A, the cost is I * PRES_COST
+ -- if U + I > A, the cost is I * PRES_COST and
+ number of uses * SPILL_COST * (U + I - A) / (U + I) is added. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Global costs:\n");
+ fprintf (dump_file, " avail_regs %d\n", avail_regs);
+ fprintf (dump_file, " small_cost %d\n", small_cost);
+ fprintf (dump_file, " pres_cost %d\n", pres_cost);
+ fprintf (dump_file, " spill_cost %d\n", spill_cost);
+ }
+
+ n = 0;
+ for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+ {
+ op = PHI_RESULT (phi);
+
+ if (!is_gimple_reg (op))
+ continue;
+
+ if (get_iv (data, op))
+ continue;
+
+ n++;
+ }
+
+ EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, j,
+ {
+ struct version_info *info = ver_info (data, j);
+
+ if (info->inv_id && info->has_nonlin_use)
+ n++;
+ });
+
+ loop_data (loop)->regs_used = n;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " regs_used %d\n", n);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " cost for size:\n");
+ fprintf (dump_file, " ivs\tcost\n");
+ for (j = 0; j <= 2 * avail_regs; j++)
+ fprintf (dump_file, " %d\t%d\n", j,
+ ivopts_global_cost_for_size (data, j));
+ fprintf (dump_file, "\n");
+ }
+}
+
+/* Finds a best candidate for USE and stores it to CAND. The candidates are
+ taken from the set SOL and they may depend on invariants in the set INV.
+ The really used candidate and invariants are noted to USED_IVS and
+ USED_INV. */
+
+static unsigned
+find_best_candidate (struct ivopts_data *data,
+ struct iv_use *use, bitmap sol, bitmap inv,
+ bitmap used_ivs, bitmap used_inv, struct iv_cand **cand)
+{
+ unsigned c, d;
+ unsigned best_cost = INFTY, cost;
+ struct iv_cand *cnd = NULL, *acnd;
+ bitmap depends_on = NULL;
+
+ EXECUTE_IF_SET_IN_BITMAP (sol, 0, c,
+ {
+ acnd = iv_cand (data, c);
+ cost = get_use_iv_cost (data, use, acnd, &depends_on);
+
+ if (cost == INFTY)
+ goto next_cand;
+ if (cost > best_cost)
+ goto next_cand;
+ if (cost == best_cost)
+ {
+ /* Prefer the cheaper iv. */
+ if (acnd->cost >= cnd->cost)
+ goto next_cand;
+ }
+
+ if (depends_on)
+ {
+ EXECUTE_IF_AND_COMPL_IN_BITMAP (depends_on, inv, 0, d,
+ goto next_cand);
+ if (used_inv)
+ bitmap_a_or_b (used_inv, used_inv, depends_on);
+ }
+
+ cnd = acnd;
+ best_cost = cost;
+next_cand: ;
+ });
+
+ if (cnd && used_ivs)
+ bitmap_set_bit (used_ivs, cnd->id);
+
+ if (cand)
+ *cand = cnd;
+
+ return best_cost;
+}
+
+/* Computes cost of set of ivs SOL + invariants INV. Removes unnecessary
+ induction variable candidates and invariants from the sets. */
+
+static unsigned
+set_cost (struct ivopts_data *data, bitmap sol, bitmap inv)
+{
+ unsigned i;
+ unsigned cost = 0, size = 0, acost;
+ struct iv_use *use;
+ struct iv_cand *cand;
+ bitmap used_ivs = BITMAP_XMALLOC (), used_inv = BITMAP_XMALLOC ();
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ use = iv_use (data, i);
+ acost = find_best_candidate (data, use, sol, inv,
+ used_ivs, used_inv, NULL);
+ if (acost == INFTY)
+ {
+ BITMAP_XFREE (used_ivs);
+ BITMAP_XFREE (used_inv);
+ return INFTY;
+ }
+ cost += acost;
+ }
+
+ EXECUTE_IF_SET_IN_BITMAP (used_ivs, 0, i,
+ {
+ cand = iv_cand (data, i);
+
+ /* Do not count the pseudocandidates. */
+ if (cand->iv)
+ size++;
+
+ cost += cand->cost;
+ });
+ EXECUTE_IF_SET_IN_BITMAP (used_inv, 0, i, size++);
+ cost += ivopts_global_cost_for_size (data, size);
+
+ bitmap_copy (sol, used_ivs);
+ bitmap_copy (inv, used_inv);
+
+ BITMAP_XFREE (used_ivs);
+ BITMAP_XFREE (used_inv);
+
+ return cost;
+}
+
+/* Finds an initial set of IVS and invariants INV. We do this by simply
+ chosing the best candidate for each use. */
+
+static unsigned
+get_initial_solution (struct ivopts_data *data, bitmap ivs, bitmap inv)
+{
+ unsigned i;
+
+ for (i = 0; i < n_iv_cands (data); i++)
+ bitmap_set_bit (ivs, i);
+ for (i = 1; i <= data->max_inv_id; i++)
+ if (!ver_info (data, i)->has_nonlin_use)
+ bitmap_set_bit (inv, i);
+
+ return set_cost (data, ivs, inv);
+}
+
+/* Tries to improve set of induction variables IVS and invariants INV to get
+ it better than COST. */
+
+static bool
+try_improve_iv_set (struct ivopts_data *data,
+ bitmap ivs, bitmap inv, unsigned *cost)
+{
+ unsigned i, acost;
+ bitmap new_ivs = BITMAP_XMALLOC (), new_inv = BITMAP_XMALLOC ();
+ bitmap best_new_ivs = NULL, best_new_inv = NULL;
+
+ /* Try altering the set of induction variables by one. */
+ for (i = 0; i < n_iv_cands (data); i++)
+ {
+ bitmap_copy (new_ivs, ivs);
+ bitmap_copy (new_inv, inv);
+
+ if (bitmap_bit_p (ivs, i))
+ bitmap_clear_bit (new_ivs, i);
+ else
+ bitmap_set_bit (new_ivs, i);
+
+ acost = set_cost (data, new_ivs, new_inv);
+ if (acost >= *cost)
+ continue;
+
+ if (!best_new_ivs)
+ {
+ best_new_ivs = BITMAP_XMALLOC ();
+ best_new_inv = BITMAP_XMALLOC ();
+ }
+
+ *cost = acost;
+ bitmap_copy (best_new_ivs, new_ivs);
+ bitmap_copy (best_new_inv, new_inv);
+ }
+
+ /* Ditto for invariants. */
+ for (i = 1; i <= data->max_inv_id; i++)
+ {
+ if (ver_info (data, i)->has_nonlin_use)
+ continue;
+
+ bitmap_copy (new_ivs, ivs);
+ bitmap_copy (new_inv, inv);
+
+ if (bitmap_bit_p (inv, i))
+ bitmap_clear_bit (new_inv, i);
+ else
+ bitmap_set_bit (new_inv, i);
+
+ acost = set_cost (data, new_ivs, new_inv);
+ if (acost >= *cost)
+ continue;
+
+ if (!best_new_ivs)
+ {
+ best_new_ivs = BITMAP_XMALLOC ();
+ best_new_inv = BITMAP_XMALLOC ();
+ }
+
+ *cost = acost;
+ bitmap_copy (best_new_ivs, new_ivs);
+ bitmap_copy (best_new_inv, new_inv);
+ }
+
+ BITMAP_XFREE (new_ivs);
+ BITMAP_XFREE (new_inv);
+
+ if (!best_new_ivs)
+ return false;
+
+ bitmap_copy (ivs, best_new_ivs);
+ bitmap_copy (inv, best_new_inv);
+ BITMAP_XFREE (best_new_ivs);
+ BITMAP_XFREE (best_new_inv);
+ return true;
+}
+
+/* Attempts to find the optimal set of induction variables. We do simple
+ greedy heuristic -- we try to replace at most one candidate in the selected
+ solution and remove the unused ivs while this improves the cost. */
+
+static bitmap
+find_optimal_iv_set (struct ivopts_data *data)
+{
+ unsigned cost, i;
+ bitmap set = BITMAP_XMALLOC ();
+ bitmap inv = BITMAP_XMALLOC ();
+ struct iv_use *use;
+
+ /* Set the upper bound. */
+ cost = get_initial_solution (data, set, inv);
+ if (cost == INFTY)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unable to substitute for ivs, failed.\n");
+ BITMAP_XFREE (inv);
+ BITMAP_XFREE (set);
+ return NULL;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Initial set of candidates (cost %d): ", cost);
+ bitmap_print (dump_file, set, "", "");
+ fprintf (dump_file, " invariants ");
+ bitmap_print (dump_file, inv, "", "");
+ fprintf (dump_file, "\n");
+ }
+
+ while (try_improve_iv_set (data, set, inv, &cost))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Improved to (cost %d): ", cost);
+ bitmap_print (dump_file, set, "", "");
+ fprintf (dump_file, " invariants ");
+ bitmap_print (dump_file, inv, "", "");
+ fprintf (dump_file, "\n");
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Final cost %d\n\n", cost);
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ use = iv_use (data, i);
+ find_best_candidate (data, use, set, inv, NULL, NULL, &use->selected);
+ }
+
+ BITMAP_XFREE (inv);
+
+ return set;
+}
+
+/* Creates an induction variable with value BASE + STEP * iteration in LOOP.
+ It is expected that neither BASE nor STEP are shared with other expressions
+ (unless the sharing rules allow this). Use VAR as a base var_decl for it
+ (if NULL, a new temporary will be created). The increment will occur at
+ INCR_POS (after it if AFTER is true, before it otherwise). The ssa versions
+ of the variable before and after increment will be stored in VAR_BEFORE and
+ VAR_AFTER (unless they are NULL). */
+
+void
+create_iv (tree base, tree step, tree var, struct loop *loop,
+ block_stmt_iterator *incr_pos, bool after,
+ tree *var_before, tree *var_after)
+{
+ tree stmt, stmts, initial;
+ tree vb, va;
+
+ if (!var)
+ {
+ var = create_tmp_var (TREE_TYPE (base), "ivtmp");
+ add_referenced_tmp_var (var);
+ }
+
+ vb = make_ssa_name (var, NULL_TREE);
+ if (var_before)
+ *var_before = vb;
+ va = make_ssa_name (var, NULL_TREE);
+ if (var_after)
+ *var_after = va;
+
+ stmt = build (MODIFY_EXPR, void_type_node, va,
+ build (PLUS_EXPR, TREE_TYPE (base),
+ vb, step));
+ SSA_NAME_DEF_STMT (va) = stmt;
+ if (after)
+ bsi_insert_after (incr_pos, stmt, BSI_NEW_STMT);
+ else
+ bsi_insert_before (incr_pos, stmt, BSI_NEW_STMT);
+
+ initial = force_gimple_operand (base, &stmts, false);
+ if (stmts)
+ {
+ basic_block new_bb;
+ edge pe = loop_preheader_edge (loop);
+
+ new_bb = bsi_insert_on_edge_immediate (pe, stmts);
+ if (new_bb)
+ add_bb_to_loop (new_bb, new_bb->pred->src->loop_father);
+ }
+
+ stmt = create_phi_node (vb, loop->header);
+ SSA_NAME_DEF_STMT (vb) = stmt;
+ add_phi_arg (&stmt, initial, loop_preheader_edge (loop));
+ add_phi_arg (&stmt, va, loop_latch_edge (loop));
+}
+
+/* Creates a new induction variable corresponding to CAND. */
+
+static void
+create_new_iv (struct ivopts_data *data, struct iv_cand *cand)
+{
+ block_stmt_iterator incr_pos;
+ tree base;
+ bool after = false;
+
+ if (!cand->iv)
+ return;
+
+ switch (cand->pos)
+ {
+ case IP_NORMAL:
+ incr_pos = bsi_last (ip_normal_pos (data->current_loop));
+ break;
+
+ case IP_END:
+ incr_pos = bsi_last (ip_end_pos (data->current_loop));
+ after = true;
+ break;
+
+ case IP_ORIGINAL:
+ /* Mark that the iv is preserved. */
+ name_info (data, cand->var_before)->preserve_biv = true;
+ name_info (data, cand->var_after)->preserve_biv = true;
+
+ /* Rewrite the increment so that it uses var_before directly. */
+ find_interesting_uses_op (data, cand->var_after)->selected = cand;
+
+ return;
+ }
+
+ gimple_add_tmp_var (cand->var_before);
+ add_referenced_tmp_var (cand->var_before);
+
+ base = unshare_expr (cand->iv->base);
+
+ create_iv (base, cand->iv->step, cand->var_before, data->current_loop,
+ &incr_pos, after, &cand->var_before, &cand->var_after);
+}
+
+/* Creates new induction variables described in SET. */
+
+static void
+create_new_ivs (struct ivopts_data *data, bitmap set)
+{
+ unsigned i;
+ struct iv_cand *cand;
+
+ EXECUTE_IF_SET_IN_BITMAP (set, 0, i,
+ {
+ cand = iv_cand (data, i);
+ create_new_iv (data, cand);
+ });
+}
+
+/* Removes statement STMT (real or a phi node). If INCLUDING_DEFINED_NAME
+ is true, remove also the ssa name defined by the statement. */
+
+static void
+remove_statement (tree stmt, bool including_defined_name)
+{
+ if (TREE_CODE (stmt) == PHI_NODE)
+ {
+ if (!including_defined_name)
+ {
+ /* Prevent the ssa name defined by the statement from being removed. */
+ PHI_RESULT (stmt) = NULL;
+ }
+ remove_phi_node (stmt, NULL_TREE, bb_for_stmt (stmt));
+ }
+ else
+ {
+ block_stmt_iterator bsi = stmt_bsi (stmt);
+
+ bsi_remove (&bsi);
+ }
+}
+
+/* Rewrites USE (definition of iv used in a nonlinear expression)
+ using candidate CAND. */
+
+static void
+rewrite_use_nonlinear_expr (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ tree comp = unshare_expr (get_computation (data->current_loop,
+ use, cand));
+ tree op, stmts, tgt, ass;
+ block_stmt_iterator bsi, pbsi;
+
+ if (TREE_CODE (use->stmt) == PHI_NODE)
+ {
+ tgt = PHI_RESULT (use->stmt);
+
+ /* If we should keep the biv, do not replace it. */
+ if (name_info (data, tgt)->preserve_biv)
+ return;
+
+ pbsi = bsi = bsi_start (bb_for_stmt (use->stmt));
+ while (!bsi_end_p (pbsi)
+ && TREE_CODE (bsi_stmt (pbsi)) == LABEL_EXPR)
+ {
+ bsi = pbsi;
+ bsi_next (&pbsi);
+ }
+ }
+ else
+ {
+ tgt = TREE_OPERAND (use->stmt, 0);
+ bsi = stmt_bsi (use->stmt);
+ }
+
+ op = force_gimple_operand (comp, &stmts, false);
+
+ if (TREE_CODE (use->stmt) == PHI_NODE)
+ {
+ if (stmts)
+ bsi_insert_after (&bsi, stmts, BSI_CONTINUE_LINKING);
+ ass = build (MODIFY_EXPR, TREE_TYPE (tgt), tgt, op);
+ bsi_insert_after (&bsi, ass, BSI_NEW_STMT);
+ remove_statement (use->stmt, false);
+ SSA_NAME_DEF_STMT (tgt) = ass;
+ }
+ else
+ {
+ if (stmts)
+ bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+ TREE_OPERAND (use->stmt, 1) = op;
+ }
+}
+
+/* Rewrites USE (address that is an iv) using candidate CAND. */
+
+static void
+rewrite_use_address (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ tree comp = unshare_expr (get_computation (data->current_loop,
+ use, cand));
+ block_stmt_iterator bsi = stmt_bsi (use->stmt);
+ tree stmts;
+ tree op = force_gimple_operand (comp, &stmts, false);
+ tree var, tmp_var, name;
+
+ if (stmts)
+ bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+
+ if (TREE_CODE (op) == SSA_NAME)
+ {
+ /* We need to add a memory tag for the variable. But we do not want
+ to add it to the temporary used for the computations, since this leads
+ to problems in redundancy elimination when there are common parts
+ in two computations refering to the different arrays. So we rewrite
+ the base variable of the ssa name to a new temporary. */
+ tmp_var = create_tmp_var (TREE_TYPE (op), "ruatmp");
+ add_referenced_tmp_var (tmp_var);
+ SSA_NAME_VAR (op) = tmp_var;
+
+ var = get_base_address (*use->op_p);
+ if (TREE_CODE (var) == INDIRECT_REF)
+ var = TREE_OPERAND (var, 0);
+ if (TREE_CODE (var) == SSA_NAME)
+ {
+ name = var;
+ var = SSA_NAME_VAR (var);
+ }
+ else
+ name = NULL_TREE;
+ if (var_ann (var)->type_mem_tag)
+ var = var_ann (var)->type_mem_tag;
+ var_ann (tmp_var)->type_mem_tag = var;
+
+ if (name)
+ {
+ ssa_name_ann_t ann = ssa_name_ann (name), new_ann;
+
+ if (ann && ann->name_mem_tag)
+ {
+ new_ann = get_ssa_name_ann (op);
+ new_ann->name_mem_tag = ann->name_mem_tag;
+ }
+ }
+ }
+
+ *use->op_p = build1 (INDIRECT_REF, TREE_TYPE (*use->op_p), op);
+}
+
+/* Rewrites USE (the condition such that one of the arguments is an iv) using
+ candidate CAND. */
+
+static void
+rewrite_use_compare (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ tree comp;
+ tree *op_p, cond, op, stmts, bound;
+ block_stmt_iterator bsi = stmt_bsi (use->stmt);
+ enum tree_code compare;
+
+ if (may_eliminate_iv (data->current_loop,
+ use, cand, &compare, &bound))
+ {
+ op = force_gimple_operand (unshare_expr (bound), &stmts, false);
+
+ if (stmts)
+ bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+
+ *use->op_p = build (compare, boolean_type_node,
+ var_at_stmt (data->current_loop,
+ cand, use->stmt), op);
+ modify_stmt (use->stmt);
+ return;
+ }
+
+ /* The induction variable elimination failed; just express the original
+ giv. */
+ comp = unshare_expr (get_computation (data->current_loop, use, cand));
+
+ cond = *use->op_p;
+ op_p = &TREE_OPERAND (cond, 0);
+ if (TREE_CODE (*op_p) != SSA_NAME
+ || zero_p (get_iv (data, *op_p)->step))
+ op_p = &TREE_OPERAND (cond, 1);
+
+ op = force_gimple_operand (comp, &stmts, false);
+ if (stmts)
+ bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+
+ *op_p = op;
+}
+
+/* Split loop exit edge EXIT. The things are a bit complicated by a need to
+ preserve the loop closed ssa form. */
+
+static void
+split_loop_exit_edge (edge exit)
+{
+ basic_block dest = exit->dest;
+ basic_block bb = loop_split_edge_with (exit, NULL);
+ tree phi, *def_p, new_phi, new_name;
+
+ for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi))
+ {
+ def_p = &phi_element_for_edge (phi, bb->succ)->def;
+
+ new_name = duplicate_ssa_name (*def_p, NULL);
+ new_phi = create_phi_node (new_name, bb);
+ SSA_NAME_DEF_STMT (new_name) = new_phi;
+ add_phi_arg (&new_phi, *def_p, exit);
+ *def_p = new_name;
+ }
+}
+
+/* Ensure that operand *OP_P may be used at the end of EXIT without
+ violating loop closed ssa form. */
+
+static void
+protect_loop_closed_ssa_form_use (edge exit, tree *op_p)
+{
+ basic_block def_bb;
+ struct loop *def_loop;
+ tree phi;
+
+ if (TREE_CODE (*op_p) != SSA_NAME)
+ return;
+
+ def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (*op_p));
+ if (!def_bb)
+ return;
+
+ def_loop = def_bb->loop_father;
+ if (flow_bb_inside_loop_p (def_loop, exit->dest))
+ return;
+
+ /* Try finding a phi node that copies the value out of the loop. */
+ for (phi = phi_nodes (exit->dest); phi; phi = TREE_CHAIN (phi))
+ if (phi_element_for_edge (phi, exit)->def == *op_p)
+ break;
+
+ if (!phi)
+ {
+ /* Create such a phi node. */
+ tree new_name = duplicate_ssa_name (*op_p, NULL);
+
+ phi = create_phi_node (new_name, exit->dest);
+ SSA_NAME_DEF_STMT (new_name) = phi;
+ add_phi_arg (&phi, *op_p, exit);
+ }
+
+ *op_p = PHI_RESULT (phi);
+}
+
+/* Ensure that operands of STMT may be used at the end of EXIT without
+ violating loop closed ssa form. */
+
+static void
+protect_loop_closed_ssa_form (edge exit, tree stmt)
+{
+ use_optype uses;
+ vuse_optype vuses;
+ vdef_optype vdefs;
+ unsigned i;
+
+ get_stmt_operands (stmt);
+
+ uses = STMT_USE_OPS (stmt);
+ for (i = 0; i < NUM_USES (uses); i++)
+ protect_loop_closed_ssa_form_use (exit, USE_OP_PTR (uses, i));
+
+ vuses = STMT_VUSE_OPS (stmt);
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ protect_loop_closed_ssa_form_use (exit, VUSE_OP_PTR (vuses, i));
+
+ vdefs = STMT_VDEF_OPS (stmt);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ protect_loop_closed_ssa_form_use (exit, VDEF_OP_PTR (vdefs, i));
+}
+
+/* STMTS compute a value of a phi argument OP on EXIT of a loop. Arrange things
+ so that they are emitted on the correct place, and so that the loop closed
+ ssa form is preserved. */
+
+void
+compute_phi_arg_on_exit (edge exit, tree stmts, tree op)
+{
+ tree_stmt_iterator tsi;
+ block_stmt_iterator bsi;
+ tree phi, stmt, def, next;
+
+ if (exit->dest->pred->pred_next)
+ split_loop_exit_edge (exit);
+
+ if (TREE_CODE (stmts) == STATEMENT_LIST)
+ {
+ for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
+ protect_loop_closed_ssa_form (exit, tsi_stmt (tsi));
+ }
+ else
+ protect_loop_closed_ssa_form (exit, stmts);
+
+ /* Ensure there is label in exit->dest, so that we can
+ insert after it. */
+ tree_block_label (exit->dest);
+ bsi = bsi_after_labels (exit->dest);
+ bsi_insert_after (&bsi, stmts, BSI_CONTINUE_LINKING);
+
+ if (!op)
+ return;
+
+ for (phi = phi_nodes (exit->dest); phi; phi = next)
+ {
+ next = TREE_CHAIN (phi);
+
+ if (phi_element_for_edge (phi, exit)->def == op)
+ {
+ def = PHI_RESULT (phi);
+ remove_statement (phi, false);
+ stmt = build (MODIFY_EXPR, TREE_TYPE (op),
+ def, op);
+ SSA_NAME_DEF_STMT (def) = stmt;
+ bsi_insert_after (&bsi, stmt, BSI_CONTINUE_LINKING);
+ }
+ }
+}
+
+/* Rewrites the final value of USE (that is only needed outside of the loop)
+ using candidate CAND. */
+
+static void
+rewrite_use_outer (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ edge exit;
+ tree value, op, stmts, tgt = *use->op_p;
+ tree phi;
+
+ exit = loop_data (data->current_loop)->single_exit;
+
+ if (exit)
+ {
+ if (!cand->iv)
+ {
+ if (!may_replace_final_value (data->current_loop, use, &value))
+ abort ();
+ }
+ else
+ value = get_computation_at (data->current_loop,
+ use, cand, last_stmt (exit->src));
+
+ op = force_gimple_operand (value, &stmts, true);
+
+ /* If we will preserve the iv anyway and we would need to perform
+ some computation to replace the final value, do nothing. */
+ if (stmts && name_info (data, tgt)->preserve_biv)
+ return;
+
+ for (phi = phi_nodes (exit->dest); phi; phi = TREE_CHAIN (phi))
+ {
+ tree *def_p = &phi_element_for_edge (phi, exit)->def;
+
+ if (*def_p == tgt)
+ *def_p = op;
+ }
+
+ if (stmts)
+ compute_phi_arg_on_exit (exit, stmts, op);
+
+ /* Enable removal of the statement. We cannot remove it directly,
+ since we may still need the aliasing information attached to the
+ ssa name defined by it. */
+ name_info (data, tgt)->iv->have_use_for = false;
+ return;
+ }
+
+ /* If the variable is going to be preserved anyway, there is nothing to
+ do. */
+ if (name_info (data, tgt)->preserve_biv)
+ return;
+
+ /* Otherwise we just need to compute the iv. */
+ rewrite_use_nonlinear_expr (data, use, cand);
+}
+
+/* Rewrites USE using candidate CAND. */
+
+static void
+rewrite_use (struct ivopts_data *data,
+ struct iv_use *use, struct iv_cand *cand)
+{
+ switch (use->type)
+ {
+ case USE_NONLINEAR_EXPR:
+ rewrite_use_nonlinear_expr (data, use, cand);
+ break;
+
+ case USE_OUTER:
+ rewrite_use_outer (data, use, cand);
+ break;
+
+ case USE_ADDRESS:
+ rewrite_use_address (data, use, cand);
+ break;
+
+ case USE_COMPARE:
+ rewrite_use_compare (data, use, cand);
+ break;
+
+ default:
+ abort ();
+ }
+ modify_stmt (use->stmt);
+}
+
+/* Rewrite the uses using the selected induction variables. */
+
+static void
+rewrite_uses (struct ivopts_data *data)
+{
+ unsigned i;
+ struct iv_cand *cand;
+ struct iv_use *use;
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ use = iv_use (data, i);
+ cand = use->selected;
+ if (!cand)
+ abort ();
+
+ rewrite_use (data, use, cand);
+ }
+}
+
+/* Removes the ivs that are not used after rewriting. */
+
+static void
+remove_unused_ivs (struct ivopts_data *data)
+{
+ unsigned j;
+
+ EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, j,
+ {
+ struct version_info *info;
+
+ info = ver_info (data, j);
+ if (info->iv
+ && !zero_p (info->iv->step)
+ && !info->inv_id
+ && !info->iv->have_use_for
+ && !info->preserve_biv)
+ remove_statement (SSA_NAME_DEF_STMT (info->iv->ssa_name), true);
+ });
+}
+
+/* Frees data allocated by the optimization of a single loop. */
+
+static void
+free_loop_data (struct ivopts_data *data)
+{
+ unsigned i, j;
+
+ EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i,
+ {
+ struct version_info *info;
+
+ info = ver_info (data, i);
+ if (info->iv)
+ free (info->iv);
+ info->iv = NULL;
+ info->has_nonlin_use = false;
+ info->preserve_biv = false;
+ info->inv_id = 0;
+ });
+ bitmap_clear (data->relevant);
+
+ for (i = 0; i < n_iv_uses (data); i++)
+ {
+ struct iv_use *use = iv_use (data, i);
+
+ free (use->iv);
+ BITMAP_XFREE (use->related_cands);
+ for (j = 0; j < use->n_map_members; j++)
+ if (use->cost_map[j].depends_on)
+ BITMAP_XFREE (use->cost_map[j].depends_on);
+ free (use->cost_map);
+ free (use);
+ }
+ VARRAY_POP_ALL (data->iv_uses);
+
+ for (i = 0; i < n_iv_cands (data); i++)
+ {
+ struct iv_cand *cand = iv_cand (data, i);
+
+ if (cand->iv)
+ free (cand->iv);
+ free (cand);
+ }
+ VARRAY_POP_ALL (data->iv_candidates);
+
+ if (data->version_info_size < highest_ssa_version)
+ {
+ data->version_info_size = 2 * highest_ssa_version;
+ free (data->version_info);
+ data->version_info = xcalloc (data->version_info_size,
+ sizeof (struct version_info));
+ }
+
+ data->max_inv_id = 0;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (decl_rtl_to_reset); i++)
+ {
+ tree obj = VARRAY_GENERIC_PTR_NOGC (decl_rtl_to_reset, i);
+
+ SET_DECL_RTL (obj, NULL_RTX);
+ }
+ VARRAY_POP_ALL (decl_rtl_to_reset);
+}
+
+/* Finalizes data structures used by the iv optimization pass. LOOPS is the
+ loop tree. */
+
+static void
+tree_ssa_iv_optimize_finalize (struct loops *loops, struct ivopts_data *data)
+{
+ unsigned i;
+
+ for (i = 1; i < loops->num; i++)
+ if (loops->parray[i])
+ {
+ free (loops->parray[i]->aux);
+ loops->parray[i]->aux = NULL;
+ }
+
+ free_loop_data (data);
+ free (data->version_info);
+ BITMAP_XFREE (data->relevant);
+
+ VARRAY_FREE (decl_rtl_to_reset);
+ VARRAY_FREE (data->iv_uses);
+ VARRAY_FREE (data->iv_candidates);
+
+ scev_finalize ();
+}
+
+/* Optimizes the LOOP. Returns true if anything changed. */
+
+static bool
+tree_ssa_iv_optimize_loop (struct ivopts_data *data, struct loop *loop)
+{
+ bool changed = false;
+ bitmap iv_set;
+
+ data->current_loop = loop;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Processing loop %d\n", loop->num);
+ fprintf (dump_file, " %d exits\n", loop_data (loop)->n_exits);
+ if (loop_data (loop)->single_exit)
+ {
+ edge ex = loop_data (loop)->single_exit;
+
+ fprintf (dump_file, " single exit %d -> %d, exit condition ",
+ ex->src->index, ex->dest->index);
+ print_generic_expr (dump_file, last_stmt (ex->src), TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+ fprintf (dump_file, "\n");
+ }
+
+ /* For each ssa name determines whether it behaves as an induction variable
+ in some loop. */
+ if (!find_induction_variables (data))
+ goto finish;
+
+ /* Finds interesting uses (item 1). */
+ find_interesting_uses (data);
+
+ /* Finds candidates for the induction variables (item 2). */
+ find_iv_candidates (data);
+
+ /* Calculates the costs (item 3, part 1). */
+ determine_use_iv_costs (data);
+ determine_iv_costs (data);
+ determine_set_costs (data);
+
+ /* Find the optimal set of induction variables (item 3, part 2). */
+ iv_set = find_optimal_iv_set (data);
+ if (!iv_set)
+ goto finish;
+ changed = true;
+
+ /* Create the new induction variables (item 4, part 1). */
+ create_new_ivs (data, iv_set);
+
+ /* Rewrite the uses (item 4, part 2). */
+ rewrite_uses (data);
+
+ /* Remove the ivs that are unused after rewriting. */
+ remove_unused_ivs (data);
+
+ loop_commit_inserts ();
+
+ BITMAP_XFREE (iv_set);
+finish:
+ free_loop_data (data);
+
+ return changed;
+}
+
+/* Main entry point. Optimizes induction variables in LOOPS. */
+
+void
+tree_ssa_iv_optimize (struct loops *loops)
+{
+ struct loop *loop;
+ struct ivopts_data data;
+
+ timevar_push (TV_TREE_LOOP_IVOPTS);
+ tree_ssa_iv_optimize_init (loops, &data);
+
+ /* Optimize the loops starting with the innermost ones. */
+ loop = loops->tree_root;
+ while (loop->inner)
+ loop = loop->inner;
+
+#ifdef ENABLE_CHECKING
+ verify_loop_closed_ssa ();
+#endif
+
+ /* Scan the loops, inner ones first. */
+ while (loop != loops->tree_root)
+ {
+ if (tree_ssa_iv_optimize_loop (&data, loop))
+ {
+#ifdef ENABLE_CHECKING
+ verify_loop_closed_ssa ();
+#endif
+ }
+
+ if (loop->next)
+ {
+ loop = loop->next;
+ while (loop->inner)
+ loop = loop->inner;
+ }
+ else
+ loop = loop->outer;
+ }
+
+ tree_ssa_iv_optimize_finalize (loops, &data);
+
+ timevar_pop (TV_TREE_LOOP_IVOPTS);
+}
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
new file mode 100644
index 00000000000..5102cf3b349
--- /dev/null
+++ b/gcc/tree-ssa-loop-manip.c
@@ -0,0 +1,1020 @@
+/* High-level loop manipulation functions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "output.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-pass.h"
+
+static basic_block lv_adjust_loop_entry_edge (basic_block, basic_block, edge,
+ tree);
+static void lv_update_pending_stmts (edge e);
+static void lv_adjust_loop_header_phi (basic_block, basic_block, basic_block,
+ edge);
+
+/* Copies phi nodes in newly created copies of the LOOP. The new blocks start
+ since FIRST_NEW_BLOCK index. PEELING is true if we were peeling
+ the loop. */
+
+static void
+copy_phi_nodes (struct loop *loop, unsigned first_new_block, bool peeling)
+{
+ unsigned i;
+ basic_block bb, orig;
+ tree phi, new_phi, def;
+ edge e, new_e;
+ edge latch = loop_latch_edge (loop), entry = loop_preheader_edge (loop);
+
+ for (i = first_new_block; i < (unsigned) last_basic_block; i++)
+ {
+ tree nlist;
+ bb = BASIC_BLOCK (i);
+ orig = bb->rbi->original;
+
+ for (phi = phi_nodes (orig); phi; phi = TREE_CHAIN (phi))
+ {
+ new_phi = create_phi_node (PHI_RESULT (phi), bb);
+
+ if (orig == loop->header)
+ {
+ if (!bb->pred || bb->pred->pred_next)
+ abort ();
+
+ new_e = bb->pred;
+ e = (peeling && bb->rbi->copy_number == 1 ? entry : latch);
+ def = phi_element_for_edge (phi, e)->def;
+ add_phi_arg (&new_phi, def, new_e);
+ continue;
+ }
+
+ for (new_e = bb->pred; new_e; new_e = new_e->pred_next)
+ {
+ e = find_edge (new_e->src->rbi->original, orig);
+ if (!e)
+ abort ();
+
+ def = phi_element_for_edge (phi, e)->def;
+ add_phi_arg (&new_phi, def, new_e);
+ }
+ }
+
+ /* neverse phi nodes to keep them in original order. */
+ nlist = nreverse (phi_nodes (bb));
+ set_phi_nodes (bb, nlist);
+ }
+
+ if (peeling)
+ {
+ /* Update the phi nodes in the header so that the latch value comes from
+ both edges. */
+ for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+ {
+ def = phi_element_for_edge (phi, latch)->def;
+ phi_element_for_edge (phi, entry)->def = def;
+ }
+ }
+}
+
+/* Constructs list of all ssa names defined inside LOOP. */
+
+static tree
+collect_defs (struct loop *loop)
+{
+ basic_block *body = get_loop_body (loop);
+ unsigned i, j;
+ tree phi, stmt;
+ block_stmt_iterator bsi;
+ def_optype defs;
+ vdef_optype vdefs;
+ tree ret = NULL_TREE;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ for (bsi = bsi_start (body[i]); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ stmt = bsi_stmt (bsi);
+
+ get_stmt_operands (stmt);
+
+ defs = STMT_DEF_OPS (stmt);
+ for (j = 0; j < NUM_DEFS (defs); j++)
+ ret = tree_cons (NULL, DEF_OP (defs, j), ret);
+
+ vdefs = STMT_VDEF_OPS (stmt);
+ for (j = 0; j < NUM_VDEFS (vdefs); j++)
+ ret = tree_cons (NULL, VDEF_RESULT (vdefs, j), ret);
+ }
+
+ for (phi = phi_nodes (body[i]); phi; phi = TREE_CHAIN (phi))
+ ret = tree_cons (NULL, PHI_RESULT (phi), ret);
+ }
+
+ return ret;
+}
+
+/* For each definition in DEFINITIONS allocates NDUPL + 1 copies
+ (one for each duplicate of the loop body). */
+
+static void
+allocate_new_names (tree definitions, unsigned ndupl)
+{
+ tree def;
+ unsigned i;
+ ssa_name_ann_t ann;
+ tree *new_names;
+ bool abnormal;
+
+ for (; definitions; definitions = TREE_CHAIN (definitions))
+ {
+ def = TREE_VALUE (definitions);
+ ann = get_ssa_name_ann (def);
+ new_names = xmalloc (sizeof (tree) * (ndupl + 1));
+ ann->common.aux = new_names;
+
+ abnormal = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def);
+ for (i = 0; i <= ndupl; i++)
+ {
+ new_names[i] = duplicate_ssa_name (def, SSA_NAME_DEF_STMT (def));
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_names[i]) = abnormal;
+ }
+ }
+}
+
+/* Renames the variable *OP_P in statement STMT. If DEF is true,
+ *OP_P is defined by the statement. N_COPY is the number of the
+ copy of the loop body we are renaming. */
+
+static void
+rename_op (tree *op_p, bool def, tree stmt, unsigned n_copy)
+{
+ ssa_name_ann_t ann;
+ tree *new_names;
+
+ if (TREE_CODE (*op_p) != SSA_NAME)
+ return;
+
+ ann = ssa_name_ann (*op_p);
+ new_names = ann ? ann->common.aux : NULL;
+
+ /* Something defined outside of the loop. */
+ if (!new_names)
+ return;
+
+ /* An ordinary ssa name defined in the loop. */
+
+ *op_p = new_names[n_copy];
+ if (def)
+ SSA_NAME_DEF_STMT (*op_p) = stmt;
+}
+
+/* Renames the variables in basic block BB. */
+
+static void
+rename_variables_in_bb (basic_block bb)
+{
+ tree phi;
+ block_stmt_iterator bsi;
+ tree stmt;
+ stmt_ann_t ann;
+ use_optype uses;
+ vuse_optype vuses;
+ def_optype defs;
+ vdef_optype vdefs;
+ unsigned i, nbb = bb->rbi->copy_number;
+ edge e;
+
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ rename_op (&PHI_RESULT (phi), true, phi, nbb);
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ stmt = bsi_stmt (bsi);
+ get_stmt_operands (stmt);
+ ann = stmt_ann (stmt);
+
+ uses = USE_OPS (ann);
+ for (i = 0; i < NUM_USES (uses); i++)
+ rename_op (USE_OP_PTR (uses, i), false, stmt, nbb);
+
+ defs = DEF_OPS (ann);
+ for (i = 0; i < NUM_DEFS (defs); i++)
+ rename_op (DEF_OP_PTR (defs, i), true, stmt, nbb);
+
+ vuses = VUSE_OPS (ann);
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ rename_op (VUSE_OP_PTR (vuses, i), false, stmt, nbb);
+
+ vdefs = VDEF_OPS (ann);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ {
+ rename_op (VDEF_OP_PTR (vdefs, i), false, stmt, nbb);
+ rename_op (VDEF_RESULT_PTR (vdefs, i), true, stmt, nbb);
+ }
+ }
+
+ for (e = bb->succ; e; e = e->succ_next)
+ for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+ rename_op (&phi_element_for_edge (phi, e)->def, false, phi, nbb);
+}
+
+/* Renames variables in the area copied by tree_duplicate_loop_to_header_edge.
+ FIRST_NEW_BLOCK is the first block in the copied area. */
+
+static void
+rename_variables (unsigned first_new_block)
+{
+ unsigned i;
+ basic_block bb;
+
+ for (i = first_new_block; i < (unsigned) last_basic_block; i++)
+ {
+ bb = BASIC_BLOCK (i);
+
+ rename_variables_in_bb (bb);
+
+ if (bb->rbi->copy_number == 1)
+ rename_variables_in_bb (bb->rbi->original);
+ }
+}
+
+/* Releases the structures holding the new ssa names. The original ssa names
+ are released. */
+
+static void
+free_new_names (tree definitions)
+{
+ tree def;
+ ssa_name_ann_t ann;
+
+ for (; definitions; definitions = TREE_CHAIN (definitions))
+ {
+ def = TREE_VALUE (definitions);
+ ann = ssa_name_ann (def);
+
+ free (ann->common.aux);
+ ann->common.aux = NULL;
+
+ release_ssa_name (def);
+ }
+}
+
+/* Sets SSA_NAME_DEF_STMT for results of all phi nodes in BB. */
+
+static void
+set_phi_def_stmts (basic_block bb)
+{
+ tree phi;
+
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ SSA_NAME_DEF_STMT (PHI_RESULT (phi)) = phi;
+}
+
+/* Extends phi nodes on EXIT to the newly created edges. */
+
+static void
+extend_exit_phi_nodes (unsigned first_new_block, edge exit)
+{
+ basic_block exit_block = exit->dest;
+ edge ae;
+ tree phi, def;
+
+ for (phi = phi_nodes (exit_block); phi; phi = TREE_CHAIN (phi))
+ {
+ def = phi_element_for_edge (phi, exit)->def;
+
+ for (ae = exit_block->pred; ae; ae = ae->pred_next)
+ {
+ if (ae->src->index < (int) first_new_block)
+ continue;
+
+ if (ae->src->rbi->original != exit->src)
+ continue;
+
+ add_phi_arg (&phi, def, ae);
+ }
+ }
+}
+
+/* The same ad cfgloopmanip.c:duplicate_loop_to_header_edge, but also updates
+ ssa. In order to achieve this, only loops whose exits all lead to the same
+ location are handled.
+
+ FIXME: we create some degenerate phi nodes that could be avoided by copy
+ propagating them instead. Unfortunately this is not completely
+ straightforward due to problems with constant folding. */
+
+bool
+tree_duplicate_loop_to_header_edge (struct loop *loop, edge e,
+ struct loops *loops,
+ unsigned int ndupl, sbitmap wont_exit,
+ edge orig, edge *to_remove,
+ unsigned int *n_to_remove, int flags)
+{
+ unsigned first_new_block;
+ basic_block bb;
+ unsigned i;
+ bool peeling = (e != loop_latch_edge (loop));
+ edge latch, latch_copy;
+ tree phi, arg, map, def;
+ tree definitions;
+ edge *exits;
+ unsigned n_exits;
+
+ if (!(loops->state & LOOPS_HAVE_SIMPLE_LATCHES))
+ return false;
+ if (!(loops->state & LOOPS_HAVE_PREHEADERS))
+ return false;
+
+#ifdef ENABLE_CHECKING
+ verify_loop_closed_ssa ();
+#endif
+
+ exits = get_loop_exit_edges (loop, &n_exits);
+ definitions = collect_defs (loop);
+
+ first_new_block = last_basic_block;
+ if (!duplicate_loop_to_header_edge (loop, e, loops, ndupl, wont_exit,
+ orig, to_remove, n_to_remove, flags))
+ return false;
+
+ allocate_new_names (definitions, ndupl);
+
+ /* Readd the removed phi args for e. */
+ latch = loop_latch_edge (loop);
+ latch_copy = peeling ? loop_preheader_edge (loop) : latch;
+ map = PENDING_STMT (e);
+ PENDING_STMT (e) = NULL;
+
+ for (phi = phi_nodes (loop->header), arg = map;
+ phi;
+ phi = TREE_CHAIN (phi), arg = TREE_CHAIN (arg))
+ {
+ def = TREE_VALUE (arg);
+ add_phi_arg (&phi, def, latch_copy);
+ }
+ if (arg)
+ abort ();
+
+ /* Extend exit phi nodes. */
+ for (i = 0; i < n_exits; i++)
+ extend_exit_phi_nodes (first_new_block, exits[i]);
+ free (exits);
+
+ /* Copy the phi nodes. */
+ copy_phi_nodes (loop, first_new_block, peeling);
+
+ /* Rename the variables. */
+ rename_variables (first_new_block);
+ free_new_names (definitions);
+
+ /* For some time we have the identical ssa names as results in multiple phi
+ nodes. When phi node is resized, it sets SSA_NAME_DEF_STMT of its result
+ to the new copy. This means that we cannot easily ensure that the ssa
+ names defined in those phis are pointing to the right one -- so just
+ recompute SSA_NAME_DEF_STMT for them. */
+
+ for (i = first_new_block; i < (unsigned) last_basic_block; i++)
+ {
+ bb = BASIC_BLOCK (i);
+ set_phi_def_stmts (bb);
+ if (bb->rbi->copy_number == 1)
+ set_phi_def_stmts (bb->rbi->original);
+ }
+
+#ifdef ENABLE_CHECKING
+ verify_loop_closed_ssa ();
+#endif
+
+ return true;
+}
+
+/* Unrolls and peels each loop twice for testing. */
+
+void
+test_unrolling_and_peeling (struct loops *loops)
+{
+ struct loop *loop;
+ unsigned i;
+
+ for (i = 1; i < loops->num; i++)
+ {
+ loop = loops->parray[i];
+
+ if (!loop
+ || loop->inner)
+ continue;
+
+ tree_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
+ loops, 2, NULL, NULL, NULL, NULL, 0);
+ verify_loop_structure (loops);
+ verify_ssa ();
+
+ tree_duplicate_loop_to_header_edge (loop, loop_latch_edge (loop),
+ loops, 2, NULL, NULL, NULL, NULL, 0);
+ verify_loop_structure (loops);
+ verify_ssa ();
+ }
+}
+
+/*---------------------------------------------------------------------------
+ Loop versioning
+ ---------------------------------------------------------------------------*/
+
+/* Adjust entry edge for lv.
+
+ e is a incoming edge.
+
+ --- edge e ---- > [second_head]
+
+ Split it and insert new conditional expression and adjust edges.
+
+ --- edge e ---> [cond expr] ---> [first_head]
+ |
+ +---------> [second_head]
+
+*/
+
+static basic_block
+lv_adjust_loop_entry_edge (basic_block first_head,
+ basic_block second_head,
+ edge e,
+ tree cond_expr)
+{
+ block_stmt_iterator bsi;
+ basic_block orig_head = e->src;
+ basic_block new_head = NULL;
+ tree goto1 = NULL_TREE;
+ tree goto2 = NULL_TREE;
+ tree new_cond_expr = NULL_TREE;
+ edge e0, e1;
+
+ /* Split edge 'e'. This will create a new basic block, where we can
+ insert conditioanl expr. */
+ new_head = split_edge (e);
+ set_immediate_dominator (CDI_DOMINATORS, new_head, orig_head);
+
+ /* Build new conditional expr */
+ goto1 = build1 (GOTO_EXPR, void_type_node, tree_block_label (first_head));
+ goto2 = build1 (GOTO_EXPR, void_type_node, tree_block_label (second_head));
+ new_cond_expr = build (COND_EXPR, void_type_node, cond_expr, goto1, goto2);
+
+ /* Add new cond. in new head. */
+ bsi = bsi_start (new_head);
+ bsi_insert_after (&bsi, new_cond_expr, BSI_NEW_STMT);
+
+ /* Adjust edges appropriately to connect new head with first head
+ as well as second head. */
+ e1 = make_edge (new_head, first_head, EDGE_TRUE_VALUE);
+ set_immediate_dominator (CDI_DOMINATORS, first_head, new_head);
+ make_edge (new_head, second_head, EDGE_FALSE_VALUE);
+ set_immediate_dominator (CDI_DOMINATORS, second_head, new_head);
+
+ /* Adjust loop header phi nodes. */
+ lv_adjust_loop_header_phi (first_head, second_head, new_head, e1);
+
+ /* When edge 'e' was split, it created a fall through edge
+ from new head to second head. Above created FALSE edge
+ from new head to second head and now we do not need the
+ fall through edge. */
+ for (e0 = new_head->succ; e0; e0 = e0->succ_next)
+ if (e0->dest == second_head)
+ e0->flags &= ~EDGE_FALLTHRU;
+
+ return new_head;
+}
+
+/* Add phi args using PENDINT_STMT list. */
+
+static void
+lv_update_pending_stmts (edge e)
+{
+ basic_block dest;
+ tree phi, arg, def;
+
+ if (!PENDING_STMT (e))
+ return;
+
+ dest = e->dest;
+
+ for (phi = phi_nodes (dest), arg = PENDING_STMT (e);
+ phi;
+ phi = TREE_CHAIN (phi), arg = TREE_CHAIN (arg))
+ {
+ def = TREE_VALUE (arg);
+ add_phi_arg (&phi, def, e);
+ }
+
+ PENDING_STMT (e) = NULL;
+}
+
+/* Adjust phi nodes for 'first' basic block. 'second' basic block is a copy
+ of 'first'. Both of them are dominated by 'new_head' basic block. When
+ 'new_head' was created by 'second's incoming edge it received phi arguments
+ on the edge by split_edge(). Later, additional edge 'e' was created to
+ connect 'new_head' and 'first'. Now this routnine adds phi args on this
+ additional edge 'e' that new_head to second edge received as part of edge
+ splitting.
+*/
+
+static void
+lv_adjust_loop_header_phi (basic_block first, basic_block second,
+ basic_block new_head, edge e)
+{
+ tree phi1, phi2;
+
+ /* Browse all 'second' basic block phi nodes and add phi args to
+ edge 'e' for 'first' head. PHI args are always in correct order. */
+
+ for (phi2 = phi_nodes (second), phi1 = phi_nodes (first);
+ phi2 && phi1;
+ phi2 = TREE_CHAIN (phi2), phi1 = TREE_CHAIN (phi1))
+ {
+ int i;
+ for (i = 0; i < PHI_NUM_ARGS (phi2); i++)
+ {
+ if (PHI_ARG_EDGE (phi2, i)->src == new_head)
+ {
+ tree def = PHI_ARG_DEF (phi2, i);
+ add_phi_arg (&phi1, def, e);
+ }
+ }
+ }
+}
+
+
+/* Main entry point for Loop Versioning transformation.
+
+This transformation given a condition and a loop, creates
+-if (condition) { loop_copy1 } else { loop_copy2 },
+where loop_copy1 is the loop transformed in one way, and loop_copy2
+is the loop transformed in another way (or unchanged). 'condition'
+may be a run time test for things that were not resolved by static
+analysis (overlapping ranges (anti-aliasing), alignment, etc.). */
+
+struct loop *
+tree_ssa_loop_version (struct loops *loops, struct loop * loop,
+ tree cond_expr, basic_block *condition_bb)
+{
+ edge entry, latch_edge;
+ basic_block first_head, second_head;
+ int irred_flag;
+ struct loop *nloop;
+
+ /* CHECKME: Loop versioning does not handle nested loop at this point. */
+ if (loop->inner)
+ return NULL;
+
+ /* Record entry and latch edges for the loop */
+ entry = loop_preheader_edge (loop);
+
+ /* Note down head of loop as first_head. */
+ first_head = entry->dest;
+
+ /* Duplicate loop. */
+ irred_flag = entry->flags & EDGE_IRREDUCIBLE_LOOP;
+ entry->flags &= ~EDGE_IRREDUCIBLE_LOOP;
+ if (!tree_duplicate_loop_to_header_edge (loop, entry, loops, 1,
+ NULL, NULL, NULL, NULL, 0))
+ {
+ entry->flags |= irred_flag;
+ return NULL;
+ }
+
+ /* After duplication entry edge now points to new loop head block.
+ Note down new head as second_head. */
+ second_head = entry->dest;
+
+ /* Split loop entry edge and insert new block with cond expr. */
+ *condition_bb = lv_adjust_loop_entry_edge (first_head, second_head, entry,
+ cond_expr);
+
+ latch_edge = loop->latch->rbi->copy->succ;
+ nloop = loopify (loops,
+ latch_edge,
+ loop->header->rbi->copy->pred,
+ *condition_bb,
+ false /* Do not redirect all edges. */);
+
+ /* loopify redirected latch_edge. Update its PENDING_STMTS. */
+ lv_update_pending_stmts (latch_edge);
+
+ /* loopify redirected condition_bb's succ edge. Update its PENDING_STMTS. */
+ lv_update_pending_stmts (FALLTHRU_EDGE (*condition_bb));
+
+ /* Adjust irreducible flag. */
+ if (irred_flag)
+ {
+ (*condition_bb)->flags |= BB_IRREDUCIBLE_LOOP;
+ loop_preheader_edge (loop)->flags |= EDGE_IRREDUCIBLE_LOOP;
+ loop_preheader_edge (nloop)->flags |= EDGE_IRREDUCIBLE_LOOP;
+ (*condition_bb)->pred->flags |= EDGE_IRREDUCIBLE_LOOP;
+ }
+
+ /* At this point condition_bb is loop predheader with two successors,
+ first_head and second_head. Make sure that loop predheader has only
+ one successor. */
+ loop_split_edge_with (loop_preheader_edge (loop), NULL);
+ loop_split_edge_with (loop_preheader_edge (nloop), NULL);
+
+ /* Ensure that the latch has just a single successor. */
+ loop_split_edge_with (loop_latch_edge (loop), NULL);
+ loop_split_edge_with (loop_latch_edge (nloop), NULL);
+
+ return nloop;
+}
+
+/* Update loop versioning condition.
+ This is used by other optimizations/transformations to disable
+ one loop version. */
+void
+update_lv_condition (basic_block *bb, tree new_cond)
+{
+ tree stmt;
+ block_stmt_iterator bsi = bsi_last (*bb);
+
+ stmt = bsi_stmt (bsi);
+
+ if (TREE_CODE (stmt) == COND_EXPR)
+ {
+ TREE_OPERAND (stmt, 0) = new_cond;
+ modify_stmt (stmt);
+ }
+ else
+ abort ();
+}
+
+void
+test_loop_versioning (struct loops *loops)
+{
+ struct loop *loop;
+ unsigned i;
+ tree cond_expr;
+
+ for (i = 1; i < loops->num; i = i+ 2)
+ {
+ struct loop *nloop;
+ basic_block condition_bb;
+ loop = loops->parray[i];
+
+ if (!loop)
+ continue;
+
+ cond_expr = build (EQ_EXPR, boolean_type_node,
+ integer_one_node,
+ integer_zero_node);
+
+ nloop = tree_ssa_loop_version (loops, loop, cond_expr, &condition_bb);
+
+ if (nloop)
+ {
+ verify_loop_structure (loops);
+ verify_dominators (CDI_DOMINATORS);
+ verify_ssa ();
+
+ update_lv_condition (&condition_bb, boolean_true_node);
+ }
+ }
+
+}
+
+/* Add exit phis for the USE on EXIT. */
+
+static void
+add_exit_phis_edge (basic_block exit, tree use)
+{
+ tree phi, def_stmt = SSA_NAME_DEF_STMT (use);
+ basic_block def_bb = bb_for_stmt (def_stmt);
+ struct loop *def_loop;
+ edge e;
+
+ /* Check that some of the edges entering the EXIT block exits a loop in
+ that USE is defined. */
+ for (e = exit->pred; e; e = e->pred_next)
+ {
+ def_loop = find_common_loop (def_bb->loop_father, e->src->loop_father);
+ if (!flow_bb_inside_loop_p (def_loop, e->dest))
+ break;
+ }
+
+ if (!e)
+ return;
+
+ phi = create_phi_node (use, exit);
+
+ for (e = exit->pred; e; e = e->pred_next)
+ add_phi_arg (&phi, use, e);
+
+ SSA_NAME_DEF_STMT (use) = def_stmt;
+}
+
+/* Add exit phis for VAR that is used in LIVEIN.
+ Exits of the loops are stored in EXITS. */
+
+static void
+add_exit_phis_var (tree var, bitmap livein, bitmap exits)
+{
+ bitmap def;
+ int index;
+ basic_block def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (var));
+
+ bitmap_clear_bit (livein, def_bb->index);
+
+ def = BITMAP_XMALLOC ();
+ bitmap_set_bit (def, def_bb->index);
+ compute_global_livein (livein, def);
+ BITMAP_XFREE (def);
+
+ EXECUTE_IF_AND_IN_BITMAP (exits, livein, 0, index,
+ add_exit_phis_edge (BASIC_BLOCK (index), var));
+}
+
+/* Add exit phis for the names marked in NAMES_TO_RENAME.
+ Exits of the loops are stored in EXITS. Sets of blocks where the ssa
+ names are used are stored in USE_BLOCKS. SSA_NAMES is the array of ssa
+ names indexed by their versions. */
+
+static void
+add_exit_phis (bitmap names_to_rename, bitmap *use_blocks, bitmap loop_exits,
+ tree *ssa_names)
+{
+ unsigned i;
+
+ EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i,
+ {
+ add_exit_phis_var (ssa_names[i], use_blocks[i], loop_exits);
+ });
+}
+
+/* Returns a bitmap of all loop exit edge targets. */
+
+static bitmap
+get_loops_exits (void)
+{
+ bitmap exits = BITMAP_XMALLOC ();
+ basic_block bb;
+ edge e;
+
+ FOR_EACH_BB (bb)
+ {
+ for (e = bb->pred; e; e = e->pred_next)
+ if (e->src != ENTRY_BLOCK_PTR
+ && !flow_bb_inside_loop_p (e->src->loop_father, bb))
+ {
+ bitmap_set_bit (exits, bb->index);
+ break;
+ }
+ }
+
+ return exits;
+}
+
+/* For USE in BB, if it is used outside of the loop it is defined in,
+ mark it in NAMES_TO_RENAME. Record basic block BB where it is used
+ to USE_BLOCKS, and the ssa name itself to NAMES. */
+
+static void
+find_uses_to_rename_use (basic_block bb, tree use, bitmap names_to_rename,
+ bitmap *use_blocks, tree *names)
+{
+ unsigned ver;
+ basic_block def_bb;
+ struct loop *def_loop;
+
+ if (TREE_CODE (use) != SSA_NAME)
+ return;
+
+ ver = SSA_NAME_VERSION (use);
+ def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (use));
+ if (!def_bb)
+ return;
+ def_loop = def_bb->loop_father;
+
+ /* If the definition is not inside loop, it is not interesting. */
+ if (!def_loop->outer)
+ return;
+
+ names[ver] = use;
+ if (!use_blocks[ver])
+ use_blocks[ver] = BITMAP_XMALLOC ();
+ bitmap_set_bit (use_blocks[ver], bb->index);
+
+ if (!flow_bb_inside_loop_p (def_loop, bb))
+ bitmap_set_bit (names_to_rename, ver);
+}
+
+/* For uses in STMT, mark names that are used outside of the loop they are
+ defined in in NAMES_TO_RENAME. Record the set of blocks in that the ssa
+ names are defined to USE_BLOCKS, and the names themselves to NAMES. */
+
+static void
+find_uses_to_rename_stmt (tree stmt, bitmap names_to_rename,
+ bitmap *use_blocks, tree *names)
+{
+ use_optype uses;
+ vuse_optype vuses;
+ vdef_optype vdefs;
+ stmt_ann_t ann;
+ unsigned i;
+ basic_block bb = bb_for_stmt (stmt);
+
+ get_stmt_operands (stmt);
+ ann = stmt_ann (stmt);
+
+ uses = USE_OPS (ann);
+ for (i = 0; i < NUM_USES (uses); i++)
+ find_uses_to_rename_use (bb, USE_OP (uses, i),
+ names_to_rename, use_blocks, names);
+
+ vuses = VUSE_OPS (ann);
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ find_uses_to_rename_use (bb, VUSE_OP (vuses, i),
+ names_to_rename, use_blocks, names);
+
+ vdefs = VDEF_OPS (ann);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ find_uses_to_rename_use (bb, VDEF_OP (vdefs, i),
+ names_to_rename, use_blocks, names);
+}
+
+/* Marks names that are used outside of the loop they are defined in
+ in NAMES_TO_RENAME. Records the set of blocks in that the ssa
+ names are defined to USE_BLOCKS, and the names themselves to NAMES. */
+
+static void
+find_uses_to_rename (bitmap names_to_rename, bitmap *use_blocks, tree *names)
+{
+ basic_block bb;
+ block_stmt_iterator bsi;
+ tree phi;
+ unsigned i;
+
+ FOR_EACH_BB (bb)
+ {
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
+ find_uses_to_rename_use (PHI_ARG_EDGE (phi, i)->src,
+ PHI_ARG_DEF (phi, i),
+ names_to_rename, use_blocks, names);
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ find_uses_to_rename_stmt (bsi_stmt (bsi),
+ names_to_rename, use_blocks, names);
+ }
+}
+
+/* Rewrites the program into a loop closed ssa form -- i.e. inserts extra
+ phi nodes to ensure that no variable is used outside the loop it is
+ defined in.
+
+ This strenghtening of the basic ssa form has several advantages:
+
+ 1) Updating it during unrolling/peeling/versioning is trivial, since
+ we do not need to care about the uses outside of the loop.
+ 2) The behavior of all uses of an induction variable is the same.
+ Without this, you need to distinguish the case when the variable
+ is used outside of the loop it is defined in, for example
+
+ for (i = 0; i < 100; i++)
+ {
+ for (j = 0; j < 100; j++)
+ {
+ k = i + j;
+ use1 (k);
+ }
+ use2 (k);
+ }
+
+ Looking from the outer loop with the normal SSA form, the first use of k
+ is not well-behaved, while the second one is an induction variable with
+ base 99 and step 1. */
+
+void
+rewrite_into_loop_closed_ssa (void)
+{
+ bitmap names_to_rename = BITMAP_XMALLOC ();
+ bitmap loop_exits = get_loops_exits ();
+ bitmap *use_blocks;
+ tree *ssa_names;
+ unsigned i;
+
+ tree_ssa_dce_no_cfg_changes ();
+
+ use_blocks = xcalloc (highest_ssa_version, sizeof (bitmap));
+ ssa_names = xcalloc (highest_ssa_version, sizeof (tree));
+
+ /* Find the uses outside loops. */
+ find_uses_to_rename (names_to_rename, use_blocks, ssa_names);
+
+ /* Add the phi nodes on exits of the loops for the names we need to
+ rewrite. */
+ add_exit_phis (names_to_rename, use_blocks, loop_exits, ssa_names);
+
+ for (i = 0; i < highest_ssa_version; i++)
+ BITMAP_XFREE (use_blocks[i]);
+ free (use_blocks);
+ free (ssa_names);
+ BITMAP_XFREE (loop_exits);
+
+ /* Do the rewriting. */
+ rewrite_ssa_into_ssa (names_to_rename);
+ BITMAP_XFREE (names_to_rename);
+ BITMAP_XFREE (loop_exits);
+}
+
+/* Check invariants of the loop closed ssa form for the USE in BB. */
+
+static void
+check_loop_closed_ssa_use (basic_block bb, tree use)
+{
+ tree def;
+ basic_block def_bb;
+
+ if (TREE_CODE (use) != SSA_NAME)
+ return;
+
+ def = SSA_NAME_DEF_STMT (use);
+ def_bb = bb_for_stmt (def);
+ if (def_bb
+ && !flow_bb_inside_loop_p (def_bb->loop_father, bb))
+ abort ();
+}
+
+/* Checks invariants of loop closed ssa form in statement STMT in BB. */
+
+static void
+check_loop_closed_ssa_stmt (basic_block bb, tree stmt)
+{
+ use_optype uses;
+ vuse_optype vuses;
+ vdef_optype vdefs;
+ stmt_ann_t ann;
+ unsigned i;
+
+ get_stmt_operands (stmt);
+ ann = stmt_ann (stmt);
+
+ uses = USE_OPS (ann);
+ for (i = 0; i < NUM_USES (uses); i++)
+ check_loop_closed_ssa_use (bb, USE_OP (uses, i));
+
+ vuses = VUSE_OPS (ann);
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ check_loop_closed_ssa_use (bb, VUSE_OP (vuses, i));
+
+ vdefs = VDEF_OPS (ann);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ check_loop_closed_ssa_use (bb, VDEF_OP (vdefs, i));
+}
+
+/* Checks that invariants of the loop closed ssa form are preserved. */
+
+void
+verify_loop_closed_ssa (void)
+{
+ basic_block bb;
+ block_stmt_iterator bsi;
+ tree phi;
+ unsigned i;
+
+ verify_ssa ();
+
+ FOR_EACH_BB (bb)
+ {
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
+ check_loop_closed_ssa_use (PHI_ARG_EDGE (phi, i)->src,
+ PHI_ARG_DEF (phi, i));
+
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ check_loop_closed_ssa_stmt (bb, bsi_stmt (bsi));
+ }
+}
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
new file mode 100644
index 00000000000..ab8c4e0bab7
--- /dev/null
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -0,0 +1,283 @@
+/* Loop unswitching.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "output.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "domwalk.h"
+#include "params.h"
+#include "tree-pass.h"
+
+/* This file implements the loop unswitching, i.e. transformation of loops like
+
+ while (A)
+ {
+ if (inv)
+ B;
+
+ X;
+
+ if (!inv)
+ C;
+ }
+
+ where inv is the loop invariant, into
+
+ if (inv)
+ {
+ while (A)
+ {
+ B;
+ X;
+ }
+ }
+ else
+ {
+ while (A)
+ {
+ X;
+ C;
+ }
+ }
+
+ Inv is considered invariant iff the values it compares are both invariant;
+ tree-ssa-loop-im.c ensures that all the suitable conditions are in this
+ shape. */
+
+static struct loop *tree_unswitch_loop (struct loops *, struct loop *, basic_block,
+ tree);
+static void tree_unswitch_single_loop (struct loops *, struct loop *, int);
+static tree tree_may_unswitch_on (basic_block, struct loop *);
+
+/* Main entry point. Perform loop unswitching on all suitable LOOPS. */
+
+void
+tree_ssa_unswitch_loops (struct loops *loops)
+{
+ int i, num;
+ struct loop *loop;
+
+ /* Go through inner loops (only original ones). */
+ num = loops->num;
+
+ for (i = 1; i < num; i++)
+ {
+ /* Removed loop? */
+ loop = loops->parray[i];
+ if (!loop)
+ continue;
+
+ if (loop->inner)
+ continue;
+
+ tree_unswitch_single_loop (loops, loop, 0);
+#ifdef ENABLE_CHECKING
+ verify_dominators (CDI_DOMINATORS);
+ verify_loop_structure (loops);
+#endif
+ }
+}
+
+/* Checks whether we can unswitch LOOP on condition at end of BB -- one of its
+ basic blocks (for what it means see comments below). */
+
+static tree
+tree_may_unswitch_on (basic_block bb, struct loop *loop)
+{
+ tree stmt, def, cond;
+ basic_block def_bb;
+ use_optype uses;
+ unsigned i;
+
+ /* BB must end in a simple conditional jump. */
+ stmt = last_stmt (bb);
+ if (!stmt || TREE_CODE (stmt) != COND_EXPR)
+ return NULL_TREE;
+
+ /* Condition must be invariant. */
+ get_stmt_operands (stmt);
+ uses = STMT_USE_OPS (stmt);
+ for (i = 0; i < NUM_USES (uses); i++)
+ {
+ def = SSA_NAME_DEF_STMT (USE_OP (uses, i));
+ def_bb = bb_for_stmt (def);
+ if (def_bb
+ && flow_bb_inside_loop_p (loop, def_bb))
+ return NULL_TREE;
+ }
+
+ cond = COND_EXPR_COND (stmt);
+ /* To keep the things simple, we do not directly remove the conditions,
+ but just replace tests with 0/1. Prevent the infinite loop where we
+ would unswitch again on such a condition. */
+ if (integer_zerop (cond) || integer_nonzerop (cond))
+ return NULL_TREE;
+
+ return cond;
+}
+
+/* Simplifies COND using checks in front of the entry of the LOOP. Just very
+ simplish (sufficient to prevent us from duplicating loop in unswitching
+ unneccesarily). */
+
+static tree
+simplify_using_entry_checks (struct loop *loop, tree cond)
+{
+ edge e = loop_preheader_edge (loop);
+ tree stmt;
+
+ while (1)
+ {
+ stmt = last_stmt (e->src);
+ if (stmt
+ && TREE_CODE (stmt) == COND_EXPR
+ && operand_equal_p (COND_EXPR_COND (stmt), cond, 0))
+ return (e->flags & EDGE_TRUE_VALUE
+ ? boolean_true_node
+ : boolean_false_node);
+
+ if (e->src->pred->pred_next)
+ return cond;
+
+ e = e->src->pred;
+ if (e->src == ENTRY_BLOCK_PTR)
+ return cond;
+ }
+}
+
+/* Unswitch single LOOP. NUM is number of unswitchings done; we do not allow
+ it to grow too much, it is too easy to create example on that the code would
+ grow exponentially. */
+
+static void
+tree_unswitch_single_loop (struct loops *loops, struct loop *loop, int num)
+{
+ basic_block *bbs;
+ struct loop *nloop;
+ unsigned i;
+ tree cond = NULL_TREE, stmt;
+
+ /* Do not unswitch too much. */
+ if (num > PARAM_VALUE (PARAM_MAX_UNSWITCH_LEVEL))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
+ return;
+ }
+
+ /* Only unswitch innermost loops. */
+ if (loop->inner)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Not unswitching, not innermost loop\n");
+ return;
+ }
+
+ /* The loop should not be too large, to limit code growth. */
+ if (estimate_loop_size (loop)
+ > (unsigned) PARAM_VALUE (PARAM_MAX_UNSWITCH_INSNS))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Not unswitching, loop too big\n");
+ return;
+ }
+
+ i = 0;
+ bbs = get_loop_body (loop);
+
+ while (1)
+ {
+ /* Find a bb to unswitch on. */
+ for (; i < loop->num_nodes; i++)
+ if ((cond = tree_may_unswitch_on (bbs[i], loop)))
+ break;
+
+ if (i == loop->num_nodes)
+ {
+ free (bbs);
+ return;
+ }
+
+ cond = simplify_using_entry_checks (loop, cond);
+ stmt = last_stmt (bbs[i]);
+ if (integer_nonzerop (cond))
+ {
+ /* Remove false path. */
+ COND_EXPR_COND (stmt) = boolean_true_node;
+ }
+ else if (integer_zerop (cond))
+ {
+ /* Remove true path. */
+ COND_EXPR_COND (stmt) = boolean_false_node;
+ }
+ else
+ break;
+
+ modify_stmt (stmt);
+ i++;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Unswitching loop\n");
+
+ /* Unswitch the loop on this condition. */
+ nloop = tree_unswitch_loop (loops, loop, bbs[i], cond);
+ if (!nloop)
+ return;
+
+ /* Invoke itself on modified loops. */
+ tree_unswitch_single_loop (loops, nloop, num + 1);
+ tree_unswitch_single_loop (loops, loop, num + 1);
+}
+
+/* Unswitch a LOOP w.r. to given basic block UNSWITCH_ON. We only support
+ unswitching of innermost loops. COND is the condition determining which
+ loop is entered -- the new loop is entered if COND is true. Returns NULL
+ if impossible, new loop otherwise. */
+
+static struct loop *
+tree_unswitch_loop (struct loops *loops, struct loop *loop,
+ basic_block unswitch_on, tree cond)
+{
+ basic_block condition_bb;
+ /* Some sanity checking. */
+ if (!flow_bb_inside_loop_p (loop, unswitch_on))
+ abort ();
+ if (!unswitch_on->succ || !unswitch_on->succ->succ_next ||
+ unswitch_on->succ->succ_next->succ_next)
+ abort ();
+ if (loop->inner)
+ abort ();
+
+ return tree_ssa_loop_version (loops, loop, unshare_expr (cond),
+ &condition_bb);
+}
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 7a1a6b8548f..c9c86890032 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -29,15 +29,46 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "basic-block.h"
#include "output.h"
#include "diagnostic.h"
-#include "basic-block.h"
#include "tree-flow.h"
#include "tree-dump.h"
#include "tree-pass.h"
#include "timevar.h"
#include "cfgloop.h"
+#include "tree-inline.h"
#include "flags.h"
#include "tree-inline.h"
+/* Initializes the loop structures. DUMP is the file to that the details
+ about the analysis should be dumped. If CANONICALIZE_SSA is true, loop
+ closed ssa form is enforced and redundant phi nodes created by creating
+ preheaders are cleaned up. */
+
+struct loops *
+tree_loop_optimizer_init (FILE *dump, bool canonicalize_ssa)
+{
+ struct loops *loops = loop_optimizer_init (dump);
+
+ if (!loops)
+ return NULL;
+
+ if (!canonicalize_ssa)
+ return loops;
+
+ /* Creation of preheaders may create redundant phi nodes (if the loop is
+ entered by more than one edge, but the initial value of the induction
+ variable is the same on all of them). */
+ kill_redundant_phi_nodes ();
+ rewrite_into_ssa (false);
+ bitmap_clear (vars_to_rename);
+
+ rewrite_into_loop_closed_ssa ();
+
+#ifdef ENABLE_CHECKING
+ verify_loop_closed_ssa ();
+#endif
+
+ return loops;
+}
/* The main entry into loop optimization pass. PHASE indicates which dump file
from the DUMP_FILES array to use when dumping debugging information.
@@ -48,13 +79,34 @@ tree_ssa_loop_opt (void)
{
struct loops *loops;
- /* Does nothing for now except for checking that we are able to build the
- loops. */
+ loops = tree_loop_optimizer_init (dump_file, true);
+
+ if (loops)
+ {
+#if 0
+ /* Test unrolling and peeling. */
+ test_unrolling_and_peeling (loops);
+#endif
+
+#if 0
+ test_loop_versioning (loops);
+#endif
+
+ /* Move the expensive loop invariants. */
+ tree_ssa_lim (loops);
- loops = loop_optimizer_init (dump_file);
- loop_optimizer_finalize (loops,
- (dump_flags & TDF_DETAILS
- ? dump_file : NULL));
+ /* Unswitch the loops. */
+ if (flag_unswitch_loops)
+ tree_ssa_unswitch_loops (loops);
+
+ /* Optimize the induction variables. */
+ tree_ssa_iv_optimize (loops);
+
+ loop_optimizer_finalize (loops,
+ (dump_flags & TDF_DETAILS ? dump_file : NULL));
+
+ cleanup_tree_cfg ();
+ }
}
static bool
@@ -75,8 +127,8 @@ struct tree_opt_pass pass_loop =
PROP_cfg, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_dump_func | TODO_verify_ssa /* todo_flags_finish */
+ TODO_ggc_collect, /* todo_flags_start */
+ TODO_dump_func | TODO_verify_ssa | TODO_ggc_collect /* todo_flags_finish */
};
/* Check whether we should duplicate HEADER of LOOP. At most *LIMIT
@@ -299,15 +351,13 @@ copy_loop_headers (void)
edge preheader_edge;
varray_type bbs_to_duplicate = NULL;
- loops = loop_optimizer_init (dump_file);
+ loops = tree_loop_optimizer_init (dump_file, false);
if (!loops)
return;
/* We are not going to need or update dominators. */
free_dominance_info (CDI_DOMINATORS);
- create_preheaders (loops, CP_SIMPLE_PREHEADERS);
-
/* We do not try to keep the information about irreductible regions
up-to-date. */
loops->state &= ~LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS;
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 43c40b62107..a5dcfa059c8 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1133,6 +1133,8 @@ add_stmt_operand (tree *var_p, tree stmt, int flags, voperands_t prev_vops)
var_ann_t v_ann;
var = *var_p;
+ if (!var)
+ return;
STRIP_NOPS (var);
s_ann = stmt_ann (stmt);
@@ -1332,4 +1334,33 @@ add_call_read_ops (tree stmt, voperands_t prev_vops)
}
}
+/* Copies virtual operands from SRC to DST. */
+
+void
+copy_virtual_operands (tree dst, tree src)
+{
+ vuse_optype vuses = STMT_VUSE_OPS (src);
+ vdef_optype vdefs = STMT_VDEF_OPS (src);
+ vuse_optype *vuses_new = &stmt_ann (dst)->vuse_ops;
+ vdef_optype *vdefs_new = &stmt_ann (dst)->vdef_ops;
+ unsigned i;
+
+ if (vuses)
+ {
+ *vuses_new = allocate_vuse_optype (NUM_VUSES (vuses));
+ for (i = 0; i < NUM_VUSES (vuses); i++)
+ *VUSE_OP_PTR (*vuses_new, i) = VUSE_OP (vuses, i);
+ }
+
+ if (vdefs)
+ {
+ *vdefs_new = allocate_vdef_optype (NUM_VDEFS (vdefs));
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ {
+ *VDEF_OP_PTR (*vdefs_new, i) = VDEF_OP (vdefs, i);
+ *VDEF_RESULT_PTR (*vdefs_new, i) = VDEF_RESULT (vdefs, i);
+ }
+ }
+}
+
#include "gt-tree-ssa-operands.h"
diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h
index ceee6d037ab..675c41db07f 100644
--- a/gcc/tree-ssa-operands.h
+++ b/gcc/tree-ssa-operands.h
@@ -93,5 +93,6 @@ void add_vuse (tree, tree);
extern void get_stmt_operands (tree);
extern void remove_vuses (tree);
extern void remove_vdefs (tree);
+extern void copy_virtual_operands (tree, tree);
#endif /* GCC_TREE_SSA_OPERANDS_H */
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 9bcb7144a50..0b329ea038d 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "errors.h"
#include "ggc.h"
#include "tree.h"
+#include "flags.h"
#include "rtl.h"
#include "tm_p.h"
#include "basic-block.h"
@@ -38,7 +39,22 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static void tree_ssa_phiopt (void);
static bool conditional_replacement (basic_block bb, tree phi, tree arg0,
tree arg1);
+static bool absolute_replacement (basic_block bb, tree phi, tree arg0,
+ tree arg1);
+static bool value_replacement (basic_block bb, tree phi, tree arg0,
+ tree arg1);
+
+
+/* Build a temporary. Make sure and register it to be renamed. */
+static tree
+make_temp (tree type)
+{
+ tree t = create_tmp_var (type, NULL);
+ add_referenced_tmp_var (t);
+ bitmap_set_bit (vars_to_rename, var_ann (t)->uid);
+ return t;
+}
/* This pass eliminates PHI nodes which can be trivially implemented as
an assignment from a conditional expression. ie if we have something
@@ -59,7 +75,48 @@ static bool conditional_replacement (basic_block bb, tree phi, tree arg0,
bb1 will become unreachable and bb0 and bb2 will almost always
be merged into a single block. This occurs often due to gimplification
- of conditionals. */
+ of conditionals.
+
+ Also this pass eliminates PHI nodes which are really absolute values. ie
+ if we have something like:
+
+ bb0:
+ if (a >= 0) goto bb2; else goto bb1;
+ bb1:
+ x = -a;
+ bb2:
+ x = PHI (x (bb1), a (bb0));
+
+ We can rewrite that as:
+
+ bb0:
+ bb1:
+ bb2:
+ x = ABS_EXPR< a >;
+
+ bb1 will become unreachable and bb0 and bb2 will almost always be merged
+ into a single block. This occurs because fold never had dected then in
+ the first place, note this these are all done already by the ifcvt
+ optimization on the RTL level.
+
+ Also done is the following optimization:
+
+ bb0:
+ if (a != b) goto bb2; else goto bb1;
+ bb1:
+ bb2:
+ x = PHI (a (bb1), b (bb0))
+
+ We can rewrite that as:
+
+ bb0:
+ bb1:
+ bb2:
+ x = b;
+
+ This occurs when people are doing error checking or when optimizers
+ are doing its job. Note this is also done already by ifcvt optimizer
+ on the RTL level. */
static void
tree_ssa_phiopt (void)
@@ -86,10 +143,29 @@ tree_ssa_phiopt (void)
/* Do the replacement of conditional if it can be done. */
if (conditional_replacement (bb, phi, arg0, arg1))
{
- /* We have done the replacement so we need to rebuild the cfg. */
+ /* We have done the replacement so we need to rebuild the
+ cfg and cannot do any more. */
removed_phis = true;
continue;
}
+
+ /* Do the replacement for absolute if it can be done. */
+ if (absolute_replacement (bb, phi, arg0, arg1))
+ {
+ /* We have done the replacement so we need to rebuild the
+ cfg and cannot do any more. */
+ removed_phis = true;
+ continue;
+ }
+
+ /* Do the replacement for value if it can be done. */
+ if (value_replacement (bb, phi, arg0, arg1))
+ {
+ /* We have done the replacement so we need to rebuild the
+ cfg and cannot do any more. */
+ removed_phis = true;
+ continue;
+ }
}
}
@@ -108,11 +184,13 @@ static bool
conditional_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
{
tree result;
+ tree old_result = NULL;
basic_block other_block = NULL;
basic_block cond_block = NULL;
tree last0, last1, new, cond;
block_stmt_iterator bsi;
edge true_edge, false_edge;
+ tree new_var = NULL;
/* The PHI arguments have the constants 0 and 1, then convert
it to the conditional. */
@@ -174,22 +252,46 @@ conditional_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
/* If the condition is not a naked SSA_NAME and its type does not
match the type of the result, then we can not optimize this case
as it would likely create non-gimple code when the condition
- was converted to the result's type. */
+ so we create a new variable for it. */
cond = COND_EXPR_COND (last_stmt (cond_block));
result = PHI_RESULT (phi);
if (TREE_CODE (cond) != SSA_NAME
- && !lang_hooks.types_compatible_p (TREE_TYPE (cond), TREE_TYPE (result)))
- return false;
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (cond))
+ != TYPE_MAIN_VARIANT (TREE_TYPE (result))))
+ {
+ /* FIXME: disabled for now as the check for non-gimple is too
+ weak and will not find some cases. */
+ return false;
+#if 0
+ new_var = make_temp (TREE_TYPE (cond));
+ old_result = cond;
+ cond = new_var;
+#endif
+ }
/* If the condition was a naked SSA_NAME and the type is not the
same as the type of the result, then convert the type of the
condition. */
- if (!lang_hooks.types_compatible_p (TREE_TYPE (cond), TREE_TYPE (result)))
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (cond))
+ != TYPE_MAIN_VARIANT (TREE_TYPE (result)))
cond = convert (TREE_TYPE (result), cond);
/* We need to know which is the true edge and which is the false
edge so that we know when to invert the condition below. */
extract_true_false_edges_from_block (cond_block, &true_edge, &false_edge);
+
+ /* Insert our new statement at the head of our block. */
+ bsi = bsi_start (bb);
+
+ if (old_result)
+ {
+ tree new1;
+ new1 = convert (TREE_TYPE (result), old_result);
+ new1 = build (MODIFY_EXPR, TREE_TYPE (result),
+ new_var, new1);
+ bsi_insert_after (&bsi, new1, BSI_NEW_STMT);
+ }
+
/* At this point we know we have a COND_EXPR with two successors.
One successor is BB, the other successor is an empty block which
@@ -208,6 +310,7 @@ conditional_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
false edge as the value zero. Note that those conditions are not
the same since only one of the outgoing edges from the COND_EXPR
will directly reach BB and thus be associated with an argument. */
+
if ((PHI_ARG_EDGE (phi, 0) == true_edge && integer_onep (arg0))
|| (PHI_ARG_EDGE (phi, 0) == false_edge && integer_zerop (arg0))
|| (PHI_ARG_EDGE (phi, 1) == true_edge && integer_onep (arg1))
@@ -218,19 +321,31 @@ conditional_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
}
else
{
- cond = invert_truthvalue (cond);
-
+ tree cond1 = invert_truthvalue (cond);
+
+ cond = cond1;
+
+ /* If what we get back is not gimple try to create it as gimple by
+ using a temporary variable. */
if (is_gimple_cast (cond)
&& !is_gimple_val (TREE_OPERAND (cond, 0)))
- return false;
+ {
+ return false;
+ /* FIXME: disabled for now as it causes a bootstrap failure. */
+#if 0
+ tree temp = TREE_OPERAND (cond, 0);
+ tree new_var_1 = make_temp (TREE_TYPE (temp));
+ new = build (MODIFY_EXPR, TREE_TYPE (new_var_1), new_var_1, temp);
+ bsi_insert_after (&bsi, new, BSI_NEW_STMT);
+ cond = convert (TREE_TYPE (result), new_var_1);
+#endif
+ }
new = build (MODIFY_EXPR, TREE_TYPE (PHI_RESULT (phi)),
PHI_RESULT (phi), cond);
}
- /* Insert our new statement at the head of our block. */
- bsi = bsi_start (bb);
- bsi_insert_after (&bsi, new, BSI_SAME_STMT);
+ bsi_insert_after (&bsi, new, BSI_NEW_STMT);
/* Register our new statement as the defining statement for
the result. */
@@ -274,6 +389,495 @@ conditional_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
}
+/* The function absolute_replacement does the main work of doing the absolute
+ replacement. Return true if the replacement is done. Otherwise return false.
+ bb is the basic block where the replacement is going to be done on. arg0
+ is argument 0 from the phi. Likewise for arg1. */
+static bool
+absolute_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
+{
+ tree result;
+ basic_block other_block = NULL;
+ basic_block cond_block = NULL;
+ tree last0, last1, new, cond;
+ block_stmt_iterator bsi;
+ edge true_edge, false_edge;
+ tree asign = NULL;
+ bool arg0_neg = false;
+ bool isAbs = true;
+ tree variable;
+
+
+ /* One of the alternatives must come from a block ending with
+ a COND_EXPR. The other block must be only a statement with
+ an assignment of a variable of -arg0 or -arg1. */
+ last0 = last_stmt (bb->pred->src);
+ last1 = last_stmt (bb->pred->pred_next->src);
+
+ if (last0 && TREE_CODE (last0) == COND_EXPR)
+ {
+ cond_block = bb->pred->src;
+ other_block = bb->pred->pred_next->src;
+ }
+ if (last0 && TREE_CODE (last0) == COND_EXPR)
+ {
+ cond_block = bb->pred->src;
+ other_block = bb->pred->pred_next->src;
+ }
+ else if (last1 && TREE_CODE (last1) == COND_EXPR)
+ {
+ other_block = bb->pred->src;
+ cond_block = bb->pred->pred_next->src;
+ }
+ else
+ return false;
+
+ /* COND_BLOCK must have precisely two successors. We indirectly
+ verify that those successors are BB and OTHER_BLOCK. */
+ if (!cond_block->succ
+ || !cond_block->succ->succ_next
+ || cond_block->succ->succ_next->succ_next
+ || (cond_block->succ->flags & EDGE_ABNORMAL) != 0
+ || (cond_block->succ->succ_next->flags & EDGE_ABNORMAL) != 0)
+ return false;
+
+ /* OTHER_BLOCK must have a single predecessor which is COND_BLOCK,
+ OTHER_BLOCK must have a single successor which is BB and
+ OTHER_BLOCK must have no PHI nodes. */
+ if (!other_block->pred
+ || other_block->pred->src != cond_block
+ || other_block->pred->pred_next
+ || !other_block->succ
+ || other_block->succ->dest != bb
+ || other_block->succ->succ_next
+ || phi_nodes (other_block))
+ return false;
+
+ /* OTHER_BLOCK must have one executable statement, the assignment. */
+ bsi = bsi_start (other_block);
+ while (!bsi_end_p (bsi))
+ {
+ tree stmt = bsi_stmt (bsi);
+ if (TREE_CODE (stmt) == LABEL_EXPR
+ || IS_EMPTY_STMT (stmt))
+ {
+ bsi_next (&bsi);
+ continue;
+ }
+ /* Is this the assignment */
+ if (TREE_CODE (stmt) == MODIFY_EXPR)
+ {
+ tree stmt_arg0 = TREE_OPERAND (stmt, 0);
+ tree stmt_arg1 = TREE_OPERAND (stmt, 1);
+ if (TREE_CODE (stmt_arg1) == NEGATE_EXPR)
+ {
+ stmt_arg1 = TREE_OPERAND (stmt_arg1, 0);
+ /* The assignment has to be arg0 = arg1 or arg1 = arg0. */
+ /* FIXME: Handle more complex cases like arg1 = a-b and before
+ the conditional arg0 = b-a; */
+ if (stmt_arg0 == arg0 && stmt_arg1 == arg1)
+ {
+ asign = stmt;
+ arg0_neg = false;
+ break;
+ }
+ if (stmt_arg0 == arg1 && stmt_arg1 == arg0)
+ {
+ asign = stmt;
+ arg0_neg = true;
+ break;
+ }
+ }
+ }
+ return false;
+ }
+
+ /* We did not find an assignment so we cannot do the replacement. */
+ if (asign == NULL)
+ return false;
+
+
+ /* The rest of the OTHER_BLOCK should be empty. */
+ bsi_next (&bsi);
+ while (!bsi_end_p (bsi)
+ && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
+ || IS_EMPTY_STMT (bsi_stmt (bsi))))
+ bsi_next (&bsi);
+
+ /* There was some other expression in the basic block
+ so this optimization cannot be done. */
+ if (!bsi_end_p (bsi))
+ return false;
+
+ cond = COND_EXPR_COND (last_stmt (cond_block));
+ result = PHI_RESULT (phi);
+
+ /* We need to know which is the true edge and which is the false
+ edge so that we know if have abs or negative abs. */
+ extract_true_false_edges_from_block (cond_block, &true_edge, &false_edge);
+
+ /* Only less than, greater than, and those with "and equal" to them
+ are the ones which are needed for abs/nabs. */
+ switch (TREE_CODE (cond))
+ {
+ case LT_EXPR:
+ case LE_EXPR:
+ {
+ if (arg0_neg)
+ {
+ /* FIXME: Handle all these cases. */
+ if (PHI_ARG_EDGE (phi, 0) == true_edge)
+ return false;
+
+ /* This is the case where arg0 is the variable
+ which is negatived and is the variable on
+ the false edge so it can be converted into
+ an nabs. */
+ else if (PHI_ARG_EDGE (phi, 0) == false_edge)
+ {
+ isAbs = true;
+ }
+ else if (PHI_ARG_EDGE (phi, 1) == false_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 1) == true_edge)
+ return false;
+ }
+ else
+ {
+ /* FIXME: Handle all these cases. */
+ if (PHI_ARG_EDGE (phi, 0) == true_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 0) == false_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 1) == false_edge)
+ return false;
+
+ /* This is the case where arg1 is the variable
+ which is negatived and is the variable on
+ the true edge so it can be converted into
+ an nabs. */
+ else if (PHI_ARG_EDGE (phi, 1) == true_edge)
+ {
+ isAbs = false;
+ }
+ }
+ break;
+ }
+ case GT_EXPR:
+ case GE_EXPR:
+ {
+ if (arg0_neg)
+ {
+ /* FIXME: Handle all these cases. */
+ if (PHI_ARG_EDGE (phi, 0) == true_edge)
+ return false;
+
+ /* This is the case where arg0 is the variable
+ which is negatived and is the variable on
+ the false edge so it can be converted into
+ an nabs. */
+ else if (PHI_ARG_EDGE (phi, 0) == false_edge)
+ {
+ isAbs = false;
+ }
+ else if (PHI_ARG_EDGE (phi, 1) == false_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 1) == true_edge)
+ return false;
+ }
+ else
+ {
+ /* FIXME: Handle all these cases. */
+ if (PHI_ARG_EDGE (phi, 0) == true_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 0) == false_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 1) == false_edge)
+ return false;
+
+ /* This is the case where arg1 is the variable
+ which is negatived and is the variable on
+ the true edge so it can be converted into
+ an abs. */
+ else if (PHI_ARG_EDGE (phi, 1) == true_edge)
+ {
+ isAbs = true;
+ }
+ }
+ break;
+ }
+ default:
+ return false;
+ }
+
+
+ /* Make sure the conditional is arg[01] OP y. */
+
+ if (TREE_OPERAND (cond, 0) != (arg0_neg ? arg0 : arg1))
+ return false;
+
+ /* If the type says honor signed zeros we cannot do this
+ optimization. */
+ if (HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg1))))
+ return false;
+
+ /* Make sure that the arg[01] is comparing against 0. */
+ if (FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (cond, 1)))
+ ? real_zerop (TREE_OPERAND (cond, 1))
+ : integer_zerop (TREE_OPERAND (cond, 1)))
+ ;
+ else
+ return false;
+
+
+
+ result = PHI_RESULT (phi);
+ /* Make a new variable to hold the abs if need be. */
+ if (!isAbs)
+ variable = make_temp (TREE_TYPE (result));
+ else
+ variable = result;
+
+
+ /* Build the modify expression with abs expression. */
+ new = build (MODIFY_EXPR, TREE_TYPE (variable),
+ variable, build1 (ABS_EXPR, TREE_TYPE (variable),
+ arg0_neg ? arg0 : arg1));
+
+ /* Insert our new statement at the head of our block. */
+ bsi = bsi_start (bb);
+ bsi_insert_after (&bsi, new, BSI_NEW_STMT);
+
+ if (!isAbs)
+ {
+ new = build (MODIFY_EXPR, TREE_TYPE (result),
+ result, build1 (NEGATE_EXPR, TREE_TYPE (variable),
+ variable));
+
+ bsi_insert_after (&bsi, new, BSI_NEW_STMT);
+ }
+
+ /* Register our new statement as the defining statement for
+ the result. */
+ SSA_NAME_DEF_STMT (result) = new;
+
+ /* Remove the now useless PHI node.
+
+ We do not want to use remove_phi_node since that releases the
+ SSA_NAME as well and the SSA_NAME is still being used. */
+ release_phi_node (phi);
+ bb_ann (bb)->phi_nodes = NULL;
+
+
+ /* Disconnect the edge leading into the empty block. That will
+ make the empty block unreachable and it will be removed later. */
+ if (cond_block->succ->dest == bb)
+ {
+ cond_block->succ->flags |= EDGE_FALLTHRU;
+ cond_block->succ->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+ ssa_remove_edge (cond_block->succ->succ_next);
+ }
+ else
+ {
+ cond_block->succ->succ_next->flags |= EDGE_FALLTHRU;
+ cond_block->succ->succ_next->flags
+ &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+ ssa_remove_edge (cond_block->succ);
+ }
+
+ /* Eliminate the COND_EXPR at the end of COND_BLOCK. */
+ bsi = bsi_last (cond_block);
+ bsi_remove (&bsi);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "COND_EXPR in block %d and PHI in block %d converted to straightline code (using ABS).\n",
+ cond_block->index,
+ bb->index);
+
+ /* Note that we optimized this PHI. */
+ return true;
+}
+
+/* The function value_replacement does the main work of doing the value
+ replacement. Return true if the replacement is done. Otherwise return false.
+ bb is the basic block where the replacement is going to be done on. arg0
+ is argument 0 from the phi. Likewise for arg1. */
+
+static bool
+value_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
+{
+ tree result;
+ basic_block other_block = NULL;
+ basic_block cond_block = NULL;
+ tree last0, last1, new, cond;
+ block_stmt_iterator bsi;
+ edge true_edge, false_edge;
+ bool use_arg0;
+
+
+ /* One of the alternatives must come from a block ending with
+ a COND_EXPR. The other block must be entirely empty, except
+ for labels. */
+ last0 = last_stmt (bb->pred->src);
+ last1 = last_stmt (bb->pred->pred_next->src);
+ if (last0 && TREE_CODE (last0) == COND_EXPR)
+ {
+ cond_block = bb->pred->src;
+ other_block = bb->pred->pred_next->src;
+ }
+ else if (last1 && TREE_CODE (last1) == COND_EXPR)
+ {
+ other_block = bb->pred->src;
+ cond_block = bb->pred->pred_next->src;
+ }
+ else
+ return false;
+
+ /* COND_BLOCK must have precisely two successors. We indirectly
+ verify that those successors are BB and OTHER_BLOCK. */
+ if (!cond_block->succ
+ || !cond_block->succ->succ_next
+ || cond_block->succ->succ_next->succ_next
+ || (cond_block->succ->flags & EDGE_ABNORMAL) != 0
+ || (cond_block->succ->succ_next->flags & EDGE_ABNORMAL) != 0)
+ return false;
+
+
+ /* OTHER_BLOCK must have a single predecessor which is COND_BLOCK,
+ OTHER_BLOCK must have a single successor which is BB and
+ OTHER_BLOCK must have no PHI nodes. */
+ if (!other_block->pred
+ || other_block->pred->src != cond_block
+ || other_block->pred->pred_next
+ || !other_block->succ
+ || other_block->succ->dest != bb
+ || other_block->succ->succ_next
+ || phi_nodes (other_block))
+ return false;
+
+ /* OTHER_BLOCK must have no executable statements. */
+ bsi = bsi_start (other_block);
+ while (!bsi_end_p (bsi)
+ && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
+ || IS_EMPTY_STMT (bsi_stmt (bsi))))
+ bsi_next (&bsi);
+
+ if (!bsi_end_p (bsi))
+ return false;
+
+ cond = COND_EXPR_COND (last_stmt (cond_block));
+ result = PHI_RESULT (phi);
+
+ /* We need to know which is the true edge and which is the false
+ edge so that we know if have abs or negative abs. */
+ extract_true_false_edges_from_block (cond_block, &true_edge, &false_edge);
+
+ /* For this optimization to happen, the condition has to be
+ either equal or not equal. */
+ switch (TREE_CODE (cond))
+ {
+ case EQ_EXPR:
+ /* TODO: handle this case. */
+ /* This one is not that important as it is already handled by
+ DOM. */
+ return false;
+
+ case NE_EXPR:
+ /* FIXME: Handle all these cases. */
+ if (PHI_ARG_EDGE (phi, 0) == true_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 0) == false_edge)
+ {
+ use_arg0 = false;
+ }
+ else if (PHI_ARG_EDGE (phi, 1) == false_edge)
+ return false;
+ else if (PHI_ARG_EDGE (phi, 1) == true_edge)
+ return false;
+
+ break;
+
+ default:
+ return false;
+ }
+
+ if (operand_equal_p (TREE_OPERAND (cond, 0), arg0, 0)
+ && operand_equal_p (TREE_OPERAND (cond, 1), arg1, 0))
+ {
+ return false;
+ /* TODO: handle this case. */
+ }
+ else if (operand_equal_p (TREE_OPERAND (cond, 0), arg1, 0)
+ && operand_equal_p (TREE_OPERAND (cond, 1), arg0, 0))
+ {
+ /* TODO: handle this case. */
+ if (use_arg0)
+ return false;
+ }
+ else
+ return false;
+
+ /* If the type says honor signed zeros we cannot do this
+ optimization. */
+ if (HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg1))))
+ return false;
+
+ result = PHI_RESULT (phi);
+ /* Build the modify expression with abs expression. */
+ new = build (MODIFY_EXPR, TREE_TYPE (result),
+ result, use_arg0 ? arg0 : arg1);
+
+ /* Insert our new statement at the head of our block. */
+ bsi = bsi_start (bb);
+ bsi_insert_after (&bsi, new, BSI_NEW_STMT);
+
+ /* Register our new statement as the defining statement for
+ the result. */
+ SSA_NAME_DEF_STMT (PHI_RESULT (phi)) = new;
+
+ /* Remove the now useless PHI node.
+
+ We do not want to use remove_phi_node since that releases the
+ SSA_NAME as well and the SSA_NAME is still being used. */
+ release_phi_node (phi);
+ bb_ann (bb)->phi_nodes = NULL;
+
+
+ /* Eliminate the COND_EXPR at the end of COND_BLOCK. */
+ bsi = bsi_last (cond_block);
+ bsi_remove (&bsi);
+
+
+ /* Disconnect the edge leading into the empty block. That will
+ make the empty block unreachable and it will be removed later. */
+ if (cond_block->succ->dest == bb)
+ {
+ cond_block->succ->flags |= EDGE_FALLTHRU;
+ cond_block->succ->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+ ssa_remove_edge (cond_block->succ->succ_next);
+ }
+ else
+ {
+ cond_block->succ->succ_next->flags |= EDGE_FALLTHRU;
+ cond_block->succ->succ_next->flags
+ &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+ ssa_remove_edge (cond_block->succ);
+ }
+
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "COND_EXPR in block %d and PHI in block %d converted to straightline code.\n",
+ cond_block->index,
+ bb->index);
+
+ /* Note that we optimized this PHI. */
+ return true;
+
+}
+
+
/* Always do these optimizations if we have SSA
trees to work on. */
static bool
@@ -296,7 +900,8 @@ struct tree_opt_pass pass_phiopt =
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func | TODO_ggc_collect /* todo_flags_finish */
- | TODO_verify_ssa
+ | TODO_verify_ssa | TODO_rename_vars
+ | TODO_verify_flow
};
diff --git a/gcc/tree-ssa-return.c b/gcc/tree-ssa-return.c
new file mode 100644
index 00000000000..a333c7038fb
--- /dev/null
+++ b/gcc/tree-ssa-return.c
@@ -0,0 +1,232 @@
+/* Optimization of return nodes by merging them into one basic block.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "flags.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "basic-block.h"
+#include "timevar.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-pass.h"
+#include "tree-dump.h"
+
+static void tree_ssa_return (void);
+
+
+/* Build a temporary. Make sure and register it to be renamed. */
+
+static tree
+make_temp (tree type)
+{
+ tree t = create_tmp_var (type, NULL);
+ add_referenced_tmp_var (t);
+ bitmap_set_bit (vars_to_rename, var_ann (t)->uid);
+ return t;
+}
+
+
+static void
+tree_ssa_return (void)
+{
+ basic_block bb;
+
+ /* Search every basic block for return nodes we may be able to optimize. */
+ FOR_EACH_BB (bb)
+ {
+ tree returnstmt = last_stmt (bb);
+ edge pred = bb->pred;
+ basic_block bb_other = NULL;
+ tree returnstmt_other;
+ basic_block new_bb = NULL;
+ tree new_var = NULL;
+ block_stmt_iterator bsi, bsi_other, new_bsi;
+ tree ret_decl;
+ tree type;
+
+ /* If we have no predecessor, we can not do this for
+ the only basic block. */
+ if (!pred)
+ continue;
+
+ /* Cannot do this if there is no statements. */
+ if (!returnstmt)
+ continue;
+
+ if (TREE_CODE (returnstmt) == RETURN_EXPR)
+ ;
+ else
+ continue;
+
+ /* Only do this optimization for basic blocks which
+ have only one predecessor. */
+ if (!pred || pred->pred_next)
+ continue;
+
+ /* Only do this for predecessor which are only conditional ones. */
+ if (pred->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE))
+ ;
+ else
+ continue;
+
+ /* Cannot do this optimization if predecessor is abnormal. */
+ if (pred->flags & EDGE_ABNORMAL)
+ continue;
+
+ /* No reason to do this if we are not returning a value. */
+ if (TREE_OPERAND (returnstmt, 0) == NULL)
+ continue;
+
+ /* Make sure that the predecessor's successor is not an abnormal. */
+ if (pred->src->succ->flags & EDGE_ABNORMAL)
+ continue;
+
+ /* Find the other basic block which is connected to the predecessor. */
+ if (pred->src->succ->dest == bb)
+ bb_other = pred->src->succ->succ_next->dest;
+ else
+ bb_other = pred->src->succ->dest;
+
+
+ /* If we do not have a basic block for the other edge, just continue. */
+ if (!bb_other)
+ continue;
+
+
+ /* Only do the optimization if are bb_other is only linked from one BB. */
+ if (bb_other->pred->src != pred->src)
+ continue;
+ else if (bb_other->pred->pred_next)
+ continue;
+
+ returnstmt_other = last_stmt (bb_other);
+
+ /* Cannot do the optimization if the other basic block does not
+ end with a return. */
+ if (!returnstmt_other || TREE_CODE (returnstmt_other) != RETURN_EXPR)
+ continue;
+
+ /* No reason to do this if we are not returning a value. */
+ if (TREE_OPERAND (returnstmt_other, 0) == NULL)
+ continue;
+
+ /* If we do not have a modify expression on both returns, there is no point
+ in doing this optimization. */
+ if (TREE_CODE (TREE_OPERAND (returnstmt, 0)) != MODIFY_EXPR)
+ continue;
+
+ if (TREE_CODE (TREE_OPERAND (returnstmt_other, 0)) != MODIFY_EXPR)
+ continue;
+
+ /* Create the new basic block. */
+ new_bb = create_empty_bb (bb_other);
+
+ /* Redirect the two basic blocks (the ones with the returns)
+ to the new basic block. */
+ redirect_edge_and_branch (bb->succ, new_bb);
+ redirect_edge_and_branch (bb_other->succ, new_bb);
+
+ bsi = bsi_last (bb);
+ bsi_other = bsi_last (bb_other);
+
+
+ ret_decl = TREE_OPERAND (TREE_OPERAND (returnstmt, 0), 0);
+
+ type = TREE_TYPE (ret_decl);
+
+ /* Add the new variable to hold the return values. */
+ new_var = make_temp (type);
+
+ if (TREE_CODE (ret_decl) == SSA_NAME)
+ ret_decl = SSA_NAME_VAR (ret_decl);
+
+ /* Assign the new temp variable to hold the return value of
+ the first side of the branch. */
+ bsi_insert_after (&bsi, build (MODIFY_EXPR, type, new_var,
+ TREE_OPERAND (TREE_OPERAND (returnstmt, 0), 1)),
+ BSI_NEW_STMT);
+
+
+ /* Do the other side. */
+
+ bsi_insert_after (&bsi_other, build (MODIFY_EXPR, type, new_var,
+ TREE_OPERAND (TREE_OPERAND (returnstmt_other,
+ 0), 1)),
+ BSI_NEW_STMT);
+
+
+ /* Build the new basic block which continues the return. */
+ new_bsi = bsi_last (new_bb);
+ bsi_insert_after (&new_bsi, build1 (RETURN_EXPR, void_type_node,
+ build (MODIFY_EXPR, type, ret_decl,
+ new_var)), TSI_NEW_STMT);
+
+
+
+ /* Make sure that the return value gets renamed if needed */
+ bitmap_set_bit (vars_to_rename, var_ann (ret_decl)->uid);
+
+ /* The new basic block exits. */
+ make_edge (new_bb, EXIT_BLOCK_PTR, 0);
+
+ /* update the DOM info if we have to. */
+ if (dom_computed[CDI_DOMINATORS] >= DOM_CONS_OK)
+ set_immediate_dominator (CDI_DOMINATORS, new_bb, pred->src);
+ }
+
+
+ cleanup_tree_cfg ();
+}
+
+
+/* Always do these optimizations if we have SSA
+ trees to work on. */
+static bool
+gate_return (void)
+{
+ return 1;
+}
+
+struct tree_opt_pass pass_return =
+{
+ "return", /* name */
+ gate_return, /* gate */
+ tree_ssa_return, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_RETURN, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func | TODO_ggc_collect /* todo_flags_finish */
+ | TODO_verify_ssa | TODO_rename_vars
+ | TODO_verify_flow
+};
+
+
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index a5026e8ce44..70fe0d4db19 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -46,7 +46,6 @@ Boston, MA 02111-1307, USA. */
#include "tree-dump.h"
#include "tree-pass.h"
-
/* Remove edge E and remove the corresponding arguments from the PHI nodes
in E's destination block. */
@@ -573,7 +572,6 @@ tree_ssa_useless_type_conversion (tree expr)
return false;
}
-
/* Internal helper for walk_use_def_chains. VAR, FN and DATA are as
described in walk_use_def_chains. VISITED is a bitmap used to mark
visited SSA_NAMEs to avoid infinite loops. */
@@ -726,58 +724,106 @@ replace_immediate_uses (tree var, tree repl)
}
}
-/* Raises value of phi node PHI by joining it with VAL. Processes immediate
- uses of PHI recursively. */
+/* Gets the value VAR is equivalent to according to EQ_TO. */
-static void
-raise_value (tree phi, tree val, tree *eq_to)
+static tree
+get_eq_name (tree *eq_to, tree var)
{
- int i, n;
- tree var = PHI_RESULT (phi), stmt;
- int ver = SSA_NAME_VERSION (var);
- dataflow_t df;
+ unsigned ver;
+ tree val = var;
- if (eq_to[ver] == var)
- return;
+ while (TREE_CODE (val) == SSA_NAME)
+ {
+ ver = SSA_NAME_VERSION (val);
+ if (!eq_to[ver])
+ break;
+
+ val = eq_to[ver];
+ }
- switch (TREE_CODE (val))
+ while (TREE_CODE (var) == SSA_NAME)
{
- case SSA_NAME:
- case REAL_CST:
- case COMPLEX_CST:
- break;
- case INTEGER_CST:
- if (TREE_CODE (TREE_TYPE (var)) != POINTER_TYPE)
+ ver = SSA_NAME_VERSION (var);
+ if (!eq_to[ver])
break;
- default:
- /* Do not propagate pointer constants. This might require folding
- things like *&foo and rewriting the ssa, which is not worth the
- trouble. */
- val = var;
+ var = eq_to[ver];
+ eq_to[ver] = val;
}
- if (eq_to[ver])
+ return val;
+}
+
+/* Checks whether phi node PHI is redundant and if it is, records the ssa name
+ its result is redundant to to EQ_TO array. */
+
+static void
+check_phi_redundancy (tree phi, tree *eq_to)
+{
+ tree val = NULL_TREE, def, res = PHI_RESULT (phi), stmt;
+ unsigned i, ver = SSA_NAME_VERSION (res), n;
+ dataflow_t df;
+
+ /* It is unlikely that such large phi node would be redundant. */
+ if (PHI_NUM_ARGS (phi) > 16)
+ return;
+
+ for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
{
- if (operand_equal_p (eq_to[ver], val, 0))
+ def = PHI_ARG_DEF (phi, i);
+
+ switch (TREE_CODE (def))
+ {
+ case SSA_NAME:
+ def = get_eq_name (eq_to, def);
+ if (def == res)
+ continue;
+ break;
+
+ case REAL_CST:
+ case COMPLEX_CST:
+ break;
+
+ case INTEGER_CST:
+ if (TREE_CODE (TREE_TYPE (def)) != POINTER_TYPE)
+ break;
+
+ default:
+ /* Do not propagate pointer constants. This might require folding
+ things like *&foo and rewriting the ssa, which is not worth the
+ trouble. */
+ return;
+ }
+
+ if (val
+ && !operand_equal_p (val, def, 0))
return;
- eq_to[ver] = var;
+ val = def;
}
- else
- eq_to[ver] = val;
- df = get_immediate_uses (SSA_NAME_DEF_STMT (var));
+ /* At least one of the arguments should not be equal to the result, or
+ something strange is happening. */
+ if (!val)
+ abort ();
+
+ if (get_eq_name (eq_to, res) == val)
+ return;
+
+ if (!may_propagate_copy (res, val))
+ return;
+
+ eq_to[ver] = val;
+
+ df = get_immediate_uses (SSA_NAME_DEF_STMT (res));
n = num_immediate_uses (df);
for (i = 0; i < n; i++)
{
stmt = immediate_use (df, i);
- if (TREE_CODE (stmt) != PHI_NODE)
- continue;
-
- raise_value (stmt, eq_to[ver], eq_to);
+ if (TREE_CODE (stmt) == PHI_NODE)
+ check_phi_redundancy (stmt, eq_to);
}
}
@@ -798,30 +844,21 @@ raise_value (tree phi, tree val, tree *eq_to)
The most important effect of this pass is to remove degenerate PHI
nodes created by removing unreachable code. */
-static void
+void
kill_redundant_phi_nodes (void)
{
tree *eq_to, *ssa_names;
- unsigned i, ver, aver;
+ unsigned i;
basic_block bb;
- tree phi, t, stmt, var;
-
- /* The EQ_TO array holds the current value of the ssa name in the
- lattice:
-
- top
- / | \
- const variables
- \ | /
- bottom
-
- Bottom is represented by NULL and top by the variable itself.
-
- Once the dataflow stabilizes, we know that the phi nodes we need to keep
- are exactly those with top as their result.
-
- The remaining phi nodes have their uses replaced with their value
- in the lattice and the phi node itself is removed. */
+ tree phi, var, repl, stmt;
+
+ /* The EQ_TO[VER] holds the value by that the ssa name VER should be
+ replaced. If EQ_TO[VER] is ssa name and it is decided to replace it by
+ other value, it may be necessary to follow the chain till the final value.
+ We perform path shortening (replacing the entries of the EQ_TO array with
+ heads of these chains) whenever we access the field to prevent quadratic
+ complexity (probably would not occur in practice anyway, but let us play
+ it safe). */
eq_to = xcalloc (highest_ssa_version, sizeof (tree));
/* The SSA_NAMES array holds each SSA_NAME node we encounter
@@ -844,51 +881,35 @@ kill_redundant_phi_nodes (void)
for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
{
var = PHI_RESULT (phi);
- ver = SSA_NAME_VERSION (var);
- ssa_names[ver] = var;
-
- for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
- {
- t = PHI_ARG_DEF (phi, i);
-
- if (TREE_CODE (t) != SSA_NAME)
- {
- raise_value (phi, t, eq_to);
- continue;
- }
-
- stmt = SSA_NAME_DEF_STMT (t);
- aver = SSA_NAME_VERSION (t);
- ssa_names[aver] = t;
-
- /* If the defining statement for this argument is not a
- phi node or the argument is associated with an abnormal
- edge, then we need to recursively start the forward
- dataflow starting with PHI. */
- if (TREE_CODE (stmt) != PHI_NODE
- || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (t))
- {
- eq_to[aver] = t;
- raise_value (phi, t, eq_to);
- }
- }
+ ssa_names[SSA_NAME_VERSION (var)] = var;
+ check_phi_redundancy (phi, eq_to);
}
}
/* Now propagate the values. */
for (i = 0; i < highest_ssa_version; i++)
- if (eq_to[i]
- && eq_to[i] != ssa_names[i])
- replace_immediate_uses (ssa_names[i], eq_to[i]);
+ {
+ if (!ssa_names[i])
+ continue;
+
+ repl = get_eq_name (eq_to, ssa_names[i]);
+ if (repl != ssa_names[i])
+ replace_immediate_uses (ssa_names[i], repl);
+ }
/* And remove the dead phis. */
for (i = 0; i < highest_ssa_version; i++)
- if (eq_to[i]
- && eq_to[i] != ssa_names[i])
- {
- stmt = SSA_NAME_DEF_STMT (ssa_names[i]);
- remove_phi_node (stmt, 0, bb_for_stmt (stmt));
- }
+ {
+ if (!ssa_names[i])
+ continue;
+
+ repl = get_eq_name (eq_to, ssa_names[i]);
+ if (repl != ssa_names[i])
+ {
+ stmt = SSA_NAME_DEF_STMT (ssa_names[i]);
+ remove_phi_node (stmt, NULL_TREE, bb_for_stmt (stmt));
+ }
+ }
free_df ();
free (eq_to);
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 1142492430e..2d7d45242eb 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -114,7 +114,8 @@ make_ssa_name (tree var, tree stmt)
#if defined ENABLE_CHECKING
if ((!DECL_P (var)
&& TREE_CODE (var) != INDIRECT_REF)
- || (!IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (stmt)))
+ || (stmt
+ && !IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (stmt)))
&& TREE_CODE (stmt) != PHI_NODE))
abort ();
#endif
@@ -166,6 +167,9 @@ make_ssa_name (tree var, tree stmt)
void
release_ssa_name (tree var)
{
+ if (!var)
+ return;
+
/* release_ssa_name can be called multiple times on a single SSA_NAME.
However, it should only end up on our free list one time. We
keep a status bit in the SSA_NAME node itself to indicate it has
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
new file mode 100644
index 00000000000..d01627223c8
--- /dev/null
+++ b/gcc/tree-vectorizer.c
@@ -0,0 +1,3403 @@
+/* Loop Vectorization
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Dorit Naishlos <dorit@il.ibm.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* Loop Vectorization Pass.
+
+ This pass tries to vectorize loops. This first implementation focuses on
+ simple inner-most loops, with no conditional control flow, and a set of
+ simple operations which vector form can be expressed using existing
+ tree codes (PLUS, MULT etc).
+
+ For example, the vectorizer transforms the following simple loop:
+
+ short a[N]; short b[N]; short c[N]; int i;
+
+ for (i=0; i<N; i++){
+ a[i] = b[i] + c[i];
+ }
+
+ as if it was manually vectorized by rewriting the source code into:
+
+ typedef int __attribute__((mode(V8HI))) v8hi;
+ short a[N]; short b[N]; short c[N]; int i;
+ v8hi *pa = (v8hi*)a, *pb = (v8hi*)b, *pc = (v8hi*)c;
+ v8hi va, vb, vc;
+
+ for (i=0; i<N/8; i++){
+ vb = pb[i];
+ vc = pc[i];
+ va = vb + vc;
+ pa[i] = va;
+ }
+
+ The main entry to this pass is vectorize_loops(), in which for each
+ the vectorizer applies a set of analyses on a given set of loops,
+ followed by the actual vectorization transformation for the loops that
+ had successfully passed the analysis phase.
+
+ Throughout this pass we make a distinction between two types of
+ data: scalars (which are represented by SSA_NAMES), and data-refs. These
+ are handled separately both by the analyzer and the loop-transformer.
+ Currently, the vectorizer only supports simple data-refs which are
+ limited to ARRAY_REFS that represent one dimensional arrays which base is
+ an array (not a pointer), and have a simple (consecutive) access pattern.
+
+ Analysis phase:
+ ===============
+ The driver for the analysis phase is vect_analyze_loop_nest().
+ which applies a set of loop analyses. Some of the analyses rely on the
+ monotonic evolution analyzer developed by Sebastian Pop.
+
+ During the analysis phase the vectorizer records some information
+ per stmt in a stmt_vec_info which is attached to each stmt in the loop,
+ as well as general information about the loop as a whole, which is
+ recorded in a loop_vec_info struct attached to each loop.
+
+ Transformation phase:
+ =====================
+ The loop transformation phase scans all the stmts in the loop, and
+ creates a vector stmt (or a sequence of stmts) for each scalar stmt S in
+ the loop that needs to be vectorized. It insert the vector code sequence
+ just before the scalar stmt S, and records a pointer to the vector code
+ in STMT_VINFO_VEC_STMT (stmt_info) (where stmt_info is the stmt_vec_info
+ struct that is attached to S). This pointer is used for the vectorization
+ of following stmts which use the defs of stmt S. Stmt S is removed
+ only if it has side effects (like changing memory). If stmt S does not
+ have side effects, we currently rely on dead code elimination for
+ removing it.
+
+ For example, say stmt S1 was vectorized into stmt VS1:
+
+ VS1: vb = px[i];
+ S1: b = x[i]; STMT_VINFO_VEC_STMT (stmt_info (S1)) = VS1
+ S2: a = b;
+
+ To vectorize stmt S2, the vectorizer first finds the stmt that defines
+ the operand 'b' (S1), and gets the relevant vector def 'vb' from the
+ vector stmt VS1 pointed by STMT_VINFO_VEC_STMT (stmt_info (S1)). The
+ resulting sequence would be:
+
+ VS1: vb = px[i];
+ S1: b = x[i]; STMT_VINFO_VEC_STMT (stmt_info (S1)) = VS1
+ VS2: va = vb;
+ S2: a = b; STMT_VINFO_VEC_STMT (stmt_info (S2)) = VS2
+
+ Operands that are not SSA_NAMEs, are currently limited to array
+ references appearing in load/store operations (like 'x[i]' in S1), and
+ are handled differently.
+
+ Target modelling:
+ =================
+ Currently the only target specific information that is used is the
+ size of the vector (in bytes) - "UNITS_PER_SIMD_WORD", and a target hook
+ "vectype_for_scalar_type" that for a given (scalar) machine mode returns
+ the vector machine_mode to be used. Targets that can support different
+ sizes of vectors, for now will need to specify one value for
+ "UNITS_PER_SIMD_WORD". More flexibility will be added in the future.
+
+ Since we only vectorize operations which vector form can be
+ expressed using existing tree codes, to verify that an operation is
+ supported the vectorizer checks the relevant optab at the relevant
+ machine_mode (e.g, add_optab->handlers[(int) V8HImode].insn_code). If
+ the value found is CODE_FOR_nothing, then there's no target support, and
+ we can't vectorize the stmt. Otherwise - the stmt is transformed.
+
+
+ For additional information on this project see:
+ http://gcc.gnu.org/projects/tree-ssa/vectorization.html
+*/
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "errors.h"
+#include "ggc.h"
+#include "tree.h"
+#include "target.h"
+
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-fold-const.h"
+#include "expr.h"
+#include "optabs.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-vectorizer.h"
+#include "tree-pass.h"
+
+/* CHECKME: check for unnecessary include files. */
+
+/* Main analysis functions. */
+static loop_vec_info vect_analyze_loop (struct loop *);
+static loop_vec_info vect_analyze_loop_form (struct loop *);
+static bool vect_analyze_data_refs (loop_vec_info);
+static bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
+static bool vect_analyze_scalar_cycles (loop_vec_info);
+static bool vect_analyze_data_ref_dependences (loop_vec_info);
+static bool vect_analyze_data_ref_accesses (loop_vec_info);
+static bool vect_analyze_data_refs_alignment (loop_vec_info);
+static void vect_compute_data_refs_alignment (loop_vec_info);
+static bool vect_analyze_operations (loop_vec_info);
+
+/* Main code transformation functions. */
+static void vect_transform_loop (loop_vec_info);
+static void vect_transform_loop_bound (loop_vec_info);
+static bool vect_transform_stmt (tree, block_stmt_iterator *);
+static tree vect_transform_load (tree, block_stmt_iterator *);
+static tree vect_transform_store (tree, block_stmt_iterator *);
+static tree vect_transform_op (tree, block_stmt_iterator *);
+static tree vect_transform_assignment (tree, block_stmt_iterator *);
+static void vect_align_data_ref (tree, tree);
+static void vect_enhance_data_refs_alignment (loop_vec_info);
+
+/* Utility functions for the analyses. */
+static bool vect_is_supportable_op (tree);
+static bool vect_is_supportable_store (tree);
+static bool vect_is_supportable_load (tree);
+static bool vect_is_supportable_assignment (tree);
+static bool vect_is_simple_use (tree , struct loop *);
+static bool exist_non_indexing_operands_for_use_p (tree, tree);
+static bool vect_is_simple_iv_evolution (unsigned, tree, tree *, tree *, bool);
+static void vect_mark_relevant (varray_type, tree);
+static bool vect_stmt_relevant_p (tree, loop_vec_info);
+static tree vect_get_loop_niters (struct loop *, int *);
+static void vect_compute_data_ref_alignment
+ (struct data_reference *, loop_vec_info);
+static bool vect_analyze_data_ref_access (struct data_reference *);
+static bool vect_analyze_data_ref_dependence
+ (struct data_reference *, struct data_reference *);
+static bool vect_get_array_first_index (tree, int *);
+static bool vect_force_dr_alignment_p (struct data_reference *);
+
+/* Utility functions for the code transformation. */
+static tree vect_create_destination_var (tree, tree);
+static tree vect_create_data_ref (tree, tree, block_stmt_iterator *);
+static tree vect_create_index_for_array_ref (tree, block_stmt_iterator *);
+static tree get_vectype_for_scalar_type (tree);
+static tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
+static tree vect_get_vec_def_for_operand (tree, tree);
+static tree vect_init_vector (tree, tree);
+
+/* General untility functions (CHECKME: where do they belong). */
+static tree get_array_base (tree);
+
+/* Utilities for creation and deletion of vec_info structs. */
+loop_vec_info new_loop_vec_info (struct loop *loop);
+void destroy_loop_vec_info (loop_vec_info);
+stmt_vec_info new_stmt_vec_info (tree stmt, struct loop *loop);
+
+/* Define number of arguments for each tree code. */
+
+#define DEFTREECODE(SYM, STRING, TYPE, NARGS) NARGS,
+
+int tree_nargs[] = {
+#include "tree.def"
+
+};
+
+#undef DEFTREECODE
+
+/* Function new_stmt_vec_info.
+
+ Create and initialize a new stmt_vec_info struct for STMT. */
+
+stmt_vec_info
+new_stmt_vec_info (tree stmt, struct loop *loop)
+{
+ stmt_vec_info res;
+ res = (stmt_vec_info) xcalloc (1, sizeof (struct _stmt_vec_info));
+
+ STMT_VINFO_TYPE (res) = undef_vec_info_type;
+ STMT_VINFO_STMT (res) = stmt;
+ STMT_VINFO_LOOP (res) = loop;
+ STMT_VINFO_RELEVANT_P (res) = 0;
+ STMT_VINFO_VECTYPE (res) = NULL;
+ STMT_VINFO_VEC_STMT (res) = NULL;
+ STMT_VINFO_DATA_REF (res) = NULL;
+
+ return res;
+}
+
+
+/* Function new_loop_vec_info.
+
+ Create and initialize a new loop_vec_info struct for LOOP, as well as
+ stmt_vec_info structs for all the stmts in LOOP. */
+
+loop_vec_info
+new_loop_vec_info (struct loop *loop)
+{
+ loop_vec_info res;
+ basic_block *bbs;
+ block_stmt_iterator si;
+ unsigned int i;
+
+ res = (loop_vec_info) xcalloc (1, sizeof (struct _loop_vec_info));
+
+ bbs = get_loop_body (loop);
+
+ /* Create stmt_info for all stmts in the loop. */
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ basic_block bb = bbs[i];
+ for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ {
+ tree stmt = bsi_stmt (si);
+ stmt_ann_t ann;
+
+ get_stmt_operands (stmt);
+ ann = stmt_ann (stmt);
+ set_stmt_info (ann, new_stmt_vec_info (stmt, loop));
+ }
+ }
+
+ LOOP_VINFO_LOOP (res) = loop;
+ LOOP_VINFO_BBS (res) = bbs;
+ LOOP_VINFO_EXIT_COND (res) = NULL;
+ LOOP_VINFO_NITERS (res) = -1;
+ LOOP_VINFO_VECTORIZABLE_P (res) = 0;
+ LOOP_VINFO_VECT_FACTOR (res) = 0;
+ VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DATAREF_WRITES (res), 20,
+ "loop_write_datarefs");
+ VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DATAREF_READS (res), 20,
+ "loop_read_datarefs");
+ return res;
+}
+
+
+/* Function destroy_loop_vec_info. */
+
+void
+destroy_loop_vec_info (loop_vec_info loop_vinfo)
+{
+ struct loop *loop;
+ basic_block *bbs;
+ int nbbs;
+ block_stmt_iterator si;
+ int j;
+
+ if (!loop_vinfo)
+ return;
+
+ loop = LOOP_VINFO_LOOP (loop_vinfo);
+
+ bbs = LOOP_VINFO_BBS (loop_vinfo);
+ nbbs = loop->num_nodes;
+
+ for (j = 0; j < nbbs; j++)
+ {
+ basic_block bb = bbs[j];
+ for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ {
+ tree stmt = bsi_stmt (si);
+ stmt_ann_t ann = stmt_ann (stmt);
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ free (stmt_info);
+ set_stmt_info (ann, NULL);
+ }
+ }
+
+ free (LOOP_VINFO_BBS (loop_vinfo));
+ varray_clear (LOOP_VINFO_DATAREF_WRITES (loop_vinfo));
+ varray_clear (LOOP_VINFO_DATAREF_READS (loop_vinfo));
+
+ free (loop_vinfo);
+}
+
+
+/* Function vect_force_dr_alignment_p
+
+ Returned whether the alignment of a certain data structure can be forced. */
+
+static bool
+vect_force_dr_alignment_p (struct data_reference *dr)
+{
+ tree ref = DR_REF (dr);
+ tree array_base;
+
+ if (TREE_CODE (ref) != ARRAY_REF)
+ return false;
+
+ array_base = get_array_base (ref);
+
+ /* We want to make sure that we can force alignment of
+ the data structure that is being accessed, because we do not
+ handle misalignment yet.
+
+ CHECKME: Is this a correct check for this purpose?
+ CHECKME: This is a very strict check.
+ CHECKME: Can we force the alignment of external decls?
+ */
+
+ if (TREE_CODE (TREE_TYPE (array_base)) != ARRAY_TYPE
+ || TREE_CODE (array_base) != VAR_DECL
+ || DECL_EXTERNAL (array_base))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "unhandled ptr-based array ref\n");
+ if (TREE_CODE (array_base) == VAR_DECL && DECL_EXTERNAL (array_base))
+ fprintf (dump_file,"\nextern decl.\n");
+ }
+ return false;
+ }
+
+ return true;
+}
+
+
+/* Function vect_get_new_vect_var.
+
+ Return a name for a new variable.
+ The current naming scheme appends the prefix "vect_" or "vect_p" to
+ vectorizer generated variables, and appends that to NAME if given.
+
+ CHECKME: naming scheme ok? */
+
+static tree
+vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name)
+{
+ const char *prefix;
+ int prefix_len;
+ char *vect_var_name;
+ tree new_vect_var;
+
+ if (var_kind == vect_simple_var)
+ prefix = "vect_";
+ else
+ prefix = "vect_p";
+
+ prefix_len = strlen (prefix);
+
+ if (name)
+ {
+ vect_var_name = (char *) xmalloc (strlen (name) + prefix_len + 1);
+ sprintf (vect_var_name, "%s%s", prefix, name);
+ }
+ else
+ {
+ vect_var_name = (char *) xmalloc (prefix_len + 1);
+ sprintf (vect_var_name, "%s", prefix);
+ }
+
+ new_vect_var = create_tmp_var (type, vect_var_name);
+
+ free (vect_var_name);
+ return new_vect_var;
+}
+
+
+/* Function create_index_for_array_ref.
+
+ Create an offset/index to be used to access a memory location.
+ Input:
+
+ STMT: The stmt that contains a data reference to the memory location.
+
+ BSI: The block_stmt_iterator where STMT is. Any new stmts created by this
+ function can be added here, or in the loop pre-header.
+
+ Output:
+
+ Return an index that will be used to index an array, using a pointer as
+ a base.
+
+ FORNOW: we are not trying to be efficient, and just creating the code
+ sequence each time from scratch, even if the same offset can be reused.
+ TODO: record the index in the array_ref_info or the stmt info and reuse
+ it.
+
+ FORNOW: We are only handling array accesses with step 1. */
+
+static tree
+vect_create_index_for_array_ref (tree stmt, block_stmt_iterator *bsi)
+{
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ struct loop *loop = STMT_VINFO_LOOP (stmt_info);
+ struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
+ tree expr = DR_REF (dr);
+ varray_type access_fns = DR_ACCESS_FNS (dr);
+ tree access_fn;
+ tree scalar_indx;
+ int init_val, step_val;
+ tree init, step;
+ loop_vec_info loop_info = loop->aux;
+ int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_info);
+ bool ok;
+ int array_first_index;
+ int vec_init_val;
+ tree indx_before_incr, indx_after_incr;
+
+ if (TREE_CODE (expr) != ARRAY_REF)
+ abort ();
+
+ /* FORNOW: handle only one dimensional arrays.
+ This restriction will be relaxed in the future. */ /* CHECKME */
+ if (VARRAY_ACTIVE_SIZE (access_fns) != 1)
+ abort ();
+
+ access_fn = DR_ACCESS_FN (dr, 0);
+
+ if (!vect_is_simple_iv_evolution (loop_num (loop), access_fn, &init, &step,
+ true))
+ abort ();
+
+ if (TREE_CODE (init) != INTEGER_CST || TREE_CODE (step) != INTEGER_CST)
+ abort ();
+
+ if (TREE_INT_CST_HIGH (init) != 0 || TREE_INT_CST_HIGH (step) != 0)
+ abort ();
+
+ init_val = TREE_INT_CST_LOW (init);
+ step_val = TREE_INT_CST_LOW (step);
+
+
+ /** Handle initialization. **/
+
+ scalar_indx = TREE_OPERAND (expr, 1);
+
+ /* The actual index depends on the (mis)alignment of the access.
+ FORNOW: we verify that both the array base and the access are
+ aligned, so the index in the vectorized access is simply
+ init_val/vectorization_factor. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "creating update chain:\n");
+
+ ok = vect_get_array_first_index (expr, &array_first_index);
+ if (!ok)
+ abort ();
+ vec_init_val = array_first_index +
+ (init_val - array_first_index)/vectorization_factor;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "vec_init_indx = %d\n", vec_init_val);
+
+ init = build_int_2 (vec_init_val, 0);
+ step = integer_one_node;
+
+ /* CHECKME: assuming that bsi_insert is used with BSI_NEW_STMT */
+
+ create_iv (init, step, NULL_TREE, loop, bsi, false,
+ &indx_before_incr, &indx_after_incr);
+
+ return indx_before_incr;
+}
+
+
+/* Function get_vectype_for_scalar_type.
+
+ Return the vector type corresponding to SCALAR_TYPE as supported
+ by the target. */
+
+static tree
+get_vectype_for_scalar_type (tree scalar_type)
+{
+ enum machine_mode inner_mode;
+ enum machine_mode vec_mode;
+ int nbytes;
+ int nunits;
+
+ /* FORNOW: Only a single vector size per target is expected. */
+
+ inner_mode = TYPE_MODE (scalar_type);
+ nbytes = GET_MODE_SIZE (inner_mode);
+
+ if (nbytes == 0)
+ return NULL_TREE;
+
+ nunits = UNITS_PER_SIMD_WORD / nbytes;
+
+ if (GET_MODE_CLASS (inner_mode) == MODE_FLOAT)
+ vec_mode = MIN_MODE_VECTOR_FLOAT;
+ else
+ vec_mode = MIN_MODE_VECTOR_INT;
+
+ /* CHECKME: This duplicates some of the functionality in build_vector_type;
+ could have directly called build_vector_type_for_mode if exposed. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\nget vectype for scalar type: ");
+ print_generic_expr (dump_file, scalar_type, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+ for (; vec_mode != VOIDmode ; vec_mode = GET_MODE_WIDER_MODE (vec_mode))
+ if (GET_MODE_NUNITS (vec_mode) == nunits
+ && GET_MODE_INNER (vec_mode) == inner_mode
+ && VECTOR_MODE_SUPPORTED_P (vec_mode))
+ return build_vector_type (scalar_type, nunits);
+
+ return NULL_TREE;
+}
+
+
+/* Function vect_align_data_ref
+
+ Handle alignment of a memory accesses.
+
+ FORNOW: Make sure the array is properly aligned. The vectorizer
+ currently does not handle unaligned memory accesses.
+ This restriction will be relaxed in the future.
+
+ FORNOW: data_ref is an array_ref which alignment can be forced; i.e.,
+ the base of the ARRAY_REF is not a pointer but an array.
+ This restriction will be relaxed in the future.
+
+ FORNOW: The array is being accessed starting at location 'init';
+ We limit vectorization to cases in which init % NUNITS == 0
+ (where NUNITS = GET_MODE_NUNITS (TYPE_MODE (vectype))).
+ This restriction will be relaxed in the future. */
+
+static void
+vect_align_data_ref (tree ref, tree stmt)
+{
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree array_base = get_array_base (ref);
+ struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
+
+ if (!aligned_access_p (dr))
+ abort (); /* FORNOW, can't handle misliagned accesses. */
+
+ /* The access is aligned, but some accesses are marked alignd under the
+ assumption that alignment of the base of the data structure will be
+ forced: */
+
+ if (vect_force_dr_alignment_p (dr))
+ {
+ if (DECL_ALIGN (array_base) < TYPE_ALIGN (vectype))
+ {
+ /* CHECKME:
+ - is this the way to force the alignment of an array base?
+ - can it be made to also work for extern decls? */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "\nforce alignment. before: scalar/vec type_align = %d/%d\n",
+ DECL_ALIGN (array_base), TYPE_ALIGN (vectype));
+
+ DECL_ALIGN (array_base) = TYPE_ALIGN (vectype);
+ }
+ }
+}
+
+
+/* Function vect_create_data_ref.
+
+ Create a memory reference expression for vector access, to be used in a
+ vector load/store stmt.
+
+ Input:
+ STMT: the stmt that references memory
+ FORNOW: a load/store of the form 'var = a[i]'/'a[i] = var'.
+ OP: the operand in STMT that is the memory reference
+ FORNOW: an array_ref.
+ BSI: the block_stmt_iterator where STMT is. Any new stmts created by this
+ function can be added here.
+
+ Output:
+ 1. Declare a new ptr to vector_type, and have it point to the array base.
+ For example, for vector of type V8HI:
+ v8hi *p0;
+ p0 = (v8hi *)&a;
+
+ 3. Return the expression '(*p0)[idx]',
+ where idx is the index used for the scalar expr.
+
+ FORNOW: handle only simple array accesses (step 1). */
+
+static tree
+vect_create_data_ref (tree ref, tree stmt, block_stmt_iterator *bsi)
+{
+ tree new_base;
+ tree data_ref;
+ tree idx;
+ tree vec_stmt;
+ tree new_temp;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree ptr_type;
+ tree array_ptr;
+ tree array_base;
+ vdef_optype vdefs = STMT_VDEF_OPS (stmt);
+ vuse_optype vuses = STMT_VUSE_OPS (stmt);
+ int nvuses = 0, nvdefs = 0;
+ int i;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "create array_ref of type:\n");
+ print_generic_expr (dump_file, vectype, TDF_SLIM);
+ }
+
+ vect_align_data_ref (ref, stmt);
+ array_base = get_array_base (ref);
+
+ /*** create: vectype *p; ***/
+ ptr_type = build_pointer_type (vectype);
+ array_ptr = vect_get_new_vect_var (ptr_type, vect_pointer_var,
+ get_name (array_base));
+ add_referenced_tmp_var (array_ptr);
+ if (TREE_CODE (array_base) == VAR_DECL)
+ {
+ get_var_ann (array_ptr)->type_mem_tag = array_base;
+ bitmap_set_bit (vars_to_rename, var_ann (array_base)->uid);
+ }
+ else
+ {
+ /* FORNOW. This restriction will be relaxed in the future. */
+ abort ();
+ }
+
+ /* CHECKME: update name_mem_tag as well? */
+
+ /* Also mark for renaming all aliased variables: */ /* CHECKME */
+ if (vuses)
+ nvuses = NUM_VUSES (vuses);
+ if (vdefs)
+ nvdefs = NUM_VDEFS (vdefs);
+ for (i = 0; i < nvuses; i++)
+ {
+ tree use = VUSE_OP (vuses, i);;
+ if (TREE_CODE (use) == SSA_NAME)
+ bitmap_set_bit (vars_to_rename, var_ann (SSA_NAME_VAR (use))->uid);
+ }
+ for (i = 0; i < nvdefs; i++)
+ {
+ tree def = VDEF_RESULT (vdefs, i);
+ if (TREE_CODE (def) == SSA_NAME)
+ bitmap_set_bit (vars_to_rename, var_ann (SSA_NAME_VAR (def))->uid);
+ }
+
+ /*** create: p = (vectype *)&a; ***/
+ vec_stmt = build (MODIFY_EXPR, void_type_node, array_ptr,
+ build1 (NOP_EXPR, ptr_type,
+ build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (array_base)), array_base)));
+ TREE_ADDRESSABLE (array_base) = 1;
+ new_temp = make_ssa_name (array_ptr, vec_stmt);
+ TREE_OPERAND (vec_stmt, 0) = new_temp;
+ bsi_insert_before (bsi, vec_stmt, BSI_SAME_STMT);
+
+ idx = vect_create_index_for_array_ref (stmt, bsi);
+
+ /*** create data ref: '(*p)[idx]' ***/
+
+ new_base = build1 (INDIRECT_REF, build_array_type (vectype, 0),
+ TREE_OPERAND (vec_stmt, 0));
+ data_ref = build (ARRAY_REF, vectype, new_base, idx);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ print_generic_expr (dump_file, data_ref, TDF_SLIM);
+
+ return data_ref;
+}
+
+
+/* Function vect_create_destination_var
+
+ Create a new temporary of type VECTYPE. */
+
+static tree
+vect_create_destination_var (tree scalar_dest, tree vectype)
+{
+ tree vec_dest;
+ const char *new_name;
+
+ if (TREE_CODE (scalar_dest) != SSA_NAME)
+ abort ();
+
+ new_name = get_name (scalar_dest);
+ if (!new_name)
+ new_name = "var_";
+ vec_dest = vect_get_new_vect_var (vectype, vect_simple_var, new_name);
+ add_referenced_tmp_var (vec_dest);
+
+ /* FIXME: introduce new type. */
+ TYPE_ALIAS_SET (TREE_TYPE (vec_dest)) =
+ TYPE_ALIAS_SET (TREE_TYPE (scalar_dest));
+
+ return vec_dest;
+}
+
+
+/* Function vect_init_vector.
+
+ Insert a new stmt (INIT_STMT) that initializes a new vector veriable with
+ the vector elements of VECTOR_VAR. Return the DEF of INIT_STMT. It will be
+ used in the vectorization of STMT. */
+
+static tree
+vect_init_vector (tree stmt, tree vector_var)
+{
+ stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
+ struct loop *loop = STMT_VINFO_LOOP (stmt_vinfo);
+ block_stmt_iterator pre_header_bsi;
+ tree new_var;
+ tree init_stmt;
+ tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
+ tree vec_oprnd;
+
+ new_var = vect_get_new_vect_var (vectype, vect_simple_var, "cst_");
+ add_referenced_tmp_var (new_var);
+ bitmap_set_bit (vars_to_rename, var_ann (new_var)->uid);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_generic_expr (dump_file, vector_var, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+ init_stmt = build (MODIFY_EXPR, vectype, new_var, vector_var);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_generic_expr (dump_file, init_stmt, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+ /* CHECKME: Is there a utility for inserting code at the end of a basic block? */
+ pre_header_bsi = bsi_last (loop->pre_header);
+ if (!bsi_end_p (pre_header_bsi)
+ && is_ctrl_stmt (bsi_stmt (pre_header_bsi)))
+ bsi_insert_before (&pre_header_bsi, init_stmt, BSI_NEW_STMT);
+ else
+ bsi_insert_after (&pre_header_bsi, init_stmt, BSI_NEW_STMT);
+
+ vec_oprnd = TREE_OPERAND (init_stmt, 0);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_generic_expr (dump_file, vec_oprnd, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+ return vec_oprnd;
+}
+
+/* Function vect_get_vec_def_for_operand.
+
+ OP is an operand in STMT. This function returns a (vector) def that will be
+ used in the vectorized counterpart of STMT.
+
+ In the case that OP is an SSA_NAME which is defined in the loop, then
+ STMT_VINFO_VEC_STMT of the defining stmt holds the relevant def.
+
+ In case OP is an invariant or constant, a new stmt that creates a vector def
+ needs to be introduced. */
+
+static tree
+vect_get_vec_def_for_operand (tree op, tree stmt)
+{
+ tree vec_oprnd;
+
+ if (!op)
+ abort ();
+
+ if (TREE_CODE (op) == SSA_NAME)
+ {
+ tree vec_stmt;
+ tree def_stmt;
+ stmt_vec_info def_stmt_info = NULL;
+
+ def_stmt = SSA_NAME_DEF_STMT (op);
+ def_stmt_info = vinfo_for_stmt (def_stmt);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "vect_get_vec_def_for_operand: def_stmt:\n");
+ print_generic_expr (dump_file, def_stmt, TDF_SLIM);
+ }
+
+ if (!def_stmt_info)
+ {
+ /* op is defined outside the loop (it is loop invariant).
+ Create 'vec_inv = {inv,inv,..,inv}' */
+
+ tree vec_inv;
+ stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
+ int nunits = GET_MODE_NUNITS (TYPE_MODE (vectype));
+ basic_block bb = bb_for_stmt (def_stmt);
+ struct loop *loop = STMT_VINFO_LOOP (stmt_vinfo);
+ tree t = NULL_TREE;
+ tree def;
+ int i;
+
+ /* Build a tree with vector elements. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nCreate vector_inv.\n");
+
+ if (TREE_CODE (def_stmt) == PHI_NODE)
+ {
+ if (flow_bb_inside_loop_p (loop, bb))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nUnsupported reduction.\n");
+ abort ();
+ }
+ def = PHI_RESULT (def_stmt);
+ }
+ else if (TREE_CODE (def_stmt) == NOP_EXPR)
+ {
+ tree arg = TREE_OPERAND (def_stmt, 0);
+ if (TREE_CODE (arg) != INTEGER_CST && TREE_CODE (arg) != REAL_CST)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nUnsupported NOP_EXPR.\n");
+ abort ();
+ }
+ def = op;
+ }
+ else
+ def = TREE_OPERAND (def_stmt, 0);
+
+ for (i = nunits - 1; i >= 0; --i)
+ {
+ t = tree_cons (NULL_TREE, def, t);
+ }
+
+ vec_inv = build_constructor (vectype, t); /* CHECKME */
+ return vect_init_vector (stmt, vec_inv);
+ }
+
+
+ /* op is defined inside the loop. Get the def from the vectorized stmt.
+ */
+ vec_stmt = STMT_VINFO_VEC_STMT (def_stmt_info);
+
+ if (!vec_stmt)
+ abort ();
+
+ /* CHECKME: any cases where the def we want is not TREE_OPERAND 0? */
+ vec_oprnd = TREE_OPERAND (vec_stmt, 0);
+
+ return vec_oprnd;
+ }
+
+ if (TREE_CODE (op) == INTEGER_CST
+ || TREE_CODE (op) == REAL_CST)
+ {
+ /* Create 'vect_cst_ = {cst,cst,...,cst}' */
+
+ tree vec_cst;
+ stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
+ int nunits = GET_MODE_NUNITS (TYPE_MODE (vectype));
+ tree t = NULL_TREE;
+ int i;
+
+ /* Build a tree with vector elements. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nCreate vector_cst.\n");
+ for (i = nunits - 1; i >= 0; --i)
+ {
+ t = tree_cons (NULL_TREE, op, t);
+ }
+ vec_cst = build_vector (vectype, t);
+ return vect_init_vector (stmt, vec_cst);
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Function vect_transfom_assignment.
+
+ STMT performs an assignment (copy). Create a vectorized stmt to replace it,
+ and insert it at BSI. */
+
+static tree
+vect_transform_assignment (tree stmt, block_stmt_iterator *bsi)
+{
+ tree vec_stmt;
+ tree vec_dest;
+ tree scalar_dest;
+ tree op;
+ tree vec_oprnd;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree new_temp;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "transform assignment\n");
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ abort ();
+
+ /** Handle def. **/
+
+ scalar_dest = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (scalar_dest) != SSA_NAME)
+ abort ();
+ vec_dest = vect_create_destination_var (scalar_dest, vectype);
+
+ /** Handle use - get the vectorized def from the defining stmt. **/
+
+ op = TREE_OPERAND (stmt, 1);
+
+ vec_oprnd = vect_get_vec_def_for_operand (op, stmt);
+ if (! vec_oprnd)
+ abort ();
+
+ /** arguments are ready. create the new vector stmt. **/
+
+ vec_stmt = build (MODIFY_EXPR, vectype, vec_dest, vec_oprnd);
+ new_temp = make_ssa_name (vec_dest, vec_stmt);
+ TREE_OPERAND (vec_stmt, 0) = new_temp;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "add new stmt\n");
+ print_generic_stmt (dump_file, vec_stmt, TDF_SLIM);
+ }
+ bsi_insert_before (bsi, vec_stmt, BSI_SAME_STMT);
+
+ return vec_stmt;
+}
+
+
+/* Function vect_transfom_op.
+
+ STMT performs a binary or unary operation. Create a vectorized stmt to
+ replace it, and insert it at BSI. */
+
+static tree
+vect_transform_op (tree stmt, block_stmt_iterator *bsi)
+{
+ tree vec_stmt;
+ tree vec_dest;
+ tree scalar_dest;
+ tree operation;
+ tree op0, op1=NULL;
+ tree vec_oprnd0, vec_oprnd1=NULL;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ enum tree_code code;
+ tree new_temp;
+ int op_type;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "transform op\n");
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ abort ();
+
+ operation = TREE_OPERAND (stmt, 1);
+
+ /** Handle def. **/
+
+ scalar_dest = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (scalar_dest) != SSA_NAME)
+ abort ();
+ vec_dest = vect_create_destination_var (scalar_dest, vectype);
+
+ /** Handle uses - get the vectorized defs from the defining stmts. **/
+
+ /** Distinguish between binary and unary operations. **/
+
+ op_type = tree_nargs[TREE_CODE (operation)];
+
+ if (op_type != unary_op && op_type != binary_op)
+ abort ();
+
+ op0 = TREE_OPERAND (operation, 0);
+ if (op_type == binary_op)
+ op1 = TREE_OPERAND (operation, 1);
+
+ vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt);
+ if (! vec_oprnd0)
+ abort ();
+
+ if(op_type == binary_op)
+ {
+ vec_oprnd1 = vect_get_vec_def_for_operand (op1, stmt);
+ if (! vec_oprnd1)
+ abort ();
+ }
+
+ /** arguments are ready. create the new vector stmt. **/
+
+ code = TREE_CODE (operation);
+ if (op_type == binary_op)
+ vec_stmt = build (MODIFY_EXPR, vectype, vec_dest,
+ build (code, vectype, vec_oprnd0, vec_oprnd1));
+ else
+ vec_stmt = build (MODIFY_EXPR, vectype, vec_dest,
+ build1 (code, vectype, vec_oprnd0));
+
+ new_temp = make_ssa_name (vec_dest, vec_stmt);
+ TREE_OPERAND (vec_stmt, 0) = new_temp;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "add new stmt\n");
+ print_generic_stmt (dump_file, vec_stmt, TDF_SLIM);
+ }
+ bsi_insert_before (bsi, vec_stmt, BSI_SAME_STMT);
+
+ return vec_stmt;
+}
+
+
+/* Function vect_transfom_store.
+
+ STMT is a store to memory. Create a vectorized stmt to replace it,
+ and insert it at BSI. */
+
+static tree
+vect_transform_store (tree stmt, block_stmt_iterator *bsi)
+{
+ tree scalar_dest;
+ tree vec_stmt;
+ tree data_ref;
+ tree op;
+ tree vec_oprnd1;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "transform store\n");
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ abort ();
+
+ /** Handle def. **/
+
+ scalar_dest = TREE_OPERAND (stmt, 0);
+
+ if (TREE_CODE (scalar_dest) != ARRAY_REF)
+ abort ();
+
+ data_ref = vect_create_data_ref (scalar_dest, stmt, bsi);
+ if (!data_ref)
+ abort ();
+
+ /** Handle use - get the vectorized def from the defining stmt. **/
+
+ op = TREE_OPERAND (stmt, 1);
+
+ vec_oprnd1 = vect_get_vec_def_for_operand (op, stmt);
+ if (! vec_oprnd1)
+ abort ();
+
+ /** Arguments are ready. create the new vector stmt. **/
+
+ vec_stmt = build (MODIFY_EXPR, vectype, data_ref, vec_oprnd1);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "add new stmt\n");
+ print_generic_stmt (dump_file, vec_stmt, TDF_SLIM);
+ }
+ bsi_insert_before (bsi, vec_stmt, BSI_SAME_STMT);
+
+ if (stmt != bsi_stmt (*bsi))
+ {
+ /* This is expected when an update chain for a data-ref index has been
+ created (by vect_create_index_for_array_ref). The current stmt
+ sequence is as follows:
+
+ (i) some stmt
+ (i+1) vec_stmt (with a data_ref that uses index)
+ (i+2) stmt_to_update_index <-- bsi
+ (i+3) stmt
+
+ The iterator bsi should be bumped to point to stmt at location (i+3)
+ because this is what the driver vect_transform_loop expects. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "update chain:\n");
+ print_generic_stmt (dump_file, bsi_stmt (*bsi), TDF_SLIM);
+ }
+ bsi_next (bsi);
+ }
+
+ /* The driver function vect_transform_loop expects bsi to point the last
+ scalar stmt that was vectorized. */
+ if (stmt != bsi_stmt (*bsi))
+ abort ();
+
+ return vec_stmt;
+}
+
+
+/* Function vect_transform_load.
+
+ STMT is a load from memory. Create a vectorized stmt to replace it,
+ and insert it at BSI. */
+
+static tree
+vect_transform_load (tree stmt, block_stmt_iterator *bsi)
+{
+ tree vec_stmt;
+ tree scalar_dest;
+ tree vec_dest = NULL;
+ tree data_ref = NULL;
+ tree op;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree new_temp;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "transform load\n");
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ abort ();
+
+ /** Handle def. **/
+
+ scalar_dest = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (scalar_dest) != SSA_NAME)
+ abort ();
+ vec_dest = vect_create_destination_var (scalar_dest, vectype);
+ if (!vec_dest)
+ abort ();
+
+ /** Handle use. **/
+
+ op = TREE_OPERAND (stmt, 1);
+
+ if (TREE_CODE (op) != ARRAY_REF)
+ abort ();
+
+ data_ref = vect_create_data_ref (op, stmt, bsi);
+
+ if (!data_ref)
+ abort ();
+
+ /** Arguments are ready. create the new vector stmt. **/
+
+ vec_stmt = build (MODIFY_EXPR, vectype, vec_dest, data_ref);
+ new_temp = make_ssa_name (vec_dest, vec_stmt);
+ TREE_OPERAND (vec_stmt, 0) = new_temp;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "add new stmt\n");
+ print_generic_stmt (dump_file, vec_stmt, TDF_SLIM);
+ }
+ bsi_insert_before (bsi, vec_stmt, BSI_SAME_STMT);
+
+ if (stmt != bsi_stmt (*bsi))
+ {
+ /* This is expected when an update chain for a data-ref index has been
+ created (by vect_create_index_for_array_ref). The current stmt
+ sequence is as follows:
+
+ (i) some stmt
+ (i+1) vec_stmt (with a data_ref that uses index)
+ (i+2) stmt_to_update_index <-- bsi
+ (i+3) stmt
+
+ The iterator bsi should be bumped to point to stmt at location (i+3)
+ because this is what the driver vect_transform_loop expects. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "update chain:\n");
+ print_generic_stmt (dump_file, bsi_stmt (*bsi), TDF_SLIM);
+ }
+ bsi_next (bsi);
+ }
+
+ /* The driver function vect_transform_loop expects bsi to point the last
+ scalar stmt that was vectorized. */
+ if (stmt != bsi_stmt (*bsi))
+ abort ();
+
+ return vec_stmt;
+}
+
+
+/* Function vect_transform_stmt.
+
+ Create a vectorized stmt to replace STMT, and insert it at BSI. */
+
+static bool
+vect_transform_stmt (tree stmt, block_stmt_iterator *bsi)
+{
+ bool is_store = false;
+ tree vec_stmt = NULL;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+
+ switch (STMT_VINFO_TYPE (stmt_info))
+ {
+ case op_vec_info_type:
+ vec_stmt = vect_transform_op (stmt, bsi);
+ break;
+
+ case assignment_vec_info_type:
+ vec_stmt = vect_transform_assignment (stmt, bsi);
+ break;
+
+ case load_vec_info_type:
+ vec_stmt = vect_transform_load (stmt, bsi);
+ break;
+
+ case store_vec_info_type:
+ vec_stmt = vect_transform_store (stmt, bsi);
+ is_store = true;
+ break;
+
+ default:
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "stmt not supported\n");
+ abort ();
+ }
+
+ STMT_VINFO_VEC_STMT (stmt_info) = vec_stmt;
+
+ return is_store;
+}
+
+
+/* Function vect_transform_loop_bound.
+
+ Create a new exit condition for the loop. */
+
+static void
+vect_transform_loop_bound (loop_vec_info loop_vinfo)
+{
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ edge exit_edge = loop_exit_edge (loop, 0);
+ block_stmt_iterator loop_exit_bsi = bsi_last (exit_edge->src);
+ tree indx_before_incr, indx_after_incr;
+ tree orig_cond_expr;
+ int old_N, vf;
+ tree cond_stmt;
+ tree new_loop_bound;
+
+ /* FORNOW: assuming the loop bound is known. */
+ if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
+ abort ();
+
+ old_N = LOOP_VINFO_NITERS (loop_vinfo);
+ vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+
+ /* FORNOW:
+ assuming number-of-iterations divides by the vectorization factor. */
+ if (old_N % vf)
+ abort ();
+
+ orig_cond_expr = LOOP_VINFO_EXIT_COND (loop_vinfo);
+ if (!orig_cond_expr)
+ abort ();
+ if (orig_cond_expr != bsi_stmt (loop_exit_bsi))
+ abort ();
+
+ create_iv (integer_zero_node, integer_one_node, NULL_TREE, loop,
+ &loop_exit_bsi, false, &indx_before_incr, &indx_after_incr);
+
+ /* CHECKME: bsi_insert is using BSI_NEW_STMT. We need to bump it back
+ to point to the exit condition. */
+ bsi_next (&loop_exit_bsi);
+ if (bsi_stmt (loop_exit_bsi) != orig_cond_expr)
+ abort ();
+
+ /* new loop exit test: */
+ new_loop_bound = build_int_2 (old_N/vf, 0);
+ cond_stmt =
+ build (COND_EXPR, TREE_TYPE (orig_cond_expr),
+ build (LT_EXPR, boolean_type_node, indx_after_incr, new_loop_bound),
+ TREE_OPERAND (orig_cond_expr, 1), TREE_OPERAND (orig_cond_expr, 2));
+
+ bsi_insert_before (&loop_exit_bsi, cond_stmt, BSI_SAME_STMT);
+
+ /* remove old loop exit test: */
+ bsi_remove (&loop_exit_bsi);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ print_generic_expr (dump_file, cond_stmt, TDF_SLIM);
+}
+
+
+/* Function vect_transform_loop.
+
+ The analysis phase has determined that the loop is vectorizable.
+ Vectorize the loop - created vectorized stmts to replace the scalar
+ stmts in the loop, and update the loop exit condition. */
+
+static void
+vect_transform_loop (loop_vec_info loop_vinfo)
+{
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
+ int nbbs = loop->num_nodes;
+ int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+ block_stmt_iterator si;
+ int i;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vec_transform_loop>>\n");
+
+ /* CHECKME: FORNOW the vectorizer supports only loops which body consist
+ of one basic block + header. When the vectorizer will support more
+ involved loop forms, the order by which the BBs are traversed need
+ to be considered. */
+
+ for (i = 0; i < nbbs; i++)
+ {
+ basic_block bb = bbs[i];
+
+ for (si = bsi_start (bb); !bsi_end_p (si);)
+ {
+ tree stmt = bsi_stmt (si);
+ stmt_vec_info stmt_info;
+ tree vectype;
+ bool is_store;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\n-----\nvectorizing statement:\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+
+ stmt_info = vinfo_for_stmt (stmt);
+ if (!stmt_info)
+ abort ();
+
+ if (!STMT_VINFO_RELEVANT_P (stmt_info))
+ {
+ bsi_next (&si);
+ continue;
+ }
+
+ /* FORNOW: Verify that all stmts operate on the same number of
+ units and no inner unrolling is necessary. */
+ vectype = STMT_VINFO_VECTYPE (stmt_info);
+ if (GET_MODE_NUNITS (TYPE_MODE (vectype)) != vectorization_factor)
+ abort ();
+
+ /* -------- vectorize statement ------------ */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "transform statement.\n");
+
+ is_store = vect_transform_stmt (stmt, &si);
+
+ if (is_store)
+ {
+ /* free the attched stmt_vec_info and remove the stmt. */
+ stmt_ann_t ann = stmt_ann (stmt);
+ free (stmt_info);
+ set_stmt_info (ann, NULL);
+
+ bsi_remove (&si);
+ continue;
+ }
+
+ bsi_next (&si);
+
+ } /* stmts in BB */
+ } /* BBs in loop */
+
+
+ vect_transform_loop_bound (loop_vinfo);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<Success! loop vectorized.>>\n");
+}
+
+
+/* Function vect_is_simple_use.
+
+ Return whether the vectorization of a stmt, in LOOP, that uses OPERAND is
+ supportable. OPERANDS that can't be vectorized yet are those defined
+ by a reduction operation or some other form of recurrence.
+ Other OPERANDS - defined in the loop, constants and invariants -
+ are supported. */
+
+static bool
+vect_is_simple_use (tree operand, struct loop *loop)
+{
+ tree def_stmt;
+ basic_block bb;
+
+ if (!operand)
+ return false;
+
+ if (TREE_CODE (operand) == SSA_NAME)
+ {
+ def_stmt = SSA_NAME_DEF_STMT (operand);
+
+ if (def_stmt == NULL_TREE)
+ return false;
+
+ if (TREE_CODE (def_stmt) == NOP_EXPR)
+ {
+ tree arg = TREE_OPERAND (def_stmt, 0);
+
+ if (TREE_CODE (arg) == INTEGER_CST || TREE_CODE (arg) == REAL_CST)
+ return true;
+
+ return false;
+ }
+
+ bb = bb_for_stmt (def_stmt);
+ if (TREE_CODE (def_stmt) == PHI_NODE && flow_bb_inside_loop_p (loop, bb))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "use defined in loop phi - some form of reduction.\n");
+ return false;
+ }
+
+ return true;
+ }
+
+ if (TREE_CODE (operand) == INTEGER_CST
+ || TREE_CODE (operand) == REAL_CST)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+
+/* Function vect_is_supportable_op.
+
+ Verify that STMT performs an operation that can be vectorized. */
+
+static bool
+vect_is_supportable_op (tree stmt)
+{
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree operation;
+ enum tree_code code;
+ tree op;
+ enum machine_mode vec_mode;
+ optab optab;
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ struct loop *loop = STMT_VINFO_LOOP (stmt_info);
+ int i,op_type;
+
+ /* Is op? */
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ return false;
+
+ if (TREE_CODE (TREE_OPERAND (stmt, 0)) != SSA_NAME)
+ return false;
+
+ operation = TREE_OPERAND (stmt, 1);
+ code = TREE_CODE (operation);
+
+ switch (code)
+ {
+ case PLUS_EXPR:
+ optab = add_optab;
+ break;
+ case MULT_EXPR:
+ optab = smul_optab;
+ break;
+ case MINUS_EXPR:
+ optab = sub_optab;
+ break;
+ case BIT_AND_EXPR:
+ optab = and_optab;
+ break;
+ case BIT_XOR_EXPR:
+ optab = xor_optab;
+ break;
+ case BIT_IOR_EXPR:
+ optab = ior_optab;
+ break;
+ case BIT_NOT_EXPR:
+ optab = one_cmpl_optab;
+ break;
+ default:
+ return false;
+ }
+
+ /* Support only unary or binary operations. */
+
+ op_type = tree_nargs[code];
+ if (op_type != unary_op && op_type != binary_op)
+ return false;
+
+ for (i = 0; i < op_type; i++)
+ {
+ op = TREE_OPERAND (operation, i);
+ if (!vect_is_simple_use (op, loop))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "use not simple.\n");
+ return false;
+ }
+ }
+
+ /* Supportable by target? */
+
+ if (!optab)
+ return false;
+
+ vec_mode = TYPE_MODE (vectype);
+
+ if (optab->handlers[(int) vec_mode].insn_code == CODE_FOR_nothing)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "op not supported by target\n");
+ return false;
+ }
+
+ /* FORNOW: Not considering the cost. */
+
+ STMT_VINFO_TYPE (stmt_info) = op_vec_info_type;
+
+ return true;
+}
+
+
+/* Function vect_is_supportable_store.
+
+ Verify that STMT performs a store to memory operation,
+ and can be vectorized. */
+
+static bool
+vect_is_supportable_store (tree stmt)
+{
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree scalar_dest;
+ tree op;
+ struct loop *loop = STMT_VINFO_LOOP (stmt_info);
+
+ /* Is vectorizable store? */
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ return false;
+
+ scalar_dest = TREE_OPERAND (stmt, 0);
+
+ if (TREE_CODE (scalar_dest) != ARRAY_REF)
+ return false;
+
+ op = TREE_OPERAND (stmt, 1);
+
+ if (!vect_is_simple_use (op, loop))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "use not simple.\n");
+ return false;
+ }
+
+ if (!STMT_VINFO_DATA_REF (stmt_info))
+ return false;
+
+ /* Previous analysis steps have already verified that the data ref is
+ vectorizable (w.r.t data dependences, access pattern, etc). */
+
+ /* FORNOW: Not considering the cost. */
+
+ STMT_VINFO_TYPE (stmt_info) = store_vec_info_type;
+
+ return true;
+}
+
+
+/* Function vect_is_supportable_load.
+
+ Verify that STMT performs a load from memory operation,
+ and can be vectorized. */
+
+static bool
+vect_is_supportable_load (tree stmt)
+{
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree scalar_dest;
+ tree op;
+
+ /* Is vectorizable load? */
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ return false;
+
+ scalar_dest = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (scalar_dest) != SSA_NAME)
+ return false;
+
+ op = TREE_OPERAND (stmt, 1);
+
+ if (TREE_CODE (op) != ARRAY_REF)
+ return false;
+
+ if (!STMT_VINFO_DATA_REF (stmt_info))
+ return false;
+
+ /* Previous analysis steps have already verified that the data ref is
+ vectorizable (w.r.t data dependences, access pattern, etc). */
+
+ /* FORNOW: Not considering the cost. */
+
+ STMT_VINFO_TYPE (stmt_info) = load_vec_info_type;
+
+ return true;
+}
+
+
+/* Function vect_is_supportable_assignment.
+
+ Verify that STMT performs an assignment, and can be vectorized. */
+
+static bool
+vect_is_supportable_assignment (tree stmt)
+{
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree scalar_dest;
+ tree op;
+ struct loop *loop = STMT_VINFO_LOOP (stmt_info);
+
+ /* Is vectorizable assignment? */
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ return false;
+
+ scalar_dest = TREE_OPERAND (stmt, 0);
+ if (TREE_CODE (scalar_dest) != SSA_NAME)
+ return false;
+
+ op = TREE_OPERAND (stmt, 1);
+
+ if (!vect_is_simple_use (op, loop))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "use not simple.\n");
+ return false;
+ }
+
+ STMT_VINFO_TYPE (stmt_info) = assignment_vec_info_type;
+
+ return true;
+}
+
+
+/* Function vect_analyze_operations.
+
+ Scan the loop stmts and make sure they are all vectorizable. */
+
+static bool
+vect_analyze_operations (loop_vec_info loop_vinfo)
+{
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
+ int nbbs = loop->num_nodes;
+ block_stmt_iterator si;
+ int vectorization_factor = 0;
+ int i;
+ bool ok;
+ tree scalar_type;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vect_analyze_operations>>\n");
+
+ for (i = 0; i < nbbs; i++)
+ {
+ basic_block bb = bbs[i];
+
+ for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ {
+ tree stmt = bsi_stmt (si);
+ int nunits;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype;
+ dataflow_t df;
+ int j, num_uses;
+ vdef_optype vdefs;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\n-------\nexamining statement:\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+
+ if (!stmt_info)
+ abort ();
+
+ /* skip stmts which do not need to be vectorized.
+ this is expected to include:
+ - the COND_EXPR which is the loop exit condition
+ - any LABEL_EXPRs in the loop
+ - computations that are used only for array indexing or loop
+ control */
+
+ if (!STMT_VINFO_RELEVANT_P (stmt_info))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "irrelevant.\n");
+ continue;
+ }
+
+ /* FORNOW: Make sure that the def of this stmt is not used out
+ side the loop. This restriction will be relaxed in the future. */
+ vdefs = STMT_VDEF_OPS (stmt);
+ if (!vdefs) /* CHECKME */
+ {
+ df = get_immediate_uses (stmt);
+ num_uses = num_immediate_uses (df);
+ for (j = 0; j < num_uses; j++)
+ {
+ tree use = immediate_use (df, j);
+ basic_block bb = bb_for_stmt (use);
+ if (!flow_bb_inside_loop_p (loop, bb))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "def used out of loop:\n");
+ print_generic_stmt (dump_file, use, TDF_SLIM);
+ }
+ return false;
+ }
+ }
+ }
+
+ if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (stmt))))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "vector stmt in loop!\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+
+ if (STMT_VINFO_DATA_REF (stmt_info))
+ scalar_type = TREE_TYPE (DR_REF (STMT_VINFO_DATA_REF (stmt_info)));
+ else
+ scalar_type = TREE_TYPE (stmt);
+ vectype = get_vectype_for_scalar_type (scalar_type);
+ if (!vectype)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "no vectype for stmt.\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+ STMT_VINFO_VECTYPE (stmt_info) = vectype;
+
+ ok = (vect_is_supportable_op (stmt)
+ || vect_is_supportable_assignment (stmt)
+ || vect_is_supportable_load (stmt)
+ || vect_is_supportable_store (stmt));
+
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "stmt not supported.\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+
+ nunits = GET_MODE_NUNITS (TYPE_MODE (vectype));
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "nunits = %d\n", nunits);
+
+ if (vectorization_factor)
+ {
+ /* FORNOW: don't allow mixed units.
+ This restriction will be relaxed in the future. */
+ if (nunits != vectorization_factor)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "mixed types unsupported.\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+ }
+ else
+ vectorization_factor = nunits;
+ }
+ }
+
+ /* TODO: Analayze cost. Decide if worth while to vectorize. */
+
+ LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
+
+ /* FORNOW: handle only cases where the loop bound divides by the
+ vectorization factor. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "vectorization_factor = %d, niters = %d\n",
+ vectorization_factor, LOOP_VINFO_NITERS (loop_vinfo));
+
+ if (vectorization_factor == 0
+ || !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ || LOOP_VINFO_NITERS (loop_vinfo) % vectorization_factor != 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "loop bound unknown or doesn't divide by %d\n",
+ vectorization_factor);
+ return false;
+ }
+
+ return true;
+}
+
+
+/* Function exist_non_indexing_operands_for_use_p
+
+ USE is one of the uses attached to STMT. Check if USE is
+ used in STMT for anything other than indexing an array. */
+
+static bool
+exist_non_indexing_operands_for_use_p (tree use, tree stmt)
+{
+ tree operand;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "exist_non_indexing_operands_for_use_p?:\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+
+ /* USE corresponds to some operand in STMT. If there is no data
+ reference in STMT, then any operand that corresponds to USE
+ is not indexing an array. */
+ if (!STMT_VINFO_DATA_REF (stmt_info))
+ return true;
+
+ /* STMT has a data_ref. FORNOW this means that its of one of
+ the following forms:
+ -1- ARRAY_REF = var
+ -2- var = ARRAY_REF
+ (This should have been verified in analyze_data_refs).
+
+ 'var' in the second case corresponds to a def, not a use,
+ so USE cannot correspond to any operands that are not used
+ for array indexing.
+
+ Therefore, all we need to check is if STMT falls into the
+ first case, and whether var corresponds to USE. */
+
+ if (TREE_CODE (TREE_OPERAND (stmt, 0)) == SSA_NAME)
+ return false;
+
+ operand = TREE_OPERAND (stmt, 1);
+
+ if (TREE_CODE (operand) != SSA_NAME)
+ return false;
+
+ if (operand == use)
+ return true;
+
+ return false;
+}
+
+
+/* Function vect_is_simple_iv_evolution.
+
+ FORNOW: A simple evolution of an induction variables in the loop is
+ considered a polynomial evolution with step 1. */
+
+static bool
+vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
+ tree * step, bool strict)
+{
+ tree init_expr;
+ tree step_expr;
+
+ tree evolution_part = evolution_part_in_loop_num (access_fn, loop_nb);
+
+ /* When there is no evolution in this loop, the evolution function
+ is not "simple". */
+ if (evolution_part == NULL_TREE)
+ return false;
+
+ /* When the evolution is a polynomial of degree >= 2 or
+ exponential, the evolution function is not "simple". */
+ if (TREE_CODE (evolution_part) == POLYNOMIAL_CHREC
+ || TREE_CODE (evolution_part) == EXPONENTIAL_CHREC)
+ return false;
+
+ step_expr = evolution_part;
+ init_expr = initial_condition (access_fn);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\nstep: ");
+ print_generic_expr (dump_file, step_expr, TDF_SLIM);
+ fprintf (dump_file, "\ninit: ");
+ print_generic_expr (dump_file, init_expr, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+ *init = init_expr;
+ *step = step_expr;
+
+ if (TREE_CODE (step_expr) != INTEGER_CST)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nstep unknown.\n");
+ return false;
+ }
+
+ if (strict)
+ if (!integer_onep (step_expr))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ print_generic_expr (dump_file, step_expr, TDF_SLIM);
+ return false;
+ }
+
+ return true;
+}
+
+
+/* Function vect_analyze_scalar_cycles.
+
+ Examine the cross iteration def-use cycles of scalar variables, by
+ analyzing the loop (scalar) PHIs; verify that the cross iteration def-use
+ cycles that they represent do not impede vectorization.
+
+ FORNOW: Reduction as in the following loop, is not supported yet:
+ loop1:
+ for (i=0; i<N; i++)
+ sum += a[i];
+ The cross-iteration cycle corresponding to variable 'sum' will be
+ considered too complicated and will impede vectorization.
+
+ FORNOW: Induction as in the following loop, is not supported yet:
+ loop2:
+ for (i=0; i<N; i++)
+ a[i] = i;
+
+ However, the following loop *is* vectorizable:
+ loop3:
+ for (i=0; i<N; i++)
+ a[i] = b[i];
+
+ In both loops there exists a def-use cycle for the variable i:
+ loop: i_2 = PHI (i_0, i_1)
+ a[i_2] = ...;
+ i_1 = i_2 + 1;
+ GOTO loop;
+
+ The evolution of the above cycle is considered simple enough,
+ however, we also check that the cycle does not need to be
+ vectorized, i.e - we check that the variable that this cycle
+ defines is only used for array indexing or in stmts that do not
+ need to be vectorized. This is not the case in loop2, but it
+ *is* the case in loop3. */
+
+static bool
+vect_analyze_scalar_cycles (loop_vec_info loop_vinfo)
+{
+ tree phi;
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ basic_block bb = loop->header;
+ tree dummy;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vect_analyze_scalar_evolutions>>\n");
+
+ for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ {
+#if 0
+ int i;
+ int num_uses;
+ dataflow_t df;
+#endif
+ tree access_fn = NULL;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Analyze phi\n");
+ print_generic_expr (dump_file, phi, TDF_SLIM);
+ }
+
+ /* Skip virtual phi's. The data dependences that are associated with
+ virtual defs/uses (i.e., memory accesses) are analyzed elsewhere. */
+
+ /* CHECKME: correct way to check for a virtual phi? */
+
+ if (!is_gimple_reg (SSA_NAME_VAR (PHI_RESULT (phi))))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "virtual phi. skip.\n");
+ continue;
+ }
+
+ /* Analyze the evolution function. */
+
+ /* FORNOW: The only scalar cross-iteration cycles that we allow are
+ those of the loop induction variable;
+ Furthermore, if that induction variable is used in an operation
+ that needs to be vectorized (i.e, is not solely used to index
+ arrays and check the exit condition) - we do not support its
+ vectorization Yet. */
+
+ /* 1. Verify that it is an IV with a simple enough access pattern. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "analyze cycles: call monev analyzer!\n");
+
+ access_fn = instantiate_parameters
+ (loop,
+ analyze_scalar_evolution (loop, PHI_RESULT (phi)));
+
+ if (!access_fn)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "No Access function.");
+ return false;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Access function of PHI: ");
+ print_generic_expr (dump_file, access_fn, TDF_SLIM);
+ }
+
+ if (!vect_is_simple_iv_evolution (loop_num (loop), access_fn, &dummy,
+ &dummy, false))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "unsupported cross iter cycle.\n");
+ return false;
+ }
+
+#if 0 /* following check is now performed in "vect_is_simple_use" */
+
+ /* 2. Verify that this variable is only used in stmts that do not need
+ to be vectorized.
+ FIXME: the following checks should be applied to other defs in
+ this def-use cycle (not just to the phi result). */
+
+ df = get_immediate_uses (phi);
+ num_uses = num_immediate_uses (df);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "num uses = %d\n", num_uses);
+ for (i = 0; i < num_uses; i++)
+ {
+ tree use = immediate_use (df, i);
+ stmt_vec_info stmt_info = vinfo_for_stmt (use);
+
+ if (!stmt_info)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\nused out side the loop??\n");
+ print_generic_expr (dump_file, use, TDF_SLIM);
+ }
+ return false;
+ }
+
+ if (STMT_VINFO_RELEVANT_P (stmt_info)
+ && exist_non_indexing_operands_for_use_p (PHI_RESULT (phi), use))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file,
+ "\ninduction vectorization. Unsupported.\n");
+ print_generic_expr (dump_file, use, TDF_SLIM);
+ }
+ return false;
+ }
+ }
+
+#endif
+
+ }
+
+ return true;
+}
+
+
+/* Function get_array_base.
+
+ Return the base of the array_ref EXPR. */
+
+static tree
+get_array_base (tree expr)
+{
+ tree expr1;
+ if (TREE_CODE (expr) != ARRAY_REF)
+ abort ();
+
+ expr1 = TREE_OPERAND (expr, 0);
+ while (TREE_CODE (expr1) == ARRAY_REF)
+ expr1 = TREE_OPERAND (expr1, 0);
+
+ return expr1;
+}
+
+
+/* Function vect_analyze_data_ref_dependence.
+
+ Return TRUE if there (might) exist a dependence between a memory-reference
+ DRA and a memory-reference DRB. */
+
+static bool
+vect_analyze_data_ref_dependence (struct data_reference *dra,
+ struct data_reference *drb)
+{
+ /* FORNOW: use most trivial and conservative test. */
+
+ /* CHECKME: this test holds only if the array base is not a pointer.
+ This had been verified by analyze_data_refs.
+ This restriction will be relaxed in the future. */
+
+ if (!array_base_name_differ_p (dra, drb))
+ {
+ enum data_dependence_direction ddd =
+ ddg_direction_between_stmts (DR_STMT (dra), DR_STMT (drb),
+ loop_num (loop_of_stmt (DR_STMT (dra))));
+
+ if (ddd == dir_independent)
+ return true;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "vect_analyze_data_ref_dependence: same base\n");
+ return false;
+ }
+
+ return true;
+}
+
+
+/* Function vect_analyze_data_ref_dependences.
+
+ Examine all the data references in the loop, and make sure there do not
+ exist any data dependences between them.
+
+ FORNOW: We do not construct a data dependence graph and try to deal with
+ dependences, but fail at the first data dependence that we
+ encounter.
+
+ FORNOW: We only handle array references.
+
+ FORNOW: We apply a trivial conservative dependence test. */
+
+static bool
+vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo)
+{
+ unsigned int i, j;
+ varray_type loop_write_refs = LOOP_VINFO_DATAREF_WRITES (loop_vinfo);
+ varray_type loop_read_refs = LOOP_VINFO_DATAREF_READS (loop_vinfo);
+
+ /* examine store-store (output) dependences */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "compare all store-store pairs\n");
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_write_refs); i++)
+ {
+ for (j = i + 1; j < VARRAY_ACTIVE_SIZE (loop_write_refs); j++)
+ {
+ struct data_reference *dra =
+ VARRAY_GENERIC_PTR (loop_write_refs, i);
+ struct data_reference *drb =
+ VARRAY_GENERIC_PTR (loop_write_refs, j);
+ bool ok = vect_analyze_data_ref_dependence (dra, drb);
+ if (!ok)
+ return false;
+ }
+ }
+
+ /* examine load-store (true/anti) dependences */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "compare all load-store pairs\n");
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_read_refs); i++)
+ {
+ for (j = 0; j < VARRAY_ACTIVE_SIZE (loop_write_refs); j++)
+ {
+ struct data_reference *dra = VARRAY_GENERIC_PTR (loop_read_refs, i);
+ struct data_reference *drb =
+ VARRAY_GENERIC_PTR (loop_write_refs, j);
+ bool ok = vect_analyze_data_ref_dependence (dra, drb);
+ if (!ok)
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+/* Function vect_get_array_first_index.
+
+ REF is an array reference. Find the lower bound of the array dimension and
+ return it in ARRAY_FIRST_INDEX (e.g, 0 in C arrays, 1 in Fortran arrays
+ (unless defined otherwise). At the moment, gfortran arrays are represented
+ with a poiner which points to one element lower than the array base, so
+ ARRAY_FIRST_INDEX is currently 0 also for Fortran arrays).
+ Return TRUE if such lower bound was found, and FLASE otherwise. */
+
+static bool
+vect_get_array_first_index (tree ref, int *array_first_index)
+{
+ tree array_start;
+ tree array_base_type;
+ int array_start_val;
+
+ array_base_type = TREE_TYPE (TREE_OPERAND (ref, 0));
+ if (! TYPE_DOMAIN (array_base_type))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "no domain for array base type\n");
+ print_generic_expr (dump_file, array_base_type, TDF_DETAILS);
+ }
+ return false;
+ }
+
+ array_start = TYPE_MIN_VALUE (TYPE_DOMAIN (array_base_type));
+ if (TREE_CODE (array_start) != INTEGER_CST)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "array min val not integer cst\n");
+ print_generic_expr (dump_file, array_start, TDF_DETAILS);
+ }
+ return false;
+ }
+
+ if (TREE_INT_CST_HIGH (array_start) != 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "array min val CST_HIGH != 0\n");
+ return false;
+ }
+
+ array_start_val = TREE_INT_CST_LOW (array_start);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_generic_expr (dump_file, array_start, TDF_DETAILS);
+ fprintf (dump_file, "\narray min val = %d\n", array_start_val);
+ }
+
+ *array_first_index = array_start_val;
+
+ return true;
+}
+
+
+/* Function vect_compute_data_ref_alignment
+
+ Compute the mislignment of the data reference DR.
+
+ FOR NOW: No analysis is actually performed. Misalignment is calculated
+ only for trivial cases. TODO. */
+
+static void
+vect_compute_data_ref_alignment (struct data_reference *dr,
+ loop_vec_info loop_vinfo ATTRIBUTE_UNUSED)
+{
+ tree stmt = DR_STMT (dr);
+ tree ref = DR_REF (dr);
+ tree vectype;
+ tree access_fn = DR_ACCESS_FN (dr, 0); /* CHECKME */
+ tree init;
+ int init_val;
+ tree scalar_type;
+ int misalign;
+ int array_start_val;
+ bool ok;
+
+ /* Initialize misalignment to unknown. */
+ DR_MISALIGNMENT (dr) = -1;
+
+
+ /* In the special case of an array which alignment can be forced, we may be
+ able to compute more informative information. */
+
+ if (!vect_force_dr_alignment_p (dr))
+ return;
+
+ init = initial_condition (access_fn);
+
+ /* FORNOW: In order to simplify the handling of alignment, we make sure
+ that the first location at which the array is accessed ('init') is on an
+ 'NUNITS' boundary, since we are assuming here that the alignment of the
+ 'array base' is aligned. This is too conservative, since we require that
+ both {'array_base' is a multiple of NUNITS} && {'init' is a multiple of
+ NUNITS}, instead of just {('array_base' + 'init') is a multiple of NUNITS}.
+ This should be relaxed in the future. */
+
+ if (init && TREE_CODE (init) != INTEGER_CST)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "init not INTEGER_CST\n");
+ return;
+ }
+
+ /* CHECKME */
+ if (TREE_INT_CST_HIGH (init) != 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "init CST_HIGH != 0\n");
+ return;
+ }
+
+ init_val = TREE_INT_CST_LOW (init);
+
+ scalar_type = TREE_TYPE (ref);
+ vectype = get_vectype_for_scalar_type (scalar_type);
+ if (!vectype)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "no vectype for stmt: ");
+ print_generic_expr (dump_file, stmt, TDF_SLIM);
+ fprintf (dump_file, "\nscalar_type: ");
+ print_generic_expr (dump_file, scalar_type, TDF_DETAILS);
+ fprintf (dump_file, "\n");
+ }
+ return;
+ }
+
+ ok = vect_get_array_first_index (ref, &array_start_val);
+ if (!ok)
+ return;
+
+ misalign = (init_val - array_start_val) %
+ GET_MODE_NUNITS (TYPE_MODE (vectype));
+
+ DR_MISALIGNMENT (dr) = misalign;
+
+ return;
+}
+
+
+/* Function vect_compute_data_refs_alignment
+
+ Compute the mislignment of data references in the loop.
+ This pass may take place at function granularity instead of at loop
+ granularity.
+
+ FOR NOW: No analysis is actually performed. Misalignment is calculated
+ only for trivial cases. TODO. */
+
+static void
+vect_compute_data_refs_alignment (loop_vec_info loop_vinfo)
+{
+ varray_type loop_write_datarefs = LOOP_VINFO_DATAREF_WRITES (loop_vinfo);
+ varray_type loop_read_datarefs = LOOP_VINFO_DATAREF_READS (loop_vinfo);
+ unsigned int i;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_write_datarefs); i++)
+ {
+ struct data_reference *dr = VARRAY_GENERIC_PTR (loop_write_datarefs, i);
+ vect_compute_data_ref_alignment (dr, loop_vinfo);
+ }
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_read_datarefs); i++)
+ {
+ struct data_reference *dr = VARRAY_GENERIC_PTR (loop_read_datarefs, i);
+ vect_compute_data_ref_alignment (dr, loop_vinfo);
+ }
+
+ return;
+}
+
+
+/* Function vect_enhance_data_refs_alignment
+
+ This pass will use loop versioning and loop peeling in order to enhance
+ the alignment of data references in the loop.
+
+ FOR NOW: we assume that whatever versioning/peeling takes place, only the
+ original loop is to be vectorized; Any other loops that are created by
+ the transformations performed in this pass - are not supposed to be
+ vectorized. This restriction will be relaxed.
+
+ FOR NOW: No transformation is actually performed. TODO. */
+
+static void
+vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo ATTRIBUTE_UNUSED)
+{
+ /*
+ This pass will require a cost model to guide it whether to apply peeling
+ or versioning or a combination of the two. For example, the scheme that
+ intel uses when given a loop with several memory accesses, is as follows:
+ choose one memory access ('p') which alignment you want to force by doing
+ peeling. Then, either (1) generate a loop in which 'p' is aligned and all
+ other accesses are not necessarily aligned, or (2) use loop versioning to
+ generate one loop in which all accesses are aligned, and another loop in
+ which only 'p' is necessarily aligned.
+
+ ("Automatic Intra-Register Vectorization for the Intel Architecture",
+ Aart J.C. Bik, Milind Girkar, Paul M. Grey and Ximmin Tian, International
+ Journal of Parallel Programming, Vol. 30, No. 2, April 2002.)
+
+ Devising a cost model is the most critical aspect of this work. It will
+ guide us on which access to peel for, whether to use loop versioning, how
+ many versions to create, etc. The cost model will probably consist of
+ generic considerations as well as target specific considerations (on
+ powerpc for example, misaligned stores are more painful than misaligned
+ loads).
+
+ Here is the general steps involved in alignment enhancements:
+
+ -- original loop, before alignment analysis:
+ for (i=0; i<N; i++){
+ x = q[i]; # DR_MISALIGNMENT(q) = unknown
+ p[i] = y; # DR_MISALIGNMENT(p) = unknown
+ }
+
+ -- After vect_compute_data_refs_alignment:
+ for (i=0; i<N; i++){
+ x = q[i]; # DR_MISALIGNMENT(q) = 3
+ p[i] = y; # DR_MISALIGNMENT(p) = unknown
+ }
+
+ -- Possibility 1: we do loop versioning:
+ if (p is aligned) {
+ for (i=0; i<N; i++){ # loop 1A
+ x = q[i]; # DR_MISALIGNMENT(q) = 3
+ p[i] = y; # DR_MISALIGNMENT(p) = 0
+ }
+ }
+ else {
+ for (i=0; i<N; i++){ # loop 1B
+ x = q[i]; # DR_MISALIGNMENT(q) = 3
+ p[i] = y; # DR_MISALIGNMENT(p) = unaligned
+ }
+ }
+
+ -- Possibility 2: we do loop peeling:
+ for (i = 0; i < 3; i++){ # (scalar loop, not to be vectorized).
+ x = q[i];
+ p[i] = y;
+ }
+ for (i = 3; i < N; i++){ # loop 2A
+ x = q[i]; # DR_MISALIGNMENT(q) = 0
+ p[i] = y; # DR_MISALIGNMENT(p) = unknown
+ }
+
+ -- Possibility 3: combination of loop peeling and versioning:
+ for (i = 0; i < 3; i++){ # (scalar loop, not to be vectorized).
+ x = q[i];
+ p[i] = y;
+ }
+ if (p is aligned) {
+ for (i = 3; i<N; i++){ # loop 3A
+ x = q[i]; # DR_MISALIGNMENT(q) = 0
+ p[i] = y; # DR_MISALIGNMENT(p) = 0
+ }
+ }
+ else {
+ for (i = 3; i<N; i++){ # loop 3B
+ x = q[i]; # DR_MISALIGNMENT(q) = 0
+ p[i] = y; # DR_MISALIGNMENT(p) = unaligned
+ }
+ }
+
+ These loops are later passed to loop_transform to be vectorized. The
+ vectorizer will use the alignment information to guide the transformation
+ (whether to generate regular loads/stores, or with special handling for
+ misalignment).
+ */
+
+ return;
+}
+
+
+/* Function vect_analyze_data_refs_alignment
+
+ Analyze the alignment of the data-references in the loop.
+ FOR NOW: Until support fot misliagned accesses is in place, only if all
+ accesses are aligned can the loop be vectorized. This restruction will be
+ relaxed. */
+
+static bool
+vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo)
+{
+ varray_type loop_write_datarefs = LOOP_VINFO_DATAREF_WRITES (loop_vinfo);
+ varray_type loop_read_datarefs = LOOP_VINFO_DATAREF_READS (loop_vinfo);
+ unsigned int i;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vect_analyze_data_refs_alignment>>\n");
+
+
+ /* This pass may take place at function granularity instead of at loop
+ granularity. */
+
+ vect_compute_data_refs_alignment (loop_vinfo);
+
+
+ /* This pass will use loop versioning and loop peeling in order to enhance
+ the alignment of data references in the loop.
+ FOR NOW: we assume that whatever versioning/peeling took place, the
+ original loop is to be vectorized. Any other loops that were created by
+ the transformations performed in this pass - are not supposed to be
+ vectorized. This restriction will be relaxed. */
+
+ vect_enhance_data_refs_alignment (loop_vinfo);
+
+
+ /* Finally, check that loop can be vectorized.
+ FOR NOW: Until support fot misliagned accesses is in place, only if all
+ accesses are aligned can the loop be vectorized. This restruction will be
+ relaxed. */
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_write_datarefs); i++)
+ {
+ struct data_reference *dr = VARRAY_GENERIC_PTR (loop_write_datarefs, i);
+ if (!aligned_access_p (dr))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "first access not aligned.\n");
+ return false;
+ }
+ }
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_read_datarefs); i++)
+ {
+ struct data_reference *dr = VARRAY_GENERIC_PTR (loop_read_datarefs, i);
+ if (!aligned_access_p (dr))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "first access not aligned.\n");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+/* Function vect_analyze_data_ref_access.
+
+ Analyze the access pattern of the data-reference DR. For now, a data access
+ has to consecutive and aligned to be considered vectorizable. */
+
+static bool
+vect_analyze_data_ref_access (struct data_reference *dr)
+{
+ varray_type access_fns = DR_ACCESS_FNS (dr);
+ tree access_fn;
+ tree init, step;
+
+ /* FORNOW: handle only one dimensional arrays.
+ This restriction will be relaxed in the future. */
+ if (VARRAY_ACTIVE_SIZE (access_fns) != 1)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "multi dimensional array reference.\n");
+ return false;
+ }
+ access_fn = DR_ACCESS_FN (dr, 0);
+
+ if (!vect_is_simple_iv_evolution (loop_num (loop_of_stmt (DR_STMT (dr))),
+ access_fn, &init, &step, true))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "too complicated access function\n");
+ print_generic_expr (dump_file, access_fn, TDF_SLIM);
+ }
+ return false;
+ }
+
+ return true;
+}
+
+
+/* Function vect_analyze_data_ref_accesses.
+
+ Analyze the access pattern of all the data references in the loop.
+
+ FORNOW: the only access pattern that is considered vectorizable is a
+ simple step 1 (consecutive) access.
+
+ FORNOW: handle only one dimensional arrays. */
+
+static bool
+vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo)
+{
+ unsigned int i;
+ varray_type loop_write_datarefs = LOOP_VINFO_DATAREF_WRITES (loop_vinfo);
+ varray_type loop_read_datarefs = LOOP_VINFO_DATAREF_READS (loop_vinfo);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vect_analyze_data_ref_accesses>>\n");
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_write_datarefs); i++)
+ {
+ struct data_reference *dr = VARRAY_GENERIC_PTR (loop_write_datarefs, i);
+ bool ok = vect_analyze_data_ref_access (dr);
+ if (!ok)
+ return false;
+ }
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (loop_read_datarefs); i++)
+ {
+ struct data_reference *dr = VARRAY_GENERIC_PTR (loop_read_datarefs, i);
+ bool ok = vect_analyze_data_ref_access (dr);
+ if (!ok)
+ return false;
+ }
+
+ return true;
+}
+
+
+/* Function vect_analyze_data_refs.
+
+ Find all the data references in the loop.
+
+ FORNOW: Handle only one dimensional ARRAY_REFs which base is really an
+ array (not a pointer) which alignment can be forced. This
+ restriction will be relaxed. */
+
+static bool
+vect_analyze_data_refs (loop_vec_info loop_vinfo)
+{
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
+ int nbbs = loop->num_nodes;
+ block_stmt_iterator si;
+ int j;
+ struct data_reference *dr;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vect_analyze_data_refs>>\n");
+
+ for (j = 0; j < nbbs; j++)
+ {
+ basic_block bb = bbs[j];
+ for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ {
+ tree stmt = bsi_stmt (si);
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ vdef_optype vdefs = STMT_VDEF_OPS (stmt);
+ vuse_optype vuses = STMT_VUSE_OPS (stmt);
+ varray_type *datarefs = NULL;
+ int nvuses = 0, nvdefs = 0;
+ tree ref = NULL;
+ tree array_base;
+
+ /* CHECKME: Relying on the fact that there exists a data-ref
+ in stmt, if and only if it has vuses/vdefs. */
+
+ if (!vuses && !vdefs)
+ continue;
+
+ if (vuses)
+ nvuses = NUM_VUSES (vuses);
+ if (vdefs)
+ nvdefs = NUM_VDEFS (vdefs);
+
+ if (nvuses + nvdefs != 1)
+ {
+ /* CHECKME: multiple vdefs/vuses in a GIMPLE stmt are
+ assumed to indicate a non vectorizable stmt (e.g, ASM,
+ CALL_EXPR) or the presence of an aliasing problem. The
+ first case is ruled out during vect_analyze_operations;
+ As for the second case, currently the vuses/vdefs are
+ meaningless as they are too conservative. We therefore
+ ignore them. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Warning: multiple vops!\n");
+ print_generic_stmt (dump_file, stmt,
+ ~(TDF_RAW | TDF_SLIM | TDF_LINENO));
+ }
+ }
+
+ if (TREE_CODE (stmt) != MODIFY_EXPR)
+ {
+ /* CHECKME: a vdef/vuse in a GIMPLE stmt is assumed to
+ appear only in a MODIFY_EXPR. */
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "unexpected vops in stmt\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+
+ if (vuses)
+ {
+ if (TREE_CODE (TREE_OPERAND (stmt, 1)) == ARRAY_REF)
+ {
+ ref = TREE_OPERAND (stmt, 1);
+ datarefs = &(LOOP_VINFO_DATAREF_READS (loop_vinfo));
+ }
+ }
+
+ if (vdefs)
+ {
+ if (TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_REF)
+ {
+ ref = TREE_OPERAND (stmt, 0);
+ datarefs = &(LOOP_VINFO_DATAREF_WRITES (loop_vinfo));
+ }
+ }
+
+ if (!ref)
+ {
+ /* A different type of data reference (pointer?, struct?)
+ FORNOW: Do not attempt to handle. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "unhandled non-array data ref\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+
+ dr = analyze_array (stmt, ref);
+
+ array_base = TREE_OPERAND (ref, 0);
+
+ /* FORNOW: make sure that the array is one dimensional.
+ This restriction will be relaxed in the future. */
+ if (TREE_CODE (array_base) == ARRAY_REF)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "unhandled 2D-array data ref\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+
+ VARRAY_PUSH_GENERIC_PTR (*datarefs, dr);
+ STMT_VINFO_DATA_REF (stmt_info) = dr;
+ }
+ }
+
+ return true;
+}
+
+
+/* Utility functions used by vect_mark_stmts_to_be_vectorized.
+ Implementation inspired by tree-ssa-dce.c. */
+
+/* Function vect_mark_relevant.
+
+ Mark STMT as "relevant for vectorization" and add it to WORKLIST. */
+
+static void
+vect_mark_relevant (varray_type worklist, tree stmt)
+{
+ stmt_vec_info stmt_info;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "mark relevant.\n");
+
+ if (TREE_CODE (stmt) == PHI_NODE)
+ {
+ VARRAY_PUSH_TREE (worklist, stmt);
+ return;
+ }
+
+ stmt_info = vinfo_for_stmt (stmt);
+
+ if (!stmt_info)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "mark relevant: no stmt info!!\n");
+ print_generic_expr (dump_file, stmt, TDF_SLIM);
+ }
+ return;
+ }
+
+ if (STMT_VINFO_RELEVANT_P (stmt_info))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "already marked relevant.\n");
+ return;
+ }
+
+ STMT_VINFO_RELEVANT_P (stmt_info) = 1;
+ VARRAY_PUSH_TREE (worklist, stmt);
+}
+
+
+/* Function vect_stmt_relevant_p.
+
+ Return true if STMT in loop that is represented by LOOP_VINFO is
+ "relevant for vectorization".
+
+ A stmt is considered "relevant for vectorization" if:
+ - it has uses outside the loop.
+ - it has vdefs (it alters memory).
+ - control stmts in the loop (except for the exit condition).
+
+ CHECKME: what other side effects would the vectorizer allow? */
+
+static bool
+vect_stmt_relevant_p (tree stmt, loop_vec_info loop_vinfo)
+{
+ vdef_optype vdefs;
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ int i;
+ dataflow_t df;
+ int num_uses;
+
+ /* cond stmt other than loop exit cond. */
+ if (is_ctrl_stmt (stmt) && (stmt != LOOP_VINFO_EXIT_COND (loop_vinfo)))
+ return true;
+
+ /* changing memory. */
+ vdefs = STMT_VDEF_OPS (stmt);
+ if (vdefs)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "vec_stmt_relevant_p: stmt has vdefs:\n");
+ return true;
+ }
+
+ /* uses outside the loop. */
+ df = get_immediate_uses (stmt);
+ num_uses = num_immediate_uses (df);
+ for (i = 0; i < num_uses; i++)
+ {
+ tree use = immediate_use (df, i);
+ basic_block bb = bb_for_stmt (use);
+ if (!flow_bb_inside_loop_p (loop, bb))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "vec_stmt_relevant_p: used out of loop:\n");
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+/* Function vect_mark_stmts_to_be_vectorized.
+
+ Not all stmts in the loop need to be vectorized. For example:
+
+ for i...
+ for j...
+ 1. T0 = i + j
+ 2. T1 = a[T0]
+
+ 3. j = j + 1
+
+ Stmt 1 and 3 do not need to be vectorized, because loop control and
+ addressing of vectorized data-refs are handled differently.
+
+ This pass detects such stmts. */
+
+static bool
+vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
+{
+ varray_type worklist;
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
+ unsigned int nbbs = loop->num_nodes;
+ block_stmt_iterator si;
+ tree stmt;
+ stmt_ann_t ann;
+ unsigned int i;
+ int j;
+ use_optype use_ops;
+ stmt_vec_info stmt_info;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vect_mark_stmts_to_be_vectorized>>\n");
+
+ VARRAY_TREE_INIT (worklist, 64, "work list");
+
+ /* 1. Init worklist. */
+
+ for (i = 0; i < nbbs; i++)
+ {
+ basic_block bb = bbs[i];
+ for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+ {
+ stmt = bsi_stmt (si);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "init: stmt relevant?\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+
+ stmt_info = vinfo_for_stmt (stmt);
+ STMT_VINFO_RELEVANT_P (stmt_info) = 0;
+
+ if (vect_stmt_relevant_p (stmt, loop_vinfo))
+ vect_mark_relevant (worklist, stmt);
+ }
+ }
+
+
+ /* 2. Process_worklist */
+
+ while (VARRAY_ACTIVE_SIZE (worklist) > 0)
+ {
+ stmt = VARRAY_TOP_TREE (worklist);
+ VARRAY_POP (worklist);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "worklist: examine stmt:\n");
+ print_generic_stmt (dump_file, stmt, TDF_SLIM);
+ }
+
+ /* Examine the USES in this statement. Mark all the statements which
+ feed this statement's uses as "relevant", unless the USE is used as
+ an array index. */
+
+ if (TREE_CODE (stmt) == PHI_NODE)
+ {
+ /* follow the def-use chain inside the loop. */
+ for (j = 0; j < PHI_NUM_ARGS (stmt); j++)
+ {
+ tree arg = PHI_ARG_DEF (stmt, j);
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ tree def_stmt = NULL_TREE;
+ basic_block bb;
+
+ if (TREE_CODE (arg) == SSA_NAME)
+ def_stmt = SSA_NAME_DEF_STMT (arg);
+
+ if (def_stmt == NULL_TREE )
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nworklist: no def_stmt!\n");
+ varray_clear (worklist);
+ return false;
+ }
+
+ if (TREE_CODE (def_stmt) == NOP_EXPR)
+ {
+ tree arg = TREE_OPERAND (def_stmt, 0);
+ if (TREE_CODE (arg) != INTEGER_CST
+ && TREE_CODE (arg) != REAL_CST)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nworklist: NOP def_stmt?\n");
+ varray_clear (worklist);
+ return false;
+ }
+ continue;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\nworklist: def_stmt:\n");
+ print_generic_expr (dump_file, def_stmt, TDF_SLIM);
+ }
+
+ bb = bb_for_stmt (def_stmt);
+ if (flow_bb_inside_loop_p (loop, bb))
+ vect_mark_relevant (worklist, def_stmt);
+ }
+ }
+
+ continue;
+ }
+
+ ann = stmt_ann (stmt);
+ use_ops = USE_OPS (ann);
+
+ for (i = 0; i < NUM_USES (use_ops); i++)
+ {
+ tree use = USE_OP (use_ops, i);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\nworklist: examine use %d:\n", i);
+ print_generic_expr (dump_file, use, TDF_SLIM);
+ }
+
+ if (exist_non_indexing_operands_for_use_p (use, stmt))
+ {
+ tree def_stmt = NULL_TREE;
+ basic_block bb;
+
+ if (TREE_CODE (use) == SSA_NAME)
+ def_stmt = SSA_NAME_DEF_STMT (use);
+
+ if (def_stmt == NULL_TREE)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nworklist: no def_stmt!\n");
+ varray_clear (worklist);
+ return false;
+ }
+
+ if (TREE_CODE (def_stmt) == NOP_EXPR)
+ {
+ tree arg = TREE_OPERAND (def_stmt, 0);
+ if (TREE_CODE (arg) != INTEGER_CST
+ && TREE_CODE (arg) != REAL_CST)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nworklist: NOP def_stmt?\n");
+ varray_clear (worklist);
+ return false;
+ }
+ continue;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\nworklist: def_stmt:\n");
+ print_generic_expr (dump_file, def_stmt, TDF_SLIM);
+ }
+
+ bb = bb_for_stmt (def_stmt);
+ if (flow_bb_inside_loop_p (loop, bb))
+ vect_mark_relevant (worklist, def_stmt);
+ }
+ }
+
+ } /* while worklist */
+
+ varray_clear (worklist);
+ return true;
+}
+
+
+/* Function vect_get_loop_niters.
+
+ Determine how many iterations the loop is executed. */
+
+static tree
+vect_get_loop_niters (struct loop *loop, int *number_of_iterations)
+{
+ tree niters;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<get_loop_niters>>\n");
+
+ niters = number_of_iterations_in_loop (loop);
+
+ if (niters != NULL_TREE
+ && TREE_CODE (niters) == INTEGER_CST)
+ {
+ *number_of_iterations = TREE_INT_CST_LOW (niters);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "get_loop_niters: %d.\n",
+ *number_of_iterations);
+ }
+
+ return get_loop_exit_condition (loop);
+}
+
+
+/* Function vect_analyze_loop_form.
+
+ Verify the following restrictions:
+ Some of these maybe relaxed in the future.
+
+ - it's an inner-most loop
+ - number of BBs = 2 (which are the loop header and the latch)
+ - the loop has a pre header
+ - the loop has a single entry and exit
+ - the loop exit condition is simple enough */
+
+static loop_vec_info
+vect_analyze_loop_form (struct loop *loop)
+{
+ loop_vec_info loop_vinfo;
+ tree loop_cond;
+ int number_of_iterations = -1;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n<<vect_analyze_loop_form>>\n");
+
+ if (loop->level > 1 /* FORNOW: inner-most loop (CHECKME) */
+ || loop->num_exits > 1 || loop->num_entries > 1 || loop->num_nodes != 2
+ || !loop->pre_header || !loop->header || !loop->latch)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file,
+ "loop_analyzer: bad loop form (entry/exit, nbbs, level...)\n");
+ flow_loop_dump (loop, dump_file, NULL, 1);
+ }
+
+ return NULL;
+ }
+
+ loop_cond = vect_get_loop_niters (loop, &number_of_iterations);
+ if (!loop_cond)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Complicated exit condition.\n");
+ return NULL;
+ }
+
+ if (number_of_iterations < 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Can't determine num iters.\n");
+ return NULL;
+ }
+
+ /* CHECKME: check monev analyzer. */
+ if (number_of_iterations == 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "0 iterations??\n");
+ return NULL;
+ }
+
+ loop_vinfo = new_loop_vec_info (loop);
+
+ LOOP_VINFO_EXIT_COND (loop_vinfo) = loop_cond;
+ LOOP_VINFO_NITERS (loop_vinfo) = number_of_iterations;
+
+ return loop_vinfo;
+}
+
+
+/* Function vect_analyze_loop.
+
+ Apply a set of analyses on LOOP, and create a loop_vec_info struct
+ for it. The different analyses will record information in the
+ loop_vec_info struct. */
+
+static loop_vec_info
+vect_analyze_loop (struct loop *loop)
+{
+ bool ok;
+ loop_vec_info loop_vinfo;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n\n\n<<<<<<< analyze_loop_nest >>>>>>>\n");
+
+ /* Check the CFG characteristics of the loop (nesting, entry/exit, etc. */
+
+ loop_vinfo = vect_analyze_loop_form (loop);
+ if (!loop_vinfo)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: bad loop form.\n");
+ return NULL;
+ }
+
+ /* Find all data references in the loop (which correspond to vdefs/vuses)
+ and analyze their evolution in the loop.
+
+ FORNOW: Handle only simple, one-dimensional, array references, which
+ alignment can be forced. */
+
+ ok = vect_analyze_data_refs (loop_vinfo);
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: bad data references.\n");
+ destroy_loop_vec_info (loop_vinfo);
+ return NULL;
+ }
+
+
+ /* Data-flow analysis to detect stmts that do not need to be vectorized. */
+
+ ok = vect_mark_stmts_to_be_vectorized (loop_vinfo);
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: unexpected pattern.\n");
+ destroy_loop_vec_info (loop_vinfo);
+ return NULL;
+ }
+
+
+ /* Check that all cross-iteration scalar data-flow cycles are OK.
+ Cross-iteration cycles caused by virtual phis are analyzed separately. */
+
+ ok = vect_analyze_scalar_cycles (loop_vinfo);
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: bad scalar cycle.\n");
+ destroy_loop_vec_info (loop_vinfo);
+ return NULL;
+ }
+
+
+ /* Analyze data dependences between the data-refs in the loop.
+ FORNOW: We do not construct a data dependence graph and try to deal
+ with dependences, but fail at the first data dependence that
+ we encounter. */
+
+ ok = vect_analyze_data_ref_dependences (loop_vinfo);
+
+ /* TODO: May want to generate run time pointer aliasing checks and
+ loop versioning. */
+
+ /* TODO: May want to perform loop transformations to break dependence
+ cycles. */
+
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: bad data dependence.\n");
+ destroy_loop_vec_info (loop_vinfo);
+ return NULL;
+ }
+
+
+ /* Analyze the access patterns of the data-refs in the loop (consecutive,
+ complex, etc.). FORNOW: Only handle consecutive access pattern. */
+
+ ok = vect_analyze_data_ref_accesses (loop_vinfo);
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: bad data access.\n");
+ destroy_loop_vec_info (loop_vinfo);
+ return NULL;
+ }
+
+
+ /* Analyze the alignment of the data-refs in the loop.
+ FORNOW: Only aligned accesses are handled. */
+
+ ok = vect_analyze_data_refs_alignment (loop_vinfo);
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: bad data alignment.\n");
+ destroy_loop_vec_info (loop_vinfo);
+ return NULL;
+ }
+
+
+ /* Scan all the operations in the loop and make sure they are
+ vectorizable. */
+
+ ok = vect_analyze_operations (loop_vinfo);
+ if (!ok)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "loop_analyzer: bad operations.\n");
+ destroy_loop_vec_info (loop_vinfo);
+ return NULL;
+ }
+
+ /* TODO: May want to collapse conditional code and loop versioning. */
+
+ /* TODO: Alignment: May want to perform loop peeling and/or run time
+ tests and loop versioning. */
+
+ LOOP_VINFO_VECTORIZABLE_P (loop_vinfo) = 1;
+
+ return loop_vinfo;
+}
+
+
+/* Function indicating whether we ought to include information for 'var'
+ when calculating immediate uses. For this pass we only want use
+ information for non-virtual variables. */
+
+static bool
+need_imm_uses_for (tree var)
+{
+ return is_gimple_reg (var);
+}
+
+
+/* Function vectorize_loops.
+ Entry Point to loop vectorization phase. */
+
+void
+vectorize_loops (struct loops *loops)
+{
+ unsigned int i;
+ unsigned int num_vectorized_loops = 0;
+
+ /* Does the target support SIMD? */
+ /* FORNOW: until more sophisticated machine modelling is in place. */
+ if (!UNITS_PER_SIMD_WORD)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "vectorizer: target vector size is not defined.\n");
+ return;
+ }
+
+ compute_immediate_uses (TDFA_USE_OPS, need_imm_uses_for);
+
+ /* ----------- Analyze loops. ----------- */
+ /* CHECKME */
+ for (i = 1; i < loops->num; i++)
+ {
+ loop_vec_info loop_vinfo;
+ struct loop *loop = loops->parray[i];
+
+ flow_loop_scan (loop, LOOP_ALL);
+
+ loop_vinfo = vect_analyze_loop (loop);
+ loop->aux = loop_vinfo;
+
+#ifndef ANALYZE_ALL_THEN_VECTORIZE_ALL
+ if (!loop_vinfo || !LOOP_VINFO_VECTORIZABLE_P (loop_vinfo))
+ continue;
+
+ vect_transform_loop (loop_vinfo);
+ num_vectorized_loops++;
+#endif
+ }
+
+#ifdef ANALYZE_ALL_THEN_VECTORIZE_ALL
+ for (i = 1; i < loops->num; i++)
+ {
+ struct loop *loop = loops->parray[i];
+ loop_vec_info loop_vinfo = loop->aux;
+
+ if (!loop_vinfo || !LOOP_VINFO_VECTORIZABLE_P (loop_vinfo))
+ continue;
+
+ vect_transform_loop (loop_vinfo);
+ num_vectorized_loops++;
+ }
+#endif
+
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, "vectorized %u loops in function.\n",
+ num_vectorized_loops);
+
+ /* ----------- Finialize. ----------- */
+
+ free_df ();
+ for (i = 1; i < loops->num; i++)
+ {
+ struct loop *loop = loops->parray[i];
+ loop_vec_info loop_vinfo = loop->aux;
+ destroy_loop_vec_info (loop_vinfo);
+ loop->aux = NULL;
+ }
+}
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
new file mode 100644
index 00000000000..4778fe684b5
--- /dev/null
+++ b/gcc/tree-vectorizer.h
@@ -0,0 +1,179 @@
+/* Loop Vectorization
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Dorit Naishlos <dorit@il.ibm.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_TREE_VECTORIZER_H
+#define GCC_TREE_VECTORIZER_H
+
+/* Used for naming of new temporaries. */
+enum vect_var_kind {
+ vect_simple_var,
+ vect_pointer_var
+};
+
+/* Defines type of operation: unary or binary. */
+enum operation_type {
+ unary_op = 1,
+ binary_op
+};
+
+/*-----------------------------------------------------------------*/
+/* Info on vectorized defs. */
+/*-----------------------------------------------------------------*/
+enum stmt_vec_info_type {
+ undef_vec_info_type = 0,
+ load_vec_info_type,
+ store_vec_info_type,
+ op_vec_info_type,
+ assignment_vec_info_type
+};
+
+typedef struct _stmt_vec_info {
+
+ enum stmt_vec_info_type type;
+
+ /* The stmt to which this info struct refers to. */
+ tree stmt;
+
+ /* The loop with resprct to which STMT is vectorized. */
+ struct loop *loop;
+
+ /* Not all stmts in the loop need to be vectorized. e.g, the incrementation
+ of the loop induction variable and computation of array indexes. relevant
+ indicates whether the stmt needs to be vectorized. */
+ bool relevant;
+
+ /* The vector type to be used. */
+ tree vectype;
+
+ /* The vectorized version of the stmt. */
+ tree vectorized_stmt;
+
+ /* Relevant only for array accesses;
+ A GIMPLE stmt is expected to have at most 1 array access. */
+
+ struct data_reference *data_ref_info;
+} *stmt_vec_info;
+
+/* Access Functions. */
+#define STMT_VINFO_TYPE(S) (S)->type
+#define STMT_VINFO_STMT(S) (S)->stmt
+#define STMT_VINFO_LOOP(S) (S)->loop
+#define STMT_VINFO_RELEVANT_P(S) (S)->relevant
+#define STMT_VINFO_VECTYPE(S) (S)->vectype
+#define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
+#define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
+
+static inline void set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info);
+static inline stmt_vec_info vinfo_for_stmt (tree stmt);
+
+static inline void
+set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info)
+{
+ if (ann)
+ ann->common.aux = (char *) stmt_info;
+}
+
+static inline stmt_vec_info
+vinfo_for_stmt (tree stmt)
+{
+ stmt_ann_t ann = stmt_ann (stmt);
+ return ann ? (stmt_vec_info) ann->common.aux : NULL;
+}
+
+/*-----------------------------------------------------------------*/
+/* Info on data references alignment. */
+/*-----------------------------------------------------------------*/
+
+#define DR_MISALIGNMENT(DR) (DR)->aux
+
+static inline bool
+aligned_access_p (struct data_reference *data_ref_info)
+{
+ return (DR_MISALIGNMENT (data_ref_info) == 0);
+}
+
+static inline bool
+unknown_alignment_for_access_p (struct data_reference *data_ref_info)
+{
+ return (DR_MISALIGNMENT (data_ref_info) == -1);
+}
+
+
+/*-----------------------------------------------------------------*/
+/* Info on vectorized loops. */
+/*-----------------------------------------------------------------*/
+typedef struct _loop_vec_info {
+
+ /* The loop to which this info struct refers to. */
+ struct loop *loop;
+
+ /* The loop basic blocks. */
+ basic_block *bbs;
+
+ /* The loop exit_condition. */
+ tree exit_cond;
+
+ /* Number of iterations. -1 if unknown. */
+ int num_iters;
+
+ /* Is the loop vectorizable? */
+ bool vectorizable;
+
+ /* Unrolling factor */
+ int vectorization_factor;
+
+ /* All data references in the loop that are being written to. */
+ varray_type data_ref_writes;
+
+ /* All data references in the loop that are being read from. */
+ varray_type data_ref_reads;
+} *loop_vec_info;
+
+/* Access Functions. */
+#define LOOP_VINFO_LOOP(L) (L)->loop
+#define LOOP_VINFO_BBS(L) (L)->bbs
+#define LOOP_VINFO_EXIT_COND(L) (L)->exit_cond
+#define LOOP_VINFO_NITERS(L) (L)->num_iters
+#define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
+#define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
+#define LOOP_VINFO_DATAREF_WRITES(L) (L)->data_ref_writes
+#define LOOP_VINFO_DATAREF_READS(L) (L)->data_ref_reads
+
+#define LOOP_VINFO_NITERS_KNOWN_P(L) ((L)->num_iters > 0)
+
+/*-----------------------------------------------------------------*/
+/* Function prototypes. */
+/*-----------------------------------------------------------------*/
+
+/* Main driver. */
+extern void vectorize_loops (struct loops *);
+
+/* creation and deletion of loop and stmt info structs. */
+extern loop_vec_info new_loop_vec_info (struct loop *loop);
+extern void destroy_loop_vec_info (loop_vec_info);
+extern stmt_vec_info new_stmt_vec_info (tree stmt, struct loop *loop);
+
+/* FORNOW: analyze and then vectorize each loop, rather than first analyzing all
+ loops and then vetorizing all loops, which we may want to do in the future
+ (for example, to exploit data reuse across loops?). */
+#undef ANALYZE_ALL_THEN_VECTORIZE_ALL
+
+#endif /* GCC_TREE_VECTORIZER_H */
diff --git a/gcc/tree.c b/gcc/tree.c
index 5cc8967ede9..1a410787af5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -94,7 +94,8 @@ struct type_hash GTY(())
};
/* Initial size of the hash table (rounded to next prime). */
-#define TYPE_HASH_INITIAL_SIZE 1000
+/* APPLE LOCAL fsf candidate */
+#define TYPE_HASH_INITIAL_SIZE 4111
/* Now here is the hash table. When recording a type, it is added to
the slot whose index is the hash code. Note that the hash table is
@@ -464,6 +465,8 @@ build_vector (tree type, tree vals)
{
tree value = TREE_VALUE (link);
+ /* APPLE LOCAL AltiVec */
+ TREE_VALUE (link) = fold (value);
over1 |= TREE_OVERFLOW (value);
over2 |= TREE_CONSTANT_OVERFLOW (value);
}
@@ -2471,6 +2474,8 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
/* Expressions without side effects may be constant if their
arguments are as well. */
constant = (TREE_CODE_CLASS (code) == '<'
+ /* APPLE LOCAL Altivec */
+ || TREE_CODE_CLASS (code) == 'e'
|| TREE_CODE_CLASS (code) == '2');
read_only = 1;
side_effects = TREE_SIDE_EFFECTS (t);
@@ -5026,6 +5031,27 @@ finish_vector_type (tree t)
}
}
+static tree
+make_or_reuse_type (unsigned size, int unsignedp)
+{
+ if (size == INT_TYPE_SIZE)
+ return unsignedp ? unsigned_type_node : integer_type_node;
+ if (size == CHAR_TYPE_SIZE)
+ return unsignedp ? unsigned_char_type_node : signed_char_type_node;
+ if (size == SHORT_TYPE_SIZE)
+ return unsignedp ? short_unsigned_type_node : short_integer_type_node;
+ if (size == LONG_TYPE_SIZE)
+ return unsignedp ? long_unsigned_type_node : long_integer_type_node;
+ if (size == LONG_LONG_TYPE_SIZE)
+ return (unsignedp ? long_long_unsigned_type_node
+ : long_long_integer_type_node);
+
+ if (unsignedp)
+ return make_unsigned_type (size);
+ else
+ return make_signed_type (size);
+}
+
/* Create nodes for all integer types (and error_mark_node) using the sizes
of C datatypes. The caller should call set_sizetype soon after calling
this function to select one of the types as sizetype. */
@@ -5068,17 +5094,19 @@ build_common_tree_nodes (int signed_char)
TREE_TYPE (TYPE_MAX_VALUE (boolean_type_node)) = boolean_type_node;
TYPE_PRECISION (boolean_type_node) = 1;
- intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
- intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
- intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
- intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode));
- intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode));
-
- unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode));
- unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode));
- unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
- unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
- unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode));
+ /* Fill in the rest of the sized types. Reuse existing type nodes
+ when possible. */
+ intQI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (QImode), 0);
+ intHI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (HImode), 0);
+ intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 0);
+ intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 0);
+ intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 0);
+
+ unsigned_intQI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (QImode), 1);
+ unsigned_intHI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (HImode), 1);
+ unsigned_intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 1);
+ unsigned_intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 1);
+ unsigned_intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 1);
access_public_node = get_identifier ("public");
access_protected_node = get_identifier ("protected");
@@ -5170,40 +5198,6 @@ build_common_tree_nodes_2 (int short_double)
va_list_type_node = t;
}
-
- unsigned_V4SI_type_node
- = make_vector (V4SImode, unsigned_intSI_type_node, 1);
- unsigned_V2HI_type_node
- = make_vector (V2HImode, unsigned_intHI_type_node, 1);
- unsigned_V2SI_type_node
- = make_vector (V2SImode, unsigned_intSI_type_node, 1);
- unsigned_V2DI_type_node
- = make_vector (V2DImode, unsigned_intDI_type_node, 1);
- unsigned_V4HI_type_node
- = make_vector (V4HImode, unsigned_intHI_type_node, 1);
- unsigned_V8QI_type_node
- = make_vector (V8QImode, unsigned_intQI_type_node, 1);
- unsigned_V8HI_type_node
- = make_vector (V8HImode, unsigned_intHI_type_node, 1);
- unsigned_V16QI_type_node
- = make_vector (V16QImode, unsigned_intQI_type_node, 1);
- unsigned_V1DI_type_node
- = make_vector (V1DImode, unsigned_intDI_type_node, 1);
-
- V16SF_type_node = make_vector (V16SFmode, float_type_node, 0);
- V4SF_type_node = make_vector (V4SFmode, float_type_node, 0);
- V4SI_type_node = make_vector (V4SImode, intSI_type_node, 0);
- V2HI_type_node = make_vector (V2HImode, intHI_type_node, 0);
- V2SI_type_node = make_vector (V2SImode, intSI_type_node, 0);
- V2DI_type_node = make_vector (V2DImode, intDI_type_node, 0);
- V4HI_type_node = make_vector (V4HImode, intHI_type_node, 0);
- V8QI_type_node = make_vector (V8QImode, intQI_type_node, 0);
- V8HI_type_node = make_vector (V8HImode, intHI_type_node, 0);
- V2SF_type_node = make_vector (V2SFmode, float_type_node, 0);
- V2DF_type_node = make_vector (V2DFmode, double_type_node, 0);
- V16QI_type_node = make_vector (V16QImode, intQI_type_node, 0);
- V1DI_type_node = make_vector (V1DImode, intDI_type_node, 0);
- V4DF_type_node = make_vector (V4DFmode, double_type_node, 0);
}
/* HACK. GROSS. This is absolutely disgusting. I wish there was a
@@ -5252,23 +5246,38 @@ reconstruct_complex_type (tree type, tree bottom)
return outer;
}
-/* Returns a vector tree node given a vector mode, the inner type, and
- the signness. */
-
+/* Returns a vector tree node given a vector mode, the inner type. */
tree
-make_vector (enum machine_mode mode, tree innertype, int unsignedp)
+build_vector_type_for_mode (tree innertype, enum machine_mode mode)
{
tree t;
-
t = make_node (VECTOR_TYPE);
TREE_TYPE (t) = innertype;
TYPE_MODE (t) = mode;
- TREE_UNSIGNED (TREE_TYPE (t)) = unsignedp;
finish_vector_type (t);
-
return t;
}
+/* Similarly, but takes inner type and units. */
+
+tree
+build_vector_type (tree innertype, int nunits)
+{
+ enum machine_mode innermode = TYPE_MODE (innertype);
+ enum machine_mode mode;
+
+ if (GET_MODE_CLASS (innermode) == MODE_FLOAT)
+ mode = MIN_MODE_VECTOR_FLOAT;
+ else
+ mode = MIN_MODE_VECTOR_INT;
+
+ for (; mode != VOIDmode ; mode = GET_MODE_WIDER_MODE (mode))
+ if (GET_MODE_NUNITS (mode) == nunits && GET_MODE_INNER (mode) == innermode)
+ return build_vector_type_for_mode (innertype, mode);
+
+ return NULL_TREE;
+}
+
/* Given an initializer INIT, return TRUE if INIT is zero or some
aggregate of zeros. Otherwise return FALSE. */
@@ -5349,6 +5358,34 @@ is_essa_node (tree t)
return false;
}
+/* Checks whether IDX is in array bounds for ARRAY. */
+
+bool
+in_array_bounds_p (tree array, tree idx)
+{
+ tree dom = TYPE_DOMAIN (TREE_TYPE (array));
+ tree min, max;
+
+ if (TREE_CODE (idx) != INTEGER_CST)
+ return false;
+
+ if (!dom)
+ return false;
+
+ min = TYPE_MIN_VALUE (dom);
+ max = TYPE_MAX_VALUE (dom);
+ if (!min
+ || !max
+ || TREE_CODE (min) != INTEGER_CST
+ || TREE_CODE (max) != INTEGER_CST)
+ return false;
+
+ if (tree_int_cst_lt (idx, min)
+ || tree_int_cst_lt (max, idx))
+ return false;
+
+ return true;
+}
/* Return true if T (assumed to be a DECL) must be assigned a memory
location. */
diff --git a/gcc/tree.def b/gcc/tree.def
index 064d0806f32..79ca63551f5 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -908,6 +908,25 @@ DEFTREECODE (CATCH_EXPR, "catch_expr", 's', 2)
expanding. */
DEFTREECODE (EH_FILTER_EXPR, "eh_filter_expr", 's', 2)
+/* Chains of recurrences. */
+
+/* Intervals.
+ Under the form: cr = [CHREC_LOW (cr), CHREC_UP (cr)].
+ CHREC_LOW and CHREC_UP contain INTEGER_CST nodes. */
+DEFTREECODE (INTERVAL_CHREC, "interval_chrec", 'e', 2)
+
+/* Polynomial chains of recurrences.
+ Under the form: cr = {CHREC_LEFT (cr), +, CHREC_RIGHT (cr)}. */
+DEFTREECODE (POLYNOMIAL_CHREC, "polynomial_chrec", 'e', 3)
+
+/* Exponential chains of recurrences.
+ Under the form: cr = {CHREC_LEFT (cr), *, CHREC_RIGHT (cr)}. */
+DEFTREECODE (EXPONENTIAL_CHREC, "exponential_chrec", 'e', 3)
+
+/* Peeled chains of recurrences.
+ Under the form: (CHREC_LEFT (cr), CHREC_RIGHT (cr)). */
+DEFTREECODE (PEELED_CHREC, "peeled_chrec", 'e', 3)
+
/* Used to chain children of container statements together.
Use the interface in tree-iterator.h to access this node. */
DEFTREECODE (STATEMENT_LIST, "statement_list", 'x', 0)
diff --git a/gcc/tree.h b/gcc/tree.h
index 0e875e0a851..fd9af02e14f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -180,6 +180,9 @@ struct tree_common GTY(())
unsigned lang_flag_5 : 1;
unsigned lang_flag_6 : 1;
unsigned visited : 1;
+
+ /* APPLE LOCAL unavailable (Radar 2809697) ilr */
+ unsigned unavailable_flag : 1;
};
/* The following table lists the uses of each of the above flags and
@@ -270,6 +273,9 @@ struct tree_common GTY(())
INTEGER_TYPE, ENUMERAL_TYPE, FIELD_DECL
SAVE_EXPR_NOPLACEHOLDER in
SAVE_EXPR
+ APPLE LOCAL weak import
+ IDENTIFIER_WEAK_IMPORT in
+ IDENTIFIER
asm_written_flag:
@@ -295,6 +301,13 @@ struct tree_common GTY(())
TREE_DEPRECATED in
..._DECL
+ APPLE LOCAL begin unavailable (Radar 2809697) ilr
+ unavailable_flag:
+
+ TREE_UNAVAILABLE in
+ ..._DECL
+ APPLE LOCAL end unavailable ilr
+
visited:
Used in tree traversals to mark visited nodes.
@@ -754,6 +767,12 @@ extern void tree_operand_check_failed (int, enum tree_code,
deprecated feature by __attribute__((deprecated)). */
#define TREE_DEPRECATED(NODE) ((NODE)->common.deprecated_flag)
+/* APPLE LOCAL begin unavailable (Radar 2809697) ilr */
+/* Nonzero in a IDENTIFIER_NODE if the use of the name is defined as a
+ unavailable feature by __attribute__((unavailable)). */
+#define TREE_UNAVAILABLE(NODE) ((NODE)->common.unavailable_flag)
+/* APPLE LOCAL end unavailable ilr */
+
/* Value of expression is function invariant. A strict subset of
TREE_CONSTANT, such an expression is constant over any one function
invocation, though not across different invocations. May appear in
@@ -1100,8 +1119,8 @@ struct tree_phi_node GTY(())
/* Nonzero if the PHI node was rewritten by a previous pass through the
SSA renamer. */
- int rewritten;
-
+ unsigned int rewritten:1;
+
struct phi_arg_d GTY ((length ("((tree)&%h)->phi.capacity"))) a[1];
};
@@ -2000,6 +2019,21 @@ struct tree_type GTY(())
/* Used to indicate that this DECL has weak linkage. */
#define DECL_WEAK(NODE) (DECL_CHECK (NODE)->decl.weak_flag)
+/* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+/* Used to indicate that this DECL has weak-import linkage. */
+#define DECL_WEAK_IMPORT(NODE) (DECL_CHECK (NODE)->decl.weak_import_flag)
+/* The same information in IDENTIFIERs. */
+#define IDENTIFIER_WEAK_IMPORT(NODE) (IDENTIFIER_NODE_CHECK (NODE)->common.unsigned_flag)
+/* APPLE LOCAL end weak_import (Radar 2809704) ilr */
+
+/* APPLE LOCAL coalescing */
+/* "coalesced" symbols are similar to, but have more restrictions than,
+ ELF-style "weak" symbols. */
+#define DECL_COALESCED(NODE) (DECL_CHECK (NODE)->decl.coalesced_flag)
+
+/* APPLE LOCAL handling duplicate decls across files */
+#define DECL_DUPLICATE_DECL(NODE) (DECL_CHECK (NODE)->decl.duplicate_decl)
+
/* Used in TREE_PUBLIC decls to indicate that copies of this DECL in
multiple translation units should be merged. */
#define DECL_ONE_ONLY(NODE) (DECL_CHECK (NODE)->decl.transparent_union)
@@ -2064,6 +2098,15 @@ struct tree_type GTY(())
#define DECL_POINTER_ALIAS_SET_KNOWN_P(NODE) \
(DECL_POINTER_ALIAS_SET (NODE) != - 1)
+/* APPLE LOCAL begin */
+/* In a FUNCTION_DECL for which DECL_BUILT_IN does not hold, this is
+ the approximate number of statements in this function. There is
+ no need for this number to be exact; it is only used in various
+ heuristics regarding optimization. */
+#define DECL_ESTIMATED_INSNS(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->decl.u1.i)
+/* APPLE LOCAL end */
+
/* Nonzero for a decl which is at file scope. */
#define DECL_FILE_SCOPE_P(EXP) \
(! DECL_CONTEXT (EXP) \
@@ -2142,7 +2185,14 @@ struct tree_decl GTY(())
unsigned lang_flag_7 : 1;
unsigned needs_to_live_in_memory : 1;
- /* 15 unused bits. */
+ /* APPLE LOCAL weak_import (Radar 2809704) ilr */
+ unsigned weak_import_flag : 1;
+ /* APPLE LOCAL coalescing */
+ unsigned coalesced_flag : 1;
+ /* APPLE LOCAL duplicate decls in different files */
+ unsigned duplicate_decl : 1;
+ /* APPLE LOCAL unused bits */
+ /* 12 unused bits. */
union tree_decl_u1 {
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
@@ -2336,33 +2386,6 @@ enum tree_index
TI_VOID_LIST_NODE,
- TI_UV4SF_TYPE,
- TI_UV4SI_TYPE,
- TI_UV8HI_TYPE,
- TI_UV8QI_TYPE,
- TI_UV4HI_TYPE,
- TI_UV2HI_TYPE,
- TI_UV2SI_TYPE,
- TI_UV2SF_TYPE,
- TI_UV2DI_TYPE,
- TI_UV1DI_TYPE,
- TI_UV16QI_TYPE,
-
- TI_V4SF_TYPE,
- TI_V16SF_TYPE,
- TI_V4SI_TYPE,
- TI_V8HI_TYPE,
- TI_V8QI_TYPE,
- TI_V4HI_TYPE,
- TI_V2HI_TYPE,
- TI_V2SI_TYPE,
- TI_V2SF_TYPE,
- TI_V2DF_TYPE,
- TI_V2DI_TYPE,
- TI_V1DI_TYPE,
- TI_V16QI_TYPE,
- TI_V4DF_TYPE,
-
TI_MAIN_IDENTIFIER,
TI_MAX
@@ -2438,31 +2461,6 @@ extern GTY(()) tree global_trees[TI_MAX];
#define main_identifier_node global_trees[TI_MAIN_IDENTIFIER]
#define MAIN_NAME_P(NODE) (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node)
-#define unsigned_V16QI_type_node global_trees[TI_UV16QI_TYPE]
-#define unsigned_V4SI_type_node global_trees[TI_UV4SI_TYPE]
-#define unsigned_V8QI_type_node global_trees[TI_UV8QI_TYPE]
-#define unsigned_V8HI_type_node global_trees[TI_UV8HI_TYPE]
-#define unsigned_V4HI_type_node global_trees[TI_UV4HI_TYPE]
-#define unsigned_V2HI_type_node global_trees[TI_UV2HI_TYPE]
-#define unsigned_V2SI_type_node global_trees[TI_UV2SI_TYPE]
-#define unsigned_V2DI_type_node global_trees[TI_UV2DI_TYPE]
-#define unsigned_V1DI_type_node global_trees[TI_UV1DI_TYPE]
-
-#define V16QI_type_node global_trees[TI_V16QI_TYPE]
-#define V4SF_type_node global_trees[TI_V4SF_TYPE]
-#define V4SI_type_node global_trees[TI_V4SI_TYPE]
-#define V8QI_type_node global_trees[TI_V8QI_TYPE]
-#define V8HI_type_node global_trees[TI_V8HI_TYPE]
-#define V4HI_type_node global_trees[TI_V4HI_TYPE]
-#define V2HI_type_node global_trees[TI_V2HI_TYPE]
-#define V2SI_type_node global_trees[TI_V2SI_TYPE]
-#define V2SF_type_node global_trees[TI_V2SF_TYPE]
-#define V2DI_type_node global_trees[TI_V2DI_TYPE]
-#define V2DF_type_node global_trees[TI_V2DF_TYPE]
-#define V16SF_type_node global_trees[TI_V16SF_TYPE]
-#define V1DI_type_node global_trees[TI_V1DI_TYPE]
-#define V4DF_type_node global_trees[TI_V4DF_TYPE]
-
/* An enumeration of the standard C integer types. These must be
ordered so that shorter types appear before longer ones, and so
that signed types appear before unsigned ones, for the correct
@@ -2671,6 +2669,8 @@ extern tree build_pointer_type_for_mode (tree, enum machine_mode);
extern tree build_pointer_type (tree);
extern tree build_reference_type_for_mode (tree, enum machine_mode);
extern tree build_reference_type (tree);
+extern tree build_vector_type_for_mode (tree, enum machine_mode);
+extern tree build_vector_type (tree innertype, int nunits);
extern tree build_type_no_quals (tree);
extern tree build_index_type (tree);
extern tree build_index_2_type (tree, tree);
@@ -2681,7 +2681,9 @@ extern tree build_method_type_directly (tree, tree, tree);
extern tree build_method_type (tree, tree);
extern tree build_offset_type (tree, tree);
extern tree build_complex_type (tree);
+extern tree build_vector_type (tree, int);
extern tree array_type_nelts (tree);
+extern bool in_array_bounds_p (tree, tree);
extern tree value_member (tree, tree);
extern tree purpose_member (tree, tree);
@@ -2783,6 +2785,10 @@ enum attribute_flags
name indicates known behavior, and should be silently ignored if they
are not in fact compatible with the function type. */
ATTR_FLAG_BUILT_IN = 16
+ /* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+ /* The attributes are being applied to a function definition. */
+ ,ATTR_FLAG_FUNCTION_DEF = 16
+ /* APPLE LOCAL end weak_import ilr */
};
/* Default versions of target-overridable functions. */
@@ -3367,6 +3373,8 @@ extern tree nondestructive_fold_unary_to_constant (enum tree_code, tree, tree);
extern tree nondestructive_fold_binary_to_constant (enum tree_code, tree, tree, tree);
extern tree fold_read_from_constant_string (tree);
extern tree int_const_binop (enum tree_code, tree, tree, int);
+extern enum tree_code invert_tree_comparison (enum tree_code);
+extern enum tree_code swap_tree_comparison (enum tree_code);
/* In builtins.c */
extern tree fold_builtin (tree);
diff --git a/gcc/unroll.c b/gcc/unroll.c
index a61137cfee9..35a411c4daf 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -1116,7 +1116,7 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p)
/* If reach here, and the loop type is UNROLL_NAIVE, then don't unroll
the loop unless all loops are being unrolled. */
- if (unroll_type == UNROLL_NAIVE && ! flag_old_unroll_all_loops)
+ if (unroll_type == UNROLL_NAIVE && ! flag_unroll_all_loops)
{
if (loop_dump_stream)
fprintf (loop_dump_stream,
diff --git a/gcc/varasm.c b/gcc/varasm.c
index d2126fd2bae..db57db28d79 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -50,6 +50,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "target.h"
#include "tree-mudflap.h"
#include "cgraph.h"
+/* APPLE LOCAL begin hot/cold partitioning */
+#include "cfglayout.h"
+/* APPLE LOCAl end hot/cold partitioning */
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h" /* Needed for external data
@@ -97,6 +100,23 @@ int size_directive_output;
tree last_assemble_variable_decl;
+/* APPLE LOCAL begin hot/cold partitioning */
+/* The following global variable indicates if the section label for the
+ "cold" section of code has been output yet to the assembler. The
+ label is useful when running gdb. This is part of the optimization that
+ partitions hot and cold basic blocks into separate sections of the .o
+ file. */
+
+bool unlikely_section_label_printed = false;
+
+/* The following global variable indicates the label name to be put at
+ the start of the first cold section within each function, when
+ partitioning basic blocks into hot and cold sections. */
+
+char *unlikely_section_label = NULL;
+
+/* APPLE LOCAL end hot/cold partitioning */
+
/* RTX_UNCHANGING_P in a MEM can mean it is stored into, for initialization.
So giving constant the alias set for the type will allow such
initializations to appear to conflict with the load of the constant. We
@@ -142,7 +162,10 @@ static bool asm_emit_uninitialised (tree, const char*,
unsigned HOST_WIDE_INT);
static void mark_weak (tree);
-enum in_section { no_section, in_text, in_data, in_named
+/* APPLE LOCAL begin hot/cold partitioning */
+enum in_section { no_section, in_text, in_unlikely_executed_text, in_data,
+ in_named
+/* APPLE LOCAL end hot/cold partitioning */
#ifdef BSS_SECTION_ASM_OP
, in_bss
#endif
@@ -195,9 +218,37 @@ text_section (void)
if (in_section != in_text)
{
in_section = in_text;
+ /* APPLE LOCAL begin hot/cold partitioning */
fprintf (asm_out_file, "%s\n", TEXT_SECTION_ASM_OP);
+ assemble_align (FUNCTION_BOUNDARY);
+ /* APPLE LOCAL end hot/cold partitioning */
+ }
+}
+
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Tell assembler to switch to unlikely-to-be-executed text section. */
+
+void
+unlikely_text_section (void)
+{
+ if ((in_section != in_unlikely_executed_text)
+ && (in_section != in_named
+ || strcmp (in_named_name, UNLIKELY_EXECUTED_TEXT_SECTION_NAME) != 0))
+ {
+ named_section (NULL_TREE, UNLIKELY_EXECUTED_TEXT_SECTION_NAME, 0);
+ assemble_align (FUNCTION_BOUNDARY);
+ in_section = in_unlikely_executed_text;
+
+ if (!unlikely_section_label_printed)
+ {
+ ASM_OUTPUT_LABEL (asm_out_file, unlikely_section_label);
+ unlikely_section_label_printed = true;
+ free (unlikely_section_label);
+ unlikely_section_label = NULL;
+ }
}
}
+/* APPLE LOCAL end hot/cold partitioning */
/* Tell assembler to switch to data section. */
@@ -241,6 +292,23 @@ in_text_section (void)
return in_section == in_text;
}
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Determine if we're in the unlikely-to-be-executed text section. */
+
+int
+in_unlikely_text_section (void)
+{
+ bool ret_val;
+
+ ret_val = ((in_section == in_unlikely_executed_text)
+ || (in_section == in_named
+ && (strcmp (in_named_name, UNLIKELY_EXECUTED_TEXT_SECTION_NAME)
+ == 0)));
+
+ return ret_val;
+}
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Determine if we're in the data section. */
int
@@ -480,11 +548,15 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
void
function_section (tree decl)
{
+ /* APPLE LOCAL begin hot/cold partitioning */
if (decl != NULL_TREE
&& DECL_SECTION_NAME (decl) != NULL_TREE)
named_section (decl, (char *) 0, 0);
+ else if (scan_ahead_for_unlikely_executed_note (get_insns()))
+ unlikely_text_section ();
else
- text_section ();
+ text_section ();
+ /* APPLE LOCAL end hot/cold partitioning */
}
/* Switch to section for variable DECL. RELOC is the same as the
@@ -818,6 +890,8 @@ make_decl_rtl (tree decl, const char *asmspec)
x = gen_rtx_SYMBOL_REF (Pmode, name);
SYMBOL_REF_WEAK (x) = DECL_WEAK (decl);
+ /* APPLE LOCAL weak import */
+ SYMBOL_REF_WEAK_IMPORT (x) = DECL_WEAK_IMPORT (decl);
SYMBOL_REF_DECL (x) = decl;
x = gen_rtx_MEM (DECL_MODE (decl), x);
@@ -1036,6 +1110,15 @@ assemble_start_function (tree decl, const char *fnname)
{
int align;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ unlikely_section_label_printed = false;
+ if (flag_reorder_blocks_and_partition)
+ {
+ unlikely_section_label = xmalloc ((strlen (fnname) + 18) * sizeof (char));
+ sprintf (unlikely_section_label, "%s_unlikely_section", fnname);
+ }
+ /* APPLE LOCAL end hot/cold partitioning */
+
/* The following code does not need preprocessing in the assembler. */
app_disable ();
@@ -1123,7 +1206,10 @@ assemble_zeros (unsigned HOST_WIDE_INT size)
#ifdef ASM_NO_SKIP_IN_TEXT
/* The `space' pseudo in the text section outputs nop insns rather than 0s,
so we must output 0s explicitly in the text section. */
- if (ASM_NO_SKIP_IN_TEXT && in_text_section ())
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if ((ASM_NO_SKIP_IN_TEXT && in_text_section ())
+ || (ASM_NO_SKIP_IN_TEXT && in_unlikely_text_section ()))
+ /* APPLE LOCAL end hot/cold partitioning */
{
unsigned HOST_WIDE_INT i;
for (i = 0; i < size; i++)
@@ -1361,6 +1447,10 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
if (flag_syntax_only)
return;
+ /* APPLE LOCAL duplicate decls in multiple files. */
+ if (DECL_DUPLICATE_DECL (decl))
+ return;
+
app_disable ();
if (! dont_output_data
@@ -1484,8 +1574,31 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
/* Switch to the appropriate section. */
variable_section (decl, reloc);
+ /* APPLE LOCAL begin zerofill turly 20020218 */
+#ifdef ASM_OUTPUT_ZEROFILL
+ /* We need a ZEROFILL COALESCED option! */
+ if (flag_no_common
+ && ! dont_output_data
+ /* APPLE LOCAL coalescing */
+ && ! DECL_COALESCED (decl)
+ && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
+ {
+ ASM_OUTPUT_ZEROFILL (asm_out_file, name,
+ tree_low_cst (DECL_SIZE_UNIT (decl), 1),
+ floor_log2 (DECL_ALIGN (decl) / BITS_PER_UNIT));
+
+ /********************************/
+ /* NOTE THE EARLY RETURN HERE!! */
+ /********************************/
+ return;
+ }
+#endif
+ /* APPLE LOCAL end zerofill turly 20020218 */
+
/* dbxout.c needs to know this. */
- if (in_text_section ())
+ /* APPLE LOCAL begin hot/cold partitioning */
+ if (in_text_section () || in_unlikely_text_section ())
+ /* APPLE LOCAL end hot/cold partitioning */
DECL_IN_TEXT_SECTION (decl) = 1;
/* Output the alignment of this data. */
@@ -3250,6 +3363,8 @@ initializer_constant_valid_p (tree value, tree endtype)
{
case CONSTRUCTOR:
if ((TREE_CODE (TREE_TYPE (value)) == UNION_TYPE
+ /* APPLE LOCAL AltiVec */
+ || TREE_CODE (TREE_TYPE (value)) == VECTOR_TYPE
|| TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE)
&& TREE_CONSTANT (value)
&& CONSTRUCTOR_ELTS (value))
@@ -4032,6 +4147,16 @@ merge_weak (tree newdecl, tree olddecl)
/* OLDDECL was weak, but NEWDECL was not explicitly marked as
weak. Just update NEWDECL to indicate that it's weak too. */
mark_weak (newdecl);
+
+ /* APPLE LOCAL begin weak_import (Radar 2809704) ilr */
+ if (DECL_WEAK_IMPORT (olddecl) != DECL_WEAK_IMPORT (newdecl))
+ {
+ if (! DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl))
+ warning (
+ "%Jinconsistent weak_import attribute with previous declaration of `%D'", newdecl, olddecl);
+ DECL_WEAK_IMPORT (newdecl) = 1;
+ }
+ /* APPLE LOCAL end weak_import ilr */
}
/* Declare DECL to be a weak symbol. */
@@ -4117,6 +4242,16 @@ globalize_decl (tree decl)
}
#endif
+ /* APPLE LOCAL begin coalescing */
+ /* Weak definitions are used for coalesced symbols. They're not the
+ same thing as weak references. The naming is unfortunate. */
+#ifdef ASM_WEAK_DEFINITIONIZE_LABEL
+ if (DECL_COALESCED (decl) && flag_weak_coalesced_definitions)
+ ASM_WEAK_DEFINITIONIZE_LABEL (asm_out_file, name);
+#endif /* ASM_WEAK_DEFINITIONIZE_LABEL */
+
+ /* APPLE LOCAL end coalescing */
+
(*targetm.asm_out.globalize_label) (asm_out_file, name);
}
@@ -4334,6 +4469,10 @@ default_section_type_flags_1 (tree decl, const char *name, int reloc,
flags = SECTION_CODE;
else if (decl && decl_readonly_section_1 (decl, reloc, shlib))
flags = 0;
+ /* APPLE LOCAL begin hot/cold partitioning */
+ else if (strcmp (name, UNLIKELY_EXECUTED_TEXT_SECTION_NAME) == 0)
+ flags = SECTION_CODE;
+ /* APPLE LOCAL end hot/cold partitioning */
else
flags = SECTION_WRITE;
@@ -4933,6 +5072,15 @@ default_globalize_label (FILE * stream, const char *name)
}
#endif /* GLOBAL_ASM_OP */
+/* APPLE LOCAL begin coalescing */
+int
+darwin_named_section_is (const char* name)
+{
+ return (in_section == in_named
+ && strcmp (in_named_name, name) == 0);
+}
+/* APPLE LOCAL end coalescing */
+
/* This is how to output an internal numbered label where PREFIX is
the class of label and LABELNO is the number within the class. */
diff --git a/gcc/varray.c b/gcc/varray.c
index fc951da56e4..81842ca237b 100644
--- a/gcc/varray.c
+++ b/gcc/varray.c
@@ -110,7 +110,8 @@ static const struct {
{ sizeof (struct basic_block_def *), 1 },
{ sizeof (struct elt_list *), 1 },
{ sizeof (struct edge_def *), 1 },
- { sizeof (tree *), 1 },
+ { sizeof (struct dependence_node_def *), 0 },
+ { sizeof (tree *), 1 }
};
/* Allocate a virtual array with NUM_ELEMENT elements, each of which is
diff --git a/gcc/varray.h b/gcc/varray.h
index 2cc8fd6080c..b9f4d41ac74 100644
--- a/gcc/varray.h
+++ b/gcc/varray.h
@@ -83,6 +83,7 @@ enum varray_data_enum {
VARRAY_DATA_BB,
VARRAY_DATA_TE,
VARRAY_DATA_EDGE,
+ VARRAY_DATA_DG,
VARRAY_DATA_TREE_PTR,
NUM_VARRAY_DATA
};
@@ -133,6 +134,8 @@ typedef union varray_data_tag GTY (()) {
tag ("VARRAY_DATA_TE"))) te[1];
struct edge_def *GTY ((length ("%0.num_elements"),
tag ("VARRAY_DATA_EDGE"))) e[1];
+ struct dependence_node_def *GTY ((length ("%0.num_elements"),
+ tag ("VARRAY_DATA_DG"))) dg[1];
tree *GTY ((length ("%0.num_elements"), skip (""),
tag ("VARRAY_DATA_TREE_PTR"))) tp[1];
} varray_data;
@@ -219,6 +222,9 @@ extern varray_type varray_init (size_t, enum varray_data_enum, const char *);
#define VARRAY_EDGE_INIT(va, num, name) \
va = varray_init (num, VARRAY_DATA_EDGE, name)
+#define VARRAY_DG_INIT(va, num, name) \
+ va = varray_init (num, VARRAY_DATA_DG, name)
+
#define VARRAY_TREE_PTR_INIT(va, num, name) \
va = varray_init (num, VARRAY_DATA_TREE_PTR, name)
@@ -304,6 +310,7 @@ extern void varray_underflow (varray_type, const char *, int, const char *)
#define VARRAY_BB(VA, N) VARRAY_CHECK (VA, N, bb)
#define VARRAY_ELT_LIST(VA, N) VARRAY_CHECK (VA, N, te)
#define VARRAY_EDGE(VA, N) VARRAY_CHECK (VA, N, e)
+#define VARRAY_DG(VA, N) VARRAY_CHECK (VA, N, dg)
#define VARRAY_TREE_PTR(VA, N) VARRAY_CHECK (VA, N, tp)
/* Push a new element on the end of VA, extending it if necessary. */
@@ -328,6 +335,7 @@ extern void varray_underflow (varray_type, const char *, int, const char *)
#define VARRAY_PUSH_CONST_EQUIV(VA, X) VARRAY_PUSH (VA, const_equiv, X)
#define VARRAY_PUSH_BB(VA, X) VARRAY_PUSH (VA, bb, X)
#define VARRAY_PUSH_EDGE(VA, X) VARRAY_PUSH (VA, e, X)
+#define VARRAY_PUSH_DG(VA, X) VARRAY_PUSH (VA, dg, X)
#define VARRAY_PUSH_TREE_PTR(VA, X) VARRAY_PUSH (VA, tp, X)
/* Return the last element of VA. */
@@ -356,4 +364,61 @@ extern void varray_underflow (varray_type, const char *, int, const char *)
#define VARRAY_TOP_EDGE(VA) VARRAY_TOP (VA, e)
#define VARRAY_TOP_TREE_PTR(VA) VARRAY_TOP (VA, tp)
+
+
+
+static inline int index_in_varray_tree (tree, varray_type);
+static inline bool tree_is_in_varray_tree_p (tree, varray_type);
+
+static inline int index_in_varray_int (int, varray_type);
+static inline bool int_is_in_varray_int_p (int, varray_type);
+
+/* Determines the index of T in the varray_tree VT. */
+
+static inline int
+index_in_varray_tree (tree t,
+ varray_type vt)
+{
+ unsigned int i;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (vt); i++)
+ if (t == VARRAY_TREE (vt, i))
+ return i;
+
+ return -1;
+}
+
+/* Determines whether T is in the varray_tree VT. */
+
+static inline bool
+tree_is_in_varray_tree_p (tree t,
+ varray_type vt)
+{
+ return index_in_varray_tree (t, vt) != -1;
+}
+
+/* Determines the index of T in the varray_int VT. */
+
+static inline int
+index_in_varray_int (int t,
+ varray_type vt)
+{
+ unsigned int i;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (vt); i++)
+ if (t == VARRAY_INT (vt, i))
+ return i;
+
+ return -1;
+}
+
+/* Determines whether T is in the varray_int VT. */
+
+static inline bool
+int_is_in_varray_int_p (int t,
+ varray_type vt)
+{
+ return index_in_varray_int (t, vt) != -1;
+}
+
#endif /* ! GCC_VARRAY_H */
diff --git a/gcc/version.c b/gcc/version.c
index a64b18d5da1..7b80313a219 100644
--- a/gcc/version.c
+++ b/gcc/version.c
@@ -5,7 +5,18 @@
please modify this string to indicate that, e.g. by putting your
organization's name in parentheses at the end of the string. */
-const char version_string[] = "3.5-tree-ssa 20040320 (merged 20040307)";
+/* APPLE LOCAL begin Apple version */
+/* When updating this string:
+ - For each internal build, increment the build number.
+ - When merging from the FSF, delete any (experimental) or (prerelease).
+ Apple doesn't mark its GCC versions as 'prerelease', because a released
+ compiler will be identical to the last prerelease compiler and it
+ makes no sense to mark released compilers as 'prerelease'.
+ - There are other scripts that search for first word of the string
+ to get version number string. Do not use new line.
+*/
+const char version_string[] = "3.5.0-tree-ssa 20040321 (merged 20040322) (Apple Computer, Inc. build 1749)";
+/* APPLE LOCAL end Apple version */
/* This is the location of the online document giving instructions for
reporting bugs. If you distribute a modified version of GCC,
@@ -14,4 +25,6 @@ const char version_string[] = "3.5-tree-ssa 20040320 (merged 20040307)";
forward us bugs reported to you, if you determine that they are
not bugs in your modifications.) */
-const char bug_report_url[] = "<URL:http://gcc.gnu.org/bugs.html>";
+/* APPLE LOCAL begin Apple bug-report */
+const char bug_report_url[] = "<URL:http://developer.apple.com/bugreporter>";
+/* APPLE LOCAL end Apple bug-report */
diff --git a/include/demangle.h b/include/demangle.h
index 6e995e4817d..9ee90150304 100644
--- a/include/demangle.h
+++ b/include/demangle.h
@@ -141,6 +141,8 @@ enum gnu_v3_ctor_kinds {
gnu_v3_complete_object_ctor = 1,
gnu_v3_base_object_ctor,
gnu_v3_complete_object_allocating_ctor
+ /* APPLE LOCAL decloning */
+ , gnu_v3_unified_ctor
};
/* Return non-zero iff NAME is the mangled form of a constructor name
@@ -155,6 +157,8 @@ enum gnu_v3_dtor_kinds {
gnu_v3_deleting_dtor = 1,
gnu_v3_complete_object_dtor,
gnu_v3_base_object_dtor
+ /* APPLE LOCAL decloning */
+ , gnu_v3_unified_dtor
};
/* Return non-zero iff NAME is the mangled form of a destructor name
diff --git a/libada/configure.ac b/libada/configure.ac
deleted file mode 100644
index e2d6198e4e7..00000000000
--- a/libada/configure.ac
+++ /dev/null
@@ -1,65 +0,0 @@
-# Configure script for libada.
-# Copyright 2003, 2004 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-AC_INIT
-AC_CONFIG_SRCDIR([Makefile.in])
-
-# This is an autoconf 2.5x script.
-AC_PREREQ([2.59])
-
-# Very limited version of AC_MAINTAINER_MODE.
-AC_ARG_ENABLE(
- [maintainer-mode],
- AC_HELP_STRING([--enable-maintainer-mode],
- [enable make rules and dependencies not useful (and
- sometimes confusing) to the casual installer]),
- [case ${enable_maintainer_mode} in
- yes) MAINT='' ;;
- no) MAINT='#' ;;
- *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
- esac
- maintainer_mode=${enableval}],
- [MAINT='#'])
-AC_SUBST([MAINT])dnl
-
-# Start of actual configure tests
-
-# Output: create a Makefile.
-AC_CONFIG_FILES([Makefile])
-
-AC_CANONICAL_SYSTEM
-
-AC_ARG_ENABLE(shared,
-[ --disable-shared don't provide a shared libgnat],
-[
- case $enable_shared in
- yes | no) ;;
- *)
- enable_shared=no
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "$pkg" = "ada" || test "$pkg" = "libada"; then
- enable_shared=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
- esac
-], [enable_shared=yes])
-AC_SUBST(enable_shared)
-
-AC_OUTPUT
diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c
index d3d4f3a1553..1d4a2952bcf 100644
--- a/libiberty/vasprintf.c
+++ b/libiberty/vasprintf.c
@@ -156,7 +156,8 @@ int
vasprintf (result, format, args)
char **result;
const char *format;
-#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
+ /* APPLE LOCAL Agree with <stdio.h> prototype */
+#if defined (_BSD_VA_LIST_) && (defined (__FreeBSD__) || defined (__APPLE__))
_BSD_VA_LIST_ args;
#else
va_list args;
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
deleted file mode 100644
index dbcd2d1c437..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* GdkGraphicsEnvironment.java -- information about the graphics environment
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.*;
-import java.awt.GraphicsEnvironment;
-import java.awt.image.BufferedImage;
-import java.util.Locale;
-
-
-public class GdkGraphicsEnvironment extends GraphicsEnvironment
-{
-
- public GdkGraphicsEnvironment ()
- {
- super();
- }
-
- public GraphicsDevice[] getScreenDevices ()
- {
- throw new java.lang.UnsupportedOperationException ();
- }
-
- public GraphicsDevice getDefaultScreenDevice ()
- {
- throw new java.lang.UnsupportedOperationException ();
- }
-
- public Graphics2D createGraphics (BufferedImage image)
- {
- return new GdkGraphics2D (image);
- }
-
- public Font[] getAllFonts ()
- {
- throw new java.lang.UnsupportedOperationException ();
- }
-
- public String[] getAvailableFontFamilyNames ()
- {
- throw new java.lang.UnsupportedOperationException ();
- }
-
- public String[] getAvailableFontFamilyNames (Locale l)
- {
- throw new java.lang.UnsupportedOperationException ();
- }
-
-
-} // class GdkGraphicsEnvironment
-
diff --git a/libjava/gnu/java/net/protocol/core/Connection.java b/libjava/gnu/java/net/protocol/core/Connection.java
deleted file mode 100644
index 2319c0be923..00000000000
--- a/libjava/gnu/java/net/protocol/core/Connection.java
+++ /dev/null
@@ -1,172 +0,0 @@
-// Connection.java - Implementation of URLConnection for core protocol.
-
-/* Copyright (C) 2001, 2003 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-package gnu.java.net.protocol.core;
-
-import gnu.gcj.Core;
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Map;
-import java.util.Vector;
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-/**
- * @author Anthony Green <green@redhat.com>
- * @date August 13, 2001
- */
-
-class Connection extends URLConnection
-{
- private Hashtable hdrHash = new Hashtable();
- private Vector hdrVec = new Vector();
- private boolean gotHeaders = false;
-
- private Core core;
-
- public Connection (URL url)
- {
- super(url);
- }
-
- // Implementation of abstract method.
- public void connect() throws IOException
- {
- // Call is ignored if already connected.
- if (connected)
- return;
-
- // If not connected, then file needs to be opened.
- core = Core.create (url.getFile());
- connected = true;
- }
-
- public InputStream getInputStream() throws IOException
- {
- if (!connected)
- connect();
-
- if (! doInput)
- throw new ProtocolException("Can't open InputStream if doInput is false");
- return new CoreInputStream (core);
- }
-
- // Override default method in URLConnection.
- public String getHeaderField(String name)
- {
- try
- {
- getHeaders();
- }
- catch (IOException x)
- {
- return null;
- }
- return (String) hdrHash.get(name.toLowerCase());
- }
-
- // Override default method in URLConnection.
- public Map getHeaderFields()
- {
- try
- {
- getHeaders();
- }
- catch (IOException x)
- {
- return null;
- }
- return hdrHash;
- }
-
- // Override default method in URLConnection.
- public String getHeaderField(int n)
- {
- try
- {
- getHeaders();
- }
- catch (IOException x)
- {
- return null;
- }
- if (n < hdrVec.size())
- return getField ((String) hdrVec.elementAt(n));
-
- return null;
- }
-
- // Override default method in URLConnection.
- public String getHeaderFieldKey(int n)
- {
- try
- {
- getHeaders();
- }
- catch (IOException x)
- {
- return null;
- }
- if (n < hdrVec.size())
- return getKey ((String) hdrVec.elementAt(n));
-
- return null;
- }
-
- private String getKey(String str)
- {
- if (str == null)
- return null;
- int index = str.indexOf(':');
- if (index >= 0)
- return str.substring(0, index);
- else
- return null;
- }
-
- private String getField(String str)
- {
- if (str == null)
- return null;
- int index = str.indexOf(':');
- if (index >= 0)
- return str.substring(index + 1).trim();
- else
- return str;
- }
-
- private void getHeaders() throws IOException
- {
- if (gotHeaders)
- return;
- gotHeaders = true;
-
- connect();
-
- // Yes, it is overkill to use the hash table and vector here since
- // we're only putting one header in the file, but in case we need
- // to add others later and for consistency, we'll implement it this way.
-
- // Add the only header we know about right now: Content-length.
- long len = core.length;
- String line = "Content-length: " + len;
- hdrVec.addElement(line);
-
- // The key will never be null in this scenario since we build up the
- // headers ourselves. If we ever rely on getting a header from somewhere
- // else, then we may have to check if the result of getKey() is null.
- String key = getKey(line);
- hdrHash.put(key.toLowerCase(), Long.toString(len));
- }
-}
-
diff --git a/libjava/gnu/java/net/protocol/core/CoreInputStream.java b/libjava/gnu/java/net/protocol/core/CoreInputStream.java
deleted file mode 100644
index 421bb1c4765..00000000000
--- a/libjava/gnu/java/net/protocol/core/CoreInputStream.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// Handler.java - URLStreamHandler for core protocol.
-
-/* Copyright (C) 2001 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-package gnu.java.net.protocol.core;
-
-import gnu.gcj.Core;
-import gnu.gcj.RawData;
-import java.io.InputStream;
-import java.io.IOException;
-
-public class CoreInputStream extends InputStream
-{
- /* A pointer to the object in memory. */
- protected RawData ptr;
-
- /* Position of the next byte in core to be read. */
- protected int pos;
-
- /* The currently marked position in the stream. */
- protected int mark;
-
- /* The index in core one greater than the last valid character. */
- protected int count;
-
- private native int unsafeGetByte (long offset);
- private native int copyIntoByteArray (byte[] dest, int offset, int numBytes);
-
- public CoreInputStream (Core core)
- {
- ptr = core.ptr;
- count = core.length;
- }
-
- public synchronized int available()
- {
- return count - pos;
- }
-
- public synchronized void mark(int readAheadLimit)
- {
- // readAheadLimit is ignored per Java Class Lib. book, p.220.
- mark = pos;
- }
-
- public boolean markSupported()
- {
- return true;
- }
-
- public synchronized int read()
- {
- if (pos < count)
- return ((int) unsafeGetByte(pos++)) & 0xFF;
- return -1;
- }
-
- public synchronized int read(byte[] b, int off, int len)
- {
- if (pos >= count)
- return -1;
-
- int numBytes = Math.min(count - pos, len);
- copyIntoByteArray (b, off, numBytes);
- pos += numBytes;
- return numBytes;
- }
-
- public synchronized void reset()
- {
- pos = mark;
- }
-
- public synchronized long skip(long n)
- {
- // Even though the var numBytes is a long, in reality it can never
- // be larger than an int since the result of subtracting 2 positive
- // ints will always fit in an int. Since we have to return a long
- // anyway, numBytes might as well just be a long.
- long numBytes = Math.min ((long) (count - pos), n < 0 ? 0L : n);
- pos += numBytes;
- return numBytes;
- }
-}
diff --git a/libjava/gnu/java/net/protocol/core/Handler.java b/libjava/gnu/java/net/protocol/core/Handler.java
deleted file mode 100644
index 8726172d2cd..00000000000
--- a/libjava/gnu/java/net/protocol/core/Handler.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Handler.java - URLStreamHandler for core protocol.
-
-/* Copyright (C) 2001 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-package gnu.java.net.protocol.core;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * @author Anthony Green <green@redhat.com>
- * @date August 13, 2001.
- */
-public class Handler extends URLStreamHandler
-{
- protected URLConnection openConnection(URL url) throws IOException
- {
- return new Connection(url);
- }
-}
diff --git a/libjava/gnu/java/net/protocol/core/natCoreInputStream.cc b/libjava/gnu/java/net/protocol/core/natCoreInputStream.cc
deleted file mode 100644
index 4053efcd16a..00000000000
--- a/libjava/gnu/java/net/protocol/core/natCoreInputStream.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// natCoreInputStream.cc -- C++ side of CoreInputStream
-
-/* Copyright (C) 2001 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-/* Author: Anthony Green <green@redhat.com>. */
-
-#include <config.h>
-
-#include <gcj/cni.h>
-#include <jvm.h>
-#include <string.h>
-
-#include <java/lang/NullPointerException.h>
-#include <java/lang/ArrayIndexOutOfBoundsException.h>
-#include <gnu/java/net/protocol/core/CoreInputStream.h>
-
-jint
-gnu::java::net::protocol::core::CoreInputStream::unsafeGetByte (jlong offset)
-{
- return ((char*) ptr) [offset];
-}
-
-jint
-gnu::java::net::protocol::core::CoreInputStream::copyIntoByteArray (jbyteArray dest,
- jint offset,
- jint numBytes)
-{
- if (!dest)
- throw new ::java::lang::NullPointerException;
-
- jsize destSize = JvGetArrayLength (dest);
-
- if (offset < 0 || numBytes < 0 || offset + numBytes < 0
- || offset + numBytes > destSize
- || pos + numBytes > count)
- throw new ::java::lang::ArrayIndexOutOfBoundsException;
-
- void *pcore = (void *) &((char*) ptr) [pos];
- void *pdest = (void *) (elements (dest) + offset);
-
- memcpy (pdest, pcore, numBytes);
-
- return 0;
-}
-
diff --git a/libjava/gnu/regexp/CharIndexed.java b/libjava/gnu/regexp/CharIndexed.java
deleted file mode 100644
index eb1be13fd78..00000000000
--- a/libjava/gnu/regexp/CharIndexed.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* gnu/regexp/CharIndexed.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-
-/**
- * Defines the interface used internally so that different types of source
- * text can be accessed in the same way. Built-in concrete classes provide
- * support for String, StringBuffer, InputStream and char[] types.
- * A class that is CharIndexed supports the notion of a cursor within a
- * block of text. The cursor must be able to be advanced via the move()
- * method. The charAt() method returns the character at the cursor position
- * plus a given offset.
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- */
-public interface CharIndexed {
- /**
- * Defines a constant (0xFFFF was somewhat arbitrarily chosen)
- * that can be returned by the charAt() function indicating that
- * the specified index is out of range.
- */
- char OUT_OF_BOUNDS = '\uFFFF';
-
- /**
- * Returns the character at the given offset past the current cursor
- * position in the input. The index of the current position is zero.
- * It is possible for this method to be called with a negative index.
- * This happens when using the '^' operator in multiline matching mode
- * or the '\b' or '\<' word boundary operators. In any case, the lower
- * bound is currently fixed at -2 (for '^' with a two-character newline).
- *
- * @param index the offset position in the character field to examine
- * @return the character at the specified index, or the OUT_OF_BOUNDS
- * character defined by this interface.
- */
- char charAt(int index);
-
- /**
- * Shifts the input buffer by a given number of positions. Returns
- * true if the new cursor position is valid.
- */
- boolean move(int index);
-
- /**
- * Returns true if the most recent move() operation placed the cursor
- * position at a valid position in the input.
- */
- boolean isValid();
-}
diff --git a/libjava/gnu/regexp/CharIndexedCharArray.java b/libjava/gnu/regexp/CharIndexedCharArray.java
deleted file mode 100644
index dc488ba44ea..00000000000
--- a/libjava/gnu/regexp/CharIndexedCharArray.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* gnu/regexp/CharIndexedCharArray.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.Serializable;
-
-class CharIndexedCharArray implements CharIndexed, Serializable {
- private char[] s;
- private int anchor;
-
- CharIndexedCharArray(char[] str, int index) {
- s = str;
- anchor = index;
- }
-
- public char charAt(int index) {
- int pos = anchor + index;
- return ((pos < s.length) && (pos >= 0)) ? s[pos] : OUT_OF_BOUNDS;
- }
-
- public boolean isValid() {
- return (anchor < s.length);
- }
-
- public boolean move(int index) {
- return ((anchor += index) < s.length);
- }
-}
diff --git a/libjava/gnu/regexp/CharIndexedInputStream.java b/libjava/gnu/regexp/CharIndexedInputStream.java
deleted file mode 100644
index 776f533ca81..00000000000
--- a/libjava/gnu/regexp/CharIndexedInputStream.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/* gnu/regexp/CharIndexedInputStream.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.InputStream;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-
-// TODO: move(x) shouldn't rely on calling next() x times
-
-class CharIndexedInputStream implements CharIndexed {
- private static final int BUFFER_INCREMENT = 1024;
- private static final int UNKNOWN = Integer.MAX_VALUE; // value for end
-
- private BufferedInputStream br;
-
- // so that we don't try to reset() right away
- private int index = -1;
-
- private int bufsize = BUFFER_INCREMENT;
-
- private int end = UNKNOWN;
-
- private char cached = OUT_OF_BOUNDS;
-
- // Big enough for a \r\n pair
- // lookBehind[0] = most recent
- // lookBehind[1] = second most recent
- private char[] lookBehind = new char[] { OUT_OF_BOUNDS, OUT_OF_BOUNDS };
-
- CharIndexedInputStream(InputStream str, int index) {
- if (str instanceof BufferedInputStream) br = (BufferedInputStream) str;
- else br = new BufferedInputStream(str,BUFFER_INCREMENT);
- next();
- if (index > 0) move(index);
- }
-
- private boolean next() {
- if (end == 1) return false;
- end--; // closer to end
-
- try {
- if (index != -1) {
- br.reset();
- }
- int i = br.read();
- br.mark(bufsize);
- if (i == -1) {
- end = 1;
- cached = OUT_OF_BOUNDS;
- return false;
- }
- cached = (char) i;
- index = 1;
- } catch (IOException e) {
- e.printStackTrace();
- cached = OUT_OF_BOUNDS;
- return false;
- }
- return true;
- }
-
- public char charAt(int index) {
- if (index == 0) {
- return cached;
- } else if (index >= end) {
- return OUT_OF_BOUNDS;
- } else if (index == -1) {
- return lookBehind[0];
- } else if (index == -2) {
- return lookBehind[1];
- } else if (index < -2) {
- return OUT_OF_BOUNDS;
- } else if (index >= bufsize) {
- // Allocate more space in the buffer.
- try {
- while (bufsize <= index) bufsize += BUFFER_INCREMENT;
- br.reset();
- br.mark(bufsize);
- br.skip(index-1);
- } catch (IOException e) { }
- } else if (this.index != index) {
- try {
- br.reset();
- br.skip(index-1);
- } catch (IOException e) { }
- }
- char ch = OUT_OF_BOUNDS;
-
- try {
- int i = br.read();
- this.index = index+1; // this.index is index of next pos relative to charAt(0)
- if (i == -1) {
- // set flag that next should fail next time?
- end = index;
- return ch;
- }
- ch = (char) i;
- } catch (IOException ie) { }
-
- return ch;
- }
-
- public boolean move(int index) {
- // move read position [index] clicks from 'charAt(0)'
- boolean retval = true;
- while (retval && (index-- > 0)) retval = next();
- return retval;
- }
-
- public boolean isValid() {
- return (cached != OUT_OF_BOUNDS);
- }
-}
-
diff --git a/libjava/gnu/regexp/CharIndexedReader.java b/libjava/gnu/regexp/CharIndexedReader.java
deleted file mode 100644
index aa0fa5a313d..00000000000
--- a/libjava/gnu/regexp/CharIndexedReader.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * gnu/regexp/CharIndexedReader.java
- * Copyright (C) 2001 Lee Sau Dan
- * Based on gnu.regexp.CharIndexedInputStream by Wes Biggs
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package gnu.regexp;
-import java.io.Reader;
-import java.io.BufferedReader;
-import java.io.IOException;
-
-// TODO: move(x) shouldn't rely on calling next() x times
-
-class CharIndexedReader implements CharIndexed {
- private static final int BUFFER_INCREMENT = 1024;
- private static final int UNKNOWN = Integer.MAX_VALUE; // value for end
-
- private final BufferedReader br;
- // so that we don't try to reset() right away
- private int index = -1;
-
- private int bufsize = BUFFER_INCREMENT;
-
- private int end = UNKNOWN;
-
- private char cached = OUT_OF_BOUNDS;
-
- // Big enough for a \r\n pair
- // lookBehind[0] = most recent
- // lookBehind[1] = second most recent
- private char[] lookBehind = new char[] { OUT_OF_BOUNDS, OUT_OF_BOUNDS };
-
- CharIndexedReader(Reader reader, int index) {
- if (reader instanceof BufferedReader) {
- br = (BufferedReader) reader;
- } else {
- br = new BufferedReader(reader,BUFFER_INCREMENT);
- }
- next();
- if (index > 0) move(index);
- }
-
- private boolean next() {
- lookBehind[1] = lookBehind[0];
- lookBehind[0] = cached;
-
- if (end == 1) {
- cached = OUT_OF_BOUNDS;
- return false;
- }
- end--; // closer to end
-
- try {
- if (index != -1) {
- br.reset();
- }
- int i = br.read();
- br.mark(bufsize);
- if (i == -1) {
- end = 1;
- cached = OUT_OF_BOUNDS;
- return false;
- }
-
- // convert the byte read into a char
- cached = (char) i;
- index = 1;
- } catch (IOException e) {
- e.printStackTrace();
- cached = OUT_OF_BOUNDS;
- return false;
- }
- return true;
- }
-
- public char charAt(int index) {
- if (index == 0) {
- return cached;
- } else if (index >= end) {
- return OUT_OF_BOUNDS;
- } else if (index >= bufsize) {
- // Allocate more space in the buffer.
- try {
- while (bufsize <= index) bufsize += BUFFER_INCREMENT;
- br.reset();
- br.mark(bufsize);
- br.skip(index-1);
- } catch (IOException e) { }
- } else if (this.index != index) {
- try {
- br.reset();
- br.skip(index-1);
- } catch (IOException e) { }
- } else if (index == -1) {
- return lookBehind[0];
- } else if (index == -2) {
- return lookBehind[1];
- } else if (index < -2) {
- return OUT_OF_BOUNDS;
- }
-
- char ch = OUT_OF_BOUNDS;
-
- try {
- int i = br.read();
- this.index = index+1; // this.index is index of next pos relative to charAt(0)
- if (i == -1) {
- // set flag that next should fail next time?
- end = index;
- return ch;
- }
- ch = (char) i;
- } catch (IOException ie) { }
-
- return ch;
- }
-
- public boolean move(int index) {
- // move read position [index] clicks from 'charAt(0)'
- boolean retval = true;
- while (retval && (index-- > 0)) retval = next();
- return retval;
- }
-
- public boolean isValid() {
- return (cached != OUT_OF_BOUNDS);
- }
-}
diff --git a/libjava/gnu/regexp/CharIndexedString.java b/libjava/gnu/regexp/CharIndexedString.java
deleted file mode 100644
index adff7ac7186..00000000000
--- a/libjava/gnu/regexp/CharIndexedString.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* gnu/regexp/CharIndexedString.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.Serializable;
-
-class CharIndexedString implements CharIndexed, Serializable {
- private String s;
- private int anchor;
- private int len;
-
- CharIndexedString(String str, int index) {
- s = str;
- len = s.length();
- anchor = index;
- }
-
- public char charAt(int index) {
- int pos = anchor + index;
- return ((pos < len) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS;
- }
-
- public boolean isValid() {
- return (anchor < len);
- }
-
- public boolean move(int index) {
- return ((anchor += index) < len);
- }
-}
diff --git a/libjava/gnu/regexp/CharIndexedStringBuffer.java b/libjava/gnu/regexp/CharIndexedStringBuffer.java
deleted file mode 100644
index 2eb8c23f36a..00000000000
--- a/libjava/gnu/regexp/CharIndexedStringBuffer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* gnu/regexp/CharIndexedStringBuffer.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.Serializable;
-
-class CharIndexedStringBuffer implements CharIndexed, Serializable {
- private StringBuffer s;
- private int anchor;
-
- CharIndexedStringBuffer(StringBuffer str, int index) {
- s = str;
- anchor = index;
- }
-
- public char charAt(int index) {
- int pos = anchor + index;
- return ((pos < s.length()) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS;
- }
-
- public boolean isValid() {
- return (anchor < s.length());
- }
-
- public boolean move(int index) {
- return ((anchor += index) < s.length());
- }
-}
diff --git a/libjava/gnu/regexp/MessagesBundle.properties b/libjava/gnu/regexp/MessagesBundle.properties
deleted file mode 100644
index 1e077a4033c..00000000000
--- a/libjava/gnu/regexp/MessagesBundle.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Localized error messages for gnu.regexp
-
-# Prefix for REException messages
-error.prefix=At position {0} in regular expression pattern:
-
-# REException (parse error) messages
-repeat.assertion=repeated token is zero-width assertion
-repeat.chained=attempted to repeat a token that is already repeated
-repeat.no.token=quantifier (?*+{}) without preceding token
-repeat.empty.token=repeated token may be empty
-unmatched.brace=unmatched brace
-unmatched.bracket=unmatched bracket
-unmatched.paren=unmatched parenthesis
-interval.no.end=expected end of interval
-class.no.end=expected end of character class
-subexpr.no.end=expected end of subexpression
-interval.order=interval minimum is greater than maximum
-interval.error=interval is empty or contains illegal characters
-ends.with.backslash=backslash at end of pattern
-
-# RESyntax message
-syntax.final=Syntax has been declared final and cannot be modified
diff --git a/libjava/gnu/regexp/MessagesBundle_fr.properties b/libjava/gnu/regexp/MessagesBundle_fr.properties
deleted file mode 100644
index 8ab8356c17b..00000000000
--- a/libjava/gnu/regexp/MessagesBundle_fr.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Localized error messages for gnu.regexp
-
-# Prefix for REException messages
-error.prefix=A l''index {0} dans le modèle d''expression régulière:
-
-# REException (parse error) messages
-repeat.assertion=l'élément répété est de largeur zéro
-repeat.chained=tentative de répétition d'un élément déjà répété
-repeat.no.token=quantifieur (?*+{}) sans élément précédent
-repeat.empty.token=l'élément répété peut être vide
-unmatched.brace=accolade inégalée
-unmatched.bracket=crochet inégalé
-unmatched.paren=parenthèse inégalée
-interval.no.end=fin d'interval attendue
-class.no.end=fin de classe de caractères attendue
-subexpr.no.end=fin de sous-expression attendue
-interval.order=l'interval minimum est supérieur à l'interval maximum
-interval.error=l'interval est vide ou contient des caractères illégaux
-ends.with.backslash=antislash à la fin du modèle
-
-# RESyntax message
-syntax.final=La syntaxe a été déclarée finale et ne peut pas être modifiée
diff --git a/libjava/gnu/regexp/RE.java b/libjava/gnu/regexp/RE.java
deleted file mode 100644
index fdc00feb3fb..00000000000
--- a/libjava/gnu/regexp/RE.java
+++ /dev/null
@@ -1,1350 +0,0 @@
-/* gnu/regexp/RE.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.Locale;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-class IntPair implements Serializable {
- public int first, second;
-}
-
-class CharUnit implements Serializable {
- public char ch;
- public boolean bk;
-}
-
-/**
- * RE provides the user interface for compiling and matching regular
- * expressions.
- * <P>
- * A regular expression object (class RE) is compiled by constructing it
- * from a String, StringBuffer or character array, with optional
- * compilation flags (below)
- * and an optional syntax specification (see RESyntax; if not specified,
- * <code>RESyntax.RE_SYNTAX_PERL5</code> is used).
- * <P>
- * Once compiled, a regular expression object is reusable as well as
- * threadsafe: multiple threads can use the RE instance simultaneously
- * to match against different input text.
- * <P>
- * Various methods attempt to match input text against a compiled
- * regular expression. These methods are:
- * <LI><code>isMatch</code>: returns true if the input text in its
- * entirety matches the regular expression pattern.
- * <LI><code>getMatch</code>: returns the first match found in the
- * input text, or null if no match is found.
- * <LI><code>getAllMatches</code>: returns an array of all
- * non-overlapping matches found in the input text. If no matches are
- * found, the array is zero-length.
- * <LI><code>substitute</code>: substitute the first occurence of the
- * pattern in the input text with a replacement string (which may
- * include metacharacters $0-$9, see REMatch.substituteInto).
- * <LI><code>substituteAll</code>: same as above, but repeat for each
- * match before returning.
- * <LI><code>getMatchEnumeration</code>: returns an REMatchEnumeration
- * object that allows iteration over the matches (see
- * REMatchEnumeration for some reasons why you may want to do this
- * instead of using <code>getAllMatches</code>.
- * <P>
- *
- * These methods all have similar argument lists. The input can be a
- * String, a character array, a StringBuffer, or an
- * InputStream of some sort. Note that when using an
- * InputStream, the stream read position cannot be guaranteed after
- * attempting a match (this is not a bug, but a consequence of the way
- * regular expressions work). Using an REMatchEnumeration can
- * eliminate most positioning problems.
- *
- * <P>
- *
- * The optional index argument specifies the offset from the beginning
- * of the text at which the search should start (see the descriptions
- * of some of the execution flags for how this can affect positional
- * pattern operators). For an InputStream, this means an
- * offset from the current read position, so subsequent calls with the
- * same index argument on an InputStream will not
- * necessarily access the same position on the stream, whereas
- * repeated searches at a given index in a fixed string will return
- * consistent results.
- *
- * <P>
- * You can optionally affect the execution environment by using a
- * combination of execution flags (constants listed below).
- *
- * <P>
- * All operations on a regular expression are performed in a
- * thread-safe manner.
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- * @version 1.1.5-dev, to be released
- */
-
-public class RE extends REToken {
- // This String will be returned by getVersion()
- private static final String VERSION = "1.1.5-dev";
-
- // The localized strings are kept in a separate file
- private static ResourceBundle messages = PropertyResourceBundle.getBundle("gnu/regexp/MessagesBundle", Locale.getDefault());
-
- // These are, respectively, the first and last tokens in our linked list
- // If there is only one token, firstToken == lastToken
- private REToken firstToken, lastToken;
-
- // This is the number of subexpressions in this regular expression,
- // with a minimum value of zero. Returned by getNumSubs()
- private int numSubs;
-
- /** Minimum length, in characters, of any possible match. */
- private int minimumLength;
-
- /**
- * Compilation flag. Do not differentiate case. Subsequent
- * searches using this RE will be case insensitive.
- */
- public static final int REG_ICASE = 2;
-
- /**
- * Compilation flag. The match-any-character operator (dot)
- * will match a newline character. When set this overrides the syntax
- * bit RE_DOT_NEWLINE (see RESyntax for details). This is equivalent to
- * the "/s" operator in Perl.
- */
- public static final int REG_DOT_NEWLINE = 4;
-
- /**
- * Compilation flag. Use multiline mode. In this mode, the ^ and $
- * anchors will match based on newlines within the input. This is
- * equivalent to the "/m" operator in Perl.
- */
- public static final int REG_MULTILINE = 8;
-
- /**
- * Execution flag.
- * The match-beginning operator (^) will not match at the beginning
- * of the input string. Useful for matching on a substring when you
- * know the context of the input is such that position zero of the
- * input to the match test is not actually position zero of the text.
- * <P>
- * This example demonstrates the results of various ways of matching on
- * a substring.
- * <P>
- * <CODE>
- * String s = "food bar fool";<BR>
- * RE exp = new RE("^foo.");<BR>
- * REMatch m0 = exp.getMatch(s);<BR>
- * REMatch m1 = exp.getMatch(s.substring(8));<BR>
- * REMatch m2 = exp.getMatch(s.substring(8),0,RE.REG_NOTBOL); <BR>
- * REMatch m3 = exp.getMatch(s,8); <BR>
- * REMatch m4 = exp.getMatch(s,8,RE.REG_ANCHORINDEX); <BR>
- * <P>
- * // Results:<BR>
- * // m0.toString(): "food"<BR>
- * // m1.toString(): "fool"<BR>
- * // m2.toString(): null<BR>
- * // m3.toString(): null<BR>
- * // m4.toString(): "fool"<BR>
- * </CODE>
- */
- public static final int REG_NOTBOL = 16;
-
- /**
- * Execution flag.
- * The match-end operator ($) does not match at the end
- * of the input string. Useful for matching on substrings.
- */
- public static final int REG_NOTEOL = 32;
-
- /**
- * Execution flag.
- * When a match method is invoked that starts matching at a non-zero
- * index into the input, treat the input as if it begins at the index
- * given. The effect of this flag is that the engine does not "see"
- * any text in the input before the given index. This is useful so
- * that the match-beginning operator (^) matches not at position 0
- * in the input string, but at the position the search started at
- * (based on the index input given to the getMatch function). See
- * the example under REG_NOTBOL. It also affects the use of the \&lt;
- * and \b operators.
- */
- public static final int REG_ANCHORINDEX = 64;
-
- /**
- * Execution flag.
- * The substitute and substituteAll methods will not attempt to
- * interpolate occurrences of $1-$9 in the replacement text with
- * the corresponding subexpressions. For example, you may want to
- * replace all matches of "one dollar" with "$1".
- */
- public static final int REG_NO_INTERPOLATE = 128;
-
- /** Returns a string representing the version of the gnu.regexp package. */
- public static final String version() {
- return VERSION;
- }
-
- // Retrieves a message from the ResourceBundle
- static final String getLocalizedMessage(String key) {
- return messages.getString(key);
- }
-
- /**
- * Constructs a regular expression pattern buffer without any compilation
- * flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @exception REException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public RE(Object pattern) throws REException {
- this(pattern,0,RESyntax.RE_SYNTAX_PERL5,0,0);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags listed above.
- * @exception REException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public RE(Object pattern, int cflags) throws REException {
- this(pattern,cflags,RESyntax.RE_SYNTAX_PERL5,0,0);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and regular expression syntax.
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags listed above.
- * @param syntax The type of regular expression syntax to use.
- * @exception REException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public RE(Object pattern, int cflags, RESyntax syntax) throws REException {
- this(pattern,cflags,syntax,0,0);
- }
-
- // internal constructor used for alternation
- private RE(REToken first, REToken last,int subs, int subIndex, int minLength) {
- super(subIndex);
- firstToken = first;
- lastToken = last;
- numSubs = subs;
- minimumLength = minLength;
- addToken(new RETokenEndSub(subIndex));
- }
-
- private RE(Object patternObj, int cflags, RESyntax syntax, int myIndex, int nextSub) throws REException {
- super(myIndex); // Subexpression index of this token.
- initialize(patternObj, cflags, syntax, myIndex, nextSub);
- }
-
- // For use by subclasses
- protected RE() { super(0); }
-
- // The meat of construction
- protected void initialize(Object patternObj, int cflags, RESyntax syntax, int myIndex, int nextSub) throws REException {
- char[] pattern;
- if (patternObj instanceof String) {
- pattern = ((String) patternObj).toCharArray();
- } else if (patternObj instanceof char[]) {
- pattern = (char[]) patternObj;
- } else if (patternObj instanceof StringBuffer) {
- pattern = new char [((StringBuffer) patternObj).length()];
- ((StringBuffer) patternObj).getChars(0,pattern.length,pattern,0);
- } else {
- pattern = patternObj.toString().toCharArray();
- }
-
- int pLength = pattern.length;
-
- numSubs = 0; // Number of subexpressions in this token.
- Vector branches = null;
-
- // linked list of tokens (sort of -- some closed loops can exist)
- firstToken = lastToken = null;
-
- // Precalculate these so we don't pay for the math every time we
- // need to access them.
- boolean insens = ((cflags & REG_ICASE) > 0);
-
- // Parse pattern into tokens. Does anyone know if it's more efficient
- // to use char[] than a String.charAt()? I'm assuming so.
-
- // index tracks the position in the char array
- int index = 0;
-
- // this will be the current parse character (pattern[index])
- CharUnit unit = new CharUnit();
-
- // This is used for {x,y} calculations
- IntPair minMax = new IntPair();
-
- // Buffer a token so we can create a TokenRepeated, etc.
- REToken currentToken = null;
- char ch;
-
- while (index < pLength) {
- // read the next character unit (including backslash escapes)
- index = getCharUnit(pattern,index,unit);
-
- // ALTERNATION OPERATOR
- // \| or | (if RE_NO_BK_VBAR) or newline (if RE_NEWLINE_ALT)
- // not available if RE_LIMITED_OPS is set
-
- // TODO: the '\n' literal here should be a test against REToken.newline,
- // which unfortunately may be more than a single character.
- if ( ( (unit.ch == '|' && (syntax.get(RESyntax.RE_NO_BK_VBAR) ^ unit.bk))
- || (syntax.get(RESyntax.RE_NEWLINE_ALT) && (unit.ch == '\n') && !unit.bk) )
- && !syntax.get(RESyntax.RE_LIMITED_OPS)) {
- // make everything up to here be a branch. create vector if nec.
- addToken(currentToken);
- RE theBranch = new RE(firstToken, lastToken, numSubs, subIndex, minimumLength);
- minimumLength = 0;
- if (branches == null) {
- branches = new Vector();
- }
- branches.addElement(theBranch);
- firstToken = lastToken = currentToken = null;
- }
-
- // INTERVAL OPERATOR:
- // {x} | {x,} | {x,y} (RE_INTERVALS && RE_NO_BK_BRACES)
- // \{x\} | \{x,\} | \{x,y\} (RE_INTERVALS && !RE_NO_BK_BRACES)
- //
- // OPEN QUESTION:
- // what is proper interpretation of '{' at start of string?
-
- else if ((unit.ch == '{') && syntax.get(RESyntax.RE_INTERVALS) && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ unit.bk)) {
- int newIndex = getMinMax(pattern,index,minMax,syntax);
- if (newIndex > index) {
- if (minMax.first > minMax.second)
- throw new REException(getLocalizedMessage("interval.order"),REException.REG_BADRPT,newIndex);
- if (currentToken == null)
- throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,newIndex);
- if (currentToken instanceof RETokenRepeated)
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,newIndex);
- if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,newIndex);
- if ((currentToken.getMinimumLength() == 0) && (minMax.second == Integer.MAX_VALUE))
- throw new REException(getLocalizedMessage("repeat.empty.token"),REException.REG_BADRPT,newIndex);
- index = newIndex;
- currentToken = setRepeated(currentToken,minMax.first,minMax.second,index);
- }
- else {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,unit.ch,insens);
- }
- }
-
- // LIST OPERATOR:
- // [...] | [^...]
-
- else if ((unit.ch == '[') && !unit.bk) {
- Vector options = new Vector();
- boolean negative = false;
- char lastChar = 0;
- if (index == pLength) throw new REException(getLocalizedMessage("unmatched.bracket"),REException.REG_EBRACK,index);
-
- // Check for initial caret, negation
- if ((ch = pattern[index]) == '^') {
- negative = true;
- if (++index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- ch = pattern[index];
- }
-
- // Check for leading right bracket literal
- if (ch == ']') {
- lastChar = ch;
- if (++index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- }
-
- while ((ch = pattern[index++]) != ']') {
- if ((ch == '-') && (lastChar != 0)) {
- if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- if ((ch = pattern[index]) == ']') {
- options.addElement(new RETokenChar(subIndex,lastChar,insens));
- lastChar = '-';
- } else {
- options.addElement(new RETokenRange(subIndex,lastChar,ch,insens));
- lastChar = 0;
- index++;
- }
- } else if ((ch == '\\') && syntax.get(RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) {
- if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- int posixID = -1;
- boolean negate = false;
- char asciiEsc = 0;
- if (("dswDSW".indexOf(pattern[index]) != -1) && syntax.get(RESyntax.RE_CHAR_CLASS_ESC_IN_LISTS)) {
- switch (pattern[index]) {
- case 'D':
- negate = true;
- case 'd':
- posixID = RETokenPOSIX.DIGIT;
- break;
- case 'S':
- negate = true;
- case 's':
- posixID = RETokenPOSIX.SPACE;
- break;
- case 'W':
- negate = true;
- case 'w':
- posixID = RETokenPOSIX.ALNUM;
- break;
- }
- }
- else if ("nrt".indexOf(pattern[index]) != -1) {
- switch (pattern[index]) {
- case 'n':
- asciiEsc = '\n';
- break;
- case 't':
- asciiEsc = '\t';
- break;
- case 'r':
- asciiEsc = '\r';
- break;
- }
- }
- if (lastChar != 0) options.addElement(new RETokenChar(subIndex,lastChar,insens));
-
- if (posixID != -1) {
- options.addElement(new RETokenPOSIX(subIndex,posixID,insens,negate));
- } else if (asciiEsc != 0) {
- lastChar = asciiEsc;
- } else {
- lastChar = pattern[index];
- }
- ++index;
- } else if ((ch == '[') && (syntax.get(RESyntax.RE_CHAR_CLASSES)) && (index < pLength) && (pattern[index] == ':')) {
- StringBuffer posixSet = new StringBuffer();
- index = getPosixSet(pattern,index+1,posixSet);
- int posixId = RETokenPOSIX.intValue(posixSet.toString());
- if (posixId != -1)
- options.addElement(new RETokenPOSIX(subIndex,posixId,insens,false));
- } else {
- if (lastChar != 0) options.addElement(new RETokenChar(subIndex,lastChar,insens));
- lastChar = ch;
- }
- if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- } // while in list
- // Out of list, index is one past ']'
-
- if (lastChar != 0) options.addElement(new RETokenChar(subIndex,lastChar,insens));
-
- // Create a new RETokenOneOf
- addToken(currentToken);
- options.trimToSize();
- currentToken = new RETokenOneOf(subIndex,options,negative);
- }
-
- // SUBEXPRESSIONS
- // (...) | \(...\) depending on RE_NO_BK_PARENS
-
- else if ((unit.ch == '(') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk)) {
- boolean pure = false;
- boolean comment = false;
- if ((index+1 < pLength) && (pattern[index] == '?')) {
- switch (pattern[index+1]) {
- case ':':
- if (syntax.get(RESyntax.RE_PURE_GROUPING)) {
- pure = true;
- index += 2;
- }
- break;
- case '#':
- if (syntax.get(RESyntax.RE_COMMENTS)) {
- comment = true;
- }
- break;
- default:
- throw new REException(getLocalizedMessage("repeat.no.token"), REException.REG_BADRPT, index);
- }
- }
-
- if (index >= pLength) {
- throw new REException(getLocalizedMessage("unmatched.paren"), REException.REG_ESUBREG,index);
- }
-
- // find end of subexpression
- int endIndex = index;
- int nextIndex = index;
- int nested = 0;
-
- while ( ((nextIndex = getCharUnit(pattern,endIndex,unit)) > 0)
- && !(nested == 0 && (unit.ch == ')') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk)) )
- if ((endIndex = nextIndex) >= pLength)
- throw new REException(getLocalizedMessage("subexpr.no.end"),REException.REG_ESUBREG,nextIndex);
- else if (unit.ch == '(' && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk))
- nested++;
- else if (unit.ch == ')' && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk))
- nested--;
-
- // endIndex is now position at a ')','\)'
- // nextIndex is end of string or position after ')' or '\)'
-
- if (comment) index = nextIndex;
- else { // not a comment
- // create RE subexpression as token.
- addToken(currentToken);
- if (!pure) {
- numSubs++;
- }
-
- int useIndex = (pure) ? 0 : nextSub + numSubs;
- currentToken = new RE(String.valueOf(pattern,index,endIndex-index).toCharArray(),cflags,syntax,useIndex,nextSub + numSubs);
- numSubs += ((RE) currentToken).getNumSubs();
-
- index = nextIndex;
- } // not a comment
- } // subexpression
-
- // UNMATCHED RIGHT PAREN
- // ) or \) throw exception if
- // !syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD)
- else if (!syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD) && ((unit.ch == ')') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk))) {
- throw new REException(getLocalizedMessage("unmatched.paren"),REException.REG_EPAREN,index);
- }
-
- // START OF LINE OPERATOR
- // ^
-
- else if ((unit.ch == '^') && !unit.bk) {
- addToken(currentToken);
- currentToken = null;
- addToken(new RETokenStart(subIndex,((cflags & REG_MULTILINE) > 0) ? syntax.getLineSeparator() : null));
- }
-
- // END OF LINE OPERATOR
- // $
-
- else if ((unit.ch == '$') && !unit.bk) {
- addToken(currentToken);
- currentToken = null;
- addToken(new RETokenEnd(subIndex,((cflags & REG_MULTILINE) > 0) ? syntax.getLineSeparator() : null));
- }
-
- // MATCH-ANY-CHARACTER OPERATOR (except possibly newline and null)
- // .
-
- else if ((unit.ch == '.') && !unit.bk) {
- addToken(currentToken);
- currentToken = new RETokenAny(subIndex,syntax.get(RESyntax.RE_DOT_NEWLINE) || ((cflags & REG_DOT_NEWLINE) > 0),syntax.get(RESyntax.RE_DOT_NOT_NULL));
- }
-
- // ZERO-OR-MORE REPEAT OPERATOR
- // *
-
- else if ((unit.ch == '*') && !unit.bk) {
- if (currentToken == null)
- throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
- if (currentToken instanceof RETokenRepeated)
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,index);
- if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,index);
- if (currentToken.getMinimumLength() == 0)
- throw new REException(getLocalizedMessage("repeat.empty.token"),REException.REG_BADRPT,index);
- currentToken = setRepeated(currentToken,0,Integer.MAX_VALUE,index);
- }
-
- // ONE-OR-MORE REPEAT OPERATOR
- // + | \+ depending on RE_BK_PLUS_QM
- // not available if RE_LIMITED_OPS is set
-
- else if ((unit.ch == '+') && !syntax.get(RESyntax.RE_LIMITED_OPS) && (!syntax.get(RESyntax.RE_BK_PLUS_QM) ^ unit.bk)) {
- if (currentToken == null)
- throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
- if (currentToken instanceof RETokenRepeated)
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,index);
- if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,index);
- if (currentToken.getMinimumLength() == 0)
- throw new REException(getLocalizedMessage("repeat.empty.token"),REException.REG_BADRPT,index);
- currentToken = setRepeated(currentToken,1,Integer.MAX_VALUE,index);
- }
-
- // ZERO-OR-ONE REPEAT OPERATOR / STINGY MATCHING OPERATOR
- // ? | \? depending on RE_BK_PLUS_QM
- // not available if RE_LIMITED_OPS is set
- // stingy matching if RE_STINGY_OPS is set and it follows a quantifier
-
- else if ((unit.ch == '?') && !syntax.get(RESyntax.RE_LIMITED_OPS) && (!syntax.get(RESyntax.RE_BK_PLUS_QM) ^ unit.bk)) {
- if (currentToken == null) throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
-
- // Check for stingy matching on RETokenRepeated
- if (currentToken instanceof RETokenRepeated) {
- if (syntax.get(RESyntax.RE_STINGY_OPS) && !((RETokenRepeated)currentToken).isStingy())
- ((RETokenRepeated)currentToken).makeStingy();
- else
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,index);
- }
- else if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,index);
- else
- currentToken = setRepeated(currentToken,0,1,index);
- }
-
- // BACKREFERENCE OPERATOR
- // \1 \2 ... \9
- // not available if RE_NO_BK_REFS is set
-
- else if (unit.bk && Character.isDigit(unit.ch) && !syntax.get(RESyntax.RE_NO_BK_REFS)) {
- addToken(currentToken);
- currentToken = new RETokenBackRef(subIndex,Character.digit(unit.ch,10),insens);
- }
-
- // START OF STRING OPERATOR
- // \A if RE_STRING_ANCHORS is set
-
- else if (unit.bk && (unit.ch == 'A') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenStart(subIndex,null);
- }
-
- // WORD BREAK OPERATOR
- // \b if ????
-
- else if (unit.bk && (unit.ch == 'b') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.BEGIN | RETokenWordBoundary.END, false);
- }
-
- // WORD BEGIN OPERATOR
- // \< if ????
- else if (unit.bk && (unit.ch == '<')) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.BEGIN, false);
- }
-
- // WORD END OPERATOR
- // \> if ????
- else if (unit.bk && (unit.ch == '>')) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.END, false);
- }
-
- // NON-WORD BREAK OPERATOR
- // \B if ????
-
- else if (unit.bk && (unit.ch == 'B') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.BEGIN | RETokenWordBoundary.END, true);
- }
-
-
- // DIGIT OPERATOR
- // \d if RE_CHAR_CLASS_ESCAPES is set
-
- else if (unit.bk && (unit.ch == 'd') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,false);
- }
-
- // NON-DIGIT OPERATOR
- // \D
-
- else if (unit.bk && (unit.ch == 'D') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,true);
- }
-
- // NEWLINE ESCAPE
- // \n
-
- else if (unit.bk && (unit.ch == 'n')) {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,'\n',false);
- }
-
- // RETURN ESCAPE
- // \r
-
- else if (unit.bk && (unit.ch == 'r')) {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,'\r',false);
- }
-
- // WHITESPACE OPERATOR
- // \s if RE_CHAR_CLASS_ESCAPES is set
-
- else if (unit.bk && (unit.ch == 's') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,false);
- }
-
- // NON-WHITESPACE OPERATOR
- // \S
-
- else if (unit.bk && (unit.ch == 'S') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,true);
- }
-
- // TAB ESCAPE
- // \t
-
- else if (unit.bk && (unit.ch == 't')) {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,'\t',false);
- }
-
- // ALPHANUMERIC OPERATOR
- // \w
-
- else if (unit.bk && (unit.ch == 'w') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,false);
- }
-
- // NON-ALPHANUMERIC OPERATOR
- // \W
-
- else if (unit.bk && (unit.ch == 'W') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,true);
- }
-
- // END OF STRING OPERATOR
- // \Z
-
- else if (unit.bk && (unit.ch == 'Z') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenEnd(subIndex,null);
- }
-
- // NON-SPECIAL CHARACTER (or escape to make literal)
- // c | \* for example
-
- else { // not a special character
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,unit.ch,insens);
- }
- } // end while
-
- // Add final buffered token and an EndSub marker
- addToken(currentToken);
-
- if (branches != null) {
- branches.addElement(new RE(firstToken,lastToken,numSubs,subIndex,minimumLength));
- branches.trimToSize(); // compact the Vector
- minimumLength = 0;
- firstToken = lastToken = null;
- addToken(new RETokenOneOf(subIndex,branches,false));
- }
- else addToken(new RETokenEndSub(subIndex));
-
- }
-
- private static int getCharUnit(char[] input, int index, CharUnit unit) throws REException {
- unit.ch = input[index++];
- if (unit.bk = (unit.ch == '\\'))
- if (index < input.length)
- unit.ch = input[index++];
- else throw new REException(getLocalizedMessage("ends.with.backslash"),REException.REG_ESCAPE,index);
- return index;
- }
-
- /**
- * Checks if the regular expression matches the input in its entirety.
- *
- * @param input The input text.
- */
- public boolean isMatch(Object input) {
- return isMatch(input,0,0);
- }
-
- /**
- * Checks if the input string, starting from index, is an exact match of
- * this regular expression.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- */
- public boolean isMatch(Object input,int index) {
- return isMatch(input,index,0);
- }
-
-
- /**
- * Checks if the input, starting from index and using the specified
- * execution flags, is an exact match of this regular expression.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- */
- public boolean isMatch(Object input,int index,int eflags) {
- return isMatchImpl(makeCharIndexed(input,index),index,eflags);
- }
-
- private boolean isMatchImpl(CharIndexed input, int index, int eflags) {
- if (firstToken == null) // Trivial case
- return (input.charAt(0) == CharIndexed.OUT_OF_BOUNDS);
- REMatch m = new REMatch(numSubs, index, eflags);
- if (firstToken.match(input, m)) {
- while (m != null) {
- if (input.charAt(m.index) == CharIndexed.OUT_OF_BOUNDS) {
- return true;
- }
- m = m.next;
- }
- }
- return false;
- }
-
- /**
- * Returns the maximum number of subexpressions in this regular expression.
- * If the expression contains branches, the value returned will be the
- * maximum subexpressions in any of the branches.
- */
- public int getNumSubs() {
- return numSubs;
- }
-
- // Overrides REToken.setUncle
- void setUncle(REToken uncle) {
- if (lastToken != null) {
- lastToken.setUncle(uncle);
- } else super.setUncle(uncle); // to deal with empty subexpressions
- }
-
- // Overrides REToken.chain
-
- boolean chain(REToken next) {
- super.chain(next);
- setUncle(next);
- return true;
- }
-
- /**
- * Returns the minimum number of characters that could possibly
- * constitute a match of this regular expression.
- */
- public int getMinimumLength() {
- return minimumLength;
- }
-
- /**
- * Returns an array of all matches found in the input.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @return a non-null (but possibly zero-length) array of matches
- */
- public REMatch[] getAllMatches(Object input) {
- return getAllMatches(input,0,0);
- }
-
- /**
- * Returns an array of all matches found in the input,
- * beginning at the specified index position.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @return a non-null (but possibly zero-length) array of matches
- */
- public REMatch[] getAllMatches(Object input, int index) {
- return getAllMatches(input,index,0);
- }
-
- /**
- * Returns an array of all matches found in the input string,
- * beginning at the specified index position and using the specified
- * execution flags.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return a non-null (but possibly zero-length) array of matches
- */
- public REMatch[] getAllMatches(Object input, int index, int eflags) {
- return getAllMatchesImpl(makeCharIndexed(input,index),index,eflags);
- }
-
- // this has been changed since 1.03 to be non-overlapping matches
- private REMatch[] getAllMatchesImpl(CharIndexed input, int index, int eflags) {
- Vector all = new Vector();
- REMatch m = null;
- while ((m = getMatchImpl(input,index,eflags,null)) != null) {
- all.addElement(m);
- index = m.getEndIndex();
- if (m.end[0] == 0) { // handle pathological case of zero-length match
- index++;
- input.move(1);
- } else {
- input.move(m.end[0]);
- }
- if (!input.isValid()) break;
- }
- REMatch[] mset = new REMatch[all.size()];
- all.copyInto(mset);
- return mset;
- }
-
- /* Implements abstract method REToken.match() */
- boolean match(CharIndexed input, REMatch mymatch) {
- if (firstToken == null) return next(input, mymatch);
-
- // Note the start of this subexpression
- mymatch.start[subIndex] = mymatch.index;
-
- return firstToken.match(input, mymatch);
- }
-
- /**
- * Returns the first match found in the input. If no match is found,
- * null is returned.
- *
- * @param input The input text.
- * @return An REMatch instance referencing the match, or null if none.
- */
- public REMatch getMatch(Object input) {
- return getMatch(input,0,0);
- }
-
- /**
- * Returns the first match found in the input, beginning
- * the search at the specified index. If no match is found,
- * returns null.
- *
- * @param input The input text.
- * @param index The offset within the text to begin looking for a match.
- * @return An REMatch instance referencing the match, or null if none.
- */
- public REMatch getMatch(Object input, int index) {
- return getMatch(input,index,0);
- }
-
- /**
- * Returns the first match found in the input, beginning
- * the search at the specified index, and using the specified
- * execution flags. If no match is found, returns null.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return An REMatch instance referencing the match, or null if none.
- */
- public REMatch getMatch(Object input, int index, int eflags) {
- return getMatch(input,index,eflags,null);
- }
-
- /**
- * Returns the first match found in the input, beginning the search
- * at the specified index, and using the specified execution flags.
- * If no match is found, returns null. If a StringBuffer is
- * provided and is non-null, the contents of the input text from the
- * index to the beginning of the match (or to the end of the input,
- * if there is no match) are appended to the StringBuffer.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @param buffer The StringBuffer to save pre-match text in.
- * @return An REMatch instance referencing the match, or null if none. */
- public REMatch getMatch(Object input, int index, int eflags, StringBuffer buffer) {
- return getMatchImpl(makeCharIndexed(input,index),index,eflags,buffer);
- }
-
- REMatch getMatchImpl(CharIndexed input, int anchor, int eflags, StringBuffer buffer) {
- // Create a new REMatch to hold results
- REMatch mymatch = new REMatch(numSubs, anchor, eflags);
- do {
- // Optimization: check if anchor + minimumLength > length
- if (minimumLength == 0 || input.charAt(minimumLength-1) != CharIndexed.OUT_OF_BOUNDS) {
- if (match(input, mymatch)) {
- // Find longest match of them all to observe leftmost longest
- REMatch longest = mymatch;
- while ((mymatch = mymatch.next) != null) {
- if (mymatch.index > longest.index) {
- longest = mymatch;
- }
- }
-
- longest.end[0] = longest.index;
- longest.finish(input);
- return longest;
- }
- }
- mymatch.clear(++anchor);
- // Append character to buffer if needed
- if (buffer != null && input.charAt(0) != CharIndexed.OUT_OF_BOUNDS) {
- buffer.append(input.charAt(0));
- }
- } while (input.move(1));
-
- // Special handling at end of input for e.g. "$"
- if (minimumLength == 0) {
- if (match(input, mymatch)) {
- mymatch.finish(input);
- return mymatch;
- }
- }
-
- return null;
- }
-
- /**
- * Returns an REMatchEnumeration that can be used to iterate over the
- * matches found in the input text.
- *
- * @param input The input text.
- * @return A non-null REMatchEnumeration instance.
- */
- public REMatchEnumeration getMatchEnumeration(Object input) {
- return getMatchEnumeration(input,0,0);
- }
-
-
- /**
- * Returns an REMatchEnumeration that can be used to iterate over the
- * matches found in the input text.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @return A non-null REMatchEnumeration instance, with its input cursor
- * set to the index position specified.
- */
- public REMatchEnumeration getMatchEnumeration(Object input, int index) {
- return getMatchEnumeration(input,index,0);
- }
-
- /**
- * Returns an REMatchEnumeration that can be used to iterate over the
- * matches found in the input text.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return A non-null REMatchEnumeration instance, with its input cursor
- * set to the index position specified.
- */
- public REMatchEnumeration getMatchEnumeration(Object input, int index, int eflags) {
- return new REMatchEnumeration(this,makeCharIndexed(input,index),index,eflags);
- }
-
-
- /**
- * Substitutes the replacement text for the first match found in the input.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @return A String interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substitute(Object input,String replace) {
- return substitute(input,replace,0,0);
- }
-
- /**
- * Substitutes the replacement text for the first match found in the input
- * beginning at the specified index position. Specifying an index
- * effectively causes the regular expression engine to throw away the
- * specified number of characters.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substitute(Object input,String replace,int index) {
- return substitute(input,replace,index,0);
- }
-
- /**
- * Substitutes the replacement text for the first match found in the input
- * string, beginning at the specified index position and using the
- * specified execution flags.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substitute(Object input,String replace,int index,int eflags) {
- return substituteImpl(makeCharIndexed(input,index),replace,index,eflags);
- }
-
- private String substituteImpl(CharIndexed input,String replace,int index,int eflags) {
- StringBuffer buffer = new StringBuffer();
- REMatch m = getMatchImpl(input,index,eflags,buffer);
- if (m==null) return buffer.toString();
- buffer.append( ((eflags & REG_NO_INTERPOLATE) > 0) ?
- replace : m.substituteInto(replace) );
- if (input.move(m.end[0])) {
- do {
- buffer.append(input.charAt(0));
- } while (input.move(1));
- }
- return buffer.toString();
- }
-
- /**
- * Substitutes the replacement text for each non-overlapping match found
- * in the input text.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @return A String interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substituteAll(Object input,String replace) {
- return substituteAll(input,replace,0,0);
- }
-
- /**
- * Substitutes the replacement text for each non-overlapping match found
- * in the input text, starting at the specified index.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substituteAll(Object input,String replace,int index) {
- return substituteAll(input,replace,index,0);
- }
-
- /**
- * Substitutes the replacement text for each non-overlapping match found
- * in the input text, starting at the specified index and using the
- * specified execution flags.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substituteAll(Object input,String replace,int index,int eflags) {
- return substituteAllImpl(makeCharIndexed(input,index),replace,index,eflags);
- }
-
- private String substituteAllImpl(CharIndexed input,String replace,int index,int eflags) {
- StringBuffer buffer = new StringBuffer();
- REMatch m;
- while ((m = getMatchImpl(input,index,eflags,buffer)) != null) {
- buffer.append( ((eflags & REG_NO_INTERPOLATE) > 0) ?
- replace : m.substituteInto(replace) );
- index = m.getEndIndex();
- if (m.end[0] == 0) {
- char ch = input.charAt(0);
- if (ch != CharIndexed.OUT_OF_BOUNDS)
- buffer.append(ch);
- input.move(1);
- } else {
- input.move(m.end[0]);
- }
-
- if (!input.isValid()) break;
- }
- return buffer.toString();
- }
-
- /* Helper function for constructor */
- private void addToken(REToken next) {
- if (next == null) return;
- minimumLength += next.getMinimumLength();
- if (firstToken == null) {
- lastToken = firstToken = next;
- } else {
- // if chain returns false, it "rejected" the token due to
- // an optimization, and next was combined with lastToken
- if (lastToken.chain(next)) {
- lastToken = next;
- }
- }
- }
-
- private static REToken setRepeated(REToken current, int min, int max, int index) throws REException {
- if (current == null) throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
- return new RETokenRepeated(current.subIndex,current,min,max);
- }
-
- private static int getPosixSet(char[] pattern,int index,StringBuffer buf) {
- // Precondition: pattern[index-1] == ':'
- // we will return pos of closing ']'.
- int i;
- for (i=index; i<(pattern.length-1); i++) {
- if ((pattern[i] == ':') && (pattern[i+1] == ']'))
- return i+2;
- buf.append(pattern[i]);
- }
- return index; // didn't match up
- }
-
- private int getMinMax(char[] input,int index,IntPair minMax,RESyntax syntax) throws REException {
- // Precondition: input[index-1] == '{', minMax != null
-
- boolean mustMatch = !syntax.get(RESyntax.RE_NO_BK_BRACES);
- int startIndex = index;
- if (index == input.length) {
- if (mustMatch)
- throw new REException(getLocalizedMessage("unmatched.brace"),REException.REG_EBRACE,index);
- else
- return startIndex;
- }
-
- int min,max=0;
- CharUnit unit = new CharUnit();
- StringBuffer buf = new StringBuffer();
-
- // Read string of digits
- do {
- index = getCharUnit(input,index,unit);
- if (Character.isDigit(unit.ch))
- buf.append(unit.ch);
- } while ((index != input.length) && Character.isDigit(unit.ch));
-
- // Check for {} tomfoolery
- if (buf.length() == 0) {
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);
- else
- return startIndex;
- }
-
- min = Integer.parseInt(buf.toString());
-
- if ((unit.ch == '}') && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ unit.bk))
- max = min;
- else if (index == input.length)
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.no.end"),REException.REG_EBRACE,index);
- else
- return startIndex;
- else if ((unit.ch == ',') && !unit.bk) {
- buf = new StringBuffer();
- // Read string of digits
- while (((index = getCharUnit(input,index,unit)) != input.length) && Character.isDigit(unit.ch))
- buf.append(unit.ch);
-
- if (!((unit.ch == '}') && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ unit.bk)))
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);
- else
- return startIndex;
-
- // This is the case of {x,}
- if (buf.length() == 0) max = Integer.MAX_VALUE;
- else max = Integer.parseInt(buf.toString());
- } else
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);
- else
- return startIndex;
-
- // We know min and max now, and they are valid.
-
- minMax.first = min;
- minMax.second = max;
-
- // return the index following the '}'
- return index;
- }
-
- /**
- * Return a human readable form of the compiled regular expression,
- * useful for debugging.
- */
- public String toString() {
- StringBuffer sb = new StringBuffer();
- dump(sb);
- return sb.toString();
- }
-
- void dump(StringBuffer os) {
- os.append('(');
- if (subIndex == 0)
- os.append("?:");
- if (firstToken != null)
- firstToken.dumpAll(os);
- os.append(')');
- }
-
- // Cast input appropriately or throw exception
- private static CharIndexed makeCharIndexed(Object input, int index) {
- // We could let a String fall through to final input, but since
- // it's the most likely input type, we check it first.
- if (input instanceof String)
- return new CharIndexedString((String) input,index);
- else if (input instanceof char[])
- return new CharIndexedCharArray((char[]) input,index);
- else if (input instanceof StringBuffer)
- return new CharIndexedStringBuffer((StringBuffer) input,index);
- else if (input instanceof InputStream)
- return new CharIndexedInputStream((InputStream) input,index);
- else if (input instanceof CharIndexed)
- return (CharIndexed) input; // do we lose index info?
- else
- return new CharIndexedString(input.toString(), index);
- }
-}
diff --git a/libjava/gnu/regexp/REException.java b/libjava/gnu/regexp/REException.java
deleted file mode 100644
index a10d2fc71fe..00000000000
--- a/libjava/gnu/regexp/REException.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/* gnu/regexp/REException.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-
-import java.text.MessageFormat;
-
-/**
- * This is the regular expression exception class. An exception of this type
- * defines the three attributes:
- * <OL>
- * <LI> A descriptive message of the error.
- * <LI> An integral type code equivalent to one of the statically
- * defined symbols listed below.
- * <LI> The approximate position in the input string where the error
- * occurred.
- * </OL>
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- */
-
-public class REException extends Exception {
- private int type;
- private int pos;
-
- // Error conditions from GNU regcomp(3) manual
-
- /**
- * Error flag.
- * Invalid use of repetition operators such as using
- * `*' as the first character.
- */
- public static final int REG_BADRPT = 1;
-
- /**
- * Error flag.
- * Invalid use of back reference operator.
- */
- public static final int REG_BADBR = 2;
-
- /**
- * Error flag.
- * Un-matched brace interval operators.
- */
- public static final int REG_EBRACE = 3;
-
- /**
- * Error flag.
- * Un-matched bracket list operators.
- */
- public static final int REG_EBRACK = 4;
-
- /**
- * Error flag.
- * Invalid use of the range operator, eg. the ending
- * point of the range occurs prior to the starting
- * point.
- */
- public static final int REG_ERANGE = 5;
-
- /**
- * Error flag.
- * Unknown character class name. <B>Not implemented</B>.
- */
- public static final int REG_ECTYPE = 6;
-
- /**
- * Error flag.
- * Un-matched parenthesis group operators.
- */
- public static final int REG_EPAREN = 7;
-
- /**
- * Error flag.
- * Invalid back reference to a subexpression.
- */
- public static final int REG_ESUBREG = 8;
-
- /**
- * Error flag.
- * Non specific error. <B>Not implemented</B>.
- */
- public static final int REG_EEND = 9;
-
- /**
- * Error flag.
- * Invalid escape sequence. <B>Not implemented</B>.
- */
- public static final int REG_ESCAPE = 10;
-
- /**
- * Error flag.
- * Invalid use of pattern operators such as group or list.
- */
- public static final int REG_BADPAT = 11;
-
- /**
- * Error flag.
- * Compiled regular expression requires a pattern
- * buffer larger than 64Kb. <B>Not implemented</B>.
- */
- public static final int REG_ESIZE = 12;
-
- /**
- * Error flag.
- * The regex routines ran out of memory. <B>Not implemented</B>.
- */
- public static final int REG_ESPACE = 13;
-
- REException(String msg, int type, int position) {
- super(msg);
- this.type = type;
- this.pos = position;
- }
-
- /**
- * Returns the type of the exception, one of the constants listed above.
- */
-
- public int getType() {
- return type;
- }
-
- /**
- * Returns the position, relative to the string or character array being
- * compiled, where the error occurred. This position is generally the point
- * where the error was detected, not necessarily the starting index of
- * a bad subexpression.
- */
- public int getPosition() {
- return pos;
- }
-
- /**
- * Reports the descriptive message associated with this exception
- * as well as its index position in the string or character array
- * being compiled.
- */
- public String getMessage() {
- Object[] args = {new Integer(pos)};
- StringBuffer sb = new StringBuffer();
- String prefix = RE.getLocalizedMessage("error.prefix");
- sb.append(MessageFormat.format(prefix, args));
- sb.append('\n');
- sb.append(super.getMessage());
- return sb.toString();
- }
-}
diff --git a/libjava/gnu/regexp/REFilterInputStream.java b/libjava/gnu/regexp/REFilterInputStream.java
deleted file mode 100644
index f56a9a2a9cb..00000000000
--- a/libjava/gnu/regexp/REFilterInputStream.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* gnu/regexp/REFilterInputStream.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-import java.io.FilterInputStream;
-import java.io.InputStream;
-
-/**
- * Replaces instances of a given RE found within an InputStream
- * with replacement text. The replacements are interpolated into the
- * stream when a match is found.
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- * @deprecated This class cannot properly handle all character
- * encodings. For proper handling, use the REFilterReader
- * class instead.
- */
-
-public class REFilterInputStream extends FilterInputStream {
-
- private RE expr;
- private String replace;
- private String buffer;
- private int bufpos;
- private int offset;
- private CharIndexedInputStream stream;
-
- /**
- * Creates an REFilterInputStream. When reading from this stream,
- * occurrences of patterns matching the supplied regular expression
- * will be replaced with the supplied replacement text (the
- * metacharacters $0 through $9 may be used to refer to the full
- * match or subexpression matches).
- *
- * @param stream The InputStream to be filtered.
- * @param expr The regular expression to search for.
- * @param replace The text pattern to replace matches with.
- */
- public REFilterInputStream(InputStream stream, RE expr, String replace) {
- super(stream);
- this.stream = new CharIndexedInputStream(stream,0);
- this.expr = expr;
- this.replace = replace;
- }
-
- /**
- * Reads the next byte from the stream per the general contract of
- * InputStream.read(). Returns -1 on error or end of stream.
- */
- public int read() {
- // If we have buffered replace data, use it.
- if ((buffer != null) && (bufpos < buffer.length())) {
- return (int) buffer.charAt(bufpos++);
- }
-
- // check if input is at a valid position
- if (!stream.isValid()) return -1;
-
- REMatch mymatch = new REMatch(expr.getNumSubs(),offset,0);
- if (expr.match(stream, mymatch)) {
- mymatch.end[0] = mymatch.index;
- mymatch.finish(stream);
- stream.move(mymatch.toString().length());
- offset += mymatch.toString().length();
- buffer = mymatch.substituteInto(replace);
- bufpos = 1;
-
- // This is prone to infinite loops if replace string turns out empty.
- if (buffer.length() > 0) {
- return buffer.charAt(0);
- }
- }
- char ch = stream.charAt(0);
- if (ch == CharIndexed.OUT_OF_BOUNDS) return -1;
- stream.move(1);
- offset++;
- return ch;
- }
-
- /**
- * Returns false. REFilterInputStream does not support mark() and
- * reset() methods.
- */
- public boolean markSupported() {
- return false;
- }
-
- /** Reads from the stream into the provided array. */
- public int read(byte[] b, int off, int len) {
- int i;
- int ok = 0;
- while (len-- > 0) {
- i = read();
- if (i == -1) return (ok == 0) ? -1 : ok;
- b[off++] = (byte) i;
- ok++;
- }
- return ok;
- }
-
- /** Reads from the stream into the provided array. */
- public int read(byte[] b) {
- return read(b,0,b.length);
- }
-}
diff --git a/libjava/gnu/regexp/REFilterReader.java b/libjava/gnu/regexp/REFilterReader.java
deleted file mode 100644
index 449efcc9b1c..00000000000
--- a/libjava/gnu/regexp/REFilterReader.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * gnu/regexp/REFilterReader.java
- * Copyright (C) 2001 Lee Sau Dan
- * Based on gnu.regexp.REFilterInputStream by Wes Biggs
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package gnu.regexp;
-import java.io.FilterReader;
-import java.io.Reader;
-
-/**
- * Replaces instances of a given RE with replacement text.
- *
- * @author <A HREF="http://www.csis.hku.hk/~sdlee/">Lee Sau Dan</A>
- * @since gnu.regexp 1.1.0
- */
-
-public class REFilterReader extends FilterReader {
-
- private RE expr;
- private String replace;
- private String buffer;
- private int bufpos;
- private int offset;
- private CharIndexedReader stream;
-
- /**
- * Creates an REFilterReader. When reading from this stream,
- * occurrences of patterns matching the supplied regular expression
- * will be replaced with the supplied replacement text (the
- * metacharacters $0 through $9 may be used to refer to the full
- * match or subexpression matches.
- *
- * @param stream The Reader to be filtered.
- * @param expr The regular expression to search for.
- * @param replace The text pattern to replace matches with.
- */
- public REFilterReader(Reader stream, RE expr, String replace) {
- super(stream);
- this.stream = new CharIndexedReader(stream,0);
- this.expr = expr;
- this.replace = replace;
- }
-
- /**
- * Reads the next character from the stream per the general contract of
- * Reader.read(). Returns -1 on error or end of stream.
- */
- public int read() {
- // If we have buffered replace data, use it.
- if ((buffer != null) && (bufpos < buffer.length())) {
- return (int) buffer.charAt(bufpos++);
- }
-
- // check if input is at a valid position
- if (!stream.isValid()) return -1;
-
- REMatch mymatch = new REMatch(expr.getNumSubs(),offset,0);
- if (expr.match(stream,mymatch)) {
- mymatch.end[0] = mymatch.index;
- mymatch.finish(stream);
- stream.move(mymatch.toString().length());
- offset += mymatch.toString().length();
- buffer = mymatch.substituteInto(replace);
- bufpos = 1;
-
- if (buffer.length() > 0) {
- return buffer.charAt(0);
- }
- }
- char ch = stream.charAt(0);
- if (ch == CharIndexed.OUT_OF_BOUNDS) return -1;
- stream.move(1);
- offset++;
- return ch;
- }
-
- /**
- * Returns false. REFilterReader does not support mark() and
- * reset() methods.
- */
- public boolean markSupported() {
- return false;
- }
-
- /** Reads from the stream into the provided array. */
- public int read(char[] b, int off, int len) {
- int i;
- int ok = 0;
- while (len-- > 0) {
- i = read();
- if (i == -1) return (ok == 0) ? -1 : ok;
- b[off++] = (char) i;
- ok++;
- }
- return ok;
- }
-
- /** Reads from the stream into the provided array. */
- public int read(char[] b) {
- return read(b,0,b.length);
- }
-}
diff --git a/libjava/gnu/regexp/REMatch.java b/libjava/gnu/regexp/REMatch.java
deleted file mode 100644
index ac6c80e9196..00000000000
--- a/libjava/gnu/regexp/REMatch.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/* gnu/regexp/REMatch.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-import java.io.Serializable;
-
-/**
- * An instance of this class represents a match
- * completed by a gnu.regexp matching function. It can be used
- * to obtain relevant information about the location of a match
- * or submatch.
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- */
-public final class REMatch implements Serializable, Cloneable {
- private String matchedText;
-
- // These variables are package scope for fast access within the engine
- int eflags; // execution flags this match was made using
-
- // Offset in source text where match was tried. This is zero-based;
- // the actual position in the source text is given by (offset + anchor).
- int offset;
-
- // Anchor position refers to the index into the source input
- // at which the matching operation began.
- // This is also useful for the ANCHORINDEX option.
- int anchor;
-
- // Package scope; used by RE.
- int index; // used while matching to mark current match position in input
- int[] start; // start positions (relative to offset) for each (sub)exp.
- int[] end; // end positions for the same
- REMatch next; // other possibility (to avoid having to use arrays)
-
- public Object clone() {
- try {
- REMatch copy = (REMatch) super.clone();
- copy.next = null;
-
- copy.start = (int[]) start.clone();
- copy.end = (int[]) end.clone();
-
- return copy;
- } catch (CloneNotSupportedException e) {
- throw new Error(); // doesn't happen
- }
- }
-
- void assignFrom(REMatch other) {
- start = other.start;
- end = other.end;
- index = other.index;
- // need to deep clone?
- next = other.next;
- }
-
- REMatch(int subs, int anchor, int eflags) {
- start = new int[subs+1];
- end = new int[subs+1];
- this.anchor = anchor;
- this.eflags = eflags;
- clear(anchor);
- }
-
- void finish(CharIndexed text) {
- start[0] = 0;
- StringBuffer sb = new StringBuffer();
- int i;
- for (i = 0; i < end[0]; i++)
- sb.append(text.charAt(i));
- matchedText = sb.toString();
- for (i = 0; i < start.length; i++) {
- // If any subexpressions didn't terminate, they don't count
- // TODO check if this code ever gets hit
- if ((start[i] == -1) ^ (end[i] == -1)) {
- start[i] = -1;
- end[i] = -1;
- }
- }
- next = null; // cut off alternates
- }
-
- /** Clears the current match and moves the offset to the new index. */
- void clear(int index) {
- offset = index;
- this.index = 0;
- for (int i = 0; i < start.length; i++) {
- start[i] = end[i] = -1;
- }
- next = null; // cut off alternates
- }
-
- /**
- * Returns the string matching the pattern. This makes it convenient
- * to write code like the following:
- * <P>
- * <code>
- * REMatch myMatch = myExpression.getMatch(myString);<br>
- * if (myMatch != null) System.out.println("Regexp found: "+myMatch);
- * </code>
- */
- public String toString() {
- return matchedText;
- }
-
- /**
- * Returns the index within the input text where the match in its entirety
- * began.
- */
- public int getStartIndex() {
- return offset + start[0];
- }
-
- /**
- * Returns the index within the input string where the match in
- * its entirety ends. The return value is the next position after
- * the end of the string; therefore, a match created by the
- * following call:
- *
- * <P>
- * <code>REMatch myMatch = myExpression.getMatch(myString);</code>
- * <P>
- * can be viewed (given that myMatch is not null) by creating
- * <P>
- * <code>String theMatch = myString.substring(myMatch.getStartIndex(),
- * myMatch.getEndIndex());</code>
- * <P>
- * But you can save yourself that work, since the <code>toString()</code>
- * method (above) does exactly that for you.
- */
- public int getEndIndex() {
- return offset + end[0];
- }
-
- /**
- * Returns the string matching the given subexpression. The subexpressions
- * are indexed starting with one, not zero. That is, the subexpression
- * identified by the first set of parentheses in a regular expression
- * could be retrieved from an REMatch by calling match.toString(1).
- *
- * @param sub Index of the subexpression.
- */
- public String toString(int sub) {
- if ((sub >= start.length) || (start[sub] == -1)) return "";
- return (matchedText.substring(start[sub],end[sub]));
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number <i>sub</i> begins, or <code>-1</code> if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- * @deprecated Use getStartIndex(int) instead.
- */
- public int getSubStartIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = start[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number <i>sub</i> begins, or <code>-1</code> if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- * @since gnu.regexp 1.1.0
- */
- public int getStartIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = start[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number <i>sub</i> ends, or <code>-1</code> if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- * @deprecated Use getEndIndex(int) instead
- */
- public int getSubEndIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = end[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number <i>sub</i> ends, or <code>-1</code> if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- */
- public int getEndIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = end[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Substitute the results of this match to create a new string.
- * This is patterned after PERL, so the tokens to watch out for are
- * <code>$0</code> through <code>$9</code>. <code>$0</code> matches
- * the full substring matched; <code>$<i>n</i></code> matches
- * subexpression number <i>n</i>.
- *
- * @param input A string consisting of literals and <code>$<i>n</i></code> tokens.
- */
- public String substituteInto(String input) {
- // a la Perl, $0 is whole thing, $1 - $9 are subexpressions
- StringBuffer output = new StringBuffer();
- int pos;
- for (pos = 0; pos < input.length()-1; pos++) {
- if ((input.charAt(pos) == '$') && (Character.isDigit(input.charAt(pos+1)))) {
- int val = Character.digit(input.charAt(++pos),10);
- if (val < start.length) {
- output.append(toString(val));
- }
- } else output.append(input.charAt(pos));
- }
- if (pos < input.length()) output.append(input.charAt(pos));
- return output.toString();
- }
-}
diff --git a/libjava/gnu/regexp/REMatchEnumeration.java b/libjava/gnu/regexp/REMatchEnumeration.java
deleted file mode 100644
index c8e208a9438..00000000000
--- a/libjava/gnu/regexp/REMatchEnumeration.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/* gnu/regexp/REMatchEnumeration.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * An REMatchEnumeration enumerates regular expression matches over a
- * given input text. You obtain a reference to an enumeration using
- * the <code>getMatchEnumeration()</code> methods on an instance of
- * RE.
- *
- * <P>
- *
- * REMatchEnumeration does lazy computation; that is, it will not
- * search for a match until it needs to. If you'd rather just get all
- * the matches at once in a big array, use the
- * <code>getAllMatches()</code> methods on RE. However, using an
- * enumeration can help speed performance when the entire text does
- * not need to be searched immediately.
- *
- * <P>
- *
- * The enumerated type is especially useful when searching on a Reader
- * or InputStream, because the InputStream read position cannot be
- * guaranteed after calling <code>getMatch()</code> (see the
- * description of that method for an explanation of why). Enumeration
- * also saves a lot of overhead required when calling
- * <code>getMatch()</code> multiple times.
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- */
-public class REMatchEnumeration implements Enumeration, Serializable {
- private static final int YES = 1;
- private static final int MAYBE = 0;
- private static final int NO = -1;
-
- private int more;
- private REMatch match;
- private RE expr;
- private CharIndexed input;
- private int eflags;
- private int index;
-
- // Package scope constructor is used by RE.getMatchEnumeration()
- REMatchEnumeration(RE expr, CharIndexed input, int index, int eflags) {
- more = MAYBE;
- this.expr = expr;
- this.input = input;
- this.index = index;
- this.eflags = eflags;
- }
-
- /** Returns true if there are more matches in the input text. */
- public boolean hasMoreElements() {
- return hasMoreMatches(null);
- }
-
- /** Returns true if there are more matches in the input text. */
- public boolean hasMoreMatches() {
- return hasMoreMatches(null);
- }
-
- /** Returns true if there are more matches in the input text.
- * Saves the text leading up to the match (or to the end of the input)
- * in the specified buffer.
- */
- public boolean hasMoreMatches(StringBuffer buffer) {
- if (more == MAYBE) {
- match = expr.getMatchImpl(input,index,eflags,buffer);
- if (match != null) {
- input.move((match.end[0] > 0) ? match.end[0] : 1);
-
- index = (match.end[0] > 0) ? match.end[0] + match.offset : index + 1;
- more = YES;
- } else more = NO;
- }
- return (more == YES);
- }
-
- /** Returns the next match in the input text. */
- public Object nextElement() throws NoSuchElementException {
- return nextMatch();
- }
-
- /**
- * Returns the next match in the input text. This method is provided
- * for convenience to avoid having to explicitly cast the return value
- * to class REMatch.
- */
- public REMatch nextMatch() throws NoSuchElementException {
- if (hasMoreElements()) {
- more = (input.isValid()) ? MAYBE : NO;
- return match;
- }
- throw new NoSuchElementException();
- }
-}
-
diff --git a/libjava/gnu/regexp/RESyntax.java b/libjava/gnu/regexp/RESyntax.java
deleted file mode 100644
index 649bd0df584..00000000000
--- a/libjava/gnu/regexp/RESyntax.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/* gnu/regexp/RESyntax.java
- Copyright (C) 1998-2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-import java.io.Serializable;
-import java.util.BitSet;
-
-/**
- * An RESyntax specifies the way a regular expression will be compiled.
- * This class provides a number of predefined useful constants for
- * emulating popular regular expression syntaxes. Additionally the
- * user may construct his or her own syntax, using any combination of the
- * syntax bit constants. The syntax is an optional argument to any of the
- * matching methods on class RE.
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- */
-
-public final class RESyntax implements Serializable {
- static final String DEFAULT_LINE_SEPARATOR = System.getProperty("line.separator");
-
- private static final String SYNTAX_IS_FINAL = RE.getLocalizedMessage("syntax.final");
-
- private BitSet bits;
-
- // true for the constant defined syntaxes
- private boolean isFinal = false;
-
- private String lineSeparator = DEFAULT_LINE_SEPARATOR;
-
- // Values for constants are bit indexes
-
- /**
- * Syntax bit. Backslash is an escape character in lists.
- */
- public static final int RE_BACKSLASH_ESCAPE_IN_LISTS = 0;
-
- /**
- * Syntax bit. Use \? instead of ? and \+ instead of +.
- */
- public static final int RE_BK_PLUS_QM = 1;
-
- /**
- * Syntax bit. POSIX character classes ([:...:]) in lists are allowed.
- */
- public static final int RE_CHAR_CLASSES = 2;
-
- /**
- * Syntax bit. ^ and $ are special everywhere.
- * <B>Not implemented.</B>
- */
- public static final int RE_CONTEXT_INDEP_ANCHORS = 3;
-
- /**
- * Syntax bit. Repetition operators are only special in valid positions.
- * <B>Not implemented.</B>
- */
- public static final int RE_CONTEXT_INDEP_OPS = 4;
-
- /**
- * Syntax bit. Repetition and alternation operators are invalid
- * at start and end of pattern and other places.
- * <B>Not implemented</B>.
- */
- public static final int RE_CONTEXT_INVALID_OPS = 5;
-
- /**
- * Syntax bit. Match-any-character operator (.) matches a newline.
- */
- public static final int RE_DOT_NEWLINE = 6;
-
- /**
- * Syntax bit. Match-any-character operator (.) does not match a null.
- */
- public static final int RE_DOT_NOT_NULL = 7;
-
- /**
- * Syntax bit. Intervals ({x}, {x,}, {x,y}) are allowed.
- */
- public static final int RE_INTERVALS = 8;
-
- /**
- * Syntax bit. No alternation (|), match one-or-more (+), or
- * match zero-or-one (?) operators.
- */
- public static final int RE_LIMITED_OPS = 9;
-
- /**
- * Syntax bit. Newline is an alternation operator.
- */
- public static final int RE_NEWLINE_ALT = 10; // impl.
-
- /**
- * Syntax bit. Intervals use { } instead of \{ \}
- */
- public static final int RE_NO_BK_BRACES = 11;
-
- /**
- * Syntax bit. Grouping uses ( ) instead of \( \).
- */
- public static final int RE_NO_BK_PARENS = 12;
-
- /**
- * Syntax bit. Backreferences not allowed.
- */
- public static final int RE_NO_BK_REFS = 13;
-
- /**
- * Syntax bit. Alternation uses | instead of \|
- */
- public static final int RE_NO_BK_VBAR = 14;
-
- /**
- * Syntax bit. <B>Not implemented</B>.
- */
- public static final int RE_NO_EMPTY_RANGES = 15;
-
- /**
- * Syntax bit. An unmatched right parenthesis (')' or '\)', depending
- * on RE_NO_BK_PARENS) will throw an exception when compiling.
- */
- public static final int RE_UNMATCHED_RIGHT_PAREN_ORD = 16;
-
- /**
- * Syntax bit. <B>Not implemented.</B>
- */
- public static final int RE_HAT_LISTS_NOT_NEWLINE = 17;
-
- /**
- * Syntax bit. Stingy matching is allowed (+?, *?, ??, {x,y}?).
- */
- public static final int RE_STINGY_OPS = 18;
-
- /**
- * Syntax bit. Allow character class escapes (\d, \D, \s, \S, \w, \W).
- */
- public static final int RE_CHAR_CLASS_ESCAPES = 19;
-
- /**
- * Syntax bit. Allow use of (?:xxx) grouping (subexpression is not saved).
- */
- public static final int RE_PURE_GROUPING = 20;
-
- /**
- * Syntax bit. Allow use of (?=xxx) and (?!xxx) apply the subexpression
- * to the text following the current position without consuming that text.
- */
- public static final int RE_LOOKAHEAD = 21;
-
- /**
- * Syntax bit. Allow beginning- and end-of-string anchors (\A, \Z).
- */
- public static final int RE_STRING_ANCHORS = 22;
-
- /**
- * Syntax bit. Allow embedded comments, (?#comment), as in Perl5.
- */
- public static final int RE_COMMENTS = 23;
-
- /**
- * Syntax bit. Allow character class escapes within lists, as in Perl5.
- */
- public static final int RE_CHAR_CLASS_ESC_IN_LISTS = 24;
-
- private static final int BIT_TOTAL = 25;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the awk utility.
- */
- public static final RESyntax RE_SYNTAX_AWK;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the ed utility.
- */
- public static final RESyntax RE_SYNTAX_ED;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the egrep utility.
- */
- public static final RESyntax RE_SYNTAX_EGREP;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the GNU Emacs editor.
- */
- public static final RESyntax RE_SYNTAX_EMACS;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the grep utility.
- */
- public static final RESyntax RE_SYNTAX_GREP;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the POSIX awk specification.
- */
- public static final RESyntax RE_SYNTAX_POSIX_AWK;
-
- /**
- * Predefined syntax.
- * Emulates POSIX basic regular expression support.
- */
- public static final RESyntax RE_SYNTAX_POSIX_BASIC;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the POSIX egrep specification.
- */
- public static final RESyntax RE_SYNTAX_POSIX_EGREP;
-
- /**
- * Predefined syntax.
- * Emulates POSIX extended regular expression support.
- */
- public static final RESyntax RE_SYNTAX_POSIX_EXTENDED;
-
- /**
- * Predefined syntax.
- * Emulates POSIX basic minimal regular expressions.
- */
- public static final RESyntax RE_SYNTAX_POSIX_MINIMAL_BASIC;
-
- /**
- * Predefined syntax.
- * Emulates POSIX extended minimal regular expressions.
- */
- public static final RESyntax RE_SYNTAX_POSIX_MINIMAL_EXTENDED;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the sed utility.
- */
- public static final RESyntax RE_SYNTAX_SED;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 4,
- */
- public static final RESyntax RE_SYNTAX_PERL4;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 4,
- * using single line mode (/s modifier).
- */
- public static final RESyntax RE_SYNTAX_PERL4_S; // single line mode (/s)
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 5.
- */
- public static final RESyntax RE_SYNTAX_PERL5;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 5,
- * using single line mode (/s modifier).
- */
- public static final RESyntax RE_SYNTAX_PERL5_S;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Java 1.4's java.util.regex
- * package.
- */
- public static final RESyntax RE_SYNTAX_JAVA_1_4;
-
- static {
- // Define syntaxes
-
- RE_SYNTAX_EMACS = new RESyntax().makeFinal();
-
- RESyntax RE_SYNTAX_POSIX_COMMON = new RESyntax()
- .set(RE_CHAR_CLASSES)
- .set(RE_DOT_NEWLINE)
- .set(RE_DOT_NOT_NULL)
- .set(RE_INTERVALS)
- .set(RE_NO_EMPTY_RANGES)
- .makeFinal();
-
- RE_SYNTAX_POSIX_BASIC = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_BK_PLUS_QM)
- .makeFinal();
-
- RE_SYNTAX_POSIX_EXTENDED = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INDEP_OPS)
- .set(RE_NO_BK_BRACES)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_VBAR)
- .set(RE_UNMATCHED_RIGHT_PAREN_ORD)
- .makeFinal();
-
- RE_SYNTAX_AWK = new RESyntax()
- .set(RE_BACKSLASH_ESCAPE_IN_LISTS)
- .set(RE_DOT_NOT_NULL)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_REFS)
- .set(RE_NO_BK_VBAR)
- .set(RE_NO_EMPTY_RANGES)
- .set(RE_UNMATCHED_RIGHT_PAREN_ORD)
- .makeFinal();
-
- RE_SYNTAX_POSIX_AWK = new RESyntax(RE_SYNTAX_POSIX_EXTENDED)
- .set(RE_BACKSLASH_ESCAPE_IN_LISTS)
- .makeFinal();
-
- RE_SYNTAX_GREP = new RESyntax()
- .set(RE_BK_PLUS_QM)
- .set(RE_CHAR_CLASSES)
- .set(RE_HAT_LISTS_NOT_NEWLINE)
- .set(RE_INTERVALS)
- .set(RE_NEWLINE_ALT)
- .makeFinal();
-
- RE_SYNTAX_EGREP = new RESyntax()
- .set(RE_CHAR_CLASSES)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INDEP_OPS)
- .set(RE_HAT_LISTS_NOT_NEWLINE)
- .set(RE_NEWLINE_ALT)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_VBAR)
- .makeFinal();
-
- RE_SYNTAX_POSIX_EGREP = new RESyntax(RE_SYNTAX_EGREP)
- .set(RE_INTERVALS)
- .set(RE_NO_BK_BRACES)
- .makeFinal();
-
- /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-
- RE_SYNTAX_ED = new RESyntax(RE_SYNTAX_POSIX_BASIC)
- .makeFinal();
-
- RE_SYNTAX_SED = new RESyntax(RE_SYNTAX_POSIX_BASIC)
- .makeFinal();
-
- RE_SYNTAX_POSIX_MINIMAL_BASIC = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_LIMITED_OPS)
- .makeFinal();
-
- /* Differs from RE_SYNTAX_POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-
- RE_SYNTAX_POSIX_MINIMAL_EXTENDED = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INVALID_OPS)
- .set(RE_NO_BK_BRACES)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_REFS)
- .set(RE_NO_BK_VBAR)
- .set(RE_UNMATCHED_RIGHT_PAREN_ORD)
- .makeFinal();
-
- /* There is no official Perl spec, but here's a "best guess" */
-
- RE_SYNTAX_PERL4 = new RESyntax()
- .set(RE_BACKSLASH_ESCAPE_IN_LISTS)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INDEP_OPS) // except for '{', apparently
- .set(RE_INTERVALS)
- .set(RE_NO_BK_BRACES)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_VBAR)
- .set(RE_NO_EMPTY_RANGES)
- .set(RE_CHAR_CLASS_ESCAPES) // \d,\D,\w,\W,\s,\S
- .makeFinal();
-
- RE_SYNTAX_PERL4_S = new RESyntax(RE_SYNTAX_PERL4)
- .set(RE_DOT_NEWLINE)
- .makeFinal();
-
- RE_SYNTAX_PERL5 = new RESyntax(RE_SYNTAX_PERL4)
- .set(RE_PURE_GROUPING) // (?:)
- .set(RE_STINGY_OPS) // *?,??,+?,{}?
- .set(RE_LOOKAHEAD) // (?=)(?!)
- .set(RE_STRING_ANCHORS) // \A,\Z
- .set(RE_CHAR_CLASS_ESC_IN_LISTS)// \d,\D,\w,\W,\s,\S within []
- .set(RE_COMMENTS) // (?#)
- .makeFinal();
-
- RE_SYNTAX_PERL5_S = new RESyntax(RE_SYNTAX_PERL5)
- .set(RE_DOT_NEWLINE)
- .makeFinal();
-
- RE_SYNTAX_JAVA_1_4 = new RESyntax(RE_SYNTAX_PERL5)
- // XXX
- .makeFinal();
- }
-
- /**
- * Construct a new syntax object with all bits turned off.
- * This is equivalent to RE_SYNTAX_EMACS.
- */
- public RESyntax() {
- bits = new BitSet(BIT_TOTAL);
- }
-
- /**
- * Called internally when constructing predefined syntaxes
- * so their interpretation cannot vary. Conceivably useful
- * for your syntaxes as well. Causes IllegalAccessError to
- * be thrown if any attempt to modify the syntax is made.
- *
- * @return this object for convenient chaining
- */
- public RESyntax makeFinal() {
- isFinal = true;
- return this;
- }
-
- /**
- * Construct a new syntax object with all bits set the same
- * as the other syntax.
- */
- public RESyntax(RESyntax other) {
- bits = (BitSet) other.bits.clone();
- }
-
- /**
- * Check if a given bit is set in this syntax.
- */
- public boolean get(int index) {
- return bits.get(index);
- }
-
- /**
- * Set a given bit in this syntax.
- *
- * @param index the constant (RESyntax.RE_xxx) bit to set.
- * @return a reference to this object for easy chaining.
- */
- public RESyntax set(int index) {
- if (isFinal) throw new IllegalAccessError(SYNTAX_IS_FINAL);
- bits.set(index);
- return this;
- }
-
- /**
- * Clear a given bit in this syntax.
- *
- * @param index the constant (RESyntax.RE_xxx) bit to clear.
- * @return a reference to this object for easy chaining.
- */
- public RESyntax clear(int index) {
- if (isFinal) throw new IllegalAccessError(SYNTAX_IS_FINAL);
- bits.clear(index);
- return this;
- }
-
- /**
- * Changes the line separator string for regular expressions
- * created using this RESyntax. The default separator is the
- * value returned by the system property "line.separator", which
- * should be correct when reading platform-specific files from a
- * filesystem. However, many programs may collect input from
- * sources where the line separator is differently specified (for
- * example, in the applet environment, the text box widget
- * interprets line breaks as single-character newlines,
- * regardless of the host platform.
- *
- * Note that setting the line separator to a character or
- * characters that have specific meaning within the current syntax
- * can cause unexpected chronosynclastic infundibula.
- *
- * @return this object for convenient chaining
- */
- public RESyntax setLineSeparator(String aSeparator) {
- if (isFinal) throw new IllegalAccessError(SYNTAX_IS_FINAL);
- lineSeparator = aSeparator;
- return this;
- }
-
- /**
- * Returns the currently active line separator string. The default
- * is the platform-dependent system property "line.separator".
- */
- public String getLineSeparator() {
- return lineSeparator;
- }
-}
diff --git a/libjava/gnu/regexp/REToken.java b/libjava/gnu/regexp/REToken.java
deleted file mode 100644
index aa576a5adde..00000000000
--- a/libjava/gnu/regexp/REToken.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/* gnu/regexp/REToken.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.Serializable;
-
-abstract class REToken implements Serializable {
-
- protected REToken next = null;
- protected REToken uncle = null;
- protected int subIndex;
-
- protected REToken(int subIndex) {
- this.subIndex = subIndex;
- }
-
- int getMinimumLength() {
- return 0;
- }
-
- void setUncle(REToken anUncle) {
- uncle = anUncle;
- }
-
- /** Returns true if the match succeeded, false if it failed. */
- abstract boolean match(CharIndexed input, REMatch mymatch);
-
- /** Returns true if the rest of the tokens match, false if they fail. */
- protected boolean next(CharIndexed input, REMatch mymatch) {
- if (next == null) {
- if (uncle == null) {
- return true;
- } else {
- return uncle.match(input, mymatch);
- }
- } else {
- return next.match(input, mymatch);
- }
- }
-
- boolean chain(REToken token) {
- next = token;
- return true; // Token was accepted
- }
-
- abstract void dump(StringBuffer os);
-
- void dumpAll(StringBuffer os) {
- dump(os);
- if (next != null) next.dumpAll(os);
- }
-}
diff --git a/libjava/gnu/regexp/RETokenAny.java b/libjava/gnu/regexp/RETokenAny.java
deleted file mode 100644
index 42fdd9e284c..00000000000
--- a/libjava/gnu/regexp/RETokenAny.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* gnu/regexp/RETokenAny.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-final class RETokenAny extends REToken {
- /** True if '.' can match a newline (RE_DOT_NEWLINE) */
- private boolean newline;
-
- /** True if '.' can't match a null (RE_DOT_NOT_NULL) */
- private boolean matchNull;
-
- RETokenAny(int subIndex, boolean newline, boolean matchNull) {
- super(subIndex);
- this.newline = newline;
- this.matchNull = matchNull;
- }
-
- int getMinimumLength() {
- return 1;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- char ch = input.charAt(mymatch.index);
- if ((ch == CharIndexed.OUT_OF_BOUNDS)
- || (!newline && (ch == '\n'))
- || (matchNull && (ch == 0))) {
- return false;
- }
- ++mymatch.index;
- return next(input, mymatch);
- }
-
- void dump(StringBuffer os) {
- os.append('.');
- }
-}
-
diff --git a/libjava/gnu/regexp/RETokenBackRef.java b/libjava/gnu/regexp/RETokenBackRef.java
deleted file mode 100644
index a811e16a7b3..00000000000
--- a/libjava/gnu/regexp/RETokenBackRef.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* gnu/regexp/RETokenBackRef.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-final class RETokenBackRef extends REToken {
- private int num;
- private boolean insens;
-
- RETokenBackRef(int subIndex, int num, boolean insens) {
- super(subIndex);
- this.num = num;
- this.insens = insens;
- }
-
- // should implement getMinimumLength() -- any ideas?
-
- boolean match(CharIndexed input, REMatch mymatch) {
- int b,e;
- b = mymatch.start[num];
- e = mymatch.end[num];
- if ((b==-1)||(e==-1)) return false; // this shouldn't happen, but...
- for (int i=b; i<e; i++) {
- if (input.charAt(mymatch.index+i-b) != input.charAt(i)) {
- return false;
- }
- }
- mymatch.index += e-b;
- return next(input, mymatch);
- }
-
- void dump(StringBuffer os) {
- os.append('\\').append(num);
- }
-}
-
-
diff --git a/libjava/gnu/regexp/RETokenChar.java b/libjava/gnu/regexp/RETokenChar.java
deleted file mode 100644
index 17712e34787..00000000000
--- a/libjava/gnu/regexp/RETokenChar.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* gnu/regexp/RETokenChar.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-final class RETokenChar extends REToken {
- private char[] ch;
- private boolean insens;
-
- RETokenChar(int subIndex, char c, boolean ins) {
- super(subIndex);
- ch = new char [1];
- ch[0] = (insens = ins) ? Character.toLowerCase(c) : c;
- }
-
- int getMinimumLength() {
- return ch.length;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- int z = ch.length;
- char c;
- for (int i=0; i<z; i++) {
- c = input.charAt(mymatch.index+i);
- if (( (insens) ? Character.toLowerCase(c) : c ) != ch[i]) {
- return false;
- }
- }
- mymatch.index += z;
-
- return next(input, mymatch);
- }
-
- // Overrides REToken.chain() to optimize for strings
- boolean chain(REToken next) {
- if (next instanceof RETokenChar) {
- RETokenChar cnext = (RETokenChar) next;
- // assume for now that next can only be one character
- int newsize = ch.length + cnext.ch.length;
-
- char[] chTemp = new char [newsize];
-
- System.arraycopy(ch,0,chTemp,0,ch.length);
- System.arraycopy(cnext.ch,0,chTemp,ch.length,cnext.ch.length);
-
- ch = chTemp;
- return false;
- } else return super.chain(next);
- }
-
- void dump(StringBuffer os) {
- os.append(ch);
- }
-}
-
-
diff --git a/libjava/gnu/regexp/RETokenEnd.java b/libjava/gnu/regexp/RETokenEnd.java
deleted file mode 100644
index 08e57084da1..00000000000
--- a/libjava/gnu/regexp/RETokenEnd.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* gnu/regexp/RETokenEnd.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-final class RETokenEnd extends REToken {
- /**
- * Indicates whether this token should match on a line break.
- */
- private String newline;
-
- RETokenEnd(int subIndex,String newline) {
- super(subIndex);
- this.newline = newline;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- char ch = input.charAt(mymatch.index);
- if (ch == CharIndexed.OUT_OF_BOUNDS)
- return ((mymatch.eflags & RE.REG_NOTEOL)>0) ?
- false : next(input, mymatch);
- if (newline != null) {
- char z;
- int i = 0; // position in newline
- do {
- z = newline.charAt(i);
- if (ch != z) return false;
- ++i;
- ch = input.charAt(mymatch.index + i);
- } while (i < newline.length());
-
- return next(input, mymatch);
- }
- return false;
- }
-
- void dump(StringBuffer os) {
- os.append('$');
- }
-}
diff --git a/libjava/gnu/regexp/RETokenEndSub.java b/libjava/gnu/regexp/RETokenEndSub.java
deleted file mode 100644
index 913d3f85c05..00000000000
--- a/libjava/gnu/regexp/RETokenEndSub.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* gnu/regexp/RETokenEndSub.java
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-
-final class RETokenEndSub extends REToken {
- RETokenEndSub(int subIndex) {
- super(subIndex);
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- mymatch.end[subIndex] = mymatch.index;
- return next(input, mymatch);
- }
-
- void dump(StringBuffer os) {
- // handled by RE
- }
-}
diff --git a/libjava/gnu/regexp/RETokenLookAhead.java b/libjava/gnu/regexp/RETokenLookAhead.java
deleted file mode 100644
index 74a9bfe2465..00000000000
--- a/libjava/gnu/regexp/RETokenLookAhead.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * gnu/regexp/RETokenOneOf.java
- * Copyright (C) 1998-2001 Wes Biggs
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package gnu.regexp;
-
-/**
- * @since gnu.regexp 1.1.3
- * @author Shashank Bapat
- */
-final class RETokenLookAhead extends REToken
-{
- REToken re;
- boolean negative;
-
- RETokenLookAhead(REToken re, boolean negative) throws REException {
- super(0);
- this.re = re;
- this.negative = negative;
- }
-
- boolean match(CharIndexed input, REMatch mymatch)
- {
- REMatch trymatch = (REMatch)mymatch.clone();
- REMatch trymatch1 = (REMatch)mymatch.clone();
- REMatch newMatch = null;
- if (re.match(input, trymatch)) {
- if (negative) return false;
- if (next(input, trymatch1))
- newMatch = trymatch1;
- }
-
- if (newMatch != null) {
- if (negative) return false;
- //else
- mymatch.assignFrom(newMatch);
- return true;
- }
- else { // no match
- if (negative)
- return next(input, mymatch);
- //else
- return false;
- }
- }
-
- void dump(StringBuffer os) {
- os.append("(?");
- os.append(negative ? '!' : '=');
- re.dumpAll(os);
- os.append(')');
- }
-}
-
diff --git a/libjava/gnu/regexp/RETokenOneOf.java b/libjava/gnu/regexp/RETokenOneOf.java
deleted file mode 100644
index 7752b25771c..00000000000
--- a/libjava/gnu/regexp/RETokenOneOf.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/* gnu/regexp/RETokenOneOf.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.util.Vector;
-
-final class RETokenOneOf extends REToken {
- private Vector options;
- private boolean negative;
-
- // This constructor is used for convenience when we know the set beforehand,
- // e.g. \d --> new RETokenOneOf("0123456789",false, ..)
- // \D --> new RETokenOneOf("0123456789",true, ..)
-
- RETokenOneOf(int subIndex, String optionsStr, boolean negative, boolean insens) {
- super(subIndex);
- options = new Vector();
- this.negative = negative;
- for (int i = 0; i < optionsStr.length(); i++)
- options.addElement(new RETokenChar(subIndex,optionsStr.charAt(i),insens));
- }
-
- RETokenOneOf(int subIndex, Vector options, boolean negative) {
- super(subIndex);
- this.options = options;
- this.negative = negative;
- }
-
- int getMinimumLength() {
- int min = Integer.MAX_VALUE;
- int x;
- for (int i=0; i < options.size(); i++) {
- if ((x = ((REToken) options.elementAt(i)).getMinimumLength()) < min)
- min = x;
- }
- return min;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- if (negative && (input.charAt(mymatch.index) == CharIndexed.OUT_OF_BOUNDS))
- return false;
-
- REMatch newMatch = null;
- REMatch last = null;
- REToken tk;
- boolean isMatch;
- for (int i=0; i < options.size(); i++) {
- tk = (REToken) options.elementAt(i);
- REMatch tryMatch = (REMatch) mymatch.clone();
- if (tk.match(input, tryMatch)) { // match was successful
- if (negative) return false;
-
- if (next(input, tryMatch)) {
- // Add tryMatch to list of possibilities.
- if (last == null) {
- newMatch = tryMatch;
- last = tryMatch;
- } else {
- last.next = tryMatch;
- last = tryMatch;
- }
- } // next succeeds
- } // is a match
- } // try next option
-
- if (newMatch != null) {
- if (negative) {
- return false;
- } else {
- // set contents of mymatch equal to newMatch
-
- // try each one that matched
- mymatch.assignFrom(newMatch);
- return true;
- }
- } else {
- if (negative) {
- ++mymatch.index;
- return next(input, mymatch);
- } else {
- return false;
- }
- }
-
- // index+1 works for [^abc] lists, not for generic lookahead (--> index)
- }
-
- void dump(StringBuffer os) {
- os.append(negative ? "[^" : "(?:");
- for (int i = 0; i < options.size(); i++) {
- if (!negative && (i > 0)) os.append('|');
- ((REToken) options.elementAt(i)).dumpAll(os);
- }
- os.append(negative ? ']' : ')');
- }
-}
diff --git a/libjava/gnu/regexp/RETokenPOSIX.java b/libjava/gnu/regexp/RETokenPOSIX.java
deleted file mode 100644
index 00fcf301ad9..00000000000
--- a/libjava/gnu/regexp/RETokenPOSIX.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/* gnu/regexp/RETokenPOSIX.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-final class RETokenPOSIX extends REToken {
- int type;
- boolean insens;
- boolean negated;
-
- static final int ALNUM = 0;
- static final int ALPHA = 1;
- static final int BLANK = 2;
- static final int CNTRL = 3;
- static final int DIGIT = 4;
- static final int GRAPH = 5;
- static final int LOWER = 6;
- static final int PRINT = 7;
- static final int PUNCT = 8;
- static final int SPACE = 9;
- static final int UPPER = 10;
- static final int XDIGIT = 11;
-
- // Array indices correspond to constants defined above.
- static final String[] s_nameTable = {
- "alnum", "alpha", "blank", "cntrl", "digit", "graph", "lower",
- "print", "punct", "space", "upper", "xdigit"
- };
-
- // The RE constructor uses this to look up the constant for a string
- static int intValue(String key) {
- for (int i = 0; i < s_nameTable.length; i++) {
- if (s_nameTable[i].equals(key)) return i;
- }
- return -1;
- }
-
- RETokenPOSIX(int subIndex, int type, boolean insens, boolean negated) {
- super(subIndex);
- this.type = type;
- this.insens = insens;
- this.negated = negated;
- }
-
- int getMinimumLength() {
- return 1;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- char ch = input.charAt(mymatch.index);
- if (ch == CharIndexed.OUT_OF_BOUNDS)
- return false;
-
- boolean retval = false;
- switch (type) {
- case ALNUM:
- // Note that there is some debate over whether '_' should be included
- retval = Character.isLetterOrDigit(ch) || (ch == '_');
- break;
- case ALPHA:
- retval = Character.isLetter(ch);
- break;
- case BLANK:
- retval = ((ch == ' ') || (ch == '\t'));
- break;
- case CNTRL:
- retval = Character.isISOControl(ch);
- break;
- case DIGIT:
- retval = Character.isDigit(ch);
- break;
- case GRAPH:
- retval = (!(Character.isWhitespace(ch) || Character.isISOControl(ch)));
- break;
- case LOWER:
- retval = ((insens && Character.isLetter(ch)) || Character.isLowerCase(ch));
- break;
- case PRINT:
- retval = (!(Character.isWhitespace(ch) || Character.isISOControl(ch)))
- || (ch == ' ');
- break;
- case PUNCT:
- // This feels sloppy, especially for non-U.S. locales.
- retval = ("`~!@#$%^&*()-_=+[]{}\\|;:'\"/?,.<>".indexOf(ch)!=-1);
- break;
- case SPACE:
- retval = Character.isWhitespace(ch);
- break;
- case UPPER:
- retval = ((insens && Character.isLetter(ch)) || Character.isUpperCase(ch));
- break;
- case XDIGIT:
- retval = (Character.isDigit(ch) || ("abcdefABCDEF".indexOf(ch)!=-1));
- break;
- }
-
- if (negated) retval = !retval;
- if (retval) {
- ++mymatch.index;
- return next(input, mymatch);
- }
- else return false;
- }
-
- void dump(StringBuffer os) {
- if (negated) os.append('^');
- os.append("[:" + s_nameTable[type] + ":]");
- }
-}
diff --git a/libjava/gnu/regexp/RETokenRange.java b/libjava/gnu/regexp/RETokenRange.java
deleted file mode 100644
index 9ce3be926b9..00000000000
--- a/libjava/gnu/regexp/RETokenRange.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* gnu/regexp/RETokenRange.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-
-final class RETokenRange extends REToken {
- private char lo, hi;
- private boolean insens;
-
- RETokenRange(int subIndex, char lo, char hi, boolean ins) {
- super(subIndex);
- this.lo = (insens = ins) ? Character.toLowerCase(lo) : lo;
- this.hi = ins ? Character.toLowerCase(hi) : hi;
- }
-
- int getMinimumLength() {
- return 1;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- char c = input.charAt(mymatch.index);
- if (c == CharIndexed.OUT_OF_BOUNDS) return false;
- if (insens) c = Character.toLowerCase(c);
- if ((c >= lo) && (c <= hi)) {
- ++mymatch.index;
- return next(input, mymatch);
- }
- return false;
- }
-
- void dump(StringBuffer os) {
- os.append(lo).append('-').append(hi);
- }
-}
-
diff --git a/libjava/gnu/regexp/RETokenRepeated.java b/libjava/gnu/regexp/RETokenRepeated.java
deleted file mode 100644
index 8c789271220..00000000000
--- a/libjava/gnu/regexp/RETokenRepeated.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/* gnu/regexp/RETokenRepeated.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-import java.util.Vector;
-
-final class RETokenRepeated extends REToken {
- private REToken token;
- private int min,max;
- private boolean stingy;
-
- RETokenRepeated(int subIndex, REToken token, int min, int max) {
- super(subIndex);
- this.token = token;
- this.min = min;
- this.max = max;
- }
-
- /** Sets the minimal matching mode to true. */
- void makeStingy() {
- stingy = true;
- }
-
- /** Queries if this token has minimal matching enabled. */
- boolean isStingy() {
- return stingy;
- }
-
- /**
- * The minimum length of a repeated token is the minimum length
- * of the token multiplied by the minimum number of times it must
- * match.
- */
- int getMinimumLength() {
- return (min * token.getMinimumLength());
- }
-
- // We do need to save every possible point, but the number of clone()
- // invocations here is really a killer for performance on non-stingy
- // repeat operators. I'm open to suggestions...
-
- // Hypothetical question: can you have a RE that matches 1 times,
- // 3 times, 5 times, but not 2 times or 4 times? Does having
- // the subexpression back-reference operator allow that?
-
- boolean match(CharIndexed input, REMatch mymatch) {
- // number of times we've matched so far
- int numRepeats = 0;
-
- // Possible positions for the next repeat to match at
- REMatch newMatch = mymatch;
- REMatch last = null;
- REMatch current;
-
- // Add the '0-repeats' index
- // positions.elementAt(z) == position [] in input after <<z>> matches
- Vector positions = new Vector();
- positions.addElement(newMatch);
-
- // Declare variables used in loop
- REMatch doables;
- REMatch doablesLast;
- REMatch recurrent;
-
- do {
- // Check for stingy match for each possibility.
- if (stingy && (numRepeats >= min)) {
- REMatch result = matchRest(input, newMatch);
- if (result != null) {
- mymatch.assignFrom(result);
- return true;
- }
- }
-
- doables = null;
- doablesLast = null;
-
- // try next repeat at all possible positions
- for (current = newMatch; current != null; current = current.next) {
- recurrent = (REMatch) current.clone();
- if (token.match(input, recurrent)) {
- // add all items in current to doables array
- if (doables == null) {
- doables = recurrent;
- doablesLast = recurrent;
- } else {
- // Order these from longest to shortest
- // Start by assuming longest (more repeats)
- doablesLast.next = recurrent;
- }
- // Find new doablesLast
- while (doablesLast.next != null) {
- doablesLast = doablesLast.next;
- }
- }
- }
- // if none of the possibilities worked out, break out of do/while
- if (doables == null) break;
-
- // reassign where the next repeat can match
- newMatch = doables;
-
- // increment how many repeats we've successfully found
- ++numRepeats;
-
- positions.addElement(newMatch);
- } while (numRepeats < max);
-
- // If there aren't enough repeats, then fail
- if (numRepeats < min) return false;
-
- // We're greedy, but ease off until a true match is found
- int posIndex = positions.size();
-
- // At this point we've either got too many or just the right amount.
- // See if this numRepeats works with the rest of the regexp.
- REMatch allResults = null;
- REMatch allResultsLast = null;
-
- REMatch results = null;
- while (--posIndex >= min) {
- newMatch = (REMatch) positions.elementAt(posIndex);
- results = matchRest(input, newMatch);
- if (results != null) {
- if (allResults == null) {
- allResults = results;
- allResultsLast = results;
- } else {
- // Order these from longest to shortest
- // Start by assuming longest (more repeats)
- allResultsLast.next = results;
- }
- // Find new doablesLast
- while (allResultsLast.next != null) {
- allResultsLast = allResultsLast.next;
- }
- }
- // else did not match rest of the tokens, try again on smaller sample
- }
- if (allResults != null) {
- mymatch.assignFrom(allResults); // does this get all?
- return true;
- }
- // If we fall out, no matches.
- return false;
- }
-
- private REMatch matchRest(CharIndexed input, final REMatch newMatch) {
- REMatch current, single;
- REMatch doneIndex = null;
- REMatch doneIndexLast = null;
- // Test all possible matches for this number of repeats
- for (current = newMatch; current != null; current = current.next) {
- // clone() separates a single match from the chain
- single = (REMatch) current.clone();
- if (next(input, single)) {
- // chain results to doneIndex
- if (doneIndex == null) {
- doneIndex = single;
- doneIndexLast = single;
- } else {
- doneIndexLast.next = single;
- }
- // Find new doneIndexLast
- while (doneIndexLast.next != null) {
- doneIndexLast = doneIndexLast.next;
- }
- }
- }
- return doneIndex;
- }
-
- void dump(StringBuffer os) {
- os.append("(?:");
- token.dumpAll(os);
- os.append(')');
- if ((max == Integer.MAX_VALUE) && (min <= 1))
- os.append( (min == 0) ? '*' : '+' );
- else if ((min == 0) && (max == 1))
- os.append('?');
- else {
- os.append('{').append(min);
- if (max > min) {
- os.append(',');
- if (max != Integer.MAX_VALUE) os.append(max);
- }
- os.append('}');
- }
- if (stingy) os.append('?');
- }
-}
diff --git a/libjava/gnu/regexp/RETokenStart.java b/libjava/gnu/regexp/RETokenStart.java
deleted file mode 100644
index 8adb8c89ce2..00000000000
--- a/libjava/gnu/regexp/RETokenStart.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* gnu/regexp/RETokenStart.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-
-class RETokenStart extends REToken {
- private String newline; // matches after a newline
-
- RETokenStart(int subIndex, String newline) {
- super(subIndex);
- this.newline = newline;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- // charAt(index-n) may be unknown on a Reader/InputStream. FIXME
- // Match after a newline if in multiline mode
-
- if (newline != null) {
- int len = newline.length();
- if (mymatch.offset >= len) {
- boolean found = true;
- char z;
- int i = 0; // position in REToken.newline
- char ch = input.charAt(mymatch.index - len);
- do {
- z = newline.charAt(i);
- if (ch != z) {
- found = false;
- break;
- }
- ++i;
- ch = input.charAt(mymatch.index - len + i);
- } while (i < len);
-
- if (found) return next(input, mymatch);
- }
- }
-
- // Don't match at all if REG_NOTBOL is set.
- if ((mymatch.eflags & RE.REG_NOTBOL) > 0) return false;
-
- if ((mymatch.eflags & RE.REG_ANCHORINDEX) > 0)
- return (mymatch.anchor == mymatch.offset) ?
- next(input, mymatch) : false;
- else
- return ((mymatch.index == 0) && (mymatch.offset == 0)) ?
- next(input, mymatch) : false;
- }
-
- void dump(StringBuffer os) {
- os.append('^');
- }
-}
diff --git a/libjava/gnu/regexp/RETokenWordBoundary.java b/libjava/gnu/regexp/RETokenWordBoundary.java
deleted file mode 100644
index 38baaec13d5..00000000000
--- a/libjava/gnu/regexp/RETokenWordBoundary.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/* gnu/regexp/RETokenWordBoundary.java
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-/**
- * Represents a combination lookahead/lookbehind for POSIX [:alnum:].
- */
-final class RETokenWordBoundary extends REToken {
- private boolean negated;
- private int where;
- static final int BEGIN = 1;
- static final int END = 2;
-
- RETokenWordBoundary(int subIndex, int where, boolean negated) {
- super(subIndex);
- this.where = where;
- this.negated = negated;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- // Word boundary means input[index-1] was a word character
- // and input[index] is not, or input[index] is a word character
- // and input[index-1] was not
- // In the string "one two three", these positions match:
- // |o|n|e| |t|w|o| |t|h|r|e|e|
- // ^ ^ ^ ^ ^ ^
- boolean after = false; // is current character a letter or digit?
- boolean before = false; // is previous character a letter or digit?
- char ch;
-
- // TODO: Also check REG_ANCHORINDEX vs. anchor
- if (((mymatch.eflags & RE.REG_ANCHORINDEX) != RE.REG_ANCHORINDEX)
- || (mymatch.offset + mymatch.index > mymatch.anchor)) {
- if ((ch = input.charAt(mymatch.index - 1)) != CharIndexed.OUT_OF_BOUNDS) {
- before = Character.isLetterOrDigit(ch) || (ch == '_');
- }
- }
-
- if ((ch = input.charAt(mymatch.index)) != CharIndexed.OUT_OF_BOUNDS) {
- after = Character.isLetterOrDigit(ch) || (ch == '_');
- }
-
- // if (before) and (!after), we're at end (\>)
- // if (after) and (!before), we're at beginning (\<)
- boolean doNext = false;
-
- if ((where & BEGIN) == BEGIN) {
- doNext = after && !before;
- }
- if ((where & END) == END) {
- doNext ^= before && !after;
- }
-
- if (negated) doNext = !doNext;
-
- return (doNext ? next(input, mymatch) : false);
- }
-
- void dump(StringBuffer os) {
- if (where == (BEGIN | END)) {
- os.append( negated ? "\\B" : "\\b" );
- } else if (where == BEGIN) {
- os.append("\\<");
- } else {
- os.append("\\>");
- }
- }
-}
diff --git a/libjava/gnu/regexp/UncheckedRE.java b/libjava/gnu/regexp/UncheckedRE.java
deleted file mode 100644
index 660466eabbb..00000000000
--- a/libjava/gnu/regexp/UncheckedRE.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* gnu/regexp/UncheckedRE.java
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-
-/**
- * UncheckedRE is a subclass of RE that allows programmers an easier means
- * of programmatically precompiling regular expressions. It is constructed
- * and used in exactly the same manner as an instance of the RE class; the
- * only difference is that its constructors do not throw REException.
- * Instead, if a syntax error is encountered during construction, a
- * RuntimeException will be thrown.
- * <P>
- * Note that this makes UncheckedRE dangerous if constructed with
- * dynamic data. Do not use UncheckedRE unless you are completely sure
- * that all input being passed to it contains valid, well-formed
- * regular expressions for the syntax specified.
- *
- * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
- * @see gnu.regexp.RE
- * @since gnu.regexp 1.1.4
- */
-
-public final class UncheckedRE extends RE {
- /**
- * Constructs a regular expression pattern buffer without any compilation
- * flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @exception RuntimeException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public UncheckedRE(Object pattern) {
- this(pattern,0,RESyntax.RE_SYNTAX_PERL5);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags in the RE class.
- * @exception RuntimeException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public UncheckedRE(Object pattern, int cflags) {
- this(pattern,cflags,RESyntax.RE_SYNTAX_PERL5);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and regular expression syntax.
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags in the RE class.
- * @param syntax The type of regular expression syntax to use.
- * @exception RuntimeException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public UncheckedRE(Object pattern, int cflags, RESyntax syntax) {
- try {
- initialize(pattern,cflags,syntax,0,0);
- } catch (REException e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-}
-
-
diff --git a/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java b/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java
deleted file mode 100644
index bf5cd0a7aa9..00000000000
--- a/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java
+++ /dev/null
@@ -1,820 +0,0 @@
-/* BasicProgressBarUI.java
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package javax.swing.plaf.basic;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import javax.swing.JComponent;
-import javax.swing.JProgressBar;
-import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
-import javax.swing.Timer;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.ProgressBarUI;
-
-
-/**
- * The Basic Look and Feel UI delegate for the
- * JProgressBar.
- */
-public class BasicProgressBarUI extends ProgressBarUI
-{
- /**
- * A helper class that listens for ChangeEvents
- * from the progressBar's model.
- */
- protected class ChangeHandler implements ChangeListener
- {
- /**
- * Called every time the state of the model changes.
- *
- * @param e The ChangeEvent given by the model.
- */
- public void stateChanged(ChangeEvent e)
- {
- // Nothing to do but repaint.
- progressBar.repaint();
- }
- }
-
- /**
- * This helper class is used to listen for
- * PropertyChangeEvents from the progressBar.
- */
- private class PropertyChangeHandler implements PropertyChangeListener
- {
- /**
- * Called every time the properties of the
- * progressBar change.
- *
- * @param e The PropertyChangeEvent given by the progressBar.
- */
- public void propertyChange(PropertyChangeEvent e)
- {
- // Only need to listen for indeterminate changes.
- // All other things are done on a repaint.
- if (e.getPropertyName().equals(JProgressBar.INDETERMINATE_CHANGED_PROPERTY))
- if (((Boolean) e.getNewValue()).booleanValue())
- startAnimationTimer();
- else
- stopAnimationTimer();
- else
- progressBar.repaint();
- }
- }
-
- /**
- * This helper class is used to listen for
- * the animationTimer's intervals. On every interval,
- * the bouncing box should move.
- */
- private class Animator implements ActionListener
- {
- /**
- * Called every time the animationTimer reaches
- * its interval.
- *
- * @param e The ActionEvent given by the timer.
- */
- public void actionPerformed(ActionEvent e)
- {
- // Incrementing the animation index will cause
- // a repaint.
- incrementAnimationIndex();
- }
- }
-
- /** The timer used to move the bouncing box. */
- private transient Timer animationTimer = new Timer();
-
-
- // The total number of frames must be an even number.
- // The total number of frames is calculated from
- // the cycleTime and repaintInterval given by
- // the basic L&F's defaults.
- //
- // +-----------------------------------------------+
- // | frame0 | frame1 | frame2 | frame 3 | frame 4 |
- // | | frame7 | frame6 | frame 5 | |
- // +-----------------------------------------------+
-
- /** The current animation index. */
- private transient int animationIndex;
-
- /** The total number of frames.*/
- private transient int numFrames;
-
- /** The helper that moves the bouncing box. */
- private transient Animator animation;
-
- /** The helper that listens for property change events. */
- private transient PropertyChangeHandler propertyListener;
-
- /** The Listener for the model. */
- protected ChangeListener changeListener;
-
- /** The progressBar for this UI. */
- protected JProgressBar progressBar;
-
- /** The length of the cell. The cell is the painted part. */
- private transient int cellLength;
-
- /** The gap between cells. */
- private transient int cellSpacing;
-
- /** The color of the text when the bar is not over it.*/
- private transient Color selectionBackground;
-
- /** The color of the text when the bar is over it. */
- private transient Color selectionForeground;
-
- /**
- * Creates a new BasicProgressBarUI object.
- */
- public BasicProgressBarUI()
- {
- super();
- }
-
- /**
- * Creates a new BasicProgressBarUI for the component.
- *
- * @param x The JComponent to create the UI for.
- *
- * @return A new BasicProgressBarUI.
- */
- public static ComponentUI createUI(JComponent x)
- {
- return new BasicProgressBarUI();
- }
-
- /**
- * This method returns the length of the bar (from the minimum)
- * in pixels (or units that the Graphics object draws in) based
- * on the progressBar's getPercentComplete() value.
- *
- * @param b The insets of the progressBar.
- * @param width The width of the progressBar.
- * @param height The height of the progressBar.
- *
- * @return The length of the bar that should be painted in pixels.
- */
- protected int getAmountFull(Insets b, int width, int height)
- {
- double percentDone = progressBar.getPercentComplete();
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- return (int) (percentDone * (width - b.left - b.right));
- else
- return (int) (percentDone * (height - b.top - b.bottom));
- }
-
- /**
- * The current animation index.
- *
- * @return The current animation index.
- */
- protected int getAnimationIndex()
- {
- return animationIndex;
- }
-
- /**
- * This method returns the size and position of the bouncing box
- * for the current animation index. It stores the values in the
- * given rectangle and returns it. It returns null if no box should
- * be drawn.
- *
- * @param r The bouncing box rectangle.
- *
- * @return The bouncing box rectangle.
- */
- protected Rectangle getBox(Rectangle r)
- {
- if (!progressBar.isIndeterminate())
- return null;
- //numFrames has to be an even number as defined by spec.
- int iterations = numFrames / 2 + 1;
-
- double boxDependent;
- double boxIndependent;
-
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- {
- Dimension dims = getPreferredInnerHorizontal();
- boxDependent = (double) dims.width / iterations;
- boxIndependent = dims.height;
- }
- else
- {
- Dimension dims = getPreferredInnerVertical();
- boxDependent = (double) dims.height / iterations;
- boxIndependent = dims.width;
- }
-
- Rectangle vr = new Rectangle();
- SwingUtilities.calculateInnerArea(progressBar, vr);
-
- int index = getAnimationIndex();
- if (animationIndex > (numFrames + 1) / 2)
- index = numFrames - getAnimationIndex();
-
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- {
- r.x = vr.x + (int) (index * boxDependent);
- r.y = vr.y;
- r.width = (int) boxDependent;
- r.height = (int) boxIndependent;
- }
- else
- {
- index++;
- r.x = vr.x;
- r.y = vr.height - (int) (index * boxDependent) + vr.y;
- r.width = (int) boxIndependent;
- r.height = (int) boxDependent;
- }
-
- return r;
- }
-
- /**
- * This method returns the length of the cells.
- *
- * @return The cell length.
- */
- protected int getCellLength()
- {
- return cellLength;
- }
-
- /**
- * This method returns the spacing between cells.
- *
- * @return The cell gap.
- */
- protected int getCellSpacing()
- {
- return cellSpacing;
- }
-
- /**
- * This method returns the maximum size of the JComponent.
- * If it returns null, it is up to the LayoutManager
- * to give it a size.
- *
- * @param c The component to find a maximum size for.
- *
- * @return The maximum size.
- */
- public Dimension getMaximumSize(JComponent c)
- {
- return getPreferredSize(c);
- }
-
- /**
- * This method returns the minimum size of the JComponent.
- * If it returns null, it is up to the LayoutManager to
- * give it a size.
- *
- * @param c The component to find a minimum size for.
- *
- * @return The minimum size.
- */
- public Dimension getMinimumSize(JComponent c)
- {
- return getPreferredSize(c);
- }
-
- /**
- * This method returns the preferred size of the inner
- * rectangle (the bounds without the insets) if the
- * progressBar is horizontal.
- *
- * @return The preferred size of the progressBar minus
- * insets if it's horizontal.
- */
- protected Dimension getPreferredInnerHorizontal()
- {
- Rectangle vr = new Rectangle();
-
- SwingUtilities.calculateInnerArea(progressBar, vr);
-
- return new Dimension(vr.width, vr.height);
- }
-
- /**
- * This method returns the preferred size of the inner
- * rectangle (the bounds without insets) if the
- * progressBar is vertical.
- *
- * @return The preferred size of the progressBar minus
- * insets if it's vertical.
- */
- protected Dimension getPreferredInnerVertical()
- {
- Rectangle vr = new Rectangle();
-
- SwingUtilities.calculateInnerArea(progressBar, vr);
-
- return new Dimension(vr.width, vr.height);
- }
-
- /**
- * This method returns the preferred size of the
- * given JComponent. If it returns null, then it
- * is up to the LayoutManager to give it a size.
- *
- * @param c The component to find the preferred size for.
- *
- * @return The preferred size of the component.
- */
- public Dimension getPreferredSize(JComponent c)
- {
- // The only thing we need to worry about is
- // the text size.
- Graphics g = progressBar.getGraphics();
-
- Insets insets = c.getInsets();
-
- FontMetrics fm = g.getFontMetrics(c.getFont());
-
- int textW = fm.stringWidth(progressBar.getString());
- int textH = fm.getHeight();
-
- g.dispose();
-
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- {
- if (textH < 20)
- textH = 20;
- if (textW < 200)
- textW = 200;
- }
- else
- {
- if (textH < 200)
- textH = 200;
- if (textW < 20)
- textW = 20;
- }
- textW += insets.left + insets.right;
- textH += insets.top + insets.bottom;
- return new Dimension(textW, textH);
- }
-
- /**
- * This method returns the Color that the text is shown in when the bar is
- * not over the text.
- *
- * @return The color of the text when the bar is not over it.
- */
- protected Color getSelectionBackground()
- {
- return selectionBackground;
- }
-
- /**
- * This method returns the Color that the text is shown in when the bar is
- * over the text.
- *
- * @return The color of the text when the bar is over it.
- */
- protected Color getSelectionForeground()
- {
- return selectionForeground;
- }
-
- /**
- * This method returns the point (the top left of the bounding box)
- * where the text should be painted.
- *
- * @param g The Graphics object to measure FontMetrics with.
- * @param progressString The string to paint.
- * @param x The x coordinate of the overall bounds box.
- * @param y The y coordinate of the overall bounds box.
- * @param width The width of the overall bounds box.
- * @param height The height of the overall bounds box.
- *
- * @return The top left of the bounding box where text should be painted.
- */
- protected Point getStringPlacement(Graphics g, String progressString, int x,
- int y, int width, int height)
- {
- Rectangle tr = new Rectangle();
- Rectangle vr = new Rectangle(x, y, width, height);
- Rectangle ir = new Rectangle();
-
- Font f = g.getFont();
- FontMetrics fm = g.getFontMetrics(f);
-
- SwingUtilities.layoutCompoundLabel(progressBar, fm, progressString, null,
- SwingConstants.CENTER,
- SwingConstants.CENTER,
- SwingConstants.CENTER,
- SwingConstants.CENTER, vr, ir, tr, 0);
- return new Point(tr.x, tr.y);
- }
-
- /**
- * This method increments the animation index.
- */
- public void incrementAnimationIndex()
- {
- animationIndex++;
- //numFrames is like string length, it should be named numFrames or something
- if (animationIndex >= numFrames)
- animationIndex = 0;
- progressBar.repaint();
- }
-
- /**
- * This method paints the progressBar. It delegates its responsibilities
- * to paintDeterminate and paintIndeterminate.
- *
- * @param g The Graphics object to paint with.
- * @param c The JComponent to paint.
- */
- public void paint(Graphics g, JComponent c)
- {
- if (! progressBar.isIndeterminate())
- paintDeterminate(g, c);
- else
- paintIndeterminate(g, c);
-
- if (progressBar.isBorderPainted())
- progressBar.getBorder().paintBorder(progressBar, g, 0, 0,
- progressBar.getWidth(),
- progressBar.getHeight());
- }
-
- /**
- * This method is called if the painting to be done is
- * for a determinate progressBar.
- *
- * @param g The Graphics object to paint with.
- * @param c The JComponent to paint.
- */
- protected void paintDeterminate(Graphics g, JComponent c)
- {
- Color saved = g.getColor();
- int space = getCellSpacing();
- int len = getCellLength();
- int max = progressBar.getMaximum();
- int min = progressBar.getMinimum();
- int value = progressBar.getValue();
-
- Rectangle vr = new Rectangle();
- SwingUtilities.calculateInnerArea(c, vr);
-
- Rectangle or = c.getBounds();
-
- Insets insets = c.getInsets();
-
- int amountFull = getAmountFull(insets, or.width, or.height);
-
- g.setColor(c.getBackground());
- g.fill3DRect(vr.x, vr.y, vr.width, vr.height, false);
-
- if (max != min && len != 0 && value > min)
- {
- int iterations = value / (space + len);
-
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- {
- double spaceInUnits = space * (double) vr.width / (max - min);
- double lenInUnits = len * (double) vr.width / (max - min);
- double currX = vr.x;
-
- g.setColor(c.getForeground());
- g.fill3DRect(vr.x, vr.y, amountFull, vr.height, true);
-
- g.setColor(c.getBackground());
- if (spaceInUnits != 0)
- {
- for (int i = 0; i < iterations; i++)
- {
- currX += lenInUnits;
- g.fill3DRect((int) currX, vr.y, (int) spaceInUnits,
- vr.height, true);
- currX += spaceInUnits;
- }
- }
- }
- else
- {
- double currY = vr.y;
- double spaceInUnits = space * (double) vr.height / (max - min);
- double lenInUnits = len * (double) vr.height / (max - min);
-
- g.setColor(c.getForeground());
- g.fill3DRect(vr.x, vr.y + vr.height - amountFull, vr.width,
- amountFull, true);
-
- g.setColor(c.getBackground());
-
- if (spaceInUnits != 0)
- {
- for (int i = 0; i < iterations; i++)
- {
- currY -= lenInUnits + spaceInUnits;
- g.fill3DRect(vr.x, (int) currY, vr.width,
- (int) spaceInUnits, true);
- }
- }
- }
- }
-
- if (progressBar.isStringPainted())
- paintString(g, 0, 0, or.width, or.height, amountFull, insets);
- g.setColor(saved);
- }
-
- /**
- * This method is called if the painting to be done is for
- * an indeterminate progressBar.
- *
- * @param g The Graphics object to paint with.
- * @param c The JComponent to paint.
- */
- protected void paintIndeterminate(Graphics g, JComponent c)
- {
- //need to paint the box at it's current position. no text is painted since
- //all we're doing is bouncing back and forth
- Color saved = g.getColor();
- Insets insets = c.getInsets();
-
- Rectangle or = c.getBounds();
- Rectangle vr = new Rectangle();
- SwingUtilities.calculateInnerArea(c, vr);
-
- g.setColor(c.getBackground());
- g.fill3DRect(vr.x, vr.y, vr.width, vr.height, false);
-
- Rectangle box = new Rectangle();
- getBox(box);
-
- g.setColor(c.getForeground());
- g.fill3DRect(box.x, box.y, box.width, box.height, true);
-
- if (progressBar.isStringPainted())
- paintString(g, 0, 0, or.width, or.height,
- getAmountFull(insets, or.width, or.height), insets);
-
- g.setColor(saved);
- }
-
- /**
- * This method paints the string for the progressBar.
- *
- * @param g The Graphics object to paint with.
- * @param x The x coordinate of the progressBar.
- * @param y The y coordinate of the progressBar.
- * @param width The width of the progressBar.
- * @param height The height of the progressBar.
- * @param amountFull The amount of the progressBar that has its bar filled.
- * @param b The insets of the progressBar.
- */
- protected void paintString(Graphics g, int x, int y, int width, int height,
- int amountFull, Insets b)
- {
- // We want to place in the exact center of the bar.
- Point placement = getStringPlacement(g, progressBar.getString(),
- x + b.left, y + b.top,
- width - b.left - b.right,
- height - b.top - b.bottom);
- Color saved = g.getColor();
-
- // FIXME: The Color of the text should use selectionForeground and selectionBackground
- // but that can't be done right now, so we'll use white in the mean time.
- g.setColor(Color.WHITE);
-
- FontMetrics fm = g.getFontMetrics(progressBar.getFont());
-
- g.drawString(progressBar.getString(), placement.x,
- placement.y + fm.getAscent());
-
- g.setColor(saved);
- }
-
- /**
- * This method sets the current animation index. If the index
- * is greater than the number of frames, it resets to 0.
- *
- * @param newValue The new animation index.
- */
- protected void setAnimationIndex(int newValue)
- {
- animationIndex = (newValue <= numFrames) ? newValue : 0;
- progressBar.repaint();
- }
-
- /**
- * This method sets the cell length.
- *
- * @param cellLen The cell length.
- */
- protected void setCellLength(int cellLen)
- {
- cellLength = cellLen;
- }
-
- /**
- * This method sets the cell spacing.
- *
- * @param cellSpace The cell spacing.
- */
- protected void setCellSpacing(int cellSpace)
- {
- cellSpacing = cellSpace;
- }
-
- /**
- * This method starts the animation timer. It is called
- * when the propertyChangeListener detects that the progressBar
- * has changed to indeterminate mode.
- */
- protected void startAnimationTimer()
- {
- if (animationTimer != null)
- animationTimer.start();
- }
-
- /**
- * This method stops the animation timer. It is called when
- * the propertyChangeListener detects that the progressBar
- * has changed to determinate mode.
- */
- protected void stopAnimationTimer()
- {
- if (animationTimer != null)
- animationTimer.stop();
- setAnimationIndex(0);
- }
-
- /**
- * This method changes the settings for the progressBar to
- * the defaults provided by the current Look and Feel.
- */
- protected void installDefaults()
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- progressBar.setFont(defaults.getFont("ProgressBar.font"));
- progressBar.setForeground(defaults.getColor("ProgressBar.foreground"));
- progressBar.setBackground(defaults.getColor("ProgressBar.background"));
- progressBar.setBorder(defaults.getBorder("ProgressBar.border"));
-
- selectionForeground = defaults.getColor("ProgressBar.selectionForeground");
- selectionBackground = defaults.getColor("ProgressBar.selectionBackground");
- cellLength = defaults.getInt("ProgressBar.cellLength");
- cellSpacing = defaults.getInt("ProgressBar.cellSpacing");
-
- int repaintInterval = defaults.getInt("ProgressBar.repaintInterval");
- int cycleTime = defaults.getInt("ProgressBar.cycleTime");
-
- if (cycleTime % repaintInterval != 0
- && (cycleTime / repaintInterval) % 2 != 0)
- {
- int div = (cycleTime / repaintInterval) + 2;
- div /= 2;
- div *= 2;
- cycleTime = div * repaintInterval;
- }
- setAnimationIndex(0);
- numFrames = cycleTime / repaintInterval;
- animationTimer.setDelay(repaintInterval);
- }
-
- /**
- * The method uninstalls any defaults that were
- * set by the current Look and Feel.
- */
- protected void uninstallDefaults()
- {
- progressBar.setFont(null);
- progressBar.setForeground(null);
- progressBar.setBackground(null);
-
- selectionForeground = null;
- selectionBackground = null;
- }
-
- /**
- * This method registers listeners to all the
- * components that this UI delegate needs to listen to.
- */
- protected void installListeners()
- {
- changeListener = new ChangeHandler();
- propertyListener = new PropertyChangeHandler();
- animation = new Animator();
-
- progressBar.addChangeListener(changeListener);
- progressBar.addPropertyChangeListener(propertyListener);
- animationTimer.addActionListener(animation);
- }
-
- /**
- * This method unregisters listeners to all the
- * components that were listened to.
- */
- protected void uninstallListeners()
- {
- progressBar.removeChangeListener(changeListener);
- progressBar.removePropertyChangeListener(propertyListener);
- animationTimer.removeActionListener(animation);
-
- changeListener = null;
- propertyListener = null;
- animation = null;
- }
-
- /**
- * This method installs the UI for the given JComponent.
- * This includes setting up defaults and listeners as
- * well as initializing any values or objects that
- * the UI may need.
- *
- * @param c The JComponent that is having this UI installed.
- */
- public void installUI(JComponent c)
- {
- super.installUI(c);
- if (c instanceof JProgressBar)
- {
- progressBar = (JProgressBar) c;
-
- animationTimer = new Timer();
- animationTimer.setRepeats(true);
-
- installDefaults();
- installListeners();
- }
- }
-
- /**
- * This method removes the UI for the given JComponent.
- * This includes removing any listeners or defaults
- * that the installUI may have set up.
- *
- * @param c The JComponent that is having this UI uninstalled.
- */
- public void uninstallUI(JComponent c)
- {
- super.uninstallUI(c);
- uninstallListeners();
- uninstallDefaults();
-
- animationTimer = null;
- progressBar = null;
- }
-}
diff --git a/libjava/javax/swing/plaf/basic/BasicSeparatorUI.java b/libjava/javax/swing/plaf/basic/BasicSeparatorUI.java
deleted file mode 100644
index b7df0acb27d..00000000000
--- a/libjava/javax/swing/plaf/basic/BasicSeparatorUI.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/* BasicSeparatorUI.java
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package javax.swing.plaf.basic;
-
-import java.awt.Dimension;
-import java.awt.Color;
-import java.awt.Rectangle;
-import java.awt.Graphics;
-import java.awt.Insets;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.SeparatorUI;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
-import javax.swing.JComponent;
-import javax.swing.JSeparator;
-import javax.swing.SwingUtilities;
-
-/**
- * The Basic L&F UI delegate for JSeparator.
- */
-public class BasicSeparatorUI extends SeparatorUI
-{
- /** The shadow color. */
- protected Color shadow;
-
- /** The highlight color. */
- protected Color highlight;
-
- /**
- * Creates a new UI delegate for the given JComponent.
- *
- * @param c The JComponent to create a delegate for.
- *
- * @return A new BasicSeparatorUI.
- */
- public static ComponentUI createUI(JComponent c)
- {
- return new BasicSeparatorUI();
- }
-
- /**
- * This method installs the UI for the given JComponent.
- * This can include installing defaults, listeners, and
- * initializing any instance data.
- *
- * @param c The JComponent that is having this UI installed.
- */
- public void installUI(JComponent c)
- {
- super.installUI(c);
-
- if (c instanceof JSeparator)
- {
- JSeparator s = (JSeparator) c;
-
- installDefaults(s);
- installListeners(s);
- }
- }
-
- /**
- * Uninstalls the UI for the given JComponent. This
- * method reverses what was done when installing
- * the UI on the JComponent.
- *
- * @param c The JComponent that is having this UI uninstalled.
- */
- public void uninstallUI(JComponent c)
- {
- if (c instanceof JSeparator)
- {
- JSeparator s = (JSeparator) c;
-
- uninstallListeners(s);
- uninstallDefaults(s);
- }
- }
-
- /**
- * This method installs the defaults that are given by
- * the Basic L&F.
- *
- * @param s The JSeparator that is being installed.
- */
- protected void installDefaults(JSeparator s)
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- shadow = defaults.getColor("Separator.shadow");
- highlight = defaults.getColor("Separator.highlight");
- }
-
- /**
- * This method removes the defaults that were given
- * by the Basic L&F.
- *
- * @param s The JSeparator that is being uninstalled.
- */
- protected void uninstallDefaults(JSeparator s)
- {
- shadow = null;
- highlight = null;
- }
-
- /**
- * This method installs any listeners that need
- * to be attached to the JSeparator or any of its
- * components.
- *
- * @param s The JSeparator that is being installed.
- */
- protected void installListeners(JSeparator s)
- {
- // Separators don't receive events.
- }
-
- /**
- * This method uninstalls any listeners that
- * were installed during the install UI process.
- *
- * @param s The JSeparator that is being uninstalled.
- */
- protected void uninstallListeners(JSeparator s)
- {
- // Separators don't receive events.
- }
-
- /**
- * The separator is made of two lines. The top line will be
- * the highlight color (or left line if it's vertical). The bottom
- * or right line will be the shadow color. The two lines will
- * be centered inside the bounds box. If the separator is horizontal,
- * then it will be vertically centered, or if it's vertical, it will
- * be horizontally centered.
- *
- * @param g The Graphics object to paint with
- * @param c The JComponent to paint.
- */
- public void paint(Graphics g, JComponent c)
- {
- Rectangle r = new Rectangle();
- SwingUtilities.calculateInnerArea(c, r);
- Color saved = g.getColor();
-
- int midAB = r.width / 2 + r.x;
- int midAD = r.height / 2 + r.y;
-
- JSeparator s;
- if (c instanceof JSeparator)
- s = (JSeparator) c;
- else
- return;
-
- if (s.getOrientation() == JSeparator.HORIZONTAL)
- {
- g.setColor(highlight);
- g.drawLine(r.x, midAD, r.x + r.width, midAD);
-
- g.setColor(shadow);
- g.drawLine(r.x, midAD + 1, r.x + r.width, midAD + 1);
- }
- else
- {
- g.setColor(highlight);
- g.drawLine(midAB, r.y, midAB, r.y + r.height);
-
- g.setColor(shadow);
- g.drawLine(midAB + 1, r.y, midAB + 1, r.y + r.height);
- }
- }
-
- /**
- * This method returns the preferred size of the
- * JComponent.
- *
- * @param c The JComponent to measure.
- *
- * @return The preferred size.
- */
- public Dimension getPreferredSize(JComponent c)
- {
- Dimension dims = new Dimension(0, 0);
- Insets insets = c.getInsets();
-
- if (c instanceof JSeparator)
- {
- JSeparator s = (JSeparator) c;
-
- if (s.getOrientation() == JSeparator.HORIZONTAL)
- {
- dims.height = 2;
- dims.width = 40;
- }
- else
- {
- dims.width = 2;
- dims.height = 40;
- }
- }
- dims.width += insets.left + insets.right;
- dims.height += insets.top + insets.bottom;
-
- return dims;
- }
-
- /**
- * This method returns the minimum size of the
- * JComponent.
- *
- * @param c The JComponent to measure.
- *
- * @return The minimum size.
- */
- public Dimension getMinimumSize(JComponent c)
- {
- return getPreferredSize(c);
- }
-
- /**
- * This method returns the maximum size of the
- * JComponent.
- *
- * @param c The JComponent to measure.
- *
- * @return The maximum size.
- */
- public Dimension getMaximumSize(JComponent c)
- {
- return getPreferredSize(c);
- }
-}
diff --git a/libjava/javax/swing/plaf/basic/BasicSliderUI.java b/libjava/javax/swing/plaf/basic/BasicSliderUI.java
deleted file mode 100644
index 2ee481e317d..00000000000
--- a/libjava/javax/swing/plaf/basic/BasicSliderUI.java
+++ /dev/null
@@ -1,2213 +0,0 @@
-/* BasicSliderUI.java
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package javax.swing.plaf.basic;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.ComponentOrientation;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Polygon;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.InputEvent;
-import java.awt.event.MouseEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JSlider;
-import javax.swing.KeyStroke;
-import javax.swing.SwingUtilities;
-import javax.swing.Timer;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
-import javax.swing.BoundedRangeModel;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.MouseInputAdapter;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.SliderUI;
-
-
-/**
- * <p>
- * BasicSliderUI.java This is the UI delegate in the Basic look and feel that
- * paints JSliders.
- * </p>
- *
- * <p>
- * The UI delegate keeps track of 6 rectangles that place the various parts of
- * the JSlider inside the component.
- * </p>
- *
- * <p>
- * The rectangles are organized as follows:
- * </p>
- * <pre>
- * +-------------------------------------------------------+ <-- focusRect
- * | |
- * | +==+-------------------+==+--------------------+==+<------ contentRect
- * | | | | |<---thumbRect | | |
- * | | | TRACK | | |<--------- trackRect
- * | | +-------------------+==+--------------------+ | |
- * | | | | | |
- * | | | TICKS GO HERE |<-------- tickRect
- * | | | | | |
- * | +==+-------------------------------------------+==+ |
- * | | | | | |
- * | | | | |<----- labelRect
- * | | | LABELS GO HERE | | |
- * | | | | | |
- * | | | | | |
- * | | | | | |
- * | | | | | |
- * | | | | |
- * </pre>
- *
- * <p>
- * The space between the contentRect and the focusRect are the FocusInsets.
- * </p>
- *
- * <p>
- * The space between the focusRect and the component bounds is the insetCache
- * which are the component's insets.
- * </p>
- *
- * <p>
- * The top of the thumb is the top of the contentRect. The trackRect has to be
- * as tall as the thumb.
- * </p>
- *
- * <p>
- * The trackRect and tickRect do not start from the left edge of the
- * focusRect. They are trackBuffer away from each side of the focusRect. This
- * is so that the thumb has room to move.
- * </p>
- *
- * <p>
- * The labelRect does start right against the contentRect's left and right
- * edges and it gets all remaining space.
- * </p>
- */
-public class BasicSliderUI extends SliderUI
-{
- /**
- * Helper class that listens to the {@link JSlider}'s model for changes.
- */
- protected class ChangeHandler implements ChangeListener
- {
- /**
- * Called when the slider's model has been altered. The UI delegate should
- * recalculate any rectangles that are dependent on the model for their
- * positions and repaint.
- *
- * @param e A static {@link ChangeEvent} passed from the model.
- */
- public void stateChanged(ChangeEvent e)
- {
- // Maximum, minimum, and extent values will be taken
- // care of automatically when the slider is repainted.
-
- // Only thing that needs recalculation is the thumb.
- calculateThumbLocation();
- slider.repaint();
- }
- }
-
- /**
- * Helper class that listens for resize events.
- */
- protected class ComponentHandler extends ComponentAdapter
- {
- /**
- * Called when the size of the component changes. The UI delegate should
- * recalculate any rectangles that are dependent on the model for their
- * positions and repaint.
- *
- * @param e A {@link ComponentEvent}.
- */
- public void componentResized(ComponentEvent e)
- {
- calculateGeometry();
-
- slider.revalidate();
- slider.repaint();
- }
- }
-
- /**
- * Helper class that listens for focus events.
- */
- protected class FocusHandler implements FocusListener
- {
- /**
- * Called when the {@link JSlider} has gained focus. It should repaint
- * the slider with the focus drawn.
- *
- * @param e A {@link FocusEvent}.
- */
- public void focusGained(FocusEvent e)
- {
- // FIXME: implement.
- }
-
- /**
- * Called when the {@link JSlider} has lost focus. It should repaint the
- * slider without the focus drawn.
- *
- * @param e A {@link FocusEvent}.
- */
- public void focusLost(FocusEvent e)
- {
- // FIXME: implement.
- }
- }
-
- /**
- * Helper class that listens for changes to the properties of the {@link
- * JSlider}.
- */
- protected class PropertyChangeHandler implements PropertyChangeListener
- {
- /**
- * Called when one of the properties change. The UI should recalculate any
- * rectangles if necessary and repaint.
- *
- * @param e A {@link PropertyChangeEvent}.
- */
- public void propertyChange(PropertyChangeEvent e)
- {
- // Check for orientation changes.
- if (e.getPropertyName().equals(JSlider.ORIENTATION_CHANGED_PROPERTY))
- recalculateIfOrientationChanged();
- else if (e.getPropertyName().equals(JSlider.MODEL_CHANGED_PROPERTY))
- {
- BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
- oldModel.removeChangeListener(changeListener);
- slider.getModel().addChangeListener(changeListener);
- calculateThumbLocation();
- }
- // elif the componentOrientation changes (this is a bound property,
- // just undocumented) we change leftToRightCache. In Sun's
- // implementation, the LTR cache changes on a repaint. This is strange
- // since there is no need to do so. We could events here and
- // update the cache.
-
- // elif the border/insets change, we recalculateInsets.
- slider.repaint();
- }
- }
-
- /**
- * Helper class that listens to our swing timer. This class is responsible
- * for listening to the timer and moving the thumb in the proper direction
- * every interval.
- */
- protected class ScrollListener implements ActionListener
- {
- /** Indicates which direction the thumb should scroll. */
- private transient int direction;
-
- /** Indicates whether we should scroll in blocks or in units. */
- private transient boolean block;
-
- /**
- * Creates a new ScrollListener object.
- */
- public ScrollListener()
- {
- direction = POSITIVE_SCROLL;
- block = false;
- }
-
- /**
- * Creates a new ScrollListener object.
- *
- * @param dir The direction to scroll in.
- * @param block If movement will be in blocks.
- */
- public ScrollListener(int dir, boolean block)
- {
- direction = dir;
- this.block = block;
- }
-
- /**
- * Called every time the swing timer reaches its interval. If the thumb
- * needs to move, then this method will move the thumb one block or unit
- * in the direction desired. Otherwise, the timer can be stopped.
- *
- * @param e An {@link ActionEvent}.
- */
- public void actionPerformed(ActionEvent e)
- {
- if (! trackListener.shouldScroll(direction))
- {
- scrollTimer.stop();
- return;
- }
-
- if (block)
- scrollByBlock(direction);
- else
- scrollByUnit(direction);
- }
-
- /**
- * Sets the direction to scroll in.
- *
- * @param direction The direction to scroll in.
- */
- public void setDirection(int direction)
- {
- this.direction = direction;
- }
-
- /**
- * Sets whether movement will be in blocks.
- *
- * @param block If movement will be in blocks.
- */
- public void setScrollByBlock(boolean block)
- {
- this.block = block;
- }
- }
-
- /**
- * Helper class that listens for mouse events.
- */
- protected class TrackListener extends MouseInputAdapter
- {
- /** The current X position of the mouse. */
- protected int currentMouseX;
-
- /** The current Y position of the mouse. */
- protected int currentMouseY;
-
- /** The offset between the current slider value
- and the cursor's position. */
- protected int offset;
-
- /**
- * Called when the mouse has been dragged. This should find the mouse's
- * current position and adjust the value of the {@link JSlider}
- * accordingly.
- *
- * @param e A {@link MouseEvent}
- */
- public void mouseDragged(MouseEvent e)
- {
- currentMouseX = e.getX();
- currentMouseY = e.getY();
- if (slider.getValueIsAdjusting())
- {
- int value;
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- value = valueForXPosition(currentMouseX) - offset;
- else
- value = valueForYPosition(currentMouseY) - offset;
-
- slider.setValue(value);
- }
- }
-
- /**
- * Called when the mouse has moved over a component but no buttons have
- * been pressed yet.
- *
- * @param e A {@link MouseEvent}
- */
- public void mouseMoved(MouseEvent e)
- {
- // Don't care that we're moved unless we're dragging.
- }
-
- /**
- * Called when the mouse is pressed. When the press occurs on the thumb
- * itself, the {@link JSlider} should have its value set to where the
- * mouse was pressed. If the press occurs on the track, then the thumb
- * should move one block towards the direction of the mouse.
- *
- * @param e A {@link MouseEvent}
- */
- public void mousePressed(MouseEvent e)
- {
- currentMouseX = e.getX();
- currentMouseY = e.getY();
-
- int value;
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- value = valueForXPosition(currentMouseX);
- else
- value = valueForYPosition(currentMouseY);
-
- if (slider.getSnapToTicks())
- value = findClosestTick(value);
-
- if (value == slider.getValue())
- return;
-
- // If the thumb is hit, then we don't need to set the timers to move it.
- if (!thumbRect.contains(e.getPoint()))
- {
- // The mouse has hit some other part of the slider.
- // The value moves no matter where in the slider you hit.
- if (value > slider.getValue())
- scrollDueToClickInTrack(POSITIVE_SCROLL);
- else
- scrollDueToClickInTrack(NEGATIVE_SCROLL);
- }
- else
- {
- slider.setValueIsAdjusting(true);
- offset = value - slider.getValue();
- }
- }
-
- /**
- * Called when the mouse is released. This should stop the timer that
- * scrolls the thumb.
- *
- * @param e A {@link MouseEvent}
- */
- public void mouseReleased(MouseEvent e)
- {
- currentMouseX = e.getX();
- currentMouseY = e.getY();
-
- if (slider.getValueIsAdjusting())
- {
- slider.setValueIsAdjusting(false);
- if (slider.getSnapToTicks())
- slider.setValue(findClosestTick(slider.getValue()));
- }
- if (scrollTimer != null)
- scrollTimer.stop();
- }
-
- /**
- * Indicates whether the thumb should scroll in the given direction.
- *
- * @param direction The direction to check.
- *
- * @return True if the thumb should move in that direction.
- */
- public boolean shouldScroll(int direction)
- {
- int value;
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- value = valueForXPosition(currentMouseX);
- else
- value = valueForYPosition(currentMouseY);
-
- if (direction == POSITIVE_SCROLL)
- return (value > slider.getValue());
- else
- return (value < slider.getValue());
- }
- }
-
- /** The preferred height of the thumb. */
- private transient int thumbHeight;
-
- /** The preferred width of the thumb. */
- private transient int thumbWidth;
-
- /** The preferred height of the tick rectangle. */
- private transient int tickHeight;
-
- /** Listener for changes from the model. */
- protected ChangeListener changeListener;
-
- /** Listener for changes to the {@link JSlider}. */
- protected PropertyChangeListener propertyChangeListener;
-
- /** Listener for the scrollTimer. */
- protected ScrollListener scrollListener;
-
- /** Listener for component resizing. */
- protected ComponentListener componentListener;
-
- /** Listener for focus handling. */
- protected FocusListener focusListener;
-
- /** Listener for mouse events. */
- protected TrackListener trackListener;
-
- /** The insets between the FocusRectangle and the ContentRectangle. */
- protected Insets focusInsets;
-
- /** The {@link JSlider}'s insets. */
- protected Insets insetCache;
-
- /** Rectangle describing content bounds. See diagram above. */
- protected Rectangle contentRect;
-
- /** Rectangle describing focus bounds. See diagram above. */
- protected Rectangle focusRect;
-
- /** Rectangle describing the thumb's bounds. See diagram above. */
- protected Rectangle thumbRect;
-
- /** Rectangle describing the tick bounds. See diagram above. */
- protected Rectangle tickRect;
-
- /** Rectangle describing the label bounds. See diagram above. */
- protected Rectangle labelRect;
-
- /** Rectangle describing the track bounds. See diagram above. */
- protected Rectangle trackRect;
-
- /** FIXME: use this somewhere. */
- public static final int MAX_SCROLL = 2;
-
- /** FIXME: use this somewhere. */
- public static final int MIN_SCROLL = -2;
-
- /** A constant describing scrolling towards the minimum. */
- public static final int NEGATIVE_SCROLL = -1;
-
- /** A constant describing scrolling towards the maximum. */
- public static final int POSITIVE_SCROLL = 1;
-
- /** The gap between the edges of the contentRect and trackRect. */
- protected int trackBuffer;
-
- /** Whether this slider is actually drawn left to right. */
- protected boolean leftToRightCache;
-
- /** A timer that periodically moves the thumb. */
- protected Timer scrollTimer;
-
- /** A reference to the {@link JSlider} that this UI was created for. */
- protected JSlider slider;
-
- /** The shadow color. */
- private transient Color shadowColor;
-
- /** The highlight color. */
- private transient Color highlightColor;
-
- /** The focus color. */
- private transient Color focusColor;
-
- /**
- * Creates a new Basic look and feel Slider UI.
- *
- * @param b The {@link JSlider} that this UI was created for.
- */
- public BasicSliderUI(JSlider b)
- {
- super();
- }
-
- /**
- * Gets the shadow color to be used for this slider. The shadow color is the
- * color used for drawing the top and left edges of the track.
- *
- * @return The shadow color.
- */
- protected Color getShadowColor()
- {
- return shadowColor;
- }
-
- /**
- * Gets the highlight color to be used for this slider. The highlight color
- * is the color used for drawing the bottom and right edges of the track.
- *
- * @return The highlight color.
- */
- protected Color getHighlightColor()
- {
- return highlightColor;
- }
-
- /**
- * Gets the focus color to be used for this slider. The focus color is the
- * color used for drawing the focus rectangle when the component gains
- * focus.
- *
- * @return The focus color.
- */
- protected Color getFocusColor()
- {
- return focusColor;
- }
-
- /**
- * Factory method to create a BasicSliderUI for the given {@link
- * JComponent}, which should be a {@link JSlider}.
- *
- * @param b The {@link JComponent} a UI is being created for.
- *
- * @return A BasicSliderUI for the {@link JComponent}.
- */
- public static ComponentUI createUI(JComponent b)
- {
- return new BasicSliderUI((JSlider) b);
- }
-
- /**
- * Installs and initializes all fields for this UI delegate. Any properties
- * of the UI that need to be initialized and/or set to defaults will be
- * done now. It will also install any listeners necessary.
- *
- * @param c The {@link JComponent} that is having this UI installed.
- */
- public void installUI(JComponent c)
- {
- super.installUI(c);
- if (c instanceof JSlider)
- {
- slider = (JSlider) c;
-
- focusRect = new Rectangle();
- contentRect = new Rectangle();
- thumbRect = new Rectangle();
- trackRect = new Rectangle();
- tickRect = new Rectangle();
- labelRect = new Rectangle();
-
- insetCache = slider.getInsets();
- leftToRightCache = ! slider.getInverted();
-
- scrollTimer = new Timer();
- scrollTimer.setDelay(200);
- scrollTimer.setRepeats(true);
-
- installDefaults(slider);
- installListeners(slider);
- installKeyboardActions(slider);
-
- calculateFocusRect();
-
- calculateContentRect();
- calculateThumbSize();
- calculateTrackBuffer();
- calculateTrackRect();
- calculateThumbLocation();
-
- calculateTickRect();
- calculateLabelRect();
- }
- }
-
- /**
- * Performs the opposite of installUI. Any properties or resources that need
- * to be cleaned up will be done now. It will also uninstall any listeners
- * it has. In addition, any properties of this UI will be nulled.
- *
- * @param c The {@link JComponent} that is having this UI uninstalled.
- */
- public void uninstallUI(JComponent c)
- {
- super.uninstallUI(c);
-
- uninstallKeyboardActions(slider);
- uninstallListeners(slider);
-
- scrollTimer = null;
-
- focusRect = null;
- contentRect = null;
- thumbRect = null;
- trackRect = null;
- tickRect = null;
- labelRect = null;
-
- focusInsets = null;
- }
-
- /**
- * Initializes any default properties that this UI has from the defaults for
- * the Basic look and feel.
- *
- * @param slider The {@link JSlider} that is having this UI installed.
- */
- protected void installDefaults(JSlider slider)
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- slider.setForeground(defaults.getColor("Slider.foreground"));
- slider.setBackground(defaults.getColor("Slider.background"));
- shadowColor = defaults.getColor("Slider.shadow");
- highlightColor = defaults.getColor("Slider.highlight");
- focusColor = defaults.getColor("Slider.focus");
- slider.setBorder(defaults.getBorder("Slider.border"));
-
- thumbHeight = defaults.getInt("Slider.thumbHeight");
- thumbWidth = defaults.getInt("Slider.thumbWidth");
- tickHeight = defaults.getInt("Slider.tickHeight");
-
- focusInsets = defaults.getInsets("Slider.focusInsets");
- }
-
- /**
- * Creates a new {@link TrackListener}.
- *
- * @param slider The {@link JSlider} that this {@link TrackListener} is
- * created for.
- *
- * @return A new {@link TrackListener}.
- */
- protected TrackListener createTrackListener(JSlider slider)
- {
- return new TrackListener();
- }
-
- /**
- * Creates a new {@link ChangeListener}.
- *
- * @param slider The {@link JSlider} that this {@link ChangeListener} is
- * created for.
- *
- * @return A new {@link ChangeListener}.
- */
- protected ChangeListener createChangeListener(JSlider slider)
- {
- return new ChangeHandler();
- }
-
- /**
- * Creates a new {@link ComponentListener}.
- *
- * @param slider The {@link JSlider} that this {@link ComponentListener} is
- * created for.
- *
- * @return A new {@link ComponentListener}.
- */
- protected ComponentListener createComponentListener(JSlider slider)
- {
- return new ComponentHandler();
- }
-
- /**
- * Creates a new {@link FocusListener}.
- *
- * @param slider The {@link JSlider} that this {@link FocusListener} is
- * created for.
- *
- * @return A new {@link FocusListener}.
- */
- protected FocusListener createFocusListener(JSlider slider)
- {
- return new FocusHandler();
- }
-
- /**
- * Creates a new {@link ScrollListener}.
- *
- * @param slider The {@link JSlider} that this {@link ScrollListener} is
- * created for.
- *
- * @return A new {@link ScrollListener}.
- */
- protected ScrollListener createScrollListener(JSlider slider)
- {
- return new ScrollListener();
- }
-
- /**
- * Creates a new {@link PropertyChangeListener}.
- *
- * @param slider The {@link JSlider} that this {@link
- * PropertyChangeListener} is created for.
- *
- * @return A new {@link PropertyChangeListener}.
- */
- protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
- {
- return new PropertyChangeHandler();
- }
-
- /**
- * Creates and registers all the listeners for this UI delegate. This
- * includes creating the ScrollListener and registering it to the timer.
- *
- * @param slider The {@link JSlider} is having listeners installed.
- */
- protected void installListeners(JSlider slider)
- {
- propertyChangeListener = createPropertyChangeListener(slider);
- componentListener = createComponentListener(slider);
- trackListener = createTrackListener(slider);
- focusListener = createFocusListener(slider);
- changeListener = createChangeListener(slider);
- scrollListener = createScrollListener(slider);
-
- slider.addPropertyChangeListener(propertyChangeListener);
- slider.addComponentListener(componentListener);
- slider.addMouseListener(trackListener);
- slider.addMouseMotionListener(trackListener);
- slider.addFocusListener(focusListener);
- slider.getModel().addChangeListener(changeListener);
-
- scrollTimer.addActionListener(scrollListener);
- }
-
- /**
- * Unregisters all the listeners that this UI delegate was using. In
- * addition, it will also null any listeners that it was using.
- *
- * @param slider The {@link JSlider} that is having listeners removed.
- */
- protected void uninstallListeners(JSlider slider)
- {
- slider.removePropertyChangeListener(propertyChangeListener);
- slider.removeComponentListener(componentListener);
- slider.removeMouseListener(trackListener);
- slider.removeMouseMotionListener(trackListener);
- slider.removeFocusListener(focusListener);
- slider.getModel().removeChangeListener(changeListener);
-
- scrollTimer.removeActionListener(scrollListener);
-
- propertyChangeListener = null;
- componentListener = null;
- trackListener = null;
- focusListener = null;
- changeListener = null;
- scrollListener = null;
- }
-
- /**
- * Installs any keyboard actions. The list of keys that need to be bound are
- * listed in Basic look and feel's defaults.
- *
- * @param slider The {@link JSlider} that is having keyboard actions
- * installed.
- */
- protected void installKeyboardActions(JSlider slider)
- {
- // FIXME: implement.
- }
-
- /**
- * Uninstalls any keyboard actions. The list of keys used are listed in
- * Basic look and feel's defaults.
- *
- * @param slider The {@link JSlider} that is having keyboard actions
- * uninstalled.
- */
- protected void uninstallKeyboardActions(JSlider slider)
- {
- // FIXME: implement.
- }
-
- /* XXX: This is all after experimentation with SUN's implementation.
-
- PreferredHorizontalSize seems to be 200x21.
- PreferredVerticalSize seems to be 21x200.
-
- MinimumHorizontalSize seems to be 36x21.
- MinimumVerticalSize seems to be 21x36.
-
- PreferredSize seems to be 200x63. Or Components.getBounds?
-
- MinimumSize seems to be 36x63.
-
- MaximumSize seems to be 32767x63.
- */
-
- /**
- * This method returns the preferred size when the slider is
- * horizontally oriented.
- *
- * @return The dimensions of the preferred horizontal size.
- */
- public Dimension getPreferredHorizontalSize()
- {
- Insets insets = slider.getInsets();
-
- // The width should cover all the labels (which are usually the
- // deciding factor of the width)
- int width = getWidthOfWidestLabel() * (slider.getLabelTable() == null ?
- 0 : slider.getLabelTable().size());
-
- // If there are not enough labels.
- // This number is pretty much arbitrary, but it looks nice.
- if (width < 200)
- width = 200;
-
- // We can only draw inside of the focusRectangle, so we have to
- // pad it with insets.
- width += insets.left + insets.right + focusInsets.left +
- focusInsets.right;
-
- // Height is determined by the thumb, the ticks and the labels.
- int height = thumbHeight;
-
- if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 ||
- slider.getMinorTickSpacing() > 0)
- height += tickHeight;
-
- if (slider.getPaintLabels())
- height += getHeightOfTallestLabel();
-
- height += insets.top + insets.bottom + focusInsets.top +
- focusInsets.bottom;
-
- return new Dimension(width, height);
- }
-
- /**
- * This method returns the preferred size when the slider is
- * vertically oriented.
- *
- * @return The dimensions of the preferred vertical size.
- */
- public Dimension getPreferredVerticalSize()
- {
- Insets insets = slider.getInsets();
-
- int height = getHeightOfTallestLabel() * (slider.getLabelTable() == null ?
- 0 : slider.getLabelTable().size());
-
- if (height < 200)
- height = 200;
-
- height += insets.top + insets.bottom + focusInsets.top +
- focusInsets.bottom;
-
- int width = thumbHeight;
-
- if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 ||
- slider.getMinorTickSpacing() > 0)
- width += tickHeight;
-
- if (slider.getPaintLabels())
- width += getWidthOfWidestLabel();
-
- width += insets.left + insets.right + focusInsets.left +
- focusInsets.right;
-
- return new Dimension(width, height);
- }
-
- /**
- * This method returns the minimum size when the slider is
- * horizontally oriented.
- *
- * @return The dimensions of the minimum horizontal size.
- */
- public Dimension getMinimumHorizontalSize()
- {
- return getPreferredHorizontalSize();
- }
-
- /**
- * This method returns the minimum size of the slider when it
- * is vertically oriented.
- *
- * @return The dimensions of the minimum vertical size.
- */
- public Dimension getMinimumVerticalSize()
- {
- return getPreferredVerticalSize();
- }
-
- /**
- * This method returns the preferred size of the component. If it returns
- * null, then it is up to the Layout Manager to give the {@link JComponent}
- * a size.
- *
- * @param c The {@link JComponent} to find the preferred size for.
- *
- * @return The dimensions of the preferred size.
- */
- public Dimension getPreferredSize(JComponent c)
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- return getPreferredHorizontalSize();
- else
- return getPreferredVerticalSize();
- }
-
- /**
- * This method returns the minimum size for this {@link JSlider} for this
- * look and feel. If it returns null, then it is up to the Layout Manager
- * to give the {@link JComponent} a size.
- *
- * @param c The {@link JComponent} to find the minimum size for.
- *
- * @return The dimensions of the minimum size.
- */
- public Dimension getMinimumSize(JComponent c)
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- return getPreferredHorizontalSize();
- else
- return getPreferredVerticalSize();
- }
-
- /**
- * This method returns the maximum size for this {@link JSlider} for this
- * look and feel. If it returns null, then it is up to the Layout Manager
- * to give the {@link JComponent} a size.
- *
- * @param c The {@link JComponent} to find a maximum size for.
- *
- * @return The dimensions of the maximum size.
- */
- public Dimension getMaximumSize(JComponent c)
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- return getPreferredHorizontalSize();
- else
- return getPreferredVerticalSize();
- }
-
- /**
- * This method calculates all the sizes of the rectangles by delegating
- * to the helper methods calculateXXXRect.
- */
- protected void calculateGeometry()
- {
- calculateFocusRect();
- calculateContentRect();
- calculateThumbSize();
- calculateTrackBuffer();
- calculateTrackRect();
- calculateTickRect();
- calculateLabelRect();
- calculateThumbLocation();
- }
-
- /**
- * This method calculates the size and position of the focusRect. This
- * method does not need to be called if the orientation changes.
- */
- protected void calculateFocusRect()
- {
- insetCache = slider.getInsets();
- focusRect = SwingUtilities.calculateInnerArea(slider, focusRect);
-
- if (focusRect.width < 0)
- focusRect.width = 0;
- if (focusRect.height < 0)
- focusRect.height = 0;
- }
-
- /**
- * This method calculates the size but not the position of the thumbRect. It
- * must take into account the orientation of the slider.
- */
- protected void calculateThumbSize()
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- if (thumbWidth > contentRect.width)
- thumbRect.width = contentRect.width / 4;
- else
- thumbRect.width = thumbWidth;
- if (thumbHeight > contentRect.height)
- thumbRect.height = contentRect.height;
- else
- thumbRect.height = thumbHeight;
- }
- else
- {
- // The thumb gets flipped when inverted, so thumbWidth
- // actually is the height and vice versa.
- if (thumbWidth > contentRect.height)
- thumbRect.height = contentRect.height / 4;
- else
- thumbRect.height = thumbWidth;
- if (thumbHeight > contentRect.width)
- thumbRect.width = contentRect.width;
- else
- thumbRect.width = thumbHeight;
- }
- }
-
- /**
- * This method calculates the size and position of the contentRect. This
- * method does not need to be called if the orientation changes.
- */
- protected void calculateContentRect()
- {
- contentRect.x = focusRect.x + focusInsets.left;
- contentRect.y = focusRect.y + focusInsets.top;
- contentRect.width = focusRect.width - focusInsets.left - focusInsets.right;
- contentRect.height = focusRect.height - focusInsets.top
- - focusInsets.bottom;
-
- if (contentRect.width < 0)
- contentRect.width = 0;
- if (contentRect.height < 0)
- contentRect.height = 0;
- }
-
- /**
- * Calculates the position of the thumbRect based on the current value of
- * the slider. It must take into account the orientation of the slider.
- */
- protected void calculateThumbLocation()
- {
- int value = slider.getValue();
-
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- thumbRect.x = xPositionForValue(value) - thumbRect.width / 2;
- thumbRect.y = contentRect.y;
- }
- else
- {
- thumbRect.x = contentRect.x;
- thumbRect.y = yPositionForValue(value) - thumbRect.height / 2;
- }
- }
-
- /**
- * Calculates the gap size between the left edge of the contentRect and the
- * left edge of the trackRect.
- */
- protected void calculateTrackBuffer()
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- trackBuffer = thumbRect.width;
- else
- trackBuffer = thumbRect.height;
- }
-
- /**
- * This method returns the size of the thumbRect.
- *
- * @return The dimensions of the thumb.
- */
- protected Dimension getThumbSize()
- {
- // This is really just the bounds box for the thumb.
- // The thumb will actually be pointed (like a rectangle + triangle at bottom)
- return thumbRect.getSize();
- }
-
- /**
- * Calculates the size and position of the trackRect. It must take into
- * account the orientation of the slider.
- */
- protected void calculateTrackRect()
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- trackRect.x = contentRect.x + trackBuffer;
- trackRect.y = contentRect.y;
- trackRect.width = contentRect.width - 2 * trackBuffer;
- trackRect.height = thumbRect.height;
- }
- else
- {
- trackRect.x = contentRect.x;
- trackRect.y = contentRect.y + trackBuffer;
- trackRect.width = thumbRect.width;
- trackRect.height = contentRect.height - 2 * trackBuffer;
- }
- }
-
- /**
- * This method returns the height of the tick area box if the slider is
- * horizontal and the width of the tick area box is the slider is vertical.
- * It not necessarily how long the ticks will be. If a gap between the edge
- * of tick box and the actual tick is desired, then that will need to be
- * handled in the tick painting methods.
- *
- * @return The height (or width if the slider is vertical) of the tick
- * rectangle.
- */
- protected int getTickLength()
- {
- return tickHeight;
- }
-
- /**
- * This method calculates the size and position of the tickRect. It must
- * take into account the orientation of the slider.
- */
- protected void calculateTickRect()
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- tickRect.x = trackRect.x;
- tickRect.y = trackRect.y + trackRect.height;
- tickRect.width = trackRect.width;
- tickRect.height = getTickLength();
-
- if (tickRect.y + tickRect.height > contentRect.y + contentRect.height)
- tickRect.height = contentRect.y + contentRect.height - tickRect.y;
- }
- else
- {
- tickRect.x = trackRect.x + trackRect.width;
- tickRect.y = trackRect.y;
- tickRect.width = getTickLength();
- tickRect.height = trackRect.height;
-
- if (tickRect.x + tickRect.width > contentRect.x + contentRect.width)
- tickRect.width = contentRect.x + contentRect.width - tickRect.x;
- }
- }
-
- /**
- * This method calculates the size and position of the labelRect. It must
- * take into account the orientation of the slider.
- */
- protected void calculateLabelRect()
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- labelRect.x = contentRect.x;
- labelRect.y = tickRect.y + tickRect.height;
- labelRect.width = contentRect.width;
- labelRect.height = contentRect.height - labelRect.y;
- }
- else
- {
- labelRect.x = tickRect.x + tickRect.width;
- labelRect.y = contentRect.y;
- labelRect.width = contentRect.width - labelRect.x;
- labelRect.height = contentRect.height;
- }
- }
-
- /**
- * This method returns the width of the widest label in the slider's label
- * table.
- *
- * @return The width of the widest label or 0 if no label table exists.
- */
- protected int getWidthOfWidestLabel()
- {
- int widest = 0;
- Component label;
-
- if (slider.getLabelTable() == null)
- return 0;
-
- for (Enumeration list = slider.getLabelTable().elements();
- list.hasMoreElements();)
- {
- Object comp = list.nextElement();
- if (! (comp instanceof Component))
- continue;
- label = (Component) comp;
- if (label.getWidth() > widest)
- widest = label.getWidth();
- }
- return widest;
- }
-
- /**
- * This method returns the height of the tallest label in the slider's label
- * table.
- *
- * @return The height of the tallest label or 0 if no label table exists.
- */
- protected int getHeightOfTallestLabel()
- {
- int tallest = 0;
- Component label;
-
- if (slider.getLabelTable() == null)
- return 0;
-
- for (Enumeration list = slider.getLabelTable().elements();
- list.hasMoreElements();)
- {
- Object comp = list.nextElement();
- if (! (comp instanceof Component))
- continue;
- label = (Component) comp;
- if (label.getHeight() > tallest)
- tallest = label.getHeight();
- }
- return tallest;
- }
-
- /**
- * This method returns the width of the label whose key has the highest
- * value.
- *
- * @return The width of the high value label or 0 if no label table exists.
- */
- protected int getWidthOfHighValueLabel()
- {
- Component highValueLabel = getHighestValueLabel();
- if (highValueLabel != null)
- return highValueLabel.getWidth();
- else
- return 0;
- }
-
- /**
- * This method returns the width of the label whose key has the lowest
- * value.
- *
- * @return The width of the low value label or 0 if no label table exists.
- */
- protected int getWidthOfLowValueLabel()
- {
- Component lowValueLabel = getLowestValueLabel();
- if (lowValueLabel != null)
- return lowValueLabel.getWidth();
- else
- return 0;
- }
-
- /**
- * This method returns the height of the label whose key has the highest
- * value.
- *
- * @return The height of the high value label or 0 if no label table exists.
- */
- protected int getHeightOfHighValueLabel()
- {
- Component highValueLabel = getHighestValueLabel();
- if (highValueLabel != null)
- return highValueLabel.getHeight();
- else
- return 0;
- }
-
- /**
- * This method returns the height of the label whose key has the lowest
- * value.
- *
- * @return The height of the low value label or 0 if no label table exists.
- */
- protected int getHeightOfLowValueLabel()
- {
- Component lowValueLabel = getLowestValueLabel();
- if (lowValueLabel != null)
- return lowValueLabel.getHeight();
- else
- return 0;
- }
-
- /**
- * This method returns whether the slider is to be drawn inverted.
- *
- * @return True is the slider is to be drawn inverted.
- */
- protected boolean drawInverted()
- {
- return ! (slider.getInverted() ^ leftToRightCache);
- }
-
- /**
- * This method returns the label whose key has the lowest value.
- *
- * @return The low value label or null if no label table exists.
- */
- protected Component getLowestValueLabel()
- {
- Integer key = new Integer(Integer.MAX_VALUE);
- Integer tmpKey;
- Dictionary labelTable = slider.getLabelTable();
-
- if (labelTable == null)
- return null;
-
- for (Enumeration list = labelTable.keys(); list.hasMoreElements();)
- {
- Object value = list.nextElement();
- if (! (value instanceof Integer))
- continue;
- tmpKey = (Integer) value;
- if (tmpKey.intValue() < key.intValue())
- key = tmpKey;
- }
- Object comp = labelTable.get(key);
- if (! (comp instanceof Component))
- return null;
- return (Component) comp;
- }
-
- /**
- * This method returns the label whose key has the highest value.
- *
- * @return The high value label or null if no label table exists.
- */
- protected Component getHighestValueLabel()
- {
- Integer key = new Integer(Integer.MIN_VALUE);
- Integer tmpKey;
- Dictionary labelTable = slider.getLabelTable();
-
- if (labelTable == null)
- return null;
-
- for (Enumeration list = labelTable.keys(); list.hasMoreElements();)
- {
- Object value = list.nextElement();
- if (! (value instanceof Integer))
- continue;
- tmpKey = (Integer) value;
- if (tmpKey.intValue() > key.intValue())
- key = tmpKey;
- }
- Object comp = labelTable.get(key);
- if (! (comp instanceof Component))
- return null;
- return (Component) comp;
- }
-
- /**
- * This method is used to paint the {@link JSlider}. It delegates all its
- * duties to the various paint methods like paintTicks(), paintTrack(),
- * paintThumb(), etc.
- *
- * @param g The {@link Graphics} object to paint with.
- * @param c The {@link JComponent} that is being painted.
- */
- public void paint(Graphics g, JComponent c)
- {
- // FIXME: Move this to propertyChangeEvent handler, when we get those.
- leftToRightCache = slider.getComponentOrientation() != ComponentOrientation.RIGHT_TO_LEFT;
- // FIXME: This next line is only here because the above line is here.
- calculateThumbLocation();
-
- if (slider.getPaintTrack())
- paintTrack(g);
- if (slider.getPaintTicks())
- paintTicks(g);
- if (slider.getPaintLabels())
- paintLabels(g);
-
- //FIXME: Paint focus.
- paintThumb(g);
- }
-
- /**
- * This method recalculates any rectangles that need to be recalculated
- * after the insets of the component have changed.
- */
- protected void recalculateIfInsetsChanged()
- {
- // Examining a test program shows that either Sun calls private
- // methods that we don't know about, or these don't do anything.
- calculateFocusRect();
-
- calculateContentRect();
- calculateThumbSize();
- calculateTrackBuffer();
- calculateTrackRect();
- calculateThumbLocation();
-
- calculateTickRect();
- calculateLabelRect();
- }
-
- /**
- * This method recalculates any rectangles that need to be recalculated
- * after the orientation of the slider changes.
- */
- protected void recalculateIfOrientationChanged()
- {
- // Examining a test program shows that either Sun calls private
- // methods that we don't know about, or these don't do anything.
- calculateThumbSize();
- calculateTrackBuffer();
- calculateTrackRect();
- calculateThumbLocation();
-
- calculateTickRect();
- calculateLabelRect();
- }
-
- /**
- * This method is called during a repaint if the slider has focus. It draws
- * an outline of the focusRect using the color returned by
- * getFocusColor().
- *
- * @param g The {@link Graphics} object to draw with.
- */
- public void paintFocus(Graphics g)
- {
- Color saved_color = g.getColor();
-
- g.setColor(getFocusColor());
-
- g.drawRect(focusRect.x, focusRect.y, focusRect.width, focusRect.height);
-
- g.setColor(saved_color);
- }
-
- /**
- * <p>
- * This method is called during a repaint if the track is to be drawn. It
- * draws a 3D rectangle to represent the track. The track is not the size
- * of the trackRect. The top and left edges of the track should be outlined
- * with the shadow color. The bottom and right edges should be outlined
- * with the highlight color.
- * </p>
- * <pre>
- * a---d
- * | |
- * | | a------------------------d
- * | | | |
- * | | b------------------------c
- * | |
- * | |
- * b---c
- * </pre>
- *
- * <p>
- * The b-a-d path needs to be drawn with the shadow color and the b-c-d path
- * needs to be drawn with the highlight color.
- * </p>
- *
- * @param g The {@link Graphics} object to draw with.
- */
- public void paintTrack(Graphics g)
- {
- Color saved_color = g.getColor();
- int width;
- int height;
-
- Point a = new Point(trackRect.x, trackRect.y);
- Point b = new Point(a);
- Point c = new Point(a);
- Point d = new Point(a);
-
- Polygon high;
- Polygon shadow;
-
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- width = trackRect.width;
- height = (thumbRect.height / 4 == 0) ? 1 : thumbRect.height / 4;
-
- a.translate(0, (trackRect.height / 2) - (height / 2));
- b.translate(0, (trackRect.height / 2) + (height / 2));
- c.translate(trackRect.width, (trackRect.height / 2) + (height / 2));
- d.translate(trackRect.width, (trackRect.height / 2) - (height / 2));
- }
- else
- {
- width = (thumbRect.width / 4 == 0) ? 1 : thumbRect.width / 4;
- height = trackRect.height;
-
- a.translate((trackRect.width / 2) - (width / 2), 0);
- b.translate((trackRect.width / 2) - (width / 2), trackRect.height);
- c.translate((trackRect.width / 2) + (width / 2), trackRect.height);
- d.translate((trackRect.width / 2) + (width / 2), 0);
- }
- high = new Polygon(new int[] { b.x, c.x, d.x },
- new int[] { b.y, c.y, d.y }, 3);
- shadow = new Polygon(new int[] { b.x, a.x, d.x },
- new int[] { b.y, a.y, d.y }, 3);
-
- g.setColor(getHighlightColor());
- g.drawPolygon(high);
- g.setColor(getShadowColor());
- g.drawPolygon(shadow);
-
- g.setColor(Color.GRAY);
- g.fillRect(a.x + 1, a.y + 1, width - 2, height - 2);
- g.setColor(saved_color);
- }
-
- /**
- * This method is called during a repaint if the ticks are to be drawn. This
- * method must still verify that the majorTickSpacing and minorTickSpacing
- * are greater than zero before drawing the ticks.
- *
- * @param g The {@link Graphics} object to draw with.
- */
- public void paintTicks(Graphics g)
- {
- int max = slider.getMaximum();
- int min = slider.getMinimum();
- int majorSpace = slider.getMajorTickSpacing();
- int minorSpace = slider.getMinorTickSpacing();
-
- if (majorSpace > 0)
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- double loc = tickRect.x;
- double increment = (max == min) ? 0
- : majorSpace * (double) tickRect.width / (max
- - min);
- if (drawInverted())
- {
- loc += tickRect.width;
- increment *= -1;
- }
- for (int i = min; i <= max; i += majorSpace)
- {
- paintMajorTickForHorizSlider(g, tickRect, (int) loc);
- loc += increment;
- }
- }
- else
- {
- double loc = tickRect.height + tickRect.y;
- double increment = (max == min) ? 0
- : -majorSpace * (double) tickRect.height / (max
- - min);
- if (drawInverted())
- {
- loc = tickRect.y;
- increment *= -1;
- }
- for (int i = min; i <= max; i += majorSpace)
- {
- paintMajorTickForVertSlider(g, tickRect, (int) loc);
- loc += increment;
- }
- }
- }
- if (minorSpace > 0)
- {
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- double loc = tickRect.x;
- double increment = (max == min) ? 0
- : minorSpace * (double) tickRect.width / (max
- - min);
- if (drawInverted())
- {
- loc += tickRect.width;
- increment *= -1;
- }
- for (int i = min; i <= max; i += minorSpace)
- {
- paintMinorTickForHorizSlider(g, tickRect, (int) loc);
- loc += increment;
- }
- }
- else
- {
- double loc = tickRect.height + tickRect.y;
- double increment = (max == min) ? 0
- : -minorSpace * (double) tickRect.height / (max
- - min);
- if (drawInverted())
- {
- loc = tickRect.y;
- increment *= -1;
- }
- for (int i = min; i <= max; i += minorSpace)
- {
- paintMinorTickForVertSlider(g, tickRect, (int) loc);
- loc += increment;
- }
- }
- }
- }
-
- /* Minor ticks start at 1/4 of the height (or width) of the tickRect and extend
- to 1/2 of the tickRect.
-
- Major ticks start at 1/4 of the height and extend to 3/4.
- */
-
- /**
- * This method paints a minor tick for a horizontal slider at the given x
- * value. x represents the x coordinate to paint at.
- *
- * @param g The {@link Graphics} object to draw with.
- * @param tickBounds The tickRect rectangle.
- * @param x The x coordinate to draw the tick at.
- */
- protected void paintMinorTickForHorizSlider(Graphics g,
- Rectangle tickBounds, int x)
- {
- int y = tickRect.y + tickRect.height / 4;
-
- g.drawLine(x, y, x, y + tickRect.height / 4);
- }
-
- /**
- * This method paints a major tick for a horizontal slider at the given x
- * value. x represents the x coordinate to paint at.
- *
- * @param g The {@link Graphics} object to draw with.
- * @param tickBounds The tickRect rectangle.
- * @param x The x coordinate to draw the tick at.
- */
- protected void paintMajorTickForHorizSlider(Graphics g,
- Rectangle tickBounds, int x)
- {
- int y = tickRect.y + tickRect.height / 4;
-
- g.drawLine(x, y, x, y + tickRect.height / 2);
- }
-
- /**
- * This method paints a minor tick for a vertical slider at the given y
- * value. y represents the y coordinate to paint at.
- *
- * @param g The {@link Graphics} object to draw with.
- * @param tickBounds The tickRect rectangle.
- * @param y The y coordinate to draw the tick at.
- */
- protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds,
- int y)
- {
- int x = tickRect.x + tickRect.width / 4;
-
- g.drawLine(x, y, x + tickRect.width / 4, y);
- }
-
- /**
- * This method paints a major tick for a vertical slider at the given y
- * value. y represents the y coordinate to paint at.
- *
- * @param g The {@link Graphics} object to draw with.
- * @param tickBounds The tickRect rectangle.
- * @param y The y coordinate to draw the tick at.
- */
- protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds,
- int y)
- {
- int x = tickRect.x + tickRect.width / 4;
-
- g.drawLine(x, y, x + tickRect.width / 2, y);
- }
-
- /**
- * This method paints all the labels from the slider's label table. This
- * method must make sure that the label table is not null before painting
- * the labels. Each entry in the label table is a (integer, component)
- * pair. Every label is painted at the value of the integer.
- *
- * @param g The {@link Graphics} object to draw with.
- */
- public void paintLabels(Graphics g)
- {
- if (slider.getLabelTable() != null)
- {
- Dictionary table = slider.getLabelTable();
- Integer tmpKey;
- Object key;
- Object element;
- Component label;
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- for (Enumeration list = table.keys(); list.hasMoreElements();)
- {
- key = list.nextElement();
- if (! (key instanceof Integer))
- continue;
- tmpKey = (Integer) key;
- element = table.get(tmpKey);
- // We won't paint them if they're not
- // JLabels so continue anyway
- if (! (element instanceof JLabel))
- continue;
- label = (Component) element;
- paintHorizontalLabel(g, tmpKey.intValue(), label);
- }
- }
- else
- {
- for (Enumeration list = table.keys(); list.hasMoreElements();)
- {
- key = list.nextElement();
- if (! (key instanceof Integer))
- continue;
- tmpKey = (Integer) key;
- element = table.get(tmpKey);
- // We won't paint them if they're not
- // JLabels so continue anyway
- if (! (element instanceof JLabel))
- continue;
- label = (Component) element;
- paintVerticalLabel(g, tmpKey.intValue(), label);
- }
- }
- }
- }
-
- /**
- * This method paints the label on the horizontal slider at the value
- * specified. The value is not a coordinate. It is a value within the range
- * of the slider. If the value is not within the range of the slider, this
- * method will do nothing. This method should not paint outside the
- * boundaries of the labelRect.
- *
- * @param g The {@link Graphics} object to draw with.
- * @param value The value to paint at.
- * @param label The label to paint.
- */
- protected void paintHorizontalLabel(Graphics g, int value, Component label)
- {
- // This relies on clipping working properly or we'll end up
- // painting all over the place. If our preferred size is ignored, then
- // the labels may not fit inside the slider's bounds. Rather than mucking
- // with font sizes and possible icon sizes, we'll set the bounds for
- // the label and let it get clipped.
-
- Dimension dim = label.getPreferredSize();
- int w = (int) dim.getWidth();
- int h = (int) dim.getHeight();
-
- int max = slider.getMaximum();
- int min = slider.getMinimum();
-
- if (value > max || value < min)
- return;
-
- // value
- // |
- // ------------
- // | |
- // | |
- // | |
- // The label must move w/2 to the right to fit directly under the value.
-
-
- int xpos = xPositionForValue(value) - w / 2;
- int ypos = labelRect.y;
-
- // We want to center the label around the xPositionForValue
- // So we use xpos - w / 2. However, if value is min and the label
- // is large, we run the risk of going out of bounds. So we bring it back
- // to 0 if it becomes negative.
- if (xpos < 0)
- xpos = 0;
-
- // If the label + starting x position is greater than
- // the x space in the label rectangle, we reset it to the largest
- // amount possible in the rectangle. This means ugliness.
- if (xpos + w > labelRect.x + labelRect.width)
- w = labelRect.x + labelRect.width - xpos;
-
- // If the label is too tall. We reset it to the height of the label
- // rectangle.
- if (h > labelRect.height)
- h = labelRect.height;
-
- label.setBounds(xpos, ypos, w, h);
- javax.swing.SwingUtilities.paintComponent(g, label, null, label.getBounds());
- }
-
- /**
- * This method paints the label on the vertical slider at the value
- * specified. The value is not a coordinate. It is a value within the range
- * of the slider. If the value is not within the range of the slider, this
- * method will do nothing. This method should not paint outside the
- * boundaries of the labelRect.
- *
- * @param g The {@link Graphics} object to draw with.
- * @param value The value to paint at.
- * @param label The label to paint.
- */
- protected void paintVerticalLabel(Graphics g, int value, Component label)
- {
- Dimension dim = label.getPreferredSize();
- int w = (int) dim.getWidth();
- int h = (int) dim.getHeight();
-
- int max = slider.getMaximum();
- int min = slider.getMinimum();
-
- if (value > max || value < min)
- return;
-
- int xpos = labelRect.x;
- int ypos = yPositionForValue(value) - h / 2;
-
- if (ypos < 0)
- ypos = 0;
-
- if (ypos + h > labelRect.y + labelRect.height)
- h = labelRect.y + labelRect.height - ypos;
-
- if (w > labelRect.width)
- w = labelRect.width;
-
- label.setBounds(xpos, ypos, w, h);
- javax.swing.SwingUtilities.paintComponent(g, label, null, label.getBounds());
- }
-
- /**
- * <p>
- * This method paints a thumb. There are two types of thumb:
- * </p>
- * <pre>
- * Vertical Horizontal
- * a---b a-----b
- * | | | \
- * e c | c
- * \ / | /
- * d e-----d
- * </pre>
- *
- * <p>
- * In the case of vertical thumbs, we highlight the path b-a-e-d and shadow
- * the path b-c-d. In the case of horizontal thumbs, we highlight the path
- * c-b-a-e and shadow the path c-d-e. In both cases we fill the path
- * a-b-c-d-e before shadows and highlights are drawn.
- * </p>
- *
- * @param g The graphics object to paint with
- */
- public void paintThumb(Graphics g)
- {
- Color saved_color = g.getColor();
-
- Polygon thumb = new Polygon();
-
- Point a = new Point(thumbRect.x, thumbRect.y);
- Point b = new Point(a);
- Point c = new Point(a);
- Point d = new Point(a);
- Point e = new Point(a);
-
- Polygon bright;
- Polygon dark;
- Polygon all;
-
- // This will be in X-dimension if the slider is inverted and y if it isn't.
- int turnPoint;
-
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- turnPoint = thumbRect.height * 3 / 4;
-
- b.translate(thumbRect.width, 0);
- c.translate(thumbRect.width, turnPoint);
- d.translate(thumbRect.width / 2, thumbRect.height);
- e.translate(0, turnPoint);
-
- bright = new Polygon(new int[] { b.x, a.x, e.x, d.x },
- new int[] { b.y, a.y, e.y, d.y }, 4);
-
- dark = new Polygon(new int[] { b.x, c.x, d.x },
- new int[] { b.y, c.y, d.y }, 3);
- all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 },
- new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5);
- }
- else
- {
- turnPoint = thumbRect.width * 3 / 4;
-
- b.translate(turnPoint, 0);
- c.translate(thumbRect.width, thumbRect.height / 2);
- d.translate(turnPoint, thumbRect.height);
- e.translate(0, thumbRect.height);
-
- bright = new Polygon(new int[] { c.x, b.x, a.x, e.x },
- new int[] { c.y, b.y, a.y, e.y }, 4);
-
- dark = new Polygon(new int[] { c.x, d.x, e.x + 1 },
- new int[] { c.y, d.y, e.y }, 3);
-
- all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 },
- new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5);
- }
-
- g.setColor(Color.WHITE);
- g.drawPolygon(bright);
-
- g.setColor(Color.BLACK);
- g.drawPolygon(dark);
-
- g.setColor(Color.GRAY);
- g.fillPolygon(all);
-
- g.setColor(saved_color);
- }
-
- /**
- * This method sets the position of the thumbRect.
- *
- * @param x The new x position.
- * @param y The new y position.
- */
- public void setThumbLocation(int x, int y)
- {
- thumbRect.x = x;
- thumbRect.y = y;
- }
-
- /**
- * This method is used to move the thumb one block in the direction
- * specified. If the slider snaps to ticks, this method is responsible for
- * snapping it to a tick after the thumb has been moved.
- *
- * @param direction The direction to move in.
- */
- public void scrollByBlock(int direction)
- {
- // The direction is -1 for backwards and 1 for forwards.
- int unit = direction * (slider.getMaximum() - slider.getMinimum()) / 10;
-
- int moveTo = slider.getValue() + unit;
-
- if (slider.getSnapToTicks())
- moveTo = findClosestTick(moveTo);
-
- slider.setValue(moveTo);
- }
-
- /**
- * This method is used to move the thumb one unit in the direction
- * specified. If the slider snaps to ticks, this method is responsible for
- * snapping it to a tick after the thumb has been moved.
- *
- * @param direction The direction to move in.
- */
- public void scrollByUnit(int direction)
- {
- // The direction is -1 for backwards and 1 for forwards.
- int moveTo = slider.getValue() + direction;
-
- if (slider.getSnapToTicks())
- moveTo = findClosestTick(moveTo);
-
- slider.setValue(moveTo);
- }
-
- /**
- * This method is called when there has been a click in the track and the
- * thumb needs to be scrolled on regular intervals. This method is only
- * responsible for starting the timer and not for stopping it.
- *
- * @param dir The direction to move in.
- */
- protected void scrollDueToClickInTrack(int dir)
- {
- scrollTimer.stop();
-
- scrollListener.setDirection(dir);
- scrollListener.setScrollByBlock(true);
-
- scrollTimer.start();
- }
-
- /**
- * This method returns the X coordinate for the value passed in.
- *
- * @param value The value to calculate an x coordinate for.
- *
- * @return The x coordinate for the value.
- */
- protected int xPositionForValue(int value)
- {
- int min = slider.getMinimum();
- int max = slider.getMaximum();
- int extent = slider.getExtent();
- int len = trackRect.width;
-
- int xPos = (max == min) ? 0 : (value - min) * len / (max - min);
-
- if (! drawInverted())
- xPos += trackRect.x;
- else
- {
- xPos = trackRect.width - xPos;
- xPos += trackRect.x;
- }
- return xPos;
- }
-
- /**
- * This method returns the y coordinate for the value passed in.
- *
- * @param value The value to calculate a y coordinate for.
- *
- * @return The y coordinate for the value.
- */
- protected int yPositionForValue(int value)
- {
- int min = slider.getMinimum();
- int max = slider.getMaximum();
- int extent = slider.getExtent();
- int len = trackRect.height;
-
- int yPos = (max == min) ? 0 : (value - min) * len / (max - min);
-
- if (! drawInverted())
- {
- yPos = trackRect.height - yPos;
- yPos += trackRect.y;
- }
- else
- yPos += trackRect.y;
- return yPos;
- }
-
- /**
- * This method returns the value in the slider's range given the y
- * coordinate. If the value is out of range, it will return the closest
- * legal value.
- *
- * @param yPos The y coordinate to calculate a value for.
- *
- * @return The value for the y coordinate.
- */
- public int valueForYPosition(int yPos)
- {
- int min = slider.getMinimum();
- int max = slider.getMaximum();
- int len = trackRect.height;
-
- int value;
-
- // If the length is 0, you shouldn't be able to even see where the slider is.
- // This really shouldn't ever happen, but just in case, we'll return the middle.
- if (len == 0)
- return ((max - min) / 2);
-
- if (! drawInverted())
- value = ((len - (yPos - trackRect.y)) * (max - min) / len + min);
- else
- value = ((yPos - trackRect.y) * (max - min) / len + min);
-
- // If this isn't a legal value, then we'll have to move to one now.
- if (value > max)
- value = max;
- else if (value < min)
- value = min;
- return value;
- }
-
- /**
- * This method returns the value in the slider's range given the x
- * coordinate. If the value is out of range, it will return the closest
- * legal value.
- *
- * @param xPos The x coordinate to calculate a value for.
- *
- * @return The value for the x coordinate.
- */
- public int valueForXPosition(int xPos)
- {
- int min = slider.getMinimum();
- int max = slider.getMaximum();
- int len = trackRect.width;
-
- int value;
-
- // If the length is 0, you shouldn't be able to even see where the slider is.
- // This really shouldn't ever happen, but just in case, we'll return the middle.
- if (len == 0)
- return ((max - min) / 2);
-
- if (! drawInverted())
- value = ((xPos - trackRect.x) * (max - min) / len + min);
- else
- value = ((len - (xPos - trackRect.x)) * (max - min) / len + min);
-
- // If this isn't a legal value, then we'll have to move to one now.
- if (value > max)
- value = max;
- else if (value < min)
- value = min;
- return value;
- }
-
- /**
- * This method finds the closest value that has a tick associated with it.
- *
- * @param value The value to search from.
- *
- * @return The closest value that has a tick associated with it.
- */
- private int findClosestTick(int value)
- {
- int min = slider.getMinimum();
- int max = slider.getMaximum();
- int majorSpace = slider.getMajorTickSpacing();
- int minorSpace = slider.getMinorTickSpacing();
-
- // The default value to return is value + minor or
- // value + major.
- // Initializing at min - value leaves us with a default
- // return value of min, which always has tick marks
- // (if ticks are painted).
- int minor = min - value;
- int major = min - value;
-
- // If there are no major tick marks or minor tick marks
- // e.g. snap is set to true but no ticks are set, then
- // we can just return the value.
- if (majorSpace <= 0 && minorSpace <= 0)
- return value;
-
- // First check the major ticks.
- if (majorSpace > 0)
- {
- int lowerBound = (value - min) / majorSpace;
- int majLower = majorSpace * lowerBound + min;
- int majHigher = majorSpace * (lowerBound + 1) + min;
-
- if (majHigher <= max && majHigher - value <= value - majLower)
- major = majHigher - value;
- else
- major = majLower - value;
- }
-
- if (minorSpace > 0)
- {
- int lowerBound = value / minorSpace;
- int minLower = minorSpace * lowerBound;
- int minHigher = minorSpace * (lowerBound + 1);
-
- if (minHigher <= max && minHigher - value <= value - minLower)
- minor = minHigher - value;
- else
- minor = minLower - value;
- }
-
- // Give preference to minor ticks
- if (Math.abs(minor) > Math.abs(major))
- return value + major;
- else
- return value + minor;
- }
-}
diff --git a/libstdc++-v3/config/allocator/bitmap_allocator_base.h b/libstdc++-v3/config/allocator/bitmap_allocator_base.h
deleted file mode 100644
index bf84ae06d7f..00000000000
--- a/libstdc++-v3/config/allocator/bitmap_allocator_base.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Base to std::allocator -*- C++ -*-
-
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _CXX_ALLOCATOR_H
-#define _CXX_ALLOCATOR_H 1
-
-// Define bitmap_allocator as the base class to std::allocator.
-#include <ext/bitmap_allocator.h>
-#define ___glibcxx_base_allocator __gnu_cxx::bitmap_allocator
-
-#endif
diff --git a/libstdc++-v3/config/allocator/malloc_allocator_base.h b/libstdc++-v3/config/allocator/malloc_allocator_base.h
deleted file mode 100644
index 4a82ec362c5..00000000000
--- a/libstdc++-v3/config/allocator/malloc_allocator_base.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Base to std::allocator -*- C++ -*-
-
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _CXX_ALLOCATOR_H
-#define _CXX_ALLOCATOR_H 1
-
-// Define new_allocator as the base class to std::allocator.
-#include <ext/malloc_allocator.h>
-#define ___glibcxx_base_allocator __gnu_cxx::malloc_allocator
-
-#endif
diff --git a/libstdc++-v3/config/allocator/mt_allocator_base.h b/libstdc++-v3/config/allocator/mt_allocator_base.h
deleted file mode 100644
index 52b4421a439..00000000000
--- a/libstdc++-v3/config/allocator/mt_allocator_base.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Base to std::allocator -*- C++ -*-
-
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _CXX_ALLOCATOR_H
-#define _CXX_ALLOCATOR_H 1
-
-// Define mt_allocator as the base class to std::allocator.
-#include <ext/mt_allocator.h>
-#define ___glibcxx_base_allocator __gnu_cxx::__mt_alloc
-
-#endif
diff --git a/libstdc++-v3/config/allocator/new_allocator_base.h b/libstdc++-v3/config/allocator/new_allocator_base.h
deleted file mode 100644
index 442f89cc535..00000000000
--- a/libstdc++-v3/config/allocator/new_allocator_base.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Base to std::allocator -*- C++ -*-
-
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _CXX_ALLOCATOR_H
-#define _CXX_ALLOCATOR_H 1
-
-// Define new_allocator as the base class to std::allocator.
-#include <ext/new_allocator.h>
-#define ___glibcxx_base_allocator __gnu_cxx::new_allocator
-
-#endif
diff --git a/libstdc++-v3/config/os/bsd/darwin/ctype_base.h b/libstdc++-v3/config/os/bsd/darwin/ctype_base.h
new file mode 100644
index 00000000000..66f59010649
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/darwin/ctype_base.h
@@ -0,0 +1,77 @@
+// APPLE LOCAL file darwin-specific headers
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h on FreeBSD 3.4,
+// 4.0 and all versions of the CVS managed file at:
+// :pserver:anoncvs@anoncvs.freebsd.org:/home/ncvs/src/include/ctype.h
+
+ struct ctype_base
+ {
+ // Non-standard typedefs.
+ typedef const int* __to_type;
+
+ // NB: Offsets into ctype<char>::_M_table force a particular size
+ // on the mask type. Because of this, we don't use an enum.
+ typedef unsigned long mask;
+#ifdef _CTYPE_S
+ // FreeBSD 4.0 uses this style of define.
+ static const mask upper = _CTYPE_U;
+ static const mask lower = _CTYPE_L;
+ static const mask alpha = _CTYPE_A;
+ static const mask digit = _CTYPE_D;
+ static const mask xdigit = _CTYPE_X;
+ static const mask space = _CTYPE_S;
+ static const mask print = _CTYPE_R;
+ static const mask graph = _CTYPE_G;
+ static const mask cntrl = _CTYPE_C;
+ static const mask punct = _CTYPE_P;
+ static const mask alnum = _CTYPE_A | _CTYPE_D;
+#else
+ // Older versions, including Free BSD 3.4, use this style of define.
+ static const mask upper = _U;
+ static const mask lower = _L;
+ static const mask alpha = _A;
+ static const mask digit = _D;
+ static const mask xdigit = _X;
+ static const mask space = _S;
+ static const mask print = _R;
+ static const mask graph = _G;
+ static const mask cntrl = _C;
+ static const mask punct = _P;
+ static const mask alnum = _A | _D;
+#endif
+ };
+
+
+
diff --git a/libstdc++-v3/config/os/bsd/darwin/ctype_inline.h b/libstdc++-v3/config/os/bsd/darwin/ctype_inline.h
new file mode 100644
index 00000000000..ea8e93539f3
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/darwin/ctype_inline.h
@@ -0,0 +1,95 @@
+// APPLE LOCAL file darwin-specific headers
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const
+ {
+ return __istype(__c, __m);
+ }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const
+ {
+ for (;__low < __high; ++__vec, ++__low)
+ {
+#if defined (_CTYPE_S) || defined (__istype)
+ *__vec = __maskrune (*__low, upper | lower | alpha | digit | xdigit
+ | space | print | graph | cntrl | punct | alnum);
+#else
+ mask __m = 0;
+ if (this->is(upper, *__low)) __m |= upper;
+ if (this->is(lower, *__low)) __m |= lower;
+ if (this->is(alpha, *__low)) __m |= alpha;
+ if (this->is(digit, *__low)) __m |= digit;
+ if (this->is(xdigit, *__low)) __m |= xdigit;
+ if (this->is(space, *__low)) __m |= space;
+ if (this->is(print, *__low)) __m |= print;
+ if (this->is(graph, *__low)) __m |= graph;
+ if (this->is(cntrl, *__low)) __m |= cntrl;
+ if (this->is(punct, *__low)) __m |= punct;
+ // Do not include explicit line for alnum mask since it is a
+ // pure composite of masks on FreeBSD.
+ *__vec = __m;
+#endif
+ }
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const
+ {
+ while (__low < __high && !this->is(__m, *__low))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const
+ {
+ while (__low < __high && this->is(__m, *__low) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/os/bsd/darwin/ctype_noninline.h b/libstdc++-v3/config/os/bsd/darwin/ctype_noninline.h
new file mode 100644
index 00000000000..34bbe5cb2c7
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/darwin/ctype_noninline.h
@@ -0,0 +1,82 @@
+// APPLE LOCAL file darwin-specific headers
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ const ctype_base::mask*
+ ctype<char>::classic_table() throw()
+ { return 0; }
+
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(NULL), _M_tolower(NULL),
+ _M_table(__table ? __table : classic_table())
+ { }
+
+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(NULL), _M_tolower(NULL),
+ _M_table(__table ? __table : classic_table())
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ { return ::toupper((int) __c); }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = ::toupper((int) *__low);
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ { return ::tolower((int) __c); }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = ::tolower((int) *__low);
+ ++__low;
+ }
+ return __high;
+ }
diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
new file mode 100644
index 00000000000..6a006e30217
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
@@ -0,0 +1,161 @@
+// APPLE LOCAL file darwin-specific headers
+// Specific definitions for BSD -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _GLIBCPP_OS_DEFINES
+#define _GLIBCPP_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here. This
+// file will come before all others.
+
+#define __glibcpp_long_double_bits __glibcpp_double_bits
+
+#define _GLIBCPP_AVOID_FSEEK 1
+
+/* APPLE LOCAL begin keymgr */
+/* Copyright (C) 1989, 92-97, 1998, Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+
+/*
+ * This file added by Apple Computer Inc. for its OS X
+ * environment.
+ */
+
+#ifndef __KEYMGR_H
+#define __KEYMGR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+/*
+ * keymgr - Create and maintain process-wide global data known to
+ * all threads across all dynamic libraries.
+ *
+ */
+
+typedef enum node_kinds {
+ NODE_THREAD_SPECIFIC_DATA=1,
+ NODE_PROCESSWIDE_PTR=2,
+ NODE_LAST_KIND
+ } TnodeKind ;
+
+/*
+ * These enum members are bits or combination of bits.
+ */
+
+typedef enum node_mode {
+ NM_ALLOW_RECURSION=1,
+ NM_RECURSION_ILLEGAL=2,
+ NM_ENHANCED_LOCKING=3,
+ NM_LOCKED=4
+ } TnodeMode ;
+
+
+
+extern void * _keymgr_get_per_thread_data(unsigned int key) ;
+extern void _keymgr_set_per_thread_data(unsigned int key, void *keydata) ;
+extern void *_keymgr_get_and_lock_processwide_ptr(unsigned int key) ;
+extern void _keymgr_set_and_unlock_processwide_ptr(unsigned int key, void *ptr) ;
+extern void _keymgr_unlock_processwide_ptr(unsigned int key) ;
+extern void _keymgr_set_lockmode_processwide_ptr(unsigned int key, unsigned int mode) ;
+extern unsigned int _keymgr_get_lockmode_processwide_ptr(unsigned int key) ;
+extern int _keymgr_get_lock_count_processwide_ptr(unsigned int key) ;
+
+#ifndef NULL
+#define NULL (0)
+#endif
+
+/*
+ * Keys currently in use:
+ */
+
+#define KEYMGR_EH_CONTEXT_KEY 1 /*stores handle for root pointer of exception context node.*/
+
+#define KEYMGR_NEW_HANLDER_KEY 2 /*store handle for new handler pointer.*/
+
+#define KEYMGR_UNEXPECTED_HANDLER_KEY 3 /*store handle for unexpected exception pointer.*/
+
+#define KEYMGR_TERMINATE_HANDLER_KEY 4 /*store handle for terminate handler pointer. */
+
+#define KEYMGR_MODE_BITS 5 /*stores handle for runtime mode bits.*/
+
+#define KEYMGR_IO_LIST 6 /*Root pointer to the list of open streams.*/
+
+#define KEYMGR_IO_STDIN 7 /*GNU stdin.*/
+
+#define KEYMGR_IO_STDOUT 8 /*GNU stdout.*/
+
+#define KEYMGR_IO_STDERR 9 /*GNU stderr.*/
+
+#define KEYMGR_IO_REFCNT 10 /*How many plugins/main program currently using streams.*/
+
+#define KEYMGR_IO_MODE_BITS 11 /*Flags controlling the behavior of C++ I/O.*/
+
+#define KEYMGR_ZOE_IMAGE_LIST 12 /*Head pointer for list of per image dwarf2 unwind sections.*/
+
+
+
+/*
+ * Other important data.
+ */
+
+#define KEYMGR_API_REV_MAJOR 2 /*Major revision number of the keymgr API.*/
+#define KEYMGR_API_REV_MINOR 1 /*Minor revision number of the keymgr API.*/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __KEYMGR_H */
+/* APPLE LOCAL end keymgr */
+
+#endif /* _GLIBCPP_OS_DEFINES */
diff --git a/libstdc++-v3/docs/html/ext/ballocator_doc.txt b/libstdc++-v3/docs/html/ext/ballocator_doc.txt
deleted file mode 100644
index 2173b618f4f..00000000000
--- a/libstdc++-v3/docs/html/ext/ballocator_doc.txt
+++ /dev/null
@@ -1,374 +0,0 @@
- BITMAPPED ALLOCATOR
- ===================
-
-2004-03-11 Dhruv Matani <dhruvbird@HotPOP.com>
-
----------------------------------------------------------------------
-
-As this name suggests, this allocator uses a bit-map to keep track of
-the used and unused memory locations for it's book-keeping purposes.
-
-This allocator will make use of 1 single bit to keep track of whether
-it has been allocated or not. A bit 1 indicates free, while 0
-indicates allocated. This has been done so that you can easily check a
-collection of bits for a free block. This kind of Bitmapped strategy
-works best for single object allocations, and with the STL type
-parameterized allocators, we do not need to choose any size for the
-block which will be represented by a single bit. This will be the size
-of the parameter around which the allocator has been
-parameterized. Thus, close to optimal performance will result. Hence,
-this should be used for node based containers which call the allocate
-function with an argument of 1.
-
-The bitmapped allocator's internal pool is exponentially
-growing. Meaning that internally, the blocks acquired from the Free
-List Store will double every time the bitmapped allocator runs out of
-memory.
-
---------------------------------------------------------------------
-
-The macro __GTHREADS decides whether to use Mutex Protection around
-every allocation/deallocation. The state of the macro is picked up
-automatically from the gthr abstration layer.
-
-----------------------------------------------------------------------
-
-What is the Free List Store?
-----------------------------
-
-The Free List Store (referred to as FLS for the remaining part of this
-document) is the Global memory pool that is shared by all instances of
-the bitmapped allocator instantiated for any type. This maintains a
-sorted order of all free memory blocks given back to it by the
-bitmapped allocator, and is also responsible for giving memory to the
-bitmapped allocator when it asks for more.
-
-Internally, there is a Free List threshold which indicates the Maximum
-number of free lists that the FLS can hold internally
-(cache). Currently, this value is set at 64. So, if there are more
-than 64 free lists coming in, then some of them will be given back to
-the OS using operator delete so that at any given time the Free List's
-size does not exceed 64 entries. This is done because a Binary Search
-is used to locate an entry in a free list when a request for memory
-comes along. Thus, the run-time complexity of the search would go up
-given an increasing size, for 64 entries however, lg(64) == 6
-comparisons are enough to locate the correct free list if it exists.
-
-Suppose the free list size has reached it's threshold, then the
-largest block from among those in the list and the new block will be
-selected and given back to the OS. This is done because it reduces
-external fragmentation, and allows the OS to use the larger blocks
-later in an orderly fashion, possibly merging them later. Also, on
-some systems, large blocks are obtained via calls to mmap, so giving
-them back to free system resources becomes most important.
-
-The function _S_should_i_give decides the policy that determines
-whether the current block of memory should be given to the allocator
-for the request that it has made. That's because we may not always
-have exact fits for the memory size that the allocator requests. We do
-this mainly to prevent external fragmentation at the cost of a little
-internal fragmentation. Now, the value of this internal fragmentation
-has to be decided by this function. I can see 3 possibilities right
-now. Please add more as and when you find better strategies.
-
-1. Equal size check. Return true only when the 2 blocks are of equal
- size.
-
-2. Difference Threshold: Return true only when the _block_size is
- greater than or equal to the _required_size, and if the _BS is >
- _RS by a difference of less than some THRESHOLD value, then return
- true, else return false.
-
-3. Percentage Threshold. Return true only when the _block_size is
- greater than or equal to the _required_size, and if the _BS is >
- _RS by a percentage of less than some THRESHOLD value, then return
- true, else return false.
-
-Currently, (3) is being used with a value of 36% Maximum wastage per
-Super Block.
-
---------------------------------------------------------------------
-
-1) What is a super block? Why is it needed?
-
- A super block is the block of memory acquired from the FLS from
- which the bitmap allocator carves out memory for single objects and
- satisfies the user's requests. These super blocks come in sizes that
- are powers of 2 and multiples of 32 (_Bits_Per_Block). Yes both at
- the same time! That's because the next super block acquired will be
- 2 times the previous one, and also all super blocks have to be
- multiples of the _Bits_Per_Block value.
-
-2) How does it interact with the free list store?
-
- The super block is contained in the FLS, and the FLS is responsible
- for getting / returning Super Bocks to and from the OS using
- operator new as defined by the C++ standard.
-
----------------------------------------------------------------------
-
-How does the allocate function Work?
-------------------------------------
-
-The allocate function is specialized for single object allocation
-ONLY. Thus, ONLY if n == 1, will the bitmap_allocator's specialized
-algorithm be used. Otherwise, the request is satisfied directly by
-calling operator new.
-
-Suppose n == 1, then the allocator does the following:
-
-1. Checks to see whether the a free block exists somewhere in a region
- of memory close to the last satisfied request. If so, then that
- block is marked as allocated in the bit map and given to the
- user. If not, then (2) is executed.
-
-2. Is there a free block anywhere after the current block right upto
- the end of the memory that we have? If so, that block is found, and
- the same procedure is applied as above, and returned to the
- user. If not, then (3) is executed.
-
-3. Is there any block in whatever region of memory that we own free?
- This is done by checking (a) The use count for each super block,
- and if that fails then (b) The individual bit-maps for each super
- block. Note: Here we are never touching any of the memory that the
- user will be given, and we are confining all memory accesses to a
- small region of memory! This helps reduce cache misses. If this
- succeeds then we apply the same procedure on that bit-map as (1),
- and return that block of memory to the user. However, if this
- process fails, then we resort to (4).
-
-4. This process involves Refilling the internal exponentially growing
- memory pool. The said effect is achieved by calling _S_refill_pool
- which does the following:
- (a). Gets more memory from the Global Free List of the
- Required size.
- (b). Adjusts the size for the next call to itself.
- (c). Writes the appropriate headers in the bit-maps.
- (d). Sets the use count for that super-block just allocated
- to 0 (zero).
- (e). All of the above accounts to maintaining the basic
- invariant for the allocator. If the invariant is
- maintained, we are sure that all is well.
- Now, the same process is applied on the newly acquired free blocks,
- which are dispatched accordingly.
-
-Thus, you can clearly see that the allocate function is nothing but a
-combination of the next-fit and first-fit algorithm optimized ONLY for
-single object allocations.
-
-
--------------------------------------------------------------------------
-
-How does the deallocate function work?
---------------------------------------
-
-The deallocate function again is specialized for single objects ONLY.
-For all n belonging to > 1, the operator delete is called without
-further ado, and the deallocate function returns.
-
-However for n == 1, a series of steps are performed:
-
-1. We first need to locate that super-block which holds the memory
- location given to us by the user. For that purpose, we maintain a
- static variable _S_last_dealloc_index, which holds the index into
- the vector of block pairs which indicates the index of the last
- super-block from which memory was freed. We use this strategy in
- the hope that the user will deallocate memory in a region close to
- what he/she deallocated the last time around. If the check for
- belongs_to succeeds, then we determine the bit-map for the given
- pointer, and locate the index into that bit-map, and mark that bit
- as free by setting it.
-
-2. If the _S_last_dealloc_index does not point to the memory block
- that we're looking for, then we do a linear search on the block
- stored in the vector of Block Pairs. This vector in code is called
- _S_mem_blocks. When the corresponding super-block is found, we
- apply the same procedure as we did for (1) to mark the block as
- free in the bit-map.
-
-Now, whenever a block is freed, the use count of that particular super
-block goes down by 1. When this use count hits 0, we remove that super
-block from the list of all valid super blocks stored in the
-vector. While doing this, we also make sure that the basic invariant
-is maintained by making sure that _S_last_request and
-_S_last_dealloc_index point to valid locations within the vector.
-
---------------------------------------------------------------------
-
-
-Data Layout for a Super Block:
-==============================
-
-Each Super Block will be of some size that is a multiple of the number
-of Bits Per Block. Typically, this value is chosen as Bits_Per_Byte X
-sizeof(unsigned int). On an X86 system, this gives the figure
-8 X 4 = 32. Thus, each Super Block will be of size 32 X Some_Value.
-This Some_Value is sizeof(value_type). For now, let it be called 'K'.
-Thus, finally, Super Block size is 32 X K bytes.
-
-This value of 32 has been chosen because each unsigned int has 32-bits
-and Maximum use of these can be made with such a figure.
-
-Consider a block of size 32 ints.
-In memory, it would look like this:
-
----------------------------------------------------------------------
-| 136 | 0 | 4294967295 | Data-> Space for 32-ints |
----------------------------------------------------------------------
-
-The first Columns represents the size of the Block in bytes as seen by
-the Bitmap Allocator. Internally, a global free list is used to keep
-track of the free blocks used and given back by the bitmap
-allocator. It is this Free List Store that is responsible for writing
-and managing this information. Actually the number of bytes allocated
-in this case would be: 4 + 4 + 4 + 32*4 = 140 bytes, but the first 4
-bytes are an addition by the Free List Store, so the Bitmap Allocator
-sees only 136 bytes. These first 4 bytes about which the bitmapped
-allocator is not aware hold the value 136.
-
-What do the remaining values represent?
----------------------------------------
-
-The 2nd 4 in the expression is the sizeof(unsigned int) because the
-Bitmapped Allocator maintains a used count for each Super Block, which
-is initially set to 0 (as indicated in the diagram). This is
-incremented every time a block is removed from this super block
-(allocated), and decremented whenever it is given back. So, when the
-used count falls to 0, the whole super block will be given back to the
-Free List Store.
-
-The value 4294967295 represents the integer corresponding to the
-bit representation of all bits set: 11111111111111111111111111111111.
-
-The 3rd 4 is size of the bitmap itself, which is the size of 32-bits,
-which is 4-bytes, or 1 X sizeof(unsigned int).
-
-
---------------------------------------------------------------------
-
-Another issue would be whether to keep the all bitmaps in a separate
-area in memory, or to keep them near the actual blocks that will be
-given out or allocated for the client. After some testing, I've
-decided to keep these bitmaps close to the actual blocks. this will
-help in 2 ways.
-
-1. Constant time access for the bitmap themselves, since no kind of
- look up will be needed to find the correct bitmap list or it's
- equivalent.
-
-2. And also this would preserve the cache as far as possible.
-
-So in effect, this kind of an allocator might prove beneficial from a
-purely cache point of view. But this allocator has been made to try
-and roll out the defects of the node_allocator, wherein the nodes get
-skewed about in memory, if they are not returned in the exact reverse
-order or in the same order in which they were allocated. Also, the
-new_allocator's book keeping overhead is too much for small objects
-and single object allocations, though it preserves the locality of
-blocks very well when they are returned back to the allocator.
-
--------------------------------------------------------------------
-
-Expected overhead per block would be 1 bit in memory. Also, once
-the address of the free list has been found, the cost for
-allocation/deallocation would be negligible, and is supposed to be
-constant time. For these very reasons, it is very important to
-minimize the linear time costs, which include finding a free list
-with a free block while allocating, and finding the corresponding
-free list for a block while deallocating. Therefore, I have decided
-that the growth of the internal pool for this allocator will be
-exponential as compared to linear for node_allocator. There, linear
-time works well, because we are mainly concerned with speed of
-allocation/deallocation and memory consumption, whereas here, the
-allocation/deallocation part does have some linear/logarithmic
-complexity components in it. Thus, to try and minimize them would
-be a good thing to do at the cost of a little bit of memory.
-
-Another thing to be noted is the the pool size will double every time
-the internal pool gets exhausted, and all the free blocks have been
-given away. The initial size of the pool would be sizeof(unsigned
-int)*8 which is the number of bits in an integer, which can fit
-exactly in a CPU register. Hence, the term given is exponential growth
-of the internal pool.
-
----------------------------------------------------------------------
-
-After reading all this, you may still have a few questions about the
-internal working of this allocator, like my friend had!
-
-Well here are the exact questions that he posed:
-
-1) The "Data Layout" section is cryptic. I have no idea of what you
- are trying to say. Layout of what? The free-list? Each bitmap? The
- Super Block?
-
- The layout of a Super Block of a given size. In the example, a super
- block of size 32 X 1 is taken. The general formula for calculating
- the size of a super block is 32*sizeof(value_type)*2^n, where n
- ranges from 0 to 32 for 32-bit systems.
-
-2) And since I just mentioned the term `each bitmap', what in the
- world is meant by it? What does each bitmap manage? How does it
- relate to the super block? Is the Super Block a bitmap as well?
-
- Good question! Each bitmap is part of a Super Block which is made up
- of 3 parts as I have mentioned earlier. Re-iterating, 1. The use
- count, 2. The bit-map for that Super Block. 3. The actual memory
- that will be eventually given to the user. Each bitmap is a multiple
- of 32 in size. If there are 32*(2^3) blocks of single objects to be
- given, there will be '32*(2^3)' bits present. Each 32 bits managing
- the allocated / free status for 32 blocks. Since each unsigned int
- contains 32-bits, one unsigned int can manage upto 32 blocks'
- status. Each bit-map is made up of a number of unsigned ints, whose
- exact number for a super-block of a given size I have just
- mentioned.
-
-3) How do the allocate and deallocate functions work in regard to
- bitmaps?
-
- The allocate and deallocate functions manipulate the bitmaps and have
- nothing to do with the memory that is given to the user. As I have
- earlier mentioned, a 1 in the bitmap's bit field indicates free,
- while a 0 indicates allocated. This lets us check 32 bits at a time
- to check whether there is at lease one free block in those 32 blocks
- by testing for equality with (0). Now, the allocate function will
- given a memory block find the corresponding bit in the bitmap, and
- will reset it (ie. make it re-set (0)). And when the deallocate
- function is called, it will again set that bit after locating it to
- indicate that that particular block corresponding to this bit in the
- bit-map is not being used by anyone, and may be used to satisfy
- future requests.
-
-----------------------------------------------------------------------
-
-(Tech-Stuff, Please stay out if you are not interested in the
-selection of certain constants. This has nothing to do with the
-algorithm per-se, only with some vales that must be chosen correctly
-to ensure that the allocator performs well in a real word scenario,
-and maintains a good balance between the memory consumption and the
-allocation/deallocation speed).
-
-The formula for calculating the maximum wastage as a percentage:
-
-(32 X k + 1) / (2 X (32 X k + 1 + 32 X c)) X 100.
-
-Where,
- k => The constant overhead per node. eg. for list, it is 8
- bytes, and for map it is 12 bytes.
- c => The size of the base type on which the map/list is
- instantiated. Thus, suppose the the type1 is int and type2 is
- double, they are related by the relation sizeof(double) ==
- 2*sizeof(int). Thus, all types must have this double size
- relation for this formula to work properly.
-
-Plugging-in: For List: k = 8 and c = 4 (int and double), we get:
-33.376%
-
-For map/multimap: k = 12, and c = 4 (int and double), we get:
-37.524%
-
-Thus, knowing these values, and based on the sizeof(value_type), we
-may create a function that returns the Max_Wastage_Percentage for us
-to use.
-
-
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index aefeda4ffb4..c1506b20c0f 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -35,7 +35,7 @@
#include <bits/os_defines.h>
// The current version of the C++ library in compressed ISO date format.
-#define __GLIBCXX__ 20040320
+#define __GLIBCXX__ 20040417
// Allow use of "export template." This is currently not a feature
// that g++ supports.
diff --git a/libstdc++-v3/include/c_std/std_cctype.h b/libstdc++-v3/include/c_std/std_cctype.h
index 65a4214657c..b6151c308f4 100644
--- a/libstdc++-v3/include/c_std/std_cctype.h
+++ b/libstdc++-v3/include/c_std/std_cctype.h
@@ -63,6 +63,27 @@
#undef tolower
#undef toupper
+/* APPLE LOCAL begin supply missing ctype.h decls 2001-07-11 sts */
+/* These are supposed be in ctype.h like the standard says! We need
+ this until Darwin ctype.h gets fixed and/or GCC has a fixincludes
+ to supply these if they're missing. */
+#if defined(__APPLE__) && defined(__MACH__)
+extern "C" {
+extern int isalnum(int c);
+extern int isalpha(int c);
+extern int iscntrl(int c);
+extern int isdigit(int c);
+extern int isgraph(int c);
+extern int islower(int c);
+extern int isprint(int c);
+extern int ispunct(int c);
+extern int isspace(int c);
+extern int isupper(int c);
+extern int isxdigit(int c);
+}
+#endif
+/* APPLE LOCAL end supply missing ctype.h decls 2001-07-11 sts */
+
namespace std
{
using ::isalnum;
diff --git a/libstdc++-v3/include/std/std_fstream.h b/libstdc++-v3/include/std/std_fstream.h
index 040f5798b11..96231e28fcc 100644
--- a/libstdc++-v3/include/std/std_fstream.h
+++ b/libstdc++-v3/include/std/std_fstream.h
@@ -512,7 +512,8 @@ namespace std
* @doctodo
* @endif
*/
- __filebuf_type _M_filebuf;
+ /* APPLE LOCAL work with -malign-natural. */
+ __filebuf_type _M_filebuf __attribute((aligned(8)));
public:
// Constructors/Destructors:
@@ -634,7 +635,8 @@ namespace std
* @doctodo
* @endif
*/
- __filebuf_type _M_filebuf;
+ /* APPLE LOCAL work with -malign-natural. */
+ __filebuf_type _M_filebuf __attribute__((aligned(8)));
public:
// Constructors:
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc
index f4ba9701d2c..ba6719aac33 100644
--- a/libstdc++-v3/libsupc++/eh_alloc.cc
+++ b/libstdc++-v3/libsupc++/eh_alloc.cc
@@ -64,6 +64,14 @@ using namespace __cxxabiv1;
# define EMERGENCY_OBJ_COUNT 4
#endif
+/* APPLE LOCAL begin reduce emergency buffer size */
+/* 256 bytes is more than large enough for an std::bad_alloc object */
+#undef EMERGENCY_OBJ_SIZE
+#undef EMERGENCY_OBJ_COUNT
+#define EMERGENCY_OBJ_SIZE 256
+#define EMERGENCY_OBJ_COUNT 2
+/* APPLE LOCAL end reduce emergency buffer size */
+
#if INT_MAX == 32767 || EMERGENCY_OBJ_COUNT <= 32
typedef unsigned int bitmask_type;
#else
diff --git a/libstdc++-v3/libsupc++/eh_terminate.cc b/libstdc++-v3/libsupc++/eh_terminate.cc
index bf9d74db116..e8c30c470e4 100644
--- a/libstdc++-v3/libsupc++/eh_terminate.cc
+++ b/libstdc++-v3/libsupc++/eh_terminate.cc
@@ -34,6 +34,12 @@
#include "unwind-cxx.h"
#include "exception_defines.h"
+/* APPLE LOCAL begin keymgr */
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+#include "bits/os_defines.h"
+#endif
+/* APPLE LOCAL end keymgr */
+
using namespace __cxxabiv1;
void
@@ -50,7 +56,19 @@ __cxxabiv1::__terminate (std::terminate_handler handler)
void
std::terminate ()
{
+ /* APPLE LOCAL begin keymgr */
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+ /*
+ * If the Key Manager has a terminate function assigned to this thread, invoke that fn.
+ * If not (KeyMgr has 0), use whatever is initialized into my local static pointer (above).
+ */
+ std::terminate_handler __keymgr_terminate_func = (std::terminate_handler)
+ _keymgr_get_per_thread_data (KEYMGR_TERMINATE_HANDLER_KEY);
+ if (__keymgr_terminate_func)
+ __terminate_handler = __keymgr_terminate_func;
+#endif /* APPLE_KEYMGR */
__terminate (__terminate_handler);
+ /* APPLE LOCAL end keymgr */
}
void
@@ -63,13 +81,32 @@ __cxxabiv1::__unexpected (std::unexpected_handler handler)
void
std::unexpected ()
{
+ /* APPLE LOCAL begin keymgr */
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+ /* Similar to terminate case above. */
+ std::unexpected_handler __keymgr_unexpected_func = (std::unexpected_handler)
+ _keymgr_get_per_thread_data (KEYMGR_UNEXPECTED_HANDLER_KEY);
+ if (__keymgr_unexpected_func)
+ __unexpected_handler = __keymgr_unexpected_func;
+#endif /* APPLE_KEYMGR */
+ /* APPLE LOCAL end keymgr */
__unexpected (__unexpected_handler);
}
std::terminate_handler
std::set_terminate (std::terminate_handler func) throw()
{
+ /* APPLE LOCAL begin keymgr */
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+ std::terminate_handler old =
+ (std::terminate_handler) _keymgr_get_per_thread_data (KEYMGR_TERMINATE_HANDLER_KEY);
+ _keymgr_set_per_thread_data (KEYMGR_TERMINATE_HANDLER_KEY, (void *) func) ;
+ if ( ! old)
+ old = __terminate_handler;
+#else
std::terminate_handler old = __terminate_handler;
+#endif /* APPLE_KEYMGR */
+ /* APPLE LOCAL end keymgr */
__terminate_handler = func;
return old;
}
@@ -77,7 +114,17 @@ std::set_terminate (std::terminate_handler func) throw()
std::unexpected_handler
std::set_unexpected (std::unexpected_handler func) throw()
{
+ /* APPLE LOCAL begin keymgr */
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+ std::unexpected_handler old =
+ (std::unexpected_handler) _keymgr_get_per_thread_data (KEYMGR_UNEXPECTED_HANDLER_KEY);
+ _keymgr_set_per_thread_data (KEYMGR_UNEXPECTED_HANDLER_KEY, (void *) func);
+ if ( ! old)
+ old = __unexpected_handler;
+#else
std::unexpected_handler old = __unexpected_handler;
+#endif /* APPLE_KEYMGR */
+ /* APPLE LOCAL end keymgr */
__unexpected_handler = func;
return old;
}
diff --git a/libstdc++-v3/libsupc++/new_handler.cc b/libstdc++-v3/libsupc++/new_handler.cc
index 2f9f6bd3579..bffb3d80a63 100644
--- a/libstdc++-v3/libsupc++/new_handler.cc
+++ b/libstdc++-v3/libsupc++/new_handler.cc
@@ -31,6 +31,12 @@
#include "new"
+/* APPLE LOCAL begin keymgr */
+#if defined APPLE_KEYMGR && ! defined(LIBCC_KEXT) && ! defined(APPLE_KERNEL_EXTENSION)
+#include "bits/os_defines.h"
+#endif
+/* APPLE LOCAL end keymgr */
+
const std::nothrow_t std::nothrow = { };
using std::new_handler;
@@ -39,9 +45,19 @@ new_handler __new_handler;
new_handler
std::set_new_handler (new_handler handler) throw()
{
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+ new_handler prev_handler =
+ (new_handler) _keymgr_get_per_thread_data (KEYMGR_NEW_HANLDER_KEY);
+ if ( ! prev_handler)
+ prev_handler = __new_handler;
+ _keymgr_set_per_thread_data (KEYMGR_NEW_HANLDER_KEY, (void *) handler);
+#else /* ! APPLE_KEYMGR */
new_handler prev_handler = __new_handler;
+#endif /* APPLE_KEYMGR */
__new_handler = handler;
return prev_handler;
}
+#if !defined(LIBCC_KEXT)
std::bad_alloc::~bad_alloc() throw() { }
+#endif
diff --git a/libstdc++-v3/libsupc++/new_op.cc b/libstdc++-v3/libsupc++/new_op.cc
index 29eac93ecf0..10f65c10adc 100644
--- a/libstdc++-v3/libsupc++/new_op.cc
+++ b/libstdc++-v3/libsupc++/new_op.cc
@@ -28,12 +28,27 @@
// the GNU General Public License.
#include "new"
+/* APPLE LOCAL begin libcc_kext */
+#ifdef LIBCC_KEXT
+extern "C" {
+extern void *malloc (size_t);
+extern int panic ();
+}
+#define ABORT() panic ()
+#else
#include <cstdlib>
+#define ABORT() std::abort ()
+#endif
+/* APPLE LOCAL end libcc_kext */
#include <exception_defines.h>
using std::new_handler;
using std::bad_alloc;
+/* APPLE LOCAL libcc_kext */
+#ifndef LIBCC_KEXT
using std::malloc;
+/* APPLE LOCAL libcc_kext */
+#endif
extern new_handler __new_handler;
@@ -48,12 +63,21 @@ operator new (std::size_t sz) throw (std::bad_alloc)
p = (void *) malloc (sz);
while (p == 0)
{
+ /* APPLE LOCAL begin keymgr */
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+ /* Ask Key Manager for new_handler; if provided (!=0), use it, else use local version. */
+ new_handler handler =
+ (new_handler) _keymgr_get_per_thread_data (KEYMGR_NEW_HANLDER_KEY);
+#else /* ! APPLE_KEYMGR */
new_handler handler = __new_handler;
+#endif /* APPLE_KEYMGR */
+ /* APPLE LOCAL end keymgr */
if (! handler)
#ifdef __EXCEPTIONS
throw bad_alloc();
#else
- std::abort();
+ /* APPLE LOCAL libcc_kext */
+ ABORT();
#endif
handler ();
p = (void *) malloc (sz);
diff --git a/libstdc++-v3/libsupc++/new_opnt.cc b/libstdc++-v3/libsupc++/new_opnt.cc
index 4d7a5087c14..6406a50086c 100644
--- a/libstdc++-v3/libsupc++/new_opnt.cc
+++ b/libstdc++-v3/libsupc++/new_opnt.cc
@@ -30,6 +30,12 @@
#include "new"
#include <exception_defines.h>
+/* APPLE LOCAL begin keymgr */
+#if defined APPLE_KEYMGR && ! defined(LIBCC_KEXT) && ! defined(APPLE_KERNEL_EXTENSION)
+#include "bits/os_defines.h"
+#endif /* APPLE_KEYMGR */
+/* APPLE LOCAL end keymgr */
+
using std::new_handler;
using std::bad_alloc;
@@ -47,7 +53,14 @@ operator new (std::size_t sz, const std::nothrow_t&) throw()
p = (void *) malloc (sz);
while (p == 0)
{
+ /* APPLE LOCAL begin keymgr */
+#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT)
+ new_handler handler =
+ (new_handler) _keymgr_get_per_thread_data (KEYMGR_NEW_HANLDER_KEY);
+#else /* ! APPLE_KEYMGR */
new_handler handler = __new_handler;
+#endif /* APPLE_KEYMGR */
+ /* APPLE LOCAL end keymgr */
if (! handler)
return 0;
try
diff --git a/libstdc++-v3/libsupc++/pure.cc b/libstdc++-v3/libsupc++/pure.cc
index 66ccb7d12dd..fb31d54c2ca 100644
--- a/libstdc++-v3/libsupc++/pure.cc
+++ b/libstdc++-v3/libsupc++/pure.cc
@@ -27,8 +27,12 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
+/* APPLE LOCAL begin libcc_kext */
+#ifndef LIBCC_KEXT /* Kludge: easier than identifying correct -Ipath, and unnecessary for kext */
#include <bits/c++config.h>
#include "unwind-cxx.h"
+#endif
+/* APPLE LOCAL end libcc_kext */
#ifdef _GLIBCXX_HAVE_UNISTD_H
# include <unistd.h>
@@ -46,6 +50,14 @@
extern "C" void
__cxa_pure_virtual (void)
{
+
+/* APPLE LOCAL begin libcc_kext */
+#ifndef LIBCC_KEXT
writestr ("pure virtual method called\n");
std::terminate ();
+#else
+ extern void panic (void);
+ panic ();
+#endif
+/* APPLE LOCAL end libcc_kext */
}
diff --git a/libstdc++-v3/src/functexcept.cc b/libstdc++-v3/src/functexcept.cc
index fb158a61242..fb041effbce 100644
--- a/libstdc++-v3/src/functexcept.cc
+++ b/libstdc++-v3/src/functexcept.cc
@@ -94,9 +94,15 @@ namespace std
__throw_underflow_error(const char* __s)
{ throw underflow_error(_(__s)); }
+ /* APPLE LOCAL begin make libstdc++ more fine-grained */
+ /* This function now lives in ios.cc, so that we can avoid dragging in all
+ of IOS when some other function in this file is called. */
+#ifndef APPLE_KEYMGR
void
__throw_ios_failure(const char* __s)
{ throw ios_base::failure(_(__s)); }
+#endif /* APPLE_KEYMGR */
+ /* APPLE LOCAL end make libstdc++ more fine-grained */
#else
void
__throw_bad_exception(void)
diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc
index 0dfa482d9bb..0aeb4d2ef61 100644
--- a/libstdc++-v3/src/ios.cc
+++ b/libstdc++-v3/src/ios.cc
@@ -222,4 +222,15 @@ namespace std
}
_M_callbacks = 0;
}
+
+ /* APPLE LOCAL begin make libstdc++ more fine-grained */
+#ifdef APPLE_KEYMGR
+ /* This function used to live in functexcept.cc, but now lives here to
+ avoid dragging in all of IOS when some other function in functexcept.cc
+ is called. */
+ void
+ __throw_ios_failure(const char* __s)
+ { throw ios_base::failure(__s); }
+#endif /* APPLE_KEYMGR */
+ /* APPLE LOCAL end make libstdc++ more fine-grained */
} // namespace std
diff --git a/libstdc++-v3/testsuite/20_util/allocator/14176.cc b/libstdc++-v3/testsuite/20_util/allocator/14176.cc
deleted file mode 100644
index cb8a2f5c4bf..00000000000
--- a/libstdc++-v3/testsuite/20_util/allocator/14176.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 20.4.1.1 allocator members
-
-#include <memory>
-#include <testsuite_hooks.h>
-
-// libstdc++/14176
-void test02()
-{
- unsigned int len = 0;
- std::allocator<int> a;
- int* p = a.allocate(len);
- a.deallocate(p, len);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-// Explicitly instantiate for systems with no COMDAT or weak support.
-template class __gnu_cxx::__mt_alloc<int>;
-#endif
-
-int main()
-{
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc
deleted file mode 100644
index 3a89d371f62..00000000000
--- a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* } }
-// { dg-options "-pthreads" { target *-*-solaris* } }
-
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
-
-#include <locale>
-#include <pthread.h>
-
-const int max_thread_count = 20;
-//const int max_loop_count = 1000000; // orig value
-const int max_loop_count = 100000;
-const int max_locales = 10;
-
-void* thread_main(void*)
-{
- try
- {
- std::locale loc_c = std::locale::classic();
- std::locale loc[max_locales];
- for (int j = 0; j < max_locales; ++j)
- loc[j] = std::locale(j % 2 ? "en_US" : "fr_FR");
-
- for (int i = 0; i < max_loop_count; ++i)
- {
- int k = i % max_locales;
- loc[k] = std::locale::global(loc[k]);
-
- if (i % 37 == 0)
- loc[k] = loc[k].combine<std::ctype<char> >(loc_c);
- }
- }
- catch (...) { }
- return 0;
-}
-
-int
-main()
-{
- pthread_t tid[max_thread_count];
-
- for (int i = 0; i < max_thread_count; i++)
- pthread_create (&tid[i], NULL, thread_main, 0);
-
- for (int i = 0; i < max_thread_count; i++)
- pthread_join (tid[i], NULL);
-
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc
deleted file mode 100644
index 5216b414aae..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// 2004-03-08 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// 22.2.6.3, p2: "The value _space_ indicates that at least one space
-// is required at that position."
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test __attribute__((unused)) = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_de = __gnu_test::try_named_locale("de_DE@euro");
- VERIFY( loc_c != loc_de );
-
- iterator_type end, end02;
- istringstream iss;
- iss.imbue(loc_de);
- // cache the money_get facet
- const money_get<char>& mon_get =
- use_facet<money_get<char> >(iss.getloc());
-
- iss.str("7.200.000.000,00");
- iterator_type is_it01(iss);
- string result1;
- ios_base::iostate err01 = ios_base::goodbit;
- mon_get.get(is_it01, end, true, iss, err01, result1);
- VERIFY( err01 == (ios_base::failbit | ios_base::eofbit) );
-
- // now try with showbase, to get currency symbol in format
- iss.setf(ios_base::showbase);
-
- iss.str("7.200.000.000,00EUR ");
- iterator_type is_it02(iss);
- string result2;
- ios_base::iostate err02 = ios_base::goodbit;
- end02 = mon_get.get(is_it02, end, true, iss, err02, result2);
- VERIFY( err02 == ios_base::failbit );
- VERIFY( *end02 == 'E' );
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc
deleted file mode 100644
index 3da65de43d1..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// 2004-03-15 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// If (str.flags() & str.showbase) is false, the currency symbol is optional,
-// but, if found, must be consumed entirely.
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test __attribute__((unused)) = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk = __gnu_test::try_named_locale("en_HK");
- VERIFY( loc_c != loc_hk );
-
- iterator_type end, end01, end02;
- istringstream iss;
- iss.imbue(loc_hk);
- // cache the money_get facet
- const money_get<char>& mon_get =
- use_facet<money_get<char> >(iss.getloc());
-
- iss.str("HK7,200,000,000.00");
- iterator_type is_it01(iss);
- string result01;
- ios_base::iostate err01 = ios_base::goodbit;
- end01 = mon_get.get(is_it01, end, false, iss, err01, result01);
- VERIFY( err01 == ios_base::failbit );
- VERIFY( *end01 == '7' );
-
- iss.str("(HK100,000,000,000.00)");
- iterator_type is_it02(iss);
- string result02;
- ios_base::iostate err02 = ios_base::goodbit;
- end02 = mon_get.get(is_it02, end, true, iss, err02, result02);
- VERIFY( err02 == ios_base::failbit );
- VERIFY( *end02 == '1' );
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc
deleted file mode 100644
index 5d9dea2be1e..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// 2004-03-15 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-struct My_money_io_01 : public std::moneypunct<char, false>
-{
- std::string do_curr_symbol() const { return "$"; }
- std::string do_positive_sign() const { return ""; }
- std::string do_negative_sign() const { return ""; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { value, symbol, none, sign } };
- return pat;
- }
-};
-
-struct My_money_io_02 : public std::moneypunct<char, false>
-{
- std::string do_curr_symbol() const { return "%"; }
- std::string do_positive_sign() const { return ""; }
- std::string do_negative_sign() const { return "-"; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { value, symbol, sign, none } };
- return pat;
- }
-};
-
-struct My_money_io_03 : public std::moneypunct<char, false>
-{
- std::string do_curr_symbol() const { return "&"; }
- std::string do_positive_sign() const { return ""; }
- std::string do_negative_sign() const { return ""; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { value, space, symbol, sign } };
- return pat;
- }
-};
-
-// When both do_positive_sign and do_negative_sign return an empty
-// string, patterns of the forms { value, symbol, none, sign },
-// { value, symbol, sign, none } and { X, Y, symbol, sign } imply
-// that the symbol is not consumed since no other characters are
-// needed to complete the format.
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<char> iterator_type;
-
- bool test __attribute__((unused)) = true;
-
- // basic construction
- locale loc_01(locale::classic(), new My_money_io_01);
- locale loc_02(locale::classic(), new My_money_io_02);
- locale loc_03(locale::classic(), new My_money_io_03);
-
- iterator_type end, end01, end02, end03;
- istringstream iss_01, iss_02, iss_03;
- iss_01.imbue(loc_01);
- iss_02.imbue(loc_02);
- iss_03.imbue(loc_03);
- // cache the money_get facet
- const money_get<char>& mon_get_01 =
- use_facet<money_get<char> >(iss_01.getloc());
- const money_get<char>& mon_get_02 =
- use_facet<money_get<char> >(iss_02.getloc());
- const money_get<char>& mon_get_03 =
- use_facet<money_get<char> >(iss_03.getloc());
-
- iss_01.str("10$");
- iterator_type is_it01(iss_01);
- string result01;
- ios_base::iostate err01 = ios_base::goodbit;
- end01 = mon_get_01.get(is_it01, end, false, iss_01, err01, result01);
- VERIFY( err01 == ios_base::goodbit );
- VERIFY( *end01 == '$' );
-
- iss_02.str("50%");
- iterator_type is_it02(iss_02);
- string result02;
- ios_base::iostate err02 = ios_base::goodbit;
- end02 = mon_get_02.get(is_it02, end, false, iss_02, err02, result02);
- VERIFY( err02 == ios_base::goodbit );
- VERIFY( *end02 == '%' );
-
- iss_03.str("7 &");
- iterator_type is_it03(iss_03);
- string result03;
- ios_base::iostate err03 = ios_base::goodbit;
- end03 = mon_get_03.get(is_it03, end, false, iss_03, err03, result03);
- VERIFY( err03 == ios_base::goodbit );
- VERIFY( *end03 == '&' );
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc
deleted file mode 100644
index e8affd81bb8..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// 2004-03-08 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// 22.2.6.3, p2: "The value _space_ indicates that at least one space
-// is required at that position."
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test __attribute__((unused)) = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_de = __gnu_test::try_named_locale("de_DE@euro");
- VERIFY( loc_c != loc_de );
-
- iterator_type end, end02;
- wistringstream iss;
- iss.imbue(loc_de);
- // cache the money_get facet
- const money_get<wchar_t>& mon_get =
- use_facet<money_get<wchar_t> >(iss.getloc());
-
- iss.str(L"7.200.000.000,00");
- iterator_type is_it01(iss);
- wstring result1;
- ios_base::iostate err01 = ios_base::goodbit;
- mon_get.get(is_it01, end, true, iss, err01, result1);
- VERIFY( err01 == (ios_base::failbit | ios_base::eofbit) );
-
- // now try with showbase, to get currency symbol in format
- iss.setf(ios_base::showbase);
-
- iss.str(L"7.200.000.000,00EUR ");
- iterator_type is_it02(iss);
- wstring result2;
- ios_base::iostate err02 = ios_base::goodbit;
- end02 = mon_get.get(is_it02, end, true, iss, err02, result2);
- VERIFY( err02 == ios_base::failbit );
- VERIFY( *end02 == L'E' );
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc
deleted file mode 100644
index 285de236276..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// 2004-03-15 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-// If (str.flags() & str.showbase) is false, the currency symbol is optional,
-// but, if found, must be consumed entirely.
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test __attribute__((unused)) = true;
-
- // basic construction
- locale loc_c = locale::classic();
- locale loc_hk = __gnu_test::try_named_locale("en_HK");
- VERIFY( loc_c != loc_hk );
-
- iterator_type end, end01, end02;
- wistringstream iss;
- iss.imbue(loc_hk);
- // cache the money_get facet
- const money_get<wchar_t>& mon_get =
- use_facet<money_get<wchar_t> >(iss.getloc());
-
- iss.str(L"HK7,200,000,000.00");
- iterator_type is_it01(iss);
- wstring result01;
- ios_base::iostate err01 = ios_base::goodbit;
- end01 = mon_get.get(is_it01, end, false, iss, err01, result01);
- VERIFY( err01 == ios_base::failbit );
- VERIFY( *end01 == L'7' );
-
- iss.str(L"(HK100,000,000,000.00)");
- iterator_type is_it02(iss);
- wstring result02;
- ios_base::iostate err02 = ios_base::goodbit;
- end02 = mon_get.get(is_it02, end, true, iss, err02, result02);
- VERIFY( err02 == ios_base::failbit );
- VERIFY( *end02 == L'1' );
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc
deleted file mode 100644
index 93c63e6ea29..00000000000
--- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// 2004-03-15 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 22.2.6.1.1 money_get members
-
-#include <locale>
-#include <sstream>
-#include <testsuite_hooks.h>
-
-struct My_money_io_01 : public std::moneypunct<wchar_t, false>
-{
- std::wstring do_curr_symbol() const { return L"$"; }
- std::wstring do_positive_sign() const { return L""; }
- std::wstring do_negative_sign() const { return L""; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { value, symbol, none, sign } };
- return pat;
- }
-};
-
-struct My_money_io_02 : public std::moneypunct<wchar_t, false>
-{
- std::wstring do_curr_symbol() const { return L"%"; }
- std::wstring do_positive_sign() const { return L""; }
- std::wstring do_negative_sign() const { return L"-"; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { value, symbol, sign, none } };
- return pat;
- }
-};
-
-struct My_money_io_03 : public std::moneypunct<wchar_t, false>
-{
- std::wstring do_curr_symbol() const { return L"&"; }
- std::wstring do_positive_sign() const { return L""; }
- std::wstring do_negative_sign() const { return L""; }
-
- pattern do_neg_format() const
- {
- pattern pat = { { value, space, symbol, sign } };
- return pat;
- }
-};
-
-// When both do_positive_sign and do_negative_sign return an empty
-// string, patterns of the forms { value, symbol, none, sign },
-// { value, symbol, sign, none } and { X, Y, symbol, sign } imply
-// that the symbol is not consumed since no other characters are
-// needed to complete the format.
-void test01()
-{
- using namespace std;
- typedef istreambuf_iterator<wchar_t> iterator_type;
-
- bool test __attribute__((unused)) = true;
-
- // basic construction
- locale loc_01(locale::classic(), new My_money_io_01);
- locale loc_02(locale::classic(), new My_money_io_02);
- locale loc_03(locale::classic(), new My_money_io_03);
-
- iterator_type end, end01, end02, end03;
- wistringstream iss_01, iss_02, iss_03;
- iss_01.imbue(loc_01);
- iss_02.imbue(loc_02);
- iss_03.imbue(loc_03);
- // cache the money_get facet
- const money_get<wchar_t>& mon_get_01 =
- use_facet<money_get<wchar_t> >(iss_01.getloc());
- const money_get<wchar_t>& mon_get_02 =
- use_facet<money_get<wchar_t> >(iss_02.getloc());
- const money_get<wchar_t>& mon_get_03 =
- use_facet<money_get<wchar_t> >(iss_03.getloc());
-
- iss_01.str(L"10$");
- iterator_type is_it01(iss_01);
- wstring result01;
- ios_base::iostate err01 = ios_base::goodbit;
- end01 = mon_get_01.get(is_it01, end, false, iss_01, err01, result01);
- VERIFY( err01 == ios_base::goodbit );
- VERIFY( *end01 == L'$' );
-
- iss_02.str(L"50%");
- iterator_type is_it02(iss_02);
- wstring result02;
- ios_base::iostate err02 = ios_base::goodbit;
- end02 = mon_get_02.get(is_it02, end, false, iss_02, err02, result02);
- VERIFY( err02 == ios_base::goodbit );
- VERIFY( *end02 == L'%' );
-
- iss_03.str(L"7 &");
- iterator_type is_it03(iss_03);
- wstring result03;
- ios_base::iostate err03 = ios_base::goodbit;
- end03 = mon_get_03.get(is_it03, end, false, iss_03, err03, result03);
- VERIFY( err03 == ios_base::goodbit );
- VERIFY( *end03 == L'&' );
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc
deleted file mode 100644
index 43dc6867d3d..00000000000
--- a/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <deque>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
-
-namespace std
-{
- template<>
- void
- deque<T, allocator<T> >::swap(deque<T, allocator<T> >&)
- { ++swap_calls; }
-}
-
-// Should use deque specialization for swap.
-void test01()
-{
- bool test __attribute__((unused)) = true;
- std::deque<T> A;
- std::deque<T> B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use deque specialization for swap.
-void test02()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
- deque<T> A;
- deque<T> B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<T>;
-template class __gnu_cxx::__mt_alloc<T*>;
-#endif
-
-// See c++/13658 for background info.
-int main()
-{
- test01();
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc
deleted file mode 100644
index a51d1263fb4..00000000000
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <list>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
-
-namespace std
-{
- template<>
- void
- list<T, allocator<T> >::swap(list<T, allocator<T> >&)
- { ++swap_calls; }
-}
-
-// Should use list specialization for swap.
-void test01()
-{
- bool test __attribute__((unused)) = true;
- std::list<T> A;
- std::list<T> B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use list specialization for swap.
-void test02()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
- list<T> A;
- list<T> B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<std::_List_node<T> >;
-#endif
-
-// See c++/13658 for background info.
-int main()
-{
- test01();
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc
deleted file mode 100644
index 1afde71dd8a..00000000000
--- a/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <map>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
-
-namespace std
-{
- template<>
- void
- map<T, int>::swap(map<T, int>&)
- { ++swap_calls; }
-}
-
-// Should use map specialization for swap.
-void test01()
-{
- bool test __attribute__((unused)) = true;
- std::map<T, int> A;
- std::map<T, int> B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use map specialization for swap.
-void test02()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
- map<T, int> A;
- map<T, int> B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<T const, int> > >;
-#endif
-
-// See c++/13658 for background info.
-int main()
-{
- test01();
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc
deleted file mode 100644
index 2e87dff1632..00000000000
--- a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <map>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
-
-namespace std
-{
- template<>
- void
- multimap<T, int>::swap(multimap<T, int>&)
- { ++swap_calls; }
-}
-
-// Should use multimap specialization for swap.
-void test01()
-{
- bool test __attribute__((unused)) = true;
- std::multimap<T, int> A;
- std::multimap<T, int> B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use multimap specialization for swap.
-void test02()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
- multimap<T, int> A;
- multimap<T, int> B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<T const, int> > >;
-#endif
-
-// See c++/13658 for background info.
-int main()
-{
- test01();
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc
deleted file mode 100644
index b9632cb88ae..00000000000
--- a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <set>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
-
-namespace std
-{
- template<>
- void
- multiset<T>::swap(multiset<T>&)
- { ++swap_calls; }
-}
-
-// Should use multiset specialization for swap.
-void test01()
-{
- bool test __attribute__((unused)) = true;
- std::multiset<T> A;
- std::multiset<T> B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use multiset specialization for swap.
-void test02()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
- multiset<T> A;
- multiset<T> B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<T> >;
-#endif
-
-// See c++/13658 for background info.
-int main()
-{
- test01();
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc
deleted file mode 100644
index dcc69c99b3a..00000000000
--- a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <set>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
-
-namespace std
-{
- template<>
- void
- set<T>::swap(set<T>&)
- { ++swap_calls; }
-}
-
-// Should use set specialization for swap.
-void test01()
-{
- bool test __attribute__((unused)) = true;
- std::set<T> A;
- std::set<T> B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use set specialization for swap.
-void test02()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
- set<T> A;
- set<T> B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<T> >;
-#endif
-
-// See c++/13658 for background info.
-int main()
-{
- test01();
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc
deleted file mode 100644
index 4e49635bc22..00000000000
--- a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <vector>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
-
-namespace std
-{
- template<>
- void
- vector<T, allocator<T> >::swap(vector<T, allocator<T> >&)
- { ++swap_calls; }
-}
-
-// Should use vector specialization for swap.
-void test01()
-{
- bool test __attribute__((unused)) = true;
- std::vector<T> A;
- std::vector<T> B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use vector specialization for swap.
-void test02()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
- vector<T> A;
- vector<T> B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<T>;
-#endif
-
-// See c++/13658 for background info.
-int main()
-{
- test01();
- test02();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/26_numerics/cmath/overloads.cc b/libstdc++-v3/testsuite/26_numerics/cmath/overloads.cc
deleted file mode 100644
index 4d41a9640b4..00000000000
--- a/libstdc++-v3/testsuite/26_numerics/cmath/overloads.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// PR 3181
-// Origin: pete@toyon.com
-
-#include <cmath>
-
-int main()
-{
- int i = -1;
- int j = 9;
- double ans;
- ans = std::acos(i);
- ans = std::asin(i);
- ans = std::atan(i);
- ans = std::atan2(i, j);
- ans = std::cos(i);
- ans = std::cosh(i);
- ans = std::exp(i);
- ans = std::fabs(i);
- ans = std::floor(i);
- ans = std::log(i);
- ans = std::log10(i);
- ans = std::sqrt(i);
- ans = std::sin(i);
- ans = std::sinh(j);
- ans = std::tan(i);
- ans = std::tanh(i);
-}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/13450.cc b/libstdc++-v3/testsuite/26_numerics/complex/13450.cc
deleted file mode 100644
index 50f4bad3b93..00000000000
--- a/libstdc++-v3/testsuite/26_numerics/complex/13450.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 26.2.8 complex transcendentals
-
-#include <complex>
-#include <limits>
-#include <testsuite_hooks.h>
-
-template<typename T>
- void test01_do(T a, T b)
- {
- using namespace std;
- bool test __attribute__((unused)) = true;
- typedef complex<T> cplx;
-
- T eps = numeric_limits<T>::epsilon() * 100;
-
- cplx ref = pow(cplx(a, T()), cplx(b, T()));
- cplx res1 = pow(a, cplx(b, T()));
- cplx res2 = pow(cplx(a, T()), b);
-
- VERIFY( abs(ref - res1) < eps );
- VERIFY( abs(ref - res2) < eps );
- VERIFY( abs(res1 - res2) < eps );
- }
-
-// libstdc++/13450
-void test01()
-{
- float f1 = -1.0f;
- float f2 = 0.5f;
- test01_do(f1, f2);
-
- f1 = -3.2f;
- f2 = 1.4f;
- test01_do(f1, f2);
-
- double d1 = -1.0;
- double d2 = 0.5;
- test01_do(d1, d2);
-
- d1 = -3.2;
- d2 = 1.4;
- test01_do(d1, d2);
-
- long double ld1 = -1.0l;
- long double ld2 = 0.5l;
- test01_do(ld1, ld2);
-
- ld1 = -3.2l;
- ld2 = 1.4l;
- test01_do(ld1, ld2);
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/pow.cc b/libstdc++-v3/testsuite/26_numerics/complex/pow.cc
deleted file mode 100644
index 58d0fc5909b..00000000000
--- a/libstdc++-v3/testsuite/26_numerics/complex/pow.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// PR libbstdc++/10689
-// Origin: Daniel.Levine@jhuaph.edu
-
-#include <complex>
-#include <testsuite_hooks.h>
-
-int main()
-{
- std::complex<double> z;
-
- VERIFY( pow(z, 1.0/3.0) == 0.0 );
-
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray_subset_assignment.cc b/libstdc++-v3/testsuite/26_numerics/valarray_subset_assignment.cc
deleted file mode 100644
index 9298bfb046f..00000000000
--- a/libstdc++-v3/testsuite/26_numerics/valarray_subset_assignment.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// 2004-01-03 Jerry Quinn <jlquinn@optonline.net>
-
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// PR 3247
-
-// This is DR-253. Test for accessible assignment-operators.
-#include <valarray>
-#include <testsuite_hooks.h>
-
-bool check_array(std::valarray<double>& a, double b[])
-{
- for (int i=0; i < a.size(); i++)
- if (a[i] != b[i]) return false;
- return true;
-}
-
-int main()
-{
- double dvar = 1.0;
- std::valarray<double> val_d(10); // 0 1 2 3 4 5 6 7 8 9
- std::valarray<double> val_d1(10); // 10 9 8 7 6 5 4 3 2 1
-
- for (int i=0; i< 10; i++) { val_d[i] = 10; val_d1[i] = i; }
- std::valarray<double> val_c(val_d);
- std::valarray<double> val_f(val_d);
- std::valarray<double> val_g(val_d);
-
- std::slice slc(1, 3, 3); // 1 4 7
- val_d[slc] = val_d1[slc];
-
- double ans1[10] = {10, 1, 10, 10, 4, 10, 10, 7, 10, 10};
- VERIFY(check_array(val_d, ans1));
-
- std::valarray<std::size_t> val_size(2);
- std::valarray<std::size_t> val_stride(2);
- val_size[0] = 2; val_size[1] = 3;
- val_stride[0] = 4; val_stride[1] = 1;
-
- std::gslice gslc(1, val_size, val_stride);
- val_c[gslc] = val_d1[gslc];
-
- double ans2[10] = {10, 1, 2, 3, 10, 5, 6, 7, 10, 10};
- VERIFY(check_array(val_c, ans2));
-
- std::valarray<bool> val_b(false, 10);
- val_b[2] = val_b[6] = val_b[9] = true;
- val_f[val_b] = val_d1[val_b];
-
- double ans3[10] = {10, 10, 2, 10, 10, 10, 6, 10, 10, 9};
- VERIFY(check_array(val_f, ans3));
-
- size_t addr[] = {1, 2, 3, 4, 5};
- size_t addr1[] = {2, 7, 1, 9, 4};
- std::valarray<std::size_t> val_indirect(addr, 5);
- std::valarray<std::size_t> val_indirect1(addr1, 5);
- val_g[val_indirect] = val_d1[val_indirect1];
-
- double ans4[10] = {10, 2, 7, 1, 9, 4, 10, 10, 10, 10};
- VERIFY(check_array(val_g, ans4));
-
- return 0;
-};
diff --git a/ltconfig b/ltconfig
index 0d97409d799..c1c903fa6e3 100755
--- a/ltconfig
+++ b/ltconfig
@@ -625,7 +625,8 @@ old_postuninstall_cmds=
if test -n "$RANLIB"; then
old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
- old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+ # APPLE LOCAL begin handle ~ in pathnames 2002-01-14 sts
+ old_postinstall_cmds="\$RANLIB \$oldlib@$old_postinstall_cmds"
fi
# Source the script associated with the $tagname tag configuration.
diff --git a/ltmain.sh b/ltmain.sh
index c1ef9974d0e..fe0d022b07b 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -495,11 +495,34 @@ if test -z "$show_help"; then
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
if test -n "$available_tags" && test -z "$tagname"; then
+ # APPLE LOCAL begin handle ~ in pathnames 2002-01-14 sts
+ # Since CC may have args with shell metachars in them, add
+ # doublequotes to args so it looks the same as $base_compile.
+ qCC=
+ for argu in $CC; do
+ case $argu in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ argu="\"$argu\""
+ ;;
+ esac
+ # Add the previous argument to qCC.
+ if test -z "$qCC"; then
+ qCC="$argu"
+ else
+ qCC="$qCC $argu"
+ fi
+ done
+ # APPLE LOCAL end handle ~ in pathnames 2002-01-14 sts
case $base_compile in
- "$CC "*) ;;
+ # APPLE LOCAL handle ~ in pathnames 2002-01-14 sts
+ "$qCC "*) ;;
# Blanks in the command may have been stripped by the calling shell,
# but not from the CC environment variable when ltconfig was run.
- "`$echo $CC` "*) ;;
+ # APPLE LOCAL handle ~ in pathnames 2002-01-14 sts
+ "`$echo $qCC` "*) ;;
*)
for z in $available_tags; do
if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
@@ -4913,7 +4936,8 @@ relink_command=\"$relink_command\""
# Do each command in the postinstall commands.
eval cmds=\"$old_postinstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ # APPLE LOCAL begin handle ~ in pathnames 2002-01-14 sts
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='@'
for cmd in $cmds; do
IFS="$save_ifs"
$show "$cmd"
diff --git a/maintainer-scripts/import-prune b/maintainer-scripts/import-prune
new file mode 100755
index 00000000000..66424e5f0d1
--- /dev/null
+++ b/maintainer-scripts/import-prune
@@ -0,0 +1,24 @@
+#!/bin/sh
+# APPLE LOCAL file maintenance
+# Use in directory to prune, argument is corresponding mainline source dir.
+# Output is list of commands to execute; save into file and review before
+# executing.
+
+diff -r --exclude CVS --exclude '*~' --exclude '*.#*' --brief $1 . \
+ | grep '^Only in \.' \
+ | sed -e 's,Only in \([^:]*\): \(.*\)$,\1/\2,' \
+ | sed -e 's,\./,,g' > /tmp/prunes
+
+for fname in `cat /tmp/prunes`; do
+ if head -3 $fname |grep -q 'APPLE *LOCAL' || test -d $fname; then :
+ echo "# keeping $fname"
+ else
+ echo "rm $fname; cvs remove $fname"
+ fi
+done
+
+
+
+
+
+
diff --git a/maintainer-scripts/local-summary b/maintainer-scripts/local-summary
new file mode 100755
index 00000000000..a3a518d4af1
--- /dev/null
+++ b/maintainer-scripts/local-summary
@@ -0,0 +1,60 @@
+#!/bin/sh
+# APPLE LOCAL file maintenance
+
+root="."
+uniq_options=""
+show_file=no
+
+while :
+do
+ case $# in
+ 0)
+ break
+ ;;
+ esac
+ option=$1
+ shift
+ case $option in
+ -c)
+ uniq_options="-c"
+ ;;
+ -f)
+ show_file=yes
+ ;;
+ *)
+ root=$option
+ ;;
+ esac
+done
+
+if [ $show_file == no ]; then
+ grep 'APPLE[^_]LOCAL' -r $root | sed -e 's/.*APPLE/APPLE/' >/tmp/rawlocals
+else
+ grep -n 'APPLE[^_]LOCAL' -r $root | sed -e 's/\(.*:[0-9]*:\).*APPLE/\1 APPLE/' >/tmp/rawlocals
+fi
+
+sed < /tmp/rawlocals \
+ -e 's/LOCAL[: ] /LOCAL /' \
+ -e 's/LOCAL *begin/LOCAL/' \
+ -e '/LOCAL *end/d' \
+ -e '/APPLE LOCAL"/d' \
+ -e 's/LOCAL *file/LOCAL/' \
+ -e 's/APPLE[ ]LOCAL[ ]*//' \
+ -e 's,\*/.*$,,g' \
+ -e 's/ dpatel//' \
+ -e 's/ ff//' \
+ -e 's/ ilr//' \
+ -e 's/ matt//' \
+ -e 's/ --matt//' \
+ -e 's/ sts//' \
+ -e 's/ turly//' \
+ -e 's/ tur//' \
+ -e 's/ zll//' \
+ -e 's/ 200[12]-..-..//' \
+ -e 's/ 200[12]-.-..//' \
+ -e 's/ 200[12][0-9][0-9][0-9][0-9]//' \
+ -e 's,[ */"\\]*$,,g' | \
+ sort | uniq $uniq_options
+
+
+
diff --git a/maintainer-scripts/local-untested b/maintainer-scripts/local-untested
new file mode 100755
index 00000000000..f7953192fba
--- /dev/null
+++ b/maintainer-scripts/local-untested
@@ -0,0 +1,9 @@
+#!/bin/sh
+# APPLE LOCAL file maintenance
+# Use from the toplevel directory.
+
+maintainer-scripts/local-summary gcc >/tmp/locals1
+maintainer-scripts/local-summary gcc/testsuite >/tmp/locals2
+
+diff -u /tmp/locals1 /tmp/locals2 | grep '^-' | sed -e 's/^-//'
+
diff --git a/man-pages/README b/man-pages/README
new file mode 100644
index 00000000000..61156ca88a8
--- /dev/null
+++ b/man-pages/README
@@ -0,0 +1,4 @@
+APPLE LOCAL file man pages
+
+This directory is a holder for preformatted man pages for Darwin gcc3.
+Eventually these should be generated during the build process.
diff --git a/man-pages/cpp3.1 b/man-pages/cpp3.1
new file mode 100644
index 00000000000..3ead6db6993
--- /dev/null
+++ b/man-pages/cpp3.1
@@ -0,0 +1,821 @@
+.\" Automatically generated by Pod::Man version 1.15
+.\" Wed Jun 19 19:36:25 2002
+.\"
+.\" Standard preamble:
+.\" ======================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. | will give a
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
+.\" to do unbreakable dashes and therefore won't be available. \*(C` and
+.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
+.tr \(*W-|\(bv\*(Tr
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
+.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
+.\" index entries marked with X<> in POD. Of course, you'll have to process
+.\" the output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it
+.\" makes way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+.bd B 3
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ======================================================================
+.\"
+.IX Title "CPP 1"
+.TH CPP 1 "gcc-3.1" "2002-06-19" "GNU"
+.UC
+.SH "NAME"
+cpp \- The C Preprocessor
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+cpp [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR]
+ [\fB\-I\fR\fIdir\fR...] [\fB\-W\fR\fIwarn\fR...]
+ [\fB\-M\fR|\fB\-MM\fR] [\fB\-MG\fR] [\fB\-MF\fR \fIfilename\fR]
+ [\fB\-MP\fR] [\fB\-MQ\fR \fItarget\fR...] [\fB\-MT\fR \fItarget\fR...]
+ [\fB\-x\fR \fIlanguage\fR] [\fB\-std=\fR\fIstandard\fR]
+ \fIinfile\fR \fIoutfile\fR
+.PP
+Only the most useful options are listed here; see below for the remainder.
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The C preprocessor, often known as \fIcpp\fR, is a \fImacro processor\fR
+that is used automatically by the C compiler to transform your program
+before compilation. It is called a macro processor because it allows
+you to define \fImacros\fR, which are brief abbreviations for longer
+constructs.
+.PP
+The C preprocessor is intended to be used only with C, \*(C+, and
+Objective-C source code. In the past, it has been abused as a general
+text processor. It will choke on input which does not obey C's lexical
+rules. For example, apostrophes will be interpreted as the beginning of
+character constants, and cause errors. Also, you cannot rely on it
+preserving characteristics of the input which are not significant to
+C-family languages. If a Makefile is preprocessed, all the hard tabs
+will be removed, and the Makefile will not work.
+.PP
+Having said that, you can often get away with using cpp on things which
+are not C. Other Algol-ish programming languages are often safe
+(Pascal, Ada, etc.) So is assembly, with caution. \fB\-traditional\fR
+mode preserves more white space, and is otherwise more permissive. Many
+of the problems can be avoided by writing C or \*(C+ style comments
+instead of native language comments, and keeping macros simple.
+.PP
+Wherever possible, you should use a preprocessor geared to the language
+you are writing in. Modern versions of the \s-1GNU\s0 assembler have macro
+facilities. Most high level programming languages have their own
+conditional compilation and inclusion mechanism. If all else fails,
+try a true general text processor, such as \s-1GNU\s0 M4.
+.PP
+C preprocessors vary in some details. This manual discusses the \s-1GNU\s0 C
+preprocessor, which provides a small superset of the features of \s-1ISO\s0
+Standard C. In its default mode, the \s-1GNU\s0 C preprocessor does not do a
+few things required by the standard. These are features which are
+rarely, if ever, used, and may cause surprising changes to the meaning
+of a program which does not expect them. To get strict \s-1ISO\s0 Standard C,
+you should use the \fB\-std=c89\fR or \fB\-std=c99\fR options, depending
+on which version of the standard you want. To get all the mandatory
+diagnostics, you must also use \fB\-pedantic\fR.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+The C preprocessor expects two file names as arguments, \fIinfile\fR and
+\&\fIoutfile\fR. The preprocessor reads \fIinfile\fR together with any
+other files it specifies with \fB#include\fR. All the output generated
+by the combined input files is written in \fIoutfile\fR.
+.PP
+Either \fIinfile\fR or \fIoutfile\fR may be \fB-\fR, which as
+\&\fIinfile\fR means to read from standard input and as \fIoutfile\fR
+means to write to standard output. Also, if either file is omitted, it
+means the same as if \fB-\fR had been specified for that file.
+.PP
+Unless otherwise noted, or the option ends in \fB=\fR, all options
+which take an argument may have that argument appear either immediately
+after the option, or with a space between option and argument:
+\&\fB\-Ifoo\fR and \fB\-I foo\fR have the same effect.
+.PP
+Many options have multi-letter names; therefore multiple single-letter
+options may \fInot\fR be grouped: \fB\-dM\fR is very different from
+\&\fB\-d\ \-M\fR.
+.Ip "\fB\-D\fR \fIname\fR" 4
+.IX Item "-D name"
+Predefine \fIname\fR as a macro, with definition \f(CW\*(C`1\*(C'\fR.
+.Ip "\fB\-D\fR \fIname\fR\fB=\fR\fIdefinition\fR" 4
+.IX Item "-D name=definition"
+Predefine \fIname\fR as a macro, with definition \fIdefinition\fR.
+There are no restrictions on the contents of \fIdefinition\fR, but if
+you are invoking the preprocessor from a shell or shell-like program you
+may need to use the shell's quoting syntax to protect characters such as
+spaces that have a meaning in the shell syntax.
+.Sp
+If you wish to define a function-like macro on the command line, write
+its argument list with surrounding parentheses before the equals sign
+(if any). Parentheses are meaningful to most shells, so you will need
+to quote the option. With \fBsh\fR and \fBcsh\fR,
+\&\fB\-D'\fR\fIname\fR\fB(\fR\fIargs...\fR\fB)=\fR\fIdefinition\fR\fB'\fR works.
+.Sp
+\&\fB\-D\fR and \fB\-U\fR options are processed in the order they
+are given on the command line. All \fB\-imacros\fR \fIfile\fR and
+\&\fB\-include\fR \fIfile\fR options are processed after all
+\&\fB\-D\fR and \fB\-U\fR options.
+.Ip "\fB\-U\fR \fIname\fR" 4
+.IX Item "-U name"
+Cancel any previous definition of \fIname\fR, either built in or
+provided with a \fB\-D\fR option.
+.Ip "\fB\-undef\fR" 4
+.IX Item "-undef"
+Do not predefine any system-specific macros. The common predefined
+macros remain defined.
+.Ip "\fB\-I\fR \fIdir\fR" 4
+.IX Item "-I dir"
+Add the directory \fIdir\fR to the list of directories to be searched
+for header files.
+.Sp
+Directories named by \fB\-I\fR are searched before the standard
+system include directories.
+.Sp
+It is dangerous to specify a standard system include directory in an
+\&\fB\-I\fR option. This defeats the special treatment of system
+headers
+\&. It can also defeat the repairs to buggy system headers which \s-1GCC\s0
+makes when it is installed.
+.Ip "\fB\-o\fR \fIfile\fR" 4
+.IX Item "-o file"
+Write output to \fIfile\fR. This is the same as specifying \fIfile\fR
+as the second non-option argument to \fBcpp\fR. \fBgcc\fR has a
+different interpretation of a second non-option argument, so you must
+use \fB\-o\fR to specify the output file.
+.Ip "\fB\-Wall\fR" 4
+.IX Item "-Wall"
+Turns on all optional warnings which are desirable for normal code. At
+present this is \fB\-Wcomment\fR and \fB\-Wtrigraphs\fR. Note that
+many of the preprocessor's warnings are on by default and have no
+options to control them.
+.Ip "\fB\-Wcomment\fR" 4
+.IX Item "-Wcomment"
+.PD 0
+.Ip "\fB\-Wcomments\fR" 4
+.IX Item "-Wcomments"
+.PD
+Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR
+comment, or whenever a backslash-newline appears in a \fB//\fR comment.
+(Both forms have the same effect.)
+.Ip "\fB\-Wtrigraphs\fR" 4
+.IX Item "-Wtrigraphs"
+Warn if any trigraphs are encountered. This option used to take effect
+only if \fB\-trigraphs\fR was also specified, but now works
+independently. Warnings are not given for trigraphs within comments, as
+they do not affect the meaning of the program.
+.Ip "\fB\-Wtraditional\fR" 4
+.IX Item "-Wtraditional"
+Warn about certain constructs that behave differently in traditional and
+\&\s-1ISO\s0 C. Also warn about \s-1ISO\s0 C constructs that have no traditional C
+equivalent, and problematic constructs which should be avoided.
+.Ip "\fB\-Wimport\fR" 4
+.IX Item "-Wimport"
+Warn the first time \fB#import\fR is used.
+.Ip "\fB\-Wundef\fR" 4
+.IX Item "-Wundef"
+Warn whenever an identifier which is not a macro is encountered in an
+\&\fB#if\fR directive, outside of \fBdefined\fR. Such identifiers are
+replaced with zero.
+.Ip "\fB\-Werror\fR" 4
+.IX Item "-Werror"
+Make all warnings into hard errors. Source code which triggers warnings
+will be rejected.
+.Ip "\fB\-Wsystem-headers\fR" 4
+.IX Item "-Wsystem-headers"
+Issue warnings for code in system headers. These are normally unhelpful
+in finding bugs in your own code, therefore suppressed. If you are
+responsible for the system library, you may want to see them.
+.Ip "\fB\-w\fR" 4
+.IX Item "-w"
+Suppress all warnings, including those which \s-1GNU\s0 \s-1CPP\s0 issues by default.
+.Ip "\fB\-pedantic\fR" 4
+.IX Item "-pedantic"
+Issue all the mandatory diagnostics listed in the C standard. Some of
+them are left out by default, since they trigger frequently on harmless
+code.
+.Ip "\fB\-pedantic-errors\fR" 4
+.IX Item "-pedantic-errors"
+Issue all the mandatory diagnostics, and make all mandatory diagnostics
+into errors. This includes mandatory diagnostics that \s-1GCC\s0 issues
+without \fB\-pedantic\fR but treats as warnings.
+.Ip "\fB\-M\fR" 4
+.IX Item "-M"
+Instead of outputting the result of preprocessing, output a rule
+suitable for \fBmake\fR describing the dependencies of the main
+source file. The preprocessor outputs one \fBmake\fR rule containing
+the object file name for that source file, a colon, and the names of all
+the included files, including those coming from \fB\-include\fR or
+\&\fB\-imacros\fR command line options.
+.Sp
+Unless specified explicitly (with \fB\-MT\fR or \fB\-MQ\fR), the
+object file name consists of the basename of the source file with any
+suffix replaced with object file suffix. If there are many included
+files then the rule is split into several lines using \fB\e\fR\-newline.
+The rule has no commands.
+.Sp
+This option does not suppress the preprocessor's debug output, such as
+\&\fB\-dM\fR. To avoid mixing such debug output with the dependency
+rules you should explicitly specify the dependency output file with
+\&\fB\-MF\fR, or use an environment variable like
+\&\fB\s-1DEPENDENCIES_OUTPUT\s0\fR. Debug output
+will still be sent to the regular output stream as normal.
+.Sp
+Passing \fB\-M\fR to the driver implies \fB\-E\fR.
+.Ip "\fB\-MM\fR" 4
+.IX Item "-MM"
+Like \fB\-M\fR but do not mention header files that are found in
+system header directories, nor header files that are included,
+directly or indirectly, from such a header.
+.Sp
+This implies that the choice of angle brackets or double quotes in an
+\&\fB#include\fR directive does not in itself determine whether that
+header will appear in \fB\-MM\fR dependency output. This is a
+slight change in semantics from \s-1GCC\s0 versions 3.0 and earlier.
+.Ip "\fB\-MF\fR \fIfile\fR" 4
+.IX Item "-MF file"
+@anchor{\-MF}
+When used with \fB\-M\fR or \fB\-MM\fR, specifies a
+file to write the dependencies to. If no \fB\-MF\fR switch is given
+the preprocessor sends the rules to the same place it would have sent
+preprocessed output.
+.Sp
+When used with the driver options \fB\-MD\fR or \fB\-MMD\fR,
+\&\fB\-MF\fR overrides the default dependency output file.
+.Ip "\fB\-dependency-file\fR" 4
+.IX Item "-dependency-file"
+Like \fB\-MF\fR. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-MG\fR" 4
+.IX Item "-MG"
+When used with \fB\-M\fR or \fB\-MM\fR, \fB\-MG\fR says to treat missing
+header files as generated files and assume they live in the same
+directory as the source file. It suppresses preprocessed output, as a
+missing header file is ordinarily an error.
+.Sp
+This feature is used in automatic updating of makefiles.
+.Ip "\fB\-MP\fR" 4
+.IX Item "-MP"
+This option instructs \s-1CPP\s0 to add a phony target for each dependency
+other than the main file, causing each to depend on nothing. These
+dummy rules work around errors \fBmake\fR gives if you remove header
+files without updating the \fIMakefile\fR to match.
+.Sp
+This is typical output:
+.Sp
+.Vb 1
+\& test.o: test.c test.h
+.Ve
+.Vb 1
+\& test.h:
+.Ve
+.Ip "\fB\-MT\fR \fItarget\fR" 4
+.IX Item "-MT target"
+Change the target of the rule emitted by dependency generation. By
+default \s-1CPP\s0 takes the name of the main input file, including any path,
+deletes any file suffix such as \fB.c\fR, and appends the platform's
+usual object suffix. The result is the target.
+.Sp
+An \fB\-MT\fR option will set the target to be exactly the string you
+specify. If you want multiple targets, you can specify them as a single
+argument to \fB\-MT\fR, or use multiple \fB\-MT\fR options.
+.Sp
+For example, \fB\-MT\ '$(objpfx)foo.o'\fR might give
+.Sp
+.Vb 1
+\& $(objpfx)foo.o: foo.c
+.Ve
+.Ip "\fB\-MQ\fR \fItarget\fR" 4
+.IX Item "-MQ target"
+Same as \fB\-MT\fR, but it quotes any characters which are special to
+Make. \fB\-MQ\ '$(objpfx)foo.o'\fR gives
+.Sp
+.Vb 1
+\& $$(objpfx)foo.o: foo.c
+.Ve
+The default target is automatically quoted, as if it were given with
+\&\fB\-MQ\fR.
+.Ip "\fB\-MD\fR" 4
+.IX Item "-MD"
+\&\fB\-MD\fR is equivalent to \fB\-M \-MF\fR \fIfile\fR, except that
+\&\fB\-E\fR is not implied. The driver determines \fIfile\fR based on
+whether an \fB\-o\fR option is given. If it is, the driver uses its
+argument but with a suffix of \fI.d\fR, otherwise it take the
+basename of the input file and applies a \fI.d\fR suffix.
+.Sp
+If \fB\-MD\fR is used in conjunction with \fB\-E\fR, any
+\&\fB\-o\fR switch is understood to specify the dependency output file
+(but \f(CW@pxref\fR{\-MF}), but if used without \fB\-E\fR, each \fB\-o\fR
+is understood to specify a target object file.
+.Sp
+Since \fB\-E\fR is not implied, \fB\-MD\fR can be used to generate
+a dependency output file as a side-effect of the compilation process.
+.Ip "\fB\-MMD\fR" 4
+.IX Item "-MMD"
+Like \fB\-MD\fR except mention only user header files, not system
+\&\-header files.
+.Ip "\fB\-x c\fR" 4
+.IX Item "-x c"
+.PD 0
+.Ip "\fB\-x c++\fR" 4
+.IX Item "-x c++"
+.Ip "\fB\-x objective-c\fR" 4
+.IX Item "-x objective-c"
+.Ip "\fB\-x objective-c++\fR" 4
+.IX Item "-x objective-c++"
+.Ip "\fB\-x assembler-with-cpp\fR" 4
+.IX Item "-x assembler-with-cpp"
+.PD
+Specify the source language: C, \*(C+, Objective-C, Objective-\*(C+, or assembly. This has
+nothing to do with standards conformance or extensions; it merely
+selects which base syntax to expect. If you give none of these options,
+cpp will deduce the language from the extension of the source file:
+\&\fB.c\fR, \fB.cc\fR, \fB.m\fR, \fB.mm\fR, or \fB.S\fR. Some other common
+extensions for \*(C+ and assembly are also recognized. If cpp does not
+recognize the extension, it will treat the file as C; this is the most
+generic mode.
+.Sp
+\&\fBNote:\fR Previous versions of cpp accepted a \fB\-lang\fR option
+which selected both the language and the standards conformance level.
+This option has been removed, because it conflicts with the \fB\-l\fR
+option.
+.Ip "\fB\-std=\fR\fIstandard\fR" 4
+.IX Item "-std=standard"
+.PD 0
+.Ip "\fB\-ansi\fR" 4
+.IX Item "-ansi"
+.PD
+Specify the standard to which the code should conform. Currently cpp
+only knows about the standards for C; other language standards will be
+added in the future.
+.Sp
+\&\fIstandard\fR
+may be one of:
+.RS 4
+.if n .Ip "\f(CW""""iso9899:1990""""\fR" 4
+.el .Ip "\f(CWiso9899:1990\fR" 4
+.IX Item "iso9899:1990"
+.PD 0
+.if n .Ip "\f(CW""""c89""""\fR" 4
+.el .Ip "\f(CWc89\fR" 4
+.IX Item "c89"
+.PD
+The \s-1ISO\s0 C standard from 1990. \fBc89\fR is the customary shorthand for
+this version of the standard.
+.Sp
+The \fB\-ansi\fR option is equivalent to \fB\-std=c89\fR.
+.if n .Ip "\f(CW""""iso9899:199409""""\fR" 4
+.el .Ip "\f(CWiso9899:199409\fR" 4
+.IX Item "iso9899:199409"
+The 1990 C standard, as amended in 1994.
+.if n .Ip "\f(CW""""iso9899:1999""""\fR" 4
+.el .Ip "\f(CWiso9899:1999\fR" 4
+.IX Item "iso9899:1999"
+.PD 0
+.if n .Ip "\f(CW""""c99""""\fR" 4
+.el .Ip "\f(CWc99\fR" 4
+.IX Item "c99"
+.if n .Ip "\f(CW""""iso9899:199x""""\fR" 4
+.el .Ip "\f(CWiso9899:199x\fR" 4
+.IX Item "iso9899:199x"
+.if n .Ip "\f(CW""""c9x""""\fR" 4
+.el .Ip "\f(CWc9x\fR" 4
+.IX Item "c9x"
+.PD
+The revised \s-1ISO\s0 C standard, published in December 1999. Before
+publication, this was known as C9X.
+.if n .Ip "\f(CW""""gnu89""""\fR" 4
+.el .Ip "\f(CWgnu89\fR" 4
+.IX Item "gnu89"
+The 1990 C standard plus \s-1GNU\s0 extensions. This is the default.
+.if n .Ip "\f(CW""""gnu99""""\fR" 4
+.el .Ip "\f(CWgnu99\fR" 4
+.IX Item "gnu99"
+.PD 0
+.if n .Ip "\f(CW""""gnu9x""""\fR" 4
+.el .Ip "\f(CWgnu9x\fR" 4
+.IX Item "gnu9x"
+.PD
+The 1999 C standard plus \s-1GNU\s0 extensions.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-I-\fR" 4
+.IX Item "-I-"
+Split the include path. Any directories specified with \fB\-I\fR
+options before \fB\-I-\fR are searched only for headers requested with
+\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for
+\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR. If additional directories are
+specified with \fB\-I\fR options after the \fB\-I-\fR, those
+directories are searched for all \fB#include\fR directives.
+.Sp
+In addition, \fB\-I-\fR inhibits the use of the directory of the current
+file directory as the first search directory for \f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR.
+.Ip "\fB\-nostdinc\fR" 4
+.IX Item "-nostdinc"
+Do not search the standard system directories for header files.
+Only the directories you have specified with \fB\-I\fR options
+(and the directory of the current file, if appropriate) are searched.
+.Ip "\fB\-nostdinc++\fR" 4
+.IX Item "-nostdinc++"
+Do not search for header files in the \*(C+\-specific standard directories,
+but do still search the other standard directories. (This option is
+used when building the \*(C+ library.)
+.Ip "\fB\-include\fR \fIfile\fR" 4
+.IX Item "-include file"
+Process \fIfile\fR as if \f(CW\*(C`#include "file"\*(C'\fR appeared as the first
+line of the primary source file. However, the first directory searched
+for \fIfile\fR is the preprocessor's working directory \fIinstead of\fR
+the directory containing the main source file. If not found there, it
+is searched for in the remainder of the \f(CW\*(C`#include "..."\*(C'\fR search
+chain as normal.
+.Sp
+If multiple \fB\-include\fR options are given, the files are included
+in the order they appear on the command line.
+.Ip "\fB\-imacros\fR \fIfile\fR" 4
+.IX Item "-imacros file"
+Exactly like \fB\-include\fR, except that any output produced by
+scanning \fIfile\fR is thrown away. Macros it defines remain defined.
+This allows you to acquire all the macros from a header without also
+processing its declarations.
+.Sp
+All files specified by \fB\-imacros\fR are processed before all files
+specified by \fB\-include\fR.
+.Ip "\fB\-idirafter\fR \fIdir\fR" 4
+.IX Item "-idirafter dir"
+Search \fIdir\fR for header files, but do it \fIafter\fR all
+directories specified with \fB\-I\fR and the standard system directories
+have been exhausted. \fIdir\fR is treated as a system include directory.
+.Ip "\fB\-iprefix\fR \fIprefix\fR" 4
+.IX Item "-iprefix prefix"
+Specify \fIprefix\fR as the prefix for subsequent \fB\-iwithprefix\fR
+options. If the prefix represents a directory, you should include the
+final \fB/\fR.
+.Ip "\fB\-iwithprefix\fR \fIdir\fR" 4
+.IX Item "-iwithprefix dir"
+.PD 0
+.Ip "\fB\-iwithprefixbefore\fR \fIdir\fR" 4
+.IX Item "-iwithprefixbefore dir"
+.PD
+Append \fIdir\fR to the prefix specified previously with
+\&\fB\-iprefix\fR, and add the resulting directory to the include search
+path. \fB\-iwithprefixbefore\fR puts it in the same place \fB\-I\fR
+would; \fB\-iwithprefix\fR puts it where \fB\-idirafter\fR would.
+.Sp
+Use of these options is discouraged.
+.Ip "\fB\-isystem\fR \fIdir\fR" 4
+.IX Item "-isystem dir"
+Search \fIdir\fR for header files, after all directories specified by
+\&\fB\-I\fR but before the standard system directories. Mark it
+as a system directory, so that it gets the same special treatment as
+is applied to the standard system directories.
+.Ip "\fB\-fpreprocessed\fR" 4
+.IX Item "-fpreprocessed"
+Indicate to the preprocessor that the input file has already been
+preprocessed. This suppresses things like macro expansion, trigraph
+conversion, escaped newline splicing, and processing of most directives.
+The preprocessor still recognizes and removes comments, so that you can
+pass a file preprocessed with \fB\-C\fR to the compiler without
+problems. In this mode the integrated preprocessor is little more than
+a tokenizer for the front ends.
+.Sp
+\&\fB\-fpreprocessed\fR is implicit if the input file has one of the
+extensions \fB.i\fR, \fB.ii\fR or \fB.mi\fR. These are the
+extensions that \s-1GCC\s0 uses for preprocessed files created by
+\&\fB\-save-temps\fR.
+.Ip "\fB\-ftabstop=\fR\fIwidth\fR" 4
+.IX Item "-ftabstop=width"
+Set the distance between tab stops. This helps the preprocessor report
+correct column numbers in warnings or errors, even if tabs appear on the
+line. If the value is less than 1 or greater than 100, the option is
+ignored. The default is 8.
+.Ip "\fB\-fno-show-column\fR" 4
+.IX Item "-fno-show-column"
+Do not print column numbers in diagnostics. This may be necessary if
+diagnostics are being scanned by a program that does not understand the
+column numbers, such as \fBdejagnu\fR.
+.Ip "\fB\-A\fR \fIpredicate\fR\fB=\fR\fIanswer\fR" 4
+.IX Item "-A predicate=answer"
+Make an assertion with the predicate \fIpredicate\fR and answer
+\&\fIanswer\fR. This form is preferred to the older form \fB\-A\fR
+\&\fIpredicate\fR\fB(\fR\fIanswer\fR\fB)\fR, which is still supported, because
+it does not use shell special characters.
+.Ip "\fB\-A -\fR\fIpredicate\fR\fB=\fR\fIanswer\fR" 4
+.IX Item "-A -predicate=answer"
+Cancel an assertion with the predicate \fIpredicate\fR and answer
+\&\fIanswer\fR.
+.Ip "\fB\-A-\fR" 4
+.IX Item "-A-"
+Cancel all predefined assertions and all assertions preceding it on
+the command line. Also, undefine all predefined macros and all
+macros preceding it on the command line. (This is a historical wart and
+may change in the future.)
+.Ip "\fB\-dCHARS\fR" 4
+.IX Item "-dCHARS"
+\&\fI\s-1CHARS\s0\fR is a sequence of one or more of the following characters,
+and must not be preceded by a space. Other characters are interpreted
+by the compiler proper, or reserved for future versions of \s-1GCC\s0, and so
+are silently ignored. If you specify characters whose behavior
+conflicts, the result is undefined.
+.RS 4
+.Ip "\fBM\fR" 4
+.IX Item "M"
+Instead of the normal output, generate a list of \fB#define\fR
+directives for all the macros defined during the execution of the
+preprocessor, including predefined macros. This gives you a way of
+finding out what is predefined in your version of the preprocessor.
+Assuming you have no file \fIfoo.h\fR, the command
+.Sp
+.Vb 1
+\& touch foo.h; cpp -dM foo.h
+.Ve
+will show all the predefined macros.
+.Ip "\fBD\fR" 4
+.IX Item "D"
+Like \fBM\fR except in two respects: it does \fInot\fR include the
+predefined macros, and it outputs \fIboth\fR the \fB#define\fR
+directives and the result of preprocessing. Both kinds of output go to
+the standard output file.
+.Ip "\fBN\fR" 4
+.IX Item "N"
+Like \fBD\fR, but emit only the macro names, not their expansions.
+.Ip "\fBI\fR" 4
+.IX Item "I"
+Output \fB#include\fR directives in addition to the result of
+preprocessing.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-P\fR" 4
+.IX Item "-P"
+Inhibit generation of linemarkers in the output from the preprocessor.
+This might be useful when running the preprocessor on something that is
+not C code, and will be sent to a program which might be confused by the
+linemarkers.
+.Ip "\fB\-C\fR" 4
+.IX Item "-C"
+Do not discard comments. All comments are passed through to the output
+file, except for comments in processed directives, which are deleted
+along with the directive.
+.Sp
+You should be prepared for side effects when using \fB\-C\fR; it
+causes the preprocessor to treat comments as tokens in their own right.
+For example, comments appearing at the start of what would be a
+directive line have the effect of turning that line into an ordinary
+source line, since the first token on the line is no longer a \fB#\fR.
+.Ip "\fB\-gcc\fR" 4
+.IX Item "-gcc"
+Define the macros _\|_GNUC_\|_, _\|_GNUC_MINOR_\|_ and
+_\|_GNUC_PATCHLEVEL_\|_. These are defined automatically when you use
+\&\fBgcc \-E\fR; you can turn them off in that case with
+\&\fB\-no-gcc\fR.
+.Ip "\fB\-traditional\fR" 4
+.IX Item "-traditional"
+Try to imitate the behavior of old-fashioned C, as opposed to \s-1ISO\s0
+C.
+.Ip "\fB\-trigraphs\fR" 4
+.IX Item "-trigraphs"
+Process trigraph sequences.
+.Ip "\fB\-remap\fR" 4
+.IX Item "-remap"
+Enable special code to work around file systems which only permit very
+short file names, such as \s-1MS-DOS\s0.
+.Ip "\fB\-$\fR" 4
+.IX Item "-$"
+Forbid the use of \fB$\fR in identifiers. The C standard allows
+implementations to define extra characters that can appear in
+identifiers. By default \s-1GNU\s0 \s-1CPP\s0 permits \fB$\fR, a common extension.
+.Ip "\fB\-h\fR" 4
+.IX Item "-h"
+.PD 0
+.Ip "\fB\*(--help\fR" 4
+.IX Item "help"
+.Ip "\fB\*(--target-help\fR" 4
+.IX Item "target-help"
+.PD
+Print text describing all the command line options instead of
+preprocessing anything.
+.Ip "\fB\-v\fR" 4
+.IX Item "-v"
+Verbose mode. Print out \s-1GNU\s0 \s-1CPP\s0's version number at the beginning of
+execution, and report the final form of the include path.
+.Ip "\fB\-H\fR" 4
+.IX Item "-H"
+Print the name of each header file used, in addition to other normal
+activities. Each name is indented to show how deep in the
+\&\fB#include\fR stack it is.
+.Ip "\fB\-version\fR" 4
+.IX Item "-version"
+.PD 0
+.Ip "\fB\*(--version\fR" 4
+.IX Item "version"
+.PD
+Print out \s-1GNU\s0 \s-1CPP\s0's version number. With one dash, proceed to
+preprocess as normal. With two dashes, exit immediately.
+.SH "ENVIRONMENT"
+.IX Header "ENVIRONMENT"
+This section describes the environment variables that affect how \s-1CPP\s0
+operates. You can use them to specify directories or prefixes to use
+when searching for include files, or to control dependency output.
+.PP
+Note that you can also specify places to search using options such as
+\&\fB\-I\fR, and control dependency output with options like
+\&\fB\-M\fR. These take precedence over
+environment variables, which in turn take precedence over the
+configuration of \s-1GCC\s0.
+.Ip "\fB\s-1CPATH\s0\fR" 4
+.IX Item "CPATH"
+.PD 0
+.Ip "\fBC_INCLUDE_PATH\fR" 4
+.IX Item "C_INCLUDE_PATH"
+.Ip "\fB\s-1CPLUS_INCLUDE_PATH\s0\fR" 4
+.IX Item "CPLUS_INCLUDE_PATH"
+.Ip "\fB\s-1OBJC_INCLUDE_PATH\s0\fR" 4
+.IX Item "OBJC_INCLUDE_PATH"
+.PD
+Each variable's value is a list of directories separated by a special
+character, much like \fB\s-1PATH\s0\fR, in which to look for header files.
+The special character, \f(CW\*(C`PATH_SEPARATOR\*(C'\fR, is target-dependent and
+determined at \s-1GCC\s0 build time. For Windows-based targets it is a
+semicolon, and for almost all other targets it is a colon.
+.Sp
+\&\fB\s-1CPATH\s0\fR specifies a list of directories to be searched as if
+specified with \fB\-I\fR, but after any paths given with \fB\-I\fR
+options on the command line. The environment variable is used
+regardless of which language is being preprocessed.
+.Sp
+The remaining environment variables apply only when preprocessing the
+particular language indicated. Each specifies a list of directories
+to be searched as if specified with \fB\-isystem\fR, but after any
+paths given with \fB\-isystem\fR options on the command line.
+.Sp
+See also \f(CW@ref\fR{Search Path}.
+.Ip "\fB\s-1DEPENDENCIES_OUTPUT\s0\fR" 4
+.IX Item "DEPENDENCIES_OUTPUT"
+@anchor{\s-1DEPENDENCIES_OUTPUT\s0}
+If this variable is set, its value specifies how to output
+dependencies for Make based on the non-system header files processed
+by the compiler. System header files are ignored in the dependency
+output.
+.Sp
+The value of \fB\s-1DEPENDENCIES_OUTPUT\s0\fR can be just a file name, in
+which case the Make rules are written to that file, guessing the target
+name from the source file name. Or the value can have the form
+\&\fIfile\fR\fB \fR\fItarget\fR, in which case the rules are written to
+file \fIfile\fR using \fItarget\fR as the target name.
+.Sp
+In other words, this environment variable is equivalent to combining
+the options \fB\-MM\fR and \fB\-MF\fR,
+with an optional \fB\-MT\fR switch too.
+.Ip "\fB\s-1SUNPRO_DEPENDENCIES\s0\fR" 4
+.IX Item "SUNPRO_DEPENDENCIES"
+This variable is the same as the environment variable
+\&\fB\s-1DEPENDENCIES_OUTPUT\s0\fR, except that
+system header files are not ignored, so it implies \fB\-M\fR rather
+than \fB\-MM\fR.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIgpl\fR\|(7), \fIgfdl\fR\|(7), \fIfsf-funding\fR\|(7),
+\&\fIgcc\fR\|(1), \fIas\fR\|(1), \fIld\fR\|(1), and the Info entries for \fIcpp\fR, \fIgcc\fR, and
+\&\fIbinutils\fR.
+.SH "COPYRIGHT"
+.IX Header "COPYRIGHT"
+Copyright (c) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
+1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+.PP
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation. A copy of
+the license is included in the
+man page \fIgfdl\fR\|(7).
+This manual contains no Invariant Sections. The Front-Cover Texts are
+(a) (see below), and the Back-Cover Texts are (b) (see below).
+.PP
+(a) The \s-1FSF\s0's Front-Cover Text is:
+.PP
+.Vb 1
+\& A GNU Manual
+.Ve
+(b) The \s-1FSF\s0's Back-Cover Text is:
+.PP
+.Vb 3
+\& You have freedom to copy and modify this GNU Manual, like GNU
+\& software. Copies published by the Free Software Foundation raise
+\& funds for GNU development.
+.Ve
diff --git a/man-pages/gcc3.1 b/man-pages/gcc3.1
new file mode 100644
index 00000000000..35d83929541
--- /dev/null
+++ b/man-pages/gcc3.1
@@ -0,0 +1,5764 @@
+.\" Automatically generated by Pod::Man version 1.15
+.\" Wed Jun 19 19:36:28 2002
+.\"
+.\" Standard preamble:
+.\" ======================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. | will give a
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
+.\" to do unbreakable dashes and therefore won't be available. \*(C` and
+.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
+.tr \(*W-|\(bv\*(Tr
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
+.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
+.\" index entries marked with X<> in POD. Of course, you'll have to process
+.\" the output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it
+.\" makes way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+.bd B 3
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ======================================================================
+.\"
+.IX Title "GCC 1"
+.TH GCC 1 "gcc-3.1" "2002-06-19" "GNU"
+.UC
+.SH "NAME"
+gcc \- \s-1GNU\s0 project C and \*(C+ compiler
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+gcc [\fB\-c\fR|\fB\-S\fR|\fB\-E\fR] [\fB\-std=\fR\fIstandard\fR]
+ [\fB\-g\fR] [\fB\-pg\fR] [\fB\-O\fR\fIlevel\fR]
+ [\fB\-W\fR\fIwarn\fR...] [\fB\-pedantic\fR]
+ [\fB\-I\fR\fIdir\fR...] [\fB\-L\fR\fIdir\fR...]
+ [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR]
+ [\fB\-f\fR\fIoption\fR...] [\fB\-m\fR\fImachine-option\fR...]
+ [\fB\-o\fR \fIoutfile\fR] \fIinfile\fR...
+.PP
+Only the most useful options are listed here; see below for the
+remainder. \fBg++\fR accepts mostly the same options as \fBgcc\fR.
+.PP
+In Apple's version of \s-1GCC\s0, both \fBcc\fR and \fBgcc\fR are actually
+symbolic links to \fBgcc3\fR, while \fBc++\fR and \fBg++\fR are links
+to \fBg++3\fR.
+.PP
+Note that Apple's \s-1GCC\s0 includes a number of extensions to standard \s-1GCC\s0
+(flagged below with ``\s-1APPLE\s0 \s-1ONLY\s0''), and that not all generic \s-1GCC\s0
+options are available or supported on Darwin / Mac \s-1OS\s0 X. In particular,
+Apple does not currently support the compilation of Fortran, Ada, or
+Java, although there are third parties who have made these work.
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+When you invoke \s-1GCC\s0, it normally does preprocessing, compilation,
+assembly and linking. The ``overall options'' allow you to stop this
+process at an intermediate stage. For example, the \fB\-c\fR option
+says not to run the linker. Then the output consists of object files
+output by the assembler.
+.PP
+Other options are passed on to one stage of processing. Some options
+control the preprocessor and others the compiler itself. Yet other
+options control the assembler and linker; most of these are not
+documented here, since you rarely need to use any of them.
+.PP
+Most of the command line options that you can use with \s-1GCC\s0 are useful
+for C programs; when an option is only useful with another language
+(usually \*(C+), the explanation says so explicitly. If the description
+for a particular option does not mention a source language, you can use
+that option with all supported languages.
+.PP
+The \fBgcc\fR program accepts options and file names as operands. Many
+options have multi-letter names; therefore multiple single-letter options
+may \fInot\fR be grouped: \fB\-dr\fR is very different from \fB\-d\ \-r\fR.
+.PP
+You can mix options and other arguments. For the most part, the order
+you use doesn't matter. Order does matter when you use several options
+of the same kind; for example, if you specify \fB\-L\fR more than once,
+the directories are searched in the order specified.
+.PP
+Many options have long names starting with \fB\-f\fR or with
+\&\fB\-W\fR\-\-\-for example, \fB\-fforce-mem\fR,
+\&\fB\-fstrength-reduce\fR, \fB\-Wformat\fR and so on. Most of
+these have both positive and negative forms; the negative form of
+\&\fB\-ffoo\fR would be \fB\-fno-foo\fR. This manual documents
+only one of these two forms, whichever one is not the default.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.Sh "Option Summary"
+.IX Subsection "Option Summary"
+Here is a summary of all the options, grouped by type. Explanations are
+in the following sections.
+.Ip "\fIOverall Options\fR" 4
+.IX Item "Overall Options"
+\&\fB\-c \-S \-E \-o\fR \fIfile\fR \fB\-pipe \-pass-exit-codes \-x\fR \fIlanguage\fR
+\&\fB\-ObjC (\s-1APPLE\s0 \s-1ONLY\s0) \-ObjC++ (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-arch\fR \fIarch\fR \fB(\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-v \-### \-\-target-help \-\-help\fR
+.Ip "\fIC Language Options\fR" 4
+.IX Item "C Language Options"
+\&\fB\-ansi \-std=\fR\fIstandard\fR \fB\-aux-info\fR \fIfilename\fR
+\&\fB\-faltivec (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-fno-asm \-fno-builtin \-fno-builtin-\fR\fIfunction\fR
+\&\fB\-fhosted \-ffreestanding
+\&\-trigraphs \-no-integrated-cpp \-traditional \-traditional-cpp
+\&\-fallow-single-precision \-fcond-mismatch
+\&\-fconstant-cfstrings (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-fsigned-bitfields \-fsigned-char
+\&\-funsigned-bitfields \-funsigned-char
+\&\-fwritable-strings \-fshort-wchar
+\&\-fpascal-strings (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-fcoalesce (\s-1APPLE\s0 \s-1ONLY\s0) \-fweak-coalesced (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-Wno-#warnings (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-Wextra-tokens (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-Wpragma-once (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-Wnewline-eof (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-Wno-altivec-long-deprecated (\s-1APPLE\s0 \s-1ONLY\s0)\fR
+.Ip "\fI\*(C+ Language Options\fR" 4
+.IX Item " Language Options"
+\&\fB\-fno-access-control \-fcheck-new \-fconserve-space
+\&\-fno-const-strings \-fdollars-in-identifiers
+\&\-fno-elide-constructors
+\&\-fno-enforce-eh-specs \-fexternal-templates
+\&\-falt-external-templates
+\&\-ffor-scope \-fno-for-scope \-fno-gnu-keywords
+\&\-fno-implicit-templates
+\&\-fno-implicit-inline-templates
+\&\-fno-implement-inlines
+\&\-findirect-virtual-calls (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-fapple-kext (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-fcoalesce-templates (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-fms-extensions
+\&\-fno-nonansi-builtins \-fno-operator-names
+\&\-fno-optional-diags \-fpermissive
+\&\-frepo \-fno-rtti \-fstats \-ftemplate-depth-\fR\fIn\fR
+\&\fB\-fuse-cxa-atexit \-fvtable-gc \-fno-weak \-nostdinc++
+\&\-fno-default-inline \-Wctor-dtor-privacy
+\&\-Wnon-virtual-dtor \-Wreorder
+\&\-Weffc++ \-Wno-deprecated
+\&\-Wno-non-template-friend \-Wold-style-cast
+\&\-Woverloaded-virtual \-Wno-pmf-conversions
+\&\-Wsign-promo \-Wsynth\fR
+.Ip "\fIObjective-C Language Options\fR" 4
+.IX Item "Objective-C Language Options"
+\&\fB\-fconstant-string-class=\fR\fIclass-name\fR
+\&\fB\-fgnu-runtime \-fnext-runtime \-gen-decls
+\&\-Wno-protocol \-Wselector\fR
+.Ip "\fILanguage Independent Options\fR" 4
+.IX Item "Language Independent Options"
+\&\fB\-fmessage-length=\fR\fIn\fR
+\&\fB\-fdiagnostics-show-location=\fR[\fBonce\fR|\fBevery-line\fR]
+.Ip "\fIWarning Options\fR" 4
+.IX Item "Warning Options"
+\&\fB\-fsyntax-only \-pedantic \-pedantic-errors
+\&\-w \-W \-Wall \-Waggregate-return
+\&\-Wcast-align \-Wcast-qual \-Wchar-subscripts \-Wcomment
+\&\-Wconversion \-Wno-deprecated-declarations
+\&\-Wdisabled-optimization \-Wdiv-by-zero \-Werror
+\&\-Wfloat-equal \-Wformat \-Wformat=2
+\&\-Wformat-nonliteral \-Wformat-security
+\&\-Wimplicit \-Wimplicit-int
+\&\-Wimplicit-function-declaration
+\&\-Werror-implicit-function-declaration
+\&\-Wimport \-Winline
+\&\-Wlarger-than-\fR\fIlen\fR
+\&\fB\-Wno-long-double (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-Wlong-long
+\&\-Wmain \-Wmissing-braces \-Wmissing-declarations
+\&\-Wmissing-format-attribute \-Wmissing-noreturn
+\&\-Wmost (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-Wmultichar \-Wno-format-extra-args \-Wno-format-y2k
+\&\-Wno-import \-Wpacked \-Wpadded
+\&\-Wparentheses \-Wpointer-arith \-Wredundant-decls
+\&\-Wreturn-type \-Wsequence-point \-Wshadow
+\&\-Wsign-compare \-Wswitch \-Wsystem-headers
+\&\-Wtrigraphs \-Wundef \-Wuninitialized
+\&\-Wunknown-pragmas \-Wunreachable-code
+\&\-Wunused \-Wunused-function \-Wunused-label \-Wunused-parameter
+\&\-Wunused-value \-Wunused-variable \-Wwrite-strings\fR
+.Ip "\fIC-only Warning Options\fR" 4
+.IX Item "C-only Warning Options"
+\&\fB\-Wbad-function-cast \-Wmissing-prototypes \-Wnested-externs
+\&\-Wstrict-prototypes \-Wtraditional\fR
+.Ip "\fIDebugging Options\fR" 4
+.IX Item "Debugging Options"
+\&\fB\-d\fR\fIletters\fR \fB\-dumpspecs \-dumpmachine \-dumpversion
+\&\-fdump-unnumbered \-fdump-translation-unit\fR[\fB-\fR\fIn\fR]
+\&\fB\-fdump-class-hierarchy\fR[\fB-\fR\fIn\fR]
+\&\fB\-fdump-tree-original\fR[\fB-\fR\fIn\fR] \fB\-fdump-tree-optimized\fR[\fB-\fR\fIn\fR]
+\&\fB\-fdump-tree-inlined\fR[\fB-\fR\fIn\fR]
+\&\fB\-fmem-report \-fpretend-float
+\&\-fprofile-arcs \-ftest-coverage \-ftime-report
+\&\-g \-g\fR\fIlevel\fR \fB\-gcoff \-gdwarf \-gdwarf-1 \-gdwarf-1+ \-gdwarf-2
+\&\-ggdb \-gstabs \-gstabs+ \-gvms \-gxcoff \-gxcoff+
+\&\-p \-pg \-print-file-name=\fR\fIlibrary\fR \fB\-print-libgcc-file-name
+\&\-print-multi-directory \-print-multi-lib
+\&\-print-prog-name=\fR\fIprogram\fR \fB\-print-search-dirs \-Q
+\&\-save-temps \-time\fR
+.Ip "\fIOptimization Options\fR" 4
+.IX Item "Optimization Options"
+\&\fB\-falign-functions=\fR\fIn\fR \fB\-falign-jumps=\fR\fIn\fR
+\&\fB\-falign-labels=\fR\fIn\fR \fB\-falign-loops=\fR\fIn\fR
+\&\fB\-fbranch-probabilities \-fcaller-saves \-fcprop-registers
+\&\-fcse-follow-jumps \-fcse-skip-blocks \-fdata-sections
+\&\-fdelayed-branch \-fdelete-null-pointer-checks
+\&\-fexpensive-optimizations \-ffast-math \-ffloat-store
+\&\-fforce-addr \-fforce-mem \-ffunction-sections
+\&\-fgcse \-fgcse-lm \-fgcse-sm
+\&\-finline-functions \-finline-limit=\fR\fIn\fR \fB\-fkeep-inline-functions
+\&\-fkeep-static-consts \-fmerge-constants \-fmerge-all-constants
+\&\-fmove-all-movables \-fno-default-inline \-fno-defer-pop
+\&\-fno-function-cse \-fno-guess-branch-probability
+\&\-fno-inline \-fno-math-errno \-fno-peephole \-fno-peephole2
+\&\-funsafe-math-optimizations \-fno-trapping-math
+\&\-fomit-frame-pointer \-foptimize-register-move
+\&\-foptimize-sibling-calls \-fprefetch-loop-arrays
+\&\-freduce-all-givs \-fregmove \-frename-registers
+\&\-frerun-cse-after-loop \-frerun-loop-opt
+\&\-fschedule-insns \-fschedule-insns2
+\&\-fsingle-precision-constant \-fssa \-fssa-ccp \-fssa-dce
+\&\-fstrength-reduce \-fstrict-aliasing \-fthread-jumps \-ftrapv
+\&\-funroll-all-loops \-funroll-loops
+\&\-\-param\fR \fIname\fR\fB=\fR\fIvalue\fR
+\&\fB\-O \-O0 \-O1 \-O2 \-O3 \-Os\fR
+.Ip "\fIPreprocessor Options\fR" 4
+.IX Item "Preprocessor Options"
+\&\fB\-$ \-A\fR\fIquestion\fR\fB=\fR\fIanswer\fR \fB\-A-\fR\fIquestion\fR[\fB=\fR\fIanswer\fR]
+\&\fB\-C \-dD \-dI \-dM \-dN
+\&\-D\fR\fImacro\fR[\fB=\fR\fIdefn\fR] \fB\-E \-H
+\&\-idirafter\fR \fIdir\fR
+\&\fB\-include\fR \fIfile\fR \fB\-imacros\fR \fIfile\fR
+\&\fB\-iprefix\fR \fIfile\fR \fB\-iwithprefix\fR \fIdir\fR
+\&\fB\-iwithprefixbefore\fR \fIdir\fR \fB\-isystem\fR \fIdir\fR
+\&\fB\-M \-MM \-MF \-MG \-MP \-MQ \-MT \-nostdinc \-P \-remap
+\&\-dependency-file (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-\-dump-pch\fR \fIname\fR \fB(\s-1APPLE\s0 \s-1ONLY\s0) \-\-load-pch\fR \fIname\fR \fB(\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-trigraphs \-undef \-U\fR\fImacro\fR \fB\-Wp,\fR\fIoption\fR
+.Ip "\fIAssembler Option\fR" 4
+.IX Item "Assembler Option"
+\&\fB\-Wa,\fR\fIoption\fR
+.Ip "\fILinker Options\fR" 4
+.IX Item "Linker Options"
+\&\fB
+\&\fR\fIobject-file-name\fR \fB\-l\fR\fIlibrary\fR
+\&\fB\-nostartfiles \-nodefaultlibs \-nostdlib \-no-c++filt (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-s \-static \-static-libgcc \-shared \-shared-libgcc \-symbolic
+\&\-Wl,\fR\fIoption\fR \fB\-Xlinker\fR \fIoption\fR
+\&\fB\-u\fR \fIsymbol\fR
+.Ip "\fIDirectory Options\fR" 4
+.IX Item "Directory Options"
+\&\fB\-B\fR\fIprefix\fR \fB\-I\fR\fIdir\fR \fB\-I-
+\&\-F\fR\fIdir\fR \fB(\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-L\fR\fIdir\fR \fB\-specs=\fR\fIfile\fR
+.Ip "\fITarget Options\fR" 4
+.IX Item "Target Options"
+\&\fB\-b\fR \fImachine\fR \fB\-V\fR \fIversion\fR
+.Ip "\fIMachine Dependent Options\fR" 4
+.IX Item "Machine Dependent Options"
+\&\fI\s-1RS/6000\s0 and PowerPC Options\fR
+.Sp
+\&\fB\-mcpu=\fR\fIcpu-type\fR
+\&\fB\-mtune=\fR\fIcpu-type\fR
+\&\fB\-mpower \-mno-power \-mpower2 \-mno-power2
+\&\-mpowerpc \-mpowerpc64 \-mno-powerpc
+\&\-maltivec \-mno-altivec
+\&\-mpowerpc-gpopt \-mno-powerpc-gpopt
+\&\-mpowerpc-gfxopt \-mno-powerpc-gfxopt
+\&\-mnew-mnemonics \-mold-mnemonics
+\&\-mfull-toc \-mminimal-toc \-mno-fp-in-toc \-mno-sum-in-toc
+\&\-m64 \-m32 \-mxl-call \-mno-xl-call \-mpe
+\&\-malign-mac68k (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-malign-power (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-malign-natural (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-msoft-float \-mhard-float \-mmultiple \-mno-multiple
+\&\-mstring \-mno-string \-mupdate \-mno-update
+\&\-mfused-madd \-mno-fused-madd \-mbit-align \-mno-bit-align
+\&\-mstrict-align \-mno-strict-align \-mrelocatable
+\&\-mno-relocatable \-mrelocatable-lib \-mno-relocatable-lib
+\&\-mtoc \-mno-toc \-mlittle \-mlittle-endian \-mbig \-mbig-endian
+\&\-mdynamic-no-pic (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-mlong-branch (\s-1APPLE\s0 \s-1ONLY\s0)
+\&\-mcall-aix \-mcall-sysv \-mcall-netbsd
+\&\-maix-struct-return \-msvr4\-struct-return
+\&\-mabi=altivec \-mabi=no-altivec
+\&\-mprototype \-mno-prototype
+\&\-msim \-mmvme \-mads \-myellowknife \-memb \-msdata
+\&\-msdata=\fR\fIopt\fR \fB\-mvxworks \-G\fR \fInum\fR \fB\-pthread\fR
+.Sp
+\&\fIi386 and x86\-64 Options\fR
+.Sp
+\&\fB\-mcpu=\fR\fIcpu-type\fR \fB\-march=\fR\fIcpu-type\fR \fB\-mfpmath=\fR\fIunit\fR
+\&\fB\-masm=\fR\fIdialect\fR \fB\-mno-fancy-math-387
+\&\-mno-fp-ret-in-387 \-msoft-float \-msvr3\-shlib
+\&\-mno-wide-multiply \-mrtd \-malign-double
+\&\-mpreferred-stack-boundary=\fR\fInum\fR
+\&\fB\-mmmx \-msse \-msse2 \-msse-math \-m3dnow
+\&\-mthreads \-mno-align-stringops \-minline-all-stringops
+\&\-mpush-args \-maccumulate-outgoing-args \-m128bit-long-double
+\&\-m96bit-long-double \-mregparm=\fR\fInum\fR \fB\-momit-leaf-frame-pointer
+\&\-mno-red-zone
+\&\-m32 \-m64\fR
+.Ip "\fICode Generation Options\fR" 4
+.IX Item "Code Generation Options"
+\&\fB\-fcall-saved-\fR\fIreg\fR \fB\-fcall-used-\fR\fIreg\fR
+\&\fB\-ffixed-\fR\fIreg\fR \fB\-fexceptions
+\&\-fnon-call-exceptions \-funwind-tables
+\&\-fasynchronous-unwind-tables
+\&\-finhibit-size-directive \-finstrument-functions
+\&\-fno-common \-fno-ident \-fno-gnu-linker
+\&\-fpcc-struct-return \-fpic \-fPIC
+\&\-freg-struct-return \-fshared-data \-fshort-enums
+\&\-fshort-double \-fvolatile
+\&\-fvolatile-global \-fvolatile-static
+\&\-fverbose-asm \-fpack-struct \-fstack-check
+\&\-fstack-limit-register=\fR\fIreg\fR \fB\-fstack-limit-symbol=\fR\fIsym\fR
+\&\fB\-fargument-alias \-fargument-noalias
+\&\-fargument-noalias-global \-fleading-underscore\fR
+.Sh "Options Controlling the Kind of Output"
+.IX Subsection "Options Controlling the Kind of Output"
+Compilation can involve up to four stages: preprocessing, compilation
+proper, assembly and linking, always in that order. The first three
+stages apply to an individual source file, and end by producing an
+object file; linking combines all the object files (those newly
+compiled, and those specified as input) into an executable file.
+.PP
+For any given input file, the file name suffix determines what kind of
+compilation is done:
+.Ip "\fIfile\fR\fB.c\fR" 4
+.IX Item "file.c"
+C source code which must be preprocessed.
+.Ip "\fIfile\fR\fB.i\fR" 4
+.IX Item "file.i"
+C source code which should not be preprocessed.
+.Ip "\fIfile\fR\fB.ii\fR" 4
+.IX Item "file.ii"
+\&\*(C+ source code which should not be preprocessed.
+.Ip "\fIfile\fR\fB.m\fR" 4
+.IX Item "file.m"
+Objective-C source code. Note that you must link with the library
+\&\fIlibobjc.a\fR to make an Objective-C program work.
+.Ip "\fIfile\fR\fB.mi\fR" 4
+.IX Item "file.mi"
+Objective-C source code which should not be preprocessed.
+.Ip "\fIfile\fR\fB.h\fR" 4
+.IX Item "file.h"
+C header file (not to be compiled or linked).
+.Ip "\fIfile\fR\fB.cc\fR" 4
+.IX Item "file.cc"
+.PD 0
+.Ip "\fIfile\fR\fB.cp\fR" 4
+.IX Item "file.cp"
+.Ip "\fIfile\fR\fB.cxx\fR" 4
+.IX Item "file.cxx"
+.Ip "\fIfile\fR\fB.cpp\fR" 4
+.IX Item "file.cpp"
+.Ip "\fIfile\fR\fB.c++\fR" 4
+.IX Item "file.c++"
+.Ip "\fIfile\fR\fB.C\fR" 4
+.IX Item "file.C"
+.PD
+\&\*(C+ source code which must be preprocessed. Note that in \fB.cxx\fR,
+the last two letters must both be literally \fBx\fR. Likewise,
+\&\fB.C\fR refers to a literal capital C.
+.Ip "\fIfile\fR\fB.mm\fR" 4
+.IX Item "file.mm"
+.PD 0
+.Ip "\fIfile\fR\fB.M\fR" 4
+.IX Item "file.M"
+.PD
+Objective-\*(C+ source code which must be preprocessed. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fIfile\fR\fB.mii\fR" 4
+.IX Item "file.mii"
+Objective-\*(C+ source code which should not be preprocessed. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fIfile\fR\fB.f\fR" 4
+.IX Item "file.f"
+.PD 0
+.Ip "\fIfile\fR\fB.for\fR" 4
+.IX Item "file.for"
+.Ip "\fIfile\fR\fB.FOR\fR" 4
+.IX Item "file.FOR"
+.PD
+Fortran source code which should not be preprocessed.
+.Ip "\fIfile\fR\fB.F\fR" 4
+.IX Item "file.F"
+.PD 0
+.Ip "\fIfile\fR\fB.fpp\fR" 4
+.IX Item "file.fpp"
+.Ip "\fIfile\fR\fB.FPP\fR" 4
+.IX Item "file.FPP"
+.PD
+Fortran source code which must be preprocessed (with the traditional
+preprocessor).
+.Ip "\fIfile\fR\fB.r\fR" 4
+.IX Item "file.r"
+Fortran source code which must be preprocessed with a \s-1RATFOR\s0
+preprocessor (not included with \s-1GCC\s0).
+.Ip "\fIfile\fR\fB.ads\fR" 4
+.IX Item "file.ads"
+Ada source code file which contains a library unit declaration (a
+declaration of a package, subprogram, or generic, or a generic
+instantiation), or a library unit renaming declaration (a package,
+generic, or subprogram renaming declaration). Such files are also
+called \fIspecs\fR.
+.Ip "\fIfile\fR\fB.adb\fR" 4
+.IX Item "file.adb"
+Ada source code file containing a library unit body (a subprogram or
+package body). Such files are also called \fIbodies\fR.
+.Ip "\fIfile\fR\fB.s\fR" 4
+.IX Item "file.s"
+Assembler code. Apple's version of \s-1GCC\s0 runs the preprocessor
+on these files as well as those ending in \fB.S\fR.
+.Ip "\fIfile\fR\fB.S\fR" 4
+.IX Item "file.S"
+Assembler code which must be preprocessed.
+.Ip "\fIother\fR" 4
+.IX Item "other"
+An object file to be fed straight into linking.
+Any file name with no recognized suffix is treated this way.
+.PP
+You can specify the input language explicitly with the \fB\-x\fR option:
+.Ip "\fB\-x\fR \fIlanguage\fR" 4
+.IX Item "-x language"
+Specify explicitly the \fIlanguage\fR for the following input files
+(rather than letting the compiler choose a default based on the file
+name suffix). This option applies to all following input files until
+the next \fB\-x\fR option. Possible values for \fIlanguage\fR are:
+.Sp
+.Vb 8
+\& c c-header cpp-output
+\& c++ c++-cpp-output
+\& objective-c objc-cpp-output
+\& objective-c++ (APPLE ONLY)
+\& assembler assembler-with-cpp
+\& ada
+\& f77 f77-cpp-input ratfor
+\& java
+.Ve
+.Ip "\fB\-x none\fR" 4
+.IX Item "-x none"
+Turn off any specification of a language, so that subsequent files are
+handled according to their file name suffixes (as they are if \fB\-x\fR
+has not been used at all).
+.Ip "\fB\-ObjC\fR" 4
+.IX Item "-ObjC"
+.PD 0
+.Ip "\fB\-ObjC++\fR" 4
+.IX Item "-ObjC++"
+.PD
+These are similar in effect to \fB\-x objective-c\fR and \fB\-x
+objective-c++\fR, but affect only the choice of compiler for files already
+identified as source files. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-arch\fR \fIarch\fR" 4
+.IX Item "-arch arch"
+Compile for the specified target architecture \fIarch\fR. The allowable
+values are \fBi386\fR and \fBppc\fR. Multiple options work, and
+direct the compiler to produce ``fat'' binaries including object code
+for each architecture specified with \fB\-arch\fR. This option only
+works if assembler and libraries are available for each architecture
+specified. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-pass-exit-codes\fR" 4
+.IX Item "-pass-exit-codes"
+Normally the \fBgcc\fR program will exit with the code of 1 if any
+phase of the compiler returns a non-success return code. If you specify
+\&\fB\-pass-exit-codes\fR, the \fBgcc\fR program will instead return with
+numerically highest error produced by any phase that returned an error
+indication.
+.PP
+If you only want some of the stages of compilation, you can use
+\&\fB\-x\fR (or filename suffixes) to tell \fBgcc\fR where to start, and
+one of the options \fB\-c\fR, \fB\-S\fR, or \fB\-E\fR to say where
+\&\fBgcc\fR is to stop. Note that some combinations (for example,
+\&\fB\-x cpp-output \-E\fR) instruct \fBgcc\fR to do nothing at all.
+.Ip "\fB\-c\fR" 4
+.IX Item "-c"
+Compile or assemble the source files, but do not link. The linking
+stage simply is not done. The ultimate output is in the form of an
+object file for each source file.
+.Sp
+By default, the object file name for a source file is made by replacing
+the suffix \fB.c\fR, \fB.i\fR, \fB.s\fR, etc., with \fB.o\fR.
+.Sp
+Unrecognized input files, not requiring compilation or assembly, are
+ignored.
+.Ip "\fB\-S\fR" 4
+.IX Item "-S"
+Stop after the stage of compilation proper; do not assemble. The output
+is in the form of an assembler code file for each non-assembler input
+file specified.
+.Sp
+By default, the assembler file name for a source file is made by
+replacing the suffix \fB.c\fR, \fB.i\fR, etc., with \fB.s\fR.
+.Sp
+Input files that don't require compilation are ignored.
+.Ip "\fB\-E\fR" 4
+.IX Item "-E"
+Stop after the preprocessing stage; do not run the compiler proper. The
+output is in the form of preprocessed source code, which is sent to the
+standard output.
+.Sp
+Input files which don't require preprocessing are ignored.
+.Ip "\fB\-o\fR \fIfile\fR" 4
+.IX Item "-o file"
+Place output in file \fIfile\fR. This applies regardless to whatever
+sort of output is being produced, whether it be an executable file,
+an object file, an assembler file or preprocessed C code.
+.Sp
+Since only one output file can be specified, it does not make sense to
+use \fB\-o\fR when compiling more than one input file, unless you are
+producing an executable file as output.
+.Sp
+If \fB\-o\fR is not specified, the default is to put an executable file
+in \fIa.out\fR, the object file for \fI\fIsource\fI.\fIsuffix\fI\fR in
+\&\fI\fIsource\fI.o\fR, its assembler file in \fI\fIsource\fI.s\fR, and
+all preprocessed C source on standard output.
+.Ip "\fB\-v\fR" 4
+.IX Item "-v"
+Print (on standard error output) the commands executed to run the stages
+of compilation. Also print the version number of the compiler driver
+program and of the preprocessor and the compiler proper.
+.Ip "\fB\-###\fR" 4
+.IX Item "-###"
+Like \fB\-v\fR except the commands are not executed and all command
+arguments are quoted. This is useful for shell scripts to capture the
+driver-generated command lines.
+.Ip "\fB\-pipe\fR" 4
+.IX Item "-pipe"
+Use pipes rather than temporary files for communication between the
+various stages of compilation. This fails to work on some systems where
+the assembler is unable to read from a pipe; but the \s-1GNU\s0 assembler has
+no trouble.
+.Ip "\fB\*(--help\fR" 4
+.IX Item "help"
+Print (on the standard output) a description of the command line options
+understood by \fBgcc\fR. If the \fB\-v\fR option is also specified
+then \fB\*(--help\fR will also be passed on to the various processes
+invoked by \fBgcc\fR, so that they can display the command line options
+they accept. If the \fB\-W\fR option is also specified then command
+line options which have no documentation associated with them will also
+be displayed.
+.Ip "\fB\*(--target-help\fR" 4
+.IX Item "target-help"
+Print (on the standard output) a description of target specific command
+line options for each tool.
+.Sh "Compiling \*(C+ Programs"
+.IX Subsection "Compiling Programs"
+\&\*(C+ source files conventionally use one of the suffixes \fB.C\fR,
+\&\fB.cc\fR, \fB.cpp\fR, \fB.c++\fR, \fB.cp\fR, or \fB.cxx\fR;
+preprocessed \*(C+ files use the suffix \fB.ii\fR. \s-1GCC\s0 recognizes
+files with these names and compiles them as \*(C+ programs even if you
+call the compiler the same way as for compiling C programs (usually with
+the name \fBgcc\fR).
+.PP
+However, \*(C+ programs often require class libraries as well as a
+compiler that understands the \*(C+ language\-\-\-and under some
+circumstances, you might want to compile programs from standard input,
+or otherwise without a suffix that flags them as \*(C+ programs.
+\&\fBg++\fR is a program that calls \s-1GCC\s0 with the default language
+set to \*(C+, and automatically specifies linking against the \*(C+
+library. On many systems, \fBg++\fR is also
+installed with the name \fBc++\fR.
+.PP
+When you compile \*(C+ programs, you may specify many of the same
+command-line options that you use for compiling programs in any
+language; or command-line options meaningful for C and related
+languages; or options that are meaningful only for \*(C+ programs.
+.Sh "Options Controlling C Dialect"
+.IX Subsection "Options Controlling C Dialect"
+The following options control the dialect of C (or languages derived
+from C, such as \*(C+ and Objective-C) that the compiler accepts:
+.Ip "\fB\-ansi\fR" 4
+.IX Item "-ansi"
+In C mode, support all \s-1ISO\s0 C89 programs. In \*(C+ mode,
+remove \s-1GNU\s0 extensions that conflict with \s-1ISO\s0 \*(C+.
+.Sp
+This turns off certain features of \s-1GCC\s0 that are incompatible with \s-1ISO\s0
+C89 (when compiling C code), or of standard \*(C+ (when compiling \*(C+ code),
+such as the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, and
+predefined macros such as \f(CW\*(C`unix\*(C'\fR and \f(CW\*(C`vax\*(C'\fR that identify the
+type of system you are using. It also enables the undesirable and
+rarely used \s-1ISO\s0 trigraph feature. For the C compiler,
+it disables recognition of \*(C+ style \fB//\fR comments as well as
+the \f(CW\*(C`inline\*(C'\fR keyword.
+.Sp
+The alternate keywords \f(CW\*(C`_\|_asm_\|_\*(C'\fR, \f(CW\*(C`_\|_extension_\|_\*(C'\fR,
+\&\f(CW\*(C`_\|_inline_\|_\*(C'\fR and \f(CW\*(C`_\|_typeof_\|_\*(C'\fR continue to work despite
+\&\fB\-ansi\fR. You would not want to use them in an \s-1ISO\s0 C program, of
+course, but it is useful to put them in header files that might be included
+in compilations done with \fB\-ansi\fR. Alternate predefined macros
+such as \f(CW\*(C`_\|_unix_\|_\*(C'\fR and \f(CW\*(C`_\|_vax_\|_\*(C'\fR are also available, with or
+without \fB\-ansi\fR.
+.Sp
+The \fB\-ansi\fR option does not cause non-ISO programs to be
+rejected gratuitously. For that, \fB\-pedantic\fR is required in
+addition to \fB\-ansi\fR.
+.Sp
+The macro \f(CW\*(C`_\|_STRICT_ANSI_\|_\*(C'\fR is predefined when the \fB\-ansi\fR
+option is used. Some header files may notice this macro and refrain
+from declaring certain functions or defining certain macros that the
+\&\s-1ISO\s0 standard doesn't call for; this is to avoid interfering with any
+programs that might use these names for other things.
+.Sp
+Functions which would normally be built in but do not have semantics
+defined by \s-1ISO\s0 C (such as \f(CW\*(C`alloca\*(C'\fR and \f(CW\*(C`ffs\*(C'\fR) are not built-in
+functions with \fB\-ansi\fR is used.
+.Ip "\fB\-std=\fR" 4
+.IX Item "-std="
+Determine the language standard. This option is currently only
+supported when compiling C. A value for this option must be provided;
+possible values are
+.RS 4
+.Ip "\fBc89\fR" 4
+.IX Item "c89"
+.PD 0
+.Ip "\fBiso9899:1990\fR" 4
+.IX Item "iso9899:1990"
+.PD
+\&\s-1ISO\s0 C89 (same as \fB\-ansi\fR).
+.Ip "\fBiso9899:199409\fR" 4
+.IX Item "iso9899:199409"
+\&\s-1ISO\s0 C89 as modified in amendment 1.
+.Ip "\fBc99\fR" 4
+.IX Item "c99"
+.PD 0
+.Ip "\fBc9x\fR" 4
+.IX Item "c9x"
+.Ip "\fBiso9899:1999\fR" 4
+.IX Item "iso9899:1999"
+.Ip "\fBiso9899:199x\fR" 4
+.IX Item "iso9899:199x"
+.PD
+\&\s-1ISO\s0 C99. Note that this standard is not yet fully supported; see
+<\fBhttp://gcc.gnu.org/gcc-3.1/c99status.html\fR> for more information. The
+names \fBc9x\fR and \fBiso9899:199x\fR are deprecated.
+.Ip "\fBgnu89\fR" 4
+.IX Item "gnu89"
+Default, \s-1ISO\s0 C89 plus \s-1GNU\s0 extensions (including some C99 features).
+.Ip "\fBgnu99\fR" 4
+.IX Item "gnu99"
+.PD 0
+.Ip "\fBgnu9x\fR" 4
+.IX Item "gnu9x"
+.PD
+\&\s-1ISO\s0 C99 plus \s-1GNU\s0 extensions. When \s-1ISO\s0 C99 is fully implemented in \s-1GCC\s0,
+this will become the default. The name \fBgnu9x\fR is deprecated.
+.RE
+.RS 4
+.Sp
+Even when this option is not specified, you can still use some of the
+features of newer standards in so far as they do not conflict with
+previous C standards. For example, you may use \f(CW\*(C`_\|_restrict_\|_\*(C'\fR even
+when \fB\-std=c99\fR is not specified.
+.Sp
+The \fB\-std\fR options specifying some version of \s-1ISO\s0 C have the same
+effects as \fB\-ansi\fR, except that features that were not in \s-1ISO\s0 C89
+but are in the specified version (for example, \fB//\fR comments and
+the \f(CW\*(C`inline\*(C'\fR keyword in \s-1ISO\s0 C99) are not disabled.
+.RE
+.Ip "\fB\-aux-info\fR \fIfilename\fR" 4
+.IX Item "-aux-info filename"
+Output to the given filename prototyped declarations for all functions
+declared and/or defined in a translation unit, including those in header
+files. This option is silently ignored in any language other than C.
+.Sp
+Besides declarations, the file indicates, in comments, the origin of
+each declaration (source file and line), whether the declaration was
+implicit, prototyped or unprototyped (\fBI\fR, \fBN\fR for new or
+\&\fBO\fR for old, respectively, in the first character after the line
+number and the colon), and whether it came from a declaration or a
+definition (\fBC\fR or \fBF\fR, respectively, in the following
+character). In the case of function definitions, a K&R-style list of
+arguments followed by their declarations is also provided, inside
+comments, after the declaration.
+.Ip "\fB\-faltivec\fR" 4
+.IX Item "-faltivec"
+Enable the AltiVec language extensions, as defined in Motorola's AltiVec
+\&\s-1PIM\s0. This includes the recognition of \f(CW\*(C`vector\*(C'\fR and \f(CW\*(C`pixel\*(C'\fR as
+(context-dependent) keywords, the definition of built-in functions such
+as \f(CW\*(C`vec_add\*(C'\fR, and other extensions. Note that unlike the option
+\&\fB\-maltivec\fR, the extensions do not require the inclusion of any
+special header files. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-fno-asm\fR" 4
+.IX Item "-fno-asm"
+Do not recognize \f(CW\*(C`asm\*(C'\fR, \f(CW\*(C`inline\*(C'\fR or \f(CW\*(C`typeof\*(C'\fR as a
+keyword, so that code can use these words as identifiers. You can use
+the keywords \f(CW\*(C`_\|_asm_\|_\*(C'\fR, \f(CW\*(C`_\|_inline_\|_\*(C'\fR and \f(CW\*(C`_\|_typeof_\|_\*(C'\fR
+instead. \fB\-ansi\fR implies \fB\-fno-asm\fR.
+.Sp
+In \*(C+, this switch only affects the \f(CW\*(C`typeof\*(C'\fR keyword, since
+\&\f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`inline\*(C'\fR are standard keywords. You may want to
+use the \fB\-fno-gnu-keywords\fR flag instead, which has the same
+effect. In C99 mode (\fB\-std=c99\fR or \fB\-std=gnu99\fR), this
+switch only affects the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, since
+\&\f(CW\*(C`inline\*(C'\fR is a standard keyword in \s-1ISO\s0 C99.
+.Ip "\fB\-fno-builtin\fR" 4
+.IX Item "-fno-builtin"
+.PD 0
+.Ip "\fB\-fno-builtin-\fR\fIfunction\fR\fB \fR(C and Objective-C only)" 4
+.IX Item "-fno-builtin-function (C and Objective-C only)"
+.PD
+Don't recognize built-in functions that do not begin with
+\&\fB_\|_builtin_\fR as prefix.
+.Sp
+\&\s-1GCC\s0 normally generates special code to handle certain built-in functions
+more efficiently; for instance, calls to \f(CW\*(C`alloca\*(C'\fR may become single
+instructions that adjust the stack directly, and calls to \f(CW\*(C`memcpy\*(C'\fR
+may become inline copy loops. The resulting code is often both smaller
+and faster, but since the function calls no longer appear as such, you
+cannot set a breakpoint on those calls, nor can you change the behavior
+of the functions by linking with a different library.
+.Sp
+In \*(C+, \fB\-fno-builtin\fR is always in effect. The \fB\-fbuiltin\fR
+option has no effect. Therefore, in \*(C+, the only way to get the
+optimization benefits of built-in functions is to call the function
+using the \fB_\|_builtin_\fR prefix. The \s-1GNU\s0 \*(C+ Standard Library uses
+built-in functions to implement many functions (like
+\&\f(CW\*(C`std::strchr\*(C'\fR), so that you automatically get efficient code.
+.Sp
+With the \fB\-fno-builtin-\fR\fIfunction\fR option, not available
+when compiling \*(C+, only the built-in function \fIfunction\fR is
+disabled. \fIfunction\fR must not begin with \fB_\|_builtin_\fR. If a
+function is named this is not built-in in this version of \s-1GCC\s0, this
+option is ignored. There is no corresponding
+\&\fB\-fbuiltin-\fR\fIfunction\fR option; if you wish to enable
+built-in functions selectively when using \fB\-fno-builtin\fR or
+\&\fB\-ffreestanding\fR, you may define macros such as:
+.Sp
+.Vb 2
+\& #define abs(n) __builtin_abs ((n))
+\& #define strcpy(d, s) __builtin_strcpy ((d), (s))
+.Ve
+.Ip "\fB\-fhosted\fR" 4
+.IX Item "-fhosted"
+Assert that compilation takes place in a hosted environment. This implies
+\&\fB\-fbuiltin\fR. A hosted environment is one in which the
+entire standard library is available, and in which \f(CW\*(C`main\*(C'\fR has a return
+type of \f(CW\*(C`int\*(C'\fR. Examples are nearly everything except a kernel.
+This is equivalent to \fB\-fno-freestanding\fR.
+.Ip "\fB\-ffreestanding\fR" 4
+.IX Item "-ffreestanding"
+Assert that compilation takes place in a freestanding environment. This
+implies \fB\-fno-builtin\fR. A freestanding environment
+is one in which the standard library may not exist, and program startup may
+not necessarily be at \f(CW\*(C`main\*(C'\fR. The most obvious example is an \s-1OS\s0 kernel.
+This is equivalent to \fB\-fno-hosted\fR.
+.Ip "\fB\-trigraphs\fR" 4
+.IX Item "-trigraphs"
+Support \s-1ISO\s0 C trigraphs. The \fB\-ansi\fR option (and \fB\-std\fR
+options for strict \s-1ISO\s0 C conformance) implies \fB\-trigraphs\fR.
+.Ip "\fB\-no-integrated-cpp\fR" 4
+.IX Item "-no-integrated-cpp"
+Invoke the external cpp during compilation. The default is to use the
+integrated cpp (internal cpp). This option also allows a
+user-supplied cpp via the \fB\-B\fR option. This flag is applicable
+in both C and \*(C+ modes.
+.Sp
+We do not guarantee to retain this option in future, and we may change
+its semantics.
+.Ip "\fB\*(--dump-pch\fR \fIname\fR" 4
+.IX Item "dump-pch name"
+Dump the state of the compiler into a directory named \fIname\fR, after
+processing all the other arguments. This is useful for creating
+precompiled headers. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\*(--load-pch\fR \fIname\fR" 4
+.IX Item "load-pch name"
+Restore the state of the compiler from the directory \fIname\fR before
+processing the other arguments. The net effect is similar to
+\&\fB\-include\fR, but it happens much more quickly. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Sp
+So for instance if the file \fImyprefix.c\fR #includes various
+headers that are useful to all files in your program, you can do
+.Sp
+.Vb 5
+\& gcc --dump-pch foo -c myprefix.c
+\& gcc --load-pch foo myfile1.c
+\& gcc --load-pch foo myfile2.c
+\& gcc --load-pch foo myfile2.c
+\& ...
+.Ve
+.Ip "\fB\-traditional\fR" 4
+.IX Item "-traditional"
+Attempt to support some aspects of traditional C compilers.
+Specifically:
+.RS 4
+.Ip "\(bu" 4
+All \f(CW\*(C`extern\*(C'\fR declarations take effect globally even if they
+are written inside of a function definition. This includes implicit
+declarations of functions.
+.Ip "\(bu" 4
+The newer keywords \f(CW\*(C`typeof\*(C'\fR, \f(CW\*(C`inline\*(C'\fR, \f(CW\*(C`signed\*(C'\fR, \f(CW\*(C`const\*(C'\fR
+and \f(CW\*(C`volatile\*(C'\fR are not recognized. (You can still use the
+alternative keywords such as \f(CW\*(C`_\|_typeof_\|_\*(C'\fR, \f(CW\*(C`_\|_inline_\|_\*(C'\fR, and
+so on.)
+.Ip "\(bu" 4
+Comparisons between pointers and integers are always allowed.
+.Ip "\(bu" 4
+Integer types \f(CW\*(C`unsigned short\*(C'\fR and \f(CW\*(C`unsigned char\*(C'\fR promote
+to \f(CW\*(C`unsigned int\*(C'\fR.
+.Ip "\(bu" 4
+Out-of-range floating point literals are not an error.
+.Ip "\(bu" 4
+Certain constructs which \s-1ISO\s0 regards as a single invalid preprocessing
+number, such as \fB0xe-0xd\fR, are treated as expressions instead.
+.Ip "\(bu" 4
+String ``constants'' are not necessarily constant; they are stored in
+writable space, and identical looking constants are allocated
+separately. (This is the same as the effect of
+\&\fB\-fwritable-strings\fR.)
+.Ip "\(bu" 4
+All automatic variables not declared \f(CW\*(C`register\*(C'\fR are preserved by
+\&\f(CW\*(C`longjmp\*(C'\fR. Ordinarily, \s-1GNU\s0 C follows \s-1ISO\s0 C: automatic variables
+not declared \f(CW\*(C`volatile\*(C'\fR may be clobbered.
+.Ip "\(bu" 4
+The character escape sequences \fB\ex\fR and \fB\ea\fR evaluate as the
+literal characters \fBx\fR and \fBa\fR respectively. Without
+\&\fB\-traditional\fR, \fB\ex\fR is a prefix for the hexadecimal
+representation of a character, and \fB\ea\fR produces a bell.
+.RE
+.RS 4
+.Sp
+This option is deprecated and may be removed.
+.Sp
+You may wish to use \fB\-fno-builtin\fR as well as \fB\-traditional\fR
+if your program uses names that are normally \s-1GNU\s0 C built-in functions for
+other purposes of its own.
+.Sp
+You cannot use \fB\-traditional\fR if you include any header files that
+rely on \s-1ISO\s0 C features. Some vendors are starting to ship systems with
+\&\s-1ISO\s0 C header files and you cannot use \fB\-traditional\fR on such
+systems to compile files that include any system headers.
+.Sp
+The \fB\-traditional\fR option also enables \fB\-traditional-cpp\fR.
+.RE
+.Ip "\fB\-fcond-mismatch\fR" 4
+.IX Item "-fcond-mismatch"
+Allow conditional expressions with mismatched types in the second and
+third arguments. The value of such an expression is void. This option
+is not supported for \*(C+.
+.Ip "\fB\-funsigned-char\fR" 4
+.IX Item "-funsigned-char"
+Let the type \f(CW\*(C`char\*(C'\fR be unsigned, like \f(CW\*(C`unsigned char\*(C'\fR.
+.Sp
+Each kind of machine has a default for what \f(CW\*(C`char\*(C'\fR should
+be. It is either like \f(CW\*(C`unsigned char\*(C'\fR by default or like
+\&\f(CW\*(C`signed char\*(C'\fR by default.
+.Sp
+Ideally, a portable program should always use \f(CW\*(C`signed char\*(C'\fR or
+\&\f(CW\*(C`unsigned char\*(C'\fR when it depends on the signedness of an object.
+But many programs have been written to use plain \f(CW\*(C`char\*(C'\fR and
+expect it to be signed, or expect it to be unsigned, depending on the
+machines they were written for. This option, and its inverse, let you
+make such a program work with the opposite default.
+.Sp
+The type \f(CW\*(C`char\*(C'\fR is always a distinct type from each of
+\&\f(CW\*(C`signed char\*(C'\fR or \f(CW\*(C`unsigned char\*(C'\fR, even though its behavior
+is always just like one of those two.
+.Ip "\fB\-fsigned-char\fR" 4
+.IX Item "-fsigned-char"
+Let the type \f(CW\*(C`char\*(C'\fR be signed, like \f(CW\*(C`signed char\*(C'\fR.
+.Sp
+Note that this is equivalent to \fB\-fno-unsigned-char\fR, which is
+the negative form of \fB\-funsigned-char\fR. Likewise, the option
+\&\fB\-fno-signed-char\fR is equivalent to \fB\-funsigned-char\fR.
+.Ip "\fB\-fsigned-bitfields\fR" 4
+.IX Item "-fsigned-bitfields"
+.PD 0
+.Ip "\fB\-funsigned-bitfields\fR" 4
+.IX Item "-funsigned-bitfields"
+.Ip "\fB\-fno-signed-bitfields\fR" 4
+.IX Item "-fno-signed-bitfields"
+.Ip "\fB\-fno-unsigned-bitfields\fR" 4
+.IX Item "-fno-unsigned-bitfields"
+.PD
+These options control whether a bit-field is signed or unsigned, when the
+declaration does not use either \f(CW\*(C`signed\*(C'\fR or \f(CW\*(C`unsigned\*(C'\fR. By
+default, such a bit-field is signed, because this is consistent: the
+basic integer types such as \f(CW\*(C`int\*(C'\fR are signed types.
+.Sp
+However, when \fB\-traditional\fR is used, bit-fields are all unsigned
+no matter what.
+.Ip "\fB\-fwritable-strings\fR" 4
+.IX Item "-fwritable-strings"
+Store string constants in the writable data segment and don't uniquize
+them. This is for compatibility with old programs which assume they can
+write into string constants. The option \fB\-traditional\fR also has
+this effect.
+.Sp
+Writing into string constants is a very bad idea; ``constants'' should
+be constant.
+.Ip "\fB\-fconstant-cfstrings\fR" 4
+.IX Item "-fconstant-cfstrings"
+Enable the automatic creation of a CoreFoundation-type constant string
+whenever a special builtin \f(CW\*(C`_\|_builtin_\|_CFStringMakeConstantString\*(C'\fR
+is called on a literal string. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-fallow-single-precision\fR" 4
+.IX Item "-fallow-single-precision"
+Do not promote single precision math operations to double precision,
+even when compiling with \fB\-traditional\fR.
+.Sp
+Traditional K&R C promotes all floating point operations to double
+precision, regardless of the sizes of the operands. On the
+architecture for which you are compiling, single precision may be faster
+than double precision. If you must use \fB\-traditional\fR, but want
+to use single precision operations when the operands are single
+precision, use this option. This option has no effect when compiling
+with \s-1ISO\s0 or \s-1GNU\s0 C conventions (the default).
+.Ip "\fB\-fshort-wchar\fR" 4
+.IX Item "-fshort-wchar"
+Override the underlying type for \fBwchar_t\fR to be \fBshort
+unsigned int\fR instead of the default for the target. This option is
+useful for building programs to run under \s-1WINE\s0.
+.Ip "\fB\-fpascal-strings\fR" 4
+.IX Item "-fpascal-strings"
+Allow Pascal-style string literals to be constructed. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-fcoalesce\fR" 4
+.IX Item "-fcoalesce"
+Coalesce duplicated functions and data. The linker will discard all
+but one, saving space. Enabled by default. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-fweak-coalesced\fR" 4
+.IX Item "-fweak-coalesced"
+Use the new \s-1OS\s0 X \*(L"weak_definitions\*(R" section attribute for coalesced items.
+A single \*(L"normal\*(R" definition will be chosen by the linker over any number
+of weakly-coalesced ones. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Sh "Options Controlling \*(C+ Dialect"
+.IX Subsection "Options Controlling Dialect"
+This section describes the command-line options that are only meaningful
+for \*(C+ programs; but you can also use most of the \s-1GNU\s0 compiler options
+regardless of what language your program is in. For example, you
+might compile a file \f(CW\*(C`firstClass.C\*(C'\fR like this:
+.PP
+.Vb 1
+\& g++ -g -frepo -O -c firstClass.C
+.Ve
+In this example, only \fB\-frepo\fR is an option meant
+only for \*(C+ programs; you can use the other options with any
+language supported by \s-1GCC\s0.
+.PP
+Here is a list of options that are \fIonly\fR for compiling \*(C+ programs:
+.Ip "\fB\-fno-access-control\fR" 4
+.IX Item "-fno-access-control"
+Turn off all access checking. This switch is mainly useful for working
+around bugs in the access control code.
+.Ip "\fB\-fcheck-new\fR" 4
+.IX Item "-fcheck-new"
+Check that the pointer returned by \f(CW\*(C`operator new\*(C'\fR is non-null
+before attempting to modify the storage allocated. The current Working
+Paper requires that \f(CW\*(C`operator new\*(C'\fR never return a null pointer, so
+this check is normally unnecessary.
+.Sp
+An alternative to using this option is to specify that your
+\&\f(CW\*(C`operator new\*(C'\fR does not throw any exceptions; if you declare it
+\&\fB\f(BIthrow()\fB\fR, G++ will check the return value. See also \fBnew
+(nothrow)\fR.
+.Ip "\fB\-fconserve-space\fR" 4
+.IX Item "-fconserve-space"
+Put uninitialized or runtime-initialized global variables into the
+common segment, as C does. This saves space in the executable at the
+cost of not diagnosing duplicate definitions. If you compile with this
+flag and your program mysteriously crashes after \f(CW\*(C`main()\*(C'\fR has
+completed, you may have an object that is being destroyed twice because
+two definitions were merged.
+.Sp
+This option is no longer useful on most targets, now that support has
+been added for putting variables into \s-1BSS\s0 without making them common.
+.Ip "\fB\-fno-const-strings\fR" 4
+.IX Item "-fno-const-strings"
+Give string constants type \f(CW\*(C`char *\*(C'\fR instead of type \f(CW\*(C`const
+char *\*(C'\fR. By default, G++ uses type \f(CW\*(C`const char *\*(C'\fR as required by
+the standard. Even if you use \fB\-fno-const-strings\fR, you cannot
+actually modify the value of a string constant, unless you also use
+\&\fB\-fwritable-strings\fR.
+.Sp
+This option might be removed in a future release of G++. For maximum
+portability, you should structure your code so that it works with
+string constants that have type \f(CW\*(C`const char *\*(C'\fR.
+.Ip "\fB\-fdollars-in-identifiers\fR" 4
+.IX Item "-fdollars-in-identifiers"
+Accept \fB$\fR in identifiers. You can also explicitly prohibit use of
+\&\fB$\fR with the option \fB\-fno-dollars-in-identifiers\fR. (\s-1GNU\s0 C allows
+\&\fB$\fR by default on most target systems, but there are a few exceptions.)
+Traditional C allowed the character \fB$\fR to form part of
+identifiers. However, \s-1ISO\s0 C and \*(C+ forbid \fB$\fR in identifiers.
+.Ip "\fB\-fno-elide-constructors\fR" 4
+.IX Item "-fno-elide-constructors"
+The \*(C+ standard allows an implementation to omit creating a temporary
+which is only used to initialize another object of the same type.
+Specifying this option disables that optimization, and forces G++ to
+call the copy constructor in all cases.
+.Ip "\fB\-fno-enforce-eh-specs\fR" 4
+.IX Item "-fno-enforce-eh-specs"
+Don't check for violation of exception specifications at runtime. This
+option violates the \*(C+ standard, but may be useful for reducing code
+size in production builds, much like defining \fB\s-1NDEBUG\s0\fR. The compiler
+will still optimize based on the exception specifications.
+.Ip "\fB\-fexternal-templates\fR" 4
+.IX Item "-fexternal-templates"
+Cause \fB#pragma interface\fR and \fBimplementation\fR to apply to
+template instantiation; template instances are emitted or not according
+to the location of the template definition.
+.Sp
+This option is deprecated.
+.Ip "\fB\-falt-external-templates\fR" 4
+.IX Item "-falt-external-templates"
+Similar to \fB\-fexternal-templates\fR, but template instances are
+emitted or not according to the place where they are first instantiated.
+.Sp
+This option is deprecated.
+.Ip "\fB\-ffor-scope\fR" 4
+.IX Item "-ffor-scope"
+.PD 0
+.Ip "\fB\-fno-for-scope\fR" 4
+.IX Item "-fno-for-scope"
+.PD
+If \fB\-ffor-scope\fR is specified, the scope of variables declared in
+a \fIfor-init-statement\fR is limited to the \fBfor\fR loop itself,
+as specified by the \*(C+ standard.
+If \fB\-fno-for-scope\fR is specified, the scope of variables declared in
+a \fIfor-init-statement\fR extends to the end of the enclosing scope,
+as was the case in old versions of G++, and other (traditional)
+implementations of \*(C+.
+.Sp
+The default if neither flag is given to follow the standard,
+but to allow and give a warning for old-style code that would
+otherwise be invalid, or have different behavior.
+.Ip "\fB\-fno-gnu-keywords\fR" 4
+.IX Item "-fno-gnu-keywords"
+Do not recognize \f(CW\*(C`typeof\*(C'\fR as a keyword, so that code can use this
+word as an identifier. You can use the keyword \f(CW\*(C`_\|_typeof_\|_\*(C'\fR instead.
+\&\fB\-ansi\fR implies \fB\-fno-gnu-keywords\fR.
+.Ip "\fB\-fno-implicit-templates\fR" 4
+.IX Item "-fno-implicit-templates"
+Never emit code for non-inline templates which are instantiated
+implicitly (i.e. by use); only emit code for explicit instantiations.
+.Ip "\fB\-fno-implicit-inline-templates\fR" 4
+.IX Item "-fno-implicit-inline-templates"
+Don't emit code for implicit instantiations of inline templates, either.
+The default is to handle inlines differently so that compiles with and
+without optimization will need the same set of explicit instantiations.
+.Ip "\fB\-fno-implement-inlines\fR" 4
+.IX Item "-fno-implement-inlines"
+To save space, do not emit out-of-line copies of inline functions
+controlled by \fB#pragma implementation\fR. This will cause linker
+errors if these functions are not inlined everywhere they are called.
+.Ip "\fB\-findirect-virtual-calls\fR" 4
+.IX Item "-findirect-virtual-calls"
+Do not make direct calls to virtual functions; instead, always
+go through the vtable. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-fapple-kext\fR" 4
+.IX Item "-fapple-kext"
+Alter vtables, destructors, and other implementation details to more
+closely resemble the \s-1GCC\s0 2.95 \s-1ABI\s0. This is to make kernel extensions
+loadable by Darwin kernels built using older compilers, and is required
+to build any Darwin kernel extension. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-fcoalesce-templates\fR" 4
+.IX Item "-fcoalesce-templates"
+Mark instantiated templates as \*(L"coalesced\*(R": the linker will discard
+all but one, thus saving space. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-fms-extensions\fR" 4
+.IX Item "-fms-extensions"
+Disable pedantic warnings about constructs used in \s-1MFC\s0, such as implicit
+int and getting a pointer to member function via non-standard syntax.
+.Ip "\fB\-fno-nonansi-builtins\fR" 4
+.IX Item "-fno-nonansi-builtins"
+Disable built-in declarations of functions that are not mandated by
+\&\s-1ANSI/ISO\s0 C. These include \f(CW\*(C`ffs\*(C'\fR, \f(CW\*(C`alloca\*(C'\fR, \f(CW\*(C`_exit\*(C'\fR,
+\&\f(CW\*(C`index\*(C'\fR, \f(CW\*(C`bzero\*(C'\fR, \f(CW\*(C`conjf\*(C'\fR, and other related functions.
+.Ip "\fB\-fno-operator-names\fR" 4
+.IX Item "-fno-operator-names"
+Do not treat the operator name keywords \f(CW\*(C`and\*(C'\fR, \f(CW\*(C`bitand\*(C'\fR,
+\&\f(CW\*(C`bitor\*(C'\fR, \f(CW\*(C`compl\*(C'\fR, \f(CW\*(C`not\*(C'\fR, \f(CW\*(C`or\*(C'\fR and \f(CW\*(C`xor\*(C'\fR as
+synonyms as keywords.
+.Ip "\fB\-fno-optional-diags\fR" 4
+.IX Item "-fno-optional-diags"
+Disable diagnostics that the standard says a compiler does not need to
+issue. Currently, the only such diagnostic issued by G++ is the one for
+a name having multiple meanings within a class.
+.Ip "\fB\-fpermissive\fR" 4
+.IX Item "-fpermissive"
+Downgrade messages about nonconformant code from errors to warnings. By
+default, G++ effectively sets \fB\-pedantic-errors\fR without
+\&\fB\-pedantic\fR; this option reverses that. This behavior and this
+option are superseded by \fB\-pedantic\fR, which works as it does for \s-1GNU\s0 C.
+.Ip "\fB\-frepo\fR" 4
+.IX Item "-frepo"
+Enable automatic template instantiation at link time. This option also
+implies \fB\-fno-implicit-templates\fR.
+.Ip "\fB\-fno-rtti\fR" 4
+.IX Item "-fno-rtti"
+Disable generation of information about every class with virtual
+functions for use by the \*(C+ runtime type identification features
+(\fBdynamic_cast\fR and \fBtypeid\fR). If you don't use those parts
+of the language, you can save some space by using this flag. Note that
+exception handling uses the same information, but it will generate it as
+needed.
+.Ip "\fB\-fstats\fR" 4
+.IX Item "-fstats"
+Emit statistics about front-end processing at the end of the compilation.
+This information is generally only useful to the G++ development team.
+.Ip "\fB\-ftemplate-depth-\fR\fIn\fR" 4
+.IX Item "-ftemplate-depth-n"
+Set the maximum instantiation depth for template classes to \fIn\fR.
+A limit on the template instantiation depth is needed to detect
+endless recursions during template class instantiation. \s-1ANSI/ISO\s0 \*(C+
+conforming programs must not rely on a maximum depth greater than 17.
+.Ip "\fB\-fuse-cxa-atexit\fR" 4
+.IX Item "-fuse-cxa-atexit"
+Register destructors for objects with static storage duration with the
+\&\f(CW\*(C`_\|_cxa_atexit\*(C'\fR function rather than the \f(CW\*(C`atexit\*(C'\fR function.
+This option is required for fully standards-compliant handling of static
+destructors, but will only work if your C library supports
+\&\f(CW\*(C`_\|_cxa_atexit\*(C'\fR.
+This option is not supported on Mac \s-1OS\s0 X.
+.Ip "\fB\-fvtable-gc\fR" 4
+.IX Item "-fvtable-gc"
+Emit special relocations for vtables and virtual function references
+so that the linker can identify unused virtual functions and zero out
+vtable slots that refer to them. This is most useful with
+\&\fB\-ffunction-sections\fR and \fB\-Wl,\-\-gc-sections\fR, in order to
+also discard the functions themselves.
+.Sp
+This optimization requires \s-1GNU\s0 as and \s-1GNU\s0 ld. Not all systems support
+this option. \fB\-Wl,\-\-gc-sections\fR is ignored without \fB\-static\fR.
+.Ip "\fB\-fno-weak\fR" 4
+.IX Item "-fno-weak"
+Do not use weak symbol support, even if it is provided by the linker.
+By default, G++ will use weak symbols if they are available. This
+option exists only for testing, and should not be used by end-users;
+it will result in inferior code and has no benefits. This option may
+be removed in a future release of G++.
+.Ip "\fB\-nostdinc++\fR" 4
+.IX Item "-nostdinc++"
+Do not search for header files in the standard directories specific to
+\&\*(C+, but do still search the other standard directories. (This option
+is used when building the \*(C+ library.)
+.PP
+In addition, these optimization, warning, and code generation options
+have meanings only for \*(C+ programs:
+.Ip "\fB\-fno-default-inline\fR" 4
+.IX Item "-fno-default-inline"
+Do not assume \fBinline\fR for functions defined inside a class scope.
+ Note that these
+functions will have linkage like inline functions; they just won't be
+inlined by default.
+.Ip "\fB\-Wctor-dtor-privacy\fR (\*(C+ only)" 4
+.IX Item "-Wctor-dtor-privacy ( only)"
+Warn when a class seems unusable, because all the constructors or
+destructors in a class are private and the class has no friends or
+public static member functions.
+.Ip "\fB\-Wnon-virtual-dtor\fR (\*(C+ only)" 4
+.IX Item "-Wnon-virtual-dtor ( only)"
+Warn when a class declares a non-virtual destructor that should probably
+be virtual, because it looks like the class will be used polymorphically.
+.Ip "\fB\-Wreorder\fR (\*(C+ only)" 4
+.IX Item "-Wreorder ( only)"
+Warn when the order of member initializers given in the code does not
+match the order in which they must be executed. For instance:
+.Sp
+.Vb 5
+\& struct A {
+\& int i;
+\& int j;
+\& A(): j (0), i (1) { }
+\& };
+.Ve
+Here the compiler will warn that the member initializers for \fBi\fR
+and \fBj\fR will be rearranged to match the declaration order of the
+members.
+.PP
+The following \fB\-W...\fR options are not affected by \fB\-Wall\fR.
+.Ip "\fB\-Weffc++\fR (\*(C+ only)" 4
+.IX Item "-Weffc++ ( only)"
+Warn about violations of the following style guidelines from Scott Meyers'
+\&\fIEffective \*(C+\fR book:
+.RS 4
+.Ip "\(bu" 4
+Item 11: Define a copy constructor and an assignment operator for classes
+with dynamically allocated memory.
+.Ip "\(bu" 4
+Item 12: Prefer initialization to assignment in constructors.
+.Ip "\(bu" 4
+Item 14: Make destructors virtual in base classes.
+.Ip "\(bu" 4
+Item 15: Have \f(CW\*(C`operator=\*(C'\fR return a reference to \f(CW\*(C`*this\*(C'\fR.
+.Ip "\(bu" 4
+Item 23: Don't try to return a reference when you must return an object.
+.RE
+.RS 4
+.Sp
+and about violations of the following style guidelines from Scott Meyers'
+\&\fIMore Effective \*(C+\fR book:
+.RS 4
+.RE
+.Ip "\(bu" 4
+Item 6: Distinguish between prefix and postfix forms of increment and
+decrement operators.
+.Ip "\(bu" 4
+Item 7: Never overload \f(CW\*(C`&&\*(C'\fR, \f(CW\*(C`||\*(C'\fR, or \f(CW\*(C`,\*(C'\fR.
+.RE
+.RS 4
+.Sp
+If you use this option, you should be aware that the standard library
+headers do not obey all of these guidelines; you can use \fBgrep \-v\fR
+to filter out those warnings.
+.RE
+.Ip "\fB\-Wno-deprecated\fR (\*(C+ only)" 4
+.IX Item "-Wno-deprecated ( only)"
+Do not warn about usage of deprecated features.
+.Ip "\fB\-Wno-non-template-friend\fR (\*(C+ only)" 4
+.IX Item "-Wno-non-template-friend ( only)"
+Disable warnings when non-templatized friend functions are declared
+within a template. With the advent of explicit template specification
+support in G++, if the name of the friend is an unqualified-id (i.e.,
+\&\fBfriend foo(int)\fR), the \*(C+ language specification demands that the
+friend declare or define an ordinary, nontemplate function. (Section
+14.5.3). Before G++ implemented explicit specification, unqualified-ids
+could be interpreted as a particular specialization of a templatized
+function. Because this non-conforming behavior is no longer the default
+behavior for G++, \fB\-Wnon-template-friend\fR allows the compiler to
+check existing code for potential trouble spots, and is on by default.
+This new compiler behavior can be turned off with
+\&\fB\-Wno-non-template-friend\fR which keeps the conformant compiler code
+but disables the helpful warning.
+.Ip "\fB\-Wold-style-cast\fR (\*(C+ only)" 4
+.IX Item "-Wold-style-cast ( only)"
+Warn if an old-style (C-style) cast to a non-void type is used within
+a \*(C+ program. The new-style casts (\fBstatic_cast\fR,
+\&\fBreinterpret_cast\fR, and \fBconst_cast\fR) are less vulnerable to
+unintended effects, and much easier to grep for.
+.Ip "\fB\-Woverloaded-virtual\fR (\*(C+ only)" 4
+.IX Item "-Woverloaded-virtual ( only)"
+Warn when a function declaration hides virtual functions from a
+base class. For example, in:
+.Sp
+.Vb 3
+\& struct A {
+\& virtual void f();
+\& };
+.Ve
+.Vb 3
+\& struct B: public A {
+\& void f(int);
+\& };
+.Ve
+the \f(CW\*(C`A\*(C'\fR class version of \f(CW\*(C`f\*(C'\fR is hidden in \f(CW\*(C`B\*(C'\fR, and code
+like this:
+.Sp
+.Vb 2
+\& B* b;
+\& b->f();
+.Ve
+will fail to compile.
+.Ip "\fB\-Wno-pmf-conversions\fR (\*(C+ only)" 4
+.IX Item "-Wno-pmf-conversions ( only)"
+Disable the diagnostic for converting a bound pointer to member function
+to a plain pointer.
+.Ip "\fB\-Wsign-promo\fR (\*(C+ only)" 4
+.IX Item "-Wsign-promo ( only)"
+Warn when overload resolution chooses a promotion from unsigned or
+enumeral type to a signed type over a conversion to an unsigned type of
+the same size. Previous versions of G++ would try to preserve
+unsignedness, but the standard mandates the current behavior.
+.Ip "\fB\-Wsynth\fR (\*(C+ only)" 4
+.IX Item "-Wsynth ( only)"
+Warn when G++'s synthesis behavior does not match that of cfront. For
+instance:
+.Sp
+.Vb 4
+\& struct A {
+\& operator int ();
+\& A& operator = (int);
+\& };
+.Ve
+.Vb 5
+\& main ()
+\& {
+\& A a,b;
+\& a = b;
+\& }
+.Ve
+In this example, G++ will synthesize a default \fBA& operator =
+(const A&);\fR, while cfront will use the user-defined \fBoperator =\fR.
+.Sh "Options Controlling Objective-C Dialect"
+.IX Subsection "Options Controlling Objective-C Dialect"
+This section describes the command-line options that are only meaningful
+for Objective-C programs; but you can also use most of the \s-1GNU\s0 compiler
+options regardless of what language your program is in. For example,
+you might compile a file \f(CW\*(C`some_class.m\*(C'\fR like this:
+.PP
+.Vb 1
+\& gcc -g -fgnu-runtime -O -c some_class.m
+.Ve
+In this example, only \fB\-fgnu-runtime\fR is an option meant only for
+Objective-C programs; you can use the other options with any language
+supported by \s-1GCC\s0.
+.PP
+Here is a list of options that are \fIonly\fR for compiling Objective-C
+programs:
+.Ip "\fB\-fconstant-string-class=\fR\fIclass-name\fR" 4
+.IX Item "-fconstant-string-class=class-name"
+Use \fIclass-name\fR as the name of the class to instantiate for each
+literal string specified with the syntax \f(CW\*(C`@"..."\*(C'\fR. The default
+class name is \f(CW\*(C`NXConstantString\*(C'\fR.
+.Ip "\fB\-fgnu-runtime\fR" 4
+.IX Item "-fgnu-runtime"
+Generate object code compatible with the standard \s-1GNU\s0 Objective-C
+runtime. This is the default for most types of systems.
+.Ip "\fB\-fnext-runtime\fR" 4
+.IX Item "-fnext-runtime"
+Generate output compatible with the NeXT runtime. This is the default
+for NeXT-based systems, including Darwin and Mac \s-1OS\s0 X.
+.Ip "\fB\-gen-decls\fR" 4
+.IX Item "-gen-decls"
+Dump interface declarations for all classes seen in the source file to a
+file named \fI\fIsourcename\fI.decl\fR.
+.Ip "\fB\-Wno-protocol\fR" 4
+.IX Item "-Wno-protocol"
+Do not warn if methods required by a protocol are not implemented
+in the class adopting it.
+.Ip "\fB\-Wselector\fR" 4
+.IX Item "-Wselector"
+Warn if a selector has multiple methods of different types defined.
+.Sh "Options to Control Diagnostic Messages Formatting"
+.IX Subsection "Options to Control Diagnostic Messages Formatting"
+Traditionally, diagnostic messages have been formatted irrespective of
+the output device's aspect (e.g. its width, ...). The options described
+below can be used to control the diagnostic messages formatting
+algorithm, e.g. how many characters per line, how often source location
+information should be reported. Right now, only the \*(C+ front end can
+honor these options. However it is expected, in the near future, that
+the remaining front ends would be able to digest them correctly.
+.Ip "\fB\-fmessage-length=\fR\fIn\fR" 4
+.IX Item "-fmessage-length=n"
+Try to format error messages so that they fit on lines of about \fIn\fR
+characters. The default is 72 characters for \fBg++\fR and 0 for the rest of
+the front ends supported by \s-1GCC\s0. If \fIn\fR is zero, then no
+line-wrapping will be done; each error message will appear on a single
+line.
+.Ip "\fB\-fdiagnostics-show-location=once\fR" 4
+.IX Item "-fdiagnostics-show-location=once"
+Only meaningful in line-wrapping mode. Instructs the diagnostic messages
+reporter to emit \fIonce\fR source location information; that is, in
+case the message is too long to fit on a single physical line and has to
+be wrapped, the source location won't be emitted (as prefix) again,
+over and over, in subsequent continuation lines. This is the default
+behavior.
+.Ip "\fB\-fdiagnostics-show-location=every-line\fR" 4
+.IX Item "-fdiagnostics-show-location=every-line"
+Only meaningful in line-wrapping mode. Instructs the diagnostic
+messages reporter to emit the same source location information (as
+prefix) for physical lines that result from the process of breaking
+a message which is too long to fit on a single line.
+.Sh "Options to Request or Suppress Warnings"
+.IX Subsection "Options to Request or Suppress Warnings"
+Warnings are diagnostic messages that report constructions which
+are not inherently erroneous but which are risky or suggest there
+may have been an error.
+.PP
+You can request many specific warnings with options beginning \fB\-W\fR,
+for example \fB\-Wimplicit\fR to request warnings on implicit
+declarations. Each of these specific warning options also has a
+negative form beginning \fB\-Wno-\fR to turn off warnings;
+for example, \fB\-Wno-implicit\fR. This manual lists only one of the
+two forms, whichever is not the default.
+.PP
+The following options control the amount and kinds of warnings produced
+by \s-1GCC\s0; for further, language-specific options also refer to
+\&\f(CW@ref\fR{\*(C+ Dialect Options} and \f(CW@ref\fR{Objective-C Dialect Options}.
+.Ip "\fB\-fsyntax-only\fR" 4
+.IX Item "-fsyntax-only"
+Check the code for syntax errors, but don't do anything beyond that.
+.Ip "\fB\-pedantic\fR" 4
+.IX Item "-pedantic"
+Issue all the warnings demanded by strict \s-1ISO\s0 C and \s-1ISO\s0 \*(C+;
+reject all programs that use forbidden extensions, and some other
+programs that do not follow \s-1ISO\s0 C and \s-1ISO\s0 \*(C+. For \s-1ISO\s0 C, follows the
+version of the \s-1ISO\s0 C standard specified by any \fB\-std\fR option used.
+.Sp
+Valid \s-1ISO\s0 C and \s-1ISO\s0 \*(C+ programs should compile properly with or without
+this option (though a rare few will require \fB\-ansi\fR or a
+\&\fB\-std\fR option specifying the required version of \s-1ISO\s0 C). However,
+without this option, certain \s-1GNU\s0 extensions and traditional C and \*(C+
+features are supported as well. With this option, they are rejected.
+.Sp
+\&\fB\-pedantic\fR does not cause warning messages for use of the
+alternate keywords whose names begin and end with \fB_\|_\fR. Pedantic
+warnings are also disabled in the expression that follows
+\&\f(CW\*(C`_\|_extension_\|_\*(C'\fR. However, only system header files should use
+these escape routes; application programs should avoid them.
+.Sp
+Some users try to use \fB\-pedantic\fR to check programs for strict \s-1ISO\s0
+C conformance. They soon find that it does not do quite what they want:
+it finds some non-ISO practices, but not all\-\-\-only those for which
+\&\s-1ISO\s0 C \fIrequires\fR a diagnostic, and some others for which
+diagnostics have been added.
+.Sp
+A feature to report any failure to conform to \s-1ISO\s0 C might be useful in
+some instances, but would require considerable additional work and would
+be quite different from \fB\-pedantic\fR. We don't have plans to
+support such a feature in the near future.
+.Sp
+Where the standard specified with \fB\-std\fR represents a \s-1GNU\s0
+extended dialect of C, such as \fBgnu89\fR or \fBgnu99\fR, there is a
+corresponding \fIbase standard\fR, the version of \s-1ISO\s0 C on which the \s-1GNU\s0
+extended dialect is based. Warnings from \fB\-pedantic\fR are given
+where they are required by the base standard. (It would not make sense
+for such warnings to be given only for features not in the specified \s-1GNU\s0
+C dialect, since by definition the \s-1GNU\s0 dialects of C include all
+features the compiler supports with the given option, and there would be
+nothing to warn about.)
+.Ip "\fB\-pedantic-errors\fR" 4
+.IX Item "-pedantic-errors"
+Like \fB\-pedantic\fR, except that errors are produced rather than
+warnings.
+.Ip "\fB\-w\fR" 4
+.IX Item "-w"
+Inhibit all warning messages.
+.Ip "\fB\-Wno-import\fR" 4
+.IX Item "-Wno-import"
+Inhibit warning messages about the use of \fB#import\fR.
+.Ip "\fB\-Wno-#warnings\fR" 4
+.IX Item "-Wno-#warnings"
+Inhibit warning messages issued by \fB#warning\fR.
+.Ip "\fB\-Wpragma-once\fR" 4
+.IX Item "-Wpragma-once"
+Warn about the use of \fB#pragma once\fR. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-Wextra-tokens\fR" 4
+.IX Item "-Wextra-tokens"
+Warn about extra tokens at the end of prepreprocessor directives. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-Wnewline-eof\fR" 4
+.IX Item "-Wnewline-eof"
+Warn about files missing a newline at the end of the file. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-Wno-altivec-long-deprecated\fR" 4
+.IX Item "-Wno-altivec-long-deprecated"
+Do not warn about the use of the deprecated 'long' keyword in
+AltiVec data types. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-Wchar-subscripts\fR" 4
+.IX Item "-Wchar-subscripts"
+Warn if an array subscript has type \f(CW\*(C`char\*(C'\fR. This is a common cause
+of error, as programmers often forget that this type is signed on some
+machines.
+.Ip "\fB\-Wcomment\fR" 4
+.IX Item "-Wcomment"
+Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR
+comment, or whenever a Backslash-Newline appears in a \fB//\fR comment.
+.Ip "\fB\-Wformat\fR" 4
+.IX Item "-Wformat"
+Check calls to \f(CW\*(C`printf\*(C'\fR and \f(CW\*(C`scanf\*(C'\fR, etc., to make sure that
+the arguments supplied have types appropriate to the format string
+specified, and that the conversions specified in the format string make
+sense. This includes standard functions, and others specified by format
+attributes, in the \f(CW\*(C`printf\*(C'\fR,
+\&\f(CW\*(C`scanf\*(C'\fR, \f(CW\*(C`strftime\*(C'\fR and \f(CW\*(C`strfmon\*(C'\fR (an X/Open extension,
+not in the C standard) families.
+.Sp
+The formats are checked against the format features supported by \s-1GNU\s0
+libc version 2.2. These include all \s-1ISO\s0 C89 and C99 features, as well
+as features from the Single Unix Specification and some \s-1BSD\s0 and \s-1GNU\s0
+extensions. Other library implementations may not support all these
+features; \s-1GCC\s0 does not support warning about features that go beyond a
+particular library's limitations. However, if \fB\-pedantic\fR is used
+with \fB\-Wformat\fR, warnings will be given about format features not
+in the selected standard version (but not for \f(CW\*(C`strfmon\*(C'\fR formats,
+since those are not in any version of the C standard).
+.Sp
+\&\fB\-Wformat\fR is included in \fB\-Wall\fR. For more control over some
+aspects of format checking, the options \fB\-Wno-format-y2k\fR,
+\&\fB\-Wno-format-extra-args\fR, \fB\-Wformat-nonliteral\fR,
+\&\fB\-Wformat-security\fR and \fB\-Wformat=2\fR are available, but are
+not included in \fB\-Wall\fR.
+.Ip "\fB\-Wno-format-y2k\fR" 4
+.IX Item "-Wno-format-y2k"
+If \fB\-Wformat\fR is specified, do not warn about \f(CW\*(C`strftime\*(C'\fR
+formats which may yield only a two-digit year.
+.Ip "\fB\-Wno-format-extra-args\fR" 4
+.IX Item "-Wno-format-extra-args"
+If \fB\-Wformat\fR is specified, do not warn about excess arguments to a
+\&\f(CW\*(C`printf\*(C'\fR or \f(CW\*(C`scanf\*(C'\fR format function. The C standard specifies
+that such arguments are ignored.
+.Sp
+Where the unused arguments lie between used arguments that are
+specified with \fB$\fR operand number specifications, normally
+warnings are still given, since the implementation could not know what
+type to pass to \f(CW\*(C`va_arg\*(C'\fR to skip the unused arguments. However,
+in the case of \f(CW\*(C`scanf\*(C'\fR formats, this option will suppress the
+warning if the unused arguments are all pointers, since the Single
+Unix Specification says that such unused arguments are allowed.
+.Ip "\fB\-Wformat-nonliteral\fR" 4
+.IX Item "-Wformat-nonliteral"
+If \fB\-Wformat\fR is specified, also warn if the format string is not a
+string literal and so cannot be checked, unless the format function
+takes its format arguments as a \f(CW\*(C`va_list\*(C'\fR.
+.Ip "\fB\-Wformat-security\fR" 4
+.IX Item "-Wformat-security"
+If \fB\-Wformat\fR is specified, also warn about uses of format
+functions that represent possible security problems. At present, this
+warns about calls to \f(CW\*(C`printf\*(C'\fR and \f(CW\*(C`scanf\*(C'\fR functions where the
+format string is not a string literal and there are no format arguments,
+as in \f(CW\*(C`printf (foo);\*(C'\fR. This may be a security hole if the format
+string came from untrusted input and contains \fB%n\fR. (This is
+currently a subset of what \fB\-Wformat-nonliteral\fR warns about, but
+in future warnings may be added to \fB\-Wformat-security\fR that are not
+included in \fB\-Wformat-nonliteral\fR.)
+.Ip "\fB\-Wformat=2\fR" 4
+.IX Item "-Wformat=2"
+Enable \fB\-Wformat\fR plus format checks not included in
+\&\fB\-Wformat\fR. Currently equivalent to \fB\-Wformat
+\&\-Wformat-nonliteral \-Wformat-security\fR.
+.Ip "\fB\-Wimplicit-int\fR" 4
+.IX Item "-Wimplicit-int"
+Warn when a declaration does not specify a type.
+.Ip "\fB\-Wimplicit-function-declaration\fR" 4
+.IX Item "-Wimplicit-function-declaration"
+.PD 0
+.Ip "\fB\-Werror-implicit-function-declaration\fR" 4
+.IX Item "-Werror-implicit-function-declaration"
+.PD
+Give a warning (or error) whenever a function is used before being
+declared.
+.Ip "\fB\-Wimplicit\fR" 4
+.IX Item "-Wimplicit"
+Same as \fB\-Wimplicit-int\fR and \fB\-Wimplicit-function-declaration\fR.
+.Ip "\fB\-Wmain\fR" 4
+.IX Item "-Wmain"
+Warn if the type of \fBmain\fR is suspicious. \fBmain\fR should be a
+function with external linkage, returning int, taking either zero
+arguments, two, or three arguments of appropriate types.
+.Ip "\fB\-Wmissing-braces\fR" 4
+.IX Item "-Wmissing-braces"
+Warn if an aggregate or union initializer is not fully bracketed. In
+the following example, the initializer for \fBa\fR is not fully
+bracketed, but that for \fBb\fR is fully bracketed.
+.Sp
+.Vb 2
+\& int a[2][2] = { 0, 1, 2, 3 };
+\& int b[2][2] = { { 0, 1 }, { 2, 3 } };
+.Ve
+.Ip "\fB\-Wparentheses\fR" 4
+.IX Item "-Wparentheses"
+Warn if parentheses are omitted in certain contexts, such
+as when there is an assignment in a context where a truth value
+is expected, or when operators are nested whose precedence people
+often get confused about.
+.Sp
+Also warn about constructions where there may be confusion to which
+\&\f(CW\*(C`if\*(C'\fR statement an \f(CW\*(C`else\*(C'\fR branch belongs. Here is an example of
+such a case:
+.Sp
+.Vb 7
+\& {
+\& if (a)
+\& if (b)
+\& foo ();
+\& else
+\& bar ();
+\& }
+.Ve
+In C, every \f(CW\*(C`else\*(C'\fR branch belongs to the innermost possible \f(CW\*(C`if\*(C'\fR
+statement, which in this example is \f(CW\*(C`if (b)\*(C'\fR. This is often not
+what the programmer expected, as illustrated in the above example by
+indentation the programmer chose. When there is the potential for this
+confusion, \s-1GCC\s0 will issue a warning when this flag is specified.
+To eliminate the warning, add explicit braces around the innermost
+\&\f(CW\*(C`if\*(C'\fR statement so there is no way the \f(CW\*(C`else\*(C'\fR could belong to
+the enclosing \f(CW\*(C`if\*(C'\fR. The resulting code would look like this:
+.Sp
+.Vb 9
+\& {
+\& if (a)
+\& {
+\& if (b)
+\& foo ();
+\& else
+\& bar ();
+\& }
+\& }
+.Ve
+.Ip "\fB\-Wsequence-point\fR" 4
+.IX Item "-Wsequence-point"
+Warn about code that may have undefined semantics because of violations
+of sequence point rules in the C standard.
+.Sp
+The C standard defines the order in which expressions in a C program are
+evaluated in terms of \fIsequence points\fR, which represent a partial
+ordering between the execution of parts of the program: those executed
+before the sequence point, and those executed after it. These occur
+after the evaluation of a full expression (one which is not part of a
+larger expression), after the evaluation of the first operand of a
+\&\f(CW\*(C`&&\*(C'\fR, \f(CW\*(C`||\*(C'\fR, \f(CW\*(C`? :\*(C'\fR or \f(CW\*(C`,\*(C'\fR (comma) operator, before a
+function is called (but after the evaluation of its arguments and the
+expression denoting the called function), and in certain other places.
+Other than as expressed by the sequence point rules, the order of
+evaluation of subexpressions of an expression is not specified. All
+these rules describe only a partial order rather than a total order,
+since, for example, if two functions are called within one expression
+with no sequence point between them, the order in which the functions
+are called is not specified. However, the standards committee have
+ruled that function calls do not overlap.
+.Sp
+It is not specified when between sequence points modifications to the
+values of objects take effect. Programs whose behavior depends on this
+have undefined behavior; the C standard specifies that ``Between the
+previous and next sequence point an object shall have its stored value
+modified at most once by the evaluation of an expression. Furthermore,
+the prior value shall be read only to determine the value to be
+stored.''. If a program breaks these rules, the results on any
+particular implementation are entirely unpredictable.
+.Sp
+Examples of code with undefined behavior are \f(CW\*(C`a = a++;\*(C'\fR, \f(CW\*(C`a[n]
+= b[n++]\*(C'\fR and \f(CW\*(C`a[i++] = i;\*(C'\fR. Some more complicated cases are not
+diagnosed by this option, and it may give an occasional false positive
+result, but in general it has been found fairly effective at detecting
+this sort of problem in programs.
+.Sp
+The present implementation of this option only works for C programs. A
+future implementation may also work for \*(C+ programs.
+.Sp
+The C standard is worded confusingly, therefore there is some debate
+over the precise meaning of the sequence point rules in subtle cases.
+Links to discussions of the problem, including proposed formal
+definitions, may be found on our readings page, at
+<\fBhttp://gcc.gnu.org/readings.html\fR>.
+.Ip "\fB\-Wreturn-type\fR" 4
+.IX Item "-Wreturn-type"
+Warn whenever a function is defined with a return-type that defaults to
+\&\f(CW\*(C`int\*(C'\fR. Also warn about any \f(CW\*(C`return\*(C'\fR statement with no
+return-value in a function whose return-type is not \f(CW\*(C`void\*(C'\fR.
+.Sp
+For \*(C+, a function without return type always produces a diagnostic
+message, even when \fB\-Wno-return-type\fR is specified. The only
+exceptions are \fBmain\fR and functions defined in system headers.
+.Ip "\fB\-Wswitch\fR" 4
+.IX Item "-Wswitch"
+Warn whenever a \f(CW\*(C`switch\*(C'\fR statement has an index of enumeral type
+and lacks a \f(CW\*(C`case\*(C'\fR for one or more of the named codes of that
+enumeration. (The presence of a \f(CW\*(C`default\*(C'\fR label prevents this
+warning.) \f(CW\*(C`case\*(C'\fR labels outside the enumeration range also
+provoke warnings when this option is used.
+.Ip "\fB\-Wtrigraphs\fR" 4
+.IX Item "-Wtrigraphs"
+Warn if any trigraphs are encountered that might change the meaning of
+the program (trigraphs within comments are not warned about).
+.Ip "\fB\-Wunused-function\fR" 4
+.IX Item "-Wunused-function"
+Warn whenever a static function is declared but not defined or a
+non\e-inline static function is unused.
+.Ip "\fB\-Wunused-label\fR" 4
+.IX Item "-Wunused-label"
+Warn whenever a label is declared but not used.
+.Sp
+To suppress this warning use the \fBunused\fR attribute.
+.Ip "\fB\-Wunused-parameter\fR" 4
+.IX Item "-Wunused-parameter"
+Warn whenever a function parameter is unused aside from its declaration.
+.Sp
+To suppress this warning use the \fBunused\fR attribute.
+.Ip "\fB\-Wunused-variable\fR" 4
+.IX Item "-Wunused-variable"
+Warn whenever a local variable or non-constant static variable is unused
+aside from its declaration
+.Sp
+To suppress this warning use the \fBunused\fR attribute.
+.Ip "\fB\-Wunused-value\fR" 4
+.IX Item "-Wunused-value"
+Warn whenever a statement computes a result that is explicitly not used.
+.Sp
+To suppress this warning cast the expression to \fBvoid\fR.
+.Ip "\fB\-Wunused\fR" 4
+.IX Item "-Wunused"
+All all the above \fB\-Wunused\fR options combined.
+.Sp
+In order to get a warning about an unused function parameter, you must
+either specify \fB\-W \-Wunused\fR or separately specify
+\&\fB\-Wunused-parameter\fR.
+.Ip "\fB\-Wuninitialized\fR" 4
+.IX Item "-Wuninitialized"
+Warn if an automatic variable is used without first being initialized or
+if a variable may be clobbered by a \f(CW\*(C`setjmp\*(C'\fR call.
+.Sp
+These warnings are possible only in optimizing compilation,
+because they require data flow information that is computed only
+when optimizing. If you don't specify \fB\-O\fR, you simply won't
+get these warnings.
+.Sp
+These warnings occur only for variables that are candidates for
+register allocation. Therefore, they do not occur for a variable that
+is declared \f(CW\*(C`volatile\*(C'\fR, or whose address is taken, or whose size
+is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
+structures, unions or arrays, even when they are in registers.
+.Sp
+Note that there may be no warning about a variable that is used only
+to compute a value that itself is never used, because such
+computations may be deleted by data flow analysis before the warnings
+are printed.
+.Sp
+These warnings are made optional because \s-1GCC\s0 is not smart
+enough to see all the reasons why the code might be correct
+despite appearing to have an error. Here is one example of how
+this can happen:
+.Sp
+.Vb 12
+\& {
+\& int x;
+\& switch (y)
+\& {
+\& case 1: x = 1;
+\& break;
+\& case 2: x = 4;
+\& break;
+\& case 3: x = 5;
+\& }
+\& foo (x);
+\& }
+.Ve
+If the value of \f(CW\*(C`y\*(C'\fR is always 1, 2 or 3, then \f(CW\*(C`x\*(C'\fR is
+always initialized, but \s-1GCC\s0 doesn't know this. Here is
+another common case:
+.Sp
+.Vb 6
+\& {
+\& int save_y;
+\& if (change_y) save_y = y, y = new_y;
+\& ...
+\& if (change_y) y = save_y;
+\& }
+.Ve
+This has no bug because \f(CW\*(C`save_y\*(C'\fR is used only if it is set.
+.Sp
+This option also warns when a non-volatile automatic variable might be
+changed by a call to \f(CW\*(C`longjmp\*(C'\fR. These warnings as well are possible
+only in optimizing compilation.
+.Sp
+The compiler sees only the calls to \f(CW\*(C`setjmp\*(C'\fR. It cannot know
+where \f(CW\*(C`longjmp\*(C'\fR will be called; in fact, a signal handler could
+call it at any point in the code. As a result, you may get a warning
+even when there is in fact no problem because \f(CW\*(C`longjmp\*(C'\fR cannot
+in fact be called at the place which would cause a problem.
+.Sp
+Some spurious warnings can be avoided if you declare all the functions
+you use that never return as \f(CW\*(C`noreturn\*(C'\fR.
+.Ip "\fB\-Wreorder\fR (\*(C+ only)" 4
+.IX Item "-Wreorder ( only)"
+Warn when the order of member initializers given in the code does not
+match the order in which they must be executed. For instance:
+.Ip "\fB\-Wunknown-pragmas\fR" 4
+.IX Item "-Wunknown-pragmas"
+Warn when a #pragma directive is encountered which is not understood by
+\&\s-1GCC\s0. If this command line option is used, warnings will even be issued
+for unknown pragmas in system header files. This is not the case if
+the warnings were only enabled by the \fB\-Wall\fR command line option.
+.Ip "\fB\-Wall\fR" 4
+.IX Item "-Wall"
+All of the above \fB\-W\fR options combined. This enables all the
+warnings about constructions that some users consider questionable, and
+that are easy to avoid (or modify to prevent the warning), even in
+conjunction with macros.
+.Ip "\fB\-Wmost\fR" 4
+.IX Item "-Wmost"
+This is equivalent to \-Wall \-Wno-parentheses. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-Wdiv-by-zero\fR" 4
+.IX Item "-Wdiv-by-zero"
+Warn about compile-time integer division by zero. This is default. To
+inhibit the warning messages, use \fB\-Wno-div-by-zero\fR. Floating
+point division by zero is not warned about, as it can be a legitimate
+way of obtaining infinities and NaNs.
+.Ip "\fB\-Wmultichar\fR" 4
+.IX Item "-Wmultichar"
+Warn if a multicharacter constant (\fB'\s-1FOOF\s0'\fR) is used. This is
+default. To inhibit the warning messages, use \fB\-Wno-multichar\fR.
+Usually they indicate a typo in the user's code, as they have
+implementation-defined values, and should not be used in portable code.
+.Ip "\fB\-Wsystem-headers\fR" 4
+.IX Item "-Wsystem-headers"
+Print warning messages for constructs found in system header files.
+Warnings from system headers are normally suppressed, on the assumption
+that they usually do not indicate real problems and would only make the
+compiler output harder to read. Using this command line option tells
+\&\s-1GCC\s0 to emit warnings from system headers as if they occurred in user
+code. However, note that using \fB\-Wall\fR in conjunction with this
+option will \fInot\fR warn about unknown pragmas in system
+headers\-\-\-for that, \fB\-Wunknown-pragmas\fR must also be used.
+.PP
+The following \fB\-W...\fR options are not implied by \fB\-Wall\fR.
+Some of them warn about constructions that users generally do not
+consider questionable, but which occasionally you might wish to check
+for; others warn about constructions that are necessary or hard to avoid
+in some cases, and there is no simple way to modify the code to suppress
+the warning.
+.Ip "\fB\-W\fR" 4
+.IX Item "-W"
+Print extra warning messages for these events:
+.RS 4
+.Ip "\(bu" 4
+A function can return either with or without a value. (Falling
+off the end of the function body is considered returning without
+a value.) For example, this function would evoke such a
+warning:
+.Sp
+.Vb 5
+\& foo (a)
+\& {
+\& if (a > 0)
+\& return a;
+\& }
+.Ve
+.Ip "\(bu" 4
+An expression-statement or the left-hand side of a comma expression
+contains no side effects.
+To suppress the warning, cast the unused expression to void.
+For example, an expression such as \fBx[i,j]\fR will cause a warning,
+but \fBx[(void)i,j]\fR will not.
+.Ip "\(bu" 4
+An unsigned value is compared against zero with \fB<\fR or \fB<=\fR.
+.Ip "\(bu" 4
+A comparison like \fBx<=y<=z\fR appears; this is equivalent to
+\&\fB(x<=y ? 1 : 0) <= z\fR, which is a different interpretation from
+that of ordinary mathematical notation.
+.Ip "\(bu" 4
+Storage-class specifiers like \f(CW\*(C`static\*(C'\fR are not the first things in
+a declaration. According to the C Standard, this usage is obsolescent.
+.Ip "\(bu" 4
+The return type of a function has a type qualifier such as \f(CW\*(C`const\*(C'\fR.
+Such a type qualifier has no effect, since the value returned by a
+function is not an lvalue. (But don't warn about the \s-1GNU\s0 extension of
+\&\f(CW\*(C`volatile void\*(C'\fR return types. That extension will be warned about
+if \fB\-pedantic\fR is specified.)
+.Ip "\(bu" 4
+If \fB\-Wall\fR or \fB\-Wunused\fR is also specified, warn about unused
+arguments.
+.Ip "\(bu" 4
+A comparison between signed and unsigned values could produce an
+incorrect result when the signed value is converted to unsigned.
+(But don't warn if \fB\-Wno-sign-compare\fR is also specified.)
+.Ip "\(bu" 4
+An aggregate has a partly bracketed initializer.
+For example, the following code would evoke such a warning,
+because braces are missing around the initializer for \f(CW\*(C`x.h\*(C'\fR:
+.Sp
+.Vb 3
+\& struct s { int f, g; };
+\& struct t { struct s h; int i; };
+\& struct t x = { 1, 2, 3 };
+.Ve
+.Ip "\(bu" 4
+An aggregate has an initializer which does not initialize all members.
+For example, the following code would cause such a warning, because
+\&\f(CW\*(C`x.h\*(C'\fR would be implicitly initialized to zero:
+.Sp
+.Vb 2
+\& struct s { int f, g, h; };
+\& struct s x = { 3, 4 };
+.Ve
+.RE
+.RS 4
+.RE
+.Ip "\fB\-Wfloat-equal\fR" 4
+.IX Item "-Wfloat-equal"
+Warn if floating point values are used in equality comparisons.
+.Sp
+The idea behind this is that sometimes it is convenient (for the
+programmer) to consider floating-point values as approximations to
+infinitely precise real numbers. If you are doing this, then you need
+to compute (by analysing the code, or in some other way) the maximum or
+likely maximum error that the computation introduces, and allow for it
+when performing comparisons (and when producing output, but that's a
+different problem). In particular, instead of testing for equality, you
+would check to see whether the two values have ranges that overlap; and
+this is done with the relational operators, so equality comparisons are
+probably mistaken.
+.Ip "\fB\-Wtraditional\fR (C only)" 4
+.IX Item "-Wtraditional (C only)"
+Warn about certain constructs that behave differently in traditional and
+\&\s-1ISO\s0 C. Also warn about \s-1ISO\s0 C constructs that have no traditional C
+equivalent, and/or problematic constructs which should be avoided.
+.RS 4
+.Ip "\(bu" 4
+Macro parameters that appear within string literals in the macro body.
+In traditional C macro replacement takes place within string literals,
+but does not in \s-1ISO\s0 C.
+.Ip "\(bu" 4
+In traditional C, some preprocessor directives did not exist.
+Traditional preprocessors would only consider a line to be a directive
+if the \fB#\fR appeared in column 1 on the line. Therefore
+\&\fB\-Wtraditional\fR warns about directives that traditional C
+understands but would ignore because the \fB#\fR does not appear as the
+first character on the line. It also suggests you hide directives like
+\&\fB#pragma\fR not understood by traditional C by indenting them. Some
+traditional implementations would not recognize \fB#elif\fR, so it
+suggests avoiding it altogether.
+.Ip "\(bu" 4
+A function-like macro that appears without arguments.
+.Ip "\(bu" 4
+The unary plus operator.
+.Ip "\(bu" 4
+The \fBU\fR integer constant suffix, or the \fBF\fR or \fBL\fR floating point
+constant suffixes. (Traditional C does support the \fBL\fR suffix on integer
+constants.) Note, these suffixes appear in macros defined in the system
+headers of most modern systems, e.g. the \fB_MIN\fR/\fB_MAX\fR macros in \f(CW\*(C`<limits.h>\*(C'\fR.
+Use of these macros in user code might normally lead to spurious
+warnings, however gcc's integrated preprocessor has enough context to
+avoid warning in these cases.
+.Ip "\(bu" 4
+A function declared external in one block and then used after the end of
+the block.
+.Ip "\(bu" 4
+A \f(CW\*(C`switch\*(C'\fR statement has an operand of type \f(CW\*(C`long\*(C'\fR.
+.Ip "\(bu" 4
+A non-\f(CW\*(C`static\*(C'\fR function declaration follows a \f(CW\*(C`static\*(C'\fR one.
+This construct is not accepted by some traditional C compilers.
+.Ip "\(bu" 4
+The \s-1ISO\s0 type of an integer constant has a different width or
+signedness from its traditional type. This warning is only issued if
+the base of the constant is ten. I.e. hexadecimal or octal values, which
+typically represent bit patterns, are not warned about.
+.Ip "\(bu" 4
+Usage of \s-1ISO\s0 string concatenation is detected.
+.Ip "\(bu" 4
+Initialization of automatic aggregates.
+.Ip "\(bu" 4
+Identifier conflicts with labels. Traditional C lacks a separate
+namespace for labels.
+.Ip "\(bu" 4
+Initialization of unions. If the initializer is zero, the warning is
+omitted. This is done under the assumption that the zero initializer in
+user code appears conditioned on e.g. \f(CW\*(C`_\|_STDC_\|_\*(C'\fR to avoid missing
+initializer warnings and relies on default initialization to zero in the
+traditional C case.
+.Ip "\(bu" 4
+Conversions by prototypes between fixed/floating point values and vice
+versa. The absence of these prototypes when compiling with traditional
+C would cause serious problems. This is a subset of the possible
+conversion warnings, for the full set use \fB\-Wconversion\fR.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-Wundef\fR" 4
+.IX Item "-Wundef"
+Warn if an undefined identifier is evaluated in an \fB#if\fR directive.
+.Ip "\fB\-Wshadow\fR" 4
+.IX Item "-Wshadow"
+Warn whenever a local variable shadows another local variable, parameter or
+global variable or whenever a built-in function is shadowed.
+.Ip "\fB\-Wlarger-than-\fR\fIlen\fR" 4
+.IX Item "-Wlarger-than-len"
+Warn whenever an object of larger than \fIlen\fR bytes is defined.
+.Ip "\fB\-Wpointer-arith\fR" 4
+.IX Item "-Wpointer-arith"
+Warn about anything that depends on the ``size of'' a function type or
+of \f(CW\*(C`void\*(C'\fR. \s-1GNU\s0 C assigns these types a size of 1, for
+convenience in calculations with \f(CW\*(C`void *\*(C'\fR pointers and pointers
+to functions.
+.Ip "\fB\-Wbad-function-cast\fR (C only)" 4
+.IX Item "-Wbad-function-cast (C only)"
+Warn whenever a function call is cast to a non-matching type.
+For example, warn if \f(CW\*(C`int malloc()\*(C'\fR is cast to \f(CW\*(C`anything *\*(C'\fR.
+.Ip "\fB\-Wcast-qual\fR" 4
+.IX Item "-Wcast-qual"
+Warn whenever a pointer is cast so as to remove a type qualifier from
+the target type. For example, warn if a \f(CW\*(C`const char *\*(C'\fR is cast
+to an ordinary \f(CW\*(C`char *\*(C'\fR.
+.Ip "\fB\-Wcast-align\fR" 4
+.IX Item "-Wcast-align"
+Warn whenever a pointer is cast such that the required alignment of the
+target is increased. For example, warn if a \f(CW\*(C`char *\*(C'\fR is cast to
+an \f(CW\*(C`int *\*(C'\fR on machines where integers can only be accessed at
+two- or four-byte boundaries.
+.Ip "\fB\-Wwrite-strings\fR" 4
+.IX Item "-Wwrite-strings"
+When compiling C, give string constants the type \f(CW\*(C`const
+char[\f(CIlength\f(CW]\*(C'\fR so that
+copying the address of one into a non-\f(CW\*(C`const\*(C'\fR \f(CW\*(C`char *\*(C'\fR
+pointer will get a warning; when compiling \*(C+, warn about the
+deprecated conversion from string constants to \f(CW\*(C`char *\*(C'\fR.
+These warnings will help you find at
+compile time code that can try to write into a string constant, but
+only if you have been very careful about using \f(CW\*(C`const\*(C'\fR in
+declarations and prototypes. Otherwise, it will just be a nuisance;
+this is why we did not make \fB\-Wall\fR request these warnings.
+.Ip "\fB\-Wconversion\fR" 4
+.IX Item "-Wconversion"
+Warn if a prototype causes a type conversion that is different from what
+would happen to the same argument in the absence of a prototype. This
+includes conversions of fixed point to floating and vice versa, and
+conversions changing the width or signedness of a fixed point argument
+except when the same as the default promotion.
+.Sp
+Also, warn if a negative integer constant expression is implicitly
+converted to an unsigned type. For example, warn about the assignment
+\&\f(CW\*(C`x = \-1\*(C'\fR if \f(CW\*(C`x\*(C'\fR is unsigned. But do not warn about explicit
+casts like \f(CW\*(C`(unsigned) \-1\*(C'\fR.
+.Ip "\fB\-Wsign-compare\fR" 4
+.IX Item "-Wsign-compare"
+Warn when a comparison between signed and unsigned values could produce
+an incorrect result when the signed value is converted to unsigned.
+This warning is also enabled by \fB\-W\fR; to get the other warnings
+of \fB\-W\fR without this warning, use \fB\-W \-Wno-sign-compare\fR.
+.Ip "\fB\-Waggregate-return\fR" 4
+.IX Item "-Waggregate-return"
+Warn if any functions that return structures or unions are defined or
+called. (In languages where you can return an array, this also elicits
+a warning.)
+.Ip "\fB\-Wstrict-prototypes\fR (C only)" 4
+.IX Item "-Wstrict-prototypes (C only)"
+Warn if a function is declared or defined without specifying the
+argument types. (An old-style function definition is permitted without
+a warning if preceded by a declaration which specifies the argument
+types.)
+.Ip "\fB\-Wmissing-prototypes\fR (C only)" 4
+.IX Item "-Wmissing-prototypes (C only)"
+Warn if a global function is defined without a previous prototype
+declaration. This warning is issued even if the definition itself
+provides a prototype. The aim is to detect global functions that fail
+to be declared in header files.
+.Ip "\fB\-Wmissing-declarations\fR" 4
+.IX Item "-Wmissing-declarations"
+Warn if a global function is defined without a previous declaration.
+Do so even if the definition itself provides a prototype.
+Use this option to detect global functions that are not declared in
+header files.
+.Ip "\fB\-Wmissing-noreturn\fR" 4
+.IX Item "-Wmissing-noreturn"
+Warn about functions which might be candidates for attribute \f(CW\*(C`noreturn\*(C'\fR.
+Note these are only possible candidates, not absolute ones. Care should
+be taken to manually verify functions actually do not ever return before
+adding the \f(CW\*(C`noreturn\*(C'\fR attribute, otherwise subtle code generation
+bugs could be introduced. You will not get a warning for \f(CW\*(C`main\*(C'\fR in
+hosted C environments.
+.Ip "\fB\-Wmissing-format-attribute\fR" 4
+.IX Item "-Wmissing-format-attribute"
+If \fB\-Wformat\fR is enabled, also warn about functions which might be
+candidates for \f(CW\*(C`format\*(C'\fR attributes. Note these are only possible
+candidates, not absolute ones. \s-1GCC\s0 will guess that \f(CW\*(C`format\*(C'\fR
+attributes might be appropriate for any function that calls a function
+like \f(CW\*(C`vprintf\*(C'\fR or \f(CW\*(C`vscanf\*(C'\fR, but this might not always be the
+case, and some functions for which \f(CW\*(C`format\*(C'\fR attributes are
+appropriate may not be detected. This option has no effect unless
+\&\fB\-Wformat\fR is enabled (possibly by \fB\-Wall\fR).
+.Ip "\fB\-Wno-deprecated-declarations\fR" 4
+.IX Item "-Wno-deprecated-declarations"
+Do not warn about uses of functions, variables, and types marked as
+deprecated by using the \f(CW\*(C`deprecated\*(C'\fR attribute.
+(@pxref{Function Attributes}, \f(CW@pxref\fR{Variable Attributes},
+\&\f(CW@pxref\fR{Type Attributes}.)
+.Ip "\fB\-Wpacked\fR" 4
+.IX Item "-Wpacked"
+Warn if a structure is given the packed attribute, but the packed
+attribute has no effect on the layout or size of the structure.
+Such structures may be mis-aligned for little benefit. For
+instance, in this code, the variable \f(CW\*(C`f.x\*(C'\fR in \f(CW\*(C`struct bar\*(C'\fR
+will be misaligned even though \f(CW\*(C`struct bar\*(C'\fR does not itself
+have the packed attribute:
+.Sp
+.Vb 8
+\& struct foo {
+\& int x;
+\& char a, b, c, d;
+\& } __attribute__((packed));
+\& struct bar {
+\& char z;
+\& struct foo f;
+\& };
+.Ve
+.Ip "\fB\-Wpadded\fR" 4
+.IX Item "-Wpadded"
+Warn if padding is included in a structure, either to align an element
+of the structure or to align the whole structure. Sometimes when this
+happens it is possible to rearrange the fields of the structure to
+reduce the padding and so make the structure smaller.
+.Ip "\fB\-Wredundant-decls\fR" 4
+.IX Item "-Wredundant-decls"
+Warn if anything is declared more than once in the same scope, even in
+cases where multiple declaration is valid and changes nothing.
+.Ip "\fB\-Wnested-externs\fR (C only)" 4
+.IX Item "-Wnested-externs (C only)"
+Warn if an \f(CW\*(C`extern\*(C'\fR declaration is encountered within a function.
+.Ip "\fB\-Wunreachable-code\fR" 4
+.IX Item "-Wunreachable-code"
+Warn if the compiler detects that code will never be executed.
+.Sp
+This option is intended to warn when the compiler detects that at
+least a whole line of source code will never be executed, because
+some condition is never satisfied or because it is after a
+procedure that never returns.
+.Sp
+It is possible for this option to produce a warning even though there
+are circumstances under which part of the affected line can be executed,
+so care should be taken when removing apparently-unreachable code.
+.Sp
+For instance, when a function is inlined, a warning may mean that the
+line is unreachable in only one inlined copy of the function.
+.Sp
+This option is not made part of \fB\-Wall\fR because in a debugging
+version of a program there is often substantial code which checks
+correct functioning of the program and is, hopefully, unreachable
+because the program does work. Another common use of unreachable
+code is to provide behavior which is selectable at compile-time.
+.Ip "\fB\-Winline\fR" 4
+.IX Item "-Winline"
+Warn if a function can not be inlined and it was declared as inline.
+.Ip "\fB\-Wno-long-double\fR" 4
+.IX Item "-Wno-long-double"
+Inhibit warning if the \fBlong double\fR type is used. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-Wlong-long\fR" 4
+.IX Item "-Wlong-long"
+Warn if \fBlong long\fR type is used. This is default. To inhibit
+the warning messages, use \fB\-Wno-long-long\fR. Flags
+\&\fB\-Wlong-long\fR and \fB\-Wno-long-long\fR are taken into account
+only when \fB\-pedantic\fR flag is used.
+.Ip "\fB\-Wdisabled-optimization\fR" 4
+.IX Item "-Wdisabled-optimization"
+Warn if a requested optimization pass is disabled. This warning does
+not generally indicate that there is anything wrong with your code; it
+merely indicates that \s-1GCC\s0's optimizers were unable to handle the code
+effectively. Often, the problem is that your code is too big or too
+complex; \s-1GCC\s0 will refuse to optimize programs when the optimization
+itself is likely to take inordinate amounts of time.
+.Ip "\fB\-Werror\fR" 4
+.IX Item "-Werror"
+Make all warnings into errors.
+.Sh "Options for Debugging Your Program or \s-1GCC\s0"
+.IX Subsection "Options for Debugging Your Program or GCC"
+\&\s-1GCC\s0 has various special options that are used for debugging
+either your program or \s-1GCC:\s0
+.Ip "\fB\-g\fR" 4
+.IX Item "-g"
+Produce debugging information in the operating system's native format
+(stabs, \s-1COFF\s0, \s-1XCOFF\s0, or \s-1DWARF\s0). \s-1GDB\s0 can work with this debugging
+information.
+.Sp
+On most systems that use stabs format, \fB\-g\fR enables use of extra
+debugging information that only \s-1GDB\s0 can use; this extra information
+makes debugging work better in \s-1GDB\s0 but will probably make other debuggers
+crash or
+refuse to read the program. If you want to control for certain whether
+to generate the extra information, use \fB\-gstabs+\fR or \fB\-gstabs\fR
+(see below).
+.Sp
+Unlike most other C compilers, \s-1GCC\s0 allows you to use \fB\-g\fR with
+\&\fB\-O\fR. The shortcuts taken by optimized code may occasionally
+produce surprising results: some variables you declared may not exist
+at all; flow of control may briefly move where you did not expect it;
+some statements may not be executed because they compute constant
+results or their values were already at hand; some statements may
+execute in different places because they were moved out of loops.
+.Sp
+Nevertheless it proves possible to debug optimized output. This makes
+it reasonable to use the optimizer for programs that might have bugs.
+.Sp
+The following options are useful when \s-1GCC\s0 is generated with the
+capability for more than one debugging format.
+.Ip "\fB\-ggdb\fR" 4
+.IX Item "-ggdb"
+Produce debugging information for use by \s-1GDB\s0. This means to use the
+most expressive format available (\s-1DWARF\s0 2, stabs, or the native format
+if neither of those are supported), including \s-1GDB\s0 extensions if at all
+possible.
+.Ip "\fB\-gstabs\fR" 4
+.IX Item "-gstabs"
+Produce debugging information in stabs format (if that is supported),
+without \s-1GDB\s0 extensions. This is the format used by \s-1DBX\s0 on most \s-1BSD\s0
+systems. On \s-1MIPS\s0, Alpha and System V Release 4 systems this option
+produces stabs debugging output which is not understood by \s-1DBX\s0 or \s-1SDB\s0.
+On System V Release 4 systems this option requires the \s-1GNU\s0 assembler.
+.Ip "\fB\-gstabs+\fR" 4
+.IX Item "-gstabs+"
+Produce debugging information in stabs format (if that is supported),
+using \s-1GNU\s0 extensions understood only by the \s-1GNU\s0 debugger (\s-1GDB\s0). The
+use of these extensions is likely to make other debuggers crash or
+refuse to read the program.
+.Sp
+(Other debug formats, such as \fB\-gcoff\fR, are not supported in
+Darwin or Mac \s-1OS\s0 X.)
+.Ip "\fB\-g\fR\fIlevel\fR" 4
+.IX Item "-glevel"
+.PD 0
+.Ip "\fB\-ggdb\fR\fIlevel\fR" 4
+.IX Item "-ggdblevel"
+.Ip "\fB\-gstabs\fR\fIlevel\fR" 4
+.IX Item "-gstabslevel"
+.PD
+Request debugging information and also use \fIlevel\fR to specify how
+much information. The default level is 2.
+.Sp
+Level 1 produces minimal information, enough for making backtraces in
+parts of the program that you don't plan to debug. This includes
+descriptions of functions and external variables, but no information
+about local variables and no line numbers.
+.Sp
+Level 3 includes extra information, such as all the macro definitions
+present in the program. Some debuggers support macro expansion when
+you use \fB\-g3\fR.
+.Ip "\fB\-p\fR" 4
+.IX Item "-p"
+Generate extra code to write profile information suitable for the
+analysis program \f(CW\*(C`prof\*(C'\fR. You must use this option when compiling
+the source files you want data about, and you must also use it when
+linking.
+.Ip "\fB\-pg\fR" 4
+.IX Item "-pg"
+Generate extra code to write profile information suitable for the
+analysis program \f(CW\*(C`gprof\*(C'\fR. You must use this option when compiling
+the source files you want data about, and you must also use it when
+linking.
+.Ip "\fB\-a\fR" 4
+.IX Item "-a"
+Generate extra code to write profile information for basic blocks, which will
+record the number of times each basic block is executed, the basic block start
+address, and the function name containing the basic block. If \fB\-g\fR is
+used, the line number and filename of the start of the basic block will also be
+recorded. If not overridden by the machine description, the default action is
+to append to the text file \fIbb.out\fR.
+.Sp
+This data could be analyzed by a program like \f(CW\*(C`tcov\*(C'\fR. Note,
+however, that the format of the data is not what \f(CW\*(C`tcov\*(C'\fR expects.
+Eventually \s-1GNU\s0 \f(CW\*(C`gprof\*(C'\fR should be extended to process this data.
+.Ip "\fB\-Q\fR" 4
+.IX Item "-Q"
+Makes the compiler print out each function name as it is compiled, and
+print some statistics about each pass when it finishes.
+.Ip "\fB\-ftime-report\fR" 4
+.IX Item "-ftime-report"
+Makes the compiler print some statistics about the time consumed by each
+pass when it finishes.
+.Ip "\fB\-fmem-report\fR" 4
+.IX Item "-fmem-report"
+Makes the compiler print some statistics about permanent memory
+allocation when it finishes.
+.Ip "\fB\-fprofile-arcs\fR" 4
+.IX Item "-fprofile-arcs"
+Instrument \fIarcs\fR during compilation to generate coverage data
+or for profile-directed block ordering. During execution the program
+records how many times each branch is executed and how many times it is
+taken. When the compiled program exits it saves this data to a file
+called \fI\fIsourcename\fI.da\fR for each source file.
+.Sp
+For profile-directed block ordering, compile the program with
+\&\fB\-fprofile-arcs\fR plus optimization and code generation options,
+generate the arc profile information by running the program on a
+selected workload, and then compile the program again with the same
+optimization and code generation options plus
+\&\fB\-fbranch-probabilities\fR.
+.Sp
+The other use of \fB\-fprofile-arcs\fR is for use with \f(CW\*(C`gcov\*(C'\fR,
+when it is used with the \fB\-ftest-coverage\fR option. \s-1GCC\s0
+supports two methods of determining code coverage: the options that
+support \f(CW\*(C`gcov\*(C'\fR, and options \fB\-a\fR and \fB\-ax\fR, which
+write information to text files. The options that support \f(CW\*(C`gcov\*(C'\fR
+do not need to instrument every arc in the program, so a program compiled
+with them runs faster than a program compiled with \fB\-a\fR, which
+adds instrumentation code to every basic block in the program. The
+tradeoff: since \f(CW\*(C`gcov\*(C'\fR does not have execution counts for all
+branches, it must start with the execution counts for the instrumented
+branches, and then iterate over the program flow graph until the entire
+graph has been solved. Hence, \f(CW\*(C`gcov\*(C'\fR runs a little more slowly than
+a program which uses information from \fB\-a\fR and \fB\-ax\fR.
+.Sp
+With \fB\-fprofile-arcs\fR, for each function of your program \s-1GCC\s0
+creates a program flow graph, then finds a spanning tree for the graph.
+Only arcs that are not on the spanning tree have to be instrumented: the
+compiler adds code to count the number of times that these arcs are
+executed. When an arc is the only exit or only entrance to a block, the
+instrumentation code can be added to the block; otherwise, a new basic
+block must be created to hold the instrumentation code.
+.Sp
+This option makes it possible to estimate branch probabilities and to
+calculate basic block execution counts. In general, basic block
+execution counts as provided by \fB\-a\fR do not give enough
+information to estimate all branch probabilities.
+.Ip "\fB\-ftest-coverage\fR" 4
+.IX Item "-ftest-coverage"
+Create data files for the \f(CW\*(C`gcov\*(C'\fR code-coverage utility.
+The data file names begin with the name of your source file:
+.RS 4
+.Ip "\fIsourcename\fR\fB.bb\fR" 4
+.IX Item "sourcename.bb"
+A mapping from basic blocks to line numbers, which \f(CW\*(C`gcov\*(C'\fR uses to
+associate basic block execution counts with line numbers.
+.Ip "\fIsourcename\fR\fB.bbg\fR" 4
+.IX Item "sourcename.bbg"
+A list of all arcs in the program flow graph. This allows \f(CW\*(C`gcov\*(C'\fR
+to reconstruct the program flow graph, so that it can compute all basic
+block and arc execution counts from the information in the
+\&\f(CW\*(C`\f(CIsourcename\f(CW.da\*(C'\fR file.
+.RE
+.RS 4
+.Sp
+Use \fB\-ftest-coverage\fR with \fB\-fprofile-arcs\fR; the latter
+option adds instrumentation to the program, which then writes
+execution counts to another data file:
+.RS 4
+.RE
+.Ip "\fIsourcename\fR\fB.da\fR" 4
+.IX Item "sourcename.da"
+Runtime arc execution counts, used in conjunction with the arc
+information in the file \f(CW\*(C`\f(CIsourcename\f(CW.bbg\*(C'\fR.
+.RE
+.RS 4
+.Sp
+Coverage data will map better to the source files if
+\&\fB\-ftest-coverage\fR is used without optimization.
+.RE
+.Ip "\fB\-d\fR\fIletters\fR" 4
+.IX Item "-dletters"
+Says to make debugging dumps during compilation at times specified by
+\&\fIletters\fR. This is used for debugging the compiler. The file names
+for most of the dumps are made by appending a pass number and a word to
+the source file name (e.g. \fIfoo.c.00.rtl\fR or \fIfoo.c.01.sibling\fR).
+Here are the possible letters for use in \fIletters\fR, and their meanings:
+.RS 4
+.Ip "\fBA\fR" 4
+.IX Item "A"
+Annotate the assembler output with miscellaneous debugging information.
+.Ip "\fBb\fR" 4
+.IX Item "b"
+Dump after computing branch probabilities, to \fI\fIfile\fI.14.bp\fR.
+.Ip "\fBB\fR" 4
+.IX Item "B"
+Dump after block reordering, to \fI\fIfile\fI.29.bbro\fR.
+.Ip "\fBc\fR" 4
+.IX Item "c"
+Dump after instruction combination, to the file \fI\fIfile\fI.16.combine\fR.
+.Ip "\fBC\fR" 4
+.IX Item "C"
+Dump after the first if conversion, to the file \fI\fIfile\fI.17.ce\fR.
+.Ip "\fBd\fR" 4
+.IX Item "d"
+Dump after delayed branch scheduling, to \fI\fIfile\fI.31.dbr\fR.
+.Ip "\fBD\fR" 4
+.IX Item "D"
+Dump all macro definitions, at the end of preprocessing, in addition to
+normal output.
+.Ip "\fBe\fR" 4
+.IX Item "e"
+Dump after \s-1SSA\s0 optimizations, to \fI\fIfile\fI.04.ssa\fR and
+\&\fI\fIfile\fI.07.ussa\fR.
+.Ip "\fBE\fR" 4
+.IX Item "E"
+Dump after the second if conversion, to \fI\fIfile\fI.26.ce2\fR.
+.Ip "\fBf\fR" 4
+.IX Item "f"
+Dump after life analysis, to \fI\fIfile\fI.15.life\fR.
+.Ip "\fBF\fR" 4
+.IX Item "F"
+Dump after purging \f(CW\*(C`ADDRESSOF\*(C'\fR codes, to \fI\fIfile\fI.09.addressof\fR.
+.Ip "\fBg\fR" 4
+.IX Item "g"
+Dump after global register allocation, to \fI\fIfile\fI.21.greg\fR.
+.Ip "\fBh\fR" 4
+.IX Item "h"
+Dump after finalization of \s-1EH\s0 handling code, to \fI\fIfile\fI.02.eh\fR.
+.Ip "\fBk\fR" 4
+.IX Item "k"
+Dump after reg-to-stack conversion, to \fI\fIfile\fI.28.stack\fR.
+.Ip "\fBo\fR" 4
+.IX Item "o"
+Dump after post-reload optimizations, to \fI\fIfile\fI.22.postreload\fR.
+.Ip "\fBG\fR" 4
+.IX Item "G"
+Dump after \s-1GCSE\s0, to \fI\fIfile\fI.10.gcse\fR.
+.Ip "\fBi\fR" 4
+.IX Item "i"
+Dump after sibling call optimizations, to \fI\fIfile\fI.01.sibling\fR.
+.Ip "\fBj\fR" 4
+.IX Item "j"
+Dump after the first jump optimization, to \fI\fIfile\fI.03.jump\fR.
+.Ip "\fBk\fR" 4
+.IX Item "k"
+Dump after conversion from registers to stack, to \fI\fIfile\fI.32.stack\fR.
+.Ip "\fBl\fR" 4
+.IX Item "l"
+Dump after local register allocation, to \fI\fIfile\fI.20.lreg\fR.
+.Ip "\fBL\fR" 4
+.IX Item "L"
+Dump after loop optimization, to \fI\fIfile\fI.11.loop\fR.
+.Ip "\fBM\fR" 4
+.IX Item "M"
+Dump after performing the machine dependent reorganisation pass, to
+\&\fI\fIfile\fI.30.mach\fR.
+.Ip "\fBn\fR" 4
+.IX Item "n"
+Dump after register renumbering, to \fI\fIfile\fI.25.rnreg\fR.
+.Ip "\fBN\fR" 4
+.IX Item "N"
+Dump after the register move pass, to \fI\fIfile\fI.18.regmove\fR.
+.Ip "\fBr\fR" 4
+.IX Item "r"
+Dump after \s-1RTL\s0 generation, to \fI\fIfile\fI.00.rtl\fR.
+.Ip "\fBR\fR" 4
+.IX Item "R"
+Dump after the second scheduling pass, to \fI\fIfile\fI.27.sched2\fR.
+.Ip "\fBs\fR" 4
+.IX Item "s"
+Dump after \s-1CSE\s0 (including the jump optimization that sometimes follows
+\&\s-1CSE\s0), to \fI\fIfile\fI.08.cse\fR.
+.Ip "\fBS\fR" 4
+.IX Item "S"
+Dump after the first scheduling pass, to \fI\fIfile\fI.19.sched\fR.
+.Ip "\fBt\fR" 4
+.IX Item "t"
+Dump after the second \s-1CSE\s0 pass (including the jump optimization that
+sometimes follows \s-1CSE\s0), to \fI\fIfile\fI.12.cse2\fR.
+.Ip "\fBw\fR" 4
+.IX Item "w"
+Dump after the second flow pass, to \fI\fIfile\fI.23.flow2\fR.
+.Ip "\fBX\fR" 4
+.IX Item "X"
+Dump after \s-1SSA\s0 dead code elimination, to \fI\fIfile\fI.06.ssadce\fR.
+.Ip "\fBz\fR" 4
+.IX Item "z"
+Dump after the peephole pass, to \fI\fIfile\fI.24.peephole2\fR.
+.Ip "\fBa\fR" 4
+.IX Item "a"
+Produce all the dumps listed above.
+.Ip "\fBm\fR" 4
+.IX Item "m"
+Print statistics on memory usage, at the end of the run, to
+standard error.
+.Ip "\fBp\fR" 4
+.IX Item "p"
+Annotate the assembler output with a comment indicating which
+pattern and alternative was used. The length of each instruction is
+also printed.
+.Ip "\fBP\fR" 4
+.IX Item "P"
+Dump the \s-1RTL\s0 in the assembler output as a comment before each instruction.
+Also turns on \fB\-dp\fR annotation.
+.Ip "\fBv\fR" 4
+.IX Item "v"
+For each of the other indicated dump files (except for
+\&\fI\fIfile\fI.00.rtl\fR), dump a representation of the control flow graph
+suitable for viewing with \s-1VCG\s0 to \fI\fIfile\fI.\fIpass\fI.vcg\fR.
+.Ip "\fBx\fR" 4
+.IX Item "x"
+Just generate \s-1RTL\s0 for a function instead of compiling it. Usually used
+with \fBr\fR.
+.Ip "\fBy\fR" 4
+.IX Item "y"
+Dump debugging information during parsing, to standard error.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-fdump-unnumbered\fR" 4
+.IX Item "-fdump-unnumbered"
+When doing debugging dumps (see \fB\-d\fR option above), suppress instruction
+numbers and line number note output. This makes it more feasible to
+use diff on debugging dumps for compiler invocations with different
+options, in particular with and without \fB\-g\fR.
+.Ip "\fB\-fdump-translation-unit\fR (C and \*(C+ only)" 4
+.IX Item "-fdump-translation-unit (C and only)"
+.PD 0
+.Ip "\fB\-fdump-translation-unit-\fR\fIoptions\fR\fB \fR(C and \*(C+ only)" 4
+.IX Item "-fdump-translation-unit-options (C and only)"
+.PD
+Dump a representation of the tree structure for the entire translation
+unit to a file. The file name is made by appending \fI.tu\fR to the
+source file name. If the \fB-\fR\fIoptions\fR form is used, \fIoptions\fR
+controls the details of the dump as described for the
+\&\fB\-fdump-tree\fR options.
+.Ip "\fB\-fdump-class-hierarchy\fR (\*(C+ only)" 4
+.IX Item "-fdump-class-hierarchy ( only)"
+.PD 0
+.Ip "\fB\-fdump-class-hierarchy-\fR\fIoptions\fR\fB \fR(\*(C+ only)" 4
+.IX Item "-fdump-class-hierarchy-options ( only)"
+.PD
+Dump a representation of each class's hierarchy and virtual function
+table layout to a file. The file name is made by appending \fI.class\fR
+to the source file name. If the \fB-\fR\fIoptions\fR form is used,
+\&\fIoptions\fR controls the details of the dump as described for the
+\&\fB\-fdump-tree\fR options.
+.Ip "\fB\-fdump-tree-\fR\fIswitch\fR\fB \fR(\*(C+ only)" 4
+.IX Item "-fdump-tree-switch ( only)"
+.PD 0
+.Ip "\fB\-fdump-tree-\fR\fIswitch\fR\fB-\fR\fIoptions\fR\fB \fR(\*(C+ only)" 4
+.IX Item "-fdump-tree-switch-options ( only)"
+.PD
+Control the dumping at various stages of processing the intermediate
+language tree to a file. The file name is generated by appending a switch
+specific suffix to the source file name. If the \fB-\fR\fIoptions\fR
+form is used, \fIoptions\fR is a list of \fB-\fR separated options that
+control the details of the dump. Not all options are applicable to all
+dumps, those which are not meaningful will be ignored. The following
+options are available
+.RS 4
+.Ip "\fBaddress\fR" 4
+.IX Item "address"
+Print the address of each node. Usually this is not meaningful as it
+changes according to the environment and source file. Its primary use
+is for tying up a dump file with a debug environment.
+.Ip "\fBslim\fR" 4
+.IX Item "slim"
+Inhibit dumping of members of a scope or body of a function merely
+because that scope has been reached. Only dump such items when they
+are directly reachable by some other path.
+.Ip "\fBall\fR" 4
+.IX Item "all"
+Turn on all options.
+.RE
+.RS 4
+.Sp
+The following tree dumps are possible:
+.RS 4
+.RE
+.Ip "\fBoriginal\fR" 4
+.IX Item "original"
+Dump before any tree based optimization, to \fI\fIfile\fI.original\fR.
+.Ip "\fBoptimized\fR" 4
+.IX Item "optimized"
+Dump after all tree based optimization, to \fI\fIfile\fI.optimized\fR.
+.Ip "\fBinlined\fR" 4
+.IX Item "inlined"
+Dump after function inlining, to \fI\fIfile\fI.inlined\fR.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-fpretend-float\fR" 4
+.IX Item "-fpretend-float"
+When running a cross-compiler, pretend that the target machine uses the
+same floating point format as the host machine. This causes incorrect
+output of the actual floating constants, but the actual instruction
+sequence will probably be the same as \s-1GCC\s0 would make when running on
+the target machine.
+.Ip "\fB\-save-temps\fR" 4
+.IX Item "-save-temps"
+Store the usual ``temporary'' intermediate files permanently; place them
+in the current directory and name them based on the source file. Thus,
+compiling \fIfoo.c\fR with \fB\-c \-save-temps\fR would produce files
+\&\fIfoo.i\fR and \fIfoo.s\fR, as well as \fIfoo.o\fR. This creates a
+preprocessed \fIfoo.i\fR output file even though the compiler now
+normally uses an integrated preprocessor.
+.Ip "\fB\-time\fR" 4
+.IX Item "-time"
+Report the \s-1CPU\s0 time taken by each subprocess in the compilation
+sequence. For C source files, this is the compiler proper and assembler
+(plus the linker if linking is done). The output looks like this:
+.Sp
+.Vb 2
+\& # cc1 0.12 0.01
+\& # as 0.00 0.01
+.Ve
+The first number on each line is the ``user time,'' that is time spent
+executing the program itself. The second number is ``system time,''
+time spent executing operating system routines on behalf of the program.
+Both numbers are in seconds.
+.Ip "\fB\-print-file-name=\fR\fIlibrary\fR" 4
+.IX Item "-print-file-name=library"
+Print the full absolute name of the library file \fIlibrary\fR that
+would be used when linking\-\-\-and don't do anything else. With this
+option, \s-1GCC\s0 does not compile or link anything; it just prints the
+file name.
+.Ip "\fB\-print-multi-directory\fR" 4
+.IX Item "-print-multi-directory"
+Print the directory name corresponding to the multilib selected by any
+other switches present in the command line. This directory is supposed
+to exist in \fB\s-1GCC_EXEC_PREFIX\s0\fR.
+.Ip "\fB\-print-multi-lib\fR" 4
+.IX Item "-print-multi-lib"
+Print the mapping from multilib directory names to compiler switches
+that enable them. The directory name is separated from the switches by
+\&\fB;\fR, and each switch starts with an \fB@} instead of the
+\&\f(CB@samp\fB{-\fR, without spaces between multiple switches. This is supposed to
+ease shell-processing.
+.Ip "\fB\-print-prog-name=\fR\fIprogram\fR" 4
+.IX Item "-print-prog-name=program"
+Like \fB\-print-file-name\fR, but searches for a program such as \fBcpp\fR.
+.Ip "\fB\-print-libgcc-file-name\fR" 4
+.IX Item "-print-libgcc-file-name"
+Same as \fB\-print-file-name=libgcc.a\fR.
+.Sp
+This is useful when you use \fB\-nostdlib\fR or \fB\-nodefaultlibs\fR
+but you do want to link with \fIlibgcc.a\fR. You can do
+.Sp
+.Vb 1
+\& gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
+.Ve
+.Ip "\fB\-print-search-dirs\fR" 4
+.IX Item "-print-search-dirs"
+Print the name of the configured installation directory and a list of
+program and library directories gcc will search\-\-\-and don't do anything else.
+.Sp
+This is useful when gcc prints the error message
+\&\fBinstallation problem, cannot exec cpp0: No such file or directory\fR.
+To resolve this you either need to put \fIcpp0\fR and the other compiler
+components where gcc expects to find them, or you can set the environment
+variable \fB\s-1GCC_EXEC_PREFIX\s0\fR to the directory where you installed them.
+Don't forget the trailing '/'.
+.Ip "\fB\-dumpmachine\fR" 4
+.IX Item "-dumpmachine"
+Print the compiler's target machine (for example,
+\&\fBi686\-pc-linux-gnu\fR)\-\-\-and don't do anything else.
+.Ip "\fB\-dumpversion\fR" 4
+.IX Item "-dumpversion"
+Print the compiler version (for example, \fB3.0\fR)\-\-\-and don't do
+anything else.
+.Ip "\fB\-dumpspecs\fR" 4
+.IX Item "-dumpspecs"
+Print the compiler's built-in specs\-\-\-and don't do anything else. (This
+is used when \s-1GCC\s0 itself is being built.)
+.Sh "Options That Control Optimization"
+.IX Subsection "Options That Control Optimization"
+These options control various sorts of optimizations:
+.Ip "\fB\-O\fR" 4
+.IX Item "-O"
+.PD 0
+.Ip "\fB\-O1\fR" 4
+.IX Item "-O1"
+.PD
+Optimize. Optimizing compilation takes somewhat more time, and a lot
+more memory for a large function.
+.Sp
+Without \fB\-O\fR, the compiler's goal is to reduce the cost of
+compilation and to make debugging produce the expected results.
+Statements are independent: if you stop the program with a breakpoint
+between statements, you can then assign a new value to any variable or
+change the program counter to any other statement in the function and
+get exactly the results you would expect from the source code.
+.Sp
+With \fB\-O\fR, the compiler tries to reduce code size and execution
+time, without performing any optimizations that take a great deal of
+compilation time.
+.Sp
+When you specify \fB\-O\fR, the compiler turns on \fB\-fthread-jumps\fR
+and \fB\-fdefer-pop\fR on all machines. The compiler turns on
+\&\fB\-fdelayed-branch\fR on machines that have delay slots, and
+\&\fB\-fomit-frame-pointer\fR on machines that can support debugging even
+without a frame pointer. On some machines the compiler also turns
+on other flags.
+.Sp
+In Apple's version of \s-1GCC\s0, \fB\-fstrict-aliasing\fR,
+\&\fB\-freorder-blocks\fR, and \fB\-fsched-interblock\fR
+are disabled by default when optimizing.
+.Ip "\fB\-O2\fR" 4
+.IX Item "-O2"
+Optimize even more. \s-1GCC\s0 performs nearly all supported optimizations
+that do not involve a space-speed tradeoff. The compiler does not
+perform loop unrolling or function inlining when you specify \fB\-O2\fR.
+As compared to \fB\-O\fR, this option increases both compilation time
+and the performance of the generated code.
+.Sp
+\&\fB\-O2\fR turns on all optional optimizations except for loop unrolling,
+function inlining, and register renaming. It also turns on the
+\&\fB\-fforce-mem\fR option on all machines and frame pointer elimination
+on machines where doing so does not interfere with debugging.
+.Sp
+Please note the warning under \fB\-fgcse\fR about
+invoking \fB\-O2\fR on programs that use computed gotos.
+.Ip "\fB\-O3\fR" 4
+.IX Item "-O3"
+Optimize yet more. \fB\-O3\fR turns on all optimizations specified by
+\&\fB\-O2\fR and also turns on the \fB\-finline-functions\fR and
+\&\fB\-frename-registers\fR options.
+.Ip "\fB\-O0\fR" 4
+.IX Item "-O0"
+Do not optimize.
+.Ip "\fB\-Os\fR" 4
+.IX Item "-Os"
+Optimize for size. \fB\-Os\fR enables all \fB\-O2\fR optimizations that
+do not typically increase code size. It also performs further
+optimizations designed to reduce code size.
+.Sp
+If you use multiple \fB\-O\fR options, with or without level numbers,
+the last such option is the one that is effective.
+.PP
+Options of the form \fB\-f\fR\fIflag\fR specify machine-independent
+flags. Most flags have both positive and negative forms; the negative
+form of \fB\-ffoo\fR would be \fB\-fno-foo\fR. In the table below,
+only one of the forms is listed\-\-\-the one which is not the default.
+You can figure out the other form by either removing \fBno-\fR or
+adding it.
+.Ip "\fB\-ffloat-store\fR" 4
+.IX Item "-ffloat-store"
+Do not store floating point variables in registers, and inhibit other
+options that might change whether a floating point value is taken from a
+register or memory.
+.Sp
+This option prevents undesirable excess precision on machines such as
+the 68000 where the floating registers (of the 68881) keep more
+precision than a \f(CW\*(C`double\*(C'\fR is supposed to have. Similarly for the
+x86 architecture. For most programs, the excess precision does only
+good, but a few programs rely on the precise definition of \s-1IEEE\s0 floating
+point. Use \fB\-ffloat-store\fR for such programs, after modifying
+them to store all pertinent intermediate computations into variables.
+.Ip "\fB\-fno-default-inline\fR" 4
+.IX Item "-fno-default-inline"
+Do not make member functions inline by default merely because they are
+defined inside the class scope (\*(C+ only). Otherwise, when you specify
+\&\fB\-O\fR, member functions defined inside class scope are compiled
+inline by default; i.e., you don't need to add \fBinline\fR in front of
+the member function name.
+.Ip "\fB\-fno-defer-pop\fR" 4
+.IX Item "-fno-defer-pop"
+Always pop the arguments to each function call as soon as that function
+returns. For machines which must pop arguments after a function call,
+the compiler normally lets arguments accumulate on the stack for several
+function calls and pops them all at once.
+.Ip "\fB\-fforce-mem\fR" 4
+.IX Item "-fforce-mem"
+Force memory operands to be copied into registers before doing
+arithmetic on them. This produces better code by making all memory
+references potential common subexpressions. When they are not common
+subexpressions, instruction combination should eliminate the separate
+register-load. The \fB\-O2\fR option turns on this option.
+.Ip "\fB\-fforce-addr\fR" 4
+.IX Item "-fforce-addr"
+Force memory address constants to be copied into registers before
+doing arithmetic on them. This may produce better code just as
+\&\fB\-fforce-mem\fR may.
+.Ip "\fB\-fomit-frame-pointer\fR" 4
+.IX Item "-fomit-frame-pointer"
+Don't keep the frame pointer in a register for functions that
+don't need one. This avoids the instructions to save, set up and
+restore frame pointers; it also makes an extra register available
+in many functions. \fBIt also makes debugging impossible on
+some machines.\fR
+.Sp
+On some machines, such as the \s-1VAX\s0, this flag has no effect, because
+the standard calling sequence automatically handles the frame pointer
+and nothing is saved by pretending it doesn't exist. The
+machine-description macro \f(CW\*(C`FRAME_POINTER_REQUIRED\*(C'\fR controls
+whether a target machine supports this flag.
+.Ip "\fB\-foptimize-sibling-calls\fR" 4
+.IX Item "-foptimize-sibling-calls"
+Optimize sibling and tail recursive calls.
+.Ip "\fB\-ftrapv\fR" 4
+.IX Item "-ftrapv"
+This option generates traps for signed overflow on addition, subtraction,
+multiplication operations.
+.Ip "\fB\-fno-inline\fR" 4
+.IX Item "-fno-inline"
+Don't pay attention to the \f(CW\*(C`inline\*(C'\fR keyword. Normally this option
+is used to keep the compiler from expanding any functions inline.
+Note that if you are not optimizing, no functions can be expanded inline.
+.Ip "\fB\-finline-functions\fR" 4
+.IX Item "-finline-functions"
+Integrate all simple functions into their callers. The compiler
+heuristically decides which functions are simple enough to be worth
+integrating in this way.
+.Sp
+If all calls to a given function are integrated, and the function is
+declared \f(CW\*(C`static\*(C'\fR, then the function is normally not output as
+assembler code in its own right.
+.Ip "\fB\-finline-limit=\fR\fIn\fR" 4
+.IX Item "-finline-limit=n"
+By default, gcc limits the size of functions that can be inlined. This flag
+allows the control of this limit for functions that are explicitly marked as
+inline (ie marked with the inline keyword or defined within the class
+definition in c++). \fIn\fR is the size of functions that can be inlined in
+number of pseudo instructions (not counting parameter handling). The default
+value of \fIn\fR is 600.
+Increasing this value can result in more inlined code at
+the cost of compilation time and memory consumption. Decreasing usually makes
+the compilation faster and less code will be inlined (which presumably
+means slower programs). This option is particularly useful for programs that
+use inlining heavily such as those based on recursive templates with \*(C+.
+.Sp
+\&\fINote:\fR pseudo instruction represents, in this particular context, an
+abstract measurement of function's size. In no way, it represents a count
+of assembly instructions and as such its exact meaning might change from one
+release to an another.
+.Ip "\fB\-fkeep-inline-functions\fR" 4
+.IX Item "-fkeep-inline-functions"
+Even if all calls to a given function are integrated, and the function
+is declared \f(CW\*(C`static\*(C'\fR, nevertheless output a separate run-time
+callable version of the function. This switch does not affect
+\&\f(CW\*(C`extern inline\*(C'\fR functions.
+.Ip "\fB\-fkeep-static-consts\fR" 4
+.IX Item "-fkeep-static-consts"
+Emit variables declared \f(CW\*(C`static const\*(C'\fR when optimization isn't turned
+on, even if the variables aren't referenced.
+.Sp
+\&\s-1GCC\s0 enables this option by default. If you want to force the compiler to
+check if the variable was referenced, regardless of whether or not
+optimization is turned on, use the \fB\-fno-keep-static-consts\fR option.
+.Ip "\fB\-fmerge-constants\fR" 4
+.IX Item "-fmerge-constants"
+Attempt to merge identical constants (string constants and floating point
+constants) accross compilation units.
+.Sp
+This option is default for optimized compilation if assembler and linker
+support it. Use \fB\-fno-merge-constants\fR to inhibit this behavior.
+.Ip "\fB\-fmerge-all-constants\fR" 4
+.IX Item "-fmerge-all-constants"
+Attempt to merge identical constants and identical variables.
+.Sp
+This option implies \fB\-fmerge-constants\fR. In addition to
+\&\fB\-fmerge-constants\fR this considers e.g. even constant initialized
+arrays or initialized constant variables with integral or floating point
+types. Languages like C or \*(C+ require each non-automatic variable to
+have distinct location, so using this option will result in non-conforming
+behavior.
+.Ip "\fB\-fno-function-cse\fR" 4
+.IX Item "-fno-function-cse"
+Do not put function addresses in registers; make each instruction that
+calls a constant function contain the function's address explicitly.
+.Sp
+This option results in less efficient code, but some strange hacks
+that alter the assembler output may be confused by the optimizations
+performed when this option is not used.
+.Ip "\fB\-ffast-math\fR" 4
+.IX Item "-ffast-math"
+Sets \fB\-fno-math-errno\fR, \fB\-funsafe-math-optimizations\fR, and \fB\-fno-trapping-math\fR.
+.Sp
+This option causes the preprocessor macro \f(CW\*(C`_\|_FAST_MATH_\|_\*(C'\fR to be defined.
+.Sp
+This option should never be turned on by any \fB\-O\fR option since
+it can result in incorrect output for programs which depend on
+an exact implementation of \s-1IEEE\s0 or \s-1ISO\s0 rules/specifications for
+math functions.
+.Ip "\fB\-fno-math-errno\fR" 4
+.IX Item "-fno-math-errno"
+Do not set \s-1ERRNO\s0 after calling math functions that are executed
+with a single instruction, e.g., sqrt. A program that relies on
+\&\s-1IEEE\s0 exceptions for math error handling may want to use this flag
+for speed while maintaining \s-1IEEE\s0 arithmetic compatibility.
+.Sp
+This option should never be turned on by any \fB\-O\fR option since
+it can result in incorrect output for programs which depend on
+an exact implementation of \s-1IEEE\s0 or \s-1ISO\s0 rules/specifications for
+math functions.
+.Sp
+The default is \fB\-fmath-errno\fR.
+.Ip "\fB\-funsafe-math-optimizations\fR" 4
+.IX Item "-funsafe-math-optimizations"
+Allow optimizations for floating-point arithmetic that (a) assume
+that arguments and results are valid and (b) may violate \s-1IEEE\s0 or
+\&\s-1ANSI\s0 standards. When used at link-time, it may include libraries
+or startup files that change the default \s-1FPU\s0 control word or other
+similar optimizations.
+.Sp
+This option should never be turned on by any \fB\-O\fR option since
+it can result in incorrect output for programs which depend on
+an exact implementation of \s-1IEEE\s0 or \s-1ISO\s0 rules/specifications for
+math functions.
+.Sp
+The default is \fB\-fno-unsafe-math-optimizations\fR.
+.Ip "\fB\-fno-trapping-math\fR" 4
+.IX Item "-fno-trapping-math"
+Compile code assuming that floating-point operations cannot generate
+user-visible traps. Setting this option may allow faster code
+if one relies on ``non-stop'' \s-1IEEE\s0 arithmetic, for example.
+.Sp
+This option should never be turned on by any \fB\-O\fR option since
+it can result in incorrect output for programs which depend on
+an exact implementation of \s-1IEEE\s0 or \s-1ISO\s0 rules/specifications for
+math functions.
+.Sp
+The default is \fB\-ftrapping-math\fR.
+.PP
+The following options control specific optimizations. The \fB\-O2\fR
+option turns on all of these optimizations except \fB\-funroll-loops\fR
+and \fB\-funroll-all-loops\fR. On most machines, the \fB\-O\fR option
+turns on the \fB\-fthread-jumps\fR and \fB\-fdelayed-branch\fR options,
+but specific machines may handle it differently.
+.PP
+You can use the following flags in the rare cases when ``fine-tuning''
+of optimizations to be performed is desired.
+.PP
+Not all of the optimizations performed by \s-1GCC\s0 have \fB\-f\fR options
+to control them.
+.Ip "\fB\-fstrength-reduce\fR" 4
+.IX Item "-fstrength-reduce"
+Perform the optimizations of loop strength reduction and
+elimination of iteration variables.
+.Ip "\fB\-fthread-jumps\fR" 4
+.IX Item "-fthread-jumps"
+Perform optimizations where we check to see if a jump branches to a
+location where another comparison subsumed by the first is found. If
+so, the first branch is redirected to either the destination of the
+second branch or a point immediately following it, depending on whether
+the condition is known to be true or false.
+.Ip "\fB\-fcse-follow-jumps\fR" 4
+.IX Item "-fcse-follow-jumps"
+In common subexpression elimination, scan through jump instructions
+when the target of the jump is not reached by any other path. For
+example, when \s-1CSE\s0 encounters an \f(CW\*(C`if\*(C'\fR statement with an
+\&\f(CW\*(C`else\*(C'\fR clause, \s-1CSE\s0 will follow the jump when the condition
+tested is false.
+.Ip "\fB\-fcse-skip-blocks\fR" 4
+.IX Item "-fcse-skip-blocks"
+This is similar to \fB\-fcse-follow-jumps\fR, but causes \s-1CSE\s0 to
+follow jumps which conditionally skip over blocks. When \s-1CSE\s0
+encounters a simple \f(CW\*(C`if\*(C'\fR statement with no else clause,
+\&\fB\-fcse-skip-blocks\fR causes \s-1CSE\s0 to follow the jump around the
+body of the \f(CW\*(C`if\*(C'\fR.
+.Ip "\fB\-frerun-cse-after-loop\fR" 4
+.IX Item "-frerun-cse-after-loop"
+Re-run common subexpression elimination after loop optimizations has been
+performed.
+.Ip "\fB\-frerun-loop-opt\fR" 4
+.IX Item "-frerun-loop-opt"
+Run the loop optimizer twice.
+.Ip "\fB\-fgcse\fR" 4
+.IX Item "-fgcse"
+Perform a global common subexpression elimination pass.
+This pass also performs global constant and copy propagation.
+.Sp
+\&\fINote:\fR When compiling a program using computed gotos, a \s-1GCC\s0
+extension, you may get better runtime performance if you disable
+the global common subexpression elmination pass by adding
+\&\fB\-fno-gcse\fR to the command line.
+.Ip "\fB\-fgcse-lm\fR" 4
+.IX Item "-fgcse-lm"
+When \fB\-fgcse-lm\fR is enabled, global common subexpression elimination will
+attempt to move loads which are only killed by stores into themselves. This
+allows a loop containing a load/store sequence to be changed to a load outside
+the loop, and a copy/store within the loop.
+.Ip "\fB\-fgcse-sm\fR" 4
+.IX Item "-fgcse-sm"
+When \fB\-fgcse-sm\fR is enabled, A store motion pass is run after global common
+subexpression elimination. This pass will attempt to move stores out of loops.
+When used in conjunction with \fB\-fgcse-lm\fR, loops containing a load/store sequence
+can be changed to a load before the loop and a store after the loop.
+.Ip "\fB\-fdelete-null-pointer-checks\fR" 4
+.IX Item "-fdelete-null-pointer-checks"
+Use global dataflow analysis to identify and eliminate useless checks
+for null pointers. The compiler assumes that dereferencing a null
+pointer would have halted the program. If a pointer is checked after
+it has already been dereferenced, it cannot be null.
+.Sp
+In some environments, this assumption is not true, and programs can
+safely dereference null pointers. Use
+\&\fB\-fno-delete-null-pointer-checks\fR to disable this optimization
+for programs which depend on that behavior.
+.Ip "\fB\-fexpensive-optimizations\fR" 4
+.IX Item "-fexpensive-optimizations"
+Perform a number of minor optimizations that are relatively expensive.
+.Ip "\fB\-foptimize-register-move\fR" 4
+.IX Item "-foptimize-register-move"
+.PD 0
+.Ip "\fB\-fregmove\fR" 4
+.IX Item "-fregmove"
+.PD
+Attempt to reassign register numbers in move instructions and as
+operands of other simple instructions in order to maximize the amount of
+register tying. This is especially helpful on machines with two-operand
+instructions. \s-1GCC\s0 enables this optimization by default with \fB\-O2\fR
+or higher.
+.Sp
+Note \fB\-fregmove\fR and \fB\-foptimize-register-move\fR are the same
+optimization.
+.Ip "\fB\-fdelayed-branch\fR" 4
+.IX Item "-fdelayed-branch"
+If supported for the target machine, attempt to reorder instructions
+to exploit instruction slots available after delayed branch
+instructions.
+.Ip "\fB\-fschedule-insns\fR" 4
+.IX Item "-fschedule-insns"
+If supported for the target machine, attempt to reorder instructions to
+eliminate execution stalls due to required data being unavailable. This
+helps machines that have slow floating point or memory load instructions
+by allowing other instructions to be issued until the result of the load
+or floating point instruction is required.
+.Ip "\fB\-fschedule-insns2\fR" 4
+.IX Item "-fschedule-insns2"
+Similar to \fB\-fschedule-insns\fR, but requests an additional pass of
+instruction scheduling after register allocation has been done. This is
+especially useful on machines with a relatively small number of
+registers and where memory load instructions take more than one cycle.
+.Ip "\fB\-ffunction-sections\fR" 4
+.IX Item "-ffunction-sections"
+.PD 0
+.Ip "\fB\-fdata-sections\fR" 4
+.IX Item "-fdata-sections"
+.PD
+Place each function or data item into its own section in the output
+file if the target supports arbitrary sections. The name of the
+function or the name of the data item determines the section's name
+in the output file.
+.Sp
+Use these options on systems where the linker can perform optimizations
+to improve locality of reference in the instruction space. \s-1HPPA\s0
+processors running \s-1HP-UX\s0 and Sparc processors running Solaris 2 have
+linkers with such optimizations. Other systems using the \s-1ELF\s0 object format
+as well as \s-1AIX\s0 may have these optimizations in the future.
+.Sp
+Only use these options when there are significant benefits from doing
+so. When you specify these options, the assembler and linker will
+create larger object and executable files and will also be slower.
+You will not be able to use \f(CW\*(C`gprof\*(C'\fR on all systems if you
+specify this option and you may have problems with debugging if
+you specify both this option and \fB\-g\fR.
+.Ip "\fB\-fcaller-saves\fR" 4
+.IX Item "-fcaller-saves"
+Enable values to be allocated in registers that will be clobbered by
+function calls, by emitting extra instructions to save and restore the
+registers around such calls. Such allocation is done only when it
+seems to result in better code than would otherwise be produced.
+.Sp
+This option is always enabled by default on certain machines, usually
+those which have no call-preserved registers to use instead.
+.Sp
+For all machines, optimization level 2 and higher enables this flag by
+default.
+.Ip "\fB\-funroll-loops\fR" 4
+.IX Item "-funroll-loops"
+Unroll loops whose number of iterations can be determined at compile
+time or upon entry to the loop. \fB\-funroll-loops\fR implies both
+\&\fB\-fstrength-reduce\fR and \fB\-frerun-cse-after-loop\fR. This
+option makes code larger, and may or may not make it run faster.
+.Ip "\fB\-funroll-all-loops\fR" 4
+.IX Item "-funroll-all-loops"
+Unroll all loops, even if their number of iterations is uncertain when
+the loop is entered. This usually makes programs run more slowly.
+\&\fB\-funroll-all-loops\fR implies the same options as
+\&\fB\-funroll-loops\fR,
+.Ip "\fB\-fprefetch-loop-arrays\fR" 4
+.IX Item "-fprefetch-loop-arrays"
+If supported by the target machine, generate instructions to prefetch
+memory to improve the performance of loops that access large arrays.
+.Ip "\fB\-fmove-all-movables\fR" 4
+.IX Item "-fmove-all-movables"
+Forces all invariant computations in loops to be moved
+outside the loop.
+.Ip "\fB\-freduce-all-givs\fR" 4
+.IX Item "-freduce-all-givs"
+Forces all general-induction variables in loops to be
+strength-reduced.
+.Sp
+\&\fINote:\fR When compiling programs written in Fortran,
+\&\fB\-fmove-all-movables\fR and \fB\-freduce-all-givs\fR are enabled
+by default when you use the optimizer.
+.Sp
+These options may generate better or worse code; results are highly
+dependent on the structure of loops within the source code.
+.Sp
+These two options are intended to be removed someday, once
+they have helped determine the efficacy of various
+approaches to improving loop optimizations.
+.Sp
+Please let us (<\fBgcc@gcc.gnu.org\fR> and <\fBfortran@gnu.org\fR>)
+know how use of these options affects
+the performance of your production code.
+We're very interested in code that runs \fIslower\fR
+when these options are \fIenabled\fR.
+.Ip "\fB\-fno-peephole\fR" 4
+.IX Item "-fno-peephole"
+.PD 0
+.Ip "\fB\-fno-peephole2\fR" 4
+.IX Item "-fno-peephole2"
+.PD
+Disable any machine-specific peephole optimizations. The difference
+between \fB\-fno-peephole\fR and \fB\-fno-peephole2\fR is in how they
+are implemented in the compiler; some targets use one, some use the
+other, a few use both.
+.Ip "\fB\-fbranch-probabilities\fR" 4
+.IX Item "-fbranch-probabilities"
+After running a program compiled with \fB\-fprofile-arcs\fR, you can compile it a second time using
+\&\fB\-fbranch-probabilities\fR, to improve optimizations based on
+the number of times each branch was taken. When the program
+compiled with \fB\-fprofile-arcs\fR exits it saves arc execution
+counts to a file called \fI\fIsourcename\fI.da\fR for each source
+file The information in this data file is very dependent on the
+structure of the generated code, so you must use the same source code
+and the same optimization options for both compilations.
+.Sp
+With \fB\-fbranch-probabilities\fR, \s-1GCC\s0 puts a \fB\s-1REG_EXEC_COUNT\s0\fR
+note on the first instruction of each basic block, and a
+\&\fB\s-1REG_BR_PROB\s0\fR note on each \fB\s-1JUMP_INSN\s0\fR and \fB\s-1CALL_INSN\s0\fR.
+These can be used to improve optimization. Currently, they are only
+used in one place: in \fIreorg.c\fR, instead of guessing which path a
+branch is mostly to take, the \fB\s-1REG_BR_PROB\s0\fR values are used to
+exactly determine which path is taken more often.
+.Ip "\fB\-fno-guess-branch-probability\fR" 4
+.IX Item "-fno-guess-branch-probability"
+Do not guess branch probabilities using a randomized model.
+.Sp
+Sometimes gcc will opt to use a randomized model to guess branch
+probabilities, when none are available from either profiling feedback
+(\fB\-fprofile-arcs\fR) or \fB_\|_builtin_expect\fR. This means that
+different runs of the compiler on the same program may produce different
+object code.
+.Sp
+In a hard real-time system, people don't want different runs of the
+compiler to produce code that has different behavior; minimizing
+non-determinism is of paramount import. This switch allows users to
+reduce non-determinism, possibly at the expense of inferior
+optimization.
+.Ip "\fB\-fstrict-aliasing\fR" 4
+.IX Item "-fstrict-aliasing"
+Allows the compiler to assume the strictest aliasing rules applicable to
+the language being compiled. For C (and \*(C+), this activates
+optimizations based on the type of expressions. In particular, an
+object of one type is assumed never to reside at the same address as an
+object of a different type, unless the types are almost the same. For
+example, an \f(CW\*(C`unsigned int\*(C'\fR can alias an \f(CW\*(C`int\*(C'\fR, but not a
+\&\f(CW\*(C`void*\*(C'\fR or a \f(CW\*(C`double\*(C'\fR. A character type may alias any other
+type.
+.Sp
+Pay special attention to code like this:
+.Sp
+.Vb 4
+\& union a_union {
+\& int i;
+\& double d;
+\& };
+.Ve
+.Vb 5
+\& int f() {
+\& a_union t;
+\& t.d = 3.0;
+\& return t.i;
+\& }
+.Ve
+The practice of reading from a different union member than the one most
+recently written to (called ``type-punning'') is common. Even with
+\&\fB\-fstrict-aliasing\fR, type-punning is allowed, provided the memory
+is accessed through the union type. So, the code above will work as
+expected. However, this code might not:
+.Sp
+.Vb 7
+\& int f() {
+\& a_union t;
+\& int* ip;
+\& t.d = 3.0;
+\& ip = &t.i;
+\& return *ip;
+\& }
+.Ve
+Every language that wishes to perform language-specific alias analysis
+should define a function that computes, given an \f(CW\*(C`tree\*(C'\fR
+node, an alias set for the node. Nodes in different alias sets are not
+allowed to alias. For an example, see the C front-end function
+\&\f(CW\*(C`c_get_alias_set\*(C'\fR.
+.Ip "\fB\-falign-functions\fR" 4
+.IX Item "-falign-functions"
+.PD 0
+.Ip "\fB\-falign-functions=\fR\fIn\fR" 4
+.IX Item "-falign-functions=n"
+.PD
+Align the start of functions to the next power-of-two greater than
+\&\fIn\fR, skipping up to \fIn\fR bytes. For instance,
+\&\fB\-falign-functions=32\fR aligns functions to the next 32\-byte
+boundary, but \fB\-falign-functions=24\fR would align to the next
+32\-byte boundary only if this can be done by skipping 23 bytes or less.
+.Sp
+\&\fB\-fno-align-functions\fR and \fB\-falign-functions=1\fR are
+equivalent and mean that functions will not be aligned.
+.Sp
+Some assemblers only support this flag when \fIn\fR is a power of two;
+in that case, it is rounded up.
+.Sp
+If \fIn\fR is not specified, use a machine-dependent default.
+.Ip "\fB\-falign-labels\fR" 4
+.IX Item "-falign-labels"
+.PD 0
+.Ip "\fB\-falign-labels=\fR\fIn\fR" 4
+.IX Item "-falign-labels=n"
+.PD
+Align all branch targets to a power-of-two boundary, skipping up to
+\&\fIn\fR bytes like \fB\-falign-functions\fR. This option can easily
+make code slower, because it must insert dummy operations for when the
+branch target is reached in the usual flow of the code.
+.Sp
+If \fB\-falign-loops\fR or \fB\-falign-jumps\fR are applicable and
+are greater than this value, then their values are used instead.
+.Sp
+If \fIn\fR is not specified, use a machine-dependent default which is
+very likely to be \fB1\fR, meaning no alignment.
+.Sp
+This option does not work on Mac \s-1OS\s0 X.
+.Ip "\fB\-falign-loops\fR" 4
+.IX Item "-falign-loops"
+.PD 0
+.Ip "\fB\-falign-loops=\fR\fIn\fR" 4
+.IX Item "-falign-loops=n"
+.PD
+Align loops to a power-of-two boundary, skipping up to \fIn\fR bytes
+like \fB\-falign-functions\fR. The hope is that the loop will be
+executed many times, which will make up for any execution of the dummy
+operations.
+.Sp
+If \fIn\fR is not specified, use a machine-dependent default.
+.Sp
+This option does not work on Mac \s-1OS\s0 X.
+.Ip "\fB\-falign-jumps\fR" 4
+.IX Item "-falign-jumps"
+.PD 0
+.Ip "\fB\-falign-jumps=\fR\fIn\fR" 4
+.IX Item "-falign-jumps=n"
+.PD
+Align branch targets to a power-of-two boundary, for branch targets
+where the targets can only be reached by jumping, skipping up to \fIn\fR
+bytes like \fB\-falign-functions\fR. In this case, no dummy operations
+need be executed.
+.Sp
+If \fIn\fR is not specified, use a machine-dependent default.
+.Sp
+This option does not work on Mac \s-1OS\s0 X.
+.Ip "\fB\-fssa\fR" 4
+.IX Item "-fssa"
+Perform optimizations in static single assignment form. Each function's
+flow graph is translated into \s-1SSA\s0 form, optimizations are performed, and
+the flow graph is translated back from \s-1SSA\s0 form. Users should not
+specify this option, since it is not yet ready for production use.
+.Ip "\fB\-fssa-ccp\fR" 4
+.IX Item "-fssa-ccp"
+Perform Sparse Conditional Constant Propagation in \s-1SSA\s0 form. Requires
+\&\fB\-fssa\fR. Like \fB\-fssa\fR, this is an experimental feature.
+.Ip "\fB\-fssa-dce\fR" 4
+.IX Item "-fssa-dce"
+Perform aggressive dead-code elimination in \s-1SSA\s0 form. Requires \fB\-fssa\fR.
+Like \fB\-fssa\fR, this is an experimental feature.
+.Ip "\fB\-fsingle-precision-constant\fR" 4
+.IX Item "-fsingle-precision-constant"
+Treat floating point constant as single precision constant instead of
+implicitly converting it to double precision constant.
+.Ip "\fB\-frename-registers\fR" 4
+.IX Item "-frename-registers"
+Attempt to avoid false dependencies in scheduled code by making use
+of registers left over after register allocation. This optimization
+will most benefit processors with lots of registers. It can, however,
+make debugging impossible, since variables will no longer stay in
+a ``home register''.
+.Ip "\fB\-fno-cprop-registers\fR" 4
+.IX Item "-fno-cprop-registers"
+After register allocation and post-register allocation instruction splitting,
+we perform a copy-propagation pass to try to reduce scheduling dependencies
+and occasionally eliminate the copy.
+.Ip "\fB\*(--param\fR \fIname\fR\fB=\fR\fIvalue\fR" 4
+.IX Item "param name=value"
+In some places, \s-1GCC\s0 uses various constants to control the amount of
+optimization that is done. For example, \s-1GCC\s0 will not inline functions
+that contain more that a certain number of instructions. You can
+control some of these constants on the command-line using the
+\&\fB\*(--param\fR option.
+.Sp
+In each case, the \fIvalue\fR is an integer. The allowable choices for
+\&\fIname\fR are given in the following table:
+.RS 4
+.Ip "\fBmax-delay-slot-insn-search\fR" 4
+.IX Item "max-delay-slot-insn-search"
+The maximum number of instructions to consider when looking for an
+instruction to fill a delay slot. If more than this arbitrary number of
+instructions is searched, the time savings from filling the delay slot
+will be minimal so stop searching. Increasing values mean more
+aggressive optimization, making the compile time increase with probably
+small improvement in executable run time.
+.Ip "\fBmax-delay-slot-live-search\fR" 4
+.IX Item "max-delay-slot-live-search"
+When trying to fill delay slots, the maximum number of instructions to
+consider when searching for a block with valid live register
+information. Increasing this arbitrarily chosen value means more
+aggressive optimization, increasing the compile time. This parameter
+should be removed when the delay slot code is rewritten to maintain the
+control-flow graph.
+.Ip "\fBmax-gcse-memory\fR" 4
+.IX Item "max-gcse-memory"
+The approximate maximum amount of memory that will be allocated in
+order to perform the global common subexpression elimination
+optimization. If more memory than specified is required, the
+optimization will not be done.
+.Ip "\fBmax-gcse-passes\fR" 4
+.IX Item "max-gcse-passes"
+The maximum number of passes of \s-1GCSE\s0 to run.
+.Ip "\fBmax-pending-list-length\fR" 4
+.IX Item "max-pending-list-length"
+The maximum number of pending dependencies scheduling will allow
+before flushing the current state and starting over. Large functions
+with few branches or calls can create excessively large lists which
+needlessly consume memory and resources.
+.Ip "\fBmax-inline-insns\fR" 4
+.IX Item "max-inline-insns"
+If an function contains more than this many instructions, it
+will not be inlined. This option is precisely equivalent to
+\&\fB\-finline-limit\fR.
+.RE
+.RS 4
+.RE
+.Sh "Options Controlling the Preprocessor"
+.IX Subsection "Options Controlling the Preprocessor"
+These options control the C preprocessor, which is run on each C source
+file before actual compilation.
+.PP
+If you use the \fB\-E\fR option, nothing is done except preprocessing.
+Some of these options make sense only together with \fB\-E\fR because
+they cause the preprocessor output to be unsuitable for actual
+compilation.
+.PP
+You can use \fB\-Wp,\fR\fIoption\fR to bypass the compiler driver
+and pass \fIoption\fR directly through to the preprocessor. If
+\&\fIoption\fR contains commas, it is split into multiple options at the
+commas. However, many options are modified, translated or interpreted
+by the compiler driver before being passed to the preprocessor, and
+\&\fB\-Wp\fR forcibly bypasses this phase. The preprocessor's direct
+interface is undocumented and subject to change, so whenever possible
+you should avoid using \fB\-Wp\fR and let the driver handle the
+options instead.
+.Ip "\fB\-D\fR \fIname\fR" 4
+.IX Item "-D name"
+Predefine \fIname\fR as a macro, with definition \f(CW\*(C`1\*(C'\fR.
+.Ip "\fB\-D\fR \fIname\fR\fB=\fR\fIdefinition\fR" 4
+.IX Item "-D name=definition"
+Predefine \fIname\fR as a macro, with definition \fIdefinition\fR.
+There are no restrictions on the contents of \fIdefinition\fR, but if
+you are invoking the preprocessor from a shell or shell-like program you
+may need to use the shell's quoting syntax to protect characters such as
+spaces that have a meaning in the shell syntax.
+.Sp
+If you wish to define a function-like macro on the command line, write
+its argument list with surrounding parentheses before the equals sign
+(if any). Parentheses are meaningful to most shells, so you will need
+to quote the option. With \fBsh\fR and \fBcsh\fR,
+\&\fB\-D'\fR\fIname\fR\fB(\fR\fIargs...\fR\fB)=\fR\fIdefinition\fR\fB'\fR works.
+.Sp
+\&\fB\-D\fR and \fB\-U\fR options are processed in the order they
+are given on the command line. All \fB\-imacros\fR \fIfile\fR and
+\&\fB\-include\fR \fIfile\fR options are processed after all
+\&\fB\-D\fR and \fB\-U\fR options.
+.Ip "\fB\-U\fR \fIname\fR" 4
+.IX Item "-U name"
+Cancel any previous definition of \fIname\fR, either built in or
+provided with a \fB\-D\fR option.
+.Ip "\fB\-undef\fR" 4
+.IX Item "-undef"
+Do not predefine any system-specific macros. The common predefined
+macros remain defined.
+.Ip "\fB\-I\fR \fIdir\fR" 4
+.IX Item "-I dir"
+Add the directory \fIdir\fR to the list of directories to be searched
+for header files.
+Directories named by \fB\-I\fR are searched before the standard
+system include directories.
+.Sp
+It is dangerous to specify a standard system include directory in an
+\&\fB\-I\fR option. This defeats the special treatment of system
+headers
+\&. It can also defeat the repairs to buggy system headers which \s-1GCC\s0
+makes when it is installed.
+.Ip "\fB\-o\fR \fIfile\fR" 4
+.IX Item "-o file"
+Write output to \fIfile\fR. This is the same as specifying \fIfile\fR
+as the second non-option argument to \fBcpp\fR. \fBgcc\fR has a
+different interpretation of a second non-option argument, so you must
+use \fB\-o\fR to specify the output file.
+.Ip "\fB\-Wall\fR" 4
+.IX Item "-Wall"
+Turns on all optional warnings which are desirable for normal code. At
+present this is \fB\-Wcomment\fR and \fB\-Wtrigraphs\fR. Note that
+many of the preprocessor's warnings are on by default and have no
+options to control them.
+.Ip "\fB\-Wcomment\fR" 4
+.IX Item "-Wcomment"
+.PD 0
+.Ip "\fB\-Wcomments\fR" 4
+.IX Item "-Wcomments"
+.PD
+Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR
+comment, or whenever a backslash-newline appears in a \fB//\fR comment.
+(Both forms have the same effect.)
+.Ip "\fB\-Wtrigraphs\fR" 4
+.IX Item "-Wtrigraphs"
+Warn if any trigraphs are encountered. This option used to take effect
+only if \fB\-trigraphs\fR was also specified, but now works
+independently. Warnings are not given for trigraphs within comments, as
+they do not affect the meaning of the program.
+.Ip "\fB\-Wtraditional\fR" 4
+.IX Item "-Wtraditional"
+Warn about certain constructs that behave differently in traditional and
+\&\s-1ISO\s0 C. Also warn about \s-1ISO\s0 C constructs that have no traditional C
+equivalent, and problematic constructs which should be avoided.
+.Ip "\fB\-Wimport\fR" 4
+.IX Item "-Wimport"
+Warn the first time \fB#import\fR is used.
+.Ip "\fB\-Wundef\fR" 4
+.IX Item "-Wundef"
+Warn whenever an identifier which is not a macro is encountered in an
+\&\fB#if\fR directive, outside of \fBdefined\fR. Such identifiers are
+replaced with zero.
+.Ip "\fB\-Werror\fR" 4
+.IX Item "-Werror"
+Make all warnings into hard errors. Source code which triggers warnings
+will be rejected.
+.Ip "\fB\-Wsystem-headers\fR" 4
+.IX Item "-Wsystem-headers"
+Issue warnings for code in system headers. These are normally unhelpful
+in finding bugs in your own code, therefore suppressed. If you are
+responsible for the system library, you may want to see them.
+.Ip "\fB\-w\fR" 4
+.IX Item "-w"
+Suppress all warnings, including those which \s-1GNU\s0 \s-1CPP\s0 issues by default.
+.Ip "\fB\-pedantic\fR" 4
+.IX Item "-pedantic"
+Issue all the mandatory diagnostics listed in the C standard. Some of
+them are left out by default, since they trigger frequently on harmless
+code.
+.Ip "\fB\-pedantic-errors\fR" 4
+.IX Item "-pedantic-errors"
+Issue all the mandatory diagnostics, and make all mandatory diagnostics
+into errors. This includes mandatory diagnostics that \s-1GCC\s0 issues
+without \fB\-pedantic\fR but treats as warnings.
+.Ip "\fB\-M\fR" 4
+.IX Item "-M"
+Instead of outputting the result of preprocessing, output a rule
+suitable for \fBmake\fR describing the dependencies of the main
+source file. The preprocessor outputs one \fBmake\fR rule containing
+the object file name for that source file, a colon, and the names of all
+the included files, including those coming from \fB\-include\fR or
+\&\fB\-imacros\fR command line options.
+.Sp
+Unless specified explicitly (with \fB\-MT\fR or \fB\-MQ\fR), the
+object file name consists of the basename of the source file with any
+suffix replaced with object file suffix. If there are many included
+files then the rule is split into several lines using \fB\e\fR\-newline.
+The rule has no commands.
+.Sp
+This option does not suppress the preprocessor's debug output, such as
+\&\fB\-dM\fR. To avoid mixing such debug output with the dependency
+rules you should explicitly specify the dependency output file with
+\&\fB\-MF\fR, or use an environment variable like
+\&\fB\s-1DEPENDENCIES_OUTPUT\s0\fR. Debug output
+will still be sent to the regular output stream as normal.
+.Sp
+Passing \fB\-M\fR to the driver implies \fB\-E\fR.
+.Ip "\fB\-MM\fR" 4
+.IX Item "-MM"
+Like \fB\-M\fR but do not mention header files that are found in
+system header directories, nor header files that are included,
+directly or indirectly, from such a header.
+.Sp
+This implies that the choice of angle brackets or double quotes in an
+\&\fB#include\fR directive does not in itself determine whether that
+header will appear in \fB\-MM\fR dependency output. This is a
+slight change in semantics from \s-1GCC\s0 versions 3.0 and earlier.
+.Ip "\fB\-MF\fR \fIfile\fR" 4
+.IX Item "-MF file"
+@anchor{\-MF}
+When used with \fB\-M\fR or \fB\-MM\fR, specifies a
+file to write the dependencies to. If no \fB\-MF\fR switch is given
+the preprocessor sends the rules to the same place it would have sent
+preprocessed output.
+.Sp
+When used with the driver options \fB\-MD\fR or \fB\-MMD\fR,
+\&\fB\-MF\fR overrides the default dependency output file.
+.Ip "\fB\-dependency-file\fR" 4
+.IX Item "-dependency-file"
+Like \fB\-MF\fR. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-MG\fR" 4
+.IX Item "-MG"
+When used with \fB\-M\fR or \fB\-MM\fR, \fB\-MG\fR says to treat missing
+header files as generated files and assume they live in the same
+directory as the source file. It suppresses preprocessed output, as a
+missing header file is ordinarily an error.
+.Sp
+This feature is used in automatic updating of makefiles.
+.Ip "\fB\-MP\fR" 4
+.IX Item "-MP"
+This option instructs \s-1CPP\s0 to add a phony target for each dependency
+other than the main file, causing each to depend on nothing. These
+dummy rules work around errors \fBmake\fR gives if you remove header
+files without updating the \fIMakefile\fR to match.
+.Sp
+This is typical output:
+.Sp
+.Vb 1
+\& test.o: test.c test.h
+.Ve
+.Vb 1
+\& test.h:
+.Ve
+.Ip "\fB\-MT\fR \fItarget\fR" 4
+.IX Item "-MT target"
+Change the target of the rule emitted by dependency generation. By
+default \s-1CPP\s0 takes the name of the main input file, including any path,
+deletes any file suffix such as \fB.c\fR, and appends the platform's
+usual object suffix. The result is the target.
+.Sp
+An \fB\-MT\fR option will set the target to be exactly the string you
+specify. If you want multiple targets, you can specify them as a single
+argument to \fB\-MT\fR, or use multiple \fB\-MT\fR options.
+.Sp
+For example, \fB\-MT\ '$(objpfx)foo.o'\fR might give
+.Sp
+.Vb 1
+\& $(objpfx)foo.o: foo.c
+.Ve
+.Ip "\fB\-MQ\fR \fItarget\fR" 4
+.IX Item "-MQ target"
+Same as \fB\-MT\fR, but it quotes any characters which are special to
+Make. \fB\-MQ\ '$(objpfx)foo.o'\fR gives
+.Sp
+.Vb 1
+\& $$(objpfx)foo.o: foo.c
+.Ve
+The default target is automatically quoted, as if it were given with
+\&\fB\-MQ\fR.
+.Ip "\fB\-MD\fR" 4
+.IX Item "-MD"
+\&\fB\-MD\fR is equivalent to \fB\-M \-MF\fR \fIfile\fR, except that
+\&\fB\-E\fR is not implied. The driver determines \fIfile\fR based on
+whether an \fB\-o\fR option is given. If it is, the driver uses its
+argument but with a suffix of \fI.d\fR, otherwise it take the
+basename of the input file and applies a \fI.d\fR suffix.
+.Sp
+If \fB\-MD\fR is used in conjunction with \fB\-E\fR, any
+\&\fB\-o\fR switch is understood to specify the dependency output file
+(but \f(CW@pxref\fR{\-MF}), but if used without \fB\-E\fR, each \fB\-o\fR
+is understood to specify a target object file.
+.Sp
+Since \fB\-E\fR is not implied, \fB\-MD\fR can be used to generate
+a dependency output file as a side-effect of the compilation process.
+.Ip "\fB\-MMD\fR" 4
+.IX Item "-MMD"
+Like \fB\-MD\fR except mention only user header files, not system
+\&\-header files.
+.Ip "\fB\-x c\fR" 4
+.IX Item "-x c"
+.PD 0
+.Ip "\fB\-x c++\fR" 4
+.IX Item "-x c++"
+.Ip "\fB\-x objective-c\fR" 4
+.IX Item "-x objective-c"
+.Ip "\fB\-x objective-c++\fR" 4
+.IX Item "-x objective-c++"
+.Ip "\fB\-x assembler-with-cpp\fR" 4
+.IX Item "-x assembler-with-cpp"
+.PD
+Specify the source language: C, \*(C+, Objective-C, Objective-\*(C+, or assembly. This has
+nothing to do with standards conformance or extensions; it merely
+selects which base syntax to expect. If you give none of these options,
+cpp will deduce the language from the extension of the source file:
+\&\fB.c\fR, \fB.cc\fR, \fB.m\fR, \fB.mm\fR, or \fB.S\fR. Some other common
+extensions for \*(C+ and assembly are also recognized. If cpp does not
+recognize the extension, it will treat the file as C; this is the most
+generic mode.
+.Sp
+\&\fBNote:\fR Previous versions of cpp accepted a \fB\-lang\fR option
+which selected both the language and the standards conformance level.
+This option has been removed, because it conflicts with the \fB\-l\fR
+option.
+.Ip "\fB\-std=\fR\fIstandard\fR" 4
+.IX Item "-std=standard"
+.PD 0
+.Ip "\fB\-ansi\fR" 4
+.IX Item "-ansi"
+.PD
+Specify the standard to which the code should conform. Currently cpp
+only knows about the standards for C; other language standards will be
+added in the future.
+.Sp
+\&\fIstandard\fR
+may be one of:
+.RS 4
+.if n .Ip "\f(CW""""iso9899:1990""""\fR" 4
+.el .Ip "\f(CWiso9899:1990\fR" 4
+.IX Item "iso9899:1990"
+.PD 0
+.if n .Ip "\f(CW""""c89""""\fR" 4
+.el .Ip "\f(CWc89\fR" 4
+.IX Item "c89"
+.PD
+The \s-1ISO\s0 C standard from 1990. \fBc89\fR is the customary shorthand for
+this version of the standard.
+.Sp
+The \fB\-ansi\fR option is equivalent to \fB\-std=c89\fR.
+.if n .Ip "\f(CW""""iso9899:199409""""\fR" 4
+.el .Ip "\f(CWiso9899:199409\fR" 4
+.IX Item "iso9899:199409"
+The 1990 C standard, as amended in 1994.
+.if n .Ip "\f(CW""""iso9899:1999""""\fR" 4
+.el .Ip "\f(CWiso9899:1999\fR" 4
+.IX Item "iso9899:1999"
+.PD 0
+.if n .Ip "\f(CW""""c99""""\fR" 4
+.el .Ip "\f(CWc99\fR" 4
+.IX Item "c99"
+.if n .Ip "\f(CW""""iso9899:199x""""\fR" 4
+.el .Ip "\f(CWiso9899:199x\fR" 4
+.IX Item "iso9899:199x"
+.if n .Ip "\f(CW""""c9x""""\fR" 4
+.el .Ip "\f(CWc9x\fR" 4
+.IX Item "c9x"
+.PD
+The revised \s-1ISO\s0 C standard, published in December 1999. Before
+publication, this was known as C9X.
+.if n .Ip "\f(CW""""gnu89""""\fR" 4
+.el .Ip "\f(CWgnu89\fR" 4
+.IX Item "gnu89"
+The 1990 C standard plus \s-1GNU\s0 extensions. This is the default.
+.if n .Ip "\f(CW""""gnu99""""\fR" 4
+.el .Ip "\f(CWgnu99\fR" 4
+.IX Item "gnu99"
+.PD 0
+.if n .Ip "\f(CW""""gnu9x""""\fR" 4
+.el .Ip "\f(CWgnu9x\fR" 4
+.IX Item "gnu9x"
+.PD
+The 1999 C standard plus \s-1GNU\s0 extensions.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-I-\fR" 4
+.IX Item "-I-"
+Split the include path. Any directories specified with \fB\-I\fR
+options before \fB\-I-\fR are searched only for headers requested with
+\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for
+\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR. If additional directories are
+specified with \fB\-I\fR options after the \fB\-I-\fR, those
+directories are searched for all \fB#include\fR directives.
+.Sp
+In addition, \fB\-I-\fR inhibits the use of the directory of the current
+file directory as the first search directory for \f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR.
+.Ip "\fB\-nostdinc\fR" 4
+.IX Item "-nostdinc"
+Do not search the standard system directories for header files.
+Only the directories you have specified with \fB\-I\fR options
+(and the directory of the current file, if appropriate) are searched.
+.Ip "\fB\-nostdinc++\fR" 4
+.IX Item "-nostdinc++"
+Do not search for header files in the \*(C+\-specific standard directories,
+but do still search the other standard directories. (This option is
+used when building the \*(C+ library.)
+.Ip "\fB\-include\fR \fIfile\fR" 4
+.IX Item "-include file"
+Process \fIfile\fR as if \f(CW\*(C`#include "file"\*(C'\fR appeared as the first
+line of the primary source file. However, the first directory searched
+for \fIfile\fR is the preprocessor's working directory \fIinstead of\fR
+the directory containing the main source file. If not found there, it
+is searched for in the remainder of the \f(CW\*(C`#include "..."\*(C'\fR search
+chain as normal.
+.Sp
+If multiple \fB\-include\fR options are given, the files are included
+in the order they appear on the command line.
+.Ip "\fB\-imacros\fR \fIfile\fR" 4
+.IX Item "-imacros file"
+Exactly like \fB\-include\fR, except that any output produced by
+scanning \fIfile\fR is thrown away. Macros it defines remain defined.
+This allows you to acquire all the macros from a header without also
+processing its declarations.
+.Sp
+All files specified by \fB\-imacros\fR are processed before all files
+specified by \fB\-include\fR.
+.Ip "\fB\-idirafter\fR \fIdir\fR" 4
+.IX Item "-idirafter dir"
+Search \fIdir\fR for header files, but do it \fIafter\fR all
+directories specified with \fB\-I\fR and the standard system directories
+have been exhausted. \fIdir\fR is treated as a system include directory.
+.Ip "\fB\-iprefix\fR \fIprefix\fR" 4
+.IX Item "-iprefix prefix"
+Specify \fIprefix\fR as the prefix for subsequent \fB\-iwithprefix\fR
+options. If the prefix represents a directory, you should include the
+final \fB/\fR.
+.Ip "\fB\-iwithprefix\fR \fIdir\fR" 4
+.IX Item "-iwithprefix dir"
+.PD 0
+.Ip "\fB\-iwithprefixbefore\fR \fIdir\fR" 4
+.IX Item "-iwithprefixbefore dir"
+.PD
+Append \fIdir\fR to the prefix specified previously with
+\&\fB\-iprefix\fR, and add the resulting directory to the include search
+path. \fB\-iwithprefixbefore\fR puts it in the same place \fB\-I\fR
+would; \fB\-iwithprefix\fR puts it where \fB\-idirafter\fR would.
+.Sp
+Use of these options is discouraged.
+.Ip "\fB\-isystem\fR \fIdir\fR" 4
+.IX Item "-isystem dir"
+Search \fIdir\fR for header files, after all directories specified by
+\&\fB\-I\fR but before the standard system directories. Mark it
+as a system directory, so that it gets the same special treatment as
+is applied to the standard system directories.
+.Ip "\fB\-fpreprocessed\fR" 4
+.IX Item "-fpreprocessed"
+Indicate to the preprocessor that the input file has already been
+preprocessed. This suppresses things like macro expansion, trigraph
+conversion, escaped newline splicing, and processing of most directives.
+The preprocessor still recognizes and removes comments, so that you can
+pass a file preprocessed with \fB\-C\fR to the compiler without
+problems. In this mode the integrated preprocessor is little more than
+a tokenizer for the front ends.
+.Sp
+\&\fB\-fpreprocessed\fR is implicit if the input file has one of the
+extensions \fB.i\fR, \fB.ii\fR or \fB.mi\fR. These are the
+extensions that \s-1GCC\s0 uses for preprocessed files created by
+\&\fB\-save-temps\fR.
+.Ip "\fB\-ftabstop=\fR\fIwidth\fR" 4
+.IX Item "-ftabstop=width"
+Set the distance between tab stops. This helps the preprocessor report
+correct column numbers in warnings or errors, even if tabs appear on the
+line. If the value is less than 1 or greater than 100, the option is
+ignored. The default is 8.
+.Ip "\fB\-fno-show-column\fR" 4
+.IX Item "-fno-show-column"
+Do not print column numbers in diagnostics. This may be necessary if
+diagnostics are being scanned by a program that does not understand the
+column numbers, such as \fBdejagnu\fR.
+.Ip "\fB\-A\fR \fIpredicate\fR\fB=\fR\fIanswer\fR" 4
+.IX Item "-A predicate=answer"
+Make an assertion with the predicate \fIpredicate\fR and answer
+\&\fIanswer\fR. This form is preferred to the older form \fB\-A\fR
+\&\fIpredicate\fR\fB(\fR\fIanswer\fR\fB)\fR, which is still supported, because
+it does not use shell special characters.
+.Ip "\fB\-A -\fR\fIpredicate\fR\fB=\fR\fIanswer\fR" 4
+.IX Item "-A -predicate=answer"
+Cancel an assertion with the predicate \fIpredicate\fR and answer
+\&\fIanswer\fR.
+.Ip "\fB\-A-\fR" 4
+.IX Item "-A-"
+Cancel all predefined assertions and all assertions preceding it on
+the command line. Also, undefine all predefined macros and all
+macros preceding it on the command line. (This is a historical wart and
+may change in the future.)
+.Ip "\fB\-dCHARS\fR" 4
+.IX Item "-dCHARS"
+\&\fI\s-1CHARS\s0\fR is a sequence of one or more of the following characters,
+and must not be preceded by a space. Other characters are interpreted
+by the compiler proper, or reserved for future versions of \s-1GCC\s0, and so
+are silently ignored. If you specify characters whose behavior
+conflicts, the result is undefined.
+.RS 4
+.Ip "\fBM\fR" 4
+.IX Item "M"
+Instead of the normal output, generate a list of \fB#define\fR
+directives for all the macros defined during the execution of the
+preprocessor, including predefined macros. This gives you a way of
+finding out what is predefined in your version of the preprocessor.
+Assuming you have no file \fIfoo.h\fR, the command
+.Sp
+.Vb 1
+\& touch foo.h; cpp -dM foo.h
+.Ve
+will show all the predefined macros.
+.Ip "\fBD\fR" 4
+.IX Item "D"
+Like \fBM\fR except in two respects: it does \fInot\fR include the
+predefined macros, and it outputs \fIboth\fR the \fB#define\fR
+directives and the result of preprocessing. Both kinds of output go to
+the standard output file.
+.Ip "\fBN\fR" 4
+.IX Item "N"
+Like \fBD\fR, but emit only the macro names, not their expansions.
+.Ip "\fBI\fR" 4
+.IX Item "I"
+Output \fB#include\fR directives in addition to the result of
+preprocessing.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-P\fR" 4
+.IX Item "-P"
+Inhibit generation of linemarkers in the output from the preprocessor.
+This might be useful when running the preprocessor on something that is
+not C code, and will be sent to a program which might be confused by the
+linemarkers.
+.Ip "\fB\-C\fR" 4
+.IX Item "-C"
+Do not discard comments. All comments are passed through to the output
+file, except for comments in processed directives, which are deleted
+along with the directive.
+.Sp
+You should be prepared for side effects when using \fB\-C\fR; it
+causes the preprocessor to treat comments as tokens in their own right.
+For example, comments appearing at the start of what would be a
+directive line have the effect of turning that line into an ordinary
+source line, since the first token on the line is no longer a \fB#\fR.
+.Ip "\fB\-gcc\fR" 4
+.IX Item "-gcc"
+Define the macros _\|_GNUC_\|_, _\|_GNUC_MINOR_\|_ and
+_\|_GNUC_PATCHLEVEL_\|_. These are defined automatically when you use
+\&\fBgcc \-E\fR; you can turn them off in that case with
+\&\fB\-no-gcc\fR.
+.Ip "\fB\-traditional\fR" 4
+.IX Item "-traditional"
+Try to imitate the behavior of old-fashioned C, as opposed to \s-1ISO\s0
+C.
+.Ip "\fB\-trigraphs\fR" 4
+.IX Item "-trigraphs"
+Process trigraph sequences.
+These are three-character sequences, all starting with \fB??\fR, that
+are defined by \s-1ISO\s0 C to stand for single characters. For example,
+\&\fB??/\fR stands for \fB\e\fR, so \fB'??/n'\fR is a character
+constant for a newline. By default, \s-1GCC\s0 ignores trigraphs, but in
+standard-conforming modes it converts them. See the \fB\-std\fR and
+\&\fB\-ansi\fR options.
+.Sp
+The nine trigraphs and their replacements are
+.Sp
+.Vb 2
+\& Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
+\& Replacement: [ ] { } # \e ^ | ~
+.Ve
+.Ip "\fB\-remap\fR" 4
+.IX Item "-remap"
+Enable special code to work around file systems which only permit very
+short file names, such as \s-1MS-DOS\s0.
+.Ip "\fB\-$\fR" 4
+.IX Item "-$"
+Forbid the use of \fB$\fR in identifiers. The C standard allows
+implementations to define extra characters that can appear in
+identifiers. By default \s-1GNU\s0 \s-1CPP\s0 permits \fB$\fR, a common extension.
+.Ip "\fB\-h\fR" 4
+.IX Item "-h"
+.PD 0
+.Ip "\fB\*(--help\fR" 4
+.IX Item "help"
+.Ip "\fB\*(--target-help\fR" 4
+.IX Item "target-help"
+.PD
+Print text describing all the command line options instead of
+preprocessing anything.
+.Ip "\fB\-v\fR" 4
+.IX Item "-v"
+Verbose mode. Print out \s-1GNU\s0 \s-1CPP\s0's version number at the beginning of
+execution, and report the final form of the include path.
+.Ip "\fB\-H\fR" 4
+.IX Item "-H"
+Print the name of each header file used, in addition to other normal
+activities. Each name is indented to show how deep in the
+\&\fB#include\fR stack it is.
+.Ip "\fB\-version\fR" 4
+.IX Item "-version"
+.PD 0
+.Ip "\fB\*(--version\fR" 4
+.IX Item "version"
+.PD
+Print out \s-1GNU\s0 \s-1CPP\s0's version number. With one dash, proceed to
+preprocess as normal. With two dashes, exit immediately.
+.Sh "Passing Options to the Assembler"
+.IX Subsection "Passing Options to the Assembler"
+You can pass options to the assembler.
+.Ip "\fB\-Wa,\fR\fIoption\fR" 4
+.IX Item "-Wa,option"
+Pass \fIoption\fR as an option to the assembler. If \fIoption\fR
+contains commas, it is split into multiple options at the commas.
+.Sh "Options for Linking"
+.IX Subsection "Options for Linking"
+These options come into play when the compiler links object files into
+an executable output file. They are meaningless if the compiler is
+not doing a link step.
+.PP
+In addition to the options listed below, Apple's \s-1GCC\s0 also accepts and
+passes nearly all of the options defined by the linker \fBld\fR and by
+the library tool \fBlibtool\fR. Common options include
+\&\fB\-framework\fR, \fB\-dynamic\fR, \fB\-bundle\fR,
+\&\fB\-flat_namespace\fR, and so forth. See the ld and libtool man pages
+for further details.
+.Ip "\fIobject-file-name\fR" 4
+.IX Item "object-file-name"
+A file name that does not end in a special recognized suffix is
+considered to name an object file or library. (Object files are
+distinguished from libraries by the linker according to the file
+contents.) If linking is done, these object files are used as input
+to the linker.
+.Ip "\fB\-c\fR" 4
+.IX Item "-c"
+.PD 0
+.Ip "\fB\-S\fR" 4
+.IX Item "-S"
+.Ip "\fB\-E\fR" 4
+.IX Item "-E"
+.PD
+If any of these options is used, then the linker is not run, and
+object file names should not be used as arguments.
+.Ip "\fB\-l\fR\fIlibrary\fR" 4
+.IX Item "-llibrary"
+.PD 0
+.Ip "\fB\-l\fR \fIlibrary\fR" 4
+.IX Item "-l library"
+.PD
+Search the library named \fIlibrary\fR when linking. (The second
+alternative with the library as a separate argument is only for
+\&\s-1POSIX\s0 compliance and is not recommended.)
+.Sp
+It makes a difference where in the command you write this option; the
+linker searches and processes libraries and object files in the order they
+are specified. Thus, \fBfoo.o \-lz bar.o\fR searches library \fBz\fR
+after file \fIfoo.o\fR but before \fIbar.o\fR. If \fIbar.o\fR refers
+to functions in \fBz\fR, those functions may not be loaded.
+.Sp
+The linker searches a standard list of directories for the library,
+which is actually a file named \fIlib\fIlibrary\fI.a\fR. The linker
+then uses this file as if it had been specified precisely by name.
+.Sp
+The directories searched include several standard system directories
+plus any that you specify with \fB\-L\fR.
+.Sp
+Normally the files found this way are library files\-\-\-archive files
+whose members are object files. The linker handles an archive file by
+scanning through it for members which define symbols that have so far
+been referenced but not defined. But if the file that is found is an
+ordinary object file, it is linked in the usual fashion. The only
+difference between using an \fB\-l\fR option and specifying a file name
+is that \fB\-l\fR surrounds \fIlibrary\fR with \fBlib\fR and \fB.a\fR
+and searches several directories.
+.Ip "\fB\-lobjc\fR" 4
+.IX Item "-lobjc"
+You need this special case of the \fB\-l\fR option in order to
+link an Objective-C program.
+.Ip "\fB\-nostartfiles\fR" 4
+.IX Item "-nostartfiles"
+Do not use the standard system startup files when linking.
+The standard system libraries are used normally, unless \fB\-nostdlib\fR
+or \fB\-nodefaultlibs\fR is used.
+.Ip "\fB\-nodefaultlibs\fR" 4
+.IX Item "-nodefaultlibs"
+Do not use the standard system libraries when linking.
+Only the libraries you specify will be passed to the linker.
+The standard startup files are used normally, unless \fB\-nostartfiles\fR
+is used. The compiler may generate calls to memcmp, memset, and memcpy
+for System V (and \s-1ISO\s0 C) environments or to bcopy and bzero for
+\&\s-1BSD\s0 environments. These entries are usually resolved by entries in
+libc. These entry points should be supplied through some other
+mechanism when this option is specified.
+.Ip "\fB\-nostdlib\fR" 4
+.IX Item "-nostdlib"
+Do not use the standard system startup files or libraries when linking.
+No startup files and only the libraries you specify will be passed to
+the linker. The compiler may generate calls to memcmp, memset, and memcpy
+for System V (and \s-1ISO\s0 C) environments or to bcopy and bzero for
+\&\s-1BSD\s0 environments. These entries are usually resolved by entries in
+libc. These entry points should be supplied through some other
+mechanism when this option is specified.
+.Ip "\fB\-no-c++filt\fR" 4
+.IX Item "-no-c++filt"
+By default all linker diagnostic output is piped through c++filt.
+This option suppresses that behavior. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Sp
+One of the standard libraries bypassed by \fB\-nostdlib\fR and
+\&\fB\-nodefaultlibs\fR is \fIlibgcc.a\fR, a library of internal subroutines
+that \s-1GCC\s0 uses to overcome shortcomings of particular machines, or special
+needs for some languages.
+.Sp
+In most cases, you need \fIlibgcc.a\fR even when you want to avoid
+other standard libraries. In other words, when you specify \fB\-nostdlib\fR
+or \fB\-nodefaultlibs\fR you should usually specify \fB\-lgcc\fR as well.
+This ensures that you have no unresolved references to internal \s-1GCC\s0
+library subroutines. (For example, \fB_\|_main\fR, used to ensure \*(C+
+constructors will be called.)
+.Ip "\fB\-s\fR" 4
+.IX Item "-s"
+Remove all symbol table and relocation information from the executable.
+.Ip "\fB\-static\fR" 4
+.IX Item "-static"
+On systems that support dynamic linking, this prevents linking with the shared
+libraries. On other systems, this option has no effect.
+.Sp
+This option will not work on Mac \s-1OS\s0 X unless all of your libraries
+(including \fIlibgcc.a\fR) have also been compiled with
+\&\fB\-static\fR.
+.Ip "\fB\-shared\fR" 4
+.IX Item "-shared"
+Produce a shared object which can then be linked with other objects to
+form an executable. Not all systems support this option. For predictable
+results, you must also specify the same set of options that were used to
+generate code (\fB\-fpic\fR, \fB\-fPIC\fR, or model suboptions)
+when you specify this option.[1]
+.Sp
+This option is not supported on Mac \s-1OS\s0 X.
+.Ip "\fB\-shared-libgcc\fR" 4
+.IX Item "-shared-libgcc"
+.PD 0
+.Ip "\fB\-static-libgcc\fR" 4
+.IX Item "-static-libgcc"
+.PD
+On systems that provide \fIlibgcc\fR as a shared library, these options
+force the use of either the shared or static version respectively.
+If no shared version of \fIlibgcc\fR was built when the compiler was
+configured, these options have no effect.
+.Sp
+There are several situations in which an application should use the
+shared \fIlibgcc\fR instead of the static version. The most common
+of these is when the application wishes to throw and catch exceptions
+across different shared libraries. In that case, each of the libraries
+as well as the application itself should use the shared \fIlibgcc\fR.
+.Sp
+Therefore, the G++ and \s-1GCJ\s0 drivers automatically add
+\&\fB\-shared-libgcc\fR whenever you build a shared library or a main
+executable, because \*(C+ and Java programs typically use exceptions, so
+this is the right thing to do.
+.Sp
+If, instead, you use the \s-1GCC\s0 driver to create shared libraries, you may
+find that they will not always be linked with the shared \fIlibgcc\fR.
+If \s-1GCC\s0 finds, at its configuration time, that you have a \s-1GNU\s0 linker that
+does not support option \fB\*(--eh-frame-hdr\fR, it will link the shared
+version of \fIlibgcc\fR into shared libraries by default. Otherwise,
+it will take advantage of the linker and optimize away the linking with
+the shared version of \fIlibgcc\fR, linking with the static version of
+libgcc by default. This allows exceptions to propagate through such
+shared libraries, without incurring relocation costs at library load
+time.
+.Sp
+However, if a library or main executable is supposed to throw or catch
+exceptions, you must link it using the G++ or \s-1GCJ\s0 driver, as appropriate
+for the languages used in the program, or using the option
+\&\fB\-shared-libgcc\fR, such that it is linked with the shared
+\&\fIlibgcc\fR.
+.Ip "\fB\-symbolic\fR" 4
+.IX Item "-symbolic"
+Bind references to global symbols when building a shared object. Warn
+about any unresolved references (unless overridden by the link editor
+option \fB\-Xlinker \-z \-Xlinker defs\fR). Only a few systems support
+this option.
+.Ip "\fB\-Xlinker\fR \fIoption\fR" 4
+.IX Item "-Xlinker option"
+Pass \fIoption\fR as an option to the linker. You can use this to
+supply system-specific linker options which \s-1GCC\s0 does not know how to
+recognize.
+.Sp
+If you want to pass an option that takes an argument, you must use
+\&\fB\-Xlinker\fR twice, once for the option and once for the argument.
+For example, to pass \fB\-assert definitions\fR, you must write
+\&\fB\-Xlinker \-assert \-Xlinker definitions\fR. It does not work to write
+\&\fB\-Xlinker \*(L"\-assert definitions\*(R"\fR, because this passes the entire
+string as a single argument, which is not what the linker expects.
+.Ip "\fB\-Wl,\fR\fIoption\fR" 4
+.IX Item "-Wl,option"
+Pass \fIoption\fR as an option to the linker. If \fIoption\fR contains
+commas, it is split into multiple options at the commas.
+.Ip "\fB\-u\fR \fIsymbol\fR" 4
+.IX Item "-u symbol"
+Pretend the symbol \fIsymbol\fR is undefined, to force linking of
+library modules to define it. You can use \fB\-u\fR multiple times with
+different symbols to force loading of additional library modules.
+.Sh "Options for Directory Search"
+.IX Subsection "Options for Directory Search"
+These options specify directories to search for header files, for
+libraries and for parts of the compiler:
+.Ip "\fB\-I\fR\fIdir\fR" 4
+.IX Item "-Idir"
+Add the directory \fIdir\fR to the head of the list of directories to be
+searched for header files. This can be used to override a system header
+file, substituting your own version, since these directories are
+searched before the system header file directories. However, you should
+not use this option to add directories that contain vendor-supplied
+system header files (use \fB\-isystem\fR for that). If you use more than
+one \fB\-I\fR option, the directories are scanned in left-to-right
+order; the standard system directories come after.
+.Sp
+If a standard system include directory, or a directory specified with
+\&\fB\-isystem\fR, is also specified with \fB\-I\fR, it will be
+searched only in the position requested by \fB\-I\fR. Also, it will
+not be considered a system include directory. If that directory really
+does contain system headers, there is a good chance that they will
+break. For instance, if \s-1GCC\s0's installation procedure edited the headers
+in \fI/usr/include\fR to fix bugs, \fB\-I/usr/include\fR will cause the
+original, buggy headers to be found instead of the corrected ones. \s-1GCC\s0
+will issue a warning when a system include directory is hidden in this
+way.
+.Ip "\fB\-I-\fR" 4
+.IX Item "-I-"
+Any directories you specify with \fB\-I\fR options before the \fB\-I-\fR
+option are searched only for the case of \fB#include "\fR\fIfile\fR\fB"\fR;
+they are not searched for \fB#include <\fR\fIfile\fR\fB>\fR.
+.Sp
+If additional directories are specified with \fB\-I\fR options after
+the \fB\-I-\fR, these directories are searched for all \fB#include\fR
+directives. (Ordinarily \fIall\fR \fB\-I\fR directories are used
+this way.)
+.Sp
+In addition, the \fB\-I-\fR option inhibits the use of the current
+directory (where the current input file came from) as the first search
+directory for \fB#include "\fR\fIfile\fR\fB"\fR. There is no way to
+override this effect of \fB\-I-\fR. With \fB\-I.\fR you can specify
+searching the directory which was current when the compiler was
+invoked. That is not exactly the same as what the preprocessor does
+by default, but it is often satisfactory.
+.Sp
+\&\fB\-I-\fR does not inhibit the use of the standard system directories
+for header files. Thus, \fB\-I-\fR and \fB\-nostdinc\fR are
+independent.
+.Ip "\fB\-L\fR\fIdir\fR" 4
+.IX Item "-Ldir"
+Add directory \fIdir\fR to the list of directories to be searched
+for \fB\-l\fR.
+.Ip "\fB\-F\fR\fIdir\fR" 4
+.IX Item "-Fdir"
+In Apple's version of \s-1GCC\s0 only, add the directory \fIdir\fR to the head
+of the list of directories to be searched for frameworks.
+.Sp
+The framework search algorithm is, for an inclusion of
+\&\fB<Fmwk/Header.h>\fR, to look for files named
+\&\fI\fIpath\fI/Fmwk.framework/Headers/Header.h\fR or
+\&\fI\fIpath\fI/Fmwk.framework/PrivateHeaders/Header.h\fR where
+\&\fIpath\fR includes \fI/System/Library/Frameworks/\fR
+\&\fI/Library/Frameworks/\fR, and \fI/Local/Library/Frameworks/\fR, plus
+any additional paths specified by \fB\-F\fR.
+.Sp
+All the \fB\-F\fR options are also passed to the linker.
+.Ip "\fB\-B\fR\fIprefix\fR" 4
+.IX Item "-Bprefix"
+This option specifies where to find the executables, libraries,
+include files, and data files of the compiler itself.
+.Sp
+The compiler driver program runs one or more of the subprograms
+\&\fIcpp\fR, \fIcc1\fR, \fIas\fR and \fIld\fR. It tries
+\&\fIprefix\fR as a prefix for each program it tries to run, both with and
+without \fImachine\fR\fB/\fR\fIversion\fR\fB/\fR.
+.Sp
+For each subprogram to be run, the compiler driver first tries the
+\&\fB\-B\fR prefix, if any. If that name is not found, or if \fB\-B\fR
+was not specified, the driver tries two standard prefixes, which are
+\&\fI/usr/lib/gcc/\fR and \fI/usr/local/lib/gcc-lib/\fR. If neither of
+those results in a file name that is found, the unmodified program
+name is searched for using the directories specified in your
+\&\fB\s-1PATH\s0\fR environment variable.
+.Sp
+The compiler will check to see if the path provided by the \fB\-B\fR
+refers to a directory, and if necessary it will add a directory
+separator character at the end of the path.
+.Sp
+\&\fB\-B\fR prefixes that effectively specify directory names also apply
+to libraries in the linker, because the compiler translates these
+options into \fB\-L\fR options for the linker. They also apply to
+includes files in the preprocessor, because the compiler translates these
+options into \fB\-isystem\fR options for the preprocessor. In this case,
+the compiler appends \fBinclude\fR to the prefix.
+.Sp
+The run-time support file \fIlibgcc.a\fR can also be searched for using
+the \fB\-B\fR prefix, if needed. If it is not found there, the two
+standard prefixes above are tried, and that is all. The file is left
+out of the link if it is not found by those means.
+.Sp
+Another way to specify a prefix much like the \fB\-B\fR prefix is to use
+the environment variable \fB\s-1GCC_EXEC_PREFIX\s0\fR.
+.Sp
+As a special kludge, if the path provided by \fB\-B\fR is
+\&\fI[dir/]stage\fIN\fI/\fR, where \fIN\fR is a number in the range 0 to
+9, then it will be replaced by \fI[dir/]include\fR. This is to help
+with boot-strapping the compiler.
+.Ip "\fB\-specs=\fR\fIfile\fR" 4
+.IX Item "-specs=file"
+Process \fIfile\fR after the compiler reads in the standard \fIspecs\fR
+file, in order to override the defaults that the \fIgcc\fR driver
+program uses when determining what switches to pass to \fIcc1\fR,
+\&\fIcc1plus\fR, \fIas\fR, \fIld\fR, etc. More than one
+\&\fB\-specs=\fR\fIfile\fR can be specified on the command line, and they
+are processed in order, from left to right.
+.Sh "Specifying Target Machine and Compiler Version"
+.IX Subsection "Specifying Target Machine and Compiler Version"
+By default, \s-1GCC\s0 compiles code for the same type of machine that you
+are using. However, it can also be installed as a cross-compiler, to
+compile for some other type of machine. In fact, several different
+configurations of \s-1GCC\s0, for different target machines, can be
+installed side by side. Then you specify which one to use with the
+\&\fB\-b\fR option.
+.PP
+In addition, older and newer versions of \s-1GCC\s0 can be installed side
+by side. One of them (probably the newest) will be the default, but
+you may sometimes wish to use another.
+.Ip "\fB\-b\fR \fImachine\fR" 4
+.IX Item "-b machine"
+The argument \fImachine\fR specifies the target machine for compilation.
+This is useful when you have installed \s-1GCC\s0 as a cross-compiler.
+.Sp
+The value to use for \fImachine\fR is the same as was specified as the
+machine type when configuring \s-1GCC\s0 as a cross-compiler. For
+example, if a cross-compiler was configured with \fBconfigure
+i386v\fR, meaning to compile for an 80386 running System V, then you
+would specify \fB\-b i386v\fR to run that cross compiler.
+.Sp
+When you do not specify \fB\-b\fR, it normally means to compile for
+the same type of machine that you are using.
+.Ip "\fB\-V\fR \fIversion\fR" 4
+.IX Item "-V version"
+The argument \fIversion\fR specifies which version of \s-1GCC\s0 to run.
+This is useful when multiple versions are installed. For example,
+\&\fIversion\fR might be \fB2.0\fR, meaning to run \s-1GCC\s0 version 2.0.
+.Sp
+The default version, when you do not specify \fB\-V\fR, is the last
+version of \s-1GCC\s0 that you installed.
+.PP
+The \fB\-b\fR and \fB\-V\fR options actually work by controlling part of
+the file name used for the executable files and libraries used for
+compilation. A given version of \s-1GCC\s0, for a given target machine, is
+normally kept in the directory \fI/usr/local/lib/gcc-lib/\fImachine\fI/\fIversion\fI\fR.
+.PP
+Thus, sites can customize the effect of \fB\-b\fR or \fB\-V\fR either by
+changing the names of these directories or adding alternate names (or
+symbolic links). If in directory \fI/usr/local/lib/gcc-lib/\fR the
+file \fI80386\fR is a link to the file \fIi386v\fR, then \fB\-b
+80386\fR becomes an alias for \fB\-b i386v\fR.
+.PP
+In one respect, the \fB\-b\fR or \fB\-V\fR do not completely change
+to a different compiler: the top-level driver program \fBgcc\fR
+that you originally invoked continues to run and invoke the other
+executables (preprocessor, compiler per se, assembler and linker)
+that do the real work. However, since no real work is done in the
+driver program, it usually does not matter that the driver program
+in use is not the one for the specified target. It is common for the
+interface to the other executables to change incompatibly between
+compiler versions, so unless the version specified is very close to that
+of the driver (for example, \fB\-V 3.0\fR with a driver program from \s-1GCC\s0
+version 3.0.1), use of \fB\-V\fR may not work; for example, using
+\&\fB\-V 2.95.2\fR will not work with a driver program from \s-1GCC\s0 3.0.
+.PP
+The only way that the driver program depends on the target machine is
+in the parsing and handling of special machine-specific options.
+However, this is controlled by a file which is found, along with the
+other executables, in the directory for the specified version and
+target machine. As a result, a single installed driver program adapts
+to any specified target machine, and sufficiently similar compiler
+versions.
+.PP
+The driver program executable does control one significant thing,
+however: the default version and target machine. Therefore, you can
+install different instances of the driver program, compiled for
+different targets or versions, under different names.
+.PP
+For example, if the driver for version 2.0 is installed as \fBogcc\fR
+and that for version 2.1 is installed as \fBgcc\fR, then the command
+\&\fBgcc\fR will use version 2.1 by default, while \fBogcc\fR will use
+2.0 by default. However, you can choose either version with either
+command with the \fB\-V\fR option.
+.Sh "Hardware Models and Configurations"
+.IX Subsection "Hardware Models and Configurations"
+Earlier we discussed the standard option \fB\-b\fR which chooses among
+different installed compilers for completely different target
+machines, such as \s-1VAX\s0 vs. 68000 vs. 80386.
+.PP
+In addition, each of these target machine types can have its own
+special options, starting with \fB\-m\fR, to choose among various
+hardware models or configurations\-\-\-for example, 68010 vs 68020,
+floating coprocessor or none. A single installed version of the
+compiler can compile for any model or configuration, according to the
+options specified.
+.PP
+Some configurations of the compiler also support additional special
+options, usually for compatibility with other compilers on the same
+platform.
+.PP
+These options are defined by the macro \f(CW\*(C`TARGET_SWITCHES\*(C'\fR in the
+machine description. The default for the options is also defined by
+that macro, which enables you to change the defaults.
+.PP
+.I "\s-1IBM\s0 \s-1RS/6000\s0 and PowerPC Options"
+.IX Subsection "IBM RS/6000 and PowerPC Options"
+.PP
+These \fB\-m\fR options are defined for the \s-1IBM\s0 \s-1RS/6000\s0 and PowerPC:
+.Ip "\fB\-mpower\fR" 4
+.IX Item "-mpower"
+.PD 0
+.Ip "\fB\-mno-power\fR" 4
+.IX Item "-mno-power"
+.Ip "\fB\-mpower2\fR" 4
+.IX Item "-mpower2"
+.Ip "\fB\-mno-power2\fR" 4
+.IX Item "-mno-power2"
+.Ip "\fB\-mpowerpc\fR" 4
+.IX Item "-mpowerpc"
+.Ip "\fB\-mno-powerpc\fR" 4
+.IX Item "-mno-powerpc"
+.Ip "\fB\-mpowerpc-gpopt\fR" 4
+.IX Item "-mpowerpc-gpopt"
+.Ip "\fB\-mno-powerpc-gpopt\fR" 4
+.IX Item "-mno-powerpc-gpopt"
+.Ip "\fB\-mpowerpc-gfxopt\fR" 4
+.IX Item "-mpowerpc-gfxopt"
+.Ip "\fB\-mno-powerpc-gfxopt\fR" 4
+.IX Item "-mno-powerpc-gfxopt"
+.Ip "\fB\-mpowerpc64\fR" 4
+.IX Item "-mpowerpc64"
+.Ip "\fB\-mno-powerpc64\fR" 4
+.IX Item "-mno-powerpc64"
+.PD
+\&\s-1GCC\s0 supports two related instruction set architectures for the
+\&\s-1RS/6000\s0 and PowerPC. The \fI\s-1POWER\s0\fR instruction set are those
+instructions supported by the \fBrios\fR chip set used in the original
+\&\s-1RS/6000\s0 systems and the \fIPowerPC\fR instruction set is the
+architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
+the \s-1IBM\s0 4xx microprocessors.
+.Sp
+Neither architecture is a subset of the other. However there is a
+large common subset of instructions supported by both. An \s-1MQ\s0
+register is included in processors supporting the \s-1POWER\s0 architecture.
+.Sp
+You use these options to specify which instructions are available on the
+processor you are using. The default value of these options is
+determined when configuring \s-1GCC\s0. Specifying the
+\&\fB\-mcpu=\fR\fIcpu_type\fR overrides the specification of these
+options. We recommend you use the \fB\-mcpu=\fR\fIcpu_type\fR option
+rather than the options listed above.
+.Sp
+The \fB\-mpower\fR option allows \s-1GCC\s0 to generate instructions that
+are found only in the \s-1POWER\s0 architecture and to use the \s-1MQ\s0 register.
+Specifying \fB\-mpower2\fR implies \fB\-power\fR and also allows \s-1GCC\s0
+to generate instructions that are present in the \s-1POWER2\s0 architecture but
+not the original \s-1POWER\s0 architecture.
+.Sp
+The \fB\-mpowerpc\fR option allows \s-1GCC\s0 to generate instructions that
+are found only in the 32\-bit subset of the PowerPC architecture.
+Specifying \fB\-mpowerpc-gpopt\fR implies \fB\-mpowerpc\fR and also allows
+\&\s-1GCC\s0 to use the optional PowerPC architecture instructions in the
+General Purpose group, including floating-point square root. Specifying
+\&\fB\-mpowerpc-gfxopt\fR implies \fB\-mpowerpc\fR and also allows \s-1GCC\s0 to
+use the optional PowerPC architecture instructions in the Graphics
+group, including floating-point select.
+.Sp
+The \fB\-mpowerpc64\fR option allows \s-1GCC\s0 to generate the additional
+64\-bit instructions that are found in the full PowerPC64 architecture
+and to treat GPRs as 64\-bit, doubleword quantities. \s-1GCC\s0 defaults to
+\&\fB\-mno-powerpc64\fR.
+.Sp
+If you specify both \fB\-mno-power\fR and \fB\-mno-powerpc\fR, \s-1GCC\s0
+will use only the instructions in the common subset of both
+architectures plus some special \s-1AIX\s0 common-mode calls, and will not use
+the \s-1MQ\s0 register. Specifying both \fB\-mpower\fR and \fB\-mpowerpc\fR
+permits \s-1GCC\s0 to use any instruction from either architecture and to
+allow use of the \s-1MQ\s0 register; specify this for the Motorola \s-1MPC601\s0.
+.Ip "\fB\-mnew-mnemonics\fR" 4
+.IX Item "-mnew-mnemonics"
+.PD 0
+.Ip "\fB\-mold-mnemonics\fR" 4
+.IX Item "-mold-mnemonics"
+.PD
+Select which mnemonics to use in the generated assembler code. With
+\&\fB\-mnew-mnemonics\fR, \s-1GCC\s0 uses the assembler mnemonics defined for
+the PowerPC architecture. With \fB\-mold-mnemonics\fR it uses the
+assembler mnemonics defined for the \s-1POWER\s0 architecture. Instructions
+defined in only one architecture have only one mnemonic; \s-1GCC\s0 uses that
+mnemonic irrespective of which of these options is specified.
+.Sp
+\&\s-1GCC\s0 defaults to the mnemonics appropriate for the architecture in
+use. Specifying \fB\-mcpu=\fR\fIcpu_type\fR sometimes overrides the
+value of these option. Unless you are building a cross-compiler, you
+should normally not specify either \fB\-mnew-mnemonics\fR or
+\&\fB\-mold-mnemonics\fR, but should instead accept the default.
+.Ip "\fB\-mcpu=\fR\fIcpu_type\fR" 4
+.IX Item "-mcpu=cpu_type"
+Set architecture type, register usage, choice of mnemonics, and
+instruction scheduling parameters for machine type \fIcpu_type\fR.
+Supported values for \fIcpu_type\fR are \fBrios\fR, \fBrios1\fR,
+\&\fBrsc\fR, \fBrios2\fR, \fBrs64a\fR, \fB601\fR, \fB602\fR,
+\&\fB603\fR, \fB603e\fR, \fB604\fR, \fB604e\fR, \fB620\fR,
+\&\fB630\fR, \fB740\fR, \fB7400\fR, \fB7450\fR, \fB750\fR,
+\&\fBpower\fR, \fBpower2\fR, \fBpowerpc\fR, \fB403\fR, \fB505\fR,
+\&\fB801\fR, \fB821\fR, \fB823\fR, and \fB860\fR and \fBcommon\fR.
+.Sp
+\&\fB\-mcpu=common\fR selects a completely generic processor. Code
+generated under this option will run on any \s-1POWER\s0 or PowerPC processor.
+\&\s-1GCC\s0 will use only the instructions in the common subset of both
+architectures, and will not use the \s-1MQ\s0 register. \s-1GCC\s0 assumes a generic
+processor model for scheduling purposes.
+.Sp
+\&\fB\-mcpu=power\fR, \fB\-mcpu=power2\fR, \fB\-mcpu=powerpc\fR, and
+\&\fB\-mcpu=powerpc64\fR specify generic \s-1POWER\s0, \s-1POWER2\s0, pure 32\-bit
+PowerPC (i.e., not \s-1MPC601\s0), and 64\-bit PowerPC architecture machine
+types, with an appropriate, generic processor model assumed for
+scheduling purposes.
+.Sp
+The other options specify a specific processor. Code generated under
+those options will run best on that processor, and may not run at all on
+others.
+.Sp
+The \fB\-mcpu\fR options automatically enable or disable other
+\&\fB\-m\fR options as follows:
+.RS 4
+.Ip "\fBcommon\fR" 4
+.IX Item "common"
+\&\fB\-mno-power\fR, \fB\-mno-powerc\fR
+.Ip "\fBpower\fR" 4
+.IX Item "power"
+.PD 0
+.Ip "\fBpower2\fR" 4
+.IX Item "power2"
+.Ip "\fBrios1\fR" 4
+.IX Item "rios1"
+.Ip "\fBrios2\fR" 4
+.IX Item "rios2"
+.Ip "\fBrsc\fR" 4
+.IX Item "rsc"
+.PD
+\&\fB\-mpower\fR, \fB\-mno-powerpc\fR, \fB\-mno-new-mnemonics\fR
+.Ip "\fBpowerpc\fR" 4
+.IX Item "powerpc"
+.PD 0
+.Ip "\fBrs64a\fR" 4
+.IX Item "rs64a"
+.Ip "\fB602\fR" 4
+.IX Item "602"
+.Ip "\fB603\fR" 4
+.IX Item "603"
+.Ip "\fB603e\fR" 4
+.IX Item "603e"
+.Ip "\fB604\fR" 4
+.IX Item "604"
+.Ip "\fB620\fR" 4
+.IX Item "620"
+.Ip "\fB630\fR" 4
+.IX Item "630"
+.Ip "\fB740\fR" 4
+.IX Item "740"
+.Ip "\fB7400\fR" 4
+.IX Item "7400"
+.Ip "\fB7450\fR" 4
+.IX Item "7450"
+.Ip "\fB750\fR" 4
+.IX Item "750"
+.Ip "\fB505\fR" 4
+.IX Item "505"
+.PD
+\&\fB\-mno-power\fR, \fB\-mpowerpc\fR, \fB\-mnew-mnemonics\fR
+.Ip "\fB601\fR" 4
+.IX Item "601"
+\&\fB\-mpower\fR, \fB\-mpowerpc\fR, \fB\-mnew-mnemonics\fR
+.Ip "\fB403\fR" 4
+.IX Item "403"
+.PD 0
+.Ip "\fB821\fR" 4
+.IX Item "821"
+.Ip "\fB860\fR" 4
+.IX Item "860"
+.PD
+\&\fB\-mno-power\fR, \fB\-mpowerpc\fR, \fB\-mnew-mnemonics\fR, \fB\-msoft-float\fR
+.RE
+.RS 4
+.RE
+.Ip "\fB\-mtune=\fR\fIcpu_type\fR" 4
+.IX Item "-mtune=cpu_type"
+Set the instruction scheduling parameters for machine type
+\&\fIcpu_type\fR, but do not set the architecture type, register usage, or
+choice of mnemonics, as \fB\-mcpu=\fR\fIcpu_type\fR would. The same
+values for \fIcpu_type\fR are used for \fB\-mtune\fR as for
+\&\fB\-mcpu\fR. If both are specified, the code generated will use the
+architecture, registers, and mnemonics set by \fB\-mcpu\fR, but the
+scheduling parameters set by \fB\-mtune\fR.
+.Ip "\fB\-maltivec\fR" 4
+.IX Item "-maltivec"
+.PD 0
+.Ip "\fB\-mno-altivec\fR" 4
+.IX Item "-mno-altivec"
+.PD
+These switches enable or disable the use of built-in functions that
+allow access to the AltiVec instruction set. You may also need to set
+\&\fB\-mabi=altivec\fR to adjust the current \s-1ABI\s0 with AltiVec \s-1ABI\s0
+enhancements.
+.Sp
+This option is not supported on Mac \s-1OS\s0 X; use \fB\-faltivec\fR instead.
+.Ip "\fB\-mfull-toc\fR" 4
+.IX Item "-mfull-toc"
+.PD 0
+.Ip "\fB\-mno-fp-in-toc\fR" 4
+.IX Item "-mno-fp-in-toc"
+.Ip "\fB\-mno-sum-in-toc\fR" 4
+.IX Item "-mno-sum-in-toc"
+.Ip "\fB\-mminimal-toc\fR" 4
+.IX Item "-mminimal-toc"
+.PD
+Modify generation of the \s-1TOC\s0 (Table Of Contents), which is created for
+every executable file. The \fB\-mfull-toc\fR option is selected by
+default. In that case, \s-1GCC\s0 will allocate at least one \s-1TOC\s0 entry for
+each unique non-automatic variable reference in your program. \s-1GCC\s0
+will also place floating-point constants in the \s-1TOC\s0. However, only
+16,384 entries are available in the \s-1TOC\s0.
+.Sp
+If you receive a linker error message that saying you have overflowed
+the available \s-1TOC\s0 space, you can reduce the amount of \s-1TOC\s0 space used
+with the \fB\-mno-fp-in-toc\fR and \fB\-mno-sum-in-toc\fR options.
+\&\fB\-mno-fp-in-toc\fR prevents \s-1GCC\s0 from putting floating-point
+constants in the \s-1TOC\s0 and \fB\-mno-sum-in-toc\fR forces \s-1GCC\s0 to
+generate code to calculate the sum of an address and a constant at
+run-time instead of putting that sum into the \s-1TOC\s0. You may specify one
+or both of these options. Each causes \s-1GCC\s0 to produce very slightly
+slower and larger code at the expense of conserving \s-1TOC\s0 space.
+.Sp
+If you still run out of space in the \s-1TOC\s0 even when you specify both of
+these options, specify \fB\-mminimal-toc\fR instead. This option causes
+\&\s-1GCC\s0 to make only one \s-1TOC\s0 entry for every file. When you specify this
+option, \s-1GCC\s0 will produce code that is slower and larger but which
+uses extremely little \s-1TOC\s0 space. You may wish to use this option
+only on files that contain less frequently executed code.
+.Ip "\fB\-maix64\fR" 4
+.IX Item "-maix64"
+.PD 0
+.Ip "\fB\-maix32\fR" 4
+.IX Item "-maix32"
+.PD
+Enable 64\-bit \s-1AIX\s0 \s-1ABI\s0 and calling convention: 64\-bit pointers, 64\-bit
+\&\f(CW\*(C`long\*(C'\fR type, and the infrastructure needed to support them.
+Specifying \fB\-maix64\fR implies \fB\-mpowerpc64\fR and
+\&\fB\-mpowerpc\fR, while \fB\-maix32\fR disables the 64\-bit \s-1ABI\s0 and
+implies \fB\-mno-powerpc64\fR. \s-1GCC\s0 defaults to \fB\-maix32\fR.
+.Ip "\fB\-mxl-call\fR" 4
+.IX Item "-mxl-call"
+.PD 0
+.Ip "\fB\-mno-xl-call\fR" 4
+.IX Item "-mno-xl-call"
+.PD
+On \s-1AIX\s0, pass floating-point arguments to prototyped functions beyond the
+register save area (\s-1RSA\s0) on the stack in addition to argument FPRs. The
+\&\s-1AIX\s0 calling convention was extended but not initially documented to
+handle an obscure K&R C case of calling a function that takes the
+address of its arguments with fewer arguments than declared. \s-1AIX\s0 \s-1XL\s0
+compilers access floating point arguments which do not fit in the
+\&\s-1RSA\s0 from the stack when a subroutine is compiled without
+optimization. Because always storing floating-point arguments on the
+stack is inefficient and rarely needed, this option is not enabled by
+default and only is necessary when calling subroutines compiled by \s-1AIX\s0
+\&\s-1XL\s0 compilers without optimization.
+.Ip "\fB\-mpe\fR" 4
+.IX Item "-mpe"
+Support \fI\s-1IBM\s0 \s-1RS/6000\s0 \s-1SP\s0\fR \fIParallel Environment\fR (\s-1PE\s0). Link an
+application written to use message passing with special startup code to
+enable the application to run. The system must have \s-1PE\s0 installed in the
+standard location (\fI/usr/lpp/ppe.poe/\fR), or the \fIspecs\fR file
+must be overridden with the \fB\-specs=\fR option to specify the
+appropriate directory location. The Parallel Environment does not
+support threads, so the \fB\-mpe\fR option and the \fB\-pthread\fR
+option are incompatible.
+.Ip "\fB\-malign-mac68k\fR" 4
+.IX Item "-malign-mac68k"
+.PD 0
+.Ip "\fB\-malign-power\fR" 4
+.IX Item "-malign-power"
+.Ip "\fB\-malign-natural\fR" 4
+.IX Item "-malign-natural"
+.PD
+The option \fB\-malign-mac68k\fR causes structure fields to be aligned
+on 2\-byte boundaries, in order to be compatible with m68k compiler
+output. The option \fB\-malign-power\fR is the standard alignment
+mode for the PowerPC. The option \fB\-malign-natural\fR is an
+extension of PowerPC alignment that aligns larger data types such as
+doubles on their natural boundaries. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-msoft-float\fR" 4
+.IX Item "-msoft-float"
+.PD 0
+.Ip "\fB\-mhard-float\fR" 4
+.IX Item "-mhard-float"
+.PD
+Generate code that does not use (uses) the floating-point register set.
+Software floating point emulation is provided if you use the
+\&\fB\-msoft-float\fR option, and pass the option to \s-1GCC\s0 when linking.
+.Ip "\fB\-mmultiple\fR" 4
+.IX Item "-mmultiple"
+.PD 0
+.Ip "\fB\-mno-multiple\fR" 4
+.IX Item "-mno-multiple"
+.PD
+Generate code that uses (does not use) the load multiple word
+instructions and the store multiple word instructions. These
+instructions are generated by default on \s-1POWER\s0 systems, and not
+generated on PowerPC systems. Do not use \fB\-mmultiple\fR on little
+endian PowerPC systems, since those instructions do not work when the
+processor is in little endian mode. The exceptions are \s-1PPC740\s0 and
+\&\s-1PPC750\s0 which permit the instructions usage in little endian mode.
+.Ip "\fB\-mstring\fR" 4
+.IX Item "-mstring"
+.PD 0
+.Ip "\fB\-mno-string\fR" 4
+.IX Item "-mno-string"
+.PD
+Generate code that uses (does not use) the load string instructions
+and the store string word instructions to save multiple registers and
+do small block moves. These instructions are generated by default on
+\&\s-1POWER\s0 systems, and not generated on PowerPC systems. Do not use
+\&\fB\-mstring\fR on little endian PowerPC systems, since those
+instructions do not work when the processor is in little endian mode.
+The exceptions are \s-1PPC740\s0 and \s-1PPC750\s0 which permit the instructions
+usage in little endian mode.
+.Ip "\fB\-mupdate\fR" 4
+.IX Item "-mupdate"
+.PD 0
+.Ip "\fB\-mno-update\fR" 4
+.IX Item "-mno-update"
+.PD
+Generate code that uses (does not use) the load or store instructions
+that update the base register to the address of the calculated memory
+location. These instructions are generated by default. If you use
+\&\fB\-mno-update\fR, there is a small window between the time that the
+stack pointer is updated and the address of the previous frame is
+stored, which means code that walks the stack frame across interrupts or
+signals may get corrupted data.
+.Ip "\fB\-mfused-madd\fR" 4
+.IX Item "-mfused-madd"
+.PD 0
+.Ip "\fB\-mno-fused-madd\fR" 4
+.IX Item "-mno-fused-madd"
+.PD
+Generate code that uses (does not use) the floating point multiply and
+accumulate instructions. These instructions are generated by default if
+hardware floating is used.
+.Ip "\fB\-mno-bit-align\fR" 4
+.IX Item "-mno-bit-align"
+.PD 0
+.Ip "\fB\-mbit-align\fR" 4
+.IX Item "-mbit-align"
+.PD
+On System V.4 and embedded PowerPC systems do not (do) force structures
+and unions that contain bit-fields to be aligned to the base type of the
+bit-field.
+.Sp
+For example, by default a structure containing nothing but 8
+\&\f(CW\*(C`unsigned\*(C'\fR bit-fields of length 1 would be aligned to a 4 byte
+boundary and have a size of 4 bytes. By using \fB\-mno-bit-align\fR,
+the structure would be aligned to a 1 byte boundary and be one byte in
+size.
+.Ip "\fB\-mno-strict-align\fR" 4
+.IX Item "-mno-strict-align"
+.PD 0
+.Ip "\fB\-mstrict-align\fR" 4
+.IX Item "-mstrict-align"
+.PD
+On System V.4 and embedded PowerPC systems do not (do) assume that
+unaligned memory references will be handled by the system.
+.Ip "\fB\-mrelocatable\fR" 4
+.IX Item "-mrelocatable"
+.PD 0
+.Ip "\fB\-mno-relocatable\fR" 4
+.IX Item "-mno-relocatable"
+.PD
+On embedded PowerPC systems generate code that allows (does not allow)
+the program to be relocated to a different address at runtime. If you
+use \fB\-mrelocatable\fR on any module, all objects linked together must
+be compiled with \fB\-mrelocatable\fR or \fB\-mrelocatable-lib\fR.
+.Ip "\fB\-mrelocatable-lib\fR" 4
+.IX Item "-mrelocatable-lib"
+.PD 0
+.Ip "\fB\-mno-relocatable-lib\fR" 4
+.IX Item "-mno-relocatable-lib"
+.PD
+On embedded PowerPC systems generate code that allows (does not allow)
+the program to be relocated to a different address at runtime. Modules
+compiled with \fB\-mrelocatable-lib\fR can be linked with either modules
+compiled without \fB\-mrelocatable\fR and \fB\-mrelocatable-lib\fR or
+with modules compiled with the \fB\-mrelocatable\fR options.
+.Ip "\fB\-mno-toc\fR" 4
+.IX Item "-mno-toc"
+.PD 0
+.Ip "\fB\-mtoc\fR" 4
+.IX Item "-mtoc"
+.PD
+On System V.4 and embedded PowerPC systems do not (do) assume that
+register 2 contains a pointer to a global area pointing to the addresses
+used in the program.
+.Ip "\fB\-mlittle\fR" 4
+.IX Item "-mlittle"
+.PD 0
+.Ip "\fB\-mlittle-endian\fR" 4
+.IX Item "-mlittle-endian"
+.PD
+On System V.4 and embedded PowerPC systems compile code for the
+processor in little endian mode. The \fB\-mlittle-endian\fR option is
+the same as \fB\-mlittle\fR.
+.Ip "\fB\-mbig\fR" 4
+.IX Item "-mbig"
+.PD 0
+.Ip "\fB\-mbig-endian\fR" 4
+.IX Item "-mbig-endian"
+.PD
+On System V.4 and embedded PowerPC systems compile code for the
+processor in big endian mode. The \fB\-mbig-endian\fR option is
+the same as \fB\-mbig\fR.
+.Ip "\fB\-mdynamic-no-pic\fR" 4
+.IX Item "-mdynamic-no-pic"
+On Darwin and Mac \s-1OS\s0 X systems, compile code so that it is not
+relocatable, but that its external references are relocatable. The
+resulting code is suitable for applications, but not shared
+libraries. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-mlong-branch\fR" 4
+.IX Item "-mlong-branch"
+On Darwin and Mac \s-1OS\s0 X systems, compile calls to use a 32\-bit
+destination address. This is to support kernel extensions, which may
+load anywhere within the kernel address space. (\s-1APPLE\s0 \s-1ONLY\s0)
+.Ip "\fB\-mcall-sysv\fR" 4
+.IX Item "-mcall-sysv"
+On System V.4 and embedded PowerPC systems compile code using calling
+conventions that adheres to the March 1995 draft of the System V
+Application Binary Interface, PowerPC processor supplement. This is the
+default unless you configured \s-1GCC\s0 using \fBpowerpc-*\-eabiaix\fR.
+.Ip "\fB\-mcall-sysv-eabi\fR" 4
+.IX Item "-mcall-sysv-eabi"
+Specify both \fB\-mcall-sysv\fR and \fB\-meabi\fR options.
+.Ip "\fB\-mcall-sysv-noeabi\fR" 4
+.IX Item "-mcall-sysv-noeabi"
+Specify both \fB\-mcall-sysv\fR and \fB\-mno-eabi\fR options.
+.Ip "\fB\-mcall-aix\fR" 4
+.IX Item "-mcall-aix"
+On System V.4 and embedded PowerPC systems compile code using calling
+conventions that are similar to those used on \s-1AIX\s0. This is the
+default if you configured \s-1GCC\s0 using \fBpowerpc-*\-eabiaix\fR.
+.Ip "\fB\-mcall-solaris\fR" 4
+.IX Item "-mcall-solaris"
+On System V.4 and embedded PowerPC systems compile code for the Solaris
+operating system.
+.Ip "\fB\-mcall-linux\fR" 4
+.IX Item "-mcall-linux"
+On System V.4 and embedded PowerPC systems compile code for the
+Linux-based \s-1GNU\s0 system.
+.Ip "\fB\-mcall-gnu\fR" 4
+.IX Item "-mcall-gnu"
+On System V.4 and embedded PowerPC systems compile code for the
+Hurd-based \s-1GNU\s0 system.
+.Ip "\fB\-mcall-netbsd\fR" 4
+.IX Item "-mcall-netbsd"
+On System V.4 and embedded PowerPC systems compile code for the
+NetBSD operating system.
+.Ip "\fB\-maix-struct-return\fR" 4
+.IX Item "-maix-struct-return"
+Return all structures in memory (as specified by the \s-1AIX\s0 \s-1ABI\s0).
+.Ip "\fB\-msvr4\-struct-return\fR" 4
+.IX Item "-msvr4-struct-return"
+Return structures smaller than 8 bytes in registers (as specified by the
+\&\s-1SVR4\s0 \s-1ABI\s0).
+.Ip "\fB\-mabi=altivec\fR" 4
+.IX Item "-mabi=altivec"
+Extend the current \s-1ABI\s0 with AltiVec \s-1ABI\s0 extensions. This does not
+change the default \s-1ABI\s0, instead it adds the AltiVec \s-1ABI\s0 extensions to
+the current \s-1ABI\s0.
+.Sp
+This option is effectively permanently enabled on Mac \s-1OS\s0 X.
+.Ip "\fB\-mabi=no-altivec\fR" 4
+.IX Item "-mabi=no-altivec"
+Disable AltiVec \s-1ABI\s0 extensions for the current \s-1ABI\s0.
+.Sp
+This option will not work on Mac \s-1OS\s0 X.
+.Ip "\fB\-mprototype\fR" 4
+.IX Item "-mprototype"
+.PD 0
+.Ip "\fB\-mno-prototype\fR" 4
+.IX Item "-mno-prototype"
+.PD
+On System V.4 and embedded PowerPC systems assume that all calls to
+variable argument functions are properly prototyped. Otherwise, the
+compiler must insert an instruction before every non prototyped call to
+set or clear bit 6 of the condition code register (\fI\s-1CR\s0\fR) to
+indicate whether floating point values were passed in the floating point
+registers in case the function takes a variable arguments. With
+\&\fB\-mprototype\fR, only calls to prototyped variable argument functions
+will set or clear the bit.
+.Ip "\fB\-msim\fR" 4
+.IX Item "-msim"
+On embedded PowerPC systems, assume that the startup module is called
+\&\fIsim-crt0.o\fR and that the standard C libraries are \fIlibsim.a\fR and
+\&\fIlibc.a\fR. This is the default for \fBpowerpc-*\-eabisim\fR.
+configurations.
+.Ip "\fB\-mmvme\fR" 4
+.IX Item "-mmvme"
+On embedded PowerPC systems, assume that the startup module is called
+\&\fIcrt0.o\fR and the standard C libraries are \fIlibmvme.a\fR and
+\&\fIlibc.a\fR.
+.Ip "\fB\-mads\fR" 4
+.IX Item "-mads"
+On embedded PowerPC systems, assume that the startup module is called
+\&\fIcrt0.o\fR and the standard C libraries are \fIlibads.a\fR and
+\&\fIlibc.a\fR.
+.Ip "\fB\-myellowknife\fR" 4
+.IX Item "-myellowknife"
+On embedded PowerPC systems, assume that the startup module is called
+\&\fIcrt0.o\fR and the standard C libraries are \fIlibyk.a\fR and
+\&\fIlibc.a\fR.
+.Ip "\fB\-mvxworks\fR" 4
+.IX Item "-mvxworks"
+On System V.4 and embedded PowerPC systems, specify that you are
+compiling for a VxWorks system.
+.Ip "\fB\-memb\fR" 4
+.IX Item "-memb"
+On embedded PowerPC systems, set the \fI\s-1PPC_EMB\s0\fR bit in the \s-1ELF\s0 flags
+header to indicate that \fBeabi\fR extended relocations are used.
+.Ip "\fB\-meabi\fR" 4
+.IX Item "-meabi"
+.PD 0
+.Ip "\fB\-mno-eabi\fR" 4
+.IX Item "-mno-eabi"
+.PD
+On System V.4 and embedded PowerPC systems do (do not) adhere to the
+Embedded Applications Binary Interface (eabi) which is a set of
+modifications to the System V.4 specifications. Selecting \fB\-meabi\fR
+means that the stack is aligned to an 8 byte boundary, a function
+\&\f(CW\*(C`_\|_eabi\*(C'\fR is called to from \f(CW\*(C`main\*(C'\fR to set up the eabi
+environment, and the \fB\-msdata\fR option can use both \f(CW\*(C`r2\*(C'\fR and
+\&\f(CW\*(C`r13\*(C'\fR to point to two separate small data areas. Selecting
+\&\fB\-mno-eabi\fR means that the stack is aligned to a 16 byte boundary,
+do not call an initialization function from \f(CW\*(C`main\*(C'\fR, and the
+\&\fB\-msdata\fR option will only use \f(CW\*(C`r13\*(C'\fR to point to a single
+small data area. The \fB\-meabi\fR option is on by default if you
+configured \s-1GCC\s0 using one of the \fBpowerpc*\-*\-eabi*\fR options.
+.Ip "\fB\-msdata=eabi\fR" 4
+.IX Item "-msdata=eabi"
+On System V.4 and embedded PowerPC systems, put small initialized
+\&\f(CW\*(C`const\*(C'\fR global and static data in the \fB.sdata2\fR section, which
+is pointed to by register \f(CW\*(C`r2\*(C'\fR. Put small initialized
+non-\f(CW\*(C`const\*(C'\fR global and static data in the \fB.sdata\fR section,
+which is pointed to by register \f(CW\*(C`r13\*(C'\fR. Put small uninitialized
+global and static data in the \fB.sbss\fR section, which is adjacent to
+the \fB.sdata\fR section. The \fB\-msdata=eabi\fR option is
+incompatible with the \fB\-mrelocatable\fR option. The
+\&\fB\-msdata=eabi\fR option also sets the \fB\-memb\fR option.
+.Ip "\fB\-msdata=sysv\fR" 4
+.IX Item "-msdata=sysv"
+On System V.4 and embedded PowerPC systems, put small global and static
+data in the \fB.sdata\fR section, which is pointed to by register
+\&\f(CW\*(C`r13\*(C'\fR. Put small uninitialized global and static data in the
+\&\fB.sbss\fR section, which is adjacent to the \fB.sdata\fR section.
+The \fB\-msdata=sysv\fR option is incompatible with the
+\&\fB\-mrelocatable\fR option.
+.Ip "\fB\-msdata=default\fR" 4
+.IX Item "-msdata=default"
+.PD 0
+.Ip "\fB\-msdata\fR" 4
+.IX Item "-msdata"
+.PD
+On System V.4 and embedded PowerPC systems, if \fB\-meabi\fR is used,
+compile code the same as \fB\-msdata=eabi\fR, otherwise compile code the
+same as \fB\-msdata=sysv\fR.
+.Ip "\fB\-msdata-data\fR" 4
+.IX Item "-msdata-data"
+On System V.4 and embedded PowerPC systems, put small global and static
+data in the \fB.sdata\fR section. Put small uninitialized global and
+static data in the \fB.sbss\fR section. Do not use register \f(CW\*(C`r13\*(C'\fR
+to address small data however. This is the default behavior unless
+other \fB\-msdata\fR options are used.
+.Ip "\fB\-msdata=none\fR" 4
+.IX Item "-msdata=none"
+.PD 0
+.Ip "\fB\-mno-sdata\fR" 4
+.IX Item "-mno-sdata"
+.PD
+On embedded PowerPC systems, put all initialized global and static data
+in the \fB.data\fR section, and all uninitialized data in the
+\&\fB.bss\fR section.
+.Ip "\fB\-G\fR \fInum\fR" 4
+.IX Item "-G num"
+On embedded PowerPC systems, put global and static items less than or
+equal to \fInum\fR bytes into the small data or bss sections instead of
+the normal data or bss section. By default, \fInum\fR is 8. The
+\&\fB\-G\fR \fInum\fR switch is also passed to the linker.
+All modules should be compiled with the same \fB\-G\fR \fInum\fR value.
+.Ip "\fB\-mregnames\fR" 4
+.IX Item "-mregnames"
+.PD 0
+.Ip "\fB\-mno-regnames\fR" 4
+.IX Item "-mno-regnames"
+.PD
+On System V.4 and embedded PowerPC systems do (do not) emit register
+names in the assembly language output using symbolic forms.
+.Ip "\fB\-pthread\fR" 4
+.IX Item "-pthread"
+Adds support for multithreading with the \fIpthreads\fR library.
+This option sets flags for both the preprocessor and linker.
+.PP
+.I "Intel 386 and \s-1AMD\s0 x86\-64 Options"
+.IX Subsection "Intel 386 and AMD x86-64 Options"
+.PP
+These \fB\-m\fR options are defined for the i386 and x86\-64 family of
+computers:
+.Ip "\fB\-mcpu=\fR\fIcpu-type\fR" 4
+.IX Item "-mcpu=cpu-type"
+Tune to \fIcpu-type\fR everything applicable about the generated code, except
+for the \s-1ABI\s0 and the set of available instructions. The choices for
+\&\fIcpu-type\fR are \fBi386\fR, \fBi486\fR, \fBi586\fR, \fBi686\fR,
+\&\fBpentium\fR, \fBpentium-mmx\fR, \fBpentiumpro\fR, \fBpentium2\fR,
+\&\fBpentium3\fR, \fBpentium4\fR, \fBk6\fR, \fBk6\-2\fR, \fBk6\-3\fR,
+\&\fBathlon\fR, \fBathlon-tbird\fR, \fBathlon-4\fR, \fBathlon-xp\fR
+and \fBathlon-mp\fR.
+.Sp
+While picking a specific \fIcpu-type\fR will schedule things appropriately
+for that particular chip, the compiler will not generate any code that
+does not run on the i386 without the \fB\-march=\fR\fIcpu-type\fR option
+being used. \fBi586\fR is equivalent to \fBpentium\fR and \fBi686\fR
+is equivalent to \fBpentiumpro\fR. \fBk6\fR and \fBathlon\fR are the
+\&\s-1AMD\s0 chips as opposed to the Intel ones.
+.Ip "\fB\-march=\fR\fIcpu-type\fR" 4
+.IX Item "-march=cpu-type"
+Generate instructions for the machine type \fIcpu-type\fR. The choices
+for \fIcpu-type\fR are the same as for \fB\-mcpu\fR. Moreover,
+specifying \fB\-march=\fR\fIcpu-type\fR implies \fB\-mcpu=\fR\fIcpu-type\fR.
+.Ip "\fB\-m386\fR" 4
+.IX Item "-m386"
+.PD 0
+.Ip "\fB\-m486\fR" 4
+.IX Item "-m486"
+.Ip "\fB\-mpentium\fR" 4
+.IX Item "-mpentium"
+.Ip "\fB\-mpentiumpro\fR" 4
+.IX Item "-mpentiumpro"
+.PD
+These options are synonyms for \fB\-mcpu=i386\fR, \fB\-mcpu=i486\fR,
+\&\fB\-mcpu=pentium\fR, and \fB\-mcpu=pentiumpro\fR respectively.
+These synonyms are deprecated.
+.Ip "\fB\-mfpmath=\fR\fIunit\fR" 4
+.IX Item "-mfpmath=unit"
+generate floating point arithmetics for selected unit \fIunit\fR. the choices
+for \fIunit\fR are:
+.RS 4
+.Ip "\fB387\fR" 4
+.IX Item "387"
+Use the standard 387 floating point coprocessor present majority of chips and
+emulated otherwise. Code compiled with this option will run almost everywhere.
+The temporary results are computed in 80bit precesion instead of precision
+specified by the type resulting in slightly different results compared to most
+of other chips. See \fB\-ffloat-store\fR for more detailed description.
+.Sp
+This is the default choice for i386 compiler.
+.Ip "\fBsse\fR" 4
+.IX Item "sse"
+Use scalar floating point instructions present in the \s-1SSE\s0 instruction set.
+This instruction set is supported by Pentium3 and newer chips, in the \s-1AMD\s0 line
+by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of \s-1SSE\s0
+instruction set supports only single precision arithmetics, thus the double and
+extended precision arithmetics is still done using 387. Later version, present
+only in Pentium4 and the future \s-1AMD\s0 x86\-64 chips supports double precision
+arithmetics too.
+.Sp
+For i387 you need to use \fB\-march=\fR\fIcpu-type\fR, \fB\-msse\fR or
+\&\fB\-msse2\fR switches to enable \s-1SSE\s0 extensions and make this option
+effective. For x86\-64 compiler, these extensions are enabled by default.
+.Sp
+The resulting code should be considerably faster in majority of cases and avoid
+the numerical instability problems of 387 code, but may break some existing
+code that expects temporaries to be 80bit.
+.Sp
+This is the default choice for x86\-64 compiler.
+.Ip "\fBsse,387\fR" 4
+.IX Item "sse,387"
+Attempt to utilize both instruction sets at once. This effectivly double the
+amount of available registers and on chips with separate execution units for
+387 and \s-1SSE\s0 the execution resources too. Use this option with care, as it is
+still experimental, because gcc register allocator does not model separate
+functional units well resulting in instable performance.
+.RE
+.RS 4
+.RE
+.Ip "\fB\-masm=\fR\fIdialect\fR" 4
+.IX Item "-masm=dialect"
+Output asm instructions using selected \fIdialect\fR. Supported choices are
+\&\fBintel\fR or \fBatt\fR (the default one).
+.Ip "\fB\-mieee-fp\fR" 4
+.IX Item "-mieee-fp"
+.PD 0
+.Ip "\fB\-mno-ieee-fp\fR" 4
+.IX Item "-mno-ieee-fp"
+.PD
+Control whether or not the compiler uses \s-1IEEE\s0 floating point
+comparisons. These handle correctly the case where the result of a
+comparison is unordered.
+.Ip "\fB\-msoft-float\fR" 4
+.IX Item "-msoft-float"
+Generate output containing library calls for floating point.
+\&\fBWarning:\fR the requisite libraries are not part of \s-1GCC\s0.
+Normally the facilities of the machine's usual C compiler are used, but
+this can't be done directly in cross-compilation. You must make your
+own arrangements to provide suitable library functions for
+cross-compilation.
+.Sp
+On machines where a function returns floating point results in the 80387
+register stack, some floating point opcodes may be emitted even if
+\&\fB\-msoft-float\fR is used.
+.Ip "\fB\-mno-fp-ret-in-387\fR" 4
+.IX Item "-mno-fp-ret-in-387"
+Do not use the \s-1FPU\s0 registers for return values of functions.
+.Sp
+The usual calling convention has functions return values of types
+\&\f(CW\*(C`float\*(C'\fR and \f(CW\*(C`double\*(C'\fR in an \s-1FPU\s0 register, even if there
+is no \s-1FPU\s0. The idea is that the operating system should emulate
+an \s-1FPU\s0.
+.Sp
+The option \fB\-mno-fp-ret-in-387\fR causes such values to be returned
+in ordinary \s-1CPU\s0 registers instead.
+.Ip "\fB\-mno-fancy-math-387\fR" 4
+.IX Item "-mno-fancy-math-387"
+Some 387 emulators do not support the \f(CW\*(C`sin\*(C'\fR, \f(CW\*(C`cos\*(C'\fR and
+\&\f(CW\*(C`sqrt\*(C'\fR instructions for the 387. Specify this option to avoid
+generating those instructions. This option is the default on FreeBSD,
+OpenBSD and NetBSD. This option is overridden when \fB\-march\fR
+indicates that the target cpu will always have an \s-1FPU\s0 and so the
+instruction will not need emulation. As of revision 2.6.1, these
+instructions are not generated unless you also use the
+\&\fB\-funsafe-math-optimizations\fR switch.
+.Ip "\fB\-malign-double\fR" 4
+.IX Item "-malign-double"
+.PD 0
+.Ip "\fB\-mno-align-double\fR" 4
+.IX Item "-mno-align-double"
+.PD
+Control whether \s-1GCC\s0 aligns \f(CW\*(C`double\*(C'\fR, \f(CW\*(C`long double\*(C'\fR, and
+\&\f(CW\*(C`long long\*(C'\fR variables on a two word boundary or a one word
+boundary. Aligning \f(CW\*(C`double\*(C'\fR variables on a two word boundary will
+produce code that runs somewhat faster on a \fBPentium\fR at the
+expense of more memory.
+.Ip "\fB\-m128bit-long-double\fR" 4
+.IX Item "-m128bit-long-double"
+Control the size of \f(CW\*(C`long double\*(C'\fR type. i386 application binary interface
+specify the size to be 12 bytes, while modern architectures (Pentium and newer)
+prefer \f(CW\*(C`long double\*(C'\fR aligned to 8 or 16 byte boundary. This is
+impossible to reach with 12 byte long doubles in the array accesses.
+.Sp
+\&\fBWarning:\fR if you use the \fB\-m128bit-long-double\fR switch, the
+structures and arrays containing \f(CW\*(C`long double\*(C'\fR will change their size as
+well as function calling convention for function taking \f(CW\*(C`long double\*(C'\fR
+will be modified.
+.Ip "\fB\-m96bit-long-double\fR" 4
+.IX Item "-m96bit-long-double"
+Set the size of \f(CW\*(C`long double\*(C'\fR to 96 bits as required by the i386
+application binary interface. This is the default.
+.Ip "\fB\-msvr3\-shlib\fR" 4
+.IX Item "-msvr3-shlib"
+.PD 0
+.Ip "\fB\-mno-svr3\-shlib\fR" 4
+.IX Item "-mno-svr3-shlib"
+.PD
+Control whether \s-1GCC\s0 places uninitialized local variables into the
+\&\f(CW\*(C`bss\*(C'\fR or \f(CW\*(C`data\*(C'\fR segments. \fB\-msvr3\-shlib\fR places them
+into \f(CW\*(C`bss\*(C'\fR. These options are meaningful only on System V Release 3.
+.Ip "\fB\-mrtd\fR" 4
+.IX Item "-mrtd"
+Use a different function-calling convention, in which functions that
+take a fixed number of arguments return with the \f(CW\*(C`ret\*(C'\fR \fInum\fR
+instruction, which pops their arguments while returning. This saves one
+instruction in the caller since there is no need to pop the arguments
+there.
+.Sp
+You can specify that an individual function is called with this calling
+sequence with the function attribute \fBstdcall\fR. You can also
+override the \fB\-mrtd\fR option by using the function attribute
+\&\fBcdecl\fR.
+.Sp
+\&\fBWarning:\fR this calling convention is incompatible with the one
+normally used on Unix, so you cannot use it if you need to call
+libraries compiled with the Unix compiler.
+.Sp
+Also, you must provide function prototypes for all functions that
+take variable numbers of arguments (including \f(CW\*(C`printf\*(C'\fR);
+otherwise incorrect code will be generated for calls to those
+functions.
+.Sp
+In addition, seriously incorrect code will result if you call a
+function with too many arguments. (Normally, extra arguments are
+harmlessly ignored.)
+.Ip "\fB\-mregparm=\fR\fInum\fR" 4
+.IX Item "-mregparm=num"
+Control how many registers are used to pass integer arguments. By
+default, no registers are used to pass arguments, and at most 3
+registers can be used. You can control this behavior for a specific
+function by using the function attribute \fBregparm\fR.
+.Sp
+\&\fBWarning:\fR if you use this switch, and
+\&\fInum\fR is nonzero, then you must build all modules with the same
+value, including any libraries. This includes the system libraries and
+startup modules.
+.Ip "\fB\-mpreferred-stack-boundary=\fR\fInum\fR" 4
+.IX Item "-mpreferred-stack-boundary=num"
+Attempt to keep the stack boundary aligned to a 2 raised to \fInum\fR
+byte boundary. If \fB\-mpreferred-stack-boundary\fR is not specified,
+the default is 4 (16 bytes or 128 bits), except when optimizing for code
+size (\fB\-Os\fR), in which case the default is the minimum correct
+alignment (4 bytes for x86, and 8 bytes for x86\-64).
+.Sp
+On Pentium and PentiumPro, \f(CW\*(C`double\*(C'\fR and \f(CW\*(C`long double\*(C'\fR values
+should be aligned to an 8 byte boundary (see \fB\-malign-double\fR) or
+suffer significant run time performance penalties. On Pentium \s-1III\s0, the
+Streaming \s-1SIMD\s0 Extension (\s-1SSE\s0) data type \f(CW\*(C`_\|_m128\*(C'\fR suffers similar
+penalties if it is not 16 byte aligned.
+.Sp
+To ensure proper alignment of this values on the stack, the stack boundary
+must be as aligned as that required by any value stored on the stack.
+Further, every function must be generated such that it keeps the stack
+aligned. Thus calling a function compiled with a higher preferred
+stack boundary from a function compiled with a lower preferred stack
+boundary will most likely misalign the stack. It is recommended that
+libraries that use callbacks always use the default setting.
+.Sp
+This extra alignment does consume extra stack space, and generally
+increases code size. Code that is sensitive to stack space usage, such
+as embedded systems and operating system kernels, may want to reduce the
+preferred alignment to \fB\-mpreferred-stack-boundary=2\fR.
+.Ip "\fB\-mmmx\fR" 4
+.IX Item "-mmmx"
+.PD 0
+.Ip "\fB\-mno-mmx\fR" 4
+.IX Item "-mno-mmx"
+.Ip "\fB\-msse\fR" 4
+.IX Item "-msse"
+.Ip "\fB\-mno-sse\fR" 4
+.IX Item "-mno-sse"
+.Ip "\fB\-msse2\fR" 4
+.IX Item "-msse2"
+.Ip "\fB\-mno-sse2\fR" 4
+.IX Item "-mno-sse2"
+.Ip "\fB\-m3dnow\fR" 4
+.IX Item "-m3dnow"
+.Ip "\fB\-mno-3dnow\fR" 4
+.IX Item "-mno-3dnow"
+.PD
+These switches enable or disable the use of built-in functions that allow
+direct access to the \s-1MMX\s0, \s-1SSE\s0 and 3Dnow extensions of the instruction set.
+.Ip "\fB\-mpush-args\fR" 4
+.IX Item "-mpush-args"
+.PD 0
+.Ip "\fB\-mno-push-args\fR" 4
+.IX Item "-mno-push-args"
+.PD
+Use \s-1PUSH\s0 operations to store outgoing parameters. This method is shorter
+and usually equally fast as method using \s-1SUB/MOV\s0 operations and is enabled
+by default. In some cases disabling it may improve performance because of
+improved scheduling and reduced dependencies.
+.Ip "\fB\-maccumulate-outgoing-args\fR" 4
+.IX Item "-maccumulate-outgoing-args"
+If enabled, the maximum amount of space required for outgoing arguments will be
+computed in the function prologue. This is faster on most modern CPUs
+because of reduced dependencies, improved scheduling and reduced stack usage
+when preferred stack boundary is not equal to 2. The drawback is a notable
+increase in code size. This switch implies \fB\-mno-push-args\fR.
+.Ip "\fB\-mthreads\fR" 4
+.IX Item "-mthreads"
+Support thread-safe exception handling on \fBMingw32\fR. Code that relies
+on thread-safe exception handling must compile and link all code with the
+\&\fB\-mthreads\fR option. When compiling, \fB\-mthreads\fR defines
+\&\fB\-D_MT\fR; when linking, it links in a special thread helper library
+\&\fB\-lmingwthrd\fR which cleans up per thread exception handling data.
+.Ip "\fB\-mno-align-stringops\fR" 4
+.IX Item "-mno-align-stringops"
+Do not align destination of inlined string operations. This switch reduces
+code size and improves performance in case the destination is already aligned,
+but gcc don't know about it.
+.Ip "\fB\-minline-all-stringops\fR" 4
+.IX Item "-minline-all-stringops"
+By default \s-1GCC\s0 inlines string operations only when destination is known to be
+aligned at least to 4 byte boundary. This enables more inlining, increase code
+size, but may improve performance of code that depends on fast memcpy, strlen
+and memset for short lengths.
+.Ip "\fB\-momit-leaf-frame-pointer\fR" 4
+.IX Item "-momit-leaf-frame-pointer"
+Don't keep the frame pointer in a register for leaf functions. This
+avoids the instructions to save, set up and restore frame pointers and
+makes an extra register available in leaf functions. The option
+\&\fB\-fomit-frame-pointer\fR removes the frame pointer for all functions
+which might make debugging harder.
+.PP
+These \fB\-m\fR switches are supported in addition to the above
+on \s-1AMD\s0 x86\-64 processors in 64\-bit environments.
+.Ip "\fB\-m32\fR" 4
+.IX Item "-m32"
+.PD 0
+.Ip "\fB\-m64\fR" 4
+.IX Item "-m64"
+.PD
+Generate code for a 32\-bit or 64\-bit environment.
+The 32\-bit environment sets int, long and pointer to 32 bits and
+generates code that runs on any i386 system.
+The 64\-bit environment sets int to 32 bits and long and pointer
+to 64 bits and generates code for \s-1AMD\s0's x86\-64 architecture.
+.Ip "\fB\-mno-red-zone\fR" 4
+.IX Item "-mno-red-zone"
+Do not use a so called red zone for x86\-64 code. The red zone is mandated
+by the x86\-64 \s-1ABI\s0, it is a 128\-byte area beyond the location of the
+stack pointer that will not be modified by signal or interrupt handlers
+and therefore can be used for temporary data without adjusting the stack
+pointer. The flag \fB\-mno-red-zone\fR disables this red zone.
+.Sh "Options for Code Generation Conventions"
+.IX Subsection "Options for Code Generation Conventions"
+These machine-independent options control the interface conventions
+used in code generation.
+.PP
+Most of them have both positive and negative forms; the negative form
+of \fB\-ffoo\fR would be \fB\-fno-foo\fR. In the table below, only
+one of the forms is listed\-\-\-the one which is not the default. You
+can figure out the other form by either removing \fBno-\fR or adding
+it.
+.Ip "\fB\-fexceptions\fR" 4
+.IX Item "-fexceptions"
+Enable exception handling. Generates extra code needed to propagate
+exceptions. For some targets, this implies \s-1GCC\s0 will generate frame
+unwind information for all functions, which can produce significant data
+size overhead, although it does not affect execution. If you do not
+specify this option, \s-1GCC\s0 will enable it by default for languages like
+\&\*(C+ which normally require exception handling, and disable it for
+languages like C that do not normally require it. However, you may need
+to enable this option when compiling C code that needs to interoperate
+properly with exception handlers written in \*(C+. You may also wish to
+disable this option if you are compiling older \*(C+ programs that don't
+use exception handling.
+.Ip "\fB\-fnon-call-exceptions\fR" 4
+.IX Item "-fnon-call-exceptions"
+Generate code that allows trapping instructions to throw exceptions.
+Note that this requires platform-specific runtime support that does
+not exist everywhere. Moreover, it only allows \fItrapping\fR
+instructions to throw exceptions, i.e. memory references or floating
+point instructions. It does not allow exceptions to be thrown from
+arbitrary signal handlers such as \f(CW\*(C`SIGALRM\*(C'\fR.
+.Ip "\fB\-funwind-tables\fR" 4
+.IX Item "-funwind-tables"
+Similar to \fB\-fexceptions\fR, except that it will just generate any needed
+static data, but will not affect the generated code in any other way.
+You will normally not enable this option; instead, a language processor
+that needs this handling would enable it on your behalf.
+.Ip "\fB\-fasynchronous-unwind-tables\fR" 4
+.IX Item "-fasynchronous-unwind-tables"
+Generate unwind table in dwarf2 format, if supported by target machine. The
+table is exact at each instruction boundary, so it can be used for stack
+unwinding from asynchronous events (such as debugger or garbage collector).
+.Ip "\fB\-fpcc-struct-return\fR" 4
+.IX Item "-fpcc-struct-return"
+Return ``short'' \f(CW\*(C`struct\*(C'\fR and \f(CW\*(C`union\*(C'\fR values in memory like
+longer ones, rather than in registers. This convention is less
+efficient, but it has the advantage of allowing intercallability between
+GCC-compiled files and files compiled with other compilers.
+.Sp
+The precise convention for returning structures in memory depends
+on the target configuration macros.
+.Sp
+Short structures and unions are those whose size and alignment match
+that of some integer type.
+.Ip "\fB\-freg-struct-return\fR" 4
+.IX Item "-freg-struct-return"
+Return \f(CW\*(C`struct\*(C'\fR and \f(CW\*(C`union\*(C'\fR values in registers when possible.
+This is more efficient for small structures than
+\&\fB\-fpcc-struct-return\fR.
+.Sp
+If you specify neither \fB\-fpcc-struct-return\fR nor
+\&\fB\-freg-struct-return\fR, \s-1GCC\s0 defaults to whichever convention is
+standard for the target. If there is no standard convention, \s-1GCC\s0
+defaults to \fB\-fpcc-struct-return\fR, except on targets where \s-1GCC\s0 is
+the principal compiler. In those cases, we can choose the standard, and
+we chose the more efficient register return alternative.
+.Ip "\fB\-fshort-enums\fR" 4
+.IX Item "-fshort-enums"
+Allocate to an \f(CW\*(C`enum\*(C'\fR type only as many bytes as it needs for the
+declared range of possible values. Specifically, the \f(CW\*(C`enum\*(C'\fR type
+will be equivalent to the smallest integer type which has enough room.
+.Ip "\fB\-fshort-double\fR" 4
+.IX Item "-fshort-double"
+Use the same size for \f(CW\*(C`double\*(C'\fR as for \f(CW\*(C`float\*(C'\fR.
+.Ip "\fB\-fshared-data\fR" 4
+.IX Item "-fshared-data"
+Requests that the data and non-\f(CW\*(C`const\*(C'\fR variables of this
+compilation be shared data rather than private data. The distinction
+makes sense only on certain operating systems, where shared data is
+shared between processes running the same program, while private data
+exists in one copy per process.
+.Ip "\fB\-fno-common\fR" 4
+.IX Item "-fno-common"
+In C, allocate even uninitialized global variables in the data section of the
+object file, rather than generating them as common blocks. This has the
+effect that if the same variable is declared (without \f(CW\*(C`extern\*(C'\fR) in
+two different compilations, you will get an error when you link them.
+The only reason this might be useful is if you wish to verify that the
+program will work on other systems which always work this way.
+.Ip "\fB\-fno-ident\fR" 4
+.IX Item "-fno-ident"
+Ignore the \fB#ident\fR directive.
+.Ip "\fB\-fno-gnu-linker\fR" 4
+.IX Item "-fno-gnu-linker"
+Do not output global initializations (such as \*(C+ constructors and
+destructors) in the form used by the \s-1GNU\s0 linker (on systems where the \s-1GNU\s0
+linker is the standard method of handling them). Use this option when
+you want to use a non-GNU linker, which also requires using the
+\&\fBcollect2\fR program to make sure the system linker includes
+constructors and destructors. (\fBcollect2\fR is included in the \s-1GCC\s0
+distribution.) For systems which \fImust\fR use \fBcollect2\fR, the
+compiler driver \fBgcc\fR is configured to do this automatically.
+.Ip "\fB\-finhibit-size-directive\fR" 4
+.IX Item "-finhibit-size-directive"
+Don't output a \f(CW\*(C`.size\*(C'\fR assembler directive, or anything else that
+would cause trouble if the function is split in the middle, and the
+two halves are placed at locations far apart in memory. This option is
+used when compiling \fIcrtstuff.c\fR; you should not need to use it
+for anything else.
+.Ip "\fB\-fverbose-asm\fR" 4
+.IX Item "-fverbose-asm"
+Put extra commentary information in the generated assembly code to
+make it more readable. This option is generally only of use to those
+who actually need to read the generated assembly code (perhaps while
+debugging the compiler itself).
+.Sp
+\&\fB\-fno-verbose-asm\fR, the default, causes the
+extra information to be omitted and is useful when comparing two assembler
+files.
+.Ip "\fB\-fvolatile\fR" 4
+.IX Item "-fvolatile"
+Consider all memory references through pointers to be volatile.
+.Ip "\fB\-fvolatile-global\fR" 4
+.IX Item "-fvolatile-global"
+Consider all memory references to extern and global data items to
+be volatile. \s-1GCC\s0 does not consider static data items to be volatile
+because of this switch.
+.Ip "\fB\-fvolatile-static\fR" 4
+.IX Item "-fvolatile-static"
+Consider all memory references to static data to be volatile.
+.Ip "\fB\-fpic\fR" 4
+.IX Item "-fpic"
+Generate position-independent code (\s-1PIC\s0) suitable for use in a shared
+library, if supported for the target machine. Such code accesses all
+constant addresses through a global offset table (\s-1GOT\s0). The dynamic
+loader resolves the \s-1GOT\s0 entries when the program starts (the dynamic
+loader is not part of \s-1GCC\s0; it is part of the operating system). If
+the \s-1GOT\s0 size for the linked executable exceeds a machine-specific
+maximum size, you get an error message from the linker indicating that
+\&\fB\-fpic\fR does not work; in that case, recompile with \fB\-fPIC\fR
+instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
+on the m68k and \s-1RS/6000\s0. The 386 has no such limit.)
+.Sp
+Position-independent code requires special support, and therefore works
+only on certain machines. For the 386, \s-1GCC\s0 supports \s-1PIC\s0 for System V
+but not for the Sun 386i. Code generated for the \s-1IBM\s0 \s-1RS/6000\s0 is always
+position-independent.
+.Sp
+\&\fB\-fpic\fR is not supported on Mac \s-1OS\s0 X.
+.Ip "\fB\-fPIC\fR" 4
+.IX Item "-fPIC"
+If supported for the target machine, emit position-independent code,
+suitable for dynamic linking and avoiding any limit on the size of the
+global offset table. This option makes a difference on the m68k, m88k,
+and the Sparc.
+.Sp
+Position-independent code requires special support, and therefore works
+only on certain machines.
+.Sp
+\&\fB\-fPIC\fR is the default on Darwin and Mac \s-1OS\s0 X.
+.Ip "\fB\-ffixed-\fR\fIreg\fR" 4
+.IX Item "-ffixed-reg"
+Treat the register named \fIreg\fR as a fixed register; generated code
+should never refer to it (except perhaps as a stack pointer, frame
+pointer or in some other fixed role).
+.Sp
+\&\fIreg\fR must be the name of a register. The register names accepted
+are machine-specific and are defined in the \f(CW\*(C`REGISTER_NAMES\*(C'\fR
+macro in the machine description macro file.
+.Sp
+This flag does not have a negative form, because it specifies a
+three-way choice.
+.Ip "\fB\-fcall-used-\fR\fIreg\fR" 4
+.IX Item "-fcall-used-reg"
+Treat the register named \fIreg\fR as an allocable register that is
+clobbered by function calls. It may be allocated for temporaries or
+variables that do not live across a call. Functions compiled this way
+will not save and restore the register \fIreg\fR.
+.Sp
+It is an error to used this flag with the frame pointer or stack pointer.
+Use of this flag for other registers that have fixed pervasive roles in
+the machine's execution model will produce disastrous results.
+.Sp
+This flag does not have a negative form, because it specifies a
+three-way choice.
+.Ip "\fB\-fcall-saved-\fR\fIreg\fR" 4
+.IX Item "-fcall-saved-reg"
+Treat the register named \fIreg\fR as an allocable register saved by
+functions. It may be allocated even for temporaries or variables that
+live across a call. Functions compiled this way will save and restore
+the register \fIreg\fR if they use it.
+.Sp
+It is an error to used this flag with the frame pointer or stack pointer.
+Use of this flag for other registers that have fixed pervasive roles in
+the machine's execution model will produce disastrous results.
+.Sp
+A different sort of disaster will result from the use of this flag for
+a register in which function values may be returned.
+.Sp
+This flag does not have a negative form, because it specifies a
+three-way choice.
+.Ip "\fB\-fpack-struct\fR" 4
+.IX Item "-fpack-struct"
+Pack all structure members together without holes. Usually you would
+not want to use this option, since it makes the code suboptimal, and
+the offsets of structure members won't agree with system libraries.
+.Ip "\fB\-finstrument-functions\fR" 4
+.IX Item "-finstrument-functions"
+Generate instrumentation calls for entry and exit to functions. Just
+after function entry and just before function exit, the following
+profiling functions will be called with the address of the current
+function and its call site. (On some platforms,
+\&\f(CW\*(C`_\|_builtin_return_address\*(C'\fR does not work beyond the current
+function, so the call site information may not be available to the
+profiling functions otherwise.)
+.Sp
+.Vb 4
+\& void __cyg_profile_func_enter (void *this_fn,
+\& void *call_site);
+\& void __cyg_profile_func_exit (void *this_fn,
+\& void *call_site);
+.Ve
+The first argument is the address of the start of the current function,
+which may be looked up exactly in the symbol table.
+.Sp
+This instrumentation is also done for functions expanded inline in other
+functions. The profiling calls will indicate where, conceptually, the
+inline function is entered and exited. This means that addressable
+versions of such functions must be available. If all your uses of a
+function are expanded inline, this may mean an additional expansion of
+code size. If you use \fBextern inline\fR in your C code, an
+addressable version of such functions must be provided. (This is
+normally the case anyways, but if you get lucky and the optimizer always
+expands the functions inline, you might have gotten away without
+providing static copies.)
+.Sp
+A function may be given the attribute \f(CW\*(C`no_instrument_function\*(C'\fR, in
+which case this instrumentation will not be done. This can be used, for
+example, for the profiling functions listed above, high-priority
+interrupt routines, and any functions from which the profiling functions
+cannot safely be called (perhaps signal handlers, if the profiling
+routines generate output or allocate memory).
+.Ip "\fB\-fstack-check\fR" 4
+.IX Item "-fstack-check"
+Generate code to verify that you do not go beyond the boundary of the
+stack. You should specify this flag if you are running in an
+environment with multiple threads, but only rarely need to specify it in
+a single-threaded environment since stack overflow is automatically
+detected on nearly all systems if there is only one stack.
+.Sp
+Note that this switch does not actually cause checking to be done; the
+operating system must do that. The switch causes generation of code
+to ensure that the operating system sees the stack being extended.
+.Ip "\fB\-fstack-limit-register=\fR\fIreg\fR" 4
+.IX Item "-fstack-limit-register=reg"
+.PD 0
+.Ip "\fB\-fstack-limit-symbol=\fR\fIsym\fR" 4
+.IX Item "-fstack-limit-symbol=sym"
+.Ip "\fB\-fno-stack-limit\fR" 4
+.IX Item "-fno-stack-limit"
+.PD
+Generate code to ensure that the stack does not grow beyond a certain value,
+either the value of a register or the address of a symbol. If the stack
+would grow beyond the value, a signal is raised. For most targets,
+the signal is raised before the stack overruns the boundary, so
+it is possible to catch the signal without taking special precautions.
+.Sp
+For instance, if the stack starts at absolute address \fB0x80000000\fR
+and grows downwards, you can use the flags
+\&\fB\-fstack-limit-symbol=_\|_stack_limit\fR and
+\&\fB\-Wl,\-\-defsym,_\|_stack_limit=0x7ffe0000\fR to enforce a stack limit
+of 128KB. Note that this may only work with the \s-1GNU\s0 linker.
+.Ip "\fB\-fargument-alias\fR" 4
+.IX Item "-fargument-alias"
+.PD 0
+.Ip "\fB\-fargument-noalias\fR" 4
+.IX Item "-fargument-noalias"
+.Ip "\fB\-fargument-noalias-global\fR" 4
+.IX Item "-fargument-noalias-global"
+.PD
+Specify the possible relationships among parameters and between
+parameters and global data.
+.Sp
+\&\fB\-fargument-alias\fR specifies that arguments (parameters) may
+alias each other and may alias global storage.\fB\-fargument-noalias\fR specifies that arguments do not alias
+each other, but may alias global storage.\fB\-fargument-noalias-global\fR specifies that arguments do not
+alias each other and do not alias global storage.
+.Sp
+Each language will automatically use whatever option is required by
+the language standard. You should not need to use these options yourself.
+.Ip "\fB\-fleading-underscore\fR" 4
+.IX Item "-fleading-underscore"
+This option and its counterpart, \fB\-fno-leading-underscore\fR, forcibly
+change the way C symbols are represented in the object file. One use
+is to help link with legacy assembly code.
+.Sp
+Be warned that you should know what you are doing when invoking this
+option, and that not all targets provide complete support for it.
+.SH "ENVIRONMENT"
+.IX Header "ENVIRONMENT"
+This section describes several environment variables that affect how \s-1GCC\s0
+operates. Some of them work by specifying directories or prefixes to use
+when searching for various kinds of files. Some are used to specify other
+aspects of the compilation environment.
+.PP
+Note that you can also specify places to search using options such as
+\&\fB\-B\fR, \fB\-I\fR and \fB\-L\fR. These
+take precedence over places specified using environment variables, which
+in turn take precedence over those specified by the configuration of \s-1GCC\s0.
+.Ip "\fB\s-1LANG\s0\fR" 4
+.IX Item "LANG"
+.PD 0
+.Ip "\fB\s-1LC_CTYPE\s0\fR" 4
+.IX Item "LC_CTYPE"
+.Ip "\fB\s-1LC_MESSAGES\s0\fR" 4
+.IX Item "LC_MESSAGES"
+.Ip "\fB\s-1LC_ALL\s0\fR" 4
+.IX Item "LC_ALL"
+.PD
+These environment variables control the way that \s-1GCC\s0 uses
+localization information that allow \s-1GCC\s0 to work with different
+national conventions. \s-1GCC\s0 inspects the locale categories
+\&\fB\s-1LC_CTYPE\s0\fR and \fB\s-1LC_MESSAGES\s0\fR if it has been configured to do
+so. These locale categories can be set to any value supported by your
+installation. A typical value is \fBen_UK\fR for English in the United
+Kingdom.
+.Sp
+The \fB\s-1LC_CTYPE\s0\fR environment variable specifies character
+classification. \s-1GCC\s0 uses it to determine the character boundaries in
+a string; this is needed for some multibyte encodings that contain quote
+and escape characters that would otherwise be interpreted as a string
+end or escape.
+.Sp
+The \fB\s-1LC_MESSAGES\s0\fR environment variable specifies the language to
+use in diagnostic messages.
+.Sp
+If the \fB\s-1LC_ALL\s0\fR environment variable is set, it overrides the value
+of \fB\s-1LC_CTYPE\s0\fR and \fB\s-1LC_MESSAGES\s0\fR; otherwise, \fB\s-1LC_CTYPE\s0\fR
+and \fB\s-1LC_MESSAGES\s0\fR default to the value of the \fB\s-1LANG\s0\fR
+environment variable. If none of these variables are set, \s-1GCC\s0
+defaults to traditional C English behavior.
+.Ip "\fB\s-1TMPDIR\s0\fR" 4
+.IX Item "TMPDIR"
+If \fB\s-1TMPDIR\s0\fR is set, it specifies the directory to use for temporary
+files. \s-1GCC\s0 uses temporary files to hold the output of one stage of
+compilation which is to be used as input to the next stage: for example,
+the output of the preprocessor, which is the input to the compiler
+proper.
+.Ip "\fB\s-1GCC_EXEC_PREFIX\s0\fR" 4
+.IX Item "GCC_EXEC_PREFIX"
+If \fB\s-1GCC_EXEC_PREFIX\s0\fR is set, it specifies a prefix to use in the
+names of the subprograms executed by the compiler. No slash is added
+when this prefix is combined with the name of a subprogram, but you can
+specify a prefix that ends with a slash if you wish.
+.Sp
+If \fB\s-1GCC_EXEC_PREFIX\s0\fR is not set, \s-1GCC\s0 will attempt to figure out
+an appropriate prefix to use based on the pathname it was invoked with.
+.Sp
+If \s-1GCC\s0 cannot find the subprogram using the specified prefix, it
+tries looking in the usual places for the subprogram.
+.Sp
+The default value of \fB\s-1GCC_EXEC_PREFIX\s0\fR is
+\&\fI\fIprefix\fI/lib/gcc-lib/\fR where \fIprefix\fR is the value
+of \f(CW\*(C`prefix\*(C'\fR when you ran the \fIconfigure\fR script.
+.Sp
+Other prefixes specified with \fB\-B\fR take precedence over this prefix.
+.Sp
+This prefix is also used for finding files such as \fIcrt0.o\fR that are
+used for linking.
+.Sp
+In addition, the prefix is used in an unusual way in finding the
+directories to search for header files. For each of the standard
+directories whose name normally begins with \fB/usr/local/lib/gcc-lib\fR
+(more precisely, with the value of \fB\s-1GCC_INCLUDE_DIR\s0\fR), \s-1GCC\s0 tries
+replacing that beginning with the specified prefix to produce an
+alternate directory name. Thus, with \fB\-Bfoo/\fR, \s-1GCC\s0 will search
+\&\fIfoo/bar\fR where it would normally search \fI/usr/local/lib/bar\fR.
+These alternate directories are searched first; the standard directories
+come next.
+.Ip "\fB\s-1COMPILER_PATH\s0\fR" 4
+.IX Item "COMPILER_PATH"
+The value of \fB\s-1COMPILER_PATH\s0\fR is a colon-separated list of
+directories, much like \fB\s-1PATH\s0\fR. \s-1GCC\s0 tries the directories thus
+specified when searching for subprograms, if it can't find the
+subprograms using \fB\s-1GCC_EXEC_PREFIX\s0\fR.
+.Ip "\fB\s-1LIBRARY_PATH\s0\fR" 4
+.IX Item "LIBRARY_PATH"
+The value of \fB\s-1LIBRARY_PATH\s0\fR is a colon-separated list of
+directories, much like \fB\s-1PATH\s0\fR. When configured as a native compiler,
+\&\s-1GCC\s0 tries the directories thus specified when searching for special
+linker files, if it can't find them using \fB\s-1GCC_EXEC_PREFIX\s0\fR. Linking
+using \s-1GCC\s0 also uses these directories when searching for ordinary
+libraries for the \fB\-l\fR option (but directories specified with
+\&\fB\-L\fR come first).
+.Ip "\fB\s-1LANG\s0\fR" 4
+.IX Item "LANG"
+This variable is used to pass locale information to the compiler. One way in
+which this information is used is to determine the character set to be used
+when character literals, string literals and comments are parsed in C and \*(C+.
+When the compiler is configured to allow multibyte characters,
+the following values for \fB\s-1LANG\s0\fR are recognized:
+.RS 4
+.Ip "\fBC-JIS\fR" 4
+.IX Item "C-JIS"
+Recognize \s-1JIS\s0 characters.
+.Ip "\fBC-SJIS\fR" 4
+.IX Item "C-SJIS"
+Recognize \s-1SJIS\s0 characters.
+.Ip "\fBC-EUCJP\fR" 4
+.IX Item "C-EUCJP"
+Recognize \s-1EUCJP\s0 characters.
+.RE
+.RS 4
+.Sp
+If \fB\s-1LANG\s0\fR is not defined, or if it has some other value, then the
+compiler will use mblen and mbtowc as defined by the default locale to
+recognize and translate multibyte characters.
+.RE
+.PP
+Some additional environments variables affect the behavior of the
+preprocessor.
+.Ip "\fB\s-1CPATH\s0\fR" 4
+.IX Item "CPATH"
+.PD 0
+.Ip "\fBC_INCLUDE_PATH\fR" 4
+.IX Item "C_INCLUDE_PATH"
+.Ip "\fB\s-1CPLUS_INCLUDE_PATH\s0\fR" 4
+.IX Item "CPLUS_INCLUDE_PATH"
+.Ip "\fB\s-1OBJC_INCLUDE_PATH\s0\fR" 4
+.IX Item "OBJC_INCLUDE_PATH"
+.PD
+Each variable's value is a list of directories separated by a special
+character, much like \fB\s-1PATH\s0\fR, in which to look for header files.
+The special character, \f(CW\*(C`PATH_SEPARATOR\*(C'\fR, is target-dependent and
+determined at \s-1GCC\s0 build time. For Windows-based targets it is a
+semicolon, and for almost all other targets it is a colon.
+.Sp
+\&\fB\s-1CPATH\s0\fR specifies a list of directories to be searched as if
+specified with \fB\-I\fR, but after any paths given with \fB\-I\fR
+options on the command line. The environment variable is used
+regardless of which language is being preprocessed.
+.Sp
+The remaining environment variables apply only when preprocessing the
+particular language indicated. Each specifies a list of directories
+to be searched as if specified with \fB\-isystem\fR, but after any
+paths given with \fB\-isystem\fR options on the command line.
+.Ip "\fB\s-1DEPENDENCIES_OUTPUT\s0\fR" 4
+.IX Item "DEPENDENCIES_OUTPUT"
+@anchor{\s-1DEPENDENCIES_OUTPUT\s0}
+If this variable is set, its value specifies how to output
+dependencies for Make based on the non-system header files processed
+by the compiler. System header files are ignored in the dependency
+output.
+.Sp
+The value of \fB\s-1DEPENDENCIES_OUTPUT\s0\fR can be just a file name, in
+which case the Make rules are written to that file, guessing the target
+name from the source file name. Or the value can have the form
+\&\fIfile\fR\fB \fR\fItarget\fR, in which case the rules are written to
+file \fIfile\fR using \fItarget\fR as the target name.
+.Sp
+In other words, this environment variable is equivalent to combining
+the options \fB\-MM\fR and \fB\-MF\fR,
+with an optional \fB\-MT\fR switch too.
+.Ip "\fB\s-1SUNPRO_DEPENDENCIES\s0\fR" 4
+.IX Item "SUNPRO_DEPENDENCIES"
+This variable is the same as the environment variable
+\&\fB\s-1DEPENDENCIES_OUTPUT\s0\fR, except that
+system header files are not ignored, so it implies \fB\-M\fR rather
+than \fB\-MM\fR.
+.SH "BUGS"
+.IX Header "BUGS"
+To report bugs to Apple, see
+<\fBhttp://developer.apple.com/bugreporter\fR>.
+.SH "FOOTNOTES"
+.IX Header "FOOTNOTES"
+.Ip "1." 4
+On some systems, \fBgcc \-shared\fR
+needs to build supplementary stub code for constructors to work. On
+multi-libbed systems, \fBgcc \-shared\fR must select the correct support
+libraries to link against. Failing to supply the correct flags may lead
+to subtle defects. Supplying them in cases where they are not necessary
+is innocuous.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIgpl\fR\|(7), \fIgfdl\fR\|(7), \fIfsf-funding\fR\|(7),
+\&\fIcpp\fR\|(1), \fIgcov\fR\|(1), \fIg77\fR\|(1), \fIas\fR\|(1), \fIld\fR\|(1), \fIgdb\fR\|(1), \fIadb\fR\|(1), \fIdbx\fR\|(1), \fIsdb\fR\|(1)
+and the Info entries for \fIgcc\fR, \fIcpp\fR, \fIg77\fR, \fIas\fR,
+\&\fIld\fR, \fIbinutils\fR and \fIgdb\fR.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+See the Info entry for \fBgcc\fR, or
+<\fBhttp://gcc.gnu.org/onlinedocs/gcc/Contributors.html\fR>,
+for contributors to \s-1GCC\s0.
+.SH "COPYRIGHT"
+.IX Header "COPYRIGHT"
+Copyright (c) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
+1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+.PP
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``\s-1GNU\s0 General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). A copy of the license is
+included in the \fIgfdl\fR\|(7) man page.
+.PP
+(a) The \s-1FSF\s0's Front-Cover Text is:
+.PP
+.Vb 1
+\& A GNU Manual
+.Ve
+(b) The \s-1FSF\s0's Back-Cover Text is:
+.PP
+.Vb 3
+\& You have freedom to copy and modify this GNU Manual, like GNU
+\& software. Copies published by the Free Software Foundation raise
+\& funds for GNU development.
+.Ve
diff --git a/man-pages/gcov3.1 b/man-pages/gcov3.1
new file mode 100644
index 00000000000..f68ba8afbf2
--- /dev/null
+++ b/man-pages/gcov3.1
@@ -0,0 +1,453 @@
+.\" Automatically generated by Pod::Man version 1.15
+.\" Wed Jun 19 19:36:24 2002
+.\"
+.\" Standard preamble:
+.\" ======================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. | will give a
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
+.\" to do unbreakable dashes and therefore won't be available. \*(C` and
+.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
+.tr \(*W-|\(bv\*(Tr
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
+.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
+.\" index entries marked with X<> in POD. Of course, you'll have to process
+.\" the output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it
+.\" makes way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+.bd B 3
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ======================================================================
+.\"
+.IX Title "GCOV 1"
+.TH GCOV 1 "gcc-3.1" "2002-06-19" "GNU"
+.UC
+.SH "NAME"
+gcov \- coverage testing tool
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+gcov [\fB\-v\fR|\fB\*(--version\fR] [\fB\-h\fR|\fB\*(--help\fR]
+ [\fB\-b\fR|\fB\*(--branch-probabilities\fR] [\fB\-c\fR|\fB\*(--branch-counts\fR]
+ [\fB\-n\fR|\fB\*(--no-output\fR] [\fB\-l\fR|\fB\*(--long-file-names\fR]
+ [\fB\-f\fR|\fB\*(--function-summaries\fR]
+ [\fB\-o\fR|\fB\*(--object-directory\fR \fIdirectory\fR] \fIsourcefile\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fBgcov\fR is a test coverage program. Use it in concert with \s-1GCC\s0
+to analyze your programs to help create more efficient, faster
+running code. You can use \fBgcov\fR as a profiling tool to help
+discover where your optimization efforts will best affect your code. You
+can also use \fBgcov\fR along with the other profiling tool,
+\&\fBgprof\fR, to assess which parts of your code use the greatest amount
+of computing time.
+.PP
+Profiling tools help you analyze your code's performance. Using a
+profiler such as \fBgcov\fR or \fBgprof\fR, you can find out some
+basic performance statistics, such as:
+.Ip "\(bu" 4
+how often each line of code executes
+.Ip "\(bu" 4
+what lines of code are actually executed
+.Ip "\(bu" 4
+how much computing time each section of code uses
+.PP
+Once you know these things about how your code works when compiled, you
+can look at each module to see which modules should be optimized.
+\&\fBgcov\fR helps you determine where to work on optimization.
+.PP
+Software developers also use coverage testing in concert with
+testsuites, to make sure software is actually good enough for a release.
+Testsuites can verify that a program works as expected; a coverage
+program tests to see how much of the program is exercised by the
+testsuite. Developers can then determine what kinds of test cases need
+to be added to the testsuites to create both better testing and a better
+final product.
+.PP
+You should compile your code without optimization if you plan to use
+\&\fBgcov\fR because the optimization, by combining some lines of code
+into one function, may not give you as much information as you need to
+look for `hot spots' where the code is using a great deal of computer
+time. Likewise, because \fBgcov\fR accumulates statistics by line (at
+the lowest resolution), it works best with a programming style that
+places only one statement on each line. If you use complicated macros
+that expand to loops or to other control structures, the statistics are
+less helpful\-\-\-they only report on the line where the macro call
+appears. If your complex macros behave like functions, you can replace
+them with inline functions to solve this problem.
+.PP
+\&\fBgcov\fR creates a logfile called \fI\fIsourcefile\fI.gcov\fR which
+indicates how many times each line of a source file \fI\fIsourcefile\fI.c\fR
+has executed. You can use these logfiles along with \fBgprof\fR to aid
+in fine-tuning the performance of your programs. \fBgprof\fR gives
+timing information you can use along with the information you get from
+\&\fBgcov\fR.
+.PP
+\&\fBgcov\fR works only on code compiled with \s-1GCC\s0. It is not
+compatible with any other profiling or test coverage mechanism.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.Ip "\fB\-h\fR" 4
+.IX Item "-h"
+.PD 0
+.Ip "\fB\*(--help\fR" 4
+.IX Item "help"
+.PD
+Display help about using \fBgcov\fR (on the standard output), and
+exit without doing any further processing.
+.Ip "\fB\-v\fR" 4
+.IX Item "-v"
+.PD 0
+.Ip "\fB\*(--version\fR" 4
+.IX Item "version"
+.PD
+Display the \fBgcov\fR version number (on the standard output),
+and exit without doing any further processing.
+.Ip "\fB\-b\fR" 4
+.IX Item "-b"
+.PD 0
+.Ip "\fB\*(--branch-probabilities\fR" 4
+.IX Item "branch-probabilities"
+.PD
+Write branch frequencies to the output file, and write branch summary
+info to the standard output. This option allows you to see how often
+each branch in your program was taken.
+.Ip "\fB\-c\fR" 4
+.IX Item "-c"
+.PD 0
+.Ip "\fB\*(--branch-counts\fR" 4
+.IX Item "branch-counts"
+.PD
+Write branch frequencies as the number of branches taken, rather than
+the percentage of branches taken.
+.Ip "\fB\-n\fR" 4
+.IX Item "-n"
+.PD 0
+.Ip "\fB\*(--no-output\fR" 4
+.IX Item "no-output"
+.PD
+Do not create the \fBgcov\fR output file.
+.Ip "\fB\-l\fR" 4
+.IX Item "-l"
+.PD 0
+.Ip "\fB\*(--long-file-names\fR" 4
+.IX Item "long-file-names"
+.PD
+Create long file names for included source files. For example, if the
+header file \fIx.h\fR contains code, and was included in the file
+\&\fIa.c\fR, then running \fBgcov\fR on the file \fIa.c\fR will produce
+an output file called \fIa.c.x.h.gcov\fR instead of \fIx.h.gcov\fR.
+This can be useful if \fIx.h\fR is included in multiple source files.
+.Ip "\fB\-f\fR" 4
+.IX Item "-f"
+.PD 0
+.Ip "\fB\*(--function-summaries\fR" 4
+.IX Item "function-summaries"
+.PD
+Output summaries for each function in addition to the file level summary.
+.Ip "\fB\-o\fR \fIdirectory\fR" 4
+.IX Item "-o directory"
+.PD 0
+.Ip "\fB\*(--object-directory\fR \fIdirectory\fR" 4
+.IX Item "object-directory directory"
+.PD
+The directory where the object files live. Gcov will search for \fI.bb\fR,
+\&\fI.bbg\fR, and \fI.da\fR files in this directory.
+.PP
+When using \fBgcov\fR, you must first compile your program with two
+special \s-1GCC\s0 options: \fB\-fprofile-arcs \-ftest-coverage\fR.
+This tells the compiler to generate additional information needed by
+gcov (basically a flow graph of the program) and also includes
+additional code in the object files for generating the extra profiling
+information needed by gcov. These additional files are placed in the
+directory where the source code is located.
+.PP
+Running the program will cause profile output to be generated. For each
+source file compiled with \fB\-fprofile-arcs\fR, an accompanying \fI.da\fR
+file will be placed in the source directory.
+.PP
+Running \fBgcov\fR with your program's source file names as arguments
+will now produce a listing of the code along with frequency of execution
+for each line. For example, if your program is called \fItmp.c\fR, this
+is what you see when you use the basic \fBgcov\fR facility:
+.PP
+.Vb 5
+\& $ gcc -fprofile-arcs -ftest-coverage tmp.c
+\& $ a.out
+\& $ gcov tmp.c
+\& 87.50% of 8 source lines executed in file tmp.c
+\& Creating tmp.c.gcov.
+.Ve
+The file \fItmp.c.gcov\fR contains output from \fBgcov\fR.
+Here is a sample:
+.PP
+.Vb 3
+\& main()
+\& {
+\& 1 int i, total;
+.Ve
+.Vb 1
+\& 1 total = 0;
+.Ve
+.Vb 2
+\& 11 for (i = 0; i < 10; i++)
+\& 10 total += i;
+.Ve
+.Vb 5
+\& 1 if (total != 45)
+\& ###### printf ("Failure\en");
+\& else
+\& 1 printf ("Success\en");
+\& 1 }
+.Ve
+When you use the \fB\-b\fR option, your output looks like this:
+.PP
+.Vb 6
+\& $ gcov -b tmp.c
+\& 87.50% of 8 source lines executed in file tmp.c
+\& 80.00% of 5 branches executed in file tmp.c
+\& 80.00% of 5 branches taken at least once in file tmp.c
+\& 50.00% of 2 calls executed in file tmp.c
+\& Creating tmp.c.gcov.
+.Ve
+Here is a sample of a resulting \fItmp.c.gcov\fR file:
+.PP
+.Vb 3
+\& main()
+\& {
+\& 1 int i, total;
+.Ve
+.Vb 1
+\& 1 total = 0;
+.Ve
+.Vb 5
+\& 11 for (i = 0; i < 10; i++)
+\& branch 0 taken = 91%
+\& branch 1 taken = 100%
+\& branch 2 taken = 100%
+\& 10 total += i;
+.Ve
+.Vb 9
+\& 1 if (total != 45)
+\& branch 0 taken = 100%
+\& ###### printf ("Failure\en");
+\& call 0 never executed
+\& branch 1 never executed
+\& else
+\& 1 printf ("Success\en");
+\& call 0 returns = 100%
+\& 1 }
+.Ve
+For each basic block, a line is printed after the last line of the basic
+block describing the branch or call that ends the basic block. There can
+be multiple branches and calls listed for a single source line if there
+are multiple basic blocks that end on that line. In this case, the
+branches and calls are each given a number. There is no simple way to map
+these branches and calls back to source constructs. In general, though,
+the lowest numbered branch or call will correspond to the leftmost construct
+on the source line.
+.PP
+For a branch, if it was executed at least once, then a percentage
+indicating the number of times the branch was taken divided by the
+number of times the branch was executed will be printed. Otherwise, the
+message ``never executed'' is printed.
+.PP
+For a call, if it was executed at least once, then a percentage
+indicating the number of times the call returned divided by the number
+of times the call was executed will be printed. This will usually be
+100%, but may be less for functions call \f(CW\*(C`exit\*(C'\fR or \f(CW\*(C`longjmp\*(C'\fR,
+and thus may not return every time they are called.
+.PP
+The execution counts are cumulative. If the example program were
+executed again without removing the \fI.da\fR file, the count for the
+number of times each line in the source was executed would be added to
+the results of the previous \fIrun\fR\|(s). This is potentially useful in
+several ways. For example, it could be used to accumulate data over a
+number of program runs as part of a test verification suite, or to
+provide more accurate long-term information over a large number of
+program runs.
+.PP
+The data in the \fI.da\fR files is saved immediately before the program
+exits. For each source file compiled with \fB\-fprofile-arcs\fR, the profiling
+code first attempts to read in an existing \fI.da\fR file; if the file
+doesn't match the executable (differing number of basic block counts) it
+will ignore the contents of the file. It then adds in the new execution
+counts and finally writes the data to the file.
+.Sh "Using \fBgcov\fP with \s-1GCC\s0 Optimization"
+.IX Subsection "Using gcov with GCC Optimization"
+If you plan to use \fBgcov\fR to help optimize your code, you must
+first compile your program with two special \s-1GCC\s0 options:
+\&\fB\-fprofile-arcs \-ftest-coverage\fR. Aside from that, you can use any
+other \s-1GCC\s0 options; but if you want to prove that every single line
+in your program was executed, you should not compile with optimization
+at the same time. On some machines the optimizer can eliminate some
+simple code lines by combining them with other lines. For example, code
+like this:
+.PP
+.Vb 4
+\& if (a != b)
+\& c = 1;
+\& else
+\& c = 0;
+.Ve
+can be compiled into one instruction on some machines. In this case,
+there is no way for \fBgcov\fR to calculate separate execution counts
+for each line because there isn't separate code for each line. Hence
+the \fBgcov\fR output looks like this if you compiled the program with
+optimization:
+.PP
+.Vb 4
+\& 100 if (a != b)
+\& 100 c = 1;
+\& 100 else
+\& 100 c = 0;
+.Ve
+The output shows that this block of code, combined by optimization,
+executed 100 times. In one sense this result is correct, because there
+was only one instruction representing all four of these lines. However,
+the output does not indicate how many times the result was 0 and how
+many times the result was 1.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIgpl\fR\|(7), \fIgfdl\fR\|(7), \fIfsf-funding\fR\|(7), \fIgcc\fR\|(1) and the Info entry for \fIgcc\fR.
+.SH "COPYRIGHT"
+.IX Header "COPYRIGHT"
+Copyright (c) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+.PP
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``\s-1GNU\s0 General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). A copy of the license is
+included in the \fIgfdl\fR\|(7) man page.
+.PP
+(a) The \s-1FSF\s0's Front-Cover Text is:
+.PP
+.Vb 1
+\& A GNU Manual
+.Ve
+(b) The \s-1FSF\s0's Back-Cover Text is:
+.PP
+.Vb 3
+\& You have freedom to copy and modify this GNU Manual, like GNU
+\& software. Copies published by the Free Software Foundation raise
+\& funds for GNU development.
+.Ve
diff --git a/more-hdrs/assert.h b/more-hdrs/assert.h
new file mode 100644
index 00000000000..0bd55b020c8
--- /dev/null
+++ b/more-hdrs/assert.h
@@ -0,0 +1,71 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "/usr/include/assert.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+#ifndef FIXINC_BROKEN_ASSERT_STDLIB_CHECK
+#define FIXINC_BROKEN_ASSERT_STDLIB_CHECK 1
+
+#ifdef __cplusplus
+#include <stdlib.h>
+#endif
+/* Allow this file to be included multiple times
+ with different settings of NDEBUG. */
+#undef assert
+#undef __assert
+
+#ifdef NDEBUG
+#define assert(ignore) ((void) 0)
+#else
+
+#ifndef __GNUC__
+
+#define assert(expression) \
+ ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))
+
+#define __assert(expression, file, lineno) \
+ (printf ("%s:%u: failed assertion\n", file, lineno), \
+ abort (), 0)
+
+#else
+
+#if defined(__STDC__) || defined (__cplusplus)
+
+/* Defined in libgcc.a */
+#ifdef __cplusplus
+extern "C" {
+extern void __eprintf (const char *, const char *, unsigned, const char *)
+ __attribute__ ((noreturn));
+}
+#else
+extern void __eprintf (const char *, const char *, unsigned, const char *)
+ __attribute__ ((noreturn));
+#endif
+
+#define assert(expression) \
+ ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)))
+
+#define __assert(expression, file, line) \
+ (__eprintf ("%s:%u: failed assertion `%s'\n", \
+ file, line, expression), 0)
+
+#else /* no __STDC__ and not C++; i.e. -traditional. */
+
+extern void __eprintf () __attribute__ ((noreturn)); /* Defined in libgcc.a */
+
+#define assert(expression) \
+ ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))
+
+#define __assert(expression, file, lineno) \
+ (__eprintf ("%s:%u: failed assertion `%s'\n", \
+ file, lineno, "expression"), 0)
+
+#endif /* no __STDC__ and not C++; i.e. -traditional. */
+#endif /* no __GNU__; i.e., /bin/cc. */
+#endif
+
+#endif /* FIXINC_BROKEN_ASSERT_STDLIB_CHECK */
diff --git a/more-hdrs/float.h b/more-hdrs/float.h
new file mode 100644
index 00000000000..366d745abbf
--- /dev/null
+++ b/more-hdrs/float.h
@@ -0,0 +1,98 @@
+/* This file exists soley to keep Metrowerks' compilers happy. The version
+ used by GCC 3.4 and later can be found in /usr/lib/gcc, although it's
+ not very informative. */
+
+#ifndef _FLOAT_H_
+#define _FLOAT_H_
+
+#ifndef __MWERKS__
+#error This file is only for Metrowerks compatibilty.
+#endif
+
+/* Define various characteristics of floating-point types, if needed. */
+#ifndef __FLT_RADIX__
+#define __FLT_RADIX__ 2
+#endif
+#ifndef __FLT_MANT_DIG__
+#define __FLT_MANT_DIG__ 24
+#endif
+#ifndef __FLT_DIG__
+#define __FLT_DIG__ 6
+#endif
+#ifndef __FLT_EPSILON__
+#define __FLT_EPSILON__ 1.19209290e-07F
+#endif
+#ifndef __FLT_MIN__
+#define __FLT_MIN__ 1.17549435e-38F
+#endif
+#ifndef __FLT_MAX__
+#define __FLT_MAX__ 3.40282347e+38F
+#endif
+#ifndef __FLT_MIN_EXP__
+#define __FLT_MIN_EXP__ (-125)
+#endif
+#ifndef __FLT_MIN_10_EXP__
+#define __FLT_MIN_10_EXP__ (-37)
+#endif
+#ifndef __FLT_MAX_EXP__
+#define __FLT_MAX_EXP__ 128
+#endif
+#ifndef __FLT_MAX_10_EXP__
+#define __FLT_MAX_10_EXP__ 38
+#endif
+#ifndef __DBL_MANT_DIG__
+#define __DBL_MANT_DIG__ 53
+#endif
+#ifndef __DBL_DIG__
+#define __DBL_DIG__ 15
+#endif
+#ifndef __DBL_EPSILON__
+#define __DBL_EPSILON__ 2.2204460492503131e-16
+#endif
+#ifndef __DBL_MIN__
+#define __DBL_MIN__ 2.2250738585072014e-308
+#endif
+#ifndef __DBL_MAX__
+#define __DBL_MAX__ 1.7976931348623157e+308
+#endif
+#ifndef __DBL_MIN_EXP__
+#define __DBL_MIN_EXP__ (-1021)
+#endif
+#ifndef __DBL_MIN_10_EXP__
+#define __DBL_MIN_10_EXP__ (-307)
+#endif
+#ifndef __DBL_MAX_EXP__
+#define __DBL_MAX_EXP__ 1024
+#endif
+#ifndef __DBL_MAX_10_EXP__
+#define __DBL_MAX_10_EXP__ 308
+#endif
+#ifndef __LDBL_MANT_DIG__
+#define __LDBL_MANT_DIG__ 53
+#endif
+#ifndef __LDBL_DIG__
+#define __LDBL_DIG__ 15
+#endif
+#ifndef __LDBL_EPSILON__
+#define __LDBL_EPSILON__ 2.2204460492503131e-16
+#endif
+#ifndef __LDBL_MIN__
+#define __LDBL_MIN__ 2.2250738585072014e-308
+#endif
+#ifndef __LDBL_MAX__
+#define __LDBL_MAX__ 1.7976931348623157e+308
+#endif
+#ifndef __LDBL_MIN_EXP__
+#define __LDBL_MIN_EXP__ (-1021)
+#endif
+#ifndef __LDBL_MIN_10_EXP__
+#define __LDBL_MIN_10_EXP__ (-307)
+#endif
+#ifndef __LDBL_MAX_EXP__
+#define __LDBL_MAX_EXP__ 1024
+#endif
+#ifndef __LDBL_MAX_10_EXP__
+#define __LDBL_MAX_10_EXP__ 308
+#endif
+
+#endif
diff --git a/more-hdrs/inttypes.h b/more-hdrs/inttypes.h
new file mode 100644
index 00000000000..a203cc7613c
--- /dev/null
+++ b/more-hdrs/inttypes.h
@@ -0,0 +1,308 @@
+/*
+ * Copyright (c) 2000,2001 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
+ *
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*
+ * <inttypes.h> -- Standard C header, defined in ISO/IEC 9899:1999
+ * (aka "C99"), section 7.8. This defines format string conversion
+ * specifiers suitable for use within arguments to fprintf and fscanf
+ * and their ilk.
+ */
+
+#if !defined(_INTTYPES_H_)
+#define _INTTYPES_H_
+
+#include <sys/cdefs.h> /* For __BEGIN_DECLS and __END_DECLS */
+#include <machine/ansi.h> /* For _BSD_WCHAR_T_ */
+#include <stdint.h>
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
+ /* Translator is not ISO/IEC 9899:1999-compliant. */
+# if !defined(restrict)
+# define restrict
+# define __RESTRICT_KEYWORD_DEFINED__
+# endif
+#endif
+
+/* "C++ implementations should define these macros only when
+ * __STDC_FORMAT_MACROS is defined before <inttypes.h> is included."
+ */
+#if (! defined(__cplusplus)) || defined(__STDC_FORMAT_MACROS)
+
+# undef __PRI_8_LENGTH_MODIFIER__
+# undef __PRI_64_LENGTH_MODIFIER__
+# undef __SCN_8_LENGTH_MODIFIER__
+# undef __SCN_64_LENGTH_MODIFIER__
+
+# if defined(__STDC_LIBRARY_SUPPORTED__)
+# define __PRI_8_LENGTH_MODIFIER__ "hh"
+# define __PRI_64_LENGTH_MODIFIER__ "ll"
+# define __SCN_8_LENGTH_MODIFIER__ "hh"
+# define __SCN_64_LENGTH_MODIFIER__ "ll"
+# else
+# define __PRI_8_LENGTH_MODIFIER__ "" /* none */
+# define __PRI_64_LENGTH_MODIFIER__ "q"
+# endif
+
+# define PRId8 __PRI_8_LENGTH_MODIFIER__ "d"
+# define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i"
+# define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o"
+# define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u"
+# define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x"
+# define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X"
+
+# define PRId16 "hd"
+# define PRIi16 "hi"
+# define PRIo16 "ho"
+# define PRIu16 "hu"
+# define PRIx16 "hx"
+# define PRIX16 "hX"
+
+# define PRId32 "d"
+# define PRIi32 "i"
+# define PRIo32 "o"
+# define PRIu32 "u"
+# define PRIx32 "x"
+# define PRIX32 "X"
+
+# define PRId64 __PRI_64_LENGTH_MODIFIER__ "d"
+# define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i"
+# define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o"
+# define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u"
+# define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x"
+# define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X"
+
+# define PRIdLEAST8 PRId8
+# define PRIiLEAST8 PRIi8
+# define PRIoLEAST8 PRIo8
+# define PRIuLEAST8 PRIu8
+# define PRIxLEAST8 PRIx8
+# define PRIXLEAST8 PRIX8
+
+# define PRIdLEAST16 PRId16
+# define PRIiLEAST16 PRIi16
+# define PRIoLEAST16 PRIo16
+# define PRIuLEAST16 PRIu16
+# define PRIxLEAST16 PRIx16
+# define PRIXLEAST16 PRIX16
+
+# define PRIdLEAST32 PRId32
+# define PRIiLEAST32 PRIi32
+# define PRIoLEAST32 PRIo32
+# define PRIuLEAST32 PRIu32
+# define PRIxLEAST32 PRIx32
+# define PRIXLEAST32 PRIX32
+
+# define PRIdLEAST64 PRId64
+# define PRIiLEAST64 PRIi64
+# define PRIoLEAST64 PRIo64
+# define PRIuLEAST64 PRIu64
+# define PRIxLEAST64 PRIx64
+# define PRIXLEAST64 PRIX64
+
+# define PRIdFAST8 PRId32
+# define PRIiFAST8 PRIi32
+# define PRIoFAST8 PRIo32
+# define PRIuFAST8 PRIu32
+# define PRIxFAST8 PRIx32
+# define PRIXFAST8 PRIX32
+
+# define PRIdFAST16 PRId32
+# define PRIiFAST16 PRIi32
+# define PRIoFAST16 PRIo32
+# define PRIuFAST16 PRIu32
+# define PRIxFAST16 PRIx32
+# define PRIXFAST16 PRIX32
+
+# define PRIdFAST32 PRId32
+# define PRIiFAST32 PRIi32
+# define PRIoFAST32 PRIo32
+# define PRIuFAST32 PRIu32
+# define PRIxFAST32 PRIx32
+# define PRIXFAST32 PRIX32
+
+# define PRIdFAST64 PRId64
+# define PRIiFAST64 PRIi64
+# define PRIoFAST64 PRIo64
+# define PRIuFAST64 PRIu64
+# define PRIxFAST64 PRIx64
+# define PRIXFAST64 PRIX64
+
+# define PRIdPTR PRId32
+# define PRIiPTR PRIi32
+# define PRIoPTR PRIo32
+# define PRIuPTR PRIu32
+# define PRIxPTR PRIx32
+# define PRIXPTR PRIX32
+
+# define PRIdMAX PRId64
+# define PRIiMAX PRIi64
+# define PRIoMAX PRIo64
+# define PRIuMAX PRIu64
+# define PRIxMAX PRIx64
+# define PRIXMAX PRIX64
+
+# if defined(__SCN_8_LENGTH_MODIFIER__)
+# define SCNd8 __SCN_8_LENGTH_MODIFIER__ "d"
+# define SCNi8 __SCN_8_LENGTH_MODIFIER__ "i"
+# define SCNo8 __SCN_8_LENGTH_MODIFIER__ "o"
+# define SCNu8 __SCN_8_LENGTH_MODIFIER__ "u"
+# define SCNx8 __SCN_8_LENGTH_MODIFIER__ "x"
+# endif
+
+# define SCNd16 "hd"
+# define SCNi16 "hi"
+# define SCNo16 "ho"
+# define SCNu16 "hu"
+# define SCNx16 "hx"
+
+# define SCNd32 "ld"
+# define SCNi32 "li"
+# define SCNo32 "lo"
+# define SCNu32 "lu"
+# define SCNx32 "lx"
+
+# if defined(__SCN_64_LENGTH_MODIFIER__)
+# define SCNd64 __SCN_64_LENGTH_MODIFIER__ "d"
+# define SCNi64 __SCN_64_LENGTH_MODIFIER__ "i"
+# define SCNo64 __SCN_64_LENGTH_MODIFIER__ "o"
+# define SCNu64 __SCN_64_LENGTH_MODIFIER__ "u"
+# define SCNx64 __SCN_64_LENGTH_MODIFIER__ "x"
+# endif
+
+# if defined(__SCN_8_LENGTH_MODIFIER__)
+# define SCNdLEAST8 SCNd8
+# define SCNiLEAST8 SCNi8
+# define SCNoLEAST8 SCNo8
+# define SCNuLEAST8 SCNu8
+# define SCNxLEAST8 SCNx8
+# endif
+
+# define SCNdLEAST16 SCNd16
+# define SCNiLEAST16 SCNi16
+# define SCNoLEAST16 SCNo16
+# define SCNuLEAST16 SCNu16
+# define SCNxLEAST16 SCNx16
+
+# define SCNdLEAST32 SCNd32
+# define SCNiLEAST32 SCNi32
+# define SCNoLEAST32 SCNo32
+# define SCNuLEAST32 SCNu32
+# define SCNxLEAST32 SCNx32
+
+# if defined(__SCN_64_LENGTH_MODIFIER__)
+# define SCNdLEAST64 SCNd64
+# define SCNiLEAST64 SCNi64
+# define SCNoLEAST64 SCNo64
+# define SCNuLEAST64 SCNu64
+# define SCNxLEAST64 SCNx64
+# endif
+
+# define SCNdFAST8 SCNd32
+# define SCNiFAST8 SCNi32
+# define SCNoFAST8 SCNo32
+# define SCNuFAST8 SCNu32
+# define SCNxFAST8 SCNx32
+
+# define SCNdFAST16 SCNd32
+# define SCNiFAST16 SCNi32
+# define SCNoFAST16 SCNo32
+# define SCNuFAST16 SCNu32
+# define SCNxFAST16 SCNx32
+
+# define SCNdFAST32 SCNd32
+# define SCNiFAST32 SCNi32
+# define SCNoFAST32 SCNo32
+# define SCNuFAST32 SCNu32
+# define SCNxFAST32 SCNx32
+
+# if defined(__SCN_64_LENGTH_MODIFIER__)
+# define SCNdFAST64 SCNd64
+# define SCNiFAST64 SCNi64
+# define SCNoFAST64 SCNo64
+# define SCNuFAST64 SCNu64
+# define SCNxFAST64 SCNx64
+# endif
+
+# define SCNdPTR SCNd32
+# define SCNiPTR SCNi32
+# define SCNoPTR SCNo32
+# define SCNuPTR SCNu32
+# define SCNxPTR SCNx32
+
+# if defined(__SCN_64_LENGTH_MODIFIER__)
+# define SCNdMAX SCNd64
+# define SCNiMAX SCNi64
+# define SCNoMAX SCNo64
+# define SCNuMAX SCNu64
+# define SCNxMAX SCNx64
+# endif
+
+#endif /* if C++, then __STDC_FORMAT_MACROS enables the above macros */
+
+__BEGIN_DECLS
+
+ /* 7.8.2.1 */
+ extern intmax_t imaxabs(intmax_t j);
+
+ /* 7.8.2.2 */
+ typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+ } imaxdiv_t;
+
+ extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
+
+ /* 7.8.2.3 */
+ extern intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base);
+ extern uintmax_t strtoumax(const char * restrict nptr, char ** restrict endptr, int base);
+
+#ifndef __cplusplus /* wchar_t is a built-in type in C++ */
+# ifndef _BSD_WCHAR_T_DEFINED_
+# define _BSD_WCHAR_T_DEFINED_
+ typedef _BSD_WCHAR_T_ wchar_t;
+# endif
+#endif
+
+ /* 7.8.2.4 */
+ extern intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
+ extern uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
+
+__END_DECLS
+
+/*
+ No need to #undef the __*_{8,64}_LENGTH_MODIFIER__ macros;
+ in fact, you can't #undef them, because later uses of any of
+ their dependents will *not* then do the intended substitution.
+ Expansion of a #define like this one:
+
+ #define x IDENT y
+
+ uses the cpp value of IDENT at the location where x is *expanded*,
+ not where it is #defined.
+*/
+
+#if defined(__RESTRICT_KEYWORD_DEFINED__)
+# undef restrict
+# undef __RESTRICT_KEYWORD_DEFINED__
+#endif
+
+#endif /* !_INTTYPES_H_ */
diff --git a/more-hdrs/machine/limits.h b/more-hdrs/machine/limits.h
new file mode 100644
index 00000000000..67d35383bf5
--- /dev/null
+++ b/more-hdrs/machine/limits.h
@@ -0,0 +1,11 @@
+/* This is the `system' limits.h, independent of any particular
+ compiler. GCC provides its own limits.h which can be found in
+ /usr/lib/gcc, although it is not very informative.
+ This file is public domain. */
+#if defined (__ppc__)
+#include <ppc/limits.h>
+#elif defined (__i386__)
+#include <i386/limits.h>
+#else
+#error architecture not supported
+#endif
diff --git a/more-hdrs/ppc_intrinsics.h b/more-hdrs/ppc_intrinsics.h
new file mode 100644
index 00000000000..c9418abdba6
--- /dev/null
+++ b/more-hdrs/ppc_intrinsics.h
@@ -0,0 +1,939 @@
+/* APPLE LOCAL PPC_INTRINSICS */
+
+/* Definitions for PowerPC intrinsic instructions
+ Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* As a special exception, if you include this header file into source
+ files compiled by GCC, this header file does not by itself cause
+ the resulting executable to be covered by the GNU General Public
+ License. This exception does not however invalidate any other
+ reasons why the executable file might be covered by the GNU General
+ Public License. */
+
+/*
+ * The following PowerPC intrinsics are provided by this header:
+ *
+ * Low-Level Processor Synchronization
+ * __eieio - Enforce In-Order Execution of I/O
+ * __isync - Instruction Synchronize
+ * __sync - Synchronize
+ *
+ * Manipulating the Contents of a Variable or Register
+ * __cntlzw - Count Leading Zeros Word
+ * __rlwimi - Rotate Left Word Immediate then Mask Insert
+ * __rlwinm - Rotate Left Word Immediate then AND with Mask
+ * __rlwnm - Rotate Left Word then AND with Mask
+ *
+ * Byte-Reversing Functions
+ * __lhbrx - Load Half Word Byte-Reverse Indexed
+ * __lwbrx - Load Word Byte-Reverse Indexed
+ * __sthbrx - Store Half Word Byte-Reverse Indexed
+ * __stwbrx - Store Word Byte-Reverse Indexed
+ *
+ * Data Cache Manipulation
+ * __dcba - Data Cache Block Allocate
+ * __dcba - Data Cache Block Flush
+ * __dcbst - Data Cache Block Store
+ * __dcbt - Data Cache Block Touch
+ * __dcbtst - Data Cache Block Touch for Store
+ * __dcbz - Data Cache Block Set to Zero
+ *
+ * Setting the Floating-Point Environment
+ * __setflm - Set Floating-point Mode
+ *
+ * Math Functions
+ * __fabs - Floating-Point Absolute Value
+ * __fnabs - Floating Negative Absolute Value
+ * __fctiw - Floating Convert to Integer Word
+ * __fctiwz - Floating Convert to Integer Word with Round toward Zero
+ * __fmadd - Floating Multiply-Add (Double-Precision)
+ * __fmadds - Floating Multiply-Add Single
+ * __fmsub - Floating Multiply-Subract (Double-Precision)
+ * __fmsubs - Floating Multiply-Subract Single
+ * __fmul - Floating Multiply (Double-Precision)
+ * __fmuls - Floating Multiply Single
+ * __fnmadd - Floating Negative Multiply-Add (Double-Precision)
+ * __fnmadds - Floating Negative Multiply-Add Single
+ * __fnmsub - Floating Negative Multiply-Subtract (Double-Precision)
+ * __fnmsubs - Floating Negative Multiply-Subtract Single
+ * __fres - Floating Reciprocal Estimate
+ * __frsp - Floating Round to Single-Precision
+ * __frsqrte - Floating Reciprocal Square Root Estimate
+ * __frsqrtes - Floating Reciprocal Square Root Estimate Single
+ * __fsel - Floating Select
+ * __fsels - Floating Select (Single-Precision variant)
+ * __fsqrt - Floating-Point Square Root (Double-Precision)
+ * __fsqrts - Floating-Point Square Root Single-Precision
+ * __mulhw - Multiply High Word
+ * __mulhwu - Multiply High Word Unsigned
+ * __stfiwx - Store Floating-Point as Integer Word Indexed
+ *
+ * Miscellaneous Functions
+ * __astrcmp - assembly strcmp
+ * __icbi - Instruction Cache Block Invalidate
+ * __mffs - Move from FPSCR
+ * __mfspr - Move from Special Purpose Register
+ * __mtfsf - Move to SPSCR Fields
+ * __mtspr - Move to Special Purpose Register
+ * __OSReadSwapSInt16 - lhbrx for signed shorts
+ * __OSReadSwapUInt16 - lhbrx for unsigned shorts
+ *
+ * TO DO:
+ * - Desired:
+ * mullw
+ * - Available in CodeWarrior, not yet implemented here:
+ * abs, labs, fabsf, fnabsf
+ *
+ * NOTES:
+ * - Some of the intrinsics need to be macros because certain
+ * parameters MUST be integer constants and not values in registers.
+ * - The declarations use __asm__ instead of asm and __inline__ instead
+ * of inline to prevent errors when -ansi is specified.
+ * - Some of the intrinsic definitions use the "volatile" specifier on
+ * the "asm" statements in order to work around what appears to be
+ * a bug in the compiler/optimizer. In general we have avoided the
+ * use of "volatile" because it suppresses optimization on the
+ * generated instructions. The instructions to which "volatile"
+ * has been added where it appears that it should not be needed are
+ * lhbrx and lwbrx.
+ *
+ * Contributors: Fred Forsman (editor), Turly O'Connor, Ian Ollmann
+ * Last modified: June 4, 2002
+ */
+
+#ifndef _PPC_INTRINSICS_H_
+#define _PPC_INTRINSICS_H_
+
+#if defined(__ppc__) && ! defined(__MWERKS__)
+
+/*******************************************************************
+ * Special Purpose Registers (SPRs) *
+ *******************************************************************/
+
+#define __SPR_MQR 0 /* PPC 601 only */
+#define __SPR_XER 1
+#define __SPR_RTCU 4 /* Real time clock upper. PPC 601 only.*/
+#define __SPR_RTCL 5 /* Real time clock lower. PPC 601 only.*/
+#define __SPR_LR 8
+#define __SPR_CTR 9
+#define __SPR_VRSAVE 256 /* AltiVec */
+#define __SPR_TBL 268 /* Time-base Lower. Not on PPC 601 */
+#define __SPR_TBU 269 /* Time-base Upper. Not on PPC 601 */
+#define __SPR_UMMCR2 928 /* PPC 74xx */
+#define __SPR_UPMC5 929 /* PPC 745x */
+#define __SPR_UPMC6 930 /* PPC 745x */
+#define __SPR_UBAMR 935 /* PPC 7400 and 7410 */
+#define __SPR_UMMCR0 936 /* PPC 74xx and 750 */
+#define __SPR_UPMC1 937 /* PPC 74xx and 750 */
+#define __SPR_UPMC2 938 /* PPC 74xx and 750 */
+#define __SPR_USIAR 939 /* PPC 74xx and 750 */
+#define __SPR_UMMCR1 940 /* PPC 74xx and 750 */
+#define __SPR_UPMC3 941 /* PPC 74xx and 750 */
+#define __SPR_UPMC4 942 /* PPC 74xx and 750 */
+#define __SPR_PIR 1023 /* supervisor level only! */
+
+/*
+ * Shorthand macros for some commonly used SPR's.
+ */
+#define __mfxer() __mfspr(__SPR_XER)
+#define __mflr() __mfspr(__SPR_LR)
+#define __mfctr() __mfspr(__SPR_CTR)
+#define __mfvrsave() __mfspr(__SPR_VRSAVE)
+#define __mftb() __mfspr(__SPR_TBL)
+#define __mftbu() __mfspr(__SPR_TBU)
+
+#define __mtlr(value) __mtspr(__SPR_LR, value)
+#define __mtxer(value) __mtspr(__SPR_XER, value)
+#define __mtctr(value) __mtspr(__SPR_CTR, value)
+#define __mtvrsave(value) __mtspr(__SPR_VRSAVE, value)
+
+
+/*******************************************************************
+ * Low-Level Processor Synchronization *
+ *******************************************************************/
+
+/*
+ * __eieio - Enforce In-Order Execution of I/O
+ *
+ * void __eieio (void);
+ */
+#define __eieio() __asm__ ("eieio" : : : "memory")
+
+/*
+ * __isync - Instruction Synchronize
+ *
+ * void __isync (void);
+ */
+#define __isync() \
+ __asm__ volatile ("isync")
+
+/*
+ * __sync - Synchronize
+ *
+ * void __sync (void);
+ */
+#define __sync() __asm__ volatile ("sync")
+
+
+/*******************************************************************
+ * Byte-Reversing Functions *
+ *******************************************************************/
+
+/*
+ * __lhbrx - Load Half Word Byte-Reverse Indexed
+ *
+ * int __lhbrx(void *, int);
+ */
+#define __lhbrx(base, index) \
+ ({ unsigned short lhbrxResult; \
+ __asm__ volatile ("lhbrx %0, %1, %2" : "=r" (lhbrxResult) : "b%" (index), "r" (base) : "memory"); \
+ /*return*/ lhbrxResult; })
+
+/*
+ * __lwbrx - Load Word Byte-Reverse Indexed
+ *
+ * int __lwbrx(void *, int);
+ */
+#define __lwbrx(base, index) \
+ ({ unsigned long lwbrxResult; \
+ __asm__ volatile ("lwbrx %0, %1, %2" : "=r" (lwbrxResult) : "b%" (index), "r" (base) : "memory"); \
+ /*return*/ lwbrxResult; })
+
+/*
+ * __sthbrx - Store Half Word Byte-Reverse Indexed
+ *
+ * int __sthbrx(unsigned short, void *, int);
+ */
+#define __sthbrx(value, base, index) \
+ __asm__ ("sthbrx %0, %1, %2" : : "r" (value), "b%" (index), "r" (base) : "memory")
+
+/*
+ * __stwbrx - Store Word Byte-Reverse Indexed
+ *
+ * int __sthbrx(unsigned int, void *, int);
+ */
+#define __stwbrx(value, base, index) \
+ __asm__ ("stwbrx %0, %1, %2" : : "r" (value), "b%" (index), "r" (base) : "memory")
+
+
+/*******************************************************************
+ * Manipulating the Contents of a Variable or Register *
+ *******************************************************************/
+
+/*
+ * __cntlzw - Count Leading Zeros Word
+ */
+static inline int __cntlzw (int value) __attribute__((always_inline));
+static inline int
+__cntlzw (int value)
+{
+ long result;
+ __asm__ ("cntlzw %0, %1"
+ /* outputs: */ : "=r" (result)
+ /* inputs: */ : "r" (value));
+ return result;
+}
+
+/*
+ * __rlwimi - Rotate Left Word Immediate then Mask Insert
+ *
+ * int __rlwimi(int, int, int, int, int);
+ *
+ * We don't mention "%1" below: operand[1] needs to be skipped as
+ * it's just a placeholder to let the compiler know that rA is read
+ * from as well as written to.
+ */
+#define __rlwimi(rA, rS, cnt, mb, me) \
+ ({ __asm__ ("rlwimi %0,%2,%3,%4,%5" : "=r" (rA) \
+ : "0" (rA), "r" (rS), "n" (cnt), "n" (mb), "n" (me)); \
+ /*return*/ rA;})
+
+/*
+ * __rlwinm - Rotate Left Word Immediate then AND with Mask
+ *
+ * int __rlwinm(int, int, int, int);
+ */
+#define __rlwinm(rS, cnt, mb, me) \
+ ({ unsigned long val, src = (rS); \
+ __asm__ ("rlwinm %0,%1,%2,%3,%4" : "=r" (val) \
+ : "r" (src), "n" (cnt), "n" (mb), "n" (me)); \
+ /*return*/ val;})
+
+/*
+ * __rlwnm - Rotate Left Word then AND with Mask
+ *
+ * int __rlwnm(int, int, int, int);
+ */
+#define __rlwnm(value, leftRotateBits, maskStart, maskEnd) \
+ ({ long result; \
+ __asm__ ("rlwnm %0, %1, %2, %3, %4" : "=r" (result) : \
+ "r" (value), "r" (leftRotateBits), "n" (maskStart), "n" (maskEnd)); \
+ /*return */ result; })
+
+
+/*******************************************************************
+ * Data Cache Manipulation *
+ *******************************************************************/
+
+/*
+ * --- Data Cache Block instructions ---
+ *
+ * Please see Motorola's "The Programming Environments for 32-Bit
+ * Microprocessors" for a description of what these do.
+ *
+ * Parameter descriptions:
+ *
+ * base starting address for figuring out where the
+ * cacheline is
+ *
+ * index byte count to be added to the base address for
+ * purposes of calculating the effective address
+ * of the cacheline to be operated on.
+ *
+ * Effective Address of cacheline to be manipulated =
+ * (char*) base + index
+ *
+ * WARNING: The size and alignment of cachelines are subject to
+ * change on future processors! Cachelines are 32 bytes in
+ * size and are aligned to 32 bytes on PowerPC 601, 603, 604,
+ * 750, 7400, 7410, 7450, and 7455.
+ *
+ */
+
+/*
+ * __dcba - Data Cache Block Allocate
+ *
+ * void __dcba(void *, int)
+ *
+ * WARNING: dcba is a valid instruction only on PowerPC 7400, 7410,
+ * 7450 and 7455.
+ */
+#define __dcba(base, index) \
+ __asm__ ("dcba %0, %1" : /*no result*/ : "b%" (index), "r" (base) : "memory")
+
+/*
+ * __dcbf - Data Cache Block Flush
+ *
+ * void __dcbf(void *, int);
+ */
+#define __dcbf(base, index) \
+ __asm__ ("dcbf %0, %1" : /*no result*/ : "b%" (index), "r" (base) : "memory")
+
+/*
+ * __dcbst - Data Cache Block Store
+ *
+ * void __dcbst(void *, int);
+ */
+#define __dcbst(base, index) \
+ __asm__ ("dcbst %0, %1" : /*no result*/ : "b%" (index), "r" (base) : "memory")
+
+/*
+ * __dcbt - Data Cache Block Touch
+ *
+ * void __dcbt(void *, int);
+ */
+#define __dcbt(base, index) \
+ __asm__ ("dcbt %0, %1" : /*no result*/ : "b%" (index), "r" (base) : "memory")
+
+/*
+ * __dcbtst - Data Cache Block Touch for Store
+ *
+ * void __dcbtst(void *, int);
+ */
+#define __dcbtst(base, index) \
+ __asm__ ("dcbtst %0, %1" : /*no result*/ : "b%" (index), "r" (base) : "memory")
+
+/*
+ * __dcbz - Data Cache Block Set to Zero
+ *
+ * void __dcbz(void *, int);
+ */
+#define __dcbz(base, index) \
+ __asm__ ("dcbz %0, %1" : /*no result*/ : "b%" (index), "r" (base) : "memory")
+
+
+/*******************************************************************
+ * Setting the Floating-Point Environment *
+ *******************************************************************/
+
+/*
+ * __setflm - Set Floating-point Mode
+ *
+ * Sets the FPSCR (floating-point status and control register),
+ * returning the original value.
+ *
+ * ??? CW: float __setflm(float);
+ */
+static inline double __setflm (double newflm) __attribute__((always_inline));
+static inline double
+__setflm(double newflm)
+{
+ double original;
+
+ __asm__ ("mffs %0"
+ /* outputs: */ : "=f" (original));
+ __asm__ ("mtfsf 255,%0"
+ /* outputs: */ : /* none */
+ /* inputs: */ : "f" (newflm));
+ return original;
+}
+
+
+/*******************************************************************
+ * Math Functions *
+ *******************************************************************/
+
+/*
+ * __fabs - Floating-Point Absolute Value
+ */
+static inline double __fabs (double value) __attribute__((always_inline));
+static inline double
+__fabs (double value)
+{
+ double result;
+ __asm__ ("fabs %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (value));
+ return result;
+}
+
+/*
+ * __fnabs - Floating Negative Absolute Value
+ */
+static inline double __fnabs (double b) __attribute__((always_inline));
+static inline double
+__fnabs (double b)
+{
+ double result;
+ __asm__ ("fnabs %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (b));
+ return result;
+}
+
+/*
+ * fctiw - Floating Convert to Integer Word
+ *
+ * Convert the input value to a signed long and place in the low 32
+ * bits of the FP register. Clip to LONG_MIN or LONG_MAX if the FP
+ * value exceeds the range representable by a long. Use the rounding
+ * mode indicated in the FPSCR.
+ */
+static inline double __fctiw (double b) __attribute__((always_inline));
+static inline double
+__fctiw (double b)
+{
+ double result;
+ __asm__ ("fctiw %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (b));
+ return result;
+}
+
+/*
+ * fctiwz - Floating Convert to Integer Word with Round toward Zero
+ *
+ * Convert the input value to a signed long and place in the low 32
+ * bits of the FP register. Clip to LONG_MIN or LONG_MAX if the FP
+ * value exceeds the range representable by a long.
+ */
+static inline double __fctiwz (double b) __attribute__((always_inline));
+static inline double
+__fctiwz (double b)
+{
+ double result;
+ __asm__ ("fctiwz %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (b));
+ return result;
+}
+
+/*
+ * fmadd - Floating Multiply-Add (Double-Precision)
+ *
+ * (a * c + b) double precision
+ */
+static inline double __fmadd (double a, double c, double b) __attribute__((always_inline));
+static inline double
+__fmadd (double a, double c, double b)
+{
+ double result;
+ __asm__ ("fmadd %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * fmadds - Floating Multiply-Add Single
+ *
+ * (a * c + b) single precision
+ *
+ * Double precision arguments are used to prevent the compiler from
+ * issuing frsp instructions upstream.
+ */
+static inline float __fmadds (double a, double c, double b) __attribute__((always_inline));
+static inline float
+__fmadds (double a, double c, double b)
+{
+ float result;
+ __asm__ ("fmadds %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * fmsub - Floating Multiply-Subract (Double-Precision)
+ *
+ * (a * c - b) double precision
+ */
+static inline double __fmsub (double a, double c, double b) __attribute__((always_inline));
+static inline double
+__fmsub (double a, double c, double b)
+{
+ double result;
+ __asm__ ("fmsub %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * fmsubs - Floating Multiply-Subract Single
+ *
+ * (a * c - b) single precision
+ *
+ * Double precision arguments are used to prevent the compiler from
+ * issuing frsp instructions upstream.
+ */
+static inline float __fmsubs (double a, double c, double b) __attribute__((always_inline));
+static inline float
+__fmsubs (double a, double c, double b)
+{
+ float result;
+ __asm__ ("fmsubs %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * fmul - Floating Multiply (Double-Precision)
+ *
+ * (a * c) double precision
+ */
+static inline double __fmul (double a, double c) __attribute__((always_inline));
+static inline double
+__fmul (double a, double c)
+{
+ double result;
+ __asm__ ("fmul %0, %1, %2"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c));
+ return result;
+}
+
+/*
+ * fmuls - Floating Multiply Single
+ *
+ * (a * c) single precision
+ *
+ * Double precision arguments are used to prevent the compiler from
+ * issuing frsp instructions upstream.
+ */
+static inline float __fmuls (double a, double c) __attribute__((always_inline));
+static inline float
+__fmuls (double a, double c)
+{
+ float result;
+ __asm__ ("fmuls %0, %1, %2"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c));
+ return result;
+}
+
+/*
+ * __fnmadd - Floating Negative Multiply-Add (Double-Precision)
+ *
+ * -(a * c + b) double precision
+ */
+static inline double __fnmadd (double a, double c, double b) __attribute__((always_inline));
+static inline double
+__fnmadd (double a, double c, double b)
+{
+ double result;
+ __asm__ ("fnmadd %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * __fnmadds - Floating Negative Multiply-Add Single
+ *
+ * -(a * c + b) single precision
+ *
+ * Double precision arguments are used to prevent the compiler from
+ * issuing frsp instructions upstream.
+ */
+static inline float __fnmadds (double a, double c, double b) __attribute__((always_inline));
+static inline float
+__fnmadds (double a, double c, double b)
+{
+ float result;
+ __asm__ ("fnmadds %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * __fnmsub - Floating Negative Multiply-Subtract (Double-Precision)
+ *
+ * -(a * c - B) double precision
+ */
+static inline double __fnmsub (double a, double c, double b) __attribute__((always_inline));
+static inline double
+__fnmsub (double a, double c, double b)
+{
+ double result;
+ __asm__ ("fnmsub %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * __fnmsubs - Floating Negative Multiply-Subtract Single
+ *
+ * -(a * c - b) single precision
+ *
+ * Double precision arguments are used to prevent the compiler from
+ * issuing frsp instructions upstream.
+ */
+static inline float __fnmsubs (double a, double c, double b) __attribute__((always_inline));
+static inline float
+__fnmsubs (double a, double c, double b)
+{
+ float result;
+ __asm__ ("fnmsubs %0, %1, %2, %3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (a), "f" (c), "f" (b));
+ return result;
+}
+
+/*
+ * __fres - Floating Reciprocal Estimate
+ *
+ * Produces a double precision result with 5 bits of accuracy.
+ * Note: not valid on the PowerPC 601.
+ *
+ * ??? CW: float __fres(float)
+ */
+static inline float __fres (float val) __attribute__((always_inline));
+static inline float
+__fres (float val)
+{
+ float estimate;
+ __asm__ ("fres %0,%1"
+ /* outputs: */ : "=f" (estimate)
+ /* inputs: */ : "f" (val));
+ return estimate;
+}
+
+/*
+ * __frsp - Floating Round to Single-Precision
+ */
+static inline float __frsp (double d) __attribute__((always_inline));
+static inline float
+__frsp (double d)
+{
+ float result;
+ __asm__ ("frsp %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (d));
+ return result;
+}
+
+/*
+ * __frsqrte - Floating Reciprocal Square Root Estimate
+ *
+ * Note: not valid on the PowerPC 601.
+ */
+static inline double __frsqrte (double val) __attribute__((always_inline));
+static inline double
+__frsqrte (double val)
+{
+ double estimate;
+
+ __asm__ ("frsqrte %0,%1"
+ /* outputs: */ : "=f" (estimate)
+ /* inputs: */ : "f" (val));
+ return estimate;
+}
+
+/*
+ * __frsqrtes - Floating Reciprocal Square Root Estimate Single
+ */
+static inline float __frsqrtes (double f) __attribute__((always_inline));
+static inline float
+__frsqrtes (double f)
+{
+ float result;
+ __asm__ ("frsqrte %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (f));
+ return result;
+}
+
+/*
+ * __fsel - Floating Select
+ *
+ * if (test >= 0) return a; else return b;
+ *
+ * Note: not valid on the PowerPC 601.
+ */
+static inline double __fsel (double test, double a, double b) __attribute__((always_inline));
+static inline double
+__fsel (double test, double a, double b)
+{
+ double result;
+ __asm__ ("fsel %0,%1,%2,%3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (test), "f" (a), "f" (b));
+ return result;
+}
+
+/*
+ * __fsels - Floating Select (Single-Precision variant)
+ *
+ * An artificial single precision variant of fsel. This produces the
+ * same results as fsel, but is useful because the result is cast as
+ * a float, discouraging the compiler from issuing a frsp instruction
+ * afterward.
+ */
+static inline float __fsels (double test, double a, double b) __attribute__((always_inline));
+static inline float
+__fsels (double test, double a, double b)
+{
+ float result;
+ __asm__ ("fsel %0,%1,%2,%3"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (test), "f" (a), "f" (b));
+ return result;
+}
+
+/*
+ * __fsqrt - Floating-Point Square Root (Double-Precision)
+ *
+ * WARNING: Illegal instruction for PowerPC 603, 604, 750, 7400, 7410,
+ * 7450, and 7455
+ */
+static inline double __fsqrt (double b) __attribute__((always_inline));
+static inline double
+__fsqrt(double d)
+{
+ double result;
+ __asm__ ("fsqrt %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (d));
+ return result;
+}
+
+/*
+ * __fsqrts - Floating-Point Square Root Single-Precision
+ *
+ * WARNING: Illegal instruction for PowerPC 603, 604, 750, 7400, 7410,
+ * 7450, and 7455
+ */
+static inline float __fsqrts (float f) __attribute__((always_inline));
+static inline float
+__fsqrts (float f)
+{
+ float result;
+ __asm__ ("fsqrts %0, %1"
+ /* outputs: */ : "=f" (result)
+ /* inputs: */ : "f" (f));
+ return result;
+}
+
+/*
+ * __mulhw - Multiply High Word
+ */
+static inline int __mulhw (int a, int b) __attribute__((always_inline));
+static inline int
+__mulhw (int a, int b)
+{
+ long result;
+ __asm__ ("mulhw %0, %1, %2"
+ /* outputs: */ : "=r" (result)
+ /* inputs: */ : "r" (a), "r"(b));
+ return result;
+}
+
+/*
+ * __mulhwu - Multiply High Word Unsigned
+ */
+static inline unsigned int __mulhwu (unsigned int a, unsigned int b) __attribute__((always_inline));
+static inline unsigned int
+__mulhwu (unsigned int a, unsigned int b)
+{
+ unsigned long result;
+ __asm__ ("mulhwu %0, %1, %2"
+ /* outputs: */ : "=r" (result)
+ /* inputs: */ : "r" (a), "r"(b));
+ return result;
+}
+
+/*
+ * __stfiwx - Store Floating-Point as Integer Word Indexed
+ *
+ * void x(int, void *, int);
+ */
+#define __stfiwx(value, base, index) \
+ __asm__ ("stfiwx %0, %1, %2" : /*no result*/ \
+ : "f" (value), "b%" (index), "r" (base) : "memory")
+
+
+/*******************************************************************
+ * Miscellaneous Functions *
+ *******************************************************************/
+
+/*
+ * __icbi - Instruction Cache Block Invalidate
+ *
+ * void __icbi(void *, int);
+ */
+#define __icbi(base, index) \
+ __asm__ ("icbi %0, %1" : /*no result*/ : "b%" (index), "r" (base) : "memory")
+
+/*
+ * __mffs - Move from FPSCR
+ */
+static inline double __mffs (void) __attribute__((always_inline));
+static inline double
+__mffs (void)
+{
+ double result;
+ __asm__ volatile ("mffs %0"
+ /* outputs: */ : "=f" (result));
+ return result;
+}
+
+/*
+ * __mfspr - Move from Special Purpose Register
+ *
+ * int __mfspr(int);
+ */
+#define __mfspr(spr) \
+ ({ long mfsprResult; \
+ __asm__ volatile ("mfspr %0, %1" : "=r" (mfsprResult) : "n" (spr)); \
+ /*return*/ mfsprResult; })
+
+/*
+ * __mtfsf - Move to SPSCR Fields
+ *
+ * void __mtfsf(int, int);
+ */
+#define __mtfsf(mask, newValue) \
+ __asm__ volatile ("mtfsf %0, %1" : : "n" (mask), "f" (newValue))
+
+/*
+ * __mtspr - Move to Special Purpose Register
+ *
+ * __mtspr x(int, int);
+ */
+#define __mtspr(spr, value) \
+ __asm__ volatile ("mtspr %0, %1" : : "n" (spr), "r" (value))
+
+/*
+ * __OSReadSwapSInt16
+ *
+ * lhbrx for signed shorts. This will do the required sign
+ * extension after load and byteswap.
+ */
+static inline signed short __OSReadSwapSInt16 (signed short *base, int index) __attribute__((always_inline));
+static inline signed short
+__OSReadSwapSInt16 (signed short *base, int index)
+{
+ signed long result;
+ __asm__ volatile ("lhbrx %0, %1, %2"
+ /* outputs: */ : "=r" (result)
+ /* inputs: */ : "b%" (index), "r" (base)
+ /* clobbers: */ : "memory");
+ return result;
+}
+
+/*
+ * __OSReadSwapUInt16
+ */
+static inline unsigned short __OSReadSwapUInt16 (volatile void *base, int inex) __attribute__((always_inline));
+static inline unsigned short
+__OSReadSwapUInt16 (volatile void *base, int index)
+{
+ unsigned long result;
+ __asm__ volatile ("lhbrx %0, %1, %2"
+ /* outputs: */ : "=r" (result)
+ /* inputs: */ : "b" (index), "r" (base)
+ /* clobbers: */ : "memory");
+ return result;
+}
+
+/*
+ * __astrcmp - assembly strcmp
+ */
+static inline int astrcmp (const char *in_s1, const char *in_s2) __attribute__((always_inline));
+static inline int
+astrcmp (const char *in_s1, const char *in_s2)
+{
+ int result, temp;
+ register const char *s1 = in_s1 - 1;
+ register const char *s2 = in_s2 - 1;
+
+ __asm__ ("1:lbzu %0,1(%1)\n"
+ "\tcmpwi cr1,%0,0\n"
+ "\tlbzu %3,1(%2)\n"
+ "\tsubf. %0,%3,%0\n"
+ "\tbeq- cr1,2f\n"
+ "\tbeq+ 1b\n2:"
+ /* outputs: */ : "=&r" (result), "+b" (s1), "+b" (s2), "=r" (temp)
+ /* inputs: */ :
+ /* clobbers: */ : "cr0", "cr1", "memory");
+
+ return result;
+
+ /*
+ * "=&r" (result) means: 'result' is written on (the '='), it's any GP
+ * register (the 'r'), and it must not be the same as
+ * any of the input registers (the '&').
+ * "+b" (s1) means: 's1' is read from and written to (the '+'),
+ * and it must be a base GP register (i.e., not R0.)
+ * "=r" (temp) means: 'temp' is any GP reg and it's only written to.
+ *
+ * "memory" in the 'clobbers' section means that gcc will make
+ * sure that anything that should be in memory IS there
+ * before calling this routine.
+ */
+}
+
+#endif /* defined(__ppc__) && ! defined(__MWERKS__) */
+
+#endif /* _PPC_INTRINSICS_H_ */
diff --git a/more-hdrs/stdarg.h b/more-hdrs/stdarg.h
new file mode 100644
index 00000000000..e12e16383c6
--- /dev/null
+++ b/more-hdrs/stdarg.h
@@ -0,0 +1,6 @@
+/* This file is public domain. */
+#ifdef __MWERKS__
+#include "mw_stdarg.h"
+#else
+#error "This header only supports __MWERKS__."
+#endif
diff --git a/more-hdrs/stdbool.h b/more-hdrs/stdbool.h
new file mode 100644
index 00000000000..ee1d976ce16
--- /dev/null
+++ b/more-hdrs/stdbool.h
@@ -0,0 +1,2 @@
+/* This file is public domain. */
+#error "stdbool.h has moved to avoid accidental use with a non-GCC compiler. Only GCC should have used stdbool.h due to licensing restrictions."
diff --git a/more-hdrs/stdint.h b/more-hdrs/stdint.h
new file mode 100644
index 00000000000..ce729ca94a5
--- /dev/null
+++ b/more-hdrs/stdint.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2000,2001 Apple Computer, Inc. All rights reserved.
+ *
+ * We build on <machine/types.h> rather than <sys/types.h> in order to
+ * minimize the global namespace pollution (i.e., we'd like to define
+ * *only* those identifiers that the C standard mandates should be
+ * defined by <stdint.h>). Using <machine/types.h> means that (at
+ * least as of January 2001) all of the extra macros that do get
+ * #defined by #include'ing <stdint.h> are in the implementor's
+ * namespace ("_[A-Z].*" or "__.*").
+ *
+ * The reason that we do #include the relevant ...types.h instead of
+ * creating several "competing" typedefs is to make header collisions
+ * less likely during the transition to C99.
+ *
+ * Caveat: There are still five extra typedef's defined by doing it
+ * this way: "u_int{8,16,32,64}_t" and "register_t". Might be
+ * fixable via pre- and post- #defines, but probably not worth it.
+ */
+
+#ifndef _STDINT_H_
+#define _STDINT_H_
+
+#include <machine/types.h>
+
+
+/* from ISO/IEC 988:1999 spec */
+
+/* 7.18.1.1 Exact-width integer types */
+ /* int8_t is defined in <machine/types.h> */
+ /* int16_t is defined in <machine/types.h> */
+ /* int32_t is defined in <machine/types.h> */
+ /* int64_t is defined in <machine/types.h> */
+typedef u_int8_t uint8_t; /* u_int8_t is defined in <machine/types.h> */
+typedef u_int16_t uint16_t; /* u_int16_t is defined in <machine/types.h> */
+typedef u_int32_t uint32_t; /* u_int32_t is defined in <machine/types.h> */
+typedef u_int64_t uint64_t; /* u_int64_t is defined in <machine/types.h> */
+
+
+/* 7.18.1.2 Minumun-width integer types */
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+
+/* 7.18.1.3 Fastest-width integer types */
+typedef int8_t int_fast8_t;
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint64_t uint_fast64_t;
+
+
+/* 7.18.1.4 Integer types capable of hgolding object pointers */
+ /* intptr_t is defined in <machine/types.h> */
+ /* uintptr_t is defined in <machine/types.h> */
+
+
+/* 7.18.1.5 Greatest-width integer types */
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
+
+
+/* "C++ implementations should define these macros only when
+ * __STDC_LIMIT_MACROS is defined before <stdint.h> is included."
+ * In other words, if C++, then __STDC_LIMIT_MACROS enables the
+ * macros below. (Note that there also exists a different enabling
+ * macro (__STDC_CONSTANT_MACROS) for the last few, below.)
+ */
+#if (! defined(__cplusplus)) || defined(__STDC_LIMIT_MACROS)
+
+
+/* 7.18.2 Limits of specified-width integer types:
+ * These #defines specify the minimum and maximum limits
+ * of each of the types declared above.
+ */
+
+
+/* 7.18.2.1 Limits of exact-width integer types */
+#define INT8_MAX 127
+#define INT16_MAX 32767
+#define INT32_MAX 2147483647
+#define INT64_MAX 9223372036854775807LL
+
+#define INT8_MIN -128
+#define INT16_MIN -32768
+ /*
+ Note: the literal "most negative int" cannot be written in C --
+ the rules in the standard (section 6.4.4.1 in C99) will give it
+ an unsigned type, so INT32_MIN (and the most negative member of
+ any larger signed type) must be written via a constant expression.
+ */
+#define INT32_MIN (-INT32_MAX-1)
+#define INT64_MIN (-INT64_MAX-1)
+
+#define UINT8_MAX 255
+#define UINT16_MAX 65535
+#define UINT32_MAX 4294967295U
+#define UINT64_MAX 18446744073709551615ULL
+
+/* 7.18.2.2 Limits of minimum-width integer types */
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST64_MIN INT64_MIN
+
+#define INT_LEAST8_MAX INT8_MAX
+#define INT_LEAST16_MAX INT16_MAX
+#define INT_LEAST32_MAX INT32_MAX
+#define INT_LEAST64_MAX INT64_MAX
+
+#define UINT_LEAST8_MAX UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+/* 7.18.2.3 Limits of fastest minimum-width integer types */
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST64_MIN INT64_MIN
+
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MAX INT32_MAX
+#define INT_FAST64_MAX INT64_MAX
+
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+/* 7.18.2.4 Limits of integer types capable of holding object pointers */
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+
+#define UINTPTR_MAX UINT32_MAX
+
+/* 7.18.2.5 Limits of greatest-width integer types */
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+
+#define UINTMAX_MAX UINT64_MAX
+
+/* 7.18.3 "Other" */
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+
+/* We have no sig_atomic_t yet, so no SIG_ATOMIC_{MIN,MAX}.
+ Should end up being {-127,127} or {0,255} ... or bigger.
+ My bet would be on one of {U}INT32_{MIN,MAX}. */
+
+#define SIZE_MAX UINT32_MAX
+
+#ifndef WCHAR_MIN
+# define WCHAR_MIN 0
+#endif
+
+#ifndef WCHAR_MAX
+# ifdef __WCHAR_MAX__
+# define WCHAR_MAX __WCHAR_MAX__
+# else
+# define WCHAR_MAX 0x7fffffff
+# endif
+#endif
+
+/* We have no wint_t yet, so no WINT_{MIN,MAX}.
+ Should end up being {U}INT32_{MIN,MAX}, depending. */
+
+
+#endif /* if C++, then __STDC_LIMIT_MACROS enables the above macros */
+
+/* "C++ implementations should define these macros only when
+ * __STDC_CONSTANT_MACROS is defined before <stdint.h> is included."
+ */
+#if (! defined(__cplusplus)) || defined(__STDC_CONSTANT_MACROS)
+
+/* 7.18.4 Macros for integer constants */
+#define INT8_C(v) ((int8_t)v)
+#define INT16_C(v) ((int16_t)v)
+#define INT32_C(v) (v ## L)
+#define INT64_C(v) (v ## LL)
+
+#define UINT8_C(v) ((uint8_t)v)
+#define UINT16_C(v) ((uint16_t)v)
+#define UINT32_C(v) (v ## UL)
+#define UINT64_C(v) (v ## ULL)
+
+#define INTMAX_C(v) (v ## LL)
+#define UINTMAX_C(v) (v ## ULL)
+
+#endif /* if C++, then __STDC_CONSTANT_MACROS enables the above macros */
+
+#endif /* _STDINT_H_ */
diff --git a/more-hdrs/varargs.h b/more-hdrs/varargs.h
new file mode 100644
index 00000000000..83188caef34
--- /dev/null
+++ b/more-hdrs/varargs.h
@@ -0,0 +1,6 @@
+/* This file is public domain. */
+#ifdef __MWERKS__
+#include "mw_varargs.h"
+#else
+#error "This header only supports __MWERKS__."
+#endif
diff --git a/order-files/HOW TO BUILD b/order-files/HOW TO BUILD
new file mode 100644
index 00000000000..7cca046f37a
--- /dev/null
+++ b/order-files/HOW TO BUILD
@@ -0,0 +1,170 @@
+ Creating Order files, i.e., Scatter Loading the Compiler
+ --------------------------------------------------------
+
+This is a brief description on how to generate the cc1*.order files.
+The order files are intended to minimize the number of page-ins of
+the compiler as it is loaded. If there is enough memory this
+benifits only the first load of the compiler since it will stay
+resident after that.
+
+Unfortunately it's a manual process since one of the tools requires
+an explicit interrupt from the terminal. You should only need to
+(re)do the order files if there's any major reorganizations or
+additions to the compilers.
+
+There are five steps involved to genrrate the order files.
+
+1. Select test cases.
+
+ These should be "average" compilations to exercise each of the
+ cc1* compilers. They should be large enough to take enough time
+ to generate acceptible results. As of this writing the
+ following cases were chosen:
+
+ For cc1 - gcc/c-decl.c (from the compiler sources)
+ For cc1plus - Finder_FE/AboutWindow/AboutWindow.cp
+ For cc1obj - MailViewer/Compose.subproj/MessageEditor.m
+ For cc1objplus - devkit/cpp.subproj/Cpp-precomp.mm
+
+ Of these four the cc1objplus test case is not very good.
+ Unfortunately there are few .mm files of any significant size.
+ If a better one can be found it probably should be used.
+
+2. Capture the command lines needed to build the chosen files.
+
+ For the selected projects built with with PB set PB's building
+ preferences for detailed build logs. That way you can the
+ full command lines you need. In non-PB projects like gcc the
+ command lines are of course echoed on the terminal.
+
+3. Run selected command lines with -### to get the cc1* lines.
+
+ From the full command lines you need the cc1* lines generated
+ by the driver. The easiest way to get these is to add -###
+ to the full command lines captured in step 2.
+
+4. Prepare to generate the order files
+
+ If you don't already have it you should build a set of cc1*
+ compilers with -O2 with symbols. The easiest way to do this
+ is FSF-style but using buildit with build_gcc probably will
+ also work.
+
+ In the gcc objects directory you will of course have the cc1*
+ compilers. You need to substitute these in each of the cc1*
+ command lines captured in step 3. You also need to run these
+ with ~perf/bin/pcsample to generate the order files. Thus,
+ for each cc1* command line it should have the following in
+ the beginning in place of the original cc1* of the step 3
+ lines.
+
+ sudo ~perf/bin/pcsample -O -E $gcc3-obj/cc1* ... rest of line...
+
+ Where $gcc3-obj represents whatever the path is to the gcc3
+ objects directory and cc1* is one of the cc1* compilers (is
+ -B necessary here?).
+
+ Note, you need sudo because pcsample will only run as root.
+ Also, if you have a dual processor you need to reboot as in
+ single processor mode. If you don't pcscample will tell you
+ to do that by executing the command,
+
+ nvram boot-args="cpus=1"
+
+5. Generate the order files
+
+ Run the lines created in step 4. The order files (cc1*.order)
+ will be left in /tmp in the direectory indicated by the summary
+ that pcsample displays when you hit cmd-c to stop the pcsample
+ execution. Be sure to run pcsample long enough to compile the
+ entire program.
+
+ At this point you now have the order files created. You place
+ them in the order-files directory at the top level of the gcc
+ source directory.
+
+ You can also use them to measure he effects of these order files
+ on compiler page-ins. If you do this go to the next step (6).
+ Otherwisw you are ready to go.
+
+6. Creating the compilers with ther order files
+
+ You will need two versions of the cc1* files; the ones from above
+ and a set linked with their respective order file.
+
+ From a gcc compiler build extract the command lines that link
+ the cc1* files. Change the -o file to something else, for
+ example, cc1 to cc1X. Then add the following options to the
+ link line. Note, if you build using buildit and build_gcc the
+ lines will already be there referencing the order-files
+ directory. Otherwise you need to add,
+
+ -sectorder __TEXT __text $order/cc1*.order -e start
+
+ where $order is the directory containing the order file being
+ used and cc1* is of course a reference to a specific order
+ file.
+
+ 7. Measuring the performance improvement
+
+ You need to have two terminbal windows open; T1 and T2. The
+ execute the follwoing commands on the indicated terminals:
+
+ T2: sudo fs_usage -w > /tmp/fs.out1 (do NOT execute yet)
+ T1: ~perf/bin/flushmem (note this can take a while)
+ T2: fs_usage
+ T1: use cc1* line originally used to build order file
+ T2: ctl-c when cc1* compilation done
+
+ T2: sudo fs_usage -w > /tmp/fs.out2 (do not execute yet)
+ T1: ~perf/bin/flushmem
+ T2: fs_usage
+ T1: use cc1*X line originally used to build order file
+ T2: ctl-c when cc1XXX compilation done
+
+ In the first group of commands you use the original cc1* line
+ with the command line used to build the order file. You also
+ run fs_usage at the same time to measure the paging behavior.
+
+ The second group of commands is similar but you use the cc1*
+ linked with its order file (with the -sectorder stuff mentioned
+ in step 6). For this discussion call this compiler cc1*X.
+
+ In both cases you need to run ~perf/bin/flushmem to make sure
+ compiler is flused from the cached. That way you are
+ measuring the initial page-in bechavor as thee compiler is
+ loaded. Warning, the flushmem's sometimes take quite a
+ while.
+
+ At this point you should have /tmp/fs.out1 and /tmp/fs.out2.
+ You need to extract the page-ins times for the compilers in
+ order to sum them up. The easies way to do this is make the
+ data tab delimited for importing into Excel.
+
+ T1: fgrep cc1* /tmp/fs.out1 | fgrep PAGE_IN | \
+ tr -s "[:blank:]" '\t' >/tmp/cc1*.pageins-1
+ T1: fgrep cc1*X /tmp/fs.out2 | fgrep PAGE_IN | \
+ tr -s "[:blank:]" '\t' >/tmp/cc1*.pageins-2
+
+ Load each of these into Excel and sum the pagin times to
+ determine the percent change.
+
+ Remember that the '*'s in the above illustrations are not really
+ a '*'. It is just a short way to show the general command lines
+ where in reality you explicitly specify cc1, cc1plus, cc1obj, or
+ cc1objplus.
+
+ Also remember that you are measuring the page-in performance
+ improvement on the test cases used to generate the order files
+ in the first place. Thus you should expect that these would
+ probably show the greatest improvement. That is why it is
+ important to try to choose representative test cases in the
+ first place. You can try the measurements on other tests.
+ But that requires you again extracting the cc1* lines using
+ -###. The above procedure only uses the orignal files since
+ the command lines are already handy.
+
+
+
+
+
diff --git a/order-files/cc1.order b/order-files/cc1.order
new file mode 100644
index 00000000000..a3bd7b04a39
--- /dev/null
+++ b/order-files/cc1.order
@@ -0,0 +1,1188 @@
+start
+__start
+__dyld_init_check
+dyld_stub_binding_helper
+___darwin_gcc3_preregister_frame_info
+__call_mod_init_funcs
+__dyld_func_lookup
+_main
+_toplev_main
+_hex_init
+_general_init
+_xmalloc_set_program_name
+_diagnostic_initialize
+__obstack_begin
+_xmalloc
+_parse_options_and_default_flags
+_init_reg_sets
+_add_params
+_xrealloc
+_pfe_init
+_override_O_option
+_extract_override_options
+_lang_init_options
+_c_common_init_options
+_cpp_create_reader
+_init_library
+_init_trigraph_map
+_xcalloc
+_set_lang
+_deps_init
+_init_line_maps
+__cpp_init_tokenrun
+__cpp_get_buff
+_new_buff
+_pfe_s_malloc
+_pfe_malloc
+_gcc_obstack_init
+_pfe_obstack_chuck_alloc
+__cpp_init_includes
+_splay_tree_new
+_splay_tree_new_with_allocator
+_splay_tree_xmalloc_allocate
+_set_index_lang
+_set_target_switch
+_optimization_options
+_override_option
+_c_decode_option
+_cpp_handle_option
+_parse_option
+_independent_decode_option
+_xstrdup
+_append_include_chain
+__cpp_simplify_pathname
+_remove_component_p
+_new_pending_directive
+_dump_switch_p
+_decode_f_option
+_decode_g_option
+_set_Wunused
+_set_Wformat
+_decode_W_option
+_add_env_options
+_c_common_post_options
+_cpp_post_options
+_init_dependency_output
+_do_compile
+_process_options
+_rs6000_override_options
+_rs6000_parse_abi_options
+_rs6000_add_gc_roots
+_ggc_add_rtx_root
+_ggc_add_root
+_htab_create
+_higher_prime_number
+_machopic_add_gc_roots
+_ggc_add_tree_root
+_new_alias_set
+_floor_log2_wide
+_init_timevar
+_timevar_start
+_lang_independent_init
+_init_ggc
+_exact_log2_wide
+_pfe_s_calloc
+_pfe_calloc
+_init_stringpool
+_ht_create
+_init_obstacks
+_ggc_add_deletable_htab
+_init_emit_once
+_mode_for_size
+_gen_rtx
+_rtx_alloc
+_ggc_alloc
+_alloc_page
+_pfe_free
+_set_page_table_entry
+_gen_raw_REG
+_gen_rtx_fmt_i0
+_gen_rtx_fmt_w
+_ereal_atof
+_asctoe53
+_asctoeg
+_ecleaz
+_enormlz
+_eshup6
+_toe53
+_eiisnan
+_eshift
+_eshup1
+_e53toe
+_eshdn1
+_ecleazs
+_emovo
+_emovz
+_eaddm
+_eshup8
+_emdnorm
+_gen_rtx_CONST_INT
+_gen_const_vector_0
+_rtvec_alloc
+_gen_rtx_fmt_E0
+_gen_rtx_REG
+_init_regs
+_init_reg_sets_1
+_reg_class_subset_p
+_init_reg_modes
+_choose_hard_reg_mode
+_init_alias_once
+_init_stmt
+_init_loop
+_address_cost
+_memory_address_p
+_rs6000_legitimate_address
+_init_reload
+_gen_rtx_fmt_ee
+_gen_rtx_MEM
+_gen_rtx_fmt_e0
+_gen_rtx_fmt_s
+_pfe_savestring
+_plus_constant_wide
+_find_constant_term_loc
+_bitmap_initialize
+_init_function_once
+_varray_init
+_init_stor_layout_once
+_init_varasm_once
+_init_EXPR_INSN_LIST_cache
+_init_dummy_function_start
+_prepare_function_start
+_ggc_alloc_cleared
+_init_stmt_for_function
+_init_eh_for_function
+_init_emit
+_clear_emit_caches
+_init_virtual_regs
+_init_expr
+_init_varasm_status
+_init_temp_slots
+_init_pending_stack_adjust
+_rs6000_init_machine_status
+_init_expmed
+_start_sequence
+_rtx_cost
+_emit_insn
+_make_insn_raw
+_add_insn
+_init_recog
+_recog
+_recog_13
+_gpc_reg_operand
+_register_operand
+_recog_4
+_reg_or_cint_operand
+_recog_5
+_nonimmediate_operand
+_general_operand
+_input_operand
+_memory_operand
+_toc_relative_expr_p
+_constant_pool_expr_1
+_reg_or_short_operand
+_short_cint_operand
+_htab_find_slot_with_hash
+_const_int_htab_eq
+_init_expr_once
+_boolean_or_operator
+_boolean_operator
+_recog_1
+_reg_or_mem_operand
+_recog_7
+_recog_10
+_recog_9
+_altivec_register_operand
+_zero_constant
+_extract_insn
+_init_caller_save
+_constrain_operands
+_reg_fits_class_p
+_insn_extract
+_recog_memoized_1
+_cc_reg_operand
+_recog_6
+_record_builtin_type
+_build_decl
+_make_node
+_tree_size
+_pushdecl
+_lookup_name_current_level
+_c_common_nodes_and_builtins
+_get_identifier
+_ht_lookup
+_calc_hash
+_alloc_node
+_make_signed_type
+_default_set_default_type_attributes
+_fixup_signed_type
+_build_int_2_wide
+_layout_type
+_tree_int_cst_sgn
+_smallest_mode_for_size
+_size_int_wide
+_size_int_type_wide
+_force_fit_type
+_htab_find_slot
+_size_htab_hash
+_size_htab_eq
+_finalize_type_size
+_get_mode_alignment
+_round_type_align
+_round_up
+_size_binop
+_int_const_binop
+_integer_onep
+_tree_cons
+_make_unsigned_type
+_fixup_unsigned_type
+_identifier_global_value
+_signed_type
+_set_sizetype
+_copy_node
+_build_common_tree_nodes_2
+_build_pointer_type
+_build_qualified_type
+_get_qualified_type
+_build_type_copy
+_set_type_quals
+_mul_double
+_encode
+_decode
+_rs6000_build_va_list
+_make_vector
+_finish_vector_type
+_build_index_type
+_convert
+_convert_to_integer
+_build1
+_first_rtl_op
+_fold
+_fold_convert
+_compare_tree_int
+_host_integerp
+_tree_low_cst
+_type_hash_canon
+_type_hash_lookup
+_htab_find_with_hash
+_type_hash_add
+_build_array_type
+_build
+_integer_zerop
+_non_lvalue
+_add_double
+_simple_cst_equal
+_mode_for_size_tree
+_start_record_layout
+_place_field
+_layout_decl
+_default_ms_bitfield_layout_p
+_normalize_rli
+_normalize_offset
+_finish_record_layout
+_finalize_record_size
+_get_inner_array_type
+_rli_size_so_far
+_bit_from_pos
+_rli_size_unit_so_far
+_byte_from_pos
+_compute_record_mode
+_type_hash_eq
+_attribute_list_equal
+_attribute_list_contained
+_bit_position
+_int_bit_position
+_builtin_function
+_make_decl_rtl
+_decode_reg_name
+_darwin_encode_section_info
+_ggc_alloc_string
+_update_stubs
+_decl_attributes
+_default_insert_attributes
+_insert_default_attributes
+_c_common_insert_default_attributes
+_builtin_function_2
+_builtin_function_disabled_p
+_set_decl_assembler_name
+_is_attribute_p
+_c_init_decl_processing
+_build_function_type
+_type_hash_list
+_type_list_equal
+_start_fname_decls
+_set_dump_tree_p
+_c_objc_common_init
+_c_common_init
+_init_c_lex
+_get_fileinfo
+_splay_tree_lookup
+_splay_tree_splay
+_splay_tree_insert
+_cpp_get_callbacks
+_cpp_read_main_file
+__cpp_init_hashtable
+__cpp_init_directives
+_cpp_lookup
+__obstack_newchunk
+__cpp_init_internal_pragmas
+_cpp_register_pragma
+_lookup_pragma_entry
+_insert_pragma_entry
+__cpp_aligned_alloc
+_init_standard_includes
+_update_path
+_concat
+_translate_name
+_get_key_value
+_merge_include_chains
+_remove_dup_dirs
+_remove_dup_dir
+__cpp_read_file
+_open_file
+_find_or_create_entry
+_splay_tree_foreach
+_splay_tree_foreach_helper
+_inode_finder
+_stack_include_file
+_read_include_file
+_cpp_push_buffer
+__cpp_do_file_change
+_add_line_map
+_cb_file_change
+_update_header_times
+_extract_interface_info
+_init_pragma
+_add_c_tree_codes
+_ggc_add_tree_varray_root
+_lang_dependent_init
+_init_asm_output
+_init_eh
+_init_optabs
+_new_optab
+_init_all_optabs
+_init_integral_libfuncs
+_init_libfuncs
+_init_floating_libfuncs
+_init_one_libfunc
+_init_traps
+_push_srcloc
+_timevar_push
+_dwarf2out_do_frame
+_dbxout_init
+_getdecls
+_getpwd
+_output_quoted_string
+_assemble_name
+_maybe_get_identifier
+_text_section
+_dbxout_typedefs
+_dbxout_symbol
+_timevar_pop
+_compile_file
+_init_final
+_init_branch_prob
+_yyparse
+_dbxout_start_source_file
+_cpp_finish_options
+_init_builtins
+__cpp_define_builtin
+_run_directive
+_start_directive
+_do_define
+_lex_macro_node
+__cpp_lex_token
+__cpp_lex_direct
+_parse_identifier
+__cpp_create_definition
+_skip_whitespace
+_parse_string
+_unescaped_terminator_p
+_alloc_expansion_token
+_lex_expansion_token
+_handle_newline
+_pfe_is_cmd_ln_processing
+_end_directive
+_skip_rest_of_line
+__cpp_pop_buffer
+_parse_number
+_pfe_set_cmd_ln_processing
+_cpp_define
+_warn_of_redefinition
+__cpp_equiv_tokens
+__cpp_free_definition
+_pfe_reset_cmd_ln_processing
+_free_chain
+__cpp_push_next_buffer
+_yyparse_1
+_yylex
+__yylex
+_c_lex
+_cpp_get_token
+_get_effective_char
+_skip_block_comment
+_skip_escaped_newlines
+_trigraph_p
+__cpp_handle_directive
+_directive_diagnostics
+_do_include
+_do_include_common
+_parse_include
+_check_eol
+__cpp_execute_include
+_find_include_file
+_search_from
+_lbasename
+_splay_tree_splay_helper
+_adjust_column
+__cpp_extend_buff
+_parse_params
+_save_parameter
+_cb_line_change
+_yylexname
+_altivec_treat_as_keyword
+_ggc_collect
+_lookup_name
+_start_enum
+_lookup_tag
+_pushtag
+_build_enumerator
+_int_fits_type_p
+_build_binary_op
+_common_type
+_tree_int_cst_lt
+_type_for_size
+_const_binop
+_chainon
+_nreverse
+_finish_enum
+_in_parm_level_p
+_min_precision
+_tree_floor_log2
+_rest_of_type_compilation
+_shadow_tag
+_shadow_tag_warned
+_split_specs_attrs
+_lookup_tag_reverse
+_check_trad_stringification
+_xref_tag
+_pending_xref_error
+_build_tree_list
+_grokdeclarator
+_c_apply_type_quals_to_decl
+_grokfield
+_finish_decl
+_maybe_apply_renaming_pragma
+_get_pending_sizes
+_finish_struct
+_start_decl
+_maybe_apply_pragma_weak
+_rest_of_decl_compilation
+_start_struct
+_do_ifdef
+_push_conditional
+_do_else
+_do_endif
+_constant_expression_warning
+__cpp_pop_file_buffer
+_pop_srcloc
+_dbxout_end_source_file
+_make_pointer_declarator
+_pushlevel
+_make_binding_level
+_clear_parm_order
+_declare_parm_level
+_push_parm_decl
+_simple_type_promotes_to
+_c_promoting_integer_type_p
+_get_parm_info
+_gettags
+_storedecls
+_parmlist_tags_warning
+_poplevel
+_warn_about_unused_variables
+_build_nt
+_grokparms
+_unsigned_type
+_lex_number
+_build_compound_expr
+_internal_build_compound_expr
+_build_array_declarator
+_set_array_declarator_type
+_signed_or_unsigned_type
+_operand_equal_p
+_tree_int_cst_equal
+_neg_double
+_do_undef
+_warn_if_shadowing
+_build_decl_attribute_variant
+_gen_aux_info_record
+_collect_args
+_enter_macro_context
+_replace_args
+_expand_arg
+_push_ptoken_context
+_next_context
+__cpp_pop_context
+__cpp_release_buff
+_padding_token
+__cpp_temp_token
+_c_build_qualified_type
+_push_token_context
+_list_length
+_handle_noreturn_attribute
+_lookup_attribute
+_purge_cache
+_do_ifndef
+_do_if
+__cpp_parse_expr
+_lex
+_parse_number
+___udivdi3
+___udivmoddi4
+_funlike_invocation_p
+_parse_defined
+_cpp_warning
+__cpp_begin_message
+_do_elif
+_groktypename
+_c_sizeof
+_parser_build_binary_op
+_default_conversion
+_merge_type_attributes
+_merge_attributes
+_build_type_attribute_variant
+_extract_muldiv
+_unsigned_conversion_warning
+_overflow_warning
+_get_narrower
+_attribute_hash_list
+_duplicate_decls
+_comptypes
+_default_comp_type_attributes
+_function_types_compatible_p
+_self_promoting_args_p
+_merge_decl_attributes
+_handle_format_attribute
+_decode_format_attr
+_decode_format_type
+_start_function
+_announce_function
+_store_parm_decls
+_decl_function_context
+_storetags
+_init_function_start
+_decl_name
+_emit_line_note
+_set_file_and_line_for_stmt
+_emit_note
+_aggregate_value_p
+_hard_function_value
+_begin_stmt_tree
+_current_stmt_tree
+_c_begin_compound_stmt
+_build_stmt
+_add_stmt
+_stmts_are_full_exprs_p
+_clear_last_expr
+_add_scope_stmt
+_current_scope_stmt_stack
+_c_begin_if_stmt
+_build_external_ref
+_lookup_objc_ivar
+_assemble_external
+_build_indirect_ref
+_build_component_ref
+_lookup_field
+_build_unary_op
+_unary_complex_lvalue
+_get_unwidened
+_lvalue_or_else
+_lvalue_p
+_shorten_compare
+_twoval_comparison_p
+_invert_tree_comparison
+_truthvalue_conversion
+_build_c_cast
+_default_function_array_conversion
+_lex_charconst
+_cpp_interpret_charconst
+_cpp_parse_escape
+_truth_value_p
+_fold_range_test
+_make_range
+_fold_truthop
+_c_expand_start_cond
+_c_size_in_bytes
+_convert_to_pointer
+_build_modify_expr
+_require_complete_type
+_convert_for_assignment
+_convert_and_check
+_c_expand_return
+_build_return_stmt
+_c_finish_then
+_c_expand_start_else
+_build_function_call
+_decl_target_overloaded_intrinsic_p
+_convert_arguments
+_check_function_format
+_c_finish_else
+_c_expand_end_cond
+_kept_level_p
+_finish_function
+_clear_limbo_values
+_finish_fname_decls
+_finish_stmt_tree
+_free_after_parsing
+_free_stmt_status
+_free_after_compilation
+_free_eh_status
+_free_expr_status
+_free_emit_status
+_free_varasm_status
+_rs6000_free_machine_status
+_c_expand_body
+_tree_inlinable_function_p
+_inlinable_function_p
+_c_disregard_inline_limits
+_c_cannot_inline_tree_fn
+_function_attribute_inlinable_p
+_put_pending_sizes
+_walk_tree
+_inline_forbidden_p
+_statement_code_p
+_lhd_tree_inlining_walk_subtrees
+_get_callee_fndecl
+_setjmp_call_p
+_special_function_p
+_defer_fn
+_debug_nothing_tree
+_integer_all_onesp
+_distribute_bit_expr
+_place_union_field
+_cpp_pedwarn
+_do_include_next
+___divdi3
+___udivmoddi4
+_handle_malloc_attribute
+_type_lists_compatible_p
+_redeclaration_error_message
+_pedwarn
+_set_diagnostic_context
+_report_diagnostic
+_count_error
+_build_range_type
+_complete_array_type
+_start_init
+_push_string
+_really_start_incremental_init
+_process_init_element
+_push_member_name
+_output_init_element
+_initializer_constant_valid_p
+_lhd_return_tree
+_digest_init
+_output_pending_init_elements
+_pop_init_level
+_finish_init
+_store_init_value
+_assemble_variable
+_set_mem_attributes
+_get_alias_set
+_maybe_set_unchanging
+_can_address_p
+_handled_component_p
+_get_mem_attrs
+_mem_attrs_htab_hash
+_update_non_lazy_ptrs
+_app_disable
+_set_mem_align
+_mem_attrs_htab_eq
+_output_addressed_constants
+_resolve_unique_section
+_variable_section
+_darwin_set_section_for_var_p
+_data_section
+_try_section_alias
+_in_text_section
+_machopic_define_name
+_machopic_define_ident
+_machopic_ident_defined_p
+_machopic_classify_ident
+_name_needs_quotes
+_output_constant
+_int_size_in_bytes
+_output_constructor
+_int_byte_position
+_byte_position
+_expand_expr
+_get_subtarget
+_immed_double_const
+_assemble_integer
+_rs6000_assemble_integer
+_find_weak_imports
+_default_assemble_integer
+_integer_asm_op
+_assemble_integer_with_op
+_output_addr_const
+_global_bindings_p
+_handle_unused_attribute
+_add_decl_stmt
+_build_array_ref
+_pointer_int_sum
+_size_in_bytes
+_omit_one_operand
+_decl_constant_value_for_broken_optimization
+_comp_target_types
+_c_expand_expr_stmt
+_verify_sequence_points
+_verify_tree
+_warning_candidate_p
+_split_tree
+_lex_string
+_build_string
+_combine_strings
+_choose_string_type
+_mark_addressable
+_staticp
+_expand_tree_builtin
+_fold_builtin
+_invert_truthvalue
+_define_label
+_lookup_label
+_new_tlist
+_add_tlist
+_warn_for_collisions
+_warn_for_collisions_1
+_merge_tlist
+_decode_field_reference
+_get_inner_reference
+_hash_pointer
+_htab_find
+_eq_pointer
+_expand_call_inline
+_lhd_tree_inlining_tree_chain_matters_p
+_htab_expand
+_find_empty_slot_for_expand
+_expand_call
+_precompute_register_parameters
+_push_temp_slots
+_preserve_temp_slots
+_find_temp_slot_from_address
+_pop_temp_slots
+_combine_temp_slots
+_emit_queue
+_protect_from_queue
+_mark_temp_addr_taken
+_force_operand
+_save_fixed_argument_area
+_prepare_call_address
+_lookup_static_chain
+_load_register_parameters
+_emit_move_insn
+_emit_move_insn_1
+_gen_movsi
+_rs6000_emit_move
+_gen_sequence
+_end_sequence
+_use_reg
+_gen_rtx_fmt_e
+_easy_fp_constant
+_rs6000_machopic_legitimize_pic_address
+_machopic_legitimize_pic_address
+_machopic_indirect_data_reference
+_machopic_data_defined_p
+_machopic_function_base_name
+_gen_rtx_fmt_E
+_trunc_int_for_mode
+_num_insns_constant
+_num_insns_constant_wide
+_get_last_insn
+_function_arg
+_emit_call_1
+_gen_call_value
+_machopic_indirect_call_target
+_machopic_name_defined_p
+_machopic_stub_list_entry
+_gen_rtx_fmt_0
+_gen_rtvec
+_gen_rtvec_v
+_emit_call_insn
+_make_call_insn_raw
+_any_pending_cleanups
+_get_insns
+_gen_rtx_fmt_uuuu
+_expand_builtin
+_do_jump
+_do_pending_stack_adjust
+_can_compare_p
+_do_compare_rtx_and_jump
+_reverse_condition
+_swap_commutative_operands_p
+_commutative_operand_precedence
+_force_not_mem
+_emit_cmp_and_jump_insns
+_prepare_cmp_insn
+_preserve_subexpressions_p
+_emit_cmp_and_jump_insn_1
+_prepare_operand
+_gen_cmpsi
+_gen_beq
+_rs6000_emit_cbranch
+_rs6000_generate_compare
+_gen_reg_rtx
+_validate_condition_mode
+_gen_rtx_fmt_u00
+_gen_rtx_fmt_eee
+_emit_jump_insn
+_make_jump_insn_raw
+_start_cleanup_deferral
+_expand_builtin_strcmp
+_validate_arglist
+_c_getstr
+_string_constant
+_c_strlen
+_build_function_call_expr
+_expand_builtin_memcmp
+_flags_from_decl_or_type
+_init_cumulative_args
+_tree_last
+_rearrange_arg_list
+_initialize_argument_information
+_function_arg_pass_by_reference
+_promote_mode
+_no_reg_parm_stack_space
+_function_arg_partial_nregs
+_function_arg_skip
+_function_arg_boundary
+_locate_and_pad_parm
+_function_arg_padding
+_function_arg_mod_boundary
+_pad_to_arg_alignment
+_function_arg_advance
+_finalize_must_preallocate
+_function_ok_for_sibcall
+_unsafe_for_reeval
+_c_unsafe_for_reeval
+_expand_start_target_temps
+_expand_start_bindings_and_block
+_compute_argument_block_size
+_sbitmap_alloc
+_sbitmap_zero
+_compute_argument_addresses
+_rtx_for_function_call
+_output_constant_def
+_const_hash
+_record_constant
+_record_constant_1
+_set_mem_alias_set
+_copy_constant
+_gen_sibcall_value
+_gen_rtx_fmt_
+_emit_barrier_after
+_add_insn_after
+_copy_to_reg
+_expand_end_target_temps
+_expand_end_bindings
+_precompute_arguments
+_calls_function
+_calls_function_1
+_end_cleanup_deferral
+_gen_bne
+_emit_jump
+_gen_jump
+_emit_barrier
+_emit_label
+_genrtl_if_stmt
+_expand_stmt
+_prep_stmt
+_genrtl_compound_stmt
+_genrtl_scope_stmt
+_genrtl_expr_stmt_value
+_expand_expr_stmt_value
+_warn_if_unused_value
+_expand_assignment
+_copy_rtx
+_replace_equiv_address
+_update_temp_slot_address
+_rtx_equal_p
+_change_address_1
+_memory_address
+_force_reg
+_machopic_non_lazy_ptr_list_entry
+_set_unique_reg_note
+_find_reg_note
+_mark_reg_pointer
+_store_expr
+_queued_subexp_p
+_free_temp_slots
+_pfe_s_realloc
+_pfe_realloc
+_expand_start_else
+_gen_label_rtx
+_gen_rtx_fmt_iuu00iss
+_genrtl_do_pushlevel
+_expand_cond
+_expand_start_cond
+_gen_sibcall
+_gen_call
+_expand_end_cond
+_compare_constant
+_compare_constant_1
+_safe_from_p
+_expand_binop
+_convert_modes
+_reg_or_arith_cint_operand
+_gen_addsi3
+_add_operand
+_do_compare_and_jump
+_gen_movqi
+_convert_move
+_can_extend_p
+_emit_unop_insn
+_gen_extendqisi2
+_gen_extendqisi2_ppc
+_simplify_binary_operation
+_avoid_constant_pool_reference
+_break_out_memory_refs
+_genrtl_goto_stmt
+_label_rtx
+_expand_goto
+_expand_goto_internal
+_const_str_htab_eq
+_expand_fixup
+_expand_value_return
+_expand_return
+_genrtl_return_stmt
+_obstack_free
+_assign_temp
+_expand_null_return_1
+_clear_pending_stack_adjust
+_expand_function_end
+_finish_expr_for_function
+_in_sequence_p
+_emit_line_note_force
+_expand_eh_return
+_clobber_return_register
+_diddle_return_value
+_do_clobber_return_reg
+_emit_insn_after
+_use_return_register
+_do_use_return_reg
+_expand_fixups
+_fixup_gotos
+_rest_of_compilation
+_reorder_blocks
+_reorder_blocks_0
+_reorder_blocks_1
+_blocks_nreverse
+_purge_hard_subreg_sets
+_open_dump_file
+_optimize_sibling_and_tail_recursive_calls
+_find_exception_handler_labels
+_rebuild_jump_labels
+_init_label_info
+_mark_all_labels
+_mark_jump_label
+_find_unreachable_blocks
+_delete_unreachable_blocks
+_flow_delete_block_noexpunge
+_never_reached_warning
+_next_nonnote_insn
+_delete_insn_chain
+_can_delete_note_p
+_delete_insn
+_remove_insn
+_remove_edge
+_free_edge
+_expunge_block_nocompact
+_tidy_fallthru_edges
+_tidy_fallthru_edge
+_next_real_insn
+_forwarder_block_p
+_update_forwarder_flag
+_try_optimize_cfg
+_active_insn_p
+_simplejump_p
+_hook_void_bool_false
+_try_forward_edges
+_redirect_edge_and_branch
+_try_redirect_by_replacing_jump
+_redirect_edge_succ_nodup
+_redirect_edge_succ
+_flow_delete_block
+_expunge_block
+_onlyjump_p
+_side_effects_p
+_can_fallthru
+_next_active_insn
+_block_label
+_redirect_jump
+_redirect_exp
+_redirect_exp_1
+_validate_change
+_num_validated_changes
+_apply_change_group
+_insn_invalid_p
+_prev_nonnote_insn
+_computed_jump_p
+_computed_jump_p_1
+_returnjump_p
+_for_each_rtx
+_returnjump_p_1
+_branch_comparison_operator
+_merge_blocks
+_tail_recursion_label_p
+_merge_blocks_nomove
+_can_delete_label_p
+_in_expr_list_p
+_remove_node_from_expr_list
+_set_block_for_insn
+_label_is_jump_target_p
+_uses_addressof
+_sequence_uses_addressof
+_free_basic_block_vars
+_clear_edges
+_close_dump_file
+_htab_empty
+_doing_eh
+_emit_initial_value_sets
+_unshare_all_rtl
+_copy_rtx_if_shared
+_unshare_all_decls
+_unshare_all_rtl_1
+_max_reg_num
+_find_basic_blocks
+_count_basic_blocks
+_inside_basic_block_p
+_control_flow_insn_p
+_can_throw_internal
+_compute_bb_for_insn
+_make_edges
+_cached_make_edge
+_make_label_edge
+_try_simplify_condjump
+_any_uncondjump_p
+_pc_set
+_any_condjump_p
+_invert_jump
+_invert_exp
+_invert_exp_1
+_reversed_comparison_code
+_reversed_comparison_code_parts
+_invert_br_probabilities
+_update_br_prob_note
+_find_basic_blocks_1
+_create_basic_block_structure
+_reorder_insns
+_reorder_insns_nobb
+_thread_jump
+_comparison_dominates_p
+_find_if_header
+_find_if_block
+_find_cond_trap
+_block_has_only_trap
+_if_convert
+_process_if_block
+_noce_process_if_block
+_noce_get_condition
+_get_condition
+_canonicalize_condition
+_set_of
+_note_stores
+_set_of_1
+_first_active_insn
+_last_active_insn_p
+_clear_aux_for_blocks
+_free_bb_for_insn
+_delete_null_pointer_checks
+_get_bitmap_width
+_sbitmap_vector_alloc
+_reg_scan_mark_refs
+_reg_scan
+_cse_main
+_init_alias_analysis
+_record_set
+_find_base_value
+_rtx_varies_p
+_single_set_2
+_reg_overlap_mentioned_p
+_ggc_push_context
+_cse_end_of_basic_block
+_cse_basic_block
+_new_basic_block
+_cse_process_notes
+_cse_insn
+_canon_reg
+_fold_rtx
+_canon_hash
+_get_cse_reg_info
+_lookup
+_approx_reg_cost
+_approx_reg_cost_1
+_bitmap_set_bit
+_bitmap_element_allocate
+_bitmap_element_link
+_bitmap_clear
+_preferrable
+_insert_regs
+_make_new_qty
+_rehash_using_reg
+_insert
+_invalidate_from_clobbers
+_invalidate
+_delete_reg_equiv
+_lookup_for_remove
+_make_regs_eqv
+_check_for_label_ref
+_find_best_addr
+_notreg_cost
+_mention_regs
+_lookup_as_function
+_safe_hash
+_equiv_constant
+_asm_noperands
+_cancel_changes
+_exp_equiv_p
+_recog_33
+_mov_to_vrsave_operation
+_load_multiple_operation
+_store_multiple_operation
+_recog_25
+_current_file_function_operand
+_call_operand
+_immediate_operand
+_scratch_operand
+_remove_from_table
+_invalidate_memory
+_invalidate_for_call
+_remove_invalid_refs
+_refers_to_regno_p
+_gen_lowpart_if_possible
+_gen_lowpart_common
+_subreg_lowpart_offset
+_recog_3
+_invalidate_skipped_block
+_invalidate_skipped_set
+_canon_rtx
+_replace_equiv_address_nv
+_check_dependence
+_true_dependence
+_mems_in_disjoint_alias_sets_p
+_alias_sets_conflict_p
+_nonoverlapping_memrefs_p
+_simplify_relational_operation
+_simplify_ternary_operation
+_record_jump_equiv
+_find_comparison_args
+_record_jump_cond
+_get_addr
+_find_base_term
+_base_alias_check
+_memrefs_conflict_p
+_addr_side_effect_eval
+_rtx_equal_for_memref_p
+_aliases_everything_p
+_fixed_scalar_and_varying_struct_p
+_merge_equiv_classes
+_reg_mentioned_p
diff --git a/order-files/cc1obj.order b/order-files/cc1obj.order
new file mode 100644
index 00000000000..730010f4851
--- /dev/null
+++ b/order-files/cc1obj.order
@@ -0,0 +1,2163 @@
+start
+__start
+__dyld_init_check
+dyld_stub_binding_helper
+___darwin_gcc3_preregister_frame_info
+__call_mod_init_funcs
+__dyld_func_lookup
+_main
+_toplev_main
+_hex_init
+_general_init
+_xmalloc_set_program_name
+_diagnostic_initialize
+__obstack_begin
+_xmalloc
+_parse_options_and_default_flags
+_init_reg_sets
+_add_params
+_xrealloc
+_pfe_init
+_read_integral_parameter
+_override_O_option
+_extract_override_options
+_objc_init_options
+_c_common_init_options
+_cpp_create_reader
+_init_library
+_init_trigraph_map
+_xcalloc
+_set_lang
+_deps_init
+_init_line_maps
+__cpp_init_tokenrun
+__cpp_get_buff
+_new_buff
+_pfe_s_malloc
+_pfe_malloc
+_gcc_obstack_init
+_pfe_obstack_chuck_alloc
+__cpp_init_includes
+_splay_tree_new
+_splay_tree_new_with_allocator
+_splay_tree_xmalloc_allocate
+_set_index_lang
+_set_target_switch
+_optimization_options
+_override_option
+_objc_decode_option
+_c_decode_option
+_cpp_handle_option
+_parse_option
+_independent_decode_option
+_new_pending_directive
+_xstrdup
+_append_include_chain
+__cpp_simplify_pathname
+_hmap_load_header_map
+_dump_switch_p
+_decode_f_option
+_decode_g_option
+_set_Wunused
+_set_Wformat
+_decode_W_option
+_output_set_maximum_length
+_set_real_maximum_length
+_output_is_line_wrapping
+_add_env_options
+_objc_post_options
+_c_common_post_options
+_cpp_post_options
+_init_dependency_output
+_do_compile
+_process_options
+_rs6000_override_options
+_rs6000_parse_abi_options
+_rs6000_add_gc_roots
+_ggc_add_rtx_root
+_ggc_add_root
+_htab_create
+_higher_prime_number
+_machopic_add_gc_roots
+_ggc_add_tree_root
+_new_alias_set
+_floor_log2_wide
+_init_timevar
+_timevar_start
+_lang_independent_init
+_init_ggc
+_exact_log2_wide
+_pfe_s_calloc
+_pfe_calloc
+_init_stringpool
+_ht_create
+_init_obstacks
+_ggc_add_deletable_htab
+_init_emit_once
+_mode_for_size
+_gen_rtx
+_rtx_alloc
+_ggc_alloc
+_alloc_page
+_pfe_free
+_set_page_table_entry
+_gen_raw_REG
+_gen_rtx_fmt_i0
+_gen_rtx_fmt_w
+_ereal_atof
+_asctoe53
+_asctoeg
+_ecleaz
+_enormlz
+_eshup6
+_toe53
+_eiisnan
+_eshift
+_eshup1
+_e53toe
+_eshdn1
+_ecleazs
+_emovo
+_emovz
+_eaddm
+_eshup8
+_emdnorm
+_gen_rtx_CONST_INT
+_gen_const_vector_0
+_rtvec_alloc
+_gen_rtx_fmt_E0
+_gen_rtx_REG
+_init_regs
+_init_reg_sets_1
+_reg_class_subset_p
+_init_reg_modes
+_choose_hard_reg_mode
+_init_alias_once
+_init_stmt
+_init_loop
+_address_cost
+_memory_address_p
+_rs6000_legitimate_address
+_init_reload
+_gen_rtx_fmt_ee
+_gen_rtx_MEM
+_gen_rtx_fmt_e0
+_gen_rtx_fmt_s
+_pfe_savestring
+_plus_constant_wide
+_find_constant_term_loc
+_bitmap_initialize
+_init_function_once
+_varray_init
+_init_stor_layout_once
+_init_varasm_once
+_init_EXPR_INSN_LIST_cache
+_init_dummy_function_start
+_prepare_function_start
+_ggc_alloc_cleared
+_init_stmt_for_function
+_init_eh_for_function
+_init_emit
+_clear_emit_caches
+_init_virtual_regs
+_init_expr
+_init_varasm_status
+_init_temp_slots
+_init_pending_stack_adjust
+_rs6000_init_machine_status
+_init_expmed
+_start_sequence
+_rtx_cost
+_emit_insn
+_make_insn_raw
+_add_insn
+_init_recog
+_recog
+_recog_13
+_gpc_reg_operand
+_register_operand
+_recog_4
+_reg_or_cint_operand
+_recog_5
+_nonimmediate_operand
+_general_operand
+_input_operand
+_memory_operand
+_toc_relative_expr_p
+_constant_pool_expr_1
+_reg_or_short_operand
+_short_cint_operand
+_htab_find_slot_with_hash
+_const_int_htab_eq
+_init_expr_once
+_recog_6
+_recog_10
+_recog_9
+_altivec_register_operand
+_zero_constant
+_cc_reg_operand
+_end_sequence
+_init_caller_save
+_strict_memory_address_p
+_recog_memoized_1
+_extract_insn
+_insn_extract
+_constrain_operands
+_reg_fits_class_p
+_boolean_or_operator
+_boolean_operator
+_recog_1
+_reg_or_mem_operand
+_recog_7
+_make_node
+_build_decl
+_builtin_function
+_get_identifier
+_ht_lookup
+_calc_hash
+_alloc_node
+_tree_size
+_make_decl_rtl
+_decode_reg_name
+_darwin_encode_section_info
+_ggc_alloc_string
+_update_stubs
+_pushdecl
+_lookup_name_current_level
+_decl_attributes
+_default_insert_attributes
+_insert_default_attributes
+_c_common_insert_default_attributes
+_builtin_function_2
+_builtin_function_disabled_p
+_set_decl_assembler_name
+_c_common_nodes_and_builtins
+_is_attribute_p
+_list_length
+_handle_format_attribute
+_decode_format_attr
+_decode_format_type
+_chainon
+_lookup_attribute
+_tree_cons
+_build_type_attribute_variant
+_attribute_list_equal
+_attribute_list_contained
+_copy_node
+_set_type_quals
+_attribute_hash_list
+_type_hash_canon
+_type_hash_lookup
+_layout_type
+_htab_find_with_hash
+_type_hash_add
+_build_qualified_type
+_get_qualified_type
+_c_init_decl_processing
+_make_unsigned_type
+_default_set_default_type_attributes
+_fixup_unsigned_type
+_build_int_2_wide
+_tree_int_cst_sgn
+_smallest_mode_for_size
+_size_int_wide
+_size_int_type_wide
+_force_fit_type
+_htab_find_slot
+_size_htab_hash
+_size_htab_eq
+_finalize_type_size
+_get_mode_alignment
+_round_type_align
+_round_up
+_size_binop
+_int_const_binop
+_integer_onep
+_build_function_type
+_type_hash_list
+_type_hash_eq
+_type_list_equal
+__obstack_newchunk
+_start_fname_decls
+_set_dump_tree_p
+_c_objc_common_init
+_c_common_init
+_init_c_lex
+_get_fileinfo
+_splay_tree_lookup
+_splay_tree_splay
+_splay_tree_insert
+_cpp_get_callbacks
+_cpp_read_main_file
+__cpp_init_hashtable
+__cpp_init_directives
+_cpp_lookup
+__cpp_init_internal_pragmas
+_cpp_register_pragma
+_lookup_pragma_entry
+_insert_pragma_entry
+__cpp_aligned_alloc
+_init_standard_includes
+_update_path
+_remove_component_p
+_concat
+_translate_name
+_get_key_value
+_merge_include_chains
+_remove_dup_dirs
+_remove_dup_dir
+__cpp_read_file
+_open_file
+_find_or_create_entry
+_splay_tree_foreach
+_splay_tree_foreach_helper
+_inode_finder
+_stack_include_file
+_read_include_file
+_cpp_push_buffer
+__cpp_do_file_change
+_add_line_map
+_cb_file_change
+_update_header_times
+_extract_interface_info
+_init_pragma
+_add_c_tree_codes
+_ggc_add_tree_varray_root
+_objc_init
+_add_objc_tree_codes
+_init_objc
+_hash_init
+_synth_module_prologue
+_xref_tag
+_lookup_tag
+_pushtag
+_build_pointer_type
+_objc_declare_class
+_is_class_name
+_lookup_interface
+_lookup_name
+_generate_forward_declaration_to_string_table
+_build_nt
+_define_decl
+_start_decl
+_grokdeclarator
+_signed_type
+_signed_or_unsigned_type
+_build_array_type
+_layout_decl
+_c_apply_type_quals_to_decl
+_maybe_apply_pragma_weak
+_finish_decl
+_maybe_apply_renaming_pragma
+_complete_array_type
+_objc_check_decl
+_rest_of_decl_compilation
+_timevar_push
+_timevar_pop
+_get_pending_sizes
+_build_tree_list
+_objc_act_parse_init
+_lang_dependent_init
+_init_asm_output
+_init_eh
+_init_optabs
+_new_optab
+_init_all_optabs
+_init_integral_libfuncs
+_init_libfuncs
+_init_floating_libfuncs
+_init_one_libfunc
+_init_traps
+_push_srcloc
+_dwarf2out_do_frame
+_dbxout_init
+_getdecls
+_getpwd
+_output_quoted_string
+_assemble_name
+_maybe_get_identifier
+_text_section
+_dbxout_typedefs
+_dbxout_symbol
+_compile_file
+_init_final
+_init_branch_prob
+_yyparse
+_dbxout_start_source_file
+_cpp_finish_options
+_init_builtins
+__cpp_define_builtin
+_run_directive
+_start_directive
+_do_define
+_lex_macro_node
+__cpp_lex_token
+__cpp_lex_direct
+_parse_identifier
+__cpp_create_definition
+_skip_whitespace
+_parse_string
+_unescaped_terminator_p
+_alloc_expansion_token
+_lex_expansion_token
+_handle_newline
+_pfe_is_cmd_ln_processing
+_end_directive
+_skip_rest_of_line
+__cpp_pop_buffer
+_parse_number
+_pfe_set_cmd_ln_processing
+_cpp_define
+_warn_of_redefinition
+__cpp_equiv_tokens
+__cpp_free_definition
+_pfe_reset_cmd_ln_processing
+_free_chain
+__cpp_push_next_buffer
+_yyparse_1
+_yylex
+__yylex
+_c_lex
+_cpp_get_token
+_get_effective_char
+_skip_line_comment
+__cpp_handle_directive
+_directive_diagnostics
+_do_import
+_do_include_common
+_parse_include
+_check_eol
+__cpp_execute_include
+_find_include_file
+_hmap_lookup_path
+_splay_tree_splay_helper
+_find_framework_file
+__cpp_never_reread
+_skip_block_comment
+_adjust_column
+_do_ifndef
+_push_conditional
+_do_if
+__cpp_parse_expr
+_lex
+_parse_defined
+_do_else
+_do_endif
+__cpp_pop_file_buffer
+_purge_cache
+_pop_srcloc
+_dbxout_end_source_file
+_cb_line_change
+_yylexname
+_altivec_treat_as_keyword
+_pending_xref_error
+_split_specs_attrs
+_make_pointer_declarator
+_build1
+_first_rtl_op
+_build_type_copy
+_ggc_collect
+_start_struct
+_grokfield
+_finish_struct
+_in_parm_level_p
+_start_record_layout
+_place_field
+_integer_zerop
+_default_ms_bitfield_layout_p
+_normalize_rli
+_normalize_offset
+_compare_tree_int
+_finish_record_layout
+_finalize_record_size
+_convert
+_convert_to_integer
+_fold
+_fold_convert
+_mul_double
+_encode
+_decode
+_rli_size_so_far
+_bit_from_pos
+_rli_size_unit_so_far
+_byte_from_pos
+_compute_record_mode
+_host_integerp
+_bit_position
+_int_bit_position
+_tree_low_cst
+_simple_cst_equal
+_rest_of_type_compilation
+_get_object_reference
+_pushlevel
+_make_binding_level
+_clear_parm_order
+_declare_parm_level
+_push_parm_decl
+_simple_type_promotes_to
+_c_promoting_integer_type_p
+_warn_about_unused_variables
+_poplevel
+_grokparms
+_enter_macro_context
+_push_token_context
+_next_context
+_padding_token
+__cpp_temp_token
+__cpp_pop_context
+_warn_if_shadowing
+_get_parm_info
+_gettags
+_nreverse
+_storedecls
+_parmlist_tags_warning
+_build_decl_attribute_variant
+_gen_aux_info_record
+_c_build_qualified_type
+_parse_params
+_save_parameter
+_do_include
+_search_from
+_lbasename
+___udivmoddi4
+_parse_number
+_do_elif
+___udivdi3
+_skip_escaped_newlines
+_unsigned_type
+__cpp_extend_buff
+_build_index_type
+_build
+_non_lvalue
+_add_double
+_mode_for_size_tree
+_shadow_tag
+_shadow_tag_warned
+_lookup_tag_reverse
+_lex_number
+_build_compound_expr
+_internal_build_compound_expr
+_build_array_declarator
+_set_array_declarator_type
+_constant_expression_warning
+_operand_equal_p
+_tree_int_cst_equal
+_const_binop
+_neg_double
+_trigraph_p
+_build_enumerator
+_default_conversion
+_build_binary_op
+_common_type
+_tree_int_cst_lt
+_type_for_size
+_finish_enum
+_min_precision
+_tree_floor_log2
+_int_fits_type_p
+_start_enum
+_do_undef
+_do_ifdef
+_function_attribute_inlinable_p
+_c_cannot_inline_tree_fn
+_put_pending_sizes
+_walk_tree
+_inline_forbidden_p
+_statement_code_p
+_lhd_tree_inlining_walk_subtrees
+_get_callee_fndecl
+_setjmp_call_p
+_special_function_p
+_inlinable_function_p
+_c_expand_body
+_defer_fn
+_debug_nothing_tree
+_finish_function
+_start_function
+_announce_function
+_store_parm_decls
+_decl_function_context
+_storetags
+_init_function_start
+_objc_printable_name
+_objc_demangle
+_emit_line_note
+_set_file_and_line_for_stmt
+_emit_note
+_aggregate_value_p
+_hard_function_value
+_begin_stmt_tree
+_current_stmt_tree
+_c_begin_compound_stmt
+_build_stmt
+_add_stmt
+_stmts_are_full_exprs_p
+_clear_last_expr
+_add_scope_stmt
+_current_scope_stmt_stack
+_c_begin_if_stmt
+_build_external_ref
+_lookup_objc_ivar
+_assemble_external
+_build_indirect_ref
+_is_public
+_build_component_ref
+_lookup_field
+_truthvalue_conversion
+_convert_to_pointer
+_truth_value_p
+_twoval_comparison_p
+_optimize_bit_field_compare
+_get_inner_reference
+_c_expand_start_cond
+_parser_build_binary_op
+_split_tree
+_unsigned_conversion_warning
+_overflow_warning
+_build_array_ref
+_pointer_int_sum
+_size_in_bytes
+_extract_muldiv
+_c_expand_return
+_convert_for_assignment
+_objc_comptypes
+_build_return_stmt
+_c_finish_then
+_c_expand_end_cond
+_shorten_compare
+_get_narrower
+_invert_tree_comparison
+_fold_range_test
+_make_range
+_fold_truthop
+_merge_type_attributes
+_merge_attributes
+_swap_tree_comparison
+_convert_and_check
+_build_modify_expr
+_c_expand_expr_stmt
+_verify_sequence_points
+_verify_tree
+_warning_candidate_p
+_new_tlist
+_merge_tlist
+_add_tlist
+_warn_for_collisions
+_warn_for_collisions_1
+_require_complete_type
+_lvalue_or_else
+_lvalue_p
+_get_unwidened
+_negate_expr
+_build_function_call
+_decl_target_overloaded_intrinsic_p
+_convert_arguments
+_default_function_array_conversion
+_check_function_format
+_build_unary_op
+_unary_complex_lvalue
+_mark_addressable
+_byte_position
+_staticp
+_kept_level_p
+_lshift_double
+_place_union_field
+_get_inner_array_type
+__cpp_release_buff
+_funlike_invocation_p
+_collect_args
+_replace_args
+_expand_arg
+_push_ptoken_context
+_clear_limbo_values
+_finish_fname_decls
+_finish_stmt_tree
+_free_after_parsing
+_free_stmt_status
+_free_after_compilation
+_free_eh_status
+_free_expr_status
+_free_emit_status
+_free_varasm_status
+_rs6000_free_machine_status
+_tree_inlinable_function_p
+_c_disregard_inline_limits
+_merge_ranges
+_range_binop
+_build_range_check
+_invert_truthvalue
+_put_var_into_stack
+_integer_all_onesp
+_distribute_bit_expr
+_integer_pow2p
+_build_conditional_expr
+_operand_equal_for_comparison_p
+_decl_constant_value_for_broken_optimization
+_decl_constant_value
+_warn_about_long_double
+_duplicate_decls
+_comptypes
+_merge_decl_attributes
+_groktypename
+_c_sizeof
+_default_comp_type_attributes
+_function_types_compatible_p
+_self_promoting_args_p
+_type_lists_compatible_p
+_start_init
+_push_string
+_finish_init
+_store_init_value
+_digest_init
+_add_decl_stmt
+_build_c_cast
+_is_id
+_lex_string
+_build_string
+_combine_strings
+_choose_string_type
+_global_bindings_p
+_htab_expand
+_type_hash_hash
+_find_empty_slot_for_expand
+_get_static_reference
+_start_protocol
+_build_protocol_template
+_lookup_protocol
+_make_tree_vec
+_lookup_and_install_protocols
+_add_protocol
+_check_protocol_recursively
+_build_keyword_decl
+_adjust_type_for_id_default
+_is_objc_type_qualifier
+_build_method_decl
+_build_keyword_selector
+_add_instance_method
+_lookup_method
+_hash_lookup
+_hash_func
+_hash_enter
+_finish_protocol
+_start_class
+_add_class
+_add_class_method
+_finish_class
+_continue_class
+_build_ivar_chain
+_objc_copy_list
+_add_category
+_decode_field_reference
+_get_best_mode
+_comp_proto_with_proto
+_get_arg_type_list
+_groktypename_in_parm_context
+_hash_add_attr
+_add_instance_variable
+_type_for_mode
+_rshift_double
+_constant_boolean_node
+_omit_one_operand
+_unextend
+_make_bit_field_ref
+_all_ones_mask_p
+_do_float_handler
+_set_float_handler
+_parse_float
+_target_isinf
+_eisinf
+_eisnan
+restFP
+_build_real
+_convert_to_real
+_real_onep
+_ereal_cmp
+_ecmp
+_emovi
+_exact_real_inverse
+_ediv
+_eisneg
+_edivm
+_m16m
+_ecmpm
+_esubm
+_real_value_truncate
+_eclear
+_etoe53
+_real_twop
+saveFP
+_lex_charconst
+_cpp_interpret_charconst
+_do_pragma
+_darwin_pragma_options
+_push_field_alignment
+_pop_field_alignment
+_ht_expand
+_redeclaration_error_message
+_build_range_type
+_release_pages
+_ggc_mark_roots
+_ggc_mark_rtx_ptr
+_ggc_set_mark
+_ggc_mark_rtx_children
+_mark_optab
+_mark_ehl_map
+_ggc_mark_hash_table
+_zap_lists
+_ggc_mark_tree_ptr
+_mark_const_str_htab
+_htab_traverse
+_mark_const_hash_entry
+_maybe_mark_struct_function
+_ggc_mark_rtvec_children
+_mark_ident_hash
+_ht_forall
+_mark_ident
+_varray_grow
+_ggc_mark_trees
+_lang_mark_tree
+_c_mark_lang_decl
+_ggc_htab_delete
+_type_hash_marked_p
+_ggc_marked_p
+_type_hash_mark
+_htab_clear_slot
+_sweep_pages
+_c_expand_start_else
+_c_finish_else
+_stabilize_reference
+_stabilize_reference_1
+_c_begin_while_stmt
+_c_finish_while_stmt_cond
+_c_size_in_bytes
+_pedantic_non_lvalue
+_pop_label_level
+_build_message_expr
+_finish_message_expr
+_save_expr
+_contains_placeholder_p
+_lookup_instance_method_static
+_build_selector_reference
+_build_objc_method_call
+_build_selector_reference_decl
+_set_mem_attributes
+_get_alias_set
+_maybe_set_unchanging
+_can_address_p
+_handled_component_p
+_get_mem_attrs
+_mem_attrs_htab_hash
+_update_non_lazy_ptrs
+_pushdecl_top_level
+_comp_target_types
+_get_class_reference
+_build_class_reference_decl
+_receiver_is_class_object
+_lookup_class_method_static
+_initializer_constant_valid_p
+_lhd_return_tree
+_assemble_variable
+_app_disable
+_set_mem_align
+_mem_attrs_htab_eq
+_output_addressed_constants
+_output_constant_def
+_const_hash
+_record_constant
+_record_constant_1
+_set_mem_alias_set
+_output_constant_def_contents
+_cstring_section
+_data_section
+_try_section_alias
+_int_size_in_bytes
+_output_constant
+_assemble_string
+_decode_addr_const
+_objc_constant_string_object_section
+_objc_section_init
+_objc_cat_cls_meth_section
+_objc_cat_inst_meth_section
+_objc_string_object_section
+_cfstring_constant_object_section
+_objc_selector_refs_section
+_objc_selector_fixup_section
+_objc_cls_refs_section
+_objc_class_section
+_objc_meta_class_section
+_objc_cls_meth_section
+_objc_inst_meth_section
+_objc_protocol_section
+_objc_class_names_section
+_objc_meth_var_types_section
+_objc_meth_var_names_section
+_objc_category_section
+_objc_class_vars_section
+_objc_instance_vars_section
+_objc_module_info_section
+_objc_symbols_section
+_output_constructor
+_int_byte_position
+_expand_expr
+_get_subtarget
+_protect_from_queue
+_mark_temp_addr_taken
+_assemble_integer
+_rs6000_assemble_integer
+_find_weak_imports
+_default_assemble_integer
+_integer_asm_op
+_assemble_integer_with_op
+_output_addr_const
+_name_needs_quotes
+_immed_double_const
+_resolve_unique_section
+_variable_section
+_darwin_set_section_for_var_p
+_const_data_section
+_in_text_section
+_machopic_define_name
+_machopic_define_ident
+_machopic_ident_defined_p
+_machopic_classify_ident
+__cpp_backup_tokens
+_build_objc_string_object
+_add_class_reference
+_setup_string_decl
+_build_constructor
+_build_super_template
+_build_private_template
+_build_class_template
+_is_ivar
+_check_duplicates
+_locate_and_pad_parm
+_function_arg_padding
+_function_arg_boundary
+_function_arg_mod_boundary
+_pad_to_arg_alignment
+_assign_parms
+_function_arg_partial_nregs
+_function_arg_skip
+_no_reg_parm_stack_space
+_function_arg_advance
+_promote_mode
+_gen_reg_rtx
+_mark_user_reg
+_validize_mem
+_emit_move_insn
+_emit_move_insn_1
+_gen_movsi
+_rs6000_emit_move
+_gen_sequence
+_pfe_s_realloc
+_pfe_realloc
+_reg_mentioned_p
+_get_last_insn
+_mark_reg_pointer
+_function_arg_pass_by_reference
+_function_arg
+_emit_insns
+_expand_function_start
+_expand_pending_sizes
+_force_next_line_note
+_expand_stmt
+_prep_stmt
+_genrtl_compound_stmt
+_genrtl_scope_stmt
+_expand_start_bindings_and_block
+_push_temp_slots
+_genrtl_decl_stmt
+_anon_aggr_type_p
+_emit_local_var
+_expand_decl
+_expand_decl_init
+_expand_assignment
+_store_expr
+_queued_subexp_p
+_preserve_subexpressions_p
+_expand_call
+_flags_from_decl_or_type
+_init_cumulative_args
+_tree_last
+_rearrange_arg_list
+_initialize_argument_information
+_finalize_must_preallocate
+_any_pending_cleanups
+_function_ok_for_sibcall
+_unsafe_for_reeval
+_c_unsafe_for_reeval
+_assign_temp
+_precompute_arguments
+_calls_function
+_calls_function_1
+_value_member
+_compute_argument_block_size
+_compute_argument_addresses
+_rtx_for_function_call
+_precompute_register_parameters
+_rtx_equal_p
+_preserve_temp_slots
+_pop_temp_slots
+_combine_temp_slots
+_emit_queue
+_copy_rtx
+_replace_equiv_address
+_update_temp_slot_address
+_change_address_1
+_memory_address
+_force_reg
+_easy_fp_constant
+_gen_rtx_fmt_e
+_rs6000_machopic_legitimize_pic_address
+_machopic_legitimize_pic_address
+_machopic_indirect_data_reference
+_machopic_data_defined_p
+_machopic_function_base_name
+_gen_rtx_fmt_E
+_set_unique_reg_note
+_find_reg_note
+_find_temp_slot_from_address
+_copy_to_mode_reg
+_save_fixed_argument_area
+_prepare_call_address
+_lookup_static_chain
+_load_register_parameters
+_use_reg
+_trunc_int_for_mode
+_num_insns_constant
+_num_insns_constant_wide
+_emit_call_1
+_gen_call_value
+_machopic_indirect_call_target
+_machopic_name_defined_p
+_machopic_stub_list_entry
+_gen_rtx_fmt_0
+_gen_rtvec
+_gen_rtvec_v
+_emit_call_insn
+_make_call_insn_raw
+_get_insns
+_expand_start_target_temps
+_do_pending_stack_adjust
+_sbitmap_alloc
+_sbitmap_zero
+_gen_lowpart_SUBREG
+_subreg_lowpart_offset
+_gen_rtx_SUBREG
+_gen_rtx_fmt_ei
+_convert_modes
+_gen_lowpart
+_gen_lowpart_common
+_simplify_gen_subreg
+_simplify_subreg
+_gen_sibcall_value
+_gen_rtx_fmt_
+_emit_barrier_after
+_add_insn_after
+_expand_end_target_temps
+_expand_end_bindings
+_do_jump
+_can_compare_p
+_do_compare_and_jump
+_copy_to_reg
+_gen_rtx_fmt_uuuu
+_do_compare_rtx_and_jump
+_reverse_condition
+_swap_commutative_operands_p
+_commutative_operand_precedence
+_force_not_mem
+_emit_cmp_and_jump_insns
+_unsigned_condition
+_prepare_cmp_insn
+_emit_cmp_and_jump_insn_1
+_prepare_operand
+_gen_cmpsi
+_gen_bne
+_rs6000_emit_cbranch
+_rs6000_generate_compare
+_validate_condition_mode
+_gen_rtx_fmt_u00
+_gen_rtx_fmt_eee
+_emit_jump_insn
+_make_jump_insn_raw
+_genrtl_if_stmt
+_genrtl_expr_stmt_value
+_expand_expr_stmt_value
+_warn_if_unused_value
+_gen_call
+_free_temp_slots
+_expand_end_cond
+_emit_label
+_gen_sibcall
+_genrtl_return_stmt
+_expand_return
+_expand_value_return
+_expand_null_return_1
+_clear_pending_stack_adjust
+_expand_goto_internal
+_expand_fixup
+_emit_jump
+_gen_jump
+_emit_barrier
+_objc_expand_function_end
+_encode_method_prototype
+_encode_type_qualifiers
+_encode_type
+_encode_pointer
+_forwarding_offset
+_apply_args_register_offset
+_apply_args_size
+_encode_aggregate
+_expand_function_end
+_finish_expr_for_function
+_in_sequence_p
+_emit_line_note_force
+_expand_eh_return
+_clobber_return_register
+_diddle_return_value
+_do_clobber_return_reg
+_emit_insn_after
+_use_return_register
+_do_use_return_reg
+_expand_fixups
+_fixup_gotos
+_rest_of_compilation
+_reorder_blocks
+_reorder_blocks_0
+_reorder_blocks_1
+_blocks_nreverse
+_reorder_fix_fragments
+_pfe_varray_free
+_init_flow
+_open_dump_file
+_convert_from_eh_region_ranges
+_collect_eh_region_array
+_resolve_fixup_regions
+_convert_from_eh_region_ranges_1
+_remove_fixup_regions
+_remove_unreachable_regions
+_get_max_uid
+_remove_unnecessary_notes
+_remove_insn
+_alloc_INSN_LIST
+_gen_rtx_fmt_ue
+_free_INSN_LIST_node
+_init_function_for_compilation
+_purge_hard_subreg_sets
+_optimize_sibling_and_tail_recursive_calls
+_find_exception_handler_labels
+_rebuild_jump_labels
+_init_label_info
+_mark_all_labels
+_mark_jump_label
+_cse_basic_block
+_new_basic_block
+_any_uncondjump_p
+_pc_set
+_cse_process_notes
+_cse_insn
+_canon_reg
+_apply_change_group
+_fold_rtx
+_canon_hash
+_get_cse_reg_info
+_lookup
+_approx_reg_cost
+_for_each_rtx
+_approx_reg_cost_1
+_bitmap_set_bit
+_bitmap_element_allocate
+_bitmap_element_link
+_bitmap_clear
+_preferrable
+_validate_change
+_insert_regs
+_make_new_qty
+_rehash_using_reg
+_insert
+_invalidate_from_clobbers
+_invalidate
+_delete_reg_equiv
+_lookup_for_remove
+_make_regs_eqv
+_check_for_label_ref
+_lookup_as_function
+_safe_hash
+_exp_equiv_p
+_equiv_constant
+_simplify_binary_operation
+_avoid_constant_pool_reference
+_notreg_cost
+_insn_invalid_p
+_asm_noperands
+_cancel_changes
+_mention_regs
+_remove_invalid_refs
+_refers_to_regno_p
+_remove_from_table
+_gen_lowpart_if_possible
+_find_best_addr
+_recog_33
+_mov_to_vrsave_operation
+_load_multiple_operation
+_store_multiple_operation
+_recog_25
+_current_file_function_operand
+_call_operand
+_immediate_operand
+_scratch_operand
+_invalidate_memory
+_invalidate_for_call
+_recog_3
+_invalidate_skipped_block
+_note_stores
+_invalidate_skipped_set
+_cse_main
+_cse_end_of_basic_block
+_next_real_insn
+_prev_nonnote_insn
+_ggc_pop_context
+_end_alias_analysis
+_ggc_del_root
+_max_reg_num
+_find_basic_blocks
+_clear_edges
+_free_edge
+_count_basic_blocks
+_inside_basic_block_p
+_control_flow_insn_p
+_can_throw_internal
+_find_basic_blocks_1
+_create_basic_block_structure
+_compute_bb_for_insn
+_make_edges
+_cached_make_edge
+_computed_jump_p
+_computed_jump_p_1
+_returnjump_p
+_returnjump_p_1
+_make_label_edge
+_next_nonnote_insn
+_make_eh_edge
+_reachable_handlers
+_free_INSN_LIST_list
+_tidy_fallthru_edges
+_tidy_fallthru_edge
+_cleanup_cfg
+_delete_unreachable_blocks
+_find_unreachable_blocks
+_try_optimize_cfg
+_update_forwarder_flag
+_forwarder_block_p
+_active_insn_p
+_hook_void_bool_false
+_try_simplify_condjump
+_any_condjump_p
+_try_forward_edges
+_onlyjump_p
+_free_EXPR_LIST_list
+_free_bb_for_insn
+_delete_trivially_dead_insns
+_count_reg_usage
+_side_effects_p
+_canonicalize_condition
+_set_of
+_set_of_1
+_delete_null_pointer_checks
+_delete_null_pointer_checks_1
+_sbitmap_vector_zero
+_invalidate_nonnull_info
+_single_set_2
+_compute_available
+_sbitmap_vector_ones
+_sbitmap_ones
+_sbitmap_union_of_diff
+_sbitmap_intersection_of_preds
+_sbitmap_copy
+_clear_aux_for_edges
+_clear_aux_for_blocks
+_renumber_insns
+_close_dump_file
+_purge_addressof
+_hash_table_init
+_hash_table_init_n
+_compute_insns_for_mem
+_insns_for_mem_walk
+_hash_lookup
+_insns_for_mem_hash
+_compute_hash_table
+_record_last_reg_set_info
+_mark_call
+_record_last_mem_set_info
+_record_last_set_info
+_hash_scan_insn
+_hash_scan_set
+_find_reg_equal_equiv_note
+_oprs_available_p
+_oprs_unchanged_p
+_insert_set_in_table
+_hash_set
+_gcse_alloc
+_hash_scan_call
+_hash_scan_clobber
+_expr_equiv_p
+_one_cprop_pass
+_alloc_cprop_mem
+_sbitmap_vector_alloc
+_compute_cprop_data
+_compute_local_properties
+_compute_transp
+_cprop
+_reset_opr_set_tables
+_clear_modify_mem_tables
+_free_list
+_cprop_insn
+_note_uses
+_find_used_regs
+_mark_oprs_set
+_oprs_not_set_p
+_bitmap_bit_p
+_find_avail_set
+_lookup_set
+_mark_set
+_mark_clobber
+_free_cprop_mem
+_free_set_hash_table
+_gcse_main
+_free_gcse_mem
+_free_modify_mem_tables
+_alloc_gcse_mem
+_gmalloc
+_one_classic_gcse_pass
+_alloc_expr_hash_table
+_alloc_rd_mem
+_compute_expr_hash_table
+_want_to_gcse_p
+_set_noop_p
+_oprs_anticipatable_p
+_insert_expr_in_table
+_hash_expr
+_hash_expr_1
+_load_killed_in_block_p
+_find_comparison_args
+_comparison_dominates_p
+_simplify_relational_operation
+_simplify_ternary_operation
+_record_jump_equiv
+_reversed_comparison_code_parts
+_record_jump_cond
+_merge_equiv_classes
+_check_function_return_warnings
+_mark_constant_function
+_mark_dfs_back_edges
+_init_alias_analysis
+_record_set
+_find_base_value
+_rtx_varies_p
+_nonlocal_mentioned_p
+_flow_loops_find
+_calculate_dominance_info
+_init_dom_info
+_calc_dfs_tree
+_calc_dfs_tree_nonrec
+_calc_idoms
+_link_roots
+_idoms_to_doms
+_free_dom_info
+_flow_loops_tree_build
+_flow_loops_level_compute
+_estimate_probability
+_predict_edge_def
+_predict_edge
+_predict_insn
+_get_condition
+_predict_insn_def
+_combine_predictions_for_insn
+_dump_prediction
+_estimate_bb_frequencies
+_alloc_aux_for_blocks
+_alloc_aux_for_block
+_alloc_aux_for_edges
+_alloc_aux_for_edge
+_estimate_loops_at_level
+_propagate_freq
+_free_aux_for_blocks
+_free_aux_for_edges
+_flow_loops_free
+_life_analysis
+_allocate_reg_life_data
+_allocate_reg_info
+_allocate_bb_life_data
+_mark_regs_live_at_end
+_mark_reg
+_update_life_info
+_clear_log_links
+_calculate_global_regs_live
+_bitmap_operation
+_bitmap_copy
+_propagate_block
+_init_propagate_block_info
+_propagate_one_insn
+_insn_dead_p
+_mark_set_regs
+_mark_used_regs
+_mark_used_reg
+_volatile_refs_p
+_mark_set_1
+_invalidate_mems_from_set
+_bitmap_clear_bit
+_invalidate_mems_from_autoinc
+_free_propagate_block_info
+_bitmap_equal_p
+_sched_analyze
+_add_dependence_list_and_free
+_add_dependence
+_sched_analyze_insn
+_sched_analyze_1
+_sched_analyze_2
+_read_dependence
+_add_insn_mem_dependence
+_alloc_EXPR_LIST
+_add_dependence_list
+_flush_pending_lists
+_compute_jump_reg_dependencies
+_get_condition
+_compute_block_backward_dependences
+_add_branch_dependences
+_sets_likely_spilled
+_sets_likely_spilled_1
+_free_deps
+_schedule_region
+_get_block_head_tail
+_compute_forward_dependences
+_group_leader
+_set_priorities
+_priority
+_insn_cost
+_result_ready_cost
+_contributes_to_priority
+_rs6000_adjust_cost
+_get_attr_type
+_extract_constrain_insn_cached
+_extract_insn_cached
+_regclass
+_secondary_reload_class
+_scan_one_insn
+_record_operand_costs
+_record_reg_classes
+_find_regno_note
+_copy_cost
+_local_alloc
+_update_equiv_regs
+_reg_preferred_class
+_equiv_init_movable_p
+_equiv_init_varies_p
+_no_equiv
+_block_alloc
+_requires_inout
+_get_hard_reg_initial_reg
+_combine_regs
+_reg_is_born
+_alloc_qty
+_reg_alternate_class
+_wipe_dead_reg
+_mark_life
+_reg_is_set
+_multiple_sets
+_qty_sugg_compare_1
+_find_free_reg
+_post_mark_life
+_qty_compare_1
+_reg_set_to_hard_reg_set
+_qty_sugg_compare
+_qty_compare
+_global_alloc
+_global_conflicts
+_record_conflicts
+_mark_reg_clobber
+_mark_reg_death
+_mark_reg_store
+_set_preference
+_record_one_conflict
+_expand_preferences
+_allocno_compare
+_prune_preferences
+_find_reg
+_build_insn_chain
+_new_insn_chain
+_reg_dies
+_reg_becomes_live
+_reload
+_clear_secondary_mem
+_init_save_areas
+_mark_home_live
+_scan_paradoxical_subregs
+_function_invariant_p
+_init_elim_table
+_max_label_num
+_get_first_label_num
+_alter_reg
+_mark_not_eliminable
+_maybe_fix_stack_asms
+_finish_spills
+_rs6000_stack_info
+_first_reg_to_save
+_first_fp_reg_to_save
+_first_altivec_reg_to_save
+_rs6000_ra_ever_killed
+_push_topmost_sequence
+_pop_topmost_sequence
+_reg_overlap_mentioned_p
+_get_frame_size
+_get_func_frame_size
+_set_initial_elim_offsets
+_set_initial_label_offsets
+_calculate_needs_all_insns
+_set_label_offsets
+_eliminate_regs_in_insn
+_elimination_effects
+_eliminate_regs
+_check_eliminable_occurrences
+_find_reloads
+_update_eliminable_offsets
+_combine_reloads
+_operands_match_p
+_emit_reload_insns
+_emit_insns_before
+_emit_insns_after
+_reload_reg_reaches_end_p
+_reload_as_needed
+_subst_reloads
+_forget_old_reloads_1
+_push_reload
+_reload_inner_reg_of_subreg
+_find_reusable_reload
+_earlyclobber_operand_p
+_choose_reload_regs
+_choose_reload_regs_init
+_compute_use_by_pseudos
+_allocate_reload_reg
+_reload_reg_free_p
+_set_reload_reg
+_true_regnum
+_mark_reload_reg_in_use
+_do_input_reload
+_do_output_reload
+_set_offsets_for_label
+_verify_initial_elim_offsets
+_cleanup_subreg_operands
+_add_auto_inc_notes
+_auto_inc_p
+_replace_pseudos_in_call_usage
+_obstack_free
+_fixup_abnormal_edges
+_unshare_all_rtl_again
+_reset_used_flags
+_reset_used_decls
+_unshare_all_rtl
+_copy_rtx_if_shared
+_unshare_all_decls
+_unshare_all_rtl_1
+_reload_cse_regs
+_reload_cse_regs_1
+_cselib_init
+_clear_table
+_htab_empty
+_prologue_epilogue_contains
+_contains
+_cselib_process_insn
+_reload_cse_simplify
+_reload_cse_simplify_set
+_reload_cse_noop_set_p
+_rtx_equal_for_cselib_p
+_cselib_lookup
+_reload_cse_simplify_operands
+_cselib_record_sets
+_new_cselib_val
+_new_elt_loc_list
+_new_elt_list
+_cselib_invalidate_rtx
+_cselib_invalidate_regno
+_push_operand
+_cselib_record_set
+_hash_rtx
+_wrap_constant
+_cselib_subst_to_values
+_shallow_copy_rtx
+_cselib_lookup_mem
+_add_mem_for_addr
+_replace_equiv_address_nv
+_unchain_one_elt_list
+_unchain_one_elt_loc_list
+_entry_and_rtx_equal_p
+_cselib_invalidate_mem
+_cselib_invalidate_mem_1
+_cselib_mem_conflict_p
+_cselib_finish
+_htab_delete
+_reload_combine
+_reload_combine_note_use
+_reload_combine_note_store
+_get_value_hash
+_if_convert
+_find_if_header
+_find_if_block
+_process_if_block
+_find_cond_trap
+_block_has_only_trap
+_find_if_case_1
+_find_if_case_2
+_split_all_insns
+_split_insn
+_try_split
+_split_insns
+_const_int_operand
+_non_add_cint_operand
+_split_11
+_split_7
+_equality_operator
+_vector_comparison_operator
+_schedule_insns
+_scope_to_insns_initialize
+_delete_insn
+_sched_init
+_rs6000_issue_rate
+_init_dependency_caches
+_rtx_equal_for_memref_p
+_memrefs_conflict_p
+_canon_rtx
+_addr_side_effect_eval
+_write_dependence_p
+_output_dependence
+_mems_in_disjoint_alias_sets_p
+_alias_sets_conflict_p
+_nonoverlapping_memrefs_p
+_get_addr
+_base_alias_check
+_find_base_term
+_true_dependence
+_lsu_unit_blockage
+_actual_hazard
+_schedule_block
+_schedule_more_p
+_iu2_unit_blockage
+_can_schedule_ready_p
+_move_insn
+_move_insn1
+_reemit_notes
+_schedule_insn
+_new_ready
+_rs6000_adjust_priority
+_queue_to_ready
+_rank_for_schedule
+_function_units_used
+_rgn_rank
+_find_insn_list
+_no_real_insns_p
+_save_line_notes
+_rm_line_notes
+_rm_other_notes
+_clear_units
+_init_ready_list
+_ready_add
+_verify_local_live_at_start
+_reposition_prologue_and_epilogue_notes
+_reorder_insns
+_reorder_insns_nobb
+_set_block_for_insn
+_rm_redundant_line_notes
+_scope_to_insns_finalize
+_set_block_levels
+_change_scope
+_emit_note_before
+_add_insn_before
+_sched_finish
+_free_dependency_caches
+_add_noreturn_fake_exit_edges
+_try_crossjump_bb
+_try_crossjump_to_edge
+_outgoing_edges_match
+_remove_fake_edges
+_remove_fake_successors
+_compute_alignments
+_purge_line_number_notes
+_cleanup_barriers
+_split_all_insns_noflow
+_convert_to_eh_region_ranges
+_shorten_branches
+_insn_default_length
+_insn_variable_length_p
+_dwarf2out_begin_prologue
+_final_start_function
+_number_blocks
+_get_block_vector
+_all_blocks
+_rs6000_output_function_prologue
+_final
+_final_scan_insn
+_debug_nothing_int
+_peephole
+_scc_comparison_operator
+_constrain_operands_cached
+_get_insn_template
+_output_asm_insn
+_output_operand
+_print_operand
+_notice_source_line
+_dbxout_source_line
+_dbxout_source_file
+_dbxout_begin_block
+_simplify_subtraction
+_decode_rtx_const
+_walk_alter_subreg
+_output_address
+_print_operand_address
+_no_asm_to_stream
+_profile_after_prologue
+_output_406
+_machopic_validate_stub_or_non_lazy_ptr
+_output_405
+_output_541
+_output_cbranch
+_get_attr_length
+_output_asm_label
+_dbxout_end_block
+_final_end_function
+_rs6000_output_function_epilogue
+_output_compiler_stub
+_debug_nothing_void
+_assemble_end_function
+_output_after_function_constants
+_output_function_exception_table
+_free_basic_block_vars
+_regset_release_memory
+_bitmap_release_memory
+_dbxout_function_decl
+_dbxout_begin_function
+_dbxout_prepare_symbol
+_dbxout_type
+_dbxout_type_index
+_dbxout_queue_symbol
+_dbxout_type_name
+_dbxout_finish_symbol
+_dbxout_flush_symbol_queue
+_print_wide_int
+_dbxout_type_fields
+_print_int_cst_octal
+_print_octal
+_finish_method_def
+_optimize_inline_calls
+_lhd_tree_inlining_add_pending_fn_decls
+_expand_calls_inline
+_htab_find
+_hash_pointer
+_expand_call_inline
+_lhd_tree_inlining_tree_chain_matters_p
+_eq_pointer
+_init_recog_no_volatile
+_gen_label_rtx
+_gen_rtx_fmt_iuu00iss
+_genrtl_for_stmt
+_emit_nop
+_expand_start_loop_continue_elsewhere
+_expand_start_loop
+_genrtl_do_pushlevel
+_expand_cond
+_expand_exit_loop_top_cond
+_expand_exit_loop_if_false
+_gen_blt
+_expand_start_cond
+_gen_beq
+_expand_binop
+_reg_or_arith_cint_operand
+_gen_addsi3
+_add_operand
+_expand_increment
+_expand_end_loop
+_emit_label_before
+_emit_jump_insn_before
+_emit_barrier_before
+_maybe_remove_eh_handler
+_flow_delete_block_noexpunge
+_delete_insn_chain
+_can_delete_label_p
+_in_expr_list_p
+_remove_node_from_expr_list
+_can_delete_note_p
+_remove_edge
+_flow_delete_block
+_expunge_block
+_expunge_block_nocompact
+_redirect_edge_and_branch
+_try_redirect_by_replacing_jump
+_can_fallthru
+_next_active_insn
+_simplejump_p
+_never_reached_warning
+_ehl_hash
+_block_label
+_redirect_jump
+_redirect_exp
+_redirect_exp_1
+_num_validated_changes
+_branch_comparison_operator
+_redirect_edge_succ_nodup
+_redirect_edge_succ
+_merge_blocks
+_tail_recursion_label_p
+_sequence_uses_addressof
+_uses_addressof
+_replace_call_placeholder
+_call_ends_block_p
+_skip_copy_to_return_value
+_identify_call_return_value
+_skip_stack_adjustment
+_skip_pic_restore
+_reg_set_between_p
+_purge_reg_equiv_notes
+_remove_note
+_purge_mem_unchanging_flag
+_purge_addressof_1
+_hash_table_free
+_alloc_reg_set_mem
+_compute_sets
+_record_set_info
+_record_one_set
+_alloc_set_hash_table
+_compute_set_hash_table
+_compute_kill_rd
+_compute_rd
+_sbitmap_union_of_preds
+_alloc_avail_expr_mem
+_compute_ae_gen
+_compute_ae_kill
+_expr_killed_p
+_classic_gcse
+_lookup_expr
+_free_avail_expr_mem
+_free_rd_mem
+_free_expr_hash_table
+_one_code_hoisting_pass
+_cse_around_loop
+_cse_set_around_loop
+_addr_affects_sp_p
+_find_and_verify_loops
+_compute_luids
+_for_each_eh_label
+_mark_loop_jump
+_loop_optimize
+_reg_scan
+_reg_scan_mark_refs
+_find_single_use_in_loop
+_loop_regs_scan
+_count_one_set
+_reg_used_between_p
+_find_reg_fusage
+_find_regno_fusage
+_scan_loop
+_count_insns_in_loop
+_next_insn_in_loop
+_reg_in_basic_block_p
+_loop_invariant_p
+_consec_sets_invariant_p
+_loop_movables_add
+_skip_consec_insns
+_modified_between_p
+_reg_set_p
+_no_labels_between_p
+_may_trap_p
+_rtx_addr_can_trap_p
+_loop_reg_used_before_p
+_ignore_some_movables
+_force_movables
+_combine_movables
+_load_mems
+_reg_scan_update
+_strength_reduce
+_loop_bivs_find
+_for_each_insn_in_loop
+_check_insn_for_bivs
+_basic_induction_var
+_record_biv
+_loop_bivs_init_find
+_record_initial
+_get_condition_for_loop
+_valid_initial_value_p
+_loop_bivs_check
+_loop_givs_find
+_check_insn_for_givs
+_find_mem_givs
+_update_giv_derive
+_general_induction_var
+_simplify_giv_expr
+_loop_iterations
+_biv_total_increment
+_fold_rtx_mult_add
+_loop_find_equiv_value
+_find_common_reg_term
+_loop_givs_check
+_check_dbra_loop
+_count_nonfixed_reads
+_loop_biv_eliminable_p
+_maybe_eliminate_biv
+_maybe_eliminate_biv_1
+_check_ext_dependent_givs
+_combine_givs
+_loop_givs_dead_check
+_loop_givs_reduce
+_loop_givs_rescan
+_replace_regs
+_loop_ivs_free
+_loop_movables_free
+_ggc_push_context
+_regclass_init
+_thread_jump
+_reversed_comparison_code
+_compress
+_flow_depth_first_order_compute
+_flow_loop_nodes_find
+_sbitmap_first_set_bit
+_sbitmap_last_set_bit
+_flow_loop_scan
+_flow_loop_level_compute
+_flow_loop_exit_edges_find
+_find_auto_inc
+_delete_dead_jumptables
+_uninitialized_vars_warning
+_regno_uninitialized
+_initialize_uninitialized_subregs
+_combine_instructions
+_init_reg_last_arrays
+_setup_incoming_promotions
+_promoted_input_arg
+_record_value_for_reg
+_update_table_tick
+_get_last_value_validate
+_nonzero_bits
+_num_sign_bit_copies
+_set_nonzero_bits_and_sign_copies
+_expand_field_assignment
+_get_last_value
+_record_dead_and_set_regs
+_record_dead_and_set_regs_1
+_replace_rtx
+_recog_15
+_recog_21
+_recog_16
+_recog_17
+_recog_19
+_recog_31
+_recog_28
+_recog_26
+_stmw_operation
+_mtcrf_operation
+_lmw_operation
+_vrsave_operation
+_recog_for_combine
+_check_asm_operands
+_do_SUBST_INT
+_try_combine
+_undo_all
+_cant_combine_insn_p
+_can_combine_p
+_combinable_i3pat
+_do_SUBST
+_reg_referenced_p
+_dead_or_set_p
+_dead_or_set_regno_p
+_subst
+_combine_simplify_rtx
+_simplify_set
+_find_single_use
+_find_single_use_1
+_simplify_comparison
+_swap_condition
+_make_compound_operation
+_make_field_assignment
+_mark_used_regs_combine
+_use_crosses_set_p
+_volatile_insn_p
+_force_to_mode
+_recog_22
+_recog_23
+_any_operand
+_check_promoted_subreg
+_if_then_else_cond
+_simplify_if_then_else
+_combine_reversed_comparison_code
+_recog_30
+_contains_muldiv
+_apply_distributive_law
+_have_insn_for
+_move_deaths
+_restore_line_notes
+_free_pending_lists
+_finish_deps_global
+_init_deps_global
+_init_deps
+_unlink_line_notes
+_unlink_other_notes
+_leaf_function_p
+_allocate_initial_values
+_record_address_regs
+_assign_stack_local
+_assign_stack_local_1
+_find_reloads_address
+_regno_clobbered_p
+_copy_reloads
+_condjump_p
+_thread_prologue_and_epilogue_insns
+_gen_prologue
+_rs6000_emit_prologue
+_try_leaf_pic_optimization
+_name_encodes_objc_method_p
+_rs6000_frame_related
+_simplify_rtx
+_rs6000_maybe_dead
+_rs6000_emit_allocate_stack
+_gen_movsi_update
+_record_insns
+_insert_insn_on_edge
+_direct_return
+_gen_epilogue
+_rs6000_emit_epilogue
+_commit_edge_insertions
+_commit_one_edge_insertion
+_find_sub_basic_blocks
+_find_bb_boundaries
+_purge_dead_edges
+_compute_outgoing_frequencies
+___divdi3
+___udivmoddi4
+_gen_sibcall_epilogue
+_emit_insn_before
+_insns_match_p
+_copyprop_hardreg_forward
+_init_value_data
+_copyprop_hardreg_forward_1
+_preprocess_constraints
+_kill_clobbered_value
+_kill_autoinc_value
+_replace_oldest_value_reg
+_find_oldest_value_reg
+_kill_set_value
+_kill_value
+_kill_value_regno
+_set_value_regno
+_copy_value
+_replace_oldest_value_mem
+_replace_oldest_value_addr
+_recog_20
+_delete_noop_moves
+_noop_move_p
+_find_insn_reg_weight
+_init_regions
+_find_single_block_region
+_count_or_remove_death_notes
+_free_EXPR_LIST_node
+_assemble_start_function
+_output_408
+_purge_all_dead_edges
+_notice_stack_pointer_modification
+_notice_stack_pointer_modification_1
+_distribute_notes
+_reg_bitfield_target_p
+_distribute_links
+_undo_commit
+_remove_death
+_emit_note_after
+_reload_cse_delete_noop_set
+_references_value_p
+_reload_cse_move2add
+_move2add_note_store
+_sext_for_mode
+_start_method_def
+_synth_self_and_ucmd_args
+_handle_unused_attribute
+_expr_last
+_continue_method_def
+_really_start_method
+_lookup_method_in_protocol_list
+_find_label_refs
+_alloc_block
+_merge_blocks_nomove
+_skip_use_of_return_value
+_skip_unreturned_value
+_skip_jump_insn
+_doing_eh
+_emit_initial_value_sets
+_instantiate_virtual_regs
+_instantiate_decls
+_instantiate_decl
+_instantiate_decls_1
+_instantiate_virtual_regs_1
+_instantiate_new_reg
+_output_407
+_dbxout_parms
+_dbxout_block
+_dbxout_syms
+_dbxout_reg_parms
+_dbxout_symbol_location
+_dbxout_function_end
+_init_insn_lengths
+_clear_const_double_mem
+_expected_value_to_br_prob
+_prev_real_insn
+_insn_live_p
+_set_live_p
+_regmove_optimize
+_discover_flags_reg
+_gen_add3_insn
+_mark_flags_life_zones
+_find_matches
+_validate_replace_rtx
+_validate_replace_rtx_1
+_mirror_conflicts
+_nothrow_function_p
+_output_constant_pool
+_mark_constant_pool
+_htab_elements
+_function_section
+_unsave_expr
+_expand_start_else
+_machopic_non_lazy_ptr_list_entry
+_start_cleanup_deferral
+_end_cleanup_deferral
+_expand_loop_continue_here
+_genrtl_expr_stmt
+_delete_related_insns
+_canon_list_insert
+_mems_conflict_for_gcse_p
+_try_replace_reg
+_validate_replace_src
+_validate_replace_src_1
+_simplify_replace_rtx
+_try_pre_increment_1
+_try_pre_increment
+_find_use_as_address
+_split_2
+_cc_reg_not_cr0_operand
+_split_3
+_split_4
+_split_6
+_non_short_cint_operand
+_add_to_mem_set_list
+_comp_method_with_proto
+_force_operand
+_unsave_expr_now
+_unsave_expr_now_r
+_unsave_expr_1
+_duplicate_loop_exit_test
+_copy_loop_headers
+_invert_jump
+_invert_exp
+_invert_exp_1
+_invert_br_probabilities
+_update_br_prob_note
+_label_is_jump_target_p
+_get_bitmap_width
+_indirect_jump_in_function_p
+_prescan_loop
+_note_addr_stored
+_set_sched_group_p
+_remove_dependence
diff --git a/order-files/cc1objplus.order b/order-files/cc1objplus.order
new file mode 100644
index 00000000000..380a0e211c1
--- /dev/null
+++ b/order-files/cc1objplus.order
@@ -0,0 +1,952 @@
+start
+__start
+__dyld_init_check
+dyld_stub_binding_helper
+___darwin_gcc3_preregister_frame_info
+__call_mod_init_funcs
+__dyld_func_lookup
+_main
+_toplev_main
+_hex_init
+_general_init
+_xmalloc_set_program_name
+_diagnostic_initialize
+__obstack_begin
+_xmalloc
+_parse_options_and_default_flags
+_init_reg_sets
+_add_params
+_xrealloc
+_pfe_init
+_read_integral_parameter
+_override_O_option
+_extract_override_options
+_objc_init_options
+_cxx_init_options
+_c_common_init_options
+_cpp_create_reader
+_init_library
+_init_trigraph_map
+_xcalloc
+_set_lang
+_deps_init
+_init_line_maps
+__cpp_init_tokenrun
+__cpp_get_buff
+_new_buff
+_pfe_s_malloc
+_pfe_malloc
+_gcc_obstack_init
+_pfe_obstack_chuck_alloc
+__cpp_init_includes
+_splay_tree_new
+_splay_tree_new_with_allocator
+_splay_tree_xmalloc_allocate
+_set_index_lang
+_set_target_switch
+_optimization_options
+_override_option
+_objc_decode_option
+_cxx_decode_option
+_cpp_handle_option
+_parse_option
+_xstrdup
+_append_include_chain
+__cpp_simplify_pathname
+_independent_decode_option
+_new_pending_directive
+_hmap_load_header_map
+_decode_W_option
+_set_Wunused
+_compare_options
+_dump_switch_p
+_decode_f_option
+_output_set_maximum_length
+_set_real_maximum_length
+_output_is_line_wrapping
+_add_env_options
+_objc_post_options
+_c_common_post_options
+_cpp_post_options
+_init_dependency_output
+_do_compile
+_process_options
+_rs6000_override_options
+_rs6000_parse_abi_options
+_rs6000_add_gc_roots
+_ggc_add_rtx_root
+_ggc_add_root
+_htab_create
+_higher_prime_number
+_machopic_add_gc_roots
+_ggc_add_tree_root
+_new_alias_set
+_floor_log2_wide
+_init_timevar
+_timevar_start
+_lang_independent_init
+_init_ggc
+_exact_log2_wide
+_pfe_s_calloc
+_pfe_calloc
+_init_stringpool
+_ht_create
+_init_obstacks
+_ggc_add_deletable_htab
+_init_emit_once
+_mode_for_size
+_gen_rtx
+_rtx_alloc
+_ggc_alloc
+_alloc_page
+_pfe_free
+_set_page_table_entry
+_gen_raw_REG
+_gen_rtx_fmt_i0
+_gen_rtx_fmt_w
+_ereal_atof
+_asctoe53
+_asctoeg
+_ecleaz
+_enormlz
+_eshup6
+_toe53
+_eiisnan
+_eshift
+_eshup1
+_e53toe
+_eshdn1
+_ecleazs
+_emovo
+_emovz
+_eaddm
+_eshup8
+_emdnorm
+_init_reg_sets_1
+_reg_class_subset_p
+_init_regs
+_init_reg_modes
+_choose_hard_reg_mode
+_recog_13
+_nonimmediate_operand
+_general_operand
+_input_operand
+_memory_operand
+_register_operand
+_toc_relative_expr_p
+_constant_pool_expr_1
+_init_expmed
+_gen_rtx_CONST_INT
+_recog
+_gpc_reg_operand
+_recog_4
+_reg_or_cint_operand
+_rtx_cost
+_recog_5
+_reg_or_short_operand
+_short_cint_operand
+_htab_find_slot_with_hash
+_const_int_htab_eq
+_init_expr_once
+_gen_rtx_REG
+_recog_10
+_recog_9
+_altivec_register_operand
+_rs6000_legitimate_address
+_zero_constant
+_cc_reg_operand
+_constrain_operands
+_reg_fits_class_p
+_init_caller_save
+_extract_insn
+_insn_extract
+_gen_rtx_MEM
+_gen_rtx_fmt_e0
+_gen_rtx_fmt_ee
+_emit_insn
+_make_insn_raw
+_add_insn
+_recog_memoized_1
+_reg_or_mem_operand
+_recog_7
+_recog_6
+_boolean_or_operator
+_boolean_operator
+_recog_1
+_builtin_function_2
+_builtin_function
+_builtin_function_1
+_get_identifier
+_ht_lookup
+_calc_hash
+_alloc_node
+_make_node
+_tree_size
+_build_library_fn_1
+_build_lang_decl
+_build_decl
+_pfe_savestring
+_retrofit_lang_decl
+_ggc_alloc_cleared
+_pushdecl
+_lookup_name_current_level
+_namespace_binding
+_check_template_shadow
+_push_overloaded_decl
+_namespace_bindings_p
+_innermost_nonclass_level
+_set_namespace_binding
+_decls_match
+_warn_extern_redeclared_static
+_check_default_args
+_add_decl_to_level
+_make_decl_rtl
+_decode_reg_name
+_gen_rtx_fmt_s
+_darwin_encode_section_info
+_ggc_alloc_string
+_update_stubs
+_decl_attributes
+_init_attributes
+_default_insert_attributes
+_insert_default_attributes
+_c_common_insert_default_attributes
+_c_init_attributes
+_build_int_2_wide
+_tree_cons
+_builtin_function_disabled_p
+_mangle_decl
+_mangle_decl_string
+_c_common_nodes_and_builtins
+_init_standard_includes
+_update_path
+_cpp_read_main_file
+_merge_include_chains
+_remove_dup_dirs
+_remove_dup_dir
+__cpp_read_file
+_open_file
+_find_or_create_entry
+_splay_tree_lookup
+_splay_tree_splay
+_splay_tree_insert
+_splay_tree_foreach
+_splay_tree_foreach_helper
+_inode_finder
+_stack_include_file
+_read_include_file
+_cpp_push_buffer
+__cpp_do_file_change
+_add_line_map
+_cb_file_change
+_update_header_times
+_extract_interface_info
+_get_fileinfo
+_splay_tree_splay_helper
+_c_common_init
+_init_pragma
+_cpp_register_pragma
+_cpp_lookup
+_lookup_pragma_entry
+_insert_pragma_entry
+__cpp_aligned_alloc
+_cxx_init
+_init_cp_pragma
+_init_repo
+_objc_init
+_add_objc_tree_codes
+_set_dump_tree_p
+_init_objc
+_hash_init
+_synth_module_prologue
+_push_lang_context
+_objcp_xref_tag
+_xref_tag
+_tree_low_cst
+_host_integerp
+_identifier_type_value
+_lookup_tag
+_binding_for_name
+_lookup_name
+_lookup_name_real
+_lookup_flags
+_unqualified_namespace_lookup
+_current_decl_namespace
+_find_binding
+_lookup_using_namespace
+_select_decl
+_make_aggr_type
+_cp_make_lang_type
+_default_set_default_type_attributes
+_build_pointer_type
+_layout_type
+_size_int_wide
+_size_int_type_wide
+_force_fit_type
+_htab_find_slot
+_size_htab_hash
+_size_htab_eq
+_finalize_type_size
+_get_mode_alignment
+_round_type_align
+_round_up
+_size_binop
+_int_const_binop
+_integer_onep
+_make_binfo
+_make_tree_vec
+_pushtag
+_current_scope
+_create_implicit_typedef
+_set_identifier_type_value_with_scope
+_maybe_process_template_type_declaration
+_maybe_check_template_type
+_pushdecl_with_scope
+_objc_declare_class
+_is_class_name
+_lookup_interface
+_objcp_lookup_name
+_follow_tag_typedef
+_original_type
+_build_function_type
+_type_hash_list
+_type_hash_canon
+_type_hash_lookup
+_htab_find_with_hash
+_type_hash_add
+_objcp_builtin_function
+_type_hash_eq
+_attribute_list_equal
+_attribute_list_contained
+_type_list_equal
+_generate_forward_declaration_to_string_table
+_build_nt
+_define_decl
+_objcp_start_decl
+_start_decl
+_chainon
+_grokdeclarator
+_toplevel_bindings_p
+_cp_type_quals
+_strip_array_types
+_cp_build_qualified_type_real
+_create_array_type_for_decl
+_build_cplus_array_type
+_build_cplus_array_type_1
+_uses_template_parms
+_is_id
+_for_each_template_parm
+_walk_tree
+_for_each_template_parm_r
+_cp_walk_subtrees
+_build_array_type
+_grokvardecl
+_layout_decl
+_set_decl_namespace
+_is_namespace_ancestor
+_no_linkage_check
+_walk_tree_without_duplicates
+_htab_find
+_hash_pointer
+_no_linkage_helper
+_htab_delete
+_bad_specifiers
+_c_apply_type_quals_to_decl
+_cplus_decl_attributes
+_maybe_apply_pragma_weak
+_maybe_push_decl
+_maybe_register_incomplete_var
+_start_decl_1
+_maybe_push_cleanup_level
+_objcp_finish_decl
+_cp_finish_decl
+_maybe_apply_renaming_pragma
+_cp_has_mutable_p
+_target_type
+_check_initializer
+_maybe_deduce_size_from_array_init
+_complete_array_type
+_current_stmt_tree
+_layout_var_decl
+_maybe_commonize_var
+_make_rtl_for_nonlocal_decl
+_rest_of_decl_compilation
+_timevar_push
+_assemble_variable
+_timevar_pop
+_abstract_virtuals_error
+_pop_lang_context
+_objc_act_parse_init
+_lang_dependent_init
+_init_asm_output
+_strip_off_ending
+_init_eh
+_init_optabs
+_c_lex
+_read_token
+_read_process_identifier
+_altivec_treat_as_keyword
+_yylex
+_yyparse_1
+_do_pending_lang_change
+_cpp_get_token
+__cpp_lex_token
+__cpp_lex_direct
+_skip_whitespace
+_parse_identifier
+_enter_macro_context
+_push_token_context
+_next_context
+_padding_token
+__cpp_temp_token
+_hash_tree_cons
+_list_hash_pieces
+__cpp_pop_context
+_scan_tokens
+_frob_id
+_parse_decl0
+_frob_specs
+_save_type_access_control
+_split_specs_attrs
+_parse_decl
+_build_type_copy
+_copy_node
+_parse_end_decl
+_decl_type_access_control
+_deferred_type_access_control
+_note_list_got_semicolon
+_clear_anon_tags
+_do_pending_inlines
+_ggc_collect
+_handle_newline
+_get_effective_char
+__cpp_handle_directive
+_start_directive
+_directive_diagnostics
+_do_endif
+_check_eol
+_skip_block_comment
+_end_directive
+_skip_rest_of_line
+_do_undef
+_lex_macro_node
+_adjust_column
+_do_if
+__cpp_parse_expr
+_lex
+_parse_defined
+_push_conditional
+_do_ifndef
+__obstack_newchunk
+_do_define
+__cpp_create_definition
+_alloc_expansion_token
+_pfe_is_cmd_ln_processing
+_cb_line_change
+_list_hash_eq
+_build_tree_list
+_do_ifdef
+_find_include_file
+__cpp_execute_include
+_push_srcloc
+_debug_nothing_int_charstar
+__cpp_never_reread
+_do_import
+_do_include_common
+_parse_include
+_parse_string
+_unescaped_terminator_p
+_hmap_lookup_path
+_maybe_note_name_used_in_class
+_note_got_semicolon
+_parse_params
+_save_parameter
+_lex_expansion_token
+_parse_number
+_parse_number
+___udivdi3
+___udivmoddi4
+_do_else
+_identifier_type
+_do_include
+_search_from
+_lbasename
+__cpp_pop_buffer
+__cpp_pop_file_buffer
+_purge_cache
+_pop_srcloc
+_debug_nothing_int
+_do_elif
+_comptypes
+_compparms
+_add_method
+_build_overload
+_ovl_cons
+_clone_function_decl
+_clone_constructors_and_destructors
+_check_bases_and_members
+_finish_struct_methods
+_maybe_warn_about_overly_private_class
+_method_name_cmp
+_type_requires_array_cookie
+_lookup_fnfields
+_lookup_member
+_complete_type
+_bfs_walk
+_varray_init
+_lookup_field_r
+_lookup_fnfields_1
+_lookup_field_1
+_finish_struct_1
+_layout_class_type
+_start_record_layout
+_determine_primary_base
+_create_vtable_ptr
+_build_base_fields
+_layout_nonempty_base_or_field
+_place_field
+_integer_zerop
+_default_ms_bitfield_layout_p
+_normalize_rli
+_normalize_offset
+_compare_tree_int
+_tree_int_cst_sgn
+_byte_position
+_byte_from_pos
+_convert
+_ocp_convert
+_decl_constant_value
+_convert_to_integer
+_build1
+_first_rtl_op
+_fold
+_fold_convert
+_layout_conflict_p
+_splay_tree_max
+_add_double
+_end_of_class
+_rli_size_unit_so_far
+_finish_record_layout
+_finalize_record_size
+_mul_double
+_encode
+_decode
+_rli_size_so_far
+_bit_from_pos
+_compute_record_mode
+_bit_position
+_int_bit_position
+_simple_cst_equal
+_mode_for_size_tree
+_remove_zero_width_bit_fields
+_layout_virtual_bases
+_warn_about_ambiguous_direct_bases
+_splay_tree_delete
+_splay_tree_delete_helper
+_splay_tree_xmalloc_deallocate
+_nreverse
+_modify_all_vtables
+_dfs_walk
+_dfs_walk_real
+_dfs_modify_vtables
+_dfs_unmark
+_finish_struct_bits
+_aggregate_value_p
+_count_fields
+_add_fields_to_vec
+_field_decl_cmp
+_finish_vtbls
+_accumulate_vtbl_inits
+_build_vtt
+_build_vtt_inits
+_complete_vars
+_maybe_suppress_debug_info
+_dump_class_hierarchy
+_dump_begin
+_decl_function_context
+_rest_of_type_compilation
+_finish_struct
+_popclass
+_poplevel_class
+_pop_binding
+_pop_binding_level
+_find_class_binding_level
+_pop_class_decls
+_pop_search_level
+_pop_stack_level
+_finish_class_definition
+_check_for_missing_semicolon
+_do_pending_defargs
+_done_pending_defargs
+_begin_inline_definitions
+_finish_inline_definitions
+_clear_inline_text_obstack
+_set_identifier_type_value
+_build_self_reference
+_finish_member_declaration
+_pushdecl_class_level
+_push_class_level_binding
+_push_class_binding
+_note_name_declared_in_class
+_push_binding
+_context_for_name_lookup
+_is_properly_derived_from
+_begin_class_definition
+_check_class_key
+_decl_namespace
+_parse_field0
+_parse_field
+_grokfield
+_constructor_name
+_constructor_name_full
+_objc_check_decl
+_template_class_depth
+_template_class_depth_real
+_splay_tree_compare_pointers
+_reset_type_access_control
+_unreverse_member_declarations
+_fixup_inline_methods
+_check_bases
+_check_field_decls
+_delete_duplicate_fields
+_delete_duplicate_fields_1
+_pod_type_p
+_check_field_decl
+_finish_struct_anon
+_check_methods
+_add_implicitly_declared_members
+_implicitly_declare_fn
+_synthesize_exception_spec
+_make_call_declarator
+_parmlist_is_exprlist
+_check_special_function_return_type
+_member_function_or_else
+_grokparms
+_build_cplus_method_type
+_grokfndecl
+_build_exception_variant
+_comp_except_specs
+_eq_pointer
+_get_containing_scope
+_grokclassfn
+_build_qualified_type
+_get_qualified_type
+_set_type_quals
+_build_artificial_parm
+_maybe_retrofit_in_chrg
+_statement_code_p
+_cp_statement_code_p
+_cp_is_overload_p
+_check_explicit_specialization
+_current_tmpl_spec_kind
+_grok_ctor_properties
+_copy_fn_p
+_skip_artificial_parms_for
+_grok_special_member_properties
+_sufficient_parms_p
+_defer_fn
+_build_reference_type
+_hash_tree_chain
+_type_promotes_to
+_c_promoting_integer_type_p
+_grok_op_properties
+_ambi_op_p
+_unary_op_p
+_build_clone
+_copy_decl
+_copy_lang_decl
+_copy_list
+_parse_bitfield0
+_parse_bitfield
+_grokbitfield
+_constant_expression_warning
+_lex_number
+_int_fits_type_p
+_check_bitfield_decl
+_do_aggr
+_yyungetc
+_handle_class_head
+_maybe_process_partial_specialization
+_pushclass
+_invalidate_class_lookup_cache
+_pushlevel_class
+_push_binding_level
+_push_class_decls
+_push_search_level
+_push_stack_level
+_dfs_push_type_decls
+_dfs_push_decls
+_storetags
+_reset_specialization
+_make_pointer_declarator
+_get_type_decl
+_finish_decl_parsing
+_check_for_new_type
+_finish_parmlist
+_varray_grow
+_pfe_s_realloc
+_pfe_realloc
+_do_warning
+__cpp_extend_buff
+_nothrow_libfn_p
+_libc_name_p
+_lex_string
+_build_string
+_lookup_tag_reverse
+_skip_escaped_newlines
+_begin_function_definition
+_start_function
+_lookup_attribute
+_check_function_type
+_require_complete_types_for_parms
+_complete_type_or_else
+_init_function_start
+_prepare_function_start
+_init_stmt_for_function
+_init_eh_for_function
+_init_emit
+_clear_emit_caches
+_init_virtual_regs
+_init_expr
+_init_varasm_status
+_init_temp_slots
+_init_pending_stack_adjust
+_push_cp_function_context
+_rs6000_init_machine_status
+_objc_printable_name
+_objc_demangle
+_emit_line_note
+_set_file_and_line_for_stmt
+_emit_note
+_hard_function_value
+_begin_stmt_tree
+_announce_function
+_pushlevel
+_start_fname_decls
+_store_parm_decls
+_storedecls
+_push_local_binding
+_getdecls
+_gettags
+_begin_function_body
+_keep_next_level
+_begin_compound_stmt
+_build_stmt
+_add_stmt
+_stmts_are_full_exprs_p
+_do_pushlevel
+_make_binding_level
+_add_scope_stmt
+_current_scope_stmt_stack
+_at_function_scope_p
+_compute_array_index_type
+_cp_convert
+_build_binary_op
+_really_overloaded_fn
+_default_conversion
+_decay_conversion
+_type_unknown_p
+_is_overloaded_fn
+_common_type
+_type_after_usual_arithmetic_conversions
+_merge_type_attributes
+_merge_attributes
+_build_type_attribute_variant
+_build
+_operand_equal_p
+_tree_int_cst_equal
+_const_binop
+_neg_double
+_build_index_type
+_non_lvalue
+_place_union_field
+_qualify_lookup
+_finish_id_expr
+_do_identifier
+_objcp_lookup_identifier
+_lookup_objc_ivar
+_hack_identifier
+_mark_used
+_assemble_external
+_convert_from_reference
+_build_x_unary_op
+_build_new_op
+_build_unary_op
+_lvalue_type
+_unary_complex_lvalue
+_lvalue_or_else
+_lvalue_p
+_lvalue_p_1
+_mark_addressable
+_staticp
+_reparse_absdcl_as_casts
+_altivec_is_vector_constant_element
+_groktypename
+_build_c_cast
+_convert_force
+_convert_to_pointer_force
+_cp_convert_to_pointer
+_build_x_modify_expr
+_build_modify_expr
+_require_complete_type
+_convert_for_assignment
+_dubious_conversion_warnings
+_overflow_warning
+_can_convert_arg_bad
+_implicit_conversion
+_standard_conversion
+_strip_top_quals
+_perform_implicit_conversion
+_convert_like_real
+_finish_expr_stmt
+_convert_to_void
+_finish_stmt
+_dependent_base_p
+_currently_open_class
+_type_access_control
+_build_x_component_ref
+_build_component_ref
+_lookup_field
+_enforce_access
+_accessible_p
+_friend_accessible_p
+_access_in_type
+_dfs_access_in_type
+_assert_canonical_unmarked
+_dfs_assert_unmarked_p
+_dfs_accessible_p
+_grok_array_decl
+_build_expr_type_conversion
+_build_array_ref
+_build_x_arrow
+_build_indirect_ref
+_canonical_type_variant
+_build_conv
+_finish_call_expr
+_is_global
+_lookup_arg_dependent
+_arg_assoc_args
+_arg_assoc
+_arg_assoc_type
+_build_x_function_call
+_build_function_call
+_build_function_call_real
+_decl_target_overloaded_intrinsic_p
+_inline_conversion
+_convert_arguments
+_convert_for_initialization
+_build_call
+_build_addr_func
+_is_empty_class
+_finish_return_stmt
+_check_return_expr
+_maybe_warn_about_returning_address_of_local
+_finish_compound_stmt
+_finish_function_body
+_do_poplevel
+_kept_level_p
+_poplevel
+_warn_about_unused_variables
+_finish_function
+_finish_fname_decls
+_finish_stmt_tree
+_pop_labels
+_save_function_data
+_calls_setjmp_p
+_calls_setjmp_r
+_setjmp_call_p
+_special_function_p
+_free_after_parsing
+_pop_cp_function_context
+_free_stmt_status
+_free_after_compilation
+_free_eh_status
+_free_expr_status
+_free_emit_status
+_free_varasm_status
+_rs6000_free_machine_status
+_expand_body
+_simplify_aggr_init_exprs_r
+_maybe_clone_body
+_debug_nothing_tree
+_start_enum
+_build_enumerator
+_tree_int_cst_lt
+_finish_enum
+_min_precision
+_tree_floor_log2
+_fixup_unsigned_type
+_smallest_mode_for_size
+_shadow_tag
+_check_tag_decl
+_add_builtin_candidates
+_non_reference
+_type_decays_to
+_type_for_size
+_add_builtin_candidate
+_build_builtin_candidate
+_add_candidate
+_any_viable
+_splice_viable
+_tourney
+_lshift_double
+_finish_parenthesized_expr
+_build_x_binary_op
+_lookup_function_nonclass
+_lookup_name_nonclass
+_arg_assoc_namespace
+_purpose_member
+_get_narrower
+_truth_value_p
+_integer_all_onesp
+_distribute_bit_expr
+_default_comp_type_attributes
+_build_x_indirect_ref
+_build_opfncall
+_reparse_decl_as_expr
+_build_expr_from_tree
+_warn_of_redefinition
+_cpp_pedwarn_with_line
+__cpp_begin_message
+__cpp_free_definition
+_funlike_invocation_p
+_collect_args
+_replace_args
+_expand_arg
+_push_ptoken_context
+__cpp_release_buff
+_finish_sizeof
+_c_sizeof
+_extract_muldiv
+_get_inner_array_type
+_duplicate_decls
+_redeclaration_error_message
+_locate_copy
+_merge_exception_specifiers
+_add_binding
+_locate_ctor
+_make_anon_name
+_clear_identifier_class_values
+_merge_decl_attributes
+_merge_types
+_commonparms
+_list_length
+_tree_last
+_skip_line_comment
+_trigraph_p
+_see_typename
+_push_nested_class
+_set_class_shadows
+_unuse_fields
+_dfs_unuse_fields
+_maybe_begin_member_template_processing
+_inline_needs_template_parms
+_feed_defarg
+_feed_input
+_replace_defarg
+_can_convert_arg
+_finish_defarg
+_end_input
+_obstack_free
+_maybe_end_member_template_processing
+_pop_nested_class
diff --git a/order-files/cc1plus.order b/order-files/cc1plus.order
new file mode 100644
index 00000000000..39806c011ca
--- /dev/null
+++ b/order-files/cc1plus.order
@@ -0,0 +1,1356 @@
+start
+__start
+__dyld_init_check
+dyld_stub_binding_helper
+___darwin_gcc3_preregister_frame_info
+__call_mod_init_funcs
+__dyld_func_lookup
+_main
+_toplev_main
+_hex_init
+_general_init
+_xmalloc_set_program_name
+_diagnostic_initialize
+__obstack_begin
+_xmalloc
+_parse_options_and_default_flags
+_init_reg_sets
+_add_params
+_xrealloc
+_pfe_init
+_read_integral_parameter
+_override_O_option
+_extract_override_options
+_lang_init_options
+_cxx_init_options
+_c_common_init_options
+_cpp_create_reader
+_init_library
+_init_trigraph_map
+_xcalloc
+_set_lang
+_deps_init
+_init_line_maps
+__cpp_init_tokenrun
+__cpp_get_buff
+_new_buff
+_pfe_s_malloc
+_pfe_malloc
+_gcc_obstack_init
+_pfe_obstack_chuck_alloc
+__cpp_init_includes
+_splay_tree_new
+_splay_tree_new_with_allocator
+_splay_tree_xmalloc_allocate
+_set_index_lang
+_set_target_switch
+_optimization_options
+_override_option
+_cxx_decode_option
+_cpp_handle_option
+_parse_option
+_xstrdup
+_append_include_chain
+__cpp_simplify_pathname
+_independent_decode_option
+_remove_component_p
+_new_pending_directive
+_compare_options
+_dump_switch_p
+_decode_f_option
+_decode_g_option
+_set_Wunused
+_set_Wformat
+_decode_W_option
+_output_set_maximum_length
+_set_real_maximum_length
+_output_is_line_wrapping
+_add_env_options
+_cxx_post_options
+_c_common_post_options
+_cpp_post_options
+_init_dependency_output
+_do_compile
+_process_options
+_rs6000_override_options
+_rs6000_parse_abi_options
+_rs6000_add_gc_roots
+_ggc_add_rtx_root
+_ggc_add_root
+_htab_create
+_higher_prime_number
+_machopic_add_gc_roots
+_ggc_add_tree_root
+_new_alias_set
+_floor_log2_wide
+_init_timevar
+_timevar_start
+_lang_independent_init
+_init_ggc
+_exact_log2_wide
+_pfe_s_calloc
+_pfe_calloc
+_init_stringpool
+_ht_create
+_init_obstacks
+_ggc_add_deletable_htab
+_init_emit_once
+_mode_for_size
+_gen_rtx
+_rtx_alloc
+_ggc_alloc
+_alloc_page
+_pfe_free
+_set_page_table_entry
+_gen_raw_REG
+_gen_rtx_fmt_i0
+_gen_rtx_fmt_w
+_ereal_atof
+_asctoe53
+_asctoeg
+_ecleaz
+_enormlz
+_eshup6
+_toe53
+_eiisnan
+_eshift
+_eshup1
+_e53toe
+_eshdn1
+_ecleazs
+_emovo
+_emovz
+_eaddm
+_eshup8
+_emdnorm
+_gen_rtx_CONST_INT
+_gen_const_vector_0
+_rtvec_alloc
+_gen_rtx_fmt_E0
+_gen_rtx_REG
+_init_regs
+_init_reg_sets_1
+_reg_class_subset_p
+_init_reg_modes
+_choose_hard_reg_mode
+_gen_rtx_MEM
+_gen_rtx_fmt_e0
+_init_alias_once
+_init_stmt
+_init_loop
+_address_cost
+_memory_address_p
+_rs6000_legitimate_address
+_init_reload
+_gen_rtx_fmt_ee
+_gen_rtx_fmt_s
+_pfe_savestring
+_plus_constant_wide
+_find_constant_term_loc
+_init_varasm_once
+_init_EXPR_INSN_LIST_cache
+_init_dummy_function_start
+_prepare_function_start
+_ggc_alloc_cleared
+_init_stmt_for_function
+_init_eh_for_function
+_init_emit
+_clear_emit_caches
+_init_virtual_regs
+_init_expr
+_init_varasm_status
+_init_temp_slots
+_init_pending_stack_adjust
+_rs6000_init_machine_status
+_init_expmed
+_start_sequence
+_rtx_cost
+_emit_insn
+_make_insn_raw
+_add_insn
+_init_recog
+_recog
+_recog_13
+_gpc_reg_operand
+_register_operand
+_recog_4
+_reg_or_cint_operand
+_recog_5
+_nonimmediate_operand
+_general_operand
+_input_operand
+_memory_operand
+_toc_relative_expr_p
+_constant_pool_expr_1
+_reg_or_short_operand
+_short_cint_operand
+_htab_find_slot_with_hash
+_const_int_htab_eq
+_init_expr_once
+_boolean_or_operator
+_boolean_operator
+_recog_1
+_reg_or_mem_operand
+_recog_7
+_recog_10
+_recog_9
+_altivec_register_operand
+_zero_constant
+_strict_memory_address_p
+_init_caller_save
+_recog_memoized_1
+_extract_insn
+_insn_extract
+_constrain_operands
+_reg_fits_class_p
+_recog_6
+_cc_reg_operand
+_ht_lookup
+_alloc_node
+_make_node
+_tree_size
+_get_identifier
+_init_reswords
+_calc_hash
+_cxx_init
+_init_spew
+_init_tree
+_set_dump_tree_p
+_init_cplus_expand
+_init_cp_semantics
+_add_c_tree_codes
+_add_cpp_tree_codes
+_init_operators
+_init_method
+_init_mangle
+_varray_init
+_init_error
+_init_output_buffer
+_output_set_prefix
+_clear_diagnostic_info
+_build_int_2_wide
+_cxx_init_decl_processing
+_initialize_predefined_identifiers
+_cp_parse_init
+_init_decl2
+_ggc_add_tree_varray_root
+_init_pt
+_push_to_top_level
+_maybe_push_to_top_level
+_push_namespace
+_build_lang_decl
+_build_decl
+_retrofit_lang_decl
+_build_common_tree_nodes
+_initialize_sizetypes
+_default_set_default_type_attributes
+_get_mode_alignment
+_copy_node
+_make_signed_type
+_fixup_signed_type
+_layout_type
+_tree_int_cst_sgn
+_smallest_mode_for_size
+_size_int_wide
+_size_int_type_wide
+_force_fit_type
+_htab_find_slot
+_size_htab_hash
+_finalize_type_size
+_round_type_align
+_round_up
+_size_htab_eq
+_size_binop
+_int_const_binop
+_integer_onep
+_tree_cons
+_make_unsigned_type
+_fixup_unsigned_type
+_pushlevel
+_make_binding_level
+_push_binding_level
+_declare_namespace_level
+_namespace_binding
+_pushdecl
+_lookup_name_current_level
+_check_template_shadow
+_namespace_bindings_p
+_innermost_nonclass_level
+_set_namespace_binding
+_add_decl_to_level
+_pop_namespace
+_suspend_binding_level
+_find_class_binding_level
+_c_common_nodes_and_builtins
+_record_builtin_type
+_set_identifier_type_value_with_scope
+_binding_for_name
+_find_binding
+_set_identifier_type_value
+_identifier_global_value
+_signed_type
+_set_sizetype
+_build_common_tree_nodes_2
+_build_pointer_type
+_build_qualified_type
+_get_qualified_type
+_build_type_copy
+_set_type_quals
+_mul_double
+_encode
+_decode
+_rs6000_build_va_list
+_make_vector
+_finish_vector_type
+_build_index_type
+_convert
+_ocp_convert
+_complete_type
+_decl_constant_value
+_convert_to_integer
+_build1
+_first_rtl_op
+_fold
+_fold_convert
+_compare_tree_int
+_host_integerp
+_tree_low_cst
+_type_hash_canon
+_type_hash_lookup
+_htab_find_with_hash
+_type_hash_add
+_build_array_type
+_build
+_integer_zerop
+_comptypes
+_non_lvalue
+_add_double
+_simple_cst_equal
+_mode_for_size_tree
+_start_record_layout
+_place_field
+_layout_decl
+_default_ms_bitfield_layout_p
+_normalize_rli
+_normalize_offset
+_finish_record_layout
+_finalize_record_size
+_get_inner_array_type
+_rli_size_so_far
+_bit_from_pos
+_rli_size_unit_so_far
+_byte_from_pos
+_compute_record_mode
+_type_hash_eq
+_attribute_list_equal
+_attribute_list_contained
+_bit_position
+_int_bit_position
+_build_function_type
+_type_hash_list
+_type_list_equal
+_builtin_function_2
+_builtin_function
+_builtin_function_1
+_build_library_fn_1
+_push_overloaded_decl
+_decls_match
+_warn_extern_redeclared_static
+_check_default_args
+_make_decl_rtl
+_decode_reg_name
+_darwin_encode_section_info
+_ggc_alloc_string
+_update_stubs
+_decl_attributes
+_init_attributes
+_default_insert_attributes
+_insert_default_attributes
+_c_common_insert_default_attributes
+_c_init_attributes
+_builtin_function_disabled_p
+_mangle_decl
+_mangle_decl_string
+_resume_binding_level
+_strip_array_types
+_cp_type_quals
+_build_cplus_array_type
+_build_cplus_array_type_1
+_uses_template_parms
+_for_each_template_parm
+_walk_tree
+_for_each_template_parm_r
+_cp_walk_subtrees
+_statement_code_p
+_cp_statement_code_p
+_cp_is_overload_p
+_record_unknown_type
+_xref_tag
+_identifier_type_value
+_add_exception_specifier
+_build_tree_list
+_build_exception_variant
+_comp_except_specs
+_push_cp_library_fn
+_build_cp_library_fn
+_set_mangled_name_for_decl
+_write_encoding
+_write_name
+_decl_is_template_id
+_write_unscoped_name
+_write_unqualified_name
+_write_bare_function_type
+_write_method_parms
+_write_type
+_find_substitution
+_canonical_type_variant
+_cp_build_qualified_type_real
+_write_CV_qualifiers_for_type
+_write_builtin_type
+_add_substitution
+_build_library_fn_ptr
+_build_library_fn
+_init_class_processing
+_init_one_libfunc
+_init_exception_processing
+_supports_one_only
+_start_fname_decls
+_using_eh_for_cleanups
+_type_for_size
+_init_cpp_parse
+_c_common_init
+_init_c_lex
+_get_fileinfo
+_splay_tree_lookup
+_splay_tree_splay
+_splay_tree_insert
+_cpp_get_callbacks
+_cpp_read_main_file
+__cpp_init_hashtable
+__cpp_init_directives
+_cpp_lookup
+__cpp_init_internal_pragmas
+_cpp_register_pragma
+_lookup_pragma_entry
+_insert_pragma_entry
+__cpp_aligned_alloc
+_init_standard_includes
+_update_path
+_concat
+_translate_name
+_get_key_value
+_merge_include_chains
+_remove_dup_dirs
+_remove_dup_dir
+_cpp_warning
+__cpp_begin_message
+__cpp_read_file
+_open_file
+_find_or_create_entry
+_splay_tree_foreach
+_splay_tree_foreach_helper
+_inode_finder
+_stack_include_file
+_read_include_file
+_cpp_push_buffer
+__cpp_do_file_change
+_add_line_map
+_cb_file_change
+_update_header_times
+_extract_interface_info
+_splay_tree_splay_helper
+_init_pragma
+_init_cp_pragma
+_init_repo
+_lang_dependent_init
+_init_asm_output
+_init_eh
+_init_optabs
+_init_all_optabs
+_init_integral_libfuncs
+_init_libfuncs
+_init_floating_libfuncs
+__obstack_newchunk
+_dwarf2out_do_frame
+_dwarf2out_frame_init
+_dwarf2out_def_cfa
+_def_cfa_1
+_lookup_cfa
+_add_fde_cfi
+_initial_return_save
+_reg_save
+_dbxout_init
+_getdecls
+_getpwd
+_output_quoted_string
+_assemble_name
+_maybe_get_identifier
+_text_section
+_dbxout_typedefs
+_dbxout_symbol
+_timevar_pop
+_compile_file
+_init_final
+_init_branch_prob
+_timevar_push
+_yyparse
+_dbxout_start_source_file
+_cpp_finish_options
+_init_builtins
+__cpp_define_builtin
+_run_directive
+_start_directive
+_do_define
+_lex_macro_node
+__cpp_lex_token
+__cpp_lex_direct
+_parse_identifier
+__cpp_create_definition
+_skip_whitespace
+_parse_string
+_unescaped_terminator_p
+_alloc_expansion_token
+_lex_expansion_token
+_handle_newline
+_pfe_is_cmd_ln_processing
+_end_directive
+_skip_rest_of_line
+__cpp_pop_buffer
+_parse_number
+_pfe_set_cmd_ln_processing
+_cpp_define
+_warn_of_redefinition
+__cpp_equiv_tokens
+__cpp_free_definition
+_pfe_reset_cmd_ln_processing
+_free_chain
+__cpp_push_next_buffer
+_push_include
+__cpp_execute_include
+_find_include_file
+_search_from
+_push_srcloc
+_yyparse_1
+_yylex
+_read_token
+_c_lex
+_cpp_get_token
+_get_effective_char
+_skip_block_comment
+_adjust_column
+_skip_line_comment
+__cpp_handle_directive
+_directive_diagnostics
+_do_ifndef
+_check_eol
+_push_conditional
+_do_else
+_do_endif
+___udivmoddi4
+_parse_number
+_lex
+__cpp_parse_expr
+__cpp_pop_context
+_do_if
+_do_include
+_do_include_common
+_parse_include
+_find_framework_file
+_skip_escaped_newlines
+_enter_macro_context
+_push_token_context
+_next_context
+___udivdi3
+_parse_defined
+_do_elif
+__cpp_pop_file_buffer
+_purge_cache
+_pop_srcloc
+_dbxout_end_source_file
+_lbasename
+_parse_params
+_save_parameter
+_read_process_identifier
+_altivec_treat_as_keyword
+_padding_token
+__cpp_temp_token
+_hash_tree_cons
+_list_hash_pieces
+_scan_tokens
+_frob_id
+_lookup_name
+_lookup_name_real
+_lookup_flags
+_unqualified_namespace_lookup
+_current_decl_namespace
+_lookup_using_namespace
+_select_decl
+_chainon
+_parse_decl0
+_frob_specs
+_save_type_access_control
+_split_specs_attrs
+_parse_decl
+_start_decl
+_grokdeclarator
+_toplevel_bindings_p
+_bad_specifiers
+_cplus_decl_attributes
+_maybe_apply_pragma_weak
+_maybe_push_decl
+_start_decl_1
+_maybe_push_cleanup_level
+_parse_end_decl
+_decl_type_access_control
+_deferred_type_access_control
+_cp_finish_decl
+_maybe_apply_renaming_pragma
+_cp_has_mutable_p
+_rest_of_decl_compilation
+_note_list_got_semicolon
+_clear_anon_tags
+_do_pending_inlines
+_ggc_collect
+_cb_line_change
+_list_hash_eq
+_identifier_type
+_maybe_note_name_used_in_class
+_note_got_semicolon
+_do_aggr
+_yyungetc
+_handle_class_head
+_current_scope
+_lookup_tag
+_make_aggr_type
+_cp_make_lang_type
+_make_binfo
+_make_tree_vec
+_pushtag
+_create_implicit_typedef
+_maybe_process_template_type_declaration
+_maybe_check_template_type
+_pushdecl_with_scope
+_begin_class_definition
+_reset_type_access_control
+_maybe_process_partial_specialization
+_pushclass
+_pushlevel_class
+_push_class_decls
+_push_search_level
+_push_stack_level
+_dfs_walk
+_dfs_walk_real
+_dfs_push_type_decls
+_dfs_push_decls
+_storetags
+_reset_specialization
+_build_self_reference
+_constructor_name
+_constructor_name_full
+_finish_member_declaration
+_pushdecl_class_level
+_push_class_level_binding
+_push_class_binding
+_note_name_declared_in_class
+_push_binding
+_context_for_name_lookup
+_is_properly_derived_from
+_check_class_key
+_decl_namespace
+_parse_field0
+_parse_field
+_grokfield
+_c_apply_type_quals_to_decl
+_target_type
+_check_initializer
+_maybe_deduce_size_from_array_init
+_current_stmt_tree
+_template_class_depth
+_template_class_depth_real
+_splay_tree_compare_pointers
+_finish_class_definition
+_finish_struct
+_unreverse_member_declarations
+_nreverse
+_finish_struct_1
+_fixup_inline_methods
+_check_bases_and_members
+_check_bases
+_check_field_decls
+_delete_duplicate_fields
+_delete_duplicate_fields_1
+_pod_type_p
+_check_field_decl
+_finish_struct_anon
+_check_methods
+_add_implicitly_declared_members
+_implicitly_declare_fn
+_synthesize_exception_spec
+_make_call_declarator
+_build_nt
+_parmlist_is_exprlist
+_check_special_function_return_type
+_member_function_or_else
+_grokparms
+_build_cplus_method_type
+_decl_function_context
+_grokfndecl
+_no_linkage_check
+_walk_tree_without_duplicates
+_htab_find
+_hash_pointer
+_no_linkage_helper
+_eq_pointer
+_htab_delete
+_get_containing_scope
+_grokclassfn
+_build_artificial_parm
+_abstract_virtuals_error
+_defer_fn
+_build_reference_type
+_hash_tree_chain
+_type_promotes_to
+_c_promoting_integer_type_p
+_maybe_retrofit_in_chrg
+_check_explicit_specialization
+_current_tmpl_spec_kind
+_grok_ctor_properties
+_copy_fn_p
+_skip_artificial_parms_for
+_grok_special_member_properties
+_make_rtl_for_nonlocal_decl
+_assemble_variable
+_grok_op_properties
+_ambi_op_p
+_unary_op_p
+_add_method
+_build_overload
+_compparms
+_ovl_cons
+_clone_constructors_and_destructors
+_clone_function_decl
+_build_clone
+_copy_decl
+_copy_lang_decl
+_copy_list
+_finish_struct_methods
+_maybe_warn_about_overly_private_class
+_method_name_cmp
+_type_requires_array_cookie
+_lookup_fnfields
+_lookup_member
+_bfs_walk
+_lookup_field_r
+_lookup_fnfields_1
+_lookup_field_1
+_layout_class_type
+_determine_primary_base
+_create_vtable_ptr
+_build_base_fields
+_layout_nonempty_base_or_field
+_byte_position
+_layout_conflict_p
+_splay_tree_max
+_end_of_class
+_aggregate_value_p
+_finish_struct_bits
+_count_fields
+_finish_vtbls
+_accumulate_vtbl_inits
+_build_vtt
+_build_vtt_inits
+_complete_vars
+_maybe_suppress_debug_info
+_dump_class_hierarchy
+_dump_begin
+_rest_of_type_compilation
+_popclass
+_poplevel_class
+_pop_binding
+_pop_binding_level
+_pop_class_decls
+_pop_search_level
+_pop_stack_level
+_splay_tree_delete
+_splay_tree_delete_helper
+_splay_tree_xmalloc_deallocate
+_do_pending_defargs
+_done_pending_defargs
+_begin_inline_definitions
+_finish_inline_definitions
+_clear_inline_text_obstack
+_shadow_tag
+_check_tag_decl
+_follow_tag_typedef
+_original_type
+_duplicate_decls
+_redeclaration_error_message
+_invalidate_class_lookup_cache
+_sufficient_parms_p
+_make_pointer_declarator
+_create_array_type_for_decl
+_compute_array_index_type
+_constant_expression_warning
+_cp_convert
+_build_binary_op
+_really_overloaded_fn
+_default_conversion
+_decay_conversion
+_type_unknown_p
+_is_overloaded_fn
+_common_type
+_type_after_usual_arithmetic_conversions
+_merge_type_attributes
+_merge_attributes
+_build_type_attribute_variant
+_operand_equal_p
+_tree_int_cst_equal
+_const_binop
+_neg_double
+_lex_number
+_remove_zero_width_bit_fields
+_layout_virtual_bases
+_warn_about_ambiguous_direct_bases
+_modify_all_vtables
+_dfs_modify_vtables
+_dfs_unmark
+_int_fits_type_p
+_do_ifdef
+_check_for_new_type
+_finish_parmlist
+_begin_function_definition
+_start_function
+_nothrow_libfn_p
+_libc_name_p
+_lookup_attribute
+_check_function_type
+_require_complete_types_for_parms
+_complete_type_or_else
+_init_function_start
+_push_cp_function_context
+_lang_printable_name
+_lang_decl_name
+_decl_as_string
+_output_clear_message_text
+_dump_decl
+_dump_function_decl
+_dump_type_prefix
+_dump_type
+_dump_qualifiers
+_output_add_string
+_maybe_wrap_text
+_output_append
+_output_emit_prefix
+_output_append_r
+_output_add_space
+_dump_scope
+_dump_function_name
+_dump_parameters
+_output_add_character
+_dump_type_suffix
+_output_finalize_message
+_emit_line_note
+_set_file_and_line_for_stmt
+_emit_note
+_hard_function_value
+_begin_stmt_tree
+_announce_function
+_store_parm_decls
+_storedecls
+_push_local_binding
+_gettags
+_begin_function_body
+_keep_next_level
+_begin_compound_stmt
+_build_stmt
+_add_stmt
+_stmts_are_full_exprs_p
+_do_pushlevel
+_add_scope_stmt
+_current_scope_stmt_stack
+_build_expr_from_tree
+_do_identifier
+_qualify_lookup
+_objcp_lookup_identifier
+_hack_identifier
+_mark_used
+_assemble_external
+_convert_from_reference
+_build_x_indirect_ref
+_build_opfncall
+_build_new_op
+_build_indirect_ref
+_reparse_decl_as_expr
+_finish_parenthesized_expr
+_finish_return_stmt
+_check_return_expr
+_convert_for_initialization
+_convert_for_assignment
+_dubious_conversion_warnings
+_overflow_warning
+_can_convert_arg_bad
+_implicit_conversion
+_standard_conversion
+_strip_top_quals
+_lvalue_p
+_lvalue_p_1
+_build_conv
+_perform_implicit_conversion
+_convert_like_real
+_maybe_warn_about_returning_address_of_local
+_finish_stmt
+_finish_compound_stmt
+_finish_function_body
+_do_poplevel
+_kept_level_p
+_poplevel
+_warn_about_unused_variables
+_finish_function
+_finish_fname_decls
+_finish_stmt_tree
+_pop_labels
+_save_function_data
+_calls_setjmp_p
+_calls_setjmp_r
+_free_after_parsing
+_pop_cp_function_context
+_free_stmt_status
+_free_after_compilation
+_free_eh_status
+_free_expr_status
+_free_emit_status
+_free_varasm_status
+_rs6000_free_machine_status
+_expand_body
+_simplify_aggr_init_exprs_r
+_maybe_clone_body
+_debug_nothing_tree
+_lex_string
+_build_string
+_push_lang_context
+_grokvardecl
+_set_decl_namespace
+_is_namespace_ancestor
+_maybe_register_incomplete_var
+_layout_var_decl
+_maybe_commonize_var
+_make_anon_name
+_start_enum
+_finish_unary_op_expr
+_build_x_unary_op
+_build_unary_op
+_build_expr_type_conversion
+_build_enumerator
+_check_for_missing_semicolon
+_dump_aggr_type
+_class_key_or_enum
+_check_for_uninitialized_const_var
+_at_function_scope_p
+_add_decl_stmt
+_maybe_inject_for_scope_var
+_initialize_local_var
+_destroy_local_var
+_finish_id_expr
+_dependent_base_p
+_currently_open_class
+_type_access_control
+_build_x_component_ref
+_build_component_ref
+_lookup_field
+_enforce_access
+_accessible_p
+_friend_accessible_p
+_access_in_type
+_dfs_access_in_type
+_assert_canonical_unmarked
+_dfs_assert_unmarked_p
+_dfs_accessible_p
+_build_x_modify_expr
+_build_modify_expr
+_require_complete_type
+_lvalue_or_else
+_get_unwidened
+_finish_expr_stmt
+_convert_to_void
+_lookup_base
+_lookup_base_r
+_build_method_call
+_build_new_method_call
+_resolve_args
+_add_function_candidate
+_list_length
+_lvalue_type
+_reference_binding
+_real_lvalue_p
+_reference_related_p
+_reference_compatible_p
+_at_least_as_qualified_p
+_direct_reference_binding
+_add_candidate
+_any_viable
+_splice_viable
+_tourney
+_is_dummy_object
+_build_over_call
+_unary_complex_lvalue
+_mark_addressable
+_staticp
+_cp_convert_to_pointer
+_is_friend
+_build_base_path
+_resolves_to_fixed_type_p
+_fixed_type_or_null
+_check_function_format
+_build_target_expr_with_type
+_build_target_expr
+_maybe_build_cleanup
+_build_cplus_new
+_nullify_returns_r
+_htab_expand
+_list_hash
+_find_empty_slot_for_expand
+_finish_decl_parsing
+_pop_lang_context
+_lookup_tag_reverse
+_finish_enum
+_tree_int_cst_lt
+_min_precision
+_tree_floor_log2
+_do_undef
+_get_inner_reference
+_optimize_bit_field_compare
+_condition_conversion
+_has_cleanups
+_finish_if_stmt_cond
+_build_x_arrow
+_build_x_binary_op
+_split_tree
+_grok_array_decl
+_build_array_ref
+_cp_pointer_int_sum
+_pointer_int_sum
+_size_in_bytes
+_extract_muldiv
+_finish_then_clause
+_finish_if_stmt
+_begin_if_stmt
+_shorten_compare
+_get_narrower
+_invert_tree_comparison
+_fold_range_test
+_make_range
+_cp_truthvalue_conversion
+_truthvalue_conversion
+_fold_truthop
+_maybe_convert_cond
+_negate_expr
+_finish_call_expr
+_is_global
+_lookup_arg_dependent
+_arg_assoc_args
+_arg_assoc
+_arg_assoc_type
+_build_x_function_call
+_build_function_call
+_build_function_call_real
+_decl_target_overloaded_intrinsic_p
+_inline_conversion
+_convert_arguments
+_build_call
+_build_addr_func
+_is_empty_class
+_arg_assoc_class
+_purpose_member
+_arg_assoc_namespace
+_convert_class_to_reference
+_lookup_conversions
+_add_conversions
+_build_component_addr
+_decl_type_context
+_convert_force
+_convert_to_pointer_force
+_parse_bitfield0
+_parse_bitfield
+_grokbitfield
+_locate_ctor
+_merge_exception_specifiers
+_locate_copy
+_funlike_invocation_p
+_collect_args
+_replace_args
+_expand_arg
+_push_ptoken_context
+__cpp_release_buff
+_merge_decl_attributes
+_merge_types
+_type_hash_hash
+_lshift_double
+_add_fields_to_vec
+_field_decl_cmp
+__cpp_extend_buff
+_twoval_comparison_p
+_swap_tree_comparison
+_merge_ranges
+_range_binop
+_build_range_check
+_unsigned_type
+_invert_truthvalue
+_build_x_conditional_expr
+_build_conditional_expr
+_operand_equal_for_comparison_p
+_truth_value_p
+_fold_binary_op_with_conditional_arg
+_global_bindings_p
+_integer_all_onesp
+_distribute_bit_expr
+_default_comp_type_attributes
+_setjmp_call_p
+_special_function_p
+_warn_about_long_double
+_reparse_absdcl_as_casts
+_altivec_is_vector_constant_element
+_groktypename
+_build_c_cast
+_convert_to_real
+_handle_aligned_attribute
+_tree_log2
+_is_attribute_p
+_finish_sizeof
+_c_sizeof
+_place_union_field
+_complete_array_type
+_handle_format_attribute
+_decode_format_attr
+_decode_format_type
+_attribute_hash_list
+_value_member
+_commonparms
+_tree_last
+_lookup_function_nonclass
+_lookup_name_nonclass
+_add_builtin_candidates
+_non_reference
+_type_decays_to
+_add_builtin_candidate
+_build_builtin_candidate
+_store_init_value
+_digest_init
+_combine_strings
+_choose_string_type
+_finish_asm_stmt
+_parse_output_constraint
+_check_multiple_declarators
+_varray_grow
+_pfe_s_realloc
+_pfe_realloc
+_build_this
+_stabilize_reference
+_stabilize_reference_1
+_lex_charconst
+_cpp_interpret_charconst
+_do_pragma
+_darwin_pragma_options
+_pop_field_alignment
+_build_x_compound_expr
+_build_compound_expr
+_null_ptr_cst_p
+_integer_pow2p
+_tree_expr_nonnegative_p
+_push_field_alignment
+__cpp_backup_tokens
+_ht_expand
+_clear_identifier_class_values
+_expand_tree_builtin
+_fold_builtin
+_trigraph_p
+_parse_method
+_start_method
+_snarf_method
+_snarf_block
+_finish_method
+_fixup_pending_inline
+_check_for_override
+_protected_accessible_p
+_pop_nested_class
+_enter_scope_of
+_push_nested_class
+_set_class_shadows
+_unuse_fields
+_dfs_unuse_fields
+_is_aggr_type
+_check_classfn
+_finish_this_expr
+_maybe_end_member_template_processing
+_process_next_inline
+_end_input
+_obstack_free
+_begin_parsing_inclass_inline
+_feed_input
+_maybe_begin_member_template_processing
+_inline_needs_template_parms
+_dump_exception_spec
+_see_typename
+_finish_base_specifier
+_xref_basetypes
+_unshare_base_binfos
+_get_vbase_types
+_unmarkedp
+_dfs_get_vbase_types
+_markedp
+_dfs_build_inheritance_graph_order
+_unmarked_pushdecls_p
+_template_self_reference_p
+_setup_class_bindings
+_lookup_field_queue_p
+_marked_pushdecls_p
+_mark_primary_bases
+_dfs_unshared_virtual_bases
+_build_base_field
+_propagate_binfo_offsets
+_get_primary_binfo
+_record_subobject_offsets
+_walk_subobject_offsets
+_record_subobject_offset
+_dfs_set_offset_for_unshared_vbases
+_dfs_unmarked_real_bases_queue_p
+_dfs_marked_real_bases_queue_p
+_feed_defarg
+_grok_method_quals
+_cp_type_qual_from_rid
+_make_reference_declarator
+_comp_ptr_ttypes
+_comp_ptr_ttypes_real
+_string_conv_p
+_frob_opname
+_maybe_dummy_object
+_build_field_call
+_finish_object_call_expr
+_initializer_constant_valid_p
+_cplus_expand_constant
+_layout_vtable_decl
+_get_vtbl_decl_for_binfo
+_initialize_vtable
+_initialize_array
+_char_type_p
+_process_init_constructor
+_dump_vtable
+_adjust_clone_args
+_begin_eh_spec_block
+_begin_constructor_body
+_finish_mem_initializers
+_emit_base_init
+_sort_member_init
+_build_field_list
+_sort_base_init
+_initialize_vtbl_ptrs
+_dfs_initialize_vtbl_ptrs
+_expand_virtual_init
+_build_vtbl_address
+_build_vfield_ref
+_perform_member_init
+_finish_constructor_body
+_finish_eh_spec_block
+_update_cloned_parm
+_store_bindings
+_clone_body
+_copy_body
+_copy_body_r
+_cp_auto_var_in_fn_p
+_copy_tree_r
+_copy_scope_stmt
+_remap_block
+_insert_block
+_nonstatic_local_decl_p
+_local_variable_p
+_remap_decl
+_pop_from_top_level
+_pfe_varray_free
+_handle_noreturn_attribute
+_check_default_argument
+_add_defarg_fn
+_shared_unmarked_p
+_canonical_binfo
+_shared_marked_p
+_dfs_canonical_queue
+_dfs_accessible_queue_p
+_is_subobject_of_p
+_revert_static_member_fn
+_begin_template_parm_list
+_begin_scope
+_note_template_header
+_finish_template_type_parm
+_process_template_parm
+_build_template_parm_index
+_end_template_parm_list
+_push_template_decl_real
+_template_parm_scope_p
+_check_default_tmpl_args
+_current_template_args
+_build_template_decl
+_pushdecl_namespace_level
+_classtype_mangled_name
+_most_general_template
+_mangle_class_name_for_template
+_get_innermost_template_args
+_type_as_string
+_finish_template_decl
+_end_template_decl
+_finish_scope
+_write_nested_name
+_write_prefix
+_write_source_name
+_write_number
+_hwint_to_ascii
+_write_identifier
+_joust
+_compare_ics
+_maybe_handle_implicit_object
+_maybe_handle_ref_bind
+_qualified_lookup_using_namespace
+_ambiguous_decl
+_do_scoped_id
+_finish_else_clause
+_build_functional_cast
+_build_user_type_conversion_1
+_build_ptr_wrapper
+_convert_default_arg
+_break_out_target_exprs
+_bot_manip
+_bot_replace
+_write_special_name_constructor
+_build_delete
+_build_dtor_call
+_write_special_name_destructor
+_build_throw
+_is_admissible_throw_operand
+_complete_ptr_ref_or_void_ptr_p
+_doing_eh
+_decl_is_java_type
+_push_throw_library_fn
+_push_library_fn
+_pushdecl_top_level
+_push_function_context_to
+_pop_function_context_from
+_restore_emit_status
+_begin_init_stmts
+_begin_stmt_expr
+_create_temporary_var
+_obscure_complex_init
+_build_aggr_init
+_expand_aggr_init_1
+_expand_default_init
+_build_new_function_call
+_ptr_reasonably_similar
+_begin_else_clause
+_finish_init_stmts
+_finish_stmt_expr
+_build_min
+_finish_decl_cleanup
+_do_allocate_exception
+_prepare_eh_type
+_build_eh_type_type
+_get_tinfo_decl
+_mangle_typeinfo_for_type
+_mangle_special_for_type
+_write_class_enum_type
+_check_bitfield_decl
diff --git a/pbproj/gcc3.pbproj/dpatel.pbxuser b/pbproj/gcc3.pbproj/dpatel.pbxuser
new file mode 100644
index 00000000000..8ad2052ee77
--- /dev/null
+++ b/pbproj/gcc3.pbproj/dpatel.pbxuser
@@ -0,0 +1,208 @@
+// !$*UTF8*$!
+{
+ 8928587D02108C4F0CCA2CB6 = {
+ activeExec = 0;
+ };
+ 8C18C7DB00C5722F06CA2AC8 = {
+ activeBuildStyle = 8C864B2C00C575A806CA2AC8;
+ activeTarget = 8928587D02108C4F0CCA2CB6;
+ addToTargets = (
+ );
+ breakpoints = (
+ );
+ perUserDictionary = {
+ PBXWorkspaceContents = (
+ {
+ LeftSlideOut = {
+ Split0 = {
+ Split0 = {
+ NavCount = 1;
+ NavGeometry0 = {
+ Frame = "{{0, 0}, {851, 904}}";
+ NavBarVisible = YES;
+ };
+ };
+ SplitCount = 1;
+ Tab0 = {
+ Debugger = {
+ Split0 = {
+ SplitCount = 2;
+ };
+ SplitCount = 1;
+ TabCount = 2;
+ };
+ LauncherConfigVersion = 4;
+ };
+ Tab1 = {
+ LauncherConfigVersion = 3;
+ Runner = {
+ };
+ };
+ TabCount = 4;
+ };
+ SplitCount = 1;
+ Tab1 = {
+ OptionsSetName = "Hierarchy, all classes";
+ };
+ Tab3 = {
+ SplitCount = 2;
+ };
+ TabCount = 6;
+ };
+ },
+ );
+ PBXWorkspaceGeometries = (
+ {
+ ContentSize = "{1106, 927}";
+ LeftSlideOut = {
+ ActiveTab = 0;
+ Collapsed = NO;
+ Frame = "{{0, 23}, {1106, 904}}";
+ Split0 = {
+ Collapsed = NO;
+ Frame = "{{255, 0}, {851, 904}}";
+ Split0 = {
+ Frame = "{{0, 0}, {851, 904}}";
+ };
+ SplitCount = 1;
+ Tab0 = {
+ Debugger = {
+ ActiveTab = 1;
+ Collapsed = NO;
+ Frame = "{{0, 0}, {681, 289}}";
+ Split0 = {
+ Frame = "{{0, 92}, {681, 197}}";
+ Split0 = {
+ Frame = "{{0, 0}, {331, 197}}";
+ };
+ Split1 = {
+ DebugVariablesTableConfiguration = (
+ Name,
+ 114,
+ Value,
+ 206,
+ );
+ Frame = "{{340, 0}, {341, 197}}";
+ };
+ SplitCount = 2;
+ };
+ SplitCount = 1;
+ Tab0 = {
+ Frame = "{{0, 0}, {100, 50}}";
+ };
+ Tab1 = {
+ Frame = "{{0, 0}, {681, 68}}";
+ };
+ TabCount = 2;
+ TabsVisible = YES;
+ };
+ Frame = "{{0, 0}, {681, 289}}";
+ LauncherConfigVersion = 4;
+ };
+ Tab1 = {
+ Frame = "{{0, 0}, {681, 120}}";
+ LauncherConfigVersion = 3;
+ Runner = {
+ Frame = "{{0, 0}, {681, 120}}";
+ };
+ };
+ Tab2 = {
+ BuildMessageFrame = "{{0, 0}, {683, 127}}";
+ BuildTranscriptFrame = "{{0, 136}, {683, 100}}";
+ Frame = "{{0, 0}, {681, 234}}";
+ };
+ Tab3 = {
+ Frame = "{{0, 0}, {681, 238}}";
+ };
+ TabCount = 4;
+ TabsVisible = NO;
+ };
+ SplitCount = 1;
+ Tab0 = {
+ Frame = "{{0, 0}, {231, 904}}";
+ GroupTreeTableConfiguration = (
+ SCMStatusColumn,
+ 22,
+ TargetStatusColumn,
+ 18,
+ MainColumn,
+ 176,
+ );
+ };
+ Tab1 = {
+ ClassesFrame = "{{0, 0}, {233, 329}}";
+ ClassesTreeTableConfiguration = (
+ PBXBookColumnIdentifier,
+ 20,
+ PBXClassColumnIdentifier,
+ 190,
+ );
+ Frame = "{{0, 0}, {231, 548}}";
+ MembersFrame = "{{0, 338}, {233, 210}}";
+ MembersTreeTableConfiguration = (
+ PBXBookColumnIdentifier,
+ 20,
+ PBXMethodColumnIdentifier,
+ 189,
+ );
+ };
+ Tab2 = {
+ Frame = "{{0, 0}, {231, 904}}";
+ };
+ Tab3 = {
+ Frame = "{{0, 0}, {231, 548}}";
+ Split0 = {
+ Frame = "{{0, 0}, {231, 265}}";
+ TargetTreeTableConfiguration = (
+ ActiveTarget,
+ 16,
+ TargetName,
+ 199,
+ );
+ };
+ Split1 = {
+ BuildStyleTreeTableConfiguration = (
+ IsActive,
+ 16,
+ Name,
+ 200,
+ );
+ Frame = "{{0, 274}, {231, 274}}";
+ };
+ SplitCount = 2;
+ };
+ Tab4 = {
+ ExecutableTreeTableConfiguration = (
+ ActiveExecutable,
+ 16,
+ ExecutableName,
+ 198,
+ );
+ Frame = "{{0, 0}, {231, 548}}";
+ };
+ Tab5 = {
+ BreakpointsTreeTableConfiguration = (
+ breakpointColumn,
+ 178,
+ enabledColumn,
+ 31,
+ );
+ Frame = "{{0, 0}, {231, 548}}";
+ };
+ TabCount = 6;
+ TabsVisible = YES;
+ };
+ StatusViewVisible = YES;
+ Template = 64ABBB4501FA494900185B06;
+ ToolbarVisible = YES;
+ WindowLocation = "{5, 10}";
+ },
+ );
+ PBXWorkspaceStateSaveDate = 36016411;
+ };
+ projectwideBuildSettings = {
+ };
+ wantsIndex = 1;
+ wantsSCM = 0;
+ };
+}
diff --git a/pbproj/gcc3.pbproj/project.pbxproj b/pbproj/gcc3.pbproj/project.pbxproj
new file mode 100644
index 00000000000..d04c87abd7f
--- /dev/null
+++ b/pbproj/gcc3.pbproj/project.pbxproj
@@ -0,0 +1,191 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 39;
+ objects = {
+ 8928587D02108C4F0CCA2CB6 = {
+ buildArgumentsString = "$ACTION $ALL_SETTINGS";
+ buildPhases = (
+ );
+ buildSettings = {
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = gcc3;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ };
+ buildToolPath = /usr/bin/gnumake;
+ dependencies = (
+ );
+ isa = PBXLegacyTarget;
+ name = "B&I build and install";
+ passBuildSettingsInEnvironment = 1;
+ productName = "Full build and install";
+ settingsToExpand = 6;
+ settingsToPassInEnvironment = 287;
+ settingsToPassOnCommandLine = 280;
+ };
+//890
+//891
+//892
+//893
+//894
+//8C0
+//8C1
+//8C2
+//8C3
+//8C4
+ 8C18C7DB00C5722F06CA2AC8 = {
+ buildSettings = {
+ };
+ buildStyles = (
+ 8C864B2C00C575A806CA2AC8,
+ 8C956F6300C57A1506CA2AC8,
+ );
+ hasScannedForEncodings = 1;
+ isa = PBXProject;
+ mainGroup = 8C18C7DC00C5722F06CA2AC8;
+ productRefGroup = 8C864B2700C575A806CA2AC8;
+ projectDirPath = "";
+ targets = (
+ 8928587D02108C4F0CCA2CB6,
+ EE598EB2051F7D4C0002A5CC,
+ EE598EFC051F8B4C0002A5CC,
+ );
+ };
+ 8C18C7DC00C5722F06CA2AC8 = {
+ children = (
+ 8C18C7DD00C5731506CA2AC8,
+ 8C864B2700C575A806CA2AC8,
+ );
+ isa = PBXGroup;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 8C18C7DD00C5731506CA2AC8 = {
+ expectedFileType = folder;
+ fallbackIsa = PBXFileReference;
+ includeInIndex = 0;
+ isa = PBXFolderReference;
+ name = gcc3;
+ path = ..;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 8C864B2700C575A806CA2AC8 = {
+ children = (
+ EE598EB3051F7D4C0002A5CC,
+ );
+ isa = PBXGroup;
+ name = Products;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 8C864B2C00C575A806CA2AC8 = {
+ buildRules = (
+ );
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = s;
+ OPTIMIZATION_CFLAGS = "-O0";
+ ZERO_LINK = YES;
+ };
+ isa = PBXBuildStyle;
+ name = Development;
+ };
+ 8C956F6300C57A1506CA2AC8 = {
+ buildRules = (
+ );
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ ZERO_LINK = NO;
+ };
+ isa = PBXBuildStyle;
+ name = Deployment;
+ };
+//8C0
+//8C1
+//8C2
+//8C3
+//8C4
+//EE0
+//EE1
+//EE2
+//EE3
+//EE4
+ EE598EB1051F7D4C0002A5CC = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ isa = PBXShellScriptBuildPhase;
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# shell script goes here\ncd $BUILD_DIR\n$SRCROOT/../configure --enable-threads --enable-languages=c,c++,objc,objc++ --prefix=$DSTROOT\n\n";
+ };
+ EE598EB2051F7D4C0002A5CC = {
+ buildPhases = (
+ EE598EB1051F7D4C0002A5CC,
+ );
+ buildSettings = {
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = "Configuration Target";
+ REZ_EXECUTABLE = YES;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ };
+ dependencies = (
+ );
+ isa = PBXToolTarget;
+ name = "Configuration Target";
+ productInstallPath = /usr/local/bin;
+ productName = "Configuration Target";
+ productReference = EE598EB3051F7D4C0002A5CC;
+ };
+ EE598EB3051F7D4C0002A5CC = {
+ expectedFileType = "compiled.mach-o.executable";
+ includeInIndex = 0;
+ isa = PBXFileReference;
+ path = "Configuration Target";
+ refType = 3;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ EE598EFC051F8B4C0002A5CC = {
+ buildArgumentsString = "$(ACTION) -j2";
+ buildPhases = (
+ );
+ buildSettings = {
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = "Simple compiler build";
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ };
+ buildToolPath = /usr/bin/make;
+ buildWorkingDirectory = $BUILD_DIR;
+ dependencies = (
+ );
+ isa = PBXLegacyTarget;
+ name = "Simple compiler build";
+ passBuildSettingsInEnvironment = 1;
+ productName = "Simple compiler build";
+ settingsToExpand = 6;
+ settingsToPassInEnvironment = 287;
+ settingsToPassOnCommandLine = 280;
+ };
+ };
+ rootObject = 8C18C7DB00C5722F06CA2AC8;
+}
diff --git a/pbproj/gcc3.pbproj/spolk.pbxuser b/pbproj/gcc3.pbproj/spolk.pbxuser
new file mode 100644
index 00000000000..95cd3dafd2f
--- /dev/null
+++ b/pbproj/gcc3.pbproj/spolk.pbxuser
@@ -0,0 +1,370 @@
+// !$*UTF8*$!
+{
+ 8928587D02108C4F0CCA2CB6 = {
+ activeExec = 0;
+ };
+ 8C18C7DB00C5722F06CA2AC8 = {
+ activeBuildStyle = 8C864B2C00C575A806CA2AC8;
+ activeExecutable = EEB483E5051FA9DE00C73F14;
+ activeTarget = EE598EFC051F8B4C0002A5CC;
+ addToTargets = (
+ );
+ breakpoints = (
+ EEB483C7051F96E200C73F14,
+ );
+ codeSenseManager = EE598EAA051F7C710002A5CC;
+ executables = (
+ EE598EB4051F7D4C0002A5CC,
+ EE598EFF051F92590002A5CC,
+ EEB483E5051FA9DE00C73F14,
+ );
+ perUserDictionary = {
+ PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+ PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 22,
+ 761.7974,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXExecutablesDataSource_ActiveFlagID,
+ PBXExecutablesDataSource_NameID,
+ );
+ };
+ PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = -1;
+ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 20,
+ 523,
+ 20,
+ 95,
+ 43,
+ 43,
+ 20,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXFileDataSource_FiletypeID,
+ PBXFileDataSource_Filename_ColumnID,
+ PBXFileDataSource_Built_ColumnID,
+ PBXFileDataSource_ObjectSize_ColumnID,
+ PBXFileDataSource_Errors_ColumnID,
+ PBXFileDataSource_Warnings_ColumnID,
+ PBXFileDataSource_Target_ColumnID,
+ );
+ };
+ PBXConfiguration.PBXFileTableDataSource3.PBXFindDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+ PBXFileTableDataSourceColumnSortingKey = PBXFindDataSource_LocationID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 390.2974,
+ 393.2085,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXFindDataSource_MessageID,
+ PBXFindDataSource_LocationID,
+ );
+ };
+ PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 20,
+ 446,
+ 96,
+ 20,
+ 96,
+ 43,
+ 43,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXFileDataSource_FiletypeID,
+ PBXFileDataSource_Filename_ColumnID,
+ PBXTargetDataSource_PrimaryAttribute,
+ PBXFileDataSource_Built_ColumnID,
+ PBXFileDataSource_ObjectSize_ColumnID,
+ PBXFileDataSource_Errors_ColumnID,
+ PBXFileDataSource_Warnings_ColumnID,
+ );
+ };
+ PBXPerProjectTemplateStateSaveDate = 87524715;
+ PBXWorkspaceContents = (
+ {
+ PBXProjectWorkspaceModule_StateKey_Rev36 = {
+ PBXProjectWorkspaceModule_EditorOpen = false;
+ PBXProjectWorkspaceModule_EmbeddedNavigatorGroup = {
+ SplitCount = 1;
+ };
+ PBXProjectWorkspaceModule_OldDetailFrame = "{{0, 0}, {807, 634}}";
+ PBXProjectWorkspaceModule_OldEditorFrame = "{{0, 0}, {750, 480}}";
+ PBXProjectWorkspaceModule_OldSuperviewFrame = "{{182, 0}, {807, 634}}";
+ PBXProjectWorkspaceModule_RunWindowVisible = true;
+ PBXProjectWorkspaceModule_SCMWindowVisible = true;
+ PBXProjectWorkspaceModule_SGTM = {
+ PBXBottomSmartGroupGIDs = (
+ 1C37FBAC04509CD000000102,
+ 1C37FAAC04509CD000000102,
+ 1C08E77C0454961000C914BD,
+ 1CC0EA4004350EF90044410B,
+ 1CC0EA4004350EF90041110B,
+ 1C37FABC05509CD000000102,
+ 1C37FABC05539CD112110102,
+ 1C37FABC04509CD000100104,
+ );
+ PBXTopSmartGroupGIDs = (
+ );
+ };
+ };
+ },
+ );
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXBatchFindModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXBuildResultsModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXDebugCLIModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXDebugSessionModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXNavigatorGroup" = {
+ Split0 = {
+ bookmark = EE7F9785053785D1001B8D1B;
+ history = (
+ EE7F978005378595001B8D1B,
+ );
+ };
+ SplitCount = 1;
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXProjectWorkspaceModule" = {
+ PBXProjectWorkspaceModule_StateKey_Rev36 = {
+ PBXProjectWorkspaceModule_EditorOpen = true;
+ PBXProjectWorkspaceModule_EmbeddedNavigatorGroup = {
+ SplitCount = 1;
+ };
+ PBXProjectWorkspaceModule_OldDetailFrame = "{{0, 0}, {600, 115}}";
+ PBXProjectWorkspaceModule_OldEditorFrame = "{{0, 115}, {600, 186}}";
+ PBXProjectWorkspaceModule_OldSuperviewFrame = "{{0, 0}, {600, 301}}";
+ PBXProjectWorkspaceModule_SGTM = {
+ PBXBottomSmartGroupGIDs = (
+ );
+ PBXTopSmartGroupGIDs = (
+ );
+ };
+ };
+ };
+ PBXWorkspaceGeometries = (
+ {
+ Frame = "{{0, 0}, {989, 654}}";
+ PBXProjectWorkspaceModule_GeometryKey_Rev11 = {
+ PBXProjectWorkspaceModule_SGTM_Geometry = {
+ _collapsingFrameDimension = 0;
+ _indexOfCollapsedView = 0;
+ _percentageOfCollapsedView = 0;
+ sizes = (
+ "{{0, 0}, {182, 634}}",
+ "{{182, 0}, {807, 634}}",
+ );
+ };
+ };
+ WindowFrame = "{{50, 286}, {989, 716}}";
+ },
+ );
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXBatchFindModule" = {
+ Frame = "{{0, 0}, {543, 158}}";
+ WindowFrame = "{{273, 822}, {543, 158}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXBuildResultsModule" = {
+ Frame = "{{0, 0}, {750, 526}}";
+ WindowFrame = "{{418, 196}, {750, 604}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXDebugCLIModule" = {
+ Frame = "{{0, 0}, {400, 200}}";
+ WindowFrame = "{{50, 974}, {400, 222}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXDebugSessionModule" = {
+ DebugConsoleDrawerSize = "{100, 120}";
+ DebugConsoleVisible = Drawer;
+ DebugConsoleWindowFrame = "{{200, 200}, {500, 300}}";
+ DebugSTDIOWindowFrame = "{{61, 120}, {500, 300}}";
+ Frame = "{{0, 0}, {1195, 638}}";
+ WindowFrame = "{{21, 247}, {1195, 716}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXNavigatorGroup" = {
+ Frame = "{{0, 0}, {750, 480}}";
+ WindowFrame = "{{511, 375}, {750, 558}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXProjectWorkspaceModule" = {
+ Frame = "{{0, 0}, {600, 321}}";
+ PBXProjectWorkspaceModule_GeometryKey_Rev11 = {
+ GroupTreeCollapsed = yes;
+ PBXProjectWorkspaceModule_SGTM_Geometry = {
+ _collapsingFrameDimension = 182;
+ _indexOfCollapsedView = 0;
+ _percentageOfCollapsedView = 0.3033333;
+ sizes = (
+ "{{0, 0}, {600, 301}}",
+ );
+ };
+ };
+ WindowFrame = "{{485, 144}, {600, 383}}";
+ };
+ PBXWorkspaceStateSaveDate = 87524715;
+ };
+ sourceControlManager = EE598EA9051F7C710002A5CC;
+ userBuildSettings = {
+ };
+ };
+ EE02018005211E0D00ABC2E7 = {
+ expectedFileType = "compiled.mach-o.executable";
+ isa = PBXFileReference;
+ name = cc1;
+ path = "/Volumes/SandBox/spolk/Source/gcc/src.apple.com/pre-import/gcc3/pbproj/build/gcc/cc1";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ EE598EA9051F7C710002A5CC = {
+ isa = PBXSourceControlManager;
+ scmConfiguration = {
+ };
+ scmType = scm.cvs;
+ };
+ EE598EAA051F7C710002A5CC = {
+ indexTemplatePath = "";
+ isa = PBXCodeSenseManager;
+ usesDefaults = 0;
+ wantsCodeCompletion = 1;
+ wantsCodeCompletionAutoPopup = 0;
+ wantsCodeCompletionAutoSuggestions = 0;
+ wantsCodeCompletionCaseSensitivity = 1;
+ wantsCodeCompletionOnlyMatchingItems = 1;
+ wantsCodeCompletionParametersIncluded = 1;
+ wantsCodeCompletionPlaceholdersInserted = 1;
+ wantsCodeCompletionTabCompletes = 1;
+ wantsIndex = 1;
+ };
+ EE598EB2051F7D4C0002A5CC = {
+ activeExec = 0;
+ executables = (
+ EE598EB4051F7D4C0002A5CC,
+ );
+ };
+ EE598EB4051F7D4C0002A5CC = {
+ activeArgIndex = 2147483647;
+ activeArgIndices = (
+ );
+ argumentStrings = (
+ );
+ configStateDict = {
+ };
+ debuggerPlugin = GDBDebugging;
+ enableDebugStr = 1;
+ environmentEntries = (
+ );
+ isa = PBXExecutable;
+ name = "Configuration Target";
+ shlibInfoDictList = (
+ );
+ sourceDirectories = (
+ );
+ };
+ EE598EFC051F8B4C0002A5CC = {
+ activeExec = 0;
+ };
+ EE598EFF051F92590002A5CC = {
+ activeArgIndex = 0;
+ activeArgIndices = (
+ YES,
+ YES,
+ YES,
+ YES,
+ );
+ argumentStrings = (
+ "-B",
+ gcc,
+ ../hello.c,
+ "-v",
+ );
+ configStateDict = {
+ };
+ debuggerPlugin = GDBDebugging;
+ dylibVariantSuffix = "";
+ enableDebugStr = 1;
+ environmentEntries = (
+ );
+ isa = PBXExecutable;
+ launchableReference = EEB483D6051F97ED00C73F14;
+ name = Driver;
+ shlibInfoDictList = (
+ );
+ sourceDirectories = (
+ );
+ startupPath = "<<ProductDirectory>>";
+ };
+ EEB483C7051F96E200C73F14 = {
+ isa = PBXSymbolicBreakpoint;
+ state = 1;
+ symbolName = main;
+ };
+ EEB483D6051F97ED00C73F14 = {
+ expectedFileType = "compiled.mach-o.executable";
+ isa = PBXFileReference;
+ name = xgcc;
+ path = "/Volumes/SandBox/spolk/Source/gcc/src.apple.com/pre-import/gcc3/pbproj/build/gcc/xgcc";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ EEB483E5051FA9DE00C73F14 = {
+ activeArgIndex = 0;
+ activeArgIndices = (
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ YES,
+ );
+ argumentStrings = (
+ "-iprefix",
+ "gcc/../lib/gcc/ppc-apple-darwin7.0.0/3.3/",
+ "-isystem",
+ gcc/include,
+ "-D__GNUC__=3",
+ "-D__GNUC_MINOR__=3",
+ "-D__GNUC_PATHLEVEL__=0",
+ "-D__APPLE_CC__=9999",
+ "-D__DYNAMIC__",
+ ../hello.c,
+ "-fPIC",
+ "-dumpbase",
+ hello.c,
+ "-auxbase",
+ hello,
+ "-version",
+ "-o /var/tmp/foo.s",
+ );
+ configStateDict = {
+ };
+ debuggerPlugin = GDBDebugging;
+ dylibVariantSuffix = "";
+ enableDebugStr = 1;
+ environmentEntries = (
+ );
+ isa = PBXExecutable;
+ launchableReference = EE02018005211E0D00ABC2E7;
+ name = cc1;
+ shlibInfoDictList = (
+ );
+ sourceDirectories = (
+ );
+ };
+}
diff --git a/pbproj/gcc3.pbproj/zlaski.pbxuser b/pbproj/gcc3.pbproj/zlaski.pbxuser
new file mode 100644
index 00000000000..1ec0bc8873d
--- /dev/null
+++ b/pbproj/gcc3.pbproj/zlaski.pbxuser
@@ -0,0 +1,225 @@
+// !$*UTF8*$!
+{
+ 8928587D02108C4F0CCA2CB6 = {
+ activeExec = 0;
+ };
+ 8C18C7DB00C5722F06CA2AC8 = {
+ activeBuildStyle = 8C864B2C00C575A806CA2AC8;
+ activeTarget = 8928587D02108C4F0CCA2CB6;
+ breakpoints = (
+ C1BF887A0327FA7100C91839,
+ C15C8F870337D2B300C91839,
+ C14FA71B04201ADF00C91541,
+ C10B6401044B5EF200C91839,
+ C1D92266044DE56B00C91839,
+ C1351C4C0460A0F900C91839,
+ C144BAF204699A3100C91839,
+ C1DE69FD048698B600C91839,
+ C185E70C04D5C6D200C91839,
+ );
+ codeSenseManager = C12B2B0A049FDBCB00C91839;
+ perUserDictionary = {
+ PBXPerProjectTemplateStateSaveDate = 81722981;
+ PBXWorkspaceContents = (
+ {
+ },
+ );
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXBuildResultsModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXCVSModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXDebugSessionModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXNavigatorGroup" = {
+ NavContent0 = {
+ bookmark = C12B2B12049FE27600C91839;
+ history = (
+ C12B2B0D049FDC0000C91839,
+ );
+ };
+ NavCount = 1;
+ NavGeometry0 = {
+ Frame = "{{0, 0}, {750, 460}}";
+ NavBarVisible = YES;
+ WindowFrame = "{{339, 87}, {750, 558}}";
+ };
+ NavSplitVertical = NO;
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXProjectWorkspaceModule" = {
+ };
+ "PBXWorkspaceContents:PBXConfiguration.PBXModule.PBXRunSessionModule" = {
+ };
+ PBXWorkspaceGeometries = (
+ {
+ Frame = "{{0, 0}, {959, 800}}";
+ WindowFrame = "{{322, 111}, {959, 878}}";
+ },
+ );
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXBuildResultsModule" = {
+ Frame = "{{0, 0}, {480, 216}}";
+ WindowFrame = "{{402, 521}, {480, 294}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXCVSModule" = {
+ Frame = "{{0, 0}, {480, 192}}";
+ WindowFrame = "{{402, 561}, {480, 214}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXDebugSessionModule" = {
+ DebugConsoleDrawerSize = "{100, 120}";
+ DebugConsoleVisible = None;
+ DebugConsoleWindowFrame = "{{200, 200}, {500, 300}}";
+ DebugSTDIOWindowFrame = "{{200, 200}, {500, 300}}";
+ Frame = "{{0, 0}, {745, 442}}";
+ WindowFrame = "{{269, 408}, {745, 520}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXNavigatorGroup" = {
+ Frame = "{{0, 0}, {750, 480}}";
+ WindowFrame = "{{339, 87}, {750, 558}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXProjectWorkspaceModule" = {
+ Frame = "{{0, 0}, {959, 800}}";
+ WindowFrame = "{{444, -403}, {959, 878}}";
+ };
+ "PBXWorkspaceGeometries:PBXConfiguration.PBXModule.PBXRunSessionModule" = {
+ Frame = "{{0, 0}, {745, 442}}";
+ WindowFrame = "{{269, 436}, {745, 464}}";
+ };
+ PBXWorkspaceStateSaveDate = 81722981;
+ };
+ projectwideBuildSettings = {
+ };
+ sourceControlManager = C1351A7F045F217400C91839;
+ wantsSCM = -1;
+ };
+ C10B6401044B5EF200C91839 = {
+ fileReference = C10B6402044B5F1000C91839;
+ isa = PBXFileBreakpoint;
+ lineNumber = 234;
+ state = 1;
+ };
+ C10B6402044B5F1000C91839 = {
+ isa = PBXFileReference;
+ name = "objcp-decl.c";
+ path = "/Volumes/DATA2/Dev/WC/apple/pre-import-2003-02-13/gcc3/gcc/objcp/objcp-decl.c";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ C12B2B0A049FDBCB00C91839 = {
+ indexTemplatePath = "";
+ isa = PBXCodeSenseManager;
+ usesDefaults = 1;
+ wantsCodeCompletion = 1;
+ wantsCodeCompletionAutoPopup = 0;
+ wantsCodeCompletionAutoSuggestions = 0;
+ wantsCodeCompletionCaseSensitivity = 1;
+ wantsCodeCompletionOnlyMatchingItems = 1;
+ wantsCodeCompletionParametersIncluded = 1;
+ wantsCodeCompletionPlaceholdersInserted = 1;
+ wantsCodeCompletionTabCompletes = 1;
+ wantsIndex = 1;
+ };
+ C1351A7F045F217400C91839 = {
+ isa = PBXSourceControlManager;
+ scmConfiguration = {
+ };
+ scmType = "";
+ };
+ C1351C4C0460A0F900C91839 = {
+ fileReference = C14FA7A60421803700C91541;
+ isa = PBXFileBreakpoint;
+ lineNumber = 6020;
+ state = 1;
+ };
+ C144BAF204699A3100C91839 = {
+ fileReference = C14FA7A60421803700C91541;
+ isa = PBXFileBreakpoint;
+ lineNumber = 3306;
+ state = 1;
+ };
+ C14FA71B04201ADF00C91541 = {
+ fileReference = C14FA71C04201AED00C91541;
+ isa = PBXFileBreakpoint;
+ lineNumber = 1269;
+ state = 1;
+ };
+ C14FA71C04201AED00C91541 = {
+ expectedFileType = sourcecode.c.c;
+ isa = PBXFileReference;
+ name = spew.c;
+ path = "/Volumes/DATA2/Dev/WC/apple/pre-import-2003-02-13/gcc3/gcc/cp/spew.c";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ C14FA7A60421803700C91541 = {
+ expectedFileType = sourcecode.c.c;
+ isa = PBXFileReference;
+ name = "objc-act.c";
+ path = "/Volumes/DATA2/Dev/WC/apple/pre-import-2003-02-13/gcc3/gcc/objc/objc-act.c";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ C15C8F870337D2B300C91839 = {
+ fileReference = C15C8F880337D2C100C91839;
+ isa = PBXFileBreakpoint;
+ lineNumber = 230;
+ state = 2;
+ };
+ C15C8F880337D2C100C91839 = {
+ isa = PBXFileReference;
+ name = "objcp-decl.c";
+ path = "/Volumes/DATA2/Dev/WC/darwin/HEAD/gcc3/gcc/objcp/objcp-decl.c";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ C185E70C04D5C6D200C91839 = {
+ fileReference = C185E70D04D5C6F000C91839;
+ isa = PBXFileBreakpoint;
+ lineNumber = 504;
+ state = 1;
+ };
+ C185E70D04D5C6F000C91839 = {
+ isa = PBXFileReference;
+ name = next_mapping.h;
+ path = "/Volumes/DATA2/Dev/WC/apple/pre-import-2003-02-13/gcc3/gcc/testsuite/objc/execute/next_mapping.h";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ C1BF887A0327FA7100C91839 = {
+ fileReference = C1BF887B0327FA9100C91839;
+ isa = PBXFileBreakpoint;
+ lineNumber = 1626;
+ state = 2;
+ };
+ C1BF887B0327FA9100C91839 = {
+ isa = PBXFileReference;
+ name = darwin.c;
+ path = /Volumes/DATA2/Dev/WC/darwin/HEAD/gcc3/gcc/config/darwin.c;
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ C1D92266044DE56B00C91839 = {
+ fileReference = C1D92267044DE58900C91839;
+ isa = PBXFileBreakpoint;
+ lineNumber = 745;
+ state = 1;
+ };
+ C1D92267044DE58900C91839 = {
+ isa = PBXFileReference;
+ name = dbxout.c;
+ path = "/Volumes/DATA2/Dev/WC/apple/pre-import-2003-02-13/gcc3/gcc/dbxout.c";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ C1DE69FD048698B600C91839 = {
+ fileReference = C1DE69FE048698D400C91839;
+ isa = PBXFileBreakpoint;
+ lineNumber = 47;
+ state = 1;
+ };
+ C1DE69FE048698D400C91839 = {
+ isa = PBXFileReference;
+ name = "encode-3.m";
+ path = "/Volumes/DATA2/Dev/WC/apple/pre-import-2003-02-13/gcc3/gcc/testsuite/objc.dg/encode-3.m";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+}